Comparing version
15
index.js
@@ -1,3 +0,1 @@ | ||
var isBuffer = require('is-buffer') | ||
module.exports = flatten | ||
@@ -7,2 +5,9 @@ flatten.flatten = flatten | ||
function isBuffer (obj) { | ||
return obj && | ||
obj.constructor && | ||
(typeof obj.constructor.isBuffer === 'function') && | ||
obj.constructor.isBuffer(obj) | ||
} | ||
function keyIdentity (key) { | ||
@@ -98,3 +103,3 @@ return key | ||
target = Object.keys(target).reduce((result, key) => { | ||
target = Object.keys(target).reduce(function (result, key) { | ||
const type = Object.prototype.toString.call(target[key]) | ||
@@ -121,2 +126,6 @@ const isObject = (type === '[object Object]' || type === '[object Array]') | ||
while (key2 !== undefined) { | ||
if (key1 === '__proto__') { | ||
return | ||
} | ||
const type = Object.prototype.toString.call(recipient[key1]) | ||
@@ -123,0 +132,0 @@ const isobject = ( |
{ | ||
"name": "flat", | ||
"version": "5.0.0", | ||
"version": "5.0.2", | ||
"main": "index.js", | ||
@@ -12,4 +12,4 @@ "bin": "cli.js", | ||
"devDependencies": { | ||
"mocha": "~6.2.2", | ||
"standard": "^14.3.1" | ||
"mocha": "~8.1.1", | ||
"standard": "^14.3.4" | ||
}, | ||
@@ -19,5 +19,3 @@ "directories": { | ||
}, | ||
"dependencies": { | ||
"is-buffer": "~2.0.4" | ||
}, | ||
"dependencies": {}, | ||
"repository": { | ||
@@ -24,0 +22,0 @@ "type": "git", |
@@ -534,2 +534,16 @@ /* globals suite test */ | ||
} | ||
test('should not pollute prototype', function () { | ||
unflatten({ | ||
'__proto__.polluted': true | ||
}) | ||
unflatten({ | ||
'prefix.__proto__.polluted': true | ||
}) | ||
unflatten({ | ||
'prefix.0.__proto__.polluted': true | ||
}) | ||
assert.notStrictEqual({}.polluted, true) | ||
}) | ||
}) | ||
@@ -536,0 +550,0 @@ |
Sorry, the diff of this file is not supported yet
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
26578
1.81%0
-100%759
2.71%0
-100%- Removed
- Removed