{"repo":"sindresorhus/is","free":true,"listed":false,"github":"https://github.com/sindresorhus/is","clone":"git clone https://github.com/sindresorhus/is.git","description":"Type check values","language":"TypeScript","stars":1791,"topics":["type-detection","type-check","is","assertions","typescript","node-module","npm-package"],"license":"MIT","category":"dev-tools","readme_excerpt":"is Type check values For example, is.string('🦄') //= true Highlights - Written in TypeScript - Extensive use of type guards - Supports type assertions - Aware of generic type parameters (use with caution) - Actively maintained - Install Usage Assertions perform the same type checks, but throw an error if the type does not match. Assertions (except assertAll and assertAny ) also support an optional custom error message. And with TypeScript: Named exports Named exports allow tooling to perform tree-shaking, potentially reducing bundle size by including only code from the methods that are used. Every method listed below is available as a named export. Each method is prefixed by either is or assert depending on usage. For example: API is(value) Returns the type of value . Primitives are lowercase and object types are camelcase. Example: - 'undefined' - 'null' - 'string' - 'symbol' - 'Array' - 'Function' - 'Object' This method is also exported as detect . You can import it like this: Note: It will throw an error if you try to feed it object-wrapped primitives, as that's a bad practice. For example new String('foo') . is.{method} All the below methods accept a value and return a boolean for whether the value is of the desired type. Primitives .undefined(value) .null(value) .string(value) .number(value) Note: is.number(NaN) returns false . This intentionally deviates from typeof behavior to increase user-friendliness of is type checks. .boolean(value) .symbol(value) .bigint(value) ","default_branch":null,"files":null,"tree":[],"storefront":"/r/sindresorhus","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/sindresorhus/is/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}