Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/trimorphdev/deno-depd

Deprecate no longer supported features in your library with ease!
https://github.com/trimorphdev/deno-depd

Last synced: about 1 month ago
JSON representation

Deprecate no longer supported features in your library with ease!

Awesome Lists containing this project

README

        

# DEPD
*A lightweight deprecation module for Deno*!

Depd is inspired by a [Node.js module named Depd](https://www.npmjs.com/package/depd).

## Usage
```ts
import depd from 'https://deno.land/x/[email protected]/mod.ts';

// Create the initial deprecator:
const deprecated = depd('package-name');

// Deprecate a function:
const func = deprecated(function func() {
console.log('Hello, world!');
});

func();

//=> [WARNING] Package package-name deprecated 'func()'.
```

**If you want to throw an error instead of displaying a warning:**
```ts
import depd from 'https://deno.land/x/[email protected]/mod.ts';

// Create the initial deprecator:
const deprecated = depd('package-name', {
error: true // Use configuration
});

// Deprecate a function:
const func = deprecated(function func() {
console.log('Hello, world!');
});

func();

//=> Error: Package package-name deprecated 'func()'.
```