How to use monet - 10 common examples

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 aappddeevv / dynamics-client-ui / packages / dynamics-client-ui / src / Dynamics / EntityForm.tsx View on Github external
const x: Array> = attributes.map(logicalName => {
        const existing = state[logicalName]
        if (existing) return Maybe.Some(existing)
        // get Dynamics attribute
        const attribute = getAttribute(logicalName)
        if (attribute) {
            const token = ctx => onChangeHandler(logicalName, attribute.getValue())
            attribute.addOnChange(token)
            // set hasValue
            const value = attribute.getValue()
            const hasValue = attribute ? (value !== null) : false
            return Maybe.Some({
                name: logicalName, logicalName, attribute, hasValue, unregisterToken: token, value,
            } as Attribute)
        }
        else {
            // throw an error?
            if (DEBUG) console.log("connect: Unable to connect:", logicalName)
            return Maybe.None>()
github aappddeevv / dynamics-client-ui / packages / dynamics-client-ui / src / Dynamics / EntityForm.tsx View on Github external
// get Dynamics attribute
        const attribute = getAttribute(logicalName)
        if (attribute) {
            const token = ctx => onChangeHandler(logicalName, attribute.getValue())
            attribute.addOnChange(token)
            // set hasValue
            const value = attribute.getValue()
            const hasValue = attribute ? (value !== null) : false
            return Maybe.Some({
                name: logicalName, logicalName, attribute, hasValue, unregisterToken: token, value,
            } as Attribute)
        }
        else {
            // throw an error?
            if (DEBUG) console.log("connect: Unable to connect:", logicalName)
            return Maybe.None>()
        }
    }).filter(aOpt => aOpt.isSome()).map(aOpt => aOpt.some())
    return { ...state, ...normalizeWith("logicalName", x) }
github aappddeevv / dynamics-client-ui / packages / dynamics-client-ui-react / src / components / AddressManager / AddressEditor.tsx View on Github external
protected handleChange = (id: string, value: any): void => {
        if (DEBUG) console.log(`${NAME}.handleChange: id: `, id, "value: ", value)
        this.setState({
            buffer: this.state.buffer.map(b => ({ ...b, [id]: value }))
                // @ts-ignore: buffer is copy and more!, actually this should never happen!
                .orElse(Maybe.pure({ [id]: value })),
            changed: [id, ...this.state.changed]
        }, () => {
            console.log(`${NAME}.handleChange: updated buffer is`, this.state.buffer, this.state.changed)
        })
        if (!this.props.isDirty) this.props.setDirty(true)
    }
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 char0n / monad-t / tonicExample.js View on Github external
require('fantasy-land');
const { Future } = require('fluture');
const { Identity, Either } = require('monet');

const { MonetEitherT: EitherT } = require('monad-t');
const { FlutureTMonetEither: FutureTEither } = require('monad-t');


EitherT(Identity.of(1)); // => Either.Right(1)

FutureTEither.of(Future.of(Either.Right(1))); // => FlutureTMonetEither(1)
github neos / neos-ui / packages / neos-ui-editors / src / SecondaryEditors / ImageCropper / model.js View on Github external
            .bind(aspectRatio => Maybe.fromNull(
                //
                // Read out aspect ratio options and filter them
                //
                values(options).filter(o => o && (o.width / o.height).toFixed(2) === aspectRatio.toFixed(2))[0]
            ))
            .map(o => new ConfiguredAspectRatioStrategy(o.width, o.height, o.label))
github aappddeevv / dynamics-client-ui / packages / dynamics-client-ui-react / src / components / AddressManager / AddressEditor.tsx View on Github external
constructor(props) {
        super(props)
        this.state = {
            items: [],
            selected: Maybe.None(),
            buffer: Maybe.None(),
            changed: [],
        }
        this.selection = new Selection({
            onSelectionChanged: this.onSelectionChanged,
            // only used on setItems, so useless in restricting selection
            //canSelectItem: this.canSelectItem,
        })
    }
    private selection: ISelection
github aappddeevv / dynamics-client-ui / packages / dynamics-client-ui-react / src / components / AddressManager / AddressEditor.tsx View on Github external
constructor(props) {
        super(props)
        this.state = {
            items: [],
            selected: Maybe.None(),
            buffer: Maybe.None(),
            changed: [],
        }
        this.selection = new Selection({
            onSelectionChanged: this.onSelectionChanged,
            // only used on setItems, so useless in restricting selection
            //canSelectItem: this.canSelectItem,
        })
    }
    private selection: ISelection
github kepta / idly / packages / idly-state / src / osmState / index.ts View on Github external
export const osmStateShred: OsmStateShredType = ([state, log]) => {
  const newState = Identity(setClone(logGetEveryId(log)))
    .map(idsToSave => setAddIterable(logGetBaseIds(log), idsToSave))
    .map(idsToSave => expandIdsAndRelated(idsToSave, state.getElementTable()))
    .map(entityTable => State.create(entityTable))
    .get();

  // @TOFIX reliance on ''
  newState.getQuadkeysTable().set('', setClone(logGetEveryId(log)));

  return [newState, log];
};
github neos / neos-ui / packages / neos-ui-editors / src / SecondaryEditors / ImageCropper / model.js View on Github external
get aspectRatioDimensions() {
        const {width, height} = this.aspectRatioStrategy;

        return width && height ? Some({width, height}) : None();// eslint-disable-line babel/new-cap
    }