When you clone a notebook you are able to make changes without affecting the original notebook.
xxxxxxxxxx
const getJSON = require("async-get-json");
const NPMURL = "https://replicate.npmjs.com/registry/";
async function getPackageData(aPackageName)
{
return await getJSON(`https://replicate.npmjs.com/registry/${aPackageName}`);
}
xxxxxxxxxx
const { ValueViewerSymbol } = require("@runkit/value-viewer");
const cssURL = "https://runkit.io/me1000/package-value-viewer-styles/2.0.0"
const iconURL = "https://runkit.io/me1000/package-icon-svg/2.0.0"
class Package
{
constructor(data)
{
const { author, name, description, homepage } = data;
const latestVersion = data["dist-tags"].latest;
const title = "Package Viewer";
const HTML = `<link rel = "stylesheet" href = "${cssURL}" >
<div class = "card">
<h1>
<img class = "logo" src = "${iconURL}" />
${name} (v${latestVersion})
</h1>
<p>Author: <b>${author.name}</b><br />
${description}</p>
<a href = "https://npm.runkit.com/${name}"
target = "_blank">TRY IT!</a>
<a href = "${homepage}" target = "_blank">WEBSITE</a>
</div>`;
Object.assign(this, data, { [ValueViewerSymbol]: { title, HTML } });
}
}
new Package(await getPackageData("lodash"));
xxxxxxxxxx
Created from: https://runkit.com/docs/value-viewers
sign in to comment