2.0.0 • Published 1 year ago
cellx-decorators v2.0.0
cellx-decorators
Installation
npm i -S cellx-decorators
Usage
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
1 year ago
1.6.3
4 years ago
1.6.2
5 years ago
1.6.1
5 years ago
1.6.0
5 years ago
1.5.4
6 years ago
1.5.1
6 years ago
1.5.0
6 years ago
1.4.12
6 years ago
1.4.11
7 years ago
1.4.10
7 years ago
1.4.9
8 years ago
1.4.7
8 years ago
1.4.6
8 years ago
1.4.5
8 years ago
1.4.4
8 years ago
1.4.3
8 years ago
1.4.2
8 years ago
1.4.1
8 years ago
1.4.0
8 years ago
1.3.0
8 years ago
1.2.15
8 years ago
1.2.12
8 years ago
1.2.11
8 years ago
1.2.10
8 years ago
1.2.9
8 years ago
1.2.8
8 years ago
1.2.7
8 years ago
1.2.6
8 years ago
1.2.5
8 years ago
1.2.4
8 years ago
1.2.3
8 years ago
1.2.2
8 years ago
1.2.1
8 years ago
1.2.0
8 years ago
1.1.1
9 years ago
1.1.0
9 years ago
1.0.5
9 years ago
1.0.4
9 years ago
1.0.3
9 years ago
1.0.2
9 years ago
1.0.1
9 years ago
1.0.0
9 years ago
0.1.0
9 years ago