@dillonkearns/elm-graphql
Version:
<img src="https://cdn.jsdelivr.net/gh/martimatix/logo-graphqelm/logo.svg" alt="dillonearns/elm-graphql logo" width="40%" align="right">
20 lines (16 loc) • 424 B
Flow
// @flow
import {curry} from "flow-static-land/lib/Fun";
/**
* Returns a new Array with the result of having replaced the elements at the
* given index with the ones specified.
*/
const replace = <Element>(
index: number,
elements: Array<Element>,
array: Array<Element>
): Array<Element> => [
...array.slice(0, index),
...elements,
...array.slice(index + elements.length)
];
export default curry(replace);