Comparing version 1.0.4 to 1.0.5
{ | ||
"name": "zwitch", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Handle values based on a property", | ||
@@ -13,2 +13,6 @@ "license": "MIT", | ||
"bugs": "https://github.com/wooorm/zwitch/issues", | ||
"funding": { | ||
"type": "github", | ||
"url": "https://github.com/sponsors/wooorm" | ||
}, | ||
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", | ||
@@ -24,9 +28,9 @@ "contributors": [ | ||
"browserify": "^16.0.0", | ||
"nyc": "^14.0.0", | ||
"prettier": "^1.12.1", | ||
"remark-cli": "^6.0.0", | ||
"remark-preset-wooorm": "^4.0.0", | ||
"nyc": "^15.0.0", | ||
"prettier": "^1.0.0", | ||
"remark-cli": "^7.0.0", | ||
"remark-preset-wooorm": "^6.0.0", | ||
"tape": "^4.0.0", | ||
"tinyify": "^2.5.0", | ||
"xo": "^0.24.0" | ||
"tinyify": "^2.0.0", | ||
"xo": "^0.25.0" | ||
}, | ||
@@ -53,2 +57,5 @@ "scripts": { | ||
"esnext": false, | ||
"rules": { | ||
"unicorn/prefer-reflect-apply": "off" | ||
}, | ||
"ignores": [ | ||
@@ -55,0 +62,0 @@ "zwitch.js" |
@@ -10,13 +10,13 @@ # zwitch | ||
## Installation | ||
## Install | ||
[npm][]: | ||
```bash | ||
```sh | ||
npm install zwitch | ||
``` | ||
## Usage | ||
## Use | ||
```javascript | ||
```js | ||
var zwitch = require('zwitch') | ||
@@ -81,9 +81,10 @@ | ||
Handle one value. Based on the bound `key`, a respective handler will | ||
be invoked. If `value` is not an object, or doesn’t have a `key` | ||
property, the special “invalid” handler will be invoked. If `value` | ||
has an unknown `key`, the special “unknown” handler will be invoked. | ||
Handle one value. Based on the bound `key`, a respective handler will be | ||
invoked. | ||
If `value` is not an object, or doesn’t have a `key` property, the special | ||
“invalid” handler will be invoked. | ||
If `value` has an unknown `key`, the special “unknown” handler will be invoked. | ||
All arguments, and the context object, are passed through to the | ||
[handler][], and it’s result is returned. | ||
All arguments, and the context object, are passed through to the [handler][], | ||
and it’s result is returned. | ||
@@ -96,4 +97,4 @@ #### `one.handlers` | ||
Special [`handler`][handler] invoked if a value doesn’t have a `key` | ||
property. If not set, `undefined` is returned for invalid values. | ||
Special [`handler`][handler] invoked if a value doesn’t have a `key` property. | ||
If not set, `undefined` is returned for invalid values. | ||
@@ -103,3 +104,4 @@ #### `one.unknown` | ||
Special [`handler`][handler] invoked if a value does not have a matching | ||
handler. If not set, `undefined` is returned for unknown values. | ||
handler. | ||
If not set, `undefined` is returned for unknown values. | ||
@@ -106,0 +108,0 @@ ### `function handler(value[, rest...])` |
6450
144