-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathActor.ts
More file actions
22 lines (20 loc) · 820 Bytes
/
Actor.ts
File metadata and controls
22 lines (20 loc) · 820 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import * as Property from "./Property"
export class Actor<T extends Actor<T>> {
protected readonly transformers: Property.Transformer[] = []
constructor(readonly id?: string) {}
add(...argument: (Property.Configuration | Property.Transformer | undefined)[]): T {
argument.forEach(
value =>
value && this.transformers.push(Property.Configuration.is(value) ? this.creatableToTransformer(value) : value)
)
return this as unknown as T
}
private creatableToTransformer(creatable: Property.Configuration): Property.Transformer {
return Property.Converter.Configuration.is(creatable)
? new Property.Converter(creatable)
: Property.Crypto.Configuration.is(creatable)
? Property.Crypto.create(creatable[0], ...creatable.slice(1))
: new Property.Renamer(creatable)
}
}
export namespace Actor {}