@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 +14 -0
- package/index.ts +1 -0
- package/lib/JSON2String.d.ts +7 -0
- package/lib/index.d.ts +1 -0
- package/lib/ywfe-tools.cjs +14 -0
- package/lib/ywfe-tools.cjs.map +1 -1
- package/lib/ywfe-tools.esm.js +14 -1
- 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/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
package/lib/index.d.ts
CHANGED
package/lib/ywfe-tools.cjs
CHANGED
@@ -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
|