MCPcopy
hub / github.com/logto-io/logto / transform

Function transform

packages/integration-tests/src/api/factory.ts:8–19  ·  view source on GitHub ↗
(data: T)

Source from the content-addressed store, hash-verified

6 * it impossible to use `.toStrictEqual()` directly.
7 */
8const transform = <T>(data: T): T => {
9 if (Array.isArray(data)) {
10 // eslint-disable-next-line no-restricted-syntax
11 return [...data] as T;
12 }
13
14 if (typeof data === 'object') {
15 return { ...data };
16 }
17
18 return data;
19};
20
21export class ApiFactory<
22 Schema extends Record<string, unknown>,

Callers 5

createMethod · 0.70
getListMethod · 0.70
getMethod · 0.70
updateMethod · 0.70
getListMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected