Urara-Blog/node_modules/.pnpm-store/v3/files/d1/70a263e8453f206a9d692ba27acd8e1f1dce98981864d14db30716b6822d4285cb8e5fe7e84074740ebff233d65d86757813f94081b53e4a23fb6cb4d9fbdd
2022-08-14 01:14:53 +08:00

21 lines
569 B
Text

var isArray = require('./isArray'),
isKey = require('./_isKey'),
stringToPath = require('./_stringToPath'),
toString = require('./toString');
/**
* Casts `value` to a path array if it's not one.
*
* @private
* @param {*} value The value to inspect.
* @param {Object} [object] The object to query keys on.
* @returns {Array} Returns the cast property path array.
*/
function castPath(value, object) {
if (isArray(value)) {
return value;
}
return isKey(value, object) ? [value] : stringToPath(toString(value));
}
module.exports = castPath;