Cleanup stringToPath.

This commit is contained in:
John-David Dalton
2017-01-10 17:25:48 -08:00
parent c5d4bb8dcb
commit 003c11c36b
2 changed files with 3 additions and 2 deletions

View File

@@ -13,13 +13,13 @@ const MAX_MEMOIZE_SIZE = 500;
*/
function memoizeCapped(func) {
const result = memoize(func, key => {
const { cache } = result;
if (cache.size === MAX_MEMOIZE_SIZE) {
cache.clear();
}
return key;
});
const cache = result.cache;
return result;
}

View File

@@ -1,7 +1,8 @@
import memoizeCapped from './.internal/memoizeCapped.js';
/** 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. */
const reEscapeChar = /\\(\\)?/g;