@ywfe/fe-tools 1.2.1-beta.23 → 1.2.1-beta.25
Sign up to get free protection for your applications and to get access to all the features.
- package/JSON2String.ts +17 -0
- package/index.ts +1 -2
- package/lib/JSON2String.d.ts +9 -0
- package/lib/index.d.ts +1 -2
- package/lib/ywfe-tools.cjs +15 -8791
- package/lib/ywfe-tools.cjs.map +1 -1
- package/lib/ywfe-tools.esm.js +15 -8790
- package/lib/ywfe-tools.esm.js.map +1 -1
- package/lib/ywfe-tools.umd.js +1 -3
- package/lib/ywfe-tools.umd.js.map +1 -1
- package/package.json +1 -1
- package/lib/request.d.ts +0 -9
- package/lib/userInputToJson.d.ts +0 -8
- package/request.ts +0 -55
- package/userInputToJson.ts +0 -24
package/JSON2String.ts
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
interface Input {
|
2
|
+
data: object;
|
3
|
+
}
|
4
|
+
// Ctrl-S保存代码
|
5
|
+
function JSON2String({input}: { input: Input }){
|
6
|
+
const { data } = input;
|
7
|
+
const result:{content: string} = {content:''};
|
8
|
+
try {
|
9
|
+
const str = JSON.stringify(data);
|
10
|
+
result.content = '```json' + str + 'json```';
|
11
|
+
return result;
|
12
|
+
} catch (error) {
|
13
|
+
result.content = '```json' + '{}' + 'json```';
|
14
|
+
return result;
|
15
|
+
}
|
16
|
+
}
|
17
|
+
export default JSON2String
|
package/index.ts
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
export { default as
|
2
|
-
export { default as userInputToJson } from './userInputToJson'
|
1
|
+
export { default as JSON2String } from './JSON2String'
|
package/lib/index.d.ts
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
export { default as
|
2
|
-
export { default as userInputToJson } from './userInputToJson';
|
1
|
+
export { default as JSON2String } from './JSON2String';
|