Socket
Book a DemoInstallSign in
Socket

stringin

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

stringin

Programmtically interpolate strings in Javascript.

1.0.0
unpublished
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

stringin logo

stringin

A teeny-weeny utility to programatically interpolate ES6 string templates.

NPM Version Shield NPM Size Shield

Get Started

Install as a dependency in the console:

npm i stringin

Import and use in your JS/TS project:

import interpolate from 'stringin'

// Define your template with '${}'s inside
const template = 'There are ${choreCount} chores to do today'

// Then interpolate with static values
interpolate(template, { choreCount: 4 })
// 'There are 4 chores to do today'

// Or use a function to get a value
interpolate(template, { choreCount: () => 2 + 5 })
// 'There are 7 chores to do today'

Usage

replace (template, data)

Parameters:

NameTypeDescription
templatestringThe template string containing the different ${fieldNames}.
dataObjectThe data to insert into the template.

Returns:

Type: String

FAQs

Package last updated on 17 Mar 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.