MohamedBechirMejri / js-ext

A collection of useful JavaScript functions

Home Page:https://www.npmjs.com/package/@mohamedbechirmejri/js-ext

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

js-ext

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.

Install

bun i @mohamedbechirmejri/js-ext

Features

Typescript support

add the following to your tsconfig.json file

{
  "compilerOptions": {
    "types": ["./node_modules/@mohamedbechirmejri/js-ext/.build/index.d.ts"]
  }
}

Usage

// 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

Functions

you can use your IDE's intellisense to see all the functions

the library also includes JSDOC comments for all the functions

String

"test".CAPITALIZE(); // Test
"test".REVERSE(); // tset