jsir 2.1.2 → 2.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cmd/oaa.js +1 -1
- package/deps/util.js +12 -4
- package/package.json +1 -1
package/cmd/oaa.js
CHANGED
package/deps/util.js
CHANGED
|
@@ -36,15 +36,22 @@ const $draft = str => {
|
|
|
36
36
|
}
|
|
37
37
|
const $fnCache = {}
|
|
38
38
|
|
|
39
|
-
function isArgsMatch(text, args, callback, useMd5
|
|
39
|
+
function isArgsMatch(text, args, callback, useMd5) {
|
|
40
40
|
let match = false
|
|
41
41
|
for (let arg of args) {
|
|
42
42
|
let r = true
|
|
43
43
|
for (let str of arg.split(',').map(trim).filter(i => i)) {
|
|
44
44
|
let reg = new RegExp(str.split(/\s+/).join('\\s+'), 'i')
|
|
45
|
-
if (
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
if (useMd5 && /^0x[a-z\d]{8}$/.test(str)) {
|
|
46
|
+
if (('0x' + md5(text).substr(0, 8)) !== str) {
|
|
47
|
+
r = false
|
|
48
|
+
break
|
|
49
|
+
}
|
|
50
|
+
} else {
|
|
51
|
+
if (!reg.test(text)) {
|
|
52
|
+
r = false
|
|
53
|
+
break
|
|
54
|
+
}
|
|
48
55
|
}
|
|
49
56
|
}
|
|
50
57
|
if (r) {
|
|
@@ -413,6 +420,7 @@ function getConfig(key, defaultVal) {
|
|
|
413
420
|
if (!(key in config)) {
|
|
414
421
|
writeFlag = true
|
|
415
422
|
config[key] = null
|
|
423
|
+
warn(`require config "${key}" in ${configFile}`)
|
|
416
424
|
}
|
|
417
425
|
if (writeFlag) {
|
|
418
426
|
fs.writeFileSync(configFile, JSON.stringify(config, null, 2))
|