@maptiler/client 3.0.0-rc.1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -9,7 +9,9 @@
9
9
  - Adds new option `adjustSearchParams` to all functions in `geocoding` module
10
10
 
11
11
  ### Bug Fixes
12
- None
12
+ - Fixes `elevation.batch` skipping the last kernel (group of coordinates) when smoothing the result
13
+ - Fixes language helpers `toLanguageInfo` and `areSameLanguages` not working with keys from `Language` enum (like `"ENGLISH"`)
14
+ - Fixes language helper `areSameLanguages` to always return boolean (it could return `null` before)
13
15
 
14
16
  ### Others
15
17
  - Default value of `types` option of Geocoding API Client changed, TSDoc now links to API docs instead of listing the default types explicitly
@@ -955,7 +955,7 @@ const Language = {
955
955
  };
956
956
  function getLanguageInfoFromKey(languageKey, languageDictionary = Language) {
957
957
  if (languageKey in languageDictionary) {
958
- return languageKey[languageKey];
958
+ return languageDictionary[languageKey];
959
959
  }
960
960
  return null;
961
961
  }
@@ -1001,7 +1001,7 @@ function toLanguageInfo(lang, languageDictionary = Language) {
1001
1001
  function areSameLanguages(langA, langB, languageDictionary = Language) {
1002
1002
  const langAObj = toLanguageInfo(langA, languageDictionary);
1003
1003
  const langBObj = toLanguageInfo(langB, languageDictionary);
1004
- return langAObj && langBObj && langAObj.flag === langBObj.flag;
1004
+ return langAObj !== null && langBObj !== null && langAObj.flag === langBObj.flag;
1005
1005
  }
1006
1006
 
1007
1007
  async function callFetch(resource, options = {}) {
@@ -3258,7 +3258,7 @@ async function batch(positions, options = {}) {
3258
3258
  const kernelSize = ~~(options.smoothingKernelSize / 2) * 2 + 1;
3259
3259
  const elevations = elevatedPositions.map((pos) => pos[2]);
3260
3260
  const kernelSpan = ~~(kernelSize / 2);
3261
- for (let i = kernelSpan; i < elevations.length - kernelSpan - 1; i += 1) {
3261
+ for (let i = kernelSpan; i < elevations.length - kernelSpan; i += 1) {
3262
3262
  let sum = 0;
3263
3263
  for (let j = 0; j < kernelSize; j += 1) {
3264
3264
  const elev = elevations[i - kernelSpan + j];