(props: {
value: any
keyName?: string
isRoot?: boolean
isLastKey?: boolean
copyable?: boolean
defaultExpansionDepth: number
depth: number
collapsePaths?: Array<string>
path: string
config?: { dateFormat?: string }
})
| 35 | function JsonValue(props: { |
| 36 | value: any |
| 37 | keyName?: string |
| 38 | isRoot?: boolean |
| 39 | isLastKey?: boolean |
| 40 | copyable?: boolean |
| 41 | |
| 42 | defaultExpansionDepth: number |
| 43 | depth: number |
| 44 | |
| 45 | collapsePaths?: Array<string> |
| 46 | path: string |
| 47 | |
| 48 | config?: { dateFormat?: string } |
| 49 | }) { |
| 50 | const styles = createStyles() |
| 51 | |
| 52 | return ( |
| 53 | <span |
| 54 | data-tsd-surface={props.isRoot ? '' : undefined} |
| 55 | class={styles().tree.valueContainer(props.isRoot ?? false)} |
| 56 | > |
| 57 | {props.keyName && |
| 58 | typeof props.value !== 'object' && |
| 59 | !Array.isArray(props.value) && ( |
| 60 | <span data-tsd-syntax="property" class={styles().tree.valueKey}> |
| 61 | "{props.keyName}":{' '} |
| 62 | </span> |
| 63 | )} |
| 64 | |
| 65 | {(() => { |
| 66 | if (typeof props.value === 'string') { |
| 67 | return ( |
| 68 | <span data-tsd-syntax="string" class={styles().tree.valueString}> |
| 69 | "{props.value}" |
| 70 | </span> |
| 71 | ) |
| 72 | } |
| 73 | |
| 74 | if (typeof props.value === 'number') { |
| 75 | return ( |
| 76 | <span data-tsd-syntax="number" class={styles().tree.valueNumber}> |
| 77 | {String(props.value)} |
| 78 | </span> |
| 79 | ) |
| 80 | } |
| 81 | |
| 82 | if (typeof props.value === 'boolean') { |
| 83 | return ( |
| 84 | <span data-tsd-syntax="keyword" class={styles().tree.valueBoolean}> |
| 85 | {String(props.value)} |
| 86 | </span> |
| 87 | ) |
| 88 | } |
| 89 | |
| 90 | if (props.value === null) { |
| 91 | return ( |
| 92 | <span data-tsd-syntax="keyword" class={styles().tree.valueNull}> |
| 93 | null |
| 94 | </span> |
nothing calls this directly
no test coverage detected