Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function buildParameterType({
name,
typeName,
regexp,
transformer,
useForSnippets,
preferForRegexpMatch,
}) {
const getTypeName = deprecate(
() => typeName,
'Cucumber defineParameterType: Use name instead of typeName'
)
const _name = name || getTypeName()
if (typeof useForSnippets !== 'boolean') useForSnippets = true
if (typeof preferForRegexpMatch !== 'boolean') preferForRegexpMatch = false
return new ParameterType(
_name,
regexp,
null,
transformer,
useForSnippets,
preferForRegexpMatch
)
}
public defineParameterType(
parameterTypeDefinition: IParameterTypeDefinition
) {
const parameterType = new ParameterType(
parameterTypeDefinition.name,
parameterTypeDefinition.regexp,
parameterTypeDefinition.type,
parameterTypeDefinition.transformer || defaultTransformer,
parameterTypeDefinition.useForSnippets,
parameterTypeDefinition.preferForRegexpMatch
)
this.parameterTypeRegistry.defineParameterType(parameterType)
this.parameterTypes.push(parameterType)
}