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
// SOLUTION 1 | |
const getBlobBoundingBox1 = (blobString) => { | |
blobString = blobString.trim() | |
const width = (/\s/.exec(blobString) || {}).index | |
const one = /1/g | |
blobString = blobString.replace(/\s+/g, '') |
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 createList() { | |
var next = 'prev' | |
, prev = 'next' | |
, length = 0 | |
, head | |
, tail | |
, arr | |
, n; | |
return { |
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* each(arr) { | |
let i; | |
for (i = 0; i < arr.length; i++) yield arr[i]; | |
} | |
export function* traverse (arr) { | |
let queue = [each(arr)]; | |
let seen = new WeakSet(); | |
while (queue.length) { |
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 create(tag, attr = {}, children = []) { | |
children = Array.isArray(children) ? children : [children]; | |
const elm = document.createElement(tag); | |
for (let a in attr) { | |
if (a.startsWith('on')) { | |
elm.addEventListener(a.slice(2).toLowerCase(), attr[a]) | |
} else { | |
if (attr[a]) elm.setAttribute(a, attr[a]); | |
} | |
} |
OlderNewer