Last active
February 10, 2019 21:33
-
-
Save metavoid/ef9b7338aefc3fd3c2652a3f78f6e6c2 to your computer and use it in GitHub Desktop.
Some useful JS utils, part 1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //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