Skip to content

Commit

Permalink
feat(is): add is function
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Hamilton committed Nov 29, 2018
1 parent 066da0d commit 613d4ed
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/is.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* Check if the specified value is an object
*
* @param {*} value The value to check
*
* @returns {boolean} Whether it is an object
*/
function is(value) {
// check if the value is an instance of Object
return value instanceof Object
// check if the value constructor is Object
&& value.constructor === Object;
// if both match the value is truly an object
}

export default is;

0 comments on commit 613d4ed

Please # to comment.