intmax
Returns the maximum value of a specified integer type.
Installation
$ npm install compute-intmax
For use in the browser, use browserify.
Usage
var intmax = ;
intmax( [type] )
Returns the maximum value of a specified integer
type.
var max = ;// returns 127
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 maximum signed 32-bit integer.
=== ;// returns true
Examples
var intmax =max;// int32 (default):max = ;// returns 2147483647// int8:max = ;// returns 127// int16:max = ;// returns 32767// int32:max = ;// returns 2147483647// uint8:max = ;// returns 255// uint16:max = ;// returns 65535// uint32:max = ;// returns 4294967295
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.