## @strpc 기존 RPC를 package화 ### @strpc/express express의 middleware + router 결함 ## @sammo 게임 전체 - server, client - gateway_server, gateway_client
18 lines
513 B
TypeScript
18 lines
513 B
TypeScript
import { isInteger, isString } from "lodash-es";
|
|
|
|
export function simpleSerialize(...values : (string|number)[]): string{
|
|
const result: string[] = [];
|
|
for(const value of values){
|
|
if(isString(value)){
|
|
result.push(`str(${value.length},${value})`);
|
|
continue;
|
|
}
|
|
if(isInteger(value)){
|
|
result.push(`int(${value})`);
|
|
continue;
|
|
}
|
|
const float6 = value.toLocaleString("en-US", {maximumFractionDigits: 6});
|
|
result.push(`float(${float6})`);
|
|
}
|
|
return result.join('|');
|
|
} |