Socket
Socket
Sign inDemoInstall

typedescriptor

Package Overview
Dependencies
Maintainers
3
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 3.0.0 to 3.0.1

.releaserc.json

20

build/lib/TypeDescriptor.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const valueTypes = ['boolean', 'number', 'null', 'string', 'undefined'];
const referenceTypes = ['array', 'function', 'object', 'symbol'];
const detectableTypes = ['boolean', 'function', 'number', 'string', 'symbol'];
const typeConstructors = [Boolean, Number, String];
exports.Type = void 0;
const valueTypes = new Set(['boolean', 'number', 'null', 'string', 'undefined']);
const referenceTypes = new Set(['array', 'function', 'object', 'symbol']);
const detectableTypes = new Set(['boolean', 'function', 'number', 'string', 'symbol']);
const typeConstructors = new Set([Boolean, Number, String]);
class TypeDescriptor {

@@ -30,3 +31,3 @@ constructor(value) {

const detectedType = typeof value;
if (detectableTypes.includes(detectedType)) {
if (detectableTypes.has(detectedType)) {
return detectedType;

@@ -38,3 +39,3 @@ }

}
if (typeConstructors.includes(value.constructor)) {
if (typeConstructors.has(value.constructor)) {
return value.constructor.name.toLowerCase();

@@ -50,6 +51,7 @@ }

static isValueType(value) {
return valueTypes.includes(TypeDescriptor.of(value));
return valueTypes.has(TypeDescriptor.of(value));
}
// eslint-disable-next-line @typescript-eslint/ban-types
static isReferenceType(value) {
return referenceTypes.includes(TypeDescriptor.of(value));
return referenceTypes.has(TypeDescriptor.of(value));
}

@@ -62,2 +64,3 @@ static isArray(value) {

}
// eslint-disable-next-line @typescript-eslint/ban-types
static isFunction(value) {

@@ -72,2 +75,3 @@ return TypeDescriptor.of(value) === 'function';

}
// eslint-disable-next-line @typescript-eslint/ban-types
static isObject(value) {

@@ -74,0 +78,0 @@ return TypeDescriptor.of(value) === 'object';

19

lib/TypeDescriptor.ts

@@ -1,6 +0,6 @@

const valueTypes = [ 'boolean', 'number', 'null', 'string', 'undefined' ];
const referenceTypes = [ 'array', 'function', 'object', 'symbol' ];
const valueTypes = new Set([ 'boolean', 'number', 'null', 'string', 'undefined' ]);
const referenceTypes = new Set([ 'array', 'function', 'object', 'symbol' ]);
const detectableTypes = [ 'boolean', 'function', 'number', 'string', 'symbol' ];
const typeConstructors = [ Boolean, Number, String ];
const detectableTypes = new Set([ 'boolean', 'function', 'number', 'string', 'symbol' ]);
const typeConstructors = new Set([ Boolean, Number, String ]);

@@ -58,3 +58,3 @@ class TypeDescriptor {

if (detectableTypes.includes(detectedType)) {
if (detectableTypes.has(detectedType)) {
return detectedType;

@@ -68,3 +68,3 @@ }

if (typeConstructors.includes(value.constructor)) {
if (typeConstructors.has(value.constructor)) {
return value.constructor.name.toLowerCase();

@@ -84,7 +84,8 @@ }

public static isValueType (value: any): value is boolean | number | null | string | undefined {
return valueTypes.includes(TypeDescriptor.of(value));
return valueTypes.has(TypeDescriptor.of(value));
}
// eslint-disable-next-line @typescript-eslint/ban-types
public static isReferenceType (value: any): value is any[] | Function | object | symbol {
return referenceTypes.includes(TypeDescriptor.of(value));
return referenceTypes.has(TypeDescriptor.of(value));
}

@@ -100,2 +101,3 @@

// eslint-disable-next-line @typescript-eslint/ban-types
public static isFunction (value: any): value is Function {

@@ -113,2 +115,3 @@ return TypeDescriptor.of(value) === 'function';

// eslint-disable-next-line @typescript-eslint/ban-types
public static isObject (value: any): value is object {

@@ -115,0 +118,0 @@ return TypeDescriptor.of(value) === 'object';

The MIT License (MIT)
Copyright (c) 2019 the native web. All rights reserved.
Copyright (c) 2019-2020 the native web. All rights reserved.

@@ -4,0 +4,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

{
"name": "typedescriptor",
"version": "3.0.0",
"version": "3.0.1",
"description": "typedescriptor identifies and describes types.",

@@ -19,4 +19,5 @@ "contributors": [

"devDependencies": {
"assertthat": "5.0.1",
"roboter": "9.2.0"
"assertthat": "5.2.1",
"roboter": "11.5.1",
"semantic-release-configuration": "1.0.24"
},

@@ -23,0 +24,0 @@ "repository": {

@@ -7,9 +7,9 @@ # typedescriptor

| Category | Status |
| ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Version | [![npm](https://img.shields.io/npm/v/typedescriptor)](https://www.npmjs.com/package/typedescriptor) |
| Dependencies | ![David](https://img.shields.io/david/thenativeweb/typedescriptor) |
| Dev dependencies | ![David](https://img.shields.io/david/dev/thenativeweb/typedescriptor) |
| Build | [![CircleCI](https://img.shields.io/circleci/build/github/thenativeweb/typedescriptor)](https://circleci.com/gh/thenativeweb/typedescriptor/tree/master) |
| License | ![GitHub](https://img.shields.io/github/license/thenativeweb/typedescriptor) |
| Category | Status |
| ---------------- | ------------------------------------------------------------------------------------------------------- |
| Version | [![npm](https://img.shields.io/npm/v/typedescriptor)](https://www.npmjs.com/package/typedescriptor) |
| Dependencies | ![David](https://img.shields.io/david/thenativeweb/typedescriptor) |
| Dev dependencies | ![David](https://img.shields.io/david/dev/thenativeweb/typedescriptor) |
| Build | ![GitHub Actions](https://github.com/thenativeweb/typedescriptor/workflows/Release/badge.svg?branch=master) |
| License | ![GitHub](https://img.shields.io/github/license/thenativeweb/typedescriptor) |

@@ -91,5 +91,5 @@ ## Installation

## Running the build
## Running quality assurance
To build this module use [roboter](https://www.npmjs.com/package/roboter).
To run quality assurance for this module use [roboter](https://www.npmjs.com/package/roboter):

@@ -96,0 +96,0 @@ ```shell

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