Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mpath

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mpath - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

2

component.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc