@xylabs/exists 4.4.18 → 4.4.20
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/dist/neutral/index.d.ts
CHANGED
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
* @param x The object which is potentially undefined or null
|
|
7
7
|
* @returns False if the object is null/undefined, true otherwise
|
|
8
8
|
*/
|
|
9
|
-
export declare const exists: <T>(x?: T | null) => x is T
|
|
9
|
+
export declare const exists: <T>(x?: T | null) => x is NonNullable<T>;
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,MAAM,GAAI,CAAC,MAAM,CAAC,GAAG,IAAI,KAAG,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,MAAM,GAAI,CAAC,MAAM,CAAC,GAAG,IAAI,KAAG,CAAC,IAAI,WAAW,CAAC,CAAC,CAE1D,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/**\n * Used to type narrow an object which is possibly null or undefined. Works well\n * with functional Array methods. For example:\n * @example\n * const payloads: XyoPayload[] = boundWitness._payloads?.filter(exists) || []\n * @param x The object which is potentially undefined or null\n * @returns False if the object is null/undefined, true otherwise\n */\nexport const exists = <T>(x?: T | null): x is T => {\n return x === undefined || x === null ? false : true\n}\n"],"mappings":";AAQO,IAAM,SAAS,CAAI,
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/**\n * Used to type narrow an object which is possibly null or undefined. Works well\n * with functional Array methods. For example:\n * @example\n * const payloads: XyoPayload[] = boundWitness._payloads?.filter(exists) || []\n * @param x The object which is potentially undefined or null\n * @returns False if the object is null/undefined, true otherwise\n */\nexport const exists = <T>(x?: T | null): x is NonNullable<T> => {\n return x === undefined || x === null ? false : true\n}\n"],"mappings":";AAQO,IAAM,SAAS,CAAI,MAAsC;AAC9D,SAAO,MAAM,UAAa,MAAM,OAAO,QAAQ;AACjD;","names":[]}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
* @param x The object which is potentially undefined or null
|
|
7
7
|
* @returns False if the object is null/undefined, true otherwise
|
|
8
8
|
*/
|
|
9
|
-
export const exists = <T>(x?: T | null): x is T => {
|
|
9
|
+
export const exists = <T>(x?: T | null): x is NonNullable<T> => {
|
|
10
10
|
return x === undefined || x === null ? false : true
|
|
11
11
|
}
|