Add oop.rhai script.

This commit is contained in:
Stephen Chung
2020-06-27 17:34:39 +08:00
parent d509006264
commit 549ef6bf7f
7 changed files with 62 additions and 3 deletions

View File

@@ -39,6 +39,17 @@ def_package!(crate:BasicMapPackage:"Basic object map utilities.", lib, {
Ok(())
},
);
lib.set_fn_2_mut(
"fill_with",
|map1: &mut Map, map2: Map| {
map2.into_iter().for_each(|(key, value)| {
if !map1.contains_key(key.as_str()) {
map1.insert(key, value);
}
});
Ok(())
},
);
lib.set_fn_2_mut(
"+=",
|map1: &mut Map, map2: Map| {