
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.
bowhead-js
Advanced tools
Tiny string interpolation library, written in TypeScript.
yarn add bowhead-js
import format from 'bowhead-js';
// Index-based arguments.
format('{1} {0} {1}', 1, 'haha'); // 'haha 1 haha'
// Custom functions.
format('{0|uppercase}', 'haha'); // 'HAHA'
// Plurals.
format('{0} {0|countable|fish|fishes}', '1'); // '1 fish';
format('{0} {0|countable|fish|fishes}', '2'); // '2 fishes'
format('{0} {0|countable|fish|fishes}', '0'); // '0 fishes'
// "deer" is both singular and plural.
format('{0} {0|countable|deer}', '1'); // '1 deer'
format('{0} {0|countable|deer}', '2'); // '2 deer'
uppercase
to uppercaselowercase
to lowercasecapitalized
capitalizes first lettercountable
handles pluralsBy default, bowhead-js mutes index-out-of-range errors being thrown and returns error messages in resulting strings, you can disable this behavior by calling muteExceptions
:
import { muteExceptions } from 'bowhead-js';
format('{1} {7}', 23, 'haha'))
// Prints 'haha <7 is out of range>'
muteExceptions(false);
format('{1} {7}', 23, 'haha'))
// Error thrown.
FAQs
Tiny string interpolation library
We found that bowhead-js 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.