@/utils#jsonParse JavaScript Examples
The following examples show how to use
@/utils#jsonParse.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: index.jsx From mdebug with MIT License | 5 votes |
formate({ name, value }) {
if (name === 'delay') {
let valueFormat = value;
let unit = 'ms';
if (value >= 1000) {
valueFormat = (valueFormat / 1000).toFixed(2);
unit = 's';
}
return {
value: `${valueFormat}${unit}`,
name,
};
}
if (name === 'httpcode') {
return {
name: 'status',
value,
};
}
if (name === 'starttime') {
return {
name,
value: `${new Date(Number(value))}`,
};
}
if (name === 'headers') {
return {
name,
value: <Inspector data={value} style={{ display: 'block' }} />,
};
}
if (name === 'response') {
const parsedValue = jsonParse(value);
return {
name,
value: parsedValue ? (
<Inspector data={parsedValue} />
) : (
<ShowMore textColor={'#000'}>{this.stringify(value)}</ShowMore>
),
};
}
return {
name,
value: <ShowMore textColor={'#000'}>{this.stringify(value)}</ShowMore>,
};
}