New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

lodash-decorators

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lodash-decorators - npm Package Compare versions

Comparing version 5.0.1 to 6.0.0

utils/isPrototypeAccess.d.ts

28

bindAll.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var isFunction = require("lodash/isFunction");
var utils_1 = require("./utils");
var factory_1 = require("./factory");
var bind_1 = require("./bind");
/**

@@ -32,10 +32,3 @@ * Binds methods of an object to the object itself, overwriting the existing method.

return function (target) {
return utils_1.wrapConstructor(target, function (Ctor) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
bindAllMethods(target, this, methods);
Ctor.apply(this, args);
});
bindAllMethods(target, methods);
};

@@ -45,5 +38,7 @@ }

exports.bindAll = BindAll;
function bindAllMethods(target, instance, methods) {
function bindAllMethods(target, methods) {
if (methods === void 0) { methods = []; }
var targetProto = target.prototype;
var proto = target.prototype;
var boundKeys = [];
while (proto && proto !== Object.prototype) {

@@ -54,3 +49,3 @@ for (var _i = 0, _a = Object.getOwnPropertyNames(proto); _i < _a.length; _i++) {

var descriptor = Object.getOwnPropertyDescriptor(proto, key);
if (include && key !== 'constructor' && !instance.hasOwnProperty(key)) {
if (include && key !== 'constructor') {
// If this property is a getter and it's NOT an instance decorated

@@ -64,10 +59,5 @@ // method, ignore it. Instance decorators are getters until first accessed.

}
var value = instance[key];
if (isFunction(value)) {
Object.defineProperty(instance, key, {
configurable: true,
enumerable: descriptor.enumerable,
value: utils_1.copyMetadata(value.bind(instance), value),
writable: descriptor.writable
});
if (isFunction(proto[key]) && boundKeys.indexOf(key) === -1) {
Object.defineProperty(targetProto, key, bind_1.Bind(proto, key, descriptor));
boundKeys.push(key);
}

@@ -74,0 +64,0 @@ }

@@ -5,2 +5,23 @@ # Change Log

<a name="6.0.0"></a>
# [6.0.0](https://github.com/steelsojka/lodash-decorators/compare/v5.0.1...v6.0.0) (2018-06-17)
### Bug Fixes
* **bindAll:** fix constructor not being called with new ([4e72d0c](https://github.com/steelsojka/lodash-decorators/commit/4e72d0c))
* **decorators:** don't apply instance decorators when accessing from a ([17caeb6](https://github.com/steelsojka/lodash-decorators/commit/17caeb6))
### BREAKING CHANGES
* **bindAll:** Properties will use the bind decorator to apply getter/setters
on the prototype instead of the instance. This could cause
issues with consumers currently using the implementain that
assigns the bound properties to the instance through the constructor
rather than on the prototype. The value on the prototype will now be
a getter instead of the original function value.
<a name="5.0.1"></a>

@@ -7,0 +28,0 @@ ## [5.0.1](https://github.com/steelsojka/lodash-decorators/compare/v5.0.0...v5.0.1) (2018-06-02)

@@ -61,2 +61,3 @@ "use strict";

var isProperty = isFirstInstance && !isGetter && !isSetter && !isMethod;
var baseValue = isGetter ? get : isMethod ? value : undefined;
chainData.properties.push(name);

@@ -118,2 +119,7 @@ chainData.fns.push(function (fn, instance, context) {

descriptor.get = function () {
// Check for direct access on the prototype.
// MyClass.prototype.fn <-- This should not apply the decorator.
if (utils_1.isPrototypeAccess(this, target)) {
return baseValue;
}
applyDecorator(this);

@@ -120,0 +126,0 @@ var descriptor = Object.getOwnPropertyDescriptor(this, name);

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

import { BiTypedDecorator1 } from './factory';
import { ResolvableFunction, BiTypedDecorator1 } from './factory';
/**

@@ -20,4 +20,4 @@ * Negates a functions result or, when used on a property, creates a function that

*/
export declare const Negate: BiTypedDecorator1<string | Function>;
export declare const Negate: BiTypedDecorator1<ResolvableFunction>;
export { Negate as negate };
export default Negate;

@@ -5,3 +5,3 @@ {

"description": "A collection of decorators using lodash at it's core.",
"version": "5.0.1",
"version": "6.0.0",
"engines": {

@@ -54,18 +54,18 @@ "node": ">=0.12.0"

"@types/chai": "^3.5.1",
"@types/lodash": "^4.14.63",
"@types/mocha": "^2.2.41",
"@types/node": "^7.0.13",
"@types/sinon": "^2.1.3",
"@types/lodash": "^4.14.109",
"@types/mocha": "^2.2.48",
"@types/node": "^7.0.65",
"@types/sinon": "^2.3.7",
"chai": "~2.2.0",
"del-cli": "^0.2.1",
"doctoc": "^1.3.0",
"doctoc": "^1.3.1",
"esdoc": "^0.5.2",
"http-server": "^0.9.0",
"lodash": "^4.17.4",
"mocha": "^3.3.0",
"lodash": "^4.17.10",
"mocha": "^3.5.3",
"sinon": "~1.14.1",
"standard-version": "^4.0.0",
"standard-version": "^4.4.0",
"ts-node": "^3.0.2",
"tslint": "^5.1.0",
"tslint-language-service": "^0.9.2",
"tslint": "^5.10.0",
"tslint-language-service": "^0.9.9",
"typescript": "~2.3.4"

@@ -77,4 +77,4 @@ },

"dependencies": {
"tslib": "^1.7.1"
"tslib": "^1.9.2"
}
}

@@ -10,1 +10,2 @@ export * from './utils/log';

export * from './utils/isDecoratorArgs';
export * from './utils/isPrototypeAccess';

@@ -15,2 +15,3 @@ "use strict";

__export(require("./utils/isDecoratorArgs"));
__export(require("./utils/isPrototypeAccess"));
//# sourceMappingURL=utils.js.map

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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