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

@trayio/threadneedle

Package Overview
Dependencies
Maintainers
1
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@trayio/threadneedle - npm Package Compare versions

Comparing version 1.8.0 to 1.9.0

37

lib/addMethod/substitute.js

@@ -33,2 +33,8 @@ var Mustache = require('mustache');

//This is needed because Mustache has it's own behaviour for # parameters
if (template.match(/{{(#[^{}]+)}}|{{{#([^{}]+)}}}/g)) {
//Substitute hash paramters first, then continue with standard mustaching
template = substituteHashParameters(template, params);
}
// If the above isn't the case, then template it with Mustache.

@@ -41,2 +47,33 @@ var str = Mustache.render(template, params);

//Mustache.render only the hash paramters seperately
function substituteHashParameters (template, params) {
var pathList = [];
//Replace unsecape templating
template = _.replace(template, /({{{#[^{}]+}}})/g, function (match, group) {
var path = group.replace('}}}', '').replace('{{{#', '');
pathList.push(path);
return '##{' + path + '}##';
});
//Replace all other templating
template = _.replace(template, /({{#[^{}]+}})/g, function (match, group) {
var path = group.replace('}}', '').replace('{{#', '');
pathList.push(path);
return '##' + path + '##';
});
/*
Create a substituted params including only hash parameters
(but without the hash at the start of the key)
*/
var hashParams = _.reduce(pathList, function (acc, path) {
return _.set(acc, path, _.get(params, '#' + path));
}, {});
return Mustache.render(template, hashParams, {}, [ '##', '##' ]);
}
function substituteArray(template, params) {

@@ -43,0 +80,0 @@ return _.map(template, function (value) {

4

package.json
{
"name": "@trayio/threadneedle",
"version": "1.8.0",
"version": "1.9.0",
"description": "A framework for simplifying working with HTTP-based APIs.",

@@ -29,3 +29,3 @@ "main": "lib/index.js",

"dependencies": {
"lodash": "^4.17.11",
"lodash": "^4.17.15",
"mout": "^1.1.0",

@@ -32,0 +32,0 @@ "mustache": "^3.0.1",

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