mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 10:57:49 +00:00
Cleanup stringToPath.
This commit is contained in:
@@ -13,13 +13,13 @@ const MAX_MEMOIZE_SIZE = 500;
|
|||||||
*/
|
*/
|
||||||
function memoizeCapped(func) {
|
function memoizeCapped(func) {
|
||||||
const result = memoize(func, key => {
|
const result = memoize(func, key => {
|
||||||
|
const { cache } = result;
|
||||||
if (cache.size === MAX_MEMOIZE_SIZE) {
|
if (cache.size === MAX_MEMOIZE_SIZE) {
|
||||||
cache.clear();
|
cache.clear();
|
||||||
}
|
}
|
||||||
return key;
|
return key;
|
||||||
});
|
});
|
||||||
|
|
||||||
const cache = result.cache;
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import memoizeCapped from './.internal/memoizeCapped.js';
|
import memoizeCapped from './.internal/memoizeCapped.js';
|
||||||
|
|
||||||
/** Used to match property names within property paths. */
|
/** Used to match property names within property paths. */
|
||||||
const reLeadingDot = /^\./, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
const reLeadingDot = /^\./;
|
||||||
|
const rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/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