scrabble-solver
Version:
Scrabble Solver 2 - Free, open-source, cross-platform, multi-language analysis tool for Scrabble, Scrabble Duel, Super Scrabble, Letter League, Crossplay, Literaki, and Kelimelik. Quickly find the top-scoring words using the given board and tiles.
39 lines (38 loc) • 977 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.WordDefinition = void 0;
class WordDefinition {
constructor({ definitions, exists, isAllowed, word }) {
this.definitions = definitions;
this.exists = exists;
this.isAllowed = isAllowed;
this.word = word;
}
toJson() {
return {
definitions: this.definitions,
exists: this.exists,
isAllowed: this.isAllowed,
word: this.word,
};
}
}
exports.WordDefinition = WordDefinition;
WordDefinition.fromJson = (json) => {
if (!json) {
return WordDefinition.Null;
}
return new WordDefinition({
definitions: json.definitions,
exists: json.exists,
isAllowed: json.isAllowed,
word: json.word,
});
};
WordDefinition.Null = Object.freeze({
definitions: [],
exists: false,
isAllowed: false,
word: '',
toJson: () => null,
});