first commit
This commit is contained in:
16
node_modules/indefinite/lib/helpers.js
generated
vendored
Normal file
16
node_modules/indefinite/lib/helpers.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
const STARTS_WITH_VOWEL = /^[aeiouAEIOU]/;
|
||||
|
||||
/**
|
||||
* Array#indexOf is faster IF the word starts with "a" (for example),
|
||||
* but negligibly faster when you have to .toLowerCase() the word, and
|
||||
* slower if the word happens to start with (e.g.) "u."
|
||||
*/
|
||||
exports.startsWithVowel = word => STARTS_WITH_VOWEL.test(word);
|
||||
|
||||
exports.capitalize = (article, opts) => {
|
||||
if (opts.capitalize) {
|
||||
article = `${article.charAt(0).toUpperCase()}${article.slice(1)}`;
|
||||
}
|
||||
|
||||
return article;
|
||||
};
|
||||
Reference in New Issue
Block a user