JSPM

validate.io-typed-array

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 8
  • Score
    100M100P100Q31515F
  • License MIT

Validates if a value is a typed array.

Package Exports

  • validate.io-typed-array

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (validate.io-typed-array) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

typed array

NPM version Build Status Coverage Status Dependencies

Validates if a value is a typed array.

Installation

$ npm install validate.io-typed-array

For use in the browser, use browserify.

Usage

var isTypedArray = require( 'validate.io-typed-array' );

isTypedArray( value )

Validates if a value is a typed array.

var bool = isTypedArray( new Int8Array( 10 ) );
// returns true

Examples

var isTypedArray = require( 'validate.io-typed-array' );

var arr = new Int8Array( 10 );
console.log( isTypedArray( arr ) );
// returns true

arr = new Uint8Array( 10 );
console.log( isTypedArray( arr ) );
// returns true

arr = new Uint8ClampedArray( 10 );
console.log( isTypedArray( arr ) );
// returns true

arr = new Int16Array( 10 );
console.log( isTypedArray( arr ) );
// returns true

arr = new Uint16Array( 10 );
console.log( isTypedArray( arr ) );
// returns true

arr = new Int32Array( 10 );
console.log( isTypedArray( arr ) );
// returns true

arr = new Uint32Array( 10 );
console.log( isTypedArray( arr ) );
// returns true

arr = new Float32Array( 10 );
console.log( isTypedArray( arr ) );
// returns true

arr = new Float64Array( 10 );
console.log( isTypedArray( arr ) );
// returns true

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

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

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

console.log( isTypedArray( new Buffer( 10 ) ) );
// 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 © 2015. Athan Reines.