Source: speech-to-text/no-timestamps.js

'use strict';

/**
 * Returns true if the result is missing it's timestamps
 * @param {Object} data
 * @return {Boolean}
 */
module.exports = function noTimestamps(data) {
  return data.results.some(function(result) {
    var alt = result.alternatives && result.alternatives[0];
    return !!(alt && (alt.transcript.trim() && !alt.timestamps || !alt.timestamps.length));
  });
};

module.exports.ERROR_NO_TIMESTAMPS = 'NO_TIMESTAMPS';