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/utils / src / Address / fromDataLayerToThingList.ts
Size: Mime:
import { isArray } from 'exotic'
import { AddressType } from './typings'

function fromDataLayerToThingList(props: AddressType & { list?: any[] }) {
  if (isArray(props.list)) {
    return props.list
  }
  const street1 = {
    type: 'street',
    text: props.addressLine1,
  }
  const street2 = {
    type: 'street',
    text: props.addressLine2,
  }
  const region = {
    type: 'region',
    text: props.city,
  }
  const country = {
    type: 'country',
    text: props.country,
  }
  const locality = {
    type: 'locality',
    text: props.state,
  }
  const zip = {
    type: 'zip',
    text: props.zipCode,
  }

  const list = [street1, street2, region, country, locality, zip]

  return list
}

export { fromDataLayerToThingList }
export default fromDataLayerToThingList