Skip to content

Commit

Permalink
Merge branch 'main' into add-test-cases
Browse files Browse the repository at this point in the history
  • Loading branch information
cuppachino authored Sep 6, 2023
2 parents d6fc3a4 + 0d29bcd commit 026fe13
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 41 deletions.
5 changes: 0 additions & 5 deletions .changeset/neat-brooms-switch.md

This file was deleted.

18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# @cuppachino/proxy-fn

## 1.0.2

### Patch Changes

- 67d3357: Update README.md

## 1.0.1

### Patch Changes

- 6f0b02d: Update README.md

## 1.0.0

### Major Changes

- 6f7692d: add tests and pass all cases

## 0.0.2

### Patch Changes
Expand Down
40 changes: 12 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,10 @@ const add = (a: number, b: number) => a + b
* (a: number, b: number, ...args: number[]) => number
*
* ProxyFn<
* // From
* // NewArgs
* [a: number, b: number, ...args: number[]],
* // ExpectedArgs
* [a: number, b: number],
* // ActualArgs
* [number, number]
* // To
* number,
* // Original function
* (a: number, b: number) => number
* // NewReturnType
* number
* >
* ```
*/
Expand All @@ -66,16 +60,10 @@ addMany(1, 2, 3, 4) // number
* (a: number, b: number) => Promise<readonly [number, string]>
*
* ProxyFn<
* // From
* [a: number, b: number],
* // ExpectedArgs
* // NewArgs
* [a: number, b: number],
* // ActualArgs
* MaybePromise<[a: number, b: number, ...any[]]>,
* // To
* Promise<readonly [number, string]>,
* // Original function
* (a: number, b: number) => number
* // NewReturnType
* Promise<readonly [number, string]>
* >
* ```
*/
Expand All @@ -94,19 +82,15 @@ infersPromises(4, 8) // Promise<[sum: number, msg: string]>
```ts
/**
* ```ts
* () => Promise<[sum: number, msg: string]>
* (() => Promise<[sum: number, msg: string]>) & { name: string }
*
* ProxyFn<
* // From
* // NewArgs
* [],
* // ExpectedArgs
* [a: number, b: number],
* // ActualArgs
* Promise<[number, number]>,
* // To
* [sum: number, msg: string],
* // Original function
* ((a: number, b: number) => number) & { name: string; }
* // NewReturnType
* Promise<[sum: number, msg: string]>,
* // Properties
* { name: string }
* >
* ```
*/
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cuppachino/proxy-fn",
"version": "0.0.2",
"version": "1.0.2",
"description": "",
"type": "module",
"main": "dist/cjs/index.js",
Expand Down
2 changes: 1 addition & 1 deletion src/modules/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './proxy-fn.js'
export * from './proxy-fn.js'
4 changes: 2 additions & 2 deletions src/types/is-empty.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import type { IsNever } from "./is-never.js";
import type { IsNever } from './is-never.js'

export type IsEmpty<T> = IsNever<keyof NonNullable<T>>
export type IsEmpty<T> = IsNever<keyof NonNullable<T>>
2 changes: 1 addition & 1 deletion src/types/is-never.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export type IsNever<T> = [T] extends [never] ? true : false;
export type IsNever<T> = [T] extends [never] ? true : false
4 changes: 1 addition & 3 deletions src/utils/is-promise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
* Returns true if the given thing is a promise.
* @param anything The thing to check. Might be undefined.
*/
export const isPromise = <T>(
anything: T | Promise<T> | undefined
): anything is Promise<T> => {
export const isPromise = <T>(anything: T | Promise<T> | undefined): anything is Promise<T> => {
return !!anything && anything instanceof Promise
}

0 comments on commit 026fe13

Please sign in to comment.