Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@skava/ui / dist / components / atoms / Video / deps.js
Size: Mime:
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
/**
 * @file @todo needs update since we changed
 */

const exotic_1 = require("exotic");
/**
 * @todo similar things with image
 */


function _toType(props) {
  if (exotic_1.isString(props)) {
    switch (true) {
      case props.includes('webm'):
        return 'webm';

      case props.includes('ogg'):
        return 'ogg';

      case props.includes('mp4'):
      default:
        return 'mp4';
    }
  }

  switch (true) {
    case !!props.type:
      return props.type;

    case !!props.oggSource:
      return 'ogg';

    case !!props.webmSource:
      return 'webm';

    case !!props.mp4Source:
      return 'mp4';
    // makes it a string then calls again to trigger the above branch
    // default: return _toType(toSrc(props))

    default:
      return 'mp4';
  }
}

const toType = props => {
  const type = _toType(props);

  if (type.includes('type')) {
    return type;
  } else {
    return 'type/' + type;
  }
};

exports.toType = toType;

function toSrc(props) {
  if (exotic_1.isArray(props.src)) {
    return props.src[0];
  }

  return props.src || props.oggSource || props.webmSource || props.mp4Source || props.props || '@@404';
}

exports.toSrc = toSrc;
const alias = {
  toCover(props) {
    return props.thumbnailImage || props.poster || props.cover;
  },

  toAutoPlay(props) {
    return props.shouldAutoPlay || props.shouldAutoplay;
  }

};
exports.alias = alias; //# sourceMappingURL=deps.js.map