@punks/backend-core 0.0.41 → 0.0.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,4 +18,5 @@ export declare const processArrayItemMove: <TItem>(items: TItem[], input: {
18
18
  item: TItem;
19
19
  newIndex: number;
20
20
  oldIndex: number;
21
+ isMoved: boolean;
21
22
  }[];
@@ -1 +1 @@
1
- export { processArrayDifferences } from "./arrays";
1
+ export { processArrayDifferences, processArrayItemMove } from "./arrays";
package/dist/esm/index.js CHANGED
@@ -28513,6 +28513,19 @@ const processArrayDifferences = ({ elements, elementIdSelector, desiredItems, de
28513
28513
  correspondingElements,
28514
28514
  };
28515
28515
  };
28516
+ const processArrayItemMove = (items, input) => {
28517
+ const { oldIndex, newIndex } = input;
28518
+ const item = items[oldIndex];
28519
+ const newItems = [...items];
28520
+ newItems.splice(oldIndex, 1);
28521
+ newItems.splice(newIndex, 0, item);
28522
+ return newItems.map((x, i) => ({
28523
+ item: x,
28524
+ newIndex: i,
28525
+ oldIndex: items.indexOf(x),
28526
+ isMoved: i !== items.indexOf(x),
28527
+ }));
28528
+ };
28516
28529
 
28517
- export { ExcelKeyTransform, Log, LogLevel, MetaSerializationType, addTime, buildObject, buildTree, byField, byFieldDesc, camelToKebabCase, camelToSnakeCase, csvBuild, csvParse, distinct, distinctElements, ensureDirectory, ensureStartSlash, ensureTailingSlash, excelBuild, excelParse, first, flatten, getDirectoryFilePaths, getDirectoryPath, groupBy, indexes, isNullOrUndefined, iterate, joinPath, jsonDistinct, last, logMemoryUsage, mapOrThrow, mergeDeep, newUuid, notNull, notUndefined, pluralize, processArrayDifferences, range, removeUndefinedProps, selectMany, sleep, sort, splitPath, subArrays, subtractTime, toCamelCase, toDict, toItemsDict, toItemsMap, toMap, toTitleCase, trim$1 as trim, trimEnd, trimStart };
28530
+ export { ExcelKeyTransform, Log, LogLevel, MetaSerializationType, addTime, buildObject, buildTree, byField, byFieldDesc, camelToKebabCase, camelToSnakeCase, csvBuild, csvParse, distinct, distinctElements, ensureDirectory, ensureStartSlash, ensureTailingSlash, excelBuild, excelParse, first, flatten, getDirectoryFilePaths, getDirectoryPath, groupBy, indexes, isNullOrUndefined, iterate, joinPath, jsonDistinct, last, logMemoryUsage, mapOrThrow, mergeDeep, newUuid, notNull, notUndefined, pluralize, processArrayDifferences, processArrayItemMove, range, removeUndefinedProps, selectMany, sleep, sort, splitPath, subArrays, subtractTime, toCamelCase, toDict, toItemsDict, toItemsMap, toMap, toTitleCase, trim$1 as trim, trimEnd, trimStart };
28518
28531
  //# sourceMappingURL=index.js.map