generic-collections-js

0.2.0 • Public • Published

generic-collections-js

Build Status npm Total alerts Language grade: JavaScript

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

Package Sidebar

Install

npm i generic-collections-js

Weekly Downloads

2

Version

0.2.0

License

MIT

Unpacked Size

65.5 kB

Total Files

13

Last publish

Collaborators

  • vigan-abd