diff --git a/api.js b/api.js index 879b822..3ad9eac 100644 --- a/api.js +++ b/api.js @@ -1,4 +1,4 @@ -var _ = require('underscore'), +var _ = require('lodash'), Class = require('sji'); var Api = module.exports = Class.extend({ @@ -7,7 +7,7 @@ var Api = module.exports = Class.extend({ ? '' : - _.chain([]) + _([]) .push( path.replace( /^(\/)?(.+[^\/])?(\/)?$/, @@ -15,8 +15,7 @@ var Api = module.exports = Class.extend({ ) ) .push('/') - .join('') - .value(); + .join(''); this.app = app; //Default Settings For Api @@ -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, @@ -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) { diff --git a/authorization.js b/authorization.js index 1030518..9066970 100644 --- a/authorization.js +++ b/authorization.js @@ -1,5 +1,4 @@ -var _ = require('underscore'), - Class = require('sji'); +var Class = require('sji'); var Authorization = module.exports = Class.extend({ init:function () { diff --git a/examples/package.json b/examples/package.json index 9b713f3..eb2b0df 100644 --- a/examples/package.json +++ b/examples/package.json @@ -6,12 +6,12 @@ "contributors": [ ], "dependencies":{ - "underscore":"", + "lodash":"", "mongoose":"", "express":"", "sji":"" }, - "devDependencies":{ + "devDependencies":{ }, "main":"authorization.js", "keywords":[], diff --git a/mongoose_authorization.js b/mongoose_authorization.js index 21bd7f8..8aea76f 100644 --- a/mongoose_authorization.js +++ b/mongoose_authorization.js @@ -1,5 +1,4 @@ -var _ = require('underscore'), - Authorization = require('./authorization'); +var Authorization = require('./authorization'); var MongooseAuthorization = module.exports = Authorization.extend({ init:function (user_field) { diff --git a/mongoose_resource.js b/mongoose_resource.js index 6a6bab3..335ec7a 100644 --- a/mongoose_resource.js +++ b/mongoose_resource.js @@ -1,4 +1,4 @@ -var _ = require('underscore'), +var _ = require('lodash'), Class = require('sji'), Resource = require('./resource'); Validation = require('./mongoose_validation'); diff --git a/mongoose_validation.js b/mongoose_validation.js index b664e97..d6544b4 100644 --- a/mongoose_validation.js +++ b/mongoose_validation.js @@ -1,4 +1,4 @@ -var _ = require("underscore"), +var _ = require("lodash"), Class = require('sji'), Validation = require('./validation'); diff --git a/package.json b/package.json index 06023da..519fc69 100644 --- a/package.json +++ b/package.json @@ -14,8 +14,8 @@ } ], "dependencies": { - "underscore": "", - "sji": "" + "lodash": "^3.0.0", + "sji": "0.0.1" }, "devDependencies": { "express": "", diff --git a/resource.js b/resource.js index d144878..dd4a0d8 100644 --- a/resource.js +++ b/resource.js @@ -1,4 +1,4 @@ -var _ = require('underscore'), +var _ = require('lodash'), Class = require('sji'), Authentication = require('./authentication'), Authorization = require('./authorization'), diff --git a/validation.js b/validation.js index 4d1089c..43bc431 100644 --- a/validation.js +++ b/validation.js @@ -1,5 +1,4 @@ -var _ = require('underscore'), - Class = require('sji'); +var Class = require('sji'); var Validation = module.exports = Class.extend({ init:function () {