ranges-iterate 3.2.9 → 3.2.11

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
@@ -24,7 +24,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
24
24
 
25
25
  ### BREAKING CHANGES
26
26
 
27
- - programs now are in ES Modules and won't work with Common JS require()
27
+ - programs now are in ES Modules and won't work with Common JS `require()`
28
28
 
29
29
  ## 2.1.0 (2021-05-24)
30
30
 
@@ -42,7 +42,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
42
42
 
43
43
  ### Fixed
44
44
 
45
- - add testStats to npmignore ([f3c84e9](https://github.com/codsen/codsen/commit/f3c84e95afc5514214312f913692d85b2e12eb29))
45
+ - add `testStats` to npmignore ([f3c84e9](https://github.com/codsen/codsen/commit/f3c84e95afc5514214312f913692d85b2e12eb29))
46
46
 
47
47
  ## 2.0.0 (2021-01-23)
48
48
 
@@ -56,7 +56,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
56
56
 
57
57
  ## 1.2.0 (2020-11-28)
58
58
 
59
- Accidental version bump during migration to sourcehut. Sorry about that.
59
+ Accidental version bump during migration to SourceHut. Sorry about that.
60
60
 
61
61
  ## 1.1.0 (2019-06-01)
62
62
 
package/README.md CHANGED
@@ -1,28 +1,25 @@
1
- # ranges-iterate
1
+ <h1 align="center">ranges-iterate</h1>
2
2
 
3
- > Iterate a string and any changes within given string index ranges
3
+ <p align="center">Iterate a string and any changes within given string index ranges</p>
4
4
 
5
- <div class="package-badges">
6
- <a href="https://www.npmjs.com/package/ranges-iterate" rel="nofollow noreferrer noopener">
7
- <img src="https://img.shields.io/badge/-npm-blue?style=flat-square" alt="page on npm">
8
- </a>
5
+ <p align="center">
9
6
  <a href="https://codsen.com/os/ranges-iterate" rel="nofollow noreferrer noopener">
10
7
  <img src="https://img.shields.io/badge/-codsen-blue?style=flat-square" alt="page on codsen.com">
11
8
  </a>
9
+ <a href="https://www.npmjs.com/package/ranges-iterate" rel="nofollow noreferrer noopener">
10
+ <img src="https://img.shields.io/badge/-npm-blue?style=flat-square" alt="page on npm">
11
+ </a>
12
12
  <a href="https://github.com/codsen/codsen/tree/main/packages/ranges-iterate" rel="nofollow noreferrer noopener">
13
13
  <img src="https://img.shields.io/badge/-github-blue?style=flat-square" alt="page on github">
14
14
  </a>
15
15
  <a href="https://npmcharts.com/compare/ranges-iterate?interval=30" rel="nofollow noreferrer noopener" target="_blank">
16
16
  <img src="https://img.shields.io/npm/dm/ranges-iterate.svg?style=flat-square" alt="Downloads per month">
17
17
  </a>
18
- <a href="https://prettier.io" rel="nofollow noreferrer noopener" target="_blank">
19
- <img src="https://img.shields.io/badge/code_style-prettier-brightgreen.svg?style=flat-square" alt="Code style: prettier">
20
- </a>
21
- <img src="https://img.shields.io/badge/licence-MIT-brightgreen.svg?style=flat-square" alt="MIT License">
22
- <a href="https://liberamanifesto.com" rel="nofollow noreferrer noopener" target="_blank">
23
- <img src="https://img.shields.io/badge/libera-manifesto-lightgrey.svg?style=flat-square" alt="libera manifesto">
18
+ <a href="https://codsen.com/os/ranges-iterate/changelog" rel="nofollow noreferrer noopener">
19
+ <img src="https://img.shields.io/badge/changelog-here-brightgreen?style=flat-square" alt="changelog">
24
20
  </a>
25
- </div>
21
+ <img src="https://img.shields.io/badge/licence-MIT-brightgreen.svg?style=flat-square" alt="MIT Licence">
22
+ </p>
26
23
 
27
24
  ## Install
28
25
 
@@ -69,8 +66,8 @@ To report bugs or request features or assistance, [raise an issue](https://githu
69
66
 
70
67
  ## Licence
71
68
 
72
- MIT License
69
+ MIT License.
73
70
 
74
- Copyright (c) 2010-2022 Roy Revelt and other contributors
71
+ Copyright © 2010-2022 Roy Revelt and other contributors.
75
72
 
76
- <img src="https://codsen.com/images/png-codsen-ok.png" width="98" alt="ok" align="center"> <img src="https://codsen.com/images/png-codsen-1.png" width="148" alt="codsen" align="center"> <img src="https://codsen.com/images/png-codsen-star-small.png" width="32" alt="star" align="center">
73
+ <p align="center"><img src="https://codsen.com/images/png-codsen-ok.png" width="98" alt="ok" align="center"> <img src="https://codsen.com/images/png-codsen-1.png" width="148" alt="codsen" align="center"> <img src="https://codsen.com/images/png-codsen-star-small.png" width="32" alt="star" align="center"></p>
@@ -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 3.2.9
4
+ * @version 3.2.11
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 d="3.2.9";var f=d;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,c=i[2].length;l<c;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 d="3.2.11";var f=d;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,c=i[2].length;l<c;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};
@@ -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 3.2.9
4
+ * @version 3.2.11
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 c="3.2.9";var h=c;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 d=e.length;for(t[$+1]&&(d=t[$+1][0]);s<d;o++,s++)n({i:o,val:e[s]})})}}return x(E);})();
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 c="3.2.11";var h=c;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 d=e.length;for(t[$+1]&&(d=t[$+1][0]);s<d;o++,s++)n({i:o,val:e[s]})})}}return x(E);})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ranges-iterate",
3
- "version": "3.2.9",
3
+ "version": "3.2.11",
4
4
  "description": "Iterate a string and any changes within given string index ranges",
5
5
  "keywords": [
6
6
  "array",
@@ -41,7 +41,7 @@
41
41
  "examples": "node '../../ops/scripts/run-examples.js'",
42
42
  "lect": "node '../../ops/lect/lect.js' && yarn run prettier 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
43
43
  "letspublish": "yarn publish || :",
44
- "lint": "eslint . --fix",
44
+ "lint": "eslint . --ext .js --ext .ts --fix",
45
45
  "perf": "node perf/check.js",
46
46
  "prepare": "echo 'ready'",
47
47
  "prettier": "prettier",
@@ -68,7 +68,7 @@
68
68
  }
69
69
  },
70
70
  "devDependencies": {
71
- "ranges-apply": "^6.2.9",
72
- "ranges-merge": "^8.2.4"
71
+ "ranges-apply": "^6.2.11",
72
+ "ranges-merge": "^8.2.6"
73
73
  }
74
74
  }
@@ -1,24 +0,0 @@
1
- // Quick Take
2
-
3
- import { strict as assert } from "assert";
4
-
5
- import { rIterate } from "../dist/ranges-iterate.esm.js";
6
-
7
- // Ranges in the following example "punches out" a "hole" from `a` to `g`
8
- // (included), replacing it with `xyz`. That's what gets iterated.
9
-
10
- const gathered = [];
11
-
12
- // a callback-based interface:
13
- rIterate("abcdefghij", [[0, 7, "xyz"]], ({ i, val }) => {
14
- gathered.push(`i = ${i}; val = ${val}`);
15
- });
16
-
17
- assert.deepEqual(gathered, [
18
- "i = 0; val = x",
19
- "i = 1; val = y",
20
- "i = 2; val = z",
21
- "i = 3; val = h",
22
- "i = 4; val = i",
23
- "i = 5; val = j",
24
- ]);