is-lite is a concise and efficient JavaScript utility library for performing type checks and validations, currently at version 2.0.0. It offers a comprehensive suite of functions for identifying various data types, ranging from primitives like `string` and `number` to complex structures such as `Array`, `Map`, `class` constructors, and asynchronous functions. A core strength of is-lite is its robust TypeScript support, which includes type guards that facilitate accurate type inference within conditional statements, thereby improving code safety and developer experience. The library is designed to be lightweight, providing a minimal bundle size, and supports tree-shakeable, individual imports for each type checker from the `is-lite/standalone` path, optimizing performance in bundle-conscious environments. It maintains a consistent release cadence, with frequent updates incorporating new features and dependency upgrades, demonstrating active maintenance and evolution.
npm install is-liteVerified import paths — ran on the pinned version, not inferred.
Demonstrates importing the main `is` object and individual type checkers, then uses them to inspect various values and show type guards in action.
Ensure your project's build tooling (e.g., Webpack, Rollup, Parcel, tsup) is configured to correctly handle ESM modules. For Node.js, ensure your package.json `type` field is set to `module` or use `.mjs` extensions for ESM files.
Review your import statements. If you were accessing utilities in a non-standard way, update to use `import is from 'is-lite'` for the main object or `import { isChecker } from 'is-lite/standalone'` for individual checkers.If `NaN` should be treated as a number, use `is.number(value) || is.nan(value)` or directly use `typeof value === 'number'` for a broader check. `is.numericString` will correctly identify string 'NaN'.
To check against the full prototype chain, use JavaScript's native `value instanceof class` operator instead. For example, `new APIError() instanceof Error` would be `true`, while `is.instanceOf(new APIError(), Error)` is `false`.
Change your import statement from `import { isString } from 'is-lite';` to `import { isString } from 'is-lite/standalone';`.If you imported `is` as the main object, access specific checkers as `is.string(value)`. If you want the tree-shakeable `isString` function, import it directly via `import { isString } from 'is-lite/standalone';`.No dependency data recorded yet.