id2pkg

Return the package name associated with a specified error identifier prefix.

Usage

var id2pkg = require( '@stdlib/error/tools/id2pkg' );

id2pkg( id )

Returns the package name associated with a specified error identifier prefix.

var v = id2pkg( '0H5' );
// returns '@stdlib/math/base/special/sin'

If provided an unrecognized error identifier prefix, the function returns null.

var v = id2pkg( 'unrecognized_alias_beep_boop_bop_bip' );
// returns null

Examples

var id2pkg = require( '@stdlib/error/tools/id2pkg' );

var list;
var len;
var v;
var i;

list = [
    '001',
    '0A3',
    '0Ab'
];
len = list.length;

for ( i = 0; i < len; i++ ) {
    v = list[ i ];
    console.log( 'id: %s. pkg: %s.', v, id2pkg( v ) );
}

CLI

Usage

Usage: stdlib-id2pkg [options] <id>

Options:

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

Examples

$ stdlib-id2pkg '0H5'
@stdlib/math/base/special/sin

License

The data files (databases) are licensed under an Open Data Commons Public Domain Dedication & License 1.0 and their contents are licensed under Creative Commons Zero v1.0 Universal. The software is licensed under Apache License, Version 2.0.

Did you find this page helpful?