-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
35 lines (31 loc) · 835 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
'use strict';
var util = require('handlebars-utils');
/**
* Helper that renders the block if **both** of the given values are truthy.
* If an inverse block is specified it will be rendered when falsy. Works as
* a block helper, inline helper or subexpression.
*
* ```handlebars
* <!-- { great: true, magnificent: true } -->
* {{#and great magnificent}} A {{else}} B {{/and}}
* <!-- results in: ' A ' -->
* ```
* @block
* @param {any} `a`
* @param {any} `b`
* @param {Object} `options` Handlebars provided options object
* @return {String}
* @api public
*/
module.exports = function() {
var len = arguments.length - 1;
var options = arguments[len];
var val = true;
for (var i = 0; i < len; i++) {
if (!arguments[i]) {
val = false;
break;
}
}
return util.value(val, this, options);
};