aboutsummaryrefslogtreecommitdiffstats
path: root/core/src/jquery/octemplate.js
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2019-09-25 18:19:42 +0200
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2019-10-01 17:16:09 +0200
commitb9bc2417e7a8dc81feb0abe20359bedaf864f790 (patch)
tree61b47fbf37c1d168da8625224debde9e6a985348 /core/src/jquery/octemplate.js
parent7fb651235128dcbca8a6683b5cdafdf835f46300 (diff)
downloadnextcloud-server-b9bc2417e7a8dc81feb0abe20359bedaf864f790.tar.gz
nextcloud-server-b9bc2417e7a8dc81feb0abe20359bedaf864f790.zip
Comply to eslint
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'core/src/jquery/octemplate.js')
-rw-r--r--core/src/jquery/octemplate.js44
1 files changed, 22 insertions, 22 deletions
diff --git a/core/src/jquery/octemplate.js b/core/src/jquery/octemplate.js
index 61fbea2af5f..24df6739225 100644
--- a/core/src/jquery/octemplate.js
+++ b/core/src/jquery/octemplate.js
@@ -56,49 +56,49 @@ import escapeHTML from '../Util/escapeHTML'
* Inspired by micro templating done by e.g. underscore.js
*/
const Template = {
- init: function (vars, options, elem) {
+ init: function(vars, options, elem) {
// Mix in the passed in options with the default options
- this.vars = vars;
- this.options = $.extend({}, this.options, options);
+ this.vars = vars
+ this.options = $.extend({}, this.options, options)
- this.elem = elem;
- var self = this;
+ this.elem = elem
+ var self = this
if (typeof this.options.escapeFunction === 'function') {
- var keys = Object.keys(this.vars);
+ var keys = Object.keys(this.vars)
for (var key = 0; key < keys.length; key++) {
if (typeof this.vars[keys[key]] === 'string') {
- this.vars[keys[key]] = self.options.escapeFunction(this.vars[keys[key]]);
+ this.vars[keys[key]] = self.options.escapeFunction(this.vars[keys[key]])
}
}
}
- var _html = this._build(this.vars);
- return $(_html);
+ var _html = this._build(this.vars)
+ return $(_html)
},
// From stackoverflow.com/questions/1408289/best-way-to-do-variable-interpolation-in-javascript
- _build: function (o) {
- var data = this.elem.attr('type') === 'text/template' ? this.elem.html() : this.elem.get(0).outerHTML;
+ _build: function(o) {
+ var data = this.elem.attr('type') === 'text/template' ? this.elem.html() : this.elem.get(0).outerHTML
try {
return data.replace(/{([^{}]*)}/g,
- function (a, b) {
- var r = o[b];
- return typeof r === 'string' || typeof r === 'number' ? r : a;
+ function(a, b) {
+ var r = o[b]
+ return typeof r === 'string' || typeof r === 'number' ? r : a
}
- );
+ )
} catch (e) {
- console.error(e, 'data:', data);
+ console.error(e, 'data:', data)
}
},
options: {
escapeFunction: escapeHTML
}
-};
+}
-$.fn.octemplate = function (vars, options) {
- vars = vars || {};
+$.fn.octemplate = function(vars, options) {
+ vars = vars || {}
if (this.length) {
- var _template = Object.create(Template);
- return _template.init(vars, options, this);
+ var _template = Object.create(Template)
+ return _template.init(vars, options, this)
}
-};
+}