jsir 2.2.4 → 2.2.5
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 +3 -0
- package/deps/util.js +10 -1
- package/package.json +1 -1
package/cmd/oaa.js
CHANGED
|
@@ -2036,6 +2036,9 @@ async function evalText($text = '', $cmdName = '', $args = []) {
|
|
|
2036
2036
|
let $require = async (matchItem) => {
|
|
2037
2037
|
return await _requireSource(currSpace, matchItem)
|
|
2038
2038
|
}
|
|
2039
|
+
// 兼容module.exports
|
|
2040
|
+
$text.replace(/^module\.exports\s*=\s*/m, 'return ')
|
|
2041
|
+
|
|
2039
2042
|
return await evalCode(addErrorTag($text), $cmdName, $args,
|
|
2040
2043
|
$data, $file,
|
|
2041
2044
|
$require, $requires,
|
package/deps/util.js
CHANGED
|
@@ -498,7 +498,7 @@ function timeStr(fmt, date) {
|
|
|
498
498
|
function vl(obj) {
|
|
499
499
|
let type= typeof obj;
|
|
500
500
|
if (type === 'number') {
|
|
501
|
-
return !Number.isNaN(obj)
|
|
501
|
+
return !Number.isNaN(obj);
|
|
502
502
|
}
|
|
503
503
|
if (typeof obj === 'string') {
|
|
504
504
|
obj = obj.trim()
|
|
@@ -918,11 +918,20 @@ function toBigNum(str) {
|
|
|
918
918
|
}
|
|
919
919
|
|
|
920
920
|
function reget(str, reg) {
|
|
921
|
+
`
|
|
922
|
+
reget(/aaa(bbb)ccc/, str)
|
|
923
|
+
return bbb
|
|
924
|
+
`
|
|
921
925
|
let r = reg.exec(str)
|
|
922
926
|
return r ? (r[1] || "").trim(): ""
|
|
923
927
|
}
|
|
924
928
|
|
|
925
929
|
function regEach(str, reg, fn) {
|
|
930
|
+
`
|
|
931
|
+
regEach(/aaa(bbb)ccc/, str, fn)
|
|
932
|
+
fn([aaa(bbb)ccc, bbb])
|
|
933
|
+
return void
|
|
934
|
+
`
|
|
926
935
|
let r = reg.exec(str)
|
|
927
936
|
while (r != null) {
|
|
928
937
|
fn(r)
|