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

deprecated-decorator

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deprecated-decorator - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

bld/debug/test.d.ts

9

bld/index.d.ts

@@ -1,2 +0,9 @@

export declare function deprecated(alternative?: string, version?: string, url?: string): (target: Function | Object, name?: string, descriptor?: PropertyDescriptor) => any;
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 default deprecated;

@@ -24,3 +24,15 @@ /*

warnedPositions[at] = true;
var message = (type === 'property' ? 'Property or method' : 'Class') + " \"" + name + "\" has been deprecated";
var message;
switch (type) {
case 'property':
message = 'Property';
break;
case 'method':
message = 'Method';
break;
case 'class':
message = 'Class';
break;
}
message += " \"" + name + "\" has been deprecated";
if (version) {

@@ -99,6 +111,15 @@ message += " since version " + version;

}
function deprecated(alternative, version, url) {
function deprecated(options, version, url) {
var alternative;
if (typeof options === 'string') {
alternative = options;
}
else if (options) {
(alternative = options.alternative, version = options.version, url = options.url, options);
}
return function (target, name, descriptor) {
if (typeof name === 'string') {
return decorateProperty('property', name, descriptor, alternative, version, url);
var type = descriptor && typeof descriptor.value === 'function' ?
'method' : 'property';
return decorateProperty(type, name, descriptor, alternative, version, url);
}

@@ -105,0 +126,0 @@ else if (typeof target === 'function') {

2

package.json
{
"name": "deprecated-decorator",
"version": "0.1.2",
"version": "0.1.3",
"description": "A simple decorator for deprecated methods and properties.",

@@ -5,0 +5,0 @@ "main": "bld/index.js",

@@ -14,2 +14,19 @@ [![NPM Package](https://badge.fury.io/js/deprecated-decorator.svg)](https://www.npmjs.com/package/deprecated-decorator)

## API References
```ts
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 default deprecated;
```
## Usage

@@ -38,3 +55,7 @@

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

@@ -41,0 +62,0 @@ }

Sorry, the diff of this file is not supported yet

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