Skip to content

Instantly share code, notes, and snippets.

@sscotth
Last active April 5, 2017 07:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sscotth/84d39d399add27aeb48a7d8a3bfa59e2 to your computer and use it in GitHub Desktop.
Save sscotth/84d39d399add27aeb48a7d8a3bfa59e2 to your computer and use it in GitHub Desktop.
const clone = thing => Array.isArray(thing) ? [...thing] : Object(thing) === thing ? {...thing} : thing
@sscotth
Copy link
Author

sscotth commented Mar 28, 2017

lodash v4.17.4

function isObject(value) {
    var type = typeof value;
    return value != null && (type == 'object' || type == 'function');
}

underscore v1.8.3

_.isObject = function(obj) {
    var type = typeof obj;
    return type === 'function' || type === 'object' && !!obj;
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment