Manual review of Lebab for let/const conversions

This commit is contained in:
David Larlet 2023-05-22 15:12:23 -04:00
parent 56ce9ae22c
commit 8d6185c476
No known key found for this signature in database
7 changed files with 20 additions and 22 deletions

View file

@ -880,7 +880,7 @@ L.U.Map.include({
})
}
var filterFeatures = function () {
const filterFeatures = function () {
let noResults = true
this.eachDataLayer((datalayer) => {
datalayer.eachFeature(function (feature) {

View file

@ -140,7 +140,7 @@ L.U.FeatureMixin = {
appendEditFieldsets: function (container) {
const optionsFields = this.getShapeOptions()
var builder = new L.U.FormBuilder(this, optionsFields, {
let builder = new L.U.FormBuilder(this, optionsFields, {
id: 'umap-feature-shape-properties',
callback: this._redraw,
})
@ -148,7 +148,7 @@ L.U.FeatureMixin = {
shapeProperties.appendChild(builder.build())
const advancedOptions = this.getAdvancedOptions()
var builder = new L.U.FormBuilder(this, advancedOptions, {
builder = new L.U.FormBuilder(this, advancedOptions, {
id: 'umap-feature-advanced-properties',
callback: this._redraw,
})

View file

@ -340,7 +340,7 @@ L.U.Map.include({
'umap-slideshow-enabled',
this.options.slideshow && this.options.slideshow.active
)
for (var i in this._controls) {
for (const i in this._controls) {
this.removeControl(this._controls[i])
}
if (this.options.noControl) return
@ -357,7 +357,7 @@ L.U.Map.include({
})
}
let name, status, control
for (var i = 0; i < this.HIDDABLE_CONTROLS.length; i++) {
for (let i = 0; i < this.HIDDABLE_CONTROLS.length; i++) {
name = this.HIDDABLE_CONTROLS[i]
status = this.options[name + 'Control']
if (status === false) continue
@ -846,7 +846,7 @@ L.U.Map.include({
L.DomEvent.on(
download,
'click',
function () {
() => {
const type = types[typeInput.value]
const content = type.formatter(this)
let name = this.options.name || 'data'
@ -957,7 +957,7 @@ L.U.Map.include({
if (layerId) layer = map.datalayers[layerId]
if (layer && clearFlag.checked) layer.empty()
if (fileInput.files.length) {
var file
let file
for (let i = 0, file; (file = fileInput.files[i]); i++) {
type = type || L.Util.detectFileType(file)
if (!type) {

View file

@ -644,7 +644,7 @@ L.U.DataLayer = L.Evented.extend({
_polygonToLayer: function (geojson, latlngs) {
// Ensure no empty hole
// for (var i = latlngs.length - 1; i > 0; i--) {
// for (let i = latlngs.length - 1; i > 0; i--) {
// if (!latlngs.slice()[i].length) latlngs.splice(i, 1);
// }
return new L.U.Polygon(this.map, latlngs, { geojson: geojson, datalayer: this })
@ -984,14 +984,12 @@ L.U.DataLayer = L.Evented.extend({
L.DomEvent.on(a, 'click', L.DomEvent.stop).on(
a,
'click',
function () {
this.restore(data.name)
},
() => this.restore(data.name),
this
)
}
var versionsContainer = L.DomUtil.createFieldset(container, L._('Versions'), {
const versionsContainer = L.DomUtil.createFieldset(container, L._('Versions'), {
callback: function () {
this.map.xhr.get(this.getVersionsUrl(), {
callback: function (data) {
@ -1073,8 +1071,8 @@ L.U.DataLayer = L.Evented.extend({
},
getNextFeature: function (feature) {
const id = this._index.indexOf(L.stamp(feature)),
nextId = this._index[id + 1]
const id = this._index.indexOf(L.stamp(feature))
const nextId = this._index[id + 1]
return nextId ? this._layers[nextId] : this.getNextBrowsable().getFeatureByIndex(0)
},
@ -1082,8 +1080,8 @@ L.U.DataLayer = L.Evented.extend({
if (this._index <= 1) {
return null
}
const id = this._index.indexOf(L.stamp(feature)),
previousId = this._index[id - 1]
const id = this._index.indexOf(L.stamp(feature))
const previousId = this._index[id - 1]
return previousId
? this._layers[previousId]
: this.getPreviousBrowsable().getFeatureByIndex(-1)

View file

@ -13,8 +13,8 @@ L.U.Slideshow = L.Class.extend({
this.map = map
this._id = null
let // current feature
current = null
// current feature
let current = null
const self = this
try {

View file

@ -85,7 +85,7 @@ L.U.UI = L.Evented.extend({
this._alert.innerHTML = ''
L.DomUtil.addClass(this.parent, 'umap-alert')
L.DomUtil.addClass(this._alert, level_class)
const close = function () {
function close() {
if (timeoutID !== this.ALERT_ID) {
return
} // Another alert has been forced

View file

@ -1,3 +1,3 @@
var locale = {{ locale|safe }};
L.registerLocale("{{ locale_code }}", locale);
L.setLocale("{{ locale_code }}");
const locale = {{ locale|safe }}
L.registerLocale("{{ locale_code }}", locale)
L.setLocale("{{ locale_code }}")