- CLI entry point with yargs parsing for speckl-compile <file> --output-dir --bom-format - TypeScript parser with AST types for all SpeckDL primitives - Generator for PROV-O JSON-LD provenance graphs - Generator for CycloneDX v1.6 BOMs - Generator for SPDX 3.0.1 BOMs - E2E test verifying RetryHandler.speck parsing and all output formats All tests pass.
22 lines
680 B
JavaScript
22 lines
680 B
JavaScript
import { inspectList } from './helpers.js';
|
|
function inspectMapEntry([key, value], options) {
|
|
options.truncate -= 4;
|
|
key = options.inspect(key, options);
|
|
options.truncate -= key.length;
|
|
value = options.inspect(value, options);
|
|
return `${key} => ${value}`;
|
|
}
|
|
// IE11 doesn't support `map.entries()`
|
|
function mapToEntries(map) {
|
|
const entries = [];
|
|
map.forEach((value, key) => {
|
|
entries.push([key, value]);
|
|
});
|
|
return entries;
|
|
}
|
|
export default function inspectMap(map, options) {
|
|
if (map.size === 0)
|
|
return 'Map{}';
|
|
options.truncate -= 7;
|
|
return `Map{ ${inspectList(mapToEntries(map), options, inspectMapEntry)} }`;
|
|
}
|