Comparing version 1.2.0 to 1.2.1
@@ -83,3 +83,3 @@ var flat = module.exports = { | ||
// unflatten again for 'messy objects' | ||
recipient[key1] = unflatten(target[key]) | ||
recipient[key1] = unflatten(target[key], opts) | ||
}) | ||
@@ -86,0 +86,0 @@ |
{ | ||
"name": "flat", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -240,2 +240,9 @@ var assert = require('assert') | ||
test('Should create object instead of array when true', function() { | ||
var unflattened = unflatten({ | ||
'hello.you.0': 'ipsum', | ||
'hello.you.1': 'lorem', | ||
'hello.other.world': 'foo' | ||
}, { | ||
object: true | ||
}); | ||
assert.deepEqual({ | ||
@@ -249,20 +256,30 @@ hello: { | ||
} | ||
}, unflatten( | ||
{ | ||
'hello.you.0': 'ipsum', | ||
'hello.you.1': 'lorem', | ||
'hello.other.world': 'foo' | ||
}, unflattened); | ||
assert(!Array.isArray(unflattened.hello.you)); | ||
}) | ||
test('Should create object instead of array when nested', function() { | ||
var unflattened = unflatten({ | ||
'hello': { | ||
'you.0': 'ipsum', | ||
'you.1': 'lorem', | ||
'other.world': 'foo' | ||
} | ||
}, { | ||
object: true | ||
})) | ||
}) | ||
test('Should not create object when false', function() { | ||
}); | ||
assert.deepEqual({ | ||
hello: { | ||
you: ['ipsum', 'lorem'], | ||
you: { | ||
0: 'ipsum', | ||
1: 'lorem', | ||
}, | ||
other: { world: 'foo' } | ||
} | ||
}, unflatten( | ||
{ | ||
}, unflattened); | ||
assert(!Array.isArray(unflattened.hello.you)); | ||
}) | ||
test('Should not create object when false', function() { | ||
var unflattened = unflatten({ | ||
'hello.you.0': 'ipsum', | ||
@@ -273,3 +290,10 @@ 'hello.you.1': 'lorem', | ||
object: false | ||
})) | ||
}); | ||
assert.deepEqual({ | ||
hello: { | ||
you: ['ipsum', 'lorem'], | ||
other: { world: 'foo' } | ||
} | ||
}, unflattened); | ||
assert(Array.isArray(unflattened.hello.you)); | ||
}) | ||
@@ -276,0 +300,0 @@ }) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11682
384