@xylabs/promise 2.11.24 → 2.12.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/node/fulfilled.cjs +33 -0
- package/dist/node/{fulfilled.mjs.map → fulfilled.cjs.map} +1 -1
- package/dist/node/fulfilled.js +2 -27
- package/dist/node/fulfilled.js.map +1 -1
- package/dist/node/fulfilledValues.cjs +35 -0
- package/dist/node/{fulfilledValues.mjs.map → fulfilledValues.cjs.map} +1 -1
- package/dist/node/fulfilledValues.js +2 -27
- package/dist/node/fulfilledValues.js.map +1 -1
- package/dist/node/index.cjs +51 -0
- package/dist/node/index.cjs.map +1 -0
- package/dist/node/index.js +2 -31
- package/dist/node/index.js.map +1 -1
- package/dist/node/rejected.cjs +33 -0
- package/dist/node/{rejected.mjs.map → rejected.cjs.map} +1 -1
- package/dist/node/rejected.js +2 -27
- package/dist/node/rejected.js.map +1 -1
- package/package.json +4 -6
- package/dist/node/fulfilled.mjs +0 -8
- package/dist/node/fulfilledValues.mjs +0 -10
- package/dist/node/index.mjs +0 -22
- package/dist/node/index.mjs.map +0 -1
- package/dist/node/rejected.mjs +0 -8
|
@@ -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.cjs.map
|
|
@@ -1 +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":[]}
|
|
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":[]}
|
package/dist/node/fulfilled.js
CHANGED
|
@@ -1,33 +1,8 @@
|
|
|
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
1
|
// src/fulfilled.ts
|
|
21
|
-
var fulfilled_exports = {};
|
|
22
|
-
__export(fulfilled_exports, {
|
|
23
|
-
fulfilled: () => fulfilled
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(fulfilled_exports);
|
|
26
2
|
var fulfilled = (val) => {
|
|
27
3
|
return val.status === "fulfilled";
|
|
28
4
|
};
|
|
29
|
-
|
|
30
|
-
0 && (module.exports = {
|
|
5
|
+
export {
|
|
31
6
|
fulfilled
|
|
32
|
-
}
|
|
7
|
+
};
|
|
33
8
|
//# sourceMappingURL=fulfilled.js.map
|
|
@@ -1 +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":"
|
|
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":[]}
|
|
@@ -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.cjs.map
|
|
@@ -1 +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":[]}
|
|
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":[]}
|
|
@@ -1,35 +1,10 @@
|
|
|
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
1
|
// src/fulfilledValues.ts
|
|
21
|
-
var fulfilledValues_exports = {};
|
|
22
|
-
__export(fulfilledValues_exports, {
|
|
23
|
-
fulfilledValues: () => fulfilledValues
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(fulfilledValues_exports);
|
|
26
2
|
var fulfilledValues = (previousValue, currentValue) => {
|
|
27
3
|
if (currentValue.status === "fulfilled")
|
|
28
4
|
previousValue.push(currentValue.value);
|
|
29
5
|
return previousValue;
|
|
30
6
|
};
|
|
31
|
-
|
|
32
|
-
0 && (module.exports = {
|
|
7
|
+
export {
|
|
33
8
|
fulfilledValues
|
|
34
|
-
}
|
|
9
|
+
};
|
|
35
10
|
//# sourceMappingURL=fulfilledValues.js.map
|
|
@@ -1 +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":"
|
|
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":[]}
|
|
@@ -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.cjs.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/node/index.js
CHANGED
|
@@ -1,31 +1,3 @@
|
|
|
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
1
|
// src/fulfilled.ts
|
|
30
2
|
var fulfilled = (val) => {
|
|
31
3
|
return val.status === "fulfilled";
|
|
@@ -42,10 +14,9 @@ var fulfilledValues = (previousValue, currentValue) => {
|
|
|
42
14
|
var rejected = (val) => {
|
|
43
15
|
return val.status === "rejected";
|
|
44
16
|
};
|
|
45
|
-
|
|
46
|
-
0 && (module.exports = {
|
|
17
|
+
export {
|
|
47
18
|
fulfilled,
|
|
48
19
|
fulfilledValues,
|
|
49
20
|
rejected
|
|
50
|
-
}
|
|
21
|
+
};
|
|
51
22
|
//# sourceMappingURL=index.js.map
|
package/dist/node/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/
|
|
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":[]}
|
|
@@ -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.cjs.map
|
|
@@ -1 +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":[]}
|
|
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":[]}
|
package/dist/node/rejected.js
CHANGED
|
@@ -1,33 +1,8 @@
|
|
|
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
1
|
// src/rejected.ts
|
|
21
|
-
var rejected_exports = {};
|
|
22
|
-
__export(rejected_exports, {
|
|
23
|
-
rejected: () => rejected
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(rejected_exports);
|
|
26
2
|
var rejected = (val) => {
|
|
27
3
|
return val.status === "rejected";
|
|
28
4
|
};
|
|
29
|
-
|
|
30
|
-
0 && (module.exports = {
|
|
5
|
+
export {
|
|
31
6
|
rejected
|
|
32
|
-
}
|
|
7
|
+
};
|
|
33
8
|
//# sourceMappingURL=rejected.js.map
|
|
@@ -1 +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":"
|
|
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
|
@@ -12,16 +12,15 @@
|
|
|
12
12
|
},
|
|
13
13
|
"description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
|
|
14
14
|
"docs": "dist/docs.json",
|
|
15
|
-
"types": "dist/node/index.d.ts",
|
|
16
15
|
"exports": {
|
|
17
16
|
".": {
|
|
18
17
|
"require": {
|
|
19
18
|
"types": "./dist/node/index.d.ts",
|
|
20
|
-
"default": "./dist/node/index.
|
|
19
|
+
"default": "./dist/node/index.cjs"
|
|
21
20
|
},
|
|
22
21
|
"import": {
|
|
23
22
|
"types": "./dist/node/index.d.mts",
|
|
24
|
-
"default": "./dist/node/index.
|
|
23
|
+
"default": "./dist/node/index.js"
|
|
25
24
|
}
|
|
26
25
|
},
|
|
27
26
|
"./docs": {
|
|
@@ -29,8 +28,6 @@
|
|
|
29
28
|
},
|
|
30
29
|
"./package.json": "./package.json"
|
|
31
30
|
},
|
|
32
|
-
"main": "dist/node/index.js",
|
|
33
|
-
"module": "dist/node/index.mjs",
|
|
34
31
|
"homepage": "https://xylabs.com",
|
|
35
32
|
"keywords": [
|
|
36
33
|
"xylabs",
|
|
@@ -51,5 +48,6 @@
|
|
|
51
48
|
"url": "https://github.com/xylabs/sdk-js.git"
|
|
52
49
|
},
|
|
53
50
|
"sideEffects": false,
|
|
54
|
-
"version": "2.
|
|
51
|
+
"version": "2.12.0",
|
|
52
|
+
"type": "module"
|
|
55
53
|
}
|
package/dist/node/fulfilled.mjs
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
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
|
package/dist/node/index.mjs
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
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
|
package/dist/node/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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":[]}
|