Website Structure

This commit is contained in:
supalerk-ar66 2026-01-13 10:46:40 +07:00
parent 62812f2090
commit 71f0676a62
22365 changed files with 4265753 additions and 791 deletions

78
Frontend-Learner/node_modules/change-case/README.md generated vendored Normal file
View file

@ -0,0 +1,78 @@
# Change Case
> Transform a string between `camelCase`, `PascalCase`, `Capital Case`, `snake_case`, `kebab-case`, `CONSTANT_CASE` and others.
## Installation
```
npm install change-case --save
```
## Usage
```js
import * as changeCase from "change-case";
changeCase.camelCase("TEST_VALUE"); //=> "testValue"
```
Included case functions:
| Method | Result |
| ----------------- | ----------- |
| `camelCase` | `twoWords` |
| `capitalCase` | `Two Words` |
| `constantCase` | `TWO_WORDS` |
| `dotCase` | `two.words` |
| `kebabCase` | `two-words` |
| `noCase` | `two words` |
| `pascalCase` | `TwoWords` |
| `pascalSnakeCase` | `Two_Words` |
| `pathCase` | `two/words` |
| `sentenceCase` | `Two words` |
| `snakeCase` | `two_words` |
| `trainCase` | `Two-Words` |
All methods accept an `options` object as the second argument:
- `delimiter?: string` The character to use between words. Default depends on method, e.g. `_` in snake case.
- `locale?: string[] | string | false` Lower/upper according to specified locale, defaults to host environment. Set to `false` to disable.
- `split?: (value: string) => string[]` A function to define how the input is split into words. Defaults to `split`.
- `prefixCharacters?: string` Retain at the beginning of the string. Defaults to `""`. Example: use `"_"` to keep the underscores in `__typename`.
- `suffixCharacters?: string` Retain at the end of the string. Defaults to `""`. Example: use `"_"` to keep the underscore in `type_`.
By default, `pascalCase` and `snakeCase` separate ambiguous characters with `_`. For example, `V1.2` would become `V1_2` instead of `V12`. If you prefer them merged you can set `mergeAmbiguousCharacters` to `true`.
### Split
**Change case** exports a `split` utility which can be used to build other case functions. It accepts a string and returns each "word" as an array. For example:
```js
split("fooBar")
.map((x) => x.toLowerCase())
.join("_"); //=> "foo_bar"
```
## Change Case Keys
```js
import * as changeKeys from "change-case/keys";
changeKeys.camelCase({ TEST_KEY: true }); //=> { testKey: true }
```
**Change case keys** wraps around the core methods to transform object keys to any case.
### API
- **input: any** Any JavaScript value.
- **depth: number** Specify the depth to transfer for case transformation. Defaults to `1`.
- **options: object** Same as base case library.
## TypeScript and ESM
This package is a [pure ESM package](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) and ships with TypeScript definitions. It cannot be `require`'d or used with CommonJS module resolution in TypeScript.
## License
MIT

View file

@ -0,0 +1,79 @@
/**
* Supported locale values. Use `false` to ignore locale.
* Defaults to `undefined`, which uses the host environment.
*/
export type Locale = string[] | string | false | undefined;
/**
* Options used for converting strings to pascal/camel case.
*/
export interface PascalCaseOptions extends Options {
mergeAmbiguousCharacters?: boolean;
}
/**
* Options used for converting strings to any case.
*/
export interface Options {
locale?: Locale;
split?: (value: string) => string[];
/** @deprecated Pass `split: splitSeparateNumbers` instead. */
separateNumbers?: boolean;
delimiter?: string;
prefixCharacters?: string;
suffixCharacters?: string;
}
/**
* Split any cased input strings into an array of words.
*/
export declare function split(value: string): string[];
/**
* Split the input string into an array of words, separating numbers.
*/
export declare function splitSeparateNumbers(value: string): string[];
/**
* Convert a string to space separated lower case (`foo bar`).
*/
export declare function noCase(input: string, options?: Options): string;
/**
* Convert a string to camel case (`fooBar`).
*/
export declare function camelCase(input: string, options?: PascalCaseOptions): string;
/**
* Convert a string to pascal case (`FooBar`).
*/
export declare function pascalCase(input: string, options?: PascalCaseOptions): string;
/**
* Convert a string to pascal snake case (`Foo_Bar`).
*/
export declare function pascalSnakeCase(input: string, options?: Options): string;
/**
* Convert a string to capital case (`Foo Bar`).
*/
export declare function capitalCase(input: string, options?: Options): string;
/**
* Convert a string to constant case (`FOO_BAR`).
*/
export declare function constantCase(input: string, options?: Options): string;
/**
* Convert a string to dot case (`foo.bar`).
*/
export declare function dotCase(input: string, options?: Options): string;
/**
* Convert a string to kebab case (`foo-bar`).
*/
export declare function kebabCase(input: string, options?: Options): string;
/**
* Convert a string to path case (`foo/bar`).
*/
export declare function pathCase(input: string, options?: Options): string;
/**
* Convert a string to path case (`Foo bar`).
*/
export declare function sentenceCase(input: string, options?: Options): string;
/**
* Convert a string to snake case (`foo_bar`).
*/
export declare function snakeCase(input: string, options?: Options): string;
/**
* Convert a string to header case (`Foo-Bar`).
*/
export declare function trainCase(input: string, options?: Options): string;

209
Frontend-Learner/node_modules/change-case/dist/index.js generated vendored Normal file
View file

@ -0,0 +1,209 @@
// Regexps involved with splitting words in various case formats.
const SPLIT_LOWER_UPPER_RE = /([\p{Ll}\d])(\p{Lu})/gu;
const SPLIT_UPPER_UPPER_RE = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
// Used to iterate over the initial split result and separate numbers.
const SPLIT_SEPARATE_NUMBER_RE = /(\d)\p{Ll}|(\p{L})\d/u;
// Regexp involved with stripping non-word characters from the result.
const DEFAULT_STRIP_REGEXP = /[^\p{L}\d]+/giu;
// The replacement value for splits.
const SPLIT_REPLACE_VALUE = "$1\0$2";
// The default characters to keep after transforming case.
const DEFAULT_PREFIX_SUFFIX_CHARACTERS = "";
/**
* Split any cased input strings into an array of words.
*/
export function split(value) {
let result = value.trim();
result = result
.replace(SPLIT_LOWER_UPPER_RE, SPLIT_REPLACE_VALUE)
.replace(SPLIT_UPPER_UPPER_RE, SPLIT_REPLACE_VALUE);
result = result.replace(DEFAULT_STRIP_REGEXP, "\0");
let start = 0;
let end = result.length;
// Trim the delimiter from around the output string.
while (result.charAt(start) === "\0")
start++;
if (start === end)
return [];
while (result.charAt(end - 1) === "\0")
end--;
return result.slice(start, end).split(/\0/g);
}
/**
* Split the input string into an array of words, separating numbers.
*/
export function splitSeparateNumbers(value) {
const words = split(value);
for (let i = 0; i < words.length; i++) {
const word = words[i];
const match = SPLIT_SEPARATE_NUMBER_RE.exec(word);
if (match) {
const offset = match.index + (match[1] ?? match[2]).length;
words.splice(i, 1, word.slice(0, offset), word.slice(offset));
}
}
return words;
}
/**
* Convert a string to space separated lower case (`foo bar`).
*/
export function noCase(input, options) {
const [prefix, words, suffix] = splitPrefixSuffix(input, options);
return (prefix +
words.map(lowerFactory(options?.locale)).join(options?.delimiter ?? " ") +
suffix);
}
/**
* Convert a string to camel case (`fooBar`).
*/
export function camelCase(input, options) {
const [prefix, words, suffix] = splitPrefixSuffix(input, options);
const lower = lowerFactory(options?.locale);
const upper = upperFactory(options?.locale);
const transform = options?.mergeAmbiguousCharacters
? capitalCaseTransformFactory(lower, upper)
: pascalCaseTransformFactory(lower, upper);
return (prefix +
words
.map((word, index) => {
if (index === 0)
return lower(word);
return transform(word, index);
})
.join(options?.delimiter ?? "") +
suffix);
}
/**
* Convert a string to pascal case (`FooBar`).
*/
export function pascalCase(input, options) {
const [prefix, words, suffix] = splitPrefixSuffix(input, options);
const lower = lowerFactory(options?.locale);
const upper = upperFactory(options?.locale);
const transform = options?.mergeAmbiguousCharacters
? capitalCaseTransformFactory(lower, upper)
: pascalCaseTransformFactory(lower, upper);
return prefix + words.map(transform).join(options?.delimiter ?? "") + suffix;
}
/**
* Convert a string to pascal snake case (`Foo_Bar`).
*/
export function pascalSnakeCase(input, options) {
return capitalCase(input, { delimiter: "_", ...options });
}
/**
* Convert a string to capital case (`Foo Bar`).
*/
export function capitalCase(input, options) {
const [prefix, words, suffix] = splitPrefixSuffix(input, options);
const lower = lowerFactory(options?.locale);
const upper = upperFactory(options?.locale);
return (prefix +
words
.map(capitalCaseTransformFactory(lower, upper))
.join(options?.delimiter ?? " ") +
suffix);
}
/**
* Convert a string to constant case (`FOO_BAR`).
*/
export function constantCase(input, options) {
const [prefix, words, suffix] = splitPrefixSuffix(input, options);
return (prefix +
words.map(upperFactory(options?.locale)).join(options?.delimiter ?? "_") +
suffix);
}
/**
* Convert a string to dot case (`foo.bar`).
*/
export function dotCase(input, options) {
return noCase(input, { delimiter: ".", ...options });
}
/**
* Convert a string to kebab case (`foo-bar`).
*/
export function kebabCase(input, options) {
return noCase(input, { delimiter: "-", ...options });
}
/**
* Convert a string to path case (`foo/bar`).
*/
export function pathCase(input, options) {
return noCase(input, { delimiter: "/", ...options });
}
/**
* Convert a string to path case (`Foo bar`).
*/
export function sentenceCase(input, options) {
const [prefix, words, suffix] = splitPrefixSuffix(input, options);
const lower = lowerFactory(options?.locale);
const upper = upperFactory(options?.locale);
const transform = capitalCaseTransformFactory(lower, upper);
return (prefix +
words
.map((word, index) => {
if (index === 0)
return transform(word);
return lower(word);
})
.join(options?.delimiter ?? " ") +
suffix);
}
/**
* Convert a string to snake case (`foo_bar`).
*/
export function snakeCase(input, options) {
return noCase(input, { delimiter: "_", ...options });
}
/**
* Convert a string to header case (`Foo-Bar`).
*/
export function trainCase(input, options) {
return capitalCase(input, { delimiter: "-", ...options });
}
function lowerFactory(locale) {
return locale === false
? (input) => input.toLowerCase()
: (input) => input.toLocaleLowerCase(locale);
}
function upperFactory(locale) {
return locale === false
? (input) => input.toUpperCase()
: (input) => input.toLocaleUpperCase(locale);
}
function capitalCaseTransformFactory(lower, upper) {
return (word) => `${upper(word[0])}${lower(word.slice(1))}`;
}
function pascalCaseTransformFactory(lower, upper) {
return (word, index) => {
const char0 = word[0];
const initial = index > 0 && char0 >= "0" && char0 <= "9" ? "_" + char0 : upper(char0);
return initial + lower(word.slice(1));
};
}
function splitPrefixSuffix(input, options = {}) {
const splitFn = options.split ?? (options.separateNumbers ? splitSeparateNumbers : split);
const prefixCharacters = options.prefixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;
const suffixCharacters = options.suffixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;
let prefixIndex = 0;
let suffixIndex = input.length;
while (prefixIndex < input.length) {
const char = input.charAt(prefixIndex);
if (!prefixCharacters.includes(char))
break;
prefixIndex++;
}
while (suffixIndex > prefixIndex) {
const index = suffixIndex - 1;
const char = input.charAt(index);
if (!suffixCharacters.includes(char))
break;
suffixIndex = index;
}
return [
input.slice(0, prefixIndex),
splitFn(input.slice(prefixIndex, suffixIndex)),
input.slice(suffixIndex),
];
}
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,12 @@
import * as changeCase from "./index.js";
export declare const camelCase: (object: unknown, depth?: number, options?: changeCase.PascalCaseOptions | undefined) => unknown;
export declare const capitalCase: (object: unknown, depth?: number, options?: changeCase.Options | undefined) => unknown;
export declare const constantCase: (object: unknown, depth?: number, options?: changeCase.Options | undefined) => unknown;
export declare const dotCase: (object: unknown, depth?: number, options?: changeCase.Options | undefined) => unknown;
export declare const trainCase: (object: unknown, depth?: number, options?: changeCase.Options | undefined) => unknown;
export declare const noCase: (object: unknown, depth?: number, options?: changeCase.Options | undefined) => unknown;
export declare const kebabCase: (object: unknown, depth?: number, options?: changeCase.Options | undefined) => unknown;
export declare const pascalCase: (object: unknown, depth?: number, options?: changeCase.PascalCaseOptions | undefined) => unknown;
export declare const pathCase: (object: unknown, depth?: number, options?: changeCase.Options | undefined) => unknown;
export declare const sentenceCase: (object: unknown, depth?: number, options?: changeCase.Options | undefined) => unknown;
export declare const snakeCase: (object: unknown, depth?: number, options?: changeCase.Options | undefined) => unknown;

31
Frontend-Learner/node_modules/change-case/dist/keys.js generated vendored Normal file
View file

@ -0,0 +1,31 @@
import * as changeCase from "./index.js";
const isObject = (object) => object !== null && typeof object === "object";
function changeKeysFactory(changeCase) {
return function changeKeys(object, depth = 1, options) {
if (depth === 0 || !isObject(object))
return object;
if (Array.isArray(object)) {
return object.map((item) => changeKeys(item, depth - 1, options));
}
const result = Object.create(Object.getPrototypeOf(object));
Object.keys(object).forEach((key) => {
const value = object[key];
const changedKey = changeCase(key, options);
const changedValue = changeKeys(value, depth - 1, options);
result[changedKey] = changedValue;
});
return result;
};
}
export const camelCase = changeKeysFactory(changeCase.camelCase);
export const capitalCase = changeKeysFactory(changeCase.capitalCase);
export const constantCase = changeKeysFactory(changeCase.constantCase);
export const dotCase = changeKeysFactory(changeCase.dotCase);
export const trainCase = changeKeysFactory(changeCase.trainCase);
export const noCase = changeKeysFactory(changeCase.noCase);
export const kebabCase = changeKeysFactory(changeCase.kebabCase);
export const pascalCase = changeKeysFactory(changeCase.pascalCase);
export const pathCase = changeKeysFactory(changeCase.pathCase);
export const sentenceCase = changeKeysFactory(changeCase.sentenceCase);
export const snakeCase = changeKeysFactory(changeCase.snakeCase);
//# sourceMappingURL=keys.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../src/keys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,YAAY,CAAC;AAEzC,MAAM,QAAQ,GAAG,CAAC,MAAe,EAAE,EAAE,CACnC,MAAM,KAAK,IAAI,IAAI,OAAO,MAAM,KAAK,QAAQ,CAAC;AAEhD,SAAS,iBAAiB,CAGxB,UAAmE;IAEnE,OAAO,SAAS,UAAU,CACxB,MAAe,EACf,KAAK,GAAG,CAAC,EACT,OAAiB;QAEjB,IAAI,KAAK,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;YAAE,OAAO,MAAM,CAAC;QAEpD,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;YACzB,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;SACnE;QAED,MAAM,MAAM,GAA4B,MAAM,CAAC,MAAM,CACnD,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,CAC9B,CAAC;QAEF,MAAM,CAAC,IAAI,CAAC,MAAgB,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YAC5C,MAAM,KAAK,GAAI,MAAkC,CAAC,GAAG,CAAC,CAAC;YACvD,MAAM,UAAU,GAAG,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;YAC5C,MAAM,YAAY,GAAG,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;YAC3D,MAAM,CAAC,UAAU,CAAC,GAAG,YAAY,CAAC;QACpC,CAAC,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,iBAAiB,CACxC,UAAU,CAAC,SAAS,CACrB,CAAC;AACF,MAAM,CAAC,MAAM,WAAW,GAAG,iBAAiB,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;AACrE,MAAM,CAAC,MAAM,YAAY,GAAG,iBAAiB,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;AACvE,MAAM,CAAC,MAAM,OAAO,GAAG,iBAAiB,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;AAC7D,MAAM,CAAC,MAAM,SAAS,GAAG,iBAAiB,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AACjE,MAAM,CAAC,MAAM,MAAM,GAAG,iBAAiB,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;AAC3D,MAAM,CAAC,MAAM,SAAS,GAAG,iBAAiB,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AACjE,MAAM,CAAC,MAAM,UAAU,GAAG,iBAAiB,CACzC,UAAU,CAAC,UAAU,CACtB,CAAC;AACF,MAAM,CAAC,MAAM,QAAQ,GAAG,iBAAiB,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;AAC/D,MAAM,CAAC,MAAM,YAAY,GAAG,iBAAiB,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;AACvE,MAAM,CAAC,MAAM,SAAS,GAAG,iBAAiB,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC","sourcesContent":["import * as changeCase from \"./index.js\";\n\nconst isObject = (object: unknown) =>\n object !== null && typeof object === \"object\";\n\nfunction changeKeysFactory<\n Options extends changeCase.Options = changeCase.Options,\n>(\n changeCase: (input: string, options?: changeCase.Options) => string,\n): (object: unknown, depth?: number, options?: Options) => unknown {\n return function changeKeys(\n object: unknown,\n depth = 1,\n options?: Options,\n ): unknown {\n if (depth === 0 || !isObject(object)) return object;\n\n if (Array.isArray(object)) {\n return object.map((item) => changeKeys(item, depth - 1, options));\n }\n\n const result: Record<string, unknown> = Object.create(\n Object.getPrototypeOf(object),\n );\n\n Object.keys(object as object).forEach((key) => {\n const value = (object as Record<string, unknown>)[key];\n const changedKey = changeCase(key, options);\n const changedValue = changeKeys(value, depth - 1, options);\n result[changedKey] = changedValue;\n });\n\n return result;\n };\n}\n\nexport const camelCase = changeKeysFactory<changeCase.PascalCaseOptions>(\n changeCase.camelCase,\n);\nexport const capitalCase = changeKeysFactory(changeCase.capitalCase);\nexport const constantCase = changeKeysFactory(changeCase.constantCase);\nexport const dotCase = changeKeysFactory(changeCase.dotCase);\nexport const trainCase = changeKeysFactory(changeCase.trainCase);\nexport const noCase = changeKeysFactory(changeCase.noCase);\nexport const kebabCase = changeKeysFactory(changeCase.kebabCase);\nexport const pascalCase = changeKeysFactory<changeCase.PascalCaseOptions>(\n changeCase.pascalCase,\n);\nexport const pathCase = changeKeysFactory(changeCase.pathCase);\nexport const sentenceCase = changeKeysFactory(changeCase.sentenceCase);\nexport const snakeCase = changeKeysFactory(changeCase.snakeCase);\n"]}

51
Frontend-Learner/node_modules/change-case/package.json generated vendored Normal file
View file

@ -0,0 +1,51 @@
{
"name": "change-case",
"version": "5.4.4",
"description": "Transform a string between `camelCase`, `PascalCase`, `Capital Case`, `snake_case`, `kebab-case`, `CONSTANT_CASE` and others",
"keywords": [
"change",
"case",
"convert",
"transform",
"camel-case",
"pascal-case",
"param-case",
"kebab-case",
"header-case"
],
"homepage": "https://github.com/blakeembrey/change-case/tree/master/packages/change-case#readme",
"bugs": {
"url": "https://github.com/blakeembrey/change-case/issues"
},
"repository": {
"type": "git",
"url": "git://github.com/blakeembrey/change-case.git"
},
"license": "MIT",
"author": {
"name": "Blake Embrey",
"email": "hello@blakeembrey.com",
"url": "http://blakeembrey.me"
},
"type": "module",
"exports": {
".": "./dist/index.js",
"./keys": "./dist/keys.js"
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist/"
],
"scripts": {
"bench": "vitest bench",
"build": "ts-scripts build",
"format": "ts-scripts format",
"prepublishOnly": "npm run build",
"specs": "ts-scripts specs",
"test": "ts-scripts test"
},
"publishConfig": {
"access": "public"
}
}