planning
All checks were successful
Publish To Prod / deploy_and_publish (push) Successful in 35s

This commit is contained in:
2024-10-14 09:15:30 +02:00
parent bcba00a730
commit 6e64e138e2
21059 changed files with 2317811 additions and 1 deletions

28
node_modules/zwitch/index.js generated vendored Normal file
View File

@@ -0,0 +1,28 @@
'use strict'
module.exports = factory
var noop = Function.prototype
var own = {}.hasOwnProperty
// Handle values based on a property.
function factory(key, options) {
var settings = options || {}
function one(value) {
var fn = one.invalid
var handlers = one.handlers
if (value && own.call(value, key)) {
fn = own.call(handlers, value[key]) ? handlers[value[key]] : one.unknown
}
return (fn || noop).apply(this, arguments)
}
one.handlers = settings.handlers || {}
one.invalid = settings.invalid
one.unknown = settings.unknown
return one
}

22
node_modules/zwitch/license generated vendored Normal file
View File

@@ -0,0 +1,22 @@
(The MIT License)
Copyright (c) 2016 Titus Wormer <tituswormer@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

73
node_modules/zwitch/package.json generated vendored Normal file
View File

@@ -0,0 +1,73 @@
{
"name": "zwitch",
"version": "1.0.5",
"description": "Handle values based on a property",
"license": "MIT",
"keywords": [
"handle",
"switch",
"property"
],
"repository": "wooorm/zwitch",
"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)",
"contributors": [
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"files": [
"index.js"
],
"dependencies": {},
"devDependencies": {
"browserify": "^16.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.0.0",
"xo": "^0.25.0"
},
"scripts": {
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"build-bundle": "browserify . -s zwitch -o zwitch.js",
"build-mangle": "browserify . -s zwitch -p tinyify -o zwitch.min.js",
"build": "npm run build-bundle && npm run build-mangle",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js",
"test": "npm run format && npm run build && npm run test-coverage"
},
"prettier": {
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"bracketSpacing": false,
"semi": false,
"trailingComma": "none"
},
"xo": {
"prettier": true,
"esnext": false,
"rules": {
"unicorn/prefer-reflect-apply": "off"
},
"ignores": [
"zwitch.js"
]
},
"nyc": {
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100
},
"remarkConfig": {
"plugins": [
"preset-wooorm"
]
}
}

143
node_modules/zwitch/readme.md generated vendored Normal file
View File

@@ -0,0 +1,143 @@
# zwitch
[![Build][build-badge]][build]
[![Coverage][coverage-badge]][coverage]
[![Downloads][downloads-badge]][downloads]
[![Size][size-badge]][size]
Handle values based on a property.
## Install
[npm][]:
```sh
npm install zwitch
```
## Use
```js
var zwitch = require('zwitch')
var handle = zwitch('type')
handle.invalid = invalid
handle.unknown = unknown
handle.handlers.alpha = handle
handle({type: 'alpha'})
```
Or, with a `switch` statement:
```javascript
function handle(value) {
var fn
if (!value || typeof value !== 'object' || !('type' in value)) {
fn = invalid
} else {
switch (value.type) {
case 'alpha':
fn = handle
break
default:
fn = unknown
break
}
}
return fn.apply(this, arguments)
}
handle({type: 'alpha'})
```
## API
### `zwitch(key[, options])`
Create a functional switch, based on a `key` (`string`).
###### `options`
Options can be omitted and added later to `one`.
* `handlers` (`Object.<Function>`, optional)
— Object mapping values to handle, stored on `one.handlers`
* `invalid` (`Function`, optional)
— Handle values without `key`, stored on `one.invalid`
* `unknown` (`Function`, optional)
— Handle values with an unhandled `key`, stored on `one.unknown`
###### Returns
`Function` — See [`one`][one].
#### `one(value[, rest...])`
Handle one value. Based on the bound `key`, a respective handler will be
invoked.
If `value` is not an object, or doesnt 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 its result is returned.
#### `one.handlers`
Map of [handler][]s (`Object.<string, Function>`).
#### `one.invalid`
Special [`handler`][handler] invoked if a value doesnt have a `key` property.
If not set, `undefined` is returned for invalid values.
#### `one.unknown`
Special [`handler`][handler] invoked if a value does not have a matching
handler.
If not set, `undefined` is returned for unknown values.
### `function handler(value[, rest...])`
Handle one value.
## Related
* [`mapz`](https://github.com/wooorm/mapz)
— Functional map
## License
[MIT][license] © [Titus Wormer][author]
<!-- Definitions -->
[build-badge]: https://img.shields.io/travis/wooorm/zwitch.svg
[build]: https://travis-ci.org/wooorm/zwitch
[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/zwitch.svg
[coverage]: https://codecov.io/github/wooorm/zwitch
[downloads-badge]: https://img.shields.io/npm/dm/zwitch.svg
[downloads]: https://www.npmjs.com/package/zwitch
[size-badge]: https://img.shields.io/bundlephobia/minzip/zwitch.svg
[size]: https://bundlephobia.com/result?p=zwitch
[npm]: https://docs.npmjs.com/cli/install
[license]: license
[author]: https://wooorm.com
[one]: #onevalue-rest
[handler]: #function-handlervalue-rest