documentation and fix tests

This commit is contained in:
Kevin Jahns
2018-03-29 11:58:02 +02:00
parent 61149b458a
commit 135c6d31be
22 changed files with 341 additions and 115 deletions

View File

@@ -1,5 +1,5 @@
import { default as Item } from './Item.js'
import { logID } from '../MessageHandler/messageToString.js'
import { logItemHelper } from '../MessageHandler/messageToString.js'
export default class ItemFormat extends Item {
constructor () {
@@ -30,9 +30,13 @@ export default class ItemFormat extends Item {
encoder.writeVarString(this.key)
encoder.writeVarString(JSON.stringify(this.value))
}
/**
* Transform this YXml Type to a readable format.
* Useful for logging as all Items and Delete implement this method.
*
* @private
*/
_logString () {
const left = this._left !== null ? this._left._lastId : null
const origin = this._origin !== null ? this._origin._lastId : null
return `ItemFormat(id:${logID(this._id)},key:${JSON.stringify(this.key)},value:${JSON.stringify(this.value)},left:${logID(left)},origin:${logID(origin)},right:${logID(this._right)},parent:${logID(this._parent)},parentSub:${this._parentSub})`
return logItemHelper('ItemFormat', this, `key:${JSON.stringify(this.key)},value:${JSON.stringify(this.value)}`)
}
}