Skip to content

Commit 3d89d73

Browse files
committed
Make variables that start with _ significant
1 parent b413389 commit 3d89d73

File tree

4 files changed

+4
-13
lines changed

4 files changed

+4
-13
lines changed

lib/tailored.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tailored",
3-
"version": "2.7.1",
3+
"version": "2.7.2",
44
"description": "Pattern matching library",
55
"main": "lib/tailored.js",
66
"jsnext:main": "src/index.js",

src/tailored/resolvers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function resolveVariable(pattern) {
6262
return function(value, args) {
6363
if (pattern.name === null) {
6464
args.push(value);
65-
} else if (!pattern.name.startsWith('_')) {
65+
} else if (pattern.name !== '_') {
6666
args.push(Types.namedVariableResult(pattern.name, value));
6767
}
6868

test/match.spec.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,6 @@ describe('match', () => {
8383
expect(matches).to.equal(null);
8484
});
8585

86-
it('must match variable names with underscores with values are different', () => {
87-
let matches = Tailored.match_or_default(
88-
[Tailored.variable('_name'), Tailored.variable('_name')],
89-
[3, 4]
90-
);
91-
92-
expect(matches.length).to.equal(0);
93-
});
94-
9586
it('matches async function', () => {
9687
const f = async function() {};
9788
let matches = Tailored.match_or_default(f, f);

0 commit comments

Comments
 (0)