npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@dtyq/es6-template-strings

v0.0.5

Published

Lightweight ES6 template string engine for dynamic string interpolation.

Downloads

264

Readme

@dtyq/es6-template-strings

ES6 字符串模板解析引擎

license NPM Version codecov

概述

本包提供了一个支持 ES6 风格语法的模板字符串解析引擎。它允许你使用 ${expression} 语法在字符串中插入变量和表达式。

用法

import { resolveToString, resolveToArray } from "@dtyq/es6-template-strings";

// 基本用法
console.log(resolveToString("hello ${name}", { name: "world" }));
// 输出: "hello world"

// 返回模板部分和替换值的数组
console.log(resolveToArray("hello ${name}", { name: "world" }));
// 输出: ["hello ", "world"]

配置选项

| 选项 | 描述 | 类型 | 默认值 | 是否必填 | |:-------------:|:---------------:|:-----:|:-----:|:-------:| | notation | 模板语法前缀符号 | string | "$" | 否 | | notationStart | 模板语法开始标记 | string | "{" | 否 | | notationEnd | 模板语法结束标记 | string | "}" | 否 | | partial | 是否跳过解析失败的表达式 | boolean | false | 否 |

注意事项

  • 当表达式无法解析时:
    • 如果 partial: true,将保留原始 ${expression} 字符串
    • 如果 partial: false(默认值),对应表达式将返回 undefined
  • 该包能够正确处理嵌套表达式和转义序列

开发模式

设置开发环境:

  1. 克隆仓库
  2. 安装依赖:npm install
  3. 构建包:npm run build
  4. 运行测试:npm test

迭代模式

该包遵循语义化版本规范:

  1. 错误修复导致补丁版本增加
  2. 保持向后兼容性的新功能导致次要版本增加
  3. 破坏性变更导致主要版本增加

贡献流程:

  1. Fork 仓库
  2. 创建功能分支
  3. 提交拉取请求,详细描述更改