MCPcopy Create free account
hub / github.com/codrops/RainEffect / createArrayReduce

Function createArrayReduce

demo/js/index.js:1903–1926  ·  view source on GitHub ↗
(isRight)

Source from the content-addressed store, hash-verified

1901$def($def.S, 'Array', {isArray: require('./$.is-array')});
1902
1903var createArrayReduce = function(isRight){
1904 return function(callbackfn, memo){
1905 aFunction(callbackfn);
1906 var O = IObject(this)
1907 , length = toLength(O.length)
1908 , index = isRight ? length - 1 : 0
1909 , i = isRight ? -1 : 1;
1910 if(arguments.length < 2)for(;;){
1911 if(index in O){
1912 memo = O[index];
1913 index += i;
1914 break;
1915 }
1916 index += i;
1917 if(isRight ? index < 0 : length <= index){
1918 throw TypeError('Reduce of empty array with no initial value');
1919 }
1920 }
1921 for(;isRight ? index >= 0 : length > index; index += i)if(index in O){
1922 memo = callbackfn(memo, O[index], index, this);
1923 }
1924 return memo;
1925 };
1926};
1927var methodize = function($fn){
1928 return function(arg1/*, arg2 = undefined */){
1929 return $fn(this, arg1, arguments[1]);

Callers 1

index.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected