Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
enabled
}) => (
<button>
);
const root$ = Kefir.pool();
render();
expect(root$).toEmit([value({ type: 'EMITTED' })], () => {
send(source$, [value({ type: 'EMITTED' })]);
});
expect(combine).toHaveBeenCalledTimes(1);
expect(combine).toHaveBeenCalledWith(
expect.any(Kefir.Observable),
{
onButtonClick$: expect.any(Kefir.Observable),
children$: expect.any(Kefir.Observable)
},
{ text: 'Click me', enabled: true }
);
});
</button>
const testEq = (expr, expect) => it(`${expr} => ${show(expect)}`, done => {
const actual = eval(`(Atom, K, Kefir, R, bind, bindProps, classes) => ${expr}`)(Atom, K, Kefir, R, bind, bindProps, classes)
const check = actual => {
if (!R.equals(actual, expect))
throw new Error(`Expected: ${show(expect)}, actual: ${show(actual)}`)
done()
}
if (actual instanceof Kefir.Observable)
actual.take(1).onValue(check)
else
check(actual)
})
Molecule,
MutableWithSource,
holding
} from '../dist/kefir.atom.cjs'
function show(x) {
switch (typeof x) {
case 'string':
case 'object':
return JSON.stringify(x)
default:
return `${x}`
}
}
Kefir.Observable.prototype.orAsync = function(y) {
return this.merge(Kefir.later(0, y))
}
const objectConstant = {x: 1}
const toExpr = f =>
f
.toString()
.replace(/\s+/g, ' ')
.replace(/^\s*function\s*\(\s*\)\s*{\s*(return\s*)?/g, '')
.replace(/\s*;?\s*}\s*$/g, '')
.replace(/function\s*(\([a-zA-Z0-9, ]*\))\s*/g, '$1 => ')
.replace(/\(([a-z]+)\)\s*=>/g, '$1 =>')
.replace(/{\s*return\s*([^{;]+)\s*;\s*}/g, '$1')
.replace(/\(0, [^.]*[.]([^)]*)\)/g, '$1')
.replace(/_kefirAtom[.]/g, '')
var isObservable = function isObservable(x) {
return x instanceof K.Observable;
};
const isObservable = x => x instanceof K.Observable
const isProperty = x => x instanceof K.Property
export default function domDelta({ el, view, selectProps }) {
let precheck$ = Kefir.constant('Configuration correct');
if (typeof el === 'function') {
el = el(document);
if (!(el instanceof Kefir.Observable)) {
precheck$ = Kefir.constantError(new TypeError(`type ${typeof el} returned from el is not valid`));
}
} else if (el instanceof Element) {
el = Kefir.constant(el);
} else {
precheck$ = Kefir.constantError(new TypeError(`el of type ${typeof el} is not valid`));
}
if (typeof view !== 'function') {
precheck$ = Kefir.constantError(new TypeError(`component of type ${typeof el} is not valid`));
}
if (typeof selectProps !== 'function') {
precheck$ = Kefir.constantError(new TypeError(`selectProps of type ${typeof el} is not valid`));
}
export const isObs = x => x instanceof Kefir.Observable;
function forEach(template, fn) {
if (template instanceof Kefir.Observable) {
fn(template)
} else {
const constructor = template && template.constructor
if (constructor === Array)
for (let i=0, n=template.length; i
const isObservable = x => x instanceof K.Observable
var isObservable = function isObservable(x) {
return x instanceof K.Observable;
};
var isProperty = function isProperty(x) {