import toSync from './toSync' ; import hexGen from './hexGen' ; import { CollabAction } from '../model' ; export * from './testUtils' ; const toJS = ( node ) => { try { return JSON . parse ( JSON . stringify ( node ) ) ; } catch ( e ) { console . error ( 'Convert to js failed!!! Return null' ) ; return null ; } } ; const cloneNode = ( node ) => toSync ( toJS ( node ) ) ; const toSlatePath = ( path ) => path ? path . filter ( ( d ) => Number . isInteger ( d ) ) : [ ] ; const toCollabAction = ( type , fn ) => ( payload ) => fn ( { type , payload } ) ; export { toSync , toJS , toSlatePath , hexGen , cloneNode , toCollabAction } ;