Skip to content

Commit

Permalink
feat: identity
Browse files Browse the repository at this point in the history
  • Loading branch information
Hfutsora committed May 23, 2022
1 parent 545babf commit 77f2e62
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import { TupleLast } from './TupleT'
*/
export type Lazy<A> = () => A

/**
* Identity
*/
export const identity = <A>(a: A): A => a


type PipeFn<A, B> = (a: A) => B

Expand Down
6 changes: 5 additions & 1 deletion test/function.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { pipe } from '../src/function'
import { identity, pipe } from '../src/function'

test('identity', () => {
expect(identity(1)).toBe(1)
})

test('pipe1', () => {
const f = pipe(
Expand Down

0 comments on commit 77f2e62

Please sign in to comment.