zeropad

WebJar for zeropad

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

zeropad
Last Version

Last Version

1.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

zeropad
WebJar for zeropad
Project URL

Project URL

https://www.webjars.org
Source Code Management

Source Code Management

https://github.com/radiovisual/zeropad

Download zeropad

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/zeropad/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>zeropad</artifactId>
    <version>1.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/zeropad/
implementation 'org.webjars.npm:zeropad:1.1.0'
// https://jarcasting.com/artifacts/org.webjars.npm/zeropad/
implementation ("org.webjars.npm:zeropad:1.1.0")
'org.webjars.npm:zeropad:jar:1.1.0'
<dependency org="org.webjars.npm" name="zeropad" rev="1.1.0">
  <artifact name="zeropad" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='zeropad', version='1.1.0')
)
libraryDependencies += "org.webjars.npm" % "zeropad" % "1.1.0"
[org.webjars.npm/zeropad "1.1.0"]

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.npm : negative-zero jar [1.0.0,2)

Project Modules

There are no modules declared in this project.

zeropad

Zeropad your integers with optional n-length padding.

Build Status

The default is to give you classic padding behavior where numbers less than 10 are padded with a single zero:
'9' → '09', but you can optionally pad to any length, for example: '9' → '0009'.

Note: Since version 1.1.0 you can also pad negative numbers.

Install

$ npm install --save zeropad

Usage

var zeropad = require('zeropad');

zeropad(5);
// => '05'

zeropad(10, 4);
// => '0010'

zeropad('11', 4);
// => '0011'

zeropad(4, 10);
// => '0000000004');

zeropad(9, 4);
// => '0009');

zeropad(-9, 4);
// => '-0009');

API

zeropad(number, [length])

number

Required
Type: Number String

The number you want to pad.

length

Type: Number
Default: 2

The length you want to pad to. The default is 2, which emulates classic padding behavior.

Related

License

MIT @ Michael Wuergler

Versions

Version
1.1.0