deprecated-decorator

WebJar for deprecated-decorator

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

deprecated-decorator
Last Version

Last Version

0.1.6
Release Date

Release Date

Type

Type

jar
Description

Description

deprecated-decorator
WebJar for deprecated-decorator
Project URL

Project URL

https://www.webjars.org
Source Code Management

Source Code Management

https://github.com/vilic/deprecated-decorator

Download deprecated-decorator

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/deprecated-decorator/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>deprecated-decorator</artifactId>
    <version>0.1.6</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/deprecated-decorator/
implementation 'org.webjars.npm:deprecated-decorator:0.1.6'
// https://jarcasting.com/artifacts/org.webjars.npm/deprecated-decorator/
implementation ("org.webjars.npm:deprecated-decorator:0.1.6")
'org.webjars.npm:deprecated-decorator:jar:0.1.6'
<dependency org="org.webjars.npm" name="deprecated-decorator" rev="0.1.6">
  <artifact name="deprecated-decorator" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='deprecated-decorator', version='0.1.6')
)
libraryDependencies += "org.webjars.npm" % "deprecated-decorator" % "0.1.6"
[org.webjars.npm/deprecated-decorator "0.1.6"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

NPM Package Build Status

Deprecated Decorator

A simple decorator for deprecated properties, methods and classes. It can also wrap normal functions via the old-fashioned way.

Transpilers supported:

Install

npm install deprecated-decorator --save

API References

export declare type DeprecatedDecorator = ClassDecorator & PropertyDecorator;

export interface DeprecatedOptions {
    alternative?: string;
    version?: string;
    url?: string;
}

export declare function deprecated(options?: DeprecatedOptions): DeprecatedDecorator;
export declare function deprecated(alternative?: string, version?: string, url?: string): DeprecatedDecorator;

export declare function deprecated<T extends Function>(fn: T): T;
export declare function deprecated<T extends Function>(options: DeprecatedOptions, fn: T): T;
export declare function deprecated<T extends Function>(alternative: string, fn: T): T;
export declare function deprecated<T extends Function>(alternative: string, version: string, fn: T): T;
export declare function deprecated<T extends Function>(alternative: string, version: string, url: string, fn: T): T;

export default deprecated;

Usage

Decorating a class will enable warning on constructor and static methods (including static getters and setters):

import deprecated from 'deprecated-decorator';

// alternative, since version, url
@deprecated('Bar', '0.1.0', 'http://vane.life/')
class Foo {
    static method() { }
}

Or you can decorate methods respectively:

import deprecated from 'deprecated-decorator';

class Foo {
    @deprecated('otherMethod')
    method() { }
    
    @deprecated({
        alternative: 'otherProperty',
        version: '0.1.2',
        url: 'http://vane.life/'
    })
    get property() { }
}

For functions:

import deprecated from 'deprecated-decorator';

let foo = deprecated({
    alternative: 'bar',
    version: '0.1.0'
}, function foo() {
    // ...
});

License

MIT License.

Versions

Version
0.1.6