typedescriptor
Advanced tools
Comparing version 1.2.0 to 2.0.0
@@ -29,2 +29,2 @@ declare class TypeDescriptor { | ||
} | ||
export = TypeDescriptor; | ||
export default TypeDescriptor; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const valueTypes = ['boolean', 'number', 'null', 'string', 'undefined']; | ||
@@ -80,2 +81,2 @@ const referenceTypes = ['array', 'function', 'object', 'symbol']; | ||
} | ||
module.exports = TypeDescriptor; | ||
exports.default = TypeDescriptor; |
@@ -126,2 +126,2 @@ const valueTypes = [ 'boolean', 'number', 'null', 'string', 'undefined' ]; | ||
export = TypeDescriptor; | ||
export default TypeDescriptor; |
{ | ||
"name": "typedescriptor", | ||
"version": "1.2.0", | ||
"version": "2.0.0", | ||
"description": "typedescriptor identifies and describes types.", | ||
@@ -5,0 +5,0 @@ "contributors": [ |
@@ -26,5 +26,11 @@ # typedescriptor | ||
```javascript | ||
const Type = require('typedescriptor'); | ||
const Type = require('typedescriptor').default; | ||
``` | ||
If you use TypeScript, use the following code instead: | ||
```typescript | ||
import Type from 'typedescriptor'; | ||
``` | ||
Then, to identify a value's type, call the static `of` function and hand over the value: | ||
@@ -67,3 +73,3 @@ | ||
### TypeScript Type Guards | ||
### Using TypeScript type guards | ||
@@ -78,7 +84,7 @@ Since using the descriptors above doesn't tell TypeScript anything, there are type guards for every type check: | ||
if (Type.isArray(someValue)) { | ||
// TypeScript now realizes that `someValue` is of type [] | ||
// TypeScript now realizes that `someValue` is of type [] | ||
} | ||
if (Type.isValueType(someValue)) { | ||
// TypeScript now realizes that `someValue` is of type string | number | boolean | null | undefined | ||
// TypeScript now realizes that `someValue` is of type string | number | boolean | null | undefined | ||
} | ||
@@ -85,0 +91,0 @@ ``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
12604
220
97
0