summaryrefslogtreecommitdiff
path: root/school/node_modules/ranges-sort/dist
diff options
context:
space:
mode:
Diffstat (limited to 'school/node_modules/ranges-sort/dist')
-rw-r--r--school/node_modules/ranges-sort/dist/ranges-sort.cjs.js86
-rw-r--r--school/node_modules/ranges-sort/dist/ranges-sort.dev.umd.js94
-rw-r--r--school/node_modules/ranges-sort/dist/ranges-sort.esm.js68
-rw-r--r--school/node_modules/ranges-sort/dist/ranges-sort.umd.js10
4 files changed, 258 insertions, 0 deletions
diff --git a/school/node_modules/ranges-sort/dist/ranges-sort.cjs.js b/school/node_modules/ranges-sort/dist/ranges-sort.cjs.js
new file mode 100644
index 0000000..03dde06
--- /dev/null
+++ b/school/node_modules/ranges-sort/dist/ranges-sort.cjs.js
@@ -0,0 +1,86 @@
+/**
+ * @name ranges-sort
+ * @fileoverview Sort string index ranges
+ * @version 4.1.0
+ * @author Roy Revelt, Codsen Ltd
+ * @license MIT
+ * {@link https://codsen.com/os/ranges-sort/}
+ */
+
+'use strict';
+
+Object.defineProperty(exports, '__esModule', { value: true });
+
+var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
+
+function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
+
+var _objectSpread__default = /*#__PURE__*/_interopDefaultLegacy(_objectSpread);
+
+var version$1 = "4.1.0";
+
+var version = version$1;
+var defaults = {
+ strictlyTwoElementsInRangeArrays: false,
+ progressFn: null
+};
+function rSort(arrOfRanges, originalOptions) {
+ if (!Array.isArray(arrOfRanges) || !arrOfRanges.length) {
+ return arrOfRanges;
+ }
+ var opts = _objectSpread__default['default'](_objectSpread__default['default']({}, defaults), originalOptions);
+ var culpritsIndex;
+ var culpritsLen;
+ if (opts.strictlyTwoElementsInRangeArrays && !arrOfRanges.filter(function (range) {
+ return range;
+ }).every(function (rangeArr, indx) {
+ if (rangeArr.length !== 2) {
+ culpritsIndex = indx;
+ culpritsLen = rangeArr.length;
+ return false;
+ }
+ return true;
+ })) {
+ throw new TypeError("ranges-sort: [THROW_ID_03] The first argument should be an array and must consist of arrays which are natural number indexes representing TWO string index ranges. However, ".concat(culpritsIndex, "th range (").concat(JSON.stringify(arrOfRanges[culpritsIndex], null, 4), ") has not two but ").concat(culpritsLen, " elements!"));
+ }
+ if (!arrOfRanges.filter(function (range) {
+ return range;
+ }).every(function (rangeArr, indx) {
+ if (!Number.isInteger(rangeArr[0]) || rangeArr[0] < 0 || !Number.isInteger(rangeArr[1]) || rangeArr[1] < 0) {
+ culpritsIndex = indx;
+ return false;
+ }
+ return true;
+ })) {
+ throw new TypeError("ranges-sort: [THROW_ID_04] The first argument should be an array and must consist of arrays which are natural number indexes representing string index ranges. However, ".concat(culpritsIndex, "th range (").concat(JSON.stringify(arrOfRanges[culpritsIndex], null, 4), ") does not consist of only natural numbers!"));
+ }
+ var maxPossibleIterations = Math.pow(arrOfRanges.filter(function (range) {
+ return range;
+ }).length, 2);
+ var counter = 0;
+ return Array.from(arrOfRanges).filter(function (range) {
+ return range;
+ }).sort(function (range1, range2) {
+ if (opts.progressFn) {
+ counter += 1;
+ opts.progressFn(Math.floor(counter * 100 / maxPossibleIterations));
+ }
+ if (range1[0] === range2[0]) {
+ if (range1[1] < range2[1]) {
+ return -1;
+ }
+ if (range1[1] > range2[1]) {
+ return 1;
+ }
+ return 0;
+ }
+ if (range1[0] < range2[0]) {
+ return -1;
+ }
+ return 1;
+ });
+}
+
+exports.defaults = defaults;
+exports.rSort = rSort;
+exports.version = version;
diff --git a/school/node_modules/ranges-sort/dist/ranges-sort.dev.umd.js b/school/node_modules/ranges-sort/dist/ranges-sort.dev.umd.js
new file mode 100644
index 0000000..ea07705
--- /dev/null
+++ b/school/node_modules/ranges-sort/dist/ranges-sort.dev.umd.js
@@ -0,0 +1,94 @@
+/**
+ * @name ranges-sort
+ * @fileoverview Sort string index ranges
+ * @version 4.1.0
+ * @author Roy Revelt, Codsen Ltd
+ * @license MIT
+ * {@link https://codsen.com/os/ranges-sort/}
+ */
+
+(function (global, factory) {
+typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
+typeof define === 'function' && define.amd ? define(['exports'], factory) :
+(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.rangesSort = {}));
+}(this, (function (exports) { 'use strict';
+
+var version$1 = "4.1.0";
+
+const version = version$1;
+const defaults = {
+ strictlyTwoElementsInRangeArrays: false,
+ progressFn: null,
+};
+function rSort(arrOfRanges, originalOptions) {
+ // quick ending
+ if (!Array.isArray(arrOfRanges) || !arrOfRanges.length) {
+ return arrOfRanges;
+ }
+ // fill any settings with defaults if missing:
+ const opts = { ...defaults, ...originalOptions };
+ // arrOfRanges validation
+ let culpritsIndex;
+ let culpritsLen;
+ // validate does every range consist of exactly two indexes:
+ if (opts.strictlyTwoElementsInRangeArrays &&
+ !arrOfRanges
+ .filter((range) => range)
+ .every((rangeArr, indx) => {
+ if (rangeArr.length !== 2) {
+ culpritsIndex = indx;
+ culpritsLen = rangeArr.length;
+ return false;
+ }
+ return true;
+ })) {
+ throw new TypeError(`ranges-sort: [THROW_ID_03] The first argument should be an array and must consist of arrays which are natural number indexes representing TWO string index ranges. However, ${culpritsIndex}th range (${JSON.stringify(arrOfRanges[culpritsIndex], null, 4)}) has not two but ${culpritsLen} elements!`);
+ }
+ // validate are range indexes natural numbers:
+ if (!arrOfRanges
+ .filter((range) => range)
+ .every((rangeArr, indx) => {
+ if (!Number.isInteger(rangeArr[0]) ||
+ rangeArr[0] < 0 ||
+ !Number.isInteger(rangeArr[1]) ||
+ rangeArr[1] < 0) {
+ culpritsIndex = indx;
+ return false;
+ }
+ return true;
+ })) {
+ throw new TypeError(`ranges-sort: [THROW_ID_04] The first argument should be an array and must consist of arrays which are natural number indexes representing string index ranges. However, ${culpritsIndex}th range (${JSON.stringify(arrOfRanges[culpritsIndex], null, 4)}) does not consist of only natural numbers!`);
+ }
+ // let's assume worst case scenario is N x N.
+ const maxPossibleIterations = arrOfRanges.filter((range) => range).length ** 2;
+ let counter = 0;
+ return Array.from(arrOfRanges)
+ .filter((range) => range)
+ .sort((range1, range2) => {
+ if (opts.progressFn) {
+ counter += 1;
+ opts.progressFn(Math.floor((counter * 100) / maxPossibleIterations));
+ }
+ if (range1[0] === range2[0]) {
+ if (range1[1] < range2[1]) {
+ return -1;
+ }
+ if (range1[1] > range2[1]) {
+ return 1;
+ }
+ return 0;
+ }
+ if (range1[0] < range2[0]) {
+ return -1;
+ }
+ return 1;
+ });
+}
+
+exports.defaults = defaults;
+exports.rSort = rSort;
+exports.version = version;
+
+Object.defineProperty(exports, '__esModule', { value: true });
+
+})));
diff --git a/school/node_modules/ranges-sort/dist/ranges-sort.esm.js b/school/node_modules/ranges-sort/dist/ranges-sort.esm.js
new file mode 100644
index 0000000..31f0662
--- /dev/null
+++ b/school/node_modules/ranges-sort/dist/ranges-sort.esm.js
@@ -0,0 +1,68 @@
+/**
+ * @name ranges-sort
+ * @fileoverview Sort string index ranges
+ * @version 4.1.0
+ * @author Roy Revelt, Codsen Ltd
+ * @license MIT
+ * {@link https://codsen.com/os/ranges-sort/}
+ */
+
+var version$1 = "4.1.0";
+
+const version = version$1;
+const defaults = {
+ strictlyTwoElementsInRangeArrays: false,
+ progressFn: null
+};
+function rSort(arrOfRanges, originalOptions) {
+ if (!Array.isArray(arrOfRanges) || !arrOfRanges.length) {
+ return arrOfRanges;
+ }
+ const opts = { ...defaults,
+ ...originalOptions
+ };
+ let culpritsIndex;
+ let culpritsLen;
+ if (opts.strictlyTwoElementsInRangeArrays && !arrOfRanges.filter(range => range).every((rangeArr, indx) => {
+ if (rangeArr.length !== 2) {
+ culpritsIndex = indx;
+ culpritsLen = rangeArr.length;
+ return false;
+ }
+ return true;
+ })) {
+ throw new TypeError(`ranges-sort: [THROW_ID_03] The first argument should be an array and must consist of arrays which are natural number indexes representing TWO string index ranges. However, ${culpritsIndex}th range (${JSON.stringify(arrOfRanges[culpritsIndex], null, 4)}) has not two but ${culpritsLen} elements!`);
+ }
+ if (!arrOfRanges.filter(range => range).every((rangeArr, indx) => {
+ if (!Number.isInteger(rangeArr[0]) || rangeArr[0] < 0 || !Number.isInteger(rangeArr[1]) || rangeArr[1] < 0) {
+ culpritsIndex = indx;
+ return false;
+ }
+ return true;
+ })) {
+ throw new TypeError(`ranges-sort: [THROW_ID_04] The first argument should be an array and must consist of arrays which are natural number indexes representing string index ranges. However, ${culpritsIndex}th range (${JSON.stringify(arrOfRanges[culpritsIndex], null, 4)}) does not consist of only natural numbers!`);
+ }
+ const maxPossibleIterations = arrOfRanges.filter(range => range).length ** 2;
+ let counter = 0;
+ return Array.from(arrOfRanges).filter(range => range).sort((range1, range2) => {
+ if (opts.progressFn) {
+ counter += 1;
+ opts.progressFn(Math.floor(counter * 100 / maxPossibleIterations));
+ }
+ if (range1[0] === range2[0]) {
+ if (range1[1] < range2[1]) {
+ return -1;
+ }
+ if (range1[1] > range2[1]) {
+ return 1;
+ }
+ return 0;
+ }
+ if (range1[0] < range2[0]) {
+ return -1;
+ }
+ return 1;
+ });
+}
+
+export { defaults, rSort, version };
diff --git a/school/node_modules/ranges-sort/dist/ranges-sort.umd.js b/school/node_modules/ranges-sort/dist/ranges-sort.umd.js
new file mode 100644
index 0000000..2be317f
--- /dev/null
+++ b/school/node_modules/ranges-sort/dist/ranges-sort.umd.js
@@ -0,0 +1,10 @@
+/**
+ * @name ranges-sort
+ * @fileoverview Sort string index ranges
+ * @version 4.1.0
+ * @author Roy Revelt, Codsen Ltd
+ * @license MIT
+ * {@link https://codsen.com/os/ranges-sort/}
+ */
+
+!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self).rangesSort={})}(this,(function(e){"use strict";const r={strictlyTwoElementsInRangeArrays:!1,progressFn:null};e.defaults=r,e.rSort=function(e,n){if(!Array.isArray(e)||!e.length)return e;const t={...r,...n};let s,o;if(t.strictlyTwoElementsInRangeArrays&&!e.filter((e=>e)).every(((e,r)=>2===e.length||(s=r,o=e.length,!1))))throw new TypeError(`ranges-sort: [THROW_ID_03] The first argument should be an array and must consist of arrays which are natural number indexes representing TWO string index ranges. However, ${s}th range (${JSON.stringify(e[s],null,4)}) has not two but ${o} elements!`);if(!e.filter((e=>e)).every(((e,r)=>!(!Number.isInteger(e[0])||e[0]<0||!Number.isInteger(e[1])||e[1]<0)||(s=r,!1))))throw new TypeError(`ranges-sort: [THROW_ID_04] The first argument should be an array and must consist of arrays which are natural number indexes representing string index ranges. However, ${s}th range (${JSON.stringify(e[s],null,4)}) does not consist of only natural numbers!`);const i=e.filter((e=>e)).length**2;let a=0;return Array.from(e).filter((e=>e)).sort(((e,r)=>(t.progressFn&&(a+=1,t.progressFn(Math.floor(100*a/i))),e[0]===r[0]?e[1]<r[1]?-1:e[1]>r[1]?1:0:e[0]<r[0]?-1:1)))},e.version="4.1.0",Object.defineProperty(e,"__esModule",{value:!0})}));