namefully 1.0.9 → 1.2.0
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 +21 -674
- package/dist/example/index.js +2734 -0
- package/dist/lib/config.d.ts +121 -0
- package/dist/lib/config.js +189 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/constants.d.ts +4 -0
- package/dist/lib/constants.js +31 -0
- package/dist/lib/constants.js.map +1 -0
- package/dist/lib/error.d.ts +172 -0
- package/dist/lib/error.js +210 -0
- package/dist/lib/error.js.map +1 -0
- package/dist/lib/{usecases/index.d.ts → example/example.d.ts} +0 -0
- package/dist/lib/full-name.d.ts +71 -0
- package/dist/lib/full-name.js +147 -0
- package/dist/lib/full-name.js.map +1 -0
- package/dist/lib/index.d.ts +16 -6
- package/dist/lib/index.js +29 -8
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/name.d.ts +177 -0
- package/dist/lib/name.js +322 -0
- package/dist/lib/name.js.map +1 -0
- package/dist/lib/namefully.d.ts +303 -208
- package/dist/lib/namefully.js +603 -442
- package/dist/lib/namefully.js.map +1 -1
- package/dist/lib/parser.d.ts +46 -0
- package/dist/lib/parser.js +173 -0
- package/dist/lib/parser.js.map +1 -0
- package/dist/lib/src/config.d.ts +121 -0
- package/dist/lib/src/constants.d.ts +4 -0
- package/dist/lib/src/error.d.ts +172 -0
- package/dist/lib/src/full-name.d.ts +71 -0
- package/dist/lib/src/index.d.ts +16 -6
- package/dist/lib/src/name.d.ts +177 -0
- package/dist/lib/src/namefully.d.ts +303 -208
- package/dist/lib/src/parser.d.ts +46 -0
- package/dist/lib/src/types.d.ts +127 -0
- package/dist/lib/src/utils.d.ts +63 -0
- package/dist/lib/src/validator.d.ts +66 -0
- package/dist/lib/types.d.ts +127 -0
- package/dist/lib/types.js +181 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/lib/utils.d.ts +63 -0
- package/dist/lib/utils.js +138 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/lib/validator.d.ts +66 -0
- package/dist/lib/validator.js +332 -0
- package/dist/lib/validator.js.map +1 -0
- package/dist/umd/namefully.js +2191 -2111
- package/dist/umd/namefully.js.map +1 -1
- package/dist/umd/namefully.min.js +1 -1
- package/dist/umd/namefully.min.js.LICENSE.txt +8 -20
- package/dist/umd/namefully.min.js.map +1 -1
- package/package.json +50 -53
- package/readme.md +151 -175
- package/changelog.md +0 -114
- package/dist/lib/core/constants.d.ts +0 -26
- package/dist/lib/core/constants.js +0 -42
- package/dist/lib/core/constants.js.map +0 -1
- package/dist/lib/core/index.d.ts +0 -9
- package/dist/lib/core/index.js +0 -13
- package/dist/lib/core/index.js.map +0 -1
- package/dist/lib/core/parsers/array-name.parser.d.ts +0 -42
- package/dist/lib/core/parsers/array-name.parser.js +0 -84
- package/dist/lib/core/parsers/array-name.parser.js.map +0 -1
- package/dist/lib/core/parsers/array-string.parser.d.ts +0 -48
- package/dist/lib/core/parsers/array-string.parser.js +0 -96
- package/dist/lib/core/parsers/array-string.parser.js.map +0 -1
- package/dist/lib/core/parsers/index.d.ts +0 -11
- package/dist/lib/core/parsers/index.js +0 -11
- package/dist/lib/core/parsers/index.js.map +0 -1
- package/dist/lib/core/parsers/nama.parser.d.ts +0 -34
- package/dist/lib/core/parsers/nama.parser.js +0 -75
- package/dist/lib/core/parsers/nama.parser.js.map +0 -1
- package/dist/lib/core/parsers/parser.d.ts +0 -29
- package/dist/lib/core/parsers/parser.js +0 -3
- package/dist/lib/core/parsers/parser.js.map +0 -1
- package/dist/lib/core/parsers/string.parser.d.ts +0 -61
- package/dist/lib/core/parsers/string.parser.js +0 -63
- package/dist/lib/core/parsers/string.parser.js.map +0 -1
- package/dist/lib/core/utils/utils.d.ts +0 -14
- package/dist/lib/core/utils/utils.js +0 -67
- package/dist/lib/core/utils/utils.js.map +0 -1
- package/dist/lib/models/enums.d.ts +0 -91
- package/dist/lib/models/enums.js +0 -98
- package/dist/lib/models/enums.js.map +0 -1
- package/dist/lib/models/firstname.d.ts +0 -41
- package/dist/lib/models/firstname.js +0 -59
- package/dist/lib/models/firstname.js.map +0 -1
- package/dist/lib/models/index.d.ts +0 -12
- package/dist/lib/models/index.js +0 -15
- package/dist/lib/models/index.js.map +0 -1
- package/dist/lib/models/lastname.d.ts +0 -44
- package/dist/lib/models/lastname.js +0 -86
- package/dist/lib/models/lastname.js.map +0 -1
- package/dist/lib/models/misc.d.ts +0 -80
- package/dist/lib/models/misc.js +0 -3
- package/dist/lib/models/misc.js.map +0 -1
- package/dist/lib/models/name.d.ts +0 -48
- package/dist/lib/models/name.js +0 -72
- package/dist/lib/models/name.js.map +0 -1
- package/dist/lib/models/summary.d.ts +0 -23
- package/dist/lib/models/summary.js +0 -60
- package/dist/lib/models/summary.js.map +0 -1
- package/dist/lib/src/core/constants.d.ts +0 -26
- package/dist/lib/src/core/index.d.ts +0 -9
- package/dist/lib/src/core/parsers/array-name.parser.d.ts +0 -42
- package/dist/lib/src/core/parsers/array-string.parser.d.ts +0 -48
- package/dist/lib/src/core/parsers/index.d.ts +0 -11
- package/dist/lib/src/core/parsers/nama.parser.d.ts +0 -34
- package/dist/lib/src/core/parsers/parser.d.ts +0 -29
- package/dist/lib/src/core/parsers/string.parser.d.ts +0 -61
- package/dist/lib/src/core/utils/utils.d.ts +0 -14
- package/dist/lib/src/models/enums.d.ts +0 -91
- package/dist/lib/src/models/firstname.d.ts +0 -41
- package/dist/lib/src/models/index.d.ts +0 -12
- package/dist/lib/src/models/lastname.d.ts +0 -44
- package/dist/lib/src/models/misc.d.ts +0 -80
- package/dist/lib/src/models/name.d.ts +0 -48
- package/dist/lib/src/models/summary.d.ts +0 -23
- package/dist/lib/src/validators/array-name.validator.d.ts +0 -25
- package/dist/lib/src/validators/array-string.validator.d.ts +0 -43
- package/dist/lib/src/validators/common/validation-error.d.ts +0 -19
- package/dist/lib/src/validators/common/validation-rule.d.ts +0 -69
- package/dist/lib/src/validators/common/validation-type.d.ts +0 -24
- package/dist/lib/src/validators/firstname.validator.d.ts +0 -20
- package/dist/lib/src/validators/fullname.validator.d.ts +0 -21
- package/dist/lib/src/validators/index.d.ts +0 -21
- package/dist/lib/src/validators/lastname.validator.d.ts +0 -20
- package/dist/lib/src/validators/middlename.validator.d.ts +0 -20
- package/dist/lib/src/validators/nama.validator.d.ts +0 -21
- package/dist/lib/src/validators/namon.validator.d.ts +0 -20
- package/dist/lib/src/validators/prefix.validator.d.ts +0 -14
- package/dist/lib/src/validators/string-name.validator.d.ts +0 -20
- package/dist/lib/src/validators/suffix.validator.d.ts +0 -14
- package/dist/lib/src/validators/validator.d.ts +0 -13
- package/dist/lib/usecases/compress.usecase.d.ts +0 -8
- package/dist/lib/usecases/constants.d.ts +0 -7
- package/dist/lib/usecases/describe.usecase.d.ts +0 -12
- package/dist/lib/usecases/format.usecase.d.ts +0 -6
- package/dist/lib/usecases/namefully.usecase.d.ts +0 -14
- package/dist/lib/usecases/shorten.usecase.d.ts +0 -6
- package/dist/lib/validators/array-name.validator.d.ts +0 -25
- package/dist/lib/validators/array-name.validator.js +0 -82
- package/dist/lib/validators/array-name.validator.js.map +0 -1
- package/dist/lib/validators/array-string.validator.d.ts +0 -43
- package/dist/lib/validators/array-string.validator.js +0 -80
- package/dist/lib/validators/array-string.validator.js.map +0 -1
- package/dist/lib/validators/common/validation-error.d.ts +0 -19
- package/dist/lib/validators/common/validation-error.js +0 -26
- package/dist/lib/validators/common/validation-error.js.map +0 -1
- package/dist/lib/validators/common/validation-rule.d.ts +0 -69
- package/dist/lib/validators/common/validation-rule.js +0 -73
- package/dist/lib/validators/common/validation-rule.js.map +0 -1
- package/dist/lib/validators/common/validation-type.d.ts +0 -24
- package/dist/lib/validators/common/validation-type.js +0 -28
- package/dist/lib/validators/common/validation-type.js.map +0 -1
- package/dist/lib/validators/firstname.validator.d.ts +0 -20
- package/dist/lib/validators/firstname.validator.js +0 -29
- package/dist/lib/validators/firstname.validator.js.map +0 -1
- package/dist/lib/validators/fullname.validator.d.ts +0 -21
- package/dist/lib/validators/fullname.validator.js +0 -38
- package/dist/lib/validators/fullname.validator.js.map +0 -1
- package/dist/lib/validators/index.d.ts +0 -21
- package/dist/lib/validators/index.js +0 -35
- package/dist/lib/validators/index.js.map +0 -1
- package/dist/lib/validators/lastname.validator.d.ts +0 -20
- package/dist/lib/validators/lastname.validator.js +0 -29
- package/dist/lib/validators/lastname.validator.js.map +0 -1
- package/dist/lib/validators/middlename.validator.d.ts +0 -20
- package/dist/lib/validators/middlename.validator.js +0 -38
- package/dist/lib/validators/middlename.validator.js.map +0 -1
- package/dist/lib/validators/nama.validator.d.ts +0 -21
- package/dist/lib/validators/nama.validator.js +0 -43
- package/dist/lib/validators/nama.validator.js.map +0 -1
- package/dist/lib/validators/namon.validator.d.ts +0 -20
- package/dist/lib/validators/namon.validator.js +0 -29
- package/dist/lib/validators/namon.validator.js.map +0 -1
- package/dist/lib/validators/prefix.validator.d.ts +0 -14
- package/dist/lib/validators/prefix.validator.js +0 -31
- package/dist/lib/validators/prefix.validator.js.map +0 -1
- package/dist/lib/validators/string-name.validator.d.ts +0 -20
- package/dist/lib/validators/string-name.validator.js +0 -29
- package/dist/lib/validators/string-name.validator.js.map +0 -1
- package/dist/lib/validators/suffix.validator.d.ts +0 -14
- package/dist/lib/validators/suffix.validator.js +0 -31
- package/dist/lib/validators/suffix.validator.js.map +0 -1
- package/dist/lib/validators/validator.d.ts +0 -13
- package/dist/lib/validators/validator.js +0 -9
- package/dist/lib/validators/validator.js.map +0 -1
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UnknownError = exports.NotAllowedError = exports.ValidationError = exports.InputError = exports.NameError = exports.NameErrorType = void 0;
|
|
4
|
+
const utils_1 = require("./utils");
|
|
5
|
+
/**
|
|
6
|
+
* The error types supported by `Namefully`.
|
|
7
|
+
*/
|
|
8
|
+
var NameErrorType;
|
|
9
|
+
(function (NameErrorType) {
|
|
10
|
+
/**
|
|
11
|
+
* Thrown when a name entry/argument is incorrect.
|
|
12
|
+
*
|
|
13
|
+
* For example, a name should have a minimum of 2 characters, so an empty
|
|
14
|
+
* string or a string of one character would cause this kind of error.
|
|
15
|
+
*/
|
|
16
|
+
NameErrorType[NameErrorType["INPUT"] = 0] = "INPUT";
|
|
17
|
+
/**
|
|
18
|
+
* Thrown when the name components do not match the validation rules if the
|
|
19
|
+
* `Config.bypass` is not flagged up. This bypass option skips the validation
|
|
20
|
+
* rules.
|
|
21
|
+
*
|
|
22
|
+
* See also: `ValidationError`
|
|
23
|
+
*/
|
|
24
|
+
NameErrorType[NameErrorType["VALIDATION"] = 1] = "VALIDATION";
|
|
25
|
+
/**
|
|
26
|
+
* Thrown by not allowed operations such as in NameBuilder or name formatting.
|
|
27
|
+
*
|
|
28
|
+
* See also: `NotAllowedError`, `Namefully.format`.
|
|
29
|
+
*/
|
|
30
|
+
NameErrorType[NameErrorType["NOT_ALLOWED"] = 2] = "NOT_ALLOWED";
|
|
31
|
+
/**
|
|
32
|
+
* Thrown by any other unknown sources or unexpected situation.
|
|
33
|
+
*/
|
|
34
|
+
NameErrorType[NameErrorType["UNKNOWN"] = 3] = "UNKNOWN";
|
|
35
|
+
})(NameErrorType = exports.NameErrorType || (exports.NameErrorType = {}));
|
|
36
|
+
/**
|
|
37
|
+
* Base class for all name-related errors.
|
|
38
|
+
*
|
|
39
|
+
* A custom error is intended to convey information to the user about a failure,
|
|
40
|
+
* so that it can be addressed programmatically.
|
|
41
|
+
*
|
|
42
|
+
* A name handling failure is not considered a native error that should cause a
|
|
43
|
+
* program failure. Au contraire, it is expected that a programmer using this utility
|
|
44
|
+
* would consider validating a name using its own business rules. That is not
|
|
45
|
+
* this utility's job to guess those rules. So, the predefined `ValidationRules`
|
|
46
|
+
* obey some common validation techniques when it comes to sanitizing a person
|
|
47
|
+
* name. For this reason, the [Config.bypass] is set to `true` by default,
|
|
48
|
+
* indicating that those predefined rules should be skipped for the sake of the
|
|
49
|
+
* program.
|
|
50
|
+
*
|
|
51
|
+
* A programmer may leverage `Parser` to indicate business-tailored rules if he
|
|
52
|
+
* or she wants this utility to perform those safety checks behind the scenes.
|
|
53
|
+
*
|
|
54
|
+
* A name error intends to provide useful information about what causes the error
|
|
55
|
+
* and let the user take initiative on what happens next to the given name:
|
|
56
|
+
* reconstructing it or skipping it.
|
|
57
|
+
*/
|
|
58
|
+
class NameError extends Error {
|
|
59
|
+
/**
|
|
60
|
+
* Creates an error with a message describing the issue for a name source.
|
|
61
|
+
* @param source name input that caused the error
|
|
62
|
+
* @param message a message describing the failure.
|
|
63
|
+
* @param type of `NameErrorType`
|
|
64
|
+
*/
|
|
65
|
+
constructor(source, message, type = NameErrorType.UNKNOWN) {
|
|
66
|
+
super(message);
|
|
67
|
+
this.source = source;
|
|
68
|
+
this.type = type;
|
|
69
|
+
this.name = 'NameError';
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The actual source input which caused the error.
|
|
73
|
+
*/
|
|
74
|
+
get sourceAsString() {
|
|
75
|
+
let input = '';
|
|
76
|
+
if (!this.source)
|
|
77
|
+
input = '<undefined>';
|
|
78
|
+
if (typeof this.source === 'string')
|
|
79
|
+
input = this.source;
|
|
80
|
+
if (utils_1.isNameArray(this.source))
|
|
81
|
+
input = this.source.map((n) => n.toString()).join(' ');
|
|
82
|
+
if (utils_1.isStringArray(this.source))
|
|
83
|
+
input = this.source.join(' ');
|
|
84
|
+
return input;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Whether a message describing the failure exists.
|
|
88
|
+
*/
|
|
89
|
+
get hasMessage() {
|
|
90
|
+
return this.message && this.message.trim().length > 0;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Returns a string representation of the error.
|
|
94
|
+
*/
|
|
95
|
+
toString() {
|
|
96
|
+
let report = `${this.name} (${this.sourceAsString})`;
|
|
97
|
+
if (this.hasMessage)
|
|
98
|
+
report = `${report}: ${this.message}`;
|
|
99
|
+
return report;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
exports.NameError = NameError;
|
|
103
|
+
/**
|
|
104
|
+
* An error thrown when a name source input is incorrect.
|
|
105
|
+
*
|
|
106
|
+
* A `Name` is a name for this utility under certain criteria (i.e., 2+ chars),
|
|
107
|
+
* hence, a wrong input will cause this kind of error. Another common reason
|
|
108
|
+
* may be a wrong key in a Json name parsing mechanism.
|
|
109
|
+
*
|
|
110
|
+
* Keep in mind that this error is different from a `ValidationError`.
|
|
111
|
+
*/
|
|
112
|
+
class InputError extends NameError {
|
|
113
|
+
/**
|
|
114
|
+
* Creates a new `InputError` with an optional error `message`.
|
|
115
|
+
*
|
|
116
|
+
* The name source is by nature a string content, maybe wrapped up in a different
|
|
117
|
+
* type. This string value may be extracted to form the following output:
|
|
118
|
+
* "InputError (stringName)",
|
|
119
|
+
* "InputError (stringName): message".
|
|
120
|
+
*/
|
|
121
|
+
constructor(error) {
|
|
122
|
+
super(error.source, error.message, NameErrorType.INPUT);
|
|
123
|
+
this.name = 'InputError';
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
exports.InputError = InputError;
|
|
127
|
+
/**
|
|
128
|
+
* An error thrown to indicate that a name fails the validation rules.
|
|
129
|
+
*/
|
|
130
|
+
class ValidationError extends NameError {
|
|
131
|
+
/**
|
|
132
|
+
* Creates error containing the invalid `nameType` and a `message` that
|
|
133
|
+
* briefly describes the problem if provided.
|
|
134
|
+
*
|
|
135
|
+
* For example, a validation error can be interpreted as:
|
|
136
|
+
* "ValidationError (nameType='stringName')",
|
|
137
|
+
* "ValidationError (nameType='stringName'): message"
|
|
138
|
+
*/
|
|
139
|
+
constructor(error) {
|
|
140
|
+
super(error.source, error.message, NameErrorType.VALIDATION);
|
|
141
|
+
this.nameType = error.nameType;
|
|
142
|
+
this.name = 'ValidationError';
|
|
143
|
+
}
|
|
144
|
+
toString() {
|
|
145
|
+
let report = `${this.name} (${this.nameType}='${this.sourceAsString}')`;
|
|
146
|
+
if (this.hasMessage)
|
|
147
|
+
report = `${report}: ${this.message}`;
|
|
148
|
+
return report;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
exports.ValidationError = ValidationError;
|
|
152
|
+
/**
|
|
153
|
+
* Thrown by not allowed operations such as in name formatting.
|
|
154
|
+
*
|
|
155
|
+
* For example, this will occur when trying to format a name accordingly using
|
|
156
|
+
* a non-supported key.
|
|
157
|
+
*/
|
|
158
|
+
class NotAllowedError extends NameError {
|
|
159
|
+
/**
|
|
160
|
+
* Creates a new `NotAllowedError` with an optional error `message` and the
|
|
161
|
+
* `operation` name.
|
|
162
|
+
*
|
|
163
|
+
* For example, an error of this kind can be interpreted as:
|
|
164
|
+
* "NotAllowedError (stringName)",
|
|
165
|
+
* "NotAllowedError (stringName) - operationName",
|
|
166
|
+
* "NotAllowedError (stringName) - operationName: message"
|
|
167
|
+
*/
|
|
168
|
+
constructor(error) {
|
|
169
|
+
super(error.source, error.message, NameErrorType.NOT_ALLOWED);
|
|
170
|
+
this.operation = error.operation;
|
|
171
|
+
this.name = 'NotAllowedError';
|
|
172
|
+
}
|
|
173
|
+
toString() {
|
|
174
|
+
let report = `${this.name} (${this.sourceAsString})`;
|
|
175
|
+
if (this.operation && this.operation.trim().length > 0)
|
|
176
|
+
report = `${report} - ${this.operation}`;
|
|
177
|
+
if (this.hasMessage)
|
|
178
|
+
report = `${report}: ${this.message}`;
|
|
179
|
+
return report;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
exports.NotAllowedError = NotAllowedError;
|
|
183
|
+
/**
|
|
184
|
+
* A fallback error thrown by any unknown sources or unexpected failure that are
|
|
185
|
+
* not of `NameError`.
|
|
186
|
+
*
|
|
187
|
+
* In this particular case, an `origin` remains useful as it provides details
|
|
188
|
+
* on the sources and the true nature of the unexpected error.
|
|
189
|
+
* At this point, deciding whether to exit the program or not depends on the
|
|
190
|
+
* programmer.
|
|
191
|
+
*/
|
|
192
|
+
class UnknownError extends NameError {
|
|
193
|
+
/**
|
|
194
|
+
* Creates a new `UnknownError` with an optional error `message`.
|
|
195
|
+
* Optionally, the original error revealing the true nature of the failure.
|
|
196
|
+
*/
|
|
197
|
+
constructor(error) {
|
|
198
|
+
super(error.source, error.message, NameErrorType.UNKNOWN);
|
|
199
|
+
this.origin = error.error;
|
|
200
|
+
this.name = 'UnknownError';
|
|
201
|
+
}
|
|
202
|
+
toString() {
|
|
203
|
+
let report = super.toString();
|
|
204
|
+
if (this.origin)
|
|
205
|
+
report += `\n${this.origin.toString()}`;
|
|
206
|
+
return report;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
exports.UnknownError = UnknownError;
|
|
210
|
+
//# sourceMappingURL=error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/error.ts"],"names":[],"mappings":";;;AAEA,mCAAoD;AASpD;;GAEG;AACH,IAAY,aA6BX;AA7BD,WAAY,aAAa;IACrB;;;;;OAKG;IACH,mDAAK,CAAA;IAEL;;;;;;OAMG;IACH,6DAAU,CAAA;IAEV;;;;OAIG;IACH,+DAAW,CAAA;IAEX;;OAEG;IACH,uDAAO,CAAA;AACX,CAAC,EA7BW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QA6BxB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAa,SAAU,SAAQ,KAAK;IAChC;;;;;OAKG;IACH,YAAqB,MAAkB,EAAE,OAAgB,EAAW,OAAsB,aAAa,CAAC,OAAO;QAC3G,KAAK,CAAC,OAAO,CAAC,CAAA;QADG,WAAM,GAAN,MAAM,CAAY;QAA6B,SAAI,GAAJ,IAAI,CAAuC;QAE3G,IAAI,CAAC,IAAI,GAAG,WAAW,CAAA;IAC3B,CAAC;IAED;;OAEG;IACH,IAAI,cAAc;QACd,IAAI,KAAK,GAAG,EAAE,CAAA;QACd,IAAI,CAAC,IAAI,CAAC,MAAM;YAAE,KAAK,GAAG,aAAa,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GG;IACH,YAAY,KAAuC;QAC/C,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,CAAA;QACzD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,KAAK,CAAA;QACzB,IAAI,CAAC,IAAI,GAAG,cAAc,CAAA;IAC9B,CAAC;IAED,QAAQ;QACJ,IAAI,MAAM,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAA;QAC7B,IAAI,IAAI,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAA;QACxD,OAAO,MAAM,CAAA;IACjB,CAAC;CACJ;AArBD,oCAqBC"}
|
|
File without changes
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Config } from './config';
|
|
2
|
+
import { FirstName, LastName, Name, JsonName } from './name';
|
|
3
|
+
import { Nullable, Namon } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* The core component of this utility.
|
|
6
|
+
*
|
|
7
|
+
* This component is comprised of five entities that make it easy to handle a
|
|
8
|
+
* full name set: prefix, first name, middle name, last name, and suffix.
|
|
9
|
+
* This class is intended for internal processes. However, it is understandable
|
|
10
|
+
* that it might be needed at some point for additional purposes. For this reason,
|
|
11
|
+
* it's made available.
|
|
12
|
+
*
|
|
13
|
+
* It is recommended to avoid using this class unless it is highly necessary or
|
|
14
|
+
* a custom parser is used for uncommon use cases. This utility tries to cover
|
|
15
|
+
* as many use cases as possible.
|
|
16
|
+
*
|
|
17
|
+
* Additionally, an optional configuration can be used to indicate some specific
|
|
18
|
+
* behaviors related to that name handling.
|
|
19
|
+
*/
|
|
20
|
+
export declare class FullName {
|
|
21
|
+
private _prefix;
|
|
22
|
+
private _firstName;
|
|
23
|
+
private _middleName;
|
|
24
|
+
private _lastName;
|
|
25
|
+
private _suffix;
|
|
26
|
+
private _config;
|
|
27
|
+
/**
|
|
28
|
+
* Creates a full name as it goes
|
|
29
|
+
* @param options optional configuration for additional features.
|
|
30
|
+
*/
|
|
31
|
+
constructor(options?: Partial<Config>);
|
|
32
|
+
/**
|
|
33
|
+
* A snapshot of the configuration used to set up this full name.
|
|
34
|
+
*/
|
|
35
|
+
get config(): Config;
|
|
36
|
+
/**
|
|
37
|
+
* The prefix part of the full name.
|
|
38
|
+
*/
|
|
39
|
+
get prefix(): Nullable<Name>;
|
|
40
|
+
/**
|
|
41
|
+
* The first name part of the full name.
|
|
42
|
+
*/
|
|
43
|
+
get firstName(): FirstName;
|
|
44
|
+
/**
|
|
45
|
+
* The last name part of the full name.
|
|
46
|
+
*/
|
|
47
|
+
get lastName(): LastName;
|
|
48
|
+
/**
|
|
49
|
+
* The middle name part of the full name.
|
|
50
|
+
*/
|
|
51
|
+
get middleName(): Name[];
|
|
52
|
+
/**
|
|
53
|
+
* The suffix part of the full name.
|
|
54
|
+
*/
|
|
55
|
+
get suffix(): Nullable<Name>;
|
|
56
|
+
/**
|
|
57
|
+
* Parses a json name into a full name.
|
|
58
|
+
* @param json parsable name element
|
|
59
|
+
* @param config optional configuration for additional features.
|
|
60
|
+
*/
|
|
61
|
+
static parse(json: JsonName, config?: Config): FullName;
|
|
62
|
+
setPrefix(name: Nullable<string | Name>): FullName;
|
|
63
|
+
setFirstName(name: string | FirstName): FullName;
|
|
64
|
+
setLastName(name: string | LastName): FullName;
|
|
65
|
+
setMiddleName(names: string[] | Name[]): FullName;
|
|
66
|
+
setSuffix(name: Nullable<string | Name>): FullName;
|
|
67
|
+
/**
|
|
68
|
+
* Returns true if a namon has been set.
|
|
69
|
+
*/
|
|
70
|
+
has(namon: Namon): boolean;
|
|
71
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FullName = void 0;
|
|
4
|
+
const config_1 = require("./config");
|
|
5
|
+
const error_1 = require("./error");
|
|
6
|
+
const name_1 = require("./name");
|
|
7
|
+
const types_1 = require("./types");
|
|
8
|
+
const validator_1 = require("./validator");
|
|
9
|
+
/**
|
|
10
|
+
* The core component of this utility.
|
|
11
|
+
*
|
|
12
|
+
* This component is comprised of five entities that make it easy to handle a
|
|
13
|
+
* full name set: prefix, first name, middle name, last name, and suffix.
|
|
14
|
+
* This class is intended for internal processes. However, it is understandable
|
|
15
|
+
* that it might be needed at some point for additional purposes. For this reason,
|
|
16
|
+
* it's made available.
|
|
17
|
+
*
|
|
18
|
+
* It is recommended to avoid using this class unless it is highly necessary or
|
|
19
|
+
* a custom parser is used for uncommon use cases. This utility tries to cover
|
|
20
|
+
* as many use cases as possible.
|
|
21
|
+
*
|
|
22
|
+
* Additionally, an optional configuration can be used to indicate some specific
|
|
23
|
+
* behaviors related to that name handling.
|
|
24
|
+
*/
|
|
25
|
+
class FullName {
|
|
26
|
+
/**
|
|
27
|
+
* Creates a full name as it goes
|
|
28
|
+
* @param options optional configuration for additional features.
|
|
29
|
+
*/
|
|
30
|
+
constructor(options) {
|
|
31
|
+
this._middleName = [];
|
|
32
|
+
this._config = config_1.Config.merge(options);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A snapshot of the configuration used to set up this full name.
|
|
36
|
+
*/
|
|
37
|
+
get config() {
|
|
38
|
+
return this._config;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The prefix part of the full name.
|
|
42
|
+
*/
|
|
43
|
+
get prefix() {
|
|
44
|
+
return this._prefix;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The first name part of the full name.
|
|
48
|
+
*/
|
|
49
|
+
get firstName() {
|
|
50
|
+
return this._firstName;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The last name part of the full name.
|
|
54
|
+
*/
|
|
55
|
+
get lastName() {
|
|
56
|
+
return this._lastName;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The middle name part of the full name.
|
|
60
|
+
*/
|
|
61
|
+
get middleName() {
|
|
62
|
+
return this._middleName;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The suffix part of the full name.
|
|
66
|
+
*/
|
|
67
|
+
get suffix() {
|
|
68
|
+
return this._suffix;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Parses a json name into a full name.
|
|
72
|
+
* @param json parsable name element
|
|
73
|
+
* @param config optional configuration for additional features.
|
|
74
|
+
*/
|
|
75
|
+
static parse(json, config) {
|
|
76
|
+
try {
|
|
77
|
+
const fullName = new FullName(config);
|
|
78
|
+
fullName.setPrefix(json.prefix);
|
|
79
|
+
fullName.setFirstName(json.firstName);
|
|
80
|
+
fullName.setMiddleName(json.middleName);
|
|
81
|
+
fullName.setLastName(json.lastName);
|
|
82
|
+
fullName.setSuffix(json.suffix);
|
|
83
|
+
return fullName;
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
if (error instanceof error_1.NameError) {
|
|
87
|
+
throw error;
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
throw new error_1.UnknownError({
|
|
91
|
+
source: Object.values(json).join(' '),
|
|
92
|
+
message: 'could not parse JSON content',
|
|
93
|
+
error,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
setPrefix(name) {
|
|
99
|
+
if (!name)
|
|
100
|
+
return this;
|
|
101
|
+
if (!this._config.bypass)
|
|
102
|
+
validator_1.Validators.prefix.validate(name);
|
|
103
|
+
const prefix = name instanceof name_1.Name ? name.value : name;
|
|
104
|
+
this._prefix = name_1.Name.prefix(this._config.title === types_1.Title.US ? `${prefix}.` : prefix);
|
|
105
|
+
return this;
|
|
106
|
+
}
|
|
107
|
+
setFirstName(name) {
|
|
108
|
+
if (!this._config.bypass)
|
|
109
|
+
validator_1.Validators.firstName.validate(name);
|
|
110
|
+
this._firstName = name instanceof name_1.FirstName ? name : new name_1.FirstName(name);
|
|
111
|
+
return this;
|
|
112
|
+
}
|
|
113
|
+
setLastName(name) {
|
|
114
|
+
if (!this._config.bypass)
|
|
115
|
+
validator_1.Validators.lastName.validate(name);
|
|
116
|
+
this._lastName = name instanceof name_1.LastName ? name : new name_1.LastName(name);
|
|
117
|
+
return this;
|
|
118
|
+
}
|
|
119
|
+
setMiddleName(names) {
|
|
120
|
+
if (!Array.isArray(names))
|
|
121
|
+
return;
|
|
122
|
+
if (!this._config.bypass)
|
|
123
|
+
validator_1.Validators.middleName.validate(names);
|
|
124
|
+
this._middleName = names.map((name) => name instanceof name_1.Name ? name : name_1.Name.middle(name));
|
|
125
|
+
return this;
|
|
126
|
+
}
|
|
127
|
+
setSuffix(name) {
|
|
128
|
+
if (!name)
|
|
129
|
+
return this;
|
|
130
|
+
if (!this._config.bypass)
|
|
131
|
+
validator_1.Validators.suffix.validate(name);
|
|
132
|
+
this._suffix = name_1.Name.suffix(name instanceof name_1.Name ? name.value : name);
|
|
133
|
+
return this;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Returns true if a namon has been set.
|
|
137
|
+
*/
|
|
138
|
+
has(namon) {
|
|
139
|
+
if (namon.equal(types_1.Namon.PREFIX))
|
|
140
|
+
return !!this._prefix;
|
|
141
|
+
if (namon.equal(types_1.Namon.SUFFIX))
|
|
142
|
+
return !!this._suffix;
|
|
143
|
+
return namon.equal(types_1.Namon.MIDDLE_NAME) ? this._middleName.length > 0 : true;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
exports.FullName = FullName;
|
|
147
|
+
//# sourceMappingURL=full-name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"full-name.js","sourceRoot":"","sources":["../../src/full-name.ts"],"names":[],"mappings":";;;AAAA,qCAAiC;AACjC,mCAAiD;AACjD,iCAA4D;AAC5D,mCAAgD;AAChD,2CAAwC;AAExC;;;;;;;;;;;;;;;GAeG;AACH,MAAa,QAAQ;IAQjB;;;OAGG;IACH,YAAY,OAAyB;QAT7B,gBAAW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ts
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Welcome to namefully!
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* `namefully` is a JavaScript utility for handing person names.
|
|
5
|
+
*
|
|
6
|
+
* Sources
|
|
7
|
+
* - repo: https://github.com/ralflorent/namefully
|
|
8
|
+
* - docs: https://namefully.netlify.app
|
|
9
|
+
* - npm: https://npmjs.com/package/namefully
|
|
10
|
+
*
|
|
11
|
+
* @license MIT
|
|
6
12
|
*/
|
|
13
|
+
export * from './config';
|
|
14
|
+
export * from './error';
|
|
15
|
+
export * from './full-name';
|
|
16
|
+
export * from './name';
|
|
7
17
|
export * from './namefully';
|
|
8
|
-
export
|
|
9
|
-
export * from './
|
|
10
|
-
export
|
|
18
|
+
export { Parser } from './parser';
|
|
19
|
+
export * from './types';
|
|
20
|
+
export { NameIndex } from './utils';
|
package/dist/lib/index.js
CHANGED
|
@@ -1,14 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
2
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
13
|
/**
|
|
5
|
-
*
|
|
14
|
+
* Welcome to namefully!
|
|
6
15
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
16
|
+
* `namefully` is a JavaScript utility for handing person names.
|
|
17
|
+
*
|
|
18
|
+
* Sources
|
|
19
|
+
* - repo: https://github.com/ralflorent/namefully
|
|
20
|
+
* - docs: https://namefully.netlify.app
|
|
21
|
+
* - npm: https://npmjs.com/package/namefully
|
|
22
|
+
*
|
|
23
|
+
* @license MIT
|
|
9
24
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
25
|
+
__exportStar(require("./config"), exports);
|
|
26
|
+
__exportStar(require("./error"), exports);
|
|
27
|
+
__exportStar(require("./full-name"), exports);
|
|
28
|
+
__exportStar(require("./name"), exports);
|
|
29
|
+
__exportStar(require("./namefully"), exports);
|
|
30
|
+
var parser_1 = require("./parser");
|
|
31
|
+
Object.defineProperty(exports, "Parser", { enumerable: true, get: function () { return parser_1.Parser; } });
|
|
32
|
+
__exportStar(require("./types"), exports);
|
|
33
|
+
var utils_1 = require("./utils");
|
|
34
|
+
Object.defineProperty(exports, "NameIndex", { enumerable: true, get: function () { return utils_1.NameIndex; } });
|
|
14
35
|
//# sourceMappingURL=index.js.map
|
package/dist/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;GAWG;AACH,2CAAwB;AACxB,0CAAuB;AACvB,8CAA2B;AAC3B,yCAAsB;AACtB,8CAA2B;AAC3B,mCAAiC;AAAxB,gGAAA,MAAM,OAAA;AACf,0CAAuB;AACvB,iCAAmC;AAA1B,kGAAA,SAAS,OAAA"}
|