mirror of
https://github.com/vlang/v.git
synced 2025-09-15 23:42:28 +03:00
jsdom,builtin: add all methods for DOMMatrix; add conversion methods to convet from/to JS types (#12395)
This commit is contained in:
parent
7a9ba9f41f
commit
5f3dcde358
4 changed files with 431 additions and 64 deletions
|
@ -104,3 +104,66 @@ pub fn (f float_literal) str() string {
|
|||
|
||||
return res
|
||||
}
|
||||
|
||||
pub fn tof64(n JS.Number) f64 {
|
||||
res := f64(0.0)
|
||||
#res.val = n;
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
pub fn tof32(n JS.Number) f32 {
|
||||
res := f32(0.0)
|
||||
#res.val = n;
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
pub fn toi(n JS.Number) int {
|
||||
res := int(0)
|
||||
#res.val = Math.floor(n);
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
pub fn f64tonum(n f64) JS.Number {
|
||||
mut res := JS.Number{}
|
||||
#res = n.val;
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
pub fn itonum(n int) JS.Number {
|
||||
mut res := JS.Number{}
|
||||
#res = n.val;
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
pub fn i64tobigint(n i64) JS.BigInt {
|
||||
mut res := JS.BigInt{}
|
||||
#res = n.val;
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
pub fn u64tobigint(n u64) JS.BigInt {
|
||||
mut res := JS.BigInt{}
|
||||
#res = n.val;
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
pub fn tobool(b JS.Boolean) bool {
|
||||
res := false
|
||||
#res.val = b;
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
pub fn booltojs(b bool) JS.Boolean {
|
||||
mut res := JS.Boolean{}
|
||||
#res = b.val;
|
||||
|
||||
return res
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue