🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

tlsp

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

tlsp

A lightweight JavaScript template string library with zero third-party dependencies

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
2
-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

Tlsp

简体中文
A lightweight JavaScript template string library with zero third-party dependencies

  • Entire codebase < 1kb
  • Supports function calls, numeric calculations, and other operations just like in JavaScript
  • Allows custom template string formats (supports wildcards)
  • Environmentally secure—by default, template strings cannot access Node.js's require function

Examples

var TemplateString = require("tlsp")  

// Quick Start  
var result = TemplateString.templateString(  
 "Member Data ----- \  
  \nName: ${ name.split(' ').join('-') } \  
  \nAge: ${ getAge() } \  
  \nSex: ${ boy ? 'boy' : 'girl' }", {  
    name: "Any Body",  
    boy: true,  
    getAge: () => 114514  
  }  
)  

console.log(result)  
console.log("")  

// Custom  
var tlsp = new TemplateString  
tlsp.format = "<?node*?>"  
tlsp.context = {  
  apple: {  
    en: "Apple",  
    zh: "林檎("  
  },  
  lang: "zh"  
}  
result = tlsp.generate("lang.apple.name = <?node apple[lang] ?>")  
console.log(result);  

Keywords

template

FAQs

Package last updated on 07 Aug 2025

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