the-orangee-dictionary
v1.0.6
Published
A multilingual dictionary lib
Downloads
18
Readme
The Orangee Dictionary
Description
The Orangee Dictionary is a JavaScript package designed to streamline word-related functionalities for games developed by The Orangee Games Studio. In the world of gaming, where crosswords, spelling bees, and word puzzles are prevalent, this library aims to prevent code duplication by providing a set of convenient functions.
Installation
npm install the-orangee-dictionary
Usage
import { checkWord, getDictionary, getLanguages, getWord } from "the-orangee-dictionary";
import { LanguageCode } from "the-orangee-dictionary/types/global";
// Example usage
const result = checkWord("test", "en-US");
console.log(result); // Should output true
Functions
checkWord(word: string, language: LanguageCode): boolean
Check if a word exists in the specified language dictionary.
getDictionary(language: LanguageCode): Dictionary | Error
Get the dictionary for a specific language. Returns an error if the language is not supported.
getLanguages(): LanguageCode[]
Get the list of supported languages.
getWord(word: string, language: LanguageCode): Word | undefined
Get the details of a word in the specified language dictionary. Returns undefined if the word is not found.
Tests
This package uses Jest for unit testing. To run the tests, use the following command:
npm test
License This project is licensed under the MIT License - see the LICENSE file for details.