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
/** | |
* Wrapper function with modern JS. May have issues with IE and Safari. | |
* Will preserve event handlers. | |
* @param {ChildNode} elToWrap The element you want to wrap. | |
* @param {ParentNode} wrapper The element to wrap with. | |
*/ | |
const wrap = (elToWrap, wrapper) => { | |
elToWrap.before(wrapper) // so element doesn't move | |
wrapper.append(elToWrap) // automatically moves wrapped element. | |
} |
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
from functools import reduce | |
# Readable version | |
def pipe(*funcs): | |
def shortpipe(f,g): | |
return lambda *args: g(*f(*args)) | |
return reduce(shortpipe, funcs) | |
# Short version | |
def pipe(*fs): |