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 / src / playground / Image / deps / fromProps.ts
Size: Mime:
// import { getWidthHeight } from './getWidthHeight'
// // import { calculateAspectRatio } from './calculateAspectRatio'
// // import { toPlaceholder } from './toPlaceholder'
import { toSecureProtocol } from '@skava/utils'
import { isImageLike } from './isImage'

// eslint-disable-next-line
export const fromPropsToSrc = props => {
  const alt = props.alt || ''
  let src = props.src || ''

  if (isImageLike(alt)) {
    src = alt
  }

  const url =
    src ||
    alt ||
    props.src ||
    props.imageSrc ||
    props.url ||
    props.value ||
    props.imageSource

  return toSecureProtocol(url)
}

export const fromPropsToAlt = props =>
  props.caption ||
  props.text ||
  props.alternateImage ||
  props.label ||
  props.alt