{
	"name": "precond",
	"versions": {
		"0.1.0": {
			"name": "precond",
			"description": "Preconditions checking utilities.",
			"version": "0.1.0",
			"author": {
				"name": "Mathieu Turcotte",
				"email": "turcotte.mat@gmail.com"
			},
			"keywords": [
				"preconditions",
				"asserts",
				"invariants"
			],
			"repository": {
				"type": "git",
				"url": "https://github.com/MathieuTurcotte/node-precond.git"
			},
			"devDependencies": {
				"nodeunit": "0.7",
				"jshint": "0.9.0"
			},
			"scripts": {
				"pretest": "node_modules/jshint/bin/hint lib/ tests/ examples/ index.js",
				"test": "node_modules/nodeunit/bin/nodeunit tests/"
			},
			"engines": {
				"node": ">= 0.6"
			},
			"_id": "precond@0.1.0",
			"dist": {
				"shasum": "6c5fd283b3c6f46d342261686378f1fdac04cd3c",
				"tarball": "https://registry.npmjs.org/precond/-/precond-0.1.0.tgz"
			},
			"_npmVersion": "1.1.62",
			"_npmUser": {
				"name": "mathieu",
				"email": "turcotte.mat@gmail.com"
			},
			"maintainers": [
				{
					"name": "mathieu",
					"email": "turcotte.mat@gmail.com"
				}
			],
			"directories": {},
			"contributors": []
		},
		"0.1.1": {
			"name": "precond",
			"description": "Preconditions checking utilities.",
			"version": "0.1.1",
			"author": {
				"name": "Mathieu Turcotte",
				"email": "turcotte.mat@gmail.com"
			},
			"keywords": [
				"preconditions",
				"asserts",
				"invariants"
			],
			"repository": {
				"type": "git",
				"url": "https://github.com/MathieuTurcotte/node-precond.git"
			},
			"devDependencies": {
				"nodeunit": "0.7",
				"jshint": "0.9.0"
			},
			"scripts": {
				"pretest": "node_modules/jshint/bin/hint lib/ tests/ examples/ index.js",
				"test": "node_modules/nodeunit/bin/nodeunit tests/"
			},
			"engines": {
				"node": ">= 0.6"
			},
			"_id": "precond@0.1.1",
			"dist": {
				"shasum": "6d44c7f8d3dc76bb43824bef494177771718b8e7",
				"tarball": "https://registry.npmjs.org/precond/-/precond-0.1.1.tgz"
			},
			"_npmVersion": "1.1.62",
			"_npmUser": {
				"name": "mathieu",
				"email": "turcotte.mat@gmail.com"
			},
			"maintainers": [
				{
					"name": "mathieu",
					"email": "turcotte.mat@gmail.com"
				}
			],
			"directories": {},
			"contributors": []
		},
		"0.2.0": {
			"name": "precond",
			"description": "Precondition checking utilities.",
			"version": "0.2.0",
			"author": {
				"name": "Mathieu Turcotte",
				"email": "turcotte.mat@gmail.com"
			},
			"keywords": [
				"precondition",
				"assert",
				"invariant",
				"contract",
				"condition"
			],
			"repository": {
				"type": "git",
				"url": "https://github.com/MathieuTurcotte/node-precond.git"
			},
			"devDependencies": {
				"nodeunit": "0.8",
				"jshint": "2.1"
			},
			"scripts": {
				"pretest": "node_modules/.bin/jshint lib/ tests/ examples/ index.js",
				"test": "node_modules/.bin/nodeunit tests/"
			},
			"engines": {
				"node": ">= 0.6"
			},
			"_id": "precond@0.2.0",
			"dist": {
				"shasum": "9c72fb8655611c87bd122f4cad60f43829b3e2b7",
				"tarball": "https://registry.npmjs.org/precond/-/precond-0.2.0.tgz"
			},
			"_from": ".",
			"_npmVersion": "1.2.14",
			"_npmUser": {
				"name": "mathieu",
				"email": "turcotte.mat@gmail.com"
			},
			"maintainers": [
				{
					"name": "mathieu",
					"email": "turcotte.mat@gmail.com"
				}
			],
			"directories": {},
			"contributors": []
		},
		"0.2.1": {
			"name": "precond",
			"description": "Precondition checking utilities.",
			"version": "0.2.1",
			"author": {
				"name": "Mathieu Turcotte",
				"email": "turcotte.mat@gmail.com"
			},
			"keywords": [
				"precondition",
				"assert",
				"invariant",
				"contract",
				"condition"
			],
			"repository": {
				"type": "git",
				"url": "https://github.com/MathieuTurcotte/node-precond.git"
			},
			"devDependencies": {
				"nodeunit": "0.8",
				"jshint": "2.1"
			},
			"scripts": {
				"pretest": "node_modules/.bin/jshint lib/ examples/ index.js",
				"test": "node_modules/.bin/nodeunit tests/"
			},
			"engines": {
				"node": ">= 0.6"
			},
			"_id": "precond@0.2.1",
			"dist": {
				"shasum": "214895838fb1a35d0a17f8523e758b43bb57ba55",
				"tarball": "https://registry.npmjs.org/precond/-/precond-0.2.1.tgz"
			},
			"_from": ".",
			"_npmVersion": "1.2.14",
			"_npmUser": {
				"name": "mathieu",
				"email": "turcotte.mat@gmail.com"
			},
			"maintainers": [
				{
					"name": "mathieu",
					"email": "turcotte.mat@gmail.com"
				}
			],
			"directories": {},
			"contributors": []
		},
		"0.2.2": {
			"name": "precond",
			"description": "Precondition checking utilities.",
			"version": "0.2.2",
			"author": {
				"name": "Mathieu Turcotte",
				"email": "turcotte.mat@gmail.com"
			},
			"keywords": [
				"precondition",
				"assert",
				"invariant",
				"contract",
				"condition"
			],
			"repository": {
				"type": "git",
				"url": "https://github.com/MathieuTurcotte/node-precond.git"
			},
			"devDependencies": {
				"nodeunit": "0.8",
				"jshint": "2.1"
			},
			"scripts": {
				"pretest": "node_modules/.bin/jshint lib/ examples/ index.js",
				"test": "node_modules/.bin/nodeunit tests/"
			},
			"engines": {
				"node": ">= 0.6"
			},
			"_id": "precond@0.2.2",
			"dist": {
				"shasum": "c6ce717f909e7dd0a08d515f9fb428041d6f992e",
				"tarball": "https://registry.npmjs.org/precond/-/precond-0.2.2.tgz"
			},
			"_from": ".",
			"_npmVersion": "1.2.14",
			"_npmUser": {
				"name": "mathieu",
				"email": "turcotte.mat@gmail.com"
			},
			"maintainers": [
				{
					"name": "mathieu",
					"email": "turcotte.mat@gmail.com"
				}
			],
			"directories": {},
			"contributors": []
		},
		"0.2.3": {
			"name": "precond",
			"description": "Precondition checking utilities.",
			"version": "0.2.3",
			"author": {
				"name": "Mathieu Turcotte",
				"email": "turcotte.mat@gmail.com"
			},
			"keywords": [
				"precondition",
				"assert",
				"invariant",
				"contract",
				"condition"
			],
			"repository": {
				"type": "git",
				"url": "https://github.com/MathieuTurcotte/node-precond.git"
			},
			"devDependencies": {
				"nodeunit": "0.9",
				"jshint": "2.5"
			},
			"scripts": {
				"pretest": "node_modules/.bin/jshint lib/ examples/ index.js",
				"test": "node_modules/.bin/nodeunit tests/"
			},
			"engines": {
				"node": ">= 0.6"
			},
			"files": [
				"index.js",
				"lib"
			],
			"bugs": {
				"url": "https://github.com/MathieuTurcotte/node-precond/issues"
			},
			"_id": "precond@0.2.3",
			"dist": {
				"shasum": "aa9591bcaa24923f1e0f4849d240f47efc1075ac",
				"tarball": "https://registry.npmjs.org/precond/-/precond-0.2.3.tgz"
			},
			"_from": ".",
			"_npmVersion": "1.3.11",
			"_npmUser": {
				"name": "mathieu",
				"email": "turcotte.mat@gmail.com"
			},
			"maintainers": [
				{
					"name": "mathieu",
					"email": "turcotte.mat@gmail.com"
				}
			],
			"directories": {},
			"contributors": []
		}
	},
	"time": {
		"modified": "2014-06-21T13:37:39.556Z",
		"created": "2012-11-15T01:33:14.214Z",
		"0.1.0": "2012-11-15T01:33:15.122Z",
		"0.1.1": "2012-11-16T03:46:33.767Z",
		"0.2.0": "2013-05-26T15:00:02.377Z",
		"0.2.1": "2013-05-26T16:45:32.480Z",
		"0.2.2": "2013-06-15T14:53:50.913Z",
		"0.2.3": "2014-06-21T13:37:39.556Z"
	},
	"users": {},
	"dist-tags": {
		"latest": "0.2.3"
	},
	"_uplinks": {
		"npmjs": {
			"etag": "W/\"a7169de6f25a6d3b741d002370edb693\"",
			"fetched": 1602009453977
		}
	},
	"_distfiles": {
		"precond-0.1.0.tgz": {
			"url": "https://registry.npmjs.org/precond/-/precond-0.1.0.tgz",
			"sha": "6c5fd283b3c6f46d342261686378f1fdac04cd3c",
			"registry": "npmjs"
		},
		"precond-0.1.1.tgz": {
			"url": "https://registry.npmjs.org/precond/-/precond-0.1.1.tgz",
			"sha": "6d44c7f8d3dc76bb43824bef494177771718b8e7",
			"registry": "npmjs"
		},
		"precond-0.2.0.tgz": {
			"url": "https://registry.npmjs.org/precond/-/precond-0.2.0.tgz",
			"sha": "9c72fb8655611c87bd122f4cad60f43829b3e2b7",
			"registry": "npmjs"
		},
		"precond-0.2.1.tgz": {
			"url": "https://registry.npmjs.org/precond/-/precond-0.2.1.tgz",
			"sha": "214895838fb1a35d0a17f8523e758b43bb57ba55",
			"registry": "npmjs"
		},
		"precond-0.2.2.tgz": {
			"url": "https://registry.npmjs.org/precond/-/precond-0.2.2.tgz",
			"sha": "c6ce717f909e7dd0a08d515f9fb428041d6f992e",
			"registry": "npmjs"
		},
		"precond-0.2.3.tgz": {
			"url": "https://registry.npmjs.org/precond/-/precond-0.2.3.tgz",
			"sha": "aa9591bcaa24923f1e0f4849d240f47efc1075ac",
			"registry": "npmjs"
		}
	},
	"_attachments": {
		"precond-0.2.3.tgz": {
			"shasum": "aa9591bcaa24923f1e0f4849d240f47efc1075ac"
		}
	},
	"_rev": "21-38e3dc3ca954619f",
	"_id": "precond",
	"readme": "# Preconditions for Node.js\n[![Build Status](https://secure.travis-ci.org/MathieuTurcotte/node-precond.png?branch=master)](https://travis-ci.org/MathieuTurcotte/node-precond)\n[![NPM version](https://badge.fury.io/js/precond.png)](http://badge.fury.io/js/precond)\n\nPrecondition checks for Node.js inspired by [Guava's precondition checking\nutilities](https://code.google.com/p/guava-libraries/wiki/PreconditionsExplained).\n\n## Installation\n\n```\nnpm install precond\n```\n\n## Unit tests\n\n```\nnpm test\n```\n\n## Overview\n\nPrecond provides a set of functions to verify arguments and state correctness\n\nIt lets you rewrite constructs like the following\n\n```js\nif (!this.isConnected) {\n    throw new Error('Client should be connected before calling X.');\n}\n```\n\ninto a more compact and declarative check bellow.\n\n```js\nprecond.checkState(this.isConnected, 'Client should be ...');\n```\n\n**Note that even though the throw statement is wrapped in a function, the call\nstack will still start from the calling function. So the previous examples would\nboth produce the same stack trace.**\n\nAll arguments after the message will be used to format the actual error\nmessage that will be thrown.\n\nThe following precondition checks are provded:\n\n- checkArgument(value, [messageFormat, [formatArgs, ...]])\n- checkState(value, [messageFormat, [formatArgs, ...]])\n- checkIsDef(value, [messageFormat, [formatArgs, ...]]) -> value\n- checkIsDefAndNotNull(value, [messageFormat, [formatArgs, ...]]) -> value\n- checkIsString(value, [messageFormat, [formatArgs, ...]]) -> value\n- checkIsArray(value, [messageFormat, [formatArgs, ...]]) -> value\n- checkIsNumber(value, [messageFormat, [formatArgs, ...]]) -> value\n- checkIsBoolean(value, [messageFormat, [formatArgs, ...]]) -> value\n- checkIsFunction(value, [messageFormat, [formatArgs, ...]]) -> value\n- checkIsObject(value, [messageFormat, [formatArgs, ...]]) -> value\n\n## API\n\n### Static functions\n\n#### precond.checkArgument(value, [messageFormat, [formatArgs, ...]])\n\n- value: the value that is required to be truthy\n- messageFormat: error message format template\n- formatArgs: arguments to be substituted into the message template\n\nEnsures that value is true. Throws an `IllegalArgumentError` if value\nis false.\n\n#### precond.checkState(value, [messageFormat, [formatArgs, ...]])\n\n- value: the value that is required to be truthy\n- messageFormat: error message format template\n- formatArgs: arguments to be substituted into the message template\n\nEnsures that value is true. Throws an `IllegalStateError` if value\nis false.\n\n#### precond.checkIsDef(value, [messageFormat, [formatArgs, ...]])\n\n- value: the value that is required to be defined\n- messageFormat: error message format template\n- formatArgs: arguments to be substituted into the message template\n\nEnsures that value is defined (could be null). Throws an\n`IllegalArgumentError` if value is undefined. Returns the value of\nthe value that was validated.\n\n#### precond.checkIsDefAndNotNull(value, [messageFormat, [formatArgs, ...]])\n\n- value: the value that is required to be defined and not null\n- messageFormat: error message format template\n- formatArgs: arguments to be substituted into the message template\n\nEnsures that value is defined and not null. Throws an\n`IllegalArgumentError` if value is undefined or null. Returns the value of\nthe value that was validated.\n\n#### precond.checkIsString(value, [messageFormat, [formatArgs, ...]])\n\n- value: the value that is required to be a string\n- messageFormat: error message format template\n- formatArgs: arguments to be substituted into the message template\n\nEnsures that value is a string or a String object. Throws an\n`IllegalArgumentError` if value isn't a string. Returns the value of\nthe value that was validated.\n\n#### precond.checkIsArray(value, [messageFormat, [formatArgs, ...]])\n\n- value: the value that is required to be an array\n- messageFormat: error message format template\n- formatArgs: arguments to be substituted into the message template\n\nEnsures that value is an array. Throws an `IllegalArgumentError` if\nvalue isn't an array. Returns the value of the value that was\nvalidated.\n\n#### precond.checkIsNumber(value, [messageFormat, [formatArgs, ...]])\n\n- value: the value that is required to be a number\n- messageFormat: error message format template\n- formatArgs: arguments to be substituted into the message template\n\nEnsures that value is a number. Throws an `IllegalArgumentError` if\nvalue isn't a number. Returns the value of the value that was\nvalidated.\n\n#### precond.checkIsBoolean(value, [messageFormat, [formatArgs, ...]])\n\n- value: the value that is required to be a boolean\n- messageFormat: error message format template\n- formatArgs: arguments to be substituted into the message template\n\nEnsures that value is a boolean. Throws an `IllegalArgumentError` if\nvalue isn't a boolean. Returns the value of the value that was\nvalidated.\n\n#### precond.checkIsFunction(value, [messageFormat, [formatArgs, ...]])\n\n- value: the value that is required to be a function\n- messageFormat: error message format template\n- formatArgs: arguments to be substituted into the message template\n\nEnsures that value is a function. Throws an `IllegalArgumentError` if\nvalue isn't a function. Returns the value of the value that was\nvalidated.\n\n#### precond.checkIsObject(value, [messageFormat, [formatArgs, ...]])\n\n- value: the value that is required to be an object\n- messageFormat: error message format template\n- formatArgs: arguments to be substituted into the message template\n\nEnsures that value is an object. Throws an `IllegalArgumentError` if\nvalue isn't an object. Returns the value of the value that was\nvalidated.\n\n### Class precond.IllegalArgumentError\n\nExtends `Error` and is thrown to signal illegal arguments.\n\n### Class precond.IllegalStateError\n\nExtends `Error` and is thrown to signal that the program or object has reached\nan illegal state.\n\n## License\n\nThis code is free to use under the terms of the [MIT license](http://mturcotte.mit-license.org/)."
}