Skip to content

Commit

Permalink
Move cloneObject into utilities and export it.
Browse files Browse the repository at this point in the history
  • Loading branch information
Remco Vermeulen committed Aug 1, 2024
1 parent 19a1da5 commit 7be3a64
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11 deletions.
5 changes: 1 addition & 4 deletions lib/codeql.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/codeql.js.map

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions lib/util.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/util.js.map

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions src/codeql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import * as setupCodeql from "./setup-codeql";
import { ToolsFeature, isSupportedToolsFeature } from "./tools-features";
import { shouldEnableIndirectTracing } from "./tracer-config";
import * as util from "./util";
import { BuildMode, wrapError } from "./util";
import { BuildMode, wrapError, cloneObject } from "./util";

type Options = Array<string | number | boolean>;

Expand Down Expand Up @@ -1344,10 +1344,6 @@ async function generateCodeScanningConfig(
return codeScanningConfigFile;
}

function cloneObject<T>(obj: T): T {
return JSON.parse(JSON.stringify(obj)) as T;
}

// This constant sets the size of each TRAP cache in megabytes.
const TRAP_CACHE_SIZE_MB = 1024;

Expand Down
4 changes: 4 additions & 0 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1100,3 +1100,7 @@ export enum BuildMode {
/** The database will be created by building the source root using manually specified build steps. */
Manual = "manual",
}

export function cloneObject<T>(obj: T): T {
return JSON.parse(JSON.stringify(obj)) as T;
}

0 comments on commit 7be3a64

Please sign in to comment.