MCPcopy
hub / github.com/tinyhttp/tinyhttp / ustring

Function ustring

packages/content-disposition/src/index.ts:43–50  ·  view source on GitHub ↗
(val: unknown)

Source from the content-addressed store, hash-verified

41const pencode = (char: string) => '%' + String(char).charCodeAt(0).toString(16).toUpperCase()
42
43function ustring(val: unknown): string {
44 const str = String(val)
45
46 // percent encode as UTF-8
47 const encoded = encodeURIComponent(str).replace(ENCODE_URL_ATTR_CHAR_REGEXP, pencode)
48
49 return "UTF-8''" + encoded
50}
51
52function format({
53 parameters,

Callers 1

formatFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected