[Ramda] Improved memoize definition (#25596)

* Ramda: improved memoize definition

* Ramda: improved memoize definition (fixed test)
This commit is contained in:
Tomáš Szabo
2018-05-08 19:22:35 +02:00
committed by Sheetal Nandi
parent 31f0a91829
commit 5a46131513
2 changed files with 4 additions and 2 deletions

View File

@@ -1021,11 +1021,13 @@ declare namespace R {
median(list: ReadonlyArray<number>): number;
/**
* @deprecated since v0.25.0
*
* Creates a new function that, when invoked, caches the result of calling fn for a given argument set and
* returns the result. Subsequent calls to the memoized fn with the same argument set will not result in an
* additional call to fn; instead, the cached result for that set of arguments will be returned.
*/
memoize<T = any>(fn: (...a: any[]) => T): (...a: any[]) => T;
memoize<T extends (...args: any[]) => any>(fn: T): T;
/**
* A customisable version of R.memoize. memoizeWith takes an additional function that will be applied to a given

View File

@@ -305,7 +305,7 @@ R.times(i, 5);
function stringLength(str: string): number {
return str.length;
}
const memoStringLength = R.memoize<number>(stringLength);
const memoStringLength = R.memoize(stringLength);
const isLong = memoStringLength('short') > 10; // false
})();