An acronym generator with useful options.
npm install akronim
This package is a pure ESM package.
import akronim from "akronim";
akronim("Mustafa Kemal Atatürk");
// "MKA"
akronim("God of War");
// "GOW"
akronim("GitHub");
// "GH"
akronim("Game of Thrones", { ignoreLowercaseWords: true });
// "GT"
akronim("Grand Theft Auto", { separateWith: "." });
// "G.T.A."
akronim("Grand Theft Auto", { separateWith: ".", trimLastSeparator: true });
// "G.T.A"
akronim("To be announced", { capitalize: false });
// "Tba"
Text to generate the acronym.
Note: It will be trimmed with .trim()
.
Type: string | number
Required: Yes
Default: {}
Type: object
Required: No
Ignores lowercase words in the input.
Default: false
Type: boolean
Required: No
akronim("Game of Thrones", { ignoreLowercaseWords: true });
// "GT"
Separates the output with the given value.
Note: It will be trimmed with .trim()
.
Default: ""
Type: string | number
Required: No
akronim("Grand Theft Auto", { separateWith: "." });
// "G.T.A."
Trims the last separator in the output when using with options.separateWith
.
Default: false
Type: boolean
Required: No
akronim("Grand Theft Auto", { separateWith: ".", trimLastSeparator: true });
// "G.T.A"
Capitalizes all letters in the output.
Default: true
Type: boolean
Required: No
akronim("To be announced");
akronim("To be announced", { capitalize: true });
// "TBA"
akronim("To be announced", { capitalize: false });
// "Tba"