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

regexp-tree

Package Overview
Dependencies
Maintainers
1
Versions
114
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

regexp-tree - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

50

dist/interpreter/finite-automaton/dfa/dfa.js

@@ -10,4 +10,2 @@ /**

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }

@@ -18,4 +16,2 @@

var DFAMinimizer = require('./dfa-minimizer');
var TablePrinter = require('../table-printer');
var colors = require('colors');

@@ -358,48 +354,2 @@ var _require = require('../special-symbols'),

/**
* Prints transition table.
*/
}, {
key: 'printTransitionTable',
value: function printTransitionTable() {
var header = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '\nDFA transition table:\n';
console.info(colors.bold(header));
var alphabet = [].concat(_toConsumableArray(this.getAlphabet()));
var printer = new TablePrinter({
head: [''].concat(alphabet)
});
var table = this.getTransitionTable();
var acceptingStates = this.getAcceptingStateNumbers();
var _loop = function _loop(stateNumber) {
var tableRow = table[stateNumber];
var stateLabel = acceptingStates.has(Number(stateNumber)) ? colors.bold(colors.green(stateNumber + ' \u2713')) : colors.blue(stateNumber);
if (stateNumber == 1) {
stateLabel += colors.yellow(' >');
}
var row = _defineProperty({}, stateLabel, []);
alphabet.forEach(function (symbol) {
row[stateLabel].push(tableRow[symbol] || '');
});
printer.push(row);
};
for (var stateNumber in table) {
_loop(stateNumber);
}
console.info(printer.toString());
console.info('');
}
/**
* Checks whether this DFA accepts a string.

@@ -406,0 +356,0 @@ */

@@ -12,4 +12,2 @@ /**

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }

@@ -19,5 +17,2 @@

var TablePrinter = require('../table-printer');
var colors = require('colors');
var _require = require('../special-symbols'),

@@ -236,52 +231,2 @@ EPSILON = _require.EPSILON,

}
/**
* Prints transition table.
*/
}, {
key: 'printTransitionTable',
value: function printTransitionTable() {
console.info(colors.bold('\nNFA transition table:\n'));
var alphabet = [].concat(_toConsumableArray(this.getAlphabet()), [EPSILON_CLOSURE]);
var printer = new TablePrinter({
head: [''].concat(alphabet)
});
var table = this.getTransitionTable();
var acceptingStates = this.getAcceptingStateNumbers();
var _loop = function _loop(stateNumber) {
var tableRow = table[stateNumber];
var stateLabel = acceptingStates.has(Number(stateNumber)) ? colors.bold(colors.green(stateNumber + ' \u2713')) : colors.blue(stateNumber);
if (stateNumber == 1) {
stateLabel += colors.yellow(' >');
}
var row = _defineProperty({}, stateLabel, []);
alphabet.forEach(function (symbol) {
var entry = '';
if (Array.isArray(tableRow[symbol])) {
entry = tableRow[symbol].length === 1 ? tableRow[symbol][0] : '{' + tableRow[symbol].join(',') + '}';
}
row[stateLabel].push(entry);
});
printer.push(row);
};
for (var stateNumber in table) {
_loop(stateNumber);
}
console.info(printer.toString());
console.info('');
}
}]);

@@ -288,0 +233,0 @@

2

package.json
{
"name": "regexp-tree",
"version": "0.1.4",
"version": "0.1.5",
"license": "MIT",

@@ -5,0 +5,0 @@ "description": "Regular Expressions parser in JavaScript",

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