core-decorators.js
Library of ES7 decorators inspired by languages that come with built-ins like @override, @deprecated, etc
The idea is these decorators would be used to ensure code sanity, but would be removed in production builds via a Babel plugin.
@override
import { override } from 'core-decorators';
class Parent {
kickDog(first, second) {}
}
class Child extends Parent {
@override
kickDog() {}
}
class Child extends Parent {
@override
kickDogs() {}
}
@deprecated
import { deprecated } from 'core-decorators';
class Person {
@deprecated
kickDog() {}
@deprecated('We stopped animal abuse')
kickDogHard() {}
@deprecated('We stopped animal abuse', { url: 'http://humanesociety.org/issues/abuse_neglect/' })
kickDogHarder() {}
}
let person = new Person();
person.kickDog();
person.kickDogHard();
person.kickDogHarder();