How to use tsmonad - 10 common examples

To help you get started, we’ve selected a few tsmonad 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 Simon-Initiative / authoring-client / src / editors / content / items / DynaDropTargetItems.tsx View on Github external
onScoreEdit(response: contentTypes.Response, score: string) {
    const {
      itemModel,
      partModel,
      onEdit,
    } = this.props;

    const updated = response.with({ score: Maybe.just(score) });
    const newPartModel = partModel.with(
      { responses: partModel.responses.set(updated.guid, updated) });
    onEdit(itemModel, newPartModel, updated);
  }
github Simon-Initiative / authoring-client / src / editors / content / question / imagehotspot / ImageHotspot.tsx View on Github external
onScoreEdit(response: contentTypes.Response, score: string) {
    const { partModel, itemModel, onEdit } = this.props;

    const updatedScore = response.with({
      score: score === '' ? Maybe.nothing() : Maybe.just(score),
    });
    const updatedPartModel = partModel.with(
      { responses: partModel.responses.set(updatedScore.guid, updatedScore) },
    );

    onEdit(itemModel, updatedPartModel, updatedPartModel);
  }
github Simon-Initiative / authoring-client / src / editors / content / part / NumericFeedback.tsx View on Github external
onScoreEdit(response: contentTypes.Response, score: string) {
    const { model, onEdit } = this.props;

    onEdit(model.with({
      responses: model.responses.set(
        response.guid,
        model.responses.get(response.guid).with({
          score: score === '' ? Maybe.nothing() : Maybe.just(score),
        }),
      ),
    }));
  }
github Simon-Initiative / authoring-client / src / editors / content / question / multiplechoice / MultipleChoice.tsx View on Github external
onScoreEdit(response: contentTypes.Response, score: string) {
    const { partModel, itemModel, onEdit } = this.props;

    const updatedScore = response.with({
      score: score === '' ? Maybe.nothing() : Maybe.just(score),
    });
    const updatedPartModel = partModel.with(
      { responses: partModel.responses.set(updatedScore.guid, updatedScore) },
    );

    onEdit(itemModel, updatedPartModel, updatedPartModel);
  }
github Simon-Initiative / authoring-client / src / editors / content / question / ordering / Ordering.tsx View on Github external
onScoreEdit = (response: contentTypes.Response, score: string) => {
    const { partModel } = this.props;

    this.onPartEdit(
      partModel.with({
        responses: partModel.responses.set(
          response.guid,
          response.with({
            score: score === '' ? Maybe.nothing() : Maybe.just(score),
          }),
        ),
      }),
      null,
    );
  }
github Simon-Initiative / authoring-client / src / editors / content / learning / PulloutEditor.tsx View on Github external
onPulloutTypeChange(pulloutType) {
    const model = this.props.model.with({
      pulloutType: pulloutType === ''
        ? Maybe.nothing()
        : Maybe.just(pulloutType),
    });
    this.props.onEdit(model, model);
  }
github Simon-Initiative / authoring-client / src / data / content / workbook / multipanel / multipanel.ts View on Github external
const defaults = (params: Partial = {}) => ({
  contentType: 'Multipanel',
  elementType: 'multipanel',
  guid: params.guid || createGuid(),
  id: params.id || toContentId(createGuid()),
  purpose: params.purpose || Maybe.nothing(),
  title: params.title || Maybe.nothing(),
  imageHotspot: params.imageHotspot || new ImageHotspot(),
  panels: params.panels || Immutable.List(),
  introPanelRef: params.introPanelRef || Maybe.nothing(),
  inline: params.inline || new WbInline(),
});
github Simon-Initiative / authoring-client / src / data / content / workbook / multipanel / panel.ts View on Github external
const defaults = (params: Partial = {}) => ({
  contentType: 'Panel',
  elementType: 'panel',
  guid: params.guid || toContentId(createGuid()),
  id: params.id || createGuid(),
  title: params.title || Maybe.nothing(),
  content: params.content || ContentElements.fromText(
    '', createGuid(), [...INLINE_ELEMENTS, ...CONTROL_ELEMENTS]),
});
github Simon-Initiative / authoring-client / src / data / content / workbook / multipanel / image_hotspot.ts View on Github external
const defaults = (params: Partial = {}) => ({
  contentType: 'ImageHotspot',
  elementType: 'image_hotspot',
  guid: params.guid || createGuid(),
  id: params.id || toContentId(createGuid()),
  src: params.src || 'NO_IMAGE_SELECTED',
  alt: params.alt || '',
  width: params.width || 600,
  height: params.height || 400,
  visibility: params.visibility || Maybe.nothing(),
  hotspots: params.hotspots || Immutable.OrderedMap(),
});
github Simon-Initiative / authoring-client / src / reducers / analytics.ts View on Github external
const defaults = (params: Partial = {}) => ({
  requestedDataSetId: params.requestedDataSetId || Maybe.nothing(),
  dataSet: params.dataSet || Maybe.nothing(),
});

tsmonad

TsMonad - fun-size monads library for TypeScript

MIT
Latest version published 7 years ago

Package Health Score

51 / 100
Full package analysis

Popular tsmonad functions