9.3.0 • Published 4 months ago

typechecker v9.3.0

Weekly downloads
457,259
License
Artistic-2.0
Repository
github
Last release
4 months ago

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 isEmpty, isEmptyObject and isPlainObject are darn useful!

Usage

API Documentation

npm

jspm

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

This project provides its type information via inline JSDoc Comments. To make use of this in TypeScript, set your maxNodeModuleJsDepth compiler option to 5 or thereabouts. You can accomlish this via your tsconfig.json file like so:

{
  "compilerOptions": {
    "maxNodeModuleJsDepth": 5
  }
}

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

Discover how you can contribute by heading on over to the CONTRIBUTING.md file.

These amazing people are maintaining this project:

No sponsors yet! Will you be the first?

These amazing people have contributed code to this project:

Discover how you can contribute by heading on over to the CONTRIBUTING.md file.

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

4 months ago

8.6.0

5 months ago

8.1.0

5 months ago

8.2.0

5 months ago

9.0.0

5 months ago

8.4.0

5 months ago

8.3.0

5 months ago

9.1.0

5 months ago

8.5.0

5 months ago

8.0.0

6 months ago

9.2.0

5 months ago

7.18.0

3 years ago

7.17.0

3 years ago

7.16.0

4 years ago

7.15.0

4 years ago

7.14.0

4 years ago

7.13.0

4 years ago

7.12.0

4 years ago

7.11.0

4 years ago

7.10.0

4 years ago

7.9.0

4 years ago

7.8.0

4 years ago

7.7.0

4 years ago

7.6.0

4 years ago

7.5.0

4 years ago

7.3.0

4 years ago

7.4.0

4 years ago

7.2.0

4 years ago

7.1.0

4 years ago

7.0.0

4 years ago

6.4.0

4 years ago

6.3.0

4 years ago

6.2.0

4 years ago

6.1.0

4 years ago

6.0.0

4 years ago

5.2.0

4 years ago

5.1.0

4 years ago

5.0.0

4 years ago

4.11.0

4 years ago

4.10.0

4 years ago

4.9.0

4 years ago

4.8.0

4 years ago

4.7.0

5 years ago

4.6.0

6 years ago

4.5.0

6 years ago

4.4.1

7 years ago

4.4.0

7 years ago

4.3.0

8 years ago

4.2.1

8 years ago

4.2.0

8 years ago

4.1.0

8 years ago

4.0.1

8 years ago

4.0.0

9 years ago

3.0.0

9 years ago

2.1.0

9 years ago

2.0.8

10 years ago

2.0.7

11 years ago

2.0.6

11 years ago

2.0.5

11 years ago

2.0.4

11 years ago

2.0.3

11 years ago

2.0.2

11 years ago

2.0.1

11 years ago

2.0.0

11 years ago