untitled notebook

node v10.24.1
version: 1.0.0
endpointsharetweet
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}`); }
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"));
Created from: https://runkit.com/docs/value-viewers
Loading…

no comments

    sign in to comment