You're welcome!
Adding another module with a method does not fix the original problem, it just creates more problems for other people to solve.
> isCapital("שלום");
true
> isCapital("1");
true
> isCapital('\uD83D\uDE00'); // Smiling emoji
true
> isCapital(\u279B); // Right-facing arrow
true
> isCapital("\u061Casd"); //Bidirectional control character
true
> isCapital(" ");
true
Actually, it just means that if you're wondering "if this word starts with a capital", you're asking a wrong question. Instead, you should be asking "if this word is a valid generic name", or "is this word a start of a new sentence", and implement these semantic queries in a language-specific way.
startsWithCapitalLetter("!") == true
which is not what you want.edit: fortunately there's an npm modules you can included to fix it...
Why not both? If you just want one part of a module, you can just import the dependency directly, if you want a whole core lib, you can do that.
Some people really like underscore and import that. I use ES6/7 functions for the most part, but underscore has some useful things I can import on their own.