Security update for permissions_by_term
[yaffs-website] / node_modules / uncss / node_modules / lodash / toPath.js
1 var arrayMap = require('./internal/arrayMap'),
2     isArray = require('./isArray'),
3     stringToPath = require('./internal/stringToPath');
4
5 /**
6  * Converts `value` to a property path array.
7  *
8  * @static
9  * @memberOf _
10  * @category Util
11  * @param {*} value The value to convert.
12  * @returns {Array} Returns the new property path array.
13  * @example
14  *
15  * _.toPath('a.b.c');
16  * // => ['a', 'b', 'c']
17  *
18  * _.toPath('a[0].b.c');
19  * // => ['a', '0', 'b', 'c']
20  *
21  * var path = ['a', 'b', 'c'],
22  *     newPath = _.toPath(path);
23  *
24  * console.log(newPath);
25  * // => ['a', 'b', 'c']
26  *
27  * console.log(path === newPath);
28  * // => false
29  */
30 function toPath(value) {
31   return isArray(value) ? arrayMap(value, String) : stringToPath(value);
32 }
33
34 module.exports = toPath;