Public
Edited
Nov 22, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
pkgs = pkg2standalone( pkg_list )
Insert cell
Insert cell
failures = test( pkgs )
Insert cell
JSON.stringify( failures )
Insert cell
Insert cell
Insert cell
fmt = require( 'https://cdn.jsdelivr.net/gh/stdlib-js/string-format@umd/browser.js' )
Insert cell
Insert cell
/**
* Attempts to load a UMD bundle for each stdlib package in a provided list.
*
* ## Notes
*
* - The promise returns a list of packages whose UMD bundles could not be loaded into Observable.
*
* @param {Array<string>} pkgs - list of packages
* @returns {Promise} promise which fulfills upon completing all tests
*
* @example
* var failures = await test( [ 'foo', 'bar' ] );
* // returns [...]
*/
async function test( pkgs ) {
var failures;
var pkg;
var f;
var i;

failures = [];
for ( i = 0; i < pkgs.length; i++ ) {
pkg = pkgs[ i ];
try {
console.log( pkg );
f = await require( fmt( 'https://cdn.jsdelivr.net/gh/stdlib-js/%s@umd/browser.js', pkg ) );
} catch ( err ) {
failures.push( pkg );
}
}
return failures;
}
Insert cell
Insert cell
pkg_list = FileAttachment("pkg_list@2.json").json()
Insert cell
function pkg2standalone( pkgs ) {
var list;
var i;

list = [];
for ( i = 0; i < pkgs.length; i++ ) {
list.push( pkgs[ i ].replace( /\//g, '-' ) );
}
return list;
}
Insert cell
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