escape-html-template-tag
Advanced tools
Comparing version 1.1.2 to 1.2.0
21
index.js
@@ -0,1 +1,3 @@ | ||
'use strict'; | ||
const ENTITIES = { | ||
@@ -10,9 +12,9 @@ '&': '&', | ||
'=': '=' | ||
} | ||
}; | ||
const ENT_REGEX = new RegExp(Object.keys(ENTITIES).join('|'), 'g') | ||
const ENT_REGEX = new RegExp(Object.keys(ENTITIES).join('|'), 'g'); | ||
function join (array, separator) { | ||
if (separator === undefined || separator === null) { | ||
separator = ',' | ||
separator = ','; | ||
} | ||
@@ -31,4 +33,4 @@ if (array.length <= 0) { | ||
constructor (parts, subs) { | ||
this._parts = parts | ||
this._subs = subs | ||
this._parts = parts; | ||
this._subs = subs; | ||
} | ||
@@ -48,3 +50,3 @@ | ||
return this._parts.reduce((result, part, i) => { | ||
const sub = this._subs[i - 1] | ||
const sub = this._subs[i - 1]; | ||
return result + this._escapeHtml(sub) + part | ||
@@ -63,4 +65,5 @@ }) | ||
Object.assign(escapeHtml, { safe, join }) | ||
module.exports = escapeHtml | ||
exports.default = escapeHtml; | ||
exports.join = join; | ||
exports.safe = safe; | ||
module.exports = Object.assign(exports.default, exports); |
{ | ||
"name": "escape-html-template-tag", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"description": "Tag literal strings with this function to html escape interpolated values", | ||
"main": "index.js", | ||
"module": "index.mjs", | ||
"scripts": { | ||
"test": "standard && node test" | ||
"test": "standard && node test", | ||
"prepublish": "rollup index.mjs --file index.js --format cjs --exports named --no-esModule --footer 'module.exports = Object.assign(exports.default, exports);'" | ||
}, | ||
@@ -21,2 +23,3 @@ "repository": { | ||
"index.js", | ||
"index.mjs", | ||
"index.d.ts" | ||
@@ -31,4 +34,5 @@ ], | ||
"devDependencies": { | ||
"standard": "13.1.0" | ||
"rollup": "1.26.0", | ||
"standard": "14.3.1" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6413
5
113
2