initials
v3.1.2
이름에서 이니셜을 추출하고 이름에 이니셜을 추가합니다.
node.js용 npm을 사용하여 설치:
npm install --save initials
이니셜('John Doe')// 'JD'initials(['John Doe', 'Robert Roe'])// ['JD', 'RR']// 이니셜의 별칭('John Doe')이니셜. find('John Doe')// 이름 구문 분석initials.parse('John Doe')// {name: 'John Doe', 이니셜: 'JD'}// 이니셜 추가 name(s)initials.addTo('John Doe')// 'John Doe (JD)'// namesinitials(['John Doe', 'Jane Dane'], {에 대한 기존 이니셜 전달 기존: { 'John Doe': 'JD' }})// ['JD', 'JDa']
선호하는 이니셜은 (JD)
로 전달될 수 있습니다. 예:
console.log( 이니셜('John Doe (JoDo)') );// 'JoDo'
이름에 이메일이 포함된 경우 이니셜 계산 시 무시됩니다.
console.log( 이니셜('John Doe [email protected]') );// 'JD'
이름 이 이메일인 경우 도메인 부분은 무시됩니다.
console.log( 이니셜('[email protected]') );// 'jo'
이름 배열을 전달할 때 이니셜이 중복되는 것을 방지합니다.
console.log( 이니셜(['John Doe', 'Jane Dane']) );// ['JDo', 'JDa']
npm test
MIT