
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
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 1 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
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.