How to use the monet.Right function in monet

To help you get started, we’ve selected a few monet 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 Pomegranate / Pomegranate / Framework / discoverPlugins.js View on Github external
if (appMemberArr && appMemberArr.length) {
                // lineage.push(get('state.configuration.applicationMember', plugin))
                lineage = [...lineage, ...appMemberArr];
                appPlugin = true;
            }
            // This is everything but application Plugins
            // let r = Right(plugin.state).map((v) => {
            //
            //   v.parents = lineage
            //   v.moduleSrc = moduleSrc
            //   v.namespace = ns
            //   v.loadSrc = loadSrc
            //   v.application = appPlugin
            //   return v
            // })
            let r = monet_1.Right(plugin).map((p) => {
                p.loadMetadata = {
                    parents: lineage,
                    moduleSrc: moduleSrc,
                    namespace: ns,
                    loadSrc: loadSrc,
                    application: appPlugin
                };
                return p;
            })
                .cata(fail => {
                throw fail;
            }, fp_1.identity);
            return [r];
        });
    })();
github Pomegranate / Pomegranate / Framework / discoverPlugins.js View on Github external
const eitherUnwrapOrFail = (o, filename) => {
    return (fp_1.isFunction(fp_1.get('Plugin.getPlugin', o)))
        ? monet_1.Right(o.Plugin)
        : monet_1.Left(new Error(`${filename} failed to unwrap.`));
};
const eitherObjArrayOrErr = (o, filename) => {
github kepta / idly / packages / idly-state / src / dataStructures / set.ts View on Github external
public static right(val: T): Either {
    return Right(val);
  }
}
github kepta / idly / packages / idly-state / src / dataStructures / set.ts View on Github external
export const foldEitherArray = (arr: Array>) => {
  const result: K[] = [];
  for (const x of arr) {
    if (x.isLeft()) {
      return Left(x.left());
    }
    result.push(x.right());
  }
  return Right(result);
};
github kepta / idly / packages / idly-common / src / state2 / helper.ts View on Github external
export const foldEitherArray = (arr: Array>) => {
  const result: K[] = [];
  for (const x of arr) {
    if (x.isLeft()) {
      return Left(x.left());
    }
    result.push(x.right());
  }
  return Right(result);
};