File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change 76
76
77
77
function uuid .type (id )
78
78
assert (not OSX , " uuid_type is not supported on OS X." )
79
- return lib .uuid_type (parse (id ))
79
+ local parsed = parse (id )
80
+ return parsed and lib .uuid_type (parsed )
80
81
end
81
82
82
83
function uuid .variant (id )
83
84
assert (not OSX , " uuid_variant is not supported on OS X." )
84
- return lib .uuid_variant (parse (id ))
85
+ local parsed = parse (id )
86
+ return parsed and lib .uuid_variant (parsed )
85
87
end
86
88
87
89
function uuid .time (id )
88
- local secs = lib .uuid_time (parse (id ), tvl )
89
- return tonumber (secs ), tonumber (tvl .tv_usec )
90
+ local parsed = parse (id )
91
+ if parsed then
92
+ local secs = lib .uuid_time (parsed , tvl )
93
+ return tonumber (secs ), tonumber (tvl .tv_usec )
94
+ end
95
+ end
96
+
97
+ function uuid .is_valid (id )
98
+ return not not parse (id )
90
99
end
91
100
92
101
mt .__call = uuid .generate
You can’t perform that action at this time.
0 commit comments