This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Принимает на вход произвольное количество объектов и производит их слияние возвращая новый экземпляр объекта. | |
* Если на одном уровне находится два массива, то происходит их конкатинация. | |
* | |
* @param {Object} objects | |
* @returns {Object} | |
*/ | |
export default function deepMergeObjects(...objects) { | |
const isObject = obj => obj && typeof obj === 'object'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getDocumentScrollBottom() { | |
return document.documentElement.clientHeight + document.documentElement.scrollTop; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const isElementInViewport = (el) => { | |
const rect = el.getBoundingClientRect(); | |
return rect.bottom > 0 && rect.right > 0 && | |
rect.left < (window.innerWidth || document.documentElement.clientWidth) && | |
rect.top < (window.innerHeight || document.documentElement.clientHeight); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# editorconfig.org | |
root = true | |
[*] | |
indent_style = tab | |
end_of_line = lf | |
charset = utf-8 | |
trim_trailing_whitespace = true | |
insert_final_newline = true | |
indent_size = 2 |