Skip to content

Commit f75fa19

Browse files
committed
0.4.2 - replace typeof
Improve the robustness of the type check by replacing `typeof` with `ramda.type`.
1 parent 92caea7 commit f75fa19

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
1. Fix: Improve the sanitization of the input data. Previously, the sanitization does not work correctly if the `data` is specified by `None`.
1616
2. Fix: The comparison of the docstring may fail because different versions of `dash` may produce docstrings in different order. Make the docstring comparison more robust.
17+
3. Fix: Improve the robustness of the type check by replacing `typeof` with `ramda.type`.
1718

1819
#### :floppy_disk: Change
1920

src/lib/fragments/DashJsonGrid.react.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
*/
1313

1414
import React, {Component} from "react";
15+
import {type} from "ramda";
1516

1617
import JSONGrid from "@redheadphone/react-json-grid";
1718

@@ -69,13 +70,14 @@ export default class DashJsonGrid extends Component {
6970
* configured, the other one should be undefined.
7071
*/
7172
getTheme(theme) {
72-
if (typeof theme === "object") {
73+
const themeType = type(theme);
74+
if (themeType === "Object") {
7375
return {
7476
themeName: undefined,
7577
customTheme: theme,
7678
};
7779
}
78-
if (typeof theme === "string") {
80+
if (themeType === "String") {
7981
if (theme === "inherit" || theme == "unset") {
8082
return {
8183
themeName: undefined,

0 commit comments

Comments
 (0)