@xylabs/promise 4.13.15 → 4.13.16

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/README.md CHANGED
@@ -1,63 +1,54 @@
1
- [![logo][]](https://xylabs.com)
2
-
3
1
  # @xylabs/promise
4
2
 
3
+ [![logo][]](https://xylabs.com)
4
+
5
+ [![main-build][]][main-build-link]
5
6
  [![npm-badge][]][npm-link]
6
7
  [![npm-downloads-badge][]][npm-link]
7
8
  [![jsdelivr-badge][]][jsdelivr-link]
8
9
  [![npm-license-badge][]](LICENSE)
10
+ [![codacy-badge][]][codacy-link]
11
+ [![codeclimate-badge][]][codeclimate-link]
12
+ [![snyk-badge][]][snyk-link]
9
13
  [![socket-badge][]][socket-link]
10
14
 
11
- > XY Labs generalized Javascript library
12
-
13
- ## Table of Contents
14
-
15
- - [Description](#description)
16
- - [Install](#install)
17
- - [Maintainers](#maintainers)
18
- - [License](#license)
19
- - [Credits](#credits)
20
-
21
- ## Description
15
+ Version: 4.13.15
22
16
 
23
- Common Javascript code that is used throughout XYO projects that use React.
17
+ Base functionality used throughout XY Labs TypeScript/JavaScript libraries
24
18
 
25
- ## Install
26
-
27
- Using npm:
28
-
29
- ```sh
30
- npm i --save @xylabs/promise
31
- ```
19
+ ## Documentation
32
20
 
33
- Using yarn:
21
+ Coming Soon!
34
22
 
35
- ```sh
36
- yarn add @xylabs/promise
37
- ```
38
-
39
- ## Documentation
40
- [Developer Reference](https://xylabs.github.io/sdk-js)
23
+ Part of [sdk-js](https://www.npmjs.com/package/@xyo-network/sdk-js)
41
24
 
42
25
  ## Maintainers
43
26
 
44
27
  - [Arie Trouw](https://github.com/arietrouw) ([arietrouw.com](https://arietrouw.com))
45
- - [Joel Carter](https://github.com/JoelBCarter)
46
28
  - [Matt Jones](https://github.com/jonesmac)
29
+ - [Joel Carter](https://github.com/JoelBCarter)
47
30
  - [Jordan Trouw](https://github.com/jordantrouw)
48
31
 
49
32
  ## License
50
33
 
51
- See the [LICENSE](LICENSE) file for license details
34
+ > See the [LICENSE](LICENSE) file for license details
52
35
 
53
36
  ## Credits
54
37
 
55
- [Made with 🔥and ❄️ by XY Labs](https://xylabs.com)
38
+ [Made with 🔥 and ❄️ by XYLabs](https://xylabs.com)
56
39
 
57
40
  [logo]: https://cdn.xy.company/img/brand/XYPersistentCompany_Logo_Icon_Colored.svg
58
41
 
42
+ [main-build]: https://github.com/xylabs/sdk-js/actions/workflows/build.yml/badge.svg
43
+ [main-build-link]: https://github.com/xylabs/sdk-js/actions/workflows/build.yml
59
44
  [npm-badge]: https://img.shields.io/npm/v/@xylabs/promise.svg
60
45
  [npm-link]: https://www.npmjs.com/package/@xylabs/promise
46
+ [codacy-badge]: https://app.codacy.com/project/badge/Grade/c8e15e14f37741c18cfb47ac7245c698
47
+ [codacy-link]: https://www.codacy.com/gh/xylabs/sdk-js/dashboard?utm_source=github.com&utm_medium=referral&utm_content=xylabs/sdk-js&utm_campaign=Badge_Grade
48
+ [codeclimate-badge]: https://api.codeclimate.com/v1/badges/c5eb068f806f0b047ea7/maintainability
49
+ [codeclimate-link]: https://codeclimate.com/github/xylabs/sdk-js/maintainability
50
+ [snyk-badge]: https://snyk.io/test/github/xylabs/sdk-js/badge.svg?targetFile=package.json
51
+ [snyk-link]: https://snyk.io/test/github/xylabs/sdk-js?targetFile=package.json
61
52
 
62
53
  [npm-downloads-badge]: https://img.shields.io/npm/dw/@xylabs/promise
63
54
  [npm-license-badge]: https://img.shields.io/npm/l/@xylabs/promise
@@ -1,66 +1,8 @@
1
- import { TypedValue } from '@xylabs/typeof';
2
-
3
- /**
4
- * For use with Promise.allSettled to filter only successful results
5
- * @param val
6
- * @returns
7
- */
8
- declare const fulfilled: <T>(val: PromiseSettledResult<T>) => val is PromiseFulfilledResult<T>;
9
-
10
- /**
11
- * For use with Promise.allSettled to reduce to only successful result values
12
- * @example <caption>Casting the initialValue provided to reduce</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(fulfilledValues, [] as string[])
17
- * // results === [ 'resolved' ]
18
- * @example <caption>Providing type parameter to reduce and initialValue type can be inferred</caption>
19
- * const resolved = Promise.resolve('resolved')
20
- * const rejected = Promise.reject('rejected')
21
- * const settled = await Promise.allSettled([resolved, rejected])
22
- * const results = settled.reduce<string[]>(fulfilledValues, [])
23
- * // results === [ 'resolved' ]
24
- * @param previousValue
25
- * @param currentValue
26
- * @returns
27
- */
28
- declare const fulfilledValues: <T>(previousValue: T[], currentValue: PromiseSettledResult<T>) => T[];
29
-
30
- interface PromiseType {
31
- then: () => unknown;
32
- }
33
- type AnyNonPromise = Exclude<TypedValue, PromiseType>;
34
- declare const isPromise: (value: unknown) => value is Promise<unknown>;
35
-
36
- type PromiseExSubFunc<T, TResult = T> = (value: T) => TResult;
37
- type PromiseExFunc<T> = (resolve?: PromiseExSubFunc<T, void>, reject?: PromiseExSubFunc<T, void>) => void;
38
- type PromiseExValueFunc<V> = (value?: V) => boolean;
39
- declare class PromiseEx<T, V = void> extends Promise<T> {
40
- cancelled?: boolean;
41
- private _value?;
42
- constructor(func: PromiseExFunc<T>, value?: V);
43
- then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null | undefined, onvalue?: (value?: V) => boolean): Promise<TResult1 | TResult2>;
44
- value(onvalue?: (value?: V) => boolean): this;
45
- }
46
-
47
- /**
48
- * For use with Promise.allSettled to filter only rejected results
49
- * @param val
50
- * @returns
51
- */
52
- declare const rejected: <T>(val: PromiseSettledResult<T>) => val is PromiseRejectedResult;
53
-
54
- type Promisable<T, V = never> = PromiseEx<T, V> | Promise<T> | T;
55
- type PromisableArray<T, V = never> = Promisable<T[], V>;
56
- type OptionalPromisable<T, V = never> = Promisable<T | undefined, V>;
57
- type OptionalPromisableArray<T, V = never> = PromisableArray<T | undefined, V>;
58
- type NullablePromisable<T, V = never> = Promisable<T | null, V>;
59
- type NullablePromisableArray<T, V = never> = PromisableArray<T | null, V>;
60
- /** @description Used to document promises that are being used as Mutexes */
61
- type AsyncMutex<T> = Promise<T>;
62
-
63
- declare function toPromise<T>(value: Promisable<T>): Promise<T>;
64
-
65
- export { PromiseEx, fulfilled, fulfilledValues, isPromise, rejected, toPromise };
66
- export type { AnyNonPromise, AsyncMutex, NullablePromisable, NullablePromisableArray, OptionalPromisable, OptionalPromisableArray, Promisable, PromisableArray, PromiseExFunc, PromiseExSubFunc, PromiseExValueFunc, PromiseType };
1
+ export { fulfilled } from './fulfilled.ts';
2
+ export { fulfilledValues } from './fulfilledValues.ts';
3
+ export * from './isPromise.ts';
4
+ export * from './PromiseEx.ts';
5
+ export { rejected } from './rejected.ts';
6
+ export * from './toPromise.ts';
7
+ export * from './types.ts';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,2 @@
1
+ import '@xylabs/vitest-extended';
2
+ //# sourceMappingURL=fulfilled.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fulfilled.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/fulfilled.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
@@ -0,0 +1,2 @@
1
+ import '@xylabs/vitest-extended';
2
+ //# sourceMappingURL=fulfilledValues.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fulfilledValues.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/fulfilledValues.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
@@ -0,0 +1,2 @@
1
+ import '@xylabs/vitest-extended';
2
+ //# sourceMappingURL=rejected.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rejected.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/rejected.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xylabs/promise",
3
- "version": "4.13.15",
3
+ "version": "4.13.16",
4
4
  "description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
5
5
  "keywords": [
6
6
  "promise",
@@ -36,13 +36,13 @@
36
36
  "module": "./dist/neutral/index.mjs",
37
37
  "types": "./dist/neutral/index.d.ts",
38
38
  "dependencies": {
39
- "@xylabs/typeof": "^4.13.15"
39
+ "@xylabs/typeof": "^4.13.16"
40
40
  },
41
41
  "devDependencies": {
42
- "@xylabs/ts-scripts-yarn3": "^7.0.0-rc.20",
43
- "@xylabs/tsconfig": "^7.0.0-rc.20",
44
- "@xylabs/typeof": "^4.13.15",
45
- "@xylabs/vitest-extended": "^4.13.15",
42
+ "@xylabs/ts-scripts-yarn3": "^7.0.0-rc.27",
43
+ "@xylabs/tsconfig": "^7.0.0-rc.27",
44
+ "@xylabs/typeof": "^4.13.16",
45
+ "@xylabs/vitest-extended": "^4.13.16",
46
46
  "typescript": "^5.8.3",
47
47
  "vitest": "^3.2.4"
48
48
  },
@@ -1,8 +0,0 @@
1
- export { fulfilled } from './fulfilled.ts';
2
- export { fulfilledValues } from './fulfilledValues.ts';
3
- export * from './isPromise.ts';
4
- export * from './PromiseEx.ts';
5
- export { rejected } from './rejected.ts';
6
- export * from './toPromise.ts';
7
- export * from './types.ts';
8
- //# sourceMappingURL=index.d.ts.map
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes