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

@@ -140,6 +140,11 @@ pub mod blob_functions {
pub fn len(blob: &mut Blob) -> INT {
blob.len() as INT
}
/// Return true if the blob is empty.
#[rhai_fn(name = "is_empty", get = "is_empty", pure)]
pub fn is_empty(blob: &mut Blob) -> bool {
blob.len() == 0
}
/// Get the byte value at the `index` position in the BLOB.
///
/// * If `index` < 0, position counts from the end of the BLOB (`-1` is the last element).