Move templateName function to template maps model

This commit is contained in:
Raul Ochoa 2015-04-27 11:55:05 +02:00
parent a897e36b91
commit 8fb3dc7529
2 changed files with 12 additions and 11 deletions

View File

@ -1,6 +1,7 @@
var step = require('step');
var assert = require('assert');
var _ = require('underscore');
var templateName = require('../template_maps').templateName;
var CdbRequest = require('../models/cdb_request');
function TemplateMapsController(app, serverOptions, templateMaps, metadataBackend, templateBaseUrl, surrogateKeysCache,
@ -387,14 +388,3 @@ function ifInvalidContentType(req, description) {
throw new Error(description);
}
}
function templateName(templateId) {
var templateIdTokens = templateId.split('@');
var name = templateIdTokens[0];
if (templateIdTokens.length > 1) {
name = templateIdTokens[1];
}
return name;
}

View File

@ -492,3 +492,14 @@ o.fingerPrint = function(template) {
.digest('hex')
;
};
module.exports.templateName = function templateName(templateId) {
var templateIdTokens = templateId.split('@');
var name = templateIdTokens[0];
if (templateIdTokens.length > 1) {
name = templateIdTokens[1];
}
return name;
};