@xylabs/promise 2.9.2 → 2.10.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/dist/fulfilled.d.mts +8 -0
- package/dist/fulfilled.d.ts +8 -0
- package/dist/fulfilled.js +33 -0
- package/dist/fulfilled.js.map +1 -0
- package/dist/fulfilled.mjs +8 -0
- package/dist/fulfilled.mjs.map +1 -0
- package/dist/{esm/fulfilledValues.js → fulfilledValues.d.mts} +3 -6
- package/dist/{types/fulfilledValues.d.ts → fulfilledValues.d.ts} +3 -2
- package/dist/fulfilledValues.js +35 -0
- package/dist/fulfilledValues.js.map +1 -0
- package/dist/fulfilledValues.mjs +10 -0
- package/dist/fulfilledValues.mjs.map +1 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +22 -0
- package/dist/index.mjs.map +1 -0
- package/dist/rejected.d.mts +8 -0
- package/dist/rejected.d.ts +8 -0
- package/dist/rejected.js +33 -0
- package/dist/rejected.js.map +1 -0
- package/dist/rejected.mjs +8 -0
- package/dist/rejected.mjs.map +1 -0
- package/package.json +28 -14
- package/tsup.config.ts +14 -0
- package/dist/cjs/fulfilled.js +0 -13
- package/dist/cjs/fulfilled.js.map +0 -1
- package/dist/cjs/fulfilledValues.js +0 -28
- package/dist/cjs/fulfilledValues.js.map +0 -1
- package/dist/cjs/index.js +0 -10
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/rejected.js +0 -13
- package/dist/cjs/rejected.js.map +0 -1
- package/dist/docs.json +0 -430
- package/dist/esm/fulfilled.js +0 -9
- package/dist/esm/fulfilled.js.map +0 -1
- package/dist/esm/fulfilledValues.js.map +0 -1
- package/dist/esm/index.js +0 -5
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/rejected.js +0 -9
- package/dist/esm/rejected.js.map +0 -1
- package/dist/types/fulfilled.d.ts +0 -7
- package/dist/types/fulfilled.d.ts.map +0 -1
- package/dist/types/fulfilledValues.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -5
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/rejected.d.ts +0 -7
- package/dist/types/rejected.d.ts.map +0 -1
- package/docs/assets/highlight.css +0 -85
- package/docs/assets/main.js +0 -58
- package/docs/assets/search.js +0 -1
- package/docs/assets/style.css +0 -1367
- package/docs/functions/fulfilled.html +0 -61
- package/docs/functions/fulfilledValues.html +0 -72
- package/docs/functions/rejected.html +0 -61
- package/docs/index.html +0 -84
- package/docs/modules.html +0 -46
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/fulfilled.ts
|
|
21
|
+
var fulfilled_exports = {};
|
|
22
|
+
__export(fulfilled_exports, {
|
|
23
|
+
fulfilled: () => fulfilled
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(fulfilled_exports);
|
|
26
|
+
var fulfilled = (val) => {
|
|
27
|
+
return val.status === "fulfilled";
|
|
28
|
+
};
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
fulfilled
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=fulfilled.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/fulfilled.ts"],"sourcesContent":["/**\n * For use with Promise.allSettled to filter only successful results\n * @param val\n * @returns\n */\nexport const fulfilled = <T>(val: PromiseSettledResult<T>): val is PromiseFulfilledResult<T> => {\n return val.status === 'fulfilled'\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKO,IAAM,YAAY,CAAI,QAAmE;AAC9F,SAAO,IAAI,WAAW;AACxB;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/fulfilled.ts"],"sourcesContent":["/**\n * For use with Promise.allSettled to filter only successful results\n * @param val\n * @returns\n */\nexport const fulfilled = <T>(val: PromiseSettledResult<T>): val is PromiseFulfilledResult<T> => {\n return val.status === 'fulfilled'\n}\n"],"mappings":";AAKO,IAAM,YAAY,CAAI,QAAmE;AAC9F,SAAO,IAAI,WAAW;AACxB;","names":[]}
|
|
@@ -16,9 +16,6 @@
|
|
|
16
16
|
* @param currentValue
|
|
17
17
|
* @returns
|
|
18
18
|
*/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return previousValue;
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=fulfilledValues.js.map
|
|
19
|
+
declare const fulfilledValues: <T>(previousValue: T[], currentValue: PromiseSettledResult<T>) => T[];
|
|
20
|
+
|
|
21
|
+
export { fulfilledValues };
|
|
@@ -16,5 +16,6 @@
|
|
|
16
16
|
* @param currentValue
|
|
17
17
|
* @returns
|
|
18
18
|
*/
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
declare const fulfilledValues: <T>(previousValue: T[], currentValue: PromiseSettledResult<T>) => T[];
|
|
20
|
+
|
|
21
|
+
export { fulfilledValues };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/fulfilledValues.ts
|
|
21
|
+
var fulfilledValues_exports = {};
|
|
22
|
+
__export(fulfilledValues_exports, {
|
|
23
|
+
fulfilledValues: () => fulfilledValues
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(fulfilledValues_exports);
|
|
26
|
+
var fulfilledValues = (previousValue, currentValue) => {
|
|
27
|
+
if (currentValue.status === "fulfilled")
|
|
28
|
+
previousValue.push(currentValue.value);
|
|
29
|
+
return previousValue;
|
|
30
|
+
};
|
|
31
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
32
|
+
0 && (module.exports = {
|
|
33
|
+
fulfilledValues
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=fulfilledValues.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/fulfilledValues.ts"],"sourcesContent":["/**\n * For use with Promise.allSettled to reduce to only successful result values\n * @example <caption>Casting the initialValue provided to reduce</caption>\n * const resolved = Promise.resolve('resolved')\n * const rejected = Promise.reject('rejected')\n * const settled = await Promise.allSettled([resolved, rejected])\n * const results = settled.reduce(fulfilledValues, [] as string[])\n * // results === [ 'resolved' ]\n * @example <caption>Providing type parameter to reduce and initialValue type can be inferred</caption>\n * const resolved = Promise.resolve('resolved')\n * const rejected = Promise.reject('rejected')\n * const settled = await Promise.allSettled([resolved, rejected])\n * const results = settled.reduce<string[]>(fulfilledValues, [])\n * // results === [ 'resolved' ]\n * @param previousValue\n * @param currentValue\n * @returns\n */\nexport const fulfilledValues = <T>(previousValue: T[], currentValue: PromiseSettledResult<T>): T[] => {\n if (currentValue.status === 'fulfilled') previousValue.push(currentValue.value)\n return previousValue\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBO,IAAM,kBAAkB,CAAI,eAAoB,iBAA+C;AACpG,MAAI,aAAa,WAAW;AAAa,kBAAc,KAAK,aAAa,KAAK;AAC9E,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// src/fulfilledValues.ts
|
|
2
|
+
var fulfilledValues = (previousValue, currentValue) => {
|
|
3
|
+
if (currentValue.status === "fulfilled")
|
|
4
|
+
previousValue.push(currentValue.value);
|
|
5
|
+
return previousValue;
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
fulfilledValues
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=fulfilledValues.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/fulfilledValues.ts"],"sourcesContent":["/**\n * For use with Promise.allSettled to reduce to only successful result values\n * @example <caption>Casting the initialValue provided to reduce</caption>\n * const resolved = Promise.resolve('resolved')\n * const rejected = Promise.reject('rejected')\n * const settled = await Promise.allSettled([resolved, rejected])\n * const results = settled.reduce(fulfilledValues, [] as string[])\n * // results === [ 'resolved' ]\n * @example <caption>Providing type parameter to reduce and initialValue type can be inferred</caption>\n * const resolved = Promise.resolve('resolved')\n * const rejected = Promise.reject('rejected')\n * const settled = await Promise.allSettled([resolved, rejected])\n * const results = settled.reduce<string[]>(fulfilledValues, [])\n * // results === [ 'resolved' ]\n * @param previousValue\n * @param currentValue\n * @returns\n */\nexport const fulfilledValues = <T>(previousValue: T[], currentValue: PromiseSettledResult<T>): T[] => {\n if (currentValue.status === 'fulfilled') previousValue.push(currentValue.value)\n return previousValue\n}\n"],"mappings":";AAkBO,IAAM,kBAAkB,CAAI,eAAoB,iBAA+C;AACpG,MAAI,aAAa,WAAW;AAAa,kBAAc,KAAK,aAAa,KAAK;AAC9E,SAAO;AACT;","names":[]}
|
package/dist/index.d.mts
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
fulfilled: () => fulfilled,
|
|
24
|
+
fulfilledValues: () => fulfilledValues,
|
|
25
|
+
rejected: () => rejected
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(src_exports);
|
|
28
|
+
|
|
29
|
+
// src/fulfilled.ts
|
|
30
|
+
var fulfilled = (val) => {
|
|
31
|
+
return val.status === "fulfilled";
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// src/fulfilledValues.ts
|
|
35
|
+
var fulfilledValues = (previousValue, currentValue) => {
|
|
36
|
+
if (currentValue.status === "fulfilled")
|
|
37
|
+
previousValue.push(currentValue.value);
|
|
38
|
+
return previousValue;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// src/rejected.ts
|
|
42
|
+
var rejected = (val) => {
|
|
43
|
+
return val.status === "rejected";
|
|
44
|
+
};
|
|
45
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
+
0 && (module.exports = {
|
|
47
|
+
fulfilled,
|
|
48
|
+
fulfilledValues,
|
|
49
|
+
rejected
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/fulfilled.ts","../src/fulfilledValues.ts","../src/rejected.ts"],"sourcesContent":["import { fulfilled } from './fulfilled'\nimport { fulfilledValues } from './fulfilledValues'\nimport { rejected } from './rejected'\n\nexport { fulfilled, fulfilledValues, rejected }\n","/**\n * For use with Promise.allSettled to filter only successful results\n * @param val\n * @returns\n */\nexport const fulfilled = <T>(val: PromiseSettledResult<T>): val is PromiseFulfilledResult<T> => {\n return val.status === 'fulfilled'\n}\n","/**\n * For use with Promise.allSettled to reduce to only successful result values\n * @example <caption>Casting the initialValue provided to reduce</caption>\n * const resolved = Promise.resolve('resolved')\n * const rejected = Promise.reject('rejected')\n * const settled = await Promise.allSettled([resolved, rejected])\n * const results = settled.reduce(fulfilledValues, [] as string[])\n * // results === [ 'resolved' ]\n * @example <caption>Providing type parameter to reduce and initialValue type can be inferred</caption>\n * const resolved = Promise.resolve('resolved')\n * const rejected = Promise.reject('rejected')\n * const settled = await Promise.allSettled([resolved, rejected])\n * const results = settled.reduce<string[]>(fulfilledValues, [])\n * // results === [ 'resolved' ]\n * @param previousValue\n * @param currentValue\n * @returns\n */\nexport const fulfilledValues = <T>(previousValue: T[], currentValue: PromiseSettledResult<T>): T[] => {\n if (currentValue.status === 'fulfilled') previousValue.push(currentValue.value)\n return previousValue\n}\n","/**\n * For use with Promise.allSettled to filter only rejected results\n * @param val\n * @returns\n */\nexport const rejected = <T>(val: PromiseSettledResult<T>): val is PromiseRejectedResult => {\n return val.status === 'rejected'\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACKO,IAAM,YAAY,CAAI,QAAmE;AAC9F,SAAO,IAAI,WAAW;AACxB;;;ACWO,IAAM,kBAAkB,CAAI,eAAoB,iBAA+C;AACpG,MAAI,aAAa,WAAW;AAAa,kBAAc,KAAK,aAAa,KAAK;AAC9E,SAAO;AACT;;;AChBO,IAAM,WAAW,CAAI,QAA+D;AACzF,SAAO,IAAI,WAAW;AACxB;","names":[]}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// src/fulfilled.ts
|
|
2
|
+
var fulfilled = (val) => {
|
|
3
|
+
return val.status === "fulfilled";
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
// src/fulfilledValues.ts
|
|
7
|
+
var fulfilledValues = (previousValue, currentValue) => {
|
|
8
|
+
if (currentValue.status === "fulfilled")
|
|
9
|
+
previousValue.push(currentValue.value);
|
|
10
|
+
return previousValue;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
// src/rejected.ts
|
|
14
|
+
var rejected = (val) => {
|
|
15
|
+
return val.status === "rejected";
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
fulfilled,
|
|
19
|
+
fulfilledValues,
|
|
20
|
+
rejected
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/fulfilled.ts","../src/fulfilledValues.ts","../src/rejected.ts"],"sourcesContent":["/**\n * For use with Promise.allSettled to filter only successful results\n * @param val\n * @returns\n */\nexport const fulfilled = <T>(val: PromiseSettledResult<T>): val is PromiseFulfilledResult<T> => {\n return val.status === 'fulfilled'\n}\n","/**\n * For use with Promise.allSettled to reduce to only successful result values\n * @example <caption>Casting the initialValue provided to reduce</caption>\n * const resolved = Promise.resolve('resolved')\n * const rejected = Promise.reject('rejected')\n * const settled = await Promise.allSettled([resolved, rejected])\n * const results = settled.reduce(fulfilledValues, [] as string[])\n * // results === [ 'resolved' ]\n * @example <caption>Providing type parameter to reduce and initialValue type can be inferred</caption>\n * const resolved = Promise.resolve('resolved')\n * const rejected = Promise.reject('rejected')\n * const settled = await Promise.allSettled([resolved, rejected])\n * const results = settled.reduce<string[]>(fulfilledValues, [])\n * // results === [ 'resolved' ]\n * @param previousValue\n * @param currentValue\n * @returns\n */\nexport const fulfilledValues = <T>(previousValue: T[], currentValue: PromiseSettledResult<T>): T[] => {\n if (currentValue.status === 'fulfilled') previousValue.push(currentValue.value)\n return previousValue\n}\n","/**\n * For use with Promise.allSettled to filter only rejected results\n * @param val\n * @returns\n */\nexport const rejected = <T>(val: PromiseSettledResult<T>): val is PromiseRejectedResult => {\n return val.status === 'rejected'\n}\n"],"mappings":";AAKO,IAAM,YAAY,CAAI,QAAmE;AAC9F,SAAO,IAAI,WAAW;AACxB;;;ACWO,IAAM,kBAAkB,CAAI,eAAoB,iBAA+C;AACpG,MAAI,aAAa,WAAW;AAAa,kBAAc,KAAK,aAAa,KAAK;AAC9E,SAAO;AACT;;;AChBO,IAAM,WAAW,CAAI,QAA+D;AACzF,SAAO,IAAI,WAAW;AACxB;","names":[]}
|
package/dist/rejected.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/rejected.ts
|
|
21
|
+
var rejected_exports = {};
|
|
22
|
+
__export(rejected_exports, {
|
|
23
|
+
rejected: () => rejected
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(rejected_exports);
|
|
26
|
+
var rejected = (val) => {
|
|
27
|
+
return val.status === "rejected";
|
|
28
|
+
};
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
rejected
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=rejected.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/rejected.ts"],"sourcesContent":["/**\n * For use with Promise.allSettled to filter only rejected results\n * @param val\n * @returns\n */\nexport const rejected = <T>(val: PromiseSettledResult<T>): val is PromiseRejectedResult => {\n return val.status === 'rejected'\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKO,IAAM,WAAW,CAAI,QAA+D;AACzF,SAAO,IAAI,WAAW;AACxB;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/rejected.ts"],"sourcesContent":["/**\n * For use with Promise.allSettled to filter only rejected results\n * @param val\n * @returns\n */\nexport const rejected = <T>(val: PromiseSettledResult<T>): val is PromiseRejectedResult => {\n return val.status === 'rejected'\n}\n"],"mappings":";AAKO,IAAM,WAAW,CAAI,QAA+D;AACzF,SAAO,IAAI,WAAW;AACxB;","names":[]}
|
package/package.json
CHANGED
|
@@ -11,28 +11,39 @@
|
|
|
11
11
|
"url": "https://github.com/xylabs/sdk-js/issues"
|
|
12
12
|
},
|
|
13
13
|
"description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
|
|
14
|
-
"browser": "dist/esm/index.js",
|
|
15
|
-
"main": "dist/cjs/index.js",
|
|
16
|
-
"module": "dist/esm/index.js",
|
|
17
14
|
"docs": "dist/docs.json",
|
|
18
|
-
"types": "dist/
|
|
15
|
+
"types": "dist/index.d.ts",
|
|
19
16
|
"exports": {
|
|
20
17
|
".": {
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
18
|
+
"require": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"default": "./dist/index.js"
|
|
24
21
|
},
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
}
|
|
29
|
-
"default": "./dist/esm/index.js"
|
|
22
|
+
"import": {
|
|
23
|
+
"types": "./dist/index.d.mts",
|
|
24
|
+
"default": "./dist/index.mjs"
|
|
25
|
+
}
|
|
30
26
|
},
|
|
31
27
|
"./dist/docs.json": {
|
|
32
28
|
"default": "./dist/docs.json"
|
|
33
29
|
},
|
|
30
|
+
"./cjs": {
|
|
31
|
+
"default": "./dist/index.js"
|
|
32
|
+
},
|
|
33
|
+
"./docs": {
|
|
34
|
+
"default": "./dist/docs.json"
|
|
35
|
+
},
|
|
36
|
+
"./esm": {
|
|
37
|
+
"default": "./dist/index.mjs"
|
|
38
|
+
},
|
|
34
39
|
"./package.json": "./package.json"
|
|
35
40
|
},
|
|
41
|
+
"main": "dist/index.js",
|
|
42
|
+
"module": "dist/index.mjs",
|
|
43
|
+
"scripts": {
|
|
44
|
+
"package-compile": "tsup && publint",
|
|
45
|
+
"package-recompile": "tsup && publint"
|
|
46
|
+
},
|
|
36
47
|
"homepage": "https://xylabs.com",
|
|
37
48
|
"keywords": [
|
|
38
49
|
"xylabs",
|
|
@@ -41,7 +52,10 @@
|
|
|
41
52
|
"esm"
|
|
42
53
|
],
|
|
43
54
|
"devDependencies": {
|
|
44
|
-
"@xylabs/ts-scripts-yarn3": "^2.
|
|
55
|
+
"@xylabs/ts-scripts-yarn3": "^2.19.5",
|
|
56
|
+
"@xylabs/tsconfig": "^2.19.5",
|
|
57
|
+
"publint": "^0.2.2",
|
|
58
|
+
"tsup": "^7.2.0"
|
|
45
59
|
},
|
|
46
60
|
"publishConfig": {
|
|
47
61
|
"access": "public"
|
|
@@ -51,5 +65,5 @@
|
|
|
51
65
|
"url": "https://github.com/xylabs/sdk-js.git"
|
|
52
66
|
},
|
|
53
67
|
"sideEffects": false,
|
|
54
|
-
"version": "2.
|
|
68
|
+
"version": "2.10.0"
|
|
55
69
|
}
|
package/tsup.config.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { defineConfig } from 'tsup'
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line import/no-default-export
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
bundle: true,
|
|
6
|
+
cjsInterop: true,
|
|
7
|
+
clean: true,
|
|
8
|
+
dts: true,
|
|
9
|
+
entry: ['src'],
|
|
10
|
+
format: ['cjs', 'esm'],
|
|
11
|
+
sourcemap: true,
|
|
12
|
+
splitting: false,
|
|
13
|
+
tsconfig: 'tsconfig.json',
|
|
14
|
+
})
|
package/dist/cjs/fulfilled.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fulfilled = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* For use with Promise.allSettled to filter only successful results
|
|
6
|
-
* @param val
|
|
7
|
-
* @returns
|
|
8
|
-
*/
|
|
9
|
-
const fulfilled = (val) => {
|
|
10
|
-
return val.status === 'fulfilled';
|
|
11
|
-
};
|
|
12
|
-
exports.fulfilled = fulfilled;
|
|
13
|
-
//# sourceMappingURL=fulfilled.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fulfilled.js","sourceRoot":"","sources":["../../src/fulfilled.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACI,MAAM,SAAS,GAAG,CAAI,GAA4B,EAAoC,EAAE;IAC7F,OAAO,GAAG,CAAC,MAAM,KAAK,WAAW,CAAA;AACnC,CAAC,CAAA;AAFY,QAAA,SAAS,aAErB"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fulfilledValues = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* For use with Promise.allSettled to reduce to only successful result values
|
|
6
|
-
* @example <caption>Casting the initialValue provided to reduce</caption>
|
|
7
|
-
* const resolved = Promise.resolve('resolved')
|
|
8
|
-
* const rejected = Promise.reject('rejected')
|
|
9
|
-
* const settled = await Promise.allSettled([resolved, rejected])
|
|
10
|
-
* const results = settled.reduce(fulfilledValues, [] as string[])
|
|
11
|
-
* // results === [ 'resolved' ]
|
|
12
|
-
* @example <caption>Providing type parameter to reduce and initialValue type can be inferred</caption>
|
|
13
|
-
* const resolved = Promise.resolve('resolved')
|
|
14
|
-
* const rejected = Promise.reject('rejected')
|
|
15
|
-
* const settled = await Promise.allSettled([resolved, rejected])
|
|
16
|
-
* const results = settled.reduce<string[]>(fulfilledValues, [])
|
|
17
|
-
* // results === [ 'resolved' ]
|
|
18
|
-
* @param previousValue
|
|
19
|
-
* @param currentValue
|
|
20
|
-
* @returns
|
|
21
|
-
*/
|
|
22
|
-
const fulfilledValues = (previousValue, currentValue) => {
|
|
23
|
-
if (currentValue.status === 'fulfilled')
|
|
24
|
-
previousValue.push(currentValue.value);
|
|
25
|
-
return previousValue;
|
|
26
|
-
};
|
|
27
|
-
exports.fulfilledValues = fulfilledValues;
|
|
28
|
-
//# sourceMappingURL=fulfilledValues.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fulfilledValues.js","sourceRoot":"","sources":["../../src/fulfilledValues.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;GAiBG;AACI,MAAM,eAAe,GAAG,CAAI,aAAkB,EAAE,YAAqC,EAAO,EAAE;IACnG,IAAI,YAAY,CAAC,MAAM,KAAK,WAAW;QAAE,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAA;IAC/E,OAAO,aAAa,CAAA;AACtB,CAAC,CAAA;AAHY,QAAA,eAAe,mBAG3B"}
|
package/dist/cjs/index.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.rejected = exports.fulfilledValues = exports.fulfilled = void 0;
|
|
4
|
-
const fulfilled_1 = require("./fulfilled");
|
|
5
|
-
Object.defineProperty(exports, "fulfilled", { enumerable: true, get: function () { return fulfilled_1.fulfilled; } });
|
|
6
|
-
const fulfilledValues_1 = require("./fulfilledValues");
|
|
7
|
-
Object.defineProperty(exports, "fulfilledValues", { enumerable: true, get: function () { return fulfilledValues_1.fulfilledValues; } });
|
|
8
|
-
const rejected_1 = require("./rejected");
|
|
9
|
-
Object.defineProperty(exports, "rejected", { enumerable: true, get: function () { return rejected_1.rejected; } });
|
|
10
|
-
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,2CAAuC;AAI9B,0FAJA,qBAAS,OAIA;AAHlB,uDAAmD;AAG/B,gGAHX,iCAAe,OAGW;AAFnC,yCAAqC;AAEA,yFAF5B,mBAAQ,OAE4B"}
|
package/dist/cjs/rejected.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.rejected = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* For use with Promise.allSettled to filter only rejected results
|
|
6
|
-
* @param val
|
|
7
|
-
* @returns
|
|
8
|
-
*/
|
|
9
|
-
const rejected = (val) => {
|
|
10
|
-
return val.status === 'rejected';
|
|
11
|
-
};
|
|
12
|
-
exports.rejected = rejected;
|
|
13
|
-
//# sourceMappingURL=rejected.js.map
|
package/dist/cjs/rejected.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rejected.js","sourceRoot":"","sources":["../../src/rejected.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACI,MAAM,QAAQ,GAAG,CAAI,GAA4B,EAAgC,EAAE;IACxF,OAAO,GAAG,CAAC,MAAM,KAAK,UAAU,CAAA;AAClC,CAAC,CAAA;AAFY,QAAA,QAAQ,YAEpB"}
|