@absolute/change-tracker-node-sdk
Version:
ChangeTracker SDK for Node.js
44 lines (42 loc) • 984 B
JavaScript
/**
* Row - Change Tracker row model
* @class
* @public
*/
module.exports = class Row {
/**
* @constructor
* @returns {Row}
* @param {string} key - row key
**/
constructor(key) {
/**
* @type {string}
**/
this.state = undefined;
/**
* @type {string}
**/
this.key = key;
/**
* @type {string}
**/
this.desc = undefined;
/**
* @type {Field[]}
**/
this.fields = [];
/**
* @type {Table[]}
**/
this.tables = [];
}
/**
* isFilled - check if model contains data
**/
isFilled() {
return Array.isArray(this.fields) && this.fields.length > 0 ||
Array.isArray(this.tables) && this.tables.some(el => Array.isArray(el.rows)
&& el.rows.some(x => typeof x.isFilled == 'function' && x.isFilled()))
}
}