【发布时间】:2018-02-02 19:20:50
【问题描述】:
有没有办法在sails.js v1.0 中的帮助程序中构造代码?
目前我有类似的东西:
module.exports = {
friendlyName: 'Example helper that does three things',
description: '',
inputs: {},
exits: {},
fn: async function (inputs, exits) {
const doFirstThing = function () {
// do something
};
const doSecondThing = function () {
// do something
};
const doThirdThing = function () {
// do something
};
doFirstThing();
doSecondThing();
doThirdThing();
},
};
doFirstThingdoSecondThingdoThirdThing这三个函数各有大约15行代码。现在,代码很难阅读。有没有办法将函数放在 fn 函数下方或以任何其他更具可读性的方式构造它?
【问题讨论】:
标签: javascript sails.js