Skip to content

Commit

Permalink
fix: Fix ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
fb55 committed May 23, 2022
1 parent 432ebc6 commit aeeb067
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/compile.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { trueFunc, falseFunc } from "boolbase";
import boolbase from "boolbase";

/**
* Returns a function that checks if an elements index matches the given rule
Expand Down Expand Up @@ -34,13 +34,13 @@ export function compile(
*
* `b < 0` here as we subtracted 1 from `b` above.
*/
if (b < 0 && a <= 0) return falseFunc;
if (b < 0 && a <= 0) return boolbase.falseFunc;

// When `a` is in the range -1..1, it matches any element (so only `b` is checked).
if (a === -1) return (index) => index <= b;
if (a === 0) return (index) => index === b;
// When `b <= 0` and `a === 1`, they match any element.
if (a === 1) return b < 0 ? trueFunc : (index) => index >= b;
if (a === 1) return b < 0 ? boolbase.trueFunc : (index) => index >= b;

/*
* Otherwise, modulo can be used to check if there is a match.
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { parse } from "./parse";
import { compile, generate } from "./compile";
import { parse } from "./parse.js";
import { compile, generate } from "./compile.js";

export { parse, compile, generate };

Expand Down

0 comments on commit aeeb067

Please sign in to comment.