@xylabs/assert 2.12.7 → 2.12.9

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.
@@ -0,0 +1,16 @@
1
+ export type AssertExMessageFunc<T> = (value?: T | null) => string;
2
+ export type AssertExErrorFunc<T, R extends Error> = (value?: T | null) => R;
3
+ /**
4
+ *
5
+ * Intended for simple null/undefined checks for variables
6
+ *
7
+ * @param expr - Expression to be evaluated for truthiness
8
+ * @param message - Message in Error if expression is false, may be a function that returns a string
9
+ * @throws AssertExError
10
+ * @returns Value of expression
11
+ */
12
+ declare function assertEx<T>(expr?: T | null, message?: string): T;
13
+ declare function assertEx<T>(expr?: T | null, messageFunc?: AssertExMessageFunc<T>): T;
14
+ declare function assertEx<T, R extends Error>(expr?: T | null, errorFunc?: AssertExErrorFunc<T, R>): T;
15
+ export { assertEx };
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,IAAI,KAAK,MAAM,CAAA;AACjE,MAAM,MAAM,iBAAiB,CAAC,CAAC,EAAE,CAAC,SAAS,KAAK,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,IAAI,KAAK,CAAC,CAAA;AAE3E;;;;;;;;GAQG;AACH,iBAAS,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,CAAC,CAAA;AAC1D,iBAAS,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,WAAW,CAAC,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AAC9E,iBAAS,QAAQ,CAAC,CAAC,EAAE,CAAC,SAAS,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,SAAS,CAAC,EAAE,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAA;AAW9F,OAAO,EAAE,QAAQ,EAAE,CAAA"}
@@ -0,0 +1,16 @@
1
+ export type AssertExMessageFunc<T> = (value?: T | null) => string;
2
+ export type AssertExErrorFunc<T, R extends Error> = (value?: T | null) => R;
3
+ /**
4
+ *
5
+ * Intended for simple null/undefined checks for variables
6
+ *
7
+ * @param expr - Expression to be evaluated for truthiness
8
+ * @param message - Message in Error if expression is false, may be a function that returns a string
9
+ * @throws AssertExError
10
+ * @returns Value of expression
11
+ */
12
+ declare function assertEx<T>(expr?: T | null, message?: string): T;
13
+ declare function assertEx<T>(expr?: T | null, messageFunc?: AssertExMessageFunc<T>): T;
14
+ declare function assertEx<T, R extends Error>(expr?: T | null, errorFunc?: AssertExErrorFunc<T, R>): T;
15
+ export { assertEx };
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,IAAI,KAAK,MAAM,CAAA;AACjE,MAAM,MAAM,iBAAiB,CAAC,CAAC,EAAE,CAAC,SAAS,KAAK,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,IAAI,KAAK,CAAC,CAAA;AAE3E;;;;;;;;GAQG;AACH,iBAAS,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,CAAC,CAAA;AAC1D,iBAAS,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,WAAW,CAAC,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AAC9E,iBAAS,QAAQ,CAAC,CAAC,EAAE,CAAC,SAAS,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,SAAS,CAAC,EAAE,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAA;AAW9F,OAAO,EAAE,QAAQ,EAAE,CAAA"}
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "exports": {
16
16
  ".": {
17
17
  "require": {
18
- "types": "./dist/node/index.d.ts",
18
+ "types": "./dist/node/index.d.cts",
19
19
  "default": "./dist/node/index.cjs"
20
20
  },
21
21
  "import": {
@@ -32,8 +32,8 @@
32
32
  "types": "./dist/node/index.d.ts",
33
33
  "module": "./dist/node/index.js",
34
34
  "devDependencies": {
35
- "@xylabs/ts-scripts-yarn3": "^3.0.74",
36
- "@xylabs/tsconfig": "^3.0.74",
35
+ "@xylabs/ts-scripts-yarn3": "^3.0.75",
36
+ "@xylabs/tsconfig": "^3.0.75",
37
37
  "typescript": "^5.2.2"
38
38
  },
39
39
  "homepage": "https://xylabs.com",
@@ -51,6 +51,6 @@
51
51
  "url": "https://github.com/xylabs/sdk-js.git"
52
52
  },
53
53
  "sideEffects": false,
54
- "version": "2.12.7",
54
+ "version": "2.12.9",
55
55
  "type": "module"
56
56
  }