chopcal

3.0.3 • Public • Published

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.

Links

Readme

Keywords

Package Sidebar

Install

npm i chopcal

Weekly Downloads

49

Version

3.0.3

License

MIT

Unpacked Size

24.6 kB

Total Files

36

Last publish

Collaborators

  • okunishinishi