src/api/models.js
function _action(type, payload, checklist, optional = []) {
  for (let checkitem of ['namespace', ...checklist]) {
    if (optional.indexOf(checkitem) === -1) {
      assert(payload[checkitem], `api/models/${type}: payload should have ${checkitem}`);
    }
  }

  const filePath = join(payload.sourcePath, payload.filePath);
  const source = readFile(filePath);
  const root = j(source);
  const models = root.findModels(payload.namespace);
  const args = checklist.map(checkitem => payload[checkitem]);
  models[type].apply(models, args);
  writeFile(filePath, root.toSource());
}
function _action(type, payload, checklist, optional = []) {
  for (let checkitem of ['namespace', ...checklist]) {
    if (optional.indexOf(checkitem) === -1) {
      assert(payload[checkitem], `api/models/${type}: payload should have ${checkitem}`);
    }
  }

  const filePath = join(payload.sourcePath, payload.filePath);
  const source = readFile(filePath);
  const root = j(source);
  const models = root.findModels(payload.namespace);
  const args = checklist.map(checkitem => payload[checkitem]);
  models[type].apply(models, args);
  writeFile(filePath, root.toSource());
}
private