UNPKG

bi-cycle

Version:

Bi-cycle assists in making infinite carousels and sliders by handling the index logic for you.

790 lines (774 loc) 260 kB
module.exports = /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ return installedModules[moduleId].exports; /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ // Flag the module as loaded /******/ module.l = true; /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ // identity function for calling harmory imports with the correct context /******/ __webpack_require__.i = function(value) { return value; }; /******/ // define getter function for harmory exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ }; /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 1); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ function(module, exports, __webpack_require__) { "use strict"; var __WEBPACK_AMD_DEFINE_RESULT__;'use strict';var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj;}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj;};// Ramda v0.21.0 // https://github.com/ramda/ramda // (c) 2013-2016 Scott Sauyet, Michael Hurley, and David Chambers // Ramda may be freely distributed under the MIT license. ;(function(){'use strict';/** * A special placeholder value used to specify "gaps" within curried functions, * allowing partial application of any combination of arguments, regardless of * their positions. * * If `g` is a curried ternary function and `_` is `R.__`, the following are * equivalent: * * - `g(1, 2, 3)` * - `g(_, 2, 3)(1)` * - `g(_, _, 3)(1)(2)` * - `g(_, _, 3)(1, 2)` * - `g(_, 2, _)(1, 3)` * - `g(_, 2)(1)(3)` * - `g(_, 2)(1, 3)` * - `g(_, 2)(_, 3)(1)` * * @constant * @memberOf R * @since v0.6.0 * @category Function * @example * * var greet = R.replace('{name}', R.__, 'Hello, {name}!'); * greet('Alice'); //=> 'Hello, Alice!' */var __={'@@functional/placeholder':true};/* eslint-disable no-unused-vars */var _arity=function _arity(n,fn){/* eslint-disable no-unused-vars */switch(n){case 0:return function(){return fn.apply(this,arguments);};case 1:return function(a0){return fn.apply(this,arguments);};case 2:return function(a0,a1){return fn.apply(this,arguments);};case 3:return function(a0,a1,a2){return fn.apply(this,arguments);};case 4:return function(a0,a1,a2,a3){return fn.apply(this,arguments);};case 5:return function(a0,a1,a2,a3,a4){return fn.apply(this,arguments);};case 6:return function(a0,a1,a2,a3,a4,a5){return fn.apply(this,arguments);};case 7:return function(a0,a1,a2,a3,a4,a5,a6){return fn.apply(this,arguments);};case 8:return function(a0,a1,a2,a3,a4,a5,a6,a7){return fn.apply(this,arguments);};case 9:return function(a0,a1,a2,a3,a4,a5,a6,a7,a8){return fn.apply(this,arguments);};case 10:return function(a0,a1,a2,a3,a4,a5,a6,a7,a8,a9){return fn.apply(this,arguments);};default:throw new Error('First argument to _arity must be a non-negative integer no greater than ten');}};var _arrayFromIterator=function _arrayFromIterator(iter){var list=[];var next;while(!(next=iter.next()).done){list.push(next.value);}return list;};var _arrayOf=function _arrayOf(){return Array.prototype.slice.call(arguments);};var _cloneRegExp=function _cloneRegExp(pattern){return new RegExp(pattern.source,(pattern.global?'g':'')+(pattern.ignoreCase?'i':'')+(pattern.multiline?'m':'')+(pattern.sticky?'y':'')+(pattern.unicode?'u':''));};var _complement=function _complement(f){return function(){return!f.apply(this,arguments);};};/** * Private `concat` function to merge two array-like objects. * * @private * @param {Array|Arguments} [set1=[]] An array-like object. * @param {Array|Arguments} [set2=[]] An array-like object. * @return {Array} A new, merged array. * @example * * _concat([4, 5, 6], [1, 2, 3]); //=> [4, 5, 6, 1, 2, 3] */var _concat=function _concat(set1,set2){set1=set1||[];set2=set2||[];var idx;var len1=set1.length;var len2=set2.length;var result=[];idx=0;while(idx<len1){result[result.length]=set1[idx];idx+=1;}idx=0;while(idx<len2){result[result.length]=set2[idx];idx+=1;}return result;};var _containsWith=function _containsWith(pred,x,list){var idx=0;var len=list.length;while(idx<len){if(pred(x,list[idx])){return true;}idx+=1;}return false;};var _filter=function _filter(fn,list){var idx=0;var len=list.length;var result=[];while(idx<len){if(fn(list[idx])){result[result.length]=list[idx];}idx+=1;}return result;};var _forceReduced=function _forceReduced(x){return{'@@transducer/value':x,'@@transducer/reduced':true};};// String(x => x) evaluates to "x => x", so the pattern may not match. var _functionName=function _functionName(f){// String(x => x) evaluates to "x => x", so the pattern may not match. var match=String(f).match(/^function (\w*)/);return match==null?'':match[1];};var _has=function _has(prop,obj){return Object.prototype.hasOwnProperty.call(obj,prop);};var _identity=function _identity(x){return x;};var _isArguments=function(){var toString=Object.prototype.toString;return toString.call(arguments)==='[object Arguments]'?function _isArguments(x){return toString.call(x)==='[object Arguments]';}:function _isArguments(x){return _has('callee',x);};}();/** * Tests whether or not an object is an array. * * @private * @param {*} val The object to test. * @return {Boolean} `true` if `val` is an array, `false` otherwise. * @example * * _isArray([]); //=> true * _isArray(null); //=> false * _isArray({}); //=> false */var _isArray=Array.isArray||function _isArray(val){return val!=null&&val.length>=0&&Object.prototype.toString.call(val)==='[object Array]';};var _isFunction=function _isNumber(x){return Object.prototype.toString.call(x)==='[object Function]';};/** * Determine if the passed argument is an integer. * * @private * @param {*} n * @category Type * @return {Boolean} */var _isInteger=Number.isInteger||function _isInteger(n){return n<<0===n;};var _isNumber=function _isNumber(x){return Object.prototype.toString.call(x)==='[object Number]';};var _isObject=function _isObject(x){return Object.prototype.toString.call(x)==='[object Object]';};var _isPlaceholder=function _isPlaceholder(a){return a!=null&&(typeof a==='undefined'?'undefined':_typeof(a))==='object'&&a['@@functional/placeholder']===true;};var _isRegExp=function _isRegExp(x){return Object.prototype.toString.call(x)==='[object RegExp]';};var _isString=function _isString(x){return Object.prototype.toString.call(x)==='[object String]';};var _isTransformer=function _isTransformer(obj){return typeof obj['@@transducer/step']==='function';};var _map=function _map(fn,functor){var idx=0;var len=functor.length;var result=Array(len);while(idx<len){result[idx]=fn(functor[idx]);idx+=1;}return result;};// Based on https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign var _objectAssign=function _objectAssign(target){if(target==null){throw new TypeError('Cannot convert undefined or null to object');}var output=Object(target);var idx=1;var length=arguments.length;while(idx<length){var source=arguments[idx];if(source!=null){for(var nextKey in source){if(_has(nextKey,source)){output[nextKey]=source[nextKey];}}}idx+=1;}return output;};var _of=function _of(x){return[x];};var _pipe=function _pipe(f,g){return function(){return g.call(this,f.apply(this,arguments));};};var _pipeP=function _pipeP(f,g){return function(){var ctx=this;return f.apply(ctx,arguments).then(function(x){return g.call(ctx,x);});};};// \b matches word boundary; [\b] matches backspace var _quote=function _quote(s){var escaped=s.replace(/\\/g,'\\\\').replace(/[\b]/g,'\\b')// \b matches word boundary; [\b] matches backspace .replace(/\f/g,'\\f').replace(/\n/g,'\\n').replace(/\r/g,'\\r').replace(/\t/g,'\\t').replace(/\v/g,'\\v').replace(/\0/g,'\\0');return'"'+escaped.replace(/"/g,'\\"')+'"';};var _reduced=function _reduced(x){return x&&x['@@transducer/reduced']?x:{'@@transducer/value':x,'@@transducer/reduced':true};};/** * An optimized, private array `slice` implementation. * * @private * @param {Arguments|Array} args The array or arguments object to consider. * @param {Number} [from=0] The array index to slice from, inclusive. * @param {Number} [to=args.length] The array index to slice to, exclusive. * @return {Array} A new, sliced array. * @example * * _slice([1, 2, 3, 4, 5], 1, 3); //=> [2, 3] * * var firstThreeArgs = function(a, b, c, d) { * return _slice(arguments, 0, 3); * }; * firstThreeArgs(1, 2, 3, 4); //=> [1, 2, 3] */var _slice=function _slice(args,from,to){switch(arguments.length){case 1:return _slice(args,0,args.length);case 2:return _slice(args,from,args.length);default:var list=[];var idx=0;var len=Math.max(0,Math.min(args.length,to)-from);while(idx<len){list[idx]=args[from+idx];idx+=1;}return list;}};/** * Polyfill from <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString>. */var _toISOString=function(){var pad=function pad(n){return(n<10?'0':'')+n;};return typeof Date.prototype.toISOString==='function'?function _toISOString(d){return d.toISOString();}:function _toISOString(d){return d.getUTCFullYear()+'-'+pad(d.getUTCMonth()+1)+'-'+pad(d.getUTCDate())+'T'+pad(d.getUTCHours())+':'+pad(d.getUTCMinutes())+':'+pad(d.getUTCSeconds())+'.'+(d.getUTCMilliseconds()/1000).toFixed(3).slice(2,5)+'Z';};}();var _xfBase={init:function init(){return this.xf['@@transducer/init']();},result:function result(_result){return this.xf['@@transducer/result'](_result);}};var _xwrap=function(){function XWrap(fn){this.f=fn;}XWrap.prototype['@@transducer/init']=function(){throw new Error('init not implemented on XWrap');};XWrap.prototype['@@transducer/result']=function(acc){return acc;};XWrap.prototype['@@transducer/step']=function(acc,x){return this.f(acc,x);};return function _xwrap(fn){return new XWrap(fn);};}();var _aperture=function _aperture(n,list){var idx=0;var limit=list.length-(n-1);var acc=new Array(limit>=0?limit:0);while(idx<limit){acc[idx]=_slice(list,idx,idx+n);idx+=1;}return acc;};var _assign=typeof Object.assign==='function'?Object.assign:_objectAssign;/** * Similar to hasMethod, this checks whether a function has a [methodname] * function. If it isn't an array it will execute that function otherwise it * will default to the ramda implementation. * * @private * @param {Function} fn ramda implemtation * @param {String} methodname property to check for a custom implementation * @return {Object} Whatever the return value of the method is. */var _checkForMethod=function _checkForMethod(methodname,fn){return function(){var length=arguments.length;if(length===0){return fn();}var obj=arguments[length-1];return _isArray(obj)||typeof obj[methodname]!=='function'?fn.apply(this,arguments):obj[methodname].apply(obj,_slice(arguments,0,length-1));};};/** * Optimized internal one-arity curry function. * * @private * @category Function * @param {Function} fn The function to curry. * @return {Function} The curried function. */var _curry1=function _curry1(fn){return function f1(a){if(arguments.length===0||_isPlaceholder(a)){return f1;}else{return fn.apply(this,arguments);}};};/** * Optimized internal two-arity curry function. * * @private * @category Function * @param {Function} fn The function to curry. * @return {Function} The curried function. */var _curry2=function _curry2(fn){return function f2(a,b){switch(arguments.length){case 0:return f2;case 1:return _isPlaceholder(a)?f2:_curry1(function(_b){return fn(a,_b);});default:return _isPlaceholder(a)&&_isPlaceholder(b)?f2:_isPlaceholder(a)?_curry1(function(_a){return fn(_a,b);}):_isPlaceholder(b)?_curry1(function(_b){return fn(a,_b);}):fn(a,b);}};};/** * Optimized internal three-arity curry function. * * @private * @category Function * @param {Function} fn The function to curry. * @return {Function} The curried function. */var _curry3=function _curry3(fn){return function f3(a,b,c){switch(arguments.length){case 0:return f3;case 1:return _isPlaceholder(a)?f3:_curry2(function(_b,_c){return fn(a,_b,_c);});case 2:return _isPlaceholder(a)&&_isPlaceholder(b)?f3:_isPlaceholder(a)?_curry2(function(_a,_c){return fn(_a,b,_c);}):_isPlaceholder(b)?_curry2(function(_b,_c){return fn(a,_b,_c);}):_curry1(function(_c){return fn(a,b,_c);});default:return _isPlaceholder(a)&&_isPlaceholder(b)&&_isPlaceholder(c)?f3:_isPlaceholder(a)&&_isPlaceholder(b)?_curry2(function(_a,_b){return fn(_a,_b,c);}):_isPlaceholder(a)&&_isPlaceholder(c)?_curry2(function(_a,_c){return fn(_a,b,_c);}):_isPlaceholder(b)&&_isPlaceholder(c)?_curry2(function(_b,_c){return fn(a,_b,_c);}):_isPlaceholder(a)?_curry1(function(_a){return fn(_a,b,c);}):_isPlaceholder(b)?_curry1(function(_b){return fn(a,_b,c);}):_isPlaceholder(c)?_curry1(function(_c){return fn(a,b,_c);}):fn(a,b,c);}};};/** * Internal curryN function. * * @private * @category Function * @param {Number} length The arity of the curried function. * @param {Array} received An array of arguments received thus far. * @param {Function} fn The function to curry. * @return {Function} The curried function. */var _curryN=function _curryN(length,received,fn){return function(){var combined=[];var argsIdx=0;var left=length;var combinedIdx=0;while(combinedIdx<received.length||argsIdx<arguments.length){var result;if(combinedIdx<received.length&&(!_isPlaceholder(received[combinedIdx])||argsIdx>=arguments.length)){result=received[combinedIdx];}else{result=arguments[argsIdx];argsIdx+=1;}combined[combinedIdx]=result;if(!_isPlaceholder(result)){left-=1;}combinedIdx+=1;}return left<=0?fn.apply(this,combined):_arity(left,_curryN(length,combined,fn));};};/** * Returns a function that dispatches with different strategies based on the * object in list position (last argument). If it is an array, executes [fn]. * Otherwise, if it has a function with [methodname], it will execute that * function (functor case). Otherwise, if it is a transformer, uses transducer * [xf] to return a new transformer (transducer case). Otherwise, it will * default to executing [fn]. * * @private * @param {String} methodname property to check for a custom implementation * @param {Function} xf transducer to initialize if object is transformer * @param {Function} fn default ramda implementation * @return {Function} A function that dispatches on object in list position */var _dispatchable=function _dispatchable(methodname,xf,fn){return function(){var length=arguments.length;if(length===0){return fn();}var obj=arguments[length-1];if(!_isArray(obj)){var args=_slice(arguments,0,length-1);if(typeof obj[methodname]==='function'){return obj[methodname].apply(obj,args);}if(_isTransformer(obj)){var transducer=xf.apply(null,args);return transducer(obj);}}return fn.apply(this,arguments);};};var _dropLastWhile=function dropLastWhile(pred,list){var idx=list.length-1;while(idx>=0&&pred(list[idx])){idx-=1;}return _slice(list,0,idx+1);};var _xall=function(){function XAll(f,xf){this.xf=xf;this.f=f;this.all=true;}XAll.prototype['@@transducer/init']=_xfBase.init;XAll.prototype['@@transducer/result']=function(result){if(this.all){result=this.xf['@@transducer/step'](result,true);}return this.xf['@@transducer/result'](result);};XAll.prototype['@@transducer/step']=function(result,input){if(!this.f(input)){this.all=false;result=_reduced(this.xf['@@transducer/step'](result,false));}return result;};return _curry2(function _xall(f,xf){return new XAll(f,xf);});}();var _xany=function(){function XAny(f,xf){this.xf=xf;this.f=f;this.any=false;}XAny.prototype['@@transducer/init']=_xfBase.init;XAny.prototype['@@transducer/result']=function(result){if(!this.any){result=this.xf['@@transducer/step'](result,false);}return this.xf['@@transducer/result'](result);};XAny.prototype['@@transducer/step']=function(result,input){if(this.f(input)){this.any=true;result=_reduced(this.xf['@@transducer/step'](result,true));}return result;};return _curry2(function _xany(f,xf){return new XAny(f,xf);});}();var _xaperture=function(){function XAperture(n,xf){this.xf=xf;this.pos=0;this.full=false;this.acc=new Array(n);}XAperture.prototype['@@transducer/init']=_xfBase.init;XAperture.prototype['@@transducer/result']=function(result){this.acc=null;return this.xf['@@transducer/result'](result);};XAperture.prototype['@@transducer/step']=function(result,input){this.store(input);return this.full?this.xf['@@transducer/step'](result,this.getCopy()):result;};XAperture.prototype.store=function(input){this.acc[this.pos]=input;this.pos+=1;if(this.pos===this.acc.length){this.pos=0;this.full=true;}};XAperture.prototype.getCopy=function(){return _concat(_slice(this.acc,this.pos),_slice(this.acc,0,this.pos));};return _curry2(function _xaperture(n,xf){return new XAperture(n,xf);});}();var _xdrop=function(){function XDrop(n,xf){this.xf=xf;this.n=n;}XDrop.prototype['@@transducer/init']=_xfBase.init;XDrop.prototype['@@transducer/result']=_xfBase.result;XDrop.prototype['@@transducer/step']=function(result,input){if(this.n>0){this.n-=1;return result;}return this.xf['@@transducer/step'](result,input);};return _curry2(function _xdrop(n,xf){return new XDrop(n,xf);});}();var _xdropLast=function(){function XDropLast(n,xf){this.xf=xf;this.pos=0;this.full=false;this.acc=new Array(n);}XDropLast.prototype['@@transducer/init']=_xfBase.init;XDropLast.prototype['@@transducer/result']=function(result){this.acc=null;return this.xf['@@transducer/result'](result);};XDropLast.prototype['@@transducer/step']=function(result,input){if(this.full){result=this.xf['@@transducer/step'](result,this.acc[this.pos]);}this.store(input);return result;};XDropLast.prototype.store=function(input){this.acc[this.pos]=input;this.pos+=1;if(this.pos===this.acc.length){this.pos=0;this.full=true;}};return _curry2(function _xdropLast(n,xf){return new XDropLast(n,xf);});}();var _xdropRepeatsWith=function(){function XDropRepeatsWith(pred,xf){this.xf=xf;this.pred=pred;this.lastValue=undefined;this.seenFirstValue=false;}XDropRepeatsWith.prototype['@@transducer/init']=function(){return this.xf['@@transducer/init']();};XDropRepeatsWith.prototype['@@transducer/result']=function(result){return this.xf['@@transducer/result'](result);};XDropRepeatsWith.prototype['@@transducer/step']=function(result,input){var sameAsLast=false;if(!this.seenFirstValue){this.seenFirstValue=true;}else if(this.pred(this.lastValue,input)){sameAsLast=true;}this.lastValue=input;return sameAsLast?result:this.xf['@@transducer/step'](result,input);};return _curry2(function _xdropRepeatsWith(pred,xf){return new XDropRepeatsWith(pred,xf);});}();var _xdropWhile=function(){function XDropWhile(f,xf){this.xf=xf;this.f=f;}XDropWhile.prototype['@@transducer/init']=_xfBase.init;XDropWhile.prototype['@@transducer/result']=_xfBase.result;XDropWhile.prototype['@@transducer/step']=function(result,input){if(this.f){if(this.f(input)){return result;}this.f=null;}return this.xf['@@transducer/step'](result,input);};return _curry2(function _xdropWhile(f,xf){return new XDropWhile(f,xf);});}();var _xfilter=function(){function XFilter(f,xf){this.xf=xf;this.f=f;}XFilter.prototype['@@transducer/init']=_xfBase.init;XFilter.prototype['@@transducer/result']=_xfBase.result;XFilter.prototype['@@transducer/step']=function(result,input){return this.f(input)?this.xf['@@transducer/step'](result,input):result;};return _curry2(function _xfilter(f,xf){return new XFilter(f,xf);});}();var _xfind=function(){function XFind(f,xf){this.xf=xf;this.f=f;this.found=false;}XFind.prototype['@@transducer/init']=_xfBase.init;XFind.prototype['@@transducer/result']=function(result){if(!this.found){result=this.xf['@@transducer/step'](result,void 0);}return this.xf['@@transducer/result'](result);};XFind.prototype['@@transducer/step']=function(result,input){if(this.f(input)){this.found=true;result=_reduced(this.xf['@@transducer/step'](result,input));}return result;};return _curry2(function _xfind(f,xf){return new XFind(f,xf);});}();var _xfindIndex=function(){function XFindIndex(f,xf){this.xf=xf;this.f=f;this.idx=-1;this.found=false;}XFindIndex.prototype['@@transducer/init']=_xfBase.init;XFindIndex.prototype['@@transducer/result']=function(result){if(!this.found){result=this.xf['@@transducer/step'](result,-1);}return this.xf['@@transducer/result'](result);};XFindIndex.prototype['@@transducer/step']=function(result,input){this.idx+=1;if(this.f(input)){this.found=true;result=_reduced(this.xf['@@transducer/step'](result,this.idx));}return result;};return _curry2(function _xfindIndex(f,xf){return new XFindIndex(f,xf);});}();var _xfindLast=function(){function XFindLast(f,xf){this.xf=xf;this.f=f;}XFindLast.prototype['@@transducer/init']=_xfBase.init;XFindLast.prototype['@@transducer/result']=function(result){return this.xf['@@transducer/result'](this.xf['@@transducer/step'](result,this.last));};XFindLast.prototype['@@transducer/step']=function(result,input){if(this.f(input)){this.last=input;}return result;};return _curry2(function _xfindLast(f,xf){return new XFindLast(f,xf);});}();var _xfindLastIndex=function(){function XFindLastIndex(f,xf){this.xf=xf;this.f=f;this.idx=-1;this.lastIdx=-1;}XFindLastIndex.prototype['@@transducer/init']=_xfBase.init;XFindLastIndex.prototype['@@transducer/result']=function(result){return this.xf['@@transducer/result'](this.xf['@@transducer/step'](result,this.lastIdx));};XFindLastIndex.prototype['@@transducer/step']=function(result,input){this.idx+=1;if(this.f(input)){this.lastIdx=this.idx;}return result;};return _curry2(function _xfindLastIndex(f,xf){return new XFindLastIndex(f,xf);});}();var _xmap=function(){function XMap(f,xf){this.xf=xf;this.f=f;}XMap.prototype['@@transducer/init']=_xfBase.init;XMap.prototype['@@transducer/result']=_xfBase.result;XMap.prototype['@@transducer/step']=function(result,input){return this.xf['@@transducer/step'](result,this.f(input));};return _curry2(function _xmap(f,xf){return new XMap(f,xf);});}();var _xtake=function(){function XTake(n,xf){this.xf=xf;this.n=n;}XTake.prototype['@@transducer/init']=_xfBase.init;XTake.prototype['@@transducer/result']=_xfBase.result;XTake.prototype['@@transducer/step']=function(result,input){if(this.n===0){return _reduced(result);}else{this.n-=1;return this.xf['@@transducer/step'](result,input);}};return _curry2(function _xtake(n,xf){return new XTake(n,xf);});}();var _xtakeWhile=function(){function XTakeWhile(f,xf){this.xf=xf;this.f=f;}XTakeWhile.prototype['@@transducer/init']=_xfBase.init;XTakeWhile.prototype['@@transducer/result']=_xfBase.result;XTakeWhile.prototype['@@transducer/step']=function(result,input){return this.f(input)?this.xf['@@transducer/step'](result,input):_reduced(result);};return _curry2(function _xtakeWhile(f,xf){return new XTakeWhile(f,xf);});}();/** * Adds two values. * * @func * @memberOf R * @since v0.1.0 * @category Math * @sig Number -> Number -> Number * @param {Number} a * @param {Number} b * @return {Number} * @see R.subtract * @example * * R.add(2, 3); //=> 5 * R.add(7)(10); //=> 17 */var add=_curry2(function add(a,b){return Number(a)+Number(b);});/** * Applies a function to the value at the given index of an array, returning a * new copy of the array with the element at the given index replaced with the * result of the function application. * * @func * @memberOf R * @since v0.14.0 * @category List * @sig (a -> a) -> Number -> [a] -> [a] * @param {Function} fn The function to apply. * @param {Number} idx The index. * @param {Array|Arguments} list An array-like object whose value * at the supplied index will be replaced. * @return {Array} A copy of the supplied array-like object with * the element at index `idx` replaced with the value * returned by applying `fn` to the existing element. * @see R.update * @example * * R.adjust(R.add(10), 1, [0, 1, 2]); //=> [0, 11, 2] * R.adjust(R.add(10))(1)([0, 1, 2]); //=> [0, 11, 2] */var adjust=_curry3(function adjust(fn,idx,list){if(idx>=list.length||idx<-list.length){return list;}var start=idx<0?list.length:0;var _idx=start+idx;var _list=_concat(list);_list[_idx]=fn(list[_idx]);return _list;});/** * Returns `true` if all elements of the list match the predicate, `false` if * there are any that don't. * * Dispatches to the `all` method of the second argument, if present. * * Acts as a transducer if a transformer is given in list position. * * @func * @memberOf R * @since v0.1.0 * @category List * @sig (a -> Boolean) -> [a] -> Boolean * @param {Function} fn The predicate function. * @param {Array} list The array to consider. * @return {Boolean} `true` if the predicate is satisfied by every element, `false` * otherwise. * @see R.any, R.none, R.transduce * @example * * var lessThan2 = R.flip(R.lt)(2); * var lessThan3 = R.flip(R.lt)(3); * R.all(lessThan2)([1, 2]); //=> false * R.all(lessThan3)([1, 2]); //=> true */var all=_curry2(_dispatchable('all',_xall,function all(fn,list){var idx=0;while(idx<list.length){if(!fn(list[idx])){return false;}idx+=1;}return true;}));/** * Returns a function that always returns the given value. Note that for * non-primitives the value returned is a reference to the original value. * * This function is known as `const`, `constant`, or `K` (for K combinator) in * other languages and libraries. * * @func * @memberOf R * @since v0.1.0 * @category Function * @sig a -> (* -> a) * @param {*} val The value to wrap in a function * @return {Function} A Function :: * -> val. * @example * * var t = R.always('Tee'); * t(); //=> 'Tee' */var always=_curry1(function always(val){return function(){return val;};});/** * Returns `true` if both arguments are `true`; `false` otherwise. * * @func * @memberOf R * @since v0.1.0 * @category Logic * @sig * -> * -> * * @param {Boolean} a A boolean value * @param {Boolean} b A boolean value * @return {Boolean} `true` if both arguments are `true`, `false` otherwise * @see R.both * @example * * R.and(true, true); //=> true * R.and(true, false); //=> false * R.and(false, true); //=> false * R.and(false, false); //=> false */var and=_curry2(function and(a,b){return a&&b;});/** * Returns `true` if at least one of elements of the list match the predicate, * `false` otherwise. * * Dispatches to the `any` method of the second argument, if present. * * Acts as a transducer if a transformer is given in list position. * * @func * @memberOf R * @since v0.1.0 * @category List * @sig (a -> Boolean) -> [a] -> Boolean * @param {Function} fn The predicate function. * @param {Array} list The array to consider. * @return {Boolean} `true` if the predicate is satisfied by at least one element, `false` * otherwise. * @see R.all, R.none, R.transduce * @example * * var lessThan0 = R.flip(R.lt)(0); * var lessThan2 = R.flip(R.lt)(2); * R.any(lessThan0)([1, 2]); //=> false * R.any(lessThan2)([1, 2]); //=> true */var any=_curry2(_dispatchable('any',_xany,function any(fn,list){var idx=0;while(idx<list.length){if(fn(list[idx])){return true;}idx+=1;}return false;}));/** * Returns a new list, composed of n-tuples of consecutive elements If `n` is * greater than the length of the list, an empty list is returned. * * Dispatches to the `aperture` method of the second argument, if present. * * Acts as a transducer if a transformer is given in list position. * * @func * @memberOf R * @since v0.12.0 * @category List * @sig Number -> [a] -> [[a]] * @param {Number} n The size of the tuples to create * @param {Array} list The list to split into `n`-tuples * @return {Array} The new list. * @see R.transduce * @example * * R.aperture(2, [1, 2, 3, 4, 5]); //=> [[1, 2], [2, 3], [3, 4], [4, 5]] * R.aperture(3, [1, 2, 3, 4, 5]); //=> [[1, 2, 3], [2, 3, 4], [3, 4, 5]] * R.aperture(7, [1, 2, 3, 4, 5]); //=> [] */var aperture=_curry2(_dispatchable('aperture',_xaperture,_aperture));/** * Returns a new list containing the contents of the given list, followed by * the given element. * * @func * @memberOf R * @since v0.1.0 * @category List * @sig a -> [a] -> [a] * @param {*} el The element to add to the end of the new list. * @param {Array} list The list whose contents will be added to the beginning of the output * list. * @return {Array} A new list containing the contents of the old list followed by `el`. * @see R.prepend * @example * * R.append('tests', ['write', 'more']); //=> ['write', 'more', 'tests'] * R.append('tests', []); //=> ['tests'] * R.append(['tests'], ['write', 'more']); //=> ['write', 'more', ['tests']] */var append=_curry2(function append(el,list){return _concat(list,[el]);});/** * Applies function `fn` to the argument list `args`. This is useful for * creating a fixed-arity function from a variadic function. `fn` should be a * bound function if context is significant. * * @func * @memberOf R * @since v0.7.0 * @category Function * @sig (*... -> a) -> [*] -> a * @param {Function} fn * @param {Array} args * @return {*} * @see R.call, R.unapply * @example * * var nums = [1, 2, 3, -99, 42, 6, 7]; * R.apply(Math.max, nums); //=> 42 */var apply=_curry2(function apply(fn,args){return fn.apply(this,args);});/** * Makes a shallow clone of an object, setting or overriding the specified * property with the given value. Note that this copies and flattens prototype * properties onto the new object as well. All non-primitive properties are * copied by reference. * * @func * @memberOf R * @since v0.8.0 * @category Object * @sig String -> a -> {k: v} -> {k: v} * @param {String} prop the property name to set * @param {*} val the new value * @param {Object} obj the object to clone * @return {Object} a new object similar to the original except for the specified property. * @see R.dissoc * @example * * R.assoc('c', 3, {a: 1, b: 2}); //=> {a: 1, b: 2, c: 3} */var assoc=_curry3(function assoc(prop,val,obj){var result={};for(var p in obj){result[p]=obj[p];}result[prop]=val;return result;});/** * Makes a shallow clone of an object, setting or overriding the nodes required * to create the given path, and placing the specific value at the tail end of * that path. Note that this copies and flattens prototype properties onto the * new object as well. All non-primitive properties are copied by reference. * * @func * @memberOf R * @since v0.8.0 * @category Object * @sig [String] -> a -> {k: v} -> {k: v} * @param {Array} path the path to set * @param {*} val the new value * @param {Object} obj the object to clone * @return {Object} a new object similar to the original except along the specified path. * @see R.dissocPath * @example * * R.assocPath(['a', 'b', 'c'], 42, {a: {b: {c: 0}}}); //=> {a: {b: {c: 42}}} */var assocPath=_curry3(function assocPath(path,val,obj){switch(path.length){case 0:return val;case 1:return assoc(path[0],val,obj);default:return assoc(path[0],assocPath(_slice(path,1),val,Object(obj[path[0]])),obj);}});/** * Creates a function that is bound to a context. * Note: `R.bind` does not provide the additional argument-binding capabilities of * [Function.prototype.bind](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind). * * @func * @memberOf R * @since v0.6.0 * @category Function * @category Object * @sig (* -> *) -> {*} -> (* -> *) * @param {Function} fn The function to bind to context * @param {Object} thisObj The context to bind `fn` to * @return {Function} A function that will execute in the context of `thisObj`. * @see R.partial */var bind=_curry2(function bind(fn,thisObj){return _arity(fn.length,function(){return fn.apply(thisObj,arguments);});});/** * Restricts a number to be within a range. * * Also works for other ordered types such as Strings and Dates. * * @func * @memberOf R * @since v0.20.0 * @category Relation * @sig Ord a => a -> a -> a -> a * @param {Number} minimum number * @param {Number} maximum number * @param {Number} value to be clamped * @return {Number} Returns the clamped value * @example * * R.clamp(1, 10, -1) // => 1 * R.clamp(1, 10, 11) // => 10 * R.clamp(1, 10, 4) // => 4 */var clamp=_curry3(function clamp(min,max,value){if(min>max){throw new Error('min must not be greater than max in clamp(min, max, value)');}return value<min?min:value>max?max:value;});/** * Makes a comparator function out of a function that reports whether the first * element is less than the second. * * @func * @memberOf R * @since v0.1.0 * @category Function * @sig (a, b -> Boolean) -> (a, b -> Number) * @param {Function} pred A predicate function of arity two. * @return {Function} A Function :: a -> b -> Int that returns `-1` if a < b, `1` if b < a, otherwise `0`. * @example * * var cmp = R.comparator((a, b) => a.age < b.age); * var people = [ * // ... * ]; * R.sort(cmp, people); */var comparator=_curry1(function comparator(pred){return function(a,b){return pred(a,b)?-1:pred(b,a)?1:0;};});/** * Returns a curried equivalent of the provided function, with the specified * arity. The curried function has two unusual capabilities. First, its * arguments needn't be provided one at a time. If `g` is `R.curryN(3, f)`, the * following are equivalent: * * - `g(1)(2)(3)` * - `g(1)(2, 3)` * - `g(1, 2)(3)` * - `g(1, 2, 3)` * * Secondly, the special placeholder value `R.__` may be used to specify * "gaps", allowing partial application of any combination of arguments, * regardless of their positions. If `g` is as above and `_` is `R.__`, the * following are equivalent: * * - `g(1, 2, 3)` * - `g(_, 2, 3)(1)` * - `g(_, _, 3)(1)(2)` * - `g(_, _, 3)(1, 2)` * - `g(_, 2)(1)(3)` * - `g(_, 2)(1, 3)` * - `g(_, 2)(_, 3)(1)` * * @func * @memberOf R * @since v0.5.0 * @category Function * @sig Number -> (* -> a) -> (* -> a) * @param {Number} length The arity for the returned function. * @param {Function} fn The function to curry. * @return {Function} A new, curried function. * @see R.curry * @example * * var sumArgs = (...args) => R.sum(args); * * var curriedAddFourNumbers = R.curryN(4, sumArgs); * var f = curriedAddFourNumbers(1, 2); * var g = f(3); * g(4); //=> 10 */var curryN=_curry2(function curryN(length,fn){if(length===1){return _curry1(fn);}return _arity(length,_curryN(length,[],fn));});/** * Decrements its argument. * * @func * @memberOf R * @since v0.9.0 * @category Math * @sig Number -> Number * @param {Number} n * @return {Number} * @see R.inc * @example * * R.dec(42); //=> 41 */var dec=add(-1);/** * Returns the second argument if it is not `null`, `undefined` or `NaN` * otherwise the first argument is returned. * * @func * @memberOf R * @since v0.10.0 * @category Logic * @sig a -> b -> a | b * @param {a} val The default value. * @param {b} val The value to return if it is not null or undefined * @return {*} The the second value or the default value * @example * * var defaultTo42 = R.defaultTo(42); * * defaultTo42(null); //=> 42 * defaultTo42(undefined); //=> 42 * defaultTo42('Ramda'); //=> 'Ramda' * defaultTo42(parseInt('string')); //=> 42 */var defaultTo=_curry2(function defaultTo(d,v){return v==null||v!==v?d:v;});/** * Finds the set (i.e. no duplicates) of all elements in the first list not * contained in the second list. Duplication is determined according to the * value returned by applying the supplied predicate to two list elements. * * @func * @memberOf R * @since v0.1.0 * @category Relation * @sig (a -> a -> Boolean) -> [*] -> [*] -> [*] * @param {Function} pred A predicate used to test whether two items are equal. * @param {Array} list1 The first list. * @param {Array} list2 The second list. * @return {Array} The elements in `list1` that are not in `list2`. * @see R.difference * @example * * var cmp = (x, y) => x.a === y.a; * var l1 = [{a: 1}, {a: 2}, {a: 3}]; * var l2 = [{a: 3}, {a: 4}]; * R.differenceWith(cmp, l1, l2); //=> [{a: 1}, {a: 2}] */var differenceWith=_curry3(function differenceWith(pred,first,second){var out=[];var idx=0;var firstLen=first.length;while(idx<firstLen){if(!_containsWith(pred,first[idx],second)&&!_containsWith(pred,first[idx],out)){out.push(first[idx]);}idx+=1;}return out;});/** * Returns a new object that does not contain a `prop` property. * * @func * @memberOf R * @since v0.10.0 * @category Object * @sig String -> {k: v} -> {k: v} * @param {String} prop the name of the property to dissociate * @param {Object} obj the object to clone * @return {Object} a new object similar to the original but without the specified property * @see R.assoc * @example * * R.dissoc('b', {a: 1, b: 2, c: 3}); //=> {a: 1, c: 3} */var dissoc=_curry2(function dissoc(prop,obj){var result={};for(var p in obj){if(p!==prop){result[p]=obj[p];}}return result;});/** * Makes a shallow clone of an object, omitting the property at the given path. * Note that this copies and flattens prototype properties onto the new object * as well. All non-primitive properties are copied by reference. * * @func * @memberOf R * @since v0.11.0 * @category Object * @sig [String] -> {k: v} -> {k: v} * @param {Array} path the path to set * @param {Object} obj the object to clone * @return {Object} a new object without the property at path * @see R.assocPath * @example * * R.dissocPath(['a', 'b', 'c'], {a: {b: {c: 42}}}); //=> {a: {b: {}}} */var dissocPath=_curry2(function dissocPath(path,obj){switch(path.length){case 0:return obj;case 1:return dissoc(path[0],obj);default:var head=path[0];var tail=_slice(path,1);return obj[head]==null?obj:assoc(head,dissocPath(tail,obj[head]),obj);}});/** * Divides two numbers. Equivalent to `a / b`. * * @func * @memberOf R * @since v0.1.0 * @category Math * @sig Number -> Number -> Number * @param {Number} a The first value. * @param {Number} b The second value. * @return {Number} The result of `a / b`. * @see R.multiply * @example * * R.divide(71, 100); //=> 0.71 * * var half = R.divide(R.__, 2); * half(42); //=> 21 * * var reciprocal = R.divide(1); * reciprocal(4); //=> 0.25 */var divide=_curry2(function divide(a,b){return a/b;});/** * Returns a new list containing the last `n` elements of a given list, passing * each value to the supplied predicate function, skipping elements while the * predicate function returns `true`. The predicate function is passed one * argument: *(value)*. * * Dispatches to the `dropWhile` method of the second argument, if present. * * Acts as a transducer if a transformer is given in list position. * * @func * @memberOf R * @since v0.9.0 * @category List * @sig (a -> Boolean) -> [a] -> [a] * @param {Function} fn The function called per iteration. * @param {Array} list The collection to iterate over. * @return {Array} A new array. * @see R.takeWhile, R.transduce, R.addIndex * @example * * var lteTwo = x => x <= 2; * * R.dropWhile(lteTwo, [1, 2, 3, 4, 3, 2, 1]); //=> [3, 4, 3, 2, 1] */var dropWhile=_curry2(_dispatchable('dropWhile',_xdropWhile,function dropWhile(pred,list){var idx=0;var len=list.length;while(idx<len&&pred(list[idx])){idx+=1;}return _slice(list,idx);}));/** * Returns the empty value of its argument's type. Ramda defines the empty * value of Array (`[]`), Object (`{}`), String (`''`), and Arguments. Other * types are supported if they define `<Type>.empty` and/or * `<Type>.prototype.empty`. * * Dispatches to the `empty` method of the first argument, if present. * * @func * @memberOf R * @since v0.3.0 * @category Function * @sig a -> a * @param {*} x * @return {*} * @example * * R.empty(Just(42)); //=> Nothing() * R.empty([1, 2, 3]); //=> [] * R.empty('unicorns'); //=> '' * R.empty({x: 1, y: 2}); //=> {} */// else var empty=_curry1(function empty(x){return x!=null&&typeof x.empty==='function'?x.empty():x!=null&&x.constructor!=null&&typeof x.constructor.empty==='function'?x.constructor.empty():_isArray(x)?[]:_isString(x)?'':_isObject(x)?{}:_isArguments(x)?function(){return arguments;}():// else void 0;});/** * Creates a new object by recursively evolving a shallow copy of `object`, * according to the `transformation` functions. All non-primitive properties * are copied by reference. * * A `transformation` function will not be invoked if its corresponding key * does not exist in the evolved object. * * @func * @memberOf R * @since v0.9.0 * @category Object * @sig {k: (v -> v)} -> {k: v} -> {k: v} * @param {Object} transformations The object specifying transformation functions to apply * to the object. * @param {Object} object The object to be transformed. * @return {Object} The transformed object. * @example * * var tomato = {firstName: ' Tomato ', data: {elapsed: 100, remaining: 1400}, id:123}; * var transformations = { * firstName: R.trim, * lastName: R.trim, // Will not get invoked. * data: {elapsed: R.add(1), remaining: R.add(-1)} * }; * R.evolve(transformations, tomato); //=> {firstName: 'Tomato', data: {elapsed: 101, remaining: 1399}, id:123} */var evolve=_curry2(function evolve(transformations,object){var result={};var transformation,key,type;for(key in object){transformation=transformations[key];type=typeof transformation==='undefined'?'undefined':_typeof(transformation);result[key]=type==='function'?transformation(object[key]):type==='object'?evolve(transformations[key],object[key]):object[key];}return result;});/** * Returns the first element of the list which matches the predicate, or * `undefined` if no element matches. * * Dispatches to the `find` method of the second argument, if present. * * Acts as a transducer if a transformer is given in list position. * * @func * @memberOf R * @since v0.1.0 * @category List * @sig (a -> Boolean) -> [a] -> a | undefined * @param {Function} fn The predicate function used to determine if the element is the * desired one. * @param {Array} list The array to consider. * @return {Object} The element found, or `undefined`. * @see R.transduce * @example * * var xs = [{a: 1}, {a: 2}, {a: 3}]; * R.find(R.propEq('a', 2))(xs); //=> {a: 2} * R.find(R.propEq('a', 4))(xs); //=> undefined */var find=_curry2(_dispatchable('find',_xfind,function find(fn,list){var idx=0;var len=list.length;while(idx<len){if(fn(list[idx])){return list[idx];}idx+=1;}}));/** * Returns the index of the first element of the list which matches the * predicate, or `-1` if no element matches. * * Dispatches to the `findIndex` method of the second argument, if present. * * Acts as a transducer if a transformer is given in list position. * * @func * @memberOf R * @since v0.1.1 * @category List * @sig (a -> Boolean) -> [a] -> Number * @param {Function} fn The predicate function used to determine if the element is the * desired one. * @param {Array} list The array to consider. * @return {Number} The index of the element found, or `-1`. * @see R.transduce * @example * * var xs = [{a: 1}, {a: 2}, {a: 3}]; * R.findIndex(R.propEq('a', 2))(xs); //=> 1 * R.findIndex(R.propEq('a', 4))(xs); //=> -1 */var findIndex=_curry2(_dispatchable('findIndex',_xfindIndex,function findIndex(fn,list){var idx=0;var len=list.length;while(idx<len){if(fn(list[idx])){return idx;}idx+=1;}return-1;}));/** * Returns the last element of the list which matches the predicate, or * `undefined` if no element matches. * * Dispatches to the `findLast` method of the second argument, if present. * * Acts as a transducer if a transformer is given in list position. * * @func * @memberOf R * @since v0.1.1 * @category List * @sig (a -> Boolean) -> [a] -> a | undefined * @param {Function} fn The predicate function used to determine if the element is the * desired one. * @param {Array} list The array to consider. * @return {Object} The element found, or `undefined`. * @see R.transduce * @example * * var xs = [{a: 1, b: 0}, {a:1, b: 1}]; * R.findLast(R.propEq('a', 1))(xs); //=> {a: 1, b: 1} * R.findLast(R.propEq('a', 4))(xs); //=> undefined */var findLast=_curry2(_dispatchable('findLast',_xfindLast,function findLast(fn,list){var idx=list.length-1;while(idx>=0){if(fn(list[idx])){return list[idx];}idx-=1;}}));/** * Returns the index of the last element of the list which matches the * predicate, or `-1` if no element matches. * * Dispatches to the `findLastIndex` method of the second argument, if present. * * Acts as a transducer if a transformer is given in list position. * * @func * @memberOf R * @since v0.1.1 * @category List * @sig (a -> Boolean) -> [a] -> Number * @param {Function} fn The predicate function used to determine if the element is the * desired one. * @param {Array} list The array to consider. * @return {Number} The index of the element found, or `-1`. * @see R.transduce * @example * * var xs = [{a: 1, b: 0}, {a:1, b: 1}]; * R.findLastIndex(R.propEq('a', 1))(xs); //=> 1 * R.findLastIndex(R.propEq('a', 4))(xs); //=> -1 */var findLastIndex=_curry2(_dispatchable('fi