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

fmtr

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fmtr - npm Package Compare versions

Comparing version

to
1.0.4

6

index.js

@@ -6,3 +6,7 @@ "use strict";

module.exports = function fmtr(str, obj) {
return _.template(_.isString(str) ? str : '', { interpolate: /\$\{([^\}]+)\}/gm })(obj);
try {
return _.template(_.isString(str) ? str : '', { interpolate: /\$\{([^\}]+)\}/gm })(obj);
} catch (err) {
return (_.isString(str) ? str : '').replace(/\$\{([^\}]+)\}/gm, '');
}
};

2

package.json
{
"name": "fmtr",
"version": "1.0.3",
"version": "1.0.4",
"description": "awesome string formatter",

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

@@ -27,2 +27,7 @@ "use strict";

it('should ignore undefined variables', function() {
expect(fmtr('Xx ${foobar} xX')).to.be('Xx xX');
expect(fmtr('Xx ${foobar} xX', { baz: 123 })).to.be('Xx xX');
});
});