Skip to content

Commit

Permalink
Merge pull request #130 from maksimr/master
Browse files Browse the repository at this point in the history
chore: fix eslint errors
  • Loading branch information
dignifiedquire committed Aug 9, 2016
2 parents 2ba59d2 + 1bba82e commit 2ac0389
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 26 deletions.
3 changes: 2 additions & 1 deletion gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ module.exports = function (grunt) {
eslint: {
target: [
'src/adapter.js',
'lib/*.js',
'lib/boot.js',
'lib/index.js',
'gruntfile.js',
'karma.conf.js',
'test/*.js',
Expand Down
2 changes: 0 additions & 2 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
var path = require('path')

module.exports = function (config) {
config.set({
frameworks: ['jasmine'],
Expand Down
54 changes: 31 additions & 23 deletions src/adapter.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/*eslint no-unused-vars: ["error", { "varsIgnorePattern": "(createSpecFilter|createStartFn)" }]*/

'use strict'

/**
Expand All @@ -6,7 +8,7 @@
* @return {Boolean} True if external, False otherwise.
*/
function isExternalStackEntry (entry) {
return (entry ? true : false) &&
return !!entry &&
// entries related to jasmine and karma-jasmine:
!/\/(jasmine-core|karma-jasmine)\//.test(entry) &&
// karma specifics, e.g. "at http://localhost:7018/karma.js:185"
Expand All @@ -19,8 +21,8 @@ function isExternalStackEntry (entry) {
* @return {Array} A list of relevant stack entries.
*/
function getRelevantStackFrom (stack) {
var filteredStack = [],
relevantStack = []
var filteredStack = []
var relevantStack = []

stack = stack.split('\n')

Expand Down Expand Up @@ -60,7 +62,7 @@ function getRelevantStackFrom (stack) {
function formatFailedStep (step) {
// Safari seems to have no stack trace,
// so we just return the error message:
if (!step.stack) { return step.message; }
if (!step.stack) { return step.message }

var relevantMessage = []
var relevantStack = []
Expand Down Expand Up @@ -257,11 +259,11 @@ var getGrepOption = function (clientArguments) {
return clientArguments[indexOfGrep + 1]
}

return map(filter(clientArguments ,function (arg) {
return grepRegex.test(arg)
}), function (arg) {
return arg.replace(grepRegex, '$1')
})[0] || ''
return map(filter(clientArguments, function (arg) {
return grepRegex.test(arg)
}), function (arg) {
return arg.replace(grepRegex, '$1')
})[0] || ''
} else if (typeof clientArguments === 'string') {
var match = /--grep=([^=]+)/.exec(clientArguments)

Expand Down Expand Up @@ -318,41 +320,47 @@ function createStartFn (karma, jasmineEnv) {
}
}


function indexOf(collection, find, i /*opt*/) {
function indexOf (collection, find, i /* opt*/) {
if (collection.indexOf) {
return collection.indexOf(find, i);
return collection.indexOf(find, i)
}

if (i === undefined) {i = 0;}
if (i < 0) {i += collection.length;}
if (i < 0) {i = 0;}
if (i === undefined) { i = 0 }
if (i < 0) { i += collection.length }
if (i < 0) { i = 0 }
for (var n = collection.length; i < n; i++) {
if (i in collection && collection[i] === find) {
return i;}}
return i
}
}
return -1
}

function filter(collection, filter, that /*opt*/) {
function filter (collection, filter, that /* opt*/) {
if (collection.filter) {
return collection.filter(filter, that);
return collection.filter(filter, that)
}

var other = [], v
var other = []
var v
for (var i = 0, n = collection.length; i < n; i++) {
if (i in collection && filter.call(that, v = collection[i], i, collection)) {
other.push(v);}}
other.push(v)
}
}
return other
}

function map(collection, mapper, that /*opt*/) {
function map (collection, mapper, that /* opt*/) {
if (collection.map) {
return collection.map(mapper, that);
return collection.map(mapper, that)
}

var other = new Array(collection.length)
for (var i = 0, n = collection.length; i < n; i++) {
if (i in collection) {
other[i] = mapper.call(that, collection[i], i, collection);}}
other[i] = mapper.call(that, collection[i], i, collection)
}
}
return other
}

0 comments on commit 2ac0389

Please sign in to comment.