aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/helpers/handlebars/unlessLength.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/sonar-web/src/main/js/helpers/handlebars/unlessLength.js')
-rw-r--r--server/sonar-web/src/main/js/helpers/handlebars/unlessLength.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/server/sonar-web/src/main/js/helpers/handlebars/unlessLength.js b/server/sonar-web/src/main/js/helpers/handlebars/unlessLength.js
new file mode 100644
index 00000000000..2c55bdbd49c
--- /dev/null
+++ b/server/sonar-web/src/main/js/helpers/handlebars/unlessLength.js
@@ -0,0 +1,6 @@
+import _ from 'underscore';
+
+module.exports = function (array, len, options) {
+ var cond = _.isArray(array) && array.length === +len;
+ return cond ? options.inverse(this) : options.fn(this);
+};