Comparing version 0.2.0 to 0.2.1
{ | ||
"name": "mpath", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"main": "lib/index.js", | ||
@@ -5,0 +5,0 @@ "scripts": [ |
0.2.1 / 2013-03-22 | ||
================== | ||
* test; added for #5 | ||
* fix typo that breaks set #5 [Contra](https://github.com/Contra) | ||
0.2.0 / 2013-03-15 | ||
@@ -3,0 +9,0 @@ ================== |
@@ -1,2 +0,1 @@ | ||
/** | ||
@@ -203,3 +202,3 @@ * Returns the value of object `o` at the given `path`. | ||
if (lookup) { | ||
lookup(item, part, map(val)); | ||
lookup(obj, part, map(val)); | ||
} else { | ||
@@ -206,0 +205,0 @@ obj[part] = map(val); |
{ | ||
"name": "mpath", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "{G,S}et object values using MongoDB-like path notation", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -1662,16 +1662,33 @@ | ||
describe('that is a function', function(){ | ||
it('works without map', function(done){ | ||
var o = { hello: { world: [{ how: 'are' }, { you: '?' }] }}; | ||
var special = function (obj, key, val) { | ||
if (val) { | ||
obj[key] = val; | ||
} else { | ||
return 'thing' == key | ||
? obj.world | ||
: obj[key] | ||
describe('without map', function(){ | ||
it('works on array value', function(done){ | ||
var o = { hello: { world: [{ how: 'are' }, { you: '?' }] }}; | ||
var special = function (obj, key, val) { | ||
if (val) { | ||
obj[key] = val; | ||
} else { | ||
return 'thing' == key | ||
? obj.world | ||
: obj[key] | ||
} | ||
} | ||
} | ||
mpath.set('hello.thing.how', 'arrrr', o, special); | ||
assert.deepEqual(o, { hello: { world: [{ how: 'arrrr' }, { you: '?', how: 'arrrr' }] }}); | ||
done(); | ||
mpath.set('hello.thing.how', 'arrrr', o, special); | ||
assert.deepEqual(o, { hello: { world: [{ how: 'arrrr' }, { you: '?', how: 'arrrr' }] }}); | ||
done(); | ||
}) | ||
it('works on non-array value', function(done){ | ||
var o = { hello: { world: { how: 'are you' }}}; | ||
var special = function (obj, key, val) { | ||
if (val) { | ||
obj[key] = val; | ||
} else { | ||
return 'thing' == key | ||
? obj.world | ||
: obj[key] | ||
} | ||
} | ||
mpath.set('hello.thing.how', 'RU', o, special); | ||
assert.deepEqual(o, { hello: { world: { how: 'RU' }}}); | ||
done(); | ||
}) | ||
}) | ||
@@ -1678,0 +1695,0 @@ it('works with map', function(done){ |
Sorry, the diff of this file is not supported yet
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
84344
1841