Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

typedescriptor

Package Overview
Dependencies
Maintainers
6
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typedescriptor - npm Package Compare versions

Comparing version 1.2.0 to 2.0.0

2

build/lib/TypeDescriptor.d.ts

@@ -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 @@ ```

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc