1 | 'use strict';
|
2 |
|
3 | exports.padComponent = function (component) {
|
4 | return component <= 9 ? '0' + component : '' + component;
|
5 | };
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | exports.toYYYYMMDD = function (theDate) {
|
12 | var month = this.padComponent(theDate.getMonth() + 1);
|
13 |
|
14 | return theDate.getUTCFullYear() +
|
15 | month +
|
16 | this.padComponent(theDate.getDate()) +
|
17 | '';
|
18 | };
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 | exports.capitalize = function (str) {
|
25 | return str.charAt(0).toUpperCase() + str.slice(1);
|
26 | };
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 | exports.formatPath = function formatPath(prefix, resource, action) {
|
34 | var requestPath = '/' + (prefix ? prefix + '/' : '') + resource;
|
35 |
|
36 | if (action !== '') {
|
37 | requestPath += '/' + action;
|
38 | }
|
39 |
|
40 | return requestPath;
|
41 | };
|