Skip to content

Latest commit

 

History

History
40 lines (30 loc) · 1.34 KB

README.md

File metadata and controls

40 lines (30 loc) · 1.34 KB

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