JSPM

add-zero

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1415
  • Score
    100M100P100Q104815F
  • License MIT

Add a leading zero to a number.

Package Exports

  • add-zero

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (add-zero) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

add-zero Build Status

Add a leading zero to a number.

Install

Via npm:

$ npm install add-zero --save

Via Bower:

$ bower install add-zero --save

Usage

var addZero = require('add-zero');

addZero(5); // 05
addZero(10); // 10
addZero(5, 3); // 005
addZero(100, 3); // 100
addZero(-5); // -05
addZero(-5, 3); // -005

API

addZero(value, [digits])

value

Type: number (integer) or string

Value in which a leading zero should be added to.

digits

Type: number
Default: 2

Total number of digits or decimal places.

License

MIT © Rafael Rinaldi