import * as util from "util" ; function replaceMapWithObject ( key , value ) { if ( value instanceof Map || value instanceof Set ) { var obj = { } ; for ( let [ mapKey , mapValue ] of value ) { obj [ mapKey ] = mapValue ; } return obj ; } return value ; } export function walkFromPath ( path , tree ) { const treeObject = convertTreeToObject ( tree ) ; const pathParts = path . split ( "/" ) ; const file = pathParts . pop ( ) ; const tagPath = pathParts ; const finalTagNode = tagPath . reduce ( ( node , nodePath ) => node . tags [ nodePath ] , treeObject . root ) ; return finalTagNode . files [ file ] ; } export function createDeepSnapshot ( object ) { return util . inspect ( object , { depth : Infinity } ) ; } export function convertTreeToObject ( objectToSerialize ) { return JSON . parse ( JSON . stringify ( objectToSerialize , replaceMapWithObject ) ) ; }