From 613d4ed8663d83fdb7cc476259d740fda98034ae Mon Sep 17 00:00:00 2001 From: Sean Hamilton Date: Thu, 29 Nov 2018 16:41:58 +0000 Subject: [PATCH] feat(is): add is function --- src/is.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/is.js diff --git a/src/is.js b/src/is.js new file mode 100644 index 00000000..c1b166f4 --- /dev/null +++ b/src/is.js @@ -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;