@zelgadis87/utils-core 5.2.8 → 5.2.9
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/CHANGELOG.md +2 -1
- package/dist/Optional.d.ts +4 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/esbuild/index.cjs.map +2 -2
- package/esbuild/index.mjs.map +2 -2
- package/package.json +1 -1
- package/src/Optional.ts +3 -1
package/package.json
CHANGED
package/src/Optional.ts
CHANGED
|
@@ -221,7 +221,7 @@ export type TOptional<T> = {
|
|
|
221
221
|
|
|
222
222
|
ifEmpty( callback: TVoidFunction ): void;
|
|
223
223
|
ifPresent( callback: TConsumer<T> ): void;
|
|
224
|
-
apply<RP = void, RE = void>( callbackIfPresent: TFunction<T, RP>, callbackIfEmpty: TProducer<RE> ):
|
|
224
|
+
apply<RP = void, RE = void>( callbackIfPresent: TFunction<T, RP>, callbackIfEmpty: TProducer<RE> ): RP | RE;
|
|
225
225
|
|
|
226
226
|
throwIfPresent: ( errorGenerator: TFunction<T, Error> ) => TEmptyOptional<T>;
|
|
227
227
|
|
|
@@ -255,11 +255,13 @@ export type TEmptyOptional<T> = TOptional<T> & {
|
|
|
255
255
|
get(): never;
|
|
256
256
|
isEmpty(): true;
|
|
257
257
|
isPresent(): false;
|
|
258
|
+
apply<RP = void, RE = void>( callbackIfPresent: TFunction<T, RP>, callbackIfEmpty: TProducer<RE> ): RE;
|
|
258
259
|
}
|
|
259
260
|
export type TPresentOptional<T> = TOptional<T> & {
|
|
260
261
|
get(): T;
|
|
261
262
|
isEmpty(): false;
|
|
262
263
|
isPresent(): true;
|
|
264
|
+
apply<RP = void, RE = void>( callbackIfPresent: TFunction<T, RP>, callbackIfEmpty: TProducer<RE> ): RP;
|
|
263
265
|
}
|
|
264
266
|
|
|
265
267
|
export class ErrorGetEmptyOptional extends Error {
|