integer-array-ops
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Integer Array Ops

Preform computations on arrays of integers.

Installation

npm install --save integer-array-ops

Usage

const ops = require('integer-array-ops')
 
const lhs = new Int16Array([4, 8, 16])
const rhs = new Int16Array([1, 8, 31])
 
ops.add(lhs, rhs) // [5, 16, 47]
ops.sub(lhs, rhs) // [3, 0, -15]
 
ops.max(lhs, rhs) // [4, 8, 31]
ops.min(lhs, rhs) // [1, 8, 16]
 
ops.and(lhs, rhs) // [0, 8, 16]
ops.or(lhs, rhs)  // [5, 8, 31]
ops.xor(lhs, rhs) // [5, 0, 15]

API

Each function takes two arrays of the same type and of the same length. They return a new array of the same type as the input, with the resulting values.

Name Operation
add +
sub -
max Math.max
min Math.min
and &
or |
xor ^

Readme

Keywords

none

Package Sidebar

Install

npm i integer-array-ops

Weekly Downloads

31

Version

1.0.0

License

MIT

Last publish

Collaborators

  • linusu