Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

deprecated-decorator

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deprecated-decorator

A simple decorator for deprecated methods and properties.

  • 0.1.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
497K
increased by6.37%
Maintainers
1
Weekly downloads
 
Created

What is deprecated-decorator?

The deprecated-decorator npm package provides a way to mark methods or classes as deprecated in JavaScript/TypeScript. This helps developers to signal that certain parts of the codebase should no longer be used and may be removed in future versions.

What are deprecated-decorator's main functionalities?

Deprecate a Method

This feature allows you to mark a method as deprecated. When the deprecated method is called, a warning message will be logged to the console.

const { deprecated } = require('deprecated-decorator');

class Example {
  @deprecated('This method will be removed in future versions. Use newMethod instead.')
  oldMethod() {
    console.log('This is the old method.');
  }

  newMethod() {
    console.log('This is the new method.');
  }
}

const example = new Example();
example.oldMethod();

Deprecate a Class

This feature allows you to mark an entire class as deprecated. When an instance of the deprecated class is created, a warning message will be logged to the console.

const { deprecated } = require('deprecated-decorator');

@deprecated('This class will be removed in future versions. Use NewClass instead.')
class OldClass {
  method() {
    console.log('This is a method in the old class.');
  }
}

class NewClass {
  method() {
    console.log('This is a method in the new class.');
  }
}

const oldInstance = new OldClass();
oldInstance.method();

Other packages similar to deprecated-decorator

Keywords

FAQs

Package last updated on 04 Jan 2016

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc