Socket
Socket
Sign inDemoInstall

a-template

Package Overview
Dependencies
3
Maintainers
2
Versions
48
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    a-template

Simple Template Engine


Version published
Weekly downloads
354
decreased by-43.18%
Maintainers
2
Install size
485 kB
Created
Weekly downloads
 

Readme

Source

a-template.js

Simple Template Engine used for gulp-generator

example

<script id="search" type="text/template">
   <input type="text" data-bind="search" data-action-input="update">
   <ul>
       <!-- BEGIN result:loop -->
       <li>{name}-{id}</li>
       <!-- END result:loop -->
   </ul>
</script>
<script>
var list = new aTemplate({
templates:["search"],
data:{
   search:"",
   list:[
       {name:"tomomi",id:0},
       {name:"daigo",id:1112},
       {name:"taro",id:11113},
       {name:"koike",id:1114},
       {name:"aboki",id:1115},
       {name:"tetsuro",id:1116},
       {name:"takahashi",id:1117},
       {name:"suzuki",id:1118},
       {name:"okazaki",id:1119},
       {name:"aoi",id:1120},
   ],
   result:function(){
       var search = this.data.search;
       var list = this.data.list;
       return list.filter(function(str){
	   var id = str.id+"";
	   return str.name.indexOf(search) >= 0 || id.indexOf(search) >= 0;
       });
   }
},
}).update();
</script>

FAQs

Last updated on 03 Feb 2020

Did you know?

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc