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

24 lines (17 loc) 539 B
// @flow import {curry} from "flow-static-land/lib/Fun"; import get from "./get"; import getKeys from "./getKeys"; import hasKey from "./hasKey"; import type {Composite} from "./types"; /** * Returns true if both composites have the same props or false otherwise. */ const haveSameProps = (c1: Composite, c2: Composite): boolean => { const keys1 = getKeys(c1); return ( keys1.length === getKeys(c2).length && keys1.every(k1 => hasKey(k1, c2) && get(k1, c1) === get(k1, c2)) ); }; export default curry(haveSameProps);