string-process-comma-separated 4.1.0 → 4.1.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,7 +3,7 @@
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.1.0 (2023-05-13)
6
+ ## 4.1.0 (2023-05-13)
7
7
 
8
8
  ### Features
9
9
 
@@ -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 4.1.0
4
+ * @version 4.1.2
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 $="4.1.0";var O=$;function E(s,l){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:
10
+ var $="4.1.2";var O=$;function E(s,l){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
11
  ${JSON.stringify(s,null,4)}`);if(!s.length||!l||!l.cb&&!l.errCb)return;let e={...{from:0,to:s.length,offset:0,leadingWhitespaceOK:!1,trailingWhitespaceOK:!1,oneSpaceAfterCommaOK:!1,innerWhitespaceAllowed:!1,separator:",",cb:null,errCb:null},...l};Number.isInteger(l.from)||(e.from=0),Number.isInteger(l.to)||(e.to=s.length),Number.isInteger(l.offset)||(e.offset=0);let i=null,o=null,p=!1,a=[],f=null,n=!0;for(let t=e.from;t<e.to;t++){if(s[t].trim()&&s[t]!==e.separator&&(f=t),i===null&&s[t].trim()&&(!e.separator||s[t]!==e.separator)&&(p||(p=!0),a.length&&(a.length>1&&a.forEach((r,m)=>{m&&e.errCb&&e.errCb([[r+e.offset,r+1+e.offset]],"Remove separator.",n)}),a=[]),i=t),Number.isInteger(i)&&(t>i&&e.separator&&s[t]===e.separator||t+1===e.to)){let r=s.slice(i,t+1===e.to&&s[t]!==e.separator&&s[t].trim()?t+1:t);typeof e.cb=="function"&&e.cb(i+e.offset,(t+1===e.to&&s[t]!==e.separator&&s[t].trim()?t+1:f+1)+e.offset),i=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||!(p&&s[o-1]&&s[t].trim()&&s[t]!==e.separator&&s[o-1]!==e.separator))){let r=o,m=t;t+1===e.to&&s[t]!==e.separator&&!s[t].trim()&&(m+=1);let u="";e.oneSpaceAfterCommaOK&&(s[o]===" "&&s[o-1]===e.separator?r+=1:s[o]!==" "&&(u=" "));let c="Remove whitespace.";!e.innerWhitespaceAllowed&&p&&s[o-1]&&s[t].trim()&&s[t]!==e.separator&&s[o-1]!==e.separator&&(n=!1,c="Bad whitespace."),u.length&&e.errCb?e.errCb([[r+e.offset,m+e.offset,u]],c,n):e.errCb&&e.errCb([[r+e.offset,m+e.offset]],c,n),n=!0}o=null}s[t]===e.separator&&(!p&&e.errCb?e.errCb([[t+e.offset,t+1+e.offset]],"Remove separator.",n):a.push(t)),t+1===e.to&&e.errCb&&a.forEach(r=>{e.errCb([[r+e.offset,r+1+e.offset]],"Remove separator.",n)})}}export{E 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 4.1.0
4
+ * @version 4.1.2
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
- "use strict";var stringProcessCommaSeparated=(()=>{var c=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames,g=Object.getOwnPropertySymbols;var O=Object.prototype.hasOwnProperty,N=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))N.call(o,r)&&h(t,r,o[r]);return t};var y=(t,o)=>{for(var r in o)c(t,r,{get:o[r],enumerable:!0})},C=(t,o,r,e)=>{if(o&&typeof o=="object"||typeof o=="function")for(let l of v(o))!O.call(t,l)&&l!==r&&c(t,l,{get:()=>o[l],enumerable:!(e=S(o,l))||e.enumerable});return t};var A=t=>C(c({},"__esModule",{value:!0}),t);var x={};y(x,{processCommaSep:()=>V,version:()=>D});var E="4.1.0";var D=E;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:
10
+ "use strict";var stringProcessCommaSeparated=(()=>{var c=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames,g=Object.getOwnPropertySymbols;var O=Object.prototype.hasOwnProperty,N=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))N.call(o,r)&&h(t,r,o[r]);return t};var y=(t,o)=>{for(var r in o)c(t,r,{get:o[r],enumerable:!0})},C=(t,o,r,e)=>{if(o&&typeof o=="object"||typeof o=="function")for(let l of v(o))!O.call(t,l)&&l!==r&&c(t,l,{get:()=>o[l],enumerable:!(e=S(o,l))||e.enumerable});return t};var A=t=>C(c({},"__esModule",{value:!0}),t);var x={};y(x,{processCommaSep:()=>V,version:()=>D});var E="4.1.2";var D=E;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
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 l=null,n=null,m=!1,p=[],d=null,a=!0;for(let s=e.from;s<e.to;s++){if(t[s].trim()&&t[s]!==e.separator&&(d=s),l===null&&t[s].trim()&&(!e.separator||t[s]!==e.separator)&&(m||(m=!0),p.length&&(p.length>1&&p.forEach((i,u)=>{u&&e.errCb&&e.errCb([[i+e.offset,i+1+e.offset]],"Remove separator.",a)}),p=[]),l=s),Number.isInteger(l)&&(s>l&&e.separator&&t[s]===e.separator||s+1===e.to)){let i=t.slice(l,s+1===e.to&&t[s]!==e.separator&&t[s].trim()?s+1:s);typeof e.cb=="function"&&e.cb(l+e.offset,(s+1===e.to&&t[s]!==e.separator&&t[s].trim()?s+1:d+1)+e.offset),l=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.",a);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.",a);else if((!e.oneSpaceAfterCommaOK||!(t[s].trim()&&s>e.from+1&&t[s-1]===" "&&t[s-2]===","))&&(!e.innerWhitespaceAllowed||!(m&&t[n-1]&&t[s].trim()&&t[s]!==e.separator&&t[n-1]!==e.separator))){let i=n,u=s;s+1===e.to&&t[s]!==e.separator&&!t[s].trim()&&(u+=1);let f="";e.oneSpaceAfterCommaOK&&(t[n]===" "&&t[n-1]===e.separator?i+=1:t[n]!==" "&&(f=" "));let $="Remove whitespace.";!e.innerWhitespaceAllowed&&m&&t[n-1]&&t[s].trim()&&t[s]!==e.separator&&t[n-1]!==e.separator&&(a=!1,$="Bad whitespace."),f.length&&e.errCb?e.errCb([[i+e.offset,u+e.offset,f]],$,a):e.errCb&&e.errCb([[i+e.offset,u+e.offset]],$,a),a=!0}n=null}t[s]===e.separator&&(!m&&e.errCb?e.errCb([[s+e.offset,s+1+e.offset]],"Remove separator.",a):p.push(s)),s+1===e.to&&e.errCb&&p.forEach(i=>{e.errCb([[i+e.offset,i+1+e.offset]],"Remove separator.",a)})}}return A(x);})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "string-process-comma-separated",
3
- "version": "4.1.0",
3
+ "version": "4.1.2",
4
4
  "description": "Extracts chunks from possibly comma or whatever-separated string",
5
5
  "keywords": [
6
6
  "characters",
@@ -39,7 +39,7 @@
39
39
  "cjs-on": "exit 0",
40
40
  "dev": "DEV=true node '../../ops/scripts/esbuild.js' && npm run dts",
41
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'",
42
+ "dts": "rollup -c && npm run prettier -- 'types/index.d.ts' --write --log-level 'silent'",
43
43
  "examples": "node '../../ops/scripts/run-examples.js'",
44
44
  "lect": "node '../../ops/lect/lect.js' && npm run prettier -- 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
45
45
  "letspublish": "npm publish || :",
@@ -47,7 +47,7 @@
47
47
  "perf": "node perf/check.js",
48
48
  "prep": "echo 'ready'",
49
49
  "prettier": "prettier",
50
- "prettier:format": "npm run prettier -- --write '**/*.{ts,tsx,md}' --no-error-on-unmatched-pattern --loglevel 'silent'",
50
+ "prettier:format": "npm run prettier -- --write '**/*.{ts,tsx,md}' --no-error-on-unmatched-pattern --log-level 'silent'",
51
51
  "pretest": "npm run lect && npm run build",
52
52
  "test": "npm run devtest",
53
53
  "unit": "uvu test"
@@ -70,6 +70,6 @@
70
70
  }
71
71
  },
72
72
  "dependencies": {
73
- "codsen-utils": "^1.5.0"
73
+ "codsen-utils": "^1.6.1"
74
74
  }
75
75
  }
package/types/index.d.ts CHANGED
@@ -4,7 +4,7 @@ declare const version: string;
4
4
  type ErrCb = (
5
5
  indexes: [from: number, to: number, whatToAdd?: JSONValue][],
6
6
  explanation: string,
7
- isFixable: boolean
7
+ isFixable: boolean,
8
8
  ) => void;
9
9
  interface Obj {
10
10
  [key: string]: any;