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
/** | |
* This is a DOM utility function that allows you to decorate a specific event handler | |
* for a specific event type of a DOM element with some additional behavior | |
* (e.g. for each click on a given button I want to log something before the actual click handler is executed). | |
* @param {Object} targetElement the target dom element whose addEventListener we want to decorate. | |
* @param {string} targetEventType the target event type whose event handler we want to decorate. | |
* @param {Function} decorator a function that returns the new event handler for the targetEventType. | |
* This returned function will most likely contain additional behavior. | |
* NOTE: make sure that your decorator function calls the actual event handler | |
* at the end, otherwise you will override the original behavior designed for that event |
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
{"lastUpload":"2021-04-12T03:30:34.496Z","extensionVersion":"v3.4.3"} |
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
/** | |
* Drops array elements while specified condition is met | |
* @param {Array.<T>} array | |
* @param {Function} cb condition to drop elements | |
* @returns {Array.<T>} returns array tail of resulting operation | |
*/ | |
function dropWhile(array, cb) { | |
const n = array.length; | |
let i = 0; |