1 | ;
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.createCmp = void 0;
|
4 | /** @internal */
|
5 | function createCmp(cmp) {
|
6 | return (...items) => {
|
7 | const count = items.length;
|
8 | if (count === 0) {
|
9 | throw new Error('Must provide one or more arguments');
|
10 | }
|
11 | let result = items[0];
|
12 | for (let i = 1; i < count; i++) {
|
13 | if (cmp(items[i], result)) {
|
14 | result = items[i];
|
15 | }
|
16 | }
|
17 | return result;
|
18 | };
|
19 | }
|
20 | exports.createCmp = createCmp;
|