🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

jdists

Package Overview
Dependencies
Maintainers
4
Versions
102
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jdists - npm Package Compare versions

Comparing version
2.0.2
to
2.0.4
+30
processor-extend/processor-templatestrings.js
/**
* ES6 模版字符串转化为 ES5- 字符串表达式
*
* @param {string} content 文本内容
*/
module.exports = function(content) {
return content.replace(/`((\\.|[^])*?)`/g, function(all, text) {
function encode(str) {
return str.replace(/(\\.|[\n\r"])/g, function(char) {
if (char.length === 2) {
return char;
}
return {
'\n': '\\n',
'\r': '\\r',
'"': '\\"'
}[char];
});
}
var result = '"';
var reg = /\$\{([^]*?)\}/;
var match = reg.exec(text);
while (match) {
text = RegExp["$'"];
result += encode(RegExp['$`']) + '" + (' + match[1] + ') + "';
match = reg.exec(text);
}
return result + encode(text) + '"';
});
};
+2
-2

@@ -7,4 +7,4 @@ /**

* zswang (http://weibo.com/zswang)
* @version 2.0.2
* @date 2017-03-10
* @version 2.0.4
* @date 2017-03-29
*/

@@ -11,0 +11,0 @@ var fs = require('fs');

@@ -7,4 +7,4 @@ /**

* zswang (http://weibo.com/zswang)
* @version 2.0.2
* @date 2017-03-10
* @version 2.0.4
* @date 2017-03-29
*/

@@ -11,0 +11,0 @@ var colors = require('colors');

{
"name": "jdists",
"version": "2.0.2",
"version": "2.0.4",
"description": "Code block processing tools",

@@ -5,0 +5,0 @@ "main": "lib/jdists.js",