Skip to content

Commit

Permalink
ci:linting
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorybesson committed Nov 26, 2016
1 parent 4205bde commit 8bee3ad
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions src/cli/cms/editor/handlebars/sourceAttr.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ export default function sourceAttr(obj, params) {
* @return {[type]} the object containing the path object or undefined
*/
function get(obj, path) {
return path.split(".").reduce(function(prev, curr) {
return prev ? prev[curr] : undefined
return path.split('.').reduce(function(prev, curr) {
return prev ? prev[curr] : undefined
}, obj || self)
}

Expand All @@ -63,7 +63,7 @@ function prepareDisplay(obj, str) {
var keys = getKeys(str)
Array.prototype.forEach.call(keys, (key) => {
var val = get(obj, key)
var pattern = new RegExp("{{"+key+"}}|"+key)
var pattern = new RegExp('{{'+key+'}}|'+key)
str = str.replace(pattern, val)
})

Expand All @@ -76,7 +76,7 @@ function prepareDisplay(obj, str) {
* @return {Array} the array of variables
*/
function getKeys(str){
var regex = /\{\{(.*?)\}\}/g;
var regex = /\{\{(.*?)\}\}/g
var variables = []
var match

Expand Down
26 changes: 13 additions & 13 deletions src/server/public/scripts/modules/EditorAutocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,10 @@ export default class EditorAutocomplete {
_find(obj, path) {
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
if ("object" == typeof(obj[key]) && !this._has(obj[key], path)) {
this._find(obj[key], path)
if ('object' == typeof(obj[key]) && !this._has(obj[key], path)) {
this._find(obj[key], path)
} else if (this._has(obj[key], path)) {
this.result.push(obj[key])
this.result.push(obj[key])
}
}
}
Expand All @@ -224,12 +224,12 @@ export default class EditorAutocomplete {
* @return {Boolean} is the path found in obj
*/
_has(obj, path) {
return path.split(".").every(function(x) {
if(typeof obj != "object" || obj === null || typeof obj[x] == 'undefined')
return false;
obj = obj[x];
return true;
});
return path.split('.').every(function(x) {
if(typeof obj != 'object' || obj === null || typeof obj[x] == 'undefined')
return false
obj = obj[x]
return true
})
}

/**
Expand All @@ -239,8 +239,8 @@ export default class EditorAutocomplete {
* @return {[type]} the object containing the path object or undefined
*/
_get(obj, path) {
return path.split(".").reduce(function(prev, curr) {
return prev ? prev[curr] : undefined
return path.split('.').reduce(function(prev, curr) {
return prev ? prev[curr] : undefined
}, obj || self)
}

Expand All @@ -255,7 +255,7 @@ export default class EditorAutocomplete {
var keys = this._getKeys(str)
Array.prototype.forEach.call(keys, (key) => {
var val = this._get(obj, key)
var pattern = new RegExp("{{"+key+"}}|"+key)
var pattern = new RegExp('{{'+key+'}}|'+key)
str = str.replace(pattern, val)
})

Expand All @@ -268,7 +268,7 @@ export default class EditorAutocomplete {
* @return {Array} the array of variables
*/
_getKeys(str){
var regex = /\{\{(.*?)\}\}/g;
var regex = /\{\{(.*?)\}\}/g
var variables = []
var match

Expand Down

0 comments on commit 8bee3ad

Please sign in to comment.