to-acronym

1.0.1 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i to-acronym

Weekly Downloads

12

Version

1.0.1

License

MIT

Unpacked Size

84.9 kB

Total Files

15

Last publish

Collaborators

  • alexsedeke