Skip to content

Commit

Permalink
Replacing a regex in stringToPath with a quick character code check. (
Browse files Browse the repository at this point in the history
  • Loading branch information
jdalton committed Feb 3, 2018
1 parent f831977 commit 7167a78
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lodash.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@
/** Used to match property names within property paths. */
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
reIsPlainProp = /^\w*$/,
reLeadingDot = /^\./,
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;

/**
Expand Down Expand Up @@ -6727,7 +6726,7 @@
*/
var stringToPath = memoizeCapped(function(string) {
var result = [];
if (reLeadingDot.test(string)) {
if (string.charCodeAt(0) === 46 /* . */) {
result.push('');
}
string.replace(rePropName, function(match, number, quote, subString) {
Expand Down

0 comments on commit 7167a78

Please sign in to comment.