mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 07:47:49 +00:00
Comment the scary regexp.
This commit is contained in:
@@ -2,7 +2,20 @@ import memoizeCapped from './memoizeCapped.js'
|
||||
|
||||
/** Used to match property names within property paths. */
|
||||
const reLeadingDot = /^\./
|
||||
const rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g
|
||||
|
||||
const rePropName = RegExp([
|
||||
// Match anything that isn't a dot or bracket.
|
||||
'[^.[\\]]+',
|
||||
// Or match property names within brackets.
|
||||
'\\[(?:' +
|
||||
// Match numbers.
|
||||
'(-?\\d+(?:\\.\\d+)?)' + '|' +
|
||||
// Or match strings (supports escaping quotation marks).
|
||||
'(["\'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2' +
|
||||
')\\]',
|
||||
// Or match "" as the space between consecutive dots or empty brackets.
|
||||
'(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))'
|
||||
].join('|'), 'g')
|
||||
|
||||
/** Used to match backslashes in property paths. */
|
||||
const reEscapeChar = /\\(\\)?/g
|
||||
|
||||
Reference in New Issue
Block a user