Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function convertToConditionalStream (valueStream, statusStream) {
// Combine values with status to revert to last value when a reject is passed.
const init = {
savedValue: null,
currentValue: null,
lastStatus: null
}
const held = bacon.combineAsArray(valueStream, statusStream.toProperty(null))
.scan(init, ({ savedValue, currentValue, lastStatus }, [ value, status ]) => {
// See if the status was just set
const newStatus = lastStatus !== status
if (newStatus && status === 'hold') {
// Record the currentValue as the savedValue
return {
savedValue: currentValue,
currentValue,
lastStatus: status
}
} else if (!newStatus && status === 'hold') {
// Record the current value, and keep the savedValue unchanged
return {
savedValue,
currentValue: value,
function convertToConditionalStream (valueStream, statusStream) {
// Combine values with status to revert to last value when a reject is passed.
const init = {
savedValue: null,
currentValue: null,
lastStatus: null
}
const held = bacon.combineAsArray(valueStream, statusStream.toProperty(null))
.scan(init, ({ savedValue, currentValue, lastStatus }, [ value, status ]) => {
// See if the status was just set
const newStatus = lastStatus !== status
if (newStatus && status === 'hold') {
// Record the currentValue as the savedValue
return {
savedValue: currentValue,
currentValue,
lastStatus: status
}
} else if (!newStatus && status === 'hold') {
// Record the current value, and keep the savedValue unchanged
return {
savedValue,
currentValue: value,
items.flatMapLatest(items => Bacon.combineAsArray(
items.map(item => item.fields.map(".status").map(status => ({status, item})))
)).toProperty()
() =>
Bacon.combineAsArray(
markAndGetInlineImagesAndRemoveForbiddenOnes($editor).map(data =>
checkForImageLimit($editor, data, screenshotCountLimit)
.doError(() => onValueChanged(SCREENSHOT_LIMIT_ERROR()))
.flatMapLatest(() => Bacon.fromPromise(screenshotSaver(data)))
.doAction(screenShotUrl => data.$el.attr('src', screenShotUrl))
.doError(() => data.$el.remove())
)
).onValue(() => $editor.trigger('input')),
0
it("should be able to create an application for each instance type", function(done) {
var s_apps = Bacon.combineAsArray(_.map(instanceTypes, function(type) {
return app.create(api, "My node application", type, "par");
}));
s_apps.subscribe(function(event) {
expect(event.hasValue()).to.equal(true);
expect(event.value().length).to.equal(instanceTypes.length);
done();
return Bacon.noMore;
});
});
});
.flatMapLatest(([appData, fullCommitId, remoteCommitId]) => {
const commitId = fullCommitId || remoteCommitId;
if (commitId != null) {
const cacheSuffix = withoutCache ? ' without using cache' : '';
Logger.println(`Restarting ${appData.name} on commit ${colors.green(commitId)}${cacheSuffix}`);
}
const s_redeploy = Application.redeploy(api, appData.app_id, appData.org_id, fullCommitId, withoutCache);
return Bacon.combineAsArray(s_redeploy, appData, remoteCommitId);
})
.flatMapLatest(([redeploy, appData, remoteCommitId]) => {
function importEnv (api, params) {
const { alias } = params.options;
const s_appData = AppConfig.getAppData(alias);
const s_vars = variables.readFromStdin();
const s_result = Bacon.combineAsArray(s_appData, s_vars)
.flatMapLatest(([appData, vars]) => {
return PublishedConfig.bulkSet(api, vars, appData.app_id, appData.org_id);
})
.flatMapLatest(() => Logger.println('Environment variables have been set'));
handleCommandStream(s_result);
};
process.nextTick(function() {
var partsStream = makeCandidatePartsStream(candidate).take(1);
Bacon.combineAsArray(partsStream, graph).map(function (inputs) {
var walker = inputs[1],
parts = inputs[0],
start = parts[0].length ? 0 : '1';
for (var i=start; i