We shipped syntax which is beyond our `engine` constraint. `??` is
available in node 14 but 4.x is node 4 and above, while 5.x is node 12
and above.
This just dumbs it back down to `||` for now at least.
Fixes#1573
The changes made in #1334 incorrectly used an arrow function and as this isn't supported on IE 11 it causes a SyntaxError to be thrown when loading chai.
* feat(assertions): add 'exists' alias (#1225)
* docs(assertions): remove bad `exists` example
* test(assertions): add `exists` cases
* test(should): remove `exists` tests from should interface
* feat: adding operator attribute to assertion error
You can set the operator as mentioned below.
flag(this, 'operator', MYOPERATOR).
for example,
flag(obj, 'operator', 'notEqual')
Some of the examples in assert.notInclude used quotes in the string and for the string itself, so it now uses double quotes to prevent the single quote from breaking the syntax.
- Fill 2D array with ints upfront to reduce property access cost
- Change from recursive to simpler iterative (DP) solution
- Add cap parameter to stringDistanceCapped to limit computation
- Make candidate generation use a simple loop to avoid allocating unnecessary arrays and to call stringDistance only once on each pair of strings instead of every time in the sort callback
This improves chai perf by about 13% on @bmeurer's https://github.com/v8/web-tooling-benchmark.
When throws is invoked with two arguments, where the second is a string or regexp, the second argument is the **errMsgMatcher**. The current examples imply that this string is the **message** rather than the matcher.
The `stringDistance` function calls
```js
strA.slice(0, -1)
```
and
```js
strB.slice(0, -1)
```
multiple times, which is a bit of a waste of time here. JavaScript
engines cannot generally eliminate the duplicated calls easily, so
it's better to avoid the redundant calls altogether.
This improves the chai test on the
[web-tooling-benchmark](https://github.com/v8/web-tooling-benchmark) by
around 8% when run with upcoming V8 6.4.
* property assertion should only accept strings if nested, fixes#1043
* similar logic seperated out
* test cases for fix#1043
* type check if not isNested with tests
* Tests for assert and should inteface
* Error message change
* changes in should and assert tests as per review
* assert tests modified
* Review comments changes
* review comments fixes