
Security News
Another Round of TEA Protocol Spam Floods npm, But It’s Not a Worm
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.
clean-decorators
Advanced tools
clean-decorators is a small utility library to cleanup subscriptions from observables on a method call.
It takes any property that has a unsubscribe method. If the property is undefined/null or has no unsubscribe method at the time
of the cleanup. Nothing will happen.
npm install clean-decorators
reflect-metadataThe library has a dependency on reflect-metadata but does not import it. You need to import it yourself.
@Cleanable defines a cleanable property.
@Clean unsubscribes every property defined by the @Cleanable decorators.
class MyClass {
@Cleanable() myProperty: any;
@Cleanable() myProperty2: any;
constructor () {
this.myProperty = /* observable.subscribe(() => {}) */
this.myProperty2 = /* observable2.subscribe(() => {}) */
}
@Clean()
clean () {
// Now myProperty and myProperty2 are unsubscribed
}
}
@Cleanable() takes CleanableMetadata which is an object containing an id. By default, this id is an empty string.
The @Clean() decorator also takes an id in his CleanMetadata options.
It can be useful if you need two categories of subscriptions that you want to unsubscribe in different methods.
class MyClass {
@Cleanable({ id: 'a' }) myProperty: any;
@Cleanable({ id: 'b' }) myProperty2: any;
constructor () {
this.myProperty = /* observable.subscribe(() => {}) */
this.myProperty2 = /* observable2.subscribe(() => {}) */
}
@Clean({ id: 'a' })
cleanA () {
// Now myProperty is unsubscribed
}
@Clean({ id: 'b' })
cleanB () {
// Now myProperty2 is unsubscribed
}
}
The CleanMetadata decorator also takes a before parameter which defines if the decorator runs before the original method or otherwise.
FAQs
Decorators to clean up observable subscriptions
We found that clean-decorators 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
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.

Security News
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads

Research
/Security News
A malicious Chrome extension posing as an Ethereum wallet steals seed phrases by encoding them into Sui transactions, enabling full wallet takeover.