Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
abstract-object
Advanced tools
AbstractObject with Object State Events Support, RefObject with RefCount and AddRef/Release Support.
AbstractObject with Object State Events Supports and free
method provides.
The derived class should overwrite the init
, final
methods.
Methods:
create
(class): the create
class method uses to create a new object instance(the util.createObject is the same function).
init
: abstract initialization method after a new instance creating.
final
: abstract finalization method before the instance destroying.free
: free the class instance.Events:
'initing'
: emit before the init method'inited'
: emit after the init method'destroying'
: emit before the final method'destroyed'
: emit after the final methodThe RefObject
is derived from AbstractObject. and add the RefCount
and AddRef/Release
Supports.
release
/free
: Decrements reference count for this instance.
If it is becoming less than 0, the object would be (self) destroyed.addRef
: Increments the reference count for this instance
and returns the new reference count.AbstractObject = require('abstract-object')
RefObject = require('abstract-object/RefObject')
inherits = require('abstract-object/lib/util').inherits
createObject = AbstractObject.createObject
class MyObject
inherits MyObject, RefObject
init: (@a,@b)->
super()
myObj = createObject(MyObject, 1, 2)
# if you do not wanna use `AbstractObject.create`, you MUST remember this:
# even the constructor is empty, you should can the parent's constructor manually.
# myObj = new MyObject()
class MyObject
inherits MyObject, RefObject
constructor: ->
# must call super method here:
super
init: (@a,@b)->
# must call super method here for RefObject initialization:
super()
the javascript:
var AbstractObject = require('abstract-object')
var RefObject = require('abstract-object/RefObject')
var util = require('abstract-object/lib/util')
var createObject = AbstractObject.createObject
//if you do not wanna to use the 'AbstractObject.create'(createObject):
var MyObject = function() {
//super call
MyObject.__super__.constructor.apply(this, arguments);
}
// or, this MUST use 'AbstractObject.create'
var MyObject = function(){}
util.inherits(MyObject, RefObject)
MyObject.prototype.init = function(a,b) {
//super call
MyObject.__super__.init.call(this);
this.a = a
this.b = b
}
var myObj = createObject(MyObject, 1, 2)
//or this, must overwrite the constructor and call the super constructor.
var myObj = new MyObject(1,2)
FAQs
AbstractObject with Object State Events Support
The npm package abstract-object receives a total of 32 weekly downloads. As such, abstract-object popularity was classified as not popular.
We found that abstract-object demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.