ut2 1.20.0 → 1.20.1

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.
@@ -63,9 +63,7 @@ function baseDebounce(func, wait, immediate, __throttle__) {
63
63
  if (timer !== nativeUndefined) {
64
64
  clearTimeout(timer);
65
65
  timer = nativeUndefined;
66
- if (lastArgs) {
67
- return invokeFunc(Date.now());
68
- }
66
+ return invokeFunc(Date.now());
69
67
  }
70
68
  return result;
71
69
  }
@@ -2,7 +2,7 @@ import isObjectLike from '../isObjectLike.js';
2
2
  import getTag from './getTag.js';
3
3
  import { argumentsTag, functionProtoToString, stringUndefined } from './native.js';
4
4
 
5
- var VERSION = "1.20.0";
5
+ var VERSION = "1.20.1";
6
6
  var isBrowser = typeof window !== stringUndefined && isObjectLike(window) && typeof document !== stringUndefined && isObjectLike(document) && window.document === document;
7
7
  var supportedArgumentsType = getTag((function () { return arguments; })()) === argumentsTag;
8
8
  var FUNC_ERROR_TEXT = 'Expected a function';
@@ -11,12 +11,12 @@ function toSource(func) {
11
11
  try {
12
12
  return functionProtoToString.call(func);
13
13
  }
14
- catch (e) {
14
+ catch (err) {
15
15
  }
16
16
  try {
17
17
  return func + '';
18
18
  }
19
- catch (e) {
19
+ catch (err) {
20
20
  }
21
21
  }
22
22
  return '';
@@ -9,7 +9,7 @@ var nodeUtil = (function () {
9
9
  return types;
10
10
  }
11
11
  }
12
- catch (e) {
12
+ catch (err) {
13
13
  }
14
14
  })();
15
15
  var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer;
package/es/words.js CHANGED
@@ -1,4 +1,4 @@
1
- var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
1
+ var reAsciiWord = /[^\x20-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
2
2
  function words(string, pattern) {
3
3
  if (pattern === void 0) { pattern = reAsciiWord; }
4
4
  return string.match(pattern) || [];
@@ -65,9 +65,7 @@ function baseDebounce(func, wait, immediate, __throttle__) {
65
65
  if (timer !== native.nativeUndefined) {
66
66
  clearTimeout(timer);
67
67
  timer = native.nativeUndefined;
68
- if (lastArgs) {
69
- return invokeFunc(Date.now());
70
- }
68
+ return invokeFunc(Date.now());
71
69
  }
72
70
  return result;
73
71
  }
@@ -4,7 +4,7 @@ var isObjectLike = require('../isObjectLike.js');
4
4
  var getTag = require('./getTag.js');
5
5
  var native = require('./native.js');
6
6
 
7
- var VERSION = "1.20.0";
7
+ var VERSION = "1.20.1";
8
8
  var isBrowser = typeof window !== native.stringUndefined && isObjectLike(window) && typeof document !== native.stringUndefined && isObjectLike(document) && window.document === document;
9
9
  var supportedArgumentsType = getTag((function () { return arguments; })()) === native.argumentsTag;
10
10
  var FUNC_ERROR_TEXT = 'Expected a function';
@@ -13,12 +13,12 @@ function toSource(func) {
13
13
  try {
14
14
  return native.functionProtoToString.call(func);
15
15
  }
16
- catch (e) {
16
+ catch (err) {
17
17
  }
18
18
  try {
19
19
  return func + '';
20
20
  }
21
- catch (e) {
21
+ catch (err) {
22
22
  }
23
23
  }
24
24
  return '';
@@ -11,7 +11,7 @@ var nodeUtil = (function () {
11
11
  return types;
12
12
  }
13
13
  }
14
- catch (e) {
14
+ catch (err) {
15
15
  }
16
16
  })();
17
17
  var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer;
package/lib/words.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
3
+ var reAsciiWord = /[^\x20-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
4
4
  function words(string, pattern) {
5
5
  if (pattern === void 0) { pattern = reAsciiWord; }
6
6
  return string.match(pattern) || [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ut2",
3
- "version": "1.20.0",
3
+ "version": "1.20.1",
4
4
  "author": "caijf",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
@@ -18,7 +18,7 @@
18
18
  "build:doc": "npm run doc",
19
19
  "doc": "rm -rf docs && rm -rf docs-src && tsc -p tsconfig.build.json -t esnext --outDir docs-src && jsdoc -c conf.json && rm -rf docs-src",
20
20
  "doc:open": "open ./docs/index.html",
21
- "lint": "eslint . --ext .js,.jsx,.ts,.tsx",
21
+ "lint": "eslint .",
22
22
  "lint:fix": "npm run lint:js -- --fix",
23
23
  "prettier": "prettier -w **/*",
24
24
  "commit": "cz",
@@ -59,34 +59,35 @@
59
59
  "registry": "https://registry.npmjs.org/"
60
60
  },
61
61
  "devDependencies": {
62
- "@commitlint/cli": "^19.8.0",
63
- "@commitlint/config-conventional": "^19.8.0",
64
- "@commitlint/cz-commitlint": "^19.8.0",
65
- "@rollup/plugin-commonjs": "^28.0.3",
62
+ "@commitlint/cli": "^19.8.1",
63
+ "@commitlint/config-conventional": "^19.8.1",
64
+ "@commitlint/cz-commitlint": "^19.8.1",
65
+ "@eslint/js": "^9.31.0",
66
+ "@rollup/plugin-commonjs": "^28.0.6",
66
67
  "@rollup/plugin-node-resolve": "^16.0.1",
67
68
  "@rollup/plugin-replace": "^6.0.2",
68
69
  "@rollup/plugin-terser": "^0.4.4",
69
- "@rollup/plugin-typescript": "^12.1.2",
70
- "@types/jest": "^29.5.14",
71
- "@types/node": "^20.17.24",
72
- "@typescript-eslint/eslint-plugin": "^7.18.0",
73
- "@typescript-eslint/parser": "^7.18.0",
70
+ "@rollup/plugin-typescript": "^12.1.4",
71
+ "@types/jest": "^30.0.0",
72
+ "@types/node": "^20.19.9",
74
73
  "benchmark": "^2.1.4",
75
74
  "commitizen": "^4.3.1",
76
75
  "cross-env": "^7.0.3",
77
76
  "dayjs": "^1.11.13",
78
77
  "docdash": "^2.0.2",
79
- "eslint": "^8.57.1",
78
+ "eslint": "^9.31.0",
79
+ "globals": "^16.3.0",
80
80
  "husky": "^9.1.7",
81
- "jest": "^29.7.0",
82
- "jest-environment-jsdom": "^29.7.0",
81
+ "jest": "^30.0.5",
82
+ "jest-environment-jsdom": "^30.0.5",
83
83
  "jsdoc": "^4.0.4",
84
- "lint-staged": "^15.5.0",
84
+ "lint-staged": "^15.5.2",
85
85
  "lodash": "^4.17.21",
86
- "prettier": "^3.5.3",
87
- "rollup": "^4.35.0",
88
- "ts-jest": "^29.2.6",
89
- "typescript": "^5.8.2",
86
+ "prettier": "^3.6.2",
87
+ "rollup": "^4.45.1",
88
+ "ts-jest": "^29.4.0",
89
+ "typescript": "^5.8.3",
90
+ "typescript-eslint": "^8.38.0",
90
91
  "underscore": "^1.13.7"
91
92
  },
92
93
  "engines": {
package/types/clamp.d.ts CHANGED
@@ -5,12 +5,16 @@ interface Clamp {
5
5
  /**
6
6
  * 数字限制在 `lower` 和 `upper` 之间的值。
7
7
  *
8
+ * 特殊说明:
9
+ * - 如果只传入 1 个参数,直接返回该参数;
10
+ * - 如果只传入 2 个参数,`lower` 透传给 `upper`。
11
+ *
8
12
  * @function
9
13
  * @alias module:Number.clamp
10
14
  * @since 1.0.0
11
15
  * @param {number} number 被限制的值。
12
- * @param {number} [lower] 下限。默认 `0`。
13
- * @param {number} upper 上限。默认 `0`。
16
+ * @param {number} [lower] 下限。
17
+ * @param {number} upper 上限。
14
18
  * @returns {number} 限制后的值。
15
19
  * @example
16
20
  *
package/types/words.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * @since 1.0.0
6
6
  * @see {@link https://zh.wikipedia.org/wiki/ASCII ASCII}
7
7
  * @param {string} string 要拆分的字符串。
8
- * @param {RegExp | string} [pattern=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g] 匹配模式。默认 `/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g`。
8
+ * @param {RegExp | string} [pattern=/[^\x20-\x2f\x3a-\x40\x5b-\x60\x7b-\x7e]+/g] 匹配模式。默认 `/[^\x20-\x2f\x3a-\x40\x5b-\x60\x7b-\x7e]+/g`。
9
9
  * @returns {string[]} 拆分后的数组。
10
10
  * @example
11
11
  *