🚀 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.3.0

.github/workflows/ci.yml

26

bin/dot-json.js

@@ -10,2 +10,3 @@ #!/usr/bin/env node

,package_ = require('../package.json')
,parseValue = require('../lib/parse-value')
;

@@ -15,3 +16,3 @@

'<file> <key-path>',
'<file> <key-path> <value> [--indent=<n|auto>]',
'<file> <key-path> <value> [--indent=<n|auto>] [--json-value]',
'<file> <key-path> --delete',

@@ -23,2 +24,3 @@ ];

'-d --delete Delete the key-path',
'-j --json-value Parse the input value as a JSON string (to set whole objects or arrays)',
'-h --help Show this message with options',

@@ -37,25 +39,5 @@ '-v --version Print the version number',

if (args['<value>']) {
var value = args['<value>'];
var value = parseValue(args['<value>'], args['--json-value']);
var indent = args['--indent'];
switch(value) {
case 'true':
value = true;
break;
case 'false':
value = false;
break;
case 'undefined':
value = undefined;
break;
case 'null':
value = null;
break;
}
if (value == parseInt(value)) {
value = parseInt(value);
}
else if(value == parseFloat(value)) {
value = parseFloat(value);
}
try {

@@ -62,0 +44,0 @@ dot_json.set(args['<key-path>'], value);

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

catch (e) {
_this._indent = 2
_this._indent = ' ';
}

@@ -62,0 +62,0 @@ }

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

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

# dot-json
[![Build Status](https://travis-ci.org/maikelvl/dot-json.svg?branch=master)](https://travis-ci.org/maikelvl/dot-json)
[![huntr](https://cdn.huntr.dev/huntr_security_badge_mono.svg)](https://huntr.dev)
---

@@ -13,3 +15,3 @@

```bash
npm install --save dot-json
npm install dot-json
```

@@ -21,2 +23,3 @@ ### Use from the CLI

dot-json myfile.json foo..bar baz
dot-json myfile.json address '{"city":"Atlantis"}' --json-value
```

@@ -30,3 +33,6 @@ myfile.json now looks like

},
"foo.bar": "baz"
"foo.bar": "baz",
"address": {
"city": "Atlantis"
}
}

@@ -46,6 +52,7 @@ ```

Options:
--indent=<n> Indent with <n> of white space characters [default: auto]
-d --delete Delete the key-path
-h --help Show this message with options
-v --version Print the version number
--indent=<n> Indent with <n> of white space characters [default: auto] [--json-value]
-d --delete Delete the key-path
-j --json-value Parse the input value as a JSON string (to set whole objects or arrays)
-h --help Show this message with options
-v --version Print the version number
```

@@ -52,0 +59,0 @@

@@ -735,3 +735,3 @@ var expect = require('chai').expect;

it("should be use 2 spaces indents by default when creating new file", function() {
it("should use 2 spaces indents by default when creating new file", function() {
var myfile = new DotJson(dir+'/new-2-space-indent-test.json');

@@ -738,0 +738,0 @@ myfile.set('user.name', 'John Doe').set('user.email', 'john@example.com');