0.0.53 • Published 9 months ago

@omnicar/sam-format v0.0.53

Weekly downloads
127
License
MIT
Repository
-
Last release
9 months ago

SAM-format

Library for formatting data according to locale and options given.

Installation (for development)

yarn or npm i (examples below are using yarn)

Installation on clients

yarn add omnicar/sam-format#0.0.1

Where #0.0.1 indicates the Github release tag.

Usage

First call init to initialize formatters (locale data etc).

These parameters are available:

  • isoName - (da-DK | sv-SE | fi-FI | nb-NO) identifier for locale

Formatters

There are 4 formatters:

formatMileage(value, opts)

showDecimals (true | false) show decimals in formatted number

symbolDisplayType (APPEND | PREPEND | NONE) where to put symbol related to number type

formatCurrency(value, opts)

showDecimals (true | false) show decimals in formatted number

symbolDisplayType (APPEND | PREPEND | NONE) where to put symbol related to number type

formatNumber(value, showDecimals)

showDecimals (true | false) show decimals in formatted number

formatDate(value, opts)

showTime (true | false) append time in formatted date

rawFormat (string) pass date format string to format with

example: formatDate(new Date(2018-01-23), {rawFormat: 'YYYYMMDD'}) // '20189123'

Tests

To run jest tests either run:

yarn test

or to run tests in watch mode run:

yarn test-watch

Compile application (tsc):

yarn tsc

0.0.45

10 months ago

0.0.46

10 months ago

0.0.47

10 months ago

0.0.52

9 months ago

0.0.53

9 months ago

0.0.50

10 months ago

0.0.48

10 months ago

0.0.49

10 months ago

0.0.44

11 months ago

0.0.42

2 years ago

0.0.43

2 years ago

0.0.41

2 years ago

0.0.40

2 years ago

0.0.38

3 years ago

0.0.39

3 years ago

0.0.37

3 years ago

0.0.34

3 years ago

0.0.35

3 years ago

0.0.36

3 years ago

0.0.32

3 years ago

0.0.31

3 years ago

0.0.30

4 years ago

0.0.27

4 years ago

0.0.28

4 years ago

0.0.29

4 years ago

0.0.23

4 years ago

0.0.24

4 years ago

0.0.25

4 years ago

0.0.26

4 years ago

0.0.22

4 years ago

0.0.21

4 years ago

0.0.20

4 years ago

0.0.19

4 years ago

0.0.18

4 years ago

0.0.17

4 years ago

0.0.16

5 years ago

0.0.15

5 years ago

0.0.14

5 years ago

0.0.13

5 years ago

0.0.12

6 years ago

0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago