function oftype(val, type) {
    if (type === undefined || val === undefined) {
	return type === val;

    } else if (val === null) {
	return type === null || 
	       oftype.nullAsObject && type === Object;

    } else if (type === Number) {
	if (oftype.primitiveObject) {
	    return toString.call(val) === '[object Number]';
	}

	return typeof val === 'number';

    } else if (type === String) {
	if (oftype.primitiveObject) {
	    return toString.call(val) === '[object String]';
	}

	return typeof val === 'string';

    } else if (type === Boolean) {
	if (oftype.primitiveObject) {
	    return toString.call(val) === '[object Boolean]';
	}

	return typeof val === 'boolean';

    } else {
	return type instanceof Function &&
	       val instanceof type;
    }
}

oftype.nullAsObject = false;
oftype.primitiveObject = true;

module.exports = oftype;

@@ -18,19 +18,327 @@
 al, type
-) %7B
+, options) %7B%0A    nullAsObject = oftype.nullAsObject;%0A    primitiveObject = oftype.primitiveObject;%0A%0A    if (options && (options.nullAsObject !== undefined)) %7B%0A%09nullAsObject = options.nullAsObject;%0A    %7D%0A%0A    if (options && (options.primitiveObject !== undefined)) %7B%0A%09primitive = options.primitiveObject;%0A%0A    %7D%0A
 %0A    if 
@@ -465,23 +465,23 @@
 %7C%7C %0A
-%09
        
-oftype.
+        
 null
@@ -541,39 +541,32 @@
  Number) %7B%0A%09if (
-oftype.
 primitiveObject)
@@ -691,39 +691,32 @@
  String) %7B%0A%09if (
-oftype.
 primitiveObject)
@@ -849,20 +849,13 @@
 ) %7B%0A
+
 %09if (
-oftype.
 prim

add options parameter