Current collected state Current
Observed since 20 Oct, 19:24 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
31i73-class
31i73.com simple node.js class library
A simple node.js class library
class( statics [, instanced] )
_init for declaring the initialiser, and _inherits for declaring a single or multiple classes to inherit fromvar class = require('31i73-class');
var Person = class({
_init: function(name){
this.name = name;
this.age = undefined;
}
},{
get_name: function(){ return this.name; },
set_name: function(set){ this.name = set; },
get_age: function(){ return this.age; },
set_age: function(set){ this.age = set; }
});
var bob = new Person('bob');
bob.set_age(42);
var Person = class({
_init: function(name){
this.name = name;
this.age = undefined;
},
create_adult: function(name){
var create = new Person(name);
create.set_age(24);
return create;
},
create_child: function(name){
var create = new Person(name);
create.set_age(12);
return create;
}
},{
get_name: function(){ return this.name; },
set_name: function(set){ this.name = set; },
get_age: function(){ return this.age; },
set_age: function(set){ this.age = set; }
});
var littly_timmy = Person.create_child('Timmy');
var Animal = class({
_init: function(name){
this.name = name;
this.soundeffect = undefined;
}
},{
set_soundeffect: function(path){
this.soundeffect = new Soundeffect(path);
}
});
var Horse = class({
_inherits: Animal,
_init: function(){
Animal.call(this,'horse');
this.set_soundeffect('horse.wav');
}
});
//Multiple inheritence
var Mule = class({
_inherits: [
Horse,
Donkey
],
_init: function(){
Animal.call(this,'mule');
this.set_soundeffect('mule.wav');
}
});
//a missing initialiser causes the first inherited classes initialiser to be called, instead
var Shire_horse = class({
_inherits: Horse
});
Download counts and popularity will appear here as the collector receives them.
Declarations describe requirements; they are not a resolved dependency graph.
Source distribution
{
"shasum": "2cb1645520372452cb98e6359a3db7e2855159b5",
"tarball": "https://registry.npmjs.org/31i73-class/-/31i73-class-1.0.0.tgz",
"integrity": "sha512-XOdwZU6/+BZBplEDm8Yj3TZhje1EXXZigO6c8Qhp8MegdG5+iDL9ndhd3WSLi41q2Ru9YnsWLS4Hek6zjmhGyA==",
"signatures": [
{
"keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
"sig": "MEUCIQDAUVEWL+GXhyILabIhEN1qOmsbXkM/cWiTTYZYr58o8QIgKepjOWZnqLgAWvCQn4mfduj+VWzCu6lgm3S8jjpJ8Rc="
}
]
}Observed since 20 Oct, 19:24 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:b399e9525b78099f744bcdbbfaa0feefb1f2518f90510596af6b8cc76d3076a6