Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cz

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cz - npm Package Compare versions

Comparing version 1.7.6 to 1.7.7

.nyc_output/21056cdcc89d4fc1debb76ba7c31bfde.json

26

lib/index.js

@@ -86,8 +86,28 @@ 'use strict';

this._path = newPath;
if (file.length >= 1) {
// We use 2 as an empty file with a new line would return 1
if (file.length >= 2) {
var data = JSON.parse(file);
for (var prop in data) {
if ({}.hasOwnProperty.call(data, prop)) {
var _iteratorNormalCompletion2 = true;
var _didIteratorError2 = false;
var _iteratorError2 = undefined;
try {
for (var _iterator2 = Object.keys(data)[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
var prop = _step2.value;
this._config[prop] = data[prop];
}
} catch (err) {
_didIteratorError2 = true;
_iteratorError2 = err;
} finally {
try {
if (!_iteratorNormalCompletion2 && _iterator2.return) {
_iterator2.return();
}
} finally {
if (_didIteratorError2) {
throw _iteratorError2;
}
}
}

@@ -94,0 +114,0 @@ }

10

package.json
{
"name": "cz",
"version": "1.7.6",
"version": "1.7.7",
"description": "A simple config utility for nodejs",
"main": "lib/index.js",
"scripts": {
"test": "xo",
"coverage": "echo '{}' > ./test/config.json && cross-env NODE_ENV=test nyc mocha ./test/**/* --arg:test=arg_test_value && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage && rm -rf ./nyc_output",
"test": "xo && npm run build && npm run coverage",
"gen_test_files": "echo '{}' > ./test/config.json && echo '' > ./test/emptyConfig.json",
"coverage": "npm run gen_test_files && npm run mocha && if-env CI=true && npm run push-coverage || echo ''",
"push-coverage": "cat ./coverage/lcov.info | coveralls && rm -rf ./coverage && rm -rf ./nyc_output",
"mocha": "cross-env NODE_ENV=test nyc mocha ./test/test.js --arg:test=arg_test_value",
"build": "babel -d lib/ src/",

@@ -30,2 +33,3 @@ "prepublish": "npm run build"

"dependencies": {
"if-env": "^1.0.0",
"lodash": "^4.17.4"

@@ -32,0 +36,0 @@ },

@@ -14,2 +14,3 @@ 'use strict';

const configTwo = new Cz();
const emptyConfig = new Cz();

@@ -105,2 +106,10 @@ describe('set config using string param and string value', () => {

describe('attempt to load empty config file', () => {
before(() => {
emptyConfig.load(path.join(__dirname, './emptyConfig.json'));
});
it(`config.get() should return {}`, () => expect(JSON.stringify(emptyConfig.get())).to.equal(JSON.stringify({})));
});
describe('new Cz() should create a seperate config store', () => {

@@ -107,0 +116,0 @@ before(() => {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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