3.0.5 • Published 8 years ago

jsonsave v3.0.5

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

README

NPM

Build Status Dependencies npm version Code Climate Test Coverage bitHound Overalll Score

Usage

You can open .json file, edit and save with simple methods

var json = require('jsonsave');

var manifest = json.new(__dirname + '/manifest.json');
manifest.version = ++manifest.version;
manifest.$$save();

Methods starts with $$ does not save in json file.

Save as

var file = json.new('/path/to/file.json');

file.$$merge({ name: "John", last: "Snow" });
file.$$saveAs('/another/path/to/file.json');

Insert and merge

var bastard = json.new({name: "Jon"});

bastard.$$merge({name: John}); // now bastard.name === "John"
bastard.$$insert({last: "Snow", name: "WOW"}); // now {name: "John", last: "Snow"};

bastard.$$saveAs("/game_of_thrones/westeros/north/stark/bastard.json");

Clean objects

In clean mode magic $$ variables does not creating. Use json.save(), json.merge(), json.saveAs(), json.insert().

var ob = json.clean.new(); // or json.clean.new({}) or json.clean.new('path/to.json');
ob.name = "ob";
ob.description = "ob pro comfort";
ob.version = "10.0.8";

typeof ob.$$saveAs === "undefined"; // true
json.saveAs(ob, __dirname + '/tmp/whatthe.json');
3.0.5

8 years ago

3.0.4

8 years ago

3.0.3

8 years ago

3.0.2

9 years ago

3.0.0

9 years ago

2.0.0

9 years ago

1.1.2

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago