Version 1
[yaffs-website] / node_modules / core-js / library / modules / es6.array.sort.js
diff --git a/node_modules/core-js/library/modules/es6.array.sort.js b/node_modules/core-js/library/modules/es6.array.sort.js
new file mode 100644 (file)
index 0000000..7de1fe7
--- /dev/null
@@ -0,0 +1,23 @@
+'use strict';
+var $export   = require('./_export')
+  , aFunction = require('./_a-function')
+  , toObject  = require('./_to-object')
+  , fails     = require('./_fails')
+  , $sort     = [].sort
+  , test      = [1, 2, 3];
+
+$export($export.P + $export.F * (fails(function(){
+  // IE8-
+  test.sort(undefined);
+}) || !fails(function(){
+  // V8 bug
+  test.sort(null);
+  // Old WebKit
+}) || !require('./_strict-method')($sort)), 'Array', {
+  // 22.1.3.25 Array.prototype.sort(comparefn)
+  sort: function sort(comparefn){
+    return comparefn === undefined
+      ? $sort.call(toObject(this))
+      : $sort.call(toObject(this), aFunction(comparefn));
+  }
+});
\ No newline at end of file