| @ -0,0 +1,19 @@ | |||||
| var v8type = require('../'); | |||||
| console.dir(v8type.instance([], v8type.ARRAY)); | |||||
| // true | |||||
| console.dir(v8type.instance([], v8type.OBJECT)); | |||||
| // true | |||||
| console.dir(v8type.instance(5, v8type.OBJECT)); | |||||
| // false | |||||
| console.dir(v8type.instance(5, v8type.PRIMITIVE)); | |||||
| // true | |||||
| console.dir(v8type.instance(new Number(5), v8type.NUMBER)); | |||||
| // true | |||||
| console.dir(v8type.instance(new Number(5), v8type.OBJECT)); | |||||
| // true | |||||
| @ -0,0 +1,11 @@ | |||||
| var v8type = require('../'); | |||||
| console.dir(v8type.is([1,2,3], v8type.ARRAY)); | |||||
| // true | |||||
| console.dir(v8type.is({}, v8type.NULL)); | |||||
| // false | |||||
| // is does not check inheritence | |||||
| console.dir(v8type.is([], v8type.OBJECT)); | |||||
| // false | |||||
| @ -0,0 +1,28 @@ | |||||
| var v8type = require('../'); | |||||
| console.log(v8type.of([1,2,3,4])); | |||||
| // 'array' | |||||
| console.log(v8type.of(undefined)); | |||||
| // 'undefined' | |||||
| console.log(v8type.of(5)); | |||||
| // 'number' | |||||
| console.log(v8type.of(new Number(5))) | |||||
| // 'number_object' | |||||
| console.log(v8type.of('v8type')); | |||||
| // 'string' | |||||
| console.log(v8type.of(new RegExp('v8type'))); | |||||
| // 'regexp' | |||||
| console.log(v8type.of({})); | |||||
| // 'object' | |||||
| console.log(v8type.of(function(){})); | |||||
| // 'function' | |||||
| console.log(v8type.of(new Date())); | |||||
| // 'date' | |||||