osrm-backend/tests/ts/union_vector/gadget.js
Siarhei Fedartsou 0f6aab9da6 Squashed 'third_party/flatbuffers/' content from commit 595bf0007
git-subtree-dir: third_party/flatbuffers
git-subtree-split: 595bf0007ab1929570c7671f091313c8fc20644e
2024-06-22 13:33:34 +02:00

27 lines
1.0 KiB
JavaScript

// automatically generated by the FlatBuffers compiler, do not modify
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
import { FallingTub } from './falling-tub.js';
import { HandFan } from './hand-fan.js';
export var Gadget;
(function (Gadget) {
Gadget[Gadget["NONE"] = 0] = "NONE";
Gadget[Gadget["FallingTub"] = 1] = "FallingTub";
Gadget[Gadget["HandFan"] = 2] = "HandFan";
})(Gadget || (Gadget = {}));
export function unionToGadget(type, accessor) {
switch (Gadget[type]) {
case 'NONE': return null;
case 'FallingTub': return accessor(new FallingTub());
case 'HandFan': return accessor(new HandFan());
default: return null;
}
}
export function unionListToGadget(type, accessor, index) {
switch (Gadget[type]) {
case 'NONE': return null;
case 'FallingTub': return accessor(index, new FallingTub());
case 'HandFan': return accessor(index, new HandFan());
default: return null;
}
}