@mapbox/expression-jamsession
Advanced tools
Comparing version 0.3.1 to 0.3.2
# Changelog | ||
## 0.3.2 | ||
- Fix handling of symbolic decision operators, like `<=` and `!`. | ||
## 0.3.1 | ||
@@ -4,0 +8,0 @@ |
@@ -117,2 +117,6 @@ 'use strict'; | ||
// These operators are used between operands instead of like a function | ||
// name in a call expression, so 3 + 4 instead of +(3, 4). | ||
var symbolOperatorRegExp = /^(\+|\*|-|\/|%|!|!=|<|<=|==|>|>=)$/; | ||
function stringifyLiteralArray(arr) { | ||
@@ -162,3 +166,3 @@ var items = arr.map(function (item) { | ||
if (operator === '+' || operator === '*' || operator === '-' || operator === '/' || operator === '%') { | ||
if (symbolOperatorRegExp.test(operator)) { | ||
return '' + args.join(' ' + operator + ' '); | ||
@@ -165,0 +169,0 @@ } |
{ | ||
"name": "@mapbox/expression-jamsession", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "Write Mapbox GL expressions in a more familiar, handwritable, spreadsheet-like, programming-like syntax.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -11,4 +11,7 @@ # @mapbox/expression-jamsession | ||
- Arithmetic operators (`+ - * /`) and parentheses work like in high school math, e.g. `((3 + 4) * 2) / 7`. | ||
- Expressions are represented like function invocations in programming, e.g. `get("population")`, `log2(get("population"))`. | ||
- Most expressions are represented like function invocations in programming, e.g. `get("population")`, `log2(get("population"))`. | ||
- Symbolic math operators (`+ - * / %`) and parentheses work like in high school math, e.g. `((3 + 4) * 2) / 7`. | ||
That is, the formula should contain `3 + 4` instead of `+(3, 4)`. | ||
- Symbolic decision operators also work with operands on both sides, instead of like function invocations. | ||
So `get("foo") != 4` instead of `!=(get("foo"), 4)`. | ||
- `&` operator concatenates strings, as in spreadsheet programs. | ||
@@ -15,0 +18,0 @@ |
11146
146
71