Files
aza/APP/nexus-remote/node_modules/peerjs-js-binarypack/__test__/util.ts

10 lines
278 B
TypeScript
Raw Normal View History

2026-03-25 14:14:07 +01:00
import { pack, Packable, unpack, Unpackable } from "../lib/binarypack";
export const packAndUnpack = <T extends Unpackable>(data: Packable) => {
const encoded = pack(data);
if (encoded instanceof Promise) {
return encoded.then(unpack<T>);
}
return unpack<T>(encoded);
};