the-orangee-dictionary
v1.0.7
Published
A multilingual dictionary lib
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-dictionaryUsage
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 trueFunctions
checkWord(word: string, language: LanguageCode): booleanCheck if a word exists in the specified language dictionary.
getDictionary(language: LanguageCode): Dictionary | ErrorGet 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 | undefinedGet 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 testLicense This project is licensed under the MIT License - see the LICENSE file for details.
