Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Commit

Permalink
docs(readme): add an example and licence section
Browse files Browse the repository at this point in the history
  • Loading branch information
leonskidev committed Nov 9, 2021
1 parent 0fd6c8e commit ab7edbd
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions README.md
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

0 comments on commit ab7edbd

Please sign in to comment.