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

26 lines (17 loc) 769 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 Fun = require('flow-static-land/lib/Fun'); var _this = undefined; /** * Reduce the given array applying reduce function only to elements filtered. */ var reduceIf = function (filter, reduce, resultInitial, array) { _newArrowCheck(this, _this); return array.reduce(function (result, element, index) { _newArrowCheck(this, _this); return filter(element, index, result) ? reduce(result, element, index) : result; }.bind(this), resultInitial); }.bind(undefined); var reduceIf$1 = Fun.curry(reduceIf); module.exports = reduceIf$1;