Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
expect: function (stream, exercise, assert)Â {
stream.onValue(function (report)Â {
assert(report !== true);
});
c2.push(4000);
}
},
'Should not report if the limit is lower than the flow': {
input: [
c3,
Bacon.constant(false), // inCriticalMode
Bacon.constant(false), // onBreak
Bacon.constant(true), // isSingleGate
Bacon.constant(true), // systemActive
2000 // riverLimit
],
expect: function (stream, exercise, assert)Â {
stream.onValue(function (report)Â {
assert(report !== true);
});
c3.push(1000);
}
},
'Should not report if the workers are on a break': {
input: [
c4,
Bacon.constant(false), // inCriticalMode
Bacon.constant(true), // onBreak
state: (counter) => Bacon.constant(counter)
})
state: (filter) => Bacon.constant(filter)
})
state: (value) => Bacon.constant(value + 2)
})
function renderApp(p_route, favBus, volBus) {
var $main = document.createElement("main");
document.body.appendChild($main);
favBus = favBus || new Bacon.Bus();
volBus = volBus || new Bacon.Bus();
React.render(
,
$main
);
}
testRender(<a style="{Bacon.constant({color:" href="#lol">
{Bacon.constant("Hello")} {Bacon.constant("world!")}
</a>,
'<a style="color:red" href="#lol">Hello world!</a>')
testRender(<div>{Bacon.later(1000,0)}</div>, "")
testRender(<div>{Bacon.later(1000,0).toProperty(1)}</div>, "<div>1</div>")
testRender(<div>{Bacon.later(1000,0)} {Bacon.constant(0)}</div>, "")
const Custom = ({prop, ...props}) => <div>{`${prop} ${JSON.stringify(props)}`}</div>
testRender(,
'<div>Bacon.constant(not-lifted) {}</div>')
testRender(,
'<div>lifted {}</div>')
testRender(,
'<div>lifted anyway {}</div>')
const Spread = props => <div>
testRender(
Hello {Bacon.constant("world!")}
,
'<div>Hello world!</div>')
testRender(<div><div>a</div>{[<div>b</div>, [<div>c</div>, [<div>d</div>]]]}</div>,
'<div><div>a</div><div>b</div><div>c</div><div>d</div></div>')
testRender(<div><div>a</div>{[<div>b</div>, Bacon.constant([<div>c</div>, [<div>d</div>]])]}</div>,</div>
function connect({providers, settings}) {
if (providers.length > 1) {
throw 'Only 1 data provider supported for now'
}
if (providers.length === 0) {
return {
connectionState: Bacon.constant('disconnected'),
selfData: Bacon.constant({}),
aisData: Bacon.constant({})
}
}
const provider = providers[0]
if (provider.type === 'signalk') {
return SignalkProvider({address: provider.address, settings})
} else if (provider.type === 'geolocation') {
return GeolocationProvider({settings})
} else {
throw `Unsupported provider ${provider}`
}
}
module.exports = connect
get: function() {
return Bacon.constant(get(storage, name) || []);
},
set: function(songs) {
export default function combineVDOM(vdom) {
const obs = resolveObservables(vdom, [])
if (isEmpty(obs)) {
return Bacon.constant(vdom)
} else {
return Bacon
.combineAsArray(obs)
.map(values => assignObservableValues(vdom, zip(obs, values)))
}
function resolveObservables(el, obs) {
const propKeys = Object.keys(el.props || {})
for (let k = 0 ; k < propKeys.length ; k++) {
const key = propKeys[k]
const prop = el.props[key]
if (key === "children") {
const children = isArray(prop) ? prop : [ prop ]
for (let i = 0 ; i < children.length ; i++) {
const child = children[i]
if (isObs(child) && !contains(obs, child)) {