
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
@peter.naydenov/literal-toolbox
Advanced tools
A collection of tag functions designed to transform string literals into dynamic render functions.
A collection of tag functions designed to transform string literals into dynamic render functions.
npm install @peter.naydenov/literal-toolbox
Use function obj when you will name your placeholders and will provide data as an object.
import literal from '@peter.naydenov/literal-toolbox'
const templateFn = literal.obj`${'greet'} darling ${'name'}, my age is ${'age'}. Great!`
// NOTE: Take a look that the placeholder names are wrapped in quotes!
const htmlSnippet = templateFn({
greet: 'Hello',
name: 'John',
age: 42
})
Use function arr when you will number your placeholders and will provide data as an array. Example:
const templateFn = literal.arr`${0} darling ${1}, my age is ${2}. Great!`
const htmlSnippet = templateFn(['Hello', 'John', 42])
Use function 'arg' when you will number your placeholders and will provide data as separate arguments. Example:
const templateFn = literal.arg`${0} darling ${1}, my age is ${2}. Great!`
const htmlSnippet = templateFn ( 'Hello', 'John', 42 )
In version 1.1.0 and onwards, the obj, arr, and arg functions support functions as arguments. Functions can dynamically evaluate application state or other data to produce a string result. Example:
let loginState = false; // external state
function loginFn() {
return loginState ? '' : 'You need to login first';
}
const fn = literal.obj`Change profile name. ${'login'}`;
let res = fn({ login: loginFn });
// res == 'Change profile name. You need to login first'
loginState = true;
res = fn({ login: loginFn }) // Use exactly the same request
// res == 'Change profile name.'
'@peter.naydenov/literal-toolbox' was created and supported by Peter Naydenov.
'@peter.naydenov/literal-toolbox' is released under the MIT License.
FAQs
A collection of tag functions designed to transform string literals into dynamic render functions.
We found that @peter.naydenov/literal-toolbox demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers 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.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.