Skip to content

Instantly share code, notes, and snippets.

@metavoid
Last active February 10, 2019 21:33
Show Gist options
  • Select an option

  • Save metavoid/ef9b7338aefc3fd3c2652a3f78f6e6c2 to your computer and use it in GitHub Desktop.

Select an option

Save metavoid/ef9b7338aefc3fd3c2652a3f78f6e6c2 to your computer and use it in GitHub Desktop.
Some useful JS utils, part 1
//Some useful JS utils, part 1
deepClone: function (obj) {
return JSON.parse(JSON.stringify(obj))
},
uniqueArray: function(array) {
return array.filter(function(item, pos, self) {
return self.indexOf(item) == pos;
});
},
isObject: function(item) {
return (item && typeof item === 'object' && !Array.isArray(item));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment