UNPKG

booru

Version:

Search (and do other things) on a bunch of different boorus!

52 lines 1.21 kB
"use strict"; /** * @packageDocumentation * @module Structures */ Object.defineProperty(exports, "__esModule", { value: true }); /** * A tag from a booru with a few common props * * @example * ``` * Tag { * name: 'tag_name', * count: 1234, * type: 0, * ambiguous: false, * } * ``` */ class Tag { /** The {@link Booru} it came from */ booru; /** The id of the tag */ id; /** The name of the tag */ name; /** The count of the tag */ count; /** If the tag is a meta tag */ type; /** If the tag is ambiguous */ ambiguous; /** All the data given by the booru @private */ data; /** * Create a new tag from the data given by the booru * * @param data The data from the booru * @param booru The booru this tag is from */ constructor(data, booru) { this.data = data; this.booru = booru; this.id = data.id; this.name = data.name; this.count = data.count ?? data.post_count ?? 0; this.type = data.type ?? data.category ?? 0; this.ambiguous = data.ambiguous ? data.ambiguous !== 'false' : null; } } exports.default = Tag; //# sourceMappingURL=Tag.js.map