List stdlib namespaces.
var ls = require( '@stdlib/tools/pkgs/namespaces' );Asynchronously returns a list of stdlib namespaces.
ls( onList );
function onList( error, names ) {
if ( error ) {
throw error;
}
console.log( names.join( '\n' ) );
}The function accepts the following options:
- dir: root directory from which to search for namespaces. May be either an absolute file path or a path relative to the
stdlib/lib/node_modules/directory. Default:/path/to/stdlib/lib/node_modules/.
To search from a descendant directory, set the dir option.
var opts = {
'dir': './@stdlib/math/base'
};
ls( opts, onList );
function onList( error, names ) {
if ( error ) {
throw error;
}
console.log( names.join( '\n' ) );
}Synchronously returns a list of stdlib namespaces.
var names = ls.sync();
// returns [...]The function accepts the same options as ls() above.
- The function only returns namespaces under the
@stdlibscope.
var ls = require( '@stdlib/tools/pkgs/namespaces' );
ls( onList );
function onList( error, names ) {
if ( error ) {
throw error;
}
console.log( names.join( '\n' ) );
}Usage: stdlib-namespaces [options] [dir]
Options:
-h, --help Print this message.
-V, --version Print the package version.- If not provided a
dirargument, the search directory is the current working directory.
$ stdlib-namespaces
<package_name>
<package_name>
...