@ucdjs/utils 0.2.1-beta.7 → 0.2.1-beta.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.
package/README.md CHANGED
@@ -2,9 +2,10 @@
2
2
 
3
3
  [![npm version][npm-version-src]][npm-version-href]
4
4
  [![npm downloads][npm-downloads-src]][npm-downloads-href]
5
- [![codecov][codecov-src]][codecov-href]
6
5
 
7
- A collection of utility functions and filesystem bridge implementations for the UCD project.
6
+ Curated stable utilities for UCD.js consumers.
7
+
8
+ This package exposes a small, consumer-safe facade over selected helpers used across the UCD.js ecosystem. More volatile implementation details remain in `@ucdjs-internal/shared`.
8
9
 
9
10
  ## Installation
10
11
 
@@ -12,58 +13,52 @@ A collection of utility functions and filesystem bridge implementations for the
12
13
  npm install @ucdjs/utils
13
14
  ```
14
15
 
15
- ## Usage
16
-
17
- ### Path Filtering
16
+ ## Included utility groups
18
17
 
19
- Creates a filter function that checks if a file path should be included or excluded based on glob patterns.
18
+ - Unicode version helpers
19
+ - API error guards
20
20
 
21
- ```typescript
22
- import { createPathFilter } from "@ucdjs/utils";
21
+ ## Usage
23
22
 
24
- const filter = createPathFilter(["*.txt", "!*Test*"]);
25
- filter("Data.txt"); // true
26
- filter("DataTest.txt"); // false
27
- ```
23
+ ### Unicode version helpers
28
24
 
29
- #### PathFilter Methods
25
+ ```ts
26
+ import {
27
+ getLatestStableUnicodeVersion,
28
+ isStableUnicodeVersion,
29
+ isValidUnicodeVersion,
30
+ } from "@ucdjs/utils";
30
31
 
31
- The `PathFilter` object provides additional methods:
32
+ isValidUnicodeVersion("16.0.0"); // true
33
+ isStableUnicodeVersion("16.0.0"); // true
34
+ getLatestStableUnicodeVersion(); // e.g. "16.0.0"
35
+ ```
32
36
 
33
- ```typescript
34
- const filter = createPathFilter(["*.js"]);
37
+ ### API error guard
35
38
 
36
- // Extend with additional patterns
37
- filter.extend(["*.ts", "!*.test.*"]);
39
+ ```ts
40
+ import { isApiError } from "@ucdjs/utils";
38
41
 
39
- // Get current patterns
40
- const patterns = filter.patterns(); // ['*.js', '*.ts', '!*.test.*']
42
+ const result: unknown = await fetch("/api").then((r) => r.json());
41
43
 
42
- // Use with extra filters temporarily
43
- filter("app.js", ["!src/**"]); // Apply extra exclusions
44
+ if (isApiError(result)) {
45
+ console.error(result.message);
46
+ }
44
47
  ```
45
48
 
46
- ### Preconfigured Filters
49
+ ## Relationship
47
50
 
48
- Pre-defined filter patterns for common exclusions:
51
+ ```text
52
+ consumer code
53
+ -> @ucdjs/utils
54
+ -> curated public helpers
49
55
 
50
- ```typescript
51
- import { createPathFilter, PRECONFIGURED_FILTERS } from "@ucdjs/utils";
52
-
53
- const filter = createPathFilter([
54
- "*.txt",
55
- PRECONFIGURED_FILTERS.EXCLUDE_TEST_FILES,
56
- PRECONFIGURED_FILTERS.EXCLUDE_README_FILES,
57
- PRECONFIGURED_FILTERS.EXCLUDE_HTML_FILES
58
- ]);
56
+ internal workspace code
57
+ -> @ucdjs-internal/shared
58
+ -> volatile/internal helper families
59
59
  ```
60
60
 
61
- Available filters:
62
- - `EXCLUDE_TEST_FILES`: Excludes files containing "Test" in their name
63
- - `EXCLUDE_README_FILES`: Excludes ReadMe.txt files
64
- - `EXCLUDE_HTML_FILES`: Excludes all HTML files
65
-
66
- ## 📄 License
61
+ ## License
67
62
 
68
63
  Published under [MIT License](./LICENSE).
69
64
 
@@ -71,5 +66,3 @@ Published under [MIT License](./LICENSE).
71
66
  [npm-version-href]: https://npmjs.com/package/@ucdjs/utils
72
67
  [npm-downloads-src]: https://img.shields.io/npm/dm/@ucdjs/utils?style=flat&colorA=18181B&colorB=4169E1
73
68
  [npm-downloads-href]: https://npmjs.com/package/@ucdjs/utils
74
- [codecov-src]: https://img.shields.io/codecov/c/gh/ucdjs/ucd?style=flat&colorA=18181B&colorB=4169E1
75
- [codecov-href]: https://codecov.io/gh/ucdjs/ucd
package/dist/index.d.mts CHANGED
@@ -1,6 +1,2 @@
1
- import { PRECONFIGURED_FILTERS, PathFilter, PathFilterOptions, createPathFilter, filterTreeStructure } from "@ucdjs-internal/shared";
2
-
3
- //#region src/index.d.ts
4
- declare function internal_bingbong(): void;
5
- //#endregion
6
- export { PRECONFIGURED_FILTERS, type PathFilter, type PathFilterOptions, createPathFilter, filterTreeStructure, internal_bingbong };
1
+ import { getLatestDraftUnicodeVersion, getLatestStableUnicodeVersion, isApiError, isDraftUnicodeVersion, isStableUnicodeVersion, isValidUnicodeVersion } from "@ucdjs-internal/shared";
2
+ export { getLatestDraftUnicodeVersion, getLatestStableUnicodeVersion, isApiError, isDraftUnicodeVersion, isStableUnicodeVersion, isValidUnicodeVersion };
package/dist/index.mjs CHANGED
@@ -1,9 +1,2 @@
1
- import { PRECONFIGURED_FILTERS, createPathFilter, filterTreeStructure } from "@ucdjs-internal/shared";
2
-
3
- //#region src/index.ts
4
- function internal_bingbong() {
5
- console.log("Bing Bong");
6
- }
7
-
8
- //#endregion
9
- export { PRECONFIGURED_FILTERS, createPathFilter, filterTreeStructure, internal_bingbong };
1
+ import { getLatestDraftUnicodeVersion, getLatestStableUnicodeVersion, isApiError, isDraftUnicodeVersion, isStableUnicodeVersion, isValidUnicodeVersion } from "@ucdjs-internal/shared";
2
+ export { getLatestDraftUnicodeVersion, getLatestStableUnicodeVersion, isApiError, isDraftUnicodeVersion, isStableUnicodeVersion, isValidUnicodeVersion };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ucdjs/utils",
3
- "version": "0.2.1-beta.7",
3
+ "version": "0.2.1-beta.8",
4
4
  "type": "module",
5
5
  "author": {
6
6
  "name": "Lucas Nørgård",
@@ -29,15 +29,15 @@
29
29
  "node": ">=24.13"
30
30
  },
31
31
  "dependencies": {
32
- "@ucdjs-internal/shared": "0.1.1-beta.7"
32
+ "@ucdjs-internal/shared": "0.1.1-beta.8"
33
33
  },
34
34
  "devDependencies": {
35
- "@luxass/eslint-config": "7.2.1",
36
- "eslint": "10.0.2",
37
- "publint": "0.3.17",
38
- "tsdown": "0.20.3",
39
- "typescript": "5.9.3",
40
- "vitest-testdirs": "4.4.2",
35
+ "@luxass/eslint-config": "7.4.1",
36
+ "eslint": "10.1.0",
37
+ "publint": "0.3.18",
38
+ "tsdown": "0.21.4",
39
+ "typescript": "6.0.2",
40
+ "vitest-testdirs": "4.4.3",
41
41
  "@ucdjs-tooling/tsdown-config": "1.0.0",
42
42
  "@ucdjs-tooling/tsconfig": "1.0.0"
43
43
  },