@stdlib/error-tools-id2msg
v0.2.2
Published
Return an error message corresponding to a provided two-character error identifier.
Downloads
47
Readme
id2msg
Return an error message corresponding to a provided two-character error identifier.
Installation
npm install @stdlib/error-tools-id2msg
Usage
var id2msg = require( '@stdlib/error-tools-id2msg' );
id2msg( id )
Returns an error message corresponding to a provided two-character error identifier.
var v = id2msg( '8t' );
// e.g., returns 'invalid option. `%s` option must be an array. Option: `%s`.'
If provided an unrecognized error identifier, the function returns null
.
var v = id2msg( 'beep_boop' );
// returns null
Examples
var id2msg = require( '@stdlib/error-tools-id2msg' );
var list;
var v;
var i;
list = [
'01',
'03',
'8t',
'0a',
'9W'
];
for ( i = 0; i < list.length; i++ ) {
v = list[ i ];
console.log( 'id: "%s". msg: "%s".', v, id2msg( v ) );
}
See Also
@stdlib/error-tools-id2msg-cli
: CLI package for use as a command-line utility.
Notice
This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
Community
License
See LICENSE.
Copyright
Copyright © 2016-2024. The Stdlib Authors.