Skip to content

Commit

Permalink
description and mrore
Browse files Browse the repository at this point in the history
  • Loading branch information
Inalegwu committed Sep 16, 2024
1 parent dac17c6 commit f64b0d4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name":"@disgruntleddevs/make-safe-func",
"description":"Finally be sure your function don't throw",
"license":"MIT",
"version":"0.0.2",
"version":"0.0.3",
"exports":"./src/index.ts",
"tasks": {
"dev": "deno run --watch main.ts"
Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import {type Result,ok,err} from "npm:[email protected]";

type AnyFunction=(...args:any[])=>any;


/**
**/
export function makeSafeFunction<F extends AnyFunction>(fn:F):(...args:Parameters<F>)=>Result<ReturnType<F> extends Promise<infer R>?R:ReturnType<F>,Error>{
// @ts-ignore: still yet to figure this out but it works
return (...args:Parameters<F>)=>{
Expand Down

0 comments on commit f64b0d4

Please sign in to comment.