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 resolveExpression = exp => { | |
const resolved = typeof exp === "function" ? exp() : exp; | |
return Array.isArray(resolved) | |
? resolved.join("") | |
: typeof resolved !== "undefined" ? resolved : ""; | |
}; | |
const html = (strings, ...exps) => { | |
return strings.reduce((acc, str, i) => { | |
return `${acc}${resolveExpression(exps[i - 1])}${str}`; |
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
# modified from Original source: https://github.com/python/mypy/issues/731#issuecomment-539905783 | |
from typing import Union, Dict, List | |
JSONPrimitive = Union[str, int, bool, None] | |
JSONType = Union[JSONPrimitive, 'JSONList', 'JSONDict'] | |
# work around mypy#731: no recursive structural types yet | |
class JSONList(List[JSONType]): | |
pass |
OlderNewer