Skip to content
This repository has been archived by the owner on Oct 16, 2023. It is now read-only.

segmentio/hbs-json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hbs-json

Handlebars helper for JSON.stringify.

Installation

$ npm install hbs-json

Example

var json = require('hbs-json');
var hbs = require('hbs');

hbs.registerHelper('json', json);

app.get('/', function (req, res, next) {
  res.render('index.html', { user: req.context.user });
});
 <script>
    window.user = {{{ json user }}}
  </script>

API

json obj [escaped]

A handlebars helper for JSON.stringify. By default, will escape html characters so that you may use handlebars to render values to the template.

License

WWWWWW||WWWWWW
 W W W||W W W
      ||
    ( OO )__________
     /  |           \
    /o o|    MIT     \
    \___/||_||__||_|| *
         || ||  || ||
        _||_|| _||_||
       (__|__|(__|__|

About

Handlebars helper for JSON.stringify

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •