Skip to content

Commit

Permalink
[UPDATE] lib, tests, examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
kgryte committed Jun 5, 2015
1 parent bc754b0 commit 08a90fe
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 13 deletions.
8 changes: 4 additions & 4 deletions README.md
Expand Up @@ -2,7 +2,7 @@ Matrix
===
[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coverage Status][coveralls-image]][coveralls-url] [![Dependencies][dependencies-image]][dependencies-url]

> Validates if a value is a [Matrix](https://github.com/compute-io/matrix).
> Validates if a value is a [matrix](https://github.com/dstructs/matrix).

## Installation
Expand All @@ -22,10 +22,10 @@ var isMatrix = require( 'validate.io-matrix' );

#### isMatrix( value )

Validates if a value is a [Matrix](https://github.com/compute-io/matrix).
Validates if a value is a [matrix](https://github.com/dstructs/matrix).

``` javascript
var matrix = require( 'compute-matrix' );
var matrix = require( 'dstructs-matrix' );

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

Expand All @@ -37,7 +37,7 @@ var bool = isMatrix( mat );
## Examples

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

var mat = matrix( [10,10] );
Expand Down
4 changes: 2 additions & 2 deletions benchmark/b.js
Expand Up @@ -2,7 +2,7 @@

// MODULES //

var matrix = require( 'compute-matrix' ),
var matrix = require( 'dstructs-matrix' ),
isMatrixLike = require( 'validate.io-matrix-like' ),
isMatrix = require( './../lib' );

Expand Down Expand Up @@ -58,6 +58,6 @@ res[ 1 ] = stop[ 0 ] + stop[ 1 ]*1e-9;
// RESULTS

console.log( 'matrix-like:\t%d ops/sec', Math.floor( len/res[ 0 ] ) );
console.log( 'matrix:\t%d ops/sec', Math.floor( len/res[ 1 ] ) );
console.log( 'matrix:\t\t%d ops/sec', Math.floor( len/res[ 1 ] ) );
console.log( '\n' );

2 changes: 1 addition & 1 deletion examples/index.js
@@ -1,6 +1,6 @@
'use strict';

var matrix = require( 'compute-matrix' ),
var matrix = require( 'dstructs-matrix' ),
isMatrix = require( './../lib' );

var mat = matrix( [10,10] );
Expand Down
4 changes: 2 additions & 2 deletions lib/index.js
Expand Up @@ -9,10 +9,10 @@ var typeName = require( 'type-name' );

/**
* FUNCTION: isMatrix( value )
* Validates if a value is a Matrix.
* Validates if a value is a matrix.
*
* @param {*} value - value to validate
* @returns {Boolean} boolean indicating if a value is a Matrix
* @returns {Boolean} boolean indicating if a value is a matrix
*/
function isMatrix( value ) {
return typeName( value ) === 'Matrix';
Expand Down
3 changes: 2 additions & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"name": "validate.io-matrix",
"version": "0.0.0",
"description": "Validates if a value is a Matrix.",
"description": "Validates if a value is a matrix.",
"author": {
"name": "Athan Reines",
"email": "kgryte@gmail.com"
Expand Down Expand Up @@ -46,6 +46,7 @@
"devDependencies": {
"chai": "2.x.x",
"coveralls": "^2.11.1",
"dstructs-matrix": "^1.0.0",
"istanbul": "^0.3.0",
"jshint": "2.x.x",
"jshint-stylish": "^1.0.0",
Expand Down
13 changes: 10 additions & 3 deletions test/test.js
Expand Up @@ -7,7 +7,7 @@ var // Expectation library:
chai = require( 'chai' ),

// Module to create matrices:
matrix = require( 'compute-ndarray' ),
matrix = require( 'dstructs-matrix' ),

// Module to be tested:
isMatrix = require( './../lib' );
Expand Down Expand Up @@ -41,11 +41,18 @@ describe( 'validate.io-matrix', function tests() {
true,
[],
{},
function ndarray(){}
{
'data': new Int8Array( 10 ),
'shape': [5,2],
'strides': [2,1],
'dtype': 'int8',
'length': 10
},
function matrix(){}
];

for ( var i = 0; i < values.length; i++ ) {
assert.notOk( isMatrix( values[i] ), values[ i ] );
assert.isFalse( isMatrix( values[i] ), values[ i ] );
}
});

Expand Down

0 comments on commit 08a90fe

Please sign in to comment.