## @strpc 기존 RPC를 package화 ### @strpc/express express의 middleware + router 결함 ## @sammo 게임 전체 - server, client - gateway_server, gateway_client
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
export * from "./bsonify.js"
|
|
export * from "./jsonify.js"
|
|
export * from "./error.js"
|
|
export * from "./unwrap.js"
|
|
export * from "./types.js"
|
|
export * from "./web.js"
|
|
|
|
export * from "./strongType.js"
|
|
|
|
export * as converter from "./converter/index.js"
|
|
export * as datetime from "./datetime/index.js";
|
|
export * as korean from "./korean/index.js";
|
|
export * as string from "./string/index.js";
|
|
|
|
export function calcBase64Len(length: number) {
|
|
return ((4 * length / 3) + 3) & ~3;
|
|
}
|
|
|
|
export function delay(time: number): Promise<void>;
|
|
export function delay<T>(time: number, result: T): Promise<T>;
|
|
export function delay<T = undefined>(time: number, result?: T): Promise<T | void> {
|
|
return new Promise(resolve =>
|
|
setTimeout(() => {
|
|
resolve(result);
|
|
}, time)
|
|
);
|
|
}
|
|
|
|
export function isBufferSource(obj: unknown): obj is BufferSource {
|
|
if (obj instanceof ArrayBuffer){
|
|
return true;
|
|
}
|
|
if('SharedArrayBuffer' in globalThis && obj instanceof SharedArrayBuffer){
|
|
return true;
|
|
}
|
|
if (ArrayBuffer.isView(obj)){
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
export function isNotNull<T>(value: T|null|undefined):value is T{
|
|
return value !== null && value !== undefined;
|
|
} |