collection-core
NOTE:
collection-core
has been deprecated in favor of@esfx/collection-core
and@esfx/collection-core-shim
. Please update your references.
The collection-core
package provides a low-level Symbol-based API for defining common collection characteristics.
Overview
Installation
npm i collection-core
Usage
Basic Usage
;
Global Shim
The global shim adds a default implementation the collection interfaces to the following global objects:
Array
implements:ReadonlyCollection
Collection
ReadonlyIndexedCollection
FixedSizeIndexedCollection
IndexedCollection
Uint8Array
implements:ReadonlyCollection
ReadonlyIndexedCollection
FixedSizeIndexedCollection
Uint8ClampedArray
implements:ReadonlyCollection
ReadonlyIndexedCollection
FixedSizeIndexedCollection
Uint16Array
implements:ReadonlyCollection
ReadonlyIndexedCollection
FixedSizeIndexedCollection
Uint32Array
implements:ReadonlyCollection
ReadonlyIndexedCollection
FixedSizeIndexedCollection
Int8Array
implements:ReadonlyCollection
ReadonlyIndexedCollection
FixedSizeIndexedCollection
Int16Array
implements:ReadonlyCollection
ReadonlyIndexedCollection
FixedSizeIndexedCollection
Int32Array
implements:ReadonlyCollection
ReadonlyIndexedCollection
FixedSizeIndexedCollection
Float32Array
implements:ReadonlyCollection
ReadonlyIndexedCollection
FixedSizeIndexedCollection
Float64Array
implements:ReadonlyCollection
ReadonlyIndexedCollection
FixedSizeIndexedCollection
BigUint64Array
implements:ReadonlyCollection
ReadonlyIndexedCollection
FixedSizeIndexedCollection
BigInt64Array
implements:ReadonlyCollection
ReadonlyIndexedCollection
FixedSizeIndexedCollection
Set
implements:ReadonlyCollection
Collection
Map
implements:ReadonlyKeyedCollection
KeyedCollection
To install the global shim, import collection-core/global
:
; // triggers global-scope side effects ; // 3
API
- ReadonlyCollection - The minimal set of operations needed to read from a collection.
- Collection - The minimal set of operations needed to read from and write to a collection.
- ReadonlyIndexedCollection - The minimal set of operations needed to read from an integer-indexed collection.
- FixedSizeIndexedCollection - The minimal set of operations needed to read from or write to an integer-indexed collection where the size may be fixed (such as with Typed Arrays).
- IndexedCollection - The minimal set of operations needed to read from or write to an integer-indexed collection.
- ReadonlyKeyedCollection - The minimal set of operations needed to read from a keyed collection.
- KeyedCollection - The minimal set of operations needed to read from or write to a keyed collection.
ReadonlyCollection
declare
Collection
declare
ReadonlyIndexedCollection
declare
FixedSizeIndexedCollection
declare
IndexedCollection
declare
ReadonlyKeyedCollection
declare
KeyedCollection
declare