npm.io
3.0.3 • Published 7 years ago

chopcal

Licence
MIT
Version
3.0.3
Deps
1
Size
24 kB
Vulns
0
Weekly
0
Stars
1

chopcal

Build Status npm Version JS Standard

Chop numbers.

Installation

$ npm install chopcal --save

Usage

"use strict";

const chopcal = require('chopcal')

//------------------------
// ceil
//------------------------
console.log(chopcal.ceil(14, 10)) //-> 20
console.log(chopcal.ceil(16, 10)) //-> 20
console.log(chopcal.ceil(0.23, 0.1)) //-> 0.3
console.log(chopcal.ceil(0.27, 0.1)) //-> 0.3

//------------------------
// floor
//------------------------
console.log(chopcal.floor(14, 10)) //-> 10
console.log(chopcal.floor(16, 10)) //-> 10
console.log(chopcal.floor(0.23, 0.1)) //-> 0.2
console.log(chopcal.floor(0.27, 0.1)) //-> 0.2

//------------------------
// round
//------------------------
console.log(chopcal.round(14, 10)) //-> 10
console.log(chopcal.round(16, 10)) //-> 20
console.log(chopcal.round(0.23, 0.1)) //-> 0.2
console.log(chopcal.round(0.27, 0.1)) //-> 0.3

API

Signature Description
.ceil(val, base) Chop number to ceil.
.floor(val, base) Chop number to floor.
.round(val, base) Chop number to round.

License

This software is released under the MIT License.

Keywords