intmin
Returns the minimum value of a specified integer type.
Installation
$ npm install compute-intmin
For use in the browser, use browserify.
Usage
var intmin = ;
intmin( [type] )
Returns the minimum value of a specified integer
type.
var min = ;// returns -128
The following integer
types are supported:
- int8: signed 8-bit integer
- uint8: unsigned 8-bit integer
- int16: signed 16-bit integer
- uint16: unsigned 16-bit integer
- int32: signed 32-bit integer
- uint32: unsigned 32-bit integer
If not provided an integer type
, the function returns the minimum signed 32-bit integer.
=== ;// returns true
Examples
var intmin =min;// int32 (default):min = ;// returns -2147483648// int8:min = ;// returns -128// int16:min = ;// returns -32768// int32:min = ;// returns -2147483648// uint8:min = ;// returns 0// uint16:min = ;// returns 0// uint32:min = ;// returns 0
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
Copyright
Copyright © 2015. The Compute.io Authors.