js.system.collections

Vanilla JavaScript ES collections inspired by .NET for Node.js and the browser.
Getting Started
Install with NPM
npm i js.system.collections
or
npm install js.system.collections
Import on the browser
<script src="path-to-dist-folder/js.system.collections.min.js"></script>
or
<script src="https://cdn.jsdelivr.net/gh/joao-neves95/js.system.collections/dist/js.system.collections.min.js"></script>
or
<script src="https://raw.githubusercontent.com/joao-neves95/js.system.collections/master/dist/js.system.collections.min.js"></script>
Use from the browser (using the window object)
const myDict = new Dictionary( true );
Use with CommonJS (For environments that support module.exports, like Node.js)
const { Dictionary, List } = require( 'js.system.collections' );
const myList = new List( 'any' );
const myStringList = new List( 'string' );
API
^API
List( type )
List(type)
-
length
.length
-
clear()
.clear()
-
clearSafe()
.clearSafe()
-
last
.last
-
getAll()
.getAll()
-
get( index )
.get( index )
-
contains( value )
.contains( value )
-
add( value )
.add( value )
-
update( index, value )
.update( index, value )
-
remove( index )
.remove( index )
-
removeFirst()
.removeFirst()
-
removeLast()
.removeLast()
-
forEach( index )
.forEach( Callback )
^API
Dict( initialSize )
^API
Dictionary( uniqueKeys = false )
-
length
.length
-
clear()
.clear()
-
clearSafe()
.clearSafe()
-
getAllValues()
.getAllValues()
-
getAllKeys()
.getAllKeys()
-
lastValue
.lastValue
-
containsKey( key )
.containsKey( key )
-
getByIndex( index )
.getByIndex( index )
-
getKeyByIndex( index )
.getKeyByIndex( index )
-
getByKey( key )
.getByKey( key )
-
findIndexOfKey( key )
.findIndexOfKey( key )
-
add( key, value )
.add( key, value )
-
removeFirst()
.removeFirst()
-
removeLast()
.removeLast()
-
removeByIndex( index )
.removeByIndex( index )
-
remove( key )
.remove( key )
-
updateByKey( key, newValue )
.updateByKey( key, newValue )
-
updateByIndex( idx, newValue )
.updateByIndex( idx, newValue )
-
forEachValue( Callback )
.forEachValue( Callback )
^API
DictionaryObj
^API