@pro303/formatters
v0.0.0
Published
PRO303 JS formatters
Downloads
69
Readme
Different format functions:
Array format functions:
- compareArrays (array1: any [], array2: any []): boolean
- findClosest (array: number[] | string[], needle: number | string): string | number
- inArray (needle: any | any[], array: any []): boolean
- removeArrayElement (array: any [], element: any): any[]
- shuffleArray (array)
- swapArrayItems (array: any[], index1: number, index2: number): any[]
Date and time format functions:
- curTimeInSeconds ()
- dateConvertToMySQLDatetime (date: any): string
- dateFormat (date: number | Date = new Date(), template: string): string
- timestampFormat (timestamp: number, template: string): string
Numbers format functions:
round (number: number, precision: number = 0): number
percentDiff (n1: number , n2: number): number