diff --git a/README.md b/README.md index e1105b5..46d96af 100644 --- a/README.md +++ b/README.md @@ -139,6 +139,18 @@ const increment=(v:number)=>v+1; const res=safeDivide(1/2).andThen() ``` +### Importing Third-Party Code +```ts + import {makeSafeFunc} from "@disgruntleddevs/make-safe-func"; + import {someLibraryFunction} from "@third-party/library"; + +const safeLibraryFunction=makeSafeFunc(someLibraryFunction); + +const result=safeLibraryFunction(params,for,func).unwrapOr("default value") + +console.log(result); +``` + The MakeSafeFunc docs are sparse because most of it's power is derived from [neverthrow](https://github.com/supermacro/neverthrow) so the docs for neverthrow will be your friend. diff --git a/deno.json b/deno.json index 8134f55..b95897c 100644 --- a/deno.json +++ b/deno.json @@ -2,7 +2,7 @@ "name": "@disgruntleddevs/make-safe-func", "description": "Finally be sure your functions don't throw", "license": "MIT", - "version": "0.1.0", + "version": "0.1.1", "exports": "./src/index.ts", "tasks": { "dev": "deno run --watch main.ts"