Skip to content

Commit

Permalink
devops: Format code
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasrw committed Mar 6, 2021
1 parent f067adc commit 23525b8
Show file tree
Hide file tree
Showing 25 changed files with 335 additions and 278 deletions.
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm test
8 changes: 2 additions & 6 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
"CSV",
"worker"
],
"authors": [
"Andrey Gershun <agershun@gmail.com>"
],
"authors": ["Andrey Gershun <agershun@gmail.com>"],
"homepage": "alasql.org",
"repository": {
"type": "git",
Expand All @@ -42,9 +40,7 @@
"jison": "0.4.15",
"lodash": "3.7.0"
},
"main": [
"./dist/alasql.min.js"
],
"main": ["./dist/alasql.min.js"],
"ignore": [
"src",
"test",
Expand Down
12 changes: 6 additions & 6 deletions examples/simple/jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,12 +355,12 @@
n.promise(t)
);
}),
x.each('Boolean Number String Function Array Date RegExp Object Error'.split(' '), function (
e,
t
) {
l['[object ' + t + ']'] = t.toLowerCase();
});
x.each(
'Boolean Number String Function Array Date RegExp Object Error'.split(' '),
function (e, t) {
l['[object ' + t + ']'] = t.toLowerCase();
}
);
function j(e) {
var t = e.length,
n = x.type(e);
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
"tofix": "git ls-tree --full-tree --name-only -r HEAD | xargs grep -lrE '<{5,}' #",
"next": "git add --all && git rebase --continue #",
"fresh": "cmdmix 'yarn goto '%1' && yarn pull-hard'",
"pre-pr": "cmdmix 'yarn fresh '%1' && yarn repush'"
"pre-pr": "cmdmix 'yarn fresh '%1' && yarn repush'",
"prepare": "husky install"
},
"dependencies": {
"dom-storage": "^2.1.0",
Expand All @@ -59,7 +60,7 @@
"devDependencies": {
"blueimp-md5": "2.18.0",
"cmdmix": "2.1.0",
"git-branch-is": "^4.0.0",
"git-branch-is": "4.0.0",
"gulp": "^4.0.1",
"gulp-concat": "^2.6.1",
"gulp-dereserve": "^0.2.1",
Expand All @@ -80,7 +81,7 @@
"prettier": "2.2.1",
"strftime": "^0.10.0",
"tabletop": "1.6.3",
"uglify-js": "3.12.8",
"uglify-js": "3.13.0",
"version-bump-prompt": "6.1.0"
},
"engines": {
Expand Down
100 changes: 50 additions & 50 deletions partners/sqlfiddle/alasql_driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,64 +66,64 @@ define(['jquery', './alasqlbase_driver'], function ($, AlaSQLBase_driver) {

_this.db.exec('BEGIN TRANSACTION');

$.each(this.splitStatement(args['sql'], args['statement_separator']), function (
i,
statement
) {
if ($.trim(statement).length) {
var startTime = new Date();

var setArray = [];

try {
setArray = _this.db.exec(statement);

var thisSet = {
SUCCEEDED: true,
STATEMENT: statement,
EXECUTIONTIME: new Date() - startTime,
RESULTS: {
COLUMNS: [],
DATA: [],
},
EXECUTIONPLAN: {
COLUMNS: [],
DATA: [],
},
};

if (setArray.length) {
$.each(setArray, function () {
thisSet['RESULTS']['COLUMNS'] = this.columns;
thisSet['RESULTS']['DATA'] = this.values;
});
}
$.each(
this.splitStatement(args['sql'], args['statement_separator']),
function (i, statement) {
if ($.trim(statement).length) {
var startTime = new Date();

try {
exectionPlanArray = _this.db.exec('EXPLAIN QUERY PLAN ' + statement);
var setArray = [];

if (exectionPlanArray.length) {
$.each(exectionPlanArray, function () {
thisSet['EXECUTIONPLAN']['COLUMNS'] = this.columns;
thisSet['EXECUTIONPLAN']['DATA'] = this.values;
try {
setArray = _this.db.exec(statement);

var thisSet = {
SUCCEEDED: true,
STATEMENT: statement,
EXECUTIONTIME: new Date() - startTime,
RESULTS: {
COLUMNS: [],
DATA: [],
},
EXECUTIONPLAN: {
COLUMNS: [],
DATA: [],
},
};

if (setArray.length) {
$.each(setArray, function () {
thisSet['RESULTS']['COLUMNS'] = this.columns;
thisSet['RESULTS']['DATA'] = this.values;
});
}

try {
exectionPlanArray = _this.db.exec('EXPLAIN QUERY PLAN ' + statement);

if (exectionPlanArray.length) {
$.each(exectionPlanArray, function () {
thisSet['EXECUTIONPLAN']['COLUMNS'] = this.columns;
thisSet['EXECUTIONPLAN']['DATA'] = this.values;
});
}
} catch (e) {
// if we get an error with the execution plan, just ignore and move on.
}

returnSets.push(thisSet);
} catch (e) {
// if we get an error with the execution plan, just ignore and move on.
var thisSet = {
SUCCEEDED: false,
EXECUTIONTIME: new Date() - startTime,
ERRORMESSAGE: e,
};
returnSets.push(thisSet);
return false; // breaks the each loop
}

returnSets.push(thisSet);
} catch (e) {
var thisSet = {
SUCCEEDED: false,
EXECUTIONTIME: new Date() - startTime,
ERRORMESSAGE: e,
};
returnSets.push(thisSet);
return false; // breaks the each loop
}
}
});
);

_this.db.exec('ROLLBACK TRANSACTION');

Expand Down
100 changes: 50 additions & 50 deletions partners/sqlfiddle/sqljs_driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,64 +66,64 @@ define(['jquery', './sqlite_driver'], function ($, SQLite_driver) {

_this.db.exec('BEGIN TRANSACTION');

$.each(this.splitStatement(args['sql'], args['statement_separator']), function (
i,
statement
) {
if ($.trim(statement).length) {
var startTime = new Date();

var setArray = [];

try {
setArray = _this.db.exec(statement);

var thisSet = {
SUCCEEDED: true,
STATEMENT: statement,
EXECUTIONTIME: new Date() - startTime,
RESULTS: {
COLUMNS: [],
DATA: [],
},
EXECUTIONPLAN: {
COLUMNS: [],
DATA: [],
},
};

if (setArray.length) {
$.each(setArray, function () {
thisSet['RESULTS']['COLUMNS'] = this.columns;
thisSet['RESULTS']['DATA'] = this.values;
});
}
$.each(
this.splitStatement(args['sql'], args['statement_separator']),
function (i, statement) {
if ($.trim(statement).length) {
var startTime = new Date();

try {
exectionPlanArray = _this.db.exec('EXPLAIN QUERY PLAN ' + statement);
var setArray = [];

if (exectionPlanArray.length) {
$.each(exectionPlanArray, function () {
thisSet['EXECUTIONPLAN']['COLUMNS'] = this.columns;
thisSet['EXECUTIONPLAN']['DATA'] = this.values;
try {
setArray = _this.db.exec(statement);

var thisSet = {
SUCCEEDED: true,
STATEMENT: statement,
EXECUTIONTIME: new Date() - startTime,
RESULTS: {
COLUMNS: [],
DATA: [],
},
EXECUTIONPLAN: {
COLUMNS: [],
DATA: [],
},
};

if (setArray.length) {
$.each(setArray, function () {
thisSet['RESULTS']['COLUMNS'] = this.columns;
thisSet['RESULTS']['DATA'] = this.values;
});
}

try {
exectionPlanArray = _this.db.exec('EXPLAIN QUERY PLAN ' + statement);

if (exectionPlanArray.length) {
$.each(exectionPlanArray, function () {
thisSet['EXECUTIONPLAN']['COLUMNS'] = this.columns;
thisSet['EXECUTIONPLAN']['DATA'] = this.values;
});
}
} catch (e) {
// if we get an error with the execution plan, just ignore and move on.
}

returnSets.push(thisSet);
} catch (e) {
// if we get an error with the execution plan, just ignore and move on.
var thisSet = {
SUCCEEDED: false,
EXECUTIONTIME: new Date() - startTime,
ERRORMESSAGE: e,
};
returnSets.push(thisSet);
return false; // breaks the each loop
}

returnSets.push(thisSet);
} catch (e) {
var thisSet = {
SUCCEEDED: false,
EXECUTIONTIME: new Date() - startTime,
ERRORMESSAGE: e,
};
returnSets.push(thisSet);
return false; // breaks the each loop
}
}
});
);

_this.db.exec('ROLLBACK TRANSACTION');

Expand Down
2 changes: 1 addition & 1 deletion src/40select.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ yy.Select.prototype.compile = function (databaseid, params) {
// If this is INTO() function, then call it
// with one or two parameters
//
var qs = "return alasql.into[" + JSON.stringify(this.into.funcid.toUpperCase()) + "](";
var qs = 'return alasql.into[' + JSON.stringify(this.into.funcid.toUpperCase()) + '](';
if (this.into.args && this.into.args.length > 0) {
qs += this.into.args[0].toJS() + ',';
if (this.into.args.length > 1) {
Expand Down
2 changes: 1 addition & 1 deletion src/420from.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ yy.Select.prototype.compileFrom = function (query) {
ps += ');if(cb)res=cb(res,idx,query);return res';
source.datafn = new Function('query,params,cb,idx,alasql', ps);
} else if (tq instanceof yy.FuncValue) {
ps = "var res=alasql.from[" + JSON.stringify(tq.funcid.toUpperCase()) + "](";
ps = 'var res=alasql.from[' + JSON.stringify(tq.funcid.toUpperCase()) + '](';
/*/*
// if(tq.args && tq.args.length>0) {
// s += tq.args.map(function(arg){
Expand Down
2 changes: 1 addition & 1 deletion src/421join.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ yy.Select.prototype.compileJoins = function (query) {
"var res=alasql.prepareFromData(params['"+jnparam+"']);if(cb)res=cb(res, idx, query);return res");
*/

var s = "var res=alasql.from[" + JSON.stringify(jn.func.funcid.toUpperCase()) + "](";
var s = 'var res=alasql.from[' + JSON.stringify(jn.func.funcid.toUpperCase()) + '](';
/*/*
// if(tq.args && tq.args.length>0) {
// s += tq.args.map(function(arg){
Expand Down
2 changes: 1 addition & 1 deletion src/50expression.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ yy.Op.prototype.toJS = function (context, tableid, defcols) {
if (!(!this.right.args || 0 === this.right.args.length)) {
var ss = this.right.args.map(ref);
}
s = '' + ljs + "[" + JSON.stringify(this.right.funcid) + "](" + ss.join(',') + ')';
s = '' + ljs + '[' + JSON.stringify(this.right.funcid) + '](' + ss.join(',') + ')';
} else {
s = '' + ljs + '[' + rightJS() + ']';
}
Expand Down
18 changes: 10 additions & 8 deletions test/test154.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,16 @@ if (typeof exports != 'object') {
// console.log(999,res);
assert(res8.length == 0);
// console.log(alasql.databases.ag154);
alasql('DETACH DATABASE ag154;DROP IndexedDB DATABASE ag154', [], function (
res9
) {
assert(res9[0] == 1);
assert(res9[1] == 1);
// console.log(res);
done();
});
alasql(
'DETACH DATABASE ag154;DROP IndexedDB DATABASE ag154',
[],
function (res9) {
assert(res9[0] == 1);
assert(res9[1] == 1);
// console.log(res);
done();
}
);
});
});
});
Expand Down
Loading

0 comments on commit 23525b8

Please sign in to comment.