
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
string-process-comma-separated
Advanced tools
Extracts chunks from possibly comma or whatever-separated string
Extracts chunks from possibly comma or whatever-separated string
This package is pure ESM. 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
).
npm i string-process-comma-separated
import { strict as assert } from "assert";
import { processCommaSep } from "string-process-comma-separated";
const gatheredChunks = [];
const gatheredErrors = [];
const rawnbsp = "\u00a0";
// it's a callback-interface:
processCommaSep(`<FRAMESET rows=" ,,\t50% ,${rawnbsp} 50% ,\t\t,">`, {
from: 16, // <- beginning of the attribute's value
to: 35, // <- ending of the attribute's value
separator: ",",
cb: (idxFrom, idxTo) => {
gatheredChunks.push([idxFrom, idxTo]);
},
errCb: (ranges, message) => {
gatheredErrors.push({ ranges, message });
},
});
assert.deepEqual(gatheredChunks, [
[20, 23],
[27, 30],
]);
assert.deepEqual(gatheredErrors, [
{ ranges: [[16, 17]], message: "Remove whitespace." },
{ ranges: [[17, 18]], message: "Remove separator." },
{ ranges: [[18, 19]], message: "Remove separator." },
{ ranges: [[19, 20]], message: "Remove whitespace." },
{ ranges: [[23, 24]], message: "Remove whitespace." },
{ ranges: [[25, 27]], message: "Remove whitespace." },
{ ranges: [[30, 31]], message: "Remove whitespace." },
{ ranges: [[32, 34]], message: "Remove whitespace." },
{ ranges: [[31, 32]], message: "Remove separator." },
{ ranges: [[34, 35]], message: "Remove separator." },
]);
Please visit codsen.com for a full description of the API.
To report bugs or request features or assistance, raise an issue on GitHub.
MIT License.
Copyright © 2010-2025 Roy Revelt and other contributors.
FAQs
Extracts chunks from possibly comma or whatever-separated string
The npm package string-process-comma-separated receives a total of 3 weekly downloads. As such, string-process-comma-separated popularity was classified as not popular.
We found that string-process-comma-separated demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.