@ray-js/shared 0.6.17 → 0.6.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +0 -2
- package/lib/index.js +0 -6
- package/lib/index.js.map +1 -1
- package/package.json +3 -3
- package/lib/regexp/NamedRegexp.d.ts +0 -24
- package/lib/regexp/NamedRegexp.js +0 -36
- package/lib/regexp/NamedRegexp.js.map +0 -1
- package/lib/regexp/index.d.ts +0 -1
- package/lib/regexp/index.js +0 -9
- package/lib/regexp/index.js.map +0 -1
- package/lib/url/format.d.ts +0 -2
- package/lib/url/format.js +0 -14
- package/lib/url/format.js.map +0 -1
- package/lib/url/index.d.ts +0 -16
- package/lib/url/index.js +0 -27
- package/lib/url/index.js.map +0 -1
- package/lib/url/interface.d.ts +0 -12
- package/lib/url/interface.js +0 -3
- package/lib/url/interface.js.map +0 -1
- package/lib/url/params.d.ts +0 -1
- package/lib/url/params.js +0 -15
- package/lib/url/params.js.map +0 -1
- package/lib/url/parse.d.ts +0 -2
- package/lib/url/parse.js +0 -40
- package/lib/url/parse.js.map +0 -1
- package/lib/url/queryStringify.d.ts +0 -3
- package/lib/url/queryStringify.js +0 -17
- package/lib/url/queryStringify.js.map +0 -1
- package/lib/url/searchParse.d.ts +0 -5
- package/lib/url/searchParse.js +0 -27
- package/lib/url/searchParse.js.map +0 -1
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -13,15 +13,9 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
-
};
|
|
19
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.url = void 0;
|
|
21
17
|
__exportStar(require("./file"), exports);
|
|
22
18
|
__exportStar(require("./path"), exports);
|
|
23
19
|
__exportStar(require("./log"), exports);
|
|
24
20
|
__exportStar(require("change-case"), exports);
|
|
25
|
-
const url_1 = __importDefault(require("./url"));
|
|
26
|
-
exports.url = url_1.default;
|
|
27
21
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAsB;AACtB,yCAAsB;AACtB,wCAAqB;AAErB,8CAA2B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ray-js/shared",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.18",
|
|
4
4
|
"description": "Ray shared (Node Client)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ray"
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@babel/preset-env": "^7.15.6",
|
|
24
24
|
"@babel/preset-typescript": "^7.15.0",
|
|
25
25
|
"@babel/register": "^7.15.3",
|
|
26
|
-
"@ray-js/types": "^0.6.
|
|
26
|
+
"@ray-js/types": "^0.6.18",
|
|
27
27
|
"change-case": "^4.1.2",
|
|
28
28
|
"fs-extra": "^10.0.0",
|
|
29
29
|
"merge": "^2.1.1",
|
|
@@ -40,6 +40,6 @@
|
|
|
40
40
|
"email": "tuyafe@tuya.com"
|
|
41
41
|
}
|
|
42
42
|
],
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "3c32b82d16d88061a014f122712da8d29c8260f6",
|
|
44
44
|
"repository": {}
|
|
45
45
|
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
interface ExecArray extends RegExpExecArray {
|
|
2
|
-
groups?: Record<string, string> | undefined;
|
|
3
|
-
}
|
|
4
|
-
/**
|
|
5
|
-
* 实现 Named Groups RegExp 的正则百表达式
|
|
6
|
-
* ECMA 2018 的实现
|
|
7
|
-
* 通过 new RegExp 运算符,无法被 babel 转义
|
|
8
|
-
*/
|
|
9
|
-
export default class NamedRegexp {
|
|
10
|
-
regex: RegExp;
|
|
11
|
-
groups: string[];
|
|
12
|
-
/**
|
|
13
|
-
* 创建 Named RegExp
|
|
14
|
-
* @param {object} options
|
|
15
|
-
* @param {RegExp} options.regex 正则
|
|
16
|
-
* @param {Array<String>} options.groups 分组
|
|
17
|
-
*/
|
|
18
|
-
constructor(options: {
|
|
19
|
-
regex: RegExp;
|
|
20
|
-
groups: string[];
|
|
21
|
-
});
|
|
22
|
-
exec(value: string): ExecArray | null;
|
|
23
|
-
}
|
|
24
|
-
export {};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
* 实现 Named Groups RegExp 的正则百表达式
|
|
5
|
-
* ECMA 2018 的实现
|
|
6
|
-
* 通过 new RegExp 运算符,无法被 babel 转义
|
|
7
|
-
*/
|
|
8
|
-
class NamedRegexp {
|
|
9
|
-
/**
|
|
10
|
-
* 创建 Named RegExp
|
|
11
|
-
* @param {object} options
|
|
12
|
-
* @param {RegExp} options.regex 正则
|
|
13
|
-
* @param {Array<String>} options.groups 分组
|
|
14
|
-
*/
|
|
15
|
-
constructor(options) {
|
|
16
|
-
const { regex, groups } = options;
|
|
17
|
-
this.regex = regex;
|
|
18
|
-
this.groups = groups;
|
|
19
|
-
}
|
|
20
|
-
exec(value) {
|
|
21
|
-
const matches = this.regex.exec(value);
|
|
22
|
-
if (!matches)
|
|
23
|
-
return matches;
|
|
24
|
-
const groups = matches.reduce((result, match, index) => {
|
|
25
|
-
if (index > 0)
|
|
26
|
-
// This subtraction is required because we count
|
|
27
|
-
// match indexes from 1, because 0 is the entire matched string
|
|
28
|
-
result[this.groups[index - 1]] = match;
|
|
29
|
-
return result;
|
|
30
|
-
}, {});
|
|
31
|
-
matches.groups = groups;
|
|
32
|
-
return matches;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
exports.default = NamedRegexp;
|
|
36
|
-
//# sourceMappingURL=NamedRegexp.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NamedRegexp.js","sourceRoot":"","sources":["../../src/regexp/NamedRegexp.ts"],"names":[],"mappings":";;AAIA;;;;GAIG;AACH,MAAqB,WAAW;IAI9B;;;;;OAKG;IAEH,YAAY,OAA4C;QACtD,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAA;QACjC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED,IAAI,CAAC,KAAa;QAChB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACtC,IAAI,CAAC,OAAO;YAAE,OAAO,OAAO,CAAA;QAC5B,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;YACrD,IAAI,KAAK,GAAG,CAAC;gBACX,gDAAgD;gBAChD,+DAA+D;gBAC/D,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAA;YAExC,OAAO,MAAM,CAAA;QACf,CAAC,EAAE,EAA4B,CAAC,CAAA;QAChC,OAAO,CAAC,MAAM,GAAG,MAAM,CAAA;QACvB,OAAO,OAAO,CAAA;IAChB,CAAC;CACF;AA/BD,8BA+BC"}
|
package/lib/regexp/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as NamedRegexp } from './NamedRegexp';
|
package/lib/regexp/index.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.NamedRegexp = void 0;
|
|
7
|
-
var NamedRegexp_1 = require("./NamedRegexp");
|
|
8
|
-
Object.defineProperty(exports, "NamedRegexp", { enumerable: true, get: function () { return __importDefault(NamedRegexp_1).default; } });
|
|
9
|
-
//# sourceMappingURL=index.js.map
|
package/lib/regexp/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/regexp/index.ts"],"names":[],"mappings":";;;;;;AAAA,6CAAsD;AAA7C,2HAAA,OAAO,OAAe"}
|
package/lib/url/format.d.ts
DELETED
package/lib/url/format.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const queryStringify_1 = __importDefault(require("./queryStringify"));
|
|
7
|
-
const searchParse_1 = __importDefault(require("./searchParse"));
|
|
8
|
-
function format(attrs) {
|
|
9
|
-
const { hash = '', pathname = '', origin = '', query, search = '' } = attrs;
|
|
10
|
-
const searchQuery = (0, searchParse_1.default)(search);
|
|
11
|
-
return `${origin}${pathname}${(0, queryStringify_1.default)(Object.assign(Object.assign({}, query), searchQuery))}${hash}`;
|
|
12
|
-
}
|
|
13
|
-
exports.default = format;
|
|
14
|
-
//# sourceMappingURL=format.js.map
|
package/lib/url/format.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/url/format.ts"],"names":[],"mappings":";;;;;AACA,sEAA6C;AAC7C,gEAAuC;AAEvC,SAAwB,MAAM,CAAC,KAAe;IAC5C,MAAM,EAAE,IAAI,GAAG,EAAE,EAAE,QAAQ,GAAG,EAAE,EAAE,MAAM,GAAG,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,EAAE,EAAE,GAAG,KAAK,CAAA;IAC3E,MAAM,WAAW,GAAG,IAAA,qBAAW,EAAC,MAAM,CAAC,CAAA;IACvC,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,IAAA,wBAAc,kCAAM,KAAK,GAAK,WAAW,EAAG,GAAG,IAAI,EAAE,CAAA;AACrF,CAAC;AAJD,yBAIC"}
|
package/lib/url/index.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import format from './format';
|
|
2
|
-
import params from './params';
|
|
3
|
-
import parse from './parse';
|
|
4
|
-
import queryStringify from './queryStringify';
|
|
5
|
-
import searchParse from './searchParse';
|
|
6
|
-
declare const queryParse: typeof searchParse;
|
|
7
|
-
export { parse, format, queryStringify, params, searchParse, queryParse };
|
|
8
|
-
declare const _default: {
|
|
9
|
-
parse: typeof parse;
|
|
10
|
-
format: typeof format;
|
|
11
|
-
queryStringify: typeof queryStringify;
|
|
12
|
-
queryParse: typeof searchParse;
|
|
13
|
-
params: typeof params;
|
|
14
|
-
searchParse: typeof searchParse;
|
|
15
|
-
};
|
|
16
|
-
export default _default;
|
package/lib/url/index.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.queryParse = exports.searchParse = exports.params = exports.queryStringify = exports.format = exports.parse = void 0;
|
|
7
|
-
const format_1 = __importDefault(require("./format"));
|
|
8
|
-
exports.format = format_1.default;
|
|
9
|
-
const params_1 = __importDefault(require("./params"));
|
|
10
|
-
exports.params = params_1.default;
|
|
11
|
-
const parse_1 = __importDefault(require("./parse"));
|
|
12
|
-
exports.parse = parse_1.default;
|
|
13
|
-
const queryStringify_1 = __importDefault(require("./queryStringify"));
|
|
14
|
-
exports.queryStringify = queryStringify_1.default;
|
|
15
|
-
const searchParse_1 = __importDefault(require("./searchParse"));
|
|
16
|
-
exports.searchParse = searchParse_1.default;
|
|
17
|
-
const queryParse = searchParse_1.default;
|
|
18
|
-
exports.queryParse = queryParse;
|
|
19
|
-
exports.default = {
|
|
20
|
-
parse: parse_1.default,
|
|
21
|
-
format: format_1.default,
|
|
22
|
-
queryStringify: queryStringify_1.default,
|
|
23
|
-
queryParse,
|
|
24
|
-
params: params_1.default,
|
|
25
|
-
searchParse: searchParse_1.default,
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=index.js.map
|
package/lib/url/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/url/index.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA6B;AAQb,iBART,gBAAM,CAQS;AAPtB,sDAA6B;AAOW,iBAPjC,gBAAM,CAOiC;AAN9C,oDAA2B;AAMlB,gBANF,eAAK,CAME;AALd,sEAA6C;AAKrB,yBALjB,wBAAc,CAKiB;AAJtC,gEAAuC;AAIS,sBAJzC,qBAAW,CAIyC;AAF3D,MAAM,UAAU,GAAG,qBAAW,CAAA;AAE+B,gCAAU;AAEvE,kBAAe;IACb,KAAK,EAAL,eAAK;IACL,MAAM,EAAN,gBAAM;IACN,cAAc,EAAd,wBAAc;IACd,UAAU;IACV,MAAM,EAAN,gBAAM;IACN,WAAW,EAAX,qBAAW;CACZ,CAAA"}
|
package/lib/url/interface.d.ts
DELETED
package/lib/url/interface.js
DELETED
package/lib/url/interface.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../src/url/interface.ts"],"names":[],"mappings":""}
|
package/lib/url/params.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function params(url: string, ...args: Array<Record<string, string>>): string;
|
package/lib/url/params.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const merge_1 = __importDefault(require("merge"));
|
|
7
|
-
const parse_1 = __importDefault(require("./parse"));
|
|
8
|
-
const queryStringify_1 = __importDefault(require("./queryStringify"));
|
|
9
|
-
function params(url, ...args) {
|
|
10
|
-
const { query, pathname, origin, hash } = (0, parse_1.default)(url);
|
|
11
|
-
const params = (0, merge_1.default)(query, ...args); // 合并多个对象,覆盖前一个
|
|
12
|
-
return `${origin}${pathname}${(0, queryStringify_1.default)(params)}${hash}`;
|
|
13
|
-
}
|
|
14
|
-
exports.default = params;
|
|
15
|
-
//# sourceMappingURL=params.js.map
|
package/lib/url/params.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"params.js","sourceRoot":"","sources":["../../src/url/params.ts"],"names":[],"mappings":";;;;;AAAA,kDAAyB;AAEzB,oDAA2B;AAC3B,sEAA6C;AAE7C,SAAwB,MAAM,CAAC,GAAW,EAAE,GAAG,IAAmC;IAChF,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,IAAA,eAAK,EAAC,GAAG,CAAC,CAAA;IACpD,MAAM,MAAM,GAAG,IAAA,eAAK,EAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAAA,CAAC,eAAe;IACpD,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,IAAA,wBAAc,EAAC,MAAM,CAAC,GAAG,IAAI,EAAE,CAAA;AAC/D,CAAC;AAJD,yBAIC"}
|
package/lib/url/parse.d.ts
DELETED
package/lib/url/parse.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
const regexp_1 = require("../regexp");
|
|
18
|
-
const searchParse_1 = __importDefault(require("./searchParse"));
|
|
19
|
-
const URL_REGEX = new regexp_1.NamedRegexp({
|
|
20
|
-
regex: /(((?:http|https):)?(?:\/\/)?(([^:/?#]*)(?::(\d+))?))?([^?#]+)?(\?[^#]*)?(#.*)?/,
|
|
21
|
-
groups: ['origin', 'protocol', 'host', 'hostname', 'port', 'pathname', 'search', 'hash'],
|
|
22
|
-
});
|
|
23
|
-
function parse(href) {
|
|
24
|
-
/* istanbul ignore next */
|
|
25
|
-
const { groups = {} } = URL_REGEX.exec(href) || { groups: {} };
|
|
26
|
-
Object.keys(groups).forEach((key) => {
|
|
27
|
-
if (!groups[key]) {
|
|
28
|
-
groups[key] = '';
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
let query = {};
|
|
32
|
-
if (groups.search) {
|
|
33
|
-
query = (0, searchParse_1.default)(groups.search);
|
|
34
|
-
}
|
|
35
|
-
const { pathname } = groups, restGroups = __rest(groups, ["pathname"]);
|
|
36
|
-
return Object.assign({ query,
|
|
37
|
-
href, pathname: pathname ? pathname : '/' }, restGroups);
|
|
38
|
-
}
|
|
39
|
-
exports.default = parse;
|
|
40
|
-
//# sourceMappingURL=parse.js.map
|
package/lib/url/parse.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../src/url/parse.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sCAAuC;AAGvC,gEAAuC;AAEvC,MAAM,SAAS,GAAG,IAAI,oBAAW,CAAC;IAChC,KAAK,EAAE,gFAAgF;IACvF,MAAM,EAAE,CAAC,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,CAAC;CACzF,CAAC,CAAA;AAEF,SAAwB,KAAK,CAAC,IAAY;IACxC,0BAA0B;IAC1B,MAAM,EAAE,MAAM,GAAG,EAAE,EAAE,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAA;IAC9D,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QAClC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;YAChB,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,CAAA;SACjB;IACH,CAAC,CAAC,CAAA;IAEF,IAAI,KAAK,GAA2B,EAAE,CAAA;IACtC,IAAI,MAAM,CAAC,MAAM,EAAE;QACjB,KAAK,GAAG,IAAA,qBAAW,EAAC,MAAM,CAAC,MAAM,CAAC,CAAA;KACnC;IAED,MAAM,EAAE,QAAQ,KAAoB,MAAM,EAArB,UAAU,UAAK,MAAM,EAApC,YAA2B,CAAS,CAAA;IAE1C,uBACE,KAAK;QACL,IAAI,EACJ,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,IAChC,UAAU,EACd;AACH,CAAC;AAtBD,wBAsBC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
function queryStringify(query, options = {}) {
|
|
4
|
-
const { prefix = true } = options;
|
|
5
|
-
const search = [];
|
|
6
|
-
const keys = Object.keys(query);
|
|
7
|
-
if (keys.length === 0) {
|
|
8
|
-
return '';
|
|
9
|
-
}
|
|
10
|
-
keys.forEach((key) => {
|
|
11
|
-
const value = query[key];
|
|
12
|
-
search.push([key, value].join('='));
|
|
13
|
-
});
|
|
14
|
-
return `${prefix ? '?' : ''}${search.join('&')}`;
|
|
15
|
-
}
|
|
16
|
-
exports.default = queryStringify;
|
|
17
|
-
//# sourceMappingURL=queryStringify.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"queryStringify.js","sourceRoot":"","sources":["../../src/url/queryStringify.ts"],"names":[],"mappings":";;AAAA,SAAwB,cAAc,CACpC,KAA6B,EAC7B,UAAgC,EAAE;IAElC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,GAAG,OAAO,CAAA;IACjC,MAAM,MAAM,GAAa,EAAE,CAAA;IAC3B,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAE/B,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;QACrB,OAAO,EAAE,CAAA;KACV;IAED,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QACnB,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAA;QACxB,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;IACrC,CAAC,CAAC,CAAA;IAEF,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAA;AAClD,CAAC;AAlBD,iCAkBC"}
|
package/lib/url/searchParse.d.ts
DELETED
package/lib/url/searchParse.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
* 分割url search key value,返回 [key, value]
|
|
5
|
-
*/
|
|
6
|
-
function splitSearchKeyValue(str) {
|
|
7
|
-
const [key, ...valueArr] = str.split('=');
|
|
8
|
-
const value = valueArr.length ? valueArr.join('=') : '';
|
|
9
|
-
return [key, value];
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* 解析 url.search 返回对象类型
|
|
13
|
-
* @param search URL search 信息
|
|
14
|
-
*/
|
|
15
|
-
function searchParse(search) {
|
|
16
|
-
const query = {};
|
|
17
|
-
if (!search)
|
|
18
|
-
return query;
|
|
19
|
-
search = search.replace(/^\?/, ''); // 移除首字符 问号
|
|
20
|
-
search.split('&').forEach((i) => {
|
|
21
|
-
const [key, value] = splitSearchKeyValue(i);
|
|
22
|
-
query[key] = value;
|
|
23
|
-
});
|
|
24
|
-
return query;
|
|
25
|
-
}
|
|
26
|
-
exports.default = searchParse;
|
|
27
|
-
//# sourceMappingURL=searchParse.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"searchParse.js","sourceRoot":"","sources":["../../src/url/searchParse.ts"],"names":[],"mappings":";;AAAA;;GAEG;AACH,SAAS,mBAAmB,CAAC,GAAW;IACtC,MAAM,CAAC,GAAG,EAAE,GAAG,QAAQ,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACzC,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IACvD,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;AACrB,CAAC;AAED;;;GAGG;AACH,SAAwB,WAAW,CAAC,MAAc;IAChD,MAAM,KAAK,GAA2B,EAAE,CAAA;IACxC,IAAI,CAAC,MAAM;QAAE,OAAO,KAAK,CAAA;IAEzB,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA,CAAC,WAAW;IAE9C,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;QAC9B,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAAA;QAC3C,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;IACpB,CAAC,CAAC,CAAA;IACF,OAAO,KAAK,CAAA;AACd,CAAC;AAXD,8BAWC"}
|