Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
type Second = 'second';
let observable32: Stream = Kefir.sequentially(100, ['first', 'second']).filter((value): value is First => value === 'first');
}
// Combine observables
{
{
let a: Stream = Kefir.sequentially(100, [1, 3]);
let b: Stream = Kefir.sequentially(100, [2, 4]).delay(40);
let observable01: Observable = Kefir.combine([a, b], (a, b) => a + b);
}
{
let a: Stream = Kefir.sequentially(100, [1, 3]);
let b: Stream = Kefir.sequentially(100, [2, 4]).delay(40);
let c: Stream = Kefir.sequentially(60, [5, 6, 7]);
let observable02: Observable = Kefir.combine([a, b], [c], (a, b, c) => a + b + c);
}
{
let a: Stream = Kefir.sequentially(100, [0, 1, 2, 3]);
let b: Stream = Kefir.sequentially(160, [4, 5, 6]);
let c: Property = Kefir.sequentially(100, [8, 9]).delay(260).toProperty(() => 7);
let observable03: Observable = Kefir.zip([a, b, c]);
}
{
let a: Stream = Kefir.sequentially(100, [0, 1, 2]);
let b: Stream = Kefir.sequentially(100, [0, 1, 2]).delay(30);
let c: Stream = Kefir.sequentially(100, [0, 1, 2]).delay(60);
let abc: Observable = Kefir.merge([a, b, c]);
}
{
let a: Stream = Kefir.sequentially(100, [0, 1, 2]);
let b: Stream = Kefir.sequentially(100, [3, 4, 5]);
const [setMediumUIConfig, kMediumUIConfig] = createBusProperty(localStorageJSON("uiMediumUIConfig", 'A'));
const [setSmallUIConfig, kSmallUIConfig] = createBusProperty(localStorageJSON("uiSmallUIConfig", 'Artist'));
const kUIConfigSetter = K.combine([kIsLargeUI, kIsMediumUI], (isLargeUI, isMediumUI) => {
if (isLargeUI) return setLargeUIConfig;
if (isMediumUI) return setMediumUIConfig;
return setSmallUIConfig;
}).toProperty(() => setLargeUIConfig);
const kUIConfigOptions = K.combine([kIsLargeUI, kIsMediumUI], (isLargeUI, isMediumUI) => {
if (isLargeUI) return largeUIOptions;
if (isMediumUI) return mediumUIOptions;
return smallUIOptions;
}).toProperty(() => largeUIOptions);
const kUIConfig = K.combine([kIsLargeUI, kIsMediumUI])
.flatMapLatest(([isLargeUI, isMediumUI]) => {
if (isLargeUI) return kLargeUIConfig;
if (isMediumUI) return kMediumUIConfig;
return kSmallUIConfig;
}).toProperty(() => largeUIOptions.B);
/* local storage sync */
kLargeUIConfig.onValue((v) => localStorage.uiLargeUIConfig = JSON.stringify(v));
kMediumUIConfig.onValue((v) => localStorage.uiMediumUIConfig = JSON.stringify(v));
kSmallUIConfig.onValue((v) => localStorage.uiSmallUIConfig = JSON.stringify(v));
export {
kIsInfoModalOpen,
kInfoModalTrack,
openInfoModal,
let selectedRelations = selected;
// we need to remove old selected value if it is date-range or numeric-range
// because there can be only one range selected for a given relation
if (relationType === SearchModel.TemporalDisjunctKinds.DateRange
|| relationType === SearchModel.NumericRangeDisjunctKind
) {
selectedRelations = selected.delete(value.relation);
}
let selectedValues = selectedRelations.get(value.relation) || List();
selectedValues = selectedValues.push(value.value);
this.selectedValues(selectedRelations.set(value.relation, selectedValues));
}
);
// update list of selected facet values on the de-selection of some facet value
Kefir.combine(
{value: this.deselectValueAction.$property},
{selected: this.selectedValues.$property}
).onValue(
({value, selected}) => {
const selectedValues =
selected.get(value.relation).filterNot(
selectedValue => F.partialValueEquals(value.value, selectedValue)
) as List;
this.selectedValues(selected.set(value.relation, selectedValues));
}
);
// update facet AST when list of selected values changes
this.selectedValues.$property.map(this.buldAst).onValue(this.ast);
// update faceted query when AST changes
.flatMapLatest((count) => {
const missing = {};
const numbers = [];
for (let i = 0; i < count; i++) {
numbers.push(i);
missing[i] = true;
this.getProperty(`playlist/${i}/filename`);
const j = i;
setTimeout(() => {
if (missing[j]) {
console.warn("Re-fetching missing playlist filename", j);
this.getProperty(`playlist/${j}/filename`);
}
}, 500);
}
return K.combine(numbers.map((i) => {
return this.kPropertyChanges
.filter(({name}) => name === `playlist/${i}/filename`)
.take(1)
.map(({data}) => {
delete missing[i];
return data;
})
}));
}).toProperty(() => []));
}).toProperty(() => null);
};
const kVolume = forwardPlayerProperty('kVolume');
const kIsPlaying = forwardPlayerProperty('kIsPlaying');
const kPlaybackSeconds = forwardPlayerProperty('kPlaybackSeconds');
const kPath = forwardPlayerProperty('kPath');
const kPlaylistCount = forwardPlayerProperty('kPlaylistCount');
const kPlaylistIndex = forwardPlayerProperty('kPlaylistIndex');
const kPlaylistPaths = forwardPlayerProperty('kPlaylistPaths');
const kPlayingTrack = createKPathToTrack(kPath);
const kPlaylistTracks = keepAlive(
K.combine([kBeetsWebURL, kPlaylistPaths])
.flatMapLatest(([url, paths]) => {
if (!paths) return K.once([]);
return K.combine(paths.map(createURLToKTrack.bind(this, url)));
})
.toProperty(() => []));
const kLastFM = K.combine([kPlayingTrack, kLastFMAPIKey])
.flatMapLatest(([track, lastFMAPIKey]) => {
if (!track || !lastFMAPIKey) return K.constant(null);
return K.fromPromise(window.fetch(
`http://ws.audioscrobbler.com/2.0/?method=album.getinfo&api_key=${
lastFMAPIKey
}&artist=${
track.artist
}&album=${
.merge(kURLDataChanges.map(keyMapper('album')))
.skipDuplicates()
.toProperty(() => getURLData()['album'])
keepAlive(kAlbum);
function getTrackList(beetsWebURL, album_id, albumartist) {
if (!album_id && !albumartist) return new Promise((resolve, reject) => {
resolve([]);
});
const url = `${beetsWebURL}/item/query/${albumQueryString({albumartist, album_id})}`;
return window.fetch(url)
.then((response) => response.json())
.then(({results}) => results)
}
const kTrackList = K.combine([kBeetsWebURL, kArtist, kAlbum])
.flatMapLatest(([beetsWebURL, artist, album]) => {
return K.fromPromise(getTrackList(beetsWebURL, album, artist));
})
.toProperty(() => []);
const [setTrackIndex, bTrackIndex] = createBus()
const kTrackIndex = bTrackIndex
.merge(kTrackList.changes().map(() => null))
.toProperty(() => null);
keepAlive(kTrackIndex);
const kTrack = K.combine([kTrackList, kTrackIndex], (trackList, trackIndex) => {
if (trackIndex === null) return null;
if (trackList.length < 1) return null;
if (trackIndex >= trackList.length) return null;
return trackList[trackIndex];
function show(_) {
var n = arguments.length - 1;
var xs = Array(n);
for (var i = 0; i < n; ++i) {
xs[i] = arguments[i];
}var iso = F.combine(xs, showIso);
var s = arguments[n];
return isStream(s) ? isProperty(iso) ? K.combine([iso, s], L.get) : mapValue(L.get(iso), s) : view(iso, s);
}
return (assertion: Assertion) => {
const assertionIri = assertion.iri.getOrElse(
Rdf.iri(`${assertion.field.iri}/assertion/${uuid.v4()}`)
);
return Kefir.combine(
_.map(assertion.beliefs, getBeliefGraphs)
).map<[Rdf.PointedGraph, Array]>(
beliefGraphs => {
const allBeliefs = _.flatten(beliefGraphs);
return [
evaluateAssertion(context, assertionIri)(assertion, allBeliefs),
_.map(allBeliefs, b => b.pointer)
];
}
).flatMap(
([assertionPg, bs]) => {
const service = new LdpService(rso.AssertionsContainer.value);
if (assertion.iri.isJust) {
return service.update(assertion.iri.get(), assertionPg.graph).map(
_ => ({assertion: assertion.iri.get(), beliefs: bs})
);
componentDidMount() {
this.cancellation.map(
Kefir.combine({
data: NamespaceService.getNamespaceRecords(),
appStatus: ConfigService.getStorageStatus(),
})
).observe({
value: ({data, appStatus}) => {
const selectedAppId = chooseDefaultTargetApp(appStatus);
this.setState({isLoading: false, data, appStatus, selectedAppId});
},
error: loadingError => this.setState({isLoading: false, loadingError}),
});
}
Inference: inference =>
Kefir.combine(
inference.premises.map(getBeliefGraphs)
).map(x => _.flatten(x)).toProperty(),
BeliefAdoption: beliefAdoption => getBeliefGraphs(beliefAdoption.belief),