# base-helpers

> Adds support for managing template helpers to your base application.

Latest version **1.0.0** (published 2017-04-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install base-helpers
pnpm add base-helpers
yarn add base-helpers
bun add base-helpers
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2017-04-20 |
| First published | 2016-06-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Jon Schlinkert |
| Maintainers | jonschlinkert |
| Keywords | api, app, application, async, base, base-plugin, baseplugin, building-blocks, create, engine, framework, helper, helpers, plugin, plugins, render, template, templates, tool, toolkit, tools |

## Links

- npm: https://www.npmjs.com/package/base-helpers
- Repository: https://github.com/node-base/base-helpers
- Issues: https://github.com/node-base/base-helpers/issues
- npm.io page: https://npm.io/package/base-helpers

## Dependencies (4)

- [debug](https://npm.io/package/debug.md) ^2.6.3
- [isobject](https://npm.io/package/isobject.md) ^3.0.0
- [helper-cache](https://npm.io/package/helper-cache.md) ^1.0.0
- [is-valid-app](https://npm.io/package/is-valid-app.md) ^0.3.0

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2017-04-20
- 0.2.0 — 2017-01-17
- 0.1.1 — 2016-06-10
- 0.1.0 — 2016-06-01

## README

# base-helpers [![NPM version](https://img.shields.io/npm/v/base-helpers.svg?style=flat)](https://www.npmjs.com/package/base-helpers) [![NPM monthly downloads](https://img.shields.io/npm/dm/base-helpers.svg?style=flat)](https://npmjs.org/package/base-helpers)  [![NPM total downloads](https://img.shields.io/npm/dt/base-helpers.svg?style=flat)](https://npmjs.org/package/base-helpers) [![Linux Build Status](https://img.shields.io/travis/node-base/base-helpers.svg?style=flat&label=Travis)](https://travis-ci.org/node-base/base-helpers)

> Adds support for managing template helpers to your base application.

## Install

Install with [npm](https://www.npmjs.com/):

```sh
$ npm install --save base-helpers
```

Install with [yarn](https://yarnpkg.com):

```sh
$ yarn add base-helpers
```

## Usage

Register the plugin with your [base](https://github.com/node-base/base) application:

```js
var Base = require('base');
var helpers = require('base-helpers');
base.use(helpers());
```

## API

### [.helper](index.js#L50)

Register a template helper.

**Params**

* `name` **{String}**: Helper name
* `fn` **{Function}**: Helper function.

**Example**

```js
app.helper('upper', function(str) {
  return str.toUpperCase();
});
```

### [.helpers](index.js#L71)

Register multiple template helpers.

**Params**

* `helpers` **{Object|Array}**: Object, array of objects, or glob patterns.

**Example**

```js
app.helpers({
  foo: function() {},
  bar: function() {},
  baz: function() {}
});
```

### [.asyncHelper](index.js#L93)

Register an async helper.

**Params**

* `name` **{String}**: Helper name.
* `fn` **{Function}**: Helper function

**Example**

```js
app.asyncHelper('upper', function(str, next) {
  next(null, str.toUpperCase());
});
```

### [.asyncHelpers](index.js#L117)

Register multiple async template helpers.

**Params**

* `helpers` **{Object|Array}**: Object, array of objects, or glob patterns.

**Example**

```js
app.asyncHelpers({
  foo: function() {},
  bar: function() {},
  baz: function() {}
});
```

### [.getHelper](index.js#L137)

Get a previously registered helper.

**Params**

* `name` **{String}**: Helper name
* `returns` **{Function}**: Returns the registered helper function.

**Example**

```js
var fn = app.getHelper('foo');
```

### [.getAsyncHelper](index.js#L154)

Get a previously registered async helper.

**Params**

* `name` **{String}**: Helper name
* `returns` **{Function}**: Returns the registered helper function.

**Example**

```js
var fn = app.getAsyncHelper('foo');
```

### [.hasHelper](index.js#L173)

Return true if sync helper `name` is registered.

**Params**

* `name` **{String}**: sync helper name
* `returns` **{Boolean}**: Returns true if the sync helper is registered

**Example**

```js
if (app.hasHelper('foo')) {
  // do stuff
}
```

### [.hasAsyncHelper](index.js#L191)

Return true if async helper `name` is registered.

**Params**

* `name` **{String}**: Async helper name
* `returns` **{Boolean}**: Returns true if the async helper is registered

**Example**

```js
if (app.hasAsyncHelper('foo')) {
  // do stuff
}
```

### [.helperGroup](index.js#L214)

Register a namespaced helper group.

**Params**

* `helpers` **{Object|Array}**: Object, array of objects, or glob patterns.

**Example**

```js
// markdown-utils
app.helperGroup('mdu', {
  foo: function() {},
  bar: function() {},
});

// Usage:
// <%= mdu.foo() %>
// <%= mdu.bar() %>
```

## History

### v1.0.0

* upgrades dependencies to take advantage of improvements to [load-helpers](https://github.com/jonschlinkert/load-helpers) and [helper-cache](https://github.com/jonschlinkert/helper-cache). There shouldn't be any breaking changes here, so if you experience regressions please do not hesitate to [create an issue](../../new).

### v0.2.0

* adds support for passing helper groups as a function. For example, the `log` helper can be a function, but it can also have `log.warning` and `log.info` functions as properties.

## About

### Related projects

* [base-engines](https://www.npmjs.com/package/base-engines): Adds support for managing template engines to your base application. | [homepage](https://github.com/node-base/base-engines "Adds support for managing template engines to your base application.")
* [base-option](https://www.npmjs.com/package/base-option): Adds a few options methods to base, like `option`, `enable` and `disable`. See the readme… [more](https://github.com/node-base/base-option) | [homepage](https://github.com/node-base/base-option "Adds a few options methods to base, like `option`, `enable` and `disable`. See the readme for the full API.")
* [base-task](https://www.npmjs.com/package/base-task): base plugin that provides a very thin wrapper around [https://github.com/doowb/composer](https://github.com/doowb/composer) for adding task methods to… [more](https://github.com/node-base/base-task) | [homepage](https://github.com/node-base/base-task "base plugin that provides a very thin wrapper around <https://github.com/doowb/composer> for adding task methods to your application.")
* [base](https://www.npmjs.com/package/base): Framework for rapidly creating high quality node.js applications, using plugins like building blocks | [homepage](https://github.com/node-base/base "Framework for rapidly creating high quality node.js applications, using plugins like building blocks")

### Contributing

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).

### Building docs

_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_

To generate the readme, run the following command:

```sh
$ npm install -g verbose/verb#dev verb-generate-readme && verb
```

### Running tests

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

```sh
$ npm install && npm test
```

### Author

**Jon Schlinkert**

* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)

### License

Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT License](LICENSE).

***

_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.5.0, on April 20, 2017._

---
_Source: https://npm.io/package/base-helpers · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
