round-powers
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

round-powers Travis CI Build Status

Round a number to the closest power.

NPM Badge

Install

npm install round-powers

Usage

const roundPowers = require("round-powers")

roundPowers(10, 2)
//=> 8

roundPowers.up(10, 2)
//=> 16

roundPowers.down(10, 2)
//=> 8

API

roundPowers(number, base)

Round number to the nearest power of base.

roundPowers.up(number, base)

Round number up to the nearest power of base.

roundPowers.down(number, base)

Round number down to the nearest power of base.

number

Type: number

The number to round.

base

Type: number

The base number to find the nearest power of.

Readme

Keywords

Package Sidebar

Install

npm i round-powers

Weekly Downloads

3

Version

1.0.0

License

MIT

Unpacked Size

4.18 kB

Total Files

6

Last publish

Collaborators

  • richienb