@greenstreet/formatters
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Formatters

A Library of data-type to string formatters

Build

Run npm run build to build the project. The build artifacts will be stored in the dist/ directory.

Running unit tests

Run npm run test to execute the unit tests via Jest.

Formatters

formatBoolean takes an any and returns true or false. if the input value can't be easily coerced, it returns false

formatDate takes a Date Object and optionally a format string and culture string. moment.js is used internally for formatting. Presets are

formatDateTime takes a Date Object and optionally a format string and culture string. moment.js is used internally for formatting.

formatDateAsISO takes a Date object and returns the date in ISO. e.g. 2020-09-25. An optional flag set to true will also return the time part. e.g. 2020-09-25T12:30:00

formatNumber takes a number and optionally a number of decimal places and culture string. Defaults to 0 decimal places.

Readme

Keywords

Package Sidebar

Install

npm i @greenstreet/formatters

Weekly Downloads

0

Version

1.0.1

License

ISC

Unpacked Size

20.2 kB

Total Files

38

Last publish

Collaborators

  • jameswpritchett