Socket
Socket
Sign inDemoInstall

@feathersjs/hooks

Package Overview
Dependencies
Maintainers
4
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@feathersjs/hooks - npm Package Compare versions

Comparing version 0.7.3 to 0.7.4

2

CHANGELOG.md

@@ -6,4 +6,4 @@ # Change Log

## [0.7.3](https://github.com/feathersjs/hooks/compare/v0.7.2...v0.7.3) (2022-02-05)
## [0.7.4](https://github.com/feathersjs/hooks/compare/v0.7.3...v0.7.4) (2022-04-27)
**Note:** Version bump only for package @feathersjs/hooks

@@ -53,9 +53,9 @@ import { compose } from './compose.js';

}
export function objectHooks(_obj, hooks) {
const obj = typeof _obj === 'function' ? _obj.prototype : _obj;
export function objectHooks(obj, hooks) {
if (Array.isArray(hooks)) {
return setMiddleware(obj, hooks);
}
return Object.keys(hooks).reduce((result, method) => {
const fn = obj[method];
for (const method of Object.keys(hooks)) {
const target = typeof obj[method] === 'function' ? obj : obj.prototype;
const fn = target && target[method];
if (typeof fn !== 'function') {

@@ -65,5 +65,5 @@ throw new Error(`Can not apply hooks. '${method}' is not a function`);

const manager = convertOptions(hooks[method]);
result[method] = functionHooks(fn, manager.props({ method }));
return result;
}, obj);
target[method] = functionHooks(fn, manager.props({ method }));
}
return obj;
}

@@ -70,0 +70,0 @@ export const hookDecorator = (managerOrMiddleware) => {

@@ -51,3 +51,3 @@ const proto = Object.prototype;

}
catch (e) {
catch (_e) {
// Avoid IE error

@@ -54,0 +54,0 @@ }

@@ -6,3 +6,3 @@ {

"name": "@feathersjs/hooks",
"version": "0.7.3",
"version": "0.7.4",
"description": "Async middleware for JavaScript and TypeScript",

@@ -44,3 +44,3 @@ "homepage": "https://feathersjs.com",

},
"gitHead": "2b54070a5b3edf20afb55c319bcb38feb5137e42"
"gitHead": "ba99235963980ff0c1bb0771b8654ab9b090c155"
}

@@ -58,9 +58,9 @@ "use strict";

exports.functionHooks = functionHooks;
function objectHooks(_obj, hooks) {
const obj = typeof _obj === 'function' ? _obj.prototype : _obj;
function objectHooks(obj, hooks) {
if (Array.isArray(hooks)) {
return (0, base_js_1.setMiddleware)(obj, hooks);
}
return Object.keys(hooks).reduce((result, method) => {
const fn = obj[method];
for (const method of Object.keys(hooks)) {
const target = typeof obj[method] === 'function' ? obj : obj.prototype;
const fn = target && target[method];
if (typeof fn !== 'function') {

@@ -70,5 +70,5 @@ throw new Error(`Can not apply hooks. '${method}' is not a function`);

const manager = (0, base_js_1.convertOptions)(hooks[method]);
result[method] = functionHooks(fn, manager.props({ method }));
return result;
}, obj);
target[method] = functionHooks(fn, manager.props({ method }));
}
return obj;
}

@@ -75,0 +75,0 @@ exports.objectHooks = objectHooks;

@@ -56,3 +56,3 @@ "use strict";

}
catch (e) {
catch (_e) {
// Avoid IE error

@@ -59,0 +59,0 @@ }

@@ -8,3 +8,3 @@ import { AsyncMiddleware } from './compose.js';

};
export declare function objectHooks(_obj: any, hooks: HookMap | AsyncMiddleware[]): any;
export declare function objectHooks(obj: any, hooks: HookMap | AsyncMiddleware[]): any;
export declare const hookDecorator: (managerOrMiddleware?: HookOptions | undefined) => any;
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