MCPcopy Index your code
hub / github.com/troch/path-parser / encodeParam

Function encodeParam

src/encoding.ts:50–66  ·  view source on GitHub ↗
(
  param: string | number | boolean,
  encoding: URLParamsEncodingType,
  isSpatParam: boolean
)

Source from the content-addressed store, hash-verified

48}
49
50export const encodeParam = (
51 param: string | number | boolean,
52 encoding: URLParamsEncodingType,
53 isSpatParam: boolean
54): string => {
55 const encoder =
56 encodingMethods[encoding] || encodeURIComponentExcludingSubDelims
57
58 if (isSpatParam) {
59 return String(param)
60 .split('/')
61 .map(encoder)
62 .join('/')
63 }
64
65 return encoder(String(param))
66}
67
68export const decodeParam = (
69 param: string,

Callers 1

buildMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…