@ywfe/fe-tools 1.2.1-beta.23 → 1.2.1-beta.24

Sign up to get free protection for your applications and to get access to all the features.
package/JSON2String.ts ADDED
@@ -0,0 +1,14 @@
1
+ interface Input {
2
+ data: object;
3
+ }
4
+ // Ctrl-S保存代码
5
+ function JSON2String({input}: { input: Input }){
6
+ const { data } = input;
7
+ try {
8
+ const str = JSON.stringify(data)
9
+ return '```json' + str + 'json```'
10
+ } catch (error) {
11
+ return '```json' + '{}' + 'json```'
12
+ }
13
+ }
14
+ export default JSON2String
package/index.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export { default as request } from './request'
2
2
  export { default as userInputToJson } from './userInputToJson'
3
+ export { default as JSON2String } from './JSON2String'
@@ -0,0 +1,7 @@
1
+ interface Input {
2
+ data: object;
3
+ }
4
+ declare function JSON2String({ input }: {
5
+ input: Input;
6
+ }): string;
7
+ export default JSON2String;
package/lib/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export { default as request } from './request';
2
2
  export { default as userInputToJson } from './userInputToJson';
3
+ export { default as JSON2String } from './JSON2String';
@@ -8791,6 +8791,20 @@ function userInputToJson(_a) {
8791
8791
  });
8792
8792
  }
8793
8793
 
8794
+ // Ctrl-S保存代码
8795
+ function JSON2String(_a) {
8796
+ var input = _a.input;
8797
+ var data = input.data;
8798
+ try {
8799
+ var str = JSON.stringify(data);
8800
+ return '```json' + str + 'json```';
8801
+ }
8802
+ catch (error) {
8803
+ return '```json' + '{}' + 'json```';
8804
+ }
8805
+ }
8806
+
8807
+ exports.JSON2String = JSON2String;
8794
8808
  exports.request = request;
8795
8809
  exports.userInputToJson = userInputToJson;
8796
8810
  //# sourceMappingURL=ywfe-tools.cjs.map