(array, from, to)
| 2 | import invariant from 'invariant'; |
| 3 | |
| 4 | export 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 | |
| 23 | export function omit(obj, keysToOmit) { |
| 24 | return Object.keys(obj).reduce((acc, key) => { |
no outgoing calls
no test coverage detected
searching dependent graphs…