@vinicunca/eslint-config 2.0.0-beta.9 → 2.0.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/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import process2 from "process";
3
3
  import { isPackageExists } from "local-pkg";
4
4
 
5
- // ../node_modules/.pnpm/@vinicunca+perkakas@0.0.4/node_modules/@vinicunca/perkakas/dist/es/function/purry.js
5
+ // ../node_modules/.pnpm/@vinicunca+perkakas@0.0.10/node_modules/@vinicunca/perkakas/dist/index.js
6
6
  function purry(fn, args, lazy) {
7
7
  const diff = fn.length - args.length;
8
8
  const arrayArgs = Array.from(args);
@@ -19,13 +19,35 @@ function purry(fn, args, lazy) {
19
19
  }
20
20
  throw new Error("Wrong number of arguments");
21
21
  }
22
-
23
- // ../node_modules/.pnpm/@vinicunca+perkakas@0.0.4/node_modules/@vinicunca/perkakas/dist/es/guard/is-boolean.js
24
22
  function isBoolean(data) {
25
23
  return typeof data === "boolean";
26
24
  }
27
-
28
- // ../node_modules/.pnpm/@vinicunca+perkakas@0.0.4/node_modules/@vinicunca/perkakas/dist/es/utils/reduce-lazy.js
25
+ function isDefined(data) {
26
+ return typeof data !== "undefined" && data !== null;
27
+ }
28
+ ((isDefined2) => {
29
+ function strict(data) {
30
+ return data !== void 0;
31
+ }
32
+ isDefined2.strict = strict;
33
+ })(isDefined || (isDefined = {}));
34
+ function _countBy(indexed) {
35
+ return (array, fn) => {
36
+ return array.reduce((ret, item, index) => {
37
+ const value = indexed ? fn(item, index, array) : fn(item);
38
+ return ret + (value ? 1 : 0);
39
+ }, 0);
40
+ };
41
+ }
42
+ function countBy(...args) {
43
+ return purry(_countBy(false), args);
44
+ }
45
+ ((countBy2) => {
46
+ function indexed(...args) {
47
+ return purry(_countBy(true), args);
48
+ }
49
+ countBy2.indexed = indexed;
50
+ })(countBy || (countBy = {}));
29
51
  function _reduceLazy(array, lazy, indexed) {
30
52
  const newArray = [];
31
53
  for (let index = 0; index < array.length; index++) {
@@ -39,25 +61,815 @@ function _reduceLazy(array, lazy, indexed) {
39
61
  }
40
62
  return newArray;
41
63
  }
42
-
43
- // ../node_modules/.pnpm/@vinicunca+perkakas@0.0.4/node_modules/@vinicunca/perkakas/dist/es/array/uniq.js
44
- function uniq() {
45
- return purry(_uniq, arguments, uniq.lazy);
64
+ function differenceWith(...args) {
65
+ return purry(_differenceWith, args, differenceWith.lazy);
66
+ }
67
+ function _differenceWith(array, other, isEquals) {
68
+ const lazy = differenceWith.lazy(other, isEquals);
69
+ return _reduceLazy(array, lazy);
70
+ }
71
+ ((differenceWith2) => {
72
+ function lazy(other, isEquals) {
73
+ return (value) => {
74
+ if (other.every((otherValue) => !isEquals(value, otherValue))) {
75
+ return {
76
+ done: false,
77
+ hasNext: true,
78
+ next: value
79
+ };
80
+ }
81
+ return {
82
+ done: false,
83
+ hasNext: false
84
+ };
85
+ };
86
+ }
87
+ differenceWith2.lazy = lazy;
88
+ })(differenceWith || (differenceWith = {}));
89
+ function difference(...args) {
90
+ return purry(_difference, args, difference.lazy);
91
+ }
92
+ function _difference(array, other) {
93
+ const lazy = difference.lazy(other);
94
+ return _reduceLazy(array, lazy);
95
+ }
96
+ ((difference2) => {
97
+ function lazy(other) {
98
+ const set2 = new Set(other);
99
+ return (value) => {
100
+ if (!set2.has(value)) {
101
+ return {
102
+ done: false,
103
+ hasNext: true,
104
+ next: value
105
+ };
106
+ }
107
+ return {
108
+ done: false,
109
+ hasNext: false
110
+ };
111
+ };
112
+ }
113
+ difference2.lazy = lazy;
114
+ })(difference || (difference = {}));
115
+ function drop(...args) {
116
+ return purry(_drop, args, drop.lazy);
117
+ }
118
+ function _drop(array, n) {
119
+ return _reduceLazy(array, drop.lazy(n));
120
+ }
121
+ ((drop2) => {
122
+ function lazy(n) {
123
+ let left = n;
124
+ return (value) => {
125
+ if (left > 0) {
126
+ left--;
127
+ return {
128
+ done: false,
129
+ hasNext: false
130
+ };
131
+ }
132
+ return {
133
+ done: false,
134
+ hasNext: true,
135
+ next: value
136
+ };
137
+ };
138
+ }
139
+ drop2.lazy = lazy;
140
+ })(drop || (drop = {}));
141
+ function toLazyIndexed(fn) {
142
+ fn.indexed = true;
143
+ return fn;
144
+ }
145
+ function filter(...args) {
146
+ return purry(_filter(false), args, filter.lazy);
147
+ }
148
+ function _filter(indexed) {
149
+ return (array, fn) => {
150
+ return _reduceLazy(
151
+ array,
152
+ indexed ? filter.lazyIndexed(fn) : filter.lazy(fn),
153
+ indexed
154
+ );
155
+ };
156
+ }
157
+ function _lazy(indexed) {
158
+ return (fn) => {
159
+ return (value, index, array) => {
160
+ const valid = indexed ? fn(value, index, array) : fn(value);
161
+ if (valid) {
162
+ return {
163
+ done: false,
164
+ hasNext: true,
165
+ next: value
166
+ };
167
+ }
168
+ return {
169
+ done: false,
170
+ hasNext: false
171
+ };
172
+ };
173
+ };
174
+ }
175
+ ((filter2) => {
176
+ function indexed(...args) {
177
+ return purry(_filter(true), args, filter2.lazyIndexed);
178
+ }
179
+ filter2.indexed = indexed;
180
+ filter2.lazy = _lazy(false);
181
+ filter2.lazyIndexed = toLazyIndexed(_lazy(true));
182
+ })(filter || (filter = {}));
183
+ function toSingle(fn) {
184
+ fn.single = true;
185
+ return fn;
186
+ }
187
+ function findIndex(...args) {
188
+ return purry(_findIndex(false), args, findIndex.lazy);
189
+ }
190
+ function _findIndex(indexed) {
191
+ return (array, fn) => {
192
+ if (indexed) {
193
+ return array.findIndex(fn);
194
+ }
195
+ return array.findIndex((x) => fn(x));
196
+ };
197
+ }
198
+ function _lazy2(indexed) {
199
+ return (fn) => {
200
+ let i = 0;
201
+ return (value, index, array) => {
202
+ const valid = indexed ? fn(value, index, array) : fn(value);
203
+ if (valid) {
204
+ return {
205
+ done: true,
206
+ hasNext: true,
207
+ next: i
208
+ };
209
+ }
210
+ i++;
211
+ return {
212
+ done: false,
213
+ hasNext: false
214
+ };
215
+ };
216
+ };
217
+ }
218
+ ((findIndex2) => {
219
+ function indexed(...args) {
220
+ return purry(_findIndex(true), args, findIndex2.lazyIndexed);
221
+ }
222
+ findIndex2.indexed = indexed;
223
+ findIndex2.lazy = toSingle(_lazy2(false));
224
+ findIndex2.lazyIndexed = toSingle(toLazyIndexed(_lazy2(true)));
225
+ })(findIndex || (findIndex = {}));
226
+ function findLastIndex(...args) {
227
+ return purry(_findLastIndex(false), args);
228
+ }
229
+ function _findLastIndex(indexed) {
230
+ return (array, fn) => {
231
+ for (let i = array.length - 1; i >= 0; i--) {
232
+ if (indexed ? fn(array[i], i, array) : fn(array[i])) {
233
+ return i;
234
+ }
235
+ }
236
+ return -1;
237
+ };
238
+ }
239
+ ((findLastIndex2) => {
240
+ function indexed(...args) {
241
+ return purry(_findLastIndex(true), args);
242
+ }
243
+ findLastIndex2.indexed = indexed;
244
+ })(findLastIndex || (findLastIndex = {}));
245
+ function findLast(...args) {
246
+ return purry(_findLast(false), args);
247
+ }
248
+ function _findLast(indexed) {
249
+ return (array, fn) => {
250
+ for (let i = array.length - 1; i >= 0; i--) {
251
+ if (indexed ? fn(array[i], i, array) : fn(array[i])) {
252
+ return array[i];
253
+ }
254
+ }
255
+ };
256
+ }
257
+ ((findLast2) => {
258
+ function indexed(...args) {
259
+ return purry(_findLast(true), args);
260
+ }
261
+ findLast2.indexed = indexed;
262
+ })(findLast || (findLast = {}));
263
+ function find(...args) {
264
+ return purry(_find(false), args, find.lazy);
265
+ }
266
+ function _find(indexed) {
267
+ return (array, fn) => {
268
+ if (indexed) {
269
+ return array.find(fn);
270
+ }
271
+ return array.find((x) => fn(x));
272
+ };
273
+ }
274
+ function _lazy3(indexed) {
275
+ return (fn) => {
276
+ return (value, index, array) => {
277
+ const valid = indexed ? fn(value, index, array) : fn(value);
278
+ return {
279
+ done: valid,
280
+ hasNext: valid,
281
+ next: value
282
+ };
283
+ };
284
+ };
285
+ }
286
+ ((find2) => {
287
+ function indexed(...args) {
288
+ return purry(_find(true), args, find2.lazyIndexed);
289
+ }
290
+ find2.indexed = indexed;
291
+ find2.lazy = toSingle(_lazy3(false));
292
+ find2.lazyIndexed = toSingle(toLazyIndexed(_lazy3(true)));
293
+ })(find || (find = {}));
294
+ function first(...args) {
295
+ return purry(_first, args, first.lazy);
296
+ }
297
+ function _first([first2]) {
298
+ return first2;
299
+ }
300
+ ((first2) => {
301
+ function lazy() {
302
+ return (value) => {
303
+ return {
304
+ done: true,
305
+ hasNext: true,
306
+ next: value
307
+ };
308
+ };
309
+ }
310
+ first2.lazy = lazy;
311
+ ((lazy2) => {
312
+ lazy2.single = true;
313
+ })(lazy = first2.lazy || (first2.lazy = {}));
314
+ })(first || (first = {}));
315
+ function flatMapToObj(...args) {
316
+ return purry(_flatMapToObj(false), args);
317
+ }
318
+ function _flatMapToObj(indexed) {
319
+ return (array, fn) => {
320
+ return array.reduce((result, element, index) => {
321
+ const items = indexed ? fn(element, index, array) : fn(element);
322
+ items.forEach(([key, value]) => {
323
+ result[key] = value;
324
+ });
325
+ return result;
326
+ }, {});
327
+ };
328
+ }
329
+ ((flatMapToObj2) => {
330
+ function indexed(...args) {
331
+ return purry(_flatMapToObj(true), args);
332
+ }
333
+ flatMapToObj2.indexed = indexed;
334
+ })(flatMapToObj || (flatMapToObj = {}));
335
+ function flatten(...args) {
336
+ return purry(_flatten, args, flatten.lazy);
337
+ }
338
+ function _flatten(items) {
339
+ return _reduceLazy(items, flatten.lazy());
340
+ }
341
+ ((flatten2) => {
342
+ function lazy() {
343
+ return (next) => {
344
+ if (Array.isArray(next)) {
345
+ return {
346
+ done: false,
347
+ hasNext: true,
348
+ hasMany: true,
349
+ next
350
+ };
351
+ }
352
+ return {
353
+ done: false,
354
+ hasNext: true,
355
+ next
356
+ };
357
+ };
358
+ }
359
+ flatten2.lazy = lazy;
360
+ })(flatten || (flatten = {}));
361
+ function flatMap(...args) {
362
+ return purry(_flatMap, args, flatMap.lazy);
363
+ }
364
+ function _flatMap(array, fn) {
365
+ return flatten(array.map((item) => fn(item)));
366
+ }
367
+ ((flatMap2) => {
368
+ function lazy(fn) {
369
+ return (value) => {
370
+ const next = fn(value);
371
+ if (Array.isArray(next)) {
372
+ return {
373
+ done: false,
374
+ hasNext: true,
375
+ hasMany: true,
376
+ next
377
+ };
378
+ }
379
+ return {
380
+ done: false,
381
+ hasNext: true,
382
+ next
383
+ };
384
+ };
385
+ }
386
+ flatMap2.lazy = lazy;
387
+ })(flatMap || (flatMap = {}));
388
+ function flattenDeep(...args) {
389
+ return purry(_flattenDeep, args, flattenDeep.lazy);
390
+ }
391
+ function _flattenDeep(items) {
392
+ return _reduceLazy(items, flattenDeep.lazy());
393
+ }
394
+ function _flattenDeepValue(value) {
395
+ if (!Array.isArray(value)) {
396
+ return value;
397
+ }
398
+ const ret = [];
399
+ value.forEach((item) => {
400
+ if (Array.isArray(item)) {
401
+ ret.push(...flattenDeep(item));
402
+ } else {
403
+ ret.push(item);
404
+ }
405
+ });
406
+ return ret;
407
+ }
408
+ ((flattenDeep2) => {
409
+ function lazy() {
410
+ return (value) => {
411
+ const next = _flattenDeepValue(value);
412
+ if (Array.isArray(next)) {
413
+ return {
414
+ done: false,
415
+ hasNext: true,
416
+ hasMany: true,
417
+ next
418
+ };
419
+ }
420
+ return {
421
+ done: false,
422
+ hasNext: true,
423
+ next
424
+ };
425
+ };
426
+ }
427
+ flattenDeep2.lazy = lazy;
428
+ })(flattenDeep || (flattenDeep = {}));
429
+ function forEach(...args) {
430
+ return purry(_forEach(false), args, forEach.lazy);
431
+ }
432
+ function _forEach(indexed) {
433
+ return (array, fn) => {
434
+ return _reduceLazy(
435
+ array,
436
+ indexed ? forEach.lazyIndexed(fn) : forEach.lazy(fn),
437
+ indexed
438
+ );
439
+ };
440
+ }
441
+ function _lazy4(indexed) {
442
+ return (fn) => {
443
+ return (value, index, array) => {
444
+ if (indexed) {
445
+ fn(value, index, array);
446
+ } else {
447
+ fn(value);
448
+ }
449
+ return {
450
+ done: false,
451
+ hasNext: true,
452
+ next: value
453
+ };
454
+ };
455
+ };
456
+ }
457
+ ((forEach2) => {
458
+ function indexed(...args) {
459
+ return purry(_forEach(true), args, forEach2.lazyIndexed);
460
+ }
461
+ forEach2.indexed = indexed;
462
+ forEach2.lazy = _lazy4(false);
463
+ forEach2.lazyIndexed = toLazyIndexed(_lazy4(true));
464
+ })(forEach || (forEach = {}));
465
+ function groupBy(...args) {
466
+ return purry(_groupBy(false), args);
467
+ }
468
+ function _groupBy(indexed) {
469
+ return (array, fn) => {
470
+ const ret = {};
471
+ array.forEach((item, index) => {
472
+ const key = indexed ? fn(item, index, array) : fn(item);
473
+ if (key !== void 0) {
474
+ const actualKey = String(key);
475
+ if (!ret[actualKey]) {
476
+ ret[actualKey] = [];
477
+ }
478
+ ret[actualKey].push(item);
479
+ }
480
+ });
481
+ return ret;
482
+ };
483
+ }
484
+ ((groupBy2) => {
485
+ function indexed(...args) {
486
+ return purry(_groupBy(true), args);
487
+ }
488
+ groupBy2.indexed = indexed;
489
+ groupBy2.strict = groupBy2;
490
+ })(groupBy || (groupBy = {}));
491
+ function indexBy(...args) {
492
+ return purry(_indexBy(false), args);
493
+ }
494
+ function _indexBy(indexed) {
495
+ return (array, fn) => {
496
+ return array.reduce((ret, item, index) => {
497
+ const value = indexed ? fn(item, index, array) : fn(item);
498
+ const key = String(value);
499
+ ret[key] = item;
500
+ return ret;
501
+ }, {});
502
+ };
503
+ }
504
+ ((indexBy2) => {
505
+ function indexed(...args) {
506
+ return purry(_indexBy(true), args);
507
+ }
508
+ indexBy2.indexed = indexed;
509
+ })(indexBy || (indexBy = {}));
510
+ function intersection(...args) {
511
+ return purry(_intersection, args, intersection.lazy);
512
+ }
513
+ function _intersection(array, other) {
514
+ const lazy = intersection.lazy(other);
515
+ return _reduceLazy(array, lazy);
516
+ }
517
+ ((intersection2) => {
518
+ function lazy(other) {
519
+ return (value) => {
520
+ const set2 = new Set(other);
521
+ if (set2.has(value)) {
522
+ return {
523
+ done: false,
524
+ hasNext: true,
525
+ next: value
526
+ };
527
+ }
528
+ return {
529
+ done: false,
530
+ hasNext: false
531
+ };
532
+ };
533
+ }
534
+ intersection2.lazy = lazy;
535
+ })(intersection || (intersection = {}));
536
+ function intersectionWith(...args) {
537
+ return purry(_intersectionWith, args, intersectionWith.lazy);
538
+ }
539
+ function _intersectionWith(array, other, comparator) {
540
+ const lazy = intersectionWith.lazy(other, comparator);
541
+ return _reduceLazy(array, lazy);
542
+ }
543
+ ((intersectionWith2) => {
544
+ function lazy(other, comparator) {
545
+ return (value) => {
546
+ if (other.some((otherValue) => comparator(value, otherValue))) {
547
+ return {
548
+ done: false,
549
+ hasNext: true,
550
+ next: value
551
+ };
552
+ }
553
+ return {
554
+ done: false,
555
+ hasNext: false
556
+ };
557
+ };
558
+ }
559
+ intersectionWith2.lazy = lazy;
560
+ })(intersectionWith || (intersectionWith = {}));
561
+ function map(...args) {
562
+ return purry(_map(false), args, map.lazy);
563
+ }
564
+ function _map(indexed) {
565
+ return (array, fn) => {
566
+ return _reduceLazy(
567
+ array,
568
+ indexed ? map.lazyIndexed(fn) : map.lazy(fn),
569
+ indexed
570
+ );
571
+ };
572
+ }
573
+ function _lazy5(indexed) {
574
+ return (fn) => {
575
+ return (value, index, array) => {
576
+ return {
577
+ done: false,
578
+ hasNext: true,
579
+ next: indexed ? fn(value, index, array) : fn(value)
580
+ };
581
+ };
582
+ };
583
+ }
584
+ ((map2) => {
585
+ function indexed(...args) {
586
+ return purry(_map(true), args, map2.lazyIndexed);
587
+ }
588
+ map2.indexed = indexed;
589
+ map2.lazy = _lazy5(false);
590
+ map2.lazyIndexed = toLazyIndexed(_lazy5(true));
591
+ map2.strict = map2;
592
+ })(map || (map = {}));
593
+ function mapToObj(...args) {
594
+ return purry(_mapToObj(false), args);
595
+ }
596
+ function _mapToObj(indexed) {
597
+ return (array, fn) => {
598
+ return array.reduce((result, element, index) => {
599
+ const [key, value] = indexed ? fn(element, index, array) : fn(element);
600
+ result[key] = value;
601
+ return result;
602
+ }, {});
603
+ };
604
+ }
605
+ ((mapToObj2) => {
606
+ function indexed(...args) {
607
+ return purry(_mapToObj(true), args);
608
+ }
609
+ mapToObj2.indexed = indexed;
610
+ })(mapToObj || (mapToObj = {}));
611
+ function _maxBy(indexed) {
612
+ return (array, fn) => {
613
+ let ret;
614
+ let retMax;
615
+ array.forEach((item, i) => {
616
+ const max = indexed ? fn(item, i, array) : fn(item);
617
+ if (retMax === void 0 || max > retMax) {
618
+ ret = item;
619
+ retMax = max;
620
+ }
621
+ });
622
+ return ret;
623
+ };
624
+ }
625
+ function maxBy(...args) {
626
+ return purry(_maxBy(false), args);
627
+ }
628
+ ((maxBy2) => {
629
+ function indexed(...args) {
630
+ return purry(_maxBy(true), args);
631
+ }
632
+ maxBy2.indexed = indexed;
633
+ })(maxBy || (maxBy = {}));
634
+ function _meanBy(indexed) {
635
+ return (array, fn) => {
636
+ if (array.length === 0) {
637
+ return Number.NaN;
638
+ }
639
+ let sum = 0;
640
+ array.forEach((item, i) => {
641
+ sum += indexed ? fn(item, i, array) : fn(item);
642
+ });
643
+ return sum / array.length;
644
+ };
645
+ }
646
+ function meanBy(...args) {
647
+ return purry(_meanBy(false), args);
648
+ }
649
+ ((meanBy2) => {
650
+ function indexed(...args) {
651
+ return purry(_meanBy(true), args);
652
+ }
653
+ meanBy2.indexed = indexed;
654
+ })(meanBy || (meanBy = {}));
655
+ function _minBy(indexed) {
656
+ return (array, fn) => {
657
+ let ret;
658
+ let retMin;
659
+ array.forEach((item, i) => {
660
+ const min = indexed ? fn(item, i, array) : fn(item);
661
+ if (retMin === void 0 || min < retMin) {
662
+ ret = item;
663
+ retMin = min;
664
+ }
665
+ });
666
+ return ret;
667
+ };
668
+ }
669
+ function minBy(...args) {
670
+ return purry(_minBy(false), args);
671
+ }
672
+ ((minBy2) => {
673
+ function indexed(...args) {
674
+ return purry(_minBy(true), args);
675
+ }
676
+ minBy2.indexed = indexed;
677
+ })(minBy || (minBy = {}));
678
+ function partition(...args) {
679
+ return purry(_partition(false), args);
680
+ }
681
+ function _partition(indexed) {
682
+ return (array, fn) => {
683
+ const ret = [[], []];
684
+ array.forEach((item, index) => {
685
+ const matches = indexed ? fn(item, index, array) : fn(item);
686
+ ret[matches ? 0 : 1].push(item);
687
+ });
688
+ return ret;
689
+ };
690
+ }
691
+ ((partition2) => {
692
+ function indexed(...args) {
693
+ return purry(_partition(true), args);
694
+ }
695
+ partition2.indexed = indexed;
696
+ })(partition || (partition = {}));
697
+ function reduce(...args) {
698
+ return purry(_reduce(false), args);
699
+ }
700
+ function _reduce(indexed) {
701
+ return (items, fn, initialValue) => {
702
+ return items.reduce(
703
+ (acc, item, index) => indexed ? fn(acc, item, index, items) : fn(acc, item),
704
+ initialValue
705
+ );
706
+ };
707
+ }
708
+ ((reduce2) => {
709
+ function indexed(...args) {
710
+ return purry(_reduce(true), args);
711
+ }
712
+ reduce2.indexed = indexed;
713
+ })(reduce || (reduce = {}));
714
+ function reject(...args) {
715
+ return purry(_reject(false), args, reject.lazy);
716
+ }
717
+ function _reject(indexed) {
718
+ return (array, fn) => {
719
+ return _reduceLazy(
720
+ array,
721
+ indexed ? reject.lazyIndexed(fn) : reject.lazy(fn),
722
+ indexed
723
+ );
724
+ };
725
+ }
726
+ function _lazy6(indexed) {
727
+ return (fn) => {
728
+ return (value, index, array) => {
729
+ const valid = indexed ? fn(value, index, array) : fn(value);
730
+ if (!valid) {
731
+ return {
732
+ done: false,
733
+ hasNext: true,
734
+ next: value
735
+ };
736
+ }
737
+ return {
738
+ done: false,
739
+ hasNext: false
740
+ };
741
+ };
742
+ };
743
+ }
744
+ ((reject2) => {
745
+ function indexed(...args) {
746
+ return purry(_reject(true), args, reject2.lazyIndexed);
747
+ }
748
+ reject2.indexed = indexed;
749
+ reject2.lazy = _lazy6(false);
750
+ reject2.lazyIndexed = toLazyIndexed(_lazy6(true));
751
+ })(reject || (reject = {}));
752
+ function sort(...args) {
753
+ return purry(_sort, args);
754
+ }
755
+ function _sort(items, cmp) {
756
+ const ret = [...items];
757
+ ret.sort(cmp);
758
+ return ret;
759
+ }
760
+ ((sort2) => {
761
+ sort2.strict = sort2;
762
+ })(sort || (sort = {}));
763
+ var ALL_DIRECTIONS = ["asc", "desc"];
764
+ var COMPARATOR = {
765
+ asc: (x, y) => x > y,
766
+ desc: (x, y) => x < y
767
+ };
768
+ function sortBy(arrayOrSortRule, ...sortRules) {
769
+ const args = isSortRule(arrayOrSortRule) ? [[arrayOrSortRule, ...sortRules]] : [arrayOrSortRule, sortRules];
770
+ return purry(_sortBy, args);
771
+ }
772
+ function isSortRule(x) {
773
+ if (typeof x === "function") {
774
+ return true;
775
+ }
776
+ const [maybeProjection, maybeDirection, ...rest] = x;
777
+ if (rest.length > 0) {
778
+ return false;
779
+ }
780
+ return typeof maybeProjection === "function" && ALL_DIRECTIONS.includes(maybeDirection);
781
+ }
782
+ function _sortBy(array, sorts) {
783
+ return [...array].sort(comparer(...sorts));
784
+ }
785
+ function comparer(primaryRule, secondaryRule, ...otherRules) {
786
+ const projector = typeof primaryRule === "function" ? primaryRule : primaryRule[0];
787
+ const direction = typeof primaryRule === "function" ? "asc" : primaryRule[1];
788
+ const comparator = COMPARATOR[direction];
789
+ const nextComparer = secondaryRule === void 0 ? void 0 : comparer(secondaryRule, ...otherRules);
790
+ return (a, b) => {
791
+ const projectedA = projector(a);
792
+ const projectedB = projector(b);
793
+ if (comparator(projectedA, projectedB)) {
794
+ return 1;
795
+ }
796
+ if (comparator(projectedB, projectedA)) {
797
+ return -1;
798
+ }
799
+ return nextComparer?.(a, b) ?? 0;
800
+ };
801
+ }
802
+ ((sortBy2) => {
803
+ sortBy2.strict = sortBy2;
804
+ })(sortBy || (sortBy = {}));
805
+ function _sumBy(indexed) {
806
+ return (array, fn) => {
807
+ let sum = 0;
808
+ array.forEach((item, i) => {
809
+ const summand = indexed ? fn(item, i, array) : fn(item);
810
+ sum += summand;
811
+ });
812
+ return sum;
813
+ };
814
+ }
815
+ function sumBy(...args) {
816
+ return purry(_sumBy(false), args);
817
+ }
818
+ ((sumBy2) => {
819
+ function indexed(...args) {
820
+ return purry(_sumBy(true), args);
821
+ }
822
+ sumBy2.indexed = indexed;
823
+ })(sumBy || (sumBy = {}));
824
+ function take(...args) {
825
+ return purry(_take, args, take.lazy);
826
+ }
827
+ function _take(array, n) {
828
+ return _reduceLazy(array, take.lazy(n));
829
+ }
830
+ ((take2) => {
831
+ function lazy(n) {
832
+ return (value) => {
833
+ if (n === 0) {
834
+ return {
835
+ done: true,
836
+ hasNext: false
837
+ };
838
+ }
839
+ n--;
840
+ if (n === 0) {
841
+ return {
842
+ done: true,
843
+ hasNext: true,
844
+ next: value
845
+ };
846
+ }
847
+ return {
848
+ done: false,
849
+ hasNext: true,
850
+ next: value
851
+ };
852
+ };
853
+ }
854
+ take2.lazy = lazy;
855
+ })(take || (take = {}));
856
+ function uniq(...args) {
857
+ return purry(_uniq, args, uniq.lazy);
46
858
  }
47
859
  function _uniq(array) {
48
860
  return _reduceLazy(array, uniq.lazy());
49
861
  }
50
- (function(uniq2) {
862
+ ((uniq2) => {
51
863
  function lazy() {
52
- const set = /* @__PURE__ */ new Set();
864
+ const set2 = /* @__PURE__ */ new Set();
53
865
  return (value) => {
54
- if (set.has(value)) {
866
+ if (set2.has(value)) {
55
867
  return {
56
868
  done: false,
57
869
  hasNext: false
58
870
  };
59
871
  }
60
- set.add(value);
872
+ set2.add(value);
61
873
  return {
62
874
  done: false,
63
875
  hasNext: true,
@@ -67,6 +879,81 @@ function _uniq(array) {
67
879
  }
68
880
  uniq2.lazy = lazy;
69
881
  })(uniq || (uniq = {}));
882
+ function uniqWith(...args) {
883
+ return purry(_uniqWith, args, uniqWith.lazy);
884
+ }
885
+ function _uniqWith(array, isEquals) {
886
+ const lazy = uniqWith.lazy(isEquals);
887
+ return _reduceLazy(array, lazy, true);
888
+ }
889
+ function _lazy7(isEquals) {
890
+ return (value, index, array) => {
891
+ if (array && array.findIndex((otherValue) => isEquals(value, otherValue)) === index) {
892
+ return {
893
+ done: false,
894
+ hasNext: true,
895
+ next: value
896
+ };
897
+ }
898
+ return {
899
+ done: false,
900
+ hasNext: false
901
+ };
902
+ };
903
+ }
904
+ ((uniqWith2) => {
905
+ uniqWith2.lazy = toLazyIndexed(_lazy7);
906
+ })(uniqWith || (uniqWith = {}));
907
+ var isArray2 = Array.isArray;
908
+ function forEachObj(...args) {
909
+ return purry(_forEachObj(false), args);
910
+ }
911
+ function _forEachObj(indexed) {
912
+ return (object, fn) => {
913
+ for (const key in object) {
914
+ if (Object.prototype.hasOwnProperty.call(object, key)) {
915
+ const val = object[key];
916
+ if (indexed) {
917
+ fn(val, key, object);
918
+ } else {
919
+ fn(val);
920
+ }
921
+ }
922
+ }
923
+ return object;
924
+ };
925
+ }
926
+ ((forEachObj2) => {
927
+ function indexed(...args) {
928
+ return purry(_forEachObj(true), args);
929
+ }
930
+ forEachObj2.indexed = indexed;
931
+ })(forEachObj || (forEachObj = {}));
932
+ function fromPairs(entries) {
933
+ const out = {};
934
+ for (const [key, value] of entries) {
935
+ out[key] = value;
936
+ }
937
+ return out;
938
+ }
939
+ ((fromPairs2) => {
940
+ fromPairs2.strict = fromPairs2;
941
+ })(fromPairs || (fromPairs = {}));
942
+ function keys(source) {
943
+ return Object.keys(source);
944
+ }
945
+ ((keys2) => {
946
+ keys2.strict = keys2;
947
+ })(keys || (keys = {}));
948
+ function toPairs(object) {
949
+ return Object.entries(object);
950
+ }
951
+ ((toPairs2) => {
952
+ function strict(object) {
953
+ return Object.entries(object);
954
+ }
955
+ toPairs2.strict = strict;
956
+ })(toPairs || (toPairs = {}));
70
957
 
71
958
  // src/flags.ts
72
959
  var ERROR = "error";
@@ -494,6 +1381,7 @@ function javascript(options = {}) {
494
1381
  argsIgnorePattern: "^_",
495
1382
  ignoreRestSiblings: true
496
1383
  }],
1384
+ ...default3.configs.recommended.rules,
497
1385
  ...overrides
498
1386
  }
499
1387
  },