9.4.0-next.1703778254.acb9c34358ef897fb27cdc9a030bda131e6cab12 • Published 2 years ago

typechecker v9.4.0-next.1703778254.acb9c34358ef897fb27cdc9a030bda131e6cab12

Weekly downloads
457,259
License
Artistic-2.0
Repository
github
Last release
2 years ago

TypeChecker

Utilities to get and check variable types (isString, isPlainObject, isRegExp, etc)

Why?

Why should I use this instead of say instanceof?

Under certain circumstances instanceof may not return the correct results. This occurs with node's vm module especially, and circumstances where an object's prototype has been dereferenced from the original. As such, for basic == and === checks (like a === null), you're fine not using this, but for checks when you would have done instanceof (like err instanceof Error), you should try to use this instead. Plus things like isPlainObject are darn useful!

Usage

Complete API Documentation.

Install

npm

  • Install: npm install --save typechecker
  • Import: import * as pkg from ('typechecker')
  • Require: const pkg = require('typechecker')

Deno

import * as pkg from 'https://unpkg.com/typechecker@^9.4.0/edition-deno/index.ts'

Skypack

<script type="module">
    import * as pkg from '//cdn.skypack.dev/typechecker@^9.4.0'
</script>

unpkg

<script type="module">
    import * as pkg from '//unpkg.com/typechecker@^9.4.0'
</script>

jspm

<script type="module">
    import * as pkg from '//dev.jspm.io/typechecker@9.4.0'
</script>

Editions

This package is published with the following editions:

  • typechecker aliases typechecker/index.cjs which uses the Editions Autoloader to automatically select the correct edition for the consumer's environment
  • typechecker/source/index.ts is TypeScript source code with Import for modules
  • typechecker/edition-browsers/index.js is TypeScript compiled against ES2022 for web browsers with Import for modules
  • typechecker/edition-es2022/index.js is TypeScript compiled against ES2022 for Node.js 6 || 8 || 10 || 12 || 14 || 16 || 18 || 20 || 21 with Require for modules
  • typechecker/edition-es5/index.js is TypeScript compiled against ES5 for Node.js 4 || 6 || 8 || 10 || 12 || 14 || 16 || 18 || 20 || 21 with Require for modules
  • typechecker/edition-es2022-esm/index.js is TypeScript compiled against ES2022 for Node.js 12 || 14 || 16 || 18 || 20 || 21 with Import for modules
  • typechecker/edition-types/index.d.ts is TypeScript compiled Types with Import for modules
  • typechecker/edition-deno/index.ts is TypeScript source code made to be compatible with Deno

History

Discover the release history by heading on over to the HISTORY.md file.

Backers

Code

Discover how to contribute via the CONTRIBUTING.md file.

Authors

Maintainers

Contributors

Finances

Sponsors

  • Andrew Nesbitt — Software engineer and researcher
  • Balsa — We're Balsa, and we're building tools for builders.
  • Codecov — Empower developers with tools to improve code quality and testing.
  • Poonacha Medappa
  • Rob Morris
  • Sentry — Real-time crash reporting for your web apps, mobile apps, and games.
  • Syntax — Syntax Podcast

Donors

License

Unless stated otherwise all works are:

and licensed under:

arrayassertassertionasyncasync functionasync-functionasyncFunctionboolbooleanbrowsercheckcheck-typecheckingclassclass-identifierclass-instancecompareconventional classconventional-classconventionalClassdatedefine-typedenodeno-editiondeno-entrydenolandemptyempty arrayempty keysempty mapempty plain objectempty-arrayempty-keysempty-mapempty-plain-objectemptyArrayemptyKeysemptyMapemptyPlainObjecterrores2022es5functionget object typeget typeget-object-typeget-typegetObjectTypegetTypeinstanceofisis argumentsis arrayis asyncis async functionis boolis booleanis classis conventional classis dateis empty arrayis empty keysis empty mapis empty plain objectis empty weak mapis erroris functionis mapis native classis nullis nullishis numberis objectis plain objectis regexpis stringis syncis sync functionis undefinedis weak mapis-argumentsis-arrayis-asyncis-async-functionis-boolis-booleanis-classis-conventional-classis-dateis-empty-arrayis-empty-keysis-empty-mapis-empty-plain-objectis-empty-weak-mapis-erroris-functionis-mapis-native-classis-nullis-nullishis-numberis-objectis-plain-objis-plain-objectis-regexpis-stringis-syncis-sync-functionis-undefinedis-weak-mapisArgumentsisArrayisAsyncFunctionisBoolisBooleanisClassisConventionalClassisDateisEmptyArrayisEmptyKeysisEmptyMapisEmptyPlainObjectisEmptyWeakMapisErrorisFunctionisMapisNativeClassisNullisNullishisNumberisObjectisRegExpisStringisSyncisSyncFunctionisUndefinedisWeakMapjavascriptjavascript-typekeyskindmapmodulenativenative classnative-classnativeClassnodenullnumberobjectplainplain objectplain objectsplain-objectplain-objectsplainObjectprimitiveprimitive-typespureregexregexpregular expressionsimplestringsyncsyncFunctiontesttypetype-checktype-checkertype-checkingtypecheckertypedtypeguardstypeoftypestypescriptundefinedutilutilityvalidatevalidationvanillaverifyweak mapweak-mapweakMapwhat-type
9.3.0

2 years ago

8.6.0

2 years ago

8.1.0

2 years ago

8.2.0

2 years ago

9.0.0

2 years ago

8.4.0

2 years ago

8.3.0

2 years ago

9.1.0

2 years ago

8.5.0

2 years ago

8.0.0

2 years ago

9.2.0

2 years ago

7.18.0

5 years ago

7.17.0

5 years ago

7.16.0

6 years ago

7.15.0

6 years ago

7.14.0

6 years ago

7.13.0

6 years ago

7.12.0

6 years ago

7.11.0

6 years ago

7.10.0

6 years ago

7.9.0

6 years ago

7.8.0

6 years ago

7.7.0

6 years ago

7.6.0

6 years ago

7.5.0

6 years ago

7.3.0

6 years ago

7.4.0

6 years ago

7.2.0

6 years ago

7.1.0

6 years ago

7.0.0

6 years ago

6.4.0

6 years ago

6.3.0

6 years ago

6.2.0

6 years ago

6.1.0

6 years ago

6.0.0

6 years ago

5.2.0

6 years ago

5.1.0

6 years ago

5.0.0

6 years ago

4.11.0

6 years ago

4.10.0

6 years ago

4.9.0

6 years ago

4.8.0

6 years ago

4.7.0

7 years ago

4.6.0

8 years ago

4.5.0

8 years ago

4.4.1

9 years ago

4.4.0

9 years ago

4.3.0

10 years ago

4.2.1

10 years ago

4.2.0

10 years ago

4.1.0

10 years ago

4.0.1

10 years ago

4.0.0

10 years ago

3.0.0

11 years ago

2.1.0

11 years ago

2.0.8

12 years ago

2.0.7

12 years ago

2.0.6

12 years ago

2.0.5

12 years ago

2.0.4

12 years ago

2.0.3

12 years ago

2.0.2

12 years ago

2.0.1

13 years ago

2.0.0

13 years ago