diff --git a/lib/utils.js b/lib/utils.js index fba56c8..c738f0e 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -68,9 +68,8 @@ exports.cloneObject = function cloneObject(obj, options) { var ret = {}; var hasKeys; var val; - var k; - for (k in obj) { + for (const k of Object.keys(obj)) { // Not technically prototype pollution because this wouldn't merge properties // onto `Object.prototype`, but avoid properties like __proto__ as a precaution. if (specialProperties.indexOf(k) !== -1) { @@ -295,13 +294,7 @@ exports.isArray = function(arg) { * Object.keys helper */ -exports.keys = Object.keys || function(obj) { - var keys = []; - for (var k in obj) if (obj.hasOwnProperty(k)) { - keys.push(k); - } - return keys; -}; +exports.keys = Object.keys; /** * Basic Object.create polyfill.