string-process-comma-separated 4.1.5 → 4.1.8
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/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2010-
|
|
3
|
+
Copyright (c) 2010-2025 Roy Revelt and other contributors
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
6
|
a copy of this software and associated documentation files (the
|
package/README.md
CHANGED
|
@@ -84,6 +84,6 @@ To report bugs or request features or assistance, [raise an issue](https://githu
|
|
|
84
84
|
|
|
85
85
|
MIT License.
|
|
86
86
|
|
|
87
|
-
Copyright © 2010-
|
|
87
|
+
Copyright © 2010-2025 Roy Revelt and other contributors.
|
|
88
88
|
|
|
89
89
|
<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,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.
|
|
4
|
+
* @version 4.1.8
|
|
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.
|
|
10
|
+
var $="4.1.8";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.
|
|
4
|
+
* @version 4.1.8
|
|
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.
|
|
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.8";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.
|
|
3
|
+
"version": "4.1.8",
|
|
4
4
|
"description": "Extracts chunks from possibly comma or whatever-separated string",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"characters",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"homepage": "https://codsen.com/os/string-process-comma-separated",
|
|
18
18
|
"repository": {
|
|
19
19
|
"type": "git",
|
|
20
|
-
"url": "https://github.com/codsen/codsen.git",
|
|
20
|
+
"url": "git+https://github.com/codsen/codsen.git",
|
|
21
21
|
"directory": "packages/string-process-comma-separated"
|
|
22
22
|
},
|
|
23
23
|
"license": "MIT",
|
|
@@ -43,7 +43,7 @@
|
|
|
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 || :",
|
|
46
|
-
"lint": "eslint . --
|
|
46
|
+
"lint": "eslint . --fix",
|
|
47
47
|
"perf": "node perf/check.js",
|
|
48
48
|
"prep": "echo 'ready'",
|
|
49
49
|
"prettier": "prettier",
|
|
@@ -70,6 +70,6 @@
|
|
|
70
70
|
}
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"codsen-utils": "^1.6.
|
|
73
|
+
"codsen-utils": "^1.6.7"
|
|
74
74
|
}
|
|
75
75
|
}
|