zodiac-mapper 0.1.0 → 0.2.0

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/index.d.cts CHANGED
@@ -63,6 +63,13 @@ declare function findFirstZodiacInText(text: string, options?: ZodiacMatcherOpti
63
63
  * @returns An array of matches.
64
64
  */
65
65
  declare function findAllZodiacInText(text: string, options?: ZodiacMatcherOptions): ZodiacMatch[];
66
+ /**
67
+ * Returns the list of names/aliases for a given zodiac sign in a specific locale.
68
+ * @param sign The zodiac sign.
69
+ * @param locale The locale code (e.g. "en", "zh", "es").
70
+ * @returns An array of names, or empty array if locale/sign not found.
71
+ */
72
+ declare function getZodiacNames(sign: ZodiacSign, locale: string): string[];
66
73
  //#endregion
67
74
  //#region src/date.d.ts
68
75
  interface MonthDay {
@@ -106,5 +113,5 @@ declare function getZodiacSignFromDate(date: Date | MonthDay | string): ZodiacSi
106
113
  */
107
114
  declare function normalizeName(str: string): string;
108
115
  //#endregion
109
- export { type MonthDay, type ZodiacDateRange, type ZodiacMatch, type ZodiacMatcher, type ZodiacMatcherOptions, ZodiacSign, createZodiacMatcher, findAllZodiacInText, findFirstZodiacInText, getSupportedLocales, getZodiacDateRange, getZodiacSign, getZodiacSignFromDate, normalizeName };
116
+ export { type MonthDay, type ZodiacDateRange, type ZodiacMatch, type ZodiacMatcher, type ZodiacMatcherOptions, ZodiacSign, createZodiacMatcher, findAllZodiacInText, findFirstZodiacInText, getSupportedLocales, getZodiacDateRange, getZodiacNames, getZodiacSign, getZodiacSignFromDate, normalizeName };
110
117
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.mts CHANGED
@@ -63,6 +63,13 @@ declare function findFirstZodiacInText(text: string, options?: ZodiacMatcherOpti
63
63
  * @returns An array of matches.
64
64
  */
65
65
  declare function findAllZodiacInText(text: string, options?: ZodiacMatcherOptions): ZodiacMatch[];
66
+ /**
67
+ * Returns the list of names/aliases for a given zodiac sign in a specific locale.
68
+ * @param sign The zodiac sign.
69
+ * @param locale The locale code (e.g. "en", "zh", "es").
70
+ * @returns An array of names, or empty array if locale/sign not found.
71
+ */
72
+ declare function getZodiacNames(sign: ZodiacSign, locale: string): string[];
66
73
  //#endregion
67
74
  //#region src/date.d.ts
68
75
  interface MonthDay {
@@ -106,5 +113,5 @@ declare function getZodiacSignFromDate(date: Date | MonthDay | string): ZodiacSi
106
113
  */
107
114
  declare function normalizeName(str: string): string;
108
115
  //#endregion
109
- export { type MonthDay, type ZodiacDateRange, type ZodiacMatch, type ZodiacMatcher, type ZodiacMatcherOptions, ZodiacSign, createZodiacMatcher, findAllZodiacInText, findFirstZodiacInText, getSupportedLocales, getZodiacDateRange, getZodiacSign, getZodiacSignFromDate, normalizeName };
116
+ export { type MonthDay, type ZodiacDateRange, type ZodiacMatch, type ZodiacMatcher, type ZodiacMatcherOptions, ZodiacSign, createZodiacMatcher, findAllZodiacInText, findFirstZodiacInText, getSupportedLocales, getZodiacDateRange, getZodiacNames, getZodiacSign, getZodiacSignFromDate, normalizeName };
110
117
  //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs CHANGED
@@ -2541,6 +2541,19 @@ function findFirstZodiacInText(text, options) {
2541
2541
  function findAllZodiacInText(text, options) {
2542
2542
  return findZodiacMatchesInText(text, options);
2543
2543
  }
2544
+ /**
2545
+ * Returns the list of names/aliases for a given zodiac sign in a specific locale.
2546
+ * @param sign The zodiac sign.
2547
+ * @param locale The locale code (e.g. "en", "zh", "es").
2548
+ * @returns An array of names, or empty array if locale/sign not found.
2549
+ */
2550
+ function getZodiacNames(sign, locale) {
2551
+ const canonical = canonicalizeLocale(locale);
2552
+ const base = getBaseLanguage(locale);
2553
+ if (ZODIAC_PER_LOCALE[canonical]?.[sign]) return ZODIAC_PER_LOCALE[canonical][sign];
2554
+ if (ZODIAC_PER_LOCALE[base]?.[sign]) return ZODIAC_PER_LOCALE[base][sign];
2555
+ return [];
2556
+ }
2544
2557
  function isLatin(str) {
2545
2558
  return /^[a-zA-Z\u00C0-\u00FF]+$/.test(str);
2546
2559
  }
@@ -2792,5 +2805,5 @@ function getZodiacSignFromDate(date) {
2792
2805
  }
2793
2806
 
2794
2807
  //#endregion
2795
- export { ZodiacSign, createZodiacMatcher, findAllZodiacInText, findFirstZodiacInText, getSupportedLocales, getZodiacDateRange, getZodiacSign, getZodiacSignFromDate, normalizeName };
2808
+ export { ZodiacSign, createZodiacMatcher, findAllZodiacInText, findFirstZodiacInText, getSupportedLocales, getZodiacDateRange, getZodiacNames, getZodiacSign, getZodiacSignFromDate, normalizeName };
2796
2809
  //# sourceMappingURL=index.mjs.map