.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / core-js / modules / es.array.sort.js
1 'use strict';
2 var $ = require('../internals/export');
3 var aFunction = require('../internals/a-function');
4 var toObject = require('../internals/to-object');
5 var fails = require('../internals/fails');
6 var arrayMethodIsStrict = require('../internals/array-method-is-strict');
7
8 var test = [];
9 var nativeSort = test.sort;
10
11 // IE8-
12 var FAILS_ON_UNDEFINED = fails(function () {
13   test.sort(undefined);
14 });
15 // V8 bug
16 var FAILS_ON_NULL = fails(function () {
17   test.sort(null);
18 });
19 // Old WebKit
20 var STRICT_METHOD = arrayMethodIsStrict('sort');
21
22 var FORCED = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD;
23
24 // `Array.prototype.sort` method
25 // https://tc39.es/ecma262/#sec-array.prototype.sort
26 $({ target: 'Array', proto: true, forced: FORCED }, {
27   sort: function sort(comparefn) {
28     return comparefn === undefined
29       ? nativeSort.call(toObject(this))
30       : nativeSort.call(toObject(this), aFunction(comparefn));
31   }
32 });