Last active
June 9, 2018 01:01
-
-
Save Spencer-Dawson/230f10f28402c664e94b4cf062189d66 to your computer and use it in GitHub Desktop.
Object.values() browser polyfill
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
if (!Object.values) { | |
Object.defineProperty(Object, 'values', { | |
enumerable: false, | |
configurable: true, | |
writable: true, | |
value: function(target) { | |
var res = []; | |
for (var i in target) { | |
if (target.hasOwnProperty(i)) { | |
res.push(target[i]); | |
} | |
} | |
return res; | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment