ranges-iterate 3.2.8 → 3.2.10
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 +4 -4
- package/dist/ranges-iterate.esm.js +2 -2
- package/dist/ranges-iterate.umd.js +2 -2
- package/package.json +4 -4
- package/examples/_quickTake.js +0 -24
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
|
|
|
@@ -40,9 +40,9 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
40
40
|
|
|
41
41
|
## 2.0.1 (2021-01-28)
|
|
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
|
|
59
|
+
Accidental version bump during migration to SourceHut. Sorry about that.
|
|
60
60
|
|
|
61
61
|
## 1.1.0 (2019-06-01)
|
|
62
62
|
|
|
@@ -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.
|
|
4
|
+
* @version 3.2.10
|
|
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.
|
|
10
|
+
var d="3.2.10";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.
|
|
4
|
+
* @version 3.2.10
|
|
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.
|
|
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.10";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.
|
|
3
|
+
"version": "3.2.10",
|
|
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.
|
|
72
|
-
"ranges-merge": "^8.2.
|
|
71
|
+
"ranges-apply": "^6.2.10",
|
|
72
|
+
"ranges-merge": "^8.2.5"
|
|
73
73
|
}
|
|
74
74
|
}
|
package/examples/_quickTake.js
DELETED
|
@@ -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
|
-
]);
|