A collection of useful JavaScript functions
instead of having to create helper functions for every project, I decided to create a library of useful functions that I can use in any project. bard recommended i use lodash or a similar library, but i wanted to create my own library for fun. and utilize javascript's prototype system to avoid having to import functions from a library.
bun i @mohamedbechirmejri/js-ext
add the following to your tsconfig.json file
{
"compilerOptions": {
"types": ["./node_modules/@mohamedbechirmejri/js-ext/.build/index.d.ts"]
}
}
// main.js
import init from "@mohamedbechirmejri/js-ext";
init();
you can supply a config object to the init function to turnoff some functions
init({ ignore: ["CAPITALIZE"] });
"test".CAPITALIZE(); // Test
you can use your IDE's intellisense to see all the functions
the library also includes JSDOC comments for all the functions
"test".CAPITALIZE(); // Test
"test".REVERSE(); // tset