🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

dot-json

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dot-json - npm Package Compare versions

Comparing version

to
1.2.1

myfile.json

2

lib/dot-json.js

@@ -140,3 +140,3 @@ var path = require('path');

this._setValueForKeyPath = function(key_path, value) {
var key_array = key_path.split('.');
var key_array = key_path.replace('..', '').split('.');
var tip_key = key_array.pop();

@@ -143,0 +143,0 @@ var parent_path = key_array.join('.');

{
"name": "dot-json",
"version": "1.2.0",
"version": "1.2.1",
"description": "Easily edit a json file from the CLI or NodeJS",

@@ -5,0 +5,0 @@ "main": "lib/dot-json.js",

@@ -19,2 +19,3 @@ # dot-json

dot-json myfile.json user.email "john@example.com"
dot-json myfile.json foo..bar baz
```

@@ -27,3 +28,4 @@ myfile.json now looks like

"email": "john@example.com"
}
},
"foo.bar": "baz"
}

@@ -30,0 +32,0 @@ ```

@@ -314,2 +314,8 @@ var expect = require('chai').expect;

it("should be able to set a dotted property on object", function() {
var dot_json = new DotJson();
dot_json.set("foo..bar", "baz");
expect(JSON.stringify(dot_json._object)).equal(JSON.stringify({"foo.bar": "baz"}));
});
it("should be able to set a property on a prepared key path", function() {

@@ -316,0 +322,0 @@ var dot_json = new DotJson();