@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 (18 loc) • 845 B
JavaScript
;
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;
/**
* Returns an absolute index from a relative one.
*
* Relative indexes differ from absolute ones in that they can be negative and
* in those cases it would be as simple as substracting them from the length of
* the array from where they belong to obtain their absolute counterparts.
*/
var resolveIndex = function (array, relativeIndex) {
_newArrowCheck(this, _this);
return relativeIndex < 0 ? array.length - relativeIndex : relativeIndex;
}.bind(undefined);
var resolveIndex$1 = Fun.curry(resolveIndex);
module.exports = resolveIndex$1;