
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
parse-template
Advanced tools
A very light weight library which allows you to process tokenised strings
Say you have a string like this:
const input = 'Hello ${firstName}'
You can parse it like this:
import { parseTemplate } from 'parse-template'
const meta = { firstName: 'Jess' }
parseTemplate(input, meta) // 'Hello Jess'
npm i --save parse-template
const meta = { user: { firstName: 'Joe' } }
parseTemplate('Hello ${user.firstName}', meta) // 'Hello Joe'
const meta = { guests: [{ firstName: 'Alex'}] }
parseTemplate('Hello ${guests[0].firstName}', meta) // 'Hello Alex'
const meta = { nickName: null, firstName: 'Sam' }
parseTemplate('Hello ${nickname || firstName || "there"}', meta) // 'Hello Sam'
Empty values are replaced with an empty string
const meta = { nickName: null }
parseTemplate('Hello ${nickname}', meta) // 'Hello '
Undefined values are replaced with an empty string
const meta = {}
parseTemplate('Hello ${nickname}', meta) // 'Hello '
The resolved "meta" value must be either a string or a number, otherwise it is ignored. So objects and other non string/number values are ommitted
const meta = { user: { nickName: 'Roger' } }
parseTemplate('Hello ${user}', meta) // 'Hello '
Thanks for the help :) Please open a PR!
npm i
npm test
npm run build
FAQs
A simple and light-weight template parser
The npm package parse-template receives a total of 6 weekly downloads. As such, parse-template popularity was classified as not popular.
We found that parse-template 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.