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

core-decorators

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

core-decorators - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

src/core-decorators/private/utils.js

2

package.json
{
"name": "core-decorators",
"version": "0.0.3",
"version": "0.0.4",
"description": "Library of ES7 decorators inspired by languages that come with built-ins like @override, @deprecated, etc",

@@ -5,0 +5,0 @@ "main": "src/core-decorators/index.js",

@@ -0,19 +1,5 @@

import { decorate } from './private/utils';
const DEFAULT_MSG = 'This function will be removed in future versions.';
function isDescriptor(desc) {
if (!desc || !desc.hasOwnProperty) {
return false;
}
const keys = ['value', 'get', 'set'];
for (const key of keys) {
if (desc.hasOwnProperty(key)) {
return true;
}
}
return false;
}
function handleDescriptor(target, key, descriptor, [msg = DEFAULT_MSG, options = {}]) {

@@ -39,10 +25,4 @@ if (typeof descriptor.value !== 'function') {

export default function deprecated(...entryArgs) {
if (isDescriptor(entryArgs[entryArgs.length - 1])) {
return handleDescriptor(...entryArgs, []);
} else {
return function () {
return handleDescriptor(...arguments, entryArgs);
};
}
export default function deprecated() {
return decorate(handleDescriptor, arguments);
}

@@ -0,1 +1,3 @@

import { decorate } from './private/utils';
const GENERIC_FUNCTION_ERROR = '{child} does not properly override {parent}';

@@ -222,3 +224,3 @@ const FUNCTION_REGEXP = /^function ([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?(\([^\)]*\))[\s\S]+$/;

export default function override(klass, key, descriptor) {
function handleDescriptor(target, key, descriptor) {
descriptor.key = key;

@@ -239,1 +241,5 @@ const superKlass = Object.getPrototypeOf(klass);

}
export default function override() {
return decorate(handleDescriptor, arguments);
}
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