cucumber-expressions

  • Version 8.3.0
  • Published
  • 644 kB
  • 2 dependencies
  • MIT license

Install

npm i cucumber-expressions
yarn add cucumber-expressions
pnpm add cucumber-expressions

Overview

Cucumber Expressions - a simpler alternative to Regular Expressions

Index

Classes

class Argument

class Argument<T> {}

    constructor

    constructor(group: Group, parameterType: ParameterType<T>);

      property group

      readonly group: Group;

        property parameterType

        readonly parameterType: ParameterType<T>;

          method build

          static build: (
          treeRegexp: TreeRegexp,
          text: string,
          parameterTypes: Array<ParameterType<any>>
          ) => Array<Argument<any>>;

            method getParameterType

            getParameterType: () => ParameterType<T>;

              method getValue

              getValue: (thisObj: any) => T;
              • Get the value returned by the parameter type's transformer function.

                Parameter thisObj

                the object in which the transformer function is applied.

              class CucumberExpression

              class CucumberExpression implements Expression {}

                constructor

                constructor(expression: string, parameterTypeRegistry: ParameterTypeRegistry);
                • Parameter expression

                  Parameter parameterTypeRegistry

                property regexp

                readonly regexp: RegExp;

                  property source

                  readonly source: string;

                    method match

                    match: (text: string) => Array<Argument<any>>;

                      class CucumberExpressionGenerator

                      class CucumberExpressionGenerator {}

                        constructor

                        constructor(parameterTypeRegistry: ParameterTypeRegistry);

                          method generateExpression

                          generateExpression: (text: string) => GeneratedExpression;
                          • Deprecated

                          method generateExpressions

                          generateExpressions: (text: string) => GeneratedExpression[];

                            class Group

                            class Group {}

                              constructor

                              constructor(value: string, start: number, end: number, children: Group[]);

                                property children

                                readonly children: Group[];

                                  property end

                                  readonly end: number;

                                    property start

                                    readonly start: number;

                                      property value

                                      readonly value: string;

                                        property values

                                        readonly values: string[];

                                          class ParameterType

                                          class ParameterType<T> {}

                                            constructor

                                            constructor(
                                            name: string,
                                            regexps: string | RegExp | string[] | RegExp[],
                                            type: any,
                                            transform: (...match: string[]) => T,
                                            useForSnippets: boolean,
                                            preferForRegexpMatch: boolean
                                            );
                                            • Parameter name

                                              the name of the type

                                              Parameter regexps

                                              that matches the type

                                              Parameter type

                                              the prototype (constructor) of the type. May be null.

                                              Parameter transform

                                              function transforming string to another type. May be null.

                                              Parameter useForSnippets

                                              true if this should be used for snippets. Defaults to true.

                                              Parameter preferForRegexpMatch

                                              true if this is a preferential type. Defaults to false.

                                            property name

                                            readonly name: string;

                                              property preferForRegexpMatch

                                              readonly preferForRegexpMatch: boolean;

                                                property regexpStrings

                                                regexpStrings: string[];

                                                  property useForSnippets

                                                  readonly useForSnippets: boolean;

                                                    method checkParameterTypeName

                                                    static checkParameterTypeName: (typeName: string) => void;

                                                      method compare

                                                      static compare: (pt1: ParameterType<any>, pt2: ParameterType<any>) => number;

                                                        method transform

                                                        transform: (thisObj: any, groupValues: string[]) => any;

                                                          class ParameterTypeRegistry

                                                          class ParameterTypeRegistry {}

                                                            constructor

                                                            constructor();

                                                              property ANONYMOUS_REGEXP

                                                              static readonly ANONYMOUS_REGEXP: RegExp;

                                                                property FLOAT_REGEXP

                                                                static readonly FLOAT_REGEXP: RegExp;

                                                                  property INTEGER_REGEXPS

                                                                  static readonly INTEGER_REGEXPS: RegExp[];

                                                                    property parameterTypes

                                                                    readonly parameterTypes: IterableIterator<ParameterType<any>>;

                                                                      property STRING_REGEXP

                                                                      static readonly STRING_REGEXP: RegExp;

                                                                        property WORD_REGEXP

                                                                        static readonly WORD_REGEXP: RegExp;

                                                                          method defineParameterType

                                                                          defineParameterType: (parameterType: ParameterType<any>) => void;

                                                                            method lookupByRegexp

                                                                            lookupByRegexp: (
                                                                            parameterTypeRegexp: string,
                                                                            expressionRegexp: RegExp,
                                                                            text: string
                                                                            ) => ParameterType<any>;

                                                                              method lookupByTypeName

                                                                              lookupByTypeName: (typeName: string) => ParameterType<any>;

                                                                                class RegularExpression

                                                                                class RegularExpression implements Expression {}

                                                                                  constructor

                                                                                  constructor(regexp: RegExp, parameterTypeRegistry: ParameterTypeRegistry);

                                                                                    property regexp

                                                                                    readonly regexp: RegExp;

                                                                                      property source

                                                                                      readonly source: string;

                                                                                        method match

                                                                                        match: (text: string) => Argument<any>[];

                                                                                          Interfaces

                                                                                          interface Expression

                                                                                          interface Expression {}

                                                                                            property source

                                                                                            readonly source: string;

                                                                                              method match

                                                                                              match: (text: string) => Array<Argument<any>>;

                                                                                                Package Files (9)

                                                                                                Dependencies (2)

                                                                                                Dev Dependencies (13)

                                                                                                Peer Dependencies (0)

                                                                                                No peer dependencies.

                                                                                                Badge

                                                                                                To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/cucumber-expressions.

                                                                                                • Markdown
                                                                                                  [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/cucumber-expressions)
                                                                                                • HTML
                                                                                                  <a href="https://www.jsdocs.io/package/cucumber-expressions"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>