Array Constructors
Returns an array constructor corresponding to an array data type.
Installation
$ npm install dstructs-array-constructors
For use in the browser, use browserify.
Usage
var getCtor = require( 'dstructs-array-constructors' );
getCtor( dtype )
Returns an array
constructor corresponding to an array
data type.
var ctor = getCtor( 'int8' );
The following array
data types are supported:
Examples
var getCtor = require( 'dstructs-array-constructors' );
console.log( getCtor( 'int8' ) );
console.log( getCtor( 'uint8' ) );
console.log( getCtor( 'uint8_clamped' ) );
console.log( getCtor( 'int16' ) );
console.log( getCtor( 'uint16' ) );
console.log( getCtor( 'int32' ) );
console.log( getCtor( 'uint32' ) );
console.log( getCtor( 'float32' ) );
console.log( getCtor( 'float64' ) );
console.log( getCtor( 'generic' ) );
console.log( getCtor( null ) );
console.log( getCtor( 'object' ) );
console.log( getCtor( 'array' ) );
console.log( getCtor( {} ) );
console.log( getCtor( [] ) );
To run the example code from the top-level application directory,
$ node ./examples/index.js
Tests
Unit
Unit tests use the Mocha test framework with Chai assertions. To run the tests, execute the following command in the top-level application directory:
$ make test
All new feature development should have corresponding unit tests to validate correct functionality.
Test Coverage
This repository uses Istanbul as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:
$ make test-cov
Istanbul creates a ./reports/coverage
directory. To access an HTML version of the report,
$ make view-cov
License
MIT license.
Copyright
Copyright © 2015. The Compute.io Authors.