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:
27
node_modules/flattie/dist/index.js
generated
vendored
Normal file
27
node_modules/flattie/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
function iter(output, nullish, sep, val, key) {
|
||||
var k, pfx = key ? (key + sep) : key;
|
||||
|
||||
if (val == null) {
|
||||
if (nullish) output[key] = val;
|
||||
} else if (typeof val != 'object') {
|
||||
output[key] = val;
|
||||
} else if (Array.isArray(val)) {
|
||||
for (k=0; k < val.length; k++) {
|
||||
iter(output, nullish, sep, val[k], pfx + k);
|
||||
}
|
||||
} else {
|
||||
for (k in val) {
|
||||
iter(output, nullish, sep, val[k], pfx + k);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function flattie(input, glue, toNull) {
|
||||
var output = {};
|
||||
if (typeof input == 'object') {
|
||||
iter(output, !!toNull, glue || '.', input, '');
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
exports.flattie = flattie;
|
1
node_modules/flattie/dist/index.min.js
generated
vendored
Normal file
1
node_modules/flattie/dist/index.min.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.flattie={})}(this,(function(e){e.flattie=function(e,t,f){var n={};return"object"==typeof e&&function e(t,f,n,o,i){var r,l=i?i+n:i;if(null==o)f&&(t[i]=o);else if("object"!=typeof o)t[i]=o;else if(Array.isArray(o))for(r=0;r<o.length;r++)e(t,f,n,o[r],l+r);else for(r in o)e(t,f,n,o[r],l+r)}(n,!!f,t||".",e,""),n}}));
|
25
node_modules/flattie/dist/index.mjs
generated
vendored
Normal file
25
node_modules/flattie/dist/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
function iter(output, nullish, sep, val, key) {
|
||||
var k, pfx = key ? (key + sep) : key;
|
||||
|
||||
if (val == null) {
|
||||
if (nullish) output[key] = val;
|
||||
} else if (typeof val != 'object') {
|
||||
output[key] = val;
|
||||
} else if (Array.isArray(val)) {
|
||||
for (k=0; k < val.length; k++) {
|
||||
iter(output, nullish, sep, val[k], pfx + k);
|
||||
}
|
||||
} else {
|
||||
for (k in val) {
|
||||
iter(output, nullish, sep, val[k], pfx + k);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function flattie(input, glue, toNull) {
|
||||
var output = {};
|
||||
if (typeof input == 'object') {
|
||||
iter(output, !!toNull, glue || '.', input, '');
|
||||
}
|
||||
return output;
|
||||
}
|
1
node_modules/flattie/index.d.ts
generated
vendored
Normal file
1
node_modules/flattie/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export function flattie<X=Record<string, any>, Y=unknown>(input: Y, glue?: string, keepNullish?: boolean): X;
|
21
node_modules/flattie/license
generated
vendored
Normal file
21
node_modules/flattie/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.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.
|
48
node_modules/flattie/package.json
generated
vendored
Normal file
48
node_modules/flattie/package.json
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"name": "flattie",
|
||||
"version": "1.1.1",
|
||||
"repository": "lukeed/flattie",
|
||||
"description": "A tiny (203B) and fast utility to flatten an object with customizable glue",
|
||||
"unpkg": "dist/index.min.js",
|
||||
"module": "dist/index.mjs",
|
||||
"main": "dist/index.js",
|
||||
"types": "index.d.ts",
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"name": "Luke Edwards",
|
||||
"email": "luke.edwards05@gmail.com",
|
||||
"url": "https://lukeed.com"
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./index.d.ts",
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"files": [
|
||||
"*.d.ts",
|
||||
"dist"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "bundt",
|
||||
"bench": "node bench",
|
||||
"test": "uvu -r esm test"
|
||||
},
|
||||
"keywords": [
|
||||
"keys",
|
||||
"flatten",
|
||||
"object",
|
||||
"nested",
|
||||
"flat"
|
||||
],
|
||||
"devDependencies": {
|
||||
"bundt": "1.1.1",
|
||||
"esm": "3.2.25",
|
||||
"uvu": "0.3.3"
|
||||
}
|
||||
}
|
148
node_modules/flattie/readme.md
generated
vendored
Normal file
148
node_modules/flattie/readme.md
generated
vendored
Normal file
@@ -0,0 +1,148 @@
|
||||
# flattie [](https://github.com/lukeed/flattie/actions) [](https://codecov.io/gh/lukeed/flattie)
|
||||
|
||||
> A tiny (203B) and [fast](#benchmarks) utility to flatten an object with customizable glue
|
||||
|
||||
This module recursively squashes an Object/Array. The output is a flat object – AKA, it has a single level of depth.
|
||||
|
||||
By default, the `.` character is used to glue/join layers' keys together. This is customizable.
|
||||
|
||||
Finally, by default, any keys with nullish values (`null` and `undefined`) are **not** included in the return object.
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save flattie
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import { flattie } from 'flattie';
|
||||
|
||||
flattie({
|
||||
a: 'hi',
|
||||
b: {
|
||||
a: null,
|
||||
b: ['foo', '', null, 'bar'],
|
||||
d: 'hello',
|
||||
e: {
|
||||
a: 'yo',
|
||||
b: undefined,
|
||||
c: 'sup',
|
||||
d: 0,
|
||||
f: [
|
||||
{ foo: 123, bar: 123 },
|
||||
{ foo: 465, bar: 456 },
|
||||
]
|
||||
}
|
||||
},
|
||||
c: 'world'
|
||||
});
|
||||
// {
|
||||
// 'a': 'hi',
|
||||
// 'b.b.0': 'foo',
|
||||
// 'b.b.1': '',
|
||||
// 'b.b.3': 'bar',
|
||||
// 'b.d': 'hello',
|
||||
// 'b.e.a': 'yo',
|
||||
// 'b.e.c': 'sup',
|
||||
// 'b.e.d': 0,
|
||||
// 'b.e.f.0.foo': 123,
|
||||
// 'b.e.f.0.bar': 123,
|
||||
// 'b.e.f.1.foo': 465,
|
||||
// 'b.e.f.1.bar': 456,
|
||||
// 'c': 'world'
|
||||
// }
|
||||
```
|
||||
|
||||
> **Note:** `null` and `undefined` values are purged by default.
|
||||
|
||||
## API
|
||||
|
||||
### flattie(input, glue?, keepNullish?)
|
||||
Returns: `Object`
|
||||
|
||||
Returns a new object with a single level of depth.
|
||||
|
||||
> **Important:** An object is always returned despite `input` type.
|
||||
|
||||
#### input
|
||||
Type: `Object|Array`
|
||||
|
||||
The object to flatten.
|
||||
|
||||
#### glue
|
||||
Type: `String`<br>
|
||||
Default: `.`
|
||||
|
||||
A string used to join parent key names to nested child key names.
|
||||
|
||||
```js
|
||||
const foo = { bar: 123 };
|
||||
|
||||
flattie({ foo }); //=> { 'foo.bar': 123 }
|
||||
flattie({ foo }, '???'); //=> { 'foo???bar': 123 }
|
||||
```
|
||||
|
||||
#### keepNullish
|
||||
Type: `Boolean`<br>
|
||||
Default: `false`
|
||||
|
||||
Whether or not `null` and `undefined` values should be kept.
|
||||
|
||||
```js
|
||||
// Note: Applies to Objects too
|
||||
const foo = ['hello', null, NaN, undefined, /*hole*/, 'world'];
|
||||
|
||||
flattie({ foo });
|
||||
//=> {
|
||||
//=> 'foo.0': 'hello',
|
||||
//=> 'foo.2': NaN,
|
||||
//=> 'foo.5': 'world'
|
||||
//=> }
|
||||
|
||||
flattie({ foo }, '.', true);
|
||||
//=> {
|
||||
//=> 'foo.0': 'hello',
|
||||
//=> 'foo.1': null,
|
||||
//=> 'foo.2': NaN,
|
||||
//=> 'foo.3': undefined,
|
||||
//=> 'foo.4': undefined,
|
||||
//=> 'foo.5': 'world'
|
||||
//=> }
|
||||
```
|
||||
|
||||
## Benchmarks
|
||||
|
||||
> Running on Node.js v10.13.0
|
||||
|
||||
```
|
||||
Load Time:
|
||||
flat 1.047ms
|
||||
flatten-object 1.239ms
|
||||
flat-obj 0.997ms
|
||||
flattie 0.258ms
|
||||
|
||||
Validation:
|
||||
✔ flat
|
||||
✔ flatten-object
|
||||
✔ flat-obj
|
||||
✔ flattie
|
||||
|
||||
Benchmark:
|
||||
flat x 186,487 ops/sec ±1.28% (86 runs sampled)
|
||||
flatten-object x 199,476 ops/sec ±1.01% (93 runs sampled)
|
||||
flat-obj x 393,574 ops/sec ±1.41% (95 runs sampled)
|
||||
flattie x 909,734 ops/sec ±0.82% (93 runs sampled)
|
||||
```
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
* [nestie](https://github.com/lukeed/nestie) – A tiny (242B) and fast utility to expand a flattened object <br>_This is `flattie`'s reverse / counterpart._
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Luke Edwards](https://lukeed.com)
|
Reference in New Issue
Block a user