Refactor routing in App component to enhance navigation and improve error handling by integrating dynamic routes and updating the NotFound route.
This commit is contained in:
48
node_modules/array-iterate/index.d.ts
generated
vendored
Normal file
48
node_modules/array-iterate/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* Function called for each element in an array.
|
||||
*
|
||||
* @typeParam Value
|
||||
* Element in array.
|
||||
* @typeParam ThisArg
|
||||
* Context object passed as `this`.
|
||||
* @param value
|
||||
* Element in array.
|
||||
* @param index
|
||||
* Index of `value` in `values`.
|
||||
* @param values
|
||||
* List.
|
||||
* @param [thisArg]
|
||||
* Context object
|
||||
* @returns {number|void}
|
||||
* The `index` to move to next.
|
||||
*/
|
||||
export type CallbackFn<Value, ThisArg = undefined> = (
|
||||
this: ThisArg,
|
||||
value: Value,
|
||||
index: number,
|
||||
array: Value[]
|
||||
) => number | void
|
||||
|
||||
/**
|
||||
* Perform the specified action for each element in an array.
|
||||
* When `callbackFn` returns a `number`, moves to the element at that index
|
||||
* next.
|
||||
*
|
||||
* @typeParam Value
|
||||
* Type in `values`.
|
||||
* @typeParam ThisArg
|
||||
* Context passed as `this` to callback.
|
||||
* @param values
|
||||
* Values to iterate over.
|
||||
* @param callbackFn
|
||||
* Function called for each element.
|
||||
* Can return the `index` to move to next.
|
||||
* @param [thisArg]
|
||||
* Optional object assigned as `this` in `callbackFn`.
|
||||
* @returns {void}
|
||||
*/
|
||||
export function arrayIterate<Value, ThisArg = undefined>(
|
||||
values: Value[],
|
||||
callbackFn: CallbackFn<Value, ThisArg>,
|
||||
thisArg?: ThisArg
|
||||
): void
|
1
node_modules/array-iterate/index.js
generated
vendored
Normal file
1
node_modules/array-iterate/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {arrayIterate} from './lib/index.js'
|
24
node_modules/array-iterate/lib/index.d.ts
generated
vendored
Normal file
24
node_modules/array-iterate/lib/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Perform the specified action for each element in an array.
|
||||
* When `callbackFn` returns a `number`, moves to the element at that index
|
||||
* next.
|
||||
*
|
||||
* @param {unknown[]} values
|
||||
* Values to iterate over.
|
||||
* @param {(this: unknown, value: unknown, index: number, array: unknown[]) => number | void} callbackFn
|
||||
* Function called for each element.
|
||||
* Can return the `index` to move to next.
|
||||
* @param {unknown} [thisArg]
|
||||
* Optional object assigned as `this` in `callbackFn`.
|
||||
* @returns {void}
|
||||
*/
|
||||
export function arrayIterate(
|
||||
values: unknown[],
|
||||
callbackFn: (
|
||||
this: unknown,
|
||||
value: unknown,
|
||||
index: number,
|
||||
array: unknown[]
|
||||
) => number | void,
|
||||
thisArg?: unknown
|
||||
): void
|
51
node_modules/array-iterate/lib/index.js
generated
vendored
Normal file
51
node_modules/array-iterate/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
const own = {}.hasOwnProperty
|
||||
|
||||
/**
|
||||
* Perform the specified action for each element in an array.
|
||||
* When `callbackFn` returns a `number`, moves to the element at that index
|
||||
* next.
|
||||
*
|
||||
* @param {unknown[]} values
|
||||
* Values to iterate over.
|
||||
* @param {(this: unknown, value: unknown, index: number, array: unknown[]) => number | void} callbackFn
|
||||
* Function called for each element.
|
||||
* Can return the `index` to move to next.
|
||||
* @param {unknown} [thisArg]
|
||||
* Optional object assigned as `this` in `callbackFn`.
|
||||
* @returns {void}
|
||||
*/
|
||||
export function arrayIterate(values, callbackFn, thisArg) {
|
||||
let index = -1
|
||||
|
||||
if (!values) {
|
||||
throw new Error('Iterate requires that |this| not be ' + values)
|
||||
}
|
||||
|
||||
if (!own.call(values, 'length')) {
|
||||
throw new Error('Iterate requires that |this| has a `length`')
|
||||
}
|
||||
|
||||
if (typeof callbackFn !== 'function') {
|
||||
throw new TypeError('`callback` must be a function')
|
||||
}
|
||||
|
||||
// The length might change, so we do not cache it.
|
||||
while (++index < values.length) {
|
||||
// Skip missing values.
|
||||
if (!(index in values)) {
|
||||
continue
|
||||
}
|
||||
|
||||
const result = callbackFn.call(thisArg, values[index], index, values)
|
||||
|
||||
// If `callback` returns a `number`, move `index` over to `number`.
|
||||
if (typeof result === 'number') {
|
||||
// Make sure that negative numbers do not break the loop.
|
||||
if (result < 0) {
|
||||
index = 0
|
||||
}
|
||||
|
||||
index = result - 1
|
||||
}
|
||||
}
|
||||
}
|
21
node_modules/array-iterate/license
generated
vendored
Normal file
21
node_modules/array-iterate/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2015 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/array-iterate/package.json
generated
vendored
Normal file
73
node_modules/array-iterate/package.json
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
{
|
||||
"name": "array-iterate",
|
||||
"version": "2.0.1",
|
||||
"description": "`Array#forEach()` but it’s possible to define where to move to next",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"array",
|
||||
"list",
|
||||
"iterate",
|
||||
"walk"
|
||||
],
|
||||
"repository": "wooorm/array-iterate",
|
||||
"bugs": "https://github.com/wooorm/array-iterate/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)"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"type": "module",
|
||||
"main": "index.js",
|
||||
"types": "index.d.ts",
|
||||
"files": [
|
||||
"lib/",
|
||||
"index.d.ts",
|
||||
"index.js"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@types/tape": "^4.0.0",
|
||||
"c8": "^7.0.0",
|
||||
"prettier": "^2.0.0",
|
||||
"remark-cli": "^10.0.0",
|
||||
"remark-preset-wooorm": "^9.0.0",
|
||||
"rimraf": "^3.0.0",
|
||||
"tape": "^5.0.0",
|
||||
"type-coverage": "^2.0.0",
|
||||
"typescript": "^4.0.0",
|
||||
"xo": "^0.45.0"
|
||||
},
|
||||
"scripts": {
|
||||
"prepublishOnly": "npm run build && npm run format",
|
||||
"build": "rimraf \"lib/**/*.d.ts\" \"test.d.ts\" && tsc && type-coverage",
|
||||
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
|
||||
"test-api": "node --conditions development test.js",
|
||||
"test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov npm run test-api",
|
||||
"test": "npm run build && npm run format && npm run test-coverage"
|
||||
},
|
||||
"prettier": {
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"singleQuote": true,
|
||||
"bracketSpacing": false,
|
||||
"semi": false,
|
||||
"trailingComma": "none"
|
||||
},
|
||||
"xo": {
|
||||
"prettier": true
|
||||
},
|
||||
"remarkConfig": {
|
||||
"plugins": [
|
||||
"preset-wooorm"
|
||||
]
|
||||
},
|
||||
"typeCoverage": {
|
||||
"atLeast": 100,
|
||||
"detail": true,
|
||||
"strict": true,
|
||||
"ignoreCatch": true
|
||||
}
|
||||
}
|
192
node_modules/array-iterate/readme.md
generated
vendored
Normal file
192
node_modules/array-iterate/readme.md
generated
vendored
Normal file
@@ -0,0 +1,192 @@
|
||||
# array-iterate
|
||||
|
||||
[![Build][build-badge]][build]
|
||||
[![Coverage][coverage-badge]][coverage]
|
||||
[![Downloads][downloads-badge]][downloads]
|
||||
[![Size][size-badge]][size]
|
||||
|
||||
[`Array#forEach()`][foreach] but it’s possible to define where to move to next.
|
||||
|
||||
## Contents
|
||||
|
||||
* [What is this?](#what-is-this)
|
||||
* [When should I use this?](#when-should-i-use-this)
|
||||
* [Install](#install)
|
||||
* [Use](#use)
|
||||
* [API](#api)
|
||||
* [`arrayIterate(values, callbackFn[, thisArg])`](#arrayiteratevalues-callbackfn-thisarg)
|
||||
* [Types](#types)
|
||||
* [Compatibility](#compatibility)
|
||||
* [Security](#security)
|
||||
* [Contribute](#contribute)
|
||||
* [License](#license)
|
||||
|
||||
## What is this?
|
||||
|
||||
A tiny package that works just like `forEach`, with one small difference.
|
||||
|
||||
## When should I use this?
|
||||
|
||||
You can use this if for some weird reason—like I did—you have to sometimes
|
||||
skip a few places ahead or backwards when moving through an array.
|
||||
|
||||
## Install
|
||||
|
||||
This package is [ESM only][esm].
|
||||
In Node.js (version 12.20+, 14.14+, or 16.0+), install with [npm][]:
|
||||
|
||||
```sh
|
||||
npm install array-iterate
|
||||
```
|
||||
|
||||
In Deno with [Skypack][]:
|
||||
|
||||
```js
|
||||
import {arrayIterate} from 'https://cdn.skypack.dev/array-iterate@2?dts'
|
||||
```
|
||||
|
||||
In browsers with [Skypack][]:
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import {arrayIterate} from 'https://cdn.skypack.dev/array-iterate@2?min'
|
||||
</script>
|
||||
```
|
||||
|
||||
## Use
|
||||
|
||||
```js
|
||||
import {arrayIterate} from 'array-iterate'
|
||||
|
||||
let first = true
|
||||
|
||||
arrayIterate(
|
||||
[1, 2, 3, 4],
|
||||
(value, index, values) => {
|
||||
console.log(this, value, index, values)
|
||||
|
||||
// Repeat once.
|
||||
if (first && index + 1 === values.length) {
|
||||
first = false
|
||||
return 0
|
||||
}
|
||||
},
|
||||
{hello: 'world'}
|
||||
)
|
||||
```
|
||||
|
||||
Yields:
|
||||
|
||||
```js
|
||||
{hello: 'world'}, 1, 0, [1, 2, 3, 4]
|
||||
{hello: 'world'}, 2, 1, [1, 2, 3, 4]
|
||||
{hello: 'world'}, 3, 2, [1, 2, 3, 4]
|
||||
{hello: 'world'}, 4, 3, [1, 2, 3, 4]
|
||||
{hello: 'world'}, 1, 0, [1, 2, 3, 4]
|
||||
{hello: 'world'}, 2, 1, [1, 2, 3, 4]
|
||||
{hello: 'world'}, 3, 2, [1, 2, 3, 4]
|
||||
{hello: 'world'}, 4, 3, [1, 2, 3, 4]
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
This package exports the following identifiers: `arrayIterate`.
|
||||
There is no default export.
|
||||
|
||||
### `arrayIterate(values, callbackFn[, thisArg])`
|
||||
|
||||
Perform the specified action for each element in an array (just like
|
||||
[`Array#forEach()`][foreach]).
|
||||
When `callbackFn` returns a `number`, moves to the element at that index
|
||||
next.
|
||||
|
||||
###### Parameters
|
||||
|
||||
* `values` (`Array<*>`)
|
||||
— values to iterate over
|
||||
* `callbackFn` (`Function`)
|
||||
— function called for each element, can return the `index` to move to next
|
||||
* `thisArg` (`*`, optional)
|
||||
— optional object assigned as `this` in `callbackFn`
|
||||
|
||||
###### Returns
|
||||
|
||||
`undefined`.
|
||||
|
||||
#### `function callbackFn(value, index, values)`
|
||||
|
||||
Callback given to `iterate`.
|
||||
|
||||
###### Parameters
|
||||
|
||||
* `this` (`*`)
|
||||
— context object when given as `thisArg` to `arrayIterate` or `undefined`
|
||||
* `value` (`*`)
|
||||
— element in array
|
||||
* `index` (`number`)
|
||||
— index of `value` in `values`
|
||||
* `values` (`Array.<*>`)
|
||||
— list
|
||||
|
||||
###### Returns
|
||||
|
||||
`number` or `undefined` — the `index` to move to next.
|
||||
|
||||
## Types
|
||||
|
||||
This package is fully typed with [TypeScript][].
|
||||
There is also a `CallbackFn` type export that represents the callback function.
|
||||
|
||||
## Compatibility
|
||||
|
||||
This package is at least compatible with all maintained versions of Node.js.
|
||||
As of now, that is Node.js 12.20+, 14.14+, and 16.0+.
|
||||
It also works in Deno and modern browsers.
|
||||
|
||||
## Security
|
||||
|
||||
This package is safe, assuming that you don’t create an infinite loop
|
||||
by keeping on repeating.
|
||||
|
||||
## Contribute
|
||||
|
||||
Yes please!
|
||||
See [How to Contribute to Open Source][contribute].
|
||||
|
||||
## License
|
||||
|
||||
[MIT][license] © [Titus Wormer][author]
|
||||
|
||||
<!-- Definitions -->
|
||||
|
||||
[build-badge]: https://github.com/wooorm/array-iterate/workflows/main/badge.svg
|
||||
|
||||
[build]: https://github.com/wooorm/array-iterate/actions
|
||||
|
||||
[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/array-iterate.svg
|
||||
|
||||
[coverage]: https://codecov.io/github/wooorm/array-iterate
|
||||
|
||||
[downloads-badge]: https://img.shields.io/npm/dm/array-iterate.svg
|
||||
|
||||
[downloads]: https://www.npmjs.com/package/array-iterate
|
||||
|
||||
[size-badge]: https://img.shields.io/bundlephobia/minzip/array-iterate.svg
|
||||
|
||||
[size]: https://bundlephobia.com/result?p=array-iterate
|
||||
|
||||
[npm]: https://docs.npmjs.com/cli/install
|
||||
|
||||
[skypack]: https://www.skypack.dev
|
||||
|
||||
[license]: license
|
||||
|
||||
[author]: https://wooorm.com
|
||||
|
||||
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
|
||||
|
||||
[typescript]: https://www.typescriptlang.org
|
||||
|
||||
[contribute]: https://opensource.guide/how-to-contribute/
|
||||
|
||||
[foreach]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach
|
Reference in New Issue
Block a user