@dereekb/util 13.7.0 → 13.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/util",
3
- "version": "13.7.0",
3
+ "version": "13.8.0",
4
4
  "exports": {
5
5
  "./test": {
6
6
  "module": "./test/index.esm.js",
@@ -1,3 +1,4 @@
1
+ import { type Maybe } from '../value/maybe.type';
1
2
  import { type IndexRange } from '../value/indexed';
2
3
  /**
3
4
  * Reduces an array of numbers to its maximum value.
@@ -52,7 +53,7 @@ export declare function reduceNumbersWithAddFn(emptyArrayValue?: number): (array
52
53
  * @param emptyArrayValue - value to return when the array is empty
53
54
  * @returns the reduced result, or the empty array value if the array is empty
54
55
  */
55
- export declare function reduceNumbers(reduceFn: (a: number, b: number) => number, array: number[], emptyArrayValue?: number): number | undefined;
56
+ export declare function reduceNumbers(reduceFn: (a: number, b: number) => number, array: number[], emptyArrayValue?: number): Maybe<number>;
56
57
  /**
57
58
  * Creates a reusable reducer function that reduces a number array using a custom binary function.
58
59
  *
@@ -1,6 +1,10 @@
1
1
  import { type ArrayOrValue } from './../array/array';
2
2
  import { type Maybe } from '../value/maybe.type';
3
3
  import { type PrimativeValue } from '../type';
4
+ /**
5
+ * HTML heading level corresponding to `<h1>` through `<h6>`.
6
+ */
7
+ export type HtmlHeaderLevel = 1 | 2 | 3 | 4 | 5 | 6;
4
8
  /**
5
9
  * Represents a single CSS Class
6
10
  */
package/test/index.cjs.js CHANGED
@@ -1186,30 +1186,37 @@ function _ts_generator(thisArg, body) {
1186
1186
  failSuccessfully();
1187
1187
  }
1188
1188
  }
1189
+ var promiseResult;
1189
1190
  try {
1190
1191
  var result = errorFn();
1191
1192
  if (util.isPromise(result)) {
1192
- return result.then(failDueToSuccess).catch(handleError);
1193
+ promiseResult = result.then(failDueToSuccess).catch(handleError);
1193
1194
  } else {
1194
1195
  failDueToSuccess();
1196
+ promiseResult = Promise.resolve();
1195
1197
  }
1196
1198
  } catch (e) {
1197
1199
  handleError(e);
1200
+ promiseResult = Promise.resolve();
1198
1201
  }
1199
- return Promise.resolve();
1202
+ return promiseResult;
1200
1203
  }
1201
1204
  function expectSuccessfulFail(errorFn) {
1202
1205
  var handleError = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : EXPECT_ERROR_DEFAULT_HANDLER;
1206
+ var result;
1203
1207
  try {
1204
- var result = errorFn();
1205
- if (util.isPromise(result)) {
1206
- return result.then(failDueToSuccess).catch(handleError);
1208
+ var fnResult = errorFn();
1209
+ if (util.isPromise(fnResult)) {
1210
+ result = fnResult.then(failDueToSuccess).catch(handleError);
1207
1211
  } else {
1208
1212
  failDueToSuccess();
1213
+ result = undefined;
1209
1214
  }
1210
1215
  } catch (e) {
1211
1216
  handleError(e);
1217
+ result = undefined;
1212
1218
  }
1219
+ return result;
1213
1220
  }
1214
1221
  /**
1215
1222
  * Used to wrap a testing function and watch for ExpectedFailError errors in order to pass the test. Other exceptions are treated normally as failures.
package/test/index.esm.js CHANGED
@@ -1184,30 +1184,37 @@ function _ts_generator(thisArg, body) {
1184
1184
  failSuccessfully();
1185
1185
  }
1186
1186
  }
1187
+ var promiseResult;
1187
1188
  try {
1188
1189
  var result = errorFn();
1189
1190
  if (isPromise(result)) {
1190
- return result.then(failDueToSuccess).catch(handleError);
1191
+ promiseResult = result.then(failDueToSuccess).catch(handleError);
1191
1192
  } else {
1192
1193
  failDueToSuccess();
1194
+ promiseResult = Promise.resolve();
1193
1195
  }
1194
1196
  } catch (e) {
1195
1197
  handleError(e);
1198
+ promiseResult = Promise.resolve();
1196
1199
  }
1197
- return Promise.resolve();
1200
+ return promiseResult;
1198
1201
  }
1199
1202
  function expectSuccessfulFail(errorFn) {
1200
1203
  var handleError = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : EXPECT_ERROR_DEFAULT_HANDLER;
1204
+ var result;
1201
1205
  try {
1202
- var result = errorFn();
1203
- if (isPromise(result)) {
1204
- return result.then(failDueToSuccess).catch(handleError);
1206
+ var fnResult = errorFn();
1207
+ if (isPromise(fnResult)) {
1208
+ result = fnResult.then(failDueToSuccess).catch(handleError);
1205
1209
  } else {
1206
1210
  failDueToSuccess();
1211
+ result = undefined;
1207
1212
  }
1208
1213
  } catch (e) {
1209
1214
  handleError(e);
1215
+ result = undefined;
1210
1216
  }
1217
+ return result;
1211
1218
  }
1212
1219
  /**
1213
1220
  * Used to wrap a testing function and watch for ExpectedFailError errors in order to pass the test. Other exceptions are treated normally as failures.
package/test/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@dereekb/util/test",
3
- "version": "13.7.0",
3
+ "version": "13.8.0",
4
4
  "peerDependencies": {
5
- "@dereekb/util": "13.7.0",
5
+ "@dereekb/util": "13.8.0",
6
6
  "make-error": "^1.3.0"
7
7
  },
8
8
  "exports": {