github.com/jfrog/frogbot@v1.1.1-0.20231221090046-821a26f50338/action/node_modules/@actions/core/lib/utils.js (about)

     1  "use strict";
     2  // We use any as a valid input type
     3  /* eslint-disable @typescript-eslint/no-explicit-any */
     4  Object.defineProperty(exports, "__esModule", { value: true });
     5  exports.toCommandProperties = exports.toCommandValue = void 0;
     6  /**
     7   * Sanitizes an input into a string so it can be passed into issueCommand safely
     8   * @param input input to sanitize into a string
     9   */
    10  function toCommandValue(input) {
    11      if (input === null || input === undefined) {
    12          return '';
    13      }
    14      else if (typeof input === 'string' || input instanceof String) {
    15          return input;
    16      }
    17      return JSON.stringify(input);
    18  }
    19  exports.toCommandValue = toCommandValue;
    20  /**
    21   *
    22   * @param annotationProperties
    23   * @returns The command properties to send with the actual annotation command
    24   * See IssueCommandProperties: https://github.com/actions/runner/blob/main/src/Runner.Worker/ActionCommandManager.cs#L646
    25   */
    26  function toCommandProperties(annotationProperties) {
    27      if (!Object.keys(annotationProperties).length) {
    28          return {};
    29      }
    30      return {
    31          title: annotationProperties.title,
    32          file: annotationProperties.file,
    33          line: annotationProperties.startLine,
    34          endLine: annotationProperties.endLine,
    35          col: annotationProperties.startColumn,
    36          endColumn: annotationProperties.endColumn
    37      };
    38  }
    39  exports.toCommandProperties = toCommandProperties;
    40  //# sourceMappingURL=utils.js.map