UNPKG

@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">

21 lines (15 loc) 599 B
// @flow import {curry} from "flow-static-land/lib/Fun"; import {remove as arrayRemove} from "@jumpn/utils-array"; import type {Composite, Key} from "./types"; // $FlowFixMe: flow does not understand the following construction const objectRemove = (key, {[key]: removed, ...rest}) => rest; /** * Returns a new composite with the result of having removed the property with * the given key. */ const remove = (key: Key, composite: Composite): Composite => Array.isArray(composite) ? arrayRemove((key: any), 1, composite) : objectRemove(key, composite); export default curry(remove);