Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
copy-json-file-merged
Advanced tools
Changelog
0.2.1 (2018-02-28)
Readme
Copies source JSON file and merges its contents with destination JSON file if present.
npm install copy-json-file-merged --save
In code:
var copyJsonFileMerged = require('copy-json-file-merged');
copyJsonFileMerged('src.json', 'dest.json', {
overwrite: true,
mergeKey: 'id'
});
From CLI:
./node_modules/.bin/copy-json-file-merged src.json dest.json --overwrite --mergeKey id
From package.json's scripts:
{
"scripts": {
"copy": "copy-json-file-merged src.json dest.json --overwrite --mergeKey id"
}
}
copyJsonFileMerged
function accepts three arguments:
src
— path to source JSON file (must exist);dest
— path to destination JSON file (can exist);options
— object of properties (optional):
mergeKey
— a key (property) to merge nested objects and arrays by (see
merge arrays uniting their object items by specified identifier field),
by default is id
;
overwrite
— shows whether source object should overwrite destination one (if it exists),
by default is false
; alternatively, an array of top-level properties' names of source JSON object can be passed
to limit sections of destination JSON file to overwrite, e.g.:
src.json
{
"obj1": { "merged": true },
"obj2": { "merged": true }
}
dest.json
{
"obj1": { "merged": false },
"obj2": { "merged": false }
}
copyJsonFileMerged('src.json', 'dest.json', {
overwrite: ['obj1']
}); // => { "obj1": { "merged": true }, "obj2": { "merged": false } }
In order to build library run:
npm run build
Run unit tests:
npm test
In order to run tests with coverage run the following command:
npm run test:coverage
In order to run tests with Coveralls locally you have to provide COVERALLS_REPO_TOKEN
:
COVERALLS_REPO_TOKEN=<token> npm run test:coveralls
Before making a pull request, please, be sure that your changes are rebased to develop
branch.
FAQs
Copies source JSON file and merges its contents with destination JSON file if present.
The npm package copy-json-file-merged receives a total of 4 weekly downloads. As such, copy-json-file-merged popularity was classified as not popular.
We found that copy-json-file-merged demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.