UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 888 B
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ function l(l){const n={fieldValueMap:new Map,allowedValues:[]};for(const e of l){const l=e.fieldValueMap,t=n.fieldValueMap;l.forEach(((l,e)=>{t.has(e)||(t.set(e,l),n.allowedValues.push(e))}))}return n.allowedValues.sort(((l,n)=>l-n)),n}function n(l){let n=null;for(const e of l)n=null!=n?Math.min(n,e):e;return n}function e(l){let n=null;for(const e of l)n=null!=n?Math.max(n,e):e;return n}function t(l,n){return n.allowedValues.length>0?o(l,n.allowedValues):null}function o(l,n){if(0===n.length)return l;if(l===1/0)return n[n.length-1];if(l===-1/0)return n[0];let e=n[0],t=Math.abs(e-l);for(const o of n){const n=Math.abs(o-l);n<t&&(e=o,t=n)}return e}export{o as findClosest,l as getDomainInfo,e as getMax,n as getMin,t as getValidNumber};