@wtasnorg/node-lib 0.0.7 → 0.0.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.
Files changed (52) hide show
  1. package/changelog.txt +14 -0
  2. package/dev_checklist.txt +56 -0
  3. package/docs/README.md +8 -35
  4. package/docs/docs.json +448 -205
  5. package/docs/functions/createFindDirectories.md +2 -2
  6. package/docs/functions/hello.md +2 -2
  7. package/docs/functions/parseUserAgent.md +42 -0
  8. package/docs/functions/pojo.md +2 -2
  9. package/docs/interfaces/FileSystemDependencies.md +9 -9
  10. package/docs/interfaces/FindDirectoriesOptions.md +8 -8
  11. package/docs/interfaces/UserAgentInfo.md +61 -0
  12. package/eslint.config.js +7 -2
  13. package/gen-docs/001_commands.txt +44 -0
  14. package/gen-docs/001_coverage.txt +43 -0
  15. package/gen-docs/001_env.txt +33 -0
  16. package/gen-docs/001_lint.txt +40 -0
  17. package/gen-docs/001_state.txt +58 -0
  18. package/gen-docs/002_api.txt +34 -0
  19. package/gen-docs/002_deps.txt +46 -0
  20. package/gen-docs/002_errors.txt +34 -0
  21. package/gen-docs/002_naming.txt +36 -0
  22. package/gen-docs/002_notes.txt +20 -0
  23. package/gen-docs/002_purity.txt +36 -0
  24. package/gen-docs/002_scope.txt +28 -0
  25. package/gen-docs/002_srp.txt +34 -0
  26. package/gen-sec/001_commands.txt +65 -0
  27. package/gen-sec/001_env.txt +28 -0
  28. package/gen-sec/001_findings.txt +63 -0
  29. package/gen-sec/001_inventory.txt +41 -0
  30. package/gen-sec/001_owasp.txt +78 -0
  31. package/gen-sec/001_scope.txt +44 -0
  32. package/package.json +3 -2
  33. package/{README.md → readme.txt} +2 -1
  34. package/src/find.d.ts +4 -4
  35. package/src/find.js +12 -6
  36. package/src/find.ts +10 -10
  37. package/src/index.d.ts +4 -2
  38. package/src/index.js +2 -1
  39. package/src/index.ts +5 -1
  40. package/src/pojo.js +1 -1
  41. package/src/pojo.test.js +1 -3
  42. package/src/pojo.test.ts +2 -1
  43. package/src/pojo.ts +1 -1
  44. package/src/user-agent.d.ts +48 -0
  45. package/src/user-agent.js +189 -0
  46. package/src/user-agent.test.d.ts +2 -0
  47. package/src/user-agent.test.js +54 -0
  48. package/src/user-agent.test.ts +60 -0
  49. package/src/user-agent.ts +199 -0
  50. package/DEV_CHECKLIST.md +0 -15
  51. package/docs/_media/LICENSE +0 -21
  52. package/docs/globals.md +0 -16
@@ -0,0 +1,36 @@
1
+ # 002 Purity & Side-Effect Findings
2
+ Generated: 2026-01-19T20:43:05+05:30
3
+
4
+ ## Summary
5
+
6
+ Excellent purity. Side effects isolated and intentional.
7
+
8
+ ## Per-Module Analysis
9
+
10
+ ### find.ts ✅
11
+ - I/O injected, not hardcoded
12
+ - Pure computation inside walk()
13
+ - Side effects (readdir) at boundary via dependency injection
14
+
15
+ ### hello.ts ⚠️
16
+ - console.log is a side effect
17
+ - Mitigated: guarded with `if (console?.log)`
18
+ - Acceptable: function purpose is verification output
19
+
20
+ ### pojo.ts ✅
21
+ - Pure function
22
+ - No side effects
23
+ - Deterministic output
24
+
25
+ ### user-agent.ts ✅
26
+ - All functions pure
27
+ - String parsing only
28
+ - No I/O, no mutation
29
+
30
+ ## Issues Found
31
+
32
+ None requiring action.
33
+
34
+ ## Status
35
+
36
+ PASS - Side effects appropriately isolated.
@@ -0,0 +1,28 @@
1
+ # 002 Scope - Refinement Iteration
2
+ Generated: 2026-01-19T20:43:05+05:30
3
+
4
+ ## In Scope
5
+
6
+ Modules:
7
+ - find.ts - Directory traversal factory
8
+ - hello.ts - Library health check
9
+ - pojo.ts - Object conversion utility
10
+ - user-agent.ts - UA string parser
11
+ - index.ts - Public exports
12
+
13
+ ## Out of Scope
14
+
15
+ - Test files (*.test.ts)
16
+ - Generated files (*.js, *.d.ts)
17
+ - Build/tooling configuration
18
+
19
+ ## Assumptions
20
+
21
+ - Library is functional; tests pass
22
+ - No breaking API changes desired
23
+ - Focus: code quality, not features
24
+
25
+ ## Constraints
26
+
27
+ - Must maintain backward compatibility
28
+ - All changes require passing tests
@@ -0,0 +1,34 @@
1
+ # 002 SRP Findings
2
+ Generated: 2026-01-19T20:43:05+05:30
3
+
4
+ ## Summary
5
+
6
+ All modules have good single responsibility. No major violations.
7
+
8
+ ## Per-Module Analysis
9
+
10
+ ### find.ts ✅
11
+ - Single concern: directory traversal with filtering
12
+ - Pure factory pattern isolates FS dependencies
13
+ - Helper functions (isAllowed, isBlocked) are cohesive
14
+
15
+ ### hello.ts ✅
16
+ - Single concern: library health check
17
+ - Minor: console.log side effect is appropriate for purpose
18
+
19
+ ### pojo.ts ✅
20
+ - Single concern: class-to-POJO conversion
21
+ - Pure function, no side effects
22
+
23
+ ### user-agent.ts ✅
24
+ - Single concern: UA string parsing
25
+ - Well-decomposed: detectBrowser, detectOS, detectDeviceType, detectEngine
26
+ - Each sub-function has single responsibility
27
+
28
+ ## Issues Found
29
+
30
+ None requiring action.
31
+
32
+ ## Status
33
+
34
+ PASS - All modules satisfy SRP.
@@ -0,0 +1,65 @@
1
+ # 001 Commands Executed
2
+ Generated: 2026-01-19T20:46:44+05:30
3
+
4
+ ## Environment Verification
5
+
6
+ ```bash
7
+ which npm node semgrep
8
+ # /home/anubhav/.nvm/versions/node/v24.5.0/bin/npm
9
+ # /home/anubhav/.nvm/versions/node/v24.5.0/bin/node
10
+ # semgrep not found
11
+
12
+ npm --version
13
+ # 11.7.0
14
+
15
+ node --version
16
+ # v24.5.0
17
+ ```
18
+
19
+ ## Dependency Audit
20
+
21
+ ```bash
22
+ npm audit --json
23
+ # 0 vulnerabilities
24
+ # 131 dependencies (1 prod, 130 dev)
25
+ ```
26
+
27
+ ## Static Pattern Analysis
28
+
29
+ ```bash
30
+ # Command injection patterns
31
+ grep -rE 'eval|Function\(|exec|spawn|child_process' src/*.ts
32
+ # No results
33
+
34
+ # Secret patterns
35
+ grep -riE 'password|secret|api.?key|token|credential' src/*.ts
36
+ # Found: pojo.test.ts (test data only)
37
+
38
+ # XSS patterns
39
+ grep -rE 'innerHTML|outerHTML|document\.write' src/*.ts
40
+ # No results
41
+
42
+ # File operation patterns
43
+ grep -rE 'fs\.|readFile|writeFile|unlink|rmdir' src/*.ts
44
+ # No results
45
+
46
+ # Network patterns
47
+ grep -riE 'http|fetch|axios|request' src/*.ts
48
+ # No results
49
+
50
+ # Crypto patterns
51
+ grep -riE 'crypto|hash|md5|sha1|sha256' src/*.ts
52
+ # No results
53
+
54
+ # SQL patterns
55
+ grep -riE 'sql|query|database|db\.' src/*.ts
56
+ # No results
57
+
58
+ # Deserialization patterns
59
+ grep -rE 'JSON\.parse|deserialize|pickle' src/*.ts
60
+ # No results
61
+
62
+ # Prototype pollution patterns
63
+ grep -rE 'prototype|__proto__|constructor\[' src/*.ts
64
+ # Found: pojo.ts, pojo.test.ts (documentation/test only)
65
+ ```
@@ -0,0 +1,28 @@
1
+ # 001 Environment Verification
2
+ Generated: 2026-01-19T20:46:44+05:30
3
+
4
+ ## Tooling Status
5
+
6
+ | Tool | Status | Version | Path |
7
+ |----------|-----------|-----------|----------------------------------------|
8
+ | node | ✅ OK | v24.5.0 | /home/anubhav/.nvm/versions/node/... |
9
+ | npm | ✅ OK | 11.7.0 | /home/anubhav/.nvm/versions/node/... |
10
+ | semgrep | ❌ MISSING| - | - |
11
+
12
+ ## npm audit
13
+
14
+ ```
15
+ Vulnerabilities: 0
16
+ - Critical: 0
17
+ - High: 0
18
+ - Moderate: 0
19
+ - Low: 0
20
+ - Info: 0
21
+
22
+ Dependencies: 131 (1 prod, 130 dev)
23
+ ```
24
+
25
+ ## Notes
26
+
27
+ - Semgrep not installed; manual pattern analysis performed
28
+ - All dev dependencies, minimal prod footprint
@@ -0,0 +1,63 @@
1
+ # 001 Security Findings
2
+ Generated: 2026-01-19T20:46:44+05:30
3
+
4
+ ## Summary
5
+
6
+ | Severity | Count |
7
+ |----------|-------|
8
+ | Critical | 0 |
9
+ | High | 0 |
10
+ | Medium | 0 |
11
+ | Low | 1 |
12
+ | Info | 1 |
13
+
14
+ ## Findings
15
+
16
+ ### [LOW] F001 - Path Traversal Potential in find.ts
17
+
18
+ **Location:** find.ts:23-26, createFindDirectories()
19
+
20
+ **Description:**
21
+ The `root` parameter is passed to `resolve()` without validation.
22
+ If a consumer passes user-controlled input, path traversal is possible.
23
+
24
+ **Impact:** Directory enumeration outside intended scope.
25
+
26
+ **Exploitability:** LOW - Requires consumer misuse.
27
+
28
+ **CWE:** CWE-22 (Path Traversal)
29
+
30
+ **OWASP:** A01 (Broken Access Control)
31
+
32
+ **Confidence:** LOW - Library design expects trusted input.
33
+
34
+ **Recommendation:**
35
+ - Document that `root` must be trusted input
36
+ - Optionally add: validate root is within allowed base path
37
+
38
+ ---
39
+
40
+ ### [INFO] F002 - "secret" String in Test File
41
+
42
+ **Location:** pojo.test.ts:54-65
43
+
44
+ **Description:**
45
+ String "secret" appears in test data (SecretBox class).
46
+
47
+ **Impact:** None - test data only.
48
+
49
+ **Confidence:** HIGH - Verified as test fixture.
50
+
51
+ **Recommendation:** No action needed.
52
+
53
+ ---
54
+
55
+ ## Residual Risk
56
+
57
+ **MINIMAL** - This is a stateless utility library with:
58
+ - No network exposure
59
+ - No database access
60
+ - No authentication
61
+ - No user input handling
62
+
63
+ Security posture depends on consumer implementation.
@@ -0,0 +1,41 @@
1
+ # 001 Attack Surface Inventory
2
+ Generated: 2026-01-19T20:46:44+05:30
3
+
4
+ ## Overview
5
+
6
+ This is a pure utility library with NO:
7
+ - HTTP endpoints
8
+ - CLI interfaces
9
+ - Database access
10
+ - Authentication
11
+ - Network I/O
12
+
13
+ ## Entry Points
14
+
15
+ ### find.ts - createFindDirectories()
16
+
17
+ - Input: FileSystemDependencies (injected), root path, options
18
+ - Operations: Directory traversal via injected readdir
19
+ - Trust boundary: Consumer provides FS functions
20
+
21
+ ### hello.ts - hello()
22
+
23
+ - Input: None
24
+ - Operations: Returns static string, logs to console
25
+ - Trust boundary: None
26
+
27
+ ### pojo.ts - pojo()
28
+
29
+ - Input: Object instance
30
+ - Operations: Object.entries, Object.fromEntries
31
+ - Trust boundary: Consumer provides object
32
+
33
+ ### user-agent.ts - parseUserAgent()
34
+
35
+ - Input: String (user-agent)
36
+ - Operations: String parsing (split, includes)
37
+ - Trust boundary: Consumer provides UA string
38
+
39
+ ## Attack Surface Rating
40
+
41
+ **MINIMAL** - Pure functions, no I/O, no state, no network.
@@ -0,0 +1,78 @@
1
+ # 001 OWASP Top 10 Assessment
2
+ Generated: 2026-01-19T20:46:44+05:30
3
+
4
+ ## A01 - Broken Access Control
5
+
6
+ **N/A** - No authentication, authorization, or access control.
7
+
8
+ ## A02 - Cryptographic Failures
9
+
10
+ **N/A** - No cryptographic operations.
11
+ - No passwords, tokens, or secrets
12
+ - No hashing or encryption
13
+
14
+ ## A03 - Injection
15
+
16
+ **LOW RISK** - Pattern analysis performed:
17
+
18
+ | Pattern | Found | Files |
19
+ |---------------------|-------|-------|
20
+ | eval() | ❌ No | - |
21
+ | Function() | ❌ No | - |
22
+ | exec/spawn | ❌ No | - |
23
+ | child_process | ❌ No | - |
24
+ | SQL | ❌ No | - |
25
+ | innerHTML | ❌ No | - |
26
+
27
+ ## A04 - Insecure Design
28
+
29
+ **N/A** - Simple utility library.
30
+ - No business logic
31
+ - No rate limiting needed
32
+ - No trust assumptions
33
+
34
+ ## A05 - Security Misconfiguration
35
+
36
+ **N/A** - No configuration surface.
37
+ - No debug modes
38
+ - No CORS
39
+ - No credentials
40
+
41
+ ## A06 - Vulnerable Components
42
+
43
+ **PASS** - npm audit: 0 vulnerabilities
44
+ - 131 dependencies scanned
45
+ - No known CVEs
46
+
47
+ ## A07 - Identification & Authentication Failures
48
+
49
+ **N/A** - No authentication.
50
+
51
+ ## A08 - Software & Data Integrity Failures
52
+
53
+ **LOW RISK** - Analyzed for deserialization:
54
+
55
+ | Pattern | Found | Notes |
56
+ |---------------------|-------|--------------------------|
57
+ | JSON.parse | ❌ No | - |
58
+ | Prototype pollution | ❌ No | pojo() uses safe methods |
59
+
60
+ pojo() uses Object.entries/fromEntries which are safe.
61
+
62
+ ## A09 - Logging & Monitoring Failures
63
+
64
+ **N/A** - Library code, not service.
65
+ - console.log in hello() is benign
66
+
67
+ ## A10 - SSRF
68
+
69
+ **N/A** - No network I/O.
70
+ - No fetch, axios, http
71
+ - No URL handling
72
+
73
+ ## Summary
74
+
75
+ | Category | Status |
76
+ |----------|--------|
77
+ | A01-A10 | N/A or PASS |
78
+ | Overall | **LOW RISK** |
@@ -0,0 +1,44 @@
1
+ # 001 Scope - Security Assessment
2
+ Generated: 2026-01-19T20:46:44+05:30
3
+
4
+ ## Target
5
+
6
+ - Package: @wtasnorg/node-lib@0.0.8
7
+ - Type: TypeScript utility library
8
+ - Platform: Node.js
9
+
10
+ ## In Scope
11
+
12
+ - src/*.ts (source files)
13
+ - Dependencies (package.json)
14
+ - Build artifacts
15
+
16
+ ## Out of Scope
17
+
18
+ - Test files (contain mock data only)
19
+ - Documentation
20
+ - CI/CD configuration
21
+
22
+ ## Sensitive Data Classes
23
+
24
+ None identified. Library is stateless and handles:
25
+ - File paths (find.ts)
26
+ - String parsing (user-agent.ts, pojo.ts)
27
+ - No PII, credentials, or financial data
28
+
29
+ ## Allowed Techniques
30
+
31
+ - Static code analysis
32
+ - Dependency auditing
33
+ - Pattern matching for dangerous APIs
34
+
35
+ ## Forbidden Techniques
36
+
37
+ - Network scanning (N/A - no network exposure)
38
+ - Dynamic exploitation (N/A - library code)
39
+
40
+ ## Assumptions
41
+
42
+ - Library runs in trusted Node.js environment
43
+ - Consumers provide trusted inputs
44
+ - No direct user input handling
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wtasnorg/node-lib",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "node library",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -8,7 +8,8 @@
8
8
  "docs": "./node_modules/.bin/typedoc",
9
9
  "docs:json": "./node_modules/.bin/typedoc --json docs/docs.json",
10
10
  "docs:watch": "./node_modules/.bin/typedoc --watch",
11
- "test": "bash -c 'node --test src/**/*.test.js'"
11
+ "test": "bash -c 'node --test src/**/*.test.js'",
12
+ "lint": "npx eslint src/*.ts --no-warn-ignored"
12
13
  },
13
14
  "keywords": [
14
15
  "library"
@@ -10,6 +10,7 @@ A library project for nodejs. #nodejs #typescript #library
10
10
  1. hello (for debugging)
11
11
  2. `pojo` for converting class objects to Plain Old Javascript Objects.
12
12
  3. `createFindDirectories` as a factory for finding directories; think `find path -type d`.
13
+ 4. `parseUserAgent` for extracting information from user-agent strings.
13
14
 
14
15
  ## Develop
15
16
 
@@ -32,7 +33,7 @@ npm install @wtasnorg/node-lib
32
33
  # check if you can run code
33
34
  import {hello} from "@wtasnorg/node-lib";
34
35
 
35
- await hello();
36
+ await hello();
36
37
  // "hello from @wtasnorg/node-lib"
37
38
  ```
38
39
 
package/src/find.d.ts CHANGED
@@ -1,19 +1,19 @@
1
1
  interface FileSystemDependencies {
2
- readdir: (path: string, opts: {
2
+ readdir: (_path: string, _opts: {
3
3
  withFileTypes: true;
4
4
  }) => Promise<{
5
5
  name: string;
6
6
  isDirectory(): boolean;
7
7
  }[]>;
8
- stat: (path: string) => Promise<{
8
+ stat: (_path: string) => Promise<{
9
9
  isDirectory(): boolean;
10
10
  }>;
11
11
  }
12
12
  interface FindDirectoriesOptions {
13
13
  maxDepth?: number;
14
14
  followSymlinks?: boolean;
15
- allowlist?: string[] | ((absPath: string, name: string) => boolean);
16
- blocklist?: string[] | ((absPath: string, name: string) => boolean);
15
+ allowlist?: string[] | ((_absPath: string, _name: string) => boolean);
16
+ blocklist?: string[] | ((_absPath: string, _name: string) => boolean);
17
17
  }
18
18
  /**
19
19
  * Factory that produces an async findDirectories function with
package/src/find.js CHANGED
@@ -12,8 +12,9 @@ function createFindDirectories(deps) {
12
12
  function isAllowed(absPath, name) {
13
13
  if (allowlist) {
14
14
  if (Array.isArray(allowlist)) {
15
- if (!allowlist.includes(name))
15
+ if (!allowlist.includes(name)) {
16
16
  return false;
17
+ }
17
18
  }
18
19
  else if (!allowlist(absPath, name)) {
19
20
  return false;
@@ -24,8 +25,9 @@ function createFindDirectories(deps) {
24
25
  function isBlocked(absPath, name) {
25
26
  if (blocklist) {
26
27
  if (Array.isArray(blocklist)) {
27
- if (blocklist.includes(name))
28
+ if (blocklist.includes(name)) {
28
29
  return true;
30
+ }
29
31
  }
30
32
  else if (blocklist(absPath, name)) {
31
33
  return true;
@@ -34,18 +36,22 @@ function createFindDirectories(deps) {
34
36
  return false;
35
37
  }
36
38
  async function walk(currentPath, depth) {
37
- if (depth > maxDepth)
39
+ if (depth > maxDepth) {
38
40
  return;
41
+ }
39
42
  const entries = await readdir(currentPath, { withFileTypes: true });
40
43
  for (const entry of entries) {
41
44
  const childPath = resolve(join(currentPath, entry.name));
42
45
  const isDirectory = entry.isDirectory();
43
- if (!isDirectory)
46
+ if (!isDirectory) {
44
47
  continue;
45
- if (isBlocked(childPath, entry.name))
48
+ }
49
+ if (isBlocked(childPath, entry.name)) {
46
50
  continue;
47
- if (!isAllowed(childPath, entry.name))
51
+ }
52
+ if (!isAllowed(childPath, entry.name)) {
48
53
  continue;
54
+ }
49
55
  results.push(childPath);
50
56
  if (depth < maxDepth) {
51
57
  await walk(childPath, depth + 1);
package/src/find.ts CHANGED
@@ -1,15 +1,15 @@
1
1
  import { resolve, join } from "node:path";
2
2
 
3
3
  interface FileSystemDependencies {
4
- readdir: (path: string, opts: { withFileTypes: true }) => Promise<{ name: string; isDirectory(): boolean; }[]>;
5
- stat: (path: string) => Promise<{ isDirectory(): boolean }>;
4
+ readdir: (_path: string, _opts: { withFileTypes: true }) => Promise<{ name: string; isDirectory(): boolean; }[]>;
5
+ stat: (_path: string) => Promise<{ isDirectory(): boolean }>;
6
6
  }
7
7
 
8
8
  interface FindDirectoriesOptions {
9
9
  maxDepth?: number;
10
10
  followSymlinks?: boolean;
11
- allowlist?: string[] | ((absPath: string, name: string) => boolean);
12
- blocklist?: string[] | ((absPath: string, name: string) => boolean);
11
+ allowlist?: string[] | ((_absPath: string, _name: string) => boolean);
12
+ blocklist?: string[] | ((_absPath: string, _name: string) => boolean);
13
13
  }
14
14
 
15
15
  /**
@@ -38,7 +38,7 @@ function createFindDirectories(deps: FileSystemDependencies) {
38
38
  function isAllowed(absPath: string, name: string): boolean {
39
39
  if (allowlist) {
40
40
  if (Array.isArray(allowlist)) {
41
- if (!allowlist.includes(name)) return false;
41
+ if (!allowlist.includes(name)) { return false; }
42
42
  } else if (!allowlist(absPath, name)) {
43
43
  return false;
44
44
  }
@@ -49,7 +49,7 @@ function createFindDirectories(deps: FileSystemDependencies) {
49
49
  function isBlocked(absPath: string, name: string): boolean {
50
50
  if (blocklist) {
51
51
  if (Array.isArray(blocklist)) {
52
- if (blocklist.includes(name)) return true;
52
+ if (blocklist.includes(name)) { return true; }
53
53
  } else if (blocklist(absPath, name)) {
54
54
  return true;
55
55
  }
@@ -58,7 +58,7 @@ function createFindDirectories(deps: FileSystemDependencies) {
58
58
  }
59
59
 
60
60
  async function walk(currentPath: string, depth: number): Promise<void> {
61
- if (depth > maxDepth) return;
61
+ if (depth > maxDepth) { return; }
62
62
 
63
63
  const entries = await readdir(currentPath, { withFileTypes: true });
64
64
 
@@ -67,10 +67,10 @@ function createFindDirectories(deps: FileSystemDependencies) {
67
67
 
68
68
  const isDirectory = entry.isDirectory();
69
69
 
70
- if (!isDirectory) continue;
70
+ if (!isDirectory) { continue; }
71
71
 
72
- if (isBlocked(childPath, entry.name)) continue;
73
- if (!isAllowed(childPath, entry.name)) continue;
72
+ if (isBlocked(childPath, entry.name)) { continue; }
73
+ if (!isAllowed(childPath, entry.name)) { continue; }
74
74
 
75
75
  results.push(childPath);
76
76
 
package/src/index.d.ts CHANGED
@@ -2,6 +2,8 @@ import { hello } from "./hello.js";
2
2
  import { pojo } from "./pojo.js";
3
3
  import type { FindDirectoriesOptions, FileSystemDependencies } from "./find.js";
4
4
  import { createFindDirectories } from "./find.js";
5
- export { hello, pojo, createFindDirectories };
6
- export type { FindDirectoriesOptions, FileSystemDependencies, };
5
+ import type { UserAgentInfo } from "./user-agent.js";
6
+ import { parseUserAgent } from "./user-agent.js";
7
+ export { hello, pojo, createFindDirectories, parseUserAgent };
8
+ export type { FindDirectoriesOptions, FileSystemDependencies, UserAgentInfo, };
7
9
  //# sourceMappingURL=index.d.ts.map
package/src/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { hello } from "./hello.js";
2
2
  import { pojo } from "./pojo.js";
3
3
  import { createFindDirectories } from "./find.js";
4
- export { hello, pojo, createFindDirectories };
4
+ import { parseUserAgent } from "./user-agent.js";
5
+ export { hello, pojo, createFindDirectories, parseUserAgent };
5
6
  //# sourceMappingURL=index.js.map
package/src/index.ts CHANGED
@@ -2,14 +2,18 @@ import { hello } from "./hello.js";
2
2
  import { pojo } from "./pojo.js";
3
3
  import type { FindDirectoriesOptions, FileSystemDependencies } from "./find.js";
4
4
  import { createFindDirectories } from "./find.js";
5
+ import type { UserAgentInfo } from "./user-agent.js";
6
+ import { parseUserAgent } from "./user-agent.js";
5
7
 
6
8
  export {
7
9
  hello,
8
10
  pojo,
9
- createFindDirectories
11
+ createFindDirectories,
12
+ parseUserAgent
10
13
  };
11
14
 
12
15
  export type {
13
16
  FindDirectoriesOptions,
14
17
  FileSystemDependencies,
18
+ UserAgentInfo,
15
19
  };
package/src/pojo.js CHANGED
@@ -8,7 +8,7 @@
8
8
  * @returns {Object<string, unknown>} A plain JavaScript object containing only data fields.
9
9
  */
10
10
  function pojo(instance) {
11
- return Object.fromEntries(Object.entries(instance).filter(([_, value]) => typeof value !== "function"));
11
+ return Object.fromEntries(Object.entries(instance).filter((entry) => typeof entry[1] !== "function"));
12
12
  }
13
13
  export { pojo };
14
14
  //# sourceMappingURL=pojo.js.map
package/src/pojo.test.js CHANGED
@@ -28,9 +28,7 @@ test("pojo() should exclude methods", () => {
28
28
  test("pojo() should exclude prototype properties", () => {
29
29
  class Product {
30
30
  id;
31
- constructor(id) {
32
- this.id = id;
33
- }
31
+ constructor(id) { this.id = id; }
34
32
  get info() {
35
33
  return `Product:${this.id}`;
36
34
  }
package/src/pojo.test.ts CHANGED
@@ -35,7 +35,8 @@ test("pojo() should exclude methods", () => {
35
35
 
36
36
  test("pojo() should exclude prototype properties", () => {
37
37
  class Product {
38
- constructor(public id: number) { }
38
+ id: number;
39
+ constructor(id: number) { this.id = id; }
39
40
 
40
41
  get info() {
41
42
  return `Product:${this.id}`;
package/src/pojo.ts CHANGED
@@ -9,7 +9,7 @@
9
9
  */
10
10
  function pojo<T extends object>(instance: T): Record<string, unknown> {
11
11
  return Object.fromEntries(
12
- Object.entries(instance).filter(([_, value]) => typeof value !== "function")
12
+ Object.entries(instance).filter((entry) => typeof entry[1] !== "function")
13
13
  );
14
14
  }
15
15