@ywfe/fe-tools 1.2.1-beta.36 → 1.2.1-beta.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/JSON2String.ts +17 -0
- package/index.ts +2 -1
- package/lib/JSON2String.d.ts +9 -0
- package/lib/index.d.ts +2 -1
- package/lib/request.d.ts +9 -0
- package/lib/userInputToJson.d.ts +5 -1
- package/lib/ywfe-tools.cjs +8728 -10
- package/lib/ywfe-tools.cjs.map +1 -1
- package/lib/ywfe-tools.esm.js +8727 -10
- package/lib/ywfe-tools.esm.js.map +1 -1
- package/lib/ywfe-tools.umd.js +4 -0
- package/lib/ywfe-tools.umd.js.map +1 -0
- package/package.json +1 -1
- package/request.ts +48 -0
- package/userInputToJson.ts +15 -11
- package/handler.ts +0 -3
- package/lib/handler.d.ts +0 -2
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
package/lib/index.d.ts
CHANGED
package/lib/request.d.ts
ADDED
package/lib/userInputToJson.d.ts
CHANGED