JSPM

abbreviate-name

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

    Abreviate names

    Package Exports

    • abbreviate-name

    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 (abbreviate-name) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    Abbreviate the lastnames, except the last:

    'George Raymond Richard Martin' => 'George R. R. Martin'

    Install

    npm i abbreviate-lastnames

    Usage

    Just import the module, and use their like a function

    import abbreviate from 'abbreviate-lastnames'
    
    abbreviate('George Raymond Richard Martin')// => 'George R. R. Martin'

    If you want set the numbers of lastnames to keep, pass a number in second argument

    // will keep the two lastnames
    abbreviate('George Raymond Richard Martin', 2) ==> 'George R. Richard Martin'

    Prepositions

    In portuguese, or spañol languages, the names commonly have prepositions, like de, dos, or el. This module know that, and by default, keep these, without abbreviate it. E.g.

    abbreviate('Darlan Mendonça de Oliveira Almeida') ==> 'Darlan M. de O. Almeida'