From 648722f1a6be5119a79e541b686e770c8fba638b Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 9 Jan 2017 14:01:20 -0800 Subject: [PATCH] Apply class transform. --- _Hash.js | 16 +++++++++------- _ListCache.js | 16 +++++++++------- _MapCache.js | 16 +++++++++------- _SetCache.js | 14 ++++++++------ _Stack.js | 8 +++++--- 5 files changed, 40 insertions(+), 30 deletions(-) diff --git a/_Hash.js b/_Hash.js index db6e0142ff..2801b0df6d 100644 --- a/_Hash.js +++ b/_Hash.js @@ -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]); + } } } diff --git a/_ListCache.js b/_ListCache.js index 88b83d9738..9bac93ce01 100644 --- a/_ListCache.js +++ b/_ListCache.js @@ -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]); + } } } diff --git a/_MapCache.js b/_MapCache.js index a3ae507278..48d6bdeba1 100644 --- a/_MapCache.js +++ b/_MapCache.js @@ -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]); + } } } diff --git a/_SetCache.js b/_SetCache.js index 4f01e1168c..046a0ea90c 100644 --- a/_SetCache.js +++ b/_SetCache.js @@ -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]); + } } } diff --git a/_Stack.js b/_Stack.js index abc656c149..b65cb2a08d 100644 --- a/_Stack.js +++ b/_Stack.js @@ -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`.