diff --git a/libs/hdf-converters/data/converters/cciListXml2json.ts b/libs/hdf-converters/data/converters/cciListXml2json.ts index ea8adebdb..a9b217f40 100644 --- a/libs/hdf-converters/data/converters/cciListXml2json.ts +++ b/libs/hdf-converters/data/converters/cciListXml2json.ts @@ -115,7 +115,8 @@ if (scriptIsCalled) { } } -const CCIS_KEY = 'ccis'; +export const CCIS_KEY = 'ccis'; +export const DELIMITER = ' '; type Leaf = { [CCIS_KEY]?: string[]; @@ -134,7 +135,6 @@ export function removeParentheses(key: string): string { } function unflatten(fullNistPathToListOfCcis: Record): Trie { - const DELIMITER = ' '; const result = {}; const keys = _.keys(fullNistPathToListOfCcis); for (const key of keys) { diff --git a/libs/hdf-converters/src/mappings/CciNistMapping.ts b/libs/hdf-converters/src/mappings/CciNistMapping.ts index a82103f1f..a102933c9 100644 --- a/libs/hdf-converters/src/mappings/CciNistMapping.ts +++ b/libs/hdf-converters/src/mappings/CciNistMapping.ts @@ -2,7 +2,11 @@ import _ from 'lodash'; import {NIST_TO_CCI} from '../mappings/NistCciMappingData'; import {is_control, parse_nist} from 'inspecjs'; import {CCI_TO_NIST} from './CciNistMappingData'; -import {removeParentheses} from '../../data/converters/cciListXml2json'; +import { + CCIS_KEY, + DELIMITER, + removeParentheses +} from '../../data/converters/cciListXml2json'; export function CCI2NIST( identifiers: string[], @@ -29,7 +33,7 @@ export function NIST2CCI( collapse = true ): string[] { const DEFAULT_CCI_TAGS = defaultNist2Cci || []; - const createPath = (nist: string) => [...nist.split(' '), 'ccis']; + const createPath = (nist: string) => [...nist.split(DELIMITER), CCIS_KEY]; const nists = identifiers.map(parse_nist); const controls = nists.filter(is_control); const paths = controls.map((control) =>