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

39 lines (31 loc) 943 B
'use strict'; function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } var _newArrowCheck = _interopDefault(require('babel-runtime/helpers/newArrowCheck')); var _this = undefined; /** * Creates a GqlRequest using given GqlRequestCompat * * @param {GqlRequest<Variables>} gqlRequest * * @return {GqlRequestCompat<Variables>} * * @example * const operation = ` * query userQuery($userId: ID!) { * user(userId: $userId) { * id * email * } * } * `; * * console.log(requestToCompat({operation, variables: {userId: 10}})); * // {query: "...", variables: {userId: 10}} */ var requestToCompat = function (_ref) { var query = _ref.operation, variables = _ref.variables; _newArrowCheck(this, _this); return variables ? { query: query, variables: variables } : { query: query }; }.bind(undefined); module.exports = requestToCompat;