Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ygo-json-loader.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ export const md_table = Object.create(null);
md_table['en'] = md_en_table;
md_table['ja'] = md_jp_table;

export const pre_release = new Map(Object.entries(pre_table));
export const pre_release = pre_table;
export const id_to_cid = inverse_mapping(cid_table);
const pack_id_table = inverse_mapping(pre_release);
const pack_id_table = Object.fromEntries(Object.entries(pre_release).map(([k, v]) => [v, k]));

export const official_name = {
__proto__: null,
Expand Down Expand Up @@ -174,7 +174,7 @@ export function get_pack_name(id) {
if (id <= MAX_CARD_ID)
return '';
const pack_id = id - id % 1000;
const pack_name = pack_id_table.get(pack_id);
const pack_name = pack_id_table[pack_id];
if (!pack_name)
return '';
if (pack_name.charAt(0) === '_')
Expand Down
8 changes: 4 additions & 4 deletions ygo-query.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,10 @@ export function generate_condition(params, id_list) {
const pack = pack_list[params.pack].filter(x => Number.isSafeInteger(x) && x > 0);
qstr += ` AND ${list_condition('id', 'pack', pack, arg)}`;
}
else if (typeof params.pack === 'string' && pre_release.has(params.pack)) {
else if (typeof params.pack === 'string' && Object.hasOwn(pre_release, params.pack)) {
qstr += " AND (id BETWEEN $pack_begin AND $pack_end)";
arg.$pack_begin = pre_release.get(params.pack);
arg.$pack_end = pre_release.get(params.pack) + 500;
arg.$pack_begin = pre_release[params.pack];
arg.$pack_end = pre_release[params.pack] + 500;
}
else if (Number.isSafeInteger(params.limit) && params.limit > 0) {
arg.$limit = params.limit;
Expand Down Expand Up @@ -721,7 +721,7 @@ export function query_card(params) {
is_sorted = true;
meta.pack = params.pack;
}
else if (typeof params.pack === 'string' && pre_release.has(params.pack)) {
else if (typeof params.pack === 'string' && Object.hasOwn(pre_release, params.pack)) {
is_sorted = true;
meta.pack = params.pack;
}
Expand Down