Skip to content

alexandrstudio/to-acronym

Repository files navigation

to-acronym

Build Status

to-acronym analyzes a string that can consist of one or more words and tries to create a short and concise acronym. to-acronym was build to generate acronyms from company names to have concise acronym used as database keys. to-acronym has no package dependencies.

Install

npm install to-acronym

Usage

const { acronym } = require('to-acronym')

const myAcronym = acronym('IBM Services')
// returns IBMS
const wordAcronym = acronym('System')
// returns STM
const prioAcronym = acronym('Systems for Green Planet', { highPriorityOnly: true })
// returns SGP

Options

Option Description Default value
maxLength Maximum length of the acronym to be formed 5
highPriorityOnly Only use words with high priority false
acronymMaxLength Use built-in acronyms with maximum length. Longer acronyms are used than normal words 2

About

to-acronym tries to keep the formed acronym as short as possible. Therefore there is a prioritization within the individual words. Words that start with capital letters have a higher priority than those with lower case. If a specified length is exceeded, words are only used with high priority.

to-acronym also tries to filter out acronyms within the input. This is only possible if you pay attention to upper and lower case. As an example, in 'GE Green Planet' the acronym 'GE' for 'General Electrics' is recognized as an acronym based on the spelling.

Below are a few examples and their formed acronym.

  • GE Green Planet Develoment -> GEGPD
  • GE Green for Planet -> GEGPD
  • Charles and Antony -> CAA
  • System -> STM

About

Create acronym from one or more words

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published