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

js: fix rand build, properly use key values on map, add rand.string (#12020)

This commit is contained in:
playX
2021-10-01 21:23:49 +03:00
committed by GitHub
parent 60ecbec8ea
commit 82f187e5e0
13 changed files with 186 additions and 39 deletions

View File

@ -1331,8 +1331,8 @@ fn test_struct_array_of_multi_type_in() {
},
]
println(ivan in people)
println('TODO: Map eq')
// assert ivan in people
// println('TODO: Map eq')
assert ivan in people
}
fn test_struct_array_of_multi_type_index() {

View File

@ -1,7 +1,8 @@
module builtin
struct map {
m JS.Map
m JS.Map
pub:
len int
}
@ -14,7 +15,7 @@ pub fn (mut m map) delete(key voidptr) {
pub fn (m &map) free() {}
#map.prototype[Symbol.iterator] = function () { return this.map[Symbol.iterator](); }
//#Object.defineProperty(map.prototype,"len",{get: function() { return this.map.size; }})
#map.prototype.toString = function () {
#function fmtKey(key) { return typeof key == 'string' ? '\'' + key + '\'' : key}
#let res = '{'