/obelisk

Function to use in typescript

Primary LanguageTypeScript

Obelisk

Functions for any projects Typescript
Modules and function for global use typescript using jest for tests.

Instalation

npm i alvitre-obelisk
yarn add alvitre-obelisk

Functions

Convert dates from JS, US or PTBR

dateFormatPtbr

Date US and JS to PTBR format
> dateFormatPtbr("1992-06-10")
return 10/06/1992

dateFormatUs

Date JS to US format
> dateFormatUs(new Date("1992,06,10"))
return 1992-06-10

dateFormatJs

Date US to JS full format
> dateFormatJS(new Date("1992-06-10"))
return 1992-06-10T03:00:00.000Z



Other functions to use

validarToken

Verify with token is valid string
> validarToken(null)
return false
> validarToken(undefined)
return false

calcYearsOldWithMounths

Calculate age with months of life
> calcYearsOldWithMounths("1993-06-10")
return "28 anos e 6 meses"

limitText

Cut string adding points
> limitText("lorem ipsum", 3)
return "lor ..."