added doga
This commit is contained in:
21
25_02_24/node_modules/@tinyhttp/url/LICENSE
generated
vendored
Normal file
21
25_02_24/node_modules/@tinyhttp/url/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 v 1 r t l
|
||||
|
||||
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.
|
||||
15
25_02_24/node_modules/@tinyhttp/url/README.md
generated
vendored
Normal file
15
25_02_24/node_modules/@tinyhttp/url/README.md
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
# @tinyhttp/req
|
||||
|
||||
[![npm (scoped)][npm-badge]](https://npmjs.com/package/@tinyhttp/req) [![npm][dl-badge]](https://npmjs.com/package/@tinyhttp/req) [![][web-badge]](https://tinyhttp.v1rtl.site/mw/req)
|
||||
|
||||
URL extensions for to parse query parameters, URL parameters, and more.
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
pnpm i @tinyhttp/url
|
||||
```
|
||||
|
||||
[npm-badge]: https://img.shields.io/npm/v/@tinyhttp/req?style=flat-square
|
||||
[dl-badge]: https://img.shields.io/npm/dt/@tinyhttp/req?style=flat-square
|
||||
[web-badge]: https://img.shields.io/badge/website-visit-hotpink?style=flat-square
|
||||
14
25_02_24/node_modules/@tinyhttp/url/dist/index.d.ts
generated
vendored
Normal file
14
25_02_24/node_modules/@tinyhttp/url/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
/// <reference types="node" />
|
||||
import { ParsedUrlQuery } from 'node:querystring';
|
||||
type Regex = {
|
||||
keys: string[] | false;
|
||||
pattern: RegExp;
|
||||
};
|
||||
export declare const getURLParams: ({ pattern, keys }: Regex, reqUrl?: string) => URLParams;
|
||||
export type URLParams = {
|
||||
[key: string]: string;
|
||||
};
|
||||
export declare const getPathname: (url: string) => string;
|
||||
export declare const getQueryParams: (url?: string) => ParsedUrlQuery;
|
||||
export {};
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
25_02_24/node_modules/@tinyhttp/url/dist/index.d.ts.map
generated
vendored
Normal file
1
25_02_24/node_modules/@tinyhttp/url/dist/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAS,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAExD,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,MAAM,EAAE,GAAG,KAAK,CAAA;IACtB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,eAAO,MAAM,YAAY,sBAAuB,KAAK,sBAAiB,SAarE,CAAA;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CACtB,CAAA;AAOD,eAAO,MAAM,WAAW,QAAS,MAAM,KAAG,MAA0C,CAAA;AAEpF,eAAO,MAAM,cAAc,oBAAgB,cAA0D,CAAA"}
|
||||
24
25_02_24/node_modules/@tinyhttp/url/dist/index.js
generated
vendored
Normal file
24
25_02_24/node_modules/@tinyhttp/url/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
import { parse } from "node:querystring";
|
||||
const getURLParams = ({ pattern, keys }, reqUrl = "/") => {
|
||||
const matches = pattern.exec(reqUrl);
|
||||
const params = {};
|
||||
if (matches && typeof keys !== "boolean")
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
if (matches[i + 1]) {
|
||||
params[keys[i]] = decodeURIComponent(matches[i + 1]);
|
||||
}
|
||||
}
|
||||
return params;
|
||||
};
|
||||
const getQueryIndex = (url) => {
|
||||
const index = url.indexOf("?");
|
||||
return index === -1 ? url.length : index;
|
||||
};
|
||||
const getPathname = (url) => url.slice(0, getQueryIndex(url));
|
||||
const getQueryParams = (url = "/") => parse(url.slice(getQueryIndex(url) + 1));
|
||||
export {
|
||||
getPathname,
|
||||
getQueryParams,
|
||||
getURLParams
|
||||
};
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
25_02_24/node_modules/@tinyhttp/url/dist/index.js.map
generated
vendored
Normal file
1
25_02_24/node_modules/@tinyhttp/url/dist/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { parse, ParsedUrlQuery } from 'node:querystring'\n\ntype Regex = {\n keys: string[] | false\n pattern: RegExp\n}\n\nexport const getURLParams = ({ pattern, keys }: Regex, reqUrl = '/'): URLParams => {\n const matches = pattern.exec(reqUrl)\n\n const params = {}\n\n if (matches && typeof keys !== 'boolean')\n for (let i = 0; i < keys.length; i++) {\n if (matches[i + 1]) {\n params[keys[i]] = decodeURIComponent(matches[i + 1])\n }\n }\n\n return params\n}\n\nexport type URLParams = {\n [key: string]: string\n}\n\nconst getQueryIndex = (url: string): number => {\n const index = url.indexOf('?')\n return index === -1 ? url.length : index\n}\n\nexport const getPathname = (url: string): string => url.slice(0, getQueryIndex(url))\n\nexport const getQueryParams = (url = '/'): ParsedUrlQuery => parse(url.slice(getQueryIndex(url) + 1))\n"],"names":[],"mappings":";AAOO,MAAM,eAAe,CAAC,EAAE,SAAS,KAAK,GAAU,SAAS,QAAmB;AAC3E,QAAA,UAAU,QAAQ,KAAK,MAAM;AAEnC,QAAM,SAAS,CAAA;AAEX,MAAA,WAAW,OAAO,SAAS;AAC7B,aAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AAChC,UAAA,QAAQ,IAAI,CAAC,GAAG;AACX,eAAA,KAAK,CAAC,CAAC,IAAI,mBAAmB,QAAQ,IAAI,CAAC,CAAC;AAAA,MACrD;AAAA,IACF;AAEK,SAAA;AACT;AAMA,MAAM,gBAAgB,CAAC,QAAwB;AACvC,QAAA,QAAQ,IAAI,QAAQ,GAAG;AACtB,SAAA,UAAU,KAAK,IAAI,SAAS;AACrC;AAEa,MAAA,cAAc,CAAC,QAAwB,IAAI,MAAM,GAAG,cAAc,GAAG,CAAC;AAEtE,MAAA,iBAAiB,CAAC,MAAM,QAAwB,MAAM,IAAI,MAAM,cAAc,GAAG,IAAI,CAAC,CAAC;"}
|
||||
38
25_02_24/node_modules/@tinyhttp/url/package.json
generated
vendored
Normal file
38
25_02_24/node_modules/@tinyhttp/url/package.json
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "@tinyhttp/url",
|
||||
"version": "2.1.1",
|
||||
"type": "module",
|
||||
"description": "URL extensions for tinyhttp",
|
||||
"homepage": "https://tinyhttp.v1rtl.site",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/tinyhttp/tinyhttp.git",
|
||||
"directory": "packages/url"
|
||||
},
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": "./dist/index.js",
|
||||
"keywords": [
|
||||
"tinyhttp",
|
||||
"node.js",
|
||||
"web framework",
|
||||
"web",
|
||||
"backend",
|
||||
"req",
|
||||
"request",
|
||||
"url",
|
||||
"params",
|
||||
"query"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12.20.0"
|
||||
},
|
||||
"author": "v1rtl",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user