mirror of https://gitee.com/bigwinds/arangodb
Foxx: JSLint
This commit is contained in:
parent
b374054740
commit
366e258ec7
|
@ -1,4 +1,4 @@
|
||||||
/*jslint indent: 2, nomen: true, maxlen: 120, sloppy: true, vars: true */
|
/*jslint indent: 2, maxlen: 120 */
|
||||||
/*global module, require, exports */
|
/*global module, require, exports */
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/*jslint indent: 2, nomen: true, maxlen: 120 */
|
||||||
/*global module, require, exports */
|
/*global module, require, exports */
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -185,8 +186,14 @@ _.extend(Application.prototype, {
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
createRepository: function (name, opts) {
|
createRepository: function (name, opts) {
|
||||||
var model;
|
'use strict';
|
||||||
var Repo;
|
var model,
|
||||||
|
Repo,
|
||||||
|
prefix,
|
||||||
|
cname,
|
||||||
|
collection,
|
||||||
|
Model = require("org/arangodb/foxx/model").Model,
|
||||||
|
Repository = require("org/arangodb/foxx/repository").Repository;
|
||||||
|
|
||||||
if (opts && opts.hasOwnProperty('model')) {
|
if (opts && opts.hasOwnProperty('model')) {
|
||||||
model = this.applicationContext.appModule.require(opts.model).Model;
|
model = this.applicationContext.appModule.require(opts.model).Model;
|
||||||
|
@ -208,15 +215,16 @@ _.extend(Application.prototype, {
|
||||||
Repo = Repository;
|
Repo = Repository;
|
||||||
}
|
}
|
||||||
|
|
||||||
var prefix = this.applicationContext.collectionPrefix;
|
prefix = this.applicationContext.collectionPrefix;
|
||||||
var cname;
|
|
||||||
|
|
||||||
if (prefix === "") {
|
if (prefix === "") {
|
||||||
cname = name;
|
cname = name;
|
||||||
} else {
|
} else {
|
||||||
cname = prefix + "_" + name;
|
cname = prefix + "_" + name;
|
||||||
}
|
}
|
||||||
var collection = db._collection(cname);
|
|
||||||
|
collection = db._collection(cname);
|
||||||
|
|
||||||
if (!collection) {
|
if (!collection) {
|
||||||
throw new Error("collection with name '" + cname + "' does not exist.");
|
throw new Error("collection with name '" + cname + "' does not exist.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*jslint indent: 2, nomen: true, maxlen: 120, sloppy: true, vars: true */
|
/*jslint indent: 2, nomen: true, maxlen: 120 */
|
||||||
/*global module, require, exports */
|
/*global module, require, exports */
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -43,6 +43,7 @@ BaseMiddleware = function () {
|
||||||
var middleware = function (request, response, options, next) {
|
var middleware = function (request, response, options, next) {
|
||||||
var responseFunctions,
|
var responseFunctions,
|
||||||
requestFunctions,
|
requestFunctions,
|
||||||
|
trace,
|
||||||
_ = require("underscore"),
|
_ = require("underscore"),
|
||||||
console = require("console"),
|
console = require("console"),
|
||||||
actions = require("org/arangodb/actions");
|
actions = require("org/arangodb/actions");
|
||||||
|
@ -175,7 +176,7 @@ BaseMiddleware = function () {
|
||||||
/// @brief trace
|
/// @brief trace
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
var trace = options.isDevelopment;
|
trace = options.isDevelopment;
|
||||||
if (!trace && options.hasOwnProperty("options")) {
|
if (!trace && options.hasOwnProperty("options")) {
|
||||||
trace = options.options.trace;
|
trace = options.options.trace;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*jslint indent: 2, nomen: true, maxlen: 120, sloppy: true, vars: true */
|
/*jslint indent: 2, nomen: true, maxlen: 120 */
|
||||||
/*global module, require, exports */
|
/*global module, require, exports */
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*jslint indent: 2, nomen: true, maxlen: 120, sloppy: true, vars: true */
|
/*jslint indent: 2, nomen: true, maxlen: 120 */
|
||||||
/*global module, require, exports */
|
/*global module, require, exports */
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -55,7 +55,6 @@ var Model,
|
||||||
|
|
||||||
Model = function (attributes) {
|
Model = function (attributes) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
this.attributes = attributes || {};
|
this.attributes = attributes || {};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -81,6 +80,7 @@ _.extend(Model.prototype, {
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
get: function (attributeName) {
|
get: function (attributeName) {
|
||||||
|
'use strict';
|
||||||
return this.attributes[attributeName];
|
return this.attributes[attributeName];
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -104,6 +104,7 @@ _.extend(Model.prototype, {
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
set: function (attributeName, value) {
|
set: function (attributeName, value) {
|
||||||
|
'use strict';
|
||||||
this.attributes[attributeName] = value;
|
this.attributes[attributeName] = value;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -128,6 +129,7 @@ _.extend(Model.prototype, {
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
has: function (attributeName) {
|
has: function (attributeName) {
|
||||||
|
'use strict';
|
||||||
return !(_.isUndefined(this.attributes[attributeName]) ||
|
return !(_.isUndefined(this.attributes[attributeName]) ||
|
||||||
_.isNull(this.attributes[attributeName]));
|
_.isNull(this.attributes[attributeName]));
|
||||||
},
|
},
|
||||||
|
@ -142,6 +144,7 @@ _.extend(Model.prototype, {
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
forDB: function () {
|
forDB: function () {
|
||||||
|
'use strict';
|
||||||
return this.attributes;
|
return this.attributes;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -155,6 +158,7 @@ _.extend(Model.prototype, {
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
forClient: function () {
|
forClient: function () {
|
||||||
|
'use strict';
|
||||||
return this.attributes;
|
return this.attributes;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*jslint indent: 2, nomen: true, maxlen: 120, sloppy: true, vars: true */
|
/*jslint indent: 2, nomen: true, maxlen: 120 */
|
||||||
/*global module, require, exports */
|
/*global module, require, exports */
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*jslint indent: 2, nomen: true, maxlen: 120, sloppy: true, vars: true */
|
/*jslint indent: 2, nomen: true, maxlen: 120 */
|
||||||
/*global module, require, exports */
|
/*global module, require, exports */
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Reference in New Issue