Public
Edited
Mar 1, 2023
Insert cell
Insert cell
licenses.GNU
Insert cell
licenses.GNU.GPL[1]
Insert cell
licenses = {
return Object.fromEntries(Object.entries({
GNU: {
name: "GNU",
family: {
AGPL: {
name: {
abbr: "AGPL",
name: "Affero GPL",
long: "Affero General Public License",
}
},
GPL: {
name: {
abbr: "GPL",
long: "General Public License"
},
family: {
1: {
name: "1.0",
released: "1989-02",
URL: "//GNU.org/licenses/old-licenses/gpl-1.0-standalone.html"
},
2: {
name: "2.0",
released: "1991-06",
URL: "//GNU.org/licenses/old-licenses/gpl-2.0-standalone.html"
},
3: {
name: "3.0",
released: "2007-06-29",
URL: "//GNU.org/licenses/old-licenses/gpl-3.0-standalone.html"
}
}
},
LGPL: {
name: {
abbr: "LGPL",
name: "Library GPL",
long: "Library General Public License"
},
family: {
2: {
name: "2.0",
released: "1991-06",
URL: "//GNU.org/licenses/lgpl-2.0-standalone.html"
},
2.1: {
released: "1999-02",
URL: "//GNU.org/licenses/lgpl-2.1-standalone.html"
},
3: {
name: "3.0",
released: "2007-06-29",
URL: "//GNU.org/licenses/lgpl-3.0-standalone.html"
}
}
}
}
}
}).map(processLicense));

function processLicense([name, license, parent = null]) {
name: {
if (parent && `${license.name ?? name}`.match(/^\d+(\.\d+)*$/)) {
let newName = license.name ?? name;
license.name = {
abbr: `v${newName}`,
short: `v${newName}`,
name: `v${newName}`,
long: `version ${newName}`
};
}
if (typeof license.name == "object") {
let newName = license.name.name || license.name.short || license.name.long || license.name.abbr;
newName = propStr(newName, undefined, newName);
if (parent) {
for (let k of (typeof parent.name == "object") ? new Set([...Object.keys(parent.name), ...Object.keys(license.name)]) : Object.keys(license.name)) {
newName[k] = `${parent.name[k] || parent.name} ${license.name[k] || newName.valueOf()}`;
}
}
license.name = newName;
} else {
if (parent && typeof parent.name == "object") {
let newName = license.name ?? name;
newName = propStr(newName, undefined, newName);
for (let k of Object.keys(parent.name)) {
newName[k] = `${parent.name[k]} ${newName.valueOf()}`;
}
license.name = newName;
} else {
license.name ??= name;
}
}
Object.defineProperty(license, Symbol.toStringTag, {
value: `license${(typeof license.family == "object") ? "s" : ""}: ${license.name}`
});
}
if (typeof license.family == "object") {
let family = license.family;
delete license.family;
Object.defineProperties(license, Object.getOwnPropertyDescriptors(Object.fromEntries(Object.entries(family).map(([name, lic]) => processLicense([name, lic, license])))));
}
return [name, license];
}
}
Insert cell
{
let comp = Intl.Collator(undefined, {
sensitivity: "case",
numeric: true,
ignorePunctuation: true
});
return import("//CDN.Skypack.dev/spdx-license-list@6").then(licenses => Object.fromEntries(Object.entries(licenses.default).sort(comp.compare.bind(comp)).map(([k, v]) => {
return [k, (typeof v == "object") ? propStr(v.name, v, v.name) : v];
})));
}
Insert cell
import("//CDN.Skypack.dev/spdx-license-list@6/spdx-full.json")
Insert cell
require("//CDN.Skypack.dev/spdx-license-list/full.js")
Insert cell
l = import("//CDN.Skypack.dev/license-o-matic@1.2.0?min").then(({default: d}) => d)
Insert cell
l.getIdentifiers()
Insert cell
{
let e = document.createElement("div");
e.append(...l.getLicense("isc")({copyrightHolder: "Riley", year: new Date().getFullYear()}).trim().replaceAll(/"\b/g, "“").replaceAll(/\b"/g, "”").replaceAll(/'\b/g, "‘").replaceAll(/\b'/g, "’").split(/\n+/).map(line => {
let e = document.createElement("p");
if (line.toUpperCase() == line) {
let sentences = line.trim().replace(/\.+^/, "").split(".").flatMap(s => {
s = s.trim();
if (s == "." || s == "") { return []; }
let i = s.match(/\w/);
if (i) {
i = i.index;
return [s = `${s.slice(0, i).toLowerCase()}${s[i]}${s.slice(i + 1).toLowerCase()}.`];
}
return [s = `${s}.`];
});
console.dir(sentences);
line = sentences.join(" ");
e.style.fontWeight = "bold";
}
e.append(line);
return e;
}));
return e;
}
Insert cell
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