Repository URL to install this package:
|
Version:
1.1.6 ▾
|
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