@decaf-ts/decorator-validation 1.5.8 → 1.5.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +0 -0
- package/README.md +0 -0
- package/dist/decorator-validation.js +1 -1
- package/dist/decorator-validation.js.LICENSE.txt +0 -0
- package/dist/esm/decorator-validation.js +1 -1
- package/dist/esm/decorator-validation.js.LICENSE.txt +0 -0
- package/{lib/esm → dist/types}/index.d.ts +1 -1
- package/{lib/esm → dist/types}/model/Model.d.ts +1 -0
- package/{lib/esm → dist/types}/model/ModelErrorDefinition.d.ts +0 -0
- package/{lib/esm → dist/types}/model/constants.d.ts +0 -0
- package/{lib/esm → dist/types}/model/construction.d.ts +0 -0
- package/{lib/esm → dist/types}/model/decorators.d.ts +0 -0
- package/{lib/esm → dist/types}/model/index.d.ts +0 -1
- package/{lib/esm → dist/types}/model/types.d.ts +0 -0
- package/{lib/esm → dist/types}/model/validation.d.ts +0 -0
- package/{lib/esm → dist/types}/utils/constants.d.ts +0 -0
- package/{lib/esm → dist/types}/utils/dates.d.ts +0 -0
- package/{lib/esm → dist/types}/utils/decorators.d.ts +0 -0
- package/{lib → dist/types}/utils/hashing.d.ts +0 -14
- package/{lib → dist/types}/utils/index.d.ts +1 -0
- package/{lib/esm → dist/types}/utils/registry.d.ts +0 -0
- package/{lib → dist/types}/utils/serialization.d.ts +4 -30
- package/{lib/esm → dist/types}/utils/strings.d.ts +0 -0
- package/dist/types/utils/types.d.ts +29 -0
- package/{lib → dist/types}/validation/Validation.d.ts +1 -1
- package/{lib → dist/types}/validation/Validators/DateValidator.d.ts +1 -1
- package/{lib → dist/types}/validation/Validators/EmailValidator.d.ts +1 -1
- package/{lib → dist/types}/validation/Validators/ListValidator.d.ts +1 -1
- package/{lib → dist/types}/validation/Validators/MaxLengthValidator.d.ts +1 -1
- package/{lib/esm → dist/types}/validation/Validators/MaxValidator.d.ts +1 -1
- package/{lib/esm → dist/types}/validation/Validators/MinLengthValidator.d.ts +1 -1
- package/{lib/esm → dist/types}/validation/Validators/MinValidator.d.ts +1 -1
- package/{lib/esm → dist/types}/validation/Validators/PasswordValidator.d.ts +1 -1
- package/{lib → dist/types}/validation/Validators/PatternValidator.d.ts +1 -1
- package/{lib/esm → dist/types}/validation/Validators/RequiredValidator.d.ts +1 -1
- package/{lib/esm → dist/types}/validation/Validators/StepValidator.d.ts +1 -1
- package/{lib → dist/types}/validation/Validators/TypeValidator.d.ts +1 -1
- package/{lib/esm → dist/types}/validation/Validators/URLValidator.d.ts +1 -1
- package/{lib/esm → dist/types}/validation/Validators/Validator.d.ts +1 -1
- package/{lib/esm → dist/types}/validation/Validators/ValidatorRegistry.d.ts +2 -2
- package/{lib/esm → dist/types}/validation/Validators/constants.d.ts +0 -0
- package/{lib/esm → dist/types}/validation/Validators/decorators.d.ts +0 -0
- package/dist/types/validation/Validators/index.d.ts +17 -0
- package/{lib/esm → dist/types}/validation/decorators.d.ts +0 -0
- package/{lib/esm → dist/types}/validation/index.d.ts +0 -0
- package/{lib/validation/Validators → dist/types/validation}/types.d.ts +49 -3
- package/lib/esm/index.js +3 -1
- package/lib/esm/model/Model.js +8 -1
- package/lib/esm/model/ModelErrorDefinition.js +2 -0
- package/lib/esm/model/constants.js +2 -0
- package/lib/esm/model/construction.js +2 -0
- package/lib/esm/model/decorators.js +2 -0
- package/lib/esm/model/index.js +2 -1
- package/lib/esm/model/types.js +2 -0
- package/lib/esm/model/validation.js +2 -0
- package/lib/esm/utils/constants.js +2 -0
- package/lib/esm/utils/dates.js +2 -0
- package/lib/esm/utils/decorators.js +2 -0
- package/lib/esm/utils/hashing.js +2 -17
- package/lib/esm/utils/index.js +3 -0
- package/lib/esm/utils/registry.js +2 -0
- package/lib/esm/utils/serialization.js +4 -1
- package/lib/esm/utils/strings.js +2 -0
- package/lib/esm/utils/types.js +3 -0
- package/lib/esm/validation/Validation.js +2 -0
- package/lib/esm/validation/Validators/DateValidator.js +2 -0
- package/lib/esm/validation/Validators/EmailValidator.js +2 -0
- package/lib/esm/validation/Validators/ListValidator.js +2 -0
- package/lib/esm/validation/Validators/MaxLengthValidator.js +2 -0
- package/lib/esm/validation/Validators/MaxValidator.js +2 -0
- package/lib/esm/validation/Validators/MinLengthValidator.js +2 -0
- package/lib/esm/validation/Validators/MinValidator.js +2 -0
- package/lib/esm/validation/Validators/PasswordValidator.js +2 -0
- package/lib/esm/validation/Validators/PatternValidator.js +2 -0
- package/lib/esm/validation/Validators/RequiredValidator.js +2 -0
- package/lib/esm/validation/Validators/StepValidator.js +2 -0
- package/lib/esm/validation/Validators/TypeValidator.js +2 -0
- package/lib/esm/validation/Validators/URLValidator.js +2 -0
- package/lib/esm/validation/Validators/Validator.js +2 -0
- package/lib/esm/validation/Validators/ValidatorRegistry.js +2 -0
- package/lib/esm/validation/Validators/constants.js +2 -0
- package/lib/esm/validation/Validators/decorators.js +2 -0
- package/lib/esm/validation/Validators/index.js +2 -35
- package/lib/esm/validation/decorators.js +2 -0
- package/lib/esm/validation/index.js +2 -0
- package/lib/esm/validation/types.js +2 -0
- package/lib/index.cjs +61 -0
- package/lib/model/Model.cjs +397 -0
- package/lib/model/ModelErrorDefinition.cjs +58 -0
- package/lib/model/constants.cjs +74 -0
- package/lib/model/construction.cjs +70 -0
- package/lib/model/decorators.cjs +69 -0
- package/lib/model/index.cjs +25 -0
- package/lib/model/types.cjs +4 -0
- package/lib/model/validation.cjs +140 -0
- package/lib/utils/constants.cjs +32 -0
- package/lib/utils/dates.cjs +253 -0
- package/lib/utils/decorators.cjs +24 -0
- package/lib/utils/hashing.cjs +90 -0
- package/lib/utils/index.cjs +26 -0
- package/lib/utils/registry.cjs +4 -0
- package/lib/utils/serialization.cjs +96 -0
- package/lib/utils/strings.cjs +37 -0
- package/lib/utils/types.cjs +4 -0
- package/lib/validation/Validation.cjs +77 -0
- package/lib/validation/Validators/DateValidator.cjs +59 -0
- package/lib/validation/Validators/EmailValidator.cjs +55 -0
- package/lib/validation/Validators/ListValidator.cjs +72 -0
- package/lib/validation/Validators/MaxLengthValidator.cjs +57 -0
- package/lib/validation/Validators/MaxValidator.cjs +62 -0
- package/lib/validation/Validators/MinLengthValidator.cjs +57 -0
- package/lib/validation/Validators/MinValidator.cjs +62 -0
- package/lib/validation/Validators/PasswordValidator.cjs +55 -0
- package/lib/validation/Validators/PatternValidator.cjs +75 -0
- package/lib/validation/Validators/RequiredValidator.cjs +62 -0
- package/lib/validation/Validators/StepValidator.cjs +57 -0
- package/lib/validation/Validators/TypeValidator.cjs +65 -0
- package/lib/validation/Validators/URLValidator.cjs +54 -0
- package/lib/validation/Validators/Validator.cjs +53 -0
- package/lib/validation/Validators/ValidatorRegistry.cjs +87 -0
- package/lib/validation/Validators/constants.cjs +139 -0
- package/lib/validation/Validators/decorators.cjs +30 -0
- package/lib/validation/Validators/index.cjs +35 -0
- package/lib/validation/decorators.cjs +306 -0
- package/lib/validation/{index.js → index.cjs} +6 -4
- package/lib/validation/types.cjs +4 -0
- package/package.json +2 -2
- package/lib/esm/model/utils.d.ts +0 -2
- package/lib/esm/model/utils.js +0 -8
- package/lib/esm/utils/hashing.d.ts +0 -52
- package/lib/esm/utils/index.d.ts +0 -7
- package/lib/esm/utils/serialization.d.ts +0 -79
- package/lib/esm/validation/Validation.d.ts +0 -51
- package/lib/esm/validation/Validators/DateValidator.d.ts +0 -28
- package/lib/esm/validation/Validators/EmailValidator.d.ts +0 -28
- package/lib/esm/validation/Validators/ListValidator.d.ts +0 -28
- package/lib/esm/validation/Validators/MaxLengthValidator.d.ts +0 -29
- package/lib/esm/validation/Validators/PatternValidator.d.ts +0 -37
- package/lib/esm/validation/Validators/TypeValidator.d.ts +0 -25
- package/lib/esm/validation/Validators/index.d.ts +0 -52
- package/lib/esm/validation/Validators/types.js +0 -1
- package/lib/esm/validation/types.d.ts +0 -46
- package/lib/index.d.ts +0 -42
- package/lib/index.js +0 -59
- package/lib/model/Model.d.ts +0 -203
- package/lib/model/Model.js +0 -389
- package/lib/model/ModelErrorDefinition.d.ts +0 -22
- package/lib/model/ModelErrorDefinition.js +0 -56
- package/lib/model/constants.d.ts +0 -56
- package/lib/model/constants.js +0 -72
- package/lib/model/construction.d.ts +0 -29
- package/lib/model/construction.js +0 -68
- package/lib/model/decorators.d.ts +0 -25
- package/lib/model/decorators.js +0 -67
- package/lib/model/index.d.ts +0 -8
- package/lib/model/index.js +0 -24
- package/lib/model/types.d.ts +0 -79
- package/lib/model/types.js +0 -2
- package/lib/model/utils.d.ts +0 -2
- package/lib/model/utils.js +0 -11
- package/lib/model/validation.d.ts +0 -14
- package/lib/model/validation.js +0 -138
- package/lib/utils/constants.d.ts +0 -26
- package/lib/utils/constants.js +0 -30
- package/lib/utils/dates.d.ts +0 -76
- package/lib/utils/dates.js +0 -251
- package/lib/utils/decorators.d.ts +0 -2
- package/lib/utils/decorators.js +0 -22
- package/lib/utils/hashing.js +0 -106
- package/lib/utils/index.js +0 -23
- package/lib/utils/registry.d.ts +0 -68
- package/lib/utils/registry.js +0 -2
- package/lib/utils/serialization.js +0 -93
- package/lib/utils/strings.d.ts +0 -25
- package/lib/utils/strings.js +0 -35
- package/lib/validation/Validation.js +0 -75
- package/lib/validation/Validators/DateValidator.js +0 -57
- package/lib/validation/Validators/EmailValidator.js +0 -53
- package/lib/validation/Validators/ListValidator.js +0 -70
- package/lib/validation/Validators/MaxLengthValidator.js +0 -55
- package/lib/validation/Validators/MaxValidator.d.ts +0 -28
- package/lib/validation/Validators/MaxValidator.js +0 -60
- package/lib/validation/Validators/MinLengthValidator.d.ts +0 -29
- package/lib/validation/Validators/MinLengthValidator.js +0 -55
- package/lib/validation/Validators/MinValidator.d.ts +0 -28
- package/lib/validation/Validators/MinValidator.js +0 -60
- package/lib/validation/Validators/PasswordValidator.d.ts +0 -28
- package/lib/validation/Validators/PasswordValidator.js +0 -53
- package/lib/validation/Validators/PatternValidator.js +0 -73
- package/lib/validation/Validators/RequiredValidator.d.ts +0 -28
- package/lib/validation/Validators/RequiredValidator.js +0 -60
- package/lib/validation/Validators/StepValidator.d.ts +0 -29
- package/lib/validation/Validators/StepValidator.js +0 -55
- package/lib/validation/Validators/TypeValidator.js +0 -63
- package/lib/validation/Validators/URLValidator.d.ts +0 -27
- package/lib/validation/Validators/URLValidator.js +0 -52
- package/lib/validation/Validators/Validator.d.ts +0 -41
- package/lib/validation/Validators/Validator.js +0 -51
- package/lib/validation/Validators/ValidatorRegistry.d.ts +0 -47
- package/lib/validation/Validators/ValidatorRegistry.js +0 -85
- package/lib/validation/Validators/constants.d.ts +0 -96
- package/lib/validation/Validators/constants.js +0 -137
- package/lib/validation/Validators/decorators.d.ts +0 -12
- package/lib/validation/Validators/decorators.js +0 -28
- package/lib/validation/Validators/index.d.ts +0 -52
- package/lib/validation/Validators/index.js +0 -69
- package/lib/validation/Validators/types.js +0 -2
- package/lib/validation/decorators.d.ts +0 -178
- package/lib/validation/decorators.js +0 -304
- package/lib/validation/index.d.ts +0 -4
- package/lib/validation/types.d.ts +0 -46
- package/lib/validation/types.js +0 -2
package/lib/utils/dates.js
DELETED
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.dateFromFormat = dateFromFormat;
|
|
4
|
-
exports.bindDateToString = bindDateToString;
|
|
5
|
-
exports.isValidDate = isValidDate;
|
|
6
|
-
exports.twoDigitPad = twoDigitPad;
|
|
7
|
-
exports.formatDate = formatDate;
|
|
8
|
-
exports.parseDate = parseDate;
|
|
9
|
-
require("reflect-metadata");
|
|
10
|
-
const constants_1 = require("../validation/Validators/constants");
|
|
11
|
-
const strings_1 = require("./strings");
|
|
12
|
-
/**
|
|
13
|
-
* @summary Reverses the process from {@link formatDate}
|
|
14
|
-
*
|
|
15
|
-
* @param {string} date the date string to be converted back into date
|
|
16
|
-
* @param {string} format the date format
|
|
17
|
-
* @return {Date} the date from the format or the standard new Date({@prop date}) if the string couldn't be parsed (are you sure the format matches the string?)
|
|
18
|
-
*
|
|
19
|
-
* @function dateFromFormat
|
|
20
|
-
* @memberOf module:decorator-validation.Utils.Dates
|
|
21
|
-
* @category Format
|
|
22
|
-
*/
|
|
23
|
-
function dateFromFormat(date, format) {
|
|
24
|
-
let formatRegexp = format;
|
|
25
|
-
// Hour
|
|
26
|
-
if (formatRegexp.match(/hh/))
|
|
27
|
-
formatRegexp = formatRegexp.replace("hh", "(?<hour>\\d{2})");
|
|
28
|
-
else if (formatRegexp.match(/h/))
|
|
29
|
-
formatRegexp = formatRegexp.replace("h", "(?<hour>\\d{1,2})");
|
|
30
|
-
else if (formatRegexp.match(/HH/))
|
|
31
|
-
formatRegexp = formatRegexp.replace("HH", "(?<hour>\\d{2})");
|
|
32
|
-
else if (formatRegexp.match(/H/))
|
|
33
|
-
formatRegexp = formatRegexp.replace("H", "(?<hour>\\d{1,2})");
|
|
34
|
-
// Minutes
|
|
35
|
-
if (formatRegexp.match(/mm/))
|
|
36
|
-
formatRegexp = formatRegexp.replace("mm", "(?<minutes>\\d{2})");
|
|
37
|
-
else if (formatRegexp.match(/m/))
|
|
38
|
-
formatRegexp = formatRegexp.replace("m", "(?<minutes>\\d{1,2})");
|
|
39
|
-
// Seconds
|
|
40
|
-
if (formatRegexp.match(/ss/))
|
|
41
|
-
formatRegexp = formatRegexp.replace("ss", "(?<seconds>\\d{2})");
|
|
42
|
-
else if (formatRegexp.match(/s/))
|
|
43
|
-
formatRegexp = formatRegexp.replace("s", "(?<seconds>\\d{1,2})");
|
|
44
|
-
// Day
|
|
45
|
-
if (formatRegexp.match(/dd/))
|
|
46
|
-
formatRegexp = formatRegexp.replace("dd", "(?<day>\\d{2})");
|
|
47
|
-
else if (formatRegexp.match(/d/))
|
|
48
|
-
formatRegexp = formatRegexp.replace("d", "(?<day>\\d{1,2})");
|
|
49
|
-
// Day Of Week
|
|
50
|
-
if (formatRegexp.match(/EEEE/))
|
|
51
|
-
formatRegexp = formatRegexp.replace("EEEE", "(?<dayofweek>\\w+)");
|
|
52
|
-
// eslint-disable-next-line no-dupe-else-if
|
|
53
|
-
else if (formatRegexp.match(/EEEE/))
|
|
54
|
-
formatRegexp = formatRegexp.replace("EEE", "(?<dayofweek>\\w+)");
|
|
55
|
-
// Year
|
|
56
|
-
if (formatRegexp.match(/yyyy/))
|
|
57
|
-
formatRegexp = formatRegexp.replace("yyyy", "(?<year>\\d{4})");
|
|
58
|
-
else if (formatRegexp.match(/yy/))
|
|
59
|
-
formatRegexp = formatRegexp.replace("yy", "(?<year>\\d{2})");
|
|
60
|
-
// Month
|
|
61
|
-
if (formatRegexp.match(/MMMM/))
|
|
62
|
-
formatRegexp = formatRegexp.replace("MMMM", "(?<monthname>\\w+)");
|
|
63
|
-
else if (formatRegexp.match(/MMM/))
|
|
64
|
-
formatRegexp = formatRegexp.replace("MMM", "(?<monthnamesmall>\\w+)");
|
|
65
|
-
if (formatRegexp.match(/MM/))
|
|
66
|
-
formatRegexp = formatRegexp.replace("MM", "(?<month>\\d{2})");
|
|
67
|
-
else if (formatRegexp.match(/M/))
|
|
68
|
-
formatRegexp = formatRegexp.replace("M", "(?<month>\\d{1,2})");
|
|
69
|
-
// Milis and Am Pm
|
|
70
|
-
formatRegexp = formatRegexp
|
|
71
|
-
.replace("S", "(?<milis>\\d{1,3})")
|
|
72
|
-
.replace("aaa", "(?<ampm>\\w{2})");
|
|
73
|
-
const regexp = new RegExp(formatRegexp, "g");
|
|
74
|
-
const match = regexp.exec(date);
|
|
75
|
-
if (!match || !match.groups)
|
|
76
|
-
return new Date(date);
|
|
77
|
-
const safeParseInt = function (n) {
|
|
78
|
-
if (!n)
|
|
79
|
-
return 0;
|
|
80
|
-
const result = parseInt(n);
|
|
81
|
-
return isNaN(result) ? 0 : result;
|
|
82
|
-
};
|
|
83
|
-
const year = safeParseInt(match.groups.year);
|
|
84
|
-
const day = safeParseInt(match.groups.day);
|
|
85
|
-
const amPm = match.groups.ampm;
|
|
86
|
-
let hour = safeParseInt(match.groups.hour);
|
|
87
|
-
if (amPm)
|
|
88
|
-
hour = amPm === "PM" ? hour + 12 : hour;
|
|
89
|
-
const minutes = safeParseInt(match.groups.minutes);
|
|
90
|
-
const seconds = safeParseInt(match.groups.seconds);
|
|
91
|
-
const ms = safeParseInt(match.groups.milis);
|
|
92
|
-
const monthName = match.groups.monthname;
|
|
93
|
-
const monthNameSmall = match.groups.monthnamesmall;
|
|
94
|
-
let month = match.groups.month;
|
|
95
|
-
if (monthName)
|
|
96
|
-
month = constants_1.MONTH_NAMES.indexOf(monthName);
|
|
97
|
-
else if (monthNameSmall) {
|
|
98
|
-
const m = constants_1.MONTH_NAMES.find((m) => m.toLowerCase().startsWith(monthNameSmall.toLowerCase()));
|
|
99
|
-
if (!m)
|
|
100
|
-
return new Date(date);
|
|
101
|
-
month = constants_1.MONTH_NAMES.indexOf(m);
|
|
102
|
-
}
|
|
103
|
-
else
|
|
104
|
-
month = safeParseInt(`${month}`);
|
|
105
|
-
return new Date(year, month - 1, day, hour, minutes, seconds, ms);
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* @summary Binds a date format to a string
|
|
109
|
-
* @param {Date} [date]
|
|
110
|
-
* @param {string} [format]
|
|
111
|
-
* @memberOf module:decorator-validation.Utils.Format
|
|
112
|
-
* @category Utilities
|
|
113
|
-
*/
|
|
114
|
-
function bindDateToString(date, format) {
|
|
115
|
-
if (!date)
|
|
116
|
-
return;
|
|
117
|
-
const func = () => formatDate(date, format);
|
|
118
|
-
Object.defineProperty(date, "toISOString", {
|
|
119
|
-
enumerable: false,
|
|
120
|
-
configurable: false,
|
|
121
|
-
value: func,
|
|
122
|
-
});
|
|
123
|
-
Object.defineProperty(date, "toString", {
|
|
124
|
-
enumerable: false,
|
|
125
|
-
configurable: false,
|
|
126
|
-
value: func,
|
|
127
|
-
});
|
|
128
|
-
// Object.setPrototypeOf(date, Date.prototype);
|
|
129
|
-
return date;
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* @summary Helper function to be used instead of instanceOf Date
|
|
133
|
-
* @param date
|
|
134
|
-
* @memberOf module:decorator-validation.Utils.Dates
|
|
135
|
-
* @category Validation
|
|
136
|
-
*/
|
|
137
|
-
function isValidDate(date) {
|
|
138
|
-
return (date &&
|
|
139
|
-
Object.prototype.toString.call(date) === "[object Date]" &&
|
|
140
|
-
!Number.isNaN(date));
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* @summary Util function to pad numbers
|
|
144
|
-
* @param {number} num
|
|
145
|
-
*
|
|
146
|
-
* @return {string}
|
|
147
|
-
*
|
|
148
|
-
* @function twoDigitPad
|
|
149
|
-
* @memberOf module:decorator-validation.Utils.Format
|
|
150
|
-
* @category Format
|
|
151
|
-
*/
|
|
152
|
-
function twoDigitPad(num) {
|
|
153
|
-
return num < 10 ? "0" + num : num.toString();
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* @summary Date Format Handling
|
|
157
|
-
* @description Code from {@link https://stackoverflow.com/questions/3552461/how-to-format-a-javascript-date}
|
|
158
|
-
*
|
|
159
|
-
* <pre>
|
|
160
|
-
* Using similar formatting as Moment.js, Class DateTimeFormatter (Java), and Class SimpleDateFormat (Java),
|
|
161
|
-
* I implemented a comprehensive solution formatDate(date, patternStr) where the code is easy to read and modify.
|
|
162
|
-
* You can display date, time, AM/PM, etc.
|
|
163
|
-
*
|
|
164
|
-
* Date and Time Patterns
|
|
165
|
-
* yy = 2-digit year; yyyy = full year
|
|
166
|
-
* M = digit month; MM = 2-digit month; MMM = short month name; MMMM = full month name
|
|
167
|
-
* EEEE = full weekday name; EEE = short weekday name
|
|
168
|
-
* d = digit day; dd = 2-digit day
|
|
169
|
-
* h = hours am/pm; hh = 2-digit hours am/pm; H = hours; HH = 2-digit hours
|
|
170
|
-
* m = minutes; mm = 2-digit minutes; aaa = AM/PM
|
|
171
|
-
* s = seconds; ss = 2-digit seconds
|
|
172
|
-
* S = miliseconds
|
|
173
|
-
* </pre>
|
|
174
|
-
*
|
|
175
|
-
* @param {Date} date
|
|
176
|
-
* @param {string} [patternStr] defaults to 'yyyy/MM/dd'
|
|
177
|
-
* @return {string} the formatted date
|
|
178
|
-
*
|
|
179
|
-
* @function formatDate
|
|
180
|
-
* @memberOf module:decorator-validation.Utils.Dates
|
|
181
|
-
* @category Format
|
|
182
|
-
*/
|
|
183
|
-
function formatDate(date, patternStr = "yyyy/MM/dd") {
|
|
184
|
-
const day = date.getDate(), month = date.getMonth(), year = date.getFullYear(), hour = date.getHours(), minute = date.getMinutes(), second = date.getSeconds(), miliseconds = date.getMilliseconds(), h = hour % 12, hh = twoDigitPad(h), HH = twoDigitPad(hour), mm = twoDigitPad(minute), ss = twoDigitPad(second), aaa = hour < 12 ? "AM" : "PM", EEEE = constants_1.DAYS_OF_WEEK_NAMES[date.getDay()], EEE = EEEE.substr(0, 3), dd = twoDigitPad(day), M = month + 1, MM = twoDigitPad(M), MMMM = constants_1.MONTH_NAMES[month], MMM = MMMM.substr(0, 3), yyyy = year + "", yy = yyyy.substr(2, 2);
|
|
185
|
-
// checks to see if month name will be used
|
|
186
|
-
patternStr = patternStr
|
|
187
|
-
.replace("hh", hh)
|
|
188
|
-
.replace("h", h.toString())
|
|
189
|
-
.replace("HH", HH)
|
|
190
|
-
.replace("H", hour.toString())
|
|
191
|
-
.replace("mm", mm)
|
|
192
|
-
.replace("m", minute.toString())
|
|
193
|
-
.replace("ss", ss)
|
|
194
|
-
.replace("s", second.toString())
|
|
195
|
-
.replace("S", miliseconds.toString())
|
|
196
|
-
.replace("dd", dd)
|
|
197
|
-
.replace("d", day.toString())
|
|
198
|
-
.replace("EEEE", EEEE)
|
|
199
|
-
.replace("EEE", EEE)
|
|
200
|
-
.replace("yyyy", yyyy)
|
|
201
|
-
.replace("yy", yy)
|
|
202
|
-
.replace("aaa", aaa);
|
|
203
|
-
if (patternStr.indexOf("MMM") > -1) {
|
|
204
|
-
patternStr = patternStr.replace("MMMM", MMMM).replace("MMM", MMM);
|
|
205
|
-
}
|
|
206
|
-
else {
|
|
207
|
-
patternStr = patternStr.replace("MM", MM).replace("M", M.toString());
|
|
208
|
-
}
|
|
209
|
-
return patternStr;
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* @summary Parses a date from a specified format
|
|
213
|
-
* @param {string} format
|
|
214
|
-
* @param {string | Date | number} [v]
|
|
215
|
-
* @memberOf module:decorator-validation.Utils.Dates
|
|
216
|
-
* @category Format
|
|
217
|
-
*/
|
|
218
|
-
function parseDate(format, v) {
|
|
219
|
-
let value = undefined;
|
|
220
|
-
if (!v)
|
|
221
|
-
return undefined;
|
|
222
|
-
if (v instanceof Date)
|
|
223
|
-
try {
|
|
224
|
-
value = dateFromFormat(formatDate(v, format), format);
|
|
225
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
226
|
-
}
|
|
227
|
-
catch (e) {
|
|
228
|
-
throw new Error((0, strings_1.sf)("Could not convert date {0} to format: {1}", v.toString(), format));
|
|
229
|
-
}
|
|
230
|
-
else if (typeof v === "string") {
|
|
231
|
-
value = dateFromFormat(v, format);
|
|
232
|
-
}
|
|
233
|
-
else if (typeof v === "number") {
|
|
234
|
-
const d = new Date(v);
|
|
235
|
-
value = dateFromFormat(formatDate(d, format), format);
|
|
236
|
-
}
|
|
237
|
-
else if (isValidDate(v)) {
|
|
238
|
-
try {
|
|
239
|
-
const d = new Date(v);
|
|
240
|
-
value = dateFromFormat(formatDate(d, format), format);
|
|
241
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
242
|
-
}
|
|
243
|
-
catch (e) {
|
|
244
|
-
throw new Error((0, strings_1.sf)("Could not convert date {0} to format: {1}", v, format));
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
else {
|
|
248
|
-
throw new Error(`Invalid value provided ${v}`);
|
|
249
|
-
}
|
|
250
|
-
return bindDateToString(value, format);
|
|
251
|
-
}
|
package/lib/utils/decorators.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.prop = prop;
|
|
4
|
-
exports.propMetadata = propMetadata;
|
|
5
|
-
const reflection_1 = require("@decaf-ts/reflection");
|
|
6
|
-
const constants_1 = require("./constants");
|
|
7
|
-
function prop(key = constants_1.ModelKeys.ATTRIBUTE) {
|
|
8
|
-
return (model, propertyKey) => {
|
|
9
|
-
let props;
|
|
10
|
-
if (Object.prototype.hasOwnProperty.call(model, key)) {
|
|
11
|
-
props = model[key];
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
props = model[key] = [];
|
|
15
|
-
}
|
|
16
|
-
if (!props.includes(propertyKey))
|
|
17
|
-
props.push(propertyKey);
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
function propMetadata(key, value) {
|
|
21
|
-
return (0, reflection_1.apply)(prop(), (0, reflection_1.metadata)(key, value));
|
|
22
|
-
}
|
package/lib/utils/hashing.js
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Hashing = exports.DefaultHashingMethod = void 0;
|
|
4
|
-
exports.hashCode = hashCode;
|
|
5
|
-
exports.hashSerialization = hashSerialization;
|
|
6
|
-
exports.hashObj = hashObj;
|
|
7
|
-
const serialization_1 = require("./serialization");
|
|
8
|
-
/**
|
|
9
|
-
* @summary Mimics Java's String's Hash implementation
|
|
10
|
-
*
|
|
11
|
-
* @param {string | number | symbol | Date} obj
|
|
12
|
-
* @return {number} hash value of obj
|
|
13
|
-
*
|
|
14
|
-
* @function hashCode
|
|
15
|
-
* @memberOf module:decorator-validation.Utils.Hashing
|
|
16
|
-
* @category Hashing
|
|
17
|
-
*/
|
|
18
|
-
function hashCode(obj) {
|
|
19
|
-
obj = String(obj);
|
|
20
|
-
let hash = 0;
|
|
21
|
-
for (let i = 0; i < obj.length; i++) {
|
|
22
|
-
const character = obj.charCodeAt(i);
|
|
23
|
-
hash = (hash << 5) - hash + character;
|
|
24
|
-
hash = hash & hash; // Convert to 32bit integer
|
|
25
|
-
}
|
|
26
|
-
return hash.toString();
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* @summary Hashes an object serializing it and then hashing the string
|
|
30
|
-
* @description The Serialization algorithm used by default (JSON.stringify)
|
|
31
|
-
* is not deterministic and should not be used for hashing
|
|
32
|
-
*
|
|
33
|
-
* @param {Record<string, any>} obj
|
|
34
|
-
* @return {string} the resulting hash
|
|
35
|
-
*
|
|
36
|
-
* @function hashSerialization
|
|
37
|
-
* @memberOf module:decorator-validation.Utils.Hashing
|
|
38
|
-
*
|
|
39
|
-
* @category Hashing
|
|
40
|
-
*/
|
|
41
|
-
function hashSerialization(obj) {
|
|
42
|
-
return hashCode(serialization_1.Serialization.serialize(obj));
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* @summary Hashes an object by combining the hash of all its properties
|
|
46
|
-
*
|
|
47
|
-
* @param {Record<string, any>} obj
|
|
48
|
-
* @return {string} the resulting hash
|
|
49
|
-
*
|
|
50
|
-
* @function hashObj
|
|
51
|
-
* @memberOf module:decorator-validation.Utils.Hashing
|
|
52
|
-
* @category Hashing
|
|
53
|
-
*/
|
|
54
|
-
function hashObj(obj) {
|
|
55
|
-
const hashReducer = function (h, el) {
|
|
56
|
-
const elHash = hashFunction(el);
|
|
57
|
-
if (typeof elHash === "string")
|
|
58
|
-
return hashFunction((h || "") + hashFunction(el));
|
|
59
|
-
h = h || 0;
|
|
60
|
-
h = (h << 5) - h + elHash;
|
|
61
|
-
return h & h;
|
|
62
|
-
};
|
|
63
|
-
const func = hashCode;
|
|
64
|
-
const hashFunction = function (value) {
|
|
65
|
-
if (typeof value === "undefined")
|
|
66
|
-
return "";
|
|
67
|
-
if (["string", "number", "symbol"].indexOf(typeof value) !== -1)
|
|
68
|
-
return func(value.toString());
|
|
69
|
-
if (value instanceof Date)
|
|
70
|
-
return func(value.getTime());
|
|
71
|
-
if (Array.isArray(value))
|
|
72
|
-
return value.reduce(hashReducer, undefined);
|
|
73
|
-
return Object.values(value).reduce(hashReducer, undefined);
|
|
74
|
-
};
|
|
75
|
-
const result = Object.values(obj).reduce(hashReducer, 0);
|
|
76
|
-
return (typeof result === "number" ? Math.abs(result) : result).toString();
|
|
77
|
-
}
|
|
78
|
-
exports.DefaultHashingMethod = "default";
|
|
79
|
-
class Hashing {
|
|
80
|
-
static { this.current = exports.DefaultHashingMethod; }
|
|
81
|
-
static { this.cache = {
|
|
82
|
-
default: hashObj,
|
|
83
|
-
}; }
|
|
84
|
-
constructor() { }
|
|
85
|
-
static get(key) {
|
|
86
|
-
if (key in this.cache)
|
|
87
|
-
return this.cache[key];
|
|
88
|
-
throw new Error(`No hashing method registered under ${key}`);
|
|
89
|
-
}
|
|
90
|
-
static register(key, func, setDefault = false) {
|
|
91
|
-
if (key in this.cache)
|
|
92
|
-
throw new Error(`Hashing method ${key} already registered`);
|
|
93
|
-
this.cache[key] = func;
|
|
94
|
-
if (setDefault)
|
|
95
|
-
this.current = key;
|
|
96
|
-
}
|
|
97
|
-
static hash(obj, method, ...args) {
|
|
98
|
-
if (!method)
|
|
99
|
-
return this.get(this.current)(obj, ...args);
|
|
100
|
-
return this.get(method)(obj, ...args);
|
|
101
|
-
}
|
|
102
|
-
static setDefault(method) {
|
|
103
|
-
this.current = this.get(method);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
exports.Hashing = Hashing;
|
package/lib/utils/index.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./constants"), exports);
|
|
18
|
-
__exportStar(require("./dates"), exports);
|
|
19
|
-
__exportStar(require("./decorators"), exports);
|
|
20
|
-
__exportStar(require("./hashing"), exports);
|
|
21
|
-
__exportStar(require("./registry"), exports);
|
|
22
|
-
__exportStar(require("./serialization"), exports);
|
|
23
|
-
__exportStar(require("./strings"), exports);
|
package/lib/utils/registry.d.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { Constructor } from "../model/types";
|
|
2
|
-
/**
|
|
3
|
-
* @summary Basic interface for Registries
|
|
4
|
-
*
|
|
5
|
-
* @interface IRegistry
|
|
6
|
-
*
|
|
7
|
-
* @category Utilities
|
|
8
|
-
*/
|
|
9
|
-
export interface IRegistry<T> {
|
|
10
|
-
/**
|
|
11
|
-
* @summary Registers an Object
|
|
12
|
-
*
|
|
13
|
-
* @param {T} obj
|
|
14
|
-
* @param {any[]} args
|
|
15
|
-
*
|
|
16
|
-
* @method
|
|
17
|
-
*/
|
|
18
|
-
register(obj: T | any, ...args: any[]): void;
|
|
19
|
-
/**
|
|
20
|
-
* @summary Retrieves an Object if it can find it
|
|
21
|
-
*
|
|
22
|
-
* @param {any} key
|
|
23
|
-
* @param {any[]} args
|
|
24
|
-
* @return {T | undefined}
|
|
25
|
-
*
|
|
26
|
-
* @method
|
|
27
|
-
*/
|
|
28
|
-
get(key: any, ...args: any[]): T | undefined;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* @summary Basic Builder Registry Interface
|
|
32
|
-
*
|
|
33
|
-
* @typedef T
|
|
34
|
-
* @interface BuilderRegistry<T>
|
|
35
|
-
*
|
|
36
|
-
* @category Construction
|
|
37
|
-
*/
|
|
38
|
-
export interface BuilderRegistry<T> extends IRegistry<Constructor<T>> {
|
|
39
|
-
/**
|
|
40
|
-
* @summary Retrieves an Builder Object by name if it can
|
|
41
|
-
*
|
|
42
|
-
* @param {string} name
|
|
43
|
-
* @param {any[]} args
|
|
44
|
-
*
|
|
45
|
-
* @method
|
|
46
|
-
*/
|
|
47
|
-
get(name: string, ...args: any[]): Constructor<T> | undefined;
|
|
48
|
-
/**
|
|
49
|
-
* @summary Registers a constructor by name
|
|
50
|
-
*
|
|
51
|
-
* @param {Constructor<T>} [constructor]
|
|
52
|
-
* @param {name} name
|
|
53
|
-
* @param {any[]} args
|
|
54
|
-
*
|
|
55
|
-
* @method
|
|
56
|
-
*/
|
|
57
|
-
register(constructor: Constructor<T>, name?: string, ...args: any[]): void;
|
|
58
|
-
/**
|
|
59
|
-
* @summary Builds an Object by name
|
|
60
|
-
*
|
|
61
|
-
* @param {{}} obj
|
|
62
|
-
* @param {any[]} args
|
|
63
|
-
* @return T
|
|
64
|
-
*
|
|
65
|
-
* @method
|
|
66
|
-
*/
|
|
67
|
-
build(obj: Record<string, any> | T, ...args: any[]): T;
|
|
68
|
-
}
|
package/lib/utils/registry.js
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Serialization = exports.DefaultSerializationMethod = exports.JSONSerializer = void 0;
|
|
4
|
-
const Model_1 = require("../model/Model");
|
|
5
|
-
const constants_1 = require("./constants");
|
|
6
|
-
/**
|
|
7
|
-
* @summary Concrete implementation of a {@link Serializer} in JSON format
|
|
8
|
-
* @description JS's native JSON.stringify (used here) is not deterministic
|
|
9
|
-
* and therefore should not be used for hashing purposes
|
|
10
|
-
*
|
|
11
|
-
* To keep dependencies low, we will not implement this, but we recommend
|
|
12
|
-
* implementing a similar {@link JSONSerializer} using 'deterministic-json' libraries
|
|
13
|
-
*
|
|
14
|
-
* @class JSONSerializer
|
|
15
|
-
* @implements Serializer
|
|
16
|
-
*
|
|
17
|
-
* @category Serialization
|
|
18
|
-
*/
|
|
19
|
-
class JSONSerializer {
|
|
20
|
-
/**
|
|
21
|
-
* @summary prepares the model for serialization
|
|
22
|
-
* @description returns a shallow copy of the object, containing an enumerable {@link ModelKeys#ANCHOR} property
|
|
23
|
-
* so the object can be recognized upon deserialization
|
|
24
|
-
*
|
|
25
|
-
* @param {T} model
|
|
26
|
-
* @protected
|
|
27
|
-
*/
|
|
28
|
-
preSerialize(model) {
|
|
29
|
-
// TODO: nested preserialization (so increase performance when deserializing)
|
|
30
|
-
const toSerialize = Object.assign({}, model);
|
|
31
|
-
const metadata = Model_1.Model.getMetadata(model);
|
|
32
|
-
toSerialize[constants_1.ModelKeys.ANCHOR] = metadata || model.constructor.name;
|
|
33
|
-
return toSerialize;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* @summary Rebuilds a model from a serialization
|
|
37
|
-
* @param {string} str
|
|
38
|
-
*
|
|
39
|
-
* @throws {Error} If it fails to parse the string, or to build the model
|
|
40
|
-
*/
|
|
41
|
-
deserialize(str) {
|
|
42
|
-
const deserialization = JSON.parse(str);
|
|
43
|
-
const className = deserialization[constants_1.ModelKeys.ANCHOR];
|
|
44
|
-
if (!className)
|
|
45
|
-
throw new Error("Could not find class reference in serialized model");
|
|
46
|
-
const model = Model_1.Model.build(deserialization, className);
|
|
47
|
-
return model;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* @summary Serializes a model
|
|
51
|
-
* @param {T} model
|
|
52
|
-
*
|
|
53
|
-
* @throws {Error} if fails to serialize
|
|
54
|
-
*/
|
|
55
|
-
serialize(model) {
|
|
56
|
-
return JSON.stringify(this.preSerialize(model));
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
exports.JSONSerializer = JSONSerializer;
|
|
60
|
-
exports.DefaultSerializationMethod = "json";
|
|
61
|
-
class Serialization {
|
|
62
|
-
static { this.current = exports.DefaultSerializationMethod; }
|
|
63
|
-
static { this.cache = {
|
|
64
|
-
json: new JSONSerializer(),
|
|
65
|
-
}; }
|
|
66
|
-
constructor() { }
|
|
67
|
-
static get(key) {
|
|
68
|
-
if (key in this.cache)
|
|
69
|
-
return this.cache[key];
|
|
70
|
-
throw new Error(`No serialization method registered under ${key}`);
|
|
71
|
-
}
|
|
72
|
-
static register(key, func, setDefault = false) {
|
|
73
|
-
if (key in this.cache)
|
|
74
|
-
throw new Error(`Serialization method ${key} already registered`);
|
|
75
|
-
this.cache[key] = new func();
|
|
76
|
-
if (setDefault)
|
|
77
|
-
this.current = key;
|
|
78
|
-
}
|
|
79
|
-
static serialize(obj, method, ...args) {
|
|
80
|
-
if (!method)
|
|
81
|
-
return this.get(this.current).serialize(obj, ...args);
|
|
82
|
-
return this.get(method).serialize(obj, ...args);
|
|
83
|
-
}
|
|
84
|
-
static deserialize(obj, method, ...args) {
|
|
85
|
-
if (!method)
|
|
86
|
-
return this.get(this.current).deserialize(obj, ...args);
|
|
87
|
-
return this.get(method).deserialize(obj, ...args);
|
|
88
|
-
}
|
|
89
|
-
static setDefault(method) {
|
|
90
|
-
this.current = this.get(method);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
exports.Serialization = Serialization;
|
package/lib/utils/strings.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @summary Util function to provide string format functionality similar to C#'s string.format
|
|
3
|
-
*
|
|
4
|
-
* @param {string} string
|
|
5
|
-
* @param {Array<string | number>} [args] replacements made by order of appearance (replacement0 wil replace {0} and so on)
|
|
6
|
-
* @return {string} formatted string
|
|
7
|
-
*
|
|
8
|
-
* @function stringFormat
|
|
9
|
-
* @memberOf module:decorator-validation.Utils.Format
|
|
10
|
-
* @category Format
|
|
11
|
-
*/
|
|
12
|
-
export declare function stringFormat(string: string, ...args: (string | number)[]): string;
|
|
13
|
-
/**
|
|
14
|
-
* @summary Util function to provide string format functionality similar to C#'s string.format
|
|
15
|
-
* @description alias for {@link stringFormat}
|
|
16
|
-
*
|
|
17
|
-
* @param {string} string
|
|
18
|
-
* @param {string} args replacements made by order of appearance (replacement0 wil replace {0} and so on)
|
|
19
|
-
* @return {string} formatted string
|
|
20
|
-
*
|
|
21
|
-
* @function sf
|
|
22
|
-
* @memberOf module:decorator-validation.Utils.Format
|
|
23
|
-
* @category Format
|
|
24
|
-
*/
|
|
25
|
-
export declare const sf: typeof stringFormat;
|
package/lib/utils/strings.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sf = void 0;
|
|
4
|
-
exports.stringFormat = stringFormat;
|
|
5
|
-
/**
|
|
6
|
-
* @summary Util function to provide string format functionality similar to C#'s string.format
|
|
7
|
-
*
|
|
8
|
-
* @param {string} string
|
|
9
|
-
* @param {Array<string | number>} [args] replacements made by order of appearance (replacement0 wil replace {0} and so on)
|
|
10
|
-
* @return {string} formatted string
|
|
11
|
-
*
|
|
12
|
-
* @function stringFormat
|
|
13
|
-
* @memberOf module:decorator-validation.Utils.Format
|
|
14
|
-
* @category Format
|
|
15
|
-
*/
|
|
16
|
-
function stringFormat(string, ...args) {
|
|
17
|
-
return string.replace(/{(\d+)}/g, function (match, number) {
|
|
18
|
-
return typeof args[number] !== "undefined"
|
|
19
|
-
? args[number].toString()
|
|
20
|
-
: "undefined";
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* @summary Util function to provide string format functionality similar to C#'s string.format
|
|
25
|
-
* @description alias for {@link stringFormat}
|
|
26
|
-
*
|
|
27
|
-
* @param {string} string
|
|
28
|
-
* @param {string} args replacements made by order of appearance (replacement0 wil replace {0} and so on)
|
|
29
|
-
* @return {string} formatted string
|
|
30
|
-
*
|
|
31
|
-
* @function sf
|
|
32
|
-
* @memberOf module:decorator-validation.Utils.Format
|
|
33
|
-
* @category Format
|
|
34
|
-
*/
|
|
35
|
-
exports.sf = stringFormat;
|