mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
Replacing a regex in stringToPath with a quick character code check. (#3308)
This commit is contained in:
@@ -143,7 +143,6 @@
|
|||||||
/** Used to match property names within property paths. */
|
/** Used to match property names within property paths. */
|
||||||
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
|
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
|
||||||
reIsPlainProp = /^\w*$/,
|
reIsPlainProp = /^\w*$/,
|
||||||
reLeadingDot = /^\./,
|
|
||||||
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -6727,7 +6726,7 @@
|
|||||||
*/
|
*/
|
||||||
var stringToPath = memoizeCapped(function(string) {
|
var stringToPath = memoizeCapped(function(string) {
|
||||||
var result = [];
|
var result = [];
|
||||||
if (reLeadingDot.test(string)) {
|
if (string.charCodeAt(0) === 46 /* . */) {
|
||||||
result.push('');
|
result.push('');
|
||||||
}
|
}
|
||||||
string.replace(rePropName, function(match, number, quote, subString) {
|
string.replace(rePropName, function(match, number, quote, subString) {
|
||||||
|
|||||||
Reference in New Issue
Block a user