Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8e631df

Browse filesBrowse files
committed
Faster testing against first char in stringToPath (to close #3308).
1 parent 03e23ec commit 8e631df
Copy full SHA for 8e631df

File tree

Expand file treeCollapse file tree

1 file changed

+2
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-2
lines changed

‎.internal/stringToPath.js

Copy file name to clipboardExpand all lines: .internal/stringToPath.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import memoizeCapped from './memoizeCapped.js'
22

3+
const charCodeOfDot = '.'.charCodeAt(0)
34
const reEscapeChar = /\\(\\)?/g
4-
const reLeadingDot = /^\./
55
const rePropName = RegExp(
66
// Match anything that isn't a dot or bracket.
77
'[^.[\\]]+' + '|' +
@@ -25,7 +25,7 @@ const rePropName = RegExp(
2525
*/
2626
const stringToPath = memoizeCapped((string) => {
2727
const result = []
28-
if (reLeadingDot.test(string)) {
28+
if (string.charCodeAt(0) === charCodeOfDot) {
2929
result.push('')
3030
}
3131
string.replace(rePropName, (match, expression, quote, subString) => {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.