3.0.0 • Published 3 years ago

easy-inherit v3.0.0

Weekly downloads
-
License
Unlicense
Repository
github
Last release
3 years ago

USAGE

ES6:

    import inherit from ('easy-inherit')

Node:

    const  inherit= require('easy-inherit')

Usage:

    function  fish(){
  	    this.growl=()=>"bloop"
  	}
  	fish.isFishy=true
  	    
  	function  monkey(){
  	    this.banana=true
  	}
  	monkey.prototype.eat=()=>"namnamnam"
  	monkey.isHairy=true
     
  	// function name will be the class constructor name ⬇️ (must have a name!)
  	const  monkeyFish=inherit([fish,monkey],function  monkeyFish(brain){
        fish.call(this); // you still need to call "super" manually
        monkey.call(this);
	    this.brain=brain;
  	})
    
     const  barnie=new  monkeyFish('large')
     console.log(monkeyFish.isHairy) //true
     console.log(monkeyFish.isFishy) //true
     console.log(barnie) /*
  	    monkeyFish {
  		    growl: [Function (anonymous)],
  		    banana: true,
  		    brain: 'large'
  	    }
      */
      console.log(barnie.eat()) //namnamnam
3.0.0

3 years ago

2.0.0

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago