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

Function primitiveToString

packages/effect/src/unstable/http/Template.ts:227–247  ·  view source on GitHub ↗
(value: Primitive)

Source from the content-addressed store, hash-verified

225}
226
227function primitiveToString(value: Primitive): string {
228 if (Array.isArray(value)) {
229 return value.map(primitiveToString).join("")
230 }
231
232 switch (typeof value) {
233 case "string": {
234 return value
235 }
236 case "number":
237 case "bigint": {
238 return value.toString()
239 }
240 case "boolean": {
241 return value ? "true" : "false"
242 }
243 default: {
244 return ""
245 }
246 }
247}
248
249function consolidate(
250 strings: ReadonlyArray<string>,

Callers 2

makeFunction · 0.85
streamFunction · 0.85

Calls 3

joinMethod · 0.80
toStringMethod · 0.65
mapMethod · 0.45

Tested by

no test coverage detected