Socket
Socket
Sign inDemoInstall

template-bind-helpers

Package Overview
Dependencies
2
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    template-bind-helpers

Bind the current instance of a Templates-based application to an object of helpers, allowing them to be passed to a different render method.


Version published
Maintainers
1
Install size
18.6 kB
Created

Readme

Source

template-bind-helpers NPM version Build Status

Bind the current instance of a Templates-based application to an object of helpers, allowing them to be passed to a different render method.

Install

Install with npm

$ npm i template-bind-helpers --save

Usage

bindHelpers

Bind helper functions to app so that, when the helper is called, the this keyword is set to the provided instance of app.

Params

  • app {Object}: Instance of any [Templates-based][templates] application, such as verb, assemble or generate
  • view {Object}: The view being compiled or rendered
  • locals {Object}: Context object with helpers to bind. This is usually the options object.
  • isAsync {Boolean}
  • returns {Object}

Example

var bindHelpers = require('{%= name %}');
var str = '<%= replace("foo", "bar") %>';
opts = bindHelpers(this.app, opts, true);

// pass opts to a render method as context
app.render(str, opts, function(err, result) {
  console.log(result);
});

Running tests

Install dev dependencies:

$ npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Author

Jon Schlinkert

License

Copyright © 2015 Jon Schlinkert Released under the MIT license.


This file was generated by verb on December 11, 2015.

Keywords

FAQs

Last updated on 11 Dec 2015

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