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

abstract-object

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

abstract-object - npm Package Compare versions

Comparing version 2.1.4 to 2.1.5

lib/eventable-options.js

2

index.js

@@ -5,3 +5,3 @@ var defineProperty = require('util-ex/lib/defineProperty')

defineProperty(AbstractObject.prototype, '$abilities', {
Eventable: require('./eventable')
Eventable: require('./lib/eventable-options')
})

@@ -8,0 +8,0 @@ /*

@@ -15,78 +15,10 @@

(function() {
var AbstractObject, OBJECT_STATES_STR, eventable, extend, isArray, isFunction, isUndefined;
var addionalOptions, eventable;
extend = require('util-ex/lib/_extend');
isArray = require('util-ex/lib/is/type/array');
isFunction = require('util-ex/lib/is/type/function');
isUndefined = require('util-ex/lib/is/type/undefined');
eventable = require('events-ex/eventable');
AbstractObject = require('./abstract-object');
addionalOptions = require('./eventable-options');
OBJECT_STATES_STR = AbstractObject.OBJECT_STATES_STR;
module.exports = function(aClass, aOptions) {
if (!aOptions) {
aOptions = {};
}
if (!aOptions.methods) {
aOptions.methods = {};
}
extend(aOptions.methods, {
initialize: function() {
var self;
self = this.self;
self.setMaxListeners(Infinity);
return this["super"].apply(self, arguments);
},
setObjectState: function(value, emitted) {
var self;
if (emitted == null) {
emitted = true;
}
self = this.self;
this["super"].call(self, value);
if (emitted) {
self.emit(value, self);
}
},
changeObjectState: function(value, emitted) {
var self;
if (emitted == null) {
emitted = true;
}
self = this.self;
this["super"].call(self, value);
if (emitted) {
if (value == null) {
return self.emit("destroyed", self);
} else {
return self.emit(OBJECT_STATES_STR[value], self);
}
}
},
dispatch: function(event, args, callback) {
if (isUndefined(callback) && isFunction(args)) {
callback = args;
args = [];
} else if (!isArray(args)) {
args = [args];
}
if (callback && callback.apply(this, args) !== false) {
return;
}
args.splice(0, 0, event);
return this.emit.apply(this, args);
},
dispatchError: function(error, callback) {
if (callback && callback(error) !== false) {
return;
}
return this.emit('error', error);
}
});
aOptions = addionalOptions(aOptions);
return eventable(aClass, aOptions);

@@ -93,0 +25,0 @@ };

{
"name": "abstract-object",
"version": "2.1.4",
"version": "2.1.5",
"description": "AbstractObject with Object State Events Support",

@@ -20,6 +20,6 @@ "homepage": "https://github.com/snowyu/abstract-object",

"dependencies": {
"custom-ability": "~1.2.3",
"events-ex": "~1.1.0",
"custom-ability": "~1.3.1",
"events-ex": "~1.1.1",
"inherits-ex": "~1.0.6",
"util-ex": "~0.2.8"
"util-ex": "~0.2.9"
},

@@ -26,0 +26,0 @@ "devDependencies": {

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