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 +5 -5
- package/dist/ranges-iterate.esm.js +2 -2
- package/dist/ranges-iterate.umd.js +2 -2
- package/package.json +13 -13
- package/types/index.d.ts +3 -3
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
|
-
|
|
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
|
-
|
|
8
|
+
**Note:** Version bump only for package ranges-iterate
|
|
9
9
|
|
|
10
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
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
|
|
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.
|
|
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
|
|
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.
|
|
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' &&
|
|
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' &&
|
|
41
|
-
"devtest": "c8
|
|
42
|
-
"dts": "rollup -c &&
|
|
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' &&
|
|
45
|
-
"letspublish": "
|
|
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
|
-
"
|
|
48
|
+
"prep": "echo 'ready'",
|
|
49
49
|
"prettier": "prettier",
|
|
50
|
-
"prettier:format": "prettier --write '**/*.{ts,tsx,md}' --no-error-on-unmatched-pattern",
|
|
51
|
-
"pretest": "
|
|
52
|
-
"test": "
|
|
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.
|
|
74
|
-
"ranges-merge": "^9.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
|
-
|
|
1
|
+
type Range =
|
|
2
2
|
| [from: number, to: number]
|
|
3
3
|
| [from: number, to: number, whatToInsert: string | null | undefined];
|
|
4
|
-
|
|
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
|
-
|
|
11
|
+
type Callback = (obj: Obj) => void;
|
|
12
12
|
declare function rIterate(
|
|
13
13
|
str: string,
|
|
14
14
|
input: Ranges,
|