We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
stringToPath
1 parent 03e23ec commit 8e631dfCopy full SHA for 8e631df
.internal/stringToPath.js
@@ -1,7 +1,7 @@
1
import memoizeCapped from './memoizeCapped.js'
2
3
+const charCodeOfDot = '.'.charCodeAt(0)
4
const reEscapeChar = /\\(\\)?/g
-const reLeadingDot = /^\./
5
const rePropName = RegExp(
6
// Match anything that isn't a dot or bracket.
7
'[^.[\\]]+' + '|' +
@@ -25,7 +25,7 @@ const rePropName = RegExp(
25
*/
26
const stringToPath = memoizeCapped((string) => {
27
const result = []
28
- if (reLeadingDot.test(string)) {
+ if (string.charCodeAt(0) === charCodeOfDot) {
29
result.push('')
30
}
31
string.replace(rePropName, (match, expression, quote, subString) => {
0 commit comments