4222 (t._jQueryInterface = function (e) {
4223 return this.each(function () {
4224 var n = i.default(this),
4225 o = n.data("bs.toast");4226 if (
4227 (o ||
4228 ((o = new t(this, typeof e == "object" && e)),
4221 }),
4222 (t._jQueryInterface = function (e) {
4223 return this.each(function () {
4224 var n = i.default(this),4225 o = n.data("bs.toast");
4226 if (
4227 (o ||
4219 (e._clearTimeout = function () {
4220 clearTimeout(this._timeout), (this._timeout = null);
4221 }),
4222 (t._jQueryInterface = function (e) {4223 return this.each(function () {
4224 var n = i.default(this),
4225 o = n.data("bs.toast");
4210 if (
4211 (this._element.classList.remove("show"), this._config.animation)
4212 ) {
4213 var n = l.getTransitionDurationFromElement(this._element);4214 i.default(this._element)
4215 .one(l.TRANSITION_END, e)
4216 .emulateTransitionEnd(n);
4203 }),
4204 (e._close = function () {
4205 var t = this,
4206 e = function () {4207 t._element.classList.add("hide"),
4208 i.default(t._element).trigger("hidden.bs.toast");
4209 };
Two variables can have the same name if they're declared in different scopes.
In the example below, the parameter x
is said to "shadow" the variable x
declared above it.
The outer x
can no longer be accessed inside the sum
function.
const x = 1
function add(x, y) {
return x + y
}
While shadowing does not cause any problems most of the time, it does make the code harder to read and understand. We highly recommend against shadowing. However, if you want to shadow some variable name and don't want DeepSource to flag it, add a skipcq comment alongside an explanation:
const x = 1
function add(x, y) { // skipcq: JS-0123 - `x` can be safely shadowed
return x + y
}
If you want to disable this issue project-wide, you can add it to the list of disabled issues in the project dashboard.
const file = "data.txt"
function readFile(file) {
// The parameter `file` shadows the toplevel variable `file`.
if (fs.existsSync(file)) {
return fs.readFileSync(file)
}
return null
}
// Prefer variable names that are distinct and convey as much
// meaning as possible.
const dataFile = "data.txt"
function readFile(filePath) {
if (fs.existsSync(filePath)) {
return fs.readFileSync(filePath)
}
return null
}
Alternatively:
const file = "data.txt"
function readFile(file) { // skipcq: JS-0123 - Shadowing is safe here
// ...
}