merge-object-files
Merges objects in files into a single object.
Last updated a year ago by tlivings .
Repository · Bugs · Original npm · Tarball
$ cnpm install merge-object-files 
SYNC missed versions from official npm registry.

merge-object-files

Merges a directory containing json or other files exporting objects and merges them into a single object.

Sub directories and files become keys under the merged objects, with file contents becoming values.

Requires Node 6.

api

merge-object-files exposes a single method.

  • merge(dirname, extensions, \*optional*\ callback) - merges the given dirname.

Arguments:

  • dirname - the directory to merge - defaults to caller's directory.
  • extensions - an array of extensions to accept - defaults to ['json'].
  • callback - if omitted, a promise is returned.

usage

const Files = require('merge-object-files');
const Path = require('path');

Files.merge(Path.resolve(__dirname, 'objects'), ['json', 'js'])
.then((merged) => {
    //...
})
.catch((error) => {
    console.error(error.stack);
});
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 6
Dependencies (3)
Dev Dependencies (3)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |