Skip to content

Commit

Permalink
idk
Browse files Browse the repository at this point in the history
  • Loading branch information
handeyeco committed Jan 14, 2025
1 parent 7795616 commit fd899c6
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 84 deletions.
2 changes: 1 addition & 1 deletion packages/perseus-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ export {PerseusError} from "./error/perseus-error";

export * from "./data-schema";

export {pluck, mapObject, clone} from "./utils/object-utils";
export {pluck, mapObject} from "./utils/objective_";
export {default as Util} from "./utils/util";
export type {GridDimensions, Position} from "./utils/util";
64 changes: 0 additions & 64 deletions packages/perseus-core/src/utils/object-utils.ts

This file was deleted.

14 changes: 0 additions & 14 deletions packages/perseus-core/src/utils/objective_.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
/**
<<<<<<<< HEAD:packages/perseus-core/src/utils/object-utils.ts
* Utilities for objects
========
* _ utilities for objects
>>>>>>>> main:packages/perseus-core/src/utils/objective_.ts
*/

import _ from "underscore";
Expand Down Expand Up @@ -52,13 +48,3 @@ export const mapObject = function <K extends string, V, U>(
});
return result;
};

// Performs a deep copy of the given object. If there are cycles in the object
// tree, an error is thrown.
export const clone = <T>(obj: T): T => {
const json = JSON.stringify(obj);
if (!json) {
throw new Error("Oops, couldn't clone given object!");
}
return JSON.parse(json);
};
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {Dependencies} from "@khanacademy/perseus";
import {clone} from "@khanacademy/perseus-core";
import {RenderStateRoot} from "@khanacademy/wonder-blocks-core";
import {render, screen} from "@testing-library/react";
import {userEvent as userEventLib} from "@testing-library/user-event";
import * as React from "react";

import {clone} from "../../../../../../testing/object-utils";
import {testDependencies} from "../../../../../../testing/test-dependencies";

import StartCoordsSettings from "./start-coords-settings";
Expand Down
3 changes: 2 additions & 1 deletion packages/perseus/src/__tests__/renderer.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import {describe, beforeAll, beforeEach, it} from "@jest/globals";
import {Errors, clone} from "@khanacademy/perseus-core";
import {Errors} from "@khanacademy/perseus-core";
import {act, screen, waitFor, within} from "@testing-library/react";
import {userEvent as userEventLib} from "@testing-library/user-event";
import * as React from "react";

import {clone} from "../../../../testing/object-utils";
import {testDependencies} from "../../../../testing/test-dependencies";
import {
dropdownWidget,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import {describe, beforeEach, it} from "@jest/globals";
import {lockedFigureColors, clone} from "@khanacademy/perseus-core";
import {lockedFigureColors} from "@khanacademy/perseus-core";
import {color as wbColor} from "@khanacademy/wonder-blocks-tokens";
import {act, waitFor} from "@testing-library/react";
import {userEvent as userEventLib} from "@testing-library/user-event";
import {Plot} from "mafs";
import * as React from "react";
import invariant from "tiny-invariant";

import {clone} from "../../../../../testing/object-utils";
import {testDependencies} from "../../../../../testing/test-dependencies";
import {waitForInitialGraphieRender} from "../../../../../testing/wait";
import {getDefaultFigureForType} from "../../../../perseus-editor/src/widgets/interactive-graph-editor/locked-figures/util";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {clone} from "@khanacademy/perseus-core";
import invariant from "tiny-invariant";

import {clone} from "../../../../../testing/object-utils";

import scoreInteractiveGraph from "./score-interactive-graph";

import type {PerseusInteractiveGraphRubric} from "../../validation.types";
Expand Down
2 changes: 1 addition & 1 deletion packages/perseus/src/widgets/radio/__tests__/radio.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {describe, beforeEach, it} from "@jest/globals";
import {clone} from "@khanacademy/perseus-core";
import {act, screen, fireEvent, waitFor} from "@testing-library/react";
import {userEvent as userEventLib} from "@testing-library/user-event";

import {clone} from "../../../../../../testing/object-utils";
import {testDependencies} from "../../../../../../testing/test-dependencies";
import * as Dependencies from "../../../dependencies";
import {mockStrings} from "../../../strings";
Expand Down
9 changes: 9 additions & 0 deletions testing/object-utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Performs a deep copy of the given object. If there are cycles in the object
// tree, an error is thrown.
export const clone = <T>(obj: T): T => {
const json = JSON.stringify(obj);
if (!json) {
throw new Error("Oops, couldn't clone given object!");
}
return JSON.parse(json);
};

0 comments on commit fd899c6

Please sign in to comment.