1.0.1 • Published 3 years ago

to-acronym v1.0.1

Weekly downloads
118
License
MIT
Repository
-
Last release
3 years ago

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

OptionDescriptionDefault value
maxLengthMaximum length of the acronym to be formed5
highPriorityOnlyOnly use words with high priorityfalse
acronymMaxLengthUse built-in acronyms with maximum length. Longer acronyms are used than normal words2

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
1.0.1

3 years ago

1.0.0

3 years ago

0.10.0

3 years ago

0.9.0

3 years ago