ranges-sort 6.0.0 → 6.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,17 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- # 6.0.0 (2022-12-01)
6
+ ## [6.0.2](https://github.com/codsen/codsen/compare/ranges-sort@6.0.1...ranges-sort@6.0.2) (2022-12-06)
7
7
 
8
- ### Features
8
+ **Note:** Version bump only for package ranges-sort
9
9
 
10
- - drop Node v12 support; minimum version requirement now is v14.18 and above ([c8049e8](https://github.com/codsen/codsen/commit/c8049e82a5844d3f72587740f1cc74e3c9020d22))
10
+ ## 6.0.0 (2022-12-01)
11
11
 
12
12
  ### BREAKING CHANGES
13
13
 
14
14
  - Minimum supported Node version is v14.18; we're dropping v12 support
15
15
 
16
- # 5.1.0 (2022-08-12)
16
+ ## 5.1.0 (2022-08-12)
17
17
 
18
18
  ### Features
19
19
 
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * @name ranges-sort
3
3
  * @fileoverview Sort string index ranges
4
- * @version 6.0.0
4
+ * @version 6.0.2
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/ranges-sort/}
8
8
  */
9
9
 
10
- var u="6.0.0";var m=u,d={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function g(t,l){if(!Array.isArray(t)||!t.length)return t;let n={...d,...l},s,o;if(n.strictlyTwoElementsInRangeArrays&&!t.every((e,r)=>!Array.isArray(e)||e.length!==2?(s=r,o=e.length,!1):!0))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(t[s],null,4)}) has not two but ${o} elements!`);if(!t.every((e,r)=>!Array.isArray(e)||!Number.isInteger(e[0])||e[0]<0||!Number.isInteger(e[1])||e[1]<0?(s=r,!1):!0))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(t[s],null,4)}) does not consist of only natural numbers!`);let a=t.length**2,i=0;return Array.from(t).sort((e,r)=>(n.progressFn&&(i+=1,n.progressFn(Math.floor(i*100/a))),e[0]===r[0]?e[1]<r[1]?-1:e[1]>r[1]?1:0:e[0]<r[0]?-1:1))}export{d as defaults,g as rSort,m as version};
10
+ var l="6.0.2";var y=l,d={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function g(t,u){if(!Array.isArray(t)||!t.length)return t;let n={...d,...u},s,o;if(n.strictlyTwoElementsInRangeArrays&&!t.every((e,r)=>!Array.isArray(e)||e.length!==2?(s=r,o=e.length,!1):!0))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(t[s],null,4)}) has not two but ${o} elements!`);if(!t.every((e,r)=>!Array.isArray(e)||!Number.isInteger(e[0])||e[0]<0||!Number.isInteger(e[1])||e[1]<0?(s=r,!1):!0))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(t[s],null,4)}) does not consist of only natural numbers!`);let p=t.length**2,i=0;return Array.from(t).sort((e,r)=>(n.progressFn&&(i+=1,n.progressFn(Math.floor(i*100/p))),e[0]===r[0]?e[1]<r[1]?-1:e[1]>r[1]?1:0:e[0]<r[0]?-1:1))}export{d as defaults,g as rSort,y as version};
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * @name ranges-sort
3
3
  * @fileoverview Sort string index ranges
4
- * @version 6.0.0
4
+ * @version 6.0.2
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/ranges-sort/}
8
8
  */
9
9
 
10
- "use strict";var rangesSort=(()=>{var u=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames,p=Object.getOwnPropertySymbols;var c=Object.prototype.hasOwnProperty,x=Object.prototype.propertyIsEnumerable;var d=(e,t,r)=>t in e?u(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,l=(e,t)=>{for(var r in t||(t={}))c.call(t,r)&&d(e,r,t[r]);if(p)for(var r of p(t))x.call(t,r)&&d(e,r,t[r]);return e};var b=(e,t)=>{for(var r in t)u(e,r,{get:t[r],enumerable:!0})},w=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of f(t))!c.call(e,o)&&o!==r&&u(e,o,{get:()=>t[o],enumerable:!(n=h(t,o))||n.enumerable});return e};var v=e=>w(u({},"__esModule",{value:!0}),e);var E={};b(E,{defaults:()=>m,rSort:()=>I,version:()=>j});var y="6.0.0";var j=y,m={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function I(e,t){if(!Array.isArray(e)||!e.length)return e;let r=l(l({},m),t),n,o;if(r.strictlyTwoElementsInRangeArrays&&!e.every((s,i)=>!Array.isArray(s)||s.length!==2?(n=i,o=s.length,!1):!0))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, ${n}th range (${JSON.stringify(e[n],null,4)}) has not two but ${o} elements!`);if(!e.every((s,i)=>!Array.isArray(s)||!Number.isInteger(s[0])||s[0]<0||!Number.isInteger(s[1])||s[1]<0?(n=i,!1):!0))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, ${n}th range (${JSON.stringify(e[n],null,4)}) does not consist of only natural numbers!`);let g=e.length**2,a=0;return Array.from(e).sort((s,i)=>(r.progressFn&&(a+=1,r.progressFn(Math.floor(a*100/g))),s[0]===i[0]?s[1]<i[1]?-1:s[1]>i[1]?1:0:s[0]<i[0]?-1:1))}return v(E);})();
10
+ "use strict";var rangesSort=(()=>{var l=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames,a=Object.getOwnPropertySymbols;var c=Object.prototype.hasOwnProperty,x=Object.prototype.propertyIsEnumerable;var d=(e,t,r)=>t in e?l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,u=(e,t)=>{for(var r in t||(t={}))c.call(t,r)&&d(e,r,t[r]);if(a)for(var r of a(t))x.call(t,r)&&d(e,r,t[r]);return e};var b=(e,t)=>{for(var r in t)l(e,r,{get:t[r],enumerable:!0})},v=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of f(t))!c.call(e,o)&&o!==r&&l(e,o,{get:()=>t[o],enumerable:!(n=h(t,o))||n.enumerable});return e};var w=e=>v(l({},"__esModule",{value:!0}),e);var E={};b(E,{defaults:()=>y,rSort:()=>I,version:()=>j});var m="6.0.2";var j=m,y={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function I(e,t){if(!Array.isArray(e)||!e.length)return e;let r=u(u({},y),t),n,o;if(r.strictlyTwoElementsInRangeArrays&&!e.every((s,i)=>!Array.isArray(s)||s.length!==2?(n=i,o=s.length,!1):!0))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, ${n}th range (${JSON.stringify(e[n],null,4)}) has not two but ${o} elements!`);if(!e.every((s,i)=>!Array.isArray(s)||!Number.isInteger(s[0])||s[0]<0||!Number.isInteger(s[1])||s[1]<0?(n=i,!1):!0))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, ${n}th range (${JSON.stringify(e[n],null,4)}) does not consist of only natural numbers!`);let g=e.length**2,p=0;return Array.from(e).sort((s,i)=>(r.progressFn&&(p+=1,r.progressFn(Math.floor(p*100/g))),s[0]===i[0]?s[1]<i[1]?-1:s[1]>i[1]?1:0:s[0]<i[0]?-1:1))}return w(E);})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ranges-sort",
3
- "version": "6.0.0",
3
+ "version": "6.0.2",
4
4
  "description": "Sort string index ranges",
5
5
  "keywords": [
6
6
  "array",
@@ -29,22 +29,22 @@
29
29
  },
30
30
  "types": "types/index.d.ts",
31
31
  "scripts": {
32
- "build": "node '../../ops/scripts/esbuild.js' && yarn run dts",
32
+ "build": "node '../../ops/scripts/esbuild.js' && npm run dts",
33
33
  "cjs-off": "exit 0",
34
34
  "cjs-on": "exit 0",
35
- "dev": "DEV=true node '../../ops/scripts/esbuild.js' && yarn run dts",
36
- "devtest": "c8 yarn run unit && yarn run examples && yarn run lint",
37
- "dts": "rollup -c && yarn run prettier 'types/index.d.ts' --write",
35
+ "dev": "DEV=true node '../../ops/scripts/esbuild.js' && npm run dts",
36
+ "devtest": "c8 npm run unit && npm run examples && npm run lint",
37
+ "dts": "rollup -c && npm run prettier -- 'types/index.d.ts' --write --loglevel 'silent'",
38
38
  "examples": "node '../../ops/scripts/run-examples.js'",
39
- "lect": "node '../../ops/lect/lect.js' && yarn run prettier 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
40
- "letspublish": "yarn publish || :",
39
+ "lect": "node '../../ops/lect/lect.js' && npm run prettier -- 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
40
+ "letspublish": "npm publish || :",
41
41
  "lint": "eslint . --ext .js --ext .ts --fix",
42
42
  "perf": "node perf/check.js",
43
- "prepare": "echo 'ready'",
43
+ "prep": "echo 'ready'",
44
44
  "prettier": "prettier",
45
- "prettier:format": "prettier --write '**/*.{ts,tsx,md}' --no-error-on-unmatched-pattern",
46
- "pretest": "yarn run lect && yarn run build",
47
- "test": "yarn run devtest",
45
+ "prettier:format": "npm run prettier -- --write '**/*.{ts,tsx,md}' --no-error-on-unmatched-pattern --loglevel 'silent'",
46
+ "pretest": "npm run lect && npm run build",
47
+ "test": "npm run devtest",
48
48
  "unit": "uvu test"
49
49
  },
50
50
  "engines": {
package/types/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- declare type Range =
1
+ type Range =
2
2
  | [from: number, to: number]
3
3
  | [from: number, to: number, whatToInsert: string | null | undefined];
4
- declare type Ranges = Range[] | null;
4
+ type Ranges = Range[] | null;
5
5
  declare const version: string;
6
- declare type ProgressFn = (percentageDone: number) => void;
6
+ type ProgressFn = (percentageDone: number) => void;
7
7
  interface Opts {
8
8
  strictlyTwoElementsInRangeArrays: boolean;
9
9
  progressFn: undefined | null | ProgressFn;