This file contains hidden or 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
| /** | |
| * @method fromTemplate | |
| * @description | |
| * Converts an HTML element string to a DOM object | |
| * @param {String} templateString String representation of a DOM element (e.g. '<div>content</div>') | |
| * @returns {Node} | |
| */ | |
| export const fromTemplate = templateString => { | |
| var el = document.createElement('div'); | |
| el.innerHTML = templateString; |
This file contains hidden or 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
| // Simple composing (ES6) | |
| // Belongs to Stefan A. Maric | |
| const compose = (...fns) => x => fns.reduceRight((v, f) => f(v), x); | |
| /*****************************/ | |
| // Recursive composing | |
| // Belongs to Stefan A. Maric | |
| const compose = (head, ...rest) => x => head ? head(compose(...rest)(x)) : x; |