MCPcopy Index your code
hub / github.com/clauderic/react-sortable-hoc / arrayMove

Function arrayMove

src/utils.js:4–21  ·  view source on GitHub ↗
(array, from, to)

Source from the content-addressed store, hash-verified

2import invariant from 'invariant';
3
4export function arrayMove(array, from, to) {
5 // Will be deprecated soon. Consumers should install 'array-move' instead
6 // https://www.npmjs.com/package/array-move
7
8 if (process.env.NODE_ENV !== 'production') {
9 if (typeof console !== 'undefined') {
10 // eslint-disable-next-line no-console
11 console.warn(
12 "Deprecation warning: arrayMove will no longer be exported by 'react-sortable-hoc' in the next major release. Please install the `array-move` package locally instead. https://www.npmjs.com/package/array-move",
13 );
14 }
15 }
16
17 array = array.slice();
18 array.splice(to < 0 ? array.length + to : to, 0, array.splice(from, 1)[0]);
19
20 return array;
21}
22
23export function omit(obj, keysToOmit) {
24 return Object.keys(obj).reduce((acc, key) => {

Callers 6

AppClass · 0.85
drag-handle.jsFile · 0.85
basic.jsFile · 0.85
AppClass · 0.85
collections.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…