1.1.0 • Published 6 years ago
numberingjs v1.1.0
Numbering
Convert between human and machine numbering. Basically, it provides an interface to add or subtract 1 from provided number.
Installation
npm install --save numberingjs
Example usage
import num from 'numberingjs';
// when you want to convert under-the-hood number to human-readable one(add 1 to it)
num.toHuman(0); // 1
// when you want to convert human-readable number to zero-based one(subtract 1 from it)
num.toMachine(1); // 0
Example with destructuring
import { toHuman, toMachine } from 'numberingjs';
// when you want to convert an under-the-hood number to a human-readable one(add 1 to it)
toHuman(0); // 1
// when you want to convert a human-readable number to a zero-based one(subtract 1 from it)
toMachine(1); // 0