Package Exports
- merge-object-files
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (merge-object-files) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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 givendirname
.
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);
});