gr2m / initials

extract initials from and add initials to names
https://gr2m.github.io/initials
MIT License
44 stars 14 forks source link

allow to pass existing initials for names #2

Closed gr2m closed 10 years ago

gr2m commented 10 years ago

use case: multiple fields that might contain the same names. Example:

  1. Project owner: 'John Doe'
  2. Assigned: 'John Doe, Jane Dane'

In that case I'd like initials for 'John Doe' to be 'JD', and for 'John Doe, Jane Dane' to be 'JD, JDa' instead of 'JDo, JDa'

suggested API:

// pass existing initials for names
initials(['John Doe', 'Jane Dane'], {
  existing: { 'John Doe': 'JD' }
})
// ['JD', 'JDa']