@woosh/meep-engine 2.92.0 → 2.92.4
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/build/meep.cjs +15 -3
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +15 -3
- package/package.json +1 -1
- package/src/core/binary/data_view/DataType2DataViewReaders.d.ts +14 -0
- package/src/core/binary/data_view/DataType2DataViewReaders.d.ts.map +1 -0
- package/src/core/binary/data_view/DataType2DataViewReaders.js +21 -0
- package/src/core/binary/data_view/DataType2DataViewWriters.d.ts +14 -0
- package/src/core/binary/data_view/DataType2DataViewWriters.d.ts.map +1 -0
- package/src/core/binary/data_view/DataType2DataViewWriters.js +21 -0
- package/src/core/binary/data_view/DataViewStructAccessor.d.ts +17 -0
- package/src/core/binary/data_view/DataViewStructAccessor.d.ts.map +1 -0
- package/src/core/binary/data_view/DataViewStructAccessor.js +82 -0
- package/src/core/binary/data_view/DataViewStructAccessor.spec.d.ts +2 -0
- package/src/core/binary/data_view/DataViewStructAccessor.spec.d.ts.map +1 -0
- package/src/core/binary/data_view/DataViewStructAccessor.spec.js +20 -0
- package/src/core/collection/table/RowFirstTableSpec.d.ts +0 -36
- package/src/core/collection/table/RowFirstTableSpec.d.ts.map +1 -1
- package/src/core/collection/table/RowFirstTableSpec.js +6 -44
- package/src/core/model/object/objectDeepEquals.d.ts.map +1 -1
- package/src/core/model/object/objectDeepEquals.js +16 -4
- package/src/core/model/object/objectDeepEquals.spec.js +40 -0
package/build/meep.module.js
CHANGED
|
@@ -101296,6 +101296,11 @@ function easeInOutQuad(t) {
|
|
|
101296
101296
|
* @returns {boolean}
|
|
101297
101297
|
*/
|
|
101298
101298
|
function objectDeepEquals(a, b) {
|
|
101299
|
+
if (a === b) {
|
|
101300
|
+
// identity shortcut
|
|
101301
|
+
return true;
|
|
101302
|
+
}
|
|
101303
|
+
|
|
101299
101304
|
const tA = typeof a;
|
|
101300
101305
|
const tB = typeof b;
|
|
101301
101306
|
|
|
@@ -101303,7 +101308,16 @@ function objectDeepEquals(a, b) {
|
|
|
101303
101308
|
return false;
|
|
101304
101309
|
}
|
|
101305
101310
|
|
|
101306
|
-
if (tA
|
|
101311
|
+
if (tA !== "object") {
|
|
101312
|
+
// primitive types, identity equality already checked
|
|
101313
|
+
return false;
|
|
101314
|
+
} else {
|
|
101315
|
+
|
|
101316
|
+
if (a === null || b === null) {
|
|
101317
|
+
// we know that A and B are not the same, so if one of them is a null - there is no possible equality
|
|
101318
|
+
return false;
|
|
101319
|
+
}
|
|
101320
|
+
|
|
101307
101321
|
if (Array.isArray(a)) {
|
|
101308
101322
|
// special fast path for arrays
|
|
101309
101323
|
if (!Array.isArray(b)) {
|
|
@@ -101333,8 +101347,6 @@ function objectDeepEquals(a, b) {
|
|
|
101333
101347
|
|
|
101334
101348
|
return true;
|
|
101335
101349
|
|
|
101336
|
-
} else {
|
|
101337
|
-
return a === b;
|
|
101338
101350
|
}
|
|
101339
101351
|
}
|
|
101340
101352
|
|
package/package.json
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type DataType2DataViewReaders = string;
|
|
2
|
+
export namespace DataType2DataViewReaders {
|
|
3
|
+
let uint8: string;
|
|
4
|
+
let uint16: string;
|
|
5
|
+
let uint32: string;
|
|
6
|
+
let uint64: string;
|
|
7
|
+
let int8: string;
|
|
8
|
+
let int16: string;
|
|
9
|
+
let int32: string;
|
|
10
|
+
let int64: string;
|
|
11
|
+
let float32: string;
|
|
12
|
+
let float64: string;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=DataType2DataViewReaders.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataType2DataViewReaders.d.ts","sourceRoot":"","sources":["../../../../../src/core/binary/data_view/DataType2DataViewReaders.js"],"names":[],"mappings":"uCAKU,MAAM"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BinaryDataType } from "../type/BinaryDataType.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView
|
|
5
|
+
* @readonly
|
|
6
|
+
* @enum {string}
|
|
7
|
+
*/
|
|
8
|
+
export const DataType2DataViewReaders = {
|
|
9
|
+
[BinaryDataType.Uint8]: "getUint8",
|
|
10
|
+
[BinaryDataType.Uint16]: "getUint16",
|
|
11
|
+
[BinaryDataType.Uint32]: "getUint32",
|
|
12
|
+
[BinaryDataType.Uint64]: "getUint64",
|
|
13
|
+
|
|
14
|
+
[BinaryDataType.Int8]: "getInt8",
|
|
15
|
+
[BinaryDataType.Int16]: "getInt16",
|
|
16
|
+
[BinaryDataType.Int32]: "getInt32",
|
|
17
|
+
[BinaryDataType.Int64]: "getInt64",
|
|
18
|
+
|
|
19
|
+
[BinaryDataType.Float32]: "getFloat32",
|
|
20
|
+
[BinaryDataType.Float64]: "getFloat64"
|
|
21
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type DataType2DataViewWriters = string;
|
|
2
|
+
export namespace DataType2DataViewWriters {
|
|
3
|
+
let uint8: string;
|
|
4
|
+
let uint16: string;
|
|
5
|
+
let uint32: string;
|
|
6
|
+
let uint64: string;
|
|
7
|
+
let int8: string;
|
|
8
|
+
let int16: string;
|
|
9
|
+
let int32: string;
|
|
10
|
+
let int64: string;
|
|
11
|
+
let float32: string;
|
|
12
|
+
let float64: string;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=DataType2DataViewWriters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataType2DataViewWriters.d.ts","sourceRoot":"","sources":["../../../../../src/core/binary/data_view/DataType2DataViewWriters.js"],"names":[],"mappings":"uCAKU,MAAM"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BinaryDataType } from "../type/BinaryDataType.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView
|
|
5
|
+
* @readonly
|
|
6
|
+
* @enum {string}
|
|
7
|
+
*/
|
|
8
|
+
export const DataType2DataViewWriters = {
|
|
9
|
+
[BinaryDataType.Uint8]: "setUint8",
|
|
10
|
+
[BinaryDataType.Uint16]: "setUint16",
|
|
11
|
+
[BinaryDataType.Uint32]: "setUint32",
|
|
12
|
+
[BinaryDataType.Uint64]: "setUint64",
|
|
13
|
+
|
|
14
|
+
[BinaryDataType.Int8]: "setInt8",
|
|
15
|
+
[BinaryDataType.Int16]: "setInt16",
|
|
16
|
+
[BinaryDataType.Int32]: "setInt32",
|
|
17
|
+
[BinaryDataType.Int64]: "setInt64",
|
|
18
|
+
|
|
19
|
+
[BinaryDataType.Float32]: "setFloat32",
|
|
20
|
+
[BinaryDataType.Float64]: "setFloat64"
|
|
21
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {BinaryDataType} from "../type/BinaryDataType";
|
|
2
|
+
|
|
3
|
+
interface IBinarySchema {
|
|
4
|
+
[k: string]: BinaryDataType
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export class DataViewStructAccessor<T extends IBinarySchema> {
|
|
9
|
+
|
|
10
|
+
constructor(type: T, little_endian?: boolean)
|
|
11
|
+
|
|
12
|
+
this: { [prop in keyof T]: number }
|
|
13
|
+
|
|
14
|
+
bind(view: DataView, offset: number): void
|
|
15
|
+
|
|
16
|
+
bind_by_index(view: DataView, index: number): void
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataViewStructAccessor.d.ts","sourceRoot":"","sources":["../../../../../src/core/binary/data_view/DataViewStructAccessor.js"],"names":[],"mappings":"AAOA;IAiBI;;;;OAIG;IACH,yCAFW,OAAO,EAiCjB;IApDD;;OAEG;IACH,OAFU,QAAQ,CAEZ;IAEN;;OAEG;IACH,SAFU,MAAM,CAEJ;IAEZ;;;OAGG;IACH,4BAFU,MAAM,CAEM;IAwCtB;;;;OAIG;IACH,gBAHW,QAAQ,eACR,MAAM,QAKhB;IAED;;;;OAIG;IACH,yBAHW,QAAQ,SACR,MAAM,QAKhB;CACJ"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { assert } from "../../assert.js";
|
|
2
|
+
import { FunctionCompiler } from "../../function/FunctionCompiler.js";
|
|
3
|
+
import { BinaryDataType } from "../type/BinaryDataType.js";
|
|
4
|
+
import { DataTypeByteSizes } from "../type/DataTypeByteSizes.js";
|
|
5
|
+
import { DataType2DataViewReaders } from "./DataType2DataViewReaders.js";
|
|
6
|
+
import { DataType2DataViewWriters } from "./DataType2DataViewWriters.js";
|
|
7
|
+
|
|
8
|
+
export class DataViewStructAccessor {
|
|
9
|
+
/**
|
|
10
|
+
* @type {DataView}
|
|
11
|
+
*/
|
|
12
|
+
$data;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @type {number}
|
|
16
|
+
*/
|
|
17
|
+
$offset = 0;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @readonly
|
|
21
|
+
* @type {number}
|
|
22
|
+
*/
|
|
23
|
+
$record_byte_size = 0;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* @param {Object<BinaryDataType>} schema
|
|
28
|
+
* @param {boolean} [little_endian]
|
|
29
|
+
*/
|
|
30
|
+
constructor(schema, little_endian = false) {
|
|
31
|
+
assert.defined(schema, 'schema');
|
|
32
|
+
assert.isBoolean(little_endian, 'little_endian');
|
|
33
|
+
|
|
34
|
+
const props = Object.keys(schema);
|
|
35
|
+
const property_count = props.length;
|
|
36
|
+
|
|
37
|
+
let offset = 0;
|
|
38
|
+
for (let i = 0; i < property_count; i++) {
|
|
39
|
+
const property = props[i];
|
|
40
|
+
const type = schema[property];
|
|
41
|
+
|
|
42
|
+
assert.enum(type, BinaryDataType, "type");
|
|
43
|
+
|
|
44
|
+
assert.arrayHasNo(["bind", "$data", "$offset", "this", "constructor"], property, `Illegal property name ${property}`);
|
|
45
|
+
|
|
46
|
+
//
|
|
47
|
+
Object.defineProperty(this, property, {
|
|
48
|
+
get: FunctionCompiler.INSTANCE.compile({
|
|
49
|
+
code: `return this.$data.${DataType2DataViewReaders[type]}(this.$offset + ${offset}, ${little_endian})`
|
|
50
|
+
}),
|
|
51
|
+
set: FunctionCompiler.INSTANCE.compile({
|
|
52
|
+
args: ["value"],
|
|
53
|
+
code: `this.$data.${DataType2DataViewWriters[type]}(this.$offset + ${offset}, value, ${little_endian})`
|
|
54
|
+
})
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
offset += DataTypeByteSizes[type];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
this.$record_byte_size = offset;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
*
|
|
65
|
+
* @param {DataView} data_view
|
|
66
|
+
* @param {number} byte_offset
|
|
67
|
+
*/
|
|
68
|
+
bind(data_view, byte_offset) {
|
|
69
|
+
this.$data = data_view;
|
|
70
|
+
this.$offset = byte_offset;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
*
|
|
75
|
+
* @param {DataView} data_view
|
|
76
|
+
* @param {number} index
|
|
77
|
+
*/
|
|
78
|
+
bind_by_index(data_view, index) {
|
|
79
|
+
this.$data = data_view;
|
|
80
|
+
this.$offset = index * this.$record_byte_size;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataViewStructAccessor.spec.d.ts","sourceRoot":"","sources":["../../../../../src/core/binary/data_view/DataViewStructAccessor.spec.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BinaryDataType } from "../type/BinaryDataType.js";
|
|
2
|
+
import { DataViewStructAccessor } from "./DataViewStructAccessor.js";
|
|
3
|
+
|
|
4
|
+
test("2 field schema", () => {
|
|
5
|
+
const accessor = new DataViewStructAccessor({
|
|
6
|
+
alice: BinaryDataType.Float32,
|
|
7
|
+
bob: BinaryDataType.Uint8
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
const buffer = new ArrayBuffer(1024);
|
|
11
|
+
const dataView = new DataView(buffer);
|
|
12
|
+
|
|
13
|
+
accessor.bind(dataView, 1);
|
|
14
|
+
|
|
15
|
+
accessor.alice = -3.7;
|
|
16
|
+
accessor.bob = 7;
|
|
17
|
+
|
|
18
|
+
expect(dataView.getFloat32(1)).toBeCloseTo(-3.7);
|
|
19
|
+
expect(dataView.getUint8(5)).toBe(7);
|
|
20
|
+
});
|
|
@@ -1,39 +1,3 @@
|
|
|
1
|
-
export type DataType2DataViewReaders = string;
|
|
2
|
-
export namespace DataType2DataViewReaders {
|
|
3
|
-
let uint8: string;
|
|
4
|
-
let uint16: string;
|
|
5
|
-
let uint32: string;
|
|
6
|
-
let uint64: string;
|
|
7
|
-
let int8: string;
|
|
8
|
-
let int16: string;
|
|
9
|
-
let int32: string;
|
|
10
|
-
let int64: string;
|
|
11
|
-
let float32: string;
|
|
12
|
-
let float64: string;
|
|
13
|
-
}
|
|
14
|
-
export type DataType2DataViewWriters = string;
|
|
15
|
-
export namespace DataType2DataViewWriters {
|
|
16
|
-
let uint8_1: string;
|
|
17
|
-
export { uint8_1 as uint8 };
|
|
18
|
-
let uint16_1: string;
|
|
19
|
-
export { uint16_1 as uint16 };
|
|
20
|
-
let uint32_1: string;
|
|
21
|
-
export { uint32_1 as uint32 };
|
|
22
|
-
let uint64_1: string;
|
|
23
|
-
export { uint64_1 as uint64 };
|
|
24
|
-
let int8_1: string;
|
|
25
|
-
export { int8_1 as int8 };
|
|
26
|
-
let int16_1: string;
|
|
27
|
-
export { int16_1 as int16 };
|
|
28
|
-
let int32_1: string;
|
|
29
|
-
export { int32_1 as int32 };
|
|
30
|
-
let int64_1: string;
|
|
31
|
-
export { int64_1 as int64 };
|
|
32
|
-
let float32_1: string;
|
|
33
|
-
export { float32_1 as float32 };
|
|
34
|
-
let float64_1: string;
|
|
35
|
-
export { float64_1 as float64 };
|
|
36
|
-
}
|
|
37
1
|
/**
|
|
38
2
|
* This is a schema class for binary data tables of class {@link RowFirstTable}
|
|
39
3
|
* @class
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RowFirstTableSpec.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/table/RowFirstTableSpec.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RowFirstTableSpec.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/table/RowFirstTableSpec.js"],"names":[],"mappings":"AA+HA;;;GAGG;AACH;IA6GI;;;;;OAKG;IACH,kBAJW,cAAc,EAAE,eAChB,UAAU,GACR,iBAAiB,CAgB7B;IAhID;;;;;OAKG;IACH,mBAJW,cAAc,EAAE,eAChB,UAAU,EAsEpB;IA9DG;;;OAGG;IACH,gBAFU,cAAc,EAAE,CAER;IAElB;;;OAGG;IACH,qBAFU,UAAU,CAEQ;IAE5B;;;OAGG;IACH,wBAFU,WAAW,CAEyB;IAc9C;;;OAGG;IACH,yBAFU,MAAM,CAEgB;IAEhC;;;OAGG;IACH,+BAFmB,QAAQ,QAAE,MAAM,QAAE,MAAM,EAAE,KAAG,IAAI,CAEA;IAEpD;;;OAGG;IACH,gCAFmB,QAAQ,QAAE,MAAM,QAAE,MAAM,EAAE,KAAG,IAAI,CAEC;IAIrD,mBAAsC;IACtC,mBAAsC;IAMtC;;;OAGG;IACH,8BAFU,OAAO,CAEc;IAGnC;;;OAGG;IACH,kBAFY,MAAM,CAIjB;IAED;;;OAGG;IACH,QAFY,MAAM,CAQjB;IAED;;;;OAIG;IACH,cAHW,iBAAiB,GACf,OAAO,CAQnB;CAuBJ;+BA7P8B,qCAAqC;2BADzC,4BAA4B"}
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
* @enum {string}
|
|
4
4
|
*/
|
|
5
5
|
import { assert } from "../../assert.js";
|
|
6
|
+
import { DataType2DataViewReaders } from "../../binary/data_view/DataType2DataViewReaders.js";
|
|
7
|
+
import { DataType2DataViewWriters } from "../../binary/data_view/DataType2DataViewWriters.js";
|
|
6
8
|
import { EndianType } from "../../binary/EndianType.js";
|
|
7
9
|
import { BinaryDataType } from "../../binary/type/BinaryDataType.js";
|
|
8
10
|
import { DataTypeByteSizes } from "../../binary/type/DataTypeByteSizes.js";
|
|
@@ -12,46 +14,6 @@ import { computeStringHash } from "../../primitives/strings/computeStringHash.js
|
|
|
12
14
|
import { computeHashArray } from "../array/computeHashArray.js";
|
|
13
15
|
import { isArrayEqualStrict } from "../array/isArrayEqualStrict.js";
|
|
14
16
|
|
|
15
|
-
/**
|
|
16
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView
|
|
17
|
-
* @readonly
|
|
18
|
-
* @enum {string}
|
|
19
|
-
*/
|
|
20
|
-
export const DataType2DataViewReaders = {
|
|
21
|
-
[BinaryDataType.Uint8]: "getUint8",
|
|
22
|
-
[BinaryDataType.Uint16]: "getUint16",
|
|
23
|
-
[BinaryDataType.Uint32]: "getUint32",
|
|
24
|
-
[BinaryDataType.Uint64]: "getUint64",
|
|
25
|
-
|
|
26
|
-
[BinaryDataType.Int8]: "getInt8",
|
|
27
|
-
[BinaryDataType.Int16]: "getInt16",
|
|
28
|
-
[BinaryDataType.Int32]: "getInt32",
|
|
29
|
-
[BinaryDataType.Int64]: "getInt64",
|
|
30
|
-
|
|
31
|
-
[BinaryDataType.Float32]: "getFloat32",
|
|
32
|
-
[BinaryDataType.Float64]: "getFloat64"
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView
|
|
37
|
-
* @readonly
|
|
38
|
-
* @enum {string}
|
|
39
|
-
*/
|
|
40
|
-
export const DataType2DataViewWriters = {
|
|
41
|
-
[BinaryDataType.Uint8]: "setUint8",
|
|
42
|
-
[BinaryDataType.Uint16]: "setUint16",
|
|
43
|
-
[BinaryDataType.Uint32]: "setUint32",
|
|
44
|
-
[BinaryDataType.Uint64]: "setUint64",
|
|
45
|
-
|
|
46
|
-
[BinaryDataType.Int8]: "setInt8",
|
|
47
|
-
[BinaryDataType.Int16]: "setInt16",
|
|
48
|
-
[BinaryDataType.Int32]: "setInt32",
|
|
49
|
-
[BinaryDataType.Int64]: "setInt64",
|
|
50
|
-
|
|
51
|
-
[BinaryDataType.Float32]: "setFloat32",
|
|
52
|
-
[BinaryDataType.Float64]: "setFloat64"
|
|
53
|
-
};
|
|
54
|
-
|
|
55
17
|
/**
|
|
56
18
|
*
|
|
57
19
|
* @param {BinaryDataType[]} types
|
|
@@ -134,7 +96,7 @@ function genRowWriter(types, endianType = EndianType.BigEndian) {
|
|
|
134
96
|
* @param {EndianType} [endianType]
|
|
135
97
|
* @returns {function(data_view:DataView, byte_offset:number, value:number):void}
|
|
136
98
|
*/
|
|
137
|
-
function
|
|
99
|
+
function compileDataViewValueWriter(type, offset, endianType = EndianType.BigEndian) {
|
|
138
100
|
const writeMethod = DataType2DataViewWriters[type];
|
|
139
101
|
|
|
140
102
|
const littleEndianFlag = endianType === EndianType.BigEndian ? 'false' : 'true';
|
|
@@ -152,7 +114,7 @@ function genCellWriter(type, offset, endianType = EndianType.BigEndian) {
|
|
|
152
114
|
* @param {EndianType} [endianType]
|
|
153
115
|
* @returns {function(data_view:DataView, byte_offset:number):number}
|
|
154
116
|
*/
|
|
155
|
-
function
|
|
117
|
+
function compileDataViewValueReader(type, offset, endianType = EndianType.BigEndian) {
|
|
156
118
|
const readMethod = DataType2DataViewReaders[type];
|
|
157
119
|
|
|
158
120
|
const littleEndianFlag = endianType === EndianType.BigEndian ? 'false' : 'true';
|
|
@@ -233,8 +195,8 @@ export class RowFirstTableSpec {
|
|
|
233
195
|
this.cellReaders = new Array(numTypes);
|
|
234
196
|
|
|
235
197
|
for (let i = 0; i < numTypes; i++) {
|
|
236
|
-
this.cellReaders[i] =
|
|
237
|
-
this.cellWriters[i] =
|
|
198
|
+
this.cellReaders[i] = compileDataViewValueReader(types[i], this.columnOffsets[i], endianType);
|
|
199
|
+
this.cellWriters[i] = compileDataViewValueWriter(types[i], this.columnOffsets[i], endianType);
|
|
238
200
|
}
|
|
239
201
|
/**
|
|
240
202
|
* @readonly
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"objectDeepEquals.d.ts","sourceRoot":"","sources":["../../../../../src/core/model/object/objectDeepEquals.js"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,oDAFa,OAAO,
|
|
1
|
+
{"version":3,"file":"objectDeepEquals.d.ts","sourceRoot":"","sources":["../../../../../src/core/model/object/objectDeepEquals.js"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,oDAFa,OAAO,CAuDnB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isArraysEqualWithComparator } from "../../collection/array/isArraysEqualWithComparator.js";
|
|
2
1
|
import { isArrayEqualStrict } from "../../collection/array/isArrayEqualStrict.js";
|
|
2
|
+
import { isArraysEqualWithComparator } from "../../collection/array/isArraysEqualWithComparator.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @template A,B
|
|
@@ -8,6 +8,11 @@ import { isArrayEqualStrict } from "../../collection/array/isArrayEqualStrict.js
|
|
|
8
8
|
* @returns {boolean}
|
|
9
9
|
*/
|
|
10
10
|
export function objectDeepEquals(a, b) {
|
|
11
|
+
if (a === b) {
|
|
12
|
+
// identity shortcut
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
|
|
11
16
|
const tA = typeof a;
|
|
12
17
|
const tB = typeof b;
|
|
13
18
|
|
|
@@ -15,7 +20,16 @@ export function objectDeepEquals(a, b) {
|
|
|
15
20
|
return false;
|
|
16
21
|
}
|
|
17
22
|
|
|
18
|
-
if (tA
|
|
23
|
+
if (tA !== "object") {
|
|
24
|
+
// primitive types, identity equality already checked
|
|
25
|
+
return false;
|
|
26
|
+
} else {
|
|
27
|
+
|
|
28
|
+
if (a === null || b === null) {
|
|
29
|
+
// we know that A and B are not the same, so if one of them is a null - there is no possible equality
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
|
|
19
33
|
if (Array.isArray(a)) {
|
|
20
34
|
// special fast path for arrays
|
|
21
35
|
if (!Array.isArray(b)) {
|
|
@@ -45,7 +59,5 @@ export function objectDeepEquals(a, b) {
|
|
|
45
59
|
|
|
46
60
|
return true;
|
|
47
61
|
|
|
48
|
-
} else {
|
|
49
|
-
return a === b;
|
|
50
62
|
}
|
|
51
63
|
}
|
|
@@ -12,3 +12,43 @@ test('objectDeepEquals', () => {
|
|
|
12
12
|
|
|
13
13
|
expect(objectDeepEquals({ a: 1 }, { a: 1, b: "cat" })).toBe(false);
|
|
14
14
|
});
|
|
15
|
+
|
|
16
|
+
test("null values", () => {
|
|
17
|
+
expect(objectDeepEquals(null, null)).toBe(true);
|
|
18
|
+
expect(objectDeepEquals(null, {})).toBe(false);
|
|
19
|
+
expect(objectDeepEquals({}, null)).toBe(false);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test("same-type primitives", () => {
|
|
23
|
+
expect(objectDeepEquals(1, 1)).toBe(true);
|
|
24
|
+
expect(objectDeepEquals(-1, 1)).toBe(false);
|
|
25
|
+
expect(objectDeepEquals(-1, -1)).toBe(true);
|
|
26
|
+
expect(objectDeepEquals(-1, -3)).toBe(false);
|
|
27
|
+
|
|
28
|
+
expect(objectDeepEquals("cat", "cat")).toBe(true);
|
|
29
|
+
expect(objectDeepEquals("cat", "")).toBe(false);
|
|
30
|
+
expect(objectDeepEquals("", "cat")).toBe(false);
|
|
31
|
+
expect(objectDeepEquals("sat", "cat")).toBe(false);
|
|
32
|
+
expect(objectDeepEquals("cat", "sat")).toBe(false);
|
|
33
|
+
|
|
34
|
+
expect(objectDeepEquals(true, false)).toBe(false);
|
|
35
|
+
expect(objectDeepEquals(false, true)).toBe(false);
|
|
36
|
+
expect(objectDeepEquals(true, true)).toBe(true);
|
|
37
|
+
expect(objectDeepEquals(false, false)).toBe(true);
|
|
38
|
+
|
|
39
|
+
expect(objectDeepEquals(undefined, undefined)).toBe(true);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test("mixed primitives", () => {
|
|
43
|
+
expect(objectDeepEquals(1, undefined)).toBe(false);
|
|
44
|
+
expect(objectDeepEquals(undefined, 1)).toBe(false);
|
|
45
|
+
|
|
46
|
+
expect(objectDeepEquals("cat", 1)).toBe(false);
|
|
47
|
+
expect(objectDeepEquals(1, "cat")).toBe(false);
|
|
48
|
+
|
|
49
|
+
expect(objectDeepEquals(1, true)).toBe(false);
|
|
50
|
+
expect(objectDeepEquals(true, 1)).toBe(false);
|
|
51
|
+
|
|
52
|
+
expect(objectDeepEquals("cat", undefined)).toBe(false);
|
|
53
|
+
expect(objectDeepEquals(undefined, "cat")).toBe(false);
|
|
54
|
+
});
|