Skip to content
This repository has been archived by the owner on Dec 15, 2021. It is now read-only.

Commit

Permalink
feat(has): Add module has
Browse files Browse the repository at this point in the history
Checks if an object has assigned a value to a property. Note that it will also return true to
has('foo', { foo: undefined }).
  • Loading branch information
adambrgmn committed Jan 16, 2018
1 parent bb7bbfa commit 51e1105
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/__tests__/has.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import has from '../has';

test('Core.has', () => {
expect(has('foo', { foo: 1 })).toBeTruthy();
expect(has('foo', { foo: undefined })).toBeTruthy();
expect(has('foo', {})).toBeFalsy();
});
1 change: 1 addition & 0 deletions src/has.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default (prop, obj) => Object.prototype.hasOwnProperty.call(obj, prop);
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import curry from './curry';
import filter from './filter';
import find from './find';
import findIndex from './findIndex';
import has from './has';
import head from './head';
import is from './is';
import isArray from './isArray';
Expand Down Expand Up @@ -37,6 +38,7 @@ export {
filter,
find,
findIndex,
has,
head,
is,
isArray,
Expand Down

0 comments on commit 51e1105

Please sign in to comment.