cucumber-expressions
Advanced tools
Comparing version 8.0.1 to 8.0.2
@@ -13,4 +13,4 @@ "use strict"; | ||
return (this.children.length === 0 ? [this] : this.children) | ||
.map(function (g) { return g.value; }) | ||
.filter(function (v) { return v !== null; }); | ||
.filter(function (g) { return typeof g.start !== 'undefined'; }) | ||
.map(function (g) { return g.value; }); | ||
}, | ||
@@ -17,0 +17,0 @@ enumerable: true, |
@@ -27,3 +27,3 @@ "use strict"; | ||
this.defineParameterType(new ParameterType_1.default('word', ParameterTypeRegistry.WORD_REGEXP, String, function (s) { return s; }, false, false)); | ||
this.defineParameterType(new ParameterType_1.default('string', ParameterTypeRegistry.STRING_REGEXP, String, function (s) { return s.replace(/\\"/g, '"').replace(/\\'/g, "'"); }, true, false)); | ||
this.defineParameterType(new ParameterType_1.default('string', ParameterTypeRegistry.STRING_REGEXP, String, function (s) { return (s || '').replace(/\\"/g, '"').replace(/\\'/g, "'"); }, true, false)); | ||
this.defineParameterType(new ParameterType_1.default('', ParameterTypeRegistry.ANONYMOUS_REGEXP, String, function (s) { return s; }, false, true)); | ||
@@ -30,0 +30,0 @@ } |
@@ -71,2 +71,14 @@ "use strict"; | ||
}); | ||
it('matches single quoted empty string as empty string', function () { | ||
assert_1.default.deepStrictEqual(match('three {string} mice', "three '' mice"), ['']); | ||
}); | ||
it('matches double quoted empty string as empty string ', function () { | ||
assert_1.default.deepStrictEqual(match('three {string} mice', 'three "" mice'), ['']); | ||
}); | ||
it('matches single quoted empty string as empty string, along with other strings', function () { | ||
assert_1.default.deepStrictEqual(match('three {string} and {string} mice', "three '' and 'handsome' mice"), ['', 'handsome']); | ||
}); | ||
it('matches double quoted empty string as empty string, along with other strings', function () { | ||
assert_1.default.deepStrictEqual(match('three {string} and {string} mice', 'three "" and "handsome" mice'), ['', 'handsome']); | ||
}); | ||
it('matches escaped parenthesis', function () { | ||
@@ -73,0 +85,0 @@ assert_1.default.deepStrictEqual(match('three \\(exceptionally) {string} mice', 'three (exceptionally) "blind" mice'), ['blind']); |
{ | ||
"name": "cucumber-expressions", | ||
"version": "8.0.1", | ||
"version": "8.0.2", | ||
"description": "Cucumber Expressions - a simpler alternative to Regular Expressions", | ||
@@ -33,4 +33,4 @@ "main": "dist/src/index.js", | ||
"@types/mocha": "^5.2.7", | ||
"@types/node": "^12.7.11", | ||
"mocha": "^6.2.1", | ||
"@types/node": "^12.11.7", | ||
"mocha": "^6.2.2", | ||
"nyc": "^14.1.1", | ||
@@ -42,3 +42,3 @@ "prettier": "^1.18.2", | ||
"tslint-plugin-prettier": "^2.0.1", | ||
"typescript": "^3.6.3" | ||
"typescript": "^3.6.4" | ||
}, | ||
@@ -45,0 +45,0 @@ "files": [ |
@@ -11,5 +11,5 @@ export default class Group { | ||
return (this.children.length === 0 ? [this] : this.children) | ||
.filter(g => typeof g.start !== 'undefined') | ||
.map(g => g.value) | ||
.filter(v => v !== null) | ||
} | ||
} |
@@ -52,3 +52,3 @@ import ParameterType from './ParameterType' | ||
String, | ||
s => s.replace(/\\"/g, '"').replace(/\\'/g, "'"), | ||
s => (s || '').replace(/\\"/g, '"').replace(/\\'/g, "'"), | ||
true, | ||
@@ -55,0 +55,0 @@ false |
@@ -98,2 +98,26 @@ import assert from 'assert' | ||
it('matches single quoted empty string as empty string', () => { | ||
assert.deepStrictEqual(match('three {string} mice', "three '' mice"), | ||
[''] | ||
) | ||
}) | ||
it('matches double quoted empty string as empty string ', () => { | ||
assert.deepStrictEqual(match('three {string} mice', 'three "" mice'), | ||
[''] | ||
) | ||
}) | ||
it('matches single quoted empty string as empty string, along with other strings', () => { | ||
assert.deepStrictEqual(match('three {string} and {string} mice', "three '' and 'handsome' mice"), | ||
['', 'handsome'] | ||
) | ||
}) | ||
it('matches double quoted empty string as empty string, along with other strings', () => { | ||
assert.deepStrictEqual(match('three {string} and {string} mice', 'three "" and "handsome" mice'), | ||
['', 'handsome'] | ||
) | ||
}) | ||
it('matches escaped parenthesis', () => { | ||
@@ -100,0 +124,0 @@ assert.deepStrictEqual( |
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 too big to display
Sorry, the diff of this file is not supported yet
334665
6243