initialism
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

initialism

A simple library to get initials out of words.

GitHub GitHub tag (latest SemVer) Codecov branch npm

Installation

Install using npm for node.js:

npm install --save initialism

Or yarn:

yarn add initialism

Usage

// Simple usage, returns initials from all words by default
initials('Acme Incorporation')
// 'AI'

// It can be as many words
initials('Lorem ipsum dolor sit amet')
// 'LIDSA'

// Or only a single word
initials('Acme')
// 'A'

// It can take a second argument, to specify the length
initials('John Doe Jr.', 2)
// 'JD'

// It the second argument is more than the amount of words, return the maximum initials
initials('John Doe Jr.', 5)
// 'JDJ'

// If a second argument is provided but the first argument is only a single word, returns from its first letters
initials('International', 3)
// 'INT'

Test

npm run test

Or

yarn test

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.4
    633
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.4
    633
  • 1.0.3
    2
  • 1.0.2
    0
  • 1.0.1
    11
  • 1.0.0
    0

Package Sidebar

Install

npm i initialism

Weekly Downloads

646

Version

1.0.4

License

MIT

Unpacked Size

6.65 kB

Total Files

9

Last publish

Collaborators

  • marssantoso