Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const sinks = {
DOM: appView(sandbox.DOM),
store: Observable.merge(route$, sandbox.data)
.scan(merge, {}),
};
return sinks;
}
// Note: drivers use xstream
function dummyDriver(initialValue) {
return (value$) => value$.remember().startWith(initialValue);
}
run(main, {
DOM: makeDOMDriver('#app-container'),
store: dummyDriver({}),
});
*/
if (process.env.NODE_ENV !== 'production') {
middlewares.push(require('redux-freeze')); // eslint-disable-line global-require
}
const store = createStore(
reducer,
initialState,
composeEnhancers(applyMiddleware(...middlewares)),
);
/**
* redux-cycles
* Remind: MUST create sotre first.
*/
run(main, {
ACTION: makeActionDriver(),
STATE: makeStateDriver(),
Time: timeDriver,
HTTP: makeHTTPDriver(),
STORAGE: storageDriver,
});
return store;
};
, scan$: scanner$
}
}
const keyMarker = '?access-key='
function parseQR(url) {
const p = urlutil.parse(url)
return (p && p.host)
? { serverUrl: p.search ? url.substr(0, url.indexOf('?')) : url
, accessKey: p.search && p.search.startsWith(keyMarker) ? p.search.substr(keyMarker.length) : null }
: null
}
run(main, {
DOM: makeDOMDriver('#app')
, IPC: process.env.BUILD_TARGET === 'electron'
? require('./driver/electron-ipc')
: _ => _ => O.of() // noop driver
, storage: storageDriver
, route: makeRouteDriver(makeHashHistoryDriver())
, conf$: makeConfDriver(storageDriver)
, scan$: process.env.BUILD_TARGET === 'cordova'
? require('./driver/cordova-qrscanner')
: require('./driver/instascan')({ mirror: false, backgroundScan: false })
})
})},
{
type: Update,
name: 'not-found',
component: ({ props }) => {
t.fail(`wrong command \`${props[0]}\``)
}}
]
let main = (s: Sources) => ({
bot: $.from([
matchStream(s.bot.events('message').filter(entityIs('bot_command')), plugins, s)
.pluck('bot')
.mergeAll()
])
})
let { sources, run } = Cycle(main, { bot: basicDriver })
run()
okTake(t, sources, (message) => {
t.ok(Message.is(Message(message)), 'message satisfies typecheck')
t.ok(
/\/(help)(?:@goodmind_test_bot)?(\s+(.+))?/.test(message.reply_to_message.text),
'reply to message text should match `/help` command pattern')
t.equal(
message.text,
'Cycle Telegram v1.1.1 (https://git.io/vrs3P)',
'message text should be equal to `Cycle Telegram v1.1.1 (https://git.io/vrs3P)`')
t.end()
})
})
test('should send location with basic driver', t => {
let basicDriver = makeTelegramDriver(ACCESS_TOKEN, { skipUpdates: true })
let main = () => ({
bot: $.from([
$.of(sendLocation(
{ chat_id: GROUP_ID, latitude: 55.751244, longitude: 37.618423 },
{}))
])
})
let { sources, run } = Cycle(main, { bot: basicDriver })
run()
okTake(t, sources, (message) => {
t.ok(Message.is(Message(message)), 'message satisfies typecheck')
t.ok(message.hasOwnProperty('location'), 'message has property location')
t.end()
})
})
function main(sources) {
const List = makeCollection({
item: child,
collectSinks: instances => ({
onion: instances.pickMerge('onion')
}),
});
const obs = List(sources).onion;
t.is(typeof obs.switchMap, 'function');
return {
onion: Observable.never(),
};
}
run(onionify(main), {dummy: () => {}});
});
}));
appList$.subscribe(s => console.log(`Search Term: \'${s.filter}\' | Filtered Doc List: `, s.list));
const vdom$ = appList$.map(m => div('.container', [
input('.input'),
ul('.application-list', { style: { 'list-style-type': 'none', 'padding': '0px' } },
m.list.map(n => li('.application-list-item', n.qDocName)))
]));
return {
DOM: vdom$
};
}
run(main, {
DOM: makeDOMDriver('#app-container'),
});
appList$.subscribe(s => console.log(`Search Term: \'${s.filter}\' | Filtered Doc List: `, s.list));
const vdom$ = appList$.map(m => div('.container', [
input('.input', { attr: { 'placeholder': 'Filter' } }),
ul('.application-list', { style: { 'list-style-type': 'none', 'padding': '0px' } },
m.list.map(n => li('.application-list-item', [
div(n.qDocName + ` (${n.server})`)
])))
]));
return {
DOM: vdom$
};
}
run(main, {
DOM: makeDOMDriver('#app-container'),
});
.then(() => {
run(App, drivers);
})
.catch(function (err) {
ul([
li(['Option 1']),
li(['Option 2']),
li(['Option 3']),
li(['Option 4']),
li(['Option 5']),
li(['Option 6'])
])
);
return {
DOM: vdom$
};
}
run(main, {
DOM: makeDOMDriver('#app'),
drag: userSelectDriver
});