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.12.0 to 0.12.1

31

lib/decorate.js

@@ -14,15 +14,30 @@ 'use strict';

function handleDescriptor(target, key, _ref, _ref2) {
var fn = _ref.value;
function handleDescriptor(target, key, descriptor, _ref) {
var _ref2 = _toArray(_ref);
var _ref22 = _toArray(_ref2);
var decorator = _ref2[0];
var decorator = _ref22[0];
var args = _ref2.slice(1);
var args = _ref22.slice(1);
var fn = descriptor.value;
var configurable = descriptor.configurable;
var enumerable = descriptor.enumerable;
var writable = descriptor.writable;
return {
configurable: true,
enumerable: false,
value: decorator.apply(undefined, [fn].concat(_toConsumableArray(args)))
configurable: configurable,
enumerable: enumerable,
get: function get() {
var value = decorator.apply(undefined, [fn].concat(_toConsumableArray(args)));
Object.defineProperty(this, key, {
configurable: configurable,
enumerable: enumerable,
writable: writable,
value: value
});
return value;
},
set: (0, _privateUtils.createDefaultSetter)()
};

@@ -29,0 +44,0 @@ }

{
"name": "core-decorators",
"version": "0.12.0",
"version": "0.12.1",
"description": "Library of ES2016 (ES7) JavaScript decorators inspired by languages that come with built-ins like @​override, @​deprecate, @​autobind, @​mixin and more! Works great with React/Angular/more!",

@@ -52,2 +52,3 @@ "main": "lib/core-decorators.js",

"interop-require": "1.0.0",
"lodash": "4.10.0",
"mocha": "^2.2.5",

@@ -54,0 +55,0 @@ "sinon": "^1.15.4",

@@ -27,3 +27,3 @@ # core-decorators.js [![Build Status](https://travis-ci.org/jayphelps/core-decorators.js.svg?branch=master)](https://travis-ci.org/jayphelps/core-decorators.js)

* [@decorate](#decorate)
* [@extendDescriptor](#extendDescriptor) :new:
* [@extendDescriptor](#extenddescriptor) :new:

@@ -50,3 +50,3 @@ ##### For Properties

* [applyDecorators()](#applyDecorators) :new:
* [applyDecorators()](#applydecorators-helper) :new:

@@ -57,2 +57,4 @@ ## Docs

> Note: there is a bug in `react-hot-reloader <= 1.3.0` (they fixed in [`2.0.0-alpha-4`](https://github.com/gaearon/react-hot-loader/pull/182)) which prevents this from working as expected. [Follow it here](https://github.com/jayphelps/core-decorators.js/issues/48)
Forces invocations of this function to always have `this` refer to the class instance, even if the function is passed around or would otherwise lose its `this` context. e.g. `var fn = context.method;` Popular with React components.

@@ -59,0 +61,0 @@

import { decorate as _decorate, createDefaultSetter } from './private/utils';
function handleDescriptor(target, key, { value: fn }, [decorator, ...args]) {
function handleDescriptor(target, key, descriptor, [decorator, ...args]) {
const { value: fn, configurable, enumerable, writable } = descriptor;
return {
configurable: true,
enumerable: false,
value: decorator(fn, ...args)
configurable,
enumerable,
get() {
const value = decorator(fn, ...args);
Object.defineProperty(this, key, {
configurable,
enumerable,
writable,
value
});
return value;
},
set: createDefaultSetter()
};

@@ -9,0 +23,0 @@ }

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