mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 15:27:50 +00:00
Bump to v4.7.0.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
define(['./toString'], function(toString) {
|
||||
define(['./memoize', './toString'], function(memoize, toString) {
|
||||
|
||||
/** Used to match property names within property paths. */
|
||||
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g;
|
||||
@@ -13,13 +13,13 @@ define(['./toString'], function(toString) {
|
||||
* @param {string} string The string to convert.
|
||||
* @returns {Array} Returns the property path array.
|
||||
*/
|
||||
function stringToPath(string) {
|
||||
var stringToPath = memoize(function(string) {
|
||||
var result = [];
|
||||
toString(string).replace(rePropName, function(match, number, quote, string) {
|
||||
result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
|
||||
});
|
||||
return result;
|
||||
}
|
||||
});
|
||||
|
||||
return stringToPath;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user