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 */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/*jslint indent: 2, nomen: true, maxlen: 120 */
|
||||
/*global module, require, exports */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -185,8 +186,14 @@ _.extend(Application.prototype, {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
createRepository: function (name, opts) {
|
||||
var model;
|
||||
var Repo;
|
||||
'use strict';
|
||||
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')) {
|
||||
model = this.applicationContext.appModule.require(opts.model).Model;
|
||||
|
@ -208,15 +215,16 @@ _.extend(Application.prototype, {
|
|||
Repo = Repository;
|
||||
}
|
||||
|
||||
var prefix = this.applicationContext.collectionPrefix;
|
||||
var cname;
|
||||
prefix = this.applicationContext.collectionPrefix;
|
||||
|
||||
if (prefix === "") {
|
||||
cname = name;
|
||||
} else {
|
||||
cname = prefix + "_" + name;
|
||||
}
|
||||
var collection = db._collection(cname);
|
||||
|
||||
collection = db._collection(cname);
|
||||
|
||||
if (!collection) {
|
||||
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 */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -43,6 +43,7 @@ BaseMiddleware = function () {
|
|||
var middleware = function (request, response, options, next) {
|
||||
var responseFunctions,
|
||||
requestFunctions,
|
||||
trace,
|
||||
_ = require("underscore"),
|
||||
console = require("console"),
|
||||
actions = require("org/arangodb/actions");
|
||||
|
@ -175,7 +176,7 @@ BaseMiddleware = function () {
|
|||
/// @brief trace
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var trace = options.isDevelopment;
|
||||
trace = options.isDevelopment;
|
||||
if (!trace && options.hasOwnProperty("options")) {
|
||||
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 */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -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 */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -55,7 +55,6 @@ var Model,
|
|||
|
||||
Model = function (attributes) {
|
||||
'use strict';
|
||||
|
||||
this.attributes = attributes || {};
|
||||
};
|
||||
|
||||
|
@ -81,6 +80,7 @@ _.extend(Model.prototype, {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
get: function (attributeName) {
|
||||
'use strict';
|
||||
return this.attributes[attributeName];
|
||||
},
|
||||
|
||||
|
@ -104,6 +104,7 @@ _.extend(Model.prototype, {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
set: function (attributeName, value) {
|
||||
'use strict';
|
||||
this.attributes[attributeName] = value;
|
||||
},
|
||||
|
||||
|
@ -128,6 +129,7 @@ _.extend(Model.prototype, {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
has: function (attributeName) {
|
||||
'use strict';
|
||||
return !(_.isUndefined(this.attributes[attributeName]) ||
|
||||
_.isNull(this.attributes[attributeName]));
|
||||
},
|
||||
|
@ -142,6 +144,7 @@ _.extend(Model.prototype, {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
forDB: function () {
|
||||
'use strict';
|
||||
return this.attributes;
|
||||
},
|
||||
|
||||
|
@ -155,6 +158,7 @@ _.extend(Model.prototype, {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
forClient: function () {
|
||||
'use strict';
|
||||
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 */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -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 */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Reference in New Issue