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/graphql / src / endpoints / store / transform.ts
Size: Mime:
import { getTyped } from '@skava/modules/___dist/composition'

const remapStores = store => {
  const { string, array } = getTyped(store)

  return {
    identifier: string('identifier'),
    country: string('country'),
    distance: string('distance'),
    city: string('city'),
    address1: string('address1'),
    latitude: string('latitude'),
    additionalinfo: array('additionalinfo'),
    zipcode: string('zipcode'),
    altidentifier: string('altidentifier'),
    phone: string('phone'),
    name: string('name'),
    state: string('state'),
    distanceunit: string('distanceunit'),
    email: string('email'),
    longitude: string('longitude'),
  }
}

const transformStoreLocator = response => {
  const { string, number, array } = getTyped(response)

  const storeLocatorResponse = {
    type: string('type'),
    // @todo
    offset: string('properties.state.offset'),
    limit: string('properties.state.limit'),
    //
    storeinfo: array('properties.storeinfo').map(remapStores),
  }
  return storeLocatorResponse
}

export { transformStoreLocator }
export default transformStoreLocator