🚀 Big News:Socket Has Acquired Secure Annex.Learn More
Socket
Book a DemoSign in
Socket

fmtr

Package Overview
Dependencies
Maintainers
1
Versions
12
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
1.0.3
to
1.0.4
+5
-1
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, '');
}
};
+1
-1
{
"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');
});
});