UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

6 lines (5 loc) 2.87 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ import{impedanceAttributeNameJsonMap as t}from"../support/networkEnums.js";function r(r,e){if(null==r)return null;const i={},s=new RegExp(`^${e}`,"i");for(const n of Object.keys(r))if(s.test(n)){const s=n.slice(e.length);i[t.fromJSON(s)]=r[n]}return i}function e(r,e,i){if(null!=r){e.attributes||(e.attributes={});for(const s in r){const n=t.toJSON(s);e.attributes[`${i}${n}`]=r[s]}}}function i(r){const e={};for(const i of Object.keys(r)){const s=i;e[t.fromJSON(s)]=r[i]}return e}function s(r){const e={};for(const i of Object.keys(r)){const s=i;e[t.toJSON(s)]=r[i]}return e}function n(t,r){return null==t||null==r?null:Math.round((t-r)/6e4)}function o(t){const r=t.toJSON(),e=r;return e.accumulateAttributeNames&&=r.accumulateAttributeNames?.join(),e.attributeParameterValues&&=JSON.stringify(r.attributeParameterValues),e.barriers&&=JSON.stringify(r.barriers),e.outSR&&=r.outSR?.wkid,e.overrides&&=JSON.stringify(r.overrides),e.polygonBarriers&&=JSON.stringify(r.polygonBarriers),e.polylineBarriers&&=JSON.stringify(r.polylineBarriers),e.restrictionAttributeNames&&=r.restrictionAttributeNames?.join(),e.stops&&=JSON.stringify(r.stops),e.travelMode&&=JSON.stringify(r.travelMode),e}function a(t){const r=t.toJSON(),e=r;return e.accumulateAttributeNames&&=r.accumulateAttributeNames?.join(),e.attributeParameterValues&&=JSON.stringify(r.attributeParameterValues),e.barriers&&=JSON.stringify(r.barriers),e.facilities&&=JSON.stringify(r.facilities),e.incidents&&=JSON.stringify(r.incidents),e.outSR&&=r.outSR?.wkid,e.overrides&&=JSON.stringify(r.overrides),e.polygonBarriers&&=JSON.stringify(r.polygonBarriers),e.polylineBarriers&&=JSON.stringify(r.polylineBarriers),e.restrictionAttributeNames&&=r.restrictionAttributeNames?.join(),e.travelMode&&=JSON.stringify(r.travelMode),e}function u(t){const r=t.toJSON(),e=r;return e.accumulateAttributeNames&&=r.accumulateAttributeNames?.join(),e.attributeParameterValues&&=JSON.stringify(r.attributeParameterValues),e.barriers&&=JSON.stringify(r.barriers),e.defaultBreaks&&=r.defaultBreaks?.join(),e.excludeSourcesFromPolygons&&=r.excludeSourcesFromPolygons?.join(),e.facilities&&=JSON.stringify(r.facilities),e.outSR&&=r.outSR?.wkid,e.overrides&&=JSON.stringify(r.overrides),e.polygonBarriers&&=JSON.stringify(r.polygonBarriers),e.polylineBarriers&&=JSON.stringify(r.polylineBarriers),e.restrictionAttributeNames&&=r.restrictionAttributeNames?.join(),e.travelMode&&=JSON.stringify(r.travelMode),e}export{a as closestFacilityParametersToQueryParameters,s as fromKebabImpedanceAttributes,r as getPrefixedProperties,n as getTimezoneOffset,o as routeParametersToQueryParameters,u as serviceAreaParametersToQueryParameters,e as setPrefixedProperties,i as toKebabImpedanceAttributes};