Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
peterkhayes committed Jun 24, 2016
1 parent 5cd2022 commit 6592aee
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
24 changes: 13 additions & 11 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,23 @@ var getDefaults = function(){
return defaults;
};

if(!Array.isArray) {
if (!Array.isArray) {
Array.isArray = function (arg) {
return Object.prototype.toString.call(arg) == '[object Array]';
return Object.prototype.toString.call(arg) === '[object Array]';
};
}

var objectEach = function(obj, cb){
for(var k in obj){
cb(obj[k], k);
for (var k in obj){
if (obj.hasOwnProperty(k)) {
cb(obj[k], k);
}
}
};

var argsArray = function(obj){
if (!obj) return [];
if (Array.isArray(obj)) return slice.call(obj);
if (!obj) { return []; }
if (Array.isArray(obj)) { return obj.slice() ; }
var args = [];
objectEach(obj, function(v, k){
args[k] = v;
Expand All @@ -38,8 +40,8 @@ var arrLast = function(arr){
};

var arrFlatten = function(input, output) {
if (!output) output = [];
for(var i = 0; i < input.length; i++){
if (!output) { output = []; }
for (var i = 0; i < input.length; i++){
var value = input[i];
if (Array.isArray(value)) {
arrFlatten(value, output);
Expand Down Expand Up @@ -172,7 +174,7 @@ UrlGrey.prototype.query = function(mergeObject){
// read the object out
var oldQuery = querystring.parse(this.queryString());
objectEach(mergeObject, function(v, k){
if (v == null || v === false){
if (v === null || v === false){
delete oldQuery[k];
} else {
oldQuery[k] = v;
Expand Down Expand Up @@ -203,7 +205,7 @@ UrlGrey.prototype.rawQuery = function(mergeObject){
// read the object out
var oldQuery = querystring.parse(this.queryString());
objectEach(mergeObject, function(v, k){
if (v == null || v === false){
if (v === null || v === false){
delete oldQuery[k];
} else {
oldQuery[k] = v;
Expand Down Expand Up @@ -329,7 +331,7 @@ UrlGrey.prototype.toString = function(){
var retval = this.protocol() + '://';
if (this.protocol() !== 'file'){
var userinfo = p.username + ':' + p.password;
if (userinfo != ':'){
if (userinfo !== ':'){
retval += userinfo + '@';
}
retval += p.hostname;
Expand Down
2 changes: 0 additions & 2 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ if (!isBrowser){
var urlgrey = require('../index');
}

var expect = chai.expect();

describe("urlgrey", function(){
describe("chainability", function(){
it("doesn't over-write the original url", function(){
Expand Down
8 changes: 4 additions & 4 deletions util.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@

var isObject = function (o){
return (typeof o == "object") &&
return (typeof o === "object") &&
(o !== null) &&
(Object.prototype.toString.call(o) === '[object Object]');
};
exports.isObject = isObject;
exports.isString = function(o){
return Object.prototype.toString.call(o) == '[object String]';
return Object.prototype.toString.call(o) === '[object String]';
};
exports.isArray = function(o){
return Object.prototype.toString.call(o) === "[object Array]";
Expand Down Expand Up @@ -39,7 +39,7 @@ exports.keys = function (object) {
if ('ab'.substr(-1) !== 'b') {
exports.substr = function (str, start, length) {
// did we get a negative start, calculate how much it is from the beginning of the string
if (start < 0) start = str.length + start;
if (start < 0) { start = str.length + start; }

// call the original function
return str.substr(start, length);
Expand All @@ -52,7 +52,7 @@ if ('ab'.substr(-1) !== 'b') {

// Array.prototype.map is supported in IE9
exports.map = function map(xs, fn) {
if (xs.map) return xs.map(fn);
if (xs.map) { return xs.map(fn); }
var out = new Array(xs.length);
for (var i = 0; i < xs.length; i++) {
out[i] = fn(xs[i], i, xs);
Expand Down

0 comments on commit 6592aee

Please sign in to comment.