Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
[Chore]: Technical: Translate utils (files without d.ts typings) (#1728)
Maksim Suslov5304d4dc7399
diff --git a/src/utils/aggregate-utils.js b/src/utils/aggregate-utils.tssimilarity index 97%rename from src/utils/aggregate-utils.jsrename to src/utils/aggregate-utils.tsindex 4207e4519..0751a0c2b 100644--- a/src/utils/aggregate-utils.js+++ b/src/utils/aggregate-utils.ts@@ -19,7 +19,7 @@// THE SOFTWARE.import {deviation, min, max, mean, median, sum, variance} from 'd3-array';-import {AGGREGATION_TYPES} from 'constants/default-settings';+import {AGGREGATION_TYPES} from '../constants/default-settings';export const getFrequency = data =>data.reduce(diff --git a/src/utils/dom-to-image.js b/src/utils/dom-to-image.tssimilarity index 97%rename from src/utils/dom-to-image.jsrename to src/utils/dom-to-image.tsindex 908047e7c..692ac4b6a 100644--- a/src/utils/dom-to-image.js+++ b/src/utils/dom-to-image.ts@@ -67,7 +67,7 @@ const domtoimage = {fontFaces,images,inliner,- options: {}+ options: {} as any}};@@ -213,7 +213,7 @@ function cloneNode(node, filter, root) {let done = Promise.resolve();arrChildren.forEach(child => {done = done- .then(() => cloneNode(child, flt))+ .then(() => cloneNode(child, flt, null)).then(childClone => {if (childClone) {parent.appendChild(childClone);@@ -280,8 +280,8 @@ function newInliner() {}function readUrls(string) {- const result = [];- let match;+ const result: string[] = [];+ let match: null | RegExpExecArray;while ((match = URL_REGEX.exec(string)) !== null) {result.push(match[1]);}@@ -382,9 +382,9 @@ function newFontFaces() {// Source: http://stackoverflow.com/a/2676231/3786856function concatAndResolveUrl(url, concat) {- const url1 = url.split('/');- const url2 = concat.split('/');- const url3 = [];+ const url1: string[] = url.split('/');+ const url2: string[] = concat.split('/');+ const url3: string[] = [];for (let i = 0, l = url1.length; i < l; i++) {if (url1[i] === '..') {url3.pop();@@ -421,7 +421,7 @@ function newFontFaces() {}function getCssRules(styleSheets) {- const cssRules = [];+ const cssRules: any[] = [];styleSheets.forEach(sheet => {// try...catch because browser may not able to enumerate rules for cross-domain sheetsif (!sheet) {@@ -455,7 +455,7 @@ function newFontFaces() {return {resolve: () => {const baseUrl = (webFontRule.parentStyleSheet || {}).href;- return inliner.inlineAll(webFontRule.cssText, baseUrl);+ return inliner.inlineAll(webFontRule.cssText, baseUrl, null);},src: () => webFontRule.style.getPropertyValue('src')};@@ -503,7 +503,7 @@ function newImages() {return inlineBackground(node).then(() => {if (node instanceof HTMLImageElement) {- return newImage(node).inline();+ return newImage(node).inline(null);}return Promise.all(asArray(node.childNodes).map(child => inlineAll(child)));});@@ -516,7 +516,7 @@ function newImages() {}return inliner- .inlineAll(background)+ .inlineAll(background, null, null).then(inlined => {nd.style.setProperty('background', inlined, nd.style.getPropertyPriority('background'));})diff --git a/src/utils/dom-utils.js b/src/utils/dom-utils.tssimilarity index 99%rename from src/utils/dom-utils.jsrename to src/utils/dom-utils.tsindex 19b16bc92..bfeb8bc77 100644--- a/src/utils/dom-utils.js+++ b/src/utils/dom-utils.ts@@ -141,7 +141,7 @@ export function processClone(original, clone) {* UTILS****/export function asArray(arrayLike) {- const array = [];+ const array: any[] = [];const length = arrayLike.length;for (let i = 0; i < length; i++) array.push(arrayLike[i]);return array;diff --git a/src/utils/gl-utils.js b/src/utils/gl-utils.tssimilarity index 100%rename from src/utils/gl-utils.jsrename to src/utils/gl-utils.tsdiff --git a/src/utils/locale-utils.js b/src/utils/locale-utils.tssimilarity index 100%rename from src/utils/locale-utils.jsrename to src/utils/locale-utils.tsdiff --git a/src/utils/map-info-utils.js b/src/utils/map-info-utils.tssimilarity index 100%rename from src/utils/map-info-utils.jsrename to src/utils/map-info-utils.tsdiff --git a/src/utils/map-style-utils/mapbox-gl-style-editor.js b/src/utils/map-style-utils/mapbox-gl-style-editor.tssimilarity index 98%rename from src/utils/map-style-utils/mapbox-gl-style-editor.jsrename to src/utils/map-style-utils/mapbox-gl-style-editor.tsindex b52a2d798..8ff851c89 100644--- a/src/utils/map-style-utils/mapbox-gl-style-editor.js+++ b/src/utils/map-style-utils/mapbox-gl-style-editor.ts@@ -21,11 +21,12 @@import memoize from 'lodash.memoize';import clondDeep from 'lodash.clonedeep';import {DEFAULT_LAYER_GROUPS, DEFAULT_MAPBOX_API_URL} from 'constants/default-settings';+import {LayerGroup} from 'reducers';const mapUrlRg = /^mapbox:\/\/styles\/[-a-z0-9]{2,256}\/[-a-z0-9]{2,256}/;const httpRg = /^(?=(http:|https:))/;-export function getDefaultLayerGroupVisibility({layerGroups = []}) {+export function getDefaultLayerGroupVisibility({layerGroups = []}: {layerGroups: LayerGroup[]}) {return layerGroups.reduce((accu, layer) => ({...accu,diff --git a/src/utils/map-style-utils/mapbox-utils.js b/src/utils/map-style-utils/mapbox-utils.tssimilarity index 100%rename from src/utils/map-style-utils/mapbox-utils.jsrename to src/utils/map-style-utils/mapbox-utils.tsdiff --git a/src/utils/mapbox-utils.js b/src/utils/mapbox-utils.tssimilarity index 100%rename from src/utils/mapbox-utils.jsrename to src/utils/mapbox-utils.tsdiff --git a/src/utils/notifications-utils.js b/src/utils/notifications-utils.tssimilarity index 100%rename from src/utils/notifications-utils.jsrename to src/utils/notifications-utils.tsdiff --git a/src/utils/projection-utils.js b/src/utils/projection-utils.tssimilarity index 100%rename from src/utils/projection-utils.jsrename to src/utils/projection-utils.tsdiff --git a/src/utils/searcher-utils.js b/src/utils/searcher-utils.tssimilarity index 100%rename from src/utils/searcher-utils.jsrename to src/utils/searcher-utils.tsdiff --git a/src/utils/split-map-utils.js b/src/utils/split-map-utils.tssimilarity index 100%rename from src/utils/split-map-utils.jsrename to src/utils/split-map-utils.tsdiff --git a/src/utils/utils.js b/src/utils/utils.tssimilarity index 100%rename from src/utils/utils.jsrename to src/utils/utils.ts