0.1.0 • Published 10 years ago

jsonscore v0.1.0

Weekly downloads
3
License
GPL-2.0
Repository
github
Last release
10 years ago

JSONscore

Edit json file with underscore.js chain method

Installation

$ npm install jsonscore

Usage

var jsonscore = require('jsonscore');

/* 
 * alter metadata json file in the root directory
 * addnew and filter two new json object
 */
var metadata = jsonscore('metadata.json', {
    // default json file content value
    defaultValue: [],
    // json file encoding 
    encoding: 'utf8',
    // format json with replacer function
    replacer: null,
    // number of space between json object
    space: 4
})
  .extend({
      compile_sass: {
        run: false,
        time: 1405213450
      },
      minify_js: {
        run: true,
        time: 1405213454
      }
  })
  .filter(function(task) {
      return task.run ? false : true;
  })
  .write();

console.log(metadata);

Using lodash instead of default underscore library

var jsonscore = require('jsonscore');
var _ = require('lodash');

jsonscore('metadata.json', {
  engine: _
}).extend(obj).write();

Custom mixin methods

var jsonscore = require('jsonscore');
var _ = require('underscore');

_.mixin({
  filterWith: [Function]
});

jsonscore('metadata.json', {
  engine: _
}).filterWith(obj).write();

API

jsonscore(filepath, , options) return an underscore chain method

write() write json object back into file return json data

Authors

xmhscratch

License

Licensed under the GPL license.

0.1.0

10 years ago

0.0.9

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago