Skip to content

Commit

Permalink
chore(mobx-state-tree): Refactor isPrimitive fn (#1801 by @rluvaton)
Browse files Browse the repository at this point in the history
[skip ci]
  • Loading branch information
rluvaton authored Dec 4, 2021
1 parent f3ed574 commit 4a6a9a5
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/mobx-state-tree/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,14 @@ export function isMutable(value: any) {
* @hidden
*/
export function isPrimitive(value: any, includeDate = true): value is Primitives {
if (value === null || value === undefined) return true
if (
return (
value === null ||
value === undefined ||
typeof value === "string" ||
typeof value === "number" ||
typeof value === "boolean" ||
(includeDate && value instanceof Date)
)
return true
return false
}

/**
Expand Down

0 comments on commit 4a6a9a5

Please sign in to comment.