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

deprecated

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deprecated

Tool for deprecating things

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
301K
increased by5.03%
Maintainers
2
Weekly downloads
 
Created

What is deprecated?

The 'deprecated' npm package is used to mark methods or functions as deprecated. This is useful for developers to indicate that certain parts of their code should no longer be used and may be removed in future versions. It helps in maintaining and updating codebases by providing warnings when deprecated methods are used.

What are deprecated's main functionalities?

Deprecate a Function

This feature allows you to mark a function as deprecated. When the deprecated function is called, a warning message is displayed to inform the user that the function is deprecated and suggest an alternative.

const deprecated = require('deprecated');

function oldFunction() {
  console.log('This is an old function');
}

const newFunction = deprecated('oldFunction is deprecated, use newFunction instead.', oldFunction);

newFunction();

Deprecate a Method in an Object

This feature allows you to mark a method within an object as deprecated. Similar to the function deprecation, it provides a warning message when the deprecated method is called.

const deprecated = require('deprecated');

const myObject = {
  oldMethod: function() {
    console.log('This is an old method');
  }
};

myObject.newMethod = deprecated('oldMethod is deprecated, use newMethod instead.', myObject.oldMethod);

myObject.newMethod();

Other packages similar to deprecated

FAQs

Package last updated on 13 May 2017

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