@wtasnorg/node-lib 0.0.7 → 0.0.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.
- package/changelog.txt +26 -0
- package/dev_checklist.txt +56 -0
- package/docs/README.md +15 -32
- package/docs/docs.json +916 -240
- package/docs/functions/createFindDirectories.md +2 -2
- package/docs/functions/decode.md +49 -0
- package/docs/functions/encode.md +45 -0
- package/docs/functions/hello.md +2 -2
- package/docs/functions/parseUserAgent.md +42 -0
- package/docs/functions/pojo.md +2 -2
- package/docs/interfaces/FileSystemDependencies.md +9 -9
- package/docs/interfaces/FindDirectoriesOptions.md +8 -8
- package/docs/interfaces/UserAgentInfo.md +61 -0
- package/docs/type-aliases/Base64CharsetType.md +13 -0
- package/docs/variables/Base64Charset.md +17 -0
- package/eslint.config.js +7 -2
- package/gen-docs/001_base64_refine.txt +50 -0
- package/gen-docs/001_commands.txt +44 -0
- package/gen-docs/001_coverage.txt +43 -0
- package/gen-docs/001_env.txt +33 -0
- package/gen-docs/001_lint.txt +40 -0
- package/gen-docs/001_state.txt +58 -0
- package/gen-docs/002_api.txt +34 -0
- package/gen-docs/002_deps.txt +46 -0
- package/gen-docs/002_errors.txt +34 -0
- package/gen-docs/002_naming.txt +36 -0
- package/gen-docs/002_notes.txt +20 -0
- package/gen-docs/002_purity.txt +36 -0
- package/gen-docs/002_scope.txt +28 -0
- package/gen-docs/002_srp.txt +34 -0
- package/gen-sec/001_base64_security.txt +75 -0
- package/gen-sec/001_commands.txt +65 -0
- package/gen-sec/001_env.txt +28 -0
- package/gen-sec/001_findings.txt +63 -0
- package/gen-sec/001_inventory.txt +41 -0
- package/gen-sec/001_owasp.txt +78 -0
- package/gen-sec/001_scope.txt +44 -0
- package/package.json +3 -2
- package/{README.md → readme.txt} +3 -1
- package/src/base64.d.ts +58 -0
- package/src/base64.js +138 -0
- package/src/base64.test.d.ts +2 -0
- package/src/base64.test.js +106 -0
- package/src/base64.test.ts +125 -0
- package/src/base64.ts +163 -0
- package/src/find.d.ts +4 -4
- package/src/find.js +12 -6
- package/src/find.ts +10 -10
- package/src/index.d.ts +6 -2
- package/src/index.js +3 -1
- package/src/index.ts +11 -1
- package/src/pojo.js +1 -1
- package/src/pojo.test.js +1 -3
- package/src/pojo.test.ts +2 -1
- package/src/pojo.ts +1 -1
- package/src/user-agent.d.ts +48 -0
- package/src/user-agent.js +189 -0
- package/src/user-agent.test.d.ts +2 -0
- package/src/user-agent.test.js +54 -0
- package/src/user-agent.test.ts +60 -0
- package/src/user-agent.ts +199 -0
- package/DEV_CHECKLIST.md +0 -15
- package/docs/_media/LICENSE +0 -21
- package/docs/globals.md +0 -16
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
***
|
|
4
4
|
|
|
5
|
-
[@wtasnorg/node-lib](../
|
|
5
|
+
[@wtasnorg/node-lib](../README.md) / createFindDirectories
|
|
6
6
|
|
|
7
7
|
# Function: createFindDirectories()
|
|
8
8
|
|
|
9
9
|
> **createFindDirectories**(`deps`): (`root`, `options`) => `Promise`\<`string`[]\>
|
|
10
10
|
|
|
11
|
-
Defined in: [find.ts:19](https://github.com/wtasg/node-lib/blob/
|
|
11
|
+
Defined in: [find.ts:19](https://github.com/wtasg/node-lib/blob/b5efd5c345e8fa1bdc2a6d3ea4dd4b2eb5b9cc62/src/find.ts#L19)
|
|
12
12
|
|
|
13
13
|
Factory that produces an async findDirectories function with
|
|
14
14
|
injected filesystem dependencies for full testability.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
[**@wtasnorg/node-lib**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@wtasnorg/node-lib](../README.md) / decode
|
|
6
|
+
|
|
7
|
+
# Function: decode()
|
|
8
|
+
|
|
9
|
+
> **decode**(`input`, `charset`): `string`
|
|
10
|
+
|
|
11
|
+
Defined in: base64.ts:119
|
|
12
|
+
|
|
13
|
+
Decode a Base64 string.
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
### input
|
|
18
|
+
|
|
19
|
+
`string`
|
|
20
|
+
|
|
21
|
+
The Base64 encoded string.
|
|
22
|
+
|
|
23
|
+
### charset
|
|
24
|
+
|
|
25
|
+
The charset variant to use (default: "standard").
|
|
26
|
+
|
|
27
|
+
`"standard"` | `"urlsafe"` | `"imap"` | `"radix64"`
|
|
28
|
+
|
|
29
|
+
## Returns
|
|
30
|
+
|
|
31
|
+
`string`
|
|
32
|
+
|
|
33
|
+
The decoded string.
|
|
34
|
+
|
|
35
|
+
## Example
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import { decode } from "./base64.js";
|
|
39
|
+
|
|
40
|
+
decode("SGVsbG8sIFdvcmxkIQ==");
|
|
41
|
+
// => "Hello, World!"
|
|
42
|
+
|
|
43
|
+
decode("SGVsbG8sIFdvcmxkIQ==", "standard");
|
|
44
|
+
// => "Hello, World!"
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Throws
|
|
48
|
+
|
|
49
|
+
Error if the input contains invalid characters.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
[**@wtasnorg/node-lib**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@wtasnorg/node-lib](../README.md) / encode
|
|
6
|
+
|
|
7
|
+
# Function: encode()
|
|
8
|
+
|
|
9
|
+
> **encode**(`input`, `charset`): `string`
|
|
10
|
+
|
|
11
|
+
Defined in: base64.ts:79
|
|
12
|
+
|
|
13
|
+
Encode a string to Base64.
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
### input
|
|
18
|
+
|
|
19
|
+
`string`
|
|
20
|
+
|
|
21
|
+
The string to encode.
|
|
22
|
+
|
|
23
|
+
### charset
|
|
24
|
+
|
|
25
|
+
The charset variant to use (default: "standard").
|
|
26
|
+
|
|
27
|
+
`"standard"` | `"urlsafe"` | `"imap"` | `"radix64"`
|
|
28
|
+
|
|
29
|
+
## Returns
|
|
30
|
+
|
|
31
|
+
`string`
|
|
32
|
+
|
|
33
|
+
The Base64 encoded string.
|
|
34
|
+
|
|
35
|
+
## Example
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import { encode } from "./base64.js";
|
|
39
|
+
|
|
40
|
+
encode("Hello, World!");
|
|
41
|
+
// => "SGVsbG8sIFdvcmxkIQ=="
|
|
42
|
+
|
|
43
|
+
encode("Hello, World!", "urlsafe");
|
|
44
|
+
// => "SGVsbG8sIFdvcmxkIQ=="
|
|
45
|
+
```
|
package/docs/functions/hello.md
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
***
|
|
4
4
|
|
|
5
|
-
[@wtasnorg/node-lib](../
|
|
5
|
+
[@wtasnorg/node-lib](../README.md) / hello
|
|
6
6
|
|
|
7
7
|
# Function: hello()
|
|
8
8
|
|
|
9
9
|
> **hello**(): `Promise`\<`string`\>
|
|
10
10
|
|
|
11
|
-
Defined in: [hello.ts:6](https://github.com/wtasg/node-lib/blob/
|
|
11
|
+
Defined in: [hello.ts:6](https://github.com/wtasg/node-lib/blob/b5efd5c345e8fa1bdc2a6d3ea4dd4b2eb5b9cc62/src/hello.ts#L6)
|
|
12
12
|
|
|
13
13
|
A sample function that should work to test if lib is installed correctly.
|
|
14
14
|
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
[**@wtasnorg/node-lib**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@wtasnorg/node-lib](../README.md) / parseUserAgent
|
|
6
|
+
|
|
7
|
+
# Function: parseUserAgent()
|
|
8
|
+
|
|
9
|
+
> **parseUserAgent**(`ua`): [`UserAgentInfo`](../interfaces/UserAgentInfo.md)
|
|
10
|
+
|
|
11
|
+
Defined in: [user-agent.ts:48](https://github.com/wtasg/node-lib/blob/b5efd5c345e8fa1bdc2a6d3ea4dd4b2eb5b9cc62/src/user-agent.ts#L48)
|
|
12
|
+
|
|
13
|
+
Parses a user-agent string into a UserAgentInfo object.
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
### ua
|
|
18
|
+
|
|
19
|
+
`string`
|
|
20
|
+
|
|
21
|
+
The user-agent string to parse.
|
|
22
|
+
|
|
23
|
+
## Returns
|
|
24
|
+
|
|
25
|
+
[`UserAgentInfo`](../interfaces/UserAgentInfo.md)
|
|
26
|
+
|
|
27
|
+
An object containing the extracted information.
|
|
28
|
+
|
|
29
|
+
## Examples
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
// Success Example (Chrome on Windows)
|
|
33
|
+
const ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36";
|
|
34
|
+
const info = parseUserAgent(ua);
|
|
35
|
+
// { browser: "Chrome", version: "120.0.0.0", os: "Windows", device: "Desktop", engine: "Blink" }
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
// Error/Fallback Example (Empty string)
|
|
40
|
+
const info = parseUserAgent("");
|
|
41
|
+
// { browser: "Other", version: "0", os: "Other", device: "Desktop", engine: "Other" }
|
|
42
|
+
```
|
package/docs/functions/pojo.md
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
***
|
|
4
4
|
|
|
5
|
-
[@wtasnorg/node-lib](../
|
|
5
|
+
[@wtasnorg/node-lib](../README.md) / pojo
|
|
6
6
|
|
|
7
7
|
# Function: pojo()
|
|
8
8
|
|
|
9
9
|
> **pojo**\<`T`\>(`instance`): `Record`\<`string`, `unknown`\>
|
|
10
10
|
|
|
11
|
-
Defined in: [pojo.ts:10](https://github.com/wtasg/node-lib/blob/
|
|
11
|
+
Defined in: [pojo.ts:10](https://github.com/wtasg/node-lib/blob/b5efd5c345e8fa1bdc2a6d3ea4dd4b2eb5b9cc62/src/pojo.ts#L10)
|
|
12
12
|
|
|
13
13
|
Convert a class instance into a plain JavaScript object.
|
|
14
14
|
Copies only the instance's own enumerable data properties
|
|
@@ -2,27 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
***
|
|
4
4
|
|
|
5
|
-
[@wtasnorg/node-lib](../
|
|
5
|
+
[@wtasnorg/node-lib](../README.md) / FileSystemDependencies
|
|
6
6
|
|
|
7
7
|
# Interface: FileSystemDependencies
|
|
8
8
|
|
|
9
|
-
Defined in: [find.ts:3](https://github.com/wtasg/node-lib/blob/
|
|
9
|
+
Defined in: [find.ts:3](https://github.com/wtasg/node-lib/blob/b5efd5c345e8fa1bdc2a6d3ea4dd4b2eb5b9cc62/src/find.ts#L3)
|
|
10
10
|
|
|
11
11
|
## Properties
|
|
12
12
|
|
|
13
13
|
### readdir()
|
|
14
14
|
|
|
15
|
-
> **readdir**: (`
|
|
15
|
+
> **readdir**: (`_path`, `_opts`) => `Promise`\<`object`[]\>
|
|
16
16
|
|
|
17
|
-
Defined in: [find.ts:4](https://github.com/wtasg/node-lib/blob/
|
|
17
|
+
Defined in: [find.ts:4](https://github.com/wtasg/node-lib/blob/b5efd5c345e8fa1bdc2a6d3ea4dd4b2eb5b9cc62/src/find.ts#L4)
|
|
18
18
|
|
|
19
19
|
#### Parameters
|
|
20
20
|
|
|
21
|
-
#####
|
|
21
|
+
##### \_path
|
|
22
22
|
|
|
23
23
|
`string`
|
|
24
24
|
|
|
25
|
-
#####
|
|
25
|
+
##### \_opts
|
|
26
26
|
|
|
27
27
|
###### withFileTypes
|
|
28
28
|
|
|
@@ -36,13 +36,13 @@ Defined in: [find.ts:4](https://github.com/wtasg/node-lib/blob/5ccb6028429af225c
|
|
|
36
36
|
|
|
37
37
|
### stat()
|
|
38
38
|
|
|
39
|
-
> **stat**: (`
|
|
39
|
+
> **stat**: (`_path`) => `Promise`\<\{ `isDirectory`: `boolean`; \}\>
|
|
40
40
|
|
|
41
|
-
Defined in: [find.ts:5](https://github.com/wtasg/node-lib/blob/
|
|
41
|
+
Defined in: [find.ts:5](https://github.com/wtasg/node-lib/blob/b5efd5c345e8fa1bdc2a6d3ea4dd4b2eb5b9cc62/src/find.ts#L5)
|
|
42
42
|
|
|
43
43
|
#### Parameters
|
|
44
44
|
|
|
45
|
-
#####
|
|
45
|
+
##### \_path
|
|
46
46
|
|
|
47
47
|
`string`
|
|
48
48
|
|
|
@@ -2,27 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
***
|
|
4
4
|
|
|
5
|
-
[@wtasnorg/node-lib](../
|
|
5
|
+
[@wtasnorg/node-lib](../README.md) / FindDirectoriesOptions
|
|
6
6
|
|
|
7
7
|
# Interface: FindDirectoriesOptions
|
|
8
8
|
|
|
9
|
-
Defined in: [find.ts:8](https://github.com/wtasg/node-lib/blob/
|
|
9
|
+
Defined in: [find.ts:8](https://github.com/wtasg/node-lib/blob/b5efd5c345e8fa1bdc2a6d3ea4dd4b2eb5b9cc62/src/find.ts#L8)
|
|
10
10
|
|
|
11
11
|
## Properties
|
|
12
12
|
|
|
13
13
|
### allowlist?
|
|
14
14
|
|
|
15
|
-
> `optional` **allowlist**: `string`[] \| (`
|
|
15
|
+
> `optional` **allowlist**: `string`[] \| (`_absPath`, `_name`) => `boolean`
|
|
16
16
|
|
|
17
|
-
Defined in: [find.ts:11](https://github.com/wtasg/node-lib/blob/
|
|
17
|
+
Defined in: [find.ts:11](https://github.com/wtasg/node-lib/blob/b5efd5c345e8fa1bdc2a6d3ea4dd4b2eb5b9cc62/src/find.ts#L11)
|
|
18
18
|
|
|
19
19
|
***
|
|
20
20
|
|
|
21
21
|
### blocklist?
|
|
22
22
|
|
|
23
|
-
> `optional` **blocklist**: `string`[] \| (`
|
|
23
|
+
> `optional` **blocklist**: `string`[] \| (`_absPath`, `_name`) => `boolean`
|
|
24
24
|
|
|
25
|
-
Defined in: [find.ts:12](https://github.com/wtasg/node-lib/blob/
|
|
25
|
+
Defined in: [find.ts:12](https://github.com/wtasg/node-lib/blob/b5efd5c345e8fa1bdc2a6d3ea4dd4b2eb5b9cc62/src/find.ts#L12)
|
|
26
26
|
|
|
27
27
|
***
|
|
28
28
|
|
|
@@ -30,7 +30,7 @@ Defined in: [find.ts:12](https://github.com/wtasg/node-lib/blob/5ccb6028429af225
|
|
|
30
30
|
|
|
31
31
|
> `optional` **followSymlinks**: `boolean`
|
|
32
32
|
|
|
33
|
-
Defined in: [find.ts:10](https://github.com/wtasg/node-lib/blob/
|
|
33
|
+
Defined in: [find.ts:10](https://github.com/wtasg/node-lib/blob/b5efd5c345e8fa1bdc2a6d3ea4dd4b2eb5b9cc62/src/find.ts#L10)
|
|
34
34
|
|
|
35
35
|
***
|
|
36
36
|
|
|
@@ -38,4 +38,4 @@ Defined in: [find.ts:10](https://github.com/wtasg/node-lib/blob/5ccb6028429af225
|
|
|
38
38
|
|
|
39
39
|
> `optional` **maxDepth**: `number`
|
|
40
40
|
|
|
41
|
-
Defined in: [find.ts:9](https://github.com/wtasg/node-lib/blob/
|
|
41
|
+
Defined in: [find.ts:9](https://github.com/wtasg/node-lib/blob/b5efd5c345e8fa1bdc2a6d3ea4dd4b2eb5b9cc62/src/find.ts#L9)
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
[**@wtasnorg/node-lib**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@wtasnorg/node-lib](../README.md) / UserAgentInfo
|
|
6
|
+
|
|
7
|
+
# Interface: UserAgentInfo
|
|
8
|
+
|
|
9
|
+
Defined in: [user-agent.ts:4](https://github.com/wtasg/node-lib/blob/b5efd5c345e8fa1bdc2a6d3ea4dd4b2eb5b9cc62/src/user-agent.ts#L4)
|
|
10
|
+
|
|
11
|
+
Information extracted from a user-agent string.
|
|
12
|
+
|
|
13
|
+
## Properties
|
|
14
|
+
|
|
15
|
+
### browser
|
|
16
|
+
|
|
17
|
+
> **browser**: `string`
|
|
18
|
+
|
|
19
|
+
Defined in: [user-agent.ts:8](https://github.com/wtasg/node-lib/blob/b5efd5c345e8fa1bdc2a6d3ea4dd4b2eb5b9cc62/src/user-agent.ts#L8)
|
|
20
|
+
|
|
21
|
+
Browser name (e.g., Chrome, Firefox, Safari, Edge, Opera, Other).
|
|
22
|
+
|
|
23
|
+
***
|
|
24
|
+
|
|
25
|
+
### device
|
|
26
|
+
|
|
27
|
+
> **device**: `string`
|
|
28
|
+
|
|
29
|
+
Defined in: [user-agent.ts:20](https://github.com/wtasg/node-lib/blob/b5efd5c345e8fa1bdc2a6d3ea4dd4b2eb5b9cc62/src/user-agent.ts#L20)
|
|
30
|
+
|
|
31
|
+
Device type (e.g., Mobile, Tablet, Desktop, Other).
|
|
32
|
+
|
|
33
|
+
***
|
|
34
|
+
|
|
35
|
+
### engine
|
|
36
|
+
|
|
37
|
+
> **engine**: `string`
|
|
38
|
+
|
|
39
|
+
Defined in: [user-agent.ts:24](https://github.com/wtasg/node-lib/blob/b5efd5c345e8fa1bdc2a6d3ea4dd4b2eb5b9cc62/src/user-agent.ts#L24)
|
|
40
|
+
|
|
41
|
+
Rendering engine (e.g., Blink, WebKit, Gecko, Presto, Other).
|
|
42
|
+
|
|
43
|
+
***
|
|
44
|
+
|
|
45
|
+
### os
|
|
46
|
+
|
|
47
|
+
> **os**: `string`
|
|
48
|
+
|
|
49
|
+
Defined in: [user-agent.ts:16](https://github.com/wtasg/node-lib/blob/b5efd5c345e8fa1bdc2a6d3ea4dd4b2eb5b9cc62/src/user-agent.ts#L16)
|
|
50
|
+
|
|
51
|
+
Operating system (e.g., Windows, macOS, Linux, iOS, Android, Other).
|
|
52
|
+
|
|
53
|
+
***
|
|
54
|
+
|
|
55
|
+
### version
|
|
56
|
+
|
|
57
|
+
> **version**: `string`
|
|
58
|
+
|
|
59
|
+
Defined in: [user-agent.ts:12](https://github.com/wtasg/node-lib/blob/b5efd5c345e8fa1bdc2a6d3ea4dd4b2eb5b9cc62/src/user-agent.ts#L12)
|
|
60
|
+
|
|
61
|
+
Browser version (e.g., 120.0.0.0).
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
[**@wtasnorg/node-lib**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@wtasnorg/node-lib](../README.md) / Base64CharsetType
|
|
6
|
+
|
|
7
|
+
# Type Alias: Base64CharsetType
|
|
8
|
+
|
|
9
|
+
> **Base64CharsetType** = *typeof* [`Base64Charset`](../variables/Base64Charset.md)\[`number`\]
|
|
10
|
+
|
|
11
|
+
Defined in: base64.ts:18
|
|
12
|
+
|
|
13
|
+
Base64 charset type.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
[**@wtasnorg/node-lib**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@wtasnorg/node-lib](../README.md) / Base64Charset
|
|
6
|
+
|
|
7
|
+
# Variable: Base64Charset
|
|
8
|
+
|
|
9
|
+
> `const` **Base64Charset**: readonly \[`"standard"`, `"urlsafe"`, `"imap"`, `"radix64"`\]
|
|
10
|
+
|
|
11
|
+
Defined in: base64.ts:13
|
|
12
|
+
|
|
13
|
+
Available Base64 charset variants.
|
|
14
|
+
- `standard`: RFC 4648 standard alphabet (A-Z, a-z, 0-9, +, /)
|
|
15
|
+
- `urlsafe`: URL and filename safe (A-Z, a-z, 0-9, -, _)
|
|
16
|
+
- `imap`: Modified Base64 for IMAP mailbox names (A-Z, a-z, 0-9, +, ,)
|
|
17
|
+
- `radix64`: Base64 variant used in OpenPGP (A-Z, a-z, 0-9, +, /)
|
package/eslint.config.js
CHANGED
|
@@ -28,10 +28,14 @@ export default defineConfig([
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
|
|
31
|
+
{
|
|
32
|
+
ignores: ["**/*.d.ts"]
|
|
33
|
+
},
|
|
34
|
+
|
|
31
35
|
{
|
|
32
36
|
rules: {
|
|
33
37
|
"@typescript-eslint/no-unused-vars": [
|
|
34
|
-
"
|
|
38
|
+
"error",
|
|
35
39
|
{
|
|
36
40
|
argsIgnorePattern: "^_",
|
|
37
41
|
varsIgnorePattern: "^_",
|
|
@@ -40,7 +44,8 @@ export default defineConfig([
|
|
|
40
44
|
],
|
|
41
45
|
|
|
42
46
|
semi: ["error", "always"],
|
|
43
|
-
|
|
47
|
+
curly: ["error", "all"],
|
|
48
|
+
"prefer-const": "warn",
|
|
44
49
|
"@stylistic/quotes": ["error", "double"]
|
|
45
50
|
}
|
|
46
51
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Base64 Module Refinement Pass
|
|
2
|
+
# Date: 2026-01-19
|
|
3
|
+
# Scope: src/base64.ts
|
|
4
|
+
|
|
5
|
+
## SRP Analysis
|
|
6
|
+
- encode(): Single responsibility - string to Base64
|
|
7
|
+
- decode(): Single responsibility - Base64 to string
|
|
8
|
+
- buildDecodeTable(): Single responsibility - lookup table creation
|
|
9
|
+
- No business logic mixing, no I/O coupling
|
|
10
|
+
|
|
11
|
+
## Dependency Direction
|
|
12
|
+
- No external dependencies beyond Node.js built-ins (TextEncoder/TextDecoder)
|
|
13
|
+
- No circular dependencies
|
|
14
|
+
- Pure computation, no framework coupling
|
|
15
|
+
|
|
16
|
+
## Purity & Side-Effects
|
|
17
|
+
- All functions are pure (no I/O, no global state mutation)
|
|
18
|
+
- Deterministic: same input always produces same output
|
|
19
|
+
- No hidden state mutation
|
|
20
|
+
|
|
21
|
+
## Naming Review
|
|
22
|
+
- encode/decode: Clear, idiomatic names
|
|
23
|
+
- Base64Charset: Descriptive, matches domain
|
|
24
|
+
- CHARSETS/DECODE_TABLES: Clear internal constants
|
|
25
|
+
- buildDecodeTable: Accurate verb+noun pattern
|
|
26
|
+
|
|
27
|
+
## Error Handling
|
|
28
|
+
- decode() throws Error with specific character on invalid input
|
|
29
|
+
- Error message includes the offending character
|
|
30
|
+
- No swallowed exceptions
|
|
31
|
+
|
|
32
|
+
## API Surface
|
|
33
|
+
- Exports: encode, decode, Base64Charset, Base64CharsetType
|
|
34
|
+
- Minimal and focused public API
|
|
35
|
+
- Internal helpers (buildDecodeTable, CHARSETS, PAD) are not exported
|
|
36
|
+
|
|
37
|
+
## Invariants
|
|
38
|
+
- Charset type is constrained via TypeScript const assertion
|
|
39
|
+
- Invalid charset impossible at compile time
|
|
40
|
+
- Padding handled correctly per Base64 spec
|
|
41
|
+
|
|
42
|
+
## Test Coverage
|
|
43
|
+
- 74 tests total, base64 tests cover:
|
|
44
|
+
- Encode: empty, single char, padding, all charsets, UTF-8
|
|
45
|
+
- Decode: empty, padding, error handling
|
|
46
|
+
- Round-trip: all charsets with 10 test cases each
|
|
47
|
+
- Tests verify behavior, not implementation
|
|
48
|
+
|
|
49
|
+
## Summary
|
|
50
|
+
No actionable refinement items. Code is clean, focused, and well-tested.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# 001 Commands Executed
|
|
2
|
+
Generated: 2026-01-19T20:40:49+05:30
|
|
3
|
+
|
|
4
|
+
## Environment
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
node -v
|
|
8
|
+
# v24.5.0
|
|
9
|
+
|
|
10
|
+
npm -v
|
|
11
|
+
# 11.7.0
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Verification Suite
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm run lint
|
|
18
|
+
# PASS - 0 errors, 0 warnings
|
|
19
|
+
|
|
20
|
+
npm run build
|
|
21
|
+
# PASS - tsc compiled successfully
|
|
22
|
+
|
|
23
|
+
npm run test
|
|
24
|
+
# PASS - 17/17 tests passed
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Coverage
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
node --test --experimental-test-coverage src/**/*.test.js
|
|
31
|
+
# Lines: 86.62%
|
|
32
|
+
# Branches: 76.56%
|
|
33
|
+
# Functions: 100%
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Documentation
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm run docs
|
|
40
|
+
# Generated at ./docs
|
|
41
|
+
|
|
42
|
+
npm run docs:json
|
|
43
|
+
# Generated at ./docs/docs.json
|
|
44
|
+
```
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# 001 Coverage Report
|
|
2
|
+
Generated: 2026-01-19T20:40:49+05:30
|
|
3
|
+
|
|
4
|
+
## Summary
|
|
5
|
+
|
|
6
|
+
| Metric | Value | Target |
|
|
7
|
+
|-----------|--------|--------|
|
|
8
|
+
| Lines | 86.62% | >= 90% |
|
|
9
|
+
| Branches | 76.56% | >= 90% |
|
|
10
|
+
| Functions | 100% | >= 90% |
|
|
11
|
+
|
|
12
|
+
## Per-File Breakdown
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
file | line % | branch % | funcs % | uncovered lines
|
|
16
|
+
-------------------------------------------------------------------
|
|
17
|
+
src
|
|
18
|
+
find.js | 64.71 | 70.59 | 100.00 | 14-22 27-35 40-45
|
|
19
|
+
hello.js | 100.00 | 100.00 | 100.00 |
|
|
20
|
+
pojo.js | 100.00 | 100.00 | 100.00 |
|
|
21
|
+
user-agent.js | 92.55 | 76.19 | 100.00 | 80-83 119-122 175+
|
|
22
|
+
-------------------------------------------------------------------
|
|
23
|
+
all files | 86.62 | 76.56 | 100.00 |
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Analysis
|
|
27
|
+
|
|
28
|
+
### Meets Target
|
|
29
|
+
- hello.js: 100% (all metrics)
|
|
30
|
+
- pojo.js: 100% (all metrics)
|
|
31
|
+
|
|
32
|
+
### Below Target
|
|
33
|
+
- find.js: 64.71% lines, 70.59% branches
|
|
34
|
+
- `stat` dependency unused
|
|
35
|
+
- Allowlist/blocklist callback paths untested
|
|
36
|
+
- user-agent.js: 92.55% lines, 76.19% branches
|
|
37
|
+
- Edge case UA strings not covered
|
|
38
|
+
|
|
39
|
+
## Recommendations
|
|
40
|
+
|
|
41
|
+
1. Add tests for `find.js` allowlist/blocklist callbacks
|
|
42
|
+
2. Add edge case UA tests for user-agent.js
|
|
43
|
+
3. Consider removing unused `stat` from FileSystemDependencies
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# 001 Environment Verification
|
|
2
|
+
Generated: 2026-01-19T20:40:49+05:30
|
|
3
|
+
|
|
4
|
+
## Runtime Versions
|
|
5
|
+
|
|
6
|
+
- Node.js: v24.5.0
|
|
7
|
+
- npm: 11.7.0
|
|
8
|
+
- TypeScript: 5.9.3
|
|
9
|
+
|
|
10
|
+
## Dependencies Verified
|
|
11
|
+
|
|
12
|
+
All devDependencies installed and functional:
|
|
13
|
+
- @eslint/js: 9.39.1
|
|
14
|
+
- @stylistic/eslint-plugin: 5.6.1
|
|
15
|
+
- @types/node: 24.10.1
|
|
16
|
+
- eslint: 9.39.1
|
|
17
|
+
- eslint-config-prettier: 10.1.8
|
|
18
|
+
- globals: 16.5.0
|
|
19
|
+
- typedoc: 0.28.15
|
|
20
|
+
- typedoc-plugin-markdown: 4.9.0
|
|
21
|
+
- typescript: 5.9.3
|
|
22
|
+
- typescript-eslint: 8.48.1
|
|
23
|
+
|
|
24
|
+
## Tooling
|
|
25
|
+
|
|
26
|
+
- Test runner: node:test (built-in)
|
|
27
|
+
- Coverage: node --experimental-test-coverage
|
|
28
|
+
- Linter: eslint with typescript-eslint
|
|
29
|
+
- Docs: typedoc
|
|
30
|
+
|
|
31
|
+
## Status
|
|
32
|
+
|
|
33
|
+
Environment verified. No issues.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# 001 Lint Report
|
|
2
|
+
Generated: 2026-01-19T20:40:49+05:30
|
|
3
|
+
|
|
4
|
+
## Command
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
npm run lint
|
|
8
|
+
# => npx eslint src/*.ts --no-warn-ignored
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Results
|
|
12
|
+
|
|
13
|
+
- Errors: 0
|
|
14
|
+
- Warnings: 0
|
|
15
|
+
- Status: PASS
|
|
16
|
+
|
|
17
|
+
## Configuration
|
|
18
|
+
|
|
19
|
+
ESLint config: eslint.config.js
|
|
20
|
+
- eslint.configs.recommended
|
|
21
|
+
- tseslint.configs.recommended
|
|
22
|
+
- tseslint.configs.strict
|
|
23
|
+
- tseslint.configs.stylistic
|
|
24
|
+
- eslint-config-prettier
|
|
25
|
+
|
|
26
|
+
### Key Rules
|
|
27
|
+
|
|
28
|
+
| Rule | Setting |
|
|
29
|
+
|------------------------------------|---------|
|
|
30
|
+
| @typescript-eslint/no-unused-vars | error |
|
|
31
|
+
| no-unused-vars | off |
|
|
32
|
+
| semi | error |
|
|
33
|
+
| curly | error |
|
|
34
|
+
| prefer-const | warn |
|
|
35
|
+
| @stylistic/quotes | double |
|
|
36
|
+
|
|
37
|
+
## Notes
|
|
38
|
+
|
|
39
|
+
- Base `no-unused-vars` disabled in favor of TypeScript-aware version
|
|
40
|
+
- Ignore patterns: ^_ for args, vars, caught errors
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# 001 State Report
|
|
2
|
+
Generated: 2026-01-19T20:40:49+05:30
|
|
3
|
+
|
|
4
|
+
## Project Summary
|
|
5
|
+
|
|
6
|
+
- Package: @wtasnorg/node-lib@0.0.8
|
|
7
|
+
- Type: TypeScript/Node.js library
|
|
8
|
+
- Modules: find, hello, pojo, user-agent
|
|
9
|
+
|
|
10
|
+
## Baseline Results
|
|
11
|
+
|
|
12
|
+
### Lint
|
|
13
|
+
- Status: PASS
|
|
14
|
+
- Errors: 0
|
|
15
|
+
- Warnings: 0
|
|
16
|
+
|
|
17
|
+
### Build
|
|
18
|
+
- Status: PASS
|
|
19
|
+
- Compiler: tsc (TypeScript 5.9.3)
|
|
20
|
+
|
|
21
|
+
### Tests
|
|
22
|
+
- Status: PASS
|
|
23
|
+
- Total: 17
|
|
24
|
+
- Passed: 17
|
|
25
|
+
- Failed: 0
|
|
26
|
+
- Skipped: 0
|
|
27
|
+
|
|
28
|
+
### Coverage (Overall)
|
|
29
|
+
- Lines: 86.62%
|
|
30
|
+
- Branches: 76.56%
|
|
31
|
+
- Functions: 100.00%
|
|
32
|
+
|
|
33
|
+
### Coverage by Module
|
|
34
|
+
|
|
35
|
+
| Module | Lines | Branches | Functions |
|
|
36
|
+
|----------------|--------|----------|-----------|
|
|
37
|
+
| find.js | 64.71% | 70.59% | 100.00% |
|
|
38
|
+
| hello.js | 100% | 100% | 100% |
|
|
39
|
+
| pojo.js | 100% | 100% | 100% |
|
|
40
|
+
| user-agent.js | 92.55% | 76.19% | 100% |
|
|
41
|
+
|
|
42
|
+
## Gap Analysis
|
|
43
|
+
|
|
44
|
+
### Low Coverage: find.js (64.71%)
|
|
45
|
+
|
|
46
|
+
Uncovered lines: 14-22, 27-35, 40-45
|
|
47
|
+
- `stat` function defined but never used in tests
|
|
48
|
+
- Allowlist/blocklist function callback paths untested
|
|
49
|
+
|
|
50
|
+
### Medium Coverage: user-agent.js (92.55%)
|
|
51
|
+
|
|
52
|
+
Uncovered lines: 80-83, 119-122, 175+
|
|
53
|
+
- Some edge case UA strings not covered
|
|
54
|
+
- Fallback paths for unusual browsers
|
|
55
|
+
|
|
56
|
+
## Status
|
|
57
|
+
|
|
58
|
+
All gates passed. No blocking issues.
|