index.js
1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
* Created by TaoHuang on 2016/10/26.
*/
'use strict';
exports.if_cond = (left, operator, right, options) => {
switch (operator) {
case '==':
return (left == right) ? options.fn(this) : options.inverse(this); // eslint-disable-line
case '===':
return (left === right) ? options.fn(this) : options.inverse(this);
case '<':
return (left < right) ? options.fn(this) : options.inverse(this);
case '<=':
return (left <= right) ? options.fn(this) : options.inverse(this);
case '>':
return (left > right) ? options.fn(this) : options.inverse(this);
case '>=':
return (left >= right) ? options.fn(this) : options.inverse(this);
case '&&':
return (left && right) ? options.fn(this) : options.inverse(this);
case '||':
return (left || right) ? options.fn(this) : options.inverse(this);
default:
return options.inverse(this);
}
};
exports.escapeType = (value) => {
console.log(value);
let strs = value.split('');
console.log(strs);
if (strs.length === 2) {
strs[2] = strs[1];
strs[1] = ' ';
}
console.log(strs.join(''));
return strs.join('');
};