@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 CHANGED
@@ -4,11 +4,14 @@ interface Input {
4
4
  // Ctrl-S保存代码
5
5
  function JSON2String({input}: { input: Input }){
6
6
  const { data } = input;
7
+ const result:{content: string} = {content:''};
7
8
  try {
8
- const str = JSON.stringify(data)
9
- return '```json' + str + 'json```'
9
+ const str = JSON.stringify(data);
10
+ result.content = '```json' + str + 'json```';
11
+ return result;
10
12
  } catch (error) {
11
- return '```json' + '{}' + 'json```'
13
+ result.content = '```json' + '{}' + 'json```';
14
+ return result;
12
15
  }
13
16
  }
14
17
  export default JSON2String
package/index.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  export { default as request } from './request'
2
- export { default as userInputToJson } from './userInputToJson'
3
2
  export { default as JSON2String } from './JSON2String'
@@ -3,5 +3,7 @@ interface Input {
3
3
  }
4
4
  declare function JSON2String({ input }: {
5
5
  input: Input;
6
- }): string;
6
+ }): {
7
+ content: string;
8
+ };
7
9
  export default JSON2String;
package/lib/index.d.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  export { default as request } from './request';
2
- export { default as userInputToJson } from './userInputToJson';
3
2
  export { default as JSON2String } from './JSON2String';
@@ -8723,12 +8723,12 @@ function request(_a) {
8723
8723
  return basePathMap.get(env);
8724
8724
  };
8725
8725
  isValidURL = function (url) {
8726
- var pattern = new RegExp("^(https?:\\/\\/)?" + // protocol
8727
- "((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|" + // domain name
8728
- "((\\d{1,3}\\.){3}\\d{1,3}))" + // OR ip (v4) address
8729
- "(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*" + // port and path
8730
- "(\\?[;&a-z\\d%_.~+=-]*)?" + // query string
8731
- "(\\#[-a-z\\d_]*)?$", "i"); // fragment locator
8726
+ var pattern = new RegExp("^(https?:\/\/)?" + // protocol
8727
+ "((([a-z\d]([a-z\d-]*[a-z\d])*)\.)+[a-z]{2,}|" + // domain name
8728
+ "((\d{1,3}\.){3}\d{1,3}))" + // OR ip (v4) address
8729
+ "(\:\d+)?(\/[-a-z\d%_.~+]*)*" + // port and path
8730
+ "(\?[;&a-z\d%_.~+=-]*)?" + // query string
8731
+ "(\#[-a-z\d_]*)?$", "i"); // fragment locator
8732
8732
  return !!pattern.test(url);
8733
8733
  };
8734
8734
  prefix = getBasePath();
@@ -8762,49 +8762,22 @@ function request(_a) {
8762
8762
  });
8763
8763
  }
8764
8764
 
8765
- function userInputToJson(_a) {
8766
- return __awaiter(this, arguments, void 0, function (_b) {
8767
- var res, result;
8768
- var input = _b.input;
8769
- return __generator(this, function (_c) {
8770
- switch (_c.label) {
8771
- case 0:
8772
- console.log("input", input);
8773
- return [4 /*yield*/, request({
8774
- input: {
8775
- url: "https://fc-typechat.ywwl.com/userInputToJson",
8776
- method: "GET",
8777
- params: input,
8778
- },
8779
- })];
8780
- case 1:
8781
- res = _c.sent();
8782
- if (res.success) {
8783
- result = res.data;
8784
- return [2 /*return*/, result.success ? result.data : result];
8785
- }
8786
- else {
8787
- return [2 /*return*/, res.success ? res.data : res];
8788
- }
8789
- }
8790
- });
8791
- });
8792
- }
8793
-
8794
8765
  // Ctrl-S保存代码
8795
8766
  function JSON2String(_a) {
8796
8767
  var input = _a.input;
8797
8768
  var data = input.data;
8769
+ var result = { content: '' };
8798
8770
  try {
8799
8771
  var str = JSON.stringify(data);
8800
- return '```json' + str + 'json```';
8772
+ result.content = '```json' + str + 'json```';
8773
+ return result;
8801
8774
  }
8802
8775
  catch (error) {
8803
- return '```json' + '{}' + 'json```';
8776
+ result.content = '```json' + '{}' + 'json```';
8777
+ return result;
8804
8778
  }
8805
8779
  }
8806
8780
 
8807
8781
  exports.JSON2String = JSON2String;
8808
8782
  exports.request = request;
8809
- exports.userInputToJson = userInputToJson;
8810
8783
  //# sourceMappingURL=ywfe-tools.cjs.map