всем нужны примера кода, понятно почему
какими подводными камнями
__DEV__
:export function setExtraStackFrame(stack: null | string): void {
if (__DEV__) {
currentExtraStackFrame = stack;
}
}
__DEV__
был true, условие было опущено, т.к. оно всегда выполняется, а скобки остались как артефакт. Скорее всего транспилятор TS не проверяет весь контекст, и чтобы ничего не сломать случайно, оставляет скобки на своих местах. var currentExtraStackFrame = null;
function setExtraStackFrame(stack) {
if (process.env.NODE_ENV === 'production') {
currentExtraStackFrame = stack;
}
}
В процессе сборки process.env.NODE_ENV
было заменено на 'production'
, а так как 'production' === 'production'
- это всегда истинное условие, то от if можно избавиться, оставив только его тело, вот только от блока при этом инструменты не избавляются, так как можно сломать видимость переменных.
# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received.
#
# The path to the end user account 'public_html' directory must be
# accessible to the webserver userid. This usually means that ~userid
# must have permissions of 711, ~userid/public_html must have permissions
# of 755, and documents contained therein must be world-readable.
# Otherwise, the client will only receive a "403 Forbidden" message.
#
# See also: httpd.apache.org/docs/misc/FAQ.html#forbidden
#
let a = 3;
let b = 15;
let one = {};
one.a = a;
one.b = b;
a = 42;
console.log(one.a, one.b); // 3, 15
console.log(a, b); // 42, 15
let a = 3;
let b = 15;
let two = new Map();
two.set('a', a);
two.set('b', b);
a = 42;
console.log(two.get('a'), two.get('b')); // 3, 15
console.log(a, b); // 42, 15
const swiper = new Swiper('#swiper', {
effect: 'coverflow',
loop: false,
centeredSlides: true,
slidesPerView: 3.4,
spaceBetween: 0,
coverflowEffect: {
rotate: 0,
stretch: 0,
depth: 275,
modifier: 1,
slideShadows : false,
}
}
});