MCPcopy Index your code
hub / github.com/openblocks-dev/openblocks / toString

Function toString

client/packages/openblocks/src/util/convertUtils.ts:31–51  ·  view source on GitHub ↗
(value: any)

Source from the content-addressed store, hash-verified

29}
30
31export function toString(value: any): string {
32 if (value === undefined || value === null) {
33 return "";
34 }
35 if (typeof value === "string") {
36 return value;
37 }
38 if (value instanceof Date) {
39 return value.toISOString();
40 }
41 if (value instanceof RegExp) {
42 return value.toString();
43 }
44 return JSON.stringify(value, (k, v) => {
45 switch (typeof v) {
46 case "bigint":
47 return v.toString();
48 }
49 return v;
50 });
51}
52
53export function toNumber(value: any): number {
54 if (value === undefined || value === null || value === "" || isNaN(value)) {

Callers 7

convertValueFunction · 0.90
stringUnionControlFunction · 0.90
codeControl.tsxFile · 0.90
convertDataFunction · 0.90
toStringOrNumberFunction · 0.70
showTransformFunction · 0.70

Calls 1

toStringMethod · 0.45

Tested by

no test coverage detected