@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">
1,234 lines (953 loc) • 33.8 kB
JavaScript
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.UtilsArray = {})));
}(this, (function (exports) { 'use strict';
function unwrapExports (x) {
return x && x.__esModule ? x['default'] : x;
}
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
// 7.1.4 ToInteger
var ceil = Math.ceil;
var floor = Math.floor;
var _toInteger = function (it) {
return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
};
// 7.2.1 RequireObjectCoercible(argument)
var _defined = function (it) {
if (it == undefined) throw TypeError("Can't call method on " + it);
return it;
};
// true -> String#at
// false -> String#codePointAt
var _stringAt = function (TO_STRING) {
return function (that, pos) {
var s = String(_defined(that));
var i = _toInteger(pos);
var l = s.length;
var a, b;
if (i < 0 || i >= l) return TO_STRING ? '' : undefined;
a = s.charCodeAt(i);
return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
? TO_STRING ? s.charAt(i) : a
: TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
};
};
var _library = true;
var _global = createCommonjsModule(function (module) {
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
var global = module.exports = typeof window != 'undefined' && window.Math == Math
? window : typeof self != 'undefined' && self.Math == Math ? self
// eslint-disable-next-line no-new-func
: Function('return this')();
if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
});
var _core = createCommonjsModule(function (module) {
var core = module.exports = { version: '2.5.1' };
if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
});
var _aFunction = function (it) {
if (typeof it != 'function') throw TypeError(it + ' is not a function!');
return it;
};
// optional / simple context binding
var _ctx = function (fn, that, length) {
_aFunction(fn);
if (that === undefined) return fn;
switch (length) {
case 1: return function (a) {
return fn.call(that, a);
};
case 2: return function (a, b) {
return fn.call(that, a, b);
};
case 3: return function (a, b, c) {
return fn.call(that, a, b, c);
};
}
return function (/* ...args */) {
return fn.apply(that, arguments);
};
};
var _isObject = function (it) {
return typeof it === 'object' ? it !== null : typeof it === 'function';
};
var _anObject = function (it) {
if (!_isObject(it)) throw TypeError(it + ' is not an object!');
return it;
};
var _fails = function (exec) {
try {
return !!exec();
} catch (e) {
return true;
}
};
// Thank's IE8 for his funny defineProperty
var _descriptors = !_fails(function () {
return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
});
var document = _global.document;
// typeof document.createElement is 'object' in old IE
var is = _isObject(document) && _isObject(document.createElement);
var _domCreate = function (it) {
return is ? document.createElement(it) : {};
};
var _ie8DomDefine = !_descriptors && !_fails(function () {
return Object.defineProperty(_domCreate('div'), 'a', { get: function () { return 7; } }).a != 7;
});
// 7.1.1 ToPrimitive(input [, PreferredType])
// instead of the ES6 spec version, we didn't implement @@toPrimitive case
// and the second argument - flag - preferred type is a string
var _toPrimitive = function (it, S) {
if (!_isObject(it)) return it;
var fn, val;
if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val;
if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) return val;
if (!S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val;
throw TypeError("Can't convert object to primitive value");
};
var dP = Object.defineProperty;
var f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) {
_anObject(O);
P = _toPrimitive(P, true);
_anObject(Attributes);
if (_ie8DomDefine) try {
return dP(O, P, Attributes);
} catch (e) { /* empty */ }
if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
if ('value' in Attributes) O[P] = Attributes.value;
return O;
};
var _objectDp = {
f: f
};
var _propertyDesc = function (bitmap, value) {
return {
enumerable: !(bitmap & 1),
configurable: !(bitmap & 2),
writable: !(bitmap & 4),
value: value
};
};
var _hide = _descriptors ? function (object, key, value) {
return _objectDp.f(object, key, _propertyDesc(1, value));
} : function (object, key, value) {
object[key] = value;
return object;
};
var PROTOTYPE = 'prototype';
var $export = function (type, name, source) {
var IS_FORCED = type & $export.F;
var IS_GLOBAL = type & $export.G;
var IS_STATIC = type & $export.S;
var IS_PROTO = type & $export.P;
var IS_BIND = type & $export.B;
var IS_WRAP = type & $export.W;
var exports = IS_GLOBAL ? _core : _core[name] || (_core[name] = {});
var expProto = exports[PROTOTYPE];
var target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] : (_global[name] || {})[PROTOTYPE];
var key, own, out;
if (IS_GLOBAL) source = name;
for (key in source) {
// contains in native
own = !IS_FORCED && target && target[key] !== undefined;
if (own && key in exports) continue;
// export native or passed
out = own ? target[key] : source[key];
// prevent global pollution for namespaces
exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
// bind timers to global for call from export context
: IS_BIND && own ? _ctx(out, _global)
// wrap global constructors for prevent change them in library
: IS_WRAP && target[key] == out ? (function (C) {
var F = function (a, b, c) {
if (this instanceof C) {
switch (arguments.length) {
case 0: return new C();
case 1: return new C(a);
case 2: return new C(a, b);
} return new C(a, b, c);
} return C.apply(this, arguments);
};
F[PROTOTYPE] = C[PROTOTYPE];
return F;
// make static versions for prototype methods
})(out) : IS_PROTO && typeof out == 'function' ? _ctx(Function.call, out) : out;
// export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
if (IS_PROTO) {
(exports.virtual || (exports.virtual = {}))[key] = out;
// export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
if (type & $export.R && expProto && !expProto[key]) _hide(expProto, key, out);
}
}
};
// type bitmap
$export.F = 1; // forced
$export.G = 2; // global
$export.S = 4; // static
$export.P = 8; // proto
$export.B = 16; // bind
$export.W = 32; // wrap
$export.U = 64; // safe
$export.R = 128; // real proto method for `library`
var _export = $export;
var _redefine = _hide;
var hasOwnProperty = {}.hasOwnProperty;
var _has = function (it, key) {
return hasOwnProperty.call(it, key);
};
var _iterators = {};
var toString = {}.toString;
var _cof = function (it) {
return toString.call(it).slice(8, -1);
};
// fallback for non-array-like ES3 and non-enumerable old V8 strings
// eslint-disable-next-line no-prototype-builtins
var _iobject = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
return _cof(it) == 'String' ? it.split('') : Object(it);
};
// to indexed object, toObject with fallback for non-array-like ES3 strings
var _toIobject = function (it) {
return _iobject(_defined(it));
};
// 7.1.15 ToLength
var min = Math.min;
var _toLength = function (it) {
return it > 0 ? min(_toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
};
var max = Math.max;
var min$1 = Math.min;
var _toAbsoluteIndex = function (index, length) {
index = _toInteger(index);
return index < 0 ? max(index + length, 0) : min$1(index, length);
};
// false -> Array#indexOf
// true -> Array#includes
var _arrayIncludes = function (IS_INCLUDES) {
return function ($this, el, fromIndex) {
var O = _toIobject($this);
var length = _toLength(O.length);
var index = _toAbsoluteIndex(fromIndex, length);
var value;
// Array#includes uses SameValueZero equality algorithm
// eslint-disable-next-line no-self-compare
if (IS_INCLUDES && el != el) while (length > index) {
value = O[index++];
// eslint-disable-next-line no-self-compare
if (value != value) return true;
// Array#indexOf ignores holes, Array#includes - not
} else for (;length > index; index++) if (IS_INCLUDES || index in O) {
if (O[index] === el) return IS_INCLUDES || index || 0;
} return !IS_INCLUDES && -1;
};
};
var SHARED = '__core-js_shared__';
var store = _global[SHARED] || (_global[SHARED] = {});
var _shared = function (key) {
return store[key] || (store[key] = {});
};
var id = 0;
var px = Math.random();
var _uid = function (key) {
return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
};
var shared = _shared('keys');
var _sharedKey = function (key) {
return shared[key] || (shared[key] = _uid(key));
};
var arrayIndexOf = _arrayIncludes(false);
var IE_PROTO$1 = _sharedKey('IE_PROTO');
var _objectKeysInternal = function (object, names) {
var O = _toIobject(object);
var i = 0;
var result = [];
var key;
for (key in O) if (key != IE_PROTO$1) _has(O, key) && result.push(key);
// Don't enum bug & hidden keys
while (names.length > i) if (_has(O, key = names[i++])) {
~arrayIndexOf(result, key) || result.push(key);
}
return result;
};
// IE 8- don't enum bug keys
var _enumBugKeys = (
'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
).split(',');
// 19.1.2.14 / 15.2.3.14 Object.keys(O)
var _objectKeys = Object.keys || function keys(O) {
return _objectKeysInternal(O, _enumBugKeys);
};
var _objectDps = _descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
_anObject(O);
var keys = _objectKeys(Properties);
var length = keys.length;
var i = 0;
var P;
while (length > i) _objectDp.f(O, P = keys[i++], Properties[P]);
return O;
};
var document$1 = _global.document;
var _html = document$1 && document$1.documentElement;
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
var IE_PROTO = _sharedKey('IE_PROTO');
var Empty = function () { /* empty */ };
var PROTOTYPE$1 = 'prototype';
// Create object with fake `null` prototype: use iframe Object with cleared prototype
var createDict = function () {
// Thrash, waste and sodomy: IE GC bug
var iframe = _domCreate('iframe');
var i = _enumBugKeys.length;
var lt = '<';
var gt = '>';
var iframeDocument;
iframe.style.display = 'none';
_html.appendChild(iframe);
iframe.src = 'javascript:'; // eslint-disable-line no-script-url
// createDict = iframe.contentWindow.Object;
// html.removeChild(iframe);
iframeDocument = iframe.contentWindow.document;
iframeDocument.open();
iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
iframeDocument.close();
createDict = iframeDocument.F;
while (i--) delete createDict[PROTOTYPE$1][_enumBugKeys[i]];
return createDict();
};
var _objectCreate = Object.create || function create(O, Properties) {
var result;
if (O !== null) {
Empty[PROTOTYPE$1] = _anObject(O);
result = new Empty();
Empty[PROTOTYPE$1] = null;
// add "__proto__" for Object.getPrototypeOf polyfill
result[IE_PROTO] = O;
} else result = createDict();
return Properties === undefined ? result : _objectDps(result, Properties);
};
var _wks = createCommonjsModule(function (module) {
var store = _shared('wks');
var Symbol = _global.Symbol;
var USE_SYMBOL = typeof Symbol == 'function';
var $exports = module.exports = function (name) {
return store[name] || (store[name] =
USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : _uid)('Symbol.' + name));
};
$exports.store = store;
});
var def = _objectDp.f;
var TAG = _wks('toStringTag');
var _setToStringTag = function (it, tag, stat) {
if (it && !_has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });
};
;
var IteratorPrototype = {};
// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
_hide(IteratorPrototype, _wks('iterator'), function () { return this; });
var _iterCreate = function (Constructor, NAME, next) {
Constructor.prototype = _objectCreate(IteratorPrototype, { next: _propertyDesc(1, next) });
_setToStringTag(Constructor, NAME + ' Iterator');
};
// 7.1.13 ToObject(argument)
var _toObject = function (it) {
return Object(_defined(it));
};
// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
var IE_PROTO$2 = _sharedKey('IE_PROTO');
var ObjectProto = Object.prototype;
var _objectGpo = Object.getPrototypeOf || function (O) {
O = _toObject(O);
if (_has(O, IE_PROTO$2)) return O[IE_PROTO$2];
if (typeof O.constructor == 'function' && O instanceof O.constructor) {
return O.constructor.prototype;
} return O instanceof Object ? ObjectProto : null;
};
;
var ITERATOR = _wks('iterator');
var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`
var FF_ITERATOR = '@@iterator';
var KEYS = 'keys';
var VALUES = 'values';
var returnThis = function () { return this; };
var _iterDefine = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
_iterCreate(Constructor, NAME, next);
var getMethod = function (kind) {
if (!BUGGY && kind in proto) return proto[kind];
switch (kind) {
case KEYS: return function keys() { return new Constructor(this, kind); };
case VALUES: return function values() { return new Constructor(this, kind); };
} return function entries() { return new Constructor(this, kind); };
};
var TAG = NAME + ' Iterator';
var DEF_VALUES = DEFAULT == VALUES;
var VALUES_BUG = false;
var proto = Base.prototype;
var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];
var $default = $native || getMethod(DEFAULT);
var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;
var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;
var methods, key, IteratorPrototype;
// Fix native
if ($anyNative) {
IteratorPrototype = _objectGpo($anyNative.call(new Base()));
if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {
// Set @@toStringTag to native iterators
_setToStringTag(IteratorPrototype, TAG, true);
// fix for some old engines
if (!_library && !_has(IteratorPrototype, ITERATOR)) _hide(IteratorPrototype, ITERATOR, returnThis);
}
}
// fix Array#{values, @@iterator}.name in V8 / FF
if (DEF_VALUES && $native && $native.name !== VALUES) {
VALUES_BUG = true;
$default = function values() { return $native.call(this); };
}
// Define iterator
if ((!_library || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {
_hide(proto, ITERATOR, $default);
}
// Plug for library
_iterators[NAME] = $default;
_iterators[TAG] = returnThis;
if (DEFAULT) {
methods = {
values: DEF_VALUES ? $default : getMethod(VALUES),
keys: IS_SET ? $default : getMethod(KEYS),
entries: $entries
};
if (FORCED) for (key in methods) {
if (!(key in proto)) _redefine(proto, key, methods[key]);
} else _export(_export.P + _export.F * (BUGGY || VALUES_BUG), NAME, methods);
}
return methods;
};
;
var $at = _stringAt(true);
// 21.1.3.27 String.prototype[@@iterator]()
_iterDefine(String, 'String', function (iterated) {
this._t = String(iterated); // target
this._i = 0; // next index
// 21.1.5.2.1 %StringIteratorPrototype%.next()
}, function () {
var O = this._t;
var index = this._i;
var point;
if (index >= O.length) return { value: undefined, done: true };
point = $at(O, index);
this._i += point.length;
return { value: point, done: false };
});
// call something on iterator step with safe closing on error
var _iterCall = function (iterator, fn, value, entries) {
try {
return entries ? fn(_anObject(value)[0], value[1]) : fn(value);
// 7.4.6 IteratorClose(iterator, completion)
} catch (e) {
var ret = iterator['return'];
if (ret !== undefined) _anObject(ret.call(iterator));
throw e;
}
};
// check on default Array iterator
var ITERATOR$1 = _wks('iterator');
var ArrayProto = Array.prototype;
var _isArrayIter = function (it) {
return it !== undefined && (_iterators.Array === it || ArrayProto[ITERATOR$1] === it);
};
;
var _createProperty = function (object, index, value) {
if (index in object) _objectDp.f(object, index, _propertyDesc(0, value));
else object[index] = value;
};
// getting tag from 19.1.3.6 Object.prototype.toString()
var TAG$1 = _wks('toStringTag');
// ES3 wrong here
var ARG = _cof(function () { return arguments; }()) == 'Arguments';
// fallback for IE11 Script Access Denied error
var tryGet = function (it, key) {
try {
return it[key];
} catch (e) { /* empty */ }
};
var _classof = function (it) {
var O, T, B;
return it === undefined ? 'Undefined' : it === null ? 'Null'
// @@toStringTag case
: typeof (T = tryGet(O = Object(it), TAG$1)) == 'string' ? T
// builtinTag case
: ARG ? _cof(O)
// ES3 arguments fallback
: (B = _cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
};
var ITERATOR$2 = _wks('iterator');
var core_getIteratorMethod = _core.getIteratorMethod = function (it) {
if (it != undefined) return it[ITERATOR$2]
|| it['@@iterator']
|| _iterators[_classof(it)];
};
var ITERATOR$3 = _wks('iterator');
var SAFE_CLOSING = false;
try {
var riter = [7][ITERATOR$3]();
riter['return'] = function () { SAFE_CLOSING = true; };
// eslint-disable-next-line no-throw-literal
} catch (e) { /* empty */ }
var _iterDetect = function (exec, skipClosing) {
if (!skipClosing && !SAFE_CLOSING) return false;
var safe = false;
try {
var arr = [7];
var iter = arr[ITERATOR$3]();
iter.next = function () { return { done: safe = true }; };
arr[ITERATOR$3] = function () { return iter; };
exec(arr);
} catch (e) { /* empty */ }
return safe;
};
;
_export(_export.S + _export.F * !_iterDetect(function (iter) { }), 'Array', {
// 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)
from: function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
var O = _toObject(arrayLike);
var C = typeof this == 'function' ? this : Array;
var aLen = arguments.length;
var mapfn = aLen > 1 ? arguments[1] : undefined;
var mapping = mapfn !== undefined;
var index = 0;
var iterFn = core_getIteratorMethod(O);
var length, result, step, iterator;
if (mapping) mapfn = _ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2);
// if object isn't iterable or it's array with default iterator - use simple case
if (iterFn != undefined && !(C == Array && _isArrayIter(iterFn))) {
for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) {
_createProperty(result, index, mapping ? _iterCall(iterator, mapfn, [step.value, index], true) : step.value);
}
} else {
length = _toLength(O.length);
for (result = new C(length); length > index; index++) {
_createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]);
}
}
result.length = index;
return result;
}
});
var from$1 = _core.Array.from;
var from = createCommonjsModule(function (module) {
module.exports = { "default": from$1, __esModule: true };
});
var _Array$from = unwrapExports(from);
var toConsumableArray = createCommonjsModule(function (module, exports) {
;
exports.__esModule = true;
var _from2 = _interopRequireDefault(from);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = function (arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) {
arr2[i] = arr[i];
}
return arr2;
} else {
return (0, _from2.default)(arr);
}
};
});
var _toConsumableArray = unwrapExports(toConsumableArray);
var newArrowCheck = createCommonjsModule(function (module, exports) {
;
exports.__esModule = true;
exports.default = function (innerThis, boundThis) {
if (innerThis !== boundThis) {
throw new TypeError("Cannot instantiate an arrow function");
}
};
});
var _newArrowCheck = unwrapExports(newArrowCheck);
var Fun = createCommonjsModule(function (module, exports) {
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.flip = flip;
exports.constant = constant;
exports.on = on;
exports.compose = compose;
exports.pipe = pipe;
exports.curry = curry;
// eslint-disable-line no-redeclare
// Flips the order of the arguments to a function of two arguments.
// eslint-disable-line no-redeclare
// eslint-disable-line no-redeclare
// eslint-disable-line no-redeclare
// eslint-disable-line no-redeclare
// eslint-disable-line no-redeclare
// eslint-disable-line no-redeclare
// eslint-disable-line no-redeclare
// eslint-disable-line no-redeclare
// eslint-disable-line no-redeclare
function flip(f) {
return function (b, a) {
return f(a, b);
};
}
// Returns its first argument and ignores its second.
// eslint-disable-line no-redeclare
// eslint-disable-line no-redeclare
// eslint-disable-line no-redeclare
// eslint-disable-line no-redeclare
// eslint-disable-line no-redeclare
// eslint-disable-line no-redeclare
// eslint-disable-line no-redeclare
// eslint-disable-line no-redeclare
// eslint-disable-line no-redeclare
// eslint-disable-line no-redeclare
function constant(a) {
return function () {
return a;
};
}
// The `on` function is used to change the domain of a binary operator.
function on(o, f) {
return function (x, y) {
return o(f(x), f(y));
};
}
function compose() {
var _this = this;
for (var _len = arguments.length, fns = Array(_len), _key = 0; _key < _len; _key++) {
fns[_key] = arguments[_key];
}
// eslint-disable-line no-redeclare
var len = fns.length - 1;
return function (x) {
var y = x;
for (var _i = len; _i > -1; _i--) {
y = fns[_i].call(_this, y);
}
return y;
};
}
function pipe() {
var _this2 = this;
for (var _len2 = arguments.length, fns = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
fns[_key2] = arguments[_key2];
}
// eslint-disable-line no-redeclare
var len = fns.length - 1;
return function (x) {
var y = x;
for (var _i2 = 0; _i2 <= len; _i2++) {
y = fns[_i2].call(_this2, y);
}
return y;
};
}
function curried(f, length, acc) {
return function () {
var combined = acc.concat(Array.prototype.slice.call(arguments));
return combined.length >= length ? f.apply(this, combined) : curried(f, length, combined);
};
}
function curry(f) {
// eslint-disable-line no-redeclare
return curried(f, f.length, []);
}
});
unwrapExports(Fun);
var Fun_6 = Fun.curry;
var _this = undefined;
/**
* Returns a new Array with elements appended to the one given.
*/
var append = function (elements, array) {
_newArrowCheck(this, _this);
return [].concat(_toConsumableArray(array), _toConsumableArray(elements));
}.bind(undefined);
var append$1 = Fun_6(append);
var _this$1 = undefined;
/**
* Returns input if it is an Array or returns a new Array with input inside if
* it is not.
*/
var convertIfNot = function (input) {
_newArrowCheck(this, _this$1);
return Array.isArray(input) ? input : [input];
}.bind(undefined);
var _this$3 = undefined;
/**
* Returns true if given index is the last one or false otherwise.
*/
var isLastIndex = function (array, index) {
_newArrowCheck(this, _this$3);
return index === array.length - 1;
}.bind(undefined);
var isLastIndex$1 = Fun_6(isLastIndex);
var _this$2 = undefined;
/**
* Returns 0 if current index is the last one, or returns next if it is not.
*/
var cycleNext = function (array, currentIndex) {
_newArrowCheck(this, _this$2);
return isLastIndex$1(array, currentIndex) ? 0 : currentIndex + 1;
}.bind(undefined);
var cycleNext$1 = Fun_6(cycleNext);
var f$1 = Object.getOwnPropertySymbols;
var _objectGops = {
f: f$1
};
var f$2 = {}.propertyIsEnumerable;
var _objectPie = {
f: f$2
};
;
// 19.1.2.1 Object.assign(target, source, ...)
var $assign = Object.assign;
// should work with symbols and should have deterministic property order (V8 bug)
var _objectAssign = !$assign || _fails(function () {
var A = {};
var B = {};
// eslint-disable-next-line no-undef
var S = Symbol();
var K = 'abcdefghijklmnopqrst';
A[S] = 7;
K.split('').forEach(function (k) { B[k] = k; });
return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
}) ? function assign(target, source) { // eslint-disable-line no-unused-vars
var T = _toObject(target);
var aLen = arguments.length;
var index = 1;
var getSymbols = _objectGops.f;
var isEnum = _objectPie.f;
while (aLen > index) {
var S = _iobject(arguments[index++]);
var keys = getSymbols ? _objectKeys(S).concat(getSymbols(S)) : _objectKeys(S);
var length = keys.length;
var j = 0;
var key;
while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key];
} return T;
} : $assign;
// 19.1.3.1 Object.assign(target, source)
_export(_export.S + _export.F, 'Object', { assign: _objectAssign });
var assign$2 = _core.Object.assign;
var assign = createCommonjsModule(function (module) {
module.exports = { "default": assign$2, __esModule: true };
});
unwrapExports(assign);
var _extends = createCommonjsModule(function (module, exports) {
;
exports.__esModule = true;
var _assign2 = _interopRequireDefault(assign);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _assign2.default || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
});
var _extends$1 = unwrapExports(_extends);
// most Object methods by ES6 should accept primitives
var _objectSap = function (KEY, exec) {
var fn = (_core.Object || {})[KEY] || Object[KEY];
var exp = {};
exp[KEY] = exec(fn);
_export(_export.S + _export.F * _fails(function () { fn(1); }), 'Object', exp);
};
// 19.1.2.14 Object.keys(O)
_objectSap('keys', function () {
return function keys(it) {
return _objectKeys(_toObject(it));
};
});
var keys$1 = _core.Object.keys;
var keys = createCommonjsModule(function (module) {
module.exports = { "default": keys$1, __esModule: true };
});
var _Object$keys = unwrapExports(keys);
var _this$4 = undefined;
var getObjectLength = function (object) {
_newArrowCheck(this, _this$4);
return Math.max.apply(Math, _toConsumableArray(_Object$keys(object))) + 1;
}.bind(undefined);
/**
* Creates a new array using the given object
* If all of its entries are array keys.
*
* (it could also have a property length with its size)
*/
var fromObject = function (object) {
_newArrowCheck(this, _this$4);
return _Array$from("length" in object ? object : _extends$1({}, object, { length: getObjectLength(object) }));
}.bind(undefined);
var _this$5 = undefined;
/**
* Returns a new Array with the result of having inserted the given elements at
* the specified index.
*/
var insert = function (index, elements, array) {
_newArrowCheck(this, _this$5);
return [].concat(_toConsumableArray(array.slice(0, index)), _toConsumableArray(elements), _toConsumableArray(array.slice(index + 1)));
}.bind(undefined);
var insert$1 = Fun_6(insert);
// 20.1.2.3 Number.isInteger(number)
var floor$1 = Math.floor;
var _isInteger = function isInteger(it) {
return !_isObject(it) && isFinite(it) && floor$1(it) === it;
};
// 20.1.2.3 Number.isInteger(number)
_export(_export.S, 'Number', { isInteger: _isInteger });
var isInteger$1 = _core.Number.isInteger;
var isInteger = createCommonjsModule(function (module) {
module.exports = { "default": isInteger$1, __esModule: true };
});
var _Number$isInteger = unwrapExports(isInteger);
var _this$6 = undefined;
var isIntGreaterThan = function (number, other) {
_newArrowCheck(this, _this$6);
return _Number$isInteger(number) && number >= other;
}.bind(undefined);
/**
* Returns true if the given string is an Array key or false otherwise.
*/
var isKey = function (string) {
_newArrowCheck(this, _this$6);
return isIntGreaterThan(Number(string), 0);
}.bind(undefined);
var objectWithoutProperties = createCommonjsModule(function (module, exports) {
;
exports.__esModule = true;
exports.default = function (obj, keys) {
var target = {};
for (var i in obj) {
if (keys.indexOf(i) >= 0) continue;
if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
target[i] = obj[i];
}
return target;
};
});
var _objectWithoutProperties = unwrapExports(objectWithoutProperties);
var _this$7 = undefined;
/**
* Returns true if an Array can be created from the given Object, or in other
* words, if it has or not a length property, and the rest of its keys are Array
* ones.
*/
var isPossibleFromObject = function (_ref) {
var length = _ref.length,
rest = _objectWithoutProperties(_ref, ["length"]);
_newArrowCheck(this, _this$7);
return _Object$keys(rest).every(isKey);
}.bind(undefined);
var _this$8 = undefined;
/**
* Returns a new Array with elements prepended to the one given.
*/
var prepend = function (elements, array) {
_newArrowCheck(this, _this$8);
return [].concat(_toConsumableArray(elements), _toConsumableArray(array));
}.bind(undefined);
var prepend$1 = Fun_6(prepend);
var _this$9 = undefined;
/**
* Reduce the given array applying reduce function only to elements filtered.
*/
var reduceIf = function (filter, reduce, resultInitial, array) {
_newArrowCheck(this, _this$9);
return array.reduce(function (result, element, index) {
_newArrowCheck(this, _this$9);
return filter(element, index, result) ? reduce(result, element, index) : result;
}.bind(this), resultInitial);
}.bind(undefined);
var reduceIf$1 = Fun_6(reduceIf);
var _this$10 = undefined;
/**
* Reduce the given array applying reduce function while shouldProceed function
* returns true.
*/
var reduceWhile = function (shouldProceed, reduce, resultInitial, array) {
_newArrowCheck(this, _this$10);
var result = resultInitial;
array.every(function (element, index) {
_newArrowCheck(this, _this$10);
var proceed = shouldProceed(element, index, result);
if (proceed) {
result = reduce(result, element, index);
}
return proceed;
}.bind(this));
return result;
}.bind(undefined);
var reduceWhile$1 = Fun_6(reduceWhile);
var _this$11 = undefined;
/**
* Returns a new Array with the result of having removed the specified amount
* (count) of elements at the given index.
*/
var remove = function (index, count, array) {
_newArrowCheck(this, _this$11);
return [].concat(_toConsumableArray(array.slice(0, index)), _toConsumableArray(array.slice(index + count)));
}.bind(undefined);
var remove$1 = Fun_6(remove);
var _this$12 = undefined;
/**
* Returns a new Array with the given size (count) filled with the specified
* element.
*/
var repeat = function (count, element) {
_newArrowCheck(this, _this$12);
return [].concat(_toConsumableArray(Array(count))).map(function () {
_newArrowCheck(this, _this$12);
return element;
}.bind(this));
}.bind(undefined);
var repeat$1 = Fun_6(repeat);
var _this$13 = undefined;
/**
* Returns a new Array with the result of having replaced the elements at the
* given index with the ones specified.
*/
var replace = function (index, elements, array) {
_newArrowCheck(this, _this$13);
return [].concat(_toConsumableArray(array.slice(0, index)), _toConsumableArray(elements), _toConsumableArray(array.slice(index + elements.length)));
}.bind(undefined);
var replace$1 = Fun_6(replace);
var _this$14 = 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$14);
return relativeIndex < 0 ? array.length - relativeIndex : relativeIndex;
}.bind(undefined);
var resolveIndex$1 = Fun_6(resolveIndex);
exports.append = append$1;
exports.convertIfNot = convertIfNot;
exports.cycleNext = cycleNext$1;
exports.fromObject = fromObject;
exports.insert = insert$1;
exports.isKey = isKey;
exports.isLastIndex = isLastIndex$1;
exports.isPossibleFromObject = isPossibleFromObject;
exports.prepend = prepend$1;
exports.reduceIf = reduceIf$1;
exports.reduceWhile = reduceWhile$1;
exports.remove = remove$1;
exports.repeat = repeat$1;
exports.replace = replace$1;
exports.resolveIndex = resolveIndex$1;
Object.defineProperty(exports, '__esModule', { value: true });
})));