com.sweaxizone.w3c.extension 1.0.2 → 1.0.3
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/dist/E4X.d.ts +1 -0
- package/dist/E4X.js +1 -0
- package/dist/Enum.d.ts +1 -0
- package/dist/Enum.js +1 -0
- package/dist/SAByteArray.js +20 -15
- package/dist/SAEventTarget.d.ts +1 -0
- package/dist/SAEventTarget.js +1 -0
- package/dist/index.js +12 -7
- package/package.json +1 -1
package/dist/E4X.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/E4X.js
CHANGED
package/dist/Enum.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/Enum.js
CHANGED
package/dist/SAByteArray.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const assert_1 = __importDefault(require("assert"));
|
|
2
7
|
//
|
|
3
8
|
const validEndianSet = ["bigEndian", "littleEndian"];
|
|
4
9
|
//
|
|
@@ -11,7 +16,7 @@ globalThis.SAByteArray = class SAByteArray {
|
|
|
11
16
|
m_endian = "bigEndian";
|
|
12
17
|
constructor(initialCapacityArg = undefined) {
|
|
13
18
|
let initialCapacity = initialCapacityArg === undefined ? SAByteArray.INITIAL_CAPACITY : initialCapacityArg;
|
|
14
|
-
|
|
19
|
+
(0, assert_1.default)(initialCapacity >= 2, 'SAByteArray initial capacity must be >= 2.');
|
|
15
20
|
this.m_dataview = new DataView(new ArrayBuffer(initialCapacity));
|
|
16
21
|
this.m_u8array = new Uint8Array(this.m_dataview.buffer);
|
|
17
22
|
}
|
|
@@ -63,7 +68,7 @@ globalThis.SAByteArray = class SAByteArray {
|
|
|
63
68
|
return this.m_endian;
|
|
64
69
|
}
|
|
65
70
|
set endian(val) {
|
|
66
|
-
|
|
71
|
+
(0, assert_1.default)(validEndianSet.indexOf(val) != -1);
|
|
67
72
|
this.m_endian = val;
|
|
68
73
|
}
|
|
69
74
|
get length() {
|
|
@@ -122,7 +127,7 @@ globalThis.SAByteArray = class SAByteArray {
|
|
|
122
127
|
}
|
|
123
128
|
}
|
|
124
129
|
readUnsignedByte() {
|
|
125
|
-
|
|
130
|
+
(0, assert_1.default)(this.m_position < this.m_length, 'Insufficient data available to read.');
|
|
126
131
|
let k = this.m_dataview.getUint8(this.m_position);
|
|
127
132
|
this.m_position += 1;
|
|
128
133
|
return k;
|
|
@@ -133,7 +138,7 @@ globalThis.SAByteArray = class SAByteArray {
|
|
|
133
138
|
this.m_position += 1;
|
|
134
139
|
}
|
|
135
140
|
readByte() {
|
|
136
|
-
|
|
141
|
+
(0, assert_1.default)(this.m_position < this.m_length, 'Insufficient data available to read.');
|
|
137
142
|
let k = this.m_dataview.getInt8(this.m_position);
|
|
138
143
|
this.m_position += 1;
|
|
139
144
|
return k;
|
|
@@ -144,7 +149,7 @@ globalThis.SAByteArray = class SAByteArray {
|
|
|
144
149
|
this.m_position += 1;
|
|
145
150
|
}
|
|
146
151
|
readShort() {
|
|
147
|
-
|
|
152
|
+
(0, assert_1.default)(this.m_position + 2 <= this.m_length, 'Insufficient data available to read.');
|
|
148
153
|
let k = this.m_dataview.getInt16(this.m_position, this.m_endian == "littleEndian");
|
|
149
154
|
this.m_position += 2;
|
|
150
155
|
return k;
|
|
@@ -155,7 +160,7 @@ globalThis.SAByteArray = class SAByteArray {
|
|
|
155
160
|
this.m_position += 2;
|
|
156
161
|
}
|
|
157
162
|
readUnsignedShort() {
|
|
158
|
-
|
|
163
|
+
(0, assert_1.default)(this.m_position + 2 <= this.m_length, 'Insufficient data available to read.');
|
|
159
164
|
let k = this.m_dataview.getUint16(this.m_position, this.m_endian == "littleEndian");
|
|
160
165
|
this.m_position += 2;
|
|
161
166
|
return k;
|
|
@@ -166,7 +171,7 @@ globalThis.SAByteArray = class SAByteArray {
|
|
|
166
171
|
this.m_position += 2;
|
|
167
172
|
}
|
|
168
173
|
readInt() {
|
|
169
|
-
|
|
174
|
+
(0, assert_1.default)(this.m_position + 4 <= this.m_length, 'Insufficient data available to read.');
|
|
170
175
|
let k = this.m_dataview.getInt32(this.m_position, this.m_endian == "littleEndian");
|
|
171
176
|
this.m_position += 4;
|
|
172
177
|
return k;
|
|
@@ -177,7 +182,7 @@ globalThis.SAByteArray = class SAByteArray {
|
|
|
177
182
|
this.m_position += 4;
|
|
178
183
|
}
|
|
179
184
|
readUnsignedInt() {
|
|
180
|
-
|
|
185
|
+
(0, assert_1.default)(this.m_position + 4 <= this.m_length, 'Insufficient data available to read.');
|
|
181
186
|
let k = this.m_dataview.getUint32(this.m_position, this.m_endian == "littleEndian");
|
|
182
187
|
this.m_position += 4;
|
|
183
188
|
return k;
|
|
@@ -188,7 +193,7 @@ globalThis.SAByteArray = class SAByteArray {
|
|
|
188
193
|
this.m_position += 4;
|
|
189
194
|
}
|
|
190
195
|
readLong() {
|
|
191
|
-
|
|
196
|
+
(0, assert_1.default)(this.m_position + 8 <= this.m_length, 'Insufficient data available to read.');
|
|
192
197
|
let k = this.m_dataview.getBigInt64(this.m_position, this.m_endian == "littleEndian");
|
|
193
198
|
this.m_position += 8;
|
|
194
199
|
return k;
|
|
@@ -199,7 +204,7 @@ globalThis.SAByteArray = class SAByteArray {
|
|
|
199
204
|
this.m_position += 8;
|
|
200
205
|
}
|
|
201
206
|
readUnsignedLong() {
|
|
202
|
-
|
|
207
|
+
(0, assert_1.default)(this.m_position + 8 <= this.m_length, 'Insufficient data available to read.');
|
|
203
208
|
let k = this.m_dataview.getBigUint64(this.m_position, this.m_endian == "littleEndian");
|
|
204
209
|
this.m_position += 8;
|
|
205
210
|
return k;
|
|
@@ -210,7 +215,7 @@ globalThis.SAByteArray = class SAByteArray {
|
|
|
210
215
|
this.m_position += 8;
|
|
211
216
|
}
|
|
212
217
|
readFloat() {
|
|
213
|
-
|
|
218
|
+
(0, assert_1.default)(this.m_position + 4 <= this.m_length, 'Insufficient data available to read.');
|
|
214
219
|
let k = this.m_dataview.getFloat32(this.m_position, this.m_endian == "littleEndian");
|
|
215
220
|
this.m_position += 4;
|
|
216
221
|
return k;
|
|
@@ -221,7 +226,7 @@ globalThis.SAByteArray = class SAByteArray {
|
|
|
221
226
|
this.m_position += 4;
|
|
222
227
|
}
|
|
223
228
|
readDouble() {
|
|
224
|
-
|
|
229
|
+
(0, assert_1.default)(this.m_position + 8 <= this.m_length, 'Insufficient data available to read.');
|
|
225
230
|
let k = this.m_dataview.getFloat64(this.m_position, this.m_endian == "littleEndian");
|
|
226
231
|
this.m_position += 8;
|
|
227
232
|
return k;
|
|
@@ -232,7 +237,7 @@ globalThis.SAByteArray = class SAByteArray {
|
|
|
232
237
|
this.m_position += 8;
|
|
233
238
|
}
|
|
234
239
|
readUTF(length) {
|
|
235
|
-
|
|
240
|
+
(0, assert_1.default)(this.m_position + length <= this.m_length, 'Insufficient data available to read.');
|
|
236
241
|
let k = this.m_u8array.subarray(this.m_position, this.m_position + length);
|
|
237
242
|
this.m_position += length;
|
|
238
243
|
return new TextDecoder().decode(k);
|
|
@@ -244,7 +249,7 @@ globalThis.SAByteArray = class SAByteArray {
|
|
|
244
249
|
this.m_position += u8arr.length;
|
|
245
250
|
}
|
|
246
251
|
readBytes(length) {
|
|
247
|
-
|
|
252
|
+
(0, assert_1.default)(this.m_position + length <= this.m_length, 'Insufficient data available to read.');
|
|
248
253
|
let k = this.m_u8array.subarray(this.m_position, this.m_position + length);
|
|
249
254
|
this.m_position += length;
|
|
250
255
|
return SAByteArray.from(k);
|
package/dist/SAEventTarget.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/SAEventTarget.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
require("./Enum");
|
|
7
|
+
require("./E4X");
|
|
8
|
+
require("./SAEventTarget");
|
|
9
|
+
require("./SAByteArray");
|
|
10
|
+
const assert_1 = __importDefault(require("assert"));
|
|
6
11
|
// assert
|
|
7
|
-
globalThis.assert =
|
|
8
|
-
globalThis.AssertionError =
|
|
12
|
+
globalThis.assert = assert_1.default;
|
|
13
|
+
globalThis.AssertionError = assert_1.default.AssertionError;
|
|
9
14
|
// trace(), etrace()
|
|
10
15
|
globalThis.trace = console.log;
|
|
11
16
|
globalThis.etrace = console.error;
|