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

fold

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fold

simple templating library for node and browsers that uses css selectors and plain html

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
35
Maintainers
1
Weekly downloads
 
Created
Source

fold.js

the simplest templating API ever: css selectors for all the things

named after the Scottish Fold cat breed because they are awesome:

scottish fold

also named after that thing you do when making meringue where you fold in egg whites

Client side API

// after loading the fold.js script tag you get a new global variable 'fold'

// fold assumes your templates are in the DOM already, e.g.:
// <div class="template"><div class="foo"></div></div>

// look up the template via query selector and fold in the data
fold('.template', {'.foo': 'bar'})
// => <div class="foo">bar</div>

// or if you have the template string already and don't wanna rely on the DOM
fold({'.foo', "bar"}, '<div class="foo"></div>')
// => <div class="foo">bar</div>

Node API

node doesn't have a DOM so you have to give it an HTML string to use as its fake DOM:

var fold = require('fold')('<div class="template"><div class="foo"></div></div>')
fold('.template', {'.foo', "bar"})
// => <div class="foo">bar</div>

you can also use fold directly without a DOM or fake DOM:

var fold = require('fold')
fold({'.foo', "bar"}, '<div class="foo"></div>')
// => <div class="foo">bar</div>

License

BSD

Keywords

FAQs

Package last updated on 28 Oct 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

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