ut2 1.15.0 → 1.16.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 (68) hide show
  1. package/README.md +7 -0
  2. package/dist/ut2.js +131 -3
  3. package/dist/ut2.js.map +1 -1
  4. package/dist/ut2.min.js +1 -1
  5. package/dist/ut2.min.js.map +1 -1
  6. package/es/fromPathPairs.js +25 -0
  7. package/es/get.js +20 -0
  8. package/es/guard.js +2 -1
  9. package/es/index.js +6 -0
  10. package/es/internals/helpers.js +1 -1
  11. package/es/internals/isIndex.js +12 -0
  12. package/es/internals/stringToPath.js +15 -0
  13. package/es/merge.js +1 -1
  14. package/es/pathPairs.js +25 -0
  15. package/es/set.js +33 -0
  16. package/es/toPath.js +20 -0
  17. package/es/unset.js +15 -0
  18. package/lib/fromPathPairs.js +27 -0
  19. package/lib/get.js +22 -0
  20. package/lib/guard.js +2 -1
  21. package/lib/index.js +12 -0
  22. package/lib/internals/helpers.js +1 -1
  23. package/lib/internals/isIndex.js +14 -0
  24. package/lib/internals/stringToPath.js +17 -0
  25. package/lib/merge.js +1 -1
  26. package/lib/pathPairs.js +27 -0
  27. package/lib/set.js +35 -0
  28. package/lib/toPath.js +22 -0
  29. package/lib/unset.js +17 -0
  30. package/package.json +3 -5
  31. package/types/camelCase.d.ts +1 -1
  32. package/types/ceil.d.ts +1 -1
  33. package/types/compact.d.ts +1 -1
  34. package/types/eq.d.ts +1 -1
  35. package/types/escape.d.ts +1 -1
  36. package/types/escapeRegExp.d.ts +1 -1
  37. package/types/floor.d.ts +1 -1
  38. package/types/fromPathPairs.d.ts +42 -0
  39. package/types/get.d.ts +21 -0
  40. package/types/index.d.ts +6 -0
  41. package/types/internals/isIndex.d.ts +17 -0
  42. package/types/internals/native.d.ts +3 -3
  43. package/types/internals/root.d.ts +1 -1
  44. package/types/internals/stringToPath.d.ts +9 -0
  45. package/types/internals/types.d.ts +1 -0
  46. package/types/invert.d.ts +1 -1
  47. package/types/isBlob.d.ts +2 -2
  48. package/types/isFile.d.ts +1 -1
  49. package/types/isLength.d.ts +1 -1
  50. package/types/isObject.d.ts +1 -1
  51. package/types/isTypedArray.d.ts +1 -1
  52. package/types/kebabCase.d.ts +1 -1
  53. package/types/merge.d.ts +1 -1
  54. package/types/mergeObject.d.ts +1 -1
  55. package/types/move.d.ts +1 -1
  56. package/types/omitBy.d.ts +1 -1
  57. package/types/orderBy.d.ts +1 -1
  58. package/types/partition.d.ts +2 -2
  59. package/types/pascalCase.d.ts +1 -1
  60. package/types/pathPairs.d.ts +30 -0
  61. package/types/pickBy.d.ts +1 -1
  62. package/types/round.d.ts +1 -1
  63. package/types/set.d.ts +24 -0
  64. package/types/snakeCase.d.ts +1 -1
  65. package/types/toLength.d.ts +1 -1
  66. package/types/toPath.d.ts +17 -0
  67. package/types/unset.d.ts +20 -0
  68. package/types/words.d.ts +1 -1
package/types/get.d.ts ADDED
@@ -0,0 +1,21 @@
1
+ import { Many, TPath } from './internals/types';
2
+ /**
3
+ * 获取对象路径的值。
4
+ *
5
+ * @alias module:Object.get
6
+ * @since 1.16.0
7
+ * @param {*} object 要查询的对象。
8
+ * @param {string | number | symbol | Array} path 属性路径字符串或数组。
9
+ * @param {*} [defaultValue] 替代返回 `undefined` 的默认值。
10
+ * @returns {*} 属性值。
11
+ * @example
12
+ * const obj = { a: [{ b: { c: 1 } }] };
13
+ *
14
+ * get(obj, 'a[0].b.c'); // 1
15
+ *
16
+ * get(obj, ['a', '0', 'b', 'c']); // 1
17
+ *
18
+ * get(obj, 'a.b.c', 'default'); // 'default'
19
+ */
20
+ declare function get<TDefault = unknown>(object: any, key: Many<TPath>, defaultValue?: TDefault): TDefault | undefined;
21
+ export default get;
package/types/index.d.ts CHANGED
@@ -128,6 +128,8 @@ export { default as randomInt } from './randomInt';
128
128
  export { default as allKeys } from './allKeys';
129
129
  export { default as allKeysIn } from './allKeysIn';
130
130
  export { default as findKey } from './findKey';
131
+ export { default as fromPathPairs } from './fromPathPairs';
132
+ export { default as get } from './get';
131
133
  export { default as invert } from './invert';
132
134
  export { default as keys } from './keys';
133
135
  export { default as keysIn } from './keysIn';
@@ -137,6 +139,9 @@ export { default as omit } from './omit';
137
139
  export { default as omitBy } from './omitBy';
138
140
  export { default as pick } from './pick';
139
141
  export { default as pickBy } from './pickBy';
142
+ export { default as pathPairs } from './pathPairs';
143
+ export { default as set } from './set';
144
+ export { default as unset } from './unset';
140
145
  /**
141
146
  * 字符串
142
147
  *
@@ -185,6 +190,7 @@ export { default as toFinite } from './toFinite';
185
190
  export { default as toInteger } from './toInteger';
186
191
  export { default as toLength } from './toLength';
187
192
  export { default as toNumber } from './toNumber';
193
+ export { default as toPath } from './toPath';
188
194
  export { default as toSafeInteger } from './toSafeInteger';
189
195
  export { default as toString } from './toString';
190
196
  export { default as tryit } from './tryit';
@@ -0,0 +1,17 @@
1
+ /**
2
+ * 检查值是否为有效的数组索引值。
3
+ *
4
+ * @private
5
+ * @param value 要检查的值。
6
+ * @returns {boolean} 值是否为有效的数组索引值。
7
+ * @example
8
+ * isIndex(0); // true
9
+ * isIndex('0'); // true
10
+ * isIndex('42'); // true
11
+ *
12
+ * isIndex('a'); // false
13
+ * isIndex(0.1); // false
14
+ * isIndex(Infinity); // false
15
+ */
16
+ declare function isIndex(value: any): boolean;
17
+ export default isIndex;
@@ -31,19 +31,19 @@ export declare const selfExisted: false | (Window & typeof globalThis);
31
31
  /**
32
32
  * @summary 最大安全整数。
33
33
  * @since 1.0.0
34
- * @see {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER | MAX_SAFE_INTEGER}
34
+ * @see {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER MAX_SAFE_INTEGER}
35
35
  */
36
36
  export declare const MAX_SAFE_INTEGER: number;
37
37
  /**
38
38
  * @summary 最小安全整数。
39
39
  * @since 1.0.0
40
- * @see {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Number/MIN_SAFE_INTEGER | MIN_SAFE_INTEGER}
40
+ * @see {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Number/MIN_SAFE_INTEGER MIN_SAFE_INTEGER}
41
41
  */
42
42
  export declare const MIN_SAFE_INTEGER: number;
43
43
  /**
44
44
  * @summary 最大数组长度 `Math.pow(2,32) - 1`。
45
45
  * @since 1.0.0
46
- * @see {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/length | length}
46
+ * @see {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/length length}
47
47
  */
48
48
  export declare const MAX_ARRAY_LENGTH = 4294967295;
49
49
  export declare const bigIntTag = "[object BigInt]";
@@ -7,7 +7,7 @@
7
7
  * 3. Web Workers 中等同于 `self`
8
8
  *
9
9
  * @since 1.10.0
10
- * @see {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/globalThis | globalThis}
10
+ * @see {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/globalThis globalThis}
11
11
  */
12
12
  declare const root: typeof globalThis;
13
13
  export default root;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * 将字符串路径转为数组路径
3
+ *
4
+ * @private
5
+ * @param {string} value 字符串路径
6
+ * @returns {string[]} 路径数组
7
+ */
8
+ declare function stringToPath(value: string): string[];
9
+ export default stringToPath;
@@ -3,6 +3,7 @@ export type SyncFn<P extends any[], R> = (...args: P) => R;
3
3
  export type AsyncFn<P extends any[], R> = (...args: P) => Promise<R>;
4
4
  export type SingleSyncFn<R> = () => R;
5
5
  export type SingleAsyncFn<R> = () => Promise<R>;
6
+ export type TPath = string | symbol | number;
6
7
  /**
7
8
  * 工具辅助类型
8
9
  */
package/types/invert.d.ts CHANGED
@@ -4,7 +4,7 @@ import { ObjectPredicate, PropertyName, WithNullable } from './internals/types';
4
4
  *
5
5
  * @alias module:Object.invert
6
6
  * @since 1.8.0
7
- * @see {@link https://developer.mozilla.org/zh-CN/docs/Glossary/Truthy | Truthy}
7
+ * @see {@link https://developer.mozilla.org/zh-CN/docs/Glossary/Truthy Truthy}
8
8
  * @param {Object} object 来源对象。
9
9
  * @param {Function} [predicate] 调用每一个属性的函数,返回 `Truthy` 表示要反转,否则不反转。
10
10
  * @returns {Object} 新对象。
package/types/isBlob.d.ts CHANGED
@@ -5,8 +5,8 @@
5
5
  *
6
6
  * @alias module:Language.isBlob
7
7
  * @since 1.0.0
8
- * @see {@link https://developer.mozilla.org/zh-CN/docs/Web/API/Blob | Blob}
9
- * @see {@link https://developer.mozilla.org/zh-CN/docs/Web/API/File | File}
8
+ * @see {@link https://developer.mozilla.org/zh-CN/docs/Web/API/Blob Blob}
9
+ * @see {@link https://developer.mozilla.org/zh-CN/docs/Web/API/File File}
10
10
  * @param {*} value 要检查的值。
11
11
  * @returns {boolean} 如果值为 `Blob` 对象,返回 `true`,否则返回 `false`。
12
12
  * @example
package/types/isFile.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * @alias module:Language.isFile
7
7
  * @since 1.11.0
8
- * @see {@link https://developer.mozilla.org/zh-CN/docs/Web/API/File | File}
8
+ * @see {@link https://developer.mozilla.org/zh-CN/docs/Web/API/File File}
9
9
  * @param {*} value 要检查的值。
10
10
  * @returns {boolean} 如果值为 `File` 对象,返回 `true`,否则返回 `false`。
11
11
  * @example
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * @alias module:Language.isLength
5
5
  * @since 1.0.0
6
- * @see {@link https://tc39.es/ecma262/#sec-tolength | ToLength}
6
+ * @see {@link https://tc39.es/ecma262/#sec-tolength ToLength}
7
7
  * @param {*} value 要检查的值。
8
8
  * @returns {boolean} 如果值为有效的类数组长度,返回 `true`,否则返回 `false`。
9
9
  * @example
@@ -4,7 +4,7 @@ import { FunctionAny } from './internals/types';
4
4
  *
5
5
  * @alias module:Language.isObject
6
6
  * @since 1.0.0
7
- * @see {@link https://tc39.es/ecma262/#sec-ecmascript-language-types | language type}
7
+ * @see {@link https://tc39.es/ecma262/#sec-ecmascript-language-types language type}
8
8
  * @param {*} value 要检查的值。
9
9
  * @returns {boolean} 如果值为对象,返回 `true`,否则返回 `false`。
10
10
  * @example
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * @alias module:Language.isTypedArray
5
5
  * @since 1.0.0
6
- * @see {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Guide/Typed_arrays | Typed_arrays}
6
+ * @see {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Guide/Typed_arrays Typed_arrays}
7
7
  * @param {*} value 要检查的值。
8
8
  * @returns {boolean} 如果值为类型化数组,返回 `true`,否则返回 `false`。
9
9
  * @example
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * @alias module:String.kebabCase
5
5
  * @since 1.0.0
6
- * @see {@link https://en.wikipedia.org/wiki/Letter_case#Special_case_styles | kebab case}
6
+ * @see {@link https://en.wikipedia.org/wiki/Letter_case#Special_case_styles kebab case}
7
7
  * @param {string} string 要转换的字符串。
8
8
  * @param {RegExp | string} [pattern] 拆分词组的匹配模式。
9
9
  * @returns {string} 转换后的字符串。
package/types/merge.d.ts CHANGED
@@ -7,7 +7,7 @@ type Customizer = (objValue: any, srcValue: any, key: string | symbol, object: a
7
7
  *
8
8
  * 如果不需要合并数组,第三个参数传入 `merge.NOT_MERGE_ARRAYS` 。
9
9
  *
10
- * 如果需要合并继承的属性,第四个参数传入 {@link https://caijf.github.io/ut2/module-Object.html#.allKeysIn allKeysIn} 方法, `merge(object, source, undefined, allKeysIn)`。
10
+ * 如果需要合并继承的属性,第四个参数传入 {@link https://caijf.github.io/ut2/module-Object.html#.allKeys allKeys} 方法, `merge(object, source, undefined, allKeys)`。
11
11
  *
12
12
  * @alias module:Object.merge
13
13
  * @since 1.0.0
@@ -21,7 +21,7 @@ interface MergeObject {
21
21
  * @alias module:Object.mergeObject
22
22
  * @since 1.15.0
23
23
  * @param {Object | Array} object 目标对象。
24
- * @param {...object} args 展开的来源对象。
24
+ * @param {...object} args 来源对象。
25
25
  * @returns 目标对象。
26
26
  * @example
27
27
  *
package/types/move.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * @alias module:Array.move
5
5
  * @since 1.10.0
6
- * @see {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/splice | splice}
6
+ * @see {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/splice splice}
7
7
  * @param {Array} array 要处理的数组。
8
8
  * @param {number} from 要移动的元素索引。
9
9
  * @param {number} to 要移动目标位置的元素索引。
package/types/omitBy.d.ts CHANGED
@@ -6,7 +6,7 @@ import { ObjectPredicate, WithNullable } from './internals/types';
6
6
  *
7
7
  * @alias module:Object.omitBy
8
8
  * @since 1.0.0
9
- * @see {@link https://developer.mozilla.org/zh-CN/docs/Glossary/Truthy | Truthy}
9
+ * @see {@link https://developer.mozilla.org/zh-CN/docs/Glossary/Truthy Truthy}
10
10
  * @param {Object} object 来源对象。
11
11
  * @param {Function} [predicate] 调用每一个属性的函数,返回 `Truthy` 表示要忽略该属性,否则不忽略。
12
12
  * @returns {Object} 新对象。
@@ -16,7 +16,7 @@ interface OrderBy {
16
16
  * @function
17
17
  * @alias module:Collection.orderBy
18
18
  * @since 1.0.0
19
- * @see {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/sort | sort}
19
+ * @see {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/sort sort}
20
20
  * @param {ArrayLike<any> | Object} collection 一个用来迭代的集合。
21
21
  * @param {Function | string | number | Symbol | Array} [iteratees] 排序的迭代函数。
22
22
  * @param {'asc' | 'desc' | Array} [orders] 迭代函数的排序顺序。
@@ -12,8 +12,8 @@ interface Partition {
12
12
  *
13
13
  * @alias module:Collection.partition
14
14
  * @since 1.0.0
15
- * @see {@link https://developer.mozilla.org/zh-CN/docs/Glossary/Truthy | Truthy}
16
- * @see {@link https://developer.mozilla.org/zh-CN/docs/Glossary/Falsy | Falsy}
15
+ * @see {@link https://developer.mozilla.org/zh-CN/docs/Glossary/Truthy Truthy}
16
+ * @see {@link https://developer.mozilla.org/zh-CN/docs/Glossary/Falsy Falsy}
17
17
  * @param {ArrayLike<any> | Object} collection 一个用来迭代的集合。
18
18
  * @param {Function | string | number | Symbol | Array} [predicate=identity] 每次迭代调用的断言函数。默认 `identity`。
19
19
  * @returns {Array} 分组后的数组。
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * @alias module:String.pascalCase
5
5
  * @since 1.8.0
6
- * @see {@link https://en.wikipedia.org/wiki/Camel_case | Camel_case}
6
+ * @see {@link https://en.wikipedia.org/wiki/Camel_case Camel_case}
7
7
  * @param {string} string 要转换的字符串。
8
8
  * @param {RegExp | string} [pattern] 拆分词组的匹配模式。
9
9
  * @returns {string} 帕斯卡写法的字符串。
@@ -0,0 +1,30 @@
1
+ import { TPath } from './internals/types';
2
+ /**
3
+ * 将对象转为属性路径/值对的数组。与 [`fromPathPairs`](#.fromPathPairs) 相反。
4
+ *
5
+ * @alias module:Object.pathPairs
6
+ * @since 1.16.0
7
+ * @param {Object|Array} object 对象或数组。
8
+ * @returns {Array} 属性路径/值对的数组。
9
+ * @example
10
+ * pathPairs({ date: { start: '2024-10-10', end: '2024-12-31' } });
11
+ * // [
12
+ * // [['date', 'start'], '2024-10-10'],
13
+ * // [['date', 'end'], '2024-12-31']
14
+ * // ]
15
+ *
16
+ * pathPairs({ date: ['2024-10-10', '2024-12-31'] });
17
+ * // [
18
+ * // [['date', 0], '2024-10-10'],
19
+ * // [['date', 1], '2024-12-31']
20
+ * // ]
21
+ *
22
+ * pathPairs([{ date: '2024-10-10' }, { date: '2024-12-31' }]);
23
+ * // [
24
+ * // [[0, 'date'], '2024-10-10'],
25
+ * // [[1, 'date'], '2024-12-31']
26
+ * // ]
27
+ *
28
+ */
29
+ declare function pathPairs(object: Record<string, any> | any[]): [TPath[], any][];
30
+ export default pathPairs;
package/types/pickBy.d.ts CHANGED
@@ -6,7 +6,7 @@ import { ObjectPredicate, WithNullable } from './internals/types';
6
6
  *
7
7
  * @alias module:Object.pickBy
8
8
  * @since 1.0.0
9
- * @see {@link https://developer.mozilla.org/zh-CN/docs/Glossary/Truthy | Truthy}
9
+ * @see {@link https://developer.mozilla.org/zh-CN/docs/Glossary/Truthy Truthy}
10
10
  * @param {Object} obj 来源对象。
11
11
  * @param {Function} [predicate] 调用每一个属性的函数,返回 `Truthy` 表示要提取该属性,否则不提取。
12
12
  * @returns {Object} 新对象。
package/types/round.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * @alias module:Math.round
7
7
  * @since 1.0.0
8
- * @see {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Math/round#小数舍入 | 小数舍入}
8
+ * @see {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Math/round#小数舍入 小数舍入}
9
9
  * @param {number} number 要四舍五入的值。
10
10
  * @param {number} [precision=0] 四舍五入的精度。默认 `0`。
11
11
  * @returns {number} 四舍五入的值。
package/types/set.d.ts ADDED
@@ -0,0 +1,24 @@
1
+ import { Many, TPath } from './internals/types';
2
+ type TCustomizer = (objValue: any, key: TPath, nested: any) => any;
3
+ /**
4
+ * 设置对象属性路径值。
5
+ *
6
+ * @alias module:Object.set
7
+ * @since 1.16.0
8
+ * @param {Object | Array} object 对象或数组。
9
+ * @param {string | number | symbol | Array} path 属性路径字符串或数组。
10
+ * @param {*} value 要设置的值。
11
+ * @param {Function} [customizer] 自定义指定值。
12
+ * @returns `object`。
13
+ * @example
14
+ * const obj = {};
15
+ *
16
+ * set(obj, 'a.b', 1);
17
+ * console.log(obj); // { a: { b: 1 } }
18
+ *
19
+ * set(obj, ['x', '0', 'y'], 2);
20
+ * console.log(obj); // { a: { b: 1 }, x: [{ y: 2 }] }
21
+ *
22
+ */
23
+ declare function set<T extends object>(object: T, path: Many<TPath>, value: any, customizer?: TCustomizer): T;
24
+ export default set;
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * @alias module:String.snakeCase
5
5
  * @since 1.0.0
6
- * @see {@link https://en.wikipedia.org/wiki/Snake_case | snake case}
6
+ * @see {@link https://en.wikipedia.org/wiki/Snake_case snake case}
7
7
  * @param {string} string 要转换的字符串。
8
8
  * @param {RegExp | string} [pattern] 拆分词组的匹配模式。
9
9
  * @returns {string} 转换后的字符串。
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * @alias module:Util.toLength
5
5
  * @since 1.0.0
6
- * @see {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/length | length}
6
+ * @see {@link https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/length length}
7
7
  * @param {*} value 要转换的值。
8
8
  * @returns {number} 转换后的整数。
9
9
  * @example
@@ -0,0 +1,17 @@
1
+ /**
2
+ * 将值转为属性路径数组。
3
+ *
4
+ * @alias module:Util.toPath
5
+ * @since 1.16.0
6
+ * @param {*} value 要转换的值。
7
+ * @param {Object} [object] 用于查询键的对象,可选。
8
+ * @returns {Array} 一个新的属性路径数组。
9
+ * @example
10
+ * toPath('a.b.c'); // ['a', 'b', 'c']
11
+ *
12
+ * toPath('a[0].b.c'); // ['a', '0', 'b', 'c']
13
+ *
14
+ * toPath(['a', 'b', 'c']); // ['a', 'b', 'c']
15
+ */
16
+ declare function toPath(value: any, object?: object): (string | symbol)[];
17
+ export default toPath;
@@ -0,0 +1,20 @@
1
+ import { Many, TPath } from './internals/types';
2
+ /**
3
+ * 删除对象路径的属性。
4
+ *
5
+ * @alias module:Object.unset
6
+ * @since 1.16.0
7
+ * @param {*} object 要修改的对象。
8
+ * @param {string | number | symbol | Array} path 属性路径字符串或数组。
9
+ * @returns {boolean} 如果删除成功返回`true`,否则返回`false`。
10
+ * @example
11
+ * const obj = { a: [{ b: { c: 1 } }] };
12
+ *
13
+ * unset(obj, 'a[0].b.c'); // true
14
+ * console.log(obj); // { a: [{ b: {} }] }
15
+ *
16
+ * unset(obj, ['a', '0', 'b', 'c']); // true
17
+ * console.log(obj); // { a: [{ b: {} }] }
18
+ */
19
+ declare function unset(object: any, path: Many<TPath>): boolean;
20
+ export default unset;
package/types/words.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * @alias module:String.words
5
5
  * @since 1.0.0
6
- * @see {@link https://zh.wikipedia.org/wiki/ASCII | ASCII}
6
+ * @see {@link https://zh.wikipedia.org/wiki/ASCII ASCII}
7
7
  * @param {string} string 要拆分的字符串。
8
8
  * @param {RegExp | string} [pattern=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g] 匹配模式。默认 `/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g`。
9
9
  * @returns {string[]} 拆分后的数组。