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

@incanta/config

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@incanta/config - npm Package Compare versions

Comparing version 0.1.9 to 0.1.10

14

lib/config.js

@@ -103,13 +103,15 @@ "use strict";

const regexResult = value.matchAll(variableRegex);
let result = value;
for (const match of regexResult) {
const keyToReplace = match[0].slice(2, match[0].length - 1);
const value = this.tryGet(keyToReplace);
if (value !== null) {
obj = obj.replace(match[0], `${value}`);
const newValue = this.tryGet(keyToReplace);
if (newValue !== null) {
result = result.replace(match[0], `${newValue}`);
}
}
return result;
};
// replace all ${value} with the value from the config
if (typeof obj === "string") {
replaceValue(obj);
obj = replaceValue(obj);
}

@@ -121,4 +123,4 @@ else if (typeof obj === "object") {

const value = curObj[property];
if (typeof value === "string") {
replaceValue(value);
if (typeof value === "string" && property !== "format") {
curObj[property] = replaceValue(value);
}

@@ -125,0 +127,0 @@ else if (typeof value === "object") {

{
"name": "@incanta/config",
"version": "0.1.9",
"version": "0.1.10",
"main": "lib/index.js",

@@ -5,0 +5,0 @@ "exports": {

@@ -132,11 +132,15 @@ import merge from "lodash.merge";

const replaceValue = (value: string): void => {
const replaceValue = (value: string): string => {
const regexResult = value.matchAll(variableRegex);
let result = value;
for (const match of regexResult) {
const keyToReplace = match[0].slice(2, match[0].length - 1);
const value = this.tryGet<string | number | boolean>(keyToReplace);
if (value !== null) {
obj = obj.replace(match[0], `${value}`);
const newValue = this.tryGet<string | number | boolean>(keyToReplace);
if (newValue !== null) {
result = result.replace(match[0], `${newValue}`);
}
}
return result;
};

@@ -146,3 +150,3 @@

if (typeof obj === "string") {
replaceValue(obj);
obj = replaceValue(obj);
} else if (typeof obj === "object") {

@@ -153,4 +157,4 @@ // walk the object and replace all strings with the value from the config

const value = curObj[property];
if (typeof value === "string") {
replaceValue(value);
if (typeof value === "string" && property !== "format") {
curObj[property] = replaceValue(value);
} else if (typeof value === "object") {

@@ -157,0 +161,0 @@ walkObject(value);

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