Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tie

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tie

A simple templating engine that has no special syntax.

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Tie.js

Licensed under the EUPL V.1.1

Node.js

var cheerio = require('cheerio');
var tie = require('tie').tie;
var html = '<table>\n' +
'  <thead>\n' +
'    <tr>\n' +
'      <th>Date</th>\n' +
'      <th>Activity</th>\n' +
'      <th>Comment</th>\n' +                                                                                                                                                                                                                                     
'      <th>Name</th>\n' +
'    </tr>\n' +
'  </thead>\n' +
'  <tbody class="activities">\n' +
'    <tr>\n' +
'      <td class="date"></td>\n' +
'      <td class="activity"></td>\n' +
'      <td class="comment"></td>\n' +
'      <td class="name"></td>\n' +
'    </tr>\n' +
'  </tbody>\n' +
'</table>'
  
var data = { activities:
             [ { date: '2011-08-23',
                 activity: 'Jogging',
                 comment: 'Early morning run',
                 name: 'Harry Potter' },
               { date: '2011-09-13',
                 activity: 'Gym',
                 comment: 'Chest workout',
                 name: 'Batman' } ] };
  
var $ = cheerio.load(html)
tie($.root(), data)
console.log($.html())

Browser

Be sure to include jQuery or Zepto before Tie

HTML

<table>
  <thead>
    <tr>
      <th>Date</th>
      <th>Activity</th>
      <th>Comment</th>
      <th>Name</th>
    </tr>
  </thead>
  <tbody class="activities">
    <tr>
      <td class="date"></td>
      <td class="activity"></td>
      <td class="comment"></td>
      <td class="name"></td>
    </tr>
  </tbody>
</table>

Javascript

var data = { activities:
             [ { date: '2011-08-23',
                 activity: 'Jogging',
                 comment: 'Early morning run',
                 name: 'Harry Potter' },
               { date: '2011-09-13',
                 activity: 'Gym',
                 comment: 'Chest workout',
                 name: 'Batman' } ] };
  
tie($('table'), data)

Keywords

FAQs

Package last updated on 25 Jul 2013

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc