const initials = name.match(/\b\w/g).join('')
But, yes, this does seem an odd thing to call out to a remote api for.
This would need some work to match the features of what was posted, but not much. https://jsfiddle.net/g6nrs5cq/