Skip to content

Commit

Permalink
Merge pull request #1 from jdalton/ld
Browse files Browse the repository at this point in the history
Make a switch
  • Loading branch information
Refael Ackermann committed Jun 24, 2015
2 parents f95292c + b71b321 commit 2dc25c2
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 27 deletions.
22 changes: 8 additions & 14 deletions api.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var _ = require('underscore'),
var _ = require('lodash'),
Class = require('sji');

var Api = module.exports = Class.extend({
Expand All @@ -7,16 +7,15 @@ var Api = module.exports = Class.extend({
?
''
:
_.chain([])
_([])
.push(
path.replace(
/^(\/)?(.+[^\/])?(\/)?$/,
'$2'
)
)
.push('/')
.join('')
.value();
.join('');

this.app = app;
//Default Settings For Api
Expand Down Expand Up @@ -50,18 +49,16 @@ var Api = module.exports = Class.extend({

resource.settings = this.settings;

resource.path = _.chain([])
resource.path = _([])
.push(self.path)
.push(name)
.join('')
.value();
.join('');

resource.schema_path = _.chain([])
resource.schema_path = _([])
.push(self.path)
.push('schema/')
.push(name)
.join('')
.value();
.join('');

this.resources.push({
name:name,
Expand Down Expand Up @@ -166,10 +163,7 @@ var Api = module.exports = Class.extend({
},
get_list_usage : function(schema)
{
return _.chain(schema.filtering).map(function(field)
{
return field.usages;
}).flatten().push(schema.url).push(schema.sorting).value();
return _(schema.filtering).pluck('usages').flatten().push(schema.url).push(schema.sorting).value();
},
put_usage : function(schema)
{
Expand Down
3 changes: 1 addition & 2 deletions authorization.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
var _ = require('underscore'),
Class = require('sji');
var Class = require('sji');

var Authorization = module.exports = Class.extend({
init:function () {
Expand Down
4 changes: 2 additions & 2 deletions examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
"contributors": [
],
"dependencies":{
"underscore":"",
"lodash":"",
"mongoose":"",
"express":"",
"sji":""
},
"devDependencies":{
"devDependencies":{
},
"main":"authorization.js",
"keywords":[],
Expand Down
3 changes: 1 addition & 2 deletions mongoose_authorization.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
var _ = require('underscore'),
Authorization = require('./authorization');
var Authorization = require('./authorization');

var MongooseAuthorization = module.exports = Authorization.extend({
init:function (user_field) {
Expand Down
2 changes: 1 addition & 1 deletion mongoose_resource.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var _ = require('underscore'),
var _ = require('lodash'),
Class = require('sji'),
Resource = require('./resource');
Validation = require('./mongoose_validation');
Expand Down
2 changes: 1 addition & 1 deletion mongoose_validation.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var _ = require("underscore"),
var _ = require("lodash"),
Class = require('sji'),
Validation = require('./validation');

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
}
],
"dependencies": {
"underscore": "",
"sji": ""
"lodash": "^3.0.0",
"sji": "0.0.1"
},
"devDependencies": {
"express": "",
Expand Down
2 changes: 1 addition & 1 deletion resource.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var _ = require('underscore'),
var _ = require('lodash'),
Class = require('sji'),
Authentication = require('./authentication'),
Authorization = require('./authorization'),
Expand Down
3 changes: 1 addition & 2 deletions validation.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
var _ = require('underscore'),
Class = require('sji');
var Class = require('sji');

var Validation = module.exports = Class.extend({
init:function () {
Expand Down

0 comments on commit 2dc25c2

Please sign in to comment.