@rkmodules/rules 0.0.78 → 0.0.80
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/dist/index.cjs.js +2 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +2 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/lib/DataTree/index.d.ts +3 -3
- package/package.json +1 -1
- package/readme.md +26 -1
|
@@ -45,7 +45,7 @@ export declare function getPaths<T>(tree: Tree<T>): string[];
|
|
|
45
45
|
* @param fn
|
|
46
46
|
* @returns
|
|
47
47
|
*/
|
|
48
|
-
export declare function mapTree<T, U>(tree: Tree<T>, fn: (item: T, path: string, index: number) => U | U[]): Tree<U>;
|
|
48
|
+
export declare function mapTree<T, U>(tree: Tree<T>, fn: (item: T, path: string, index: number) => U | U[] | typeof DISCARD): Tree<U>;
|
|
49
49
|
export declare function mapTreeBranch<T, U>(tree: Tree<T>, fn: (branch: T[], path: string) => U[] | typeof DISCARD): Tree<U>;
|
|
50
50
|
/**
|
|
51
51
|
* n-ary operation on a tree, branch by branch
|
|
@@ -71,7 +71,7 @@ export declare function nAryOnTreeBranch<V>(trees: Tree<any>[], fn: (branches: (
|
|
|
71
71
|
* @param fn
|
|
72
72
|
* @returns
|
|
73
73
|
*/
|
|
74
|
-
export declare function nAryOnTree<R>(trees: Tree<any>[], fn: (items: any[], paths: string[], index: number) => R | R[], fill?: boolean): Tree<R>;
|
|
74
|
+
export declare function nAryOnTree<R>(trees: Tree<any>[], fn: (items: any[], paths: string[], index: number) => R | R[] | typeof DISCARD, fill?: boolean): Tree<R>;
|
|
75
75
|
/**
|
|
76
76
|
* binary operation on a tree, branch by branch
|
|
77
77
|
* - branches are matched by index,
|
|
@@ -97,7 +97,7 @@ export declare function binaryOnTreeBranch<T, U, V>(treeA: Tree<T>, treeB: Tree<
|
|
|
97
97
|
* @param fn
|
|
98
98
|
* @returns
|
|
99
99
|
*/
|
|
100
|
-
export declare function binaryOnTree<T, U, V>(treeA: Tree<T>, treeB: Tree<U>, fn: (itemA: T | undefined, itemB: U | undefined, pathA: string, pathB: string, index: number) => V | V[], fill?: boolean): Tree<V>;
|
|
100
|
+
export declare function binaryOnTree<T, U, V>(treeA: Tree<T>, treeB: Tree<U>, fn: (itemA: T | undefined, itemB: U | undefined, pathA: string, pathB: string, index: number) => V | V[] | typeof DISCARD, fill?: boolean): Tree<V>;
|
|
101
101
|
export declare function treeSize<T>(tree: Tree<T>): number;
|
|
102
102
|
export declare function sameShape(a: Tree<any>, b: Tree<any>): boolean;
|
|
103
103
|
/**
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -45,7 +45,32 @@ We get back to function definitions later
|
|
|
45
45
|
|
|
46
46
|
## editor
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
- Create an instance of the rules engine
|
|
49
|
+
- create a function to work with
|
|
50
|
+
- use the `<Flow>` component to create the editor
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
const engine = new Engine({
|
|
54
|
+
// map of custom rules
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const emptyFunction: GraphedFunction = {
|
|
58
|
+
name: "test",
|
|
59
|
+
body: {},
|
|
60
|
+
outputs: {
|
|
61
|
+
documents: "",
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export default function MyComponent() {
|
|
66
|
+
const [fn, setFn] = React.useState(emptyFunction);
|
|
67
|
+
return (
|
|
68
|
+
<div>
|
|
69
|
+
<Flow function={fn} engine={engine} onChange={setFn} />
|
|
70
|
+
<div>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
```
|
|
49
74
|
|
|
50
75
|
TODO:
|
|
51
76
|
|