Closed ephys closed 4 months ago
@ephys - could you add a unit test for sparse arrays as well?
Subject: [PATCH] test: add test for sparse arrays
---
Index: test/jsep.test.js
<+>UTF-8
===================================================================
diff --git a/test/jsep.test.js b/test/jsep.test.js
--- a/test/jsep.test.js (revision e4fdda3a64be74be692b65a35ac6b88c55f32341)
+++ b/test/jsep.test.js (date 1681591979691)
@@ -54,6 +54,18 @@
QUnit.test('Arrays', function (assert) {
testParser('[]', { type: 'ArrayExpression', elements: [] }, assert);
+ testParser('[,,1]', {
+ type: 'ArrayExpression',
+ elements: [
+ null,
+ null,
+ {
+ raw: '1',
+ type: 'Literal',
+ value: 1
+ }
+ ],
+ }, assert);
testParser('[a]', {
type: 'ArrayExpression',
:tada: This issue has been resolved in version 1.3.9 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
According to this line: https://github.com/EricSmekens/jsep/blob/553833504f2f204964a7d63680da5c8b6471d3ad/src/jsep.js#LL807C24-L807C24, the elements array on array expressions can include null. It has been our experience when parsing an array with holes (
[,,,]
)This PR updates the typing of
ArrayExpression.elements
to include null