
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
flat-text-sequencer
Advanced tools
Looking to parse a custom text model, render markdown, or highlight code? Here's a module that chunks text into a sequence of typed ranges by pattern.
sequence('*if only* there was a way to make `this` a __sequence__', [
{ type: 'strong', pattern: /__.+?__/g },
{ type: 'em', pattern: /\*.+?\*/g },
{ type: 'code', pattern: /`.+?`/g }
])
From text to a sequence.
[
{ type: ['em'], data: '*if only*' },
{ type: [], data: ' there was a way to make ' },
{ type: ['code'], data: '`this`' },
{ type: [], data: ' a ' },
{ type: ['strong'], data: '__sequence__' }
]
Install it with npm:
npm install --save flat-text-sequencer
Load the package to your application:
const sequenceText = require('flat-text-sequecner')
And call it with your data:
const sequence = sequenceText(text, patterns)
Flat text sequencer exports a single function with the following signature:
(text: string, patterns: [{ type: string, pattern: RegExp }])
-> [{ type: [string], data: string }]
Joonatan Vuorinen (@bearror)
FAQs
Turns text to a sequence of typed ranges
We found that flat-text-sequencer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.