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:
10
node_modules/trim-lines/index.d.ts
generated
vendored
Normal file
10
node_modules/trim-lines/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Remove initial and final spaces and tabs at the line breaks in `value`.
|
||||
* Does not trim initial and final spaces and tabs of the value itself.
|
||||
*
|
||||
* @param {string} value
|
||||
* Value to trim.
|
||||
* @returns {string}
|
||||
* Trimmed value.
|
||||
*/
|
||||
export function trimLines(value: string): string
|
69
node_modules/trim-lines/index.js
generated
vendored
Normal file
69
node_modules/trim-lines/index.js
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
const tab = 9 /* `\t` */
|
||||
const space = 32 /* ` ` */
|
||||
|
||||
/**
|
||||
* Remove initial and final spaces and tabs at the line breaks in `value`.
|
||||
* Does not trim initial and final spaces and tabs of the value itself.
|
||||
*
|
||||
* @param {string} value
|
||||
* Value to trim.
|
||||
* @returns {string}
|
||||
* Trimmed value.
|
||||
*/
|
||||
export function trimLines(value) {
|
||||
const source = String(value)
|
||||
const search = /\r?\n|\r/g
|
||||
let match = search.exec(source)
|
||||
let last = 0
|
||||
/** @type {Array<string>} */
|
||||
const lines = []
|
||||
|
||||
while (match) {
|
||||
lines.push(
|
||||
trimLine(source.slice(last, match.index), last > 0, true),
|
||||
match[0]
|
||||
)
|
||||
|
||||
last = match.index + match[0].length
|
||||
match = search.exec(source)
|
||||
}
|
||||
|
||||
lines.push(trimLine(source.slice(last), last > 0, false))
|
||||
|
||||
return lines.join('')
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* Line to trim.
|
||||
* @param {boolean} start
|
||||
* Whether to trim the start of the line.
|
||||
* @param {boolean} end
|
||||
* Whether to trim the end of the line.
|
||||
* @returns {string}
|
||||
* Trimmed line.
|
||||
*/
|
||||
function trimLine(value, start, end) {
|
||||
let startIndex = 0
|
||||
let endIndex = value.length
|
||||
|
||||
if (start) {
|
||||
let code = value.codePointAt(startIndex)
|
||||
|
||||
while (code === tab || code === space) {
|
||||
startIndex++
|
||||
code = value.codePointAt(startIndex)
|
||||
}
|
||||
}
|
||||
|
||||
if (end) {
|
||||
let code = value.codePointAt(endIndex - 1)
|
||||
|
||||
while (code === tab || code === space) {
|
||||
endIndex--
|
||||
code = value.codePointAt(endIndex - 1)
|
||||
}
|
||||
}
|
||||
|
||||
return endIndex > startIndex ? value.slice(startIndex, endIndex) : ''
|
||||
}
|
22
node_modules/trim-lines/license
generated
vendored
Normal file
22
node_modules/trim-lines/license
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2015 Titus Wormer <mailto: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.
|
67
node_modules/trim-lines/package.json
generated
vendored
Normal file
67
node_modules/trim-lines/package.json
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"name": "trim-lines",
|
||||
"version": "3.0.1",
|
||||
"description": "Remove spaces and tabs around line-breaks",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"space",
|
||||
"tab",
|
||||
"line",
|
||||
"break",
|
||||
"trim"
|
||||
],
|
||||
"repository": "wooorm/trim-lines",
|
||||
"bugs": "https://github.com/wooorm/trim-lines/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": [
|
||||
"index.d.ts",
|
||||
"index.js"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@types/tape": "^4.0.0",
|
||||
"c8": "^7.0.0",
|
||||
"prettier": "^2.0.0",
|
||||
"remark-cli": "^11.0.0",
|
||||
"remark-preset-wooorm": "^9.0.0",
|
||||
"rimraf": "^3.0.0",
|
||||
"tape": "^5.0.0",
|
||||
"typescript": "^4.0.0",
|
||||
"xo": "^0.50.0"
|
||||
},
|
||||
"scripts": {
|
||||
"prepublishOnly": "npm run build && npm run format",
|
||||
"prebuild": "rimraf \"*.d.ts\"",
|
||||
"build": "tsc",
|
||||
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
|
||||
"test-api": "node test.js",
|
||||
"test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node test.js",
|
||||
"test": "npm run build && npm run format && npm run test-coverage"
|
||||
},
|
||||
"remarkConfig": {
|
||||
"plugins": [
|
||||
"preset-wooorm"
|
||||
]
|
||||
},
|
||||
"prettier": {
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"singleQuote": true,
|
||||
"bracketSpacing": false,
|
||||
"semi": false,
|
||||
"trailingComma": "none"
|
||||
},
|
||||
"xo": {
|
||||
"prettier": true
|
||||
}
|
||||
}
|
125
node_modules/trim-lines/readme.md
generated
vendored
Normal file
125
node_modules/trim-lines/readme.md
generated
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
# trim-lines
|
||||
|
||||
[![Build][build-badge]][build]
|
||||
[![Coverage][coverage-badge]][coverage]
|
||||
[![Downloads][downloads-badge]][downloads]
|
||||
[![Size][size-badge]][size]
|
||||
|
||||
Remove spaces and tabs around line breaks.
|
||||
|
||||
## Contents
|
||||
|
||||
* [What is this?](#what-is-this)
|
||||
* [When should I use this?](#when-should-i-use-this)
|
||||
* [Install](#install)
|
||||
* [Use](#use)
|
||||
* [API](#api)
|
||||
* [`trimLines(value)`](#trimlinesvalue)
|
||||
* [Types](#types)
|
||||
* [Compatibility](#compatibility)
|
||||
* [Contribute](#contribute)
|
||||
* [License](#license)
|
||||
|
||||
## What is this?
|
||||
|
||||
This package is a tiny utility that removes spaces and tabs around line endings,
|
||||
keeping the line endings, and not removing whitespace at the start or end of the
|
||||
string.
|
||||
It might look trivial, but it’s actually pretty complex to get performant.
|
||||
|
||||
## When should I use this?
|
||||
|
||||
When you need to trim markdown-like whitespace around line endings and don’t
|
||||
want to run into performance problems.
|
||||
|
||||
## Install
|
||||
|
||||
This package is [ESM only][esm].
|
||||
In Node.js (version 14.14+, 16.0+, or 18.0+), install with [npm][]:
|
||||
|
||||
```sh
|
||||
npm install trim-lines
|
||||
```
|
||||
|
||||
In Deno with [`esm.sh`][esmsh]:
|
||||
|
||||
```js
|
||||
import trimLines from 'https://esm.sh/trim-lines@3'
|
||||
```
|
||||
|
||||
In browsers with [`esm.sh`][esmsh]:
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import trimLines from 'https://esm.sh/trim-lines@3?bundle'
|
||||
</script>
|
||||
```
|
||||
|
||||
## Use
|
||||
|
||||
```js
|
||||
import {trimLines} from 'trim-lines'
|
||||
|
||||
console.log(trimLines(' foo\t\n\n bar \n\tbaz ')) // => ' foo\n\nbar\nbaz '
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
This package exports the identifier `trimLines`.
|
||||
There is no default export.
|
||||
|
||||
### `trimLines(value)`
|
||||
|
||||
Remove spaces and tabs around line breaks in `value` (`string`).
|
||||
|
||||
## Types
|
||||
|
||||
This package is fully typed with [TypeScript][].
|
||||
It exports no additional types.
|
||||
|
||||
## Compatibility
|
||||
|
||||
This package is at least compatible with all maintained versions of Node.js.
|
||||
As of now, that is Node.js 14.14+, 16.0+, and 18.0+.
|
||||
It also works in Deno and modern browsers.
|
||||
|
||||
## Contribute
|
||||
|
||||
Yes please!
|
||||
See [How to Contribute to Open Source][contribute].
|
||||
|
||||
## License
|
||||
|
||||
[MIT][license] © [Titus Wormer][author]
|
||||
|
||||
<!-- Definitions -->
|
||||
|
||||
[build-badge]: https://github.com/wooorm/trim-lines/workflows/main/badge.svg
|
||||
|
||||
[build]: https://github.com/wooorm/trim-lines/actions
|
||||
|
||||
[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/trim-lines.svg
|
||||
|
||||
[coverage]: https://codecov.io/github/wooorm/trim-lines
|
||||
|
||||
[downloads-badge]: https://img.shields.io/npm/dm/trim-lines.svg
|
||||
|
||||
[downloads]: https://www.npmjs.com/package/trim-lines
|
||||
|
||||
[size-badge]: https://img.shields.io/bundlephobia/minzip/trim-lines.svg
|
||||
|
||||
[size]: https://bundlephobia.com/result?p=trim-lines
|
||||
|
||||
[npm]: https://docs.npmjs.com/cli/install
|
||||
|
||||
[license]: license
|
||||
|
||||
[author]: https://wooorm.com
|
||||
|
||||
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
|
||||
|
||||
[esmsh]: https://esm.sh
|
||||
|
||||
[typescript]: https://www.typescriptlang.org
|
||||
|
||||
[contribute]: https://opensource.guide/how-to-contribute/
|
Reference in New Issue
Block a user