1.0.0 • Published 7 years ago

json-fn-file v1.0.0

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

json-fn-file

NPM version Build Status XO code style

Apply a function to a json file and save to a file

Install

npm install --save json-fn-file

Usage

const jsonFnFile = require('json-fn-file');

// Assuming "input.json" contains:
//  {
//    "key1": "Value1",
//    "key2": "Value2"
//  }
jsonFnFile('input.json', 'output.txt', input => Object.keys(input));
//=> 'key1,key2'

API

jsonFnFile(inputFile, outputFile, fn)

Arguments

NameDescriptionTypeDefault
inputFileFile path to input json filestringNone (required)
outputFileFile path to output filestringNone (required)
fnConverter function to run on jsonfunction(in) => (in)

Your function will be fed one argument, the json content of inputFile.

Returns

Type: object

License

MIT © Dawson Botsford