{"_id":"@marionebl/is","_rev":"1-089bc0bb2c0028b93c5c14f78169867f","name":"@marionebl/is","description":"Type check values: `is.string('🦄') //=> true`","dist-tags":{"latest":"0.5.1-0"},"versions":{"0.5.1-0":{"name":"@marionebl/is","version":"0.5.1-0","description":"Type check values: `is.string('🦄') //=> true`","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/is.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"publishConfig":{"access":"public"},"main":"dist/index.js","engines":{"node":">=4"},"scripts":{"lint":"tslint --format stylish --project .","build":"tsc","test":"npm run lint && npm run build && ava dist/tests","prepublish":"npm run build && del dist/tests"},"files":["dist"],"keywords":["type","types","is","check","checking","validate","validation","utility","util","typeof","instanceof","object","assert","assertion","test","kind","primitive","verify","compare"],"devDependencies":{"@types/jsdom":"^2.0.31","@types/node":"^8.0.47","ava":"*","del-cli":"^1.1.0","jsdom":"^9.12.0","tslint":"^5.8.0","tslint-xo":"^0.3.0","typescript":"^2.6.1"},"types":"dist/index.d.ts","gitHead":"6e808eb32dcf632edfb04b23ee9de157d4f71284","bugs":{"url":"https://github.com/sindresorhus/is/issues"},"homepage":"https://github.com/sindresorhus/is#readme","_id":"@marionebl/is@0.5.1-0","_npmVersion":"5.5.1","_nodeVersion":"8.4.0","_npmUser":{"name":"marionebl","email":"hello@mario-nebl.de"},"dist":{"integrity":"sha512-EEU1UUsQQzMaH7nyzB7VzasjtAAMJyN7QNXYL4ghhmcvbrvrHbfcTWCiyjkPjorADxI2gUCINMNiXQc46UFxUA==","shasum":"a7b1ef5210068b660ed08fa73557e6ab7d7cc491","tarball":"https://registry.npmjs.org/@marionebl/is/-/is-0.5.1-0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHQpqXTg2j+3LXGpDBFydy4jayhvj4bphIcK+RrgB9zmAiEAwBx00do+d6ciJH9M5/6nus06+vruAVl9rVf/HrvfN/U="}]},"maintainers":[{"name":"marionebl","email":"hello@mario-nebl.de"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/is-0.5.1-0.tgz_1510326366441_0.12163739558309317"}}},"readme":"# is [![Build Status](https://travis-ci.org/sindresorhus/is.svg?branch=master)](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##### .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##### .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##### .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","maintainers":[{"name":"marionebl","email":"hello@mario-nebl.de"}],"time":{"modified":"2022-04-06T03:38:01.647Z","created":"2017-11-10T15:06:06.511Z","0.5.1-0":"2017-11-10T15:06:06.511Z"},"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"],"repository":{"type":"git","url":"git+https://github.com/sindresorhus/is.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"bugs":{"url":"https://github.com/sindresorhus/is/issues"},"license":"MIT","readmeFilename":"readme.md"}