Socket
Socket
Sign inDemoInstall

tsutils

Package Overview
Dependencies
2
Maintainers
1
Versions
94
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.6.0 to 3.7.0

7

CHANGELOG.md

@@ -0,1 +1,8 @@

# 3.7.0
**Features:**
* added `isBlockScopedDeclarationStatement`
* added `isInSingleStatementContext`
# 3.6.0

@@ -2,0 +9,0 @@

2

package.json
{
"name": "tsutils",
"version": "3.6.0",
"version": "3.7.0",
"description": "utilities for working with typescript's AST",

@@ -5,0 +5,0 @@ "scripts": {

@@ -44,2 +44,4 @@ import * as ts from 'typescript';

export declare function isBlockScopedVariableDeclaration(declaration: ts.VariableDeclaration): boolean;
export declare function isBlockScopedDeclarationStatement(statement: ts.Statement): statement is ts.DeclarationStatement;
export declare function isInSingleStatementContext(statement: ts.Statement): boolean;
export declare enum ScopeBoundary {

@@ -46,0 +48,0 @@ None = 0,

@@ -256,2 +256,32 @@ "use strict";

exports.isBlockScopedVariableDeclaration = isBlockScopedVariableDeclaration;
function isBlockScopedDeclarationStatement(statement) {
switch (statement.kind) {
case ts.SyntaxKind.VariableStatement:
return isBlockScopedVariableDeclarationList(statement.declarationList);
case ts.SyntaxKind.ClassDeclaration:
case ts.SyntaxKind.EnumDeclaration:
case ts.SyntaxKind.InterfaceDeclaration:
case ts.SyntaxKind.TypeAliasDeclaration:
return true;
default:
return false;
}
}
exports.isBlockScopedDeclarationStatement = isBlockScopedDeclarationStatement;
function isInSingleStatementContext(statement) {
switch (statement.parent.kind) {
case ts.SyntaxKind.ForStatement:
case ts.SyntaxKind.ForInStatement:
case ts.SyntaxKind.ForOfStatement:
case ts.SyntaxKind.WhileStatement:
case ts.SyntaxKind.DoStatement:
case ts.SyntaxKind.IfStatement:
case ts.SyntaxKind.WithStatement:
case ts.SyntaxKind.LabeledStatement:
return true;
default:
return false;
}
}
exports.isInSingleStatementContext = isInSingleStatementContext;
var ScopeBoundary;

@@ -258,0 +288,0 @@ (function (ScopeBoundary) {

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc