New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

codom

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

codom

Mini functional templating

latest
Source
npmnpm
Version
0.0.1
Version published
Weekly downloads
4
300%
Maintainers
1
Weekly downloads
 
Created
Source

Codom - mini functional templating

Codom is a mini functional templating engine. There are only 3 functions. You probably won't use 2 of them.

Getting started

var stuff = co.node('div#content',
              co.node('a#google.linkclass', { href: 'http://google.com' },
                "google!"));

stuff is a string:

<div id="content">
  <a class="linkclass" id="google" href="http://google.com">google!</a>
</div>

Abstractions

Easily build abstractions!

function row(columnRenderers, data) {
  var n = 0;
  return co.node('tr', columnRenderers.map(function(fn){
    return co.node('td#column' + (++n), fn(data));
  }).join(""));
}

function table(meta) {
  var rows = meta.rowData.map(function(rowData){
    return row(meta.renderers, rowData);
  }).join("");
  return co.node("table#myTable", rows);
}

FAQs

Package last updated on 16 Jan 2012

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