Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.chain(() => {
const result = this.commands[commandName](this.config.toConfig(), this);
return Future.isFuture(result) ?
result :
Future.tryP(() => Promise.resolve().then(() => result));
})
// Trigger all post-command events, resolving with the value of the command execution
const runAction = (name, action, req, res, next) => {
const ret = action (req, res.locals);
if (!isFuture (ret)) {
throw new TypeError (
`The "${name}" action did not return a Future, instead saw:\n\n ${ret}`
);
}
fork (next) (val => {
if (!Response.is (val)) {
throw new TypeError (`The Future returned by the "${
name
}" action did not resolve to a Response, instead saw:\n\n ${val}`);
}
val.cata ({
Stream: (code, mime, stream) => {
res.type (mime);
res.status (code);
function FlutureTMonetEither(monad) {
if (isUndefined(new.target)) {
if (isFuture(monad)) {
return FlutureTMonetEither.fromFuture(monad);
} else if (monad instanceof Identity.fn.init) {
return FlutureTMonetEither.fromValue(monad.get());
} else if (monad instanceof Either.fn.init) {
return FlutureTMonetEither.fromEither(monad);
}
throw new Error('FlutureTMonetEither can transform only specific monad types');
}
this.run = monad;
this['@@type'] = this.constructor['@@type'];
}