Initial commit
[yaffs-website] / node_modules / node-sass / node_modules / lodash / toPath.js
1 var arrayMap = require('./_arrayMap'),
2     copyArray = require('./_copyArray'),
3     isArray = require('./isArray'),
4     isSymbol = require('./isSymbol'),
5     stringToPath = require('./_stringToPath'),
6     toKey = require('./_toKey');
7
8 /**
9  * Converts `value` to a property path array.
10  *
11  * @static
12  * @memberOf _
13  * @since 4.0.0
14  * @category Util
15  * @param {*} value The value to convert.
16  * @returns {Array} Returns the new property path array.
17  * @example
18  *
19  * _.toPath('a.b.c');
20  * // => ['a', 'b', 'c']
21  *
22  * _.toPath('a[0].b.c');
23  * // => ['a', '0', 'b', 'c']
24  */
25 function toPath(value) {
26   if (isArray(value)) {
27     return arrayMap(value, toKey);
28   }
29   return isSymbol(value) ? [value] : copyArray(stringToPath(value));
30 }
31
32 module.exports = toPath;