JSPM

compute-intmin

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

Returns the minimum value of a specified integer type.

Package Exports

  • compute-intmin

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 (compute-intmin) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

intmin

NPM version Build Status Coverage Status Dependencies

Returns the minimum value of a specified integer type.

Installation

$ npm install compute-intmin

For use in the browser, use browserify.

Usage

var intmin = require( 'compute-intmin' );

intmin( [type] )

Returns the minimum value of a specified integer type.

var min = intmin( 'int8' );
// 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.

intmin() === intmin( 'int32' );
// returns true

Examples

var intmin = require( 'compute-intmin' ),
    min;

// int32 (default):
min = intmin();
// returns -2147483648

// int8:
min = intmin( 'int8' );
// returns -128

// int16:
min = intmin( 'int16' );
// returns -32768

// int32:
min = intmin( 'int32' );
// returns -2147483648

// uint8:
min = intmin( 'uint8' );
// returns 0

// uint16:
min = intmin( 'uint16' );
// returns 0

// uint32:
min = intmin( 'uint32' );
// 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

MIT license.

Copyright © 2015. The Compute.io Authors.