Skip to content

Commit ab9654b

Browse files
committed
fix indentation styles per eslint 1.5
1 parent d58a5b9 commit ab9654b

File tree

5 files changed

+53
-38
lines changed

5 files changed

+53
-38
lines changed

src/api/data.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,15 @@ exports.$interpolate = function (text) {
118118
var tokens = textParser.parse(text)
119119
var vm = this
120120
if (tokens) {
121-
return tokens.length === 1
122-
? vm.$eval(tokens[0].value)
123-
: tokens.map(function (token) {
124-
return token.tag
125-
? vm.$eval(token.value)
126-
: token.value
127-
}).join('')
121+
if (tokens.length === 1) {
122+
return vm.$eval(tokens[0].value)
123+
} else {
124+
return tokens.map(function (token) {
125+
return token.tag
126+
? vm.$eval(token.value)
127+
: token.value
128+
}).join('')
129+
}
128130
} else {
129131
return text
130132
}

src/directive.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
var _ = require('./util')
22
var Watcher = require('./watcher')
33
var expParser = require('./parsers/expression')
4+
function noop () {}
45

56
/**
67
* A directive links a DOM element with a piece of data,
@@ -89,13 +90,15 @@ Directive.prototype._bind = function () {
8990
) {
9091
// wrapped updater for context
9192
var dir = this
92-
var update = this._update = this.update
93-
? function (val, oldVal) {
94-
if (!dir._locked) {
95-
dir.update(val, oldVal)
96-
}
93+
if (this.update) {
94+
this._update = function (val, oldVal) {
95+
if (!dir._locked) {
96+
dir.update(val, oldVal)
9797
}
98-
: function () {} // noop if no update is provided
98+
}
99+
} else {
100+
this._update = noop
101+
}
99102
// pre-process hook called before the value is piped
100103
// through the filters. used in v-for.
101104
var preProcess = this._preProcess
@@ -104,7 +107,7 @@ Directive.prototype._bind = function () {
104107
var watcher = this._watcher = new Watcher(
105108
this.vm,
106109
this.expression,
107-
update, // callback
110+
this._update, // callback
108111
{
109112
filters: this.filters,
110113
twoWay: this.twoWay,

src/filters/array-filters.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ exports.filterBy = function (arr, search, delimiter /* ...dataKeys */) {
2626
return prev.concat(cur)
2727
}, [])
2828
return arr.filter(function (item) {
29-
return keys.length
30-
? keys.some(function (key) {
31-
return contains(Path.get(item, key), search)
32-
})
33-
: contains(item, search)
29+
if (keys.length) {
30+
return keys.some(function (key) {
31+
return contains(Path.get(item, key), search)
32+
})
33+
} else {
34+
return contains(item, search)
35+
}
3436
})
3537
}
3638

src/parsers/template.js

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -156,22 +156,28 @@ function nodeToFragment (node) {
156156

157157
// Test for the presence of the Safari template cloning bug
158158
// https://bugs.webkit.org/show_bug.cgi?id=137755
159-
var hasBrokenTemplate = _.inBrowser
160-
? (function () {
161-
var a = document.createElement('div')
162-
a.innerHTML = '<template>1</template>'
163-
return !a.cloneNode(true).firstChild.innerHTML
164-
})()
165-
: false
159+
var hasBrokenTemplate = (function () {
160+
/* istanbul ignore else */
161+
if (_.inBrowser) {
162+
var a = document.createElement('div')
163+
a.innerHTML = '<template>1</template>'
164+
return !a.cloneNode(true).firstChild.innerHTML
165+
} else {
166+
return false
167+
}
168+
})()
166169

167170
// Test for IE10/11 textarea placeholder clone bug
168-
var hasTextareaCloneBug = _.inBrowser
169-
? (function () {
170-
var t = document.createElement('textarea')
171-
t.placeholder = 't'
172-
return t.cloneNode(true).value === 't'
173-
})()
174-
: false
171+
var hasTextareaCloneBug = (function () {
172+
/* istanbul ignore else */
173+
if (_.inBrowser) {
174+
var t = document.createElement('textarea')
175+
t.placeholder = 't'
176+
return t.cloneNode(true).value === 't'
177+
} else {
178+
return false
179+
}
180+
})()
175181

176182
/**
177183
* 1. Deal with Safari cloning nested <template> bug by

src/parsers/text.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,13 @@ exports.parse = function (text) {
103103
*/
104104

105105
exports.tokensToExp = function (tokens) {
106-
return tokens.length > 1
107-
? tokens.map(function (token) {
108-
return formatToken(token)
109-
}).join('+')
110-
: formatToken(tokens[0], true)
106+
if (tokens.length > 1) {
107+
return tokens.map(function (token) {
108+
return formatToken(token)
109+
}).join('+')
110+
} else {
111+
return formatToken(tokens[0], true)
112+
}
111113
}
112114

113115
/**

0 commit comments

Comments
 (0)