
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
#Atomy JavaScript OOP
##installaton
npm install atomy
Browser
<script src="/path/to/undercloud.atomy.min.js"></script>
NodeJS
var Atomy = require('atomy');
##class creation
var Animal = Atomy.extend({
weight: 0,
abilities: ['eat','breath','see'],
constructor: function(name) {
this.name = name;
},
say: function() {
console.log("I'am " + this.name);
}
})
var dogg = new Animal('Snoop');
var cat = new Animal('Tom');
dogg.say(); //I'am Snoop
cat.say(); //I'am Tom
##inheritance
var Monkey = Animal.extend({
constructor: function(name) {
Monkey.superclass.constructor.call(this, name);
},
jump: function() {
console.log('I can jump');
}
})
var monkey = new Monkey('Joe');
monkey.say(); //I'am Joe
monkey.jump(); //I can jump
##extends an existing class
var ReversedArray = Atomy.extend(Array, {
constructor: function() {
for (var i in arguments){
this.push(arguments[i]);
}
},
reverseSort: function() {
return this.sort().reverse();
}
})
var ra = new ReversedArray(1,5,3,4,2);
ra.reverseSort(); //[5,4,3,2,1]
##instanceof
var Animal = Atomy.extend({/*...*/});
var Monkey = Animal.extend({/*...*/});
var Human = Monkey.extend({/*...*/});
var Wolf = Animal.extend({/*...*/});
var Dog = Wolf.extend({/*...*/});
console.log(new Dog() instanceof Wolf); //true
console.log(new Dog() instanceof Animal); //true
console.log(new Dog() instanceof Monkey); //false
##constant
var XMath = Atomy.extend({});
XMath.constant('PI', 3.14);
try {
XMath.PI = 0;
} catch (e) {
}
XMath.PI; //3.14
Add constant into existing objects
Atomy.constant(window, 'MYCONST', true);
window.MYCONST = false;
window.MYCONST; //true
##private
var Something = Atomy.extend({
constructor: function() {
var hiddenProperty = 'Hidden Value';
Something.prototype.getHiddenProperty = function() {
return hiddenProperty;
};
}
});
var s = new Something();
s.getHiddenProperty(); //Hidden Value
##inject Extend object prototype
var Something = Atomy.extend({/*...*/});
Something.inject({
foo: 'Bar',
getFoo: function() {
return this.foo;
}
});
var some = new Something();
some.getFoo(); //Bar
Inject single property
Something.inject('square', function(x) {
return x * x;
});
some.square(3); //9
Inject into existing objects
Atomy.inject(Array, 'reverseSort', function() {
return this.sort().reverse()
});
var a = [6,7,3,4,2];
a.reverseSort(); //[7, 6, 4, 3, 2]
##share
Same as Atomy.inject but extends only static context
var Something = Atomy.extend({/*...*/});
Something.share({
foo: 'Bar',
getFoo: function() {
return this.foo;
}
});
Something.getFoo(); //Bar
Share single property
Something.inject('square', function(x) {
return x * x;
});
Something.square(3); //9
Share existing objects
Atomy.share(window.location, 'setHash', function(hash) {
this.hash = hash;
});
window.location.setHash('goto');
##singletone
var Animal = Atomy.extend({});
Animal.__instance__ = null;
Animal.getInstance = function() {
if(this.__instance__ === null) {
this.__instance__ = new Animal();
}
return this.__instance__;
}
var a = Animal.getInstance();
var b = Animal.getInstance();
a === b //true
##namespace
Atomy.namespace('milkyway.solar.earth');
//window.milkyway.solar.earth
var scope = {};
Atomy.namespace('milkyway.solar.earth',scope);
//scope.milkyway.solar.earth
Atomy.namespace('milkyway.solar.earth.life').Animal = Atomy.extend({
/*...*/
});
var animal = new milkyway.solar.earth.life.Animal();
##isset
Atomy.isset('window.Array.prototype.sort'); //true
Atomy.isset('sort', Array.prototype); //true
var Animal = Atomy.extend({
say: function() {
/*...*/
}
});
var monkey = new Animal();
monkey.isset('say') //true
Animal.abilities = [];
Animal.isset('abilities'); //true
##toString
var Animal = Atomy.extend({
toString: function() {
return '[object Atomy]';
}
});
FAQs
JavaScript OOP library
We found that atomy demonstrated a not healthy version release cadence and project activity because the last version was released 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.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.