Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

merge-object-files

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

merge-object-files

Merges objects in files into a single object.

latest
Source
npmnpm
Version
2.0.0
Version published
Maintainers
1
Created
Source

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);
});

FAQs

Package last updated on 01 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts