summaryrefslogtreecommitdiff
path: root/source/github-helpers/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'source/github-helpers/index.ts')
-rw-r--r--source/github-helpers/index.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/github-helpers/index.ts b/source/github-helpers/index.ts
index 6f24a6b1..70ad2707 100644
--- a/source/github-helpers/index.ts
+++ b/source/github-helpers/index.ts
@@ -116,3 +116,16 @@ export async function isPermalink(): Promise<boolean> {
export function isNotRefinedGitHubRepo(): boolean {
return !location.pathname.startsWith('/sindresorhus/refined-github/');
}
+
+export function shouldFeatureRun({
+ /** Every condition must be true */
+ asLongAs = [() => true],
+
+ /** At least one condition must be true */
+ include = [() => true],
+
+ /** No conditions must be true */
+ exclude = [() => false],
+}): boolean {
+ return asLongAs.every(c => c()) && include.some(c => c()) && exclude.every(c => !c());
+}