[generate] handle methods with more than one namespace

This commit is contained in:
spalger
2017-06-14 15:42:56 -07:00
parent ac23aace47
commit 080e4a0641
2 changed files with 11 additions and 6 deletions

View File

@ -75,11 +75,11 @@ module.exports = function (branch, done) {
// collect the namespaces from the action locations
var namespaces = _.filter(_.map(actions, function (action) {
if (~action.location.indexOf('.')) {
var path = action.location.split('.').slice(0, -1);
_.pull(path, 'prototype');
return path.join('.');
}
return action.location
.split('.')
.slice(0, -1)
.filter(step => step !== 'prototype')
.join('.prototype.')
}));
// seperate the proxy actions

View File

@ -10,7 +10,12 @@ var api = module.exports = {};
api._namespaces = <%= stringify(namespaces) %>;<%
_.each(actions, function (action) {
var namespace = action.location.split('.').shift();
const namespace = action.location
.split('.')
.slice(0, -1)
.filter(step => step !== 'prototype')
.join('.prototype.');
if (_.include(namespaces, namespace)) {
_.pull(namespaces, namespace);
%>