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
// Usage: | |
// ----- | |
// import html from './html-tagged-temp-lit.js' | |
// html`<div>${"Hello World"}</div>` | |
const joinIfArray = (maybeArray) => | |
Array.isArray(maybeArray) ? maybeArray.join('') : maybeArray | |
const html = (literals, ...vars) => { | |
return Array.from(literals).reduce((output, literal, i) => { |
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
// No error checking or anything! Use with caution! | |
function addCombos(list, combos=[], dict={}) { | |
if (!list.length) | |
return combos.concat(dict); | |
let item = list[0]; | |
let possibilities = getPossibilities(item); | |
possibilities.forEach(possibility => { | |
let subDict = addKvp(dict, item, possibility); |
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 getClassesAndIds(parent, memo) { | |
if (typeof memo === 'undefined') | |
memo = {classes: [], ids: []}; | |
if (parent.className) | |
parent.className.split(' ').forEach(function (className) { | |
if (className && !~memo.classes.indexOf(className)) | |
memo.classes.push(className) | |
}); |
NewerOlder