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

@cucumber/cucumber-expressions

Package Overview
Dependencies
Maintainers
2
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cucumber/cucumber-expressions - npm Package Compare versions

Comparing version 16.0.1 to 16.1.0

22

dist/cjs/src/defineDefaultParameterTypes.js

@@ -13,15 +13,15 @@ "use strict";

function defineDefaultParameterTypes(registry) {
registry.defineParameterType(new ParameterType_js_1.default('int', INTEGER_REGEXPS, Number, function (s) { return (s === undefined ? null : Number(s)); }, true, true));
registry.defineParameterType(new ParameterType_js_1.default('float', FLOAT_REGEXP, Number, function (s) { return (s === undefined ? null : parseFloat(s)); }, true, false));
registry.defineParameterType(new ParameterType_js_1.default('word', WORD_REGEXP, String, function (s) { return s; }, false, false));
registry.defineParameterType(new ParameterType_js_1.default('string', STRING_REGEXP, String, function (s1, s2) { return (s1 || s2 || '').replace(/\\"/g, '"').replace(/\\'/g, "'"); }, true, false));
registry.defineParameterType(new ParameterType_js_1.default('', ANONYMOUS_REGEXP, String, function (s) { return s; }, false, true));
registry.defineParameterType(new ParameterType_js_1.default('double', FLOAT_REGEXP, Number, function (s) { return (s === undefined ? null : parseFloat(s)); }, false, false));
registry.defineParameterType(new ParameterType_js_1.default('bigdecimal', FLOAT_REGEXP, String, function (s) { return (s === undefined ? null : s); }, false, false));
registry.defineParameterType(new ParameterType_js_1.default('byte', INTEGER_REGEXPS, Number, function (s) { return (s === undefined ? null : Number(s)); }, false, false));
registry.defineParameterType(new ParameterType_js_1.default('short', INTEGER_REGEXPS, Number, function (s) { return (s === undefined ? null : Number(s)); }, false, false));
registry.defineParameterType(new ParameterType_js_1.default('long', INTEGER_REGEXPS, Number, function (s) { return (s === undefined ? null : Number(s)); }, false, false));
registry.defineParameterType(new ParameterType_js_1.default('biginteger', INTEGER_REGEXPS, BigInt, function (s) { return (s === undefined ? null : BigInt(s)); }, false, false));
registry.defineParameterType(new ParameterType_js_1.default('int', INTEGER_REGEXPS, Number, function (s) { return (s === undefined ? null : Number(s)); }, true, true, true));
registry.defineParameterType(new ParameterType_js_1.default('float', FLOAT_REGEXP, Number, function (s) { return (s === undefined ? null : parseFloat(s)); }, true, false, true));
registry.defineParameterType(new ParameterType_js_1.default('word', WORD_REGEXP, String, function (s) { return s; }, false, false, true));
registry.defineParameterType(new ParameterType_js_1.default('string', STRING_REGEXP, String, function (s1, s2) { return (s1 || s2 || '').replace(/\\"/g, '"').replace(/\\'/g, "'"); }, true, false, true));
registry.defineParameterType(new ParameterType_js_1.default('', ANONYMOUS_REGEXP, String, function (s) { return s; }, false, true, true));
registry.defineParameterType(new ParameterType_js_1.default('double', FLOAT_REGEXP, Number, function (s) { return (s === undefined ? null : parseFloat(s)); }, false, false, true));
registry.defineParameterType(new ParameterType_js_1.default('bigdecimal', FLOAT_REGEXP, String, function (s) { return (s === undefined ? null : s); }, false, false, true));
registry.defineParameterType(new ParameterType_js_1.default('byte', INTEGER_REGEXPS, Number, function (s) { return (s === undefined ? null : Number(s)); }, false, false, true));
registry.defineParameterType(new ParameterType_js_1.default('short', INTEGER_REGEXPS, Number, function (s) { return (s === undefined ? null : Number(s)); }, false, false, true));
registry.defineParameterType(new ParameterType_js_1.default('long', INTEGER_REGEXPS, Number, function (s) { return (s === undefined ? null : Number(s)); }, false, false, true));
registry.defineParameterType(new ParameterType_js_1.default('biginteger', INTEGER_REGEXPS, BigInt, function (s) { return (s === undefined ? null : BigInt(s)); }, false, false, true));
}
exports.default = defineDefaultParameterTypes;
//# sourceMappingURL=defineDefaultParameterTypes.js.map

@@ -5,5 +5,5 @@ interface Constructor<T> extends Function {

}
declare type Factory<T> = (...args: unknown[]) => T;
export declare type RegExps = StringOrRegExp | readonly StringOrRegExp[];
export declare type StringOrRegExp = string | RegExp;
type Factory<T> = (...args: unknown[]) => T;
export type RegExps = StringOrRegExp | readonly StringOrRegExp[];
export type StringOrRegExp = string | RegExp;
export default class ParameterType<T> {

@@ -14,2 +14,3 @@ readonly name: string | undefined;

readonly preferForRegexpMatch?: boolean | undefined;
readonly builtin?: boolean | undefined;
private transformFn;

@@ -27,4 +28,5 @@ static compare(pt1: ParameterType<unknown>, pt2: ParameterType<unknown>): number;

* @param preferForRegexpMatch {boolean} true if this is a preferential type. Defaults to false.
* @param builtin whether or not this is a built-in type
*/
constructor(name: string | undefined, regexps: RegExps, type: Constructor<T> | Factory<T> | null, transform?: (...match: string[]) => T | PromiseLike<T>, useForSnippets?: boolean | undefined, preferForRegexpMatch?: boolean | undefined);
constructor(name: string | undefined, regexps: RegExps, type: Constructor<T> | Factory<T> | null, transform?: (...match: string[]) => T | PromiseLike<T>, useForSnippets?: boolean | undefined, preferForRegexpMatch?: boolean | undefined, builtin?: boolean | undefined);
transform(thisObj: unknown, groupValues: string[] | null): any;

@@ -31,0 +33,0 @@ }

@@ -28,4 +28,5 @@ "use strict";

* @param preferForRegexpMatch {boolean} true if this is a preferential type. Defaults to false.
* @param builtin whether or not this is a built-in type
*/
function ParameterType(name, regexps, type, transform, useForSnippets, preferForRegexpMatch) {
function ParameterType(name, regexps, type, transform, useForSnippets, preferForRegexpMatch, builtin) {
this.name = name;

@@ -35,2 +36,3 @@ this.type = type;

this.preferForRegexpMatch = preferForRegexpMatch;
this.builtin = builtin;
if (transform === undefined) {

@@ -37,0 +39,0 @@ transform = function (s) { return s; };

@@ -10,3 +10,3 @@ import Argument from './Argument.js';

}
export declare type ParameterInfo = {
export type ParameterInfo = {
/**

@@ -13,0 +13,0 @@ * The string representation of the original ParameterType#type property

@@ -17,3 +17,3 @@ "use strict";

if (f) throw new TypeError("Generator is already executing.");
while (_) try {
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;

@@ -20,0 +20,0 @@ if (y = 0, t) op = [op[0] & 2, t.value];

import CucumberExpressionError from './CucumberExpressionError.js';
export default class Argument {
constructor(group, parameterType) {
this.group = group;
this.parameterType = parameterType;
this.group = group;
this.parameterType = parameterType;
}
static build(group, parameterTypes) {

@@ -16,2 +10,8 @@ const argGroups = group.children;

}
constructor(group, parameterType) {
this.group = group;
this.parameterType = parameterType;
this.group = group;
this.parameterType = parameterType;
}
/**

@@ -18,0 +18,0 @@ * Get the value returned by the parameter type's transformer function.

@@ -8,14 +8,14 @@ import ParameterType from './ParameterType.js';

export default function defineDefaultParameterTypes(registry) {
registry.defineParameterType(new ParameterType('int', INTEGER_REGEXPS, Number, (s) => (s === undefined ? null : Number(s)), true, true));
registry.defineParameterType(new ParameterType('float', FLOAT_REGEXP, Number, (s) => (s === undefined ? null : parseFloat(s)), true, false));
registry.defineParameterType(new ParameterType('word', WORD_REGEXP, String, (s) => s, false, false));
registry.defineParameterType(new ParameterType('string', STRING_REGEXP, String, (s1, s2) => (s1 || s2 || '').replace(/\\"/g, '"').replace(/\\'/g, "'"), true, false));
registry.defineParameterType(new ParameterType('', ANONYMOUS_REGEXP, String, (s) => s, false, true));
registry.defineParameterType(new ParameterType('double', FLOAT_REGEXP, Number, (s) => (s === undefined ? null : parseFloat(s)), false, false));
registry.defineParameterType(new ParameterType('bigdecimal', FLOAT_REGEXP, String, (s) => (s === undefined ? null : s), false, false));
registry.defineParameterType(new ParameterType('byte', INTEGER_REGEXPS, Number, (s) => (s === undefined ? null : Number(s)), false, false));
registry.defineParameterType(new ParameterType('short', INTEGER_REGEXPS, Number, (s) => (s === undefined ? null : Number(s)), false, false));
registry.defineParameterType(new ParameterType('long', INTEGER_REGEXPS, Number, (s) => (s === undefined ? null : Number(s)), false, false));
registry.defineParameterType(new ParameterType('biginteger', INTEGER_REGEXPS, BigInt, (s) => (s === undefined ? null : BigInt(s)), false, false));
registry.defineParameterType(new ParameterType('int', INTEGER_REGEXPS, Number, (s) => (s === undefined ? null : Number(s)), true, true, true));
registry.defineParameterType(new ParameterType('float', FLOAT_REGEXP, Number, (s) => (s === undefined ? null : parseFloat(s)), true, false, true));
registry.defineParameterType(new ParameterType('word', WORD_REGEXP, String, (s) => s, false, false, true));
registry.defineParameterType(new ParameterType('string', STRING_REGEXP, String, (s1, s2) => (s1 || s2 || '').replace(/\\"/g, '"').replace(/\\'/g, "'"), true, false, true));
registry.defineParameterType(new ParameterType('', ANONYMOUS_REGEXP, String, (s) => s, false, true, true));
registry.defineParameterType(new ParameterType('double', FLOAT_REGEXP, Number, (s) => (s === undefined ? null : parseFloat(s)), false, false, true));
registry.defineParameterType(new ParameterType('bigdecimal', FLOAT_REGEXP, String, (s) => (s === undefined ? null : s), false, false, true));
registry.defineParameterType(new ParameterType('byte', INTEGER_REGEXPS, Number, (s) => (s === undefined ? null : Number(s)), false, false, true));
registry.defineParameterType(new ParameterType('short', INTEGER_REGEXPS, Number, (s) => (s === undefined ? null : Number(s)), false, false, true));
registry.defineParameterType(new ParameterType('long', INTEGER_REGEXPS, Number, (s) => (s === undefined ? null : Number(s)), false, false, true));
registry.defineParameterType(new ParameterType('biginteger', INTEGER_REGEXPS, BigInt, (s) => (s === undefined ? null : BigInt(s)), false, false, true));
}
//# sourceMappingURL=defineDefaultParameterTypes.js.map

@@ -5,5 +5,5 @@ interface Constructor<T> extends Function {

}
declare type Factory<T> = (...args: unknown[]) => T;
export declare type RegExps = StringOrRegExp | readonly StringOrRegExp[];
export declare type StringOrRegExp = string | RegExp;
type Factory<T> = (...args: unknown[]) => T;
export type RegExps = StringOrRegExp | readonly StringOrRegExp[];
export type StringOrRegExp = string | RegExp;
export default class ParameterType<T> {

@@ -14,2 +14,3 @@ readonly name: string | undefined;

readonly preferForRegexpMatch?: boolean | undefined;
readonly builtin?: boolean | undefined;
private transformFn;

@@ -27,4 +28,5 @@ static compare(pt1: ParameterType<unknown>, pt2: ParameterType<unknown>): number;

* @param preferForRegexpMatch {boolean} true if this is a preferential type. Defaults to false.
* @param builtin whether or not this is a built-in type
*/
constructor(name: string | undefined, regexps: RegExps, type: Constructor<T> | Factory<T> | null, transform?: (...match: string[]) => T | PromiseLike<T>, useForSnippets?: boolean | undefined, preferForRegexpMatch?: boolean | undefined);
constructor(name: string | undefined, regexps: RegExps, type: Constructor<T> | Factory<T> | null, transform?: (...match: string[]) => T | PromiseLike<T>, useForSnippets?: boolean | undefined, preferForRegexpMatch?: boolean | undefined, builtin?: boolean | undefined);
transform(thisObj: unknown, groupValues: string[] | null): any;

@@ -31,0 +33,0 @@ }

@@ -5,2 +5,20 @@ import CucumberExpressionError from './CucumberExpressionError.js';

export default class ParameterType {
static compare(pt1, pt2) {
if (pt1.preferForRegexpMatch && !pt2.preferForRegexpMatch) {
return -1;
}
if (pt2.preferForRegexpMatch && !pt1.preferForRegexpMatch) {
return 1;
}
return (pt1.name || '').localeCompare(pt2.name || '');
}
static checkParameterTypeName(typeName) {
if (!this.isValidParameterTypeName(typeName)) {
throw new CucumberExpressionError(`Illegal character in parameter name {${typeName}}. Parameter names may not contain '{', '}', '(', ')', '\\' or '/'`);
}
}
static isValidParameterTypeName(typeName) {
const unescapedTypeName = typeName.replace(UNESCAPE_PATTERN(), '$2');
return !unescapedTypeName.match(ILLEGAL_PARAMETER_NAME_PATTERN);
}
/**

@@ -13,4 +31,5 @@ * @param name {String} the name of the type

* @param preferForRegexpMatch {boolean} true if this is a preferential type. Defaults to false.
* @param builtin whether or not this is a built-in type
*/
constructor(name, regexps, type, transform, useForSnippets, preferForRegexpMatch) {
constructor(name, regexps, type, transform, useForSnippets, preferForRegexpMatch, builtin) {
this.name = name;

@@ -20,2 +39,3 @@ this.type = type;

this.preferForRegexpMatch = preferForRegexpMatch;
this.builtin = builtin;
if (transform === undefined) {

@@ -36,20 +56,2 @@ transform = (s) => s;

}
static compare(pt1, pt2) {
if (pt1.preferForRegexpMatch && !pt2.preferForRegexpMatch) {
return -1;
}
if (pt2.preferForRegexpMatch && !pt1.preferForRegexpMatch) {
return 1;
}
return (pt1.name || '').localeCompare(pt2.name || '');
}
static checkParameterTypeName(typeName) {
if (!this.isValidParameterTypeName(typeName)) {
throw new CucumberExpressionError(`Illegal character in parameter name {${typeName}}. Parameter names may not contain '{', '}', '(', ')', '\\' or '/'`);
}
}
static isValidParameterTypeName(typeName) {
const unescapedTypeName = typeName.replace(UNESCAPE_PATTERN(), '$2');
return !unescapedTypeName.match(ILLEGAL_PARAMETER_NAME_PATTERN);
}
transform(thisObj, groupValues) {

@@ -56,0 +58,0 @@ return this.transformFn.apply(thisObj, groupValues);

@@ -10,3 +10,3 @@ import Argument from './Argument.js';

}
export declare type ParameterInfo = {
export type ParameterInfo = {
/**

@@ -13,0 +13,0 @@ * The string representation of the original ParameterType#type property

{
"name": "@cucumber/cucumber-expressions",
"version": "16.0.1",
"version": "16.1.0",
"description": "Cucumber Expressions - a simpler alternative to Regular Expressions",

@@ -55,7 +55,7 @@ "type": "module",

"@types/node": "18.11.9",
"@typescript-eslint/eslint-plugin": "5.42.0",
"@typescript-eslint/parser": "5.42.0",
"@typescript-eslint/eslint-plugin": "5.44.0",
"@typescript-eslint/parser": "5.44.0",
"cross-env": "7.0.3",
"esbuild": "0.15.13",
"eslint": "8.26.0",
"esbuild": "0.15.16",
"eslint": "8.28.0",
"eslint-config-prettier": "8.5.0",

@@ -69,8 +69,8 @@ "eslint-plugin-import": "2.26.0",

"mocha": "10.1.0",
"npm-check-updates": "16.3.16",
"prettier": "2.7.1",
"npm-check-updates": "16.4.3",
"prettier": "2.8.0",
"pretty-quick": "3.1.3",
"query-string": "7.1.1",
"ts-node": "10.9.1",
"typescript": "4.8.4"
"typescript": "4.9.3"
},

@@ -77,0 +77,0 @@ "dependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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