immutable-js
Version:
Immutable types in JavaScript
39 lines (31 loc) • 1.3 kB
JavaScript
/**
* Copyright (c) 2015, Jan Biasi.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
import { Iterable, KeyedIterable, IndexedIterable, SetIterable } from './Iterable';
import { typedef as defineTypeOf } from './util/toolset';
export var COLLECTION_TYPEDEF = '[Iterable Collection]';
export class Collection extends Iterable {
constructor() {
throw TypeError('Abstract');
}
}
export var KEYED_COLLECTION_TYPEDEF = '[KeyedIterable KeyedCollection]';
export class KeyedCollection extends KeyedIterable {}
export var INDEXED_COLLECTION_TYPEDEF = '[IndexedIterable IndexedCollection]';
export class IndexedCollection extends IndexedIterable {}
export var SET_COLLECTION_TYPEDEF = '[SetIterable SetCollection]';
export class SetCollection extends SetIterable {}
defineTypeOf({
Collection: COLLECTION_TYPEDEF,
KeyedCollection: KEYED_COLLECTION_TYPEDEF,
IndexedCollection: INDEXED_COLLECTION_TYPEDEF,
SetCollection: SET_COLLECTION_TYPEDEF
});
Collection.Keyed = KeyedCollection;
Collection.Indexed = IndexedCollection;
Collection.Set = SetCollection;