diff --git a/src/core/util/core.js b/src/core/util/core.js index 827b79c60..be8c2fa4d 100644 --- a/src/core/util/core.js +++ b/src/core/util/core.js @@ -10,11 +10,8 @@ export function cached(fn) { const cache = Object.create(null); return function (str) { const key = isPrimitive(str) ? str : JSON.stringify(str); - if (key in cache) { - return cache[key]; - } - - return (cache[key] = fn(str)); + const hit = cache[key]; + return hit !== undefined ? hit : (cache[key] = fn(str)); }; }