@rotu/structview 0.11.0 → 0.11.1
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/README.md +2 -2
- package/esm/core.d.ts +1 -0
- package/esm/core.d.ts.map +1 -1
- package/esm/core.js +5 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,8 +29,8 @@ import {
|
|
|
29
29
|
u8,
|
|
30
30
|
} from "@rotu/structview"
|
|
31
31
|
|
|
32
|
-
// defineStruct returns a new class, which can be extended with custom getters, setters, and methods
|
|
33
|
-
//
|
|
32
|
+
// defineStruct returns a new class, which can be extended with custom getters, setters, and methods.
|
|
33
|
+
// It's recommended to always extend even if you have no additional members, so your class has a name and so the declaration is hoisted.
|
|
34
34
|
class Version extends defineStruct({
|
|
35
35
|
major: u8(0),
|
|
36
36
|
minor: u8(1),
|
package/esm/core.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export declare class Struct {
|
|
|
26
26
|
[dataViewSymbol]: DataView;
|
|
27
27
|
get [Symbol.toStringTag](): string;
|
|
28
28
|
static toDataView(o: Struct): DataView;
|
|
29
|
+
static [Symbol.hasInstance](instance: unknown): boolean;
|
|
29
30
|
/**
|
|
30
31
|
* Create a new Struct
|
|
31
32
|
* @param arg options for creating the struct.
|
package/esm/core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,SAAS,EAET,cAAc,EACd,iBAAiB,EACjB,sBAAsB,EACvB,MAAM,YAAY,CAAA;AAEnB,eAAO,MAAM,cAAc,eAAgC,CAAA;AAE3D;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,GAAG,QAAQ,CAM1D;AACD;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,SAAS,EACjB,KAAK,CAAC,EAAE,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,CAAC,KAAK,CAAC,KAAK,SAAS,qBAAqB,EACpE,mBAAmB,EAAE,KAAK,GACzB,sBAAsB,CAAC,OAAO,MAAM,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC,CAmB9D;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,SAAS,MAAM,EAC7C,YAAY,EAAE;IACZ,kDAAkD;IAClD,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC,IAAI,CAAC,CAAA;IACxC,6DAA6D;IAC7D,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,oIAAoI;IACpI,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CACzB,GACA,iBAAiB,CAClB;IACE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACzB,GAAG,QAAQ,CAAC,IAAI,CAAC,CACnB,CAqDA"}
|
package/esm/core.js
CHANGED
|
@@ -47,6 +47,11 @@ export class Struct {
|
|
|
47
47
|
static toDataView(o) {
|
|
48
48
|
return o[dataViewSymbol];
|
|
49
49
|
}
|
|
50
|
+
static [Symbol.hasInstance](instance) {
|
|
51
|
+
return (typeof instance === "object" &&
|
|
52
|
+
instance !== null &&
|
|
53
|
+
dataViewSymbol in instance);
|
|
54
|
+
}
|
|
50
55
|
/**
|
|
51
56
|
* Create a new Struct
|
|
52
57
|
* @param arg options for creating the struct.
|