Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
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)
})
e => T.pure(O.some(Ei.left(e)))
)
export const toObjectDate = (date: Date): TDateInputValue => ({
day: some(date.getDate()),
month: some(date.getMonth()),
year: some(date.getFullYear()),
});
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]');
};
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>
function getTemplateOperations(eventBindings: Array, isInlineTemplate: boolean) {
const operations = eventBindings.map(([fullMatch, event, streamName, eventPayload]) => {
const eventBinding = createEventBinding(event, streamName, eventPayload, isInlineTemplate);
return createEventBindingOperation(fullMatch, eventBinding);
});
return some(operations);
}
export const initiateBookmarkEdit = (id: LocalBookmark['id']): ThunkAC => (dispatch) => {
dispatch(setBookmarkEditId(O.some(id)));
dispatch(setPage(Page.EditBookmark));
};
export const getDelaySecForRetries = (
retries: number,
maxRetries = MAX_RETRIES,
minBackoff = MIN_BACKOFF_MS
): Option =>
some(retries)
.filter(nr => nr <= maxRetries)
.map(nr => Math.ceil((minBackoff * Math.pow(2, nr)) / 1000));