Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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!
- Host: GitHub
- URL: https://github.com/trimorphdev/deno-depd
- Owner: trimorphdev
- Created: 2020-08-29T02:51:59.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-08-30T10:10:15.000Z (over 4 years ago)
- Last Synced: 2023-08-08T20:45:14.658Z (over 1 year ago)
- Language: TypeScript
- Size: 2.93 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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()'.
```