Kaynağa Gözat

Merge pull request #203 from andreasvirkus/patch-1

Fix reduce warning for empty arrays
tags/1.3.0
Shivam Mishra 5 yıl önce
committed by GitHub
ebeveyn
işleme
884c52c671
Veri tabanında bu imza için bilinen anahtar bulunamadı GPG Anahtar Kimliği: 4AEE18F83AFDEB23
1 değiştirilmiş dosya ile 1 ekleme ve 1 silme
  1. +1
    -1
      src/js/utils/intervals.js

+ 1
- 1
src/js/utils/intervals.js Dosyayı Görüntüle

@@ -212,7 +212,7 @@ export function isInRange2D(coord, minCoord, maxCoord) {
export function getClosestInArray(goal, arr, index = false) {
let closest = arr.reduce(function(prev, curr) {
return (Math.abs(curr - goal) < Math.abs(prev - goal) ? curr : prev);
});
}, []);

return index ? arr.indexOf(closest) : closest;
}


Yükleniyor…
İptal
Kaydet