File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
packages/core-js/internals Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -6,14 +6,16 @@ var lengthOfArrayLike = require('../internals/length-of-array-like');
66
77var $TypeError = TypeError ;
88
9+ var REDUCE_EMPTY = 'Reduce of empty array with no initial value' ;
10+
911// `Array.prototype.{ reduce, reduceRight }` methods implementation
1012var createMethod = function ( IS_RIGHT ) {
1113 return function ( that , callbackfn , argumentsLength , memo ) {
1214 var O = toObject ( that ) ;
1315 var self = IndexedObject ( O ) ;
1416 var length = lengthOfArrayLike ( O ) ;
1517 aCallable ( callbackfn ) ;
16- if ( length === 0 && argumentsLength < 2 ) throw new $TypeError ( 'Reduce of empty array with no initial value' ) ;
18+ if ( length === 0 && argumentsLength < 2 ) throw new $TypeError ( REDUCE_EMPTY ) ;
1719 var index = IS_RIGHT ? length - 1 : 0 ;
1820 var i = IS_RIGHT ? - 1 : 1 ;
1921 if ( argumentsLength < 2 ) while ( true ) {
@@ -24,7 +26,7 @@ var createMethod = function (IS_RIGHT) {
2426 }
2527 index += i ;
2628 if ( IS_RIGHT ? index < 0 : length <= index ) {
27- throw new $TypeError ( 'Reduce of empty array with no initial value' ) ;
29+ throw new $TypeError ( REDUCE_EMPTY ) ;
2830 }
2931 }
3032 for ( ; IS_RIGHT ? index >= 0 : length > index ; index += i ) if ( index in self ) {
You can’t perform that action at this time.
0 commit comments