Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: hughsk/flat
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 5.0.0
Choose a base ref
...
head repository: hughsk/flat
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 5.0.2
Choose a head ref
  • 12 commits
  • 5 files changed
  • 5 contributors

Commits on Oct 22, 2019

  1. Copy the full SHA
    6e95c43 View commit details

Commits on Aug 6, 2020

  1. Copy the full SHA
    e8fb281 View commit details
  2. Fix prototype pollution on unflatten

    Fixes #105.
    MatthiasKunnen authored and timoxley committed Aug 6, 2020
    Copy the full SHA
    20ef0ef View commit details
  3. Bump acorn from 7.1.0 to 7.4.0

    Bumps [acorn](https://github.com/acornjs/acorn) from 7.1.0 to 7.4.0.
    - [Release notes](https://github.com/acornjs/acorn/releases)
    - [Commits](acornjs/acorn@7.1.0...7.4.0)
    
    Signed-off-by: dependabot[bot] <[email protected]>
    dependabot[bot] authored and timoxley committed Aug 6, 2020
    Copy the full SHA
    a61a554 View commit details
  4. Bump lodash from 4.17.15 to 4.17.19

    Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19.
    - [Release notes](https://github.com/lodash/lodash/releases)
    - [Commits](lodash/lodash@4.17.15...4.17.19)
    
    Signed-off-by: dependabot[bot] <[email protected]>
    dependabot[bot] authored and timoxley committed Aug 6, 2020
    Copy the full SHA
    2eea6d3 View commit details
  5. drop dependencies

    43081j authored and timoxley committed Aug 6, 2020
    Copy the full SHA
    779816e View commit details
  6. use standard formatting

    43081j authored and timoxley committed Aug 6, 2020
    Copy the full SHA
    54cc7ad View commit details
  7. Release 5.0.1

    timoxley committed Aug 6, 2020
    Copy the full SHA
    f25d3a1 View commit details
  8. Avoid arrow function syntax.

    andornaut authored and timoxley committed Aug 6, 2020
    Copy the full SHA
    0189cb1 View commit details
  9. Test against node 14 in CI.

    timoxley committed Aug 6, 2020
    Copy the full SHA
    e52185d View commit details
  10. Copy the full SHA
    fdb79d5 View commit details
  11. Release 5.0.2

    timoxley committed Aug 6, 2020
    Copy the full SHA
    e5ffd66 View commit details
Showing with 913 additions and 406 deletions.
  1. +3 −0 .travis.yml
  2. +12 −3 index.js
  3. +880 −397 package-lock.json
  4. +4 −6 package.json
  5. +14 −0 test/test.js
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -3,3 +3,6 @@ node_js:
- "6"
- "7"
- "8"
- "10"
- "12"
- "14"
15 changes: 12 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -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]' ||
Loading