1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-25 08:11:53 +02:00

Remove extra LEAF in memoize

This commit is contained in:
Soreine
2016-11-02 16:50:17 +01:00
parent 9e830b3c6d
commit 85ebf7fffa

View File

@@ -1,16 +1,6 @@
import { Map } from 'immutable'
/**
* The leaf node of a cache tree.
*
* An object, so that immutable maps will key it by reference.
*
* @type {Object}
*/
const LEAF = {}
/**
* An unique value used to detect cache misses
*
@@ -36,7 +26,7 @@ function memoize(object, properties) {
}
object[property] = function (...args) {
const keys = [property, ...args, LEAF]
const keys = [property, ...args]
this.__cache = this.__cache || new Map()
const cachedValue = this.__cache.getIn(keys, NO_SET)