Socket
Book a DemoInstallSign in
Socket

morph-text

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

morph-text

Multiple replaces on String (text) based on a predefined rules defined as a parameter. Useful in cases where a String template is being used. Also it can be a lightweight solution for HTML templates.

latest
Source
npmnpm
Version
1.0.2
Version published
Weekly downloads
1
-75%
Maintainers
1
Weekly downloads
 
Created
Source

morphText

Recursively runs multiple replaces on String (text) based on a predefined rules defined as a parameter. Useful in cases where a String template is being used. Also it can be a lightweight solution for HTML templates.

Usage / Examples

var strMessageTemplate = 'Dear {{name}}, could you {{something}} {{date}}';

morphText(strMessageTemplate,{
	'{{name}}': 'Function',
	'{{something}}': 'replace these texts for me?',
	'{{date}}': new Date()
});

// Returns: "Dear Function, could you replace these texts for me? Sun May 10 2015 01:04:20 GMT-0300 (BRT)""

Installation

For web, just include the main file found under /lib. To be used on Node:

npm install morph-text

Keywords

replace text

FAQs

Package last updated on 10 May 2015

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