in-node-utils
TypeScript icon, indicating that this package has built-in type declarations

1.0.7 • Public • Published

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 calculation
    • UNIT_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 another
    • replaceCaractere = (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 repetitions
    • paginationReturn = (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 reconfigure
  • tokenUtils : 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

Readme

Keywords

none

Package Sidebar

Install

npm i in-node-utils

Weekly Downloads

1

Version

1.0.7

License

ISC

Unpacked Size

18.6 kB

Total Files

20

Last publish

Collaborators

  • islam_innoom