24 lines
498 B
JavaScript
24 lines
498 B
JavaScript
|
|
exports.UserError = class extends Error {
|
|
constructor(message) {
|
|
super(message);
|
|
this.statusCode = 400;
|
|
}
|
|
};
|
|
|
|
exports.getFinalState = function(ctx) {
|
|
if (ctx.isNewInstance)
|
|
return ctx.instance;
|
|
if (ctx.currentInstance)
|
|
return Object.assign({},
|
|
ctx.currentInstance.__data,
|
|
ctx.data || ctx.instance
|
|
);
|
|
|
|
return null;
|
|
};
|
|
|
|
exports.isMultiple = function(ctx) {
|
|
return !ctx.isNewInstance && !ctx.currentInstance;
|
|
};
|