New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

kmdr-ast

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kmdr-ast - npm Package Compare versions

Comparing version 2.0.2 to 2.0.3

4

dist/ast.d.ts
/**
* Copyright 2019 Eddie Ramirez
*/
import { AssignmentNode, CommandNode, StickyOptionNode, OptionNode, OptionWithArgNode, ProgramNode, SubcommandNode, ArgumentNode, RedirectNode, ListNode, WordNode, OperatorNode, NodeAST, PipeNode, ReservedWordNode, OperandNode } from "./interfaces";
import { AssignmentNode, CommandNode, StickyOptionNode, OptionNode, OptionWithArgNode, ProgramNode, SubcommandNode, ArgumentNode, RedirectNode, ListNode, WordNode, OperatorNode, NodeAST, PipeNode, ReservedWordNode, PipelineNode, OperandNode } from "./interfaces";
declare class AST {

@@ -41,4 +41,6 @@ /**

static commandHasSubcommand(node: CommandNode, subcommandName: string, pos?: number): boolean;
static commandHasSudo(node: CommandNode): boolean;
static getAllArguments(node: CommandNode): ArgumentNode[] | undefined;
static getAllAssignments(node: CommandNode): AssignmentNode[];
static getAllPrograms(node: ListNode | PipelineNode): ProgramNode[];
static getAllRedirects(node: CommandNode): RedirectNode[];

@@ -45,0 +47,0 @@ static getAllSubcommands(node: CommandNode): SubcommandNode[] | undefined;

@@ -122,2 +122,12 @@ "use strict";

}
static commandHasSudo(node) {
if (!node.parts)
return false;
for (const currentNode of node.parts) {
if (AST.isSudo(currentNode)) {
return true;
}
}
return false;
}
static getAllArguments(node) {

@@ -147,2 +157,15 @@ if (!node.parts) {

}
static getAllPrograms(node) {
if (!node.parts) {
return [];
}
const programNodes = [];
for (const currentNode of node.parts) {
if (AST.isCommand(currentNode)) {
const programNode = AST.getCommandProgram(currentNode);
programNode && programNodes.push(programNode);
}
}
return programNodes;
}
static getAllRedirects(node) {

@@ -149,0 +172,0 @@ if (!node.parts) {

{
"name": "kmdr-ast",
"version": "2.0.2",
"version": "2.0.3",
"description": "Traverse the AST of an explanation by kmdr",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -24,5 +24,5 @@ /**

FlatAST,
PipelineNode,
OperandNode
} from "./interfaces";
import { PipelineNode } from ".";

@@ -191,2 +191,14 @@ class AST {

public static commandHasSudo(node: CommandNode): boolean {
if (!node.parts) return false;
for (const currentNode of node.parts) {
if (AST.isSudo(currentNode)) {
return true;
}
}
return false;
}
public static getAllArguments(node: CommandNode): ArgumentNode[] | undefined {

@@ -224,2 +236,19 @@ if (!node.parts) {

public static getAllPrograms(node: ListNode | PipelineNode): ProgramNode[] {
if (!node.parts) {
return [];
}
const programNodes: ProgramNode[] = [];
for (const currentNode of node.parts) {
if (AST.isCommand(currentNode)) {
const programNode = AST.getCommandProgram(currentNode as CommandNode);
programNode && programNodes.push(programNode);
}
}
return programNodes;
}
public static getAllRedirects(node: CommandNode): RedirectNode[] {

@@ -226,0 +255,0 @@ if (!node.parts) {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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