@qezor/structkit 1.0.0 → 1.0.1

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
@@ -21,7 +21,6 @@ npm install @qezor/structkit
21
21
  - no callback-style APIs
22
22
  - no recursion-heavy deep walkers
23
23
  - predictable helpers for arrays, objects, and paths
24
- - a shared Qezor Bridge contract so other libraries can detect capabilities cleanly
25
24
 
26
25
  ## Main Helpers
27
26
 
@@ -81,17 +80,6 @@ const merged = mergeDeep({}, { demand: { joinedUnits: 12 } }, { demand: { buyers
81
80
  const same = isEqual(merged, { demand: { joinedUnits: 12, buyers: 3 } })
82
81
  ```
83
82
 
84
- ## Qezor Bridge
85
-
86
- The root export carries bridge metadata through `Symbol.for("qezor.bridge")`.
87
-
88
- That lets other Qezor libraries detect things like:
89
- - `structure`
90
- - `structure:array`
91
- - `structure:object`
92
- - `structure:path`
93
- - `structure:compare`
94
-
95
83
  ## Notes
96
84
 
97
85
  - deep clone, deep merge, and deep equality use iterative walkers instead of recursion
package/index.d.ts CHANGED
@@ -6,21 +6,6 @@ export type Iteratee<T = unknown, R = unknown> =
6
6
  | null
7
7
  | undefined
8
8
 
9
- export interface QezorBridge {
10
- name: string
11
- kind: string
12
- version: string
13
- capabilities: string[]
14
- adapters: string[]
15
- dependencies: string[]
16
- }
17
-
18
- export const QEZOR_BRIDGE: unique symbol
19
- export function createQezorBridge(input?: Partial<QezorBridge>): QezorBridge
20
- export function attachQezorBridge<T extends object>(target: T, input?: Partial<QezorBridge>): T
21
- export function readQezorBridge(target: unknown): QezorBridge | null
22
- export function hasQezorCapability(target: unknown, capability: string): boolean
23
-
24
9
  export function toArray<T = unknown>(value: unknown): T[]
25
10
  export function chunk<T = unknown>(value: unknown, size?: number): T[][]
26
11
  export function compact<T = unknown>(value: unknown): T[]
package/index.js CHANGED
@@ -1,30 +1,11 @@
1
1
  "use strict"
2
2
 
3
- const bridge = require("./lib/bridge.js")
4
3
  const array = require("./lib/array.js")
5
4
  const object = require("./lib/object.js")
6
5
  const compare = require("./lib/compare.js")
7
6
 
8
- module.exports = bridge.attachQezorBridge({
7
+ module.exports = {
9
8
  ...array,
10
9
  ...object,
11
10
  ...compare,
12
- QEZOR_BRIDGE: bridge.QEZOR_BRIDGE,
13
- createQezorBridge: bridge.createQezorBridge,
14
- attachQezorBridge: bridge.attachQezorBridge,
15
- readQezorBridge: bridge.readQezorBridge,
16
- hasQezorCapability: bridge.hasQezorCapability,
17
- }, {
18
- name: "@qezor/structkit",
19
- kind: "library",
20
- version: "1.0.0",
21
- capabilities: [
22
- "bridge",
23
- "structure",
24
- "structure:array",
25
- "structure:object",
26
- "structure:path",
27
- "structure:compare",
28
- ],
29
- adapters: ["plain-data"],
30
- })
11
+ }
package/index.mjs CHANGED
@@ -29,11 +29,6 @@ export const {
29
29
  cloneDeep,
30
30
  mergeDeep,
31
31
  isEqual,
32
- QEZOR_BRIDGE,
33
- createQezorBridge,
34
- attachQezorBridge,
35
- readQezorBridge,
36
- hasQezorCapability,
37
32
  } = mod
38
33
 
39
34
  export default mod
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qezor/structkit",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Iterative array and object utilities for high-use data shaping without callback hell or recursion-heavy internals.",
5
5
  "files": [
6
6
  "LICENSE",
@@ -8,9 +8,6 @@
8
8
  "index.js",
9
9
  "index.mjs",
10
10
  "index.d.ts",
11
- "bridge.js",
12
- "bridge.mjs",
13
- "bridge.d.ts",
14
11
  "lib",
15
12
  "test.js"
16
13
  ],
@@ -22,12 +19,6 @@
22
19
  "require": "./index.js",
23
20
  "import": "./index.mjs",
24
21
  "default": "./index.js"
25
- },
26
- "./bridge": {
27
- "types": "./bridge.d.ts",
28
- "require": "./bridge.js",
29
- "import": "./bridge.mjs",
30
- "default": "./bridge.js"
31
22
  }
32
23
  },
33
24
  "scripts": {
package/test.js CHANGED
@@ -83,8 +83,13 @@ test("isEqual handles deep and cyclic values without recursion", () => {
83
83
  assert.equal(structkit.isEqual(left, { demand: { buyers: [1, 2] } }), false)
84
84
  })
85
85
 
86
- test("bridge metadata is attached", () => {
87
- const bridge = structkit.readQezorBridge(structkit)
88
- assert.equal(bridge.name, "@qezor/structkit")
89
- assert.equal(structkit.hasQezorCapability(structkit, "structure:path"), true)
86
+ test("mapValues and defaults keep object helpers practical", () => {
87
+ assert.deepEqual(
88
+ structkit.mapValues({ a: 1, b: 2 }, (value) => value * 10),
89
+ { a: 10, b: 20 }
90
+ )
91
+ assert.deepEqual(
92
+ structkit.defaults({ a: 1 }, { a: 5, b: 6 }),
93
+ { a: 1, b: 6 }
94
+ )
90
95
  })
package/bridge.d.ts DELETED
@@ -1,14 +0,0 @@
1
- export interface QezorBridge {
2
- name: string
3
- kind: string
4
- version: string
5
- capabilities: string[]
6
- adapters: string[]
7
- dependencies: string[]
8
- }
9
-
10
- export const QEZOR_BRIDGE: unique symbol
11
- export function createQezorBridge(input?: Partial<QezorBridge>): QezorBridge
12
- export function attachQezorBridge<T extends object>(target: T, input?: Partial<QezorBridge>): T
13
- export function readQezorBridge(target: unknown): QezorBridge | null
14
- export function hasQezorCapability(target: unknown, capability: string): boolean
package/bridge.js DELETED
@@ -1,3 +0,0 @@
1
- "use strict"
2
-
3
- module.exports = require("./lib/bridge.js")
package/bridge.mjs DELETED
@@ -1,11 +0,0 @@
1
- import mod from "./bridge.js"
2
-
3
- export const {
4
- QEZOR_BRIDGE,
5
- createQezorBridge,
6
- attachQezorBridge,
7
- readQezorBridge,
8
- hasQezorCapability,
9
- } = mod
10
-
11
- export default mod
package/lib/bridge.js DELETED
@@ -1,49 +0,0 @@
1
- "use strict"
2
-
3
- const QEZOR_BRIDGE = Symbol.for("qezor.bridge")
4
-
5
- function normalizeList(values) {
6
- if (!Array.isArray(values)) return []
7
- return [...new Set(values.map((value) => String(value).trim()).filter(Boolean))].sort()
8
- }
9
-
10
- function createQezorBridge(input = {}) {
11
- return {
12
- name: input.name || "unknown",
13
- kind: input.kind || "library",
14
- version: input.version || "0.0.0",
15
- capabilities: normalizeList(input.capabilities),
16
- adapters: normalizeList(input.adapters),
17
- dependencies: normalizeList(input.dependencies),
18
- }
19
- }
20
-
21
- function attachQezorBridge(target, input = {}) {
22
- const bridge = createQezorBridge(input)
23
- Object.defineProperty(target, QEZOR_BRIDGE, {
24
- enumerable: false,
25
- configurable: true,
26
- writable: false,
27
- value: bridge,
28
- })
29
- return target
30
- }
31
-
32
- function readQezorBridge(target) {
33
- if (!target || (typeof target !== "object" && typeof target !== "function")) return null
34
- return target[QEZOR_BRIDGE] || null
35
- }
36
-
37
- function hasQezorCapability(target, capability) {
38
- const bridge = readQezorBridge(target)
39
- if (!bridge) return false
40
- return bridge.capabilities.includes(String(capability))
41
- }
42
-
43
- module.exports = {
44
- QEZOR_BRIDGE,
45
- createQezorBridge,
46
- attachQezorBridge,
47
- readQezorBridge,
48
- hasQezorCapability,
49
- }