generic-collections-js
v0.2.0
Published
Generic type collection classes for arrays, maps and sets
Downloads
9
Maintainers
Readme
generic-collections-js
This library includes generic layer for javascript collections. Currently supported generic types are depicted below:
ArrayT
- Generic version of Array type
Installing
npm install --save generic-collections-js
Testing
npm run test
Usage
const { ArrayT } = require('generic-collections-js')
// Primitive type example //
const numArray = new ArrayT('number')
numArray.push(2, 3)
try {
numArray.push('4')
} catch (err) {
console.log(err.toString()) // Error: ERR_INVALID_VALUE_TYPE
}
console.log(numArray.toArray()) // [ 2, 3 ]
Authors
- vigan-abd ([email protected])