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;
@@ -20,6 +21,7 @@ function Hash(entries) {
const entry = entries[index]; const entry = entries[index];
this.set(entry[0], entry[1]); this.set(entry[0], entry[1]);
} }
}
} }
// Add methods to `Hash`. // Add methods to `Hash`.

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;
@@ -20,6 +21,7 @@ function ListCache(entries) {
const entry = entries[index]; const entry = entries[index];
this.set(entry[0], entry[1]); this.set(entry[0], entry[1]);
} }
}
} }
// Add methods to `ListCache`. // Add methods to `ListCache`.

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;
@@ -20,6 +21,7 @@ function MapCache(entries) {
const entry = entries[index]; const entry = entries[index];
this.set(entry[0], entry[1]); this.set(entry[0], entry[1]);
} }
}
} }
// Add methods to `MapCache`. // Add methods to `MapCache`.

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;
@@ -18,6 +19,7 @@ function SetCache(values) {
while (++index < length) { while (++index < length) {
this.add(values[index]); this.add(values[index]);
} }
}
} }
// Add methods to `SetCache`. // Add methods to `SetCache`.

View File

@@ -12,9 +12,11 @@ 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`.