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

hops-config

Package Overview
Dependencies
Maintainers
1
Versions
225
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hops-config - npm Package Compare versions

Comparing version 10.0.0-rc.4 to 10.0.0

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

<a name="10.0.0"></a>
# [10.0.0](https://github.com/xing/hops/compare/v10.0.0-rc.4...v10.0.0) (2018-02-07)
### Features
* **config:** apply placeholders to plain objects, too ([b84b60c](https://github.com/xing/hops/commit/b84b60c))
<a name="9.5.0"></a>

@@ -8,0 +19,0 @@ # [9.5.0](https://github.com/xing/hops/compare/v9.4.3...v9.5.0) (2018-01-09)

26

index.js

@@ -6,7 +6,8 @@ 'use strict';

var cosmiconfig = require('cosmiconfig');
var mergeWith = require('lodash.mergewith');
var isPlainObject = require('is-plain-object');
var root = require('pkg-dir').sync();
var cosmiconfig = require('cosmiconfig');
function assign() {

@@ -85,4 +86,3 @@ var args = Array.prototype.slice

function resolvePlaceholders(config) {
var keys = Object.keys(config);
var regExp = new RegExp('<(' + keys.join('|') + ')>', 'g');
var regExp = new RegExp('<(' + Object.keys(config).join('|') + ')>', 'g');
function replaceRecursive(item) {

@@ -92,5 +92,14 @@ if (Array.isArray(item)) {

}
if (isPlainObject(item)) {
return Object.keys(item).reduce(function(result, key) {
result[key] = replaceRecursive(item[key]);
return result;
}, {});
}
if (typeof item === 'string') {
return item.replace(regExp, function(_, match) {
var result = config[match].toString();
return item.replace(regExp, function(_, configKey) {
var result = config[configKey];
if (typeof result !== 'string') {
result = String(result).toString();
}
return regExp.test(result) ? replaceRecursive(result) : result;

@@ -101,6 +110,3 @@ });

}
return keys.reduce(function(result, key) {
result[key] = replaceRecursive(config[key]);
return result;
}, {});
return replaceRecursive(config);
}

@@ -107,0 +113,0 @@

{
"name": "hops-config",
"version": "10.0.0-rc.4",
"version": "10.0.0",
"description": "Hops core configuration",

@@ -21,2 +21,3 @@ "keywords": [

"cosmiconfig": "^3.1.0",
"is-plain-object": "^2.0.4",
"lodash.mergewith": "^4.6.1",

@@ -23,0 +24,0 @@ "pkg-dir": "^2.0.0"

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