maths: add length function

This commit is contained in:
jean-emmanuel 2018-03-06 01:29:45 +01:00
parent 982f8f2585
commit dfa0cb3150
2 changed files with 2 additions and 0 deletions

View file

@ -21,6 +21,7 @@ Additionnal functions:
- `unpack(x)`: remove an array's brackets (`unpack([1,2])` returns `"1, 2"`)
- `pad(x, padding)`: add leading zeros if the length the integer part of `x` is smaller than `padding` (`pad(1,2)` returns `"01"`)
- `length(x)`: returns the length of an array or string
!!! tip ""
A single widget property can contain multiple formulas. Variables and functions declared in a formula are available to subsequent formulas in the same property definition.

View file

@ -84,6 +84,7 @@ module.exports = {
}
return dec ? int + '.' + dec : int
},
length: function(x) { return x.length },
// basic relationnal to keep alphabetical string comparison (v4 change)
equal: function (a, b) { return a == b },
unequal: function (a, b) { return a != b },