Apply class transform.

This commit is contained in:
John-David Dalton
2017-01-09 14:01:20 -08:00
parent c2208f82dc
commit 648722f1a6
5 changed files with 40 additions and 30 deletions

View File

@@ -11,7 +11,8 @@ import hashSet from './_hashSet.js';
* @constructor * @constructor
* @param {Array} [entries] The key-value pairs to cache. * @param {Array} [entries] The key-value pairs to cache.
*/ */
function Hash(entries) { class Hash {
constructor(entries) {
let index = -1; let index = -1;
const length = entries == null ? 0 : entries.length; const length = entries == null ? 0 : entries.length;
@@ -21,6 +22,7 @@ function Hash(entries) {
this.set(entry[0], entry[1]); this.set(entry[0], entry[1]);
} }
} }
}
// Add methods to `Hash`. // Add methods to `Hash`.
Hash.prototype.clear = hashClear; Hash.prototype.clear = hashClear;

View File

@@ -11,7 +11,8 @@ import listCacheSet from './_listCacheSet.js';
* @constructor * @constructor
* @param {Array} [entries] The key-value pairs to cache. * @param {Array} [entries] The key-value pairs to cache.
*/ */
function ListCache(entries) { class ListCache {
constructor(entries) {
let index = -1; let index = -1;
const length = entries == null ? 0 : entries.length; const length = entries == null ? 0 : entries.length;
@@ -21,6 +22,7 @@ function ListCache(entries) {
this.set(entry[0], entry[1]); this.set(entry[0], entry[1]);
} }
} }
}
// Add methods to `ListCache`. // Add methods to `ListCache`.
ListCache.prototype.clear = listCacheClear; ListCache.prototype.clear = listCacheClear;

View File

@@ -11,7 +11,8 @@ import mapCacheSet from './_mapCacheSet.js';
* @constructor * @constructor
* @param {Array} [entries] The key-value pairs to cache. * @param {Array} [entries] The key-value pairs to cache.
*/ */
function MapCache(entries) { class MapCache {
constructor(entries) {
let index = -1; let index = -1;
const length = entries == null ? 0 : entries.length; const length = entries == null ? 0 : entries.length;
@@ -21,6 +22,7 @@ function MapCache(entries) {
this.set(entry[0], entry[1]); this.set(entry[0], entry[1]);
} }
} }
}
// Add methods to `MapCache`. // Add methods to `MapCache`.
MapCache.prototype.clear = mapCacheClear; MapCache.prototype.clear = mapCacheClear;

View File

@@ -10,7 +10,8 @@ import setCacheHas from './_setCacheHas.js';
* @constructor * @constructor
* @param {Array} [values] The values to cache. * @param {Array} [values] The values to cache.
*/ */
function SetCache(values) { class SetCache {
constructor(values) {
let index = -1; let index = -1;
const length = values == null ? 0 : values.length; const length = values == null ? 0 : values.length;
@@ -19,6 +20,7 @@ function SetCache(values) {
this.add(values[index]); this.add(values[index]);
} }
} }
}
// Add methods to `SetCache`. // Add methods to `SetCache`.
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;

View File

@@ -12,10 +12,12 @@ import stackSet from './_stackSet.js';
* @constructor * @constructor
* @param {Array} [entries] The key-value pairs to cache. * @param {Array} [entries] The key-value pairs to cache.
*/ */
function Stack(entries) { class Stack {
constructor(entries) {
const data = this.__data__ = new ListCache(entries); const data = this.__data__ = new ListCache(entries);
this.size = data.size; this.size = data.size;
} }
}
// Add methods to `Stack`. // Add methods to `Stack`.
Stack.prototype.clear = stackClear; Stack.prototype.clear = stackClear;