import { Body } from 'planck-js' ; export const cachedBodies = { } ; export const getCachedBody = ( key ) : Body | null => { const bodies = cachedBodies [ key ] ; if ( bodies && bodies . length > 0 ) { const body = bodies . pop ( ) ; if ( body ) { return body ; } } return null ; } ; export const addCachedBody = ( key , body ) => { if ( cachedBodies [ key ] ) { cachedBodies [ key ] . push ( body ) ; } else { cachedBodies [ key ] = [ body ] ; } } ;