mirror of
https://github.com/Azure/k8s-deploy.git
synced 2026-06-24 05:29:26 +08:00
Add node modules and new code for release (#168)
Co-authored-by: OliverMKing <OliverMKing@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
ca8d2604ac
commit
a0f00e5017
+19
@@ -0,0 +1,19 @@
|
||||
var keys = require('./keys.js');
|
||||
|
||||
// Internal helper to generate functions for escaping and unescaping strings
|
||||
// to/from HTML interpolation.
|
||||
function createEscaper(map) {
|
||||
var escaper = function(match) {
|
||||
return map[match];
|
||||
};
|
||||
// Regexes for identifying a key that needs to be escaped.
|
||||
var source = '(?:' + keys(map).join('|') + ')';
|
||||
var testRegexp = RegExp(source);
|
||||
var replaceRegexp = RegExp(source, 'g');
|
||||
return function(string) {
|
||||
string = string == null ? '' : '' + string;
|
||||
return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string;
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = createEscaper;
|
||||
Reference in New Issue
Block a user