3.0.3 • Published 5 years ago

chopcal v3.0.3

Weekly downloads
343
License
MIT
Repository
github
Last release
5 years ago

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

SignatureDescription
.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.

Links