0.0.5 • Published 9 years ago

utildot v0.0.5

Weekly downloads
28
License
martiniware
Repository
github
Last release
9 years ago

utildot

line saving javascript inheritence.

inherits(constructor, constructor, super)

  • grab a super constructor
  • apply it to some child constructors using a variadic version of util.inherits
  • the last parameter given is the super constructor
  • any number of constructors given sooner inherit from a prototype of the super constructor

instead of doing this:

var util = require('util');
var EventEmitter = require('events').EventEmitter;

util.inherits(Ctor, EventEmitter);
util.inherits(AnotherCtor, EventEmitter);

function Ctor(){}
function AnotherCtor(){}

just do:

var util = require('utildot')

util.inherits(Ctor, AnotherCtor, require('events').EventEmitter);

function Ctor(){}
function AnotherCtor(){}
//... inherit down to any number of constructors passed before the superCtor

install:

$ npm i utildot

test:

$ npm t
0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago