in packages/flow-dev-tools/src/record/recordRunner.js [37:67]
function suggestionToString(suggestion, indentSize): string {
const args = suggestion.args
.map(arg => {
switch (typeof arg) {
case 'string':
if (arg.split('\n').length === 1) {
return format('`%s`', escapeString(arg));
} else {
return format('`\n%s\n`', indent(escapeString(arg), 2));
}
case 'number':
return format('%d', arg);
case 'object':
return format('%s', JSON.stringify(arg, null, 2));
default:
throw new Error('Unhandled arg type');
}
})
.map(line => line + ',\n')
.join('');
if (suggestion.args.length === 0) {
return format('%s()', suggestion.method);
} else {
return format(
'%s(\n%s%s)',
suggestion.method,
indent(args, indentSize),
Array(indentSize - 1).join(' '),
);
}
}