Skip to content

Common Issues #325

Open
Open
@georgedias

Description

@georgedias

Code updates

utilities/xccfs.ts

Function removeHtmlTags() document the regex being used.
Use this code block

/**
 * Removes all the HTML tags and leaves only the text content.
  *
 * @param input - The string from which HTML tags should be removed.
 * @returns A new string with all HTML tags removed.
 * 
 * @example
 * ```typescript
 * const str = '<div>Hello <b>World</b>!</div>';
 * const stripped = removeHtmlTags(str);
 * console.log(stripped); // Output: "Hello World!"
 * ```
 */
export function removeHtmlTags(input: string): string {
  // Regex explained
  //    <: Matches the opening angle bracket of an HTML tag
  //   /?: Matches zero or one forward slash /, to include closing tags
  // [^>]: Matches any character except the > symbol
  //    +: Ensures preceding pattern ([^>]) matches one or more characters
  // (>|$):
  //   > matches the closing angle bracket of an HTML tag.
  //   $ matches the end of the string. This ensures the regex can handle
  //     cases where the tag is incomplete or unclosed (e.g., <div)
  // g: Global flag to find all matches in the input string
  return input.replace(/<\/?[^>]+(>|$)/g, '');
}

Function convertEncodedXmlIntoJson(encodedXml: string, xmlParserOption: string = 'withArrayOption'): any implement the isArray() based of the XCCDF schema

Use Abstract Syntax Tree (AST) npm Library

Implement the updates to profiles and controls using the AST-GREP npm package

Object Types Library

SpreadsheetTypes

SpreadsheetTypes is a type alias for the possible types of spreadsheets. It is used to specify the type of spreadsheet when calling functions that require this information. Currently, the possible types are 'cis', 'disa', and 'general'.

export enum SpreadsheetTypes {
   CIS = 'cis',
   DISA = 'disa',
   GENERAL = 'general'
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions