Skip to content

oriSomething/prototype-decorator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prototype Decorator

This project made because right now the class initializing spec it unclear and both in the current spec there is a missing key of what happen when you need to initialize a propery for using it with super class constructor. However when the environment isn't set to production, it will throw if you override existing property of the class.

Installing

npm install prototype-decorator

How to use

import prototype from 'prototype-decorator';


class Parent {
  constructor() {
    console.log(this.hello);
  }
}

@prototype({ hello: "hello world!" })
class Child extends Parent {}

new Child(); // log: hello world!

About

Initialize propeties to be used with super class constructor

Resources

License

Stars

Watchers

Forks

Packages

No packages published