Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.flatMap(block => {
// find where our challenge lies in the block
const challengeIndex$ = Observable.from(
block.challenges,
null,
null,
Scheduler.default
)
.findIndex(({ id }) => id === challengeId);
// grab next challenge in this block
return challengeIndex$
.map(index => {
return block.challenges[index + 1];
})
.flatMap(nextChallenge => {
if (!nextChallenge) {
return firstChallengeOfNextBlock$;
}
it('should not work after has been disposed', function (done) {
const number$ = Observable.from([1, 2, 3])
.concatMap(x => Observable.of(x).delay(50))
function app () {
return {
DOM: number$.map(number =>
h3('.target', String(number))
)
}
}
const {sinks, sources} = Cycle.run(app, {
DOM: makeDOMDriver(createRenderTarget())
})
sources.DOM.select(':root').elements.skip(1).subscribe(function (root) {
const selectEl = root.querySelector('.target')
.flatMap(challengeSpec => {
return Observable.from(challengeSpec.challenges);
})
.filter(({ challengeType }) => challengeType !== modern)
let main = ({ bot }: Sources) => ({
bot: $.from([
bot.events('inline_query')
.do(() => bot.dispose())
.map(answerInlineQuery(results))
])
})
let { sources, run } = Cycle(main, { bot: basicDriver })
function buildChallengeMap(userId, completedChallenges = [], User) {
return Observable.from(
completedChallenges,
null,
null,
Scheduler.default
)
.map(challenge => {
return challenge && typeof challenge.toJSON === 'function' ?
challenge.toJSON() :
challenge;
})
.map(updateId)
.filter(({ id, _id }) => ObjectID.isValid(id || _id))
.map(updateName)
.reduce((challengeMap, challenge) => {
const id = challenge.id || challenge._id;
preloadDictionaries(languageList=null) {
return Observable.from(languageList || getInstalledKeyboardLanguages())
.flatMap((x) => Observable.fromPromise(this.loadDictionaryForLanguage(x, true)))
.reduce((acc,x) => { acc.push(x); return acc; }, [])
.toPromise();
}
}
.flatMap(({ entities, result, redirect } = {}) => {
const actions = [
fetchChallengeCompleted({
entities,
currentChallenge: result.challenge,
challenge: entities.challenge[result.challenge],
result
}),
redirect ? delayedRedirect(redirect) : null
];
return Observable.from(actions).filter(Boolean);
})
.catch(createErrorObservable);
export function fetch({ fetchContext = [] }) {
if (fetchContext.length === 0) {
log('empty fetch context found');
return Observable.just(fetchContext);
}
return Observable.from(fetchContext, null, null, Scheduler.default)
.doOnNext(({ name }) => log(`calling ${name} action creator`))
.map(({ action, actionArgs }) => action.apply(null, actionArgs))
.doOnNext(fetch$ => {
if (!Observable.isObservable(fetch$)) {
throw new Error(
'action creator should return an observable'
);
}
})
.map(fetch$ => fetch$.doOnNext(action => log('action', action.type)))
.mergeAll()
.doOnCompleted(() => log('all fetch observables completed'));
}
.flatMap(challengeMap => {
return Observable.from(Object.keys(challengeMap))
.map(key => challengeMap[key]);
})
.filter(challenge => {
.map(buckets => {
return Observable.from(buckets).flatMapWithMaxConcurrent(1, bucket => {
return mergeSort(_.map(eventsList, event => {
return this.client
.paginate(this.buildQuery(lastEvent, bucket, event), completions)
.map(row => this.deserializer.toEvent(row));
}));
});
})
.concatAll();