2.0.0 • Published 2 years ago
cellx-decorators v2.0.0
cellx-decorators
Installation
npm i -S cellx-decoratorsUsage
import { EventEmitter } from 'cellx';
import { Observable, Computed } from 'cellx-decorators';
import formatPhone from '../../utils/formatPhone';
class User extends EventEmitter {
id = null;
@Observable firstName = null;
@Observable lastName = null;
@Computed get fullName() {
return [this.firstName, this.lastName].join(' ').trim() || null;
}
@Observable phone = null;
@Computed({
put(value) {
this.phone = value.replace(/\D+/g, '');
}
}) get formattedPhone() {
return this.phone && formatPhone(this.phone);
}
}
let u = new User();
u.phone = '79161234567';
console.log(u.formattedPhone);
// => '+7 (916) 123-45-67'
u.formattedPhone = '+7 (916) 765-43-21';
console.log(u.phone);
// => '79167654321'2.0.0
2 years ago
1.6.3
5 years ago
1.6.2
6 years ago
1.6.1
6 years ago
1.6.0
6 years ago
1.5.4
7 years ago
1.5.1
7 years ago
1.5.0
7 years ago
1.4.12
7 years ago
1.4.11
8 years ago
1.4.10
8 years ago
1.4.9
8 years ago
1.4.7
9 years ago
1.4.6
9 years ago
1.4.5
9 years ago
1.4.4
9 years ago
1.4.3
9 years ago
1.4.2
9 years ago
1.4.1
9 years ago
1.4.0
9 years ago
1.3.0
9 years ago
1.2.15
9 years ago
1.2.12
9 years ago
1.2.11
9 years ago
1.2.10
9 years ago
1.2.9
9 years ago
1.2.8
9 years ago
1.2.7
9 years ago
1.2.6
9 years ago
1.2.5
9 years ago
1.2.4
9 years ago
1.2.3
9 years ago
1.2.2
9 years ago
1.2.1
9 years ago
1.2.0
9 years ago
1.1.1
10 years ago
1.1.0
10 years ago
1.0.5
10 years ago
1.0.4
10 years ago
1.0.3
10 years ago
1.0.2
10 years ago
1.0.1
10 years ago
1.0.0
10 years ago
0.1.0
10 years ago