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

1.0.2 • Public • Published

Parsers

A Library of string to data-type 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.

Parsers

parseDate takes an "any" and an optional culture string (defaults to en-US). Returns a date object

  • The input can be a formatted date like 12/31/2020
  • The input can be a formatted date like 12-31-2020
  • The input can be an unformatted date like 12312020 or 123120
  • If the input is already a Date object, it'll return that object.
  • If the input is neither a string or a Date object, it'll return a null

parseISODate takes an "any" and returns a date object

  • If the input is null, the output will be null
  • If the input can't be parsed to a valid date, the output will be null

parseNumber takes an "any" and an optional culture string (defaults to en-US). Returns a number

  • The input will be parsed using the culture passed in.
  • If the input is null, the output will be null
  • If the input can't be parsed to a valid number, the output will be null

Readme

Keywords

Package Sidebar

Install

npm i @greenstreet/parsers

Weekly Downloads

1

Version

1.0.2

License

ISC

Unpacked Size

20.5 kB

Total Files

29

Last publish

Collaborators

  • jameswpritchett