@kensio/smartass 0.1.6 → 0.1.8

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,8 @@
1
+ import type { UUID } from "node:crypto";
2
+ type UuidV4 = UUID & `${string}-${string}-4${string}-${"8" | "9" | "a" | "b"}${string}-${string}`;
3
+ /**
4
+ * Assert that a value is a UUID v4 string, with type-narrowing.
5
+ */
6
+ export declare function assertUuidV4(value: unknown, message?: string): asserts value is UuidV4;
7
+ export {};
8
+ //# sourceMappingURL=uuid-v4.assert.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uuid-v4.assert.d.ts","sourceRoot":"","sources":["../../../src/assert/uuid/uuid-v4.assert.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAOxC,KAAK,MAAM,GAAG,IAAI,GAChB,GAAG,MAAM,IAAI,MAAM,KAAK,MAAM,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;AAE/E;;GAEG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,OAAO,EACd,OAAO,SAAoD,GAC1D,OAAO,CAAC,KAAK,IAAI,MAAM,CAIzB"}
@@ -0,0 +1,12 @@
1
+ import { AssertionError } from "../../assertion-error.js";
2
+ import { desc } from "../../describe/describe.js";
3
+ const uuidV4Regex = /^[\da-f]{8}-[\da-f]{4}-4[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i;
4
+ /**
5
+ * Assert that a value is a UUID v4 string, with type-narrowing.
6
+ */
7
+ export function assertUuidV4(value, message = `Expected ${desc(value)} to be a UUID v4 string.`) {
8
+ if (typeof value !== "string" || !uuidV4Regex.test(value)) {
9
+ throw new AssertionError(message, value, "UUID v4 string");
10
+ }
11
+ }
12
+ //# sourceMappingURL=uuid-v4.assert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uuid-v4.assert.js","sourceRoot":"","sources":["../../../src/assert/uuid/uuid-v4.assert.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAElD,MAAM,WAAW,GACf,mEAAmE,CAAC;AAKtE;;GAEG;AACH,MAAM,UAAU,YAAY,CAC1B,KAAc,EACd,OAAO,GAAG,YAAY,IAAI,CAAC,KAAK,CAAC,0BAA0B;IAE3D,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1D,MAAM,IAAI,cAAc,CAAC,OAAO,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC;IAC7D,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "author": "Kensio Software",
5
5
  "repository": "https://github.com/KensioSoftware/smartass",
6
6
  "license": "AGPL-3.0",
7
- "version": "0.1.6",
7
+ "version": "0.1.8",
8
8
  "type": "module",
9
9
  "main": "./dist/index.js",
10
10
  "types": "./dist/index.d.ts",
@@ -33,21 +33,21 @@
33
33
  "devDependencies": {
34
34
  "@eslint/js": "^10.0.1",
35
35
  "@types/eslint-plugin-security": "^3.0.1",
36
- "@types/node": "^25.4.0",
37
- "@vitest/coverage-v8": "^4.0.18",
38
- "@vitest/eslint-plugin": "^1.6.10",
39
- "eslint": "^10.0.3",
36
+ "@types/node": "^25.9.1",
37
+ "@vitest/coverage-v8": "^4.1.7",
38
+ "@vitest/eslint-plugin": "^1.6.18",
39
+ "eslint": "^10.4.0",
40
40
  "eslint-config-prettier": "^10.1.8",
41
- "eslint-plugin-jsdoc": "^62.7.1",
41
+ "eslint-plugin-jsdoc": "^62.9.0",
42
42
  "eslint-plugin-no-secrets": "^2.3.3",
43
43
  "eslint-plugin-security": "^4.0.0",
44
44
  "eslint-plugin-unicorn": "^63.0.0",
45
- "globals": "^17.4.0",
46
- "jiti": "^2.6.1",
47
- "prettier": "^3.8.1",
45
+ "globals": "^17.6.0",
46
+ "jiti": "^2.7.0",
47
+ "prettier": "^3.8.3",
48
48
  "typescript": "^5.9.3",
49
- "typescript-eslint": "^8.57.0",
50
- "vitest": "^4.0.18"
49
+ "typescript-eslint": "^8.60.0",
50
+ "vitest": "^4.1.7"
51
51
  },
52
52
  "scripts": {
53
53
  "build": "tsc -p tsconfig.build.json",
@@ -1,5 +0,0 @@
1
- /**
2
- * Assertion function a non-empty array, with type-narrowing.
3
- */
4
- export declare function assertNotEmpty<T>(value: readonly T[] | undefined | null, message?: string): asserts value is readonly [T, ...T[]];
5
- //# sourceMappingURL=not-empty.assert.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"not-empty.assert.d.ts","sourceRoot":"","sources":["../../../src/assert/not-empty/not-empty.assert.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAC9B,KAAK,EAAE,SAAS,CAAC,EAAE,GAAG,SAAS,GAAG,IAAI,EACtC,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,KAAK,IAAI,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAUvC"}
@@ -1,12 +0,0 @@
1
- import { assertNonNullable } from "../non-nullable/non-nullable.assert.js";
2
- import { AssertionError } from "../../assertion-error.js";
3
- /**
4
- * Assertion function a non-empty array, with type-narrowing.
5
- */
6
- export function assertNotEmpty(value, message) {
7
- assertNonNullable(value, message);
8
- if (value.length === 0) {
9
- throw new AssertionError(message ?? `Expected array not to be empty, but it was empty.`, value, ["..."]);
10
- }
11
- }
12
- //# sourceMappingURL=not-empty.assert.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"not-empty.assert.js","sourceRoot":"","sources":["../../../src/assert/not-empty/not-empty.assert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D;;GAEG;AACH,MAAM,UAAU,cAAc,CAC5B,KAAsC,EACtC,OAAgB;IAEhB,iBAAiB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAElC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,cAAc,CACtB,OAAO,IAAI,mDAAmD,EAC9D,KAAK,EACL,CAAC,KAAK,CAAC,CACR,CAAC;IACJ,CAAC;AACH,CAAC"}