StackGenVis: Alignment of Data, Algorithms, and Models for Stacking Ensemble Learning Using Performance Metrics
https://doi.org/10.1109/TVCG.2020.3030352
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
129 lines
3.6 KiB
129 lines
3.6 KiB
4 years ago
|
# helper-cache [](http://badge.fury.io/js/helper-cache) [](https://travis-ci.org/jonschlinkert/helper-cache)
|
||
|
|
||
|
> Easily register and get helper functions to be passed to any template engine or node.js application. Methods for both sync and async helpers.
|
||
|
|
||
|
## Install with [npm](npmjs.org)
|
||
|
|
||
|
```bash
|
||
|
npm i helper-cache --save
|
||
|
```
|
||
|
|
||
|
## Usage
|
||
|
|
||
|
### [HelperCache](index.js#L27)
|
||
|
|
||
|
Create an instance of `HelperCache`, optionally passing default `options`.
|
||
|
|
||
|
* `options` **{Object}**: Default options to use.
|
||
|
- `bind` **{Boolean}**: Bind functions to `this`. Defaults to `false`.
|
||
|
- `thisArg` **{Boolean}**: The context to use.
|
||
|
|
||
|
|
||
|
```js
|
||
|
var HelperCache = require('helper-cache');
|
||
|
var helpers = new HelperCache();
|
||
|
```
|
||
|
|
||
|
### [.addHelper](index.js#L53)
|
||
|
|
||
|
Register a helper.
|
||
|
|
||
|
* `name` **{String}**: The name of the helper.
|
||
|
* `fn` **{Function}**: Helper function.
|
||
|
* `returns` **{Object}**: Return `this` to enable chaining
|
||
|
|
||
|
```js
|
||
|
helpers.addHelper('lower', function(str) {
|
||
|
return str.toLowerCase();
|
||
|
});
|
||
|
```
|
||
|
|
||
|
### [.addAsyncHelper](index.js#L106)
|
||
|
|
||
|
Register an async helper.
|
||
|
|
||
|
* `key` **{String}**: The name of the helper.
|
||
|
* `fn` **{Function}**: Helper function.
|
||
|
* `returns` **{Object}**: Return `this` to enable chaining
|
||
|
|
||
|
```js
|
||
|
helpers.addAsyncHelper('foo', function (str, callback) {
|
||
|
callback(null, str + ' foo');
|
||
|
});
|
||
|
```
|
||
|
|
||
|
### [.addHelpers](index.js#L165)
|
||
|
|
||
|
Load an object of helpers.
|
||
|
|
||
|
* `key` **{String}**: The name of the helper.
|
||
|
* `fn` **{Function}**: Helper function.
|
||
|
* `returns` **{Object}**: Return `this` to enable chaining.
|
||
|
|
||
|
```js
|
||
|
helpers.addHelpers({
|
||
|
a: function() {},
|
||
|
b: function() {},
|
||
|
c: function() {},
|
||
|
});
|
||
|
```
|
||
|
|
||
|
### [.addAsyncHelpers](index.js#L202)
|
||
|
|
||
|
Load an object of async helpers.
|
||
|
|
||
|
* `key` **{String}**: The name of the helper.
|
||
|
* `fn` **{Function}**: Helper function.
|
||
|
* `returns` **{Object}**: Return `this` to enable chaining
|
||
|
|
||
|
```js
|
||
|
helpers.addAsyncHelpers({
|
||
|
a: function() {},
|
||
|
b: function() {},
|
||
|
c: function() {},
|
||
|
});
|
||
|
```
|
||
|
|
||
|
### [.getHelper](index.js#L234)
|
||
|
|
||
|
Get a registered helper.
|
||
|
|
||
|
* `key` **{String}**: The helper to get.
|
||
|
* `returns` **{Object}**: The specified helper. If no `key` is passed, the entire cache is returned.
|
||
|
|
||
|
```js
|
||
|
helpers.getHelper('foo');
|
||
|
```
|
||
|
|
||
|
## Related projects
|
||
|
* [engine-cache](https://github.com/jonschlinkert/engine-cache): express.js inspired template-engine manager.
|
||
|
* [handlebars-helpers](https://github.com/assemble/handlebars-helpers): 120+ Handlebars helpers in ~20 categories, for Assemble, YUI, Ghost… [more](https://github.com/assemble/handlebars-helpers)
|
||
|
* [template-helpers](https://github.com/jonschlinkert/template-helpers): Generic JavaScript helpers that can be used with any template… [more](https://github.com/jonschlinkert/template-helpers)
|
||
|
* [template](https://github.com/jonschlinkert/template): Render templates from any engine. Make custom template types, use… [more](https://github.com/jonschlinkert/template)
|
||
|
|
||
|
## Running tests
|
||
|
Install dev dependencies:
|
||
|
|
||
|
```bash
|
||
|
npm i -d && npm test
|
||
|
```
|
||
|
|
||
|
## Contributing
|
||
|
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/helper-cache/issues)
|
||
|
|
||
|
## Author
|
||
|
**Jon Schlinkert**
|
||
|
|
||
|
+ [github/jonschlinkert](https://github.com/jonschlinkert)
|
||
|
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
|
||
|
|
||
|
## License
|
||
|
Copyright (c) 2014-2015 Jon Schlinkert
|
||
|
Released under the MIT license
|
||
|
|
||
|
***
|
||
|
|
||
|
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on April 23, 2015._
|
||
|
|
||
|
|
||
|
[load-helpers]: https://github.com/assemble/load-helpers
|