How to use the fp-ts/lib/Option.some function in fp-ts

To help you get started, we’ve selected a few fp-ts 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 mikearnaldi / matechs-effect / packages / effect / src / stream / index.ts View on Github external
T.async(res => {
          if (leftover.length > 0) {
            res(Ei.right(O.some(leftover.splice(0, batch))));
          } else {
            if (errors.length > 0) {
              res(Ei.left(errors[0]));
            } else {
              if (open) {
                res(Ei.right(O.some([])));
              } else {
                res(Ei.right(O.none));
              }
            }
          }

          // tslint:disable-next-line: no-empty
          return () => {};
        }),
        every
github gcanti / money-ts / test / io-ts.ts View on Github external
it('decode', () => {
      const one = dense.getOne('EUR')
      const zero = dense.getZero('EUR')
      const T = getDense('EUR')
      assert.deepEqual(fromEither(T.decode(1)), none)
      assert.deepEqual(fromEither(T.decode([1, 0])), none)
      assert.deepEqual(fromEither(T.decode([1, 1])), some(one))
      assert.deepEqual(fromEither(T.decode([0, 1])), some(zero))
      assert.deepEqual(fromEither(T.decode([1.1, 1])), none)
    })
github devexperts / dx-platform / packages / react-kit / src / components / DateInput / DateInput.model.ts View on Github external
export const toObjectDate = (date: Date): TDateInputValue => ({
	day: some(date.getDate()),
	month: some(date.getMonth()),
	year: some(date.getFullYear()),
});
github devexperts / swagger-codegen-ts / src / language / typescript.ts View on Github external
const serializeParametersDescription = (query: QueryParameterObject[], body: BodyParameterObject[]): Option => {
	const parameters = [...query, ...body];
	return parameters.length === 0
		? none
		: some(hasRequiredParameters(parameters) ? '@param { object } parameters' : '@param { object } [parameters]');
};
github rzeigler / waveguide / src / support / list.ts View on Github external
export function find<a>(list: List</a><a>, f: Predicate</a><a>): Option</a><a> {
  let iter = list;
  while (isCons(iter)) {
    if (f(iter.head)) {
      return some(iter.head);
    }
    iter = iter.tail;
  }
  return none;
}
</a>
github typebytes / ngx-template-streams / projects / ngx-template-streams / src / internal / event-binding-engine.ts View on Github external
function getTemplateOperations(eventBindings: Array, isInlineTemplate: boolean) {
  const operations = eventBindings.map(([fullMatch, event, streamName, eventPayload]) =&gt; {
    const eventBinding = createEventBinding(event, streamName, eventPayload, isInlineTemplate);
    return createEventBindingOperation(fullMatch, eventBinding);
  });

  return some(operations);
}
github SamHH / bukubrow-webext / src / store / bookmarks / epics.ts View on Github external
export const initiateBookmarkEdit = (id: LocalBookmark['id']): ThunkAC => (dispatch) => {
	dispatch(setBookmarkEditId(O.some(id)));
	dispatch(setPage(Page.EditBookmark));
};
github teamdigitale / io-functions / lib / utils / azure_queues.ts View on Github external
export const getDelaySecForRetries = (
  retries: number,
  maxRetries = MAX_RETRIES,
  minBackoff = MIN_BACKOFF_MS
): Option =&gt;
  some(retries)
    .filter(nr =&gt; nr &lt;= maxRetries)
    .map(nr =&gt; Math.ceil((minBackoff * Math.pow(2, nr)) / 1000));