Skip to content

Instantly share code, notes, and snippets.

@Spencer-Dawson
Last active June 9, 2018 01:01
Show Gist options
  • Save Spencer-Dawson/230f10f28402c664e94b4cf062189d66 to your computer and use it in GitHub Desktop.
Save Spencer-Dawson/230f10f28402c664e94b4cf062189d66 to your computer and use it in GitHub Desktop.
Object.values() browser polyfill
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