
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
feature-toggle-decorator
Advanced tools
A decorator that will only execute the wrapped function if it is given a truthy parameter, and optionally call a fallback method if the feature is not enabled.
import { isEnabled } from "./is-enabled";
const features = {
FEATURE_1: true,
FEATURE_2: false,
FEATURE_3: false
};
class Example {
@isEnabled(features.FEATURE_1)
public test1() {
// will be called
}
@isEnabled(features.FEATURE_2)
public test2() {
// will not be called
}
@isEnabled(features.FEATURE_3, "fallbackMethod")
public test3(...args) {
// will not be called
}
public fallbackMethod() {
// will be called instead of test3
}
}
Note that any arguments sent to a disabled method with a fallback will be passed on to the fallback.
Issues and PRs are very welcome. To get the project set up run:
git clone git@github.com:solirius/feature-toggle-decorator
npm install --dev
npm test
If you would like to send a pull request please write your contribution in TypeScript and if possible, add a test.
This software is licensed under GNU GPLv3.
FAQs
Feature Toggle Decorator
The npm package feature-toggle-decorator receives a total of 1 weekly downloads. As such, feature-toggle-decorator popularity was classified as not popular.
We found that feature-toggle-decorator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.