hinted-tree-merger 6.0.2 → 6.1.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
@@ -1,5 +1,6 @@
1
1
  [![npm](https://img.shields.io/npm/v/hinted-tree-merger.svg)](https://www.npmjs.com/package/hinted-tree-merger)
2
2
  [![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
3
+ [![Typed with TypeScript](https://flat.badgen.net/badge/icon/Typed?icon=typescript\&label\&labelColor=blue\&color=555555)](https://typescriptlang.org)
3
4
  [![bundlejs](https://deno.bundlejs.com/?q=hinted-tree-merger\&badge=detailed)](https://bundlejs.com/?q=hinted-tree-merger)
4
5
  [![downloads](http://img.shields.io/npm/dm/hinted-tree-merger.svg?style=flat-square)](https://npmjs.org/package/hinted-tree-merger)
5
6
  [![GitHub Issues](https://img.shields.io/github/issues/arlac77/hinted-tree-merger.svg?style=flat-square)](https://github.com/arlac77/hinted-tree-merger/issues)
@@ -50,38 +51,46 @@ const r = merge( undefined, [ { k:1, e:2}, { k:3 }]);
50
51
 
51
52
  * [hintFor](#hintfor)
52
53
  * [Parameters](#parameters)
53
- * [mergeSkip](#mergeskip)
54
+ * [Actions](#actions)
54
55
  * [Parameters](#parameters-1)
55
- * [mergeArrays](#mergearrays)
56
+ * [mergeSkip](#mergeskip)
56
57
  * [Parameters](#parameters-2)
57
- * [merge](#merge)
58
+ * [mergeArrays](#mergearrays)
58
59
  * [Parameters](#parameters-3)
59
- * [hasDeleteHint](#hasdeletehint)
60
+ * [merge](#merge)
60
61
  * [Parameters](#parameters-4)
61
- * [isToBeRemoved](#istoberemoved)
62
+ * [hasDeleteHint](#hasdeletehint)
62
63
  * [Parameters](#parameters-5)
63
- * [hintFreeValue](#hintfreevalue)
64
+ * [isToBeRemoved](#istoberemoved)
64
65
  * [Parameters](#parameters-6)
65
- * [indexFor](#indexfor)
66
+ * [hintFreeValue](#hintfreevalue)
66
67
  * [Parameters](#parameters-7)
67
- * [keyFor](#keyfor)
68
+ * [indexFor](#indexfor)
68
69
  * [Parameters](#parameters-8)
69
- * [sortObjectsByKeys](#sortobjectsbykeys)
70
+ * [keyFor](#keyfor)
70
71
  * [Parameters](#parameters-9)
72
+ * [sortObjectsByKeys](#sortobjectsbykeys)
73
+ * [Parameters](#parameters-10)
74
+ * [compareWithDefinedOrder](#comparewithdefinedorder)
75
+ * [Parameters](#parameters-11)
76
+ * [matchingIndex](#matchingindex)
77
+ * [Parameters](#parameters-12)
71
78
  * [match](#match)
79
+ * [cmp](#cmp)
80
+ * [Parameters](#parameters-13)
72
81
  * [compareVersion](#compareversion)
73
- * [Parameters](#parameters-10)
82
+ * [Parameters](#parameters-14)
74
83
  * [unionVersion](#unionversion)
75
- * [Parameters](#parameters-11)
84
+ * [Parameters](#parameters-15)
76
85
  * [VersionMapper](#versionmapper)
77
86
  * [mergeVersionsWithFilter](#mergeversionswithfilter)
78
- * [Parameters](#parameters-12)
87
+ * [Parameters](#parameters-16)
79
88
  * [mergeVersions](#mergeversions)
80
- * [Parameters](#parameters-13)
89
+ * [Parameters](#parameters-17)
81
90
  * [mergeVersionsPreferNumeric](#mergeversionsprefernumeric)
82
- * [Parameters](#parameters-14)
91
+ * [Parameters](#parameters-18)
83
92
  * [walk](#walk)
84
- * [Parameters](#parameters-15)
93
+ * [Parameters](#parameters-19)
85
94
 
86
95
  ## hintFor
87
96
 
@@ -92,6 +101,15 @@ Construct hint for a given path.
92
101
  * `hints` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
93
102
  * `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
94
103
 
104
+ ## Actions
105
+
106
+ Type: [Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)
107
+
108
+ ### Parameters
109
+
110
+ * `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
111
+ * `hints` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
112
+
95
113
  ## mergeSkip
96
114
 
97
115
  Skip merging use left side always.
@@ -111,7 +129,7 @@ Skip merging use left side always.
111
129
  * `a` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** 
112
130
  * `b` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** 
113
131
  * `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
114
- * `actions` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** (optional, default `nullAction`)
132
+ * `actions` **[Actions](#actions)** (optional, default `nullAction`)
115
133
  * `hints` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
116
134
 
117
135
  ## merge
@@ -123,7 +141,7 @@ Merge to values.
123
141
  * `a` **any** 
124
142
  * `b` **any** 
125
143
  * `path`  
126
- * `actions` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>** (optional, default `nullAction`)
144
+ * `actions` **[Actions](#actions)** (optional, default `nullAction`)
127
145
  * `hints` **any**&#x20;
128
146
 
129
147
  Returns **any** merged value
@@ -146,7 +164,7 @@ Should value be removed.
146
164
  * `value` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
147
165
  * `fromTemplate` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
148
166
 
149
- Returns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** true if fromTemplate tells is to delete value
167
+ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** true if fromTemplate tells is to delete value
150
168
 
151
169
  ## hintFreeValue
152
170
 
@@ -177,7 +195,7 @@ Deliver key value to identify object.
177
195
  * `object` **any**&#x20;
178
196
  * `hint` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**&#x20;
179
197
 
180
- Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
198
+ Returns **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))**&#x20;
181
199
 
182
200
  ## sortObjectsByKeys
183
201
 
@@ -190,10 +208,35 @@ Sort keys in source.
190
208
 
191
209
  Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** source with keys orderd by compare function
192
210
 
211
+ ## compareWithDefinedOrder
212
+
213
+ ### Parameters
214
+
215
+ * `a` **any**&#x20;
216
+ * `b` **any**&#x20;
217
+ * `definedOrder` &#x20;
218
+
219
+ ## matchingIndex
220
+
221
+ ### Parameters
222
+
223
+ * `value` **any**&#x20;
224
+
225
+ Returns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**&#x20;
226
+
193
227
  ## match
194
228
 
195
229
  url means highest version
196
230
 
231
+ ## cmp
232
+
233
+ ### Parameters
234
+
235
+ * `a` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)>**&#x20;
236
+ * `b` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)>**&#x20;
237
+
238
+ Returns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**&#x20;
239
+
197
240
  ## compareVersion
198
241
 
199
242
  Compare two versions.
package/package.json CHANGED
@@ -1,12 +1,16 @@
1
1
  {
2
2
  "name": "hinted-tree-merger",
3
- "version": "6.0.2",
3
+ "version": "6.1.1",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
7
7
  },
8
+ "types": "./types/index.d.mts",
8
9
  "exports": {
9
- ".": "./src/index.mjs"
10
+ ".": {
11
+ "default": "./src/index.mjs",
12
+ "types": "./types/index.d.mts"
13
+ }
10
14
  },
11
15
  "description": "merges two trees guided with hints",
12
16
  "keywords": [
@@ -24,24 +28,26 @@
24
28
  ],
25
29
  "license": "BSD-2-Clause",
26
30
  "scripts": {
27
- "prepare": "npx playwright install",
31
+ "prepare": "tsc --allowJs --declaration --emitDeclarationOnly --declarationDir types -t esnext -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs",
28
32
  "test": "npm run test:browser-ava && npm run test:ava",
29
33
  "test:ava": "ava --timeout 4m tests/*-ava.mjs tests/*-ava-node.mjs",
30
34
  "test:browser-ava": "browser-ava --headless --no-keep-open tests/*-ava.mjs tests/*-ava-browser.mjs",
31
35
  "cover": "c8 -x 'tests/**/*' --temp-directory build/tmp ava --timeout 4m tests/*-ava.mjs tests/*-ava-node.mjs && c8 report -r lcov -o build/coverage --temp-directory build/tmp",
32
36
  "docs": "documentation readme --section=API ./src/**/*.mjs",
33
- "lint": "npm run lint:docs",
34
- "lint:docs": "documentation lint ./src/**/*.mjs"
37
+ "lint": "npm run lint:docs && npm run lint:tsc",
38
+ "lint:docs": "documentation lint ./src/**/*.mjs",
39
+ "lint:tsc": "tsc --allowJs --checkJs --noEmit -t esnext -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs"
35
40
  },
36
41
  "devDependencies": {
37
42
  "ava": "^6.1.1",
38
43
  "browser-ava": "^2.2.0",
39
44
  "c8": "^9.1.0",
40
45
  "documentation": "^14.0.3",
41
- "semantic-release": "^23.0.2"
46
+ "semantic-release": "^23.0.2",
47
+ "typescript": "^5.3.3"
42
48
  },
43
49
  "engines": {
44
- "node": ">=20.11.0"
50
+ "node": ">=20.11.1"
45
51
  },
46
52
  "repository": {
47
53
  "type": "git",
@@ -56,7 +62,8 @@
56
62
  "arlac77/template-arlac77-github",
57
63
  "arlac77/template-browser-ava",
58
64
  "arlac77/template-javascript-component",
59
- "arlac77/template-node-component"
65
+ "arlac77/template-node-component",
66
+ "arlac77/template-typescript"
60
67
  ]
61
68
  }
62
69
  }
package/src/merger.mjs CHANGED
@@ -12,9 +12,15 @@ import {
12
12
  compareWithDefinedOrder,
13
13
  sortObjectsByKeys
14
14
  } from "./util.mjs";
15
-
16
15
  import { hintFor } from "./hint.mjs";
17
16
 
17
+ /**
18
+ * @callback Actions
19
+ * @param {Object} options
20
+ * @param {Object} hints
21
+ */
22
+
23
+
18
24
  function appendPath(path, suffix, separator = "") {
19
25
  return path === undefined || path.length === 0
20
26
  ? suffix
@@ -33,7 +39,7 @@ export function mergeSkip(a, b, path, actions, hints) {
33
39
  * @param {Array} a
34
40
  * @param {Array} b
35
41
  * @param {string} path
36
- * @param {Function} actions
42
+ * @param {Actions} actions
37
43
  * @param {Object} hints
38
44
  */
39
45
  export function mergeArrays(a, b, path, actions = nullAction, hints) {
@@ -116,7 +122,7 @@ export function mergeArrays(a, b, path, actions = nullAction, hints) {
116
122
  * Merge to values.
117
123
  * @param {any} a
118
124
  * @param {any} b
119
- * @param {Object[]} actions
125
+ * @param {Actions} actions
120
126
  * @param {any} hints
121
127
  * @return {any} merged value
122
128
  */
@@ -1,5 +1,10 @@
1
1
  import { nullAction } from "./util.mjs";
2
- import { hintFor, DELETE_HINT_REGEX, OVERWRITE_HINT_REGEX, LIKE_HINT_REGEX } from "./hint.mjs";
2
+ import {
3
+ hintFor,
4
+ DELETE_HINT_REGEX,
5
+ OVERWRITE_HINT_REGEX,
6
+ LIKE_HINT_REGEX
7
+ } from "./hint.mjs";
3
8
 
4
9
  export function mergeExpressions(a, b, path, actions = nullAction, hints) {
5
10
  if (a === undefined && b === undefined) {
@@ -63,7 +68,7 @@ export function decodeExpressions(script, hint) {
63
68
  like,
64
69
  overwrite,
65
70
  op: "&&",
66
- args: script.split(/\s*&&\s*/).map(v=>v.trim())
71
+ args: script.split(/\s*&&\s*/).map(v => v.trim())
67
72
  };
68
73
  }
69
74
  return { op: "", args: [script.trim()], overwrite, like };
@@ -84,11 +89,12 @@ function mergeLIKE(a, b) {
84
89
  const args = x => (x === undefined ? [] : x.args);
85
90
 
86
91
  //const t = args(a).concat(args(b));
87
- const t="";
88
- console.log(args(b))
92
+ const t = "";
93
+ console.log(args(b));
89
94
 
90
95
  return {
91
96
  op: "&&",
97
+ // @ts-ignore
92
98
  args: t.filter((item, pos) => t.indexOf(item) === pos)
93
99
  };
94
100
  }
package/src/util.mjs CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  OVERWRITE_HINT_REGEX
5
5
  } from "./hint.mjs";
6
6
 
7
- export function nullAction() {}
7
+ export function nullAction(options,hint) {}
8
8
 
9
9
  export function asArray(a) {
10
10
  return Array.isArray(a) ? a : a === undefined ? [] : [a];
@@ -42,6 +42,7 @@ export function hasDeleteHint(value, expected) {
42
42
  }
43
43
 
44
44
  if (value === `-${expected}`) {
45
+ // @ts-ignore
45
46
  return expected;
46
47
  }
47
48
  }
@@ -53,7 +54,7 @@ export function hasDeleteHint(value, expected) {
53
54
  * Should value be removed.
54
55
  * @param {string} value
55
56
  * @param {string} fromTemplate
56
- * @return {number} true if fromTemplate tells is to delete value
57
+ * @return {Object} true if fromTemplate tells is to delete value
57
58
  */
58
59
  export function isToBeRemoved(value, fromTemplate) {
59
60
  if (fromTemplate === undefined) {
@@ -301,7 +302,7 @@ function normalizeValue(value, hint) {
301
302
  * Deliver key value to identify object.
302
303
  * @param {any} object
303
304
  * @param {Object} hint
304
- * @return {string}
305
+ * @return {string|undefined}
305
306
  */
306
307
  export function keyFor(object, hint) {
307
308
  if (hint?.key) {
@@ -319,8 +320,6 @@ export function keyFor(object, hint) {
319
320
  .map(k => normalizeValue(object[k], hint))
320
321
  .find(v => v !== undefined);
321
322
  }
322
-
323
- return undefined;
324
323
  }
325
324
 
326
325
  /**
@@ -339,11 +338,22 @@ export function sortObjectsByKeys(source, compare) {
339
338
  return sorted;
340
339
  }
341
340
 
341
+ /**
342
+ *
343
+ * @param {any} a
344
+ * @param {any} b
345
+ */
342
346
  export function compareWithDefinedOrder(a, b, definedOrder) {
347
+ /**
348
+ *
349
+ * @param {any} value
350
+ * @returns {number}
351
+ */
343
352
  function matchingIndex(value) {
344
353
  for (const i in definedOrder) {
345
354
  const o = definedOrder[i];
346
355
  if ((o instanceof RegExp && value.match(o)) || o === value) {
356
+ // @ts-ignore
347
357
  return i;
348
358
  }
349
359
  }
package/src/versions.mjs CHANGED
@@ -112,8 +112,15 @@ export function composeVersion(decomposed) {
112
112
  return joinSlots(decomposed.lower);
113
113
  }
114
114
 
115
+ /**
116
+ *
117
+ * @param {number[]} a
118
+ * @param {number[]} b
119
+ * @returns {number}
120
+ */
115
121
  function cmp(a, b) {
116
122
  for (const i in a) {
123
+ // @ts-ignore
117
124
  if (i >= a.length) {
118
125
  break;
119
126
  }
@@ -140,9 +147,6 @@ export function compareVersion(a, b) {
140
147
  const da = decomposeVersion(a);
141
148
  const db = decomposeVersion(b);
142
149
 
143
- //console.log(a, da);
144
- //console.log(b, db);
145
-
146
150
  const r = cmp(da.lower, db.lower);
147
151
  return r === 0 ? cmp(da.upper, db.upper) : r;
148
152
  }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Construct hint for a given path.
3
+ * @param {Object} hints
4
+ * @param {string} path
5
+ */
6
+ export function hintFor(hints: any, path: string): any;
7
+ export const SHORT_DELETE_HINT_REGEX: RegExp;
8
+ export const DELETE_HINT_REGEX: RegExp;
9
+ export const OVERWRITE_HINT_REGEX: RegExp;
10
+ export const LIKE_HINT_REGEX: RegExp;
@@ -0,0 +1,6 @@
1
+ export * from "./versions.mjs";
2
+ export * from "./walker.mjs";
3
+ export * from "./string-expressions.mjs";
4
+ export * from "./util.mjs";
5
+ export * from "./merger.mjs";
6
+ export * from "./reanimate-hints.mjs";
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Skip merging use left side always.
3
+ */
4
+ export function mergeSkip(a: any, b: any, path: any, actions: any, hints: any): any;
5
+ /**
6
+ *
7
+ * @param {Array} a
8
+ * @param {Array} b
9
+ * @param {string} path
10
+ * @param {Actions} actions
11
+ * @param {Object} hints
12
+ */
13
+ export function mergeArrays(a: any[], b: any[], path: string, actions: Actions, hints: any): any[];
14
+ /**
15
+ * Merge to values.
16
+ * @param {any} a
17
+ * @param {any} b
18
+ * @param {Actions} actions
19
+ * @param {any} hints
20
+ * @return {any} merged value
21
+ */
22
+ export function merge(a: any, b: any, path: any, actions: Actions, hints: any): any;
23
+ export type Actions = (options: any, hints: any) => any;
@@ -0,0 +1 @@
1
+ export function reanimateHints(hints: any): any;
@@ -0,0 +1,15 @@
1
+ export function mergeExpressions(a: any, b: any, path: any, actions: typeof nullAction, hints: any): any;
2
+ export function decodeExpressions(script: any, hint: any): {
3
+ op: string;
4
+ args: any;
5
+ like?: undefined;
6
+ overwrite?: undefined;
7
+ } | {
8
+ like: boolean;
9
+ overwrite: boolean;
10
+ op: string;
11
+ args: any;
12
+ };
13
+ export function mergeDecodedExpressions(dest: any, source: any): any;
14
+ export function encodeExpressions(encoded: any): any;
15
+ import { nullAction } from "./util.mjs";
@@ -0,0 +1,54 @@
1
+ export function nullAction(options: any, hint: any): void;
2
+ export function asArray(a: any): any[];
3
+ export function compare(a: any, b: any): 0 | 1 | -1;
4
+ /**
5
+ * @param {any} value
6
+ * @param {string|Function} expected
7
+ * @return {string|boolean}
8
+ */
9
+ export function hasDeleteHint(value: any, expected: string | Function): string | boolean;
10
+ /**
11
+ * Should value be removed.
12
+ * @param {string} value
13
+ * @param {string} fromTemplate
14
+ * @return {Object} true if fromTemplate tells is to delete value
15
+ */
16
+ export function isToBeRemoved(value: string, fromTemplate: string): any;
17
+ /**
18
+ * Remove hint(s) form a value.
19
+ * @param {string|any} value
20
+ * @returns {any} value without hint
21
+ */
22
+ export function hintFreeValue(value: string | any): any;
23
+ export function removeHintedValues(object: any, removeEmpty?: boolean): any;
24
+ export function deepCopy(object: any): any;
25
+ export function isEmpty(a: any): boolean;
26
+ export function isEqual(a: any, b: any, hints: any): boolean;
27
+ export function isScalar(a: any): boolean;
28
+ /**
29
+ * Find best insertion point for b[i] in a.
30
+ * @param {any[]} b
31
+ * @param {number} i
32
+ * @param {any[]} a
33
+ */
34
+ export function indexFor(b: any[], i: number, a: any[]): number;
35
+ /**
36
+ * Deliver key value to identify object.
37
+ * @param {any} object
38
+ * @param {Object} hint
39
+ * @return {string|undefined}
40
+ */
41
+ export function keyFor(object: any, hint: any): string | undefined;
42
+ /**
43
+ * Sort keys in source.
44
+ * @param {Object} source
45
+ * @param compare
46
+ * @return {Object} source with keys orderd by compare function
47
+ */
48
+ export function sortObjectsByKeys(source: any, compare: any): any;
49
+ /**
50
+ *
51
+ * @param {any} a
52
+ * @param {any} b
53
+ */
54
+ export function compareWithDefinedOrder(a: any, b: any, definedOrder: any): number;
@@ -0,0 +1,63 @@
1
+ export function decomposeVersion(value: any): {
2
+ lower: any;
3
+ upper: any;
4
+ };
5
+ export function composeVersion(decomposed: any): any;
6
+ /**
7
+ * Compare two versions.
8
+ *
9
+ * @param {string|number} a
10
+ * @param {string|number} b
11
+ * @return {number} -1 if a < b, 0 if a == b and 1 if a > b
12
+ */
13
+ export function compareVersion(a: string | number, b: string | number): number;
14
+ /**
15
+ * Forms union of two versions.
16
+ * @param {string|number} a
17
+ * @param {string|number} b
18
+ * @return {string|number}
19
+ */
20
+ export function unionVersion(a: string | number, b: string | number): string | number;
21
+ export function toBeRemoved(value: any): boolean;
22
+ /**
23
+ * maps version values (to number)
24
+ * @typedef {Function} VersionMapper
25
+ */
26
+ /**
27
+ * Merge and filter two sets of version (expressions).
28
+ * @param {string|string[]|number|number[]} a
29
+ * @param {string|string[]|number|number[]} b
30
+ * @param {string} path location in the tree
31
+ * @param {Function} actions cb to notify about the actual selection
32
+ * @param {Object} hints
33
+ * @param {VersionMapper} filter
34
+ * @return {string|string[]|number|number[]} merged set of version expressions
35
+ */
36
+ export function mergeVersionsWithFilter(a: string | string[] | number | number[], b: string | string[] | number | number[], path: string, actions: Function, hints: any, filter: VersionMapper): string | string[] | number | number[];
37
+ /**
38
+ * merge two sets of version (expressions)
39
+ * @param {string|string[]|number|number[]} a
40
+ * @param {string|string[]|number|number[]} b
41
+ * @param {string} path location in the tree
42
+ * @param {Function} actions cb to notify about the actual selection
43
+ * @param {Object} hints
44
+ * @return {string|string[]|number|number[]} merged set of version expressions
45
+ */
46
+ export function mergeVersions(a: string | string[] | number | number[], b: string | string[] | number | number[], path: string, actions: Function, hints: any): string | string[] | number | number[];
47
+ export function mergeVersionsLargest(a: any, b: any, path: any, actions: any, hints: any): string | number | string[] | number[];
48
+ export function mergeVersionsSmallest(a: any, b: any, path: any, actions: any, hints: any): string | number | string[] | number[];
49
+ /**
50
+ * Same as mergeVersions but merge result are converted into
51
+ * numbers if possible
52
+ * @param {string|string[]|number|number[]} a
53
+ * @param {string|string[]|number|number[]} b
54
+ * @param {string} path location in the tree
55
+ * @param {Function} actions cb to notify about the actual selection
56
+ * @param {Object} hints
57
+ * @return {string|string[]|number|number[]} merged set of version expressions
58
+ */
59
+ export function mergeVersionsPreferNumeric(a: string | string[] | number | number[], b: string | string[] | number | number[], path: string, actions: Function, hints: any): string | string[] | number | number[];
60
+ /**
61
+ * maps version values (to number)
62
+ */
63
+ export type VersionMapper = Function;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Iterates over all members.
3
+ * @param {any} value
4
+ * @param {any[]} path
5
+ */
6
+ export function walk(value: any, path?: any[], parents?: any[]): any;