CIDARLAB / 3DuF

Prefer var declarations be placed at the top of their scope JS-0102
Anti-pattern
Minor
15 days ago3 years old
All 'var' declarations must be at the top of the function scope
2236        target.noUiSlider = api;
2237        return api;
2238    }
2239    var nouislider = {2240        // Exposed for unit testing, don't use this in your application.2241        __spectrum: Spectrum,2242        // A reference to the default classes, allows global changes.2243        // Use the cssClasses option for changes to one slider.2244        cssClasses: cssClasses,2245        create: initialize,2246    };2247
2248    exports.create = initialize;
2249    exports.cssClasses = cssClasses;
All 'var' declarations must be at the top of the function scope
2232        }
2233        // Test the options and create the slider environment;
2234        var options = testOptions(originalOptions);
2235        var api = scope(target, options, originalOptions);2236        target.noUiSlider = api;
2237        return api;
2238    }
All 'var' declarations must be at the top of the function scope
2231            throw new Error("noUiSlider: Slider was already initialized.");
2232        }
2233        // Test the options and create the slider environment;
2234        var options = testOptions(originalOptions);2235        var api = scope(target, options, originalOptions);
2236        target.noUiSlider = api;
2237        return api;
All 'var' declarations must be at the top of the function scope
2190            aria();
2191        }
2192        setupSlider();
2193        var scope_Self = {2194            destroy: destroy,2195            steps: getNextSteps,2196            on: bindEvent,2197            off: removeEvent,2198            get: valueGet,2199            set: valueSet,2200            setHandle: valueSetHandle,2201            reset: valueReset,2202            // Exposed for unit testing, don't use this in your application.2203            __moveHandles: function (upward, proposal, handleNumbers) {2204                moveHandles(upward, proposal, scope_Locations, handleNumbers);2205            },2206            options: originalOptions,2207            updateOptions: updateOptions,2208            target: scope_Target,2209            removePips: removePips,2210            removeTooltips: removeTooltips,2211            getPositions: function () {2212                return scope_Locations.slice();2213            },2214            getTooltips: function () {2215                return scope_Tooltips;2216            },2217            getOrigins: function () {2218                return scope_Handles;2219            },2220            pips: pips, // Issue #5942221        };2222        return scope_Self;
2223    }
2224    // Run the standard initializer
All 'var' declarations must be at the top of the function scope
2141                    originalOptions[name] = optionsToUpdate[name];
2142                }
2143            });
2144            var newOptions = testOptions(originalOptions);2145            // Load new options into the slider state
2146            updateAble.forEach(function (name) {
2147                if (optionsToUpdate[name] !== undefined) {