Comparing version 1.7.2 to 1.7.3
@@ -116,4 +116,7 @@ 'use strict'; | ||
value: function joinGets(gets, joins) { | ||
var _this2 = this; | ||
// @TODO: Add support for a single join param instead of just array | ||
var results = gets.map(function (get) { | ||
return this.get(get); | ||
return _this2.get(get); | ||
}); | ||
@@ -120,0 +123,0 @@ var finalResult = ''; |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,36 +6,2 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
var flattenObject = function flattenObject(ob) { | ||
var toReturn = {}; | ||
var flatObject = void 0; | ||
for (var i in ob) { | ||
if (!{}.hasOwnProperty.call(ob, i)) { | ||
continue; | ||
} | ||
// Exclude arrays from the final result | ||
// Check this http://stackoverflow.com/questions/4775722/check-if-object-is-array | ||
if (ob[i] && Array === ob[i].constructor) { | ||
continue; | ||
} | ||
if (_typeof(ob[i]) === 'object') { | ||
flatObject = flattenObject(ob[i]); | ||
for (var x in flatObject) { | ||
if (!{}.hasOwnProperty.call(flatObject, x)) { | ||
continue; | ||
} | ||
// Exclude arrays from the final result | ||
if (flatObject[x] && Array === flatObject.constructor) { | ||
continue; | ||
} | ||
toReturn[i + (isNaN(x) ? ':' + x : '')] = flatObject[x]; | ||
} | ||
} else { | ||
toReturn[i] = ob[i]; | ||
} | ||
} | ||
return toReturn; | ||
}; | ||
var weakToJSON = function weakToJSON(obj) { | ||
@@ -45,3 +11,2 @@ return JSON.parse(JSON.stringify(obj)); | ||
exports.flattenObject = flattenObject; | ||
exports.weakToJSON = weakToJSON; |
{ | ||
"name": "cz", | ||
"version": "1.7.2", | ||
"version": "1.7.3", | ||
"description": "A simple config utility for nodejs", | ||
"main": "lib/index.js", | ||
"scripts": { | ||
"test": "xo && npm run compile && mocha --compilers js:babel-core/register ./test/**/* --arg:test=arg_test_value", | ||
"compile": "babel -d lib/ src/", | ||
"prepublish": "npm run compile" | ||
"test": "xo && npm run build && mocha --compilers js:babel-core/register ./test/**/* --arg:test=arg_test_value", | ||
"coverage": "cross-env NODE_ENV=test nyc mocha ./test/**/* --arg:test=arg_test_value", | ||
"build": "babel -d lib/ src/", | ||
"prepublish": "npm run build" | ||
}, | ||
@@ -34,6 +35,11 @@ "repository": { | ||
"babel-core": "^6.24.1", | ||
"babel-plugin-istanbul": "^4.1.1", | ||
"babel-preset-es2015": "^6.24.1", | ||
"babel-preset-stage-2": "^6.24.1", | ||
"babel-register": "^6.24.1", | ||
"chai": "^3.5.0", | ||
"cross-env": "^4.0.0", | ||
"istanbul": "^0.4.5", | ||
"mocha": "^3.2.0", | ||
"nyc": "^10.2.0", | ||
"xo": "^0.18.1" | ||
@@ -57,3 +63,14 @@ }, | ||
] | ||
}, | ||
"nyc": { | ||
"require": [ | ||
"babel-register" | ||
], | ||
"reporter": [ | ||
"lcov", | ||
"text" | ||
], | ||
"sourceMap": false, | ||
"instrument": false | ||
} | ||
} |
@@ -9,3 +9,3 @@ 'use strict'; | ||
import Cz from '../lib/index'; | ||
import Cz from '../src/index'; | ||
@@ -111,1 +111,18 @@ const config = new Cz(); | ||
}); | ||
describe('joinGets should join multiple get params', () => { | ||
before(() => { | ||
config.reset(); | ||
config.defaults({}); | ||
config.set({ | ||
db: { | ||
host: 'localhost', | ||
port: 3000 | ||
} | ||
}); | ||
}); | ||
it(`config.joinGets(['db:host', 'db:port'], [':']) should return localhost:3000`, () => { | ||
expect(config.joinGets(['db:host', 'db:port'], [':'])).to.equal('localhost:3000'); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
316306
19
650
12
1