UNPKG

4.04 kBJavaScriptView Raw
1(function webpackUniversalModuleDefinition(root, factory) {
2 if(typeof exports === 'object' && typeof module === 'object')
3 module.exports = factory();
4 else if(typeof define === 'function' && define.amd)
5 define("Compary", [], factory);
6 else if(typeof exports === 'object')
7 exports["Compary"] = factory();
8 else
9 root["Compary"] = factory();
10})(this, function() {
11return /******/ (function(modules) { // webpackBootstrap
12/******/ // The module cache
13/******/ var installedModules = {};
14/******/
15/******/ // The require function
16/******/ function __webpack_require__(moduleId) {
17/******/
18/******/ // Check if module is in cache
19/******/ if(installedModules[moduleId]) {
20/******/ return installedModules[moduleId].exports;
21/******/ }
22/******/ // Create a new module (and put it into the cache)
23/******/ var module = installedModules[moduleId] = {
24/******/ i: moduleId,
25/******/ l: false,
26/******/ exports: {}
27/******/ };
28/******/
29/******/ // Execute the module function
30/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
31/******/
32/******/ // Flag the module as loaded
33/******/ module.l = true;
34/******/
35/******/ // Return the exports of the module
36/******/ return module.exports;
37/******/ }
38/******/
39/******/
40/******/ // expose the modules object (__webpack_modules__)
41/******/ __webpack_require__.m = modules;
42/******/
43/******/ // expose the module cache
44/******/ __webpack_require__.c = installedModules;
45/******/
46/******/ // define getter function for harmony exports
47/******/ __webpack_require__.d = function(exports, name, getter) {
48/******/ if(!__webpack_require__.o(exports, name)) {
49/******/ Object.defineProperty(exports, name, {
50/******/ configurable: false,
51/******/ enumerable: true,
52/******/ get: getter
53/******/ });
54/******/ }
55/******/ };
56/******/
57/******/ // getDefaultExport function for compatibility with non-harmony modules
58/******/ __webpack_require__.n = function(module) {
59/******/ var getter = module && module.__esModule ?
60/******/ function getDefault() { return module['default']; } :
61/******/ function getModuleExports() { return module; };
62/******/ __webpack_require__.d(getter, 'a', getter);
63/******/ return getter;
64/******/ };
65/******/
66/******/ // Object.prototype.hasOwnProperty.call
67/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
68/******/
69/******/ // __webpack_public_path__
70/******/ __webpack_require__.p = "";
71/******/
72/******/ // Load entry module and return exports
73/******/ return __webpack_require__(__webpack_require__.s = 0);
74/******/ })
75/************************************************************************/
76/******/ ([
77/* 0 */
78/***/ (function(module, exports) {
79
80Object.defineProperty(exports, "__esModule", { value: true });
81var naturalOrder = function (a, b) { return a < b ? -1 : a > b ? 1 : 0; };
82function compare(comparison) {
83 return Object.assign(comparison, {
84 reversed: function () {
85 return compare(function (a, b) { return comparison(a, b) * -1; });
86 },
87 then: function (nextComparison) {
88 return compare(function (a, b) {
89 var result = comparison(a, b);
90 return result !== 0
91 ? result
92 : nextComparison(a, b);
93 });
94 },
95 thenDescending: function (nextComparison) {
96 return this.then(compare(nextComparison)
97 .reversed());
98 },
99 thenBy: function (selector) {
100 return this.then(function (a, b) { return naturalOrder(selector(a), selector(b)); });
101 },
102 thenByDescending: function (selector) {
103 return this.then(compare(function (a, b) { return naturalOrder(selector(a), selector(b)); })
104 .reversed());
105 }
106 });
107}
108exports.compare = compare;
109
110
111/***/ })
112/******/ ]);
113});
114//# sourceMappingURL=compary.js.map
\No newline at end of file