@zkochan/pnpm
Version:
Fast, disk space efficient package manager
133 lines (132 loc) • 11 kB
JSON
{
"_args": [
[
{
"raw": "@sindresorhus/is@^0.7.0",
"scope": "@sindresorhus",
"escapedName": "@sindresorhus%2fis",
"name": "@sindresorhus/is",
"rawSpec": "^0.7.0",
"spec": ">=0.7.0 <0.8.0",
"type": "range"
},
"/home/zkochan/src/pnpm/packages/pnpm/node_modules/got"
]
],
"_from": "@sindresorhus/is@>=0.7.0 <0.8.0",
"_id": "@sindresorhus/is@0.7.0",
"_inCache": true,
"_location": "/@sindresorhus/is",
"_nodeVersion": "8.9.0",
"_npmOperationalInternal": {
"host": "s3://npm-registry-packages",
"tmp": "tmp/is-0.7.0.tgz_1513024821800_0.9983615970704705"
},
"_npmUser": {
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
"_npmVersion": "5.5.1",
"_phantomChildren": {},
"_requested": {
"raw": "@sindresorhus/is@^0.7.0",
"scope": "@sindresorhus",
"escapedName": "@sindresorhus%2fis",
"name": "@sindresorhus/is",
"rawSpec": "^0.7.0",
"spec": ">=0.7.0 <0.8.0",
"type": "range"
},
"_requiredBy": [
"/got"
],
"_resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.7.0.tgz",
"_shasum": "9a06f4f137ee84d7df0460c1fdb1135ffa6c50fd",
"_shrinkwrap": null,
"_spec": "@sindresorhus/is@^0.7.0",
"_where": "/home/zkochan/src/pnpm/packages/pnpm/node_modules/got",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/is/issues"
},
"dependencies": {},
"description": "Type check values: `is.string('🦄') //=> true`",
"devDependencies": {
"@types/jsdom": "^2.0.31",
"@types/node": "^8.0.47",
"@types/tempy": "^0.1.0",
"ava": "*",
"del-cli": "^1.1.0",
"jsdom": "^9.12.0",
"tempy": "^0.2.1",
"tslint": "^5.8.0",
"tslint-xo": "^0.3.0",
"typescript": "^2.6.1"
},
"directories": {},
"dist": {
"integrity": "sha512-ONhaKPIufzzrlNbqtWFFd+jlnemX6lJAgq9ZeiZtS7I1PIf/la7CW4m83rTXRnVnsMbW2k56pGYu7AUFJD9Pow==",
"shasum": "9a06f4f137ee84d7df0460c1fdb1135ffa6c50fd",
"tarball": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.7.0.tgz"
},
"engines": {
"node": ">=4"
},
"files": [
"dist"
],
"gitHead": "828a5b3088804f32fec824a2fbff0396d4cd13b3",
"homepage": "https://github.com/sindresorhus/is#readme",
"keywords": [
"type",
"types",
"is",
"check",
"checking",
"validate",
"validation",
"utility",
"util",
"typeof",
"instanceof",
"object",
"assert",
"assertion",
"test",
"kind",
"primitive",
"verify",
"compare"
],
"license": "MIT",
"main": "dist/index.js",
"maintainers": [
{
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
}
],
"name": "@sindresorhus/is",
"optionalDependencies": {},
"publishConfig": {
"access": "public"
},
"readme": "# is [](https://travis-ci.org/sindresorhus/is)\n\n> Type check values: `is.string('🦄') //=> true`\n\n<img src=\"header.gif\" width=\"182\" align=\"right\">\n\n\n## Install\n\n```\n$ npm install @sindresorhus/is\n```\n\n\n## Usage\n\n```js\nconst is = require('@sindresorhus/is');\n\nis('🦄');\n//=> 'string'\n\nis(new Map());\n//=> 'Map'\n\nis.number(6);\n//=> true\n```\n\n\n## API\n\n### is(value)\n\nReturns the type of `value`.\n\nPrimitives are lowercase and object types are camelcase.\n\nExample:\n\n- `'undefined'`\n- `'null'`\n- `'string'`\n- `'symbol'`\n- `'Array'`\n- `'Function'`\n- `'Object'`\n\nNote: It will throw if you try to feed it object-wrapped primitives, as that's a bad practice. For example `new String('foo')`.\n\n### is.{method}\n\nAll the below methods accept a value and returns a boolean for whether the value is of the desired type.\n\n#### Primitives\n\n##### .undefined(value)\n##### .null(value)\n##### .string(value)\n##### .number(value)\n##### .boolean(value)\n##### .symbol(value)\n\n#### Built-in types\n\n##### .array(value)\n##### .function(value)\n##### .buffer(value)\n##### .object(value)\n\nKeep in mind that [functions are objects too](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions).\n\n##### .regExp(value)\n##### .date(value)\n##### .error(value)\n##### .nativePromise(value)\n##### .promise(value)\n\nReturns `true` for any object with a `.then()` and `.catch()` method. Prefer this one over `.nativePromise()` as you usually want to allow userland promise implementations too.\n\n##### .generator(value)\n\nReturns `true` for any object that implements its own `.next()` and `.throw()` methods and has a function definition for `Symbol.iterator`.\n\n##### .generatorFunction(value)\n\n##### .asyncFunction(value)\n\nReturns `true` for any `async` function that can be called with the `await` operator.\n\n```js\nis.asyncFunction(async () => {});\n// => true\n\nis.asyncFunction(() => {});\n// => false\n```\n\n##### .boundFunction(value)\n\nReturns `true` for any `bound` function.\n\n```js\nis.boundFunction(() => {});\n// => true\n\nis.boundFunction(function () {}.bind(null));\n// => true\n\nis.boundFunction(function () {});\n// => false\n```\n\n##### .map(value)\n##### .set(value)\n##### .weakMap(value)\n##### .weakSet(value)\n\n#### Typed arrays\n\n##### .int8Array(value)\n##### .uint8Array(value)\n##### .uint8ClampedArray(value)\n##### .int16Array(value)\n##### .uint16Array(value)\n##### .int32Array(value)\n##### .uint32Array(value)\n##### .float32Array(value)\n##### .float64Array(value)\n\n#### Structured data\n\n##### .arrayBuffer(value)\n##### .sharedArrayBuffer(value)\n##### .dataView(value)\n\n#### Miscellaneous\n\n##### .directInstanceOf(value, class)\n\nReturns `true` if `value` is a direct instance of `class`.\n\n```js\nis.directInstanceOf(new Error(), Error);\n//=> true\n\nclass UnicornError extends Error {};\n\nis.directInstanceOf(new UnicornError(), Error);\n//=> false\n```\n\n##### .truthy(value)\n\nReturns `true` for all values that evaluate to true in a boolean context:\n\n```js\nis.truthy('🦄');\n//=> true\n\nis.truthy(undefined);\n//=> false\n```\n\n##### .falsy(value)\n\nReturns `true` if `value` is one of: `false`, `0`, `''`, `null`, `undefined`, `NaN`.\n\n##### .nan(value)\n##### .nullOrUndefined(value)\n##### .primitive(value)\n\nJavaScript primitives are as follows: `null`, `undefined`, `string`, `number`, `boolean`, `symbol`.\n\n##### .integer(value)\n\n##### .safeInteger(value)\n\nReturns `true` if `value` is a [safe integer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isSafeInteger).\n\n##### .plainObject(value)\n\nAn object is plain if it's created by either `{}`, `new Object()`, or `Object.create(null)`.\n\n##### .iterable(value)\n##### .class(value)\n\nReturns `true` for instances created by a ES2015 class.\n\n##### .typedArray(value)\n\n##### .arrayLike(value)\n\nA `value` is array-like if it is not a function and has a `value.length` that is a safe integer greater than or equal to 0.\n\n```js\nis.arrayLike(document.forms);\n//=> true\n\nfunction () {\n is.arrayLike(arguments);\n //=> true\n}\n```\n\n##### .inRange(value, range)\n\nCheck if `value` (number) is in the given `range`. The range is an array of two values, lower bound and upper bound, in no specific order.\n\n```js\nis.inRange(3, [0, 5]);\nis.inRange(3, [5, 0]);\nis.inRange(0, [-2, 2]);\n```\n\n##### .inRange(value, upperBound)\n\nCheck if `value` (number) is in the range of `0` to `upperBound`.\n\n```js\nis.inRange(3, 10);\n```\n\n##### .domElement(value)\n\nReturns `true` if `value` is a DOM Element.\n\n##### .nodeStream(value)\n\nReturns `true` if `value` is a Node.js [stream](https://nodejs.org/api/stream.html).\n\n```js\nconst fs = require('fs');\nis.nodeStream(fs.createReadStream('unicorn.png'));\n//=> true\n```\n\n##### .infinite(value)\n\nCheck if `value` is `Infinity` or `-Infinity`.\n\n##### .even(value)\n\nReturns `true` if `value` is an even integer.\n\n##### .odd(value)\n\nReturns `true` if `value` is an odd integer.\n\n##### .empty(value)\n\nReturns `true` if `value` is falsy or an empty string, array, object, map, or set.\n\n##### .emptyOrWhitespace(value)\n\nReturns `true` if `is.empty(value)` or a string that is all whitespace.\n\n\n##### .any(predicate, ...values)\n\nReturns `true` if **any** of the input `values` returns true in the `predicate`:\n\n```js\nis.any(is.string, {}, true, '🦄');\n//=> true\n\nis.any(is.boolean, 'unicorns', [], new Map());\n//=> false\n```\n\n##### .all(predicate, ...values)\n\nReturns `true` if **all** of the input `values` returns true in the `predicate`:\n\n```js\nis.all(is.object, {}, new Map(), new Set());\n//=> true\n\nis.all(is.string, '🦄', [], 'unicorns');\n//=> false\n```\n\n## FAQ\n\n### Why yet another type checking module?\n\nThere are hundreds of type checking modules on npm, unfortunately, I couldn't find any that fit my needs:\n\n- Includes both type methods and ability to get the type\n- Types of primitives returned as lowercase and object types as camelcase\n- Covers all built-ins\n- Unsurprising behavior\n- Well-maintained\n- Comprehensive test suite\n\nFor the ones I found, pick 3 of these.\n\nThe most common mistakes I noticed in these modules was using `instanceof` for type checking, forgetting that functions are objects, and omitting `symbol` as a primitive.\n\n\n## Related\n\n- [is-stream](https://github.com/sindresorhus/is-stream) - Check if something is a Node.js stream\n- [is-observable](https://github.com/sindresorhus/is-observable) - Check if a value is an Observable\n- [file-type](https://github.com/sindresorhus/file-type) - Detect the file type of a Buffer/Uint8Array\n- [is-ip](https://github.com/sindresorhus/is-ip) - Check if a string is an IP address\n- [is-array-sorted](https://github.com/sindresorhus/is-array-sorted) - Check if an Array is sorted\n- [is-error-constructor](https://github.com/sindresorhus/is-error-constructor) - Check if a value is an error constructor\n- [is-empty-iterable](https://github.com/sindresorhus/is-empty-iterable) - Check if an Iterable is empty\n- [is-blob](https://github.com/sindresorhus/is-blob) - Check if a value is a Blob - File-like object of immutable, raw data\n- [has-emoji](https://github.com/sindresorhus/has-emoji) - Check whether a string has any emoji\n\n\n## Created by\n\n- [Sindre Sorhus](https://github.com/sindresorhus)\n- [Giora Guttsait](https://github.com/gioragutt)\n- [Brandon Smith](https://github.com/brandon93s)\n\n\n## License\n\nMIT\n",
"readmeFilename": "readme.md",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/is.git"
},
"scripts": {
"build": "tsc",
"lint": "tslint --format stylish --project .",
"prepublish": "npm run build && del dist/tests",
"test": "npm run lint && npm run build && ava dist/tests"
},
"types": "dist/index.d.ts",
"version": "0.7.0"
}