New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

only-one-json-please

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

only-one-json-please - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

32

index.js
#!/usr/bin/env node
'use strict';
const shell = require('shelljs');
const fs = require('fs');

@@ -8,23 +9,24 @@ const request = require('request');

module.exports = function() {
glob(`${__dirname}/*.json`, function (err, files) {
if (err) {
console.log(`ERROR: Unable to read the folder: ${__dirname}`, err);
}
shell.exec('echo "Concatenating files in $PWD"');
const masterObj = {};
glob(`${process.cwd()}/*.json`, function (err, files) {
if (err) {
console.log(`ERROR: Unable to read the folder: ${process.cwd()}`, err);
}
files.forEach(function(file, index) {
fs.readFile(file, 'utf8', function(err, data) {
if (err) throw err;
const masterObj = {};
let obj = JSON.parse(data);
files.forEach(function(file, index) {
fs.readFile(file, 'utf8', function(err, data) {
if (err) throw err;
Object.keys(obj).forEach((key) => {
masterObj[key] = obj[key];
jsonfile.writeFileSync(`./output.json`, masterObj);
});
let obj = JSON.parse(data);
Object.keys(obj).forEach((key) => {
masterObj[key] = obj[key];
jsonfile.writeFileSync(`${process.cwd()}/output.json`, masterObj);
});
});
});
};
console.log('Done: output.json');
});
{
"name": "only-one-json-please",
"version": "0.0.1",
"version": "0.0.2",
"description": "Concatenates all JSON files within a directory into one file",
"main": "index.js",
"bin": {
"jsonconcat": "index.js"
},
"scripts": {

@@ -18,4 +21,5 @@ "test": "echo \"Error: no test specified\" && exit 1"

"jsonfile": "^2.3.1",
"request": "^2.74.0"
"request": "^2.74.0",
"shelljs": "^0.7.4"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc