@softwareventures/nullable
Advanced tools
+28
-2
@@ -26,6 +26,9 @@ /** Tests if the specified value is null or undefined. | ||
| export declare function defaultValueFn<T>(defaultValue: T): (nullable: T | undefined | null | void) => T; | ||
| /** If the specified value is null or undefined, returns null. | ||
| /** If the specified value is `null` or `undefined`, returns `null`. | ||
| * | ||
| * Otherwise, passes the specified value to the provided function and returns | ||
| * the return value of that function. */ | ||
| * the return value of that function. | ||
| * | ||
| * Equivalent to {@link mapOptional} except that this function returns `null` | ||
| * instead of `undefined`. */ | ||
| export declare function map<T, U>(nullable: T | undefined | null | void, f: (element: T) => U): U | null; | ||
@@ -46,2 +49,5 @@ /** Returns a function that takes a nullable value as its argument. | ||
| * | ||
| * Equivalent to {@link mapOptional} except that this function returns `null` | ||
| * instead of `undefined`. | ||
| * | ||
| * Alias for {@link map}. */ | ||
@@ -58,2 +64,22 @@ export declare function mapNullable<T, U>(nullable: T | undefined | null | void, f: (element: T) => U): U | null; | ||
| export declare function mapNullableFn<T, U>(f: (element: T) => U): (nullable: T | undefined | null | void) => U | null; | ||
| /** If the specified value is `null` or `undefined`, returns `undefined`. | ||
| * | ||
| * Otherwise, passes the specified value to the provided function and returns | ||
| * the return value of that function. | ||
| * | ||
| * Equivalent to {@link map} and {@link mapNullable} except that this function | ||
| * returns `undefined` instead of `null`. */ | ||
| export declare function mapOptional<T, U>(optional: T | null | undefined | void, f: (element: T) => U): U | undefined; | ||
| /** Returns a function that takes a nullable value as its argument. | ||
| * | ||
| * If the function is called with `null` or `undefined`, it returns undefined. | ||
| * | ||
| * Otherwise, the argument is passed to the callback `f` and the | ||
| * return value of `f` is returned. | ||
| * | ||
| * Equivalent to {@link mapFn} and {@link mapNullableFn} except that the | ||
| * resulting function returns `undefined` instead of `null`. | ||
| * | ||
| * Curried variant of {@link mapOptional}. */ | ||
| export declare function mapOptionalFn<T, U>(f: (element: T) => U): (optional: T | undefined | null | void) => U | undefined; | ||
| /** Returns the specified value or, if the value is null or undefined, calls | ||
@@ -60,0 +86,0 @@ * the provided callback and returns the result of that function call. |
+37
-3
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.mapNullFn = exports.mapNull = exports.mapNullableFn = exports.mapNullable = exports.mapFn = exports.map = exports.defaultValueFn = exports.defaultValue = exports.notNull = exports.isNotNull = exports.isNull = void 0; | ||
| exports.mapNullFn = exports.mapNull = exports.mapOptionalFn = exports.mapOptional = exports.mapNullableFn = exports.mapNullable = exports.mapFn = exports.map = exports.defaultValueFn = exports.defaultValue = exports.notNull = exports.isNotNull = exports.isNull = void 0; | ||
| /** Tests if the specified value is null or undefined. | ||
@@ -51,6 +51,9 @@ * | ||
| exports.defaultValueFn = defaultValueFn; | ||
| /** If the specified value is null or undefined, returns null. | ||
| /** If the specified value is `null` or `undefined`, returns `null`. | ||
| * | ||
| * Otherwise, passes the specified value to the provided function and returns | ||
| * the return value of that function. */ | ||
| * the return value of that function. | ||
| * | ||
| * Equivalent to {@link mapOptional} except that this function returns `null` | ||
| * instead of `undefined`. */ | ||
| // eslint-disable-next-line @typescript-eslint/no-invalid-void-type | ||
@@ -84,2 +87,33 @@ function map(nullable, f) { | ||
| exports.mapNullableFn = mapFn; | ||
| /** If the specified value is `null` or `undefined`, returns `undefined`. | ||
| * | ||
| * Otherwise, passes the specified value to the provided function and returns | ||
| * the return value of that function. | ||
| * | ||
| * Equivalent to {@link map} and {@link mapNullable} except that this function | ||
| * returns `undefined` instead of `null`. */ | ||
| function mapOptional( | ||
| // eslint-disable-next-line @typescript-eslint/no-invalid-void-type | ||
| optional, f) { | ||
| var _a; | ||
| return optional == null ? undefined : (_a = f(optional)) !== null && _a !== void 0 ? _a : undefined; | ||
| } | ||
| exports.mapOptional = mapOptional; | ||
| /** Returns a function that takes a nullable value as its argument. | ||
| * | ||
| * If the function is called with `null` or `undefined`, it returns undefined. | ||
| * | ||
| * Otherwise, the argument is passed to the callback `f` and the | ||
| * return value of `f` is returned. | ||
| * | ||
| * Equivalent to {@link mapFn} and {@link mapNullableFn} except that the | ||
| * resulting function returns `undefined` instead of `null`. | ||
| * | ||
| * Curried variant of {@link mapOptional}. */ | ||
| function mapOptionalFn(f | ||
| // eslint-disable-next-line @typescript-eslint/no-invalid-void-type | ||
| ) { | ||
| return optional => mapOptional(optional, f); | ||
| } | ||
| exports.mapOptionalFn = mapOptionalFn; | ||
| /** Returns the specified value or, if the value is null or undefined, calls | ||
@@ -86,0 +120,0 @@ * the provided callback and returns the result of that function call. |
+1
-1
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAAA;;8DAE8D;AAC9D,SAAgB,MAAM,CAAI,KAAc;IACpC,OAAO,KAAK,IAAI,IAAI,CAAC;AACzB,CAAC;AAFD,wBAEC;AAED;;8DAE8D;AAC9D,mEAAmE;AACnE,SAAgB,SAAS,CAAI,KAAkC;IAC3D,OAAO,KAAK,IAAI,IAAI,CAAC;AACzB,CAAC;AAFD,8BAEC;AAED;;;yDAGyD;AACzD,mEAAmE;AACnE,SAAgB,OAAO,CAAI,KAAkC;IACzD,IAAI,KAAK,IAAI,IAAI,EAAE;QACf,MAAM,IAAI,SAAS,CAAC,YAAY,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;KACpD;IAED,OAAO,KAAK,CAAC;AACjB,CAAC;AAND,0BAMC;AAED;;;;8BAI8B;AAC9B,mEAAmE;AACnE,SAAgB,YAAY,CAAI,QAAqC,EAAE,YAAe;IAClF,OAAO,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,YAAY,CAAC;AACpC,CAAC;AAFD,oCAEC;AAED;;;;gCAIgC;AAChC,mEAAmE;AACnE,SAAgB,cAAc,CAAI,YAAe;IAC7C,OAAO,QAAQ,CAAC,EAAE,CAAC,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,YAAY,CAAC;AAChD,CAAC;AAFD,wCAEC;AAED;;;wCAGwC;AACxC,mEAAmE;AACnE,SAAgB,GAAG,CAAO,QAAqC,EAAE,CAAoB;;IACjF,OAAO,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAA,CAAC,CAAC,QAAQ,CAAC,mCAAI,IAAI,CAAC;AACzD,CAAC;AAFD,kBAEC;AAED;;;;;;;qCAOqC;AACrC,SAAgB,KAAK,CACjB,CAAoB;AACpB,mEAAmE;;IAEnE,OAAO,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;AACxC,CAAC;AALD,sBAKC;AAgBD,gBAAgB;AAChB,6DAA6D;AAC7D,4EAA4E;AAC/D,QAAA,WAAW,GAAG,GAAG,CAAC;AAiB/B,gBAAgB;AAChB,6DAA6D;AAC7D,4EAA4E;AAC/D,QAAA,aAAa,GAAG,KAAK,CAAC;AAEnC;;;;2BAI2B;AAC3B,mEAAmE;AACnE,SAAgB,OAAO,CAAW,QAAqC,EAAE,CAAU;IAC/E,OAAO,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC7C,CAAC;AAFD,0BAEC;AAED;;;;;2BAK2B;AAC3B,mEAAmE;AACnE,SAAgB,SAAS,CAAW,CAAU;IAC1C,OAAO,QAAQ,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;AAC5C,CAAC;AAFD,8BAEC","sourcesContent":["/** Tests if the specified value is null or undefined.\n *\n * Useful as the predicate of filter functions and similar. */\nexport function isNull<T>(value: unknown): value is null | undefined {\n return value == null;\n}\n\n/** Tests if the specified value is null or undefined.\n *\n * Useful as the predicate of filter functions and similar. */\n// eslint-disable-next-line @typescript-eslint/no-invalid-void-type\nexport function isNotNull<T>(value: T | null | undefined | void): value is T {\n return value != null;\n}\n\n/** Asserts that the specified value is neither null nor undefined, and\n * returns it.\n *\n * @throws TypeError if the value is null or undefined */\n// eslint-disable-next-line @typescript-eslint/no-invalid-void-type\nexport function notNull<T>(value: T | null | undefined | void): T {\n if (value == null) {\n throw new TypeError(`value is ${String(value)}`);\n }\n\n return value;\n}\n\n/** Returns the specified value, or the default value if the specified value\n * is null or undefined.\n *\n * If the default value is expensive to compute, consider using\n * {@link mapNull} instead. */\n// eslint-disable-next-line @typescript-eslint/no-invalid-void-type\nexport function defaultValue<T>(nullable: T | undefined | null | void, defaultValue: T): T {\n return nullable ?? defaultValue;\n}\n\n/** Returns a function that returns the specified value, or the default value\n * if the specified value is null or undefined.\n *\n * If the default value is expensive to compute, consider using\n * {@link mapNullFn} instead. */\n// eslint-disable-next-line @typescript-eslint/no-invalid-void-type\nexport function defaultValueFn<T>(defaultValue: T): (nullable: T | undefined | null | void) => T {\n return nullable => nullable ?? defaultValue;\n}\n\n/** If the specified value is null or undefined, returns null.\n *\n * Otherwise, passes the specified value to the provided function and returns\n * the return value of that function. */\n// eslint-disable-next-line @typescript-eslint/no-invalid-void-type\nexport function map<T, U>(nullable: T | undefined | null | void, f: (element: T) => U): U | null {\n return nullable == null ? null : f(nullable) ?? null;\n}\n\n/** Returns a function that takes a nullable value as its argument.\n *\n * If the function is called with null or undefined, it returns null.\n *\n * Otherwise, the argument is passed to the callback `f` and the\n * return value of `f` is returned.\n *\n * Curried variant of {@link map}. */\nexport function mapFn<T, U>(\n f: (element: T) => U\n // eslint-disable-next-line @typescript-eslint/no-invalid-void-type\n): (nullable: T | undefined | null | void) => U | null {\n return nullable => map(nullable, f);\n}\n\n/** If the specified value is null or undefined, returns null.\n *\n * Otherwise, passes the specified value to the provided function and returns\n * the return value of that function.\n *\n * Alias for {@link map}. */\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore This is the exported declaration, the actual implementation is below.\nexport function mapNullable<T, U>(\n // eslint-disable-next-line @typescript-eslint/no-invalid-void-type\n nullable: T | undefined | null | void,\n f: (element: T) => U\n): U | null;\n\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore This is the implementation, the exported declaration is above.\nexport const mapNullable = map;\n\n/** Returns a function that takes a nullable value as its argument.\n *\n * If the function is called with null or undefined, it returns null.\n *\n * Otherwise, the argument is passed to the callback `f` and the\n * return value of `f` is returned.\n *\n * Alias for {@link mapFn}, which is a curried variant of {@link map}. */\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore This is the exported declaration, the actual implementation is below.\nexport function mapNullableFn<T, U>(\n f: (element: T) => U\n // eslint-disable-next-line @typescript-eslint/no-invalid-void-type\n): (nullable: T | undefined | null | void) => U | null;\n\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore This is the implementation, the exported declaration is above.\nexport const mapNullableFn = mapFn;\n\n/** Returns the specified value or, if the value is null or undefined, calls\n * the provided callback and returns the result of that function call.\n *\n * Useful as an alternative to {@link defaultValue} if the default value is\n * expensive to compute. */\n// eslint-disable-next-line @typescript-eslint/no-invalid-void-type\nexport function mapNull<T, U = T>(nullable: T | undefined | null | void, f: () => U): T | U {\n return nullable == null ? f() : nullable;\n}\n\n/** Returns a function that returns the specified value or, if the value is\n * null or undefined, calls the provided callback and returns the result of\n * that function call.\n *\n * Useful as an alternative to {@link defaultValueFn} if the default value is\n * expensive to compute. */\n// eslint-disable-next-line @typescript-eslint/no-invalid-void-type\nexport function mapNullFn<T, U = T>(f: () => U): (nullable: T | undefined | null | void) => T | U {\n return nullable => mapNull(nullable, f);\n}\n"]} | ||
| {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAAA;;8DAE8D;AAC9D,SAAgB,MAAM,CAAI,KAAc;IACpC,OAAO,KAAK,IAAI,IAAI,CAAC;AACzB,CAAC;AAFD,wBAEC;AAED;;8DAE8D;AAC9D,mEAAmE;AACnE,SAAgB,SAAS,CAAI,KAAkC;IAC3D,OAAO,KAAK,IAAI,IAAI,CAAC;AACzB,CAAC;AAFD,8BAEC;AAED;;;yDAGyD;AACzD,mEAAmE;AACnE,SAAgB,OAAO,CAAI,KAAkC;IACzD,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QAChB,MAAM,IAAI,SAAS,CAAC,YAAY,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACrD,CAAC;IAED,OAAO,KAAK,CAAC;AACjB,CAAC;AAND,0BAMC;AAED;;;;8BAI8B;AAC9B,mEAAmE;AACnE,SAAgB,YAAY,CAAI,QAAqC,EAAE,YAAe;IAClF,OAAO,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,YAAY,CAAC;AACpC,CAAC;AAFD,oCAEC;AAED;;;;gCAIgC;AAChC,mEAAmE;AACnE,SAAgB,cAAc,CAAI,YAAe;IAC7C,OAAO,QAAQ,CAAC,EAAE,CAAC,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,YAAY,CAAC;AAChD,CAAC;AAFD,wCAEC;AAED;;;;;;6BAM6B;AAC7B,mEAAmE;AACnE,SAAgB,GAAG,CAAO,QAAqC,EAAE,CAAoB;;IACjF,OAAO,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAA,CAAC,CAAC,QAAQ,CAAC,mCAAI,IAAI,CAAC;AACzD,CAAC;AAFD,kBAEC;AAED;;;;;;;qCAOqC;AACrC,SAAgB,KAAK,CACjB,CAAoB;AACpB,mEAAmE;;IAEnE,OAAO,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;AACxC,CAAC;AALD,sBAKC;AAmBD,gBAAgB;AAChB,6DAA6D;AAC7D,4EAA4E;AAC/D,QAAA,WAAW,GAAG,GAAG,CAAC;AAiB/B,gBAAgB;AAChB,6DAA6D;AAC7D,4EAA4E;AAC/D,QAAA,aAAa,GAAG,KAAK,CAAC;AAEnC;;;;;;4CAM4C;AAC5C,SAAgB,WAAW;AACvB,mEAAmE;AACnE,QAAqC,EACrC,CAAoB;;IAEpB,OAAO,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAA,CAAC,CAAC,QAAQ,CAAC,mCAAI,SAAS,CAAC;AACnE,CAAC;AAND,kCAMC;AAED;;;;;;;;;;6CAU6C;AAC7C,SAAgB,aAAa,CACzB,CAAoB;AACpB,mEAAmE;;IAEnE,OAAO,QAAQ,CAAC,EAAE,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;AAChD,CAAC;AALD,sCAKC;AAED;;;;2BAI2B;AAC3B,mEAAmE;AACnE,SAAgB,OAAO,CAAW,QAAqC,EAAE,CAAU;IAC/E,OAAO,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC7C,CAAC;AAFD,0BAEC;AAED;;;;;2BAK2B;AAC3B,mEAAmE;AACnE,SAAgB,SAAS,CAAW,CAAU;IAC1C,OAAO,QAAQ,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;AAC5C,CAAC;AAFD,8BAEC","sourcesContent":["/** Tests if the specified value is null or undefined.\n *\n * Useful as the predicate of filter functions and similar. */\nexport function isNull<T>(value: unknown): value is null | undefined {\n return value == null;\n}\n\n/** Tests if the specified value is null or undefined.\n *\n * Useful as the predicate of filter functions and similar. */\n// eslint-disable-next-line @typescript-eslint/no-invalid-void-type\nexport function isNotNull<T>(value: T | null | undefined | void): value is T {\n return value != null;\n}\n\n/** Asserts that the specified value is neither null nor undefined, and\n * returns it.\n *\n * @throws TypeError if the value is null or undefined */\n// eslint-disable-next-line @typescript-eslint/no-invalid-void-type\nexport function notNull<T>(value: T | null | undefined | void): T {\n if (value == null) {\n throw new TypeError(`value is ${String(value)}`);\n }\n\n return value;\n}\n\n/** Returns the specified value, or the default value if the specified value\n * is null or undefined.\n *\n * If the default value is expensive to compute, consider using\n * {@link mapNull} instead. */\n// eslint-disable-next-line @typescript-eslint/no-invalid-void-type\nexport function defaultValue<T>(nullable: T | undefined | null | void, defaultValue: T): T {\n return nullable ?? defaultValue;\n}\n\n/** Returns a function that returns the specified value, or the default value\n * if the specified value is null or undefined.\n *\n * If the default value is expensive to compute, consider using\n * {@link mapNullFn} instead. */\n// eslint-disable-next-line @typescript-eslint/no-invalid-void-type\nexport function defaultValueFn<T>(defaultValue: T): (nullable: T | undefined | null | void) => T {\n return nullable => nullable ?? defaultValue;\n}\n\n/** If the specified value is `null` or `undefined`, returns `null`.\n *\n * Otherwise, passes the specified value to the provided function and returns\n * the return value of that function.\n *\n * Equivalent to {@link mapOptional} except that this function returns `null`\n * instead of `undefined`. */\n// eslint-disable-next-line @typescript-eslint/no-invalid-void-type\nexport function map<T, U>(nullable: T | undefined | null | void, f: (element: T) => U): U | null {\n return nullable == null ? null : f(nullable) ?? null;\n}\n\n/** Returns a function that takes a nullable value as its argument.\n *\n * If the function is called with null or undefined, it returns null.\n *\n * Otherwise, the argument is passed to the callback `f` and the\n * return value of `f` is returned.\n *\n * Curried variant of {@link map}. */\nexport function mapFn<T, U>(\n f: (element: T) => U\n // eslint-disable-next-line @typescript-eslint/no-invalid-void-type\n): (nullable: T | undefined | null | void) => U | null {\n return nullable => map(nullable, f);\n}\n\n/** If the specified value is null or undefined, returns null.\n *\n * Otherwise, passes the specified value to the provided function and returns\n * the return value of that function.\n *\n * Equivalent to {@link mapOptional} except that this function returns `null`\n * instead of `undefined`.\n *\n * Alias for {@link map}. */\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore This is the exported declaration, the actual implementation is below.\nexport function mapNullable<T, U>(\n // eslint-disable-next-line @typescript-eslint/no-invalid-void-type\n nullable: T | undefined | null | void,\n f: (element: T) => U\n): U | null;\n\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore This is the implementation, the exported declaration is above.\nexport const mapNullable = map;\n\n/** Returns a function that takes a nullable value as its argument.\n *\n * If the function is called with null or undefined, it returns null.\n *\n * Otherwise, the argument is passed to the callback `f` and the\n * return value of `f` is returned.\n *\n * Alias for {@link mapFn}, which is a curried variant of {@link map}. */\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore This is the exported declaration, the actual implementation is below.\nexport function mapNullableFn<T, U>(\n f: (element: T) => U\n // eslint-disable-next-line @typescript-eslint/no-invalid-void-type\n): (nullable: T | undefined | null | void) => U | null;\n\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore This is the implementation, the exported declaration is above.\nexport const mapNullableFn = mapFn;\n\n/** If the specified value is `null` or `undefined`, returns `undefined`.\n *\n * Otherwise, passes the specified value to the provided function and returns\n * the return value of that function.\n *\n * Equivalent to {@link map} and {@link mapNullable} except that this function\n * returns `undefined` instead of `null`. */\nexport function mapOptional<T, U>(\n // eslint-disable-next-line @typescript-eslint/no-invalid-void-type\n optional: T | null | undefined | void,\n f: (element: T) => U\n): U | undefined {\n return optional == null ? undefined : f(optional) ?? undefined;\n}\n\n/** Returns a function that takes a nullable value as its argument.\n *\n * If the function is called with `null` or `undefined`, it returns undefined.\n *\n * Otherwise, the argument is passed to the callback `f` and the\n * return value of `f` is returned.\n *\n * Equivalent to {@link mapFn} and {@link mapNullableFn} except that the\n * resulting function returns `undefined` instead of `null`.\n *\n * Curried variant of {@link mapOptional}. */\nexport function mapOptionalFn<T, U>(\n f: (element: T) => U\n // eslint-disable-next-line @typescript-eslint/no-invalid-void-type\n): (optional: T | undefined | null | void) => U | undefined {\n return optional => mapOptional(optional, f);\n}\n\n/** Returns the specified value or, if the value is null or undefined, calls\n * the provided callback and returns the result of that function call.\n *\n * Useful as an alternative to {@link defaultValue} if the default value is\n * expensive to compute. */\n// eslint-disable-next-line @typescript-eslint/no-invalid-void-type\nexport function mapNull<T, U = T>(nullable: T | undefined | null | void, f: () => U): T | U {\n return nullable == null ? f() : nullable;\n}\n\n/** Returns a function that returns the specified value or, if the value is\n * null or undefined, calls the provided callback and returns the result of\n * that function call.\n *\n * Useful as an alternative to {@link defaultValueFn} if the default value is\n * expensive to compute. */\n// eslint-disable-next-line @typescript-eslint/no-invalid-void-type\nexport function mapNullFn<T, U = T>(f: () => U): (nullable: T | undefined | null | void) => T | U {\n return nullable => mapNull(nullable, f);\n}\n"]} |
+1
-1
@@ -1,2 +0,2 @@ | ||
| Copyright 2021-2022 Software Ventures Limited. | ||
| Copyright 2021-2024 Software Ventures Limited. | ||
@@ -3,0 +3,0 @@ Permission to use, copy, modify, and/or distribute this software for any purpose |
+15
-15
| { | ||
| "name": "@softwareventures/nullable", | ||
| "version": "3.1.0", | ||
| "version": "3.2.0", | ||
| "description": "Pure functional utilities for nullable types", | ||
@@ -29,24 +29,24 @@ "keywords": [ | ||
| "dependencies": { | ||
| "tslib": "2.4.1" | ||
| "tslib": "2.6.2" | ||
| }, | ||
| "devDependencies": { | ||
| "@softwareventures/eslint-config": "7.1.0", | ||
| "@softwareventures/eslint-config": "7.1.4", | ||
| "@softwareventures/prettier-config": "4.0.0", | ||
| "@softwareventures/semantic-release-config": "3.1.0", | ||
| "@softwareventures/tsconfig": "7.0.0", | ||
| "@typescript-eslint/eslint-plugin": "5.44.0", | ||
| "@typescript-eslint/parser": "5.44.0", | ||
| "ava": "5.1.0", | ||
| "@softwareventures/tsconfig": "7.1.0", | ||
| "@typescript-eslint/eslint-plugin": "5.62.0", | ||
| "@typescript-eslint/parser": "5.62.0", | ||
| "ava": "5.3.1", | ||
| "cz-conventional-changelog": "3.3.0", | ||
| "eslint": "8.28.0", | ||
| "eslint-config-prettier": "8.5.0", | ||
| "eslint-plugin-import": "2.26.0", | ||
| "eslint-plugin-jsdoc": "39.6.4", | ||
| "eslint": "8.56.0", | ||
| "eslint-config-prettier": "8.10.0", | ||
| "eslint-plugin-import": "2.29.1", | ||
| "eslint-plugin-jsdoc": "40.3.0", | ||
| "eslint-plugin-prefer-arrow": "1.2.3", | ||
| "eslint-plugin-sonarjs": "0.16.0", | ||
| "prettier": "2.8.0", | ||
| "eslint-plugin-sonarjs": "0.23.0", | ||
| "prettier": "2.8.8", | ||
| "semantic-release": "19.0.5", | ||
| "ts-expect": "1.3.0", | ||
| "ts-node": "10.9.1", | ||
| "typescript": "4.9.3" | ||
| "ts-node": "10.9.2", | ||
| "typescript": "5.3.3" | ||
| }, | ||
@@ -53,0 +53,0 @@ "eslintConfig": { |
21908
25.77%231
35.09%+ Added
- Removed
Updated