pollute
map utils, boost productivity, prototype pollution, working progress
example
let m = ; let item1 = ;let item2 = ; item1;let item3 = item2;item2; console;// { a: 15, b: 13, e: 13, f: 324 } { c: 3, d: 156, h: 33 } { d: 156, g: 16 }
notice
{}
is already polluted console.log(typeof {}["constructor"]);
output function
api
constructor
map(input = {}, backup = "_")
in case the value inside input was overwritten by user, you can still use backup function. i.e.
let item = ;itemget; // output 10;item_get; // output a functionitem_; //output ["get"]item__; //output ["get", "udf"]Object; // output ["get"]
keys
()=>[]
values
()=>[]
length
()=>number
add
(...maps:{})=>MAP
remove
(...items:string)=>MAP
get
(...keys:string)=>MAP
has
(...keys:string)=>boolean
toString
(space?:"")=>string
clone
deep copy
()=>MAP
getExist
(...keys:string)=>MAP
getExcept
(...keys:string)=>MAP
map (verb.)
(func:(key, value)=>["key","value"],removeOld?:true)=>MAP
the output should return an array, and array[0] is key, array[1] is value
if removeOld is true then the old value will be deleted
else
let item = ;item; // output {a: 10, b: 20, a10: 10, b10: 20}