namefully 1.1.0 → 1.2.1
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/dist/lib/config.js +112 -0
- package/dist/lib/constants.js +30 -0
- package/dist/lib/error.js +92 -0
- package/dist/lib/full-name.js +115 -0
- package/dist/lib/index.js +27 -12
- package/dist/lib/name.js +230 -0
- package/dist/lib/namefully.js +368 -681
- package/dist/lib/parser.js +138 -0
- package/dist/lib/types.js +107 -0
- package/dist/lib/utils.js +92 -0
- package/dist/lib/validator.js +301 -0
- package/dist/types/config.d.ts +97 -0
- package/dist/types/constants.d.ts +4 -0
- package/dist/types/error.d.ts +158 -0
- package/dist/types/full-name.d.ts +54 -0
- package/dist/types/index.d.ts +21 -0
- package/dist/types/name.d.ts +126 -0
- package/dist/types/namefully.d.ts +313 -0
- package/dist/types/parser.d.ts +41 -0
- package/dist/types/types.d.ts +127 -0
- package/dist/types/utils.d.ts +53 -0
- package/dist/types/validator.d.ts +57 -0
- package/dist/umd/namefully.js +1503 -2900
- package/dist/umd/namefully.min.js +1 -3
- package/package.json +28 -38
- package/readme.md +138 -167
- package/changelog.md +0 -134
- package/dist/lib/core/constants.d.ts +0 -48
- package/dist/lib/core/constants.js +0 -101
- package/dist/lib/core/constants.js.map +0 -1
- package/dist/lib/core/core.d.ts +0 -17
- package/dist/lib/core/core.js +0 -24
- package/dist/lib/core/core.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 -41
- package/dist/lib/core/parsers/array-name.parser.js +0 -86
- package/dist/lib/core/parsers/array-name.parser.js.map +0 -1
- package/dist/lib/core/parsers/array-string.parser.d.ts +0 -47
- package/dist/lib/core/parsers/array-string.parser.js +0 -95
- 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 -33
- package/dist/lib/core/parsers/nama.parser.js +0 -74
- package/dist/lib/core/parsers/nama.parser.js.map +0 -1
- package/dist/lib/core/parsers/parser.d.ts +0 -28
- 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 -60
- package/dist/lib/core/parsers/string.parser.js +0 -62
- package/dist/lib/core/parsers/string.parser.js.map +0 -1
- package/dist/lib/core/utils.d.ts +0 -52
- package/dist/lib/core/utils.js +0 -178
- package/dist/lib/core/utils.js.map +0 -1
- package/dist/lib/index.d.ts +0 -10
- package/dist/lib/index.js.map +0 -1
- package/dist/lib/models/enums.d.ts +0 -106
- package/dist/lib/models/enums.js +0 -114
- package/dist/lib/models/enums.js.map +0 -1
- package/dist/lib/models/firstname.d.ts +0 -77
- package/dist/lib/models/firstname.js +0 -131
- package/dist/lib/models/firstname.js.map +0 -1
- package/dist/lib/models/fullname.d.ts +0 -73
- package/dist/lib/models/fullname.js +0 -99
- package/dist/lib/models/fullname.js.map +0 -1
- package/dist/lib/models/index.d.ts +0 -13
- package/dist/lib/models/index.js +0 -16
- package/dist/lib/models/index.js.map +0 -1
- package/dist/lib/models/lastname.d.ts +0 -80
- package/dist/lib/models/lastname.js +0 -157
- package/dist/lib/models/lastname.js.map +0 -1
- package/dist/lib/models/misc.d.ts +0 -108
- 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 -76
- package/dist/lib/models/name.js +0 -115
- package/dist/lib/models/name.js.map +0 -1
- package/dist/lib/models/summary.d.ts +0 -26
- package/dist/lib/models/summary.js +0 -61
- package/dist/lib/models/summary.js.map +0 -1
- package/dist/lib/namefully.d.ts +0 -302
- package/dist/lib/namefully.js.map +0 -1
- package/dist/lib/validators/array-name.validator.d.ts +0 -25
- package/dist/lib/validators/array-name.validator.js +0 -75
- 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 -76
- 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 -72
- package/dist/lib/validators/common/validation-rule.js +0 -76
- 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 -44
- 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
- package/dist/umd/namefully.js.map +0 -1
- package/dist/umd/namefully.min.js.LICENSE.txt +0 -29
- package/dist/umd/namefully.min.js.map +0 -1
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
* First name class definition
|
|
5
|
-
*
|
|
6
|
-
* Created on March 06, 2020
|
|
7
|
-
* @author Ralph Florent <ralflornt@gmail.com>
|
|
8
|
-
*/
|
|
9
|
-
const index_1 = require("./index");
|
|
10
|
-
const core_1 = require("../core");
|
|
11
|
-
/**
|
|
12
|
-
* Represents a first name with some extra functionalities
|
|
13
|
-
* @class
|
|
14
|
-
* @extends Name
|
|
15
|
-
*/
|
|
16
|
-
class Firstname extends index_1.Name {
|
|
17
|
-
/**
|
|
18
|
-
* Constructs a `Firstname`
|
|
19
|
-
* @param {string} namon a piece of string that will be defined as a namon
|
|
20
|
-
* @param {string[]} [more] additional pieces considered as a given name
|
|
21
|
-
*/
|
|
22
|
-
constructor(namon, ...more) {
|
|
23
|
-
super(namon, index_1.Namon.FIRST_NAME);
|
|
24
|
-
this.namon = namon;
|
|
25
|
-
this.more = [];
|
|
26
|
-
this.more = more;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Determines whether a first name has more name parts
|
|
30
|
-
*/
|
|
31
|
-
hasMore() {
|
|
32
|
-
return Array.isArray(this.more) && this.more.length > 0;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Gives some descriptive statistics that summarize the central tendency,
|
|
36
|
-
* dispersion and shape of the characters' distribution.
|
|
37
|
-
* @param {boolean} includeAll whether to include other pieces of the first
|
|
38
|
-
* name in the summary
|
|
39
|
-
* @see {@link describe} in `Namefully` class for further information
|
|
40
|
-
*/
|
|
41
|
-
describe(includeAll = false) {
|
|
42
|
-
return new index_1.Summary(this.tostring(includeAll));
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Returns a string representation of the first name
|
|
46
|
-
* @param {boolean} includeAll whether to include other pieces of the first
|
|
47
|
-
* name
|
|
48
|
-
*/
|
|
49
|
-
tostring(includeAll = true) {
|
|
50
|
-
return !includeAll
|
|
51
|
-
? this.namon
|
|
52
|
-
: this.namon.concat(index_1.Separator.SPACE, this.more.join(index_1.Separator.SPACE)).trim();
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Gets the initials of the first name
|
|
56
|
-
*/
|
|
57
|
-
getInitials(includeAll = false) {
|
|
58
|
-
const initials = [this.namon[0]];
|
|
59
|
-
if (includeAll && this.hasMore()) {
|
|
60
|
-
initials.push(...this.more.map(n => n[0]));
|
|
61
|
-
}
|
|
62
|
-
return initials;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Capitalizes a first name
|
|
66
|
-
* @param {'initial' | 'all'} option how to capitalize its subparts
|
|
67
|
-
*/
|
|
68
|
-
capitalize(option = 'initial') {
|
|
69
|
-
if (option === 'initial') {
|
|
70
|
-
this.namon = this.namon[0].toUpperCase().concat(this.namon.slice(1));
|
|
71
|
-
if (this.hasMore())
|
|
72
|
-
this.more = this.more.map(n => n[0].toUpperCase().concat(n.slice(1)));
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
this.namon = this.namon.toUpperCase();
|
|
76
|
-
if (this.hasMore())
|
|
77
|
-
this.more = this.more.map(n => n.toUpperCase());
|
|
78
|
-
}
|
|
79
|
-
return this;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* De-capitalizes a first name
|
|
83
|
-
* @param {'initial' | 'all'} option how to decapitalize its subparts
|
|
84
|
-
*/
|
|
85
|
-
decapitalize(option = 'initial') {
|
|
86
|
-
if (option === 'initial') {
|
|
87
|
-
this.namon = this.namon[0].toLowerCase().concat(this.namon.slice(1));
|
|
88
|
-
if (this.hasMore())
|
|
89
|
-
this.more = this.more.map(n => n[0].toLowerCase().concat(n.slice(1)));
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
this.namon = this.namon.toLowerCase();
|
|
93
|
-
if (this.hasMore())
|
|
94
|
-
this.more = this.more.map(n => n.toLowerCase());
|
|
95
|
-
}
|
|
96
|
-
return this;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Normalizes the first name as it should be
|
|
100
|
-
*/
|
|
101
|
-
normalize() {
|
|
102
|
-
this.namon = this.namon[0]
|
|
103
|
-
.toUpperCase()
|
|
104
|
-
.concat(this.namon.slice(1).toLowerCase());
|
|
105
|
-
if (this.hasMore())
|
|
106
|
-
this.more = this.more.map(n => n[0]
|
|
107
|
-
.toUpperCase()
|
|
108
|
-
.concat(n.slice(1).toLowerCase()));
|
|
109
|
-
return this;
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Returns an ascii representation of each characters of a first name
|
|
113
|
-
* @param restrictions chars to skip
|
|
114
|
-
*/
|
|
115
|
-
ascii(restrictions) {
|
|
116
|
-
return core_1.convertToAscii(this.tostring(true), restrictions);
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Returns a password-like representation of a first name
|
|
120
|
-
*/
|
|
121
|
-
passwd() {
|
|
122
|
-
return core_1.generatePassword(this.tostring(true));
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
exports.Firstname = Firstname;
|
|
126
|
-
Firstname.prototype.cap = Firstname.prototype.capitalize;
|
|
127
|
-
Firstname.prototype.decap = Firstname.prototype.decapitalize;
|
|
128
|
-
Firstname.prototype.norm = Firstname.prototype.normalize;
|
|
129
|
-
Firstname.prototype.stats = Firstname.prototype.describe;
|
|
130
|
-
Firstname.prototype.inits = Firstname.prototype.getInitials;
|
|
131
|
-
//# sourceMappingURL=firstname.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"firstname.js","sourceRoot":"","sources":["../../../src/models/firstname.ts"],"names":[],"mappings":";;AAAA;;;;;GAKG;AACH,mCAA0D;AAC1D,kCAA2D;AAG3D;;;;GAIG;AACH,MAAa,SAAU,SAAQ,YAAI;IAG/B;;;;OAIG;IACH,YAAmB,KAAa,EAAE,GAAG,IAAc;QAC/C,KAAK,CAAC,KAAK,EAAE,aAAK,CAAC,UAAU,CAAC,CAAC;QADhB,UAAK,GAAL,KAAK,CAAQ;QANhC,SAAI,GAAa,EAAE,CAAC;QAQhB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,OAAO;QACH,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IAC5D,CAAC;IAED;;;;;;OAMG;IACH,QAAQ,CAAC,aAAsB,KAAK;QAChC,OAAO,IAAI,eAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;IAClD,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,aAAsB,IAAI;QAC/B,OAAO,CAAC,UAAU;YACd,CAAC,CAAC,IAAI,CAAC,KAAK;YACZ,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CACf,iBAAS,CAAC,KAAK,EACf,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAS,CAAC,KAAK,CAAC,CAClC,CAAC,IAAI,EAAE,CAAC;IACjB,CAAC;IAED;;OAEG;IACH,WAAW,CAAC,aAAsB,KAAK;QACnC,MAAM,QAAQ,GAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC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AAO,uBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAA;IAChD,CAAC;CACJ;AAvHD,8BAuHC;AAaD,SAAS,CAAC,SAAS,CAAC,GAAG,GAAG,SAAS,CAAC,SAAS,CAAC,UAAU,CAAC;AACzD,SAAS,CAAC,SAAS,CAAC,KAAK,GAAG,SAAS,CAAC,SAAS,CAAC,YAAY,CAAC;AAC7D,SAAS,CAAC,SAAS,CAAC,IAAI,GAAG,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC;AACzD,SAAS,CAAC,SAAS,CAAC,KAAK,GAAG,SAAS,CAAC,SAAS,CAAC,QAAQ,CAAC;AACzD,SAAS,CAAC,SAAS,CAAC,KAAK,GAAG,SAAS,CAAC,SAAS,CAAC,WAAW,CAAC"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Full name builder
|
|
3
|
-
*
|
|
4
|
-
* Created on July 04, 2020
|
|
5
|
-
* @author Ralph Florent <ralflornt@gmail.com>
|
|
6
|
-
*/
|
|
7
|
-
import { Name, Firstname, Lastname, Prefix, Suffix } from './index';
|
|
8
|
-
import { LastnameFormat } from './misc';
|
|
9
|
-
/**
|
|
10
|
-
* Interface for JSON signature that represents the full name
|
|
11
|
-
* @interface
|
|
12
|
-
*/
|
|
13
|
-
export interface Fullname {
|
|
14
|
-
firstname: Firstname;
|
|
15
|
-
lastname: Lastname;
|
|
16
|
-
middlename?: Name[];
|
|
17
|
-
prefix?: Prefix;
|
|
18
|
-
suffix?: Suffix;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Uses method chaining to build `Fullname`
|
|
22
|
-
*/
|
|
23
|
-
export declare class FullnameBuilder {
|
|
24
|
-
private bypass;
|
|
25
|
-
private _px;
|
|
26
|
-
private _fn;
|
|
27
|
-
private _mn;
|
|
28
|
-
private _ln;
|
|
29
|
-
private _sx;
|
|
30
|
-
constructor(bypass?: boolean);
|
|
31
|
-
/**
|
|
32
|
-
* Builds with prefix
|
|
33
|
-
* @param namon prefix name part
|
|
34
|
-
*/
|
|
35
|
-
prefix(namon: string): this;
|
|
36
|
-
/**
|
|
37
|
-
* Builds with firstname
|
|
38
|
-
* @param namon a piece of string that will be defined as a namon
|
|
39
|
-
* @param more additional pieces considered as a given name
|
|
40
|
-
*/
|
|
41
|
-
firstname(namon: string, ...more: string[]): this;
|
|
42
|
-
/**
|
|
43
|
-
* Builds with middlename
|
|
44
|
-
* @param nama middle names
|
|
45
|
-
*/
|
|
46
|
-
middlename(...nama: string[]): this;
|
|
47
|
-
/**
|
|
48
|
-
* Builds with lastname
|
|
49
|
-
* @param father a piece of string that will be defined as a namon
|
|
50
|
-
* @param mother additional pieces considered as a last name
|
|
51
|
-
* @param format how to output a surname considering its subparts
|
|
52
|
-
*/
|
|
53
|
-
lastname(father: string, mother?: string, format?: LastnameFormat): this;
|
|
54
|
-
/**
|
|
55
|
-
* Builds with suffix
|
|
56
|
-
* @param namon suffix name part
|
|
57
|
-
*/
|
|
58
|
-
suffix(namon: string): this;
|
|
59
|
-
/**
|
|
60
|
-
* Builds a `Fulllname`
|
|
61
|
-
*/
|
|
62
|
-
build(): Fullname;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Aliases for `FullnameBuilder`
|
|
66
|
-
*/
|
|
67
|
-
export interface FullnameBuilder {
|
|
68
|
-
px: typeof FullnameBuilder.prototype.prefix;
|
|
69
|
-
fn: typeof FullnameBuilder.prototype.firstname;
|
|
70
|
-
mn: typeof FullnameBuilder.prototype.middlename;
|
|
71
|
-
ln: typeof FullnameBuilder.prototype.lastname;
|
|
72
|
-
sx: typeof FullnameBuilder.prototype.suffix;
|
|
73
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
* Full name builder
|
|
5
|
-
*
|
|
6
|
-
* Created on July 04, 2020
|
|
7
|
-
* @author Ralph Florent <ralflornt@gmail.com>
|
|
8
|
-
*/
|
|
9
|
-
const index_1 = require("./index");
|
|
10
|
-
const validators_1 = require("../validators");
|
|
11
|
-
/**
|
|
12
|
-
* Uses method chaining to build `Fullname`
|
|
13
|
-
*/
|
|
14
|
-
class FullnameBuilder {
|
|
15
|
-
constructor(bypass = false) {
|
|
16
|
-
this.bypass = bypass;
|
|
17
|
-
this._px = null;
|
|
18
|
-
this._fn = null;
|
|
19
|
-
this._mn = [];
|
|
20
|
-
this._ln = null;
|
|
21
|
-
this._sx = null;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Builds with prefix
|
|
25
|
-
* @param namon prefix name part
|
|
26
|
-
*/
|
|
27
|
-
prefix(namon) {
|
|
28
|
-
if (!this.bypass)
|
|
29
|
-
new validators_1.PrefixValidator().validate(namon);
|
|
30
|
-
this._px = namon;
|
|
31
|
-
return this;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Builds with firstname
|
|
35
|
-
* @param namon a piece of string that will be defined as a namon
|
|
36
|
-
* @param more additional pieces considered as a given name
|
|
37
|
-
*/
|
|
38
|
-
firstname(namon, ...more) {
|
|
39
|
-
this._fn = new index_1.Firstname(namon, ...more);
|
|
40
|
-
if (!this.bypass)
|
|
41
|
-
new validators_1.FirstnameValidator().validate(this._fn.tostring());
|
|
42
|
-
return this;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Builds with middlename
|
|
46
|
-
* @param nama middle names
|
|
47
|
-
*/
|
|
48
|
-
middlename(...nama) {
|
|
49
|
-
const validator = new validators_1.NamonValidator();
|
|
50
|
-
this._mn = nama.map(namon => {
|
|
51
|
-
if (!this.bypass)
|
|
52
|
-
validator.validate(namon);
|
|
53
|
-
return new index_1.Name(namon, index_1.Namon.MIDDLE_NAME);
|
|
54
|
-
});
|
|
55
|
-
return this;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Builds with lastname
|
|
59
|
-
* @param father a piece of string that will be defined as a namon
|
|
60
|
-
* @param mother additional pieces considered as a last name
|
|
61
|
-
* @param format how to output a surname considering its subparts
|
|
62
|
-
*/
|
|
63
|
-
lastname(father, mother, format = 'father') {
|
|
64
|
-
this._ln = new index_1.Lastname(father, mother, format);
|
|
65
|
-
if (!this.bypass)
|
|
66
|
-
new validators_1.LastnameValidator().validate(this._ln.tostring());
|
|
67
|
-
return this;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Builds with suffix
|
|
71
|
-
* @param namon suffix name part
|
|
72
|
-
*/
|
|
73
|
-
suffix(namon) {
|
|
74
|
-
if (!this.bypass)
|
|
75
|
-
new validators_1.SuffixValidator().validate(namon);
|
|
76
|
-
this._sx = namon;
|
|
77
|
-
return this;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Builds a `Fulllname`
|
|
81
|
-
*/
|
|
82
|
-
build() {
|
|
83
|
-
const fullname = {
|
|
84
|
-
firstname: this._fn,
|
|
85
|
-
lastname: this._ln,
|
|
86
|
-
middlename: this._mn,
|
|
87
|
-
prefix: this._px,
|
|
88
|
-
suffix: this._sx
|
|
89
|
-
};
|
|
90
|
-
return fullname;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
exports.FullnameBuilder = FullnameBuilder;
|
|
94
|
-
FullnameBuilder.prototype.px = FullnameBuilder.prototype.prefix;
|
|
95
|
-
FullnameBuilder.prototype.fn = FullnameBuilder.prototype.firstname;
|
|
96
|
-
FullnameBuilder.prototype.mn = FullnameBuilder.prototype.middlename;
|
|
97
|
-
FullnameBuilder.prototype.ln = FullnameBuilder.prototype.lastname;
|
|
98
|
-
FullnameBuilder.prototype.sx = FullnameBuilder.prototype.sx;
|
|
99
|
-
//# sourceMappingURL=fullname.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fullname.js","sourceRoot":"","sources":["../../../src/models/fullname.ts"],"names":[],"mappings":";;AAAA;;;;;GAKG;A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-
/**
|
|
2
|
-
* Make all the locals available
|
|
3
|
-
*
|
|
4
|
-
* Created on March 06, 2020
|
|
5
|
-
* @author Ralph Florent <ralflornt@gmail.com>
|
|
6
|
-
*/
|
|
7
|
-
export * from './name';
|
|
8
|
-
export * from './firstname';
|
|
9
|
-
export * from './lastname';
|
|
10
|
-
export * from './enums';
|
|
11
|
-
export * from './summary';
|
|
12
|
-
export * from './misc';
|
|
13
|
-
export * from './fullname';
|
package/dist/lib/models/index.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
/**
|
|
5
|
-
* Make all the locals available
|
|
6
|
-
*
|
|
7
|
-
* Created on March 06, 2020
|
|
8
|
-
* @author Ralph Florent <ralflornt@gmail.com>
|
|
9
|
-
*/
|
|
10
|
-
tslib_1.__exportStar(require("./name"), exports);
|
|
11
|
-
tslib_1.__exportStar(require("./firstname"), exports);
|
|
12
|
-
tslib_1.__exportStar(require("./lastname"), exports);
|
|
13
|
-
tslib_1.__exportStar(require("./enums"), exports);
|
|
14
|
-
tslib_1.__exportStar(require("./summary"), exports);
|
|
15
|
-
tslib_1.__exportStar(require("./fullname"), exports);
|
|
16
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/models/index.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,iDAAuB;AACvB,sDAA4B;AAC5B,qDAA2B;AAC3B,kDAAwB;AACxB,oDAA0B;AAE1B,qDAA2B"}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Last name class definition
|
|
3
|
-
*
|
|
4
|
-
* Created on March 06, 2020
|
|
5
|
-
* @author Ralph Florent <ralflornt@gmail.com>
|
|
6
|
-
*/
|
|
7
|
-
import { Name, Summary, LastnameFormat } from './index';
|
|
8
|
-
/**
|
|
9
|
-
* Represents a last name with some extra functionalities
|
|
10
|
-
* @class
|
|
11
|
-
* @extends Name
|
|
12
|
-
*/
|
|
13
|
-
export declare class Lastname extends Name {
|
|
14
|
-
father: string;
|
|
15
|
-
mother?: string;
|
|
16
|
-
private format;
|
|
17
|
-
/**
|
|
18
|
-
* Constructs a `Lastname`
|
|
19
|
-
* @param {string} father a piece of string that will be defined as a namon
|
|
20
|
-
* @param {string} [mother] additional pieces considered as a last name
|
|
21
|
-
* @param {LastnameFormat} [format] how to output a surname considering its
|
|
22
|
-
* subparts
|
|
23
|
-
*/
|
|
24
|
-
constructor(father: string, mother?: string, format?: LastnameFormat);
|
|
25
|
-
/**
|
|
26
|
-
* Determines whether a 'mother' subpart was set
|
|
27
|
-
*/
|
|
28
|
-
hasMother(): boolean;
|
|
29
|
-
/**
|
|
30
|
-
* Gives some descriptive statistics that summarize the central tendency,
|
|
31
|
-
* dispersion and shape of the characters' distribution.
|
|
32
|
-
* @param {LastnameFormat} [format] overrides the how-to format of a surname
|
|
33
|
-
* output, considering its subparts.
|
|
34
|
-
* @see {@link describe} in `Namefully` class for further information
|
|
35
|
-
*/
|
|
36
|
-
describe(format?: LastnameFormat): Summary;
|
|
37
|
-
/**
|
|
38
|
-
* Returns a string representation of the last name
|
|
39
|
-
* @param {LastnameFormat} [format] overrides the how-to format of a surname
|
|
40
|
-
* output, considering its subparts.
|
|
41
|
-
*/
|
|
42
|
-
tostring(format?: LastnameFormat): string;
|
|
43
|
-
/**
|
|
44
|
-
* Gets the initials of the last name
|
|
45
|
-
*/
|
|
46
|
-
getInitials(format?: LastnameFormat): string[];
|
|
47
|
-
/**
|
|
48
|
-
* Capitalizes a last name
|
|
49
|
-
* @param {'initial' | 'all'} option how to capitalize its subparts
|
|
50
|
-
*/
|
|
51
|
-
capitalize(option?: 'initial' | 'all'): Lastname;
|
|
52
|
-
/**
|
|
53
|
-
* De-capitalizes a last name
|
|
54
|
-
* @param {'initial' | 'all'} option how to decapitalize its subparts
|
|
55
|
-
*/
|
|
56
|
-
decapitalize(option?: 'initial' | 'all'): Lastname;
|
|
57
|
-
/**
|
|
58
|
-
* Normalizes the last name as it should be
|
|
59
|
-
*/
|
|
60
|
-
normalize(): Lastname;
|
|
61
|
-
/**
|
|
62
|
-
* Returns an ascii representation of each characters of a last name
|
|
63
|
-
* @param restrictions chars to skip
|
|
64
|
-
*/
|
|
65
|
-
ascii(restrictions?: string[]): number[];
|
|
66
|
-
/**
|
|
67
|
-
* Returns a password-like representation of a last name
|
|
68
|
-
*/
|
|
69
|
-
passwd(): string;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Aliases for `Lastname`
|
|
73
|
-
*/
|
|
74
|
-
export interface Lastname {
|
|
75
|
-
cap: typeof Lastname.prototype.capitalize;
|
|
76
|
-
decap: typeof Lastname.prototype.decapitalize;
|
|
77
|
-
norm: typeof Lastname.prototype.normalize;
|
|
78
|
-
stats: typeof Lastname.prototype.describe;
|
|
79
|
-
inits: typeof Lastname.prototype.getInitials;
|
|
80
|
-
}
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
* Last name class definition
|
|
5
|
-
*
|
|
6
|
-
* Created on March 06, 2020
|
|
7
|
-
* @author Ralph Florent <ralflornt@gmail.com>
|
|
8
|
-
*/
|
|
9
|
-
const index_1 = require("./index");
|
|
10
|
-
const core_1 = require("../core");
|
|
11
|
-
/**
|
|
12
|
-
* Represents a last name with some extra functionalities
|
|
13
|
-
* @class
|
|
14
|
-
* @extends Name
|
|
15
|
-
*/
|
|
16
|
-
class Lastname extends index_1.Name {
|
|
17
|
-
/**
|
|
18
|
-
* Constructs a `Lastname`
|
|
19
|
-
* @param {string} father a piece of string that will be defined as a namon
|
|
20
|
-
* @param {string} [mother] additional pieces considered as a last name
|
|
21
|
-
* @param {LastnameFormat} [format] how to output a surname considering its
|
|
22
|
-
* subparts
|
|
23
|
-
*/
|
|
24
|
-
constructor(father, mother, format = 'father') {
|
|
25
|
-
super(father, index_1.Namon.LAST_NAME);
|
|
26
|
-
this.father = father;
|
|
27
|
-
this.mother = mother;
|
|
28
|
-
this.format = format;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Determines whether a 'mother' subpart was set
|
|
32
|
-
*/
|
|
33
|
-
hasMother() {
|
|
34
|
-
return !!this.mother && this.mother.length > 0;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Gives some descriptive statistics that summarize the central tendency,
|
|
38
|
-
* dispersion and shape of the characters' distribution.
|
|
39
|
-
* @param {LastnameFormat} [format] overrides the how-to format of a surname
|
|
40
|
-
* output, considering its subparts.
|
|
41
|
-
* @see {@link describe} in `Namefully` class for further information
|
|
42
|
-
*/
|
|
43
|
-
describe(format) {
|
|
44
|
-
format = format || this.format;
|
|
45
|
-
return new index_1.Summary(this.tostring(format));
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Returns a string representation of the last name
|
|
49
|
-
* @param {LastnameFormat} [format] overrides the how-to format of a surname
|
|
50
|
-
* output, considering its subparts.
|
|
51
|
-
*/
|
|
52
|
-
tostring(format) {
|
|
53
|
-
format = format || this.format;
|
|
54
|
-
switch (format) {
|
|
55
|
-
case 'father':
|
|
56
|
-
return this.father;
|
|
57
|
-
case 'mother':
|
|
58
|
-
return this.mother || index_1.Separator.EMPTY;
|
|
59
|
-
case 'hyphenated':
|
|
60
|
-
return this.mother ? this.father.concat(index_1.Separator.HYPHEN, this.mother) : this.father;
|
|
61
|
-
case 'all':
|
|
62
|
-
return this.mother ? this.father.concat(index_1.Separator.SPACE, this.mother) : this.father;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Gets the initials of the last name
|
|
67
|
-
*/
|
|
68
|
-
getInitials(format) {
|
|
69
|
-
format = format || this.format;
|
|
70
|
-
const initials = [];
|
|
71
|
-
switch (format) {
|
|
72
|
-
case 'father':
|
|
73
|
-
initials.push(this.father[0]);
|
|
74
|
-
break;
|
|
75
|
-
case 'mother':
|
|
76
|
-
if (this.hasMother())
|
|
77
|
-
initials.push(this.mother[0]);
|
|
78
|
-
break;
|
|
79
|
-
case 'hyphenated':
|
|
80
|
-
case 'all':
|
|
81
|
-
initials.push(this.father[0]);
|
|
82
|
-
if (this.hasMother())
|
|
83
|
-
initials.push(this.mother[0]);
|
|
84
|
-
break;
|
|
85
|
-
}
|
|
86
|
-
return initials;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Capitalizes a last name
|
|
90
|
-
* @param {'initial' | 'all'} option how to capitalize its subparts
|
|
91
|
-
*/
|
|
92
|
-
capitalize(option = 'initial') {
|
|
93
|
-
super.capitalize(option);
|
|
94
|
-
if (option === 'initial') {
|
|
95
|
-
this.father = this.father[0].toUpperCase().concat(this.father.slice(1));
|
|
96
|
-
if (this.hasMother())
|
|
97
|
-
this.mother = this.mother[0].toUpperCase().concat(this.mother.slice(1));
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
this.father = this.father.toUpperCase();
|
|
101
|
-
if (this.hasMother())
|
|
102
|
-
this.mother = this.mother.toUpperCase();
|
|
103
|
-
}
|
|
104
|
-
return this;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* De-capitalizes a last name
|
|
108
|
-
* @param {'initial' | 'all'} option how to decapitalize its subparts
|
|
109
|
-
*/
|
|
110
|
-
decapitalize(option = 'initial') {
|
|
111
|
-
super.capitalize(option);
|
|
112
|
-
if (option === 'initial') {
|
|
113
|
-
this.father = this.father[0].toLowerCase().concat(this.father.slice(1));
|
|
114
|
-
if (this.hasMother())
|
|
115
|
-
this.mother = this.mother[0].toLowerCase().concat(this.mother.slice(1));
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
this.father = this.father.toLowerCase();
|
|
119
|
-
if (this.hasMother())
|
|
120
|
-
this.mother = this.mother.toLowerCase();
|
|
121
|
-
}
|
|
122
|
-
return this;
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Normalizes the last name as it should be
|
|
126
|
-
*/
|
|
127
|
-
normalize() {
|
|
128
|
-
this.father = this.father[0]
|
|
129
|
-
.toUpperCase()
|
|
130
|
-
.concat(this.father.slice(1).toLowerCase());
|
|
131
|
-
if (this.hasMother())
|
|
132
|
-
this.mother = this.mother[0]
|
|
133
|
-
.toUpperCase()
|
|
134
|
-
.concat(this.mother.slice(1).toLowerCase());
|
|
135
|
-
return this;
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Returns an ascii representation of each characters of a last name
|
|
139
|
-
* @param restrictions chars to skip
|
|
140
|
-
*/
|
|
141
|
-
ascii(restrictions) {
|
|
142
|
-
return core_1.convertToAscii(this.tostring(), restrictions);
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Returns a password-like representation of a last name
|
|
146
|
-
*/
|
|
147
|
-
passwd() {
|
|
148
|
-
return core_1.generatePassword(this.tostring());
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
exports.Lastname = Lastname;
|
|
152
|
-
Lastname.prototype.cap = Lastname.prototype.capitalize;
|
|
153
|
-
Lastname.prototype.decap = Lastname.prototype.decapitalize;
|
|
154
|
-
Lastname.prototype.norm = Lastname.prototype.normalize;
|
|
155
|
-
Lastname.prototype.stats = Lastname.prototype.describe;
|
|
156
|
-
Lastname.prototype.inits = Lastname.prototype.getInitials;
|
|
157
|
-
//# sourceMappingURL=lastname.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lastname.js","sourceRoot":"","sources":["../../../src/models/lastname.ts"],"names":[],"mappings":";;AAAA;;;;;GAKG;AACH,mCAA0E;AAC1E,kCAA2D;AAE3D;;;;GAIG;AACH,MAAa,QAAS,SAAQ,YAAI;IAE9B;;;;;;OAMG;IACH,YAAmB,MAAc,EAAS,MAAe,EAAU,SAAy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