Socket
Socket
Sign inDemoInstall

cantinflas

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.1 to 1.0.2

license

2

package.json
{
"name": "cantinflas",
"version": "1.0.1",
"version": "1.0.2",
"main": "src/index.js",

@@ -5,0 +5,0 @@ "description": "Tiny mustache-like template engine",

@@ -13,3 +13,3 @@ const CHUNK = /[\t ]*({{([#^])+([\w\d.$@]+)}})[\s\S]*?({{\/\3}})[\t ]*\n?/g;

* @param {String} template Input string
* @param (Object} data Data object
* @param {Object} data Data object
* @returns {String} Compiled output string

@@ -21,4 +21,3 @@ */

function render(fragment, context) {
return fragment.replace(CHUNK, (...args) => {
const [chunk, tagstart, meta, name, tagend] = args;
return fragment.replace(CHUNK, (...[chunk, tagstart, meta, name, tagend]) => {
const INLINE = new RegExp(`^.*${escRGX(tagstart)}.*${escRGX(tagend)}.*$`, 'm');

@@ -35,3 +34,3 @@ const RGX = INLINE.test(chunk)

let ctx = {...context, '.': crr, '@index': i, '@last': i === val.length-1, '@first': i === 0};
if (isArr(crr) || isObj(crr)) ctx = {...ctx, ...crr} // don't spread strings (all those chars might overvride user vars
if (isArr(crr) || isObj(crr)) ctx = {...ctx, ...crr} // only spread objects and arrays - not strings
return str += render(inner, ctx);

@@ -38,0 +37,0 @@ }, '');

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc