1.0.0 • Published 9 years ago

validate.io-matrix v1.0.0

Weekly downloads
7
License
MIT
Repository
github
Last release
9 years ago

Matrix

NPM version Build Status Coverage Status Dependencies

Validates if a value is a matrix.

Installation

$ npm install validate.io-matrix

For use in the browser, use browserify.

Usage

var isMatrix = require( 'validate.io-matrix' );

isMatrix( value )

Validates if a value is a matrix.

var matrix = require( 'dstructs-matrix' );

var mat = matrix( [10,10] );

var bool = isMatrix( mat );
// returns true

Examples

var matrix = require( 'dstructs-matrix' ),
	isMatrix = require( 'validate.io-matrix' );

var mat = matrix( [10,10] );

console.log( isMatrix( mat ) );
// returns true

console.log( isMatrix( [] ) );
// returns false

console.log( isMatrix( {} ) );
// returns false

console.log( isMatrix({
	'data': new Int8Array( 10 ),
	'shape': [5,2],
	'strides': [2,1],
	'dtype': 'int8',
	'length': 10
}));
// returns false

console.log( isMatrix( null ) );
// returns false

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. Athan Reines.