1 var memoizeCapped = require('./_memoizeCapped');
3 /** Used to match property names within property paths. */
4 var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
6 /** Used to match backslashes in property paths. */
7 var reEscapeChar = /\\(\\)?/g;
10 * Converts `string` to a property path array.
13 * @param {string} string The string to convert.
14 * @returns {Array} Returns the property path array.
16 var stringToPath = memoizeCapped(function(string) {
18 if (string.charCodeAt(0) === 46 /* . */) {
21 string.replace(rePropName, function(match, number, quote, subString) {
22 result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
27 module.exports = stringToPath;