string-process-comma-separated 3.0.12 → 3.0.13

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,6 +3,12 @@
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
+ ## 3.0.13 (2022-04-18)
7
+
8
+ ### Bug Fixes
9
+
10
+ - tweak the types ([9f5bddb](https://github.com/codsen/codsen/commit/9f5bddbf84173e51214a4c4ea75c527df0297a70))
11
+
6
12
  ## 3.0.0 (2021-09-09)
7
13
 
8
14
  ### Features
package/README.md CHANGED
@@ -26,7 +26,7 @@
26
26
 
27
27
  ## Install
28
28
 
29
- The latest version is **ESM only**: Node 12+ is needed to use it and it must be `import`ed instead of `require`d. If your project is not on ESM yet and you want to use `require`, use an older version of this program, `2.1.0`.
29
+ This package is [pure ESM](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c). If you're not ready yet, install an older version of this program, 2.1.0 (`npm i string-process-comma-separated@2.1.0`).
30
30
 
31
31
  ```bash
32
32
  npm i string-process-comma-separated
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * @name string-process-comma-separated
3
3
  * @fileoverview Extracts chunks from possibly comma or whatever-separated string
4
- * @version 3.0.12
4
+ * @version 3.0.13
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/string-process-comma-separated/}
8
8
  */
9
9
 
10
- var $="3.0.12";var y=$;function E(o,a){if(typeof o!="string")throw new Error(`string-process-comma-separated: [THROW_ID_01] input must be string! It was given as ${typeof o}, equal to:
11
- ${JSON.stringify(o,null,4)}`);if(!o.length||!a||!a.cb&&!a.errCb)return;let e={...{from:0,to:o.length,offset:0,leadingWhitespaceOK:!1,trailingWhitespaceOK:!1,oneSpaceAfterCommaOK:!1,innerWhitespaceAllowed:!1,separator:",",cb:null,errCb:null},...a};Number.isInteger(a.from)||(e.from=0),Number.isInteger(a.to)||(e.to=o.length),Number.isInteger(a.offset)||(e.offset=0);let i=null,s=null,u=!1,l=[],f=null,n=!0;for(let t=e.from;t<e.to;t++){if(o[t].trim()&&o[t]!==e.separator&&(f=t),i===null&&o[t].trim()&&(!e.separator||o[t]!==e.separator)&&(u||(u=!0),l.length&&(l.length>1&&l.forEach((r,p)=>{p&&e.errCb([[r+e.offset,r+1+e.offset]],"Remove separator.",n)}),l=[]),i=t),Number.isInteger(i)&&(t>i&&e.separator&&o[t]===e.separator||t+1===e.to)){let r=o.slice(i,t+1===e.to&&o[t]!==e.separator&&o[t].trim()?t+1:t);typeof e.cb=="function"&&e.cb(i+e.offset,(t+1===e.to&&o[t]!==e.separator&&o[t].trim()?t+1:f+1)+e.offset),i=null}if(!o[t].trim()&&s===null&&(s=t),s!==null&&(o[t].trim()||t+1===e.to)){if(s===e.from)!e.leadingWhitespaceOK&&typeof e.errCb=="function"&&e.errCb([[s+e.offset,(t+1===e.to?t+1:t)+e.offset]],"Remove whitespace.",n);else if(!o[t].trim()&&t+1===e.to)!e.trailingWhitespaceOK&&typeof e.errCb=="function"&&e.errCb([[s+e.offset,t+1+e.offset]],"Remove whitespace.",n);else if((!e.oneSpaceAfterCommaOK||!(o[t].trim()&&t>e.from+1&&o[t-1]===" "&&o[t-2]===","))&&(!e.innerWhitespaceAllowed||!(u&&o[s-1]&&o[t].trim()&&o[t]!==e.separator&&o[s-1]!==e.separator))){let r=s,p=t;t+1===e.to&&o[t]!==e.separator&&!o[t].trim()&&(p+=1);let m="";e.oneSpaceAfterCommaOK&&(o[s]===" "&&o[s-1]===e.separator?r+=1:o[s]!==" "&&(m=" "));let c="Remove whitespace.";!e.innerWhitespaceAllowed&&u&&o[s-1]&&o[t].trim()&&o[t]!==e.separator&&o[s-1]!==e.separator&&(n=!1,c="Bad whitespace."),m.length?e.errCb([[r+e.offset,p+e.offset,m]],c,n):e.errCb([[r+e.offset,p+e.offset]],c,n),n=!0}s=null}o[t]===e.separator&&(u?l.push(t):e.errCb([[t+e.offset,t+1+e.offset]],"Remove separator.",n)),t+1===e.to&&l.forEach(r=>{e.errCb([[r+e.offset,r+1+e.offset]],"Remove separator.",n)})}}export{E as processCommaSep,y as version};
10
+ var $="3.0.13";var O=$;function y(s,a){if(typeof s!="string")throw new Error(`string-process-comma-separated: [THROW_ID_01] input must be string! It was given as ${typeof s}, equal to:
11
+ ${JSON.stringify(s,null,4)}`);if(!s.length||!a||!a.cb&&!a.errCb)return;let e={...{from:0,to:s.length,offset:0,leadingWhitespaceOK:!1,trailingWhitespaceOK:!1,oneSpaceAfterCommaOK:!1,innerWhitespaceAllowed:!1,separator:",",cb:null,errCb:null},...a};Number.isInteger(a.from)||(e.from=0),Number.isInteger(a.to)||(e.to=s.length),Number.isInteger(a.offset)||(e.offset=0);let l=null,o=null,u=!1,i=[],f=null,n=!0;for(let t=e.from;t<e.to;t++){if(s[t].trim()&&s[t]!==e.separator&&(f=t),l===null&&s[t].trim()&&(!e.separator||s[t]!==e.separator)&&(u||(u=!0),i.length&&(i.length>1&&i.forEach((r,p)=>{p&&e.errCb([[r+e.offset,r+1+e.offset]],"Remove separator.",n)}),i=[]),l=t),Number.isInteger(l)&&(t>l&&e.separator&&s[t]===e.separator||t+1===e.to)){let r=s.slice(l,t+1===e.to&&s[t]!==e.separator&&s[t].trim()?t+1:t);typeof e.cb=="function"&&e.cb(l+e.offset,(t+1===e.to&&s[t]!==e.separator&&s[t].trim()?t+1:f+1)+e.offset),l=null}if(!s[t].trim()&&o===null&&(o=t),o!==null&&(s[t].trim()||t+1===e.to)){if(o===e.from)!e.leadingWhitespaceOK&&typeof e.errCb=="function"&&e.errCb([[o+e.offset,(t+1===e.to?t+1:t)+e.offset]],"Remove whitespace.",n);else if(!s[t].trim()&&t+1===e.to)!e.trailingWhitespaceOK&&typeof e.errCb=="function"&&e.errCb([[o+e.offset,t+1+e.offset]],"Remove whitespace.",n);else if((!e.oneSpaceAfterCommaOK||!(s[t].trim()&&t>e.from+1&&s[t-1]===" "&&s[t-2]===","))&&(!e.innerWhitespaceAllowed||!(u&&s[o-1]&&s[t].trim()&&s[t]!==e.separator&&s[o-1]!==e.separator))){let r=o,p=t;t+1===e.to&&s[t]!==e.separator&&!s[t].trim()&&(p+=1);let m="";e.oneSpaceAfterCommaOK&&(s[o]===" "&&s[o-1]===e.separator?r+=1:s[o]!==" "&&(m=" "));let c="Remove whitespace.";!e.innerWhitespaceAllowed&&u&&s[o-1]&&s[t].trim()&&s[t]!==e.separator&&s[o-1]!==e.separator&&(n=!1,c="Bad whitespace."),m.length?e.errCb([[r+e.offset,p+e.offset,m]],c,n):e.errCb([[r+e.offset,p+e.offset]],c,n),n=!0}o=null}s[t]===e.separator&&(u?i.push(t):e.errCb([[t+e.offset,t+1+e.offset]],"Remove separator.",n)),t+1===e.to&&i.forEach(r=>{e.errCb([[r+e.offset,r+1+e.offset]],"Remove separator.",n)})}}export{y as processCommaSep,O as version};
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * @name string-process-comma-separated
3
3
  * @fileoverview Extracts chunks from possibly comma or whatever-separated string
4
- * @version 3.0.12
4
+ * @version 3.0.13
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/string-process-comma-separated/}
8
8
  */
9
9
 
10
- var stringProcessCommaSeparated=(()=>{var c=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames,h=Object.getOwnPropertySymbols;var d=Object.prototype.hasOwnProperty,A=Object.prototype.propertyIsEnumerable;var y=(t,s,r)=>s in t?c(t,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[s]=r,b=(t,s)=>{for(var r in s||(s={}))d.call(s,r)&&y(t,r,s[r]);if(h)for(var r of h(s))A.call(s,r)&&y(t,r,s[r]);return t};var C=t=>c(t,"__esModule",{value:!0});var w=(t,s)=>{for(var r in s)c(t,r,{get:s[r],enumerable:!0})},D=(t,s,r,e)=>{if(s&&typeof s=="object"||typeof s=="function")for(let a of N(s))!d.call(t,a)&&(r||a!=="default")&&c(t,a,{get:()=>s[a],enumerable:!(e=S(s,a))||e.enumerable});return t};var O=(t=>(s,r)=>t&&t.get(s)||(r=D(C({}),s,1),t&&t.set(s,r),r))(typeof WeakMap!="undefined"?new WeakMap:0);var x={};w(x,{processCommaSep:()=>I,version:()=>v});var E="3.0.12";var v=E;function I(t,s){if(typeof t!="string")throw new Error(`string-process-comma-separated: [THROW_ID_01] input must be string! It was given as ${typeof t}, equal to:
11
- ${JSON.stringify(t,null,4)}`);if(!t.length||!s||!s.cb&&!s.errCb)return;let r={from:0,to:t.length,offset:0,leadingWhitespaceOK:!1,trailingWhitespaceOK:!1,oneSpaceAfterCommaOK:!1,innerWhitespaceAllowed:!1,separator:",",cb:null,errCb:null},e=b(b({},r),s);Number.isInteger(s.from)||(e.from=0),Number.isInteger(s.to)||(e.to=t.length),Number.isInteger(s.offset)||(e.offset=0);let a=null,n=null,p=!1,u=[],g=null,l=!0;for(let o=e.from;o<e.to;o++){if(t[o].trim()&&t[o]!==e.separator&&(g=o),a===null&&t[o].trim()&&(!e.separator||t[o]!==e.separator)&&(p||(p=!0),u.length&&(u.length>1&&u.forEach((i,m)=>{m&&e.errCb([[i+e.offset,i+1+e.offset]],"Remove separator.",l)}),u=[]),a=o),Number.isInteger(a)&&(o>a&&e.separator&&t[o]===e.separator||o+1===e.to)){let i=t.slice(a,o+1===e.to&&t[o]!==e.separator&&t[o].trim()?o+1:o);typeof e.cb=="function"&&e.cb(a+e.offset,(o+1===e.to&&t[o]!==e.separator&&t[o].trim()?o+1:g+1)+e.offset),a=null}if(!t[o].trim()&&n===null&&(n=o),n!==null&&(t[o].trim()||o+1===e.to)){if(n===e.from)!e.leadingWhitespaceOK&&typeof e.errCb=="function"&&e.errCb([[n+e.offset,(o+1===e.to?o+1:o)+e.offset]],"Remove whitespace.",l);else if(!t[o].trim()&&o+1===e.to)!e.trailingWhitespaceOK&&typeof e.errCb=="function"&&e.errCb([[n+e.offset,o+1+e.offset]],"Remove whitespace.",l);else if((!e.oneSpaceAfterCommaOK||!(t[o].trim()&&o>e.from+1&&t[o-1]===" "&&t[o-2]===","))&&(!e.innerWhitespaceAllowed||!(p&&t[n-1]&&t[o].trim()&&t[o]!==e.separator&&t[n-1]!==e.separator))){let i=n,m=o;o+1===e.to&&t[o]!==e.separator&&!t[o].trim()&&(m+=1);let f="";e.oneSpaceAfterCommaOK&&(t[n]===" "&&t[n-1]===e.separator?i+=1:t[n]!==" "&&(f=" "));let $="Remove whitespace.";!e.innerWhitespaceAllowed&&p&&t[n-1]&&t[o].trim()&&t[o]!==e.separator&&t[n-1]!==e.separator&&(l=!1,$="Bad whitespace."),f.length?e.errCb([[i+e.offset,m+e.offset,f]],$,l):e.errCb([[i+e.offset,m+e.offset]],$,l),l=!0}n=null}t[o]===e.separator&&(p?u.push(o):e.errCb([[o+e.offset,o+1+e.offset]],"Remove separator.",l)),o+1===e.to&&u.forEach(i=>{e.errCb([[i+e.offset,i+1+e.offset]],"Remove separator.",l)})}}return O(x);})();
10
+ var stringProcessCommaSeparated=(()=>{var c=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames,g=Object.getOwnPropertySymbols;var O=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable;var h=(t,o,r)=>o in t?c(t,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[o]=r,b=(t,o)=>{for(var r in o||(o={}))O.call(o,r)&&h(t,r,o[r]);if(g)for(var r of g(o))S.call(o,r)&&h(t,r,o[r]);return t};var N=(t,o)=>{for(var r in o)c(t,r,{get:o[r],enumerable:!0})},A=(t,o,r,e)=>{if(o&&typeof o=="object"||typeof o=="function")for(let a of v(o))!O.call(t,a)&&a!==r&&c(t,a,{get:()=>o[a],enumerable:!(e=E(o,a))||e.enumerable});return t};var C=t=>A(c({},"__esModule",{value:!0}),t);var I={};N(I,{processCommaSep:()=>V,version:()=>D});var y="3.0.13";var D=y;function V(t,o){if(typeof t!="string")throw new Error(`string-process-comma-separated: [THROW_ID_01] input must be string! It was given as ${typeof t}, equal to:
11
+ ${JSON.stringify(t,null,4)}`);if(!t.length||!o||!o.cb&&!o.errCb)return;let r={from:0,to:t.length,offset:0,leadingWhitespaceOK:!1,trailingWhitespaceOK:!1,oneSpaceAfterCommaOK:!1,innerWhitespaceAllowed:!1,separator:",",cb:null,errCb:null},e=b(b({},r),o);Number.isInteger(o.from)||(e.from=0),Number.isInteger(o.to)||(e.to=t.length),Number.isInteger(o.offset)||(e.offset=0);let a=null,n=null,p=!1,u=[],d=null,i=!0;for(let s=e.from;s<e.to;s++){if(t[s].trim()&&t[s]!==e.separator&&(d=s),a===null&&t[s].trim()&&(!e.separator||t[s]!==e.separator)&&(p||(p=!0),u.length&&(u.length>1&&u.forEach((l,m)=>{m&&e.errCb([[l+e.offset,l+1+e.offset]],"Remove separator.",i)}),u=[]),a=s),Number.isInteger(a)&&(s>a&&e.separator&&t[s]===e.separator||s+1===e.to)){let l=t.slice(a,s+1===e.to&&t[s]!==e.separator&&t[s].trim()?s+1:s);typeof e.cb=="function"&&e.cb(a+e.offset,(s+1===e.to&&t[s]!==e.separator&&t[s].trim()?s+1:d+1)+e.offset),a=null}if(!t[s].trim()&&n===null&&(n=s),n!==null&&(t[s].trim()||s+1===e.to)){if(n===e.from)!e.leadingWhitespaceOK&&typeof e.errCb=="function"&&e.errCb([[n+e.offset,(s+1===e.to?s+1:s)+e.offset]],"Remove whitespace.",i);else if(!t[s].trim()&&s+1===e.to)!e.trailingWhitespaceOK&&typeof e.errCb=="function"&&e.errCb([[n+e.offset,s+1+e.offset]],"Remove whitespace.",i);else if((!e.oneSpaceAfterCommaOK||!(t[s].trim()&&s>e.from+1&&t[s-1]===" "&&t[s-2]===","))&&(!e.innerWhitespaceAllowed||!(p&&t[n-1]&&t[s].trim()&&t[s]!==e.separator&&t[n-1]!==e.separator))){let l=n,m=s;s+1===e.to&&t[s]!==e.separator&&!t[s].trim()&&(m+=1);let f="";e.oneSpaceAfterCommaOK&&(t[n]===" "&&t[n-1]===e.separator?l+=1:t[n]!==" "&&(f=" "));let $="Remove whitespace.";!e.innerWhitespaceAllowed&&p&&t[n-1]&&t[s].trim()&&t[s]!==e.separator&&t[n-1]!==e.separator&&(i=!1,$="Bad whitespace."),f.length?e.errCb([[l+e.offset,m+e.offset,f]],$,i):e.errCb([[l+e.offset,m+e.offset]],$,i),i=!0}n=null}t[s]===e.separator&&(p?u.push(s):e.errCb([[s+e.offset,s+1+e.offset]],"Remove separator.",i)),s+1===e.to&&u.forEach(l=>{e.errCb([[l+e.offset,l+1+e.offset]],"Remove separator.",i)})}}return C(I);})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "string-process-comma-separated",
3
- "version": "3.0.12",
3
+ "version": "3.0.13",
4
4
  "description": "Extracts chunks from possibly comma or whatever-separated string",
5
5
  "keywords": [
6
6
  "characters",
package/types/index.d.ts CHANGED
@@ -16,9 +16,6 @@ interface Opts {
16
16
  cb: null | ((from: number, to: number) => void);
17
17
  errCb: null | ErrCb;
18
18
  }
19
- declare function processCommaSep(
20
- str: string,
21
- originalOpts?: Partial<Opts>
22
- ): void;
19
+ declare function processCommaSep(str: string, opts?: Partial<Opts>): void;
23
20
 
24
21
  export { processCommaSep, version };