fix first y-array test

This commit is contained in:
Kevin Jahns
2017-10-16 04:53:12 +02:00
parent 4eec8ecdd3
commit 1311c7a0d8
28 changed files with 489 additions and 284 deletions

View File

@@ -1,4 +1,4 @@
import Item from './Item.js'
import { splitHelper, default as Item } from './Item.js'
export default class ItemJSON extends Item {
constructor () {
@@ -17,8 +17,8 @@ export default class ItemJSON extends Item {
}
return missing
}
_toBinary (y, encoder) {
super._toBinary(y, encoder)
_toBinary (encoder) {
super._toBinary(encoder)
let len = this._content.length
encoder.writeVarUint(len)
for (let i = 0; i < len; i++) {
@@ -29,4 +29,15 @@ export default class ItemJSON extends Item {
let s = super._logString()
return 'ItemJSON: ' + s
}
_splitAt (y, diff) {
if (diff === 0) {
return this
} else if (diff >= this._length) {
return this._right
}
let item = new ItemJSON()
item._content = this._content.splice(diff)
splitHelper(y, this, item, diff)
return item
}
}