Skip to content

Commit

Permalink
refactor: Make is use some
Browse files Browse the repository at this point in the history
  • Loading branch information
fb55 committed Jun 5, 2021
1 parent d509328 commit ad46174
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { parse, Selector, PseudoSelector, isTraversal } from "css-what";
import {
is as plainIs,
_compileToken as compileToken,
Options as CSSSelectOptions,
prepareContext,
Expand Down Expand Up @@ -30,16 +29,7 @@ export function is(
selector: string | ((el: Element) => boolean),
options: Options = {}
): boolean {
if (typeof selector === "function") return selector(element);

const [plain, filtered] = groupSelectors(parse(selector, options));

return (
(plain.length > 0 && plainIs(element, plain, options)) ||
filtered.some(
(sel) => filterBySelector(sel, [element], options).length > 0
)
);
return some([element], selector, options);
}

export function some(
Expand Down

0 comments on commit ad46174

Please sign in to comment.