Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Namespaces

List stdlib namespaces.

Usage

var ls = require( '@stdlib/tools/pkgs/namespaces' );

ls( [options,] clbk )

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' ) );
}

ls.sync( [options] )

Synchronously returns a list of stdlib namespaces.

var names = ls.sync();
// returns [...]

The function accepts the same options as ls() above.

Notes

  • The function only returns namespaces under the @stdlib scope.

Examples

var ls = require( '@stdlib/tools/pkgs/namespaces' );

ls( onList );

function onList( error, names ) {
    if ( error ) {
        throw error;
    }
    console.log( names.join( '\n' ) );
}

CLI

Usage

Usage: stdlib-namespaces [options] [dir]

Options:

  -h,    --help                Print this message.
  -V,    --version             Print the package version.

Notes

  • If not provided a dir argument, the search directory is the current working directory.

Examples

$ stdlib-namespaces
<package_name>
<package_name>
...