Skip to content

jamal-rahimzadegan/Utility

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

js-icon
Javascript Utils (Helpers)

  • retry —> Re-run a callback function using Promises with try count and delay time.
  • simple-axios-module.js —> Simpler configuration of Axios to have cleaner API calls.
  • runBeforeEachMethod—> Happy helper to execute a callback on every class method.
  • handleSwipe —> Returns a promise with the direction of the swipe.
  • shortenNumber —> Returns value in compacted format (e.g. 1M, 4K).
  • debounce —> Native JS debounce function (prevents multiple clicks on an element).
  • sanitizeInput —> Validate inputs for injections.
  • handleSwipe —> detect the swiper direction and do some stuff on user swipe.
  • openCaller —> Easily work with callers (mail, phone, etc).
  • generateError —> Reusable function to throw errors and more.
  • generateArr —> Fastly create arrays.
  • toPersian —> Converts any string number (even in innerHtml) to Persian number.
  • toEnglish —> Converts any string number (even in innerHtml) to English number.
  • scrollToElement —> Scrolls to specific element.
  • checkEmptyObject —> Checks if an object has property or not.
  • checkJson —> Checks whether a string is JSON or not.
  • checkPrimitive —> Checks whether a variable is primitive (data that is not an object and has no methods) or not.
  • castTimeMsg —> Easy way to form the date messages like 10 days ago or yesterday and etc.
  • generateUrl —> Generate URLs with query params. (nice and easy)
  • addLeadingZero —> Add zero at the beginning of a number (eg. countdown)

And many more :)