@vope/utils 1.7.6 → 1.8.0

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.
Files changed (51) hide show
  1. package/dist/each.js +7 -5
  2. package/dist/index.cjs.js +19 -9
  3. package/dist/input-regex.js +12 -4
  4. package/dist/src/input-regex.d.ts +14 -0
  5. package/package.json +81 -81
  6. package/sub_storage/package.json +0 -1
  7. package/dist/input-regex.d.ts +0 -12
  8. /package/dist/{async-lock.d.ts → src/async-lock.d.ts} +0 -0
  9. /package/dist/{calc.d.ts → src/calc.d.ts} +0 -0
  10. /package/dist/{clamp.d.ts → src/clamp.d.ts} +0 -0
  11. /package/dist/{classnames.d.ts → src/classnames.d.ts} +0 -0
  12. /package/dist/{compare → src/compare}/version.d.ts +0 -0
  13. /package/dist/{compare → src/compare}/weak-equal.d.ts +0 -0
  14. /package/dist/{convert → src/convert}/json.d.ts +0 -0
  15. /package/dist/{convert → src/convert}/object.d.ts +0 -0
  16. /package/dist/{convert → src/convert}/strings.d.ts +0 -0
  17. /package/dist/{cron.d.ts → src/cron.d.ts} +0 -0
  18. /package/dist/{desens.d.ts → src/desens.d.ts} +0 -0
  19. /package/dist/{dic.d.ts → src/dic.d.ts} +0 -0
  20. /package/dist/{disable-enumerable.d.ts → src/disable-enumerable.d.ts} +0 -0
  21. /package/dist/{each.d.ts → src/each.d.ts} +0 -0
  22. /package/dist/{encoding.d.ts → src/encoding.d.ts} +0 -0
  23. /package/dist/{flat-tree.d.ts → src/flat-tree.d.ts} +0 -0
  24. /package/dist/{index-sort.d.ts → src/index-sort.d.ts} +0 -0
  25. /package/dist/{index.d.ts → src/index.d.ts} +0 -0
  26. /package/dist/{is → src/is}/class.d.ts +0 -0
  27. /package/dist/{is → src/is}/empty.d.ts +0 -0
  28. /package/dist/{is → src/is}/key.d.ts +0 -0
  29. /package/dist/{is → src/is}/null.d.ts +0 -0
  30. /package/dist/{load → src/load}/image.d.ts +0 -0
  31. /package/dist/{memory → src/memory}/basic.d.ts +0 -0
  32. /package/dist/{memory → src/memory}/list.d.ts +0 -0
  33. /package/dist/{memory → src/memory}/power.d.ts +0 -0
  34. /package/dist/{memory → src/memory}/simple.d.ts +0 -0
  35. /package/dist/{neo4j-anchors.d.ts → src/neo4j-anchors.d.ts} +0 -0
  36. /package/dist/{neo4j.d.ts → src/neo4j.d.ts} +0 -0
  37. /package/dist/{once.d.ts → src/once.d.ts} +0 -0
  38. /package/dist/{parse → src/parse}/num.d.ts +0 -0
  39. /package/dist/{power → src/power}/decon.d.ts +0 -0
  40. /package/dist/{rotate → src/rotate}/angle.d.ts +0 -0
  41. /package/dist/{rotate → src/rotate}/rad.d.ts +0 -0
  42. /package/dist/{serialize → src/serialize}/url-params.d.ts +0 -0
  43. /package/dist/{storage → src/storage}/offline.d.ts +0 -0
  44. /package/dist/{style → src/style}/css.d.ts +0 -0
  45. /package/dist/{subscriber.d.ts → src/subscriber.d.ts} +0 -0
  46. /package/dist/{table → src/table}/flex.d.ts +0 -0
  47. /package/dist/{union.d.ts → src/union.d.ts} +0 -0
  48. /package/dist/{url → src/url}/join.d.ts +0 -0
  49. /package/dist/{url → src/url}/params.d.ts +0 -0
  50. /package/dist/{wait.d.ts → src/wait.d.ts} +0 -0
  51. /package/sub_storage/{offline.d.ts → src/storage/offline.d.ts} +0 -0
package/dist/each.js CHANGED
@@ -1,9 +1,11 @@
1
1
  const forBfsEach = (list, up, callback) => {
2
- const stack = Array.isArray(list) ? list.slice() : Array.from(list);
3
- for (const value of stack) {
4
- if (!callback(value)) break;
5
- const result = up(value);
6
- result === void 0 || stack.push(...result);
2
+ const stack = [list];
3
+ for (const list2 of stack) {
4
+ for (const value of list2) {
5
+ if (!callback(value)) break;
6
+ const result = up(value);
7
+ result === void 0 || stack.push(result);
8
+ }
7
9
  }
8
10
  };
9
11
  const reverseMergeIn = (from, to = []) => {
package/dist/index.cjs.js CHANGED
@@ -1173,11 +1173,13 @@ var disable_enumerable_default = (data, key) => {
1173
1173
 
1174
1174
  // src/each.ts
1175
1175
  var forBfsEach = (list, up, callback) => {
1176
- const stack = Array.isArray(list) ? list.slice() : Array.from(list);
1177
- for (const value of stack) {
1178
- if (!callback(value)) break;
1179
- const result = up(value);
1180
- result === void 0 || stack.push(...result);
1176
+ const stack = [list];
1177
+ for (const list2 of stack) {
1178
+ for (const value of list2) {
1179
+ if (!callback(value)) break;
1180
+ const result = up(value);
1181
+ result === void 0 || stack.push(result);
1182
+ }
1181
1183
  }
1182
1184
  };
1183
1185
  var reverseMergeIn = (from, to = []) => {
@@ -1513,10 +1515,18 @@ var index_sort_default = (list, key) => {
1513
1515
  };
1514
1516
 
1515
1517
  // src/input-regex.ts
1516
- var RE_REGEX = /[$()*+.[?\\^{|]/g;
1517
- var RE_STRING = /[$()*+.[?\\^{|-]/g;
1518
- function inputRegex(text, flags) {
1519
- return flags === false ? text.replace(RE_STRING, ($0) => "\\" + $0) : new RegExp(text.replace(RE_REGEX, ($0) => "\\" + $0), flags);
1518
+ var spaces = {
1519
+ "\f": "f",
1520
+ "\n": "n",
1521
+ "\r": "r",
1522
+ " ": "t",
1523
+ "\v": "v"
1524
+ };
1525
+ var RE_REGEX = /(^[\d\a-zA-Z]|[-,=<>#&!%:;@~'`" ])|([$\\.*+^?()[\]{}|/])|([\f\n\r\t\v])/g;
1526
+ function inputRegex(text, flags, polyfill) {
1527
+ const { escape } = RegExp;
1528
+ const tmp = !polyfill && escape ? escape(text) : text.replace(RE_REGEX, ($0, $1, $2) => "\\" + ($1 ? "x" + $0.charCodeAt(0).toString(16) : $2 ? $0 : spaces[$0]));
1529
+ return flags === false ? tmp : new RegExp(tmp, flags);
1520
1530
  }
1521
1531
 
1522
1532
  // src/is/class.ts
@@ -1,7 +1,15 @@
1
- const RE_REGEX = /[$()*+.[?\\^{|]/g;
2
- const RE_STRING = /[$()*+.[?\\^{|-]/g;
3
- function inputRegex(text, flags) {
4
- return flags === false ? text.replace(RE_STRING, ($0) => "\\" + $0) : new RegExp(text.replace(RE_REGEX, ($0) => "\\" + $0), flags);
1
+ const spaces = {
2
+ "\f": "f",
3
+ "\n": "n",
4
+ "\r": "r",
5
+ " ": "t",
6
+ "\v": "v"
7
+ };
8
+ const RE_REGEX = /(^[\d\a-zA-Z]|[-,=<>#&!%:;@~'`" ])|([$\\.*+^?()[\]{}|/])|([\f\n\r\t\v])/g;
9
+ function inputRegex(text, flags, polyfill) {
10
+ const { escape } = RegExp;
11
+ const tmp = !polyfill && escape ? escape(text) : text.replace(RE_REGEX, ($0, $1, $2) => "\\" + ($1 ? "x" + $0.charCodeAt(0).toString(16) : $2 ? $0 : spaces[$0]));
12
+ return flags === false ? tmp : new RegExp(tmp, flags);
5
13
  }
6
14
  export {
7
15
  inputRegex
@@ -0,0 +1,14 @@
1
+ /**
2
+ * 处理输入文本中的特殊字符,用于转换正则表达式
3
+ * @param text
4
+ * @param flags 表示输出正则表达式
5
+ * @param polyfill 是否强制使用polyfill,默认为自动兼容,该参数主要在测试代码环境中使用
6
+ */
7
+ export declare function inputRegex(text: string, flags?: string, polyfill?: boolean): RegExp;
8
+ /**
9
+ * 处理输入文本中的特殊字符,用于转换正则表达式
10
+ * @param text
11
+ * @param flags 表示输出字符串,该字符串将作为正则表达式的一部分
12
+ * @param polyfill 是否强制使用polyfill,默认为自动兼容,该参数主要在测试代码环境中使用
13
+ */
14
+ export declare function inputRegex(text: string, flags: false, polyfill?: boolean): string;
package/package.json CHANGED
@@ -1,81 +1,81 @@
1
- {
2
- "name": "@vope/utils",
3
- "version": "1.7.6",
4
- "description": "",
5
- "publishConfig": {
6
- "access": "public",
7
- "registry": "https://registry.npmjs.org/"
8
- },
9
- "types": "./dist/index.d.ts",
10
- "typings": "./dist/index.d.ts",
11
- "module": "./dist/index.js",
12
- "main": "./dist/index.js",
13
- "scripts": {
14
- "start": "esbuild ./start.ts --outfile=start.cjs --format=cjs & node ./start.cjs",
15
- "poststart": "esbuild ./pre.ts --outfile=pre.cjs --format=cjs & node ./pre.cjs",
16
- "build": "npm run start & node ./build.cjs",
17
- "premocha": "node ./build.cjs --type=test",
18
- "mocha": "mocha __tests/**/*.js",
19
- "test": "npm run mocha",
20
- "prepublishOnly": "npm run build & npm run test",
21
- "debug": "npm run start & npm run premocha",
22
- "clean": "rimraf start.cjs pre.cjs build.cjs src/index.ts dist/ __tests/ __examples/ sub_storage/"
23
- },
24
- "exports": {
25
- ".": {
26
- "types": "./dist/index.d.ts",
27
- "import": "./dist/index.js",
28
- "require": "./dist/index.cjs.js"
29
- },
30
- "./storage": {
31
- "types": "./sub_storage/offline.d.ts",
32
- "import": "./sub_storage/offline.js",
33
- "require": "./sub_storage/offline.cjs.js"
34
- }
35
- },
36
- "author": "vope",
37
- "license": "ISC",
38
- "files": [
39
- "dist",
40
- "sub_storage"
41
- ],
42
- "devDependencies": {
43
- "@babel/parser": "^7.26.9",
44
- "@babel/traverse": "^7.26.9",
45
- "@babel/types": "^7.26.9",
46
- "@rollup/plugin-alias": "^5.1.1",
47
- "@rollup/plugin-commonjs": "^28.0.2",
48
- "@rollup/plugin-json": "^6.1.0",
49
- "@rollup/plugin-node-resolve": "^16.0.0",
50
- "@rollup/plugin-typescript": "^12.1.2",
51
- "@types/babel__traverse": "^7.20.6",
52
- "@types/mocha": "^10.0.6",
53
- "@types/node": "^22.13.5",
54
- "@types/sm-crypto": "^0.3.4",
55
- "esbuild": "^0.25.0",
56
- "glob": "^11.0.1",
57
- "iconv-lite": "^0.6.3",
58
- "mocha": "^10.2.0",
59
- "puppeteer": "^24.3.0",
60
- "rimraf": "^5.0.5",
61
- "rollup": "^4.34.8",
62
- "tslib": "^2.8.1",
63
- "typescript": "^5.9.2",
64
- "uuid": "^11.1.0"
65
- },
66
- "dependencies": {
67
- "@type-challenges/utils": "^0.1.1",
68
- "@types/lodash-es": "^4.17.12",
69
- "@vope/types": "^1.2.0",
70
- "csstype": "^3.2.3",
71
- "localforage": "^1.10.0",
72
- "lodash-es": "^4.17.21",
73
- "sm-crypto": "^0.3.13"
74
- },
75
- "pnpm": {
76
- "onlyBuiltDependencies": [
77
- "esbuild",
78
- "puppeteer"
79
- ]
80
- }
81
- }
1
+ {
2
+ "name": "@vope/utils",
3
+ "version": "1.8.0",
4
+ "description": "",
5
+ "publishConfig": {
6
+ "access": "public",
7
+ "registry": "https://registry.npmjs.org/"
8
+ },
9
+ "types": "./dist/index.d.ts",
10
+ "typings": "./dist/index.d.ts",
11
+ "module": "./dist/index.js",
12
+ "main": "./dist/index.js",
13
+ "scripts": {
14
+ "start": "esbuild ./start.ts --outfile=start.cjs --format=cjs & node ./start.cjs",
15
+ "poststart": "esbuild ./pre.ts --outfile=pre.cjs --format=cjs & node ./pre.cjs",
16
+ "build": "npm run start & node ./build.cjs",
17
+ "premocha": "node ./build.cjs --type=test",
18
+ "mocha": "mocha __tests/**/*.js",
19
+ "test": "npm run mocha",
20
+ "prepublishOnly": "npm run build & npm run test",
21
+ "debug": "npm run start & npm run premocha",
22
+ "clean": "rimraf start.cjs pre.cjs build.cjs src/index.ts dist/ __tests/ __examples/ sub_storage/"
23
+ },
24
+ "exports": {
25
+ ".": {
26
+ "types": "./dist/index.d.ts",
27
+ "import": "./dist/index.js",
28
+ "require": "./dist/index.cjs.js"
29
+ },
30
+ "./storage": {
31
+ "types": "./sub_storage/offline.d.ts",
32
+ "import": "./sub_storage/offline.js",
33
+ "require": "./sub_storage/offline.cjs.js"
34
+ }
35
+ },
36
+ "author": "vope",
37
+ "license": "ISC",
38
+ "files": [
39
+ "dist",
40
+ "sub_storage"
41
+ ],
42
+ "devDependencies": {
43
+ "@babel/parser": "^7.26.9",
44
+ "@babel/traverse": "^7.26.9",
45
+ "@babel/types": "^7.26.9",
46
+ "@rollup/plugin-alias": "^5.1.1",
47
+ "@rollup/plugin-commonjs": "^28.0.2",
48
+ "@rollup/plugin-json": "^6.1.0",
49
+ "@rollup/plugin-node-resolve": "^16.0.0",
50
+ "@rollup/plugin-typescript": "^12.1.2",
51
+ "@types/babel__traverse": "^7.20.6",
52
+ "@types/mocha": "^10.0.6",
53
+ "@types/node": "^22.13.5",
54
+ "@types/sm-crypto": "^0.3.4",
55
+ "esbuild": "^0.25.0",
56
+ "glob": "^11.0.1",
57
+ "iconv-lite": "^0.6.3",
58
+ "mocha": "^10.2.0",
59
+ "puppeteer": "^24.3.0",
60
+ "rimraf": "^5.0.5",
61
+ "rollup": "^4.34.8",
62
+ "tslib": "^2.8.1",
63
+ "typescript": "^6.0.3",
64
+ "uuid": "^11.1.0"
65
+ },
66
+ "dependencies": {
67
+ "@type-challenges/utils": "^0.1.1",
68
+ "@types/lodash-es": "^4.17.12",
69
+ "@vope/types": "^1.2.0",
70
+ "csstype": "^3.2.3",
71
+ "localforage": "^1.10.0",
72
+ "lodash-es": "^4.17.21",
73
+ "sm-crypto": "^0.3.13"
74
+ },
75
+ "pnpm": {
76
+ "onlyBuiltDependencies": [
77
+ "esbuild",
78
+ "puppeteer"
79
+ ]
80
+ }
81
+ }
@@ -1,5 +1,4 @@
1
1
  {
2
- "types": "offline.d.ts",
3
2
  "import": "offline.js",
4
3
  "require": "offline.cjs.js"
5
4
  }
@@ -1,12 +0,0 @@
1
- /**
2
- * 处理输入文本中的特殊字符,用于转换正则表达式
3
- * @param text
4
- * @param flags 表示输出正则表达式
5
- */
6
- export declare function inputRegex(text: string, flags?: string): RegExp;
7
- /**
8
- * 处理输入文本中的特殊字符,用于转换正则表达式
9
- * @param text
10
- * @param flags 表示输出字符串,该字符串将作为正则表达式的一部分
11
- */
12
- export declare function inputRegex(text: string, flags: false): string;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes