Refine is_empty methods.

This commit is contained in:
Stephen Chung
2022-08-24 21:58:08 +08:00
parent ae5e88928e
commit ca1b7f6a39
7 changed files with 101 additions and 35 deletions

View File

@@ -785,6 +785,12 @@ op +(u8, u8) -> u8;
/// ```
op +=(Map, Map) -> ();
op +=(String, String) -> ();
op +=(String, char) -> ();
op +=(String, ()) -> ();
op +=(String, ?) -> ();
op +=(String, Blob) -> ();
@@ -2368,6 +2374,21 @@ fn get int(x: float) -> float;
/// ```
fn get is_anonymous(fn_ptr: FnPtr) -> bool;
/// Return true if the array is empty.
fn get is_empty(array: Array) -> bool;
/// Return true if the BLOB is empty.
fn get is_empty(blob: Blob) -> bool;
/// Return true if the range contains no items.
fn get is_empty(range: ExclusiveRange) -> bool;
/// Return true if the range contains no items.
fn get is_empty(range: InclusiveRange) -> bool;
/// Return true if the string is empty.
fn get is_empty(string: String) -> bool;
/// Return true if the number is even.
fn get is_even(x: int) -> bool;
@@ -2913,6 +2934,24 @@ fn int(x: float) -> float;
/// ```
fn is_anonymous(fn_ptr: FnPtr) -> bool;
/// Return true if the array is empty.
fn is_empty(array: Array) -> bool;
/// Return true if the BLOB is empty.
fn is_empty(blob: Blob) -> bool;
/// Return true if the map is empty.
fn is_empty(map: Map) -> bool;
/// Return true if the range contains no items.
fn is_empty(range: ExclusiveRange) -> bool;
/// Return true if the range contains no items.
fn is_empty(range: InclusiveRange) -> bool;
/// Return true if the string is empty.
fn is_empty(string: String) -> bool;
/// Return true if the number is even.
fn is_even(x: int) -> bool;
@@ -3047,9 +3086,6 @@ fn keys(map: Map) -> Array;
/// Number of elements in the array.
fn len(array: Array) -> int;
/// Return true if the array is empty.
fn is_empty(array: Array) -> bool;
/// Return the length of the BLOB.
///
/// # Example
@@ -3063,15 +3099,9 @@ fn is_empty(array: Array) -> bool;
/// ```
fn len(blob: Blob) -> int;
/// Return true if the blob is empty.
fn is_empty(blob: Blob) -> bool;
/// Return the number of properties in the object map.
fn len(map: Map) -> int;
/// Return true if the map is empty.
fn is_empty(map: Map) -> bool;
/// Return the length of the string, in number of characters.
///
/// # Example
@@ -3083,9 +3113,6 @@ fn is_empty(map: Map) -> bool;
/// ```
fn len(string: String) -> int;
/// Return true if the string is empty.
fn is_empty(string: String) -> bool;
/// Return the natural log of the decimal number.
fn ln(x: Decimal) -> Decimal;
@@ -5738,6 +5765,16 @@ fn tan(x: float) -> float;
fn tanh(x: float) -> float;
/// Create a timestamp containing the current system time.
///
/// # Example
///
/// ```rhai
/// let now = timestamp();
///
/// sleep(10.0); // sleep for 10 seconds
///
/// print(now.elapsed); // prints 10.???
/// ```
fn timestamp() -> Instant;
/// Convert the BLOB into an array of integers.

View File

@@ -267,6 +267,12 @@ op +(u8, u8) -> u8;
/// ```
op +=(Map, Map) -> ();
op +=(String, String) -> ();
op +=(String, char) -> ();
op +=(String, ()) -> ();
op +=(String, ?) -> ();
op +=(String, Blob) -> ();
@@ -1850,6 +1856,21 @@ fn get int(x: float) -> float;
/// ```
fn get is_anonymous(fn_ptr: FnPtr) -> bool;
/// Return true if the array is empty.
fn get is_empty(array: Array) -> bool;
/// Return true if the BLOB is empty.
fn get is_empty(blob: Blob) -> bool;
/// Return true if the range contains no items.
fn get is_empty(range: ExclusiveRange) -> bool;
/// Return true if the range contains no items.
fn get is_empty(range: InclusiveRange) -> bool;
/// Return true if the string is empty.
fn get is_empty(string: String) -> bool;
/// Return true if the number is even.
fn get is_even(x: int) -> bool;
@@ -1973,9 +1994,6 @@ fn get is_zero(x: u8) -> bool;
/// Number of elements in the array.
fn get len(array: Array) -> int;
/// Return true if the array is empty.
fn get empty(array: Array) -> bool;
/// Return the length of the BLOB.
///
/// # Example
@@ -2398,6 +2416,24 @@ fn int(x: float) -> float;
/// ```
fn is_anonymous(fn_ptr: FnPtr) -> bool;
/// Return true if the array is empty.
fn is_empty(array: Array) -> bool;
/// Return true if the BLOB is empty.
fn is_empty(blob: Blob) -> bool;
/// Return true if the map is empty.
fn is_empty(map: Map) -> bool;
/// Return true if the range contains no items.
fn is_empty(range: ExclusiveRange) -> bool;
/// Return true if the range contains no items.
fn is_empty(range: InclusiveRange) -> bool;
/// Return true if the string is empty.
fn is_empty(string: String) -> bool;
/// Return true if the number is even.
fn is_even(x: int) -> bool;
@@ -2532,9 +2568,6 @@ fn keys(map: Map) -> Array;
/// Number of elements in the array.
fn len(array: Array) -> int;
/// Return true if the array is empty.
fn is_empty(array: Array) -> bool;
/// Return the length of the BLOB.
///
/// # Example
@@ -2548,15 +2581,9 @@ fn is_empty(array: Array) -> bool;
/// ```
fn len(blob: Blob) -> int;
/// Return true if the blob is empty.
fn is_empty(blob: Blob) -> bool;
/// Return the number of properties in the object map.
fn len(map: Map) -> int;
/// Return true if the map is empty.
fn is_empty(map: Map) -> bool;
/// Return the length of the string, in number of characters.
///
/// # Example
@@ -2568,9 +2595,6 @@ fn is_empty(map: Map) -> bool;
/// ```
fn len(string: String) -> int;
/// Return true if the string is empty.
fn is_empty(string: String) -> bool;
/// Return the natural log of the decimal number.
fn ln(x: Decimal) -> Decimal;

View File

@@ -3,8 +3,8 @@
"general_kenobi": {
"functions": [
{
"baseHash": 2647973605745432570,
"fullHash": 14052888716942083368,
"baseHash": 14798413363692662073,
"fullHash": 2039416761244929762,
"namespace": "internal",
"access": "public",
"name": "hello_there",
@@ -27,8 +27,8 @@
},
"functions": [
{
"baseHash": 6399059862174416123,
"fullHash": 15886705420394126404,
"baseHash": 17487674894006547092,
"fullHash": 13058993152904417424,
"namespace": "global",
"access": "public",
"name": "minus",