forked from daren.hsu/line_push
update
This commit is contained in:
+3
@@ -3,3 +3,6 @@ node_js:
|
||||
- "6"
|
||||
- "7"
|
||||
- "8"
|
||||
- "10"
|
||||
- "12"
|
||||
- "14"
|
||||
|
||||
+12
-3
@@ -1,9 +1,14 @@
|
||||
var isBuffer = require('is-buffer')
|
||||
|
||||
module.exports = flatten
|
||||
flatten.flatten = flatten
|
||||
flatten.unflatten = unflatten
|
||||
|
||||
function isBuffer (obj) {
|
||||
return obj &&
|
||||
obj.constructor &&
|
||||
(typeof obj.constructor.isBuffer === 'function') &&
|
||||
obj.constructor.isBuffer(obj)
|
||||
}
|
||||
|
||||
function keyIdentity (key) {
|
||||
return key
|
||||
}
|
||||
@@ -94,7 +99,7 @@ function unflatten (target, opts) {
|
||||
}
|
||||
}
|
||||
|
||||
target = Object.keys(target).reduce((result, key) => {
|
||||
target = Object.keys(target).reduce(function (result, key) {
|
||||
const type = Object.prototype.toString.call(target[key])
|
||||
const isObject = (type === '[object Object]' || type === '[object Array]')
|
||||
if (!isObject || isEmpty(target[key])) {
|
||||
@@ -116,6 +121,10 @@ function unflatten (target, opts) {
|
||||
let recipient = result
|
||||
|
||||
while (key2 !== undefined) {
|
||||
if (key1 === '__proto__') {
|
||||
return
|
||||
}
|
||||
|
||||
const type = Object.prototype.toString.call(recipient[key1])
|
||||
const isobject = (
|
||||
type === '[object Object]' ||
|
||||
|
||||
+15
-17
@@ -1,32 +1,32 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"flat@5.0.0",
|
||||
"/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series"
|
||||
"flat@5.0.2",
|
||||
"/home/node/nuxt"
|
||||
]
|
||||
],
|
||||
"_from": "flat@5.0.0",
|
||||
"_id": "flat@5.0.0",
|
||||
"_from": "flat@5.0.2",
|
||||
"_id": "flat@5.0.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-6KSMM+cHHzXC/hpldXApL2S8Uz+QZv+tq5o/L0KQYleoG+GcwrnIJhTWC7tCOiKQp8D/fIvryINU1OZCCwevjA==",
|
||||
"_integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==",
|
||||
"_location": "/flat",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "flat@5.0.0",
|
||||
"raw": "flat@5.0.2",
|
||||
"name": "flat",
|
||||
"escapedName": "flat",
|
||||
"rawSpec": "5.0.0",
|
||||
"rawSpec": "5.0.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "5.0.0"
|
||||
"fetchSpec": "5.0.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/rc9"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/flat/-/flat-5.0.0.tgz",
|
||||
"_spec": "5.0.0",
|
||||
"_where": "/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series",
|
||||
"_resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz",
|
||||
"_spec": "5.0.2",
|
||||
"_where": "/home/node/nuxt",
|
||||
"author": {
|
||||
"name": "Hugh Kennedy",
|
||||
"email": "hughskennedy@gmail.com",
|
||||
@@ -38,13 +38,11 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/hughsk/flat/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"is-buffer": "~2.0.4"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Take a nested Javascript object and flatten it, or unflatten an object with delimited keys",
|
||||
"devDependencies": {
|
||||
"mocha": "~6.2.2",
|
||||
"standard": "^14.3.1"
|
||||
"mocha": "~8.1.1",
|
||||
"standard": "^14.3.4"
|
||||
},
|
||||
"directories": {
|
||||
"test": "test"
|
||||
@@ -69,5 +67,5 @@
|
||||
"scripts": {
|
||||
"test": "mocha -u tdd --reporter spec && standard cli.js index.js test/index.js"
|
||||
},
|
||||
"version": "5.0.0"
|
||||
"version": "5.0.2"
|
||||
}
|
||||
|
||||
+14
@@ -531,6 +531,20 @@ suite('Unflatten', function () {
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
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)
|
||||
})
|
||||
})
|
||||
|
||||
suite('Arrays', function () {
|
||||
|
||||
Reference in New Issue
Block a user