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.5 to 5.0.6

22

dist/src/parameter_type.js

@@ -101,7 +101,8 @@ 'use strict';

function regexpSource(regexp) {
var flags = regexpFlags(regexp);
var _arr = ['g', 'i', 'm', 'y'];
for (var _i = 0; _i < _arr.length; _i++) {
var flag = _arr[_i];
if (regexp.flags.indexOf(flag) !== -1) throw new CucumberExpressionError('ParameterType Regexps can\'t use flag \'' + flag + '\'');
if (flags.indexOf(flag) !== -1) throw new CucumberExpressionError('ParameterType Regexps can\'t use flag \'' + flag + '\'');
}

@@ -111,2 +112,19 @@ return regexp.source;

// Backport RegExp.flags for Node 4.x
// https://github.com/nodejs/node/issues/8390
//
// For some strange reason this is not needed for
// `./mocha dist/test`, but it is needed for
// `./mocha dist/test/parameter_type_test.js`
function regexpFlags(regexp) {
var flags = regexp.flags;
if (flags === undefined) {
flags = '';
if (regexp.ignoreCase) flags += 'i';
if (regexp.global) flags += 'g';
if (regexp.multiline) flags += 'm';
}
return flags;
}
module.exports = ParameterType;

2

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

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

@@ -85,4 +85,6 @@ const { CucumberExpressionError } = require('./errors')

function regexpSource(regexp) {
const flags = regexpFlags(regexp)
for (const flag of ['g', 'i', 'm', 'y']) {
if (regexp.flags.indexOf(flag) !== -1)
if (flags.indexOf(flag) !== -1)
throw new CucumberExpressionError(

@@ -95,2 +97,19 @@ `ParameterType Regexps can't use flag '${flag}'`

// Backport RegExp.flags for Node 4.x
// https://github.com/nodejs/node/issues/8390
//
// For some strange reason this is not needed for
// `./mocha dist/test`, but it is needed for
// `./mocha dist/test/parameter_type_test.js`
function regexpFlags(regexp) {
let flags = regexp.flags
if (flags === undefined) {
flags = ''
if (regexp.ignoreCase) flags += 'i'
if (regexp.global) flags += 'g'
if (regexp.multiline) flags += 'm'
}
return flags
}
module.exports = ParameterType

@@ -6,3 +6,3 @@ /* eslint-env mocha */

describe('ParameterType', () => {
it('exposes group source', () => {
it('does not allow ignore flag on regexp', () => {
assertThrows(

@@ -9,0 +9,0 @@ () =>

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