examples/amazon-lex-with-lambda.js
function getAvailabilitiesForDuration(duration, availabilities) {
    const durationAvailabilities = [];
    let startTime = '10:00';
    while (startTime !== '17:00') {
        if (availabilities.indexOf(startTime) !== -1) {
            if (duration === 30) {
                durationAvailabilities.push(startTime);
            } else if (availabilities.indexOf(incrementTimeByThirtyMins(startTime)) !== -1) {
                durationAvailabilities.push(startTime);
            }
        }
        startTime = incrementTimeByThirtyMins(startTime);
    }
    return durationAvailabilities;
}
function getAvailabilitiesForDuration(duration, availabilities) {
    const durationAvailabilities = [];
    let startTime = '10:00';
    while (startTime !== '17:00') {
        if (availabilities.indexOf(startTime) !== -1) {
            if (duration === 30) {
                durationAvailabilities.push(startTime);
            } else if (availabilities.indexOf(incrementTimeByThirtyMins(startTime)) !== -1) {
                durationAvailabilities.push(startTime);
            }
        }
        startTime = incrementTimeByThirtyMins(startTime);
    }
    return durationAvailabilities;
}
function getAvailabilitiesForDuration ( duration , availabilities ) { const durationAvailabilities = [ ] ; let startTime = '10:00' ; while ( startTime !== '17:00' ) { if ( availabilities . indexOf ( startTime ) !== - 1 ) { if ( duration === 30 ) { durationAvailabilities . push ( startTime ) ; } else if ( availabilities . indexOf ( incrementTimeByThirtyMins ( startTime ) ) !== - 1 ) { durationAvailabilities . push ( startTime ) ; } } startTime = incrementTimeByThirtyMins ( startTime ) ; } return durationAvailabilities ; }
Helper function to return the windows of availability of the given duration, when provided a set of 30 minute windows.
Helper function to return the windows of availability of the given duration when provided a set of 30 minute windows .