npm

Does your artifact manager get in the way? Join us on Oct. 8 at 10am PT, to discuss how npm can help.Sign up »

compute-to-array

1.0.1 • Public • Published

to-array

NPM version Build Status Coverage Status Dependencies

Construct an array of arrays.

Installation

$ npm install compute-to-array

For use in the browser, use browserify.

Usage

var toArray = require( 'compute-to-array' );

toArray( x )

Constructs an array of arrays. To convert a matrix,

var mat = matrix( [ 2, 2 ] );
 
var arr = toArray( mat )
// returns [ [ 0, 0 ], [ 0, 0 ] ]

If provided an empty matrix, the function returns an empty array.

var mat, arr;
 
mat = matrix( [0,0] );
arr = toArray( mat );
// returns []
 
mat = matrix( [0,10] );
arr = toArray( mat );
// returns []
 
mat = matrix( [10,0] );
arr = toArray( mat );
// returns []

Examples

var toArray = require( 'compute-to-array' ),
    matrix = require( 'dstructs-matrix' );
 
var data, mat;
 
data = new Int32Array( [ 1, 2, 3, 4 ] );
mat = matrix( data, [ 2, 2 ] );
 
console.log( toArray( mat ) );
// returns [ [ 1, 2 ], [ 3, 4 ] ]

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.

install

npm i compute-to-array

Downloadsweekly downloads

2

version

1.0.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
Report a vulnerability