Public
Edited
Apr 10, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
parseAddress = (url) => {
const parsed = { indices: [] };

const base = url.substring(
url.indexOf("<img src=") + 38,
url.indexOf("/></a>") - 5
);

for (let i = 0; i < base.length; i++) {
if (base[i] === "/") {
parsed.indices.push(i);
}
}

parsed.ark = base.substr(0, parsed.indices[2]);

const getSubstring = (str, index) =>
str.substr(
parsed.indices[index] + 1,
parsed.indices[index + 1] - parsed.indices[index] - 1
);

parsed.vue = getSubstring(base, 2);

parsed.region = getSubstring(base, 3);

parsed.size = getSubstring(base, 4);

parsed.rotation = getSubstring(base, 5);
parsed.quality = base.substr(parsed.indices[6] + 1);

return parsed;
}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more