feat(data-structures): add is_empty getter to map, string and blob.

This commit is contained in:
ltabis
2022-08-24 09:54:41 +02:00
parent 9c3443538a
commit 4b3608cedc
6 changed files with 41 additions and 3 deletions

View File

@@ -25,7 +25,11 @@ mod map_functions {
pub fn len(map: &mut Map) -> INT {
map.len() as INT
}
/// Return true if the map is empty.
#[rhai_fn(name = "is_empty", get = "is_empty", pure)]
pub fn is_empty(map: &mut Map) -> bool {
map.len() == 0
}
/// Get the value of the `property` in the object map and return a copy.
///
/// If `property` does not exist in the object map, `()` is returned.