
Security News
Package Maintainers Call for Improvements to GitHub’s New npm Security Plan
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
@emmetio/field-parser
Advanced tools
Parses snippet fields (aka tab-stops) like `${1:foo}` in given string
Parses snippet fields (aka tab-stops) like ${1:foo}
in given string and produces a model that contains clean string without fields and list of fields locations.
import parse from '@emmetio/field-parser';
const fieldModel = parse('foo $0 ${1:bar} ${2}${1}');
console.log(fieldModel.string);
// outputs "foo bar "
// `.fields` is array of `{index, location, length}` fields
console.log(fieldModel.fields);
// outputs:
// {index: 0, location: 4, length: 0}
// {index: 1, location: 5, length: 3}
// {index: 2, location: 9, length: 0}
// {index: 1, location: 9, length: 0}
You can also mark string with fields:
import { mark } from '@emmetio/field-parser';
const marked = mark('foo bar', [
{index: 1, location: 0, length: 3},
{index: 5, location: 4, length: 3},
]);
console.log(marked); // ${1:foo} ${5:bar}
...or parse string and then use built-it mark
method:
import parse from '@emmetio/field-parser';
const fieldModel = parse('foo $0 ${1:bar} ${2}${1}');
fieldModel.forEach(field => field.index += 100);
console.log(fieldModel.mark()); // foo $100 ${101:bar} ${102}${101}
FAQs
Parses snippet fields (aka tab-stops) like `${1:foo}` in given string
The npm package @emmetio/field-parser receives a total of 950 weekly downloads. As such, @emmetio/field-parser popularity was classified as not popular.
We found that @emmetio/field-parser 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.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.