name-initials
v0.1.3
Published
A JavaScript utility library to extract initials from names.
Downloads
62,132
Readme
name-initials
A JavaScript utility library to extract initials from names.
Usage
Install the module:
npm install name-initials --save
ES6
import nameInitials from 'name-initials';
const initials = nameInitials('John Smith');
console.log(initials);
// Output: JS
Pre-ES6
var nameInitials = require('name-initials');
var initials = nameInitials('John Smith');
console.log(initials);
// Output: JS
Input => Output
- E. => E
- Eric => E
- E. Vera => EV
- Eric V. => EV
- Eric A. E. => EA
- Eric A. E. Vera => EV
- Eric A. Vera => EV
- Eric A. Vera Perez => EV
- Eric Vera-Perez => EV
- Eric A. Vera-Perez => EV
- Eric Vera Perez => EV
- Eric A. de Vera Perez => ED
- Eric A. de Vera-Perez => ED
- Eric A. Perez-de Vera => EP
- Eric A. Perez de Vera => EP
- Eric (Instructor Somewhere) => E
- Éric Vera => ÉV
- Vera-Perez => VP
- Eric "No Nickname" Vera => E