-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow passing Object construtor to properties
- Loading branch information
1 parent
5be9ca3
commit 1439c73
Showing
3 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
import isObjectLike from 'lodash/isObjectLike' | ||
import { ModelValueType, PrimitiveValueType } from '../glossary' | ||
|
||
function isPrimitiveValueType(value: any): value is PrimitiveValueType { | ||
return ( | ||
typeof value === 'string' || | ||
typeof value === 'number' || | ||
typeof value === 'boolean' || | ||
isObjectLike(value) || | ||
value?.constructor?.name === 'Date' | ||
) | ||
} | ||
|
||
export function isModelValueType(value: any): value is ModelValueType { | ||
return isPrimitiveValueType(value) || Array.isArray(value) | ||
return isPrimitiveValueType(value) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters