1.0.3 • Published 2 years ago
clone-class v1.0.3
CLONE CLASS
Clone an ES6 Class as Another Class Name for Isolating Static Properties in the Classes.
EXAMPLE
Shell
$ npm i clone-class
TypeScript
import cloneClass from '../'
class Employee {
public static company: string
constructor(
public name: string,
) {
}
public info() {
console.log(`Employee ${this.name}, Company ${(this.constructor as any).company}`)
}
}
const GoogleEmployee = cloneClass(Employee)
GoogleEmployee.company = 'Google'
const MicrosoftEmployee = cloneClass(Employee)
MicrosoftEmployee.company = 'Microsoft'
const employee1 = new GoogleEmployee('Tom')
const employee2 = new MicrosoftEmployee('Jerry')
employee1.info()
// Output: Employee Tom, Company Google
employee2.info()
// Output: Employee Jerry, Company Microsoft
CHANGELOG
v0.0.1 (Apr 23, 2018)
Initial version, seprecated from Project Wechaty.
AUTHOR
COPYRIGHT & LICENSE
- Code & Docs © 2016-2018 Huan LI \zixia@zixia.net\
- Code released under the Apache-2.0 License
- Docs released under Creative Commons
1.1.3
2 years ago
1.1.2
2 years ago
1.0.3
2 years ago
1.1.1
2 years ago
1.0.2
3 years ago
1.0.1
3 years ago
0.10.7
3 years ago
0.10.8
3 years ago
0.9.19
3 years ago
0.10.2
3 years ago
0.10.3
3 years ago
0.10.4
3 years ago
0.10.5
3 years ago
0.10.6
3 years ago
0.9.18
3 years ago
0.9.14
3 years ago
0.9.15
3 years ago
0.9.12
3 years ago
0.9.13
3 years ago
0.9.8
3 years ago
0.9.9
3 years ago
0.9.7
3 years ago
0.9.6
3 years ago
0.9.5
3 years ago
0.9.3
3 years ago
0.9.2
3 years ago
0.7.3
4 years ago
0.6.20
5 years ago
0.6.19
6 years ago
0.6.18
6 years ago
0.6.12
6 years ago
0.6.11
6 years ago
0.6.10
6 years ago
0.6.9
6 years ago
0.6.8
6 years ago
0.6.7
6 years ago
0.6.5
6 years ago
0.6.4
6 years ago
0.6.3
6 years ago
0.6.2
6 years ago
0.6.1
6 years ago
0.5.1
6 years ago
0.4.5
6 years ago
0.4.4
6 years ago
0.4.3
6 years ago
0.4.2
6 years ago
0.4.1
6 years ago
0.3.3
6 years ago
0.3.2
6 years ago
0.3.1
6 years ago
0.2.2
6 years ago
0.2.1
6 years ago
0.0.4
6 years ago
0.0.1
6 years ago