CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes45downloads
toPath.js34 linesDownload Raw Back to lodash-es
1import arrayMap from './_arrayMap.js';2import copyArray from './_copyArray.js';3import isArray from './isArray.js';4import isSymbol from './isSymbol.js';5import stringToPath from './_stringToPath.js';6import toKey from './_toKey.js';7import toString from './toString.js';8 9/**10 * Converts `value` to a property path array.11 *12 * @static13 * @memberOf _14 * @since 4.0.015 * @category Util16 * @param {*} value The value to convert.17 * @returns {Array} Returns the new property path array.18 * @example19 *20 * _.toPath('a.b.c');21 * // => ['a', 'b', 'c']22 *23 * _.toPath('a[0].b.c');24 * // => ['a', '0', 'b', 'c']25 */26function toPath(value) {27  if (isArray(value)) {28    return arrayMap(value, toKey);29  }30  return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));31}32 33export default toPath;34 
basant307/AI_Governance_Project · CoolFace