1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

js: comptime&assert improvements, more byte and strings.Builder methods ported (#12096)

This commit is contained in:
playX
2021-10-07 15:55:47 +03:00
committed by GitHub
parent 42359d8915
commit 33a1006cc5
9 changed files with 209 additions and 41 deletions

View File

@ -78,3 +78,21 @@ fn js_stacktrace() string {
return stacktrace
}
// Check for nil value
pub fn isnil(val voidptr) bool {
res := false
// This one is kinda weird. In C and native backend we can cast booleans and integers to pointers
// so we just check *for* all possible NULL-like values here.
#val = val.valueOf()
#res.val = val === null || val === undefined || val === false || val === 0 || val === BigInt(0)
return res
}
pub fn (f float_literal) str() string {
res := ''
#res.str += f.valueOf()
return res
}