{
  "name": "type-detect",
  "version": "0.1.1",
  "description": "Improved typeof detection for node.js and the browser.",
  "author": {
    "name": "Jake Luer",
    "email": "jake@alogicalparadox.com",
    "url": "http://alogicalparadox.com"
  },
  "license": "MIT",
  "keywords": [],
  "repository": {
    "type": "git",
    "url": "git@github.com:chaijs/type-detect.git"
  },
  "engines": {
    "node": "*"
  },
  "main": "./index",
  "scripts": {
    "test": "make test"
  },
  "dependencies": {},
  "devDependencies": {
    "component": "*",
    "coveralls": "2.0.16",
    "jscoverage": "0.3.7",
    "mocha": "*",
    "mocha-lcov-reporter": "0.0.1",
    "mocha-phantomjs": "*",
    "simple-assert": "*"
  },
  "readme": "# type-detect [![Build Status](https://travis-ci.org/chaijs/type-detect.png?branch=master)](https://travis-ci.org/chaijs/type-detect) [![Coverage Status](https://coveralls.io/repos/chaijs/type-detect/badge.png?branch=master)](https://coveralls.io/r/chaijs/type-detect?branch=master)\n\n> Improved typeof detection for node.js and the browser.\n\n## Installation\n\n### Node.js\n\n`type-detect` is available on [npm](http://npmjs.org).\n\n    $ npm install type-detect\n\n### Component\n\n`type-detect` is available as a [component](https://github.com/component/component).\n\n    $ component install chaijs/type-detect\n\n## Usage\n\n### Primary\n\nThe primary export of `type-detect` is function that can server as a replacement for \n`typeof`. The results of this function will be more specific than that of native `typeof`.\n\n```js\nvar type = require('type-detect');\n```\n\n#### array\n\n```js\nassert('array' === type([]));\nassert('array' === type(new Array()));\n```\n\n#### regexp\n\n```js\nassert('regexp' === type(/a-z/gi));\nassert('regexp' === type(new RegExp('a-z')));\n```\n\n#### function\n\n```js\nassert('function' === type(function () {}));\n```\n\n#### arguments\n\n```js\n(function () {\n  assert('arguments' === type(arguments));\n})();\n```\n\n#### date\n\n```js\nassert('date' === type(new Date));\n```\n\n#### number\n\n```js\nassert('number' === type(1));\nassert('number' === type(1.234));\nassert('number' === type(-1));\nassert('number' === type(-1.234));\nassert('number' === type(Infinity));\nassert('number' === type(NaN));\n```\n\n#### string\n\n```js\nassert('string' === type('hello world'));\n```\n\n#### null\n\n```js\nassert('null' === type(null));\nassert('null' !== type(undefined));\n```\n\n#### undefined\n\n```js\nassert('undefined' === type(undefined));\nassert('undefined' !== type(null));\n```\n\n#### object\n\n```js\nvar Noop = function () {};\nassert('object' === type({}));\nassert('object' !== type(Noop));\nassert('object' === type(new Noop));\nassert('object' === type(new Object));\nassert('object' === type(new String('hello')));\n```\n\n### Library\n\nA `Library` is a small constructed repository for custom type detections.\n\n```js\nvar lib = new type.Library;\n```\n\n#### .of (obj)\n\n* **@param** _{Mixed}_ object to test\n* **@return** _{String}_  type\n\nExpose replacement `typeof` detection to the library.\n\n```js\nif ('string' === lib.of('hello world')) {\n  // ...\n}\n```\n\n\n#### .define (type, test)\n\n* **@param** _{String}_ type \n* **@param** _{RegExp|Function}_ test \n\nAdd a test to for the `.test()` assertion.\n\nCan be defined as a regular expression:\n\n```js\nlib.define('int', /^[0-9]+$/);\n```\n\n... or as a function:\n\n```js\nlib.define('bln', function (obj) {\n  if ('boolean' === lib.of(obj)) return true;\n  var blns = [ 'yes', 'no', 'true', 'false', 1, 0 ];\n  if ('string' === lib.of(obj)) obj = obj.toLowerCase();\n  return !! ~blns.indexOf(obj);\n});\n```\n\n\n#### .test (obj, test)\n\n* **@param** _{Mixed}_ object \n* **@param** _{String}_ type \n* **@return** _{Boolean}_  result\n\nAssert that an object is of type. Will first\ncheck natives, and if that does not pass it will\nuse the user defined custom tests.\n\n```js\nassert(lib.test('1', 'int'));\nassert(lib.test('yes', 'bln'));\n```\n\n\n\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2013 Jake Luer <jake@alogicalparadox.com> (http://alogicalparadox.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n",
  "readmeFilename": "README.md",
  "bugs": {
    "url": "https://github.com/chaijs/type-detect/issues"
  },
  "_id": "type-detect@0.1.1",
  "dist": {
    "shasum": "0ba5ec2a885640e470ea4e8505971900dac58822",
    "tarball": "http://registry.npmjs.org/type-detect/-/type-detect-0.1.1.tgz"
  },
  "_from": "type-detect@0.1.1",
  "_npmVersion": "1.3.11",
  "_npmUser": {
    "name": "jakeluer",
    "email": "jake@alogicalparadox.com"
  },
  "maintainers": [
    {
      "name": "jakeluer",
      "email": "jake@alogicalparadox.com"
    }
  ],
  "directories": {},
  "_shasum": "0ba5ec2a885640e470ea4e8505971900dac58822",
  "_resolved": "https://registry.npmjs.org/type-detect/-/type-detect-0.1.1.tgz",
  "homepage": "https://github.com/chaijs/type-detect"
}
