rattail 1.0.17 → 1.0.18

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/lib/index.cjs CHANGED
@@ -1405,17 +1405,11 @@ function toText(file) {
1405
1405
 
1406
1406
  // src/math/maxBy.ts
1407
1407
  function maxBy(arr, fn) {
1408
- if (!arr.length) {
1409
- return;
1410
- }
1411
1408
  return arr.reduce((result, item) => fn(result) > fn(item) ? result : item, arr[0]);
1412
1409
  }
1413
1410
 
1414
1411
  // src/math/minBy.ts
1415
1412
  function minBy(arr, fn) {
1416
- if (!arr.length) {
1417
- return;
1418
- }
1419
1413
  return arr.reduce((result, item) => fn(result) < fn(item) ? result : item, arr[0]);
1420
1414
  }
1421
1415
 
package/lib/index.d.cts CHANGED
@@ -272,9 +272,9 @@ declare function toDataURL(file: File): Promise<string>;
272
272
 
273
273
  declare function toText(file: File): Promise<string>;
274
274
 
275
- declare function maxBy<T>(arr: T[], fn: (val: T) => number): T | undefined;
275
+ declare function maxBy<T>(arr: T[], fn: (val: T) => number): T;
276
276
 
277
- declare function minBy<T>(arr: T[], fn: (val: T) => number): T | undefined;
277
+ declare function minBy<T>(arr: T[], fn: (val: T) => number): T;
278
278
 
279
279
  declare function sum(arr: number[]): number;
280
280
 
package/lib/index.d.ts CHANGED
@@ -272,9 +272,9 @@ declare function toDataURL(file: File): Promise<string>;
272
272
 
273
273
  declare function toText(file: File): Promise<string>;
274
274
 
275
- declare function maxBy<T>(arr: T[], fn: (val: T) => number): T | undefined;
275
+ declare function maxBy<T>(arr: T[], fn: (val: T) => number): T;
276
276
 
277
- declare function minBy<T>(arr: T[], fn: (val: T) => number): T | undefined;
277
+ declare function minBy<T>(arr: T[], fn: (val: T) => number): T;
278
278
 
279
279
  declare function sum(arr: number[]): number;
280
280
 
@@ -1377,17 +1377,11 @@ var Rattail = (() => {
1377
1377
 
1378
1378
  // src/math/maxBy.ts
1379
1379
  function maxBy(arr, fn) {
1380
- if (!arr.length) {
1381
- return;
1382
- }
1383
1380
  return arr.reduce((result, item) => fn(result) > fn(item) ? result : item, arr[0]);
1384
1381
  }
1385
1382
 
1386
1383
  // src/math/minBy.ts
1387
1384
  function minBy(arr, fn) {
1388
- if (!arr.length) {
1389
- return;
1390
- }
1391
1385
  return arr.reduce((result, item) => fn(result) < fn(item) ? result : item, arr[0]);
1392
1386
  }
1393
1387
 
package/lib/index.js CHANGED
@@ -1393,17 +1393,11 @@ function toText(file) {
1393
1393
 
1394
1394
  // src/math/maxBy.ts
1395
1395
  function maxBy(arr, fn) {
1396
- if (!arr.length) {
1397
- return;
1398
- }
1399
1396
  return arr.reduce((result, item) => fn(result) > fn(item) ? result : item, arr[0]);
1400
1397
  }
1401
1398
 
1402
1399
  // src/math/minBy.ts
1403
1400
  function minBy(arr, fn) {
1404
- if (!arr.length) {
1405
- return;
1406
- }
1407
1401
  return arr.reduce((result, item) => fn(result) < fn(item) ? result : item, arr[0]);
1408
1402
  }
1409
1403
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rattail",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
4
4
  "type": "module",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "lib/index.js",