import React from "react";
import Highlighter from "../../highlighter/Highlighter";
import createStyles from "../styles/createStyles";
interface ObjectValueProps {
onMatchFound: Function;
searchBoxText: string;
filterStrings: string[];
object: any;
styles?: any;
}
interface ThemeProps {
theme: string | object;
}
/**
* A short description of the object values.
* Can be used to render tree node in ObjectInspector
* or render objects in TableInspector.
*/
const ObjectValue = (
{ onMatchFound, searchBoxText, filterStrings, object, styles }: ObjectValueProps,
{ theme }: ThemeProps
) => {
const themeStyles = createStyles("ObjectValue", theme);
const mkStyle = (key: string) => {
return { ...themeStyles[key], ...styles };
};
switch (typeof object) {
case "number":
return (
);
case "string":
return (
);
case "boolean":
return (
);
case "undefined":
return undefined;
case "object":
if (object === null) {
return null;
}
if (object instanceof Date) {
return (
);
}
if (object instanceof RegExp) {
return (
);
}
if (Array.isArray(object)) {
return {`Array[${object.length}]`};
}
if (!object.constructor) {
return Object;
}
return (
);
case "function":
return (
function
()
);
case "symbol":
return (
);
default:
return ;
}
};
export default ObjectValue;