Joel Purra: Developer and more

jqnpm logotype, a Penrose triangle

jq-zeros

Integers and floats as strings, padded with zeros to your liking.

This is a package for the command-line JSON processor jq. Install the package in your jq project/package directory with jqnpm:

jqnpm install joelpurra/jq-zeros

Usage

import "joelpurra/jq-zeros" as Zeros;

# Zeros::pad: Can pad both integer and fractions.
1.1 | Zeros::pad(3; 3) # "001.100"

# Zeros::pad: Can pad both integer and fractions.
12345.54321 | Zeros::pad(3; 3) # "12345.54321"

# Zeros::pad: Can pad both negative integer and fractions.
-1.1 | Zeros::pad(3; 3) # "-001.100"

# Zeros::pad: Can pad both negative integer and fractions.
-12345.54321 | Zeros::pad(3; 3) # "-12345.54321"

# Zeros::pad: Can pad both integer and fractions without fractions.
1 | Zeros::pad(3; 3) # "001.000"

# Zeros::pad: Can pad both negative integer and fractions without fractions.
-1 | Zeros::pad(3; 3) # "-001.000"

# Zeros::integer: Can pad single digit number to 3 digits.
1 | Zeros::integer(3) # "001"

License

Copyright (c) 2015 Joel Purra http://joelpurra.com/ All rights reserved.

When using jq-zeros, comply to the MIT license. Please see the LICENSE file for details.

Background animations by hexagonif.