Skip to content

Commit

Permalink
Apply class transform.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdalton committed Jan 9, 2017
1 parent c2208f8 commit 648722f
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 30 deletions.
16 changes: 9 additions & 7 deletions _Hash.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ import hashSet from './_hashSet.js';
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Hash(entries) {
let index = -1;
const length = entries == null ? 0 : entries.length;
class Hash {
constructor(entries) {
let index = -1;
const length = entries == null ? 0 : entries.length;

this.clear();
while (++index < length) {
const entry = entries[index];
this.set(entry[0], entry[1]);
this.clear();
while (++index < length) {
const entry = entries[index];
this.set(entry[0], entry[1]);
}
}
}

Expand Down
16 changes: 9 additions & 7 deletions _ListCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ import listCacheSet from './_listCacheSet.js';
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function ListCache(entries) {
let index = -1;
const length = entries == null ? 0 : entries.length;
class ListCache {
constructor(entries) {
let index = -1;
const length = entries == null ? 0 : entries.length;

this.clear();
while (++index < length) {
const entry = entries[index];
this.set(entry[0], entry[1]);
this.clear();
while (++index < length) {
const entry = entries[index];
this.set(entry[0], entry[1]);
}
}
}

Expand Down
16 changes: 9 additions & 7 deletions _MapCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ import mapCacheSet from './_mapCacheSet.js';
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function MapCache(entries) {
let index = -1;
const length = entries == null ? 0 : entries.length;
class MapCache {
constructor(entries) {
let index = -1;
const length = entries == null ? 0 : entries.length;

this.clear();
while (++index < length) {
const entry = entries[index];
this.set(entry[0], entry[1]);
this.clear();
while (++index < length) {
const entry = entries[index];
this.set(entry[0], entry[1]);
}
}
}

Expand Down
14 changes: 8 additions & 6 deletions _SetCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ import setCacheHas from './_setCacheHas.js';
* @constructor
* @param {Array} [values] The values to cache.
*/
function SetCache(values) {
let index = -1;
const length = values == null ? 0 : values.length;
class SetCache {
constructor(values) {
let index = -1;
const length = values == null ? 0 : values.length;

this.__data__ = new MapCache;
while (++index < length) {
this.add(values[index]);
this.__data__ = new MapCache;
while (++index < length) {
this.add(values[index]);
}
}
}

Expand Down
8 changes: 5 additions & 3 deletions _Stack.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ import stackSet from './_stackSet.js';
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Stack(entries) {
const data = this.__data__ = new ListCache(entries);
this.size = data.size;
class Stack {
constructor(entries) {
const data = this.__data__ = new ListCache(entries);
this.size = data.size;
}
}

// Add methods to `Stack`.
Expand Down

0 comments on commit 648722f

Please sign in to comment.