Skip to content

Commit 0ca7f5d

Browse files
committed
Adjust type check approach for toJS performance fix
1 parent 727bb23 commit 0ca7f5d

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

src/toJS.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { isIndexed } from './Predicates';
1010
import isDataStructure from './utils/isDataStructure';
1111

1212
export function toJS(value) {
13-
if (isDataStructure(value)) {
13+
if (typeof value === 'object' && isDataStructure(value)) {
1414
value = Seq(value);
1515
const result = isIndexed(value) ? [] : {};
1616
value.forEach((v, k) => {

src/utils/isDataStructure.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,5 @@ import isPlainObj from './isPlainObj';
1313
* provided by Immutable.js or a plain Array or Object.
1414
*/
1515
export default function isDataStructure(value) {
16-
return (
17-
typeof value === 'object' &&
18-
(isImmutable(value) || Array.isArray(value) || isPlainObj(value))
19-
);
16+
return isImmutable(value) || Array.isArray(value) || isPlainObj(value);
2017
}

0 commit comments

Comments
 (0)