0.1.0 • Published 9 years ago

jsonscore v0.1.0

Weekly downloads
3
License
GPL-2.0
Repository
github
Last release
9 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

9 years ago

0.0.9

9 years ago

0.0.8

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago