align-dots

Align numeric data by decimal dot

Usage no npm install needed!

<script type="module">
  import alignDots from 'https://cdn.skypack.dev/align-dots';
</script>

README

npm

align-dots

Build Status Dependency Status

Align numeric data by decimal dot.

Example

var align = require('align-dots');

align(['.25', '0.5', '1.005', '10'])
//=> ['  .25 ',
//    ' 0.5  ',
//    ' 1.005',
//    '10    ']);

API

align(data, [opts])

Align array of numbers (strings), return array of aligned strings.

Option Default Description
forceDots false Print dots for all numbers (except they're all integers).
char " " Padding character.
zeroes false Implies { forceDots: true, char: 0 }.

Install

npm install align-dots

License

MIT