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 🙏

© 2025 – Pkg Stats / Ryan Hefner

blunt

v1.0.1

Published

javascript template engine

Readme

Blast

高效的javascript模板引擎

安装

npm install blast --save

如果在web站点上使用,直接引入blast.js即可

<script src="./dist/blast.js"></script>

使用

<div id="container"></div>
<script>
    const compile = Blast('<div>Hello  {{= Name}}</div>');
    const res = compile({Name: "Blast"});
    document.getElementById('container').innerHTML = res;
</script>

参数 / 方法

Blast.render(id:String, data:Object, option:Object)

Blast()的别名函数

| 参数 | 类型 | 说明 | | ------- |:------------: | -----:| | id | String | 模板ID | | data | Object | 数据对象 | | option | Object | 参数对象

Blast.compile(id:String, option:Object)

编译模板,并返回一个函数

| 参数 | 类型 | 说明 | | ------- |:------------: | -----:| | id | String | 模板ID | | option | Object | 参数对象

Blast.Config

全局参数对象

| 参数 | 类型 | 说明 | | ------- |:--------: | -----:| | debug | Boolean | 调试模式,默认值true | | cache | Boolean | 缓存,默认值true | | startTag| String | 表达式开始标记 | | endTag| String | 表达式结束标记 | | extname| String | 模板扩展名 | | ignore| Object | 编译模板时跳过的变量名

比如编译时要跳过一个变量名 var

Blast.Config['var'] = true;

Blast.Filter

过滤器对象,用于自定义过滤器,比如我们现在要定义一个将字符转换为大写的过滤器

Blast.Filter.toUpperCase = (data) => {
    let ret = data;
    if( typeof data === 'string' ) {
        ret = data.toUpperCase();
    }
    return ret;
}

使用方式如下

{{= Name | toUpperCase}}

Blast.Cache

缓存操作类

let ca = new Cache();
ca.set('blast', '高效的Javascript模板引擎');
console.log( ca.get('blast') );

| 方法 | 参数 | 说明 | | ------- |:------------------------------: | -----:| | set | (key:String, value:Any) | 设置缓存 | | get | (key:String) | 缓存,默认值true | | detail| (key:String, callback:Function) | 查找key对应的缓存,如果没有则设置

捐赠

微信      支付宝