Skip to content

Commit

Permalink
Merge pull request #1118 from metabrainz/array-move
Browse files Browse the repository at this point in the history
chore: Remove dependency to array-move package
  • Loading branch information
MonkeyDo authored Oct 15, 2024
2 parents bb2ab1d + dec3d23 commit 65ae157
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"@fortawesome/free-brands-svg-icons": "^6.4.2",
"@fortawesome/free-solid-svg-icons": "^6.4.2",
"@fortawesome/react-fontawesome": "^0.1.11",
"array-move": "^3.0.1",
"bookbrainz-data": "5.1.1",
"chart.js": "^2.9.4",
"chartjs-adapter-date-fns": "^1.0.0",
Expand Down
5 changes: 3 additions & 2 deletions src/client/entity-editor/series-section/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
/* eslint-disable no-inline-comments */

import type {Attribute, Relationship, RelationshipForDisplay} from '../relationship-editor/types';
import arrayMove from 'array-move';
import {attachAttribToRelForDisplay} from '../helpers';
import {sortRelationshipOrdinal} from '../../../common/helpers/utils';

Expand Down Expand Up @@ -119,7 +118,9 @@ export function sortSeriesItems(oldIndex, newIndex):any {
delete seriesItem.number;
delete seriesItem.position;
});
const sortedSeriesItems = arrayMove(seriesItemsArray, oldIndex, newIndex);
const sortedSeriesItems = [...seriesItemsArray];
const [itemToMove] = sortedSeriesItems.splice(oldIndex, 1);
sortedSeriesItems.splice(newIndex, 0, itemToMove);
sortedSeriesItems.forEach((seriesItem: RelationshipForDisplay, index: number) => {
seriesItem.attributes.forEach((attribute: Attribute) => {
if (attribute.attributeType === 1) { // Attribute type 1 for position
Expand Down
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2535,11 +2535,6 @@ array-includes@^3.1.3, array-includes@^3.1.4, array-includes@^3.1.7:
get-intrinsic "^1.2.4"
is-string "^1.0.7"

array-move@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/array-move/-/array-move-3.0.1.tgz#179645cc0987b65953a4fc06b6df9045e4ba9618"
integrity sha512-H3Of6NIn2nNU1gsVDqDnYKY/LCdWvCMMOWifNGhKcVQgiZ6nOek39aESOvro6zmueP07exSl93YLvkN4fZOkSg==

array-union@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39"
Expand Down

0 comments on commit 65ae157

Please sign in to comment.