@voxgig/struct 0.2.1 → 0.3.0

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
@@ -610,7 +610,7 @@ transform(
610
610
  )
611
611
  // { x: { y: [ { q: 13, r: 13, p: 1 }, { q: 23, r: 23, p: 1 } ] } }
612
612
  ```
613
- <!-- => {"x": {"y": [{"q": 13, "r": 13, "p": 1}, {"q": 23, "r": 23, "p": 1}]}} -->
613
+ <!-- => {"x": {"y": [{"p": 1, "q": 13, "r": 13}, {"p": 1, "q": 23, "r": 23}]}} -->
614
614
 
615
615
  Putting a command in **key** position (or, for `$APPLY`, directly under a map)
616
616
  is an error — commands must be list values:
@@ -632,7 +632,7 @@ validate(
632
632
  // { name: 'Ada', age: 36 }
633
633
  ```
634
634
 
635
- <!-- => {"name": "Ada", "age": 36} -->
635
+ <!-- => {"age": 36, "name": "Ada"} -->
636
636
 
637
637
  <!-- example: select#query -->
638
638
  ```ts
@@ -644,7 +644,7 @@ select(
644
644
  // [{ name: 'Alice', age: 30, $KEY: 'a' }]
645
645
  ```
646
646
 
647
- <!-- => [{"name": "Alice", "age": 30, "$KEY": "a"}] -->
647
+ <!-- => [{"$KEY": "a", "age": 30, "name": "Alice"}] -->
648
648
 
649
649
  ### Builders
650
650
 
@@ -876,13 +876,33 @@ panel and per-port outcomes.
876
876
 
877
877
  ## Build and test
878
878
 
879
+ Building, linting and testing need nothing but this directory. The corpus
880
+ runner is [voxgig/omni](https://github.com/voxgig/omni), taken from npm as
881
+ `@voxgig/omni` — a **devDependency**, the way jest or vitest would be — so
882
+ there is no checkout to find and no `OMNI_HOME` to set. `npm run build` never
883
+ touches it, and `tools/omni-isolation.js` proves nothing shipped can reach it
884
+ (register 4.13).
885
+
886
+ This port is the first to take omni from a registry; the others still resolve
887
+ a checkout.
888
+
879
889
  ```bash
880
890
  cd typescript
881
- npm install
882
- npm run build # tsc -> dist/
883
- npm test # node --test on dist-test/
891
+ npm install # @voxgig/omni comes with it, as a devDependency
892
+ npm run build # tsc -> dist/ (no omni needed)
893
+ npm test # node --test on dist-test/ (omni from node_modules)
884
894
  ```
885
895
 
896
+ No clone, and no `$OMNI_HOME`. `npm ci` is NOT an option here: this repo
897
+ gitignores `package-lock.json` (`.gitignore` line 150) and commits none, so
898
+ there is nothing for it to install from — which is also why `@voxgig/omni` is
899
+ pinned to an exact `"0.1.0"` rather than a caret.
900
+
901
+ [`test/omni.ts`](./test/omni.ts) is the only file that names omni. It imports
902
+ `@voxgig/omni/compat/struct` and makes the corpus path absolute; that last part
903
+ is still needed, because this port's tests compile to two different depths and
904
+ omni's shim resolves a relative path against its caller.
905
+
886
906
  Tests live in [`test/`](./test/) and read fixtures from
887
907
  [`../build/test/`](../build/test/). The test runner consumes the
888
908
  shared JSONIC corpus shared by every language port.
@@ -125,9 +125,12 @@ declare function injectorArgs(argTypes: number[], args: any[]): any;
125
125
  declare function injectChild(child: any, store: any, inj: Injection): Injection;
126
126
  declare class StructUtility {
127
127
  clone: typeof clone;
128
+ condense: typeof condense;
129
+ condenseview: typeof condenseview;
128
130
  delprop: typeof delprop;
129
131
  escre: typeof escre;
130
132
  escurl: typeof escurl;
133
+ expand: typeof expand;
131
134
  filter: typeof filter;
132
135
  flatten: typeof flatten;
133
136
  getdef: typeof getdef;
@@ -137,6 +140,7 @@ declare class StructUtility {
137
140
  haskey: typeof haskey;
138
141
  inject: typeof inject;
139
142
  isempty: typeof isempty;
143
+ iscondensed: typeof iscondensed;
140
144
  isfunc: typeof isfunc;
141
145
  iskey: typeof iskey;
142
146
  islist: typeof islist;
@@ -161,6 +165,12 @@ declare class StructUtility {
161
165
  typename: typeof typename;
162
166
  validate: typeof validate;
163
167
  walk: typeof walk;
168
+ re_compile: typeof re_compile;
169
+ re_find: typeof re_find;
170
+ re_find_all: typeof re_find_all;
171
+ re_replace: typeof re_replace;
172
+ re_test: typeof re_test;
173
+ re_escape: typeof re_escape;
164
174
  SKIP: {
165
175
  '`$SKIP`': boolean;
166
176
  };
@@ -189,5 +199,19 @@ declare class StructUtility {
189
199
  injectorArgs: typeof injectorArgs;
190
200
  injectChild: typeof injectChild;
191
201
  }
192
- export { StructUtility, clone, delprop, escre, escurl, filter, flatten, getdef, getelem, getpath, getprop, haskey, inject, isempty, isfunc, iskey, islist, ismap, isnode, items, join, jsonify, keysof, merge, pad, pathify, select, setpath, setprop, size, slice, strkey, stringify, transform, typify, typename, validate, walk, re_compile, re_find, re_find_all, re_replace, re_test, re_escape, SKIP, DELETE, jm, jt, T_any, T_noval, T_boolean, T_decimal, T_integer, T_number, T_string, T_function, T_symbol, T_null, T_list, T_map, T_instance, T_scalar, T_node, M_KEYPRE, M_KEYPOST, M_VAL, MODENAME, checkPlacement, injectorArgs, injectChild, };
202
+ declare function iscondensed(val: any): boolean;
203
+ declare function condense(val: any): any;
204
+ declare function expand(cond: any): any;
205
+ type CondenseView = {
206
+ get: (path?: any) => any;
207
+ keys: (path?: any) => string[];
208
+ has: (path?: any) => boolean;
209
+ at: (path?: any) => CondenseView;
210
+ value: () => any;
211
+ size: () => number;
212
+ exists: () => boolean;
213
+ ref: () => any;
214
+ };
215
+ declare function condenseview(cond: any, idx?: number, memo?: any): CondenseView;
216
+ export { StructUtility, clone, condense, condenseview, expand, iscondensed, delprop, escre, escurl, filter, flatten, getdef, getelem, getpath, getprop, haskey, inject, isempty, isfunc, iskey, islist, ismap, isnode, items, join, jsonify, keysof, merge, pad, pathify, select, setpath, setprop, size, slice, strkey, stringify, transform, typify, typename, validate, walk, re_compile, re_find, re_find_all, re_replace, re_test, re_escape, SKIP, DELETE, jm, jt, T_any, T_noval, T_boolean, T_decimal, T_integer, T_number, T_string, T_function, T_symbol, T_null, T_list, T_map, T_instance, T_scalar, T_node, M_KEYPRE, M_KEYPOST, M_VAL, MODENAME, checkPlacement, injectorArgs, injectChild, };
193
217
  export type { Injection, Injector, WalkApply };