1.0.3 • Published 3 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
3 years ago
1.1.2
3 years ago
1.0.3
4 years ago
1.1.1
4 years ago
1.0.2
4 years ago
1.0.1
4 years ago
0.10.7
4 years ago
0.10.8
4 years ago
0.9.19
4 years ago
0.10.2
4 years ago
0.10.3
4 years ago
0.10.4
4 years ago
0.10.5
4 years ago
0.10.6
4 years ago
0.9.18
4 years ago
0.9.14
4 years ago
0.9.15
4 years ago
0.9.12
4 years ago
0.9.13
4 years ago
0.9.8
4 years ago
0.9.9
4 years ago
0.9.7
4 years ago
0.9.6
4 years ago
0.9.5
4 years ago
0.9.3
4 years ago
0.9.2
4 years ago
0.7.3
5 years ago
0.6.20
7 years ago
0.6.19
7 years ago
0.6.18
7 years ago
0.6.12
7 years ago
0.6.11
7 years ago
0.6.10
7 years ago
0.6.9
7 years ago
0.6.8
7 years ago
0.6.7
7 years ago
0.6.5
7 years ago
0.6.4
7 years ago
0.6.3
7 years ago
0.6.2
7 years ago
0.6.1
7 years ago
0.5.1
7 years ago
0.4.5
7 years ago
0.4.4
7 years ago
0.4.3
7 years ago
0.4.2
7 years ago
0.4.1
7 years ago
0.3.3
7 years ago
0.3.2
7 years ago
0.3.1
7 years ago
0.2.2
7 years ago
0.2.1
7 years ago
0.0.4
7 years ago
0.0.1
7 years ago