///
class SayIf extends Say {
private condition : () => boolean;
public constructor (condition : () => boolean, ...objs : Array) {
super(...objs);
this.condition = condition != undefined ? condition : () => { return true; };
}
public async getPureElements () : Promise> {
if (this.condition()) {
let paragraphs = await this.getParagraphs();
return paragraphs.length == 1 ? paragraphs[0] : Array.prototype.concat.apply([], paragraphs);
}
return [];
}
}