Atomy
JavaScript OOP
installaton
npm install atomy
Browser
NodeJS
var Atomy = ;
class creation
var Animal = Atomy var dogg = 'Snoop';var cat = 'Tom'; dogg; //I'am Snoopcat; //I'am Tom
inheritance
var Monkey = Animal var monkey = 'Joe'; monkey; //I'am Joemonkey; //I can jump
extends an existing class
var ReversedArray = Atomy var ra = 15342;ra; //[5,4,3,2,1]
instanceof
var Animal = Atomy; var Monkey = Animal;var Human = Monkey; var Wolf = Animal;var Dog = Wolf; console; //trueconsole; //trueconsole; //false
constant
var XMath = Atomy; XMath; try XMathPI = 0; catch e XMathPI; //3.14
Add constant into existing objects
Atomy;windowMYCONST = false;windowMYCONST; //true
private
var Something = Atomy; var s = ;s; //Hidden Value
inject
Extend object prototype
var Something = Atomy; Something; var some = ;some; //Bar
Inject single property
Something; some; //9
Inject into existing objects
Atomy; var a = 67342;a; //[7, 6, 4, 3, 2]
share
Same as Atomy.inject
but extends only static context
var Something = Atomy; Something; Something; //Bar
Share single property
Something; Something; //9
Share existing objects
Atomy; windowlocation;
singletone
var Animal = Atomy; Animal__instance__ = null;Animal { ifthis__instance__ === null this__instance__ = ; return this__instance__;} var a = Animal;var b = Animal; a === b //true
namespace
Atomy;//window.milkyway.solar.earth var scope = {};Atomy;//scope.milkyway.solar.earth AtomyAnimal = Atomy; var animal = ;
isset
Atomy; //trueAtomy; //true var Animal = Atomy; var monkey = ;monkey //true Animalabilities = ; Animal; //true
toString
var Animal = Atomy;