File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ export class Picker {
4848 if ( Math . random ( ) > 0.45 ) return [ this . generateObjectKey ( ) , InsObjOp ] ;
4949 const keys = [ ...node . keys . keys ( ) ] ;
5050 if ( ! keys . length ) return [ this . generateObjectKey ( ) , InsObjOp ] ;
51- const key = keys [ Math . floor ( Math . random ( ) * keys . length ) ] ;
51+ const key = Fuzzer . pick ( keys ) ;
5252 return [ key , DelOp ] ;
5353 }
5454
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import * as nodes from '../../../nodes';
22import { ClockDecoder } from '../../../../json-crdt-patch/codec/clock/ClockDecoder' ;
33import { ITimestampStruct , Timestamp } from '../../../../json-crdt-patch/clock' ;
44import { Model , UNDEFINED } from '../../../model/Model' ;
5- import { JsonCrdtDataType , ORIGIN , SESSION } from '../../../../json-crdt-patch/constants' ;
5+ import { JsonCrdtDataType , SESSION } from '../../../../json-crdt-patch/constants' ;
66import type * as t from './types' ;
77
88export class Decoder {
@@ -83,7 +83,10 @@ export class Decoder {
8383 const id = this . ts ( node [ 1 ] ) ;
8484 const obj = new nodes . ObjNode ( model , id ) ;
8585 const map = node [ 2 ] as t . JsonCrdtCompactObj [ 2 ] ;
86- for ( const key in map ) {
86+ const keys = Object . keys ( map ) ;
87+ const length = keys . length ;
88+ for ( let i = 0 ; i < length ; i ++ ) {
89+ const key = keys [ i ] ;
8790 const val = this . decNode ( model , map [ key ] ) ;
8891 obj . put ( key , val . id ) ;
8992 }
You can’t perform that action at this time.
0 commit comments