Skip to content

Commit b3d3a7c

Browse files
Fix bug
1 parent 522b267 commit b3d3a7c

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

lib/query/woqlCore.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ function compilePredicate(pp, q) {
711711
if (pp.indexOf('<') !== -1 && pp.indexOf('>') !== -1) {
712712
let pred = pp.slice(1, pp.length - 1);
713713
// eslint-disable-next-line no-multi-assign,no-constant-condition
714-
const cleaned = (pred = '.' ? null : q.cleanPathPredicate(pred));
714+
const cleaned = pred === '.' ? null : q.cleanPathPredicate(pred);
715715
return {
716716
'@type': 'PathOr',
717717
or: [{
@@ -725,15 +725,15 @@ function compilePredicate(pp, q) {
725725
};
726726
} if (pp.indexOf('<') !== -1) {
727727
const pred = pp.slice(1, pp.length);
728-
const cleaned = (pred = '.' ? null : q.cleanPathPredicate(pred));
728+
const cleaned = pred === '.' ? null : q.cleanPathPredicate(pred);
729729
return { '@type': 'InversePathPredicate', predicate: cleaned };
730730
} if (pp.indexOf('>') !== -1) {
731731
const pred = pp.slice(0, pp.length - 1);
732-
const cleaned = (pred = '.' ? null : q.cleanPathPredicate(pred));
732+
const cleaned = pred === '.' ? null : q.cleanPathPredicate(pred);
733733
return { '@type': 'PathPredicate', predicate: cleaned };
734734
}
735-
const cleaned = (pp = '.' ? null : q.cleanPathPredicate(pp));
736-
return { '@type': 'PathPredicate', predicate: pp };
735+
const cleaned = pp === '.' ? null : q.cleanPathPredicate(pp);
736+
return { '@type': 'PathPredicate', predicate: cleaned };
737737
}
738738

739739
/**

test/woqlPathquery.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ describe('woql path query and path query prettyprint', () => {
4545
}
4646
},
4747
{
48-
'@type': "PathPredicate"
48+
'@type': "PathPredicate",
49+
'predicate' : "name"
4950
}
5051
]
5152
},
@@ -55,7 +56,7 @@ describe('woql path query and path query prettyprint', () => {
5556
}
5657
};
5758
expect(query.json()).to.eql(json);
58-
expect(query.prettyPrint()).to.eql('WOQL.path("v:X", "(.*),.", "v:Y")');
59+
expect(query.prettyPrint()).to.eql('WOQL.path("v:X", "(.*),name", "v:Y")');
5960
});
6061

6162
it('test plus directed path query', () => {

0 commit comments

Comments
 (0)