1.0.0 • Published 3 years ago

round-powers v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
3 years ago

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.