Apply even more let/const transforms.

This commit is contained in:
John-David Dalton
2017-01-09 12:23:34 -08:00
parent e6152a97e8
commit dc687c1d85
177 changed files with 433 additions and 437 deletions

View File

@@ -1,7 +1,7 @@
import MapCache from './_MapCache.js';
/** Error message constants. */
var FUNC_ERROR_TEXT = 'Expected a function';
const FUNC_ERROR_TEXT = 'Expected a function';
/**
* Creates a function that memoizes the result of `func`. If `resolver` is
@@ -51,15 +51,14 @@ function memoize(func, resolver) {
if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
throw new TypeError(FUNC_ERROR_TEXT);
}
var memoized = function() {
var args = arguments,
key = resolver ? resolver.apply(this, args) : args[0],
cache = memoized.cache;
const memoized = function() {
const args = arguments, key = resolver ? resolver.apply(this, args) : args[0];
const cache = memoized.cache;
if (cache.has(key)) {
return cache.get(key);
}
var result = func.apply(this, args);
const result = func.apply(this, args);
memoized.cache = cache.set(key, result) || cache;
return result;
};