Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | 22x 8180x 8180x 8180x 8180x 7222x 6449x 4278x 22x | /*! * WikiLambda Row class * * @copyright 2020– Abstract Wikipedia team; see AUTHORS.txt * @license MIT */ 'use strict'; const Constants = require( '../../Constants.js' ); /** * Row class represents one table entry or row in the ZObject * flat table representation in the store. The root zobject being * viewed or altered is flattened into a table on initialization * and represented as an array of Row objects. * * @class * @property {number} id Numerical unique row identifier; * @property {string} key String value of the key that identifies this node, string * value of the numerical index if this row represents a list item; * @property {string} value String value if the node is terminal or type of value * this node is the parent of if not terminal; * @property {number} parentId The row identifier of this row's parent */ class Row { constructor( id, key, value, parent ) { this.id = id; this.key = key; this.parent = parent; this.value = value; } /** * Returns whether the row represents a terminal node. * * @return {boolean} */ isTerminal() { return ( ( typeof this.value === 'string' ) && ( this.value !== Constants.ROW_VALUE_OBJECT ) && ( this.value !== Constants.ROW_VALUE_ARRAY ) ); } /** * Returns whether the row represents the parent node * of an array. * * @return {boolean} */ isArray() { return ( this.value === Constants.ROW_VALUE_ARRAY ); } /** * Returns whether the row represents the parent node * of an object. * * @return {boolean} */ isObject() { return ( this.value === Constants.ROW_VALUE_OBJECT ); } } module.exports = exports = Row; |