MCPcopy Create free account
hub / github.com/Effect-TS/effect / fromInput

Function fromInput

packages/platform/src/UrlParams.ts:46–58  ·  view source on GitHub ↗
(input: Input)

Source from the content-addressed store, hash-verified

44 * @category constructors
45 */
46export const fromInput = (input: Input): UrlParams => {
47 const parsed = fromInputNested(input)
48 const out: Array<[string, string]> = []
49 for (let i = 0; i < parsed.length; i++) {
50 if (Array.isArray(parsed[i][0])) {
51 const [keys, value] = parsed[i] as [Array<string>, string]
52 out.push([`${keys[0]}[${keys.slice(1).join("][")}]`, value])
53 } else {
54 out.push(parsed[i] as [string, string])
55 }
56 }
57 return out
58}
59
60const fromInputNested = (input: Input): Array<[string | Array<string>, any]> => {
61 const entries = Symbol.iterator in input ? Arr.fromIterable(input) : Object.entries(input)

Callers 3

UrlParams.tsFile · 0.70
decodeFunction · 0.70
encodeFunction · 0.70

Calls 2

fromInputNestedFunction · 0.85
joinMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…