| | |
| | | 'use strict'; |
| | | var $ = require('../internals/export'); |
| | | var uncurryThis = require('../internals/function-uncurry-this'); |
| | | var aCallable = require('../internals/a-callable'); |
| | | var toObject = require('../internals/to-object'); |
| | | var lengthOfArrayLike = require('../internals/length-of-array-like'); |
| | |
| | | var WEBKIT = require('../internals/engine-webkit-version'); |
| | | |
| | | var test = []; |
| | | var nativeSort = test.sort; |
| | | var un$Sort = uncurryThis(test.sort); |
| | | var push = uncurryThis(test.push); |
| | | |
| | | // IE8- |
| | | var FAILS_ON_UNDEFINED = fails(function () { |
| | |
| | | |
| | | var array = toObject(this); |
| | | |
| | | if (STABLE_SORT) return comparefn === undefined ? nativeSort.call(array) : nativeSort.call(array, comparefn); |
| | | if (STABLE_SORT) return comparefn === undefined ? un$Sort(array) : un$Sort(array, comparefn); |
| | | |
| | | var items = []; |
| | | var arrayLength = lengthOfArrayLike(array); |
| | | var itemsLength, index; |
| | | |
| | | for (index = 0; index < arrayLength; index++) { |
| | | if (index in array) items.push(array[index]); |
| | | if (index in array) push(items, array[index]); |
| | | } |
| | | |
| | | items = internalSort(items, getSortCompare(comparefn)); |
| | | internalSort(items, getSortCompare(comparefn)); |
| | | |
| | | itemsLength = items.length; |
| | | index = 0; |
| | | |