完成世界书、骰子、apiconfig页面处理
This commit is contained in:
107
frontend/node_modules/ts-dedent/README.md
generated
vendored
Normal file
107
frontend/node_modules/ts-dedent/README.md
generated
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
# TypeScript Dedent
|
||||
|
||||
[](https://codecov.io/gh/tamino-martinius/node-ts-dedent)
|
||||
|
||||
TypeScript package which smartly trims and strips indentation from multi-line strings.
|
||||
|
||||
## Usage Examples
|
||||
|
||||
```js
|
||||
import dedent from 'dedent';
|
||||
|
||||
console.log(dedent`A string that gets so long you need to break it over
|
||||
multiple lines. Luckily dedent is here to keep it
|
||||
readable without lots of spaces ending up in the string
|
||||
itself.`);
|
||||
|
||||
console.log(dedent`
|
||||
A string that gets so long you need to break it over
|
||||
multiple lines. Luckily dedent is here to keep it
|
||||
readable without lots of spaces ending up in the string
|
||||
itself.
|
||||
`);
|
||||
```
|
||||
|
||||
```txt
|
||||
A string that gets so long you need to break it over
|
||||
multiple lines. Luckily dedent is here to keep it
|
||||
readable without lots of spaces ending up in the string
|
||||
itself.
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
```js
|
||||
console.log(dedent`
|
||||
Leading and trailing lines will be trimmed, so you can write something like
|
||||
this and have it work as you expect:
|
||||
|
||||
* how convenient it is
|
||||
* that I can use an indented list
|
||||
- and still have it do the right thing
|
||||
|
||||
That's all.
|
||||
`);
|
||||
```
|
||||
|
||||
```txt
|
||||
Leading and trailing lines will be trimmed, so you can write something like
|
||||
this and have it work as you expect:
|
||||
|
||||
* how convenient it is
|
||||
* that I can use an indented list
|
||||
- and still have it do the right thing
|
||||
|
||||
That's all.
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
```js
|
||||
console.log(dedent`
|
||||
Also works fine
|
||||
|
||||
${1}. With any kind of
|
||||
${2}. Placeholders
|
||||
`);
|
||||
```
|
||||
|
||||
```txt
|
||||
Also works fine
|
||||
|
||||
1. With any kind of
|
||||
2. Placeholders
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
```js
|
||||
console.log(dedent(`
|
||||
Wait! I lied. Dedent can also be used as a function.
|
||||
`);
|
||||
```
|
||||
|
||||
```txt
|
||||
Wait! I lied. Dedent can also be used as a function.
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
|
||||
## Based on
|
||||
|
||||
- [dedent](https://www.npmjs.com/package/dedent) by ~dmnd
|
||||
- [dedent-js](https://www.npmjs.com/package/dedent-js) by ~martin-kolarik
|
||||
|
||||
## Changelog
|
||||
|
||||
See [history](HISTORY.md) for more details.
|
||||
|
||||
- `2.2.0` **2021-08-01** Add indentation to values with multiline strings & added ESM module
|
||||
- `2.1.1` **2021-03-31** Update dependencies
|
||||
- `2.1.0` **2021-03-24** Bugfixes
|
||||
- `2.0.0` **2020-09-28** Bugfixes
|
||||
- `1.2.0` **2020-09-28** Update dependencies and a couple of minor improvments
|
||||
- `1.1.0` **2019-07-26** Update dependencies and fixed links in readme
|
||||
- `1.0.0` **2018-06-14** Initial release
|
||||
2
frontend/node_modules/ts-dedent/esm/index.d.ts
generated
vendored
Normal file
2
frontend/node_modules/ts-dedent/esm/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export declare function dedent(templ: TemplateStringsArray | string, ...values: unknown[]): string;
|
||||
export default dedent;
|
||||
68
frontend/node_modules/ts-dedent/package.json
generated
vendored
Normal file
68
frontend/node_modules/ts-dedent/package.json
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
{
|
||||
"name": "ts-dedent",
|
||||
"version": "2.2.0",
|
||||
"description": "TypeScript package which smartly trims and strips indentation from multi-line strings",
|
||||
"author": "Tamino Martinius <dev@zaku.eu>",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./esm/index.js",
|
||||
"jsnext:main": "./dist/index.js",
|
||||
"typings": "./dist/index.d.ts",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"dist",
|
||||
"esm",
|
||||
"src"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/tamino-martinius/node-ts-dedent.git"
|
||||
},
|
||||
"keywords": [
|
||||
"dedent",
|
||||
"deindent",
|
||||
"indentation",
|
||||
"multi-line string",
|
||||
"multiline strings",
|
||||
"template literals",
|
||||
"template strings",
|
||||
"ts",
|
||||
"typescript",
|
||||
"es6",
|
||||
"harmony"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=6.10"
|
||||
},
|
||||
"scripts": {
|
||||
"coverage": "rm -rf coverage* && jest --coverage",
|
||||
"pretest": "npm run lint",
|
||||
"test": "jest",
|
||||
"lint": "eslint .",
|
||||
"watch": "tsc -w",
|
||||
"ci": "npm run coverage && codecov",
|
||||
"compile": "rm -rf dist/* && rm -rf esm/* && tsc --module commonjs --outdir dist && tsc --module es6 --outdir esm",
|
||||
"preversion": "npm run compile && git add ."
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^26.0.24",
|
||||
"@typescript-eslint/eslint-plugin": "^4.28.5",
|
||||
"@typescript-eslint/parser": "^4.28.5",
|
||||
"codecov": "^3.8.3",
|
||||
"eslint": "^7.32.0",
|
||||
"jest": "^27.0.6",
|
||||
"ts-jest": "^27.0.4",
|
||||
"typescript": "~4.3.5"
|
||||
},
|
||||
"jest": {
|
||||
"transform": {
|
||||
".ts": "ts-jest"
|
||||
},
|
||||
"testRegex": "\\.(test|spec)\\.ts$",
|
||||
"moduleFileExtensions": [
|
||||
"ts",
|
||||
"tsx",
|
||||
"js",
|
||||
"json"
|
||||
]
|
||||
}
|
||||
}
|
||||
554
frontend/node_modules/ts-dedent/src/__tests__/index.spec.ts
generated
vendored
Normal file
554
frontend/node_modules/ts-dedent/src/__tests__/index.spec.ts
generated
vendored
Normal file
@@ -0,0 +1,554 @@
|
||||
import { dedent } from '..';
|
||||
|
||||
function tag(strings: TemplateStringsArray, ...values: number[]) {
|
||||
let string = strings[0];
|
||||
|
||||
values.forEach((value, i) => {
|
||||
string += 2 * value + strings[i + 1];
|
||||
});
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
describe('dedent tag', () => {
|
||||
it('should work with empty string', () => {
|
||||
expect(dedent``).toEqual('');
|
||||
});
|
||||
|
||||
it('should work with tabs', () => {
|
||||
expect(dedent`Line #1
|
||||
Line #2
|
||||
Line #3`).toEqual('Line #1\nLine #2\nLine #3');
|
||||
|
||||
expect(dedent`Line #${1}
|
||||
Line #${2}
|
||||
Line #${3}`).toEqual('Line #1\nLine #2\nLine #3');
|
||||
|
||||
expect(dedent`${1}. line #${1}
|
||||
${2}. line #${2}
|
||||
${3}. line`).toEqual('1. line #1\n2. line #2\n3. line');
|
||||
});
|
||||
|
||||
it('should work with spaces', () => {
|
||||
expect(dedent`Line #1
|
||||
Line #2
|
||||
Line #3`).toEqual('Line #1\nLine #2\nLine #3');
|
||||
|
||||
expect(dedent`Line #${1}
|
||||
Line #${2}
|
||||
Line #${3}`).toEqual('Line #1\nLine #2\nLine #3');
|
||||
|
||||
expect(dedent`${1}. line #${1}
|
||||
${2}. line #${2}
|
||||
${3}. line`).toEqual('1. line #1\n2. line #2\n3. line');
|
||||
});
|
||||
|
||||
it('should remove leading/trailing line break', () => {
|
||||
expect(
|
||||
dedent`
|
||||
Line #1
|
||||
Line #2
|
||||
Line #3
|
||||
`,
|
||||
).toEqual('Line #1\nLine #2\nLine #3');
|
||||
|
||||
expect(
|
||||
dedent`
|
||||
Line #1
|
||||
Line #2
|
||||
Line #3
|
||||
`,
|
||||
).toEqual('Line #1\n\tLine #2\n\tLine #3');
|
||||
|
||||
expect(
|
||||
dedent`
|
||||
Line #${1}
|
||||
Line #${2}
|
||||
Line #${3}
|
||||
`,
|
||||
).toEqual('Line #1\nLine #2\nLine #3');
|
||||
|
||||
expect(
|
||||
dedent`
|
||||
Line #${1}
|
||||
Line #${2}
|
||||
Line #${3}
|
||||
`,
|
||||
).toEqual('Line #1\n\tLine #2\n\tLine #3');
|
||||
|
||||
expect(
|
||||
dedent`
|
||||
${1}. line #${1}
|
||||
${2}. line #${2}
|
||||
${3}. line
|
||||
`,
|
||||
).toEqual('1. line #1\n2. line #2\n3. line');
|
||||
});
|
||||
|
||||
it('should not remove more than one leading/trailing line break', () => {
|
||||
expect(
|
||||
dedent`
|
||||
|
||||
Line #1
|
||||
Line #2
|
||||
Line #3
|
||||
|
||||
`,
|
||||
).toEqual('\nLine #1\nLine #2\nLine #3\n');
|
||||
|
||||
expect(
|
||||
dedent`
|
||||
|
||||
Line #${1}
|
||||
Line #${2}
|
||||
Line #${3}
|
||||
|
||||
`,
|
||||
).toEqual('\nLine #1\nLine #2\nLine #3\n');
|
||||
|
||||
expect(
|
||||
dedent`
|
||||
|
||||
${1}. line #${1}
|
||||
${2}. line #${2}
|
||||
${3}. line
|
||||
|
||||
`,
|
||||
).toEqual('\n1. line #1\n2. line #2\n3. line\n');
|
||||
});
|
||||
|
||||
it('should remove the same number of tabs/spaces from each line', () => {
|
||||
expect(
|
||||
dedent`
|
||||
Line #1
|
||||
Line #2
|
||||
Line #3
|
||||
`,
|
||||
).toEqual('Line #1\n\tLine #2\n\t\tLine #3');
|
||||
|
||||
expect(
|
||||
dedent`
|
||||
Line #${1}
|
||||
Line #${2}
|
||||
Line #${3}
|
||||
`,
|
||||
).toEqual('Line #1\n\tLine #2\n\t\tLine #3');
|
||||
|
||||
expect(
|
||||
dedent`
|
||||
${1}. line #${1}
|
||||
${2}. line #${2}
|
||||
${3}. line
|
||||
`,
|
||||
).toEqual('1. line #1\n\t2. line #2\n\t\t3. line');
|
||||
});
|
||||
|
||||
it("should ignore the last line if it doesn't contain anything else than whitespace", () => {
|
||||
expect(
|
||||
(() => {
|
||||
return dedent`
|
||||
Line #1
|
||||
Line #2
|
||||
Line #3
|
||||
`;
|
||||
})(),
|
||||
).toEqual('Line #1\nLine #2\nLine #3');
|
||||
|
||||
expect(
|
||||
(() => {
|
||||
return dedent`
|
||||
Line #${1}
|
||||
Line #${2}
|
||||
Line #${3}
|
||||
`;
|
||||
})(),
|
||||
).toEqual('Line #1\nLine #2\nLine #3');
|
||||
|
||||
expect(
|
||||
(() => {
|
||||
return dedent`
|
||||
${1}. line #${1}
|
||||
${2}. line #${2}
|
||||
${3}. line
|
||||
`;
|
||||
})(),
|
||||
).toEqual('1. line #1\n2. line #2\n3. line');
|
||||
});
|
||||
|
||||
it("should process escape sequences", () => {
|
||||
expect(
|
||||
(() => {
|
||||
return dedent`
|
||||
\${not interpolated}
|
||||
\`
|
||||
`;
|
||||
})(),
|
||||
).toEqual('${not interpolated}\n`');
|
||||
});
|
||||
});
|
||||
|
||||
describe('dedent() function', () => {
|
||||
it('should work with tabs', () => {
|
||||
expect(
|
||||
dedent(`Line #1
|
||||
Line #2
|
||||
Line #3`),
|
||||
).toEqual('Line #1\nLine #2\nLine #3');
|
||||
|
||||
expect(
|
||||
dedent(`Line #${1}
|
||||
Line #${2}
|
||||
Line #${3}`),
|
||||
).toEqual('Line #1\nLine #2\nLine #3');
|
||||
|
||||
expect(
|
||||
dedent(`${1}. line #${1}
|
||||
${2}. line #${2}
|
||||
${3}. line`),
|
||||
).toEqual('1. line #1\n2. line #2\n3. line');
|
||||
});
|
||||
|
||||
it('should work with spaces', () => {
|
||||
expect(
|
||||
dedent(`Line #1
|
||||
Line #2
|
||||
Line #3`),
|
||||
).toEqual('Line #1\nLine #2\nLine #3');
|
||||
|
||||
expect(
|
||||
dedent(`Line #${1}
|
||||
Line #${2}
|
||||
Line #${3}`),
|
||||
).toEqual('Line #1\nLine #2\nLine #3');
|
||||
|
||||
expect(
|
||||
dedent(`${1}. line #${1}
|
||||
${2}. line #${2}
|
||||
${3}. line`),
|
||||
).toEqual('1. line #1\n2. line #2\n3. line');
|
||||
});
|
||||
|
||||
it('should remove leading/trailing line break', () => {
|
||||
expect(
|
||||
dedent(`
|
||||
Line #1
|
||||
Line #2
|
||||
Line #3
|
||||
`),
|
||||
).toEqual('Line #1\nLine #2\nLine #3');
|
||||
|
||||
expect(
|
||||
dedent(`
|
||||
Line #1
|
||||
Line #2
|
||||
Line #3
|
||||
`),
|
||||
).toEqual('Line #1\n\tLine #2\n\tLine #3');
|
||||
|
||||
expect(
|
||||
dedent(`
|
||||
Line #${1}
|
||||
Line #${2}
|
||||
Line #${3}
|
||||
`),
|
||||
).toEqual('Line #1\nLine #2\nLine #3');
|
||||
|
||||
expect(
|
||||
dedent(`
|
||||
Line #${1}
|
||||
Line #${2}
|
||||
Line #${3}
|
||||
`),
|
||||
).toEqual('Line #1\n\tLine #2\n\tLine #3');
|
||||
|
||||
expect(
|
||||
dedent(`
|
||||
${1}. line #${1}
|
||||
${2}. line #${2}
|
||||
${3}. line
|
||||
`),
|
||||
).toEqual('1. line #1\n2. line #2\n3. line');
|
||||
});
|
||||
|
||||
it('should not remove more than one leading/trailing line break', () => {
|
||||
expect(
|
||||
dedent(`
|
||||
|
||||
Line #1
|
||||
Line #2
|
||||
Line #3
|
||||
|
||||
`),
|
||||
).toEqual('\nLine #1\nLine #2\nLine #3\n');
|
||||
|
||||
expect(
|
||||
dedent(`
|
||||
|
||||
Line #${1}
|
||||
Line #${2}
|
||||
Line #${3}
|
||||
|
||||
`),
|
||||
).toEqual('\nLine #1\nLine #2\nLine #3\n');
|
||||
|
||||
expect(
|
||||
dedent(`
|
||||
|
||||
${1}. line #${1}
|
||||
${2}. line #${2}
|
||||
${3}. line
|
||||
|
||||
`),
|
||||
).toEqual('\n1. line #1\n2. line #2\n3. line\n');
|
||||
});
|
||||
|
||||
it('should remove the same number of tabs/spaces from each line', () => {
|
||||
expect(
|
||||
dedent(`
|
||||
Line #1
|
||||
Line #2
|
||||
Line #3
|
||||
`),
|
||||
).toEqual('Line #1\n\tLine #2\n\t\tLine #3');
|
||||
|
||||
expect(
|
||||
dedent(`
|
||||
Line #${1}
|
||||
Line #${2}
|
||||
Line #${3}
|
||||
`),
|
||||
).toEqual('Line #1\n\tLine #2\n\t\tLine #3');
|
||||
|
||||
expect(
|
||||
dedent(`
|
||||
${1}. line #${1}
|
||||
${2}. line #${2}
|
||||
${3}. line
|
||||
`),
|
||||
).toEqual('1. line #1\n\t2. line #2\n\t\t3. line');
|
||||
});
|
||||
|
||||
it("should ignore the last line if it doesn't contain anything else than whitespace", () => {
|
||||
expect(
|
||||
(() => {
|
||||
return dedent(`
|
||||
Line #1
|
||||
Line #2
|
||||
Line #3
|
||||
`);
|
||||
})(),
|
||||
).toEqual('Line #1\nLine #2\nLine #3');
|
||||
|
||||
expect(
|
||||
(() => {
|
||||
return dedent(`
|
||||
Line #${1}
|
||||
Line #${2}
|
||||
Line #${3}
|
||||
`);
|
||||
})(),
|
||||
).toEqual('Line #1\nLine #2\nLine #3');
|
||||
|
||||
expect(
|
||||
(() => {
|
||||
return dedent(`
|
||||
${1}. line #${1}
|
||||
${2}. line #${2}
|
||||
${3}. line
|
||||
`);
|
||||
})(),
|
||||
).toEqual('1. line #1\n2. line #2\n3. line');
|
||||
});
|
||||
|
||||
it("should process escape sequences", () => {
|
||||
expect(
|
||||
dedent(`
|
||||
\${not interpolated}
|
||||
\`
|
||||
`),
|
||||
).toEqual('${not interpolated}\n`');
|
||||
});
|
||||
});
|
||||
|
||||
describe('dedent() function with custom tag', () => {
|
||||
it('should work with tabs', () => {
|
||||
expect(
|
||||
dedent(tag`Line #1
|
||||
Line #2
|
||||
Line #3`),
|
||||
).toEqual('Line #1\nLine #2\nLine #3');
|
||||
|
||||
expect(
|
||||
dedent(tag`Line #${1}
|
||||
Line #${2}
|
||||
Line #${3}`),
|
||||
).toEqual('Line #2\nLine #4\nLine #6');
|
||||
|
||||
expect(
|
||||
dedent(tag`${1}. line #${1}
|
||||
${2}. line #${2}
|
||||
${3}. line`),
|
||||
).toEqual('2. line #2\n4. line #4\n6. line');
|
||||
});
|
||||
|
||||
it('should work with spaces', () => {
|
||||
expect(
|
||||
dedent(tag`Line #1
|
||||
Line #2
|
||||
Line #3`),
|
||||
).toEqual('Line #1\nLine #2\nLine #3');
|
||||
|
||||
expect(
|
||||
dedent(tag`Line #${1}
|
||||
Line #${2}
|
||||
Line #${3}`),
|
||||
).toEqual('Line #2\nLine #4\nLine #6');
|
||||
|
||||
expect(
|
||||
dedent(tag`${1}. line #${1}
|
||||
${2}. line #${2}
|
||||
${3}. line`),
|
||||
).toEqual('2. line #2\n4. line #4\n6. line');
|
||||
});
|
||||
|
||||
it('should remove leading/trailing line break', () => {
|
||||
expect(
|
||||
dedent(tag`
|
||||
Line #1
|
||||
Line #2
|
||||
Line #3
|
||||
`),
|
||||
).toEqual('Line #1\nLine #2\nLine #3');
|
||||
|
||||
expect(
|
||||
dedent(tag`
|
||||
Line #1
|
||||
Line #2
|
||||
Line #3
|
||||
`),
|
||||
).toEqual('Line #1\n\tLine #2\n\tLine #3');
|
||||
|
||||
expect(
|
||||
dedent(tag`
|
||||
Line #${1}
|
||||
Line #${2}
|
||||
Line #${3}
|
||||
`),
|
||||
).toEqual('Line #2\nLine #4\nLine #6');
|
||||
|
||||
expect(
|
||||
dedent(tag`
|
||||
Line #${1}
|
||||
Line #${2}
|
||||
Line #${3}
|
||||
`),
|
||||
).toEqual('Line #2\n\tLine #4\n\tLine #6');
|
||||
|
||||
expect(
|
||||
dedent(tag`
|
||||
${1}. line #${1}
|
||||
${2}. line #${2}
|
||||
${3}. line
|
||||
`),
|
||||
).toEqual('2. line #2\n4. line #4\n6. line');
|
||||
});
|
||||
|
||||
it('should not remove more than one leading/trailing line break', () => {
|
||||
expect(
|
||||
dedent(tag`
|
||||
|
||||
Line #1
|
||||
Line #2
|
||||
Line #3
|
||||
|
||||
`),
|
||||
).toEqual('\nLine #1\nLine #2\nLine #3\n');
|
||||
|
||||
expect(
|
||||
dedent(tag`
|
||||
|
||||
Line #${1}
|
||||
Line #${2}
|
||||
Line #${3}
|
||||
|
||||
`),
|
||||
).toEqual('\nLine #2\nLine #4\nLine #6\n');
|
||||
|
||||
expect(
|
||||
dedent(tag`
|
||||
|
||||
${1}. line #${1}
|
||||
${2}. line #${2}
|
||||
${3}. line
|
||||
|
||||
`),
|
||||
).toEqual('\n2. line #2\n4. line #4\n6. line\n');
|
||||
});
|
||||
|
||||
it('should remove the same number of tabs/spaces from each line', () => {
|
||||
expect(
|
||||
dedent(tag`
|
||||
Line #1
|
||||
Line #2
|
||||
Line #3
|
||||
`),
|
||||
).toEqual('Line #1\n\tLine #2\n\t\tLine #3');
|
||||
|
||||
expect(
|
||||
dedent(tag`
|
||||
Line #${1}
|
||||
Line #${2}
|
||||
Line #${3}
|
||||
`),
|
||||
).toEqual('Line #2\n\tLine #4\n\t\tLine #6');
|
||||
|
||||
expect(
|
||||
dedent(tag`
|
||||
${1}. line #${1}
|
||||
${2}. line #${2}
|
||||
${3}. line
|
||||
`),
|
||||
).toEqual('2. line #2\n\t4. line #4\n\t\t6. line');
|
||||
});
|
||||
|
||||
it("should ignore the last line if it doesn't contain anything else than whitespace", () => {
|
||||
expect(
|
||||
(() => {
|
||||
return dedent(tag`
|
||||
Line #1
|
||||
Line #2
|
||||
Line #3
|
||||
`);
|
||||
})(),
|
||||
).toEqual('Line #1\nLine #2\nLine #3');
|
||||
|
||||
expect(
|
||||
(() => {
|
||||
return dedent(tag`
|
||||
Line #${1}
|
||||
Line #${2}
|
||||
Line #${3}
|
||||
`);
|
||||
})(),
|
||||
).toEqual('Line #2\nLine #4\nLine #6');
|
||||
|
||||
expect(
|
||||
(() => {
|
||||
return dedent(tag`
|
||||
${1}. line #${1}
|
||||
${2}. line #${2}
|
||||
${3}. line
|
||||
`);
|
||||
})(),
|
||||
).toEqual('2. line #2\n4. line #4\n6. line');
|
||||
});
|
||||
|
||||
it("should process escape sequences", () => {
|
||||
expect(
|
||||
dedent(tag`
|
||||
\${not interpolated}
|
||||
\`
|
||||
`),
|
||||
).toEqual('${not interpolated}\n`');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user