@mtkruto/node 0.70.1 → 0.71.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 +3 -4
- package/esm/0_deps.d.ts +2 -2
- package/esm/0_deps.d.ts.map +1 -1
- package/esm/0_deps.js +2 -2
- package/esm/client/0_html.d.ts +2 -1
- package/esm/client/0_html.d.ts.map +1 -1
- package/esm/client/0_html.js +420 -70
- package/esm/client/0_html_test.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.14/instance_of.d.ts +23 -0
- package/esm/deps/jsr.io/@std/assert/1.0.14/instance_of.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.14/instance_of.js +52 -0
- package/{script/deps/jsr.io/@std/streams/1.0.11 → esm/deps/jsr.io/@std/streams/1.0.12}/to_array_buffer.d.ts.map +1 -1
- package/package.json +1 -2
- package/script/0_deps.d.ts +2 -2
- package/script/0_deps.d.ts.map +1 -1
- package/script/0_deps.js +4 -4
- package/script/client/0_html.d.ts +2 -1
- package/script/client/0_html.d.ts.map +1 -1
- package/script/client/0_html.js +421 -70
- package/script/client/0_html_test.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.14/instance_of.d.ts +23 -0
- package/script/deps/jsr.io/@std/assert/1.0.14/instance_of.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.14/instance_of.js +55 -0
- package/{esm/deps/jsr.io/@std/streams/1.0.11 → script/deps/jsr.io/@std/streams/1.0.12}/to_array_buffer.d.ts.map +1 -1
- /package/esm/deps/jsr.io/@std/streams/{1.0.11 → 1.0.12}/to_array_buffer.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/streams/{1.0.11 → 1.0.12}/to_array_buffer.js +0 -0
- /package/script/deps/jsr.io/@std/streams/{1.0.11 → 1.0.12}/to_array_buffer.d.ts +0 -0
- /package/script/deps/jsr.io/@std/streams/{1.0.11 → 1.0.12}/to_array_buffer.js +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Any constructor */
|
|
2
|
+
export type AnyConstructor = new (...args: any[]) => any;
|
|
3
|
+
/** Gets constructor type */
|
|
4
|
+
export type GetConstructorType<T extends AnyConstructor> = InstanceType<T>;
|
|
5
|
+
/**
|
|
6
|
+
* Make an assertion that `obj` is an instance of `type`.
|
|
7
|
+
* If not then throw.
|
|
8
|
+
*
|
|
9
|
+
* @example Usage
|
|
10
|
+
* ```ts ignore
|
|
11
|
+
* import { assertInstanceOf } from "@std/assert";
|
|
12
|
+
*
|
|
13
|
+
* assertInstanceOf(new Date(), Date); // Doesn't throw
|
|
14
|
+
* assertInstanceOf(new Date(), Number); // Throws
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @typeParam T The expected type of the object.
|
|
18
|
+
* @param actual The object to check.
|
|
19
|
+
* @param expectedType The expected class constructor.
|
|
20
|
+
* @param msg The optional message to display if the assertion fails.
|
|
21
|
+
*/
|
|
22
|
+
export declare function assertInstanceOf<T extends abstract new (...args: any[]) => any>(actual: unknown, expectedType: T, msg?: string): asserts actual is InstanceType<T>;
|
|
23
|
+
//# sourceMappingURL=instance_of.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instance_of.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/assert/1.0.14/instance_of.ts"],"names":[],"mappings":"AAIA,sBAAsB;AAEtB,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;AACzD,4BAA4B;AAC5B,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,cAAc,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC;AAE3E;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAE9B,CAAC,SAAS,QAAQ,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAE9C,MAAM,EAAE,OAAO,EACf,YAAY,EAAE,CAAC,EACf,GAAG,SAAK,GACP,OAAO,CAAC,MAAM,IAAI,YAAY,CAAC,CAAC,CAAC,CA6BnC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.assertInstanceOf = assertInstanceOf;
|
|
4
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
5
|
+
// This module is browser compatible.
|
|
6
|
+
const assertion_error_js_1 = require("./assertion_error.js");
|
|
7
|
+
/**
|
|
8
|
+
* Make an assertion that `obj` is an instance of `type`.
|
|
9
|
+
* If not then throw.
|
|
10
|
+
*
|
|
11
|
+
* @example Usage
|
|
12
|
+
* ```ts ignore
|
|
13
|
+
* import { assertInstanceOf } from "@std/assert";
|
|
14
|
+
*
|
|
15
|
+
* assertInstanceOf(new Date(), Date); // Doesn't throw
|
|
16
|
+
* assertInstanceOf(new Date(), Number); // Throws
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @typeParam T The expected type of the object.
|
|
20
|
+
* @param actual The object to check.
|
|
21
|
+
* @param expectedType The expected class constructor.
|
|
22
|
+
* @param msg The optional message to display if the assertion fails.
|
|
23
|
+
*/
|
|
24
|
+
function assertInstanceOf(actual, expectedType, msg = "") {
|
|
25
|
+
if (actual instanceof expectedType)
|
|
26
|
+
return;
|
|
27
|
+
const msgSuffix = msg ? `: ${msg}` : ".";
|
|
28
|
+
const expectedTypeStr = expectedType.name;
|
|
29
|
+
let actualTypeStr = "";
|
|
30
|
+
if (actual === null) {
|
|
31
|
+
actualTypeStr = "null";
|
|
32
|
+
}
|
|
33
|
+
else if (actual === undefined) {
|
|
34
|
+
actualTypeStr = "undefined";
|
|
35
|
+
}
|
|
36
|
+
else if (typeof actual === "object") {
|
|
37
|
+
actualTypeStr = actual.constructor?.name ?? "Object";
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
actualTypeStr = typeof actual;
|
|
41
|
+
}
|
|
42
|
+
if (expectedTypeStr === actualTypeStr) {
|
|
43
|
+
msg =
|
|
44
|
+
`Expected object to be an instance of "${expectedTypeStr}"${msgSuffix}`;
|
|
45
|
+
}
|
|
46
|
+
else if (actualTypeStr === "function") {
|
|
47
|
+
msg =
|
|
48
|
+
`Expected object to be an instance of "${expectedTypeStr}" but was not an instanced object${msgSuffix}`;
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
msg =
|
|
52
|
+
`Expected object to be an instance of "${expectedTypeStr}" but was "${actualTypeStr}"${msgSuffix}`;
|
|
53
|
+
}
|
|
54
|
+
throw new assertion_error_js_1.AssertionError(msg);
|
|
55
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to_array_buffer.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/streams/1.0.
|
|
1
|
+
{"version":3,"file":"to_array_buffer.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/streams/1.0.12/to_array_buffer.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,aAAa,CACjC,cAAc,EAAE,cAAc,CAAC,UAAU,CAAC,GACzC,OAAO,CAAC,WAAW,CAAC,CAetB"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|