@ywfe/fe-tools 1.2.1-beta.24 → 1.2.1-beta.26
Sign up to get free protection for your applications and to get access to all the features.
- package/JSON2String.ts +6 -3
- package/index.ts +0 -1
- package/lib/JSON2String.d.ts +3 -1
- package/lib/index.d.ts +0 -1
- package/lib/ywfe-tools.cjs +11 -38
- package/lib/ywfe-tools.cjs.map +1 -1
- package/lib/ywfe-tools.esm.js +12 -38
- package/lib/ywfe-tools.esm.js.map +1 -1
- package/lib/ywfe-tools.umd.js +2 -2
- package/lib/ywfe-tools.umd.js.map +1 -1
- package/package.json +1 -1
- package/request.ts +6 -6
- package/lib/userInputToJson.d.ts +0 -8
- package/userInputToJson.ts +0 -24
package/lib/ywfe-tools.esm.js
CHANGED
@@ -8721,12 +8721,12 @@ function request(_a) {
|
|
8721
8721
|
return basePathMap.get(env);
|
8722
8722
|
};
|
8723
8723
|
isValidURL = function (url) {
|
8724
|
-
var pattern = new RegExp("^(https
|
8725
|
-
"((([a-z
|
8726
|
-
"((
|
8727
|
-
"(
|
8728
|
-
"(
|
8729
|
-
"(
|
8724
|
+
var pattern = new RegExp("^(https?:\/\/)?" + // protocol
|
8725
|
+
"((([a-z\d]([a-z\d-]*[a-z\d])*)\.)+[a-z]{2,}|" + // domain name
|
8726
|
+
"((\d{1,3}\.){3}\d{1,3}))" + // OR ip (v4) address
|
8727
|
+
"(\:\d+)?(\/[-a-z\d%_.~+]*)*" + // port and path
|
8728
|
+
"(\?[;&a-z\d%_.~+=-]*)?" + // query string
|
8729
|
+
"(\#[-a-z\d_]*)?$", "i"); // fragment locator
|
8730
8730
|
return !!pattern.test(url);
|
8731
8731
|
};
|
8732
8732
|
prefix = getBasePath();
|
@@ -8760,47 +8760,21 @@ function request(_a) {
|
|
8760
8760
|
});
|
8761
8761
|
}
|
8762
8762
|
|
8763
|
-
function userInputToJson(_a) {
|
8764
|
-
return __awaiter(this, arguments, void 0, function (_b) {
|
8765
|
-
var res, result;
|
8766
|
-
var input = _b.input;
|
8767
|
-
return __generator(this, function (_c) {
|
8768
|
-
switch (_c.label) {
|
8769
|
-
case 0:
|
8770
|
-
console.log("input", input);
|
8771
|
-
return [4 /*yield*/, request({
|
8772
|
-
input: {
|
8773
|
-
url: "https://fc-typechat.ywwl.com/userInputToJson",
|
8774
|
-
method: "GET",
|
8775
|
-
params: input,
|
8776
|
-
},
|
8777
|
-
})];
|
8778
|
-
case 1:
|
8779
|
-
res = _c.sent();
|
8780
|
-
if (res.success) {
|
8781
|
-
result = res.data;
|
8782
|
-
return [2 /*return*/, result.success ? result.data : result];
|
8783
|
-
}
|
8784
|
-
else {
|
8785
|
-
return [2 /*return*/, res.success ? res.data : res];
|
8786
|
-
}
|
8787
|
-
}
|
8788
|
-
});
|
8789
|
-
});
|
8790
|
-
}
|
8791
|
-
|
8792
8763
|
// Ctrl-S保存代码
|
8793
8764
|
function JSON2String(_a) {
|
8794
8765
|
var input = _a.input;
|
8795
8766
|
var data = input.data;
|
8767
|
+
var result = { content: '' };
|
8796
8768
|
try {
|
8797
8769
|
var str = JSON.stringify(data);
|
8798
|
-
|
8770
|
+
result.content = '```json' + str + 'json```';
|
8771
|
+
return result;
|
8799
8772
|
}
|
8800
8773
|
catch (error) {
|
8801
|
-
|
8774
|
+
result.content = '```json' + '{}' + 'json```';
|
8775
|
+
return result;
|
8802
8776
|
}
|
8803
8777
|
}
|
8804
8778
|
|
8805
|
-
export { JSON2String, request
|
8779
|
+
export { JSON2String, request };
|
8806
8780
|
//# sourceMappingURL=ywfe-tools.esm.js.map
|