in-node-utils
v1.0.7
Published
inNodeUtil ==
Downloads
13
Readme
inNodeUtil
library of some utils node js written in typescript
Installation
Using npm:
$ npm i node_utils_innoom
Feautures
dateUtils
: based on momentJs to have some complexe datetime calculationUNIT_TIME
enum UNIT_TIME { Minutes = 'minutes', Hours = 'hours', Days = 'days', Week = 'weeks', }
difference = (date1: Date, date2: Date, unit: UNIT_TIME)
dateUtil.difference(new Date(2022, 1, 10),new Date(2022,1,1), dateUtil.UNIT_TIME.Days) // => 10
fileUtils
: contain different function to handle files (moveFile, verifyFileExistance)moveFile = (file: string, dir2: string)
isDirExist = (dir: string)
removeFile = async (path: string)
removeFileFromFiles = async (files: any[])
haveExtensionfromFileName = (filename: string)
verifyFilesRequest = (files: any[], filename: string)
generalUtils
: contain until now one function that help to replace all occurence of caracter by anotherreplaceCaractere = (text: string, currentCaractere: string, nextCharacter: string)
generalUtil.replaceCaractere("hello world", " ", "_") // => hellow_world
paginationUtils
: when we work on backend we do some repetitive stuff when we return pagiantion so those function can help to avoid those repetitionspaginationReturn = (listCount: number, list: any[], page: number, nextLink: string): paginationSchema
checkPaginationAttribut = (start: number, end: number): boolean
pusherUtils
: based on pusher, for freelancer we work everyday with notification so this function based on pusher can help to avoid wasting time to reconfiguretokenUtils
: i worked always with tokens in backend with different type of auhtorization
Coming
- add more functions to the package
- add all tests for the different functions