UNPKG

ut2

Version:

一个现代 JavaScript 实用工具库。[点击查看在线文档]。

18 lines (17 loc) 501 B
/** * 将值转为属性路径数组。 * * @alias module:Util.toPath * @since 1.16.0 * @param {*} value 要转换的值。 * @param {Object} [object] 用于查询键的对象,可选。 * @returns {Array} 一个新的属性路径数组。 * @example * toPath('a.b.c'); // ['a', 'b', 'c'] * * toPath('a[0].b.c'); // ['a', '0', 'b', 'c'] * * toPath(['a', 'b', 'c']); // ['a', 'b', 'c'] */ declare function toPath(value: any, object?: object): (string | symbol)[]; export default toPath;