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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 186 additions and 39 deletions

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 = '{'