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

3 lines (2 loc) 5.39 kB
import _newArrowCheck from"babel-runtime/helpers/newArrowCheck";import{curry}from"flow-static-land/lib/Fun";import{isLastIndex,remove}from"@jumpn/utils-array";import _Object$keys from"babel-runtime/core-js/object/keys";import _toConsumableArray from"babel-runtime/helpers/toConsumableArray";import isDeepEqual from"fast-deep-equal";import _defineProperty from"babel-runtime/helpers/defineProperty";import _extends from"babel-runtime/helpers/extends";import _slicedToArray from"babel-runtime/helpers/slicedToArray";import _Object$entries from"babel-runtime/core-js/object/entries";import _objectWithoutProperties from"babel-runtime/helpers/objectWithoutProperties";import _Symbol from"babel-runtime/core-js/symbol";var _this=void 0,get=function(e,r){return _newArrowCheck(this,_this),r[e]}.bind(void 0),get$1=curry(get),_this$2=void 0,hasKey=function(e,r){return _newArrowCheck(this,_this$2),Object.prototype.hasOwnProperty.call(r,e)}.bind(void 0),hasKey$1=curry(hasKey),_this$1=void 0,getInRecur=function(e,r,t){return _newArrowCheck(this,_this$1),isLastIndex(r,e)?get$1(r[e],t):hasKey$1(r[e],t)?getInRecur(e+1,r,get$1(r[e],t)):void 0}.bind(void 0),getIn=function(e,r){return _newArrowCheck(this,_this$1),0===e.length?void 0:getInRecur(0,e,r)}.bind(void 0),getIn$1=curry(getIn),_this$3=void 0,getKeys=function(e){return _newArrowCheck(this,_this$3),Array.isArray(e)?[].concat(_toConsumableArray(e.keys())):_Object$keys(e)}.bind(void 0),_this$4=void 0,hasIn=function(e,r,t){return _newArrowCheck(this,_this$4),isDeepEqual(getIn$1(e,t),r)}.bind(void 0),hasIn$1=curry(hasIn),_this$5=void 0,haveSameProps=function(e,r){_newArrowCheck(this,_this$5);var t=getKeys(e);return t.length===getKeys(r).length&&t.every(function(t){return _newArrowCheck(this,_this$5),hasKey$1(t,r)&&get$1(t,e)===get$1(t,r)}.bind(this))}.bind(void 0),haveSameProps$1=curry(haveSameProps),_this$6=void 0,mapObject=function(e,r){return _newArrowCheck(this,_this$6),_Object$entries(r).reduce(function(t,i){var n=_slicedToArray(i,2),o=n[0],s=n[1];return _newArrowCheck(this,_this$6),_extends({},t,_defineProperty({},o,e(s,o,r)))}.bind(this),{})}.bind(void 0),map=function(e,r){return _newArrowCheck(this,_this$6),Array.isArray(r)?r.map(e):mapObject(e,r)}.bind(void 0),map$1=curry(map),_this$7=void 0,objectRemove=function(e,r){r[e];var t=_objectWithoutProperties(r,[e]);return _newArrowCheck(this,_this$7),t}.bind(void 0),remove$1=function(e,r){return _newArrowCheck(this,_this$7),Array.isArray(r)?remove(e,1,r):objectRemove(e,r)}.bind(void 0),remove$2=curry(remove$1),_this$10=void 0,shallowCopy=function(e){return _newArrowCheck(this,_this$10),Array.isArray(e)?[].concat(_toConsumableArray(e)):_extends({},e)}.bind(void 0),_this$9=void 0,createReduceContext=function(e){_newArrowCheck(this,_this$9);var r=shallowCopy(e);return{origin:r,previous:void 0,current:r}}.bind(void 0),createSupporting=function(e){return _newArrowCheck(this,_this$9),"number"==typeof e?[]:{}}.bind(void 0),copyOrCreate=function(e,r,t){return _newArrowCheck(this,_this$9),hasKey$1(e,t)?shallowCopy(get$1(e,t)):createSupporting(r)}.bind(void 0),getNext=function(e,r,t,i){return _newArrowCheck(this,_this$9),isLastIndex(e,t)?r(get$1(e[t],i)):copyOrCreate(e[t],e[t+1],i)}.bind(void 0),set=function(e,r,t){return _newArrowCheck(this,_this$9),t[e]=r,get$1(e,t)}.bind(void 0),updateSet=function(e,r,t,i){return _newArrowCheck(this,_this$9),_extends({},i,{current:set(e[r],t,i.current)})}.bind(void 0),updateRemove=function(e,r,t){_newArrowCheck(this,_this$9);var i=remove$2(e[r],t.current);return 0===r?_extends({},t,{current:i,origin:i}):_extends({},t,{previous:set(e[r-1],i,t.previous)})}.bind(void 0),removeAction=_Symbol("composite.updateIn.removeAction"),update=function(e,r,t,i){return _newArrowCheck(this,_this$9),t===removeAction?updateRemove(e,r,i):updateSet(e,r,t,i)}.bind(void 0),getReducer=function(e,r){return _newArrowCheck(this,_this$9),function(t,i,n){return _newArrowCheck(this,_this$9),update(e,n,getNext(e,r,n,t.current),t)}.bind(this)}.bind(void 0),updateIn=function(e,r,t){return _newArrowCheck(this,_this$9),0===e.length?t:e.reduce(getReducer(e,r),createReduceContext(t)).origin}.bind(void 0),updateInCurried=curry(updateIn);updateInCurried.remove=removeAction;var _this$8=void 0,remove$3=function(){return _newArrowCheck(this,_this$8),updateInCurried.remove}.bind(void 0),removeIn=function(e,r){return _newArrowCheck(this,_this$8),updateInCurried(e,remove$3,r)}.bind(void 0),removeIn$1=curry(removeIn),_this$11=void 0,set$1=function(e,r,t){_newArrowCheck(this,_this$11);var i=shallowCopy(t);return i[e]=r,i}.bind(void 0),set$2=curry(set$1),_this$12=void 0,setIn=function(e,r,t){return _newArrowCheck(this,_this$12),updateInCurried(e,function(){return _newArrowCheck(this,_this$12),r}.bind(this),t)}.bind(void 0),setIn$1=curry(setIn),_this$13=void 0,xor=function(e,r){return _newArrowCheck(this,_this$13),Boolean(Number(e)^Number(r))}.bind(void 0),shallowEqual=function(e,r){return _newArrowCheck(this,_this$13),e===r||!xor(Array.isArray(e),Array.isArray(r))&&haveSameProps$1(e,r)}.bind(void 0),shallowEqual$1=curry(shallowEqual);export{get$1 as get,getIn$1 as getIn,getKeys,hasIn$1 as hasIn,hasKey$1 as hasKey,haveSameProps$1 as haveSameProps,map$1 as map,remove$2 as remove,removeIn$1 as removeIn,set$2 as set,setIn$1 as setIn,shallowCopy,shallowEqual$1 as shallowEqual,updateInCurried as updateIn}; //# sourceMappingURL=index.js.map