@calcit/procs 0.5.39 → 0.5.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/calcit.procs.mjs +1 -1
- package/lib/js-list.mjs +8 -1
- package/package.json +1 -1
- package/ts-src/calcit.procs.mts +1 -1
- package/ts-src/js-list.mts +8 -1
package/lib/calcit.procs.mjs
CHANGED
package/lib/js-list.mjs
CHANGED
|
@@ -110,7 +110,10 @@ export class CalcitSliceList {
|
|
|
110
110
|
return this.end - this.start;
|
|
111
111
|
}
|
|
112
112
|
get(idx) {
|
|
113
|
-
|
|
113
|
+
if (idx >= 0 && this.start + idx < this.end) {
|
|
114
|
+
return this.value[this.start + idx];
|
|
115
|
+
}
|
|
116
|
+
return null;
|
|
114
117
|
}
|
|
115
118
|
assoc(idx, v) {
|
|
116
119
|
return this.turnListMode().assoc(idx, v);
|
|
@@ -147,6 +150,10 @@ export class CalcitSliceList {
|
|
|
147
150
|
if (to < from) {
|
|
148
151
|
throw new Error("end index too small");
|
|
149
152
|
}
|
|
153
|
+
if (from === to) {
|
|
154
|
+
// when it's empty, just return empty list
|
|
155
|
+
return new CalcitSliceList([]);
|
|
156
|
+
}
|
|
150
157
|
let result = new CalcitSliceList(this.value);
|
|
151
158
|
result.start = this.start + from;
|
|
152
159
|
result.end = this.start + to;
|
package/package.json
CHANGED
package/ts-src/calcit.procs.mts
CHANGED
package/ts-src/js-list.mts
CHANGED
|
@@ -132,7 +132,10 @@ export class CalcitSliceList {
|
|
|
132
132
|
return this.end - this.start;
|
|
133
133
|
}
|
|
134
134
|
get(idx: number) {
|
|
135
|
-
|
|
135
|
+
if (idx >= 0 && this.start + idx < this.end) {
|
|
136
|
+
return this.value[this.start + idx];
|
|
137
|
+
}
|
|
138
|
+
return null;
|
|
136
139
|
}
|
|
137
140
|
assoc(idx: number, v: CalcitValue) {
|
|
138
141
|
return this.turnListMode().assoc(idx, v);
|
|
@@ -166,6 +169,10 @@ export class CalcitSliceList {
|
|
|
166
169
|
if (to < from) {
|
|
167
170
|
throw new Error("end index too small");
|
|
168
171
|
}
|
|
172
|
+
if (from === to) {
|
|
173
|
+
// when it's empty, just return empty list
|
|
174
|
+
return new CalcitSliceList([]);
|
|
175
|
+
}
|
|
169
176
|
let result = new CalcitSliceList(this.value);
|
|
170
177
|
result.start = this.start + from;
|
|
171
178
|
result.end = this.start + to;
|