dce-reactkit 3.6.14 → 3.6.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -43350,6 +43350,30 @@ const makeLinksClickable = (text, opts) => {
43350
43350
  return elements;
43351
43351
  };
43352
43352
 
43353
+ // Constants
43354
+ const VOWELS = ['a', 'e', 'i', 'o', 'u'];
43355
+ /**
43356
+ * Prefix a word or name with "a" or "an" depending on whether it starts with a
43357
+ * vowel or not
43358
+ * @author Gabe Abrams
43359
+ * @param text the text to prefix
43360
+ * @param capitalize whether to capitalize the "A" or "An"
43361
+ * @returns the text prefixed with "a" or "an"
43362
+ */
43363
+ const prefixWithAOrAn = (text, capitalize = false) => {
43364
+ // Get the first letter
43365
+ const firstLetter = text.charAt(0).toLowerCase();
43366
+ // Check if starts with vowel
43367
+ const startsWithVowel = VOWELS.includes(firstLetter);
43368
+ // Determine prefix
43369
+ let prefix = startsWithVowel ? 'an' : 'a';
43370
+ if (capitalize) {
43371
+ prefix = prefix.charAt(0).toUpperCase() + prefix.substring(1);
43372
+ }
43373
+ // Return the text prefixed with "a" or "an"
43374
+ return `${prefix} ${text}`;
43375
+ };
43376
+
43353
43377
  /**
43354
43378
  * Days of the week
43355
43379
  * @author Gabe Abrams
@@ -43442,6 +43466,7 @@ exports.onlyKeepLetters = onlyKeepLetters;
43442
43466
  exports.padDecimalZeros = padDecimalZeros;
43443
43467
  exports.padZerosLeft = padZerosLeft;
43444
43468
  exports.parallelLimit = parallelLimit;
43469
+ exports.prefixWithAOrAn = prefixWithAOrAn;
43445
43470
  exports.roundToNumDecimals = roundToNumDecimals;
43446
43471
  exports.showFatalError = showFatalError;
43447
43472
  exports.startMinWait = startMinWait;