MCPcopy Create free account
hub / github.com/alibaba/lowcode-engine / serialize

Function serialize

packages/editor-core/src/utils/request.ts:5–16  ·  view source on GitHub ↗
(obj?: object)

Source from the content-addressed store, hash-verified

3const debug = Debug('request');
4
5export function serialize(obj?: object): string {
6 if (!obj) {
7 return '';
8 }
9 const rst: string[] = [];
10 Object.entries(obj || {}).forEach(([key, val]): void => {
11 if (val === null || val === undefined || val === '') return;
12 if (typeof val === 'object') rst.push(`${key}=${encodeURIComponent(JSON.stringify(val))}`);
13 else rst.push(`${key}=${encodeURIComponent(val)}`);
14 });
15 return rst.join('&');
16}
17
18export function buildUrl(dataAPI: string, params?: object): string {
19 const paramStr = serialize(params);

Callers 2

buildUrlFunction · 0.70
postFunction · 0.70

Calls 2

pushMethod · 0.80
forEachMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…