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