🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

depd

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

depd

Deprecate all the things

2.0.0
latest
Version published
Weekly downloads
56M
1.9%
Maintainers
1
Weekly downloads
 
Created

What is depd?

The depd package is a deprecation helper for Node.js. It allows developers to mark functions, properties, and other JavaScript features as deprecated and to issue warning messages when they are used. This can be useful for library authors who want to make changes or remove features without breaking existing code that depends on their libraries.

What are depd's main functionalities?

Deprecate functions

This feature allows you to deprecate a function by wrapping it with a deprecation warning. When the function is called, it will log a deprecation message to the console.

var deprecate = require('depd')('my-module-name');
function oldFunction() {
  deprecate('oldFunction is deprecated, use newFunction instead.');
  // old function code
}

Deprecate property access

This feature allows you to deprecate access to an object property. When the property is accessed, it will log a deprecation message to the console.

var deprecate = require('depd')('my-module-name');
var obj = {};
Object.defineProperty(obj, 'oldProperty', {
  get: function () {
    deprecate('oldProperty is deprecated, use newProperty instead.');
    return 'some value';
  }
});

Customize deprecation messages

This feature allows you to customize the deprecation message for a property to provide additional information or instructions.

var deprecate = require('depd')('my-module-name');
deprecate.property(obj, 'oldProperty', 'oldProperty is deprecated and will be removed in the next major release.');

Other packages similar to depd

FAQs

Package last updated on 26 Oct 2018

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