### Install emojilib Source: https://github.com/muan/emojilib/blob/main/README.md Install the package via npm. ```bash npm install emojilib --save ``` -------------------------------- ### Run project tests Source: https://github.com/muan/emojilib/blob/main/CONTRIBUTING.md Executes the test suite to verify the integrity of the emoji JSON files. ```bash $ npm test # Tests ✔ checking dist/emoji-en-US.json [pass: 1807, fail: 0, duration: 60ms] # Summary duration: 60ms planned: 1807 assertions: 1807 pass: 1807 fail: 0 ``` -------------------------------- ### Build Emoji Picker with Search and Grouping Source: https://context7.com/muan/emojilib/llms.txt Implement an emoji picker component that allows users to search emojis by name or keywords and retrieve them by group. Requires 'emojilib' and 'unicode-emoji-json' packages. ```javascript const emojilib = require('emojilib') const data = require('unicode-emoji-json') class EmojiPicker { constructor() { this.emojis = this.buildEmojiIndex() } buildEmojiIndex() { const index = [] for (const [emoji, keywords] of Object.entries(emojilib)) { const meta = data[emoji] || {} index.push({ char: emoji, name: meta.name || keywords[0], group: meta.group || 'Unknown', keywords: keywords, skinToneSupport: meta.skin_tone_support || false }) } return index } search(query, limit = 20) { if (!query) return this.emojis.slice(0, limit) const lowerQuery = query.toLowerCase() return this.emojis .filter(e => e.name.toLowerCase().includes(lowerQuery) || e.keywords.some(k => k.toLowerCase().includes(lowerQuery)) ) .slice(0, limit) } getByGroup(groupName) { return this.emojis.filter(e => e.group === groupName) } } // Usage const picker = new EmojiPicker() console.log(picker.search('love')) // Output: [ // { char: 'âĪïļ', name: 'red heart', group: 'Smileys & Emotion', keywords: [...], ... }, // { char: '😍', name: 'smiling face with heart-eyes', group: 'Smileys & Emotion', ... }, // ... // ] console.log(picker.getByGroup('Animals & Nature').slice(0, 3)) // Output: [ // { char: 'ðŸķ', name: 'dog face', ... }, // { char: 'ðŸą', name: 'cat face', ... }, // { char: '🐭', name: 'mouse face', ... } // ] ``` -------------------------------- ### Test Emoji Dataset with npm test Source: https://context7.com/muan/emojilib/llms.txt Run the test suite to verify that the emoji dataset includes all expected emojis from the Unicode standard. ```bash npm test # Output: # # Tests # # ✔ checking dist/emoji-en-US.json [pass: 1807, fail: 0, duration: 60ms] # # # Summary # # duration: 60ms # planned: 1807 ``` -------------------------------- ### Review and Edit Emoji Keywords with npm run review Source: https://context7.com/muan/emojilib/llms.txt Review existing keywords for quality control. This interactive command allows approving, rejecting, or editing keywords for each emoji. ```bash # Run review with a language code npm run review en-US # Interactive session example: # [current] 😀: grinning_face, face, smile, happy, joy, :D, grin # Is "grinning_face" a suitable keyword for 😀? (y/n/e) e # What should "grinning_face" be changed to? grinning face # Is "face" a suitable keyword for 😀? (y/n/e) y # Is "smile" a suitable keyword for 😀? (y/n/e) y # Is "happy" a suitable keyword for 😀? (y/n/e) y # Is "joy" a suitable keyword for 😀? (y/n/e) y # Is ":D" a suitable keyword for 😀? (y/n/e) n # [saved] 😀: grinning face, face, smile, happy, joy, grin # Options: # y - keep the keyword # n - remove the keyword # e - edit/replace the keyword ``` -------------------------------- ### Import and Use emojilib Source: https://context7.com/muan/emojilib/llms.txt Import the emojilib library to access the emoji-to-keywords mapping. Use it to retrieve keywords for specific emojis or check for their existence. ```javascript // Import the emoji keyword library const emojilib = require("emojilib") // Access keywords for a specific emoji console.log(emojilib['😀']) // Output: ['grinning_face', 'face', 'smile', 'happy', 'joy', ':D', 'grin'] console.log(emojilib['ðŸą']) // Output: ['cat_face', 'cat', 'meow', 'pet', 'kitten'] // Check if an emoji exists in the library if (emojilib['🚀']) { console.log('Rocket keywords:', emojilib['🚀']) } ``` -------------------------------- ### Augment English Dataset with npm run augment-en Source: https://context7.com/muan/emojilib/llms.txt Automatically add keywords from popular emoji platforms to the English dataset. This script fetches, normalizes, and filters keywords, saving them to dist/emoji-en-US.json. ```bash # Run automatic augmentation for en-US dataset npm run augment-en # Output example: # Augmented 123 emoji with a total of 456 keyword(s) # This script: # - Fetches keywords from multiple emoji platform sources # - Normalizes and deduplicates keywords # - Filters out common words (a, and, at, in, is, it, of, on, the, to, with) # - Only adds keywords that don't already exist # - Automatically saves to dist/emoji-en-US.json ``` -------------------------------- ### Upgrade Emoji Keywords with npm run upgrade Source: https://context7.com/muan/emojilib/llms.txt Add keywords for new emojis after updating the 'unicode-emoji-json' dependency. This command interactively prompts for keywords for each new emoji. ```bash # First update unicode-emoji-json to get new emojis npm update unicode-emoji-json # Run the upgrade script to add keywords for new emojis npm run upgrade # Interactive session example: # checking dist/emoji-en-US.json # Enter a keyword for ðŸŠĪ(mouse trap), leave it blank to go to the next one. cheese # Enter a keyword for ðŸŠĪ(mouse trap), leave it blank to go to the next one. # [saved] ðŸŠĪ: mouse trap, cheese # # Enter a keyword for ðŸŠĢ(bucket), leave it blank to go to the next one. water # Enter a keyword for ðŸŠĢ(bucket), leave it blank to go to the next one. container # Enter a keyword for ðŸŠĢ(bucket), leave it blank to go to the next one. # [saved] ðŸŠĢ: bucket, water, container # # added 2: ðŸŠĪ, ðŸŠĢ. ``` -------------------------------- ### Improve Emoji Keyword Coverage with npm run improve Source: https://context7.com/muan/emojilib/llms.txt Interactively add keywords to emojis with insufficient coverage. This tool prompts for additional keywords for each emoji needing improvement. ```bash # Run improve with a language code npm run improve en-US # Interactive session example: # 😀: grinning_face, face, smile, happy, joy, :D, grin # Add a keyword: cheerful # Add a keyword: pleased # Add a keyword: # [saved] 😀: grinning_face, face, smile, happy, joy, :D, grin, cheerful, pleased # # 🎉: # Add a keyword: party # Add a keyword: celebration # Add a keyword: # [saved] 🎉: party, celebration # List available language codes npm run improve # Output: Please provide a langage tag: en-US ``` -------------------------------- ### Upgrade emoji dataset Source: https://github.com/muan/emojilib/blob/main/CONTRIBUTING.md Updates the dataset from unicode-emoji-json and prompts for keywords for new emojis. ```bash $ npm run upgrade checking dist/emoji-en-US.json Enter a keyword for ðŸŠĪ(mouse trap), leave it blank to go to the next one. cheese Enter a keyword for ðŸŠĪ(mouse trap), leave it blank to go to the next one. [saved] ðŸŠĪ: mouse trap, cheese Enter a keyword for ðŸŠĢ(bucket), leave it blank to go to the next one. water Enter a keyword for ðŸŠĢ(bucket), leave it blank to go to the next one. container Enter a keyword for ðŸŠĢ(bucket), leave it blank to go to the next one. [saved] ðŸŠĢ: bucket, water, container added 2: ðŸŠĪ, ðŸŠĢ. ``` -------------------------------- ### Migrate emoji library access Source: https://github.com/muan/emojilib/blob/main/README.md Accessing the library structure in version 2.x. ```javascript > var emoji = require("emojilib") > emoji.lib { "grinning": { "keywords": ["face", "smile", "happy", "joy"], "char": "😀", "fitzpatrick_scale": false, "category": "people" }, ... ``` -------------------------------- ### Augment English dataset Source: https://github.com/muan/emojilib/blob/main/CONTRIBUTING.md Imports en-US keywords from common emoji platforms to enrich the existing dataset. ```bash $ npm run augment-en Augmented 123 emoji with a total of 456 keyword(s) ``` -------------------------------- ### Check Fitzpatrick scale support Source: https://github.com/muan/emojilib/blob/main/README.md Checking skin tone support for specific emojis in version 2.x and current versions. ```javascript > require("emojilib").lib['v'].fitzpatrick_scale true > require("emojilib").lib['turtle'].fitzpatrick_scale false ``` ```javascript > require('unicode-emoji-json')['✌ïļ'].skin_tone_support true > require('unicode-emoji-json')['ðŸĒ'].skin_tone_support false ``` -------------------------------- ### Merge keywords with metadata Source: https://github.com/muan/emojilib/blob/main/README.md Combine emojilib keywords with unicode-emoji-json metadata. ```javascript > var data = require('unicode-emoji-json') > var keywordSet = require('emojilib') > for (const emoji in data) { data[emoji]['keywords'] = keywordSet[emoji] } > data['😀'] { name: 'grinning face', slug: 'grinning_face', group: 'Smileys & Emotion', emoji_version: '1.0', unicode_version: '1.0', skin_tone_support: false, keywords: [ 'grinning_face', 'face', 'smile', 'happy', 'joy', ':D', 'grin' ] } ``` -------------------------------- ### Combine emojilib with unicode-emoji-json Source: https://context7.com/muan/emojilib/llms.txt Merge emojilib keywords with data from unicode-emoji-json to obtain comprehensive emoji metadata. This includes names, groups, versions, and skin tone support. ```javascript const data = require('unicode-emoji-json') const keywordSet = require('emojilib') // Merge keywords into the emoji data for (const emoji in data) { data[emoji]['keywords'] = keywordSet[emoji] } // Access enriched emoji data console.log(data['😀']) // Output: { // name: 'grinning face', // slug: 'grinning_face', // group: 'Smileys & Emotion', // emoji_version: '1.0', // unicode_version: '1.0', // skin_tone_support: false, // keywords: ['grinning_face', 'face', 'smile', 'happy', 'joy', ':D', 'grin'] // } ``` ```javascript // Get ordered list of emojis const orderedEmoji = require('unicode-emoji-json/data-ordered-emoji') console.log(orderedEmoji.slice(0, 5)) // Output: ['😀', '😃', '😄', '😁', '😆'] ``` ```javascript // Get skin tone modifiers const components = require('unicode-emoji-json/data-emoji-components') console.log(components) // Output: { // light_skin_tone: 'ðŸŧ', // medium_light_skin_tone: '🏞', // medium_skin_tone: 'ðŸ―', // medium_dark_skin_tone: 'ðŸū', // dark_skin_tone: 'ðŸŋ', // red_hair: 'ðŸĶ°', // curly_hair: 'ðŸĶą', // white_hair: 'ðŸĶģ', // bald: 'ðŸĶē' // } ``` -------------------------------- ### Review emoji keywords Source: https://github.com/muan/emojilib/blob/main/CONTRIBUTING.md Interactively edit or remove keywords for emojis in the specified language dataset. ```bash $ npm run review en-US [current] 😀: grinning_face, face, smile, happy, joy, :D, grin Is "grinning_face" a suitable keyword for 😀? (y/n/e) e What should "grinning_face" be changed to? grinning face Is "face" a suitable keyword for 😀? (y/n/e) y Is "smile" a suitable keyword for 😀? (y/n/e) y Is "happy" a suitable keyword for 😀? (y/n/e) y Is "joy" a suitable keyword for 😀? (y/n/e) y Is ":D" a suitable keyword for 😀? (y/n/e) n [saved] 😀: grinning face, face, smile, happy, joy, grin ``` -------------------------------- ### Search Emojis by Keyword Source: https://context7.com/muan/emojilib/llms.txt Implement emoji search by iterating through the library's keywords. This function matches user queries against emoji keywords, returning matching emojis and their associated keywords. ```javascript const emojilib = require("emojilib") function searchEmoji(query) { const results = [] const lowerQuery = query.toLowerCase() for (const [emoji, keywords] of Object.entries(emojilib)) { const match = keywords.some(keyword => keyword.toLowerCase().includes(lowerQuery) ) if (match) { results.push({ emoji, keywords }) } } return results } // Search for emojis related to "happy" const happyEmojis = searchEmoji('happy') console.log(happyEmojis) // Output: [ // { emoji: '😀', keywords: ['grinning_face', 'face', 'smile', 'happy', 'joy', ':D', 'grin'] }, // { emoji: '😃', keywords: ['grinning_face_with_big_eyes', 'face', 'happy', 'joy', 'haha', ...] }, // ... // ] ``` -------------------------------- ### Access ordered emoji list Source: https://github.com/muan/emojilib/blob/main/README.md Retrieving ordered emoji lists in version 2.x and current versions. ```javascript > var emoji = require("emojilib") > emoji.ordered [ 'grinning', 'grimacing', 'grin', 'joy', 'smiley', 'smile', 'sweat_smile', ...] ``` ```javascript > var orderedEmoji = require('unicode-emoji-json/data-ordered-emoji') ['😀', '😃', '😄', '😁', '😆', '😅',...] ``` -------------------------------- ### Access emoji keywords Source: https://github.com/muan/emojilib/blob/main/README.md Retrieve the emoji keyword mapping object. ```javascript > require("emojilib") { '😀': [ 'grinning_face', 'face', 'smile', 'happy', 'joy', ':D', 'grin' ], '😃': [ 'grinning_face_with_big_eyes', 'face', 'happy', 'joy', 'haha', ... } ``` -------------------------------- ### Improve emoji keywords Source: https://github.com/muan/emojilib/blob/main/CONTRIBUTING.md Adds missing keywords to emojis with insufficient metadata for a specific language code. ```bash $ npm run improve en-US 😀: Add a keyword: happy Add a keyword: [saved] 😀: happy ``` -------------------------------- ### Access Fitzpatrick scale modifiers Source: https://github.com/muan/emojilib/blob/main/README.md Retrieving skin tone modifiers in version 2.x and current versions. ```javascript > var emoji = require("emojilib") > emoji.fitzpatrick_scale_modifiers [ 'ðŸŧ', '🏞', 'ðŸ―', 'ðŸū', 'ðŸŋ' ] ``` ```javascript > require('unicode-emoji-json/data-emoji-components') { light_skin_tone: 'ðŸŧ', medium_light_skin_tone: '🏞', medium_skin_tone: 'ðŸ―', medium_dark_skin_tone: 'ðŸū', dark_skin_tone: 'ðŸŋ', red_hair: 'ðŸĶ°', curly_hair: 'ðŸĶą', white_hair: 'ðŸĶģ', bald: 'ðŸĶē' } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.