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

cucumber-expressions

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cucumber-expressions - npm Package Compare versions

Comparing version 5.0.7 to 5.0.10

15

dist/src/tree_regexp.js

@@ -21,11 +21,15 @@ 'use strict';

var groupStartStack = [];
var last = null;
var escaping = false;
var nonCapturingMaybe = false;
this._re.source.split('').forEach(function (c, n) {
if (c === '(' && last !== '\\') {
if (escaping && isRegexpChar(c)) {
escaping = false;
} else if (c === '\\') {
escaping = true;
} else if (c === '(' && !escaping) {
stack.push(new GroupBuilder());
groupStartStack.push(n + 1);
nonCapturingMaybe = false;
} else if (c === ')' && last !== '\\') {
} else if (c === ')' && !escaping) {
var gb = stack.pop();

@@ -77,2 +81,7 @@ var groupStart = groupStartStack.pop();

var REGEXP_CHARS = ['#', '$', '(', ')', '*', '+', '.', '?', '[', '\\', '^', '{', '|'];
function isRegexpChar(c) {
return REGEXP_CHARS.indexOf(c) !== -1;
}
module.exports = TreeRegexp;

12

package.json
{
"name": "cucumber-expressions",
"version": "5.0.7",
"version": "5.0.10",
"description": "Cucumber Expressions - a simpler alternative to Regular Expressions",

@@ -38,9 +38,9 @@ "main": "dist/src/index.js",

"babel-preset-env": "^1.6.1",
"eslint": "^4.12.0",
"eslint": "^4.15.0",
"eslint-config-eslint": "^4.0.0",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-prettier": "^2.0.1",
"mocha": "^4.0.1",
"nyc": "^11.3.0",
"prettier": "^1.8.2"
"eslint-plugin-prettier": "^2.5.0",
"mocha": "^5.0.0",
"nyc": "^11.4.1",
"prettier": "^1.10.2"
},

@@ -47,0 +47,0 @@ "files": [

@@ -11,7 +11,3 @@ class CucumberExpressionError extends Error {}

return new this(
`parameter type with ${keyName}=${
keyValue
} is used by several parameter types: ${parameterTypes}, ${
generatedExpressions
}`
`parameter type with ${keyName}=${keyValue} is used by several parameter types: ${parameterTypes}, ${generatedExpressions}`
)

@@ -18,0 +14,0 @@ }

@@ -89,5 +89,3 @@ const ParameterType = require('./parameter_type')

'There can only be one preferential parameter type per regexp. ' +
`The regexp /${
parameterTypeRegexp
}/ is used for two preferential parameter types, {${
`The regexp /${parameterTypeRegexp}/ is used for two preferential parameter types, {${
existingParameterType.name

@@ -94,0 +92,0 @@ }} and {${parameterType.name}}`

@@ -11,11 +11,15 @@ const Regex = require('becke-ch--regex--s0-0-v1--base--pl--lib')

const groupStartStack = []
let last = null
let escaping = false
let nonCapturingMaybe = false
this._re.source.split('').forEach((c, n) => {
if (c === '(' && last !== '\\') {
if (escaping && isRegexpChar(c)) {
escaping = false
} else if (c === '\\') {
escaping = true
} else if (c === '(' && !escaping) {
stack.push(new GroupBuilder())
groupStartStack.push(n + 1)
nonCapturingMaybe = false
} else if (c === ')' && last !== '\\') {
} else if (c === ')' && !escaping) {
const gb = stack.pop()

@@ -58,2 +62,21 @@ const groupStart = groupStartStack.pop()

const REGEXP_CHARS = [
'#',
'$',
'(',
')',
'*',
'+',
'.',
'?',
'[',
'\\',
'^',
'{',
'|',
]
function isRegexpChar(c) {
return REGEXP_CHARS.indexOf(c) !== -1
}
module.exports = TreeRegexp

@@ -55,5 +55,3 @@ /* eslint-env mocha */

err.message,
`There can only be one preferential parameter type per regexp. The regexp ${
CAPITALISED_WORD
} is used for two preferential parameter types, {name} and {place}`
`There can only be one preferential parameter type per regexp. The regexp ${CAPITALISED_WORD} is used for two preferential parameter types, {name} and {place}`
)

@@ -60,0 +58,0 @@ }

@@ -61,2 +61,8 @@ /* eslint-env mocha */

it('works with escaped backslash', () => {
const tr = new TreeRegexp(/foo\\(bar|baz)/)
const group = tr.match('foo\\bar')
assert.equal(group.children.length, 1)
})
it('captures non capturing groups with capturing groups inside', () => {

@@ -63,0 +69,0 @@ const tr = new TreeRegexp('the stdout(?: from "(.*?)")?')

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