How to use the fluture.map function in fluture

To help you get started, we’ve selected a few fluture examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Astrocoders / postgres-orm / src / PostgreSQLORM.ts View on Github external
const mapResults = (result: Future.FutureInstance) =>
    // @ts-ignore
    result.pipe(Future.map(value => value.rows)).pipe(Future.map(R.map(data => new entityMapperClass(data))))
github neutrinojs / neutrino / packages / neutrino / src / webpack.js View on Github external
// compile :: Object config -> Future Error Object
const compile = pipe(
  compiler,
  Future.chain(compiler => Future((reject, resolve) => {
    compiler.run((err, stats) => {
      const errors = getErrors(err, stats);

      isEmpty(errors) ? resolve(stats) : reject(errors);
    });
  }))
);

// devServer :: Object config -> Future Error Object
const devServer = pipe(
  compiler,
  Future.map(compiler => Object.assign(new DevServer(compiler, compiler.options.devServer), { compiler }))
);

// serve :: Object config -> Future Error Object
const serve = pipe(
  devServer,
  Future.chain(server => Future((reject, resolve) => {
    const { compiler } = server;
    const { host, port } = compiler.options.devServer;

    server.listen(port, host, () => resolve(compiler));
  }))
);

// validator :: Object config -> Future Error Object
const validator = pipe(Future.of, Future.ap(Future.of(webpack.validate)));
github arrterian / nix-env-selector / src / extension.ts View on Github external
apNixConfigPath =>
              parallel(
                1,
                apNixConfigPath([
                  Action.updateEditorConfig(
                    SELECTED_ENV_CONFIG_KEY,
                    config,
                    workspaceRoot
                  ),
                  flow(
                    Action.applyEnvByNixConfPath(getShellCmd("env")),
                    map(showStatus(Label.SELECTED_ENV_NEED_RELOAD, none))
                  ),
                  Action.askReload
                ])
              ).map(some)
          )