(configData, bodyType, isMultiple, stopNodeId)
| 937 | } |
| 938 | |
| 939 | export const getConfigExamplesForJS = (configData, bodyType, isMultiple, stopNodeId) => { |
| 940 | let finalStr = '' |
| 941 | configData = unshiftFiles(configData) |
| 942 | const loop = Math.min(configData.length, 4) |
| 943 | for (let i = 0; i < loop; i += 1) { |
| 944 | const config = configData[i] |
| 945 | let exampleVal = `"example"` |
| 946 | if (config.type === 'string') exampleVal = `"example"` |
| 947 | else if (config.type === 'boolean') exampleVal = `true` |
| 948 | else if (config.type === 'number') exampleVal = `1` |
| 949 | else if (config.type === 'json') exampleVal = `{ "key": "val" }` |
| 950 | else if (config.name === 'files') exampleVal = `input.files[0]` |
| 951 | finalStr += bodyType === 'json' ? `\n "${config.name}": ${exampleVal},` : `formData.append("${config.name}", ${exampleVal})\n` |
| 952 | if (i === loop - 1 && bodyType !== 'json') |
| 953 | finalStr += !isMultiple |
| 954 | ? `` |
| 955 | : stopNodeId |
| 956 | ? `formData.append("stopNodeId", "${stopNodeId}")\n` |
| 957 | : `formData.append("question", "Hey, how are you?")\n` |
| 958 | } |
| 959 | return finalStr |
| 960 | } |
| 961 | |
| 962 | export const getConfigExamplesForPython = (configData, bodyType, isMultiple, stopNodeId) => { |
| 963 | let finalStr = '' |
no test coverage detected