Package Exports
- arginfo
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (arginfo) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
arginfo
Install
$ npm install arginfoUsage
Calling arginfo(arg) returns a string representation of arg using node.js' util.inspect. It prefixes the value with the type of the argument (whether it is a primitive type or a built-in object) such that the formatting is consistent across all built-in types:
arginfo(2); // [number: 2]
arginfo({}); // [object: {}]
arginfo('?'); // [string: '?']
arginfo(true); // [boolean: true]
arginfo(/org/); // [RegExp: /org/]
arginfo(new Set()); // [Set: {}]
arginfo(new String('')); // [String: '']
arginfo(new Error('wtf')); // [Error: wtf]Example
var arginfo = require('arginfo');
function test(str) {
if('string' !== typeof str) {
console.error('test expects string. instead got: '+arginfo(str));
}
}Settings
By default, arginfo will call util.inspect with a depth of null. To limit the inspection depth of printing object properties, use arginfo.depth. eg:
var arginfo = require('arginfo');
arginfo.depth(1);
arginfo({
a: {
b: {
c:'d'
}
}
}); // [object: { a: { b: [Object] } }]Types
Primitive types:
- boolean
- number
- string
- object
- function
- symbol
Built-in objects:
- Boolean
- Number
- String
- Array
- Error
- RegExp
- Date
- Map
- Set
- WeakMap
- WeakSet
- Promise
- Generator
- DataView
- ArrayBuffer