This repository has been archived by the owner on Feb 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(readme): add an example and licence section
- Loading branch information
1 parent
0fd6c8e
commit ab7edbd
Showing
1 changed file
with
27 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,32 @@ | ||
# Ahh | ||
_Safe code in [deno] made simple._ | ||
|
||
**Ahh** focuses on making code in [Deno] safer while still being easy to use. | ||
## Usage | ||
|
||
You can find all the available types and functions in the [documentation]. | ||
Depending on which feature(s) you are looking for, import the files that you | ||
need. For example, if we were looking to use `Result`s depending on whether a | ||
string started with `"a"`, we could do. | ||
|
||
```ts | ||
// you'll want to add a version to this | ||
import { Result, Ok, Err } from "https://deno.land/x/ahh@vX.Y.Z/result.ts"; | ||
|
||
function mustStartWithA(str: string): Result<string, string> { | ||
if (str.startsWith("a")) { | ||
return Ok(str); | ||
} else { | ||
return Err("string must start with `\"a\"`".); | ||
} | ||
} | ||
|
||
const ok = mustStartWithA("abc"); | ||
const err = mustStartWithA("cba"); | ||
``` | ||
|
||
## Licence | ||
|
||
This is licenced under **MIT**; you can find out more in the provided | ||
[`LICENCE`] file. | ||
|
||
[Deno]: https://github.com/denoland/deno | ||
[documentation]: https://doc.deno.land/https/deno.land/x/ahh/mod.ts | ||
[`LICENCE`]: ./LICENCE |