source: node_modules/lodash/_castPath.js@ d24f17c

main
Last change on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 569 bytes
RevLine 
[d24f17c]1var isArray = require('./isArray'),
2 isKey = require('./_isKey'),
3 stringToPath = require('./_stringToPath'),
4 toString = require('./toString');
5
6/**
7 * Casts `value` to a path array if it's not one.
8 *
9 * @private
10 * @param {*} value The value to inspect.
11 * @param {Object} [object] The object to query keys on.
12 * @returns {Array} Returns the cast property path array.
13 */
14function castPath(value, object) {
15 if (isArray(value)) {
16 return value;
17 }
18 return isKey(value, object) ? [value] : stringToPath(toString(value));
19}
20
21module.exports = castPath;
Note: See TracBrowser for help on using the repository browser.