🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

node-powertools

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-powertools - npm Package Compare versions

Comparing version

to
2.1.6

17

dist/index.js

@@ -297,8 +297,16 @@ (function (root, factory) {

options.escape = typeof options.escape === 'undefined'
// ? true
? isBrowser()
: options.escape;
options.brackets = options.brackets || ['{', '}'];
// Validate brackets
if (!Array.isArray(options.brackets) || options.brackets.length !== 2) {
throw new Error('Invalid brackets option. It must be an array with two characters.');
}
const [openBracket, closeBracket] = options.brackets;
const regex = new RegExp(`${Powertools.escape(openBracket)}\\s*([\\w\\s\\.]*)\\s*${Powertools.escape(closeBracket)}`, 'g');
// Replace the settings in the input string
return input.replace(/\{\s*([\w\s\.]*)\s*\}/g, function (match, key) {
return input.replace(regex, function (match, key) {
var trimmed = key.trim();

@@ -322,2 +330,7 @@ var value = getNestedValue(settings, trimmed);

// // Helper function to escape special characters in a string for use in a regular expression
// function escapeRegExp(string) {
// return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
// }
// Merge options and defaults/schema

@@ -324,0 +337,0 @@ Powertools.defaults = function (user, schema) {

2

package.json
{
"name": "node-powertools",
"version": "2.1.5",
"version": "2.1.6",
"description": "Powerful assistive functions for Node and Browser environments.",

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