etho.js

2.0.3 • Public • Published

etho.js

Build Status Dependency Status Code Climate Coverage Status stable

NPM

My toolbox, forged to fit my needs, reading the jsjutsu's gurus papers.

Examples

etho.ucfirst

  console.log(etho.ucfirst('foobar'));
  // Print 'Foobar' in the console.

etho.x

Parent class.

var ParentCl = etho.x({
  name: 'ParentCl',
  version: '0.1'
}, function ParentCl(value){
  console.log(this.meta.name, ' constructor !');
  console.log(this.meta);
  return this.init(value);
})({
  'init': function init(value){
    this.value = value;
    console.log(this.meta.name + 'Init !');
  },
  'baz' : function baz(arg){
    console.log(this.meta.name + ':baz this', this);
    return this.meta.name + ' ' + arg + ' ' + this.value + ' Baz'
  }
});

Child class.

var ChildCl = etho.x('ChildCl', ParentCl, function ChildCl(value){
  console.log(this.meta.name, ' constructor !');
  console.log(this.meta);
  this.parentMethod('init')(value);
})({
  'baz' : function baz(){
    return 'Wrapped ' + this.parentMethod('baz')('Bob') + ' Up';
  }
});

In action.

var childCl = new ChildCl('Value that passe everywhere !!!');

console.log(bar.baz());
/** Output in console:
  ChildCl:baz this [Object(instance of ChildCl)]
  Wrapped ChildCl bob Up
**/

Readme

Keywords

none

Package Sidebar

Install

npm i etho.js

Weekly Downloads

1

Version

2.0.3

License

none

Last publish

Collaborators

  • kane-thornwyrd