UNPKG
typea
Version:
latest (8.4.0)
8.4.0
8.3.4
8.3.3
8.3.2
8.3.1
8.3.0
8.2.0
8.1.0
8.0.3
8.0.2
8.0.1
8.0.0
7.4.0
7.2.0
6.0.1
6.0.0
5.3.3
5.3.2
5.3.1
5.3.0
5.2.0
5.1.0
5.0.5
5.0.4
5.0.3
5.0.2
5.0.1
5.0.0
4.4.5
4.4.4
4.4.3
4.4.2
4.4.1
4.4.0
4.3.0
4.2.0
JS 数据结构验证、转换器
github.com/xiangle/typea
xiangle/typea
typea
/
type
/
validator
/
toDate.js
6 lines
•
187 B
JavaScript
View Raw
1
2
3
4
5
6
import
assertString
from
'./util/assertString.js'
;
export
default
function
toDate
(
date
) {
assertString
(date); date =
Date
.
parse
(date);
return
!
isNaN
(date) ?
new
Date
(date) :
null
; }