Comparing version 0.0.10 to 0.0.11
{ | ||
"name": "tote-lib", | ||
"license": "MIT", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"main": "dist/index.js", | ||
@@ -6,0 +6,0 @@ "scripts": { |
@@ -7,3 +7,3 @@ # `tote-lib` | ||
`tote-lib` exports three items. | ||
`tote-lib` exports four items. | ||
@@ -16,3 +16,3 @@ ### `Func` | ||
``` | ||
```javascript | ||
// import dependencies | ||
@@ -58,3 +58,2 @@ import { Func, joi } from 'tote-lib' | ||
| `send<object>` | `Function` | Set the JSON body | | ||
| `_validate` | `Function` | Internal method for schema validation | | ||
@@ -67,3 +66,3 @@ ##### Usage | ||
``` | ||
```javascript | ||
// get parameters | ||
@@ -80,3 +79,3 @@ const { | ||
``` | ||
```javascript | ||
this.status(404) | ||
@@ -89,3 +88,3 @@ ``` | ||
``` | ||
```javascript | ||
this.send({ | ||
@@ -96,6 +95,19 @@ foo: 'bar' | ||
### `joi` | ||
### `Exception` | ||
Look at [Joi docs](https://github.com/hapijs/joi). | ||
`Exception` extends `Error` and lets you throw sensible errors from your functions. | ||
#### Parameters | ||
| Name | Type | Description | Default | | ||
| --------- | -------- | -------------------- | --------------- | | ||
| `message` | `string` | Error message or key | `unknown_error` | | ||
| `status` | `number` | HTTP status code | `500` | | ||
#### Usage | ||
```javascript | ||
throw new Exception('Email required', 400) | ||
``` | ||
### `invoke` | ||
@@ -114,3 +126,3 @@ | ||
``` | ||
```javascript | ||
invoke('hello', { | ||
@@ -125,1 +137,5 @@ headers: { | ||
``` | ||
### `joi` | ||
Look at [Joi docs](https://github.com/hapijs/joi). |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18907
16
133