node-emojis 0.0.4 → 1.0.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.
Files changed (79) hide show
  1. package/README.md +201 -123
  2. package/lib/backward-compat.d.ts +29 -0
  3. package/lib/backward-compat.d.ts.map +1 -0
  4. package/lib/backward-compat.js +160 -0
  5. package/lib/backward-compat.js.map +1 -0
  6. package/lib/categories/animals.d.ts +3 -0
  7. package/lib/categories/animals.d.ts.map +1 -0
  8. package/lib/categories/animals.js +17 -0
  9. package/lib/categories/animals.js.map +1 -0
  10. package/lib/categories/food.d.ts +3 -0
  11. package/lib/categories/food.d.ts.map +1 -0
  12. package/lib/categories/food.js +17 -0
  13. package/lib/categories/food.js.map +1 -0
  14. package/lib/categories/nature.d.ts +3 -0
  15. package/lib/categories/nature.d.ts.map +1 -0
  16. package/lib/categories/nature.js +17 -0
  17. package/lib/categories/nature.js.map +1 -0
  18. package/lib/categories/people.d.ts +3 -0
  19. package/lib/categories/people.d.ts.map +1 -0
  20. package/lib/categories/people.js +17 -0
  21. package/lib/categories/people.js.map +1 -0
  22. package/lib/categories/travel.d.ts +3 -0
  23. package/lib/categories/travel.d.ts.map +1 -0
  24. package/lib/categories/travel.js +17 -0
  25. package/lib/categories/travel.js.map +1 -0
  26. package/lib/core/emoji.d.ts +46 -0
  27. package/lib/core/emoji.d.ts.map +1 -0
  28. package/lib/core/emoji.js +3 -0
  29. package/lib/core/emoji.js.map +1 -0
  30. package/lib/data/aliases.json +472 -0
  31. package/lib/data/categories.json +381 -0
  32. package/lib/data/emojis.json +371 -0
  33. package/lib/data/metadata.json +3254 -0
  34. package/lib/data/skin-tones.json +196 -0
  35. package/lib/features/aliases/index.d.ts +375 -0
  36. package/lib/features/aliases/index.d.ts.map +1 -0
  37. package/lib/features/aliases/index.js +230 -0
  38. package/lib/features/aliases/index.js.map +1 -0
  39. package/lib/features/filters/index.d.ts +119 -0
  40. package/lib/features/filters/index.d.ts.map +1 -0
  41. package/lib/features/filters/index.js +196 -0
  42. package/lib/features/filters/index.js.map +1 -0
  43. package/lib/features/search/index.d.ts +82 -0
  44. package/lib/features/search/index.d.ts.map +1 -0
  45. package/lib/features/search/index.js +204 -0
  46. package/lib/features/search/index.js.map +1 -0
  47. package/lib/features/skin-tones/index.d.ts +119 -0
  48. package/lib/features/skin-tones/index.d.ts.map +1 -0
  49. package/lib/features/skin-tones/index.js +184 -0
  50. package/lib/features/skin-tones/index.js.map +1 -0
  51. package/lib/index.d.ts +29 -0
  52. package/lib/index.d.ts.map +1 -0
  53. package/lib/index.js +57 -3
  54. package/lib/index.js.map +1 -0
  55. package/lib/types/index.d.ts +21 -0
  56. package/lib/types/index.d.ts.map +1 -0
  57. package/lib/types/index.js +3 -0
  58. package/lib/types/index.js.map +1 -0
  59. package/lib/utils/reverse-mapping.d.ts +111 -0
  60. package/lib/utils/reverse-mapping.d.ts.map +1 -0
  61. package/lib/utils/reverse-mapping.js +138 -0
  62. package/lib/utils/reverse-mapping.js.map +1 -0
  63. package/lib/utils/validators.d.ts +63 -0
  64. package/lib/utils/validators.d.ts.map +1 -0
  65. package/lib/utils/validators.js +106 -0
  66. package/lib/utils/validators.js.map +1 -0
  67. package/package.json +121 -17
  68. package/.github/FUNDING.yml +0 -5
  69. package/.github/workflows/nodejs.yml +0 -26
  70. package/.travis.yml +0 -12
  71. package/CODE_OF_CONDUCT.md +0 -46
  72. package/lib/emojis/animal-emojis.js +0 -71
  73. package/lib/emojis/emojis.js +0 -9
  74. package/lib/emojis/food-emojis.js +0 -42
  75. package/lib/emojis/index.js +0 -3
  76. package/lib/emojis/nature-emojis.js +0 -9
  77. package/lib/emojis/people-emojis.js +0 -181
  78. package/lib/emojis/travel-emojis.js +0 -17
  79. package/test/test.js +0 -26
@@ -0,0 +1,204 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.search = search;
7
+ exports.getByCategory = getByCategory;
8
+ exports.getCategories = getCategories;
9
+ const emojis_json_1 = __importDefault(require("../../data/emojis.json"));
10
+ const metadata_json_1 = __importDefault(require("../../data/metadata.json"));
11
+ const aliases_json_1 = __importDefault(require("../../data/aliases.json"));
12
+ const searchIndex = {
13
+ byName: new Map(),
14
+ byKeyword: new Map(),
15
+ byAlias: new Map()
16
+ };
17
+ // Build the search index once at module load
18
+ function buildSearchIndex() {
19
+ // Index by name
20
+ Object.keys(emojis_json_1.default).forEach(name => {
21
+ const lowerName = name.toLowerCase();
22
+ // Index each substring of the name
23
+ for (let i = 0; i < lowerName.length; i++) {
24
+ for (let j = i + 1; j <= lowerName.length; j++) {
25
+ const substring = lowerName.substring(i, j);
26
+ if (!searchIndex.byName.has(substring)) {
27
+ searchIndex.byName.set(substring, new Set());
28
+ }
29
+ searchIndex.byName.get(substring).add(name);
30
+ }
31
+ }
32
+ });
33
+ // Index by keywords
34
+ Object.entries(metadata_json_1.default).forEach(([name, meta]) => {
35
+ if (meta?.keywords) {
36
+ meta.keywords.forEach(keyword => {
37
+ const lowerKeyword = keyword.toLowerCase();
38
+ // Index full keyword and substrings
39
+ for (let i = 0; i < lowerKeyword.length; i++) {
40
+ for (let j = i + 1; j <= lowerKeyword.length; j++) {
41
+ const substring = lowerKeyword.substring(i, j);
42
+ if (!searchIndex.byKeyword.has(substring)) {
43
+ searchIndex.byKeyword.set(substring, new Set());
44
+ }
45
+ searchIndex.byKeyword.get(substring).add(name);
46
+ }
47
+ }
48
+ });
49
+ }
50
+ });
51
+ // Index by aliases
52
+ Object.entries(aliases_json_1.default).forEach(([primary, aliasList]) => {
53
+ aliasList.forEach(alias => {
54
+ const lowerAlias = alias.toLowerCase();
55
+ // Index full alias and substrings
56
+ for (let i = 0; i < lowerAlias.length; i++) {
57
+ for (let j = i + 1; j <= lowerAlias.length; j++) {
58
+ const substring = lowerAlias.substring(i, j);
59
+ if (!searchIndex.byAlias.has(substring)) {
60
+ searchIndex.byAlias.set(substring, new Set());
61
+ }
62
+ searchIndex.byAlias.get(substring).add(primary);
63
+ }
64
+ }
65
+ });
66
+ });
67
+ }
68
+ // Build index on module load
69
+ buildSearchIndex();
70
+ /**
71
+ * Search for emojis by keyword, name, or alias
72
+ *
73
+ * This function uses pre-built indexes for O(1) substring matching performance.
74
+ * Results are scored based on match type:
75
+ * - Name matches: score 1.0
76
+ * - Keyword matches: score 0.8
77
+ * - Alias matches: score 0.6
78
+ *
79
+ * @param keyword - The search term to find emojis for
80
+ * @returns Array of search results sorted by relevance score (highest first)
81
+ *
82
+ * @example
83
+ * ```typescript
84
+ * // Search by name
85
+ * search('fire')
86
+ * // Returns: [{ name: 'fire', emoji: '🔥', score: 1.0, ... }]
87
+ *
88
+ * // Search by keyword
89
+ * search('happy')
90
+ * // Returns: [{ name: 'smile', emoji: '😊', score: 0.8, ... }, ...]
91
+ *
92
+ * // Search by alias
93
+ * search('snapstreak')
94
+ * // Returns: [{ name: 'fire', emoji: '🔥', score: 0.6, ... }]
95
+ *
96
+ * // Partial matches work too
97
+ * search('hap')
98
+ * // Returns emojis with names/keywords/aliases containing 'hap'
99
+ * ```
100
+ */
101
+ function search(keyword) {
102
+ const searchTerm = keyword.toLowerCase();
103
+ const resultMap = new Map();
104
+ // Search in name index
105
+ const nameMatches = searchIndex.byName.get(searchTerm) || new Set();
106
+ nameMatches.forEach(name => {
107
+ const meta = metadata_json_1.default[name];
108
+ resultMap.set(name, {
109
+ name,
110
+ emoji: emojis_json_1.default[name],
111
+ keywords: meta?.keywords || [],
112
+ category: meta?.category || 'other',
113
+ score: 1.0
114
+ });
115
+ });
116
+ // Search in keyword index
117
+ const keywordMatches = searchIndex.byKeyword.get(searchTerm) || new Set();
118
+ keywordMatches.forEach(name => {
119
+ if (!resultMap.has(name)) {
120
+ const meta = metadata_json_1.default[name];
121
+ resultMap.set(name, {
122
+ name,
123
+ emoji: emojis_json_1.default[name],
124
+ keywords: meta?.keywords || [],
125
+ category: meta?.category || 'other',
126
+ score: 0.8
127
+ });
128
+ }
129
+ });
130
+ // Search in alias index
131
+ const aliasMatches = searchIndex.byAlias.get(searchTerm) || new Set();
132
+ aliasMatches.forEach(name => {
133
+ if (!resultMap.has(name)) {
134
+ const meta = metadata_json_1.default[name];
135
+ resultMap.set(name, {
136
+ name,
137
+ emoji: emojis_json_1.default[name],
138
+ keywords: meta?.keywords || [],
139
+ category: meta?.category || 'other',
140
+ score: 0.6
141
+ });
142
+ }
143
+ });
144
+ // Convert to array and sort by score
145
+ return Array.from(resultMap.values()).sort((a, b) => (b.score || 0) - (a.score || 0));
146
+ }
147
+ /**
148
+ * Get all emojis that belong to a specific category
149
+ *
150
+ * @param category - The category name to filter by (e.g., 'people', 'animals', 'food')
151
+ * @returns Array of emojis in the specified category, or empty array if category doesn't exist
152
+ *
153
+ * @example
154
+ * ```typescript
155
+ * // Get all animal emojis
156
+ * getByCategory('animals')
157
+ * // Returns: [
158
+ * // { name: 'cat', emoji: '🐈', category: 'animals', ... },
159
+ * // { name: 'dog', emoji: '🐕', category: 'animals', ... },
160
+ * // ...
161
+ * // ]
162
+ *
163
+ * // Invalid category returns empty array
164
+ * getByCategory('invalid')
165
+ * // Returns: []
166
+ * ```
167
+ */
168
+ function getByCategory(category) {
169
+ return Object.entries(emojis_json_1.default)
170
+ .filter(([name]) => {
171
+ const meta = metadata_json_1.default[name];
172
+ return meta?.category === category;
173
+ })
174
+ .map(([name, emoji]) => {
175
+ const meta = metadata_json_1.default[name];
176
+ return {
177
+ name,
178
+ emoji: emoji,
179
+ keywords: meta?.keywords || [],
180
+ category: meta?.category || 'other'
181
+ };
182
+ });
183
+ }
184
+ /**
185
+ * Get a list of all available emoji categories
186
+ *
187
+ * @returns Sorted array of category names
188
+ *
189
+ * @example
190
+ * ```typescript
191
+ * getCategories()
192
+ * // Returns: ['animals', 'food', 'nature', 'people', 'travel', ...]
193
+ * ```
194
+ */
195
+ function getCategories() {
196
+ const categories = new Set();
197
+ Object.values(metadata_json_1.default).forEach(meta => {
198
+ if (meta?.category) {
199
+ categories.add(meta.category);
200
+ }
201
+ });
202
+ return Array.from(categories).sort();
203
+ }
204
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/features/search/index.ts"],"names":[],"mappings":";;;;;AAyHA,wBAiDC;AAuBD,sCAeC;AAaD,sCAQC;AArOD,yEAA2C;AAC3C,6EAA+C;AAC/C,2EAA6C;AAyB7C,MAAM,WAAW,GAAgB;IAC/B,MAAM,EAAE,IAAI,GAAG,EAAE;IACjB,SAAS,EAAE,IAAI,GAAG,EAAE;IACpB,OAAO,EAAE,IAAI,GAAG,EAAE;CACnB,CAAA;AAED,6CAA6C;AAC7C,SAAS,gBAAgB;IACvB,gBAAgB;IAChB,MAAM,CAAC,IAAI,CAAC,qBAAM,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACjC,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,EAAE,CAAA;QACpC,mCAAmC;QACnC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC1C,KAAK,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC/C,MAAM,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;gBAC3C,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;oBACvC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,GAAG,EAAE,CAAC,CAAA;gBAC9C,CAAC;gBACD,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA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AAC,CAAA;IACF,OAAO,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,EAAE,CAAA;AACtC,CAAC"}
@@ -0,0 +1,119 @@
1
+ /** Valid skin tone modifier names */
2
+ export type SkinTone = 'light' | 'medium-light' | 'medium' | 'medium-dark' | 'dark';
3
+ /** Numeric aliases for skin tones (1-5) */
4
+ export type SkinToneAlias = '1' | '2' | '3' | '4' | '5';
5
+ /**
6
+ * Apply a skin tone modifier to an emoji
7
+ *
8
+ * This function removes any existing skin tone modifiers before applying the new one.
9
+ * Supports both named tones ('light', 'medium-dark') and numeric aliases ('1', '4').
10
+ *
11
+ * @param emoji - The emoji character to modify (e.g., '👋' or '👋🏻')
12
+ * @param tone - The skin tone to apply (name or numeric alias)
13
+ * @returns The emoji with the specified skin tone modifier applied
14
+ * @throws {Error} If the tone parameter is invalid
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * // Apply skin tone by name
19
+ * applySkinTone('👋', 'dark')
20
+ * // Returns: '👋🏿'
21
+ *
22
+ * // Apply skin tone by numeric alias
23
+ * applySkinTone('👋', '3')
24
+ * // Returns: '👋🏽' (medium)
25
+ *
26
+ * // Replace existing skin tone
27
+ * applySkinTone('👋🏻', 'dark')
28
+ * // Returns: '👋🏿'
29
+ * ```
30
+ */
31
+ export declare function applySkinTone(emoji: string, tone: SkinTone | SkinToneAlias): string;
32
+ /**
33
+ * Check if an emoji supports skin tone variations
34
+ *
35
+ * Works with both emoji names and emoji characters. Also checks aliases.
36
+ *
37
+ * @param nameOrEmoji - Either an emoji name (e.g., 'wave') or emoji character (e.g., '👋')
38
+ * @returns true if the emoji supports skin tone modifiers, false otherwise
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ * // Check by name
43
+ * supportsSkinTone('wave')
44
+ * // Returns: true
45
+ *
46
+ * // Check by emoji character
47
+ * supportsSkinTone('👋')
48
+ * // Returns: true
49
+ *
50
+ * // Check by alias
51
+ * supportsSkinTone('hand_wave')
52
+ * // Returns: true
53
+ *
54
+ * // Non-human emojis don't support skin tones
55
+ * supportsSkinTone('fire')
56
+ * // Returns: false
57
+ * ```
58
+ */
59
+ export declare function supportsSkinTone(nameOrEmoji: string): boolean;
60
+ /**
61
+ * Get all skin tone variations of an emoji
62
+ *
63
+ * Returns an object with all possible skin tone variations including the default (no modifier).
64
+ *
65
+ * @param emoji - The emoji character to get variations for
66
+ * @returns Object mapping tone names to emoji variations
67
+ *
68
+ * @example
69
+ * ```typescript
70
+ * getAllSkinToneVariations('👋')
71
+ * // Returns: {
72
+ * // default: '👋',
73
+ * // light: '👋🏻',
74
+ * // 'medium-light': '👋🏼',
75
+ * // medium: '👋🏽',
76
+ * // 'medium-dark': '👋🏾',
77
+ * // dark: '👋🏿'
78
+ * // }
79
+ *
80
+ * // Works with emojis that already have skin tone
81
+ * getAllSkinToneVariations('👋🏻')
82
+ * // Returns same as above (strips existing tone first)
83
+ * ```
84
+ */
85
+ export declare function getAllSkinToneVariations(emoji: string): Record<SkinTone | 'default', string>;
86
+ /**
87
+ * Remove skin tone modifier from an emoji
88
+ *
89
+ * Strips all skin tone modifiers and variation selectors to return the base emoji.
90
+ * Safe to use on emojis without skin tones.
91
+ *
92
+ * @param emoji - The emoji character to remove skin tone from
93
+ * @returns The base emoji without any skin tone modifiers
94
+ *
95
+ * @example
96
+ * ```typescript
97
+ * // Remove skin tone
98
+ * removeSkinTone('👋🏿')
99
+ * // Returns: '👋'
100
+ *
101
+ * // Multiple skin tones (family emojis)
102
+ * removeSkinTone('👨🏻‍👩🏾‍👧🏽')
103
+ * // Returns: '👨‍👩‍👧'
104
+ *
105
+ * // No skin tone - returns unchanged
106
+ * removeSkinTone('🔥')
107
+ * // Returns: '🔥'
108
+ * ```
109
+ */
110
+ export declare function removeSkinTone(emoji: string): string;
111
+ export declare const SKIN_TONE_MODIFIERS: {
112
+ light: string;
113
+ "medium-light": string;
114
+ medium: string;
115
+ "medium-dark": string;
116
+ dark: string;
117
+ };
118
+ export declare const SKIN_TONE_CAPABLE_EMOJIS: string[];
119
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/features/skin-tones/index.ts"],"names":[],"mappings":"AAIA,qCAAqC;AACrC,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,cAAc,GAAG,QAAQ,GAAG,aAAa,GAAG,MAAM,CAAA;AAEnF,2CAA2C;AAC3C,MAAM,MAAM,aAAa,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAA;AAUvD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,aAAa,GAAG,MAAM,CAanF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAY7D;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,QAAQ,GAAG,SAAS,EAAE,MAAM,CAAC,CAW5F;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAWpD;AAuBD,eAAO,MAAM,mBAAmB;;;;;;CAAyB,CAAA;AACzD,eAAO,MAAM,wBAAwB,UAAuB,CAAA"}
@@ -0,0 +1,184 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.SKIN_TONE_CAPABLE_EMOJIS = exports.SKIN_TONE_MODIFIERS = void 0;
7
+ exports.applySkinTone = applySkinTone;
8
+ exports.supportsSkinTone = supportsSkinTone;
9
+ exports.getAllSkinToneVariations = getAllSkinToneVariations;
10
+ exports.removeSkinTone = removeSkinTone;
11
+ const skin_tones_json_1 = __importDefault(require("../../data/skin-tones.json"));
12
+ const emojis_json_1 = __importDefault(require("../../data/emojis.json"));
13
+ const aliases_json_1 = __importDefault(require("../../data/aliases.json"));
14
+ const SKIN_TONE_ALIASES = {
15
+ '1': 'light',
16
+ '2': 'medium-light',
17
+ '3': 'medium',
18
+ '4': 'medium-dark',
19
+ '5': 'dark'
20
+ };
21
+ /**
22
+ * Apply a skin tone modifier to an emoji
23
+ *
24
+ * This function removes any existing skin tone modifiers before applying the new one.
25
+ * Supports both named tones ('light', 'medium-dark') and numeric aliases ('1', '4').
26
+ *
27
+ * @param emoji - The emoji character to modify (e.g., '👋' or '👋🏻')
28
+ * @param tone - The skin tone to apply (name or numeric alias)
29
+ * @returns The emoji with the specified skin tone modifier applied
30
+ * @throws {Error} If the tone parameter is invalid
31
+ *
32
+ * @example
33
+ * ```typescript
34
+ * // Apply skin tone by name
35
+ * applySkinTone('👋', 'dark')
36
+ * // Returns: '👋🏿'
37
+ *
38
+ * // Apply skin tone by numeric alias
39
+ * applySkinTone('👋', '3')
40
+ * // Returns: '👋🏽' (medium)
41
+ *
42
+ * // Replace existing skin tone
43
+ * applySkinTone('👋🏻', 'dark')
44
+ * // Returns: '👋🏿'
45
+ * ```
46
+ */
47
+ function applySkinTone(emoji, tone) {
48
+ const modifier = typeof tone === 'string' && tone in SKIN_TONE_ALIASES
49
+ ? skin_tones_json_1.default.modifiers[SKIN_TONE_ALIASES[tone]]
50
+ : skin_tones_json_1.default.modifiers[tone];
51
+ if (!modifier) {
52
+ throw new Error(`Invalid skin tone: ${tone}`);
53
+ }
54
+ // Remove any existing skin tone modifiers and variation selectors
55
+ const baseEmoji = removeSkinTone(emoji);
56
+ return baseEmoji + modifier;
57
+ }
58
+ /**
59
+ * Check if an emoji supports skin tone variations
60
+ *
61
+ * Works with both emoji names and emoji characters. Also checks aliases.
62
+ *
63
+ * @param nameOrEmoji - Either an emoji name (e.g., 'wave') or emoji character (e.g., '👋')
64
+ * @returns true if the emoji supports skin tone modifiers, false otherwise
65
+ *
66
+ * @example
67
+ * ```typescript
68
+ * // Check by name
69
+ * supportsSkinTone('wave')
70
+ * // Returns: true
71
+ *
72
+ * // Check by emoji character
73
+ * supportsSkinTone('👋')
74
+ * // Returns: true
75
+ *
76
+ * // Check by alias
77
+ * supportsSkinTone('hand_wave')
78
+ * // Returns: true
79
+ *
80
+ * // Non-human emojis don't support skin tones
81
+ * supportsSkinTone('fire')
82
+ * // Returns: false
83
+ * ```
84
+ */
85
+ function supportsSkinTone(nameOrEmoji) {
86
+ // Check if it's an emoji character or a name
87
+ const emojiName = emojis_json_1.default[nameOrEmoji] ? nameOrEmoji : getNameFromEmoji(nameOrEmoji);
88
+ if (!emojiName)
89
+ return false;
90
+ // Check if it's in the capable list
91
+ if (skin_tones_json_1.default.capable.includes(emojiName))
92
+ return true;
93
+ // Check aliases
94
+ const primaryName = getPrimaryName(emojiName);
95
+ return skin_tones_json_1.default.capable.includes(primaryName);
96
+ }
97
+ /**
98
+ * Get all skin tone variations of an emoji
99
+ *
100
+ * Returns an object with all possible skin tone variations including the default (no modifier).
101
+ *
102
+ * @param emoji - The emoji character to get variations for
103
+ * @returns Object mapping tone names to emoji variations
104
+ *
105
+ * @example
106
+ * ```typescript
107
+ * getAllSkinToneVariations('👋')
108
+ * // Returns: {
109
+ * // default: '👋',
110
+ * // light: '👋🏻',
111
+ * // 'medium-light': '👋🏼',
112
+ * // medium: '👋🏽',
113
+ * // 'medium-dark': '👋🏾',
114
+ * // dark: '👋🏿'
115
+ * // }
116
+ *
117
+ * // Works with emojis that already have skin tone
118
+ * getAllSkinToneVariations('👋🏻')
119
+ * // Returns same as above (strips existing tone first)
120
+ * ```
121
+ */
122
+ function getAllSkinToneVariations(emoji) {
123
+ const baseEmoji = removeSkinTone(emoji);
124
+ return {
125
+ default: baseEmoji,
126
+ light: applySkinTone(baseEmoji, 'light'),
127
+ 'medium-light': applySkinTone(baseEmoji, 'medium-light'),
128
+ medium: applySkinTone(baseEmoji, 'medium'),
129
+ 'medium-dark': applySkinTone(baseEmoji, 'medium-dark'),
130
+ dark: applySkinTone(baseEmoji, 'dark')
131
+ };
132
+ }
133
+ /**
134
+ * Remove skin tone modifier from an emoji
135
+ *
136
+ * Strips all skin tone modifiers and variation selectors to return the base emoji.
137
+ * Safe to use on emojis without skin tones.
138
+ *
139
+ * @param emoji - The emoji character to remove skin tone from
140
+ * @returns The base emoji without any skin tone modifiers
141
+ *
142
+ * @example
143
+ * ```typescript
144
+ * // Remove skin tone
145
+ * removeSkinTone('👋🏿')
146
+ * // Returns: '👋'
147
+ *
148
+ * // Multiple skin tones (family emojis)
149
+ * removeSkinTone('👨🏻‍👩🏾‍👧🏽')
150
+ * // Returns: '👨‍👩‍👧'
151
+ *
152
+ * // No skin tone - returns unchanged
153
+ * removeSkinTone('🔥')
154
+ * // Returns: '🔥'
155
+ * ```
156
+ */
157
+ function removeSkinTone(emoji) {
158
+ // Remove all skin tone modifiers
159
+ let result = emoji;
160
+ Object.values(skin_tones_json_1.default.modifiers).forEach(modifier => {
161
+ result = result.replace(new RegExp(modifier, 'g'), '');
162
+ });
163
+ // Also remove variation selectors
164
+ result = result.replace(/[\u{FE0F}\u{200D}]/gu, '');
165
+ return result;
166
+ }
167
+ // Helper functions
168
+ function getNameFromEmoji(emoji) {
169
+ const entry = Object.entries(emojis_json_1.default).find(([_, e]) => e === emoji);
170
+ return entry ? entry[0] : null;
171
+ }
172
+ function getPrimaryName(name) {
173
+ // Check if this name is already primary
174
+ if (aliases_json_1.default[name]) {
175
+ return name;
176
+ }
177
+ // Find if this is an alias
178
+ const entry = Object.entries(aliases_json_1.default).find(([_, aliasList]) => aliasList.includes(name));
179
+ return entry ? entry[0] : name;
180
+ }
181
+ // Export constants
182
+ exports.SKIN_TONE_MODIFIERS = skin_tones_json_1.default.modifiers;
183
+ exports.SKIN_TONE_CAPABLE_EMOJIS = skin_tones_json_1.default.capable;
184
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/features/skin-tones/index.ts"],"names":[],"mappings":";;;;;;AA4CA,sCAaC;AA6BD,4CAYC;AA2BD,4DAWC;AA0BD,wCAWC;AA7KD,iFAAqD;AACrD,yEAA2C;AAC3C,2EAA6C;AAQ7C,MAAM,iBAAiB,GAAoC;IACzD,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,cAAc;IACnB,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,aAAa;IAClB,GAAG,EAAE,MAAM;CACZ,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,SAAgB,aAAa,CAAC,KAAa,EAAE,IAA8B;IACzE,MAAM,QAAQ,GAAG,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,IAAI,iBAAiB;QACpE,CAAC,CAAC,yBAAY,CAAC,SAAS,CAAC,iBAAiB,CAAC,IAAqB,CAAC,CAAC;QAClE,CAAC,CAAC,yBAAY,CAAC,SAAS,CAAC,IAAgB,CAAC,CAAA;IAE5C,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,sBAAsB,IAAI,EAAE,CAAC,CAAA;IAC/C,CAAC;IAED,kEAAkE;IAClE,MAAM,SAAS,GAAG,cAAc,CAAC,KAAK,CAAC,CAAA;IAEvC,OAAO,SAAS,GAAG,QAAQ,CAAA;AAC7B,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,SAAgB,gBAAgB,CAAC,WAAmB;IAClD,6CAA6C;IAC7C,MAAM,SAAS,GAAG,qBAAM,CAAC,WAAkC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAA;IAE1G,IAAI,CAAC,SAAS;QAAE,OAAO,KAAK,CAAA;IAE5B,oCAAoC;IACpC,IAAI,yBA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C,OAAO,CAAC,qBAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,CAAC,CAAA;IAClE,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;AAChC,CAAC;AAED,SAAS,cAAc,CAAC,IAAY;IAClC,wCAAwC;IACxC,IAAI,sBAAO,CAAC,IAA4B,CAAC,EAAE,CAAC;QAC1C,OAAO,IAAI,CAAA;IACb,CAAC;IAED,2BAA2B;IAC3B,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,sBAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,EAAE,EAAE,CAC3D,SAAsB,CAAC,QAAQ,CAAC,IAAI,CAAC,CACvC,CAAA;IAED,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;AAChC,CAAC;AAED,mBAAmB;AACN,QAAA,mBAAmB,GAAG,yBAAY,CAAC,SAAS,CAAA;AAC5C,QAAA,wBAAwB,GAAG,yBAAY,CAAC,OAAO,CAAA"}
package/lib/index.d.ts ADDED
@@ -0,0 +1,29 @@
1
+ /**
2
+ * node-emojis - Complete emoji library for Node.js
3
+ *
4
+ * This module provides both modern tree-shakeable exports and backward compatibility
5
+ * with the v0.x API for smooth migration.
6
+ *
7
+ * Modern usage (tree-shakeable):
8
+ * ```
9
+ * import { search } from 'node-emojis'
10
+ * import { applySkinTone } from 'node-emojis'
11
+ * ```
12
+ *
13
+ * Legacy usage (backward compatible):
14
+ * ```
15
+ * const emojis = require('node-emojis')
16
+ * console.log(emojis.fire) // 🔥
17
+ * ```
18
+ */
19
+ export * from './features/search';
20
+ export * from './features/skin-tones';
21
+ export * from './features/aliases';
22
+ export * from './features/filters';
23
+ export * from './utils/reverse-mapping';
24
+ export * from './utils/validators';
25
+ export * from './core/emoji';
26
+ import { EmojisMain } from './backward-compat';
27
+ declare const emojis: EmojisMain;
28
+ export default emojis;
29
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,cAAc,mBAAmB,CAAA;AACjC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAGlC,cAAc,yBAAyB,CAAA;AACvC,cAAc,oBAAoB,CAAA;AAGlC,cAAc,cAAc,CAAA;AAG5B,OAAO,EAA+B,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAG3E,QAAA,MAAM,MAAM,EAAE,UAA0C,CAAA;AASxD,eAAe,MAAM,CAAA"}
package/lib/index.js CHANGED
@@ -1,3 +1,57 @@
1
- const emojis = require('./emojis')
2
-
3
- module.exports = emojis
1
+ "use strict";
2
+ /**
3
+ * node-emojis - Complete emoji library for Node.js
4
+ *
5
+ * This module provides both modern tree-shakeable exports and backward compatibility
6
+ * with the v0.x API for smooth migration.
7
+ *
8
+ * Modern usage (tree-shakeable):
9
+ * ```
10
+ * import { search } from 'node-emojis'
11
+ * import { applySkinTone } from 'node-emojis'
12
+ * ```
13
+ *
14
+ * Legacy usage (backward compatible):
15
+ * ```
16
+ * const emojis = require('node-emojis')
17
+ * console.log(emojis.fire) // 🔥
18
+ * ```
19
+ */
20
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ var desc = Object.getOwnPropertyDescriptor(m, k);
23
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
24
+ desc = { enumerable: true, get: function() { return m[k]; } };
25
+ }
26
+ Object.defineProperty(o, k2, desc);
27
+ }) : (function(o, m, k, k2) {
28
+ if (k2 === undefined) k2 = k;
29
+ o[k2] = m[k];
30
+ }));
31
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
32
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
33
+ };
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ // Re-export all modern features for tree-shaking
36
+ __exportStar(require("./features/search"), exports);
37
+ __exportStar(require("./features/skin-tones"), exports);
38
+ __exportStar(require("./features/aliases"), exports);
39
+ __exportStar(require("./features/filters"), exports);
40
+ // Re-export utilities
41
+ __exportStar(require("./utils/reverse-mapping"), exports);
42
+ __exportStar(require("./utils/validators"), exports);
43
+ // Re-export types
44
+ __exportStar(require("./core/emoji"), exports);
45
+ // Import backward compatibility API
46
+ const backward_compat_1 = require("./backward-compat");
47
+ // Create the default export with backward compatibility
48
+ const emojis = (0, backward_compat_1.createBackwardCompatibleAPI)();
49
+ // For CommonJS compatibility, we need to export emojis as the module
50
+ module.exports = emojis;
51
+ // Also export as default for ES modules
52
+ module.exports.default = emojis;
53
+ // Export the type
54
+ exports.default = emojis;
55
+ // Re-export features for tree-shaking (these are already exported via __exportStar)
56
+ // The named data exports are already available via getters on the emojis object
57
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;;;;;;;;;;;;;AAEH,iDAAiD;AACjD,oDAAiC;AACjC,wDAAqC;AACrC,qDAAkC;AAClC,qDAAkC;AAElC,sBAAsB;AACtB,0DAAuC;AACvC,qDAAkC;AAElC,kBAAkB;AAClB,+CAA4B;AAE5B,oCAAoC;AACpC,uDAA2E;AAE3E,wDAAwD;AACxD,MAAM,MAAM,GAAe,IAAA,6CAA2B,GAAE,CAAA;AAExD,qEAAqE;AACrE,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA;AAEvB,wCAAwC;AACxC,MAAM,CAAC,OAAO,CAAC,OAAO,GAAG,MAAM,CAAA;AAE/B,kBAAkB;AAClB,kBAAe,MAAM,CAAA;AAErB,oFAAoF;AACpF,gFAAgF"}
@@ -0,0 +1,21 @@
1
+ export interface EmojiMetadata {
2
+ /** The emoji character */
3
+ emoji: string;
4
+ /** The primary name/key for this emoji */
5
+ name: string;
6
+ /** The category this emoji belongs to */
7
+ category: 'animals' | 'food' | 'nature' | 'people' | 'travel';
8
+ /** Alternative names and related keywords for searching */
9
+ keywords: string[];
10
+ /** Unicode version when this emoji was introduced */
11
+ unicodeVersion: string;
12
+ }
13
+ export type EmojiMetadataMap = {
14
+ [name: string]: EmojiMetadata;
15
+ };
16
+ export interface SearchResult {
17
+ name: string;
18
+ emoji: string;
19
+ metadata: EmojiMetadata;
20
+ }
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,QAAQ,EAAE,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC9D,2DAA2D;IAC3D,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,qDAAqD;IACrD,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CAAC;CAC/B,CAAA;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,aAAa,CAAA;CACxB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}