UNPKG

1.37 kBSource Map (JSON)View Raw
1{"version":3,"file":"utils.js","sourceRoot":"","sources":["utils.ts"],"names":[],"mappings":";;AAGA,mCAAkC;AAElC,SAAgB,iBAAiB,CAAE,KAAY;IAC7C,yBACK,KAAK,IACR,IAAI,EAAE,SAAS,EACf,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAC3B;AACH,CAAC;AAND,8CAMC;AAED,SAAgB,wBAAwB,CAAE,YAA8B;IACtE,OAAO,kBAAS,CAAC,YAAY,CAAC,MAAM,EAAE,EAAE,iBAAiB,CAAC,CAAA;AAC5D,CAAC;AAFD,4DAEC;AAED,SAAgB,kCAAkC,CAAE,YAAoC;IACtF,OAAO,kBAAS,CAAC,YAAY,CAAC,MAAM,EAAE,EAAE,CAAC,WAAwB,EAAE,EAAE,CAAC,CACpE,WAAW,CAAC,KAAK;QACjB,CAAC,CAAC,iBAAiB,CAAC,WAAW,CAAC,KAAK,CAAC;QACtC,CAAC,CAAC,IAAI,CACP,CAAC,CAAA;AACJ,CAAC;AAND,gFAMC","sourcesContent":["import { Route } from '../types/routing'\nimport ForwardingRoutingTable, { RouteUpdate } from '../services/forwarding-routing-table'\nimport PrefixMap from './prefix-map'\nimport { mapValues } from 'lodash'\n\nexport function formatRouteAsJson (route: Route) {\n return {\n ...route,\n auth: undefined,\n path: route.path.join(' ')\n }\n}\n\nexport function formatRoutingTableAsJson (routingTable: PrefixMap<Route>) {\n return mapValues(routingTable.toJSON(), formatRouteAsJson)\n}\n\nexport function formatForwardingRoutingTableAsJson (routingTable: ForwardingRoutingTable) {\n return mapValues(routingTable.toJSON(), (routeUpdate: RouteUpdate) => (\n routeUpdate.route\n ? formatRouteAsJson(routeUpdate.route)\n : null\n ))\n}\n"]}
\No newline at end of file