blob: 3142ae14b19e89d118ae4078e917ad3624dc1392 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
var path = require('path');
var isarray = require('lodash.isarray');
var pluralize = require('pluralize');
var Q = require('q');
/**
* OKUtils!
* Cross cutting concerns n stuff
*/
module.exports = {
/**
* Return a copy of the route with a trailing slash
*/
withTrailingSlash: function withTrailingSlash(route) {
route = route || '';
return path.normalize(route + '/');
},
/**
* Return a copy of the route without a trailing slash
*/
withoutTrailingSlash: function withoutTrailingSlash(route) {
route = route || '';
return route.charAt(route.length - 1) === '/' ? route.slice(0, -1) : route;
}
};
|