Skip to content

Latest commit

 

History

History
50 lines (34 loc) · 1007 Bytes

.verb.md

File metadata and controls

50 lines (34 loc) · 1007 Bytes

Usage

(A few of the types have some extra formatting where it makes sense. For example, instead of a regexp, it returns a regular expression, which IMHO is more readable to users. You can customize mappings if you want)

var type = require('{%= name %}');

console.log(type({}));
//=> 'an object'

console.log(type([]));
//=> 'an array'

console.log(type(9));
//=> 'a number'

console.log(type(/abc/));
//=> 'a regular expression'

console.log(type(new WeakMap()));
//=> 'a WeakMap'

Get the object of types-to-articles mappings:

var types = require('{%= name %}').types;

Also exposes a typeOf property, for getting the native type only:

var type = require('{%= name %}');
type.types.weapmap = 'a WeakMap()';

console.log(type.typeOf(new WeakMap()));
//=> 'weakmap'

Customize

Customize any of the mappings:

var type = require('{%= name %}');
type.types.weapmap = 'a WeakMap()';

console.log(type(new WeakMap()));
//=> 'a WeakMap()'