Edge Cases Quick Reference
Return Values on Empty or Missing Data
| Function | Condition | Returns |
|---|---|---|
First(arr) | Empty array | null |
Last(arr) | Empty array | null |
IndexOf(arr, val) | Not found | -1 |
WhereByField(...) | No matches | [] (empty array) |
FindByField(...) | No match | null |
Find(arr, fn) | No match | null |
AnyByField(...) | Empty array | false |
AllByField(...) | Empty array | true (vacuous truth) |
Any(arr, fn) | Empty array | false |
All(arr, fn) | Empty array | true (vacuous truth) |
Select(...) | Empty array | [] |
SelectMany(...) | Empty array | [] |
Project(...) | Empty array | [] |
Omit(...) | Empty array | [] |
Merge(arr) | Empty array | {} |
Min(arr) | No numbers | null |
Max(arr) | No numbers | null |
Average(arr) | No numbers | null |
Median(arr) | No numbers | null |
Mode(arr) | No numbers | null |
Sum(arr) | No numbers | 0 |
ToNumber(s) | Invalid string | null |
RegexMatch(...) | No match | null |
RegexMatchAll(...) | No matches | [] |
RegexMatchDetail(...) | No match | null |
RandomChoice(arr) | Empty array | null |
Case Sensitivity
- String comparisons (
==,!=,<,>) are case-sensitive Contains,StartsWith,EndsWithare case-sensitive- Query function comparisons are case-sensitive
- Use
ToLower()orToUpper()for case-insensitive matching
Sort Order for Mixed Types
Sort groups elements by type, then sorts within each group:
nullvalues (first)- Numbers (ascending)
- Strings (lexicographic)
- Booleans (
falsebeforetrue)
Split Preserves Empty Strings
The Split function preserves empty strings produced by adjacent or leading/trailing delimiters:
Split("a,,b", ",") # ["a", "", "b"]
Split(",a,b,", ",") # ["", "a", "b", ""]