misc-DJYbNKZX.mjs 714 B

123456789101112131415161718192021
  1. //#region src/utils/misc.ts
  2. function arraify(value) {
  3. return Array.isArray(value) ? value : [value];
  4. }
  5. function isPromiseLike(value) {
  6. return value && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
  7. }
  8. function unimplemented(info) {
  9. if (info) throw new Error(`unimplemented: ${info}`);
  10. throw new Error("unimplemented");
  11. }
  12. function unreachable(info) {
  13. if (info) throw new Error(`unreachable: ${info}`);
  14. throw new Error("unreachable");
  15. }
  16. function unsupported(info) {
  17. throw new Error(`UNSUPPORTED: ${info}`);
  18. }
  19. function noop(..._args) {}
  20. //#endregion
  21. export { unreachable as a, unimplemented as i, isPromiseLike as n, unsupported as o, noop as r, arraify as t };