ranges-iterate 4.0.0 → 4.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,24 +3,24 @@
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
- # 4.0.0 (2022-12-01)
6
+ ## [4.0.2](https://github.com/codsen/codsen/compare/ranges-iterate@4.0.1...ranges-iterate@4.0.2) (2022-12-06)
7
7
 
8
- ### Features
8
+ **Note:** Version bump only for package ranges-iterate
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
+ ## 4.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
- # 3.2.0 (2022-08-12)
16
+ ## 3.2.0 (2022-08-12)
17
17
 
18
18
  ### Features
19
19
 
20
20
  - export types ([7fc9c65](https://github.com/codsen/codsen/commit/7fc9c6550d73a4915c2be055b81029aebc4f8acf))
21
21
  - export types ([11b5fb9](https://github.com/codsen/codsen/commit/11b5fb936ce20e0a77c3a09806773e1cd7695c50))
22
22
 
23
- # 3.1.0 (2022-04-11)
23
+ ## 3.1.0 (2022-04-11)
24
24
 
25
25
  ### Features
26
26
 
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * @name ranges-iterate
3
3
  * @fileoverview Iterate a string and any changes within given string index ranges
4
- * @version 4.0.0
4
+ * @version 4.0.2
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/ranges-iterate/}
8
8
  */
9
9
 
10
- var c="4.0.0";var f=c;function b(r,o,n,a=0){if(typeof r!="string")throw new TypeError(`ranges-iterate: [THROW_ID_01] Input string must be a string! It was given as ${typeof r}, equal to: ${JSON.stringify(r,null,0)}`);if(!r.length)throw new TypeError("ranges-iterate: [THROW_ID_02] Input string must be non-empty!");if(o&&!Array.isArray(o))throw new TypeError(`ranges-iterate: [THROW_ID_03] Input ranges must be an array, consisting of zero or more arrays! Currently its type is: ${typeof o}, equal to: ${JSON.stringify(o,null,0)}`);if(n){if(typeof n!="function")throw new TypeError(`ranges-iterate: [THROW_ID_05] The calllback function (third input argument) must be a function. It was given as: ${typeof n}, equal to: ${JSON.stringify(n,null,0)}`)}else throw new TypeError("ranges-iterate: [THROW_ID_04] You should provide a callback function as third input argument!");if(o===null||!o.length)for(let e=0;e<r.length;e++)n({i:e,val:r[e]});else{let e=Array.from(o),s=a,t=a;if(t<e[0][0])for(;t<e[0][0]&&r[t];t++,s++)n({i:t,val:r[t]});e[0][0]<=s&&e.forEach((i,u)=>{if(i[2])for(let l=0,d=i[2].length;l<d;l++)n({i:t,val:i[2][l]}),t+=1;for(;s<i[1];)s+=1;let $=r.length;for(e[u+1]&&($=e[u+1][0]);s<$;t++,s++)n({i:t,val:r[s]})})}}export{b as rIterate,f as version};
10
+ var m="4.0.2";var f=m;function b(t,o,r,a=0){if(typeof t!="string")throw new TypeError(`ranges-iterate: [THROW_ID_01] Input string must be a string! It was given as ${typeof t}, equal to: ${JSON.stringify(t,null,0)}`);if(!t.length)throw new TypeError("ranges-iterate: [THROW_ID_02] Input string must be non-empty!");if(o&&!Array.isArray(o))throw new TypeError(`ranges-iterate: [THROW_ID_03] Input ranges must be an array, consisting of zero or more arrays! Currently its type is: ${typeof o}, equal to: ${JSON.stringify(o,null,0)}`);if(r){if(typeof r!="function")throw new TypeError(`ranges-iterate: [THROW_ID_05] The calllback function (third input argument) must be a function. It was given as: ${typeof r}, equal to: ${JSON.stringify(r,null,0)}`)}else throw new TypeError("ranges-iterate: [THROW_ID_04] You should provide a callback function as third input argument!");if(o===null||!o.length)for(let e=0;e<t.length;e++)r({i:e,val:t[e]});else{let e=Array.from(o),s=a,n=a;if(n<e[0][0])for(;n<e[0][0]&&t[n];n++,s++)r({i:n,val:t[n]});e[0][0]<=s&&e.forEach((i,u)=>{if(i[2])for(let l=0,$=i[2].length;l<$;l++)r({i:n,val:i[2][l]}),n+=1;for(;s<i[1];)s+=1;let p=t.length;for(e[u+1]&&(p=e[u+1][0]);s<p;n++,s++)r({i:n,val:t[s]})})}}export{b as rIterate,f as version};
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * @name ranges-iterate
3
3
  * @fileoverview Iterate a string and any changes within given string index ranges
4
- * @version 4.0.0
4
+ * @version 4.0.2
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/ranges-iterate/}
8
8
  */
9
9
 
10
- "use strict";var rangesIterate=(()=>{var u=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var b=(e,r)=>{for(var n in r)u(e,n,{get:r[n],enumerable:!0})},y=(e,r,n,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of g(r))!f.call(e,t)&&t!==n&&u(e,t,{get:()=>r[t],enumerable:!(i=m(r,t))||i.enumerable});return e};var x=e=>y(u({},"__esModule",{value:!0}),e);var E={};b(E,{rIterate:()=>v,version:()=>h});var d="4.0.0";var h=d;function v(e,r,n,i=0){if(typeof e!="string")throw new TypeError(`ranges-iterate: [THROW_ID_01] Input string must be a string! It was given as ${typeof e}, equal to: ${JSON.stringify(e,null,0)}`);if(!e.length)throw new TypeError("ranges-iterate: [THROW_ID_02] Input string must be non-empty!");if(r&&!Array.isArray(r))throw new TypeError(`ranges-iterate: [THROW_ID_03] Input ranges must be an array, consisting of zero or more arrays! Currently its type is: ${typeof r}, equal to: ${JSON.stringify(r,null,0)}`);if(n){if(typeof n!="function")throw new TypeError(`ranges-iterate: [THROW_ID_05] The calllback function (third input argument) must be a function. It was given as: ${typeof n}, equal to: ${JSON.stringify(n,null,0)}`)}else throw new TypeError("ranges-iterate: [THROW_ID_04] You should provide a callback function as third input argument!");if(r===null||!r.length)for(let t=0;t<e.length;t++)n({i:t,val:e[t]});else{let t=Array.from(r),s=i,o=i;if(o<t[0][0])for(;o<t[0][0]&&e[o];o++,s++)n({i:o,val:e[o]});t[0][0]<=s&&t.forEach((l,$)=>{if(l[2])for(let a=0,p=l[2].length;a<p;a++)n({i:o,val:l[2][a]}),o+=1;for(;s<l[1];)s+=1;let c=e.length;for(t[$+1]&&(c=t[$+1][0]);s<c;o++,s++)n({i:o,val:e[s]})})}}return x(E);})();
10
+ "use strict";var rangesIterate=(()=>{var u=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var b=(e,t)=>{for(var r in t)u(e,r,{get:t[r],enumerable:!0})},x=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of g(t))!f.call(e,n)&&n!==r&&u(e,n,{get:()=>t[n],enumerable:!(i=d(t,n))||i.enumerable});return e};var y=e=>x(u({},"__esModule",{value:!0}),e);var E={};b(E,{rIterate:()=>v,version:()=>h});var $="4.0.2";var h=$;function v(e,t,r,i=0){if(typeof e!="string")throw new TypeError(`ranges-iterate: [THROW_ID_01] Input string must be a string! It was given as ${typeof e}, equal to: ${JSON.stringify(e,null,0)}`);if(!e.length)throw new TypeError("ranges-iterate: [THROW_ID_02] Input string must be non-empty!");if(t&&!Array.isArray(t))throw new TypeError(`ranges-iterate: [THROW_ID_03] Input ranges must be an array, consisting of zero or more arrays! Currently its type is: ${typeof t}, equal to: ${JSON.stringify(t,null,0)}`);if(r){if(typeof r!="function")throw new TypeError(`ranges-iterate: [THROW_ID_05] The calllback function (third input argument) must be a function. It was given as: ${typeof r}, equal to: ${JSON.stringify(r,null,0)}`)}else throw new TypeError("ranges-iterate: [THROW_ID_04] You should provide a callback function as third input argument!");if(t===null||!t.length)for(let n=0;n<e.length;n++)r({i:n,val:e[n]});else{let n=Array.from(t),s=i,o=i;if(o<n[0][0])for(;o<n[0][0]&&e[o];o++,s++)r({i:o,val:e[o]});n[0][0]<=s&&n.forEach((l,p)=>{if(l[2])for(let a=0,c=l[2].length;a<c;a++)r({i:o,val:l[2][a]}),o+=1;for(;s<l[1];)s+=1;let m=e.length;for(n[p+1]&&(m=n[p+1][0]);s<m;o++,s++)r({i:o,val:e[s]})})}}return y(E);})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ranges-iterate",
3
- "version": "4.0.0",
3
+ "version": "4.0.2",
4
4
  "description": "Iterate a string and any changes within given string index ranges",
5
5
  "keywords": [
6
6
  "array",
@@ -34,22 +34,22 @@
34
34
  },
35
35
  "types": "types/index.d.ts",
36
36
  "scripts": {
37
- "build": "node '../../ops/scripts/esbuild.js' && yarn run dts",
37
+ "build": "node '../../ops/scripts/esbuild.js' && npm run dts",
38
38
  "cjs-off": "exit 0",
39
39
  "cjs-on": "exit 0",
40
- "dev": "DEV=true node '../../ops/scripts/esbuild.js' && yarn run dts",
41
- "devtest": "c8 yarn run unit && yarn run examples && yarn run lint",
42
- "dts": "rollup -c && yarn run prettier 'types/index.d.ts' --write",
40
+ "dev": "DEV=true node '../../ops/scripts/esbuild.js' && npm run dts",
41
+ "devtest": "c8 npm run unit && npm run examples && npm run lint",
42
+ "dts": "rollup -c && npm run prettier -- 'types/index.d.ts' --write --loglevel 'silent'",
43
43
  "examples": "node '../../ops/scripts/run-examples.js'",
44
- "lect": "node '../../ops/lect/lect.js' && yarn run prettier 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
45
- "letspublish": "yarn publish || :",
44
+ "lect": "node '../../ops/lect/lect.js' && npm run prettier -- 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
45
+ "letspublish": "npm publish || :",
46
46
  "lint": "eslint . --ext .js --ext .ts --fix",
47
47
  "perf": "node perf/check.js",
48
- "prepare": "echo 'ready'",
48
+ "prep": "echo 'ready'",
49
49
  "prettier": "prettier",
50
- "prettier:format": "prettier --write '**/*.{ts,tsx,md}' --no-error-on-unmatched-pattern",
51
- "pretest": "yarn run lect && yarn run build",
52
- "test": "yarn run devtest",
50
+ "prettier:format": "npm run prettier -- --write '**/*.{ts,tsx,md}' --no-error-on-unmatched-pattern --loglevel 'silent'",
51
+ "pretest": "npm run lect && npm run build",
52
+ "test": "npm run devtest",
53
53
  "unit": "uvu test"
54
54
  },
55
55
  "engines": {
@@ -70,7 +70,7 @@
70
70
  }
71
71
  },
72
72
  "devDependencies": {
73
- "ranges-apply": "^7.0.0",
74
- "ranges-merge": "^9.0.0"
73
+ "ranges-apply": "^7.0.2",
74
+ "ranges-merge": "^9.0.2"
75
75
  }
76
76
  }
package/types/index.d.ts CHANGED
@@ -1,14 +1,14 @@
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
 
6
6
  declare const version: string;
7
7
  interface Obj {
8
8
  i: number;
9
9
  val: any;
10
10
  }
11
- declare type Callback = (obj: Obj) => void;
11
+ type Callback = (obj: Obj) => void;
12
12
  declare function rIterate(
13
13
  str: string,
14
14
  input: Ranges,