1 | import { parse } from "./parse";
|
2 | import { compile } from "./compile";
|
3 | export { parse, compile };
|
4 | /**
|
5 | * Parses and compiles a formula to a highly optimized function.
|
6 | * Combination of `parse` and `compile`.
|
7 | *
|
8 | * If the formula doesn't match any elements,
|
9 | * it returns [`boolbase`](https://github.com/fb55/boolbase)'s `falseFunc`.
|
10 | * Otherwise, a function accepting an _index_ is returned, which returns
|
11 | * whether or not the passed _index_ matches the formula.
|
12 | *
|
13 | * Note: The nth-rule starts counting at `1`, the returned function at `0`.
|
14 | *
|
15 | * @param formula The formula to compile.
|
16 | * @example
|
17 | * const check = nthCheck("2n+3");
|
18 | *
|
19 | * check(0); // `false`
|
20 | * check(1); // `false`
|
21 | * check(2); // `true`
|
22 | * check(3); // `false`
|
23 | * check(4); // `true`
|
24 | * check(5); // `false`
|
25 | * check(6); // `true`
|
26 | */
|
27 | export default function nthCheck(formula: string): (index: number) => boolean;
|
28 | //# sourceMappingURL=index.d.ts.map |
\ | No newline at end of file |