MCPcopy Create free account
hub / github.com/Devographics/Monorepo / serialize

Function serialize

api/src/graphql/string_or_array.ts:7–17  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

5 description:
6 'A custom scalar that can be either a string, a float, or an array of strings and/or floats',
7 serialize(value: unknown): string | number | (string | number)[] {
8 if (
9 typeof value === 'string' ||
10 typeof value === 'number' ||
11 (Array.isArray(value) &&
12 value.every(item => typeof item === 'string' || typeof item === 'number'))
13 ) {
14 return value
15 }
16 throw new TypeError('Value must be a string, a float, or an array of strings and/or floats')
17 },
18 parseValue(value: unknown): string | number | (string | number)[] {
19 if (
20 typeof value === 'string' ||

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected