Skip to content

Commit 46ccfef

Browse files
committed
style: add prettier, format
1 parent a3f2674 commit 46ccfef

40 files changed

Lines changed: 21789 additions & 13374 deletions

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: node_js
22
install:
3-
- "pnpm i"
3+
- "pnpm i"
44
node_js:
55
- "8"
6-
- "node"
6+
- "node"

CHANGELOG.md

Lines changed: 76 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,103 @@
11
# Changelog
22

33
## [3.1.0](https://github.com/cshaa/filtrex/releases/tag/v3.1.0)
4-
* Change links to `github.com/m93a` to `github.com/cshaa` ([#62](https://github.com/cshaa/filtrex/pull/62))
5-
* Migrate from `yarn` to [`pnpm`](https://pnpm.io/)
6-
* Update dependencies
4+
5+
- Change links to `github.com/m93a` to `github.com/cshaa` ([#62](https://github.com/cshaa/filtrex/pull/62))
6+
- Migrate from `yarn` to [`pnpm`](https://pnpm.io/)
7+
- Update dependencies
78

89
## [3.0.0](https://github.com/cshaa/filtrex/releases/tag/v3.0.0)
10+
911
### Breaking Changes
10-
* Trying to access properties that aren't present in the `data` object now produces an error ([#22](https://github.com/cshaa/filtrex/issues/22))
11-
* Logical values are no longer converted to `1` and `0`, proper booleans are returned instead ([#27](https://github.com/cshaa/filtrex/issues/27))
12-
* Corrected the precedence of exponentiation ([#41](https://github.com/cshaa/filtrex/issues/41), [#43](https://github.com/cshaa/filtrex/issues/43))
13-
* Modulo now always returns a positive number ([#36](https://github.com/cshaa/filtrex/issues/36))
14-
* Removed `random` from standard functions ([#47](https://github.com/cshaa/filtrex/issues/47))
15-
* Corrected the precedence of `not in` ([#42](https://github.com/cshaa/filtrex/issues/42))
16-
* Corrected the precedence of the ternary operator ([#34](https://github.com/cshaa/filtrex/issues/34#issuecomment-866426918))
17-
18-
### Deprecations
19-
* The ternary operator `? :` is now deprecated in favor of `if..then..else` ([#34](https://github.com/cshaa/filtrex/issues/34))
20-
* Modulo operator `%` is now deprecated in favor of `mod` ([#48](https://github.com/cshaa/filtrex/issues/48))
12+
13+
- Trying to access properties that aren't present in the `data` object now produces an error ([#22](https://github.com/cshaa/filtrex/issues/22))
14+
- Logical values are no longer converted to `1` and `0`, proper booleans are returned instead ([#27](https://github.com/cshaa/filtrex/issues/27))
15+
- Corrected the precedence of exponentiation ([#41](https://github.com/cshaa/filtrex/issues/41), [#43](https://github.com/cshaa/filtrex/issues/43))
16+
- Modulo now always returns a positive number ([#36](https://github.com/cshaa/filtrex/issues/36))
17+
- Removed `random` from standard functions ([#47](https://github.com/cshaa/filtrex/issues/47))
18+
- Corrected the precedence of `not in` ([#42](https://github.com/cshaa/filtrex/issues/42))
19+
- Corrected the precedence of the ternary operator ([#34](https://github.com/cshaa/filtrex/issues/34#issuecomment-866426918))
20+
21+
### Deprecations
22+
23+
- The ternary operator `? :` is now deprecated in favor of `if..then..else` ([#34](https://github.com/cshaa/filtrex/issues/34))
24+
- Modulo operator `%` is now deprecated in favor of `mod` ([#48](https://github.com/cshaa/filtrex/issues/48))
2125

2226
### New Features
23-
* Chained comparisons are now possible: `x>y>z`, meaning `x>y and y>z` ([#37](https://github.com/cshaa/filtrex/issues/37))
2427

25-
* Operators can now be overloaded using `options.operators['+']` and the like ([#38](https://github.com/cshaa/filtrex/issues/30))
26-
* The supported operators are `+`, `-`, `*`, `/`, `mod`, `^`, `==`, `!=`, `<`, `<=`, `>=`, `>`, `~=`
27-
* The minus operator overload is used for both the binary and the unary operator:
28-
* `-a` will result in `operators['-'](a)`
29-
* `a - b` will result in `operators['-'](a, b)`.
28+
- Chained comparisons are now possible: `x>y>z`, meaning `x>y and y>z` ([#37](https://github.com/cshaa/filtrex/issues/37))
29+
30+
- Operators can now be overloaded using `options.operators['+']` and the like ([#38](https://github.com/cshaa/filtrex/issues/30))
31+
32+
- The supported operators are `+`, `-`, `*`, `/`, `mod`, `^`, `==`, `!=`, `<`, `<=`, `>=`, `>`, `~=`
33+
- The minus operator overload is used for both the binary and the unary operator:
34+
- `-a` will result in `operators['-'](a)`
35+
- `a - b` will result in `operators['-'](a, b)`.
36+
37+
- Errors are now i18n-friendly ([#35](https://github.com/cshaa/filtrex/issues/35))
38+
39+
- `err.I18N_STRING` will return one of the following strings:
3040

31-
* Errors are now i18n-friendly ([#35](https://github.com/cshaa/filtrex/issues/35))
32-
* `err.I18N_STRING` will return one of the following strings:
33-
* `UNKNOWN_FUNCTION`, English message: “Unknown function: `<funcName>`
34-
* `UNKNOWN_PROPERTY`, English message: “Property “`<propName>`” does not exist.”
35-
* `UNKNOWN_OPTION`, English message: “Unknown option: `<key>`
36-
* `UNEXPECTED_TYPE`, English message: “Expected a `<expected>`, but got a `<got>` instead.”
37-
* `INTERNAL`, does not have a standardized message
41+
- `UNKNOWN_FUNCTION`, English message: “Unknown function: `<funcName>`
42+
- `UNKNOWN_PROPERTY`, English message: “Property “`<propName>`” does not exist.”
43+
- `UNKNOWN_OPTION`, English message: “Unknown option: `<key>`
44+
- `UNEXPECTED_TYPE`, English message: “Expected a `<expected>`, but got a `<got>` instead.”
45+
- `INTERNAL`, does not have a standardized message
3846

39-
* The values in angled brackeds are available as properties on the error, eg. `err.funcName` and `err.propName`
40-
* Parse errors are sadly not i18n-friendly yet – this is a limitation of Jison ([#55](https://github.com/cshaa/filtrex/issues/55))
47+
- The values in angled brackeds are available as properties on the error, eg. `err.funcName` and `err.propName`
48+
- Parse errors are sadly not i18n-friendly yet – this is a limitation of Jison ([#55](https://github.com/cshaa/filtrex/issues/55))
4149

42-
* Adds `options.constants`, which allows you to pass constant values (like pi) to the user without the need to modify `data` ([#38](https://github.com/cshaa/filtrex/issues/38))
43-
* When using unquoted symbols, constants shadow data properties, ie. `2*pi` will resolve as `2*constants.pi` if it is defined
44-
* Quoted symbols always resolve as data properties, ie. `2*'pi'` will always resolve as `2*data.pi`
50+
- Adds `options.constants`, which allows you to pass constant values (like pi) to the user without the need to modify `data` ([#38](https://github.com/cshaa/filtrex/issues/38))
4551

46-
* Optionally, you use dot as a property accessor ([#44](https://github.com/cshaa/filtrex/issues/44#issuecomment-925716818))
47-
* The available predefined `prop` functions are: [`useOptionalChaining`](https://github.com/cshaa/filtrex/blob/0d371508b274f78931c990b9ebfa865c9a89b970/src/filtrex.mjs#L121), [`useDotAccessOperator`](https://github.com/cshaa/filtrex/blob/0d371508b274f78931c990b9ebfa865c9a89b970/src/filtrex.mjs#L149) and [`useDotAccessOperatorAndOptionalChaining`](https://github.com/cshaa/filtrex/blob/0d371508b274f78931c990b9ebfa865c9a89b970/src/filtrex.mjs#L189)
48-
* `customProp` now has additional argument `type: 'unescaped' | 'single-quoted'`
52+
- When using unquoted symbols, constants shadow data properties, ie. `2*pi` will resolve as `2*constants.pi` if it is defined
53+
- Quoted symbols always resolve as data properties, ie. `2*'pi'` will always resolve as `2*data.pi`
54+
55+
- Optionally, you use dot as a property accessor ([#44](https://github.com/cshaa/filtrex/issues/44#issuecomment-925716818))
56+
- The available predefined `prop` functions are: [`useOptionalChaining`](https://github.com/cshaa/filtrex/blob/0d371508b274f78931c990b9ebfa865c9a89b970/src/filtrex.mjs#L121), [`useDotAccessOperator`](https://github.com/cshaa/filtrex/blob/0d371508b274f78931c990b9ebfa865c9a89b970/src/filtrex.mjs#L149) and [`useDotAccessOperatorAndOptionalChaining`](https://github.com/cshaa/filtrex/blob/0d371508b274f78931c990b9ebfa865c9a89b970/src/filtrex.mjs#L189)
57+
- `customProp` now has additional argument `type: 'unescaped' | 'single-quoted'`
4958

5059
### How to Migrate from 2.2.0
51-
* TODO: these will be the steps you need to take for the smoothest ride
60+
61+
- TODO: these will be the steps you need to take for the smoothest ride
5262

5363
## [2.2.0](https://github.com/cshaa/filtrex/releases/tag/v2.2.0)
54-
* The parser is now precompiled, massively speeding up cold start ([#19](https://github.com/cshaa/filtrex/issues/19))
55-
* Fixes Jison dependence ([#21](https://github.com/cshaa/filtrex/issues/21))
64+
65+
- The parser is now precompiled, massively speeding up cold start ([#19](https://github.com/cshaa/filtrex/issues/19))
66+
- Fixes Jison dependence ([#21](https://github.com/cshaa/filtrex/issues/21))
5667

5768
## [2.0.0](https://github.com/cshaa/filtrex/releases/tag/v2.0.0)
5869

59-
* **BREAKING CHANGE**: Changes the `compileExpression` method's call signature
60-
* Previously the method had up to three parameters: `expression`, `extraFunctions` and `customProp`
61-
* Now the method has two parameters: `expression` and `options`, where `options = { extraFunctions, customProp }`
70+
- **BREAKING CHANGE**: Changes the `compileExpression` method's call signature
71+
72+
- Previously the method had up to three parameters: `expression`, `extraFunctions` and `customProp`
73+
- Now the method has two parameters: `expression` and `options`, where `options = { extraFunctions, customProp }`
6274

63-
* **BREAKING CHANGE**: Adds support for quote-escaping in string literals and quoted symbols ([#11](https://github.com/cshaa/filtrex/issues/11), [#12](https://github.com/cshaa/filtrex/pull/12), [#20](https://github.com/cshaa/filtrex/issues/20), [#31j](https://github.com/joewalnes/filtrex/issues/31))
64-
* `"some \"quoted\" string and a \\ backslash"`
65-
* `'a \'quoted\' symbol and a \\ backslash'`
66-
* backslash `\` character now has to be escaped `\\`
67-
* these expressions throw a syntax error: `"\'"`, `'\"'`, `"\n"` (use literal newline), `"\anythingother"`
75+
- **BREAKING CHANGE**: Adds support for quote-escaping in string literals and quoted symbols ([#11](https://github.com/cshaa/filtrex/issues/11), [#12](https://github.com/cshaa/filtrex/pull/12), [#20](https://github.com/cshaa/filtrex/issues/20), [#31j](https://github.com/joewalnes/filtrex/issues/31))
6876

69-
* Adds support for `in` operator with runtime arrays ([#14](https://github.com/cshaa/filtrex/issues/14))
70-
* `value in array` will return `1` when the value is present in the array and `0` otherwise
71-
* `array in array` will return `1` when the first array is a subset of the second one, `0` otherwise
72-
* `array in value` and `value in value` technically also work, they convert `value` to `[value]`
73-
74-
* Errors are no longer thrown, but instead catched and returned ([#7](https://github.com/cshaa/filtrex/issues/7))
77+
- `"some \"quoted\" string and a \\ backslash"`
78+
- `'a \'quoted\' symbol and a \\ backslash'`
79+
- backslash `\` character now has to be escaped `\\`
80+
- these expressions throw a syntax error: `"\'"`, `'\"'`, `"\n"` (use literal newline), `"\anythingother"`
7581

82+
- Adds support for `in` operator with runtime arrays ([#14](https://github.com/cshaa/filtrex/issues/14))
83+
84+
- `value in array` will return `1` when the value is present in the array and `0` otherwise
85+
- `array in array` will return `1` when the first array is a subset of the second one, `0` otherwise
86+
- `array in value` and `value in value` technically also work, they convert `value` to `[value]`
87+
88+
- Errors are no longer thrown, but instead catched and returned ([#7](https://github.com/cshaa/filtrex/issues/7))
7689

7790
## [1.0.0](https://github.com/cshaa/filtrex/releases/tag/v1.0.0)
78-
* **FIXED VULNERABILITY**: Not prone to XSS anymore ([#17j](https://github.com/joewalnes/filtrex/issues/17), [#18j](https://github.com/joewalnes/filtrex/issues/18))
79-
* **FIXED VULNERABILITY**: More robust against prototype attacks ([#19j](https://github.com/joewalnes/filtrex/pull/19), [#20j](https://github.com/joewalnes/filtrex/pull/20))
80-
* Adds TypeScript type definitions
81-
* Adds syntax for arrays: `(a, b, c)`
82-
* Adds the `of` property accessor: `a of b` translates to `data.b.a`
83-
* Adds the ability to customize the `prop` function ([#27j](https://github.com/joewalnes/filtrex/issues/27), [#28j](https://github.com/joewalnes/filtrex/pull/28))
91+
92+
- **FIXED VULNERABILITY**: Not prone to XSS anymore ([#17j](https://github.com/joewalnes/filtrex/issues/17), [#18j](https://github.com/joewalnes/filtrex/issues/18))
93+
- **FIXED VULNERABILITY**: More robust against prototype attacks ([#19j](https://github.com/joewalnes/filtrex/pull/19), [#20j](https://github.com/joewalnes/filtrex/pull/20))
94+
- Adds TypeScript type definitions
95+
- Adds syntax for arrays: `(a, b, c)`
96+
- Adds the `of` property accessor: `a of b` translates to `data.b.a`
97+
- Adds the ability to customize the `prop` function ([#27j](https://github.com/joewalnes/filtrex/issues/27), [#28j](https://github.com/joewalnes/filtrex/pull/28))
8498

8599
## 0.5.4
86-
* The original version by [Joe Walnes](https://github.com/joewalnes)
87-
* **KNOWN VULNERABILITY**: Quotes can be exploited for XSS, see [#17j](https://github.com/joewalnes/filtrex/issues/17), [#18j](https://github.com/joewalnes/filtrex/issues/18)
88-
* **KNOWN VULNERABILITY**: Prototypes are accessible from expressions
100+
101+
- The original version by [Joe Walnes](https://github.com/joewalnes)
102+
- **KNOWN VULNERABILITY**: Quotes can be exploited for XSS, see [#17j](https://github.com/joewalnes/filtrex/issues/17), [#18j](https://github.com/joewalnes/filtrex/issues/18)
103+
- **KNOWN VULNERABILITY**: Prototypes are accessible from expressions

0 commit comments

Comments
 (0)