@mll-lab/js-utils 2.15.2 → 2.16.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.
@@ -1,17 +1,15 @@
1
1
  export declare type PredicateFn = (value: unknown) => boolean;
2
- export declare function isString(value: unknown): value is string;
3
- export declare function isAlphanumeric(value: unknown): value is string;
2
+ export declare const isAlphanumeric: PredicateFn;
4
3
  /**
5
4
  * BSNR (Betriebsstättennummer) ist eine eindeutige Zuordnung von Leistungen zu dem entsprechenden Ort der Leistungserbringung ermöglicht,
6
5
  * für alle vertrags(zahn)ärztlichen Leistungserbringer gültig
7
6
  * und klar abzugrenzen vom Institutskennzeichen (IK-Nummer) eines Krankenhauses.
8
7
  */
9
- export declare function isBSNR(value: unknown): value is string;
8
+ export declare const isBSNR: PredicateFn;
10
9
  export declare const EMAIL_REGEX: RegExp;
11
- export declare function isEmail(value: unknown): value is string;
12
- export declare function isOnlyDigits(value: unknown): value is string;
13
- export declare function isURL(value: unknown): value is string;
14
- export declare function isWord(value: unknown): value is string;
15
- export declare function isLabId(value: unknown): value is string;
16
- export declare function isRackBarcode(value: unknown): value is string;
17
- export declare function isNotNullish<T>(value: T): value is Exclude<T, null | undefined>;
10
+ export declare const isEmail: PredicateFn;
11
+ export declare const isOnlyDigits: PredicateFn;
12
+ export declare const isURL: PredicateFn;
13
+ export declare const isWord: PredicateFn;
14
+ export declare const isLabId: PredicateFn;
15
+ export declare const isRackBarcode: PredicateFn;
@@ -1 +1,3 @@
1
- export {};
1
+ import { PredicateFn } from './predicates';
2
+ export declare function assertFalse(predicate: PredicateFn, values: Array<unknown>): void;
3
+ export declare function assertTrue(predicate: PredicateFn, values: Array<unknown>): void;
@@ -0,0 +1,2 @@
1
+ export declare function isString(value: unknown): value is string;
2
+ export declare function isNotNullish<T>(value: T): value is NonNullable<T>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,28 @@
1
+ import { DeepPartial, Either, Exact, Maybe, MaybePromise, Modify, ValueOf } from './types';
2
+ declare type Bar = {
3
+ baz: number;
4
+ };
5
+ declare type Obj = {
6
+ foo: string;
7
+ bar: Bar;
8
+ };
9
+ export declare const allowsAssigningEmptyObjectToDeepPartial: DeepPartial<Obj>;
10
+ export declare function acceptsMaybePromise(v: MaybePromise<number>): Promise<number>;
11
+ export declare const modifiedType: Modify<Obj, {
12
+ foo: number;
13
+ }>;
14
+ export declare function acceptsValueOf(v: ValueOf<Obj>): string | Bar;
15
+ export declare const maybeAllowsNull: Maybe<number>;
16
+ export declare const maybeAllowsUndefined: Maybe<number>;
17
+ export declare const maybeAllowsT: Maybe<number>;
18
+ export declare const maybeDoesNotAllowOtherType: Maybe<number>;
19
+ declare type BarOrObj = Either<Bar, Obj>;
20
+ export declare const onlyFoo: BarOrObj;
21
+ export declare const onlyBar: BarOrObj;
22
+ export declare const both: BarOrObj;
23
+ export declare const none: BarOrObj;
24
+ declare type ExactlyBar = Exact<Bar>;
25
+ export declare const exactlyBar: ExactlyBar;
26
+ export declare const lessThanBar: ExactlyBar;
27
+ export declare const moreThanBar: ExactlyBar;
28
+ export {};
@@ -0,0 +1,27 @@
1
+ /** Recursively optional deep partial type. */
2
+ export declare type DeepPartial<T> = {
3
+ [P in keyof T]?: DeepPartial<T[P]>;
4
+ };
5
+ /** Either a value or a promise that will resolve to that value. */
6
+ export declare type MaybePromise<T> = T | Promise<T>;
7
+ /** Modify a given type, e.g. to make some properties optional. */
8
+ export declare type Modify<T, R> = Pick<T, Exclude<keyof T, keyof R>> & R;
9
+ /** The missing counterpart to keyof. */
10
+ export declare type ValueOf<T> = T[keyof T];
11
+ /** Add null and undefined to a type. */
12
+ export declare type Maybe<T> = T | null | undefined;
13
+ /** Only props that are contained in T but not U. */
14
+ declare type Subtract<T, U> = {
15
+ [P in keyof T]: T[P];
16
+ } & {
17
+ [P in keyof U]?: never;
18
+ };
19
+ /** Only one of both types (exclusively). */
20
+ export declare type Either<T, U> = Subtract<T, U> | Subtract<U, T>;
21
+ /** Only the given keys and no others. */
22
+ export declare type Exact<T extends {
23
+ [key: string]: unknown;
24
+ }> = {
25
+ [K in keyof T]: T[K];
26
+ };
27
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mll-lab/js-utils",
3
- "version": "2.15.2",
3
+ "version": "2.16.0",
4
4
  "main": "dist/index.common.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",