JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 555
  • Score
    100M100P100Q97191F
  • License MIT

A simple library to get initials out of words.

Package Exports

  • initialism

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (initialism) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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