Skip to content

Commit 992ea9b

Browse files
committed
Format some files that needed it
1 parent 282c8bf commit 992ea9b

3 files changed

Lines changed: 17 additions & 25 deletions

File tree

browser/queryan.test.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,5 @@ test('predicate', (t) => {
6161
t.deepEqual(query('-a or a -b or b', items), items)
6262
t.deepEqual(query('-a -b', items), [])
6363

64-
6564
t.end()
6665
})

browser/queryan.ts

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const T = (...args: any) => true;
99
const isOrToken = (token: Token): boolean =>
1010
Boolean(token && token[0] === "or");
1111
const isNegated = (token: Token): boolean =>
12-
Boolean(token && tokenValue(token)[0] === '-')
12+
Boolean(token && tokenValue(token)[0] === "-");
1313
const isWhitespaceToken = ([token]: Token): boolean => /^\s/.test(token);
1414
const isTextToken = complement(isWhitespaceToken) as (token: Token) => boolean;
1515
const isLeftOfOr = ([, index]: Token, tokens: Tokens): boolean =>
@@ -22,13 +22,10 @@ const tokenIndex = ([, index]: Token) => index;
2222
const tokenValue = ([value]: Token) => value;
2323

2424
const withoutNegation = (token: Token): Token => {
25-
const without = tokenValue(token).slice(1)
25+
const without = tokenValue(token).slice(1);
2626

27-
return [
28-
without,
29-
tokenIndex(token) + 1
30-
]
31-
}
27+
return [without, tokenIndex(token) + 1];
28+
};
3229

3330
function parse(input: string): Tokens {
3431
// Regular expression to match:
@@ -123,7 +120,7 @@ const or = (before: Predicate, token: Predicate) => (issue: string) =>
123120
const and = (before: Predicate, token: Predicate) => (issue: string) =>
124121
before(issue) && token(issue);
125122
const not = (before: Predicate, token: Predicate) => (issue: string) =>
126-
!token(issue)
123+
!token(issue);
127124

128125
const predicate =
129126
<T>(matcher: (token: Token, value: T) => boolean) =>
@@ -139,15 +136,13 @@ const predicate =
139136

140137
const [token, ...rest] = tokens;
141138

142-
if (isOrToken(token) || isWhitespaceToken(token)) return passes(rest, predicate)
139+
if (isOrToken(token) || isWhitespaceToken(token))
140+
return passes(rest, predicate);
143141

144142
if (isNegated(token)) {
145-
const without = withoutNegation(token)
143+
const without = withoutNegation(token);
146144

147-
return passes(rest, and(
148-
predicate,
149-
complement(matches(without))
150-
))
145+
return passes(rest, and(predicate, complement(matches(without))));
151146
}
152147

153148
// TODO: Consider writing this simpler by deconstructing to get left of or, the or token and the right of or in one go.

browser/template.html

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@
1313
<style>
1414
::backdrop,
1515
:root {
16-
--sans-font: -apple-system, BlinkMacSystemFont, "Avenir Next", Avenir,
16+
--sans-font:
17+
-apple-system, BlinkMacSystemFont, "Avenir Next", Avenir,
1718
"Nimbus Sans L", Roboto, "Noto Sans", "Segoe UI", Arial, Helvetica,
1819
"Helvetica Neue", sans-serif;
19-
--mono-font: Consolas, Menlo, Monaco, "Andale Mono", "Ubuntu Mono",
20-
monospace;
20+
--mono-font:
21+
Consolas, Menlo, Monaco, "Andale Mono", "Ubuntu Mono", monospace;
2122
--standard-border-radius: 5px;
2223
--bg: #fff;
2324
--accent-bg: #f5f7ff;
@@ -382,11 +383,8 @@
382383
width: 100%;
383384
}
384385
select:not([multiple]) {
385-
background-image: linear-gradient(
386-
45deg,
387-
transparent 49%,
388-
var(--text) 51%
389-
),
386+
background-image:
387+
linear-gradient(45deg, transparent 49%, var(--text) 51%),
390388
linear-gradient(135deg, var(--text) 51%, transparent 49%);
391389
background-position: calc(100% - 15px), calc(100% - 10px);
392390
background-size:
@@ -632,8 +630,8 @@
632630

633631
<dt><code>-token</code></dt>
634632
<dd>
635-
You can negate any token to exclude it from your results.
636-
e.g. Handy to hide closed items.
633+
You can negate any token to exclude it from your results. e.g. Handy
634+
to hide closed items.
637635
</dd>
638636
</dl>
639637
</details>

0 commit comments

Comments
 (0)