v3.5.0
A big release packed with new built-in functions, array expressions, and the ternary operator.
Highlights
- Ternary operator — inline conditionals with
condition ? then : else - 22 new functions and expressions covering strings, math, arrays, maps, and type conversion
- Bug fixes for non-base10 number parsing and XML round-trip ordering
New Functions
Strings
split(separator)— split a string into an arraytoLower()/toUpper()— case conversiontrim()/trimPrefix(prefix)/trimSuffix(suffix)— whitespace and affix trimmingstartsWith(prefix)/endsWith(suffix)— prefix/suffix checksindexOf(substring)— find substring position (-1 if not found)
Math
abs()— absolute valuefloor()/ceil()/round()— roundingavg(...)— average of numbers
Arrays
flatten()— flatten nested arrays by one levelunique()— remove duplicatesfirst()/last()— first/last element
Maps
values()— map values as an arrayentries()/fromEntries()— convert between maps and{key, value}arrays
Type Conversion
toBool()— convert a value to booleanstringify(format)— serialize a value to a format string (inverse ofparse)
New Expressions
any(predicate)— true if any array element matchesall(predicate)— true if all array elements matchcount(predicate)— count matching array elements
Ternary Operator
A compact alternative to if/else blocks:
age >= 18 ? "adult" : "minor"
Supports nesting with parentheses, all comparison/logical operators, and works inside map(), filter(), etc.
Bug Fixes
- Fixed YAML and TOML parsers failing on non-base10 numbers (hex, binary, octal)
- Fixed
toIntfailing on non-base10 numbers - Improved XML child element ordering for round-trip handling (thanks @takeokunn)
Full Changelog: v3.4.1...v3.5.0