UNPKG

@gameroom/gameroom-kit

Version:

Node kit for the Gameroom API

21 lines (18 loc) 573 B
let Expression = require('./Expression'); module.exports = class Filter { constructor(data) { if (!data) { this.expression = new Expression(); return; }; if (data.and) { this.and = []; for (let filter of data.and) if (filter && filter.expression) this.and.push(new Expression(filter.expression)); } else if (data.or) { this.or = []; for (let filter of data.or) if (filter && filter.expression) this.or.push(new Expression(filter.expression)); } else { this.expression = new Expression(data); }; }; };