New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gulp-json-editor

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-json-editor - npm Package Compare versions

Comparing version 2.2.2 to 2.3.0

.travis.yml

6

CHANGELOG.md

@@ -0,1 +1,7 @@

## 2.3.0
### Added
- New option 'beautify' (default: true) to disable beautification if necessary
## 2.2.2

@@ -2,0 +8,0 @@

8

index.js

@@ -35,5 +35,2 @@ /* jshint node: true */

// always beautify output
var beautify = true;
/*

@@ -64,8 +61,9 @@ create through object and return it

beautifyOptions.indent_char = beautifyOptions.indent_char || (indent.type === 'tab' ? '\t' : ' ');
beautifyOptions.beautify = !('beautify' in beautifyOptions && !beautifyOptions.beautify);
// edit JSON object and get it as string notation
var json = JSON.stringify(editBy(JSON.parse(file.contents.toString('utf8'))), null, indent.indent);
var json = JSON.stringify(editBy(JSON.parse(file.contents.toString('utf8'))));
// beautify JSON
if (beautify) {
if (beautifyOptions.beautify) {
json = jsbeautify(json, beautifyOptions);

@@ -72,0 +70,0 @@ }

{
"name": "gulp-json-editor",
"version": "2.2.2",
"version": "2.3.0",
"description": "A gulp plugin to edit JSON object",

@@ -26,3 +26,3 @@ "license": "MIT",

"dependencies": {
"deepmerge": "^2.0.1",
"deepmerge": "^2.1.0",
"detect-indent": "^5.0.0",

@@ -35,3 +35,3 @@ "js-beautify": "^1.7.5",

"gulp": "^4.0.0",
"mocha": "^5.0.1",
"mocha": "^5.0.5",
"should": "^13.2.1",

@@ -38,0 +38,0 @@ "vinyl": "^2.1.0"

# gulp-json-editor
gulp-json-editor is a [gulp](https://github.com/wearefractal/gulp) plugin to edit JSON object.
[![Greenkeeper badge](https://badges.greenkeeper.io/rejas/gulp-json-editor.svg)](https://greenkeeper.io/)
[![Build Status](https://secure.travis-ci.org/rejas/gulp-json-editor.png?branch=master)](https://travis-ci.org/rejas/gulp-json-editor)
gulp-json-editor is a [gulp](https://github.com/gulpjs/gulp) plugin to edit JSON object.
## Usage

@@ -46,2 +49,16 @@ ```javascript

### Disable beautification
```javascript
gulp.src("./manifest.json")
.pipe(jeditor({
'version': '1.2.3'
},
{
beautify: false
}))
.pipe(gulp.dest("./dest"));
```
## API

@@ -71,2 +88,2 @@ ### jeditor(editorObject, [jsBeautifyOptions])

## License
[MIT License](http://en.wikipedia.org/wiki/MIT_License)
[MIT License](http://en.wikipedia.org/wiki/MIT_License)

@@ -93,1 +93,25 @@ /* jshint node: true */

});
it('should bypass beautification when property is set', function(done) {
var stream = gulp.src('test/test.json').pipe(json({
version: '2.0.0',
description: 'this is test',
array: [
'1234567890', '1234567890', '1234567890', '1234567890', '1234567890', '1234567890', '1234567890', '1234567890'
],
nested: {
version: '2.0.1',
description: 'this is test for nested'
}
},
{
beautify: false
}));
stream.on('data', function(file) {
var expected = '{"name":"test object","version":"2.0.0","nested":{"name":"nested object","version":"2.0.1","description":"this is test for nested"},"description":"this is test","array":["1234567890","1234567890","1234567890","1234567890","1234567890","1234567890","1234567890","1234567890"]}';
file.contents.toString().should.eql(expected);
done();
});
});

Sorry, the diff of this file is not supported yet

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