@coinbase/cdp-sdk
Version:
SDK for interacting with the Coinbase Developer Platform Wallet API
19 lines (18 loc) • 471 B
text/typescript
export function encodePathParam(param: unknown): string {
if (param === null) {
return "null";
}
const typeofParam = typeof param;
switch (typeofParam) {
case "undefined":
return "undefined";
case "string":
case "number":
case "boolean":
break;
default:
param = String(param);
break;
}
return encodeURIComponent(param as string | number | boolean);
}