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

interpolate-json

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

interpolate-json - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

21

lib/main.js

@@ -99,2 +99,3 @@ const extend = require('extend');

do: (obj, values = null, options = {}) => {
let needToDo = false;
let objType = type(obj);

@@ -108,11 +109,17 @@ if (options.prefix && !options.suffix) options.suffix = '';

obj = JSON.stringify(obj);
let matches = obj.match(paramRegex);
values = flattenAndResolve(
cachedValue,
getMatchSet(matches, paramRegex),
paramRegex
);
if (paramRegex.test(obj)) {
let matches = obj.match(paramRegex);
values = flattenAndResolve(
cachedValue,
getMatchSet(matches, paramRegex),
paramRegex
);
needToDo = true;
}
break;
case 'string':
log(`Input: "${obj}"`);
if (paramRegex.test(obj)) needToDo = true;
else break;
if (null === values) {

@@ -126,3 +133,3 @@ traceNThrow('Please provide "values"', BadRequest);

}
const result = getInterpolated(obj, paramRegex, values);
const result = needToDo ? getInterpolated(obj, paramRegex, values) : obj;
switch (objType) {

@@ -129,0 +136,0 @@ case 'Object':

{
"name": "interpolate-json",
"version": "0.2.0",
"version": "0.3.0",
"description": "Interpolate a Javascript (Node.js V8) Object or string with json - Advanced",

@@ -5,0 +5,0 @@ "main": "index.js",

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