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.
Files changed (136) hide show
  1. package/dist/lib/config.js +112 -0
  2. package/dist/lib/constants.js +30 -0
  3. package/dist/lib/error.js +92 -0
  4. package/dist/lib/full-name.js +115 -0
  5. package/dist/lib/index.js +27 -12
  6. package/dist/lib/name.js +230 -0
  7. package/dist/lib/namefully.js +368 -681
  8. package/dist/lib/parser.js +138 -0
  9. package/dist/lib/types.js +107 -0
  10. package/dist/lib/utils.js +92 -0
  11. package/dist/lib/validator.js +301 -0
  12. package/dist/types/config.d.ts +97 -0
  13. package/dist/types/constants.d.ts +4 -0
  14. package/dist/types/error.d.ts +158 -0
  15. package/dist/types/full-name.d.ts +54 -0
  16. package/dist/types/index.d.ts +21 -0
  17. package/dist/types/name.d.ts +126 -0
  18. package/dist/types/namefully.d.ts +313 -0
  19. package/dist/types/parser.d.ts +41 -0
  20. package/dist/types/types.d.ts +127 -0
  21. package/dist/types/utils.d.ts +53 -0
  22. package/dist/types/validator.d.ts +57 -0
  23. package/dist/umd/namefully.js +1503 -2900
  24. package/dist/umd/namefully.min.js +1 -3
  25. package/package.json +28 -38
  26. package/readme.md +138 -167
  27. package/changelog.md +0 -134
  28. package/dist/lib/core/constants.d.ts +0 -48
  29. package/dist/lib/core/constants.js +0 -101
  30. package/dist/lib/core/constants.js.map +0 -1
  31. package/dist/lib/core/core.d.ts +0 -17
  32. package/dist/lib/core/core.js +0 -24
  33. package/dist/lib/core/core.js.map +0 -1
  34. package/dist/lib/core/index.d.ts +0 -9
  35. package/dist/lib/core/index.js +0 -13
  36. package/dist/lib/core/index.js.map +0 -1
  37. package/dist/lib/core/parsers/array-name.parser.d.ts +0 -41
  38. package/dist/lib/core/parsers/array-name.parser.js +0 -86
  39. package/dist/lib/core/parsers/array-name.parser.js.map +0 -1
  40. package/dist/lib/core/parsers/array-string.parser.d.ts +0 -47
  41. package/dist/lib/core/parsers/array-string.parser.js +0 -95
  42. package/dist/lib/core/parsers/array-string.parser.js.map +0 -1
  43. package/dist/lib/core/parsers/index.d.ts +0 -11
  44. package/dist/lib/core/parsers/index.js +0 -11
  45. package/dist/lib/core/parsers/index.js.map +0 -1
  46. package/dist/lib/core/parsers/nama.parser.d.ts +0 -33
  47. package/dist/lib/core/parsers/nama.parser.js +0 -74
  48. package/dist/lib/core/parsers/nama.parser.js.map +0 -1
  49. package/dist/lib/core/parsers/parser.d.ts +0 -28
  50. package/dist/lib/core/parsers/parser.js +0 -3
  51. package/dist/lib/core/parsers/parser.js.map +0 -1
  52. package/dist/lib/core/parsers/string.parser.d.ts +0 -60
  53. package/dist/lib/core/parsers/string.parser.js +0 -62
  54. package/dist/lib/core/parsers/string.parser.js.map +0 -1
  55. package/dist/lib/core/utils.d.ts +0 -52
  56. package/dist/lib/core/utils.js +0 -178
  57. package/dist/lib/core/utils.js.map +0 -1
  58. package/dist/lib/index.d.ts +0 -10
  59. package/dist/lib/index.js.map +0 -1
  60. package/dist/lib/models/enums.d.ts +0 -106
  61. package/dist/lib/models/enums.js +0 -114
  62. package/dist/lib/models/enums.js.map +0 -1
  63. package/dist/lib/models/firstname.d.ts +0 -77
  64. package/dist/lib/models/firstname.js +0 -131
  65. package/dist/lib/models/firstname.js.map +0 -1
  66. package/dist/lib/models/fullname.d.ts +0 -73
  67. package/dist/lib/models/fullname.js +0 -99
  68. package/dist/lib/models/fullname.js.map +0 -1
  69. package/dist/lib/models/index.d.ts +0 -13
  70. package/dist/lib/models/index.js +0 -16
  71. package/dist/lib/models/index.js.map +0 -1
  72. package/dist/lib/models/lastname.d.ts +0 -80
  73. package/dist/lib/models/lastname.js +0 -157
  74. package/dist/lib/models/lastname.js.map +0 -1
  75. package/dist/lib/models/misc.d.ts +0 -108
  76. package/dist/lib/models/misc.js +0 -3
  77. package/dist/lib/models/misc.js.map +0 -1
  78. package/dist/lib/models/name.d.ts +0 -76
  79. package/dist/lib/models/name.js +0 -115
  80. package/dist/lib/models/name.js.map +0 -1
  81. package/dist/lib/models/summary.d.ts +0 -26
  82. package/dist/lib/models/summary.js +0 -61
  83. package/dist/lib/models/summary.js.map +0 -1
  84. package/dist/lib/namefully.d.ts +0 -302
  85. package/dist/lib/namefully.js.map +0 -1
  86. package/dist/lib/validators/array-name.validator.d.ts +0 -25
  87. package/dist/lib/validators/array-name.validator.js +0 -75
  88. package/dist/lib/validators/array-name.validator.js.map +0 -1
  89. package/dist/lib/validators/array-string.validator.d.ts +0 -43
  90. package/dist/lib/validators/array-string.validator.js +0 -76
  91. package/dist/lib/validators/array-string.validator.js.map +0 -1
  92. package/dist/lib/validators/common/validation-error.d.ts +0 -19
  93. package/dist/lib/validators/common/validation-error.js +0 -26
  94. package/dist/lib/validators/common/validation-error.js.map +0 -1
  95. package/dist/lib/validators/common/validation-rule.d.ts +0 -72
  96. package/dist/lib/validators/common/validation-rule.js +0 -76
  97. package/dist/lib/validators/common/validation-rule.js.map +0 -1
  98. package/dist/lib/validators/common/validation-type.d.ts +0 -24
  99. package/dist/lib/validators/common/validation-type.js +0 -28
  100. package/dist/lib/validators/common/validation-type.js.map +0 -1
  101. package/dist/lib/validators/firstname.validator.d.ts +0 -20
  102. package/dist/lib/validators/firstname.validator.js +0 -29
  103. package/dist/lib/validators/firstname.validator.js.map +0 -1
  104. package/dist/lib/validators/fullname.validator.d.ts +0 -21
  105. package/dist/lib/validators/fullname.validator.js +0 -38
  106. package/dist/lib/validators/fullname.validator.js.map +0 -1
  107. package/dist/lib/validators/index.d.ts +0 -21
  108. package/dist/lib/validators/index.js +0 -35
  109. package/dist/lib/validators/index.js.map +0 -1
  110. package/dist/lib/validators/lastname.validator.d.ts +0 -20
  111. package/dist/lib/validators/lastname.validator.js +0 -29
  112. package/dist/lib/validators/lastname.validator.js.map +0 -1
  113. package/dist/lib/validators/middlename.validator.d.ts +0 -20
  114. package/dist/lib/validators/middlename.validator.js +0 -38
  115. package/dist/lib/validators/middlename.validator.js.map +0 -1
  116. package/dist/lib/validators/nama.validator.d.ts +0 -21
  117. package/dist/lib/validators/nama.validator.js +0 -44
  118. package/dist/lib/validators/nama.validator.js.map +0 -1
  119. package/dist/lib/validators/namon.validator.d.ts +0 -20
  120. package/dist/lib/validators/namon.validator.js +0 -29
  121. package/dist/lib/validators/namon.validator.js.map +0 -1
  122. package/dist/lib/validators/prefix.validator.d.ts +0 -14
  123. package/dist/lib/validators/prefix.validator.js +0 -31
  124. package/dist/lib/validators/prefix.validator.js.map +0 -1
  125. package/dist/lib/validators/string-name.validator.d.ts +0 -20
  126. package/dist/lib/validators/string-name.validator.js +0 -29
  127. package/dist/lib/validators/string-name.validator.js.map +0 -1
  128. package/dist/lib/validators/suffix.validator.d.ts +0 -14
  129. package/dist/lib/validators/suffix.validator.js +0 -31
  130. package/dist/lib/validators/suffix.validator.js.map +0 -1
  131. package/dist/lib/validators/validator.d.ts +0 -13
  132. package/dist/lib/validators/validator.js +0 -9
  133. package/dist/lib/validators/validator.js.map +0 -1
  134. package/dist/umd/namefully.js.map +0 -1
  135. package/dist/umd/namefully.min.js.LICENSE.txt +0 -29
  136. package/dist/umd/namefully.min.js.map +0 -1
@@ -1,60 +0,0 @@
1
- /**
2
- * A string parser
3
- *
4
- * Created on March 15, 2020
5
- * @author Ralph Florent <ralflornt@gmail.com>
6
- */
7
- import { Separator, Fullname, NameOrder } from '../../models/index';
8
- import { Parser } from './index';
9
- /**
10
- * Represents a string parser
11
- * @class
12
- * @implements {Parser}
13
- * @classdesc
14
- * This parser parses a string name using a separator, if set, or simply using
15
- * the space character <' '> as a basis for the split.
16
- *
17
- * **NOTE**:
18
- * A string name is basically a string type containing the name parts differentiated
19
- * with the help of a separator. The default separator is the character <space>
20
- * or <' '>. However, it can be very, very helpful to use a distinct separator
21
- * (e.g., a colon <:>) to handle multiple names for a `Namon`. That is to say,
22
- * a piece of name shaped as `De La Cruz` is a last name that needs to be handled
23
- * as a whole, and therefore requires that a different type of separator to split
24
- * up the name parts. Alternatively, the `ArrayStringParser` can be used by indicating
25
- * specifically which part of the name is what. Do note that this parser is actually
26
- * a wrapper of the `ArrayStringParser`.
27
- *
28
- * @example
29
- * Given the name `Maria De La Cruz`, using this parser without indicating a
30
- * separator different than <space> will definitely throw an error. So, if the proper
31
- * proper of doing when `De La Cruz` is the last name:
32
- * ```
33
- * > const name = new Namefully('Maria:De La Cruz', { separator: Separator.COLON })
34
- * > console.log(name.getLastname())
35
- * De La Cruz
36
- * ```
37
- * Or
38
- * ```
39
- * > const name = new Namefully(['Maria', 'De La Cruz'])
40
- * > console.log(name.getLastname())
41
- * De La Cruz
42
- * ```
43
- */
44
- export default class StringParser implements Parser<string> {
45
- raw: string;
46
- /**
47
- * Create a parser ready to parse the raw data
48
- * @param {string} raw data as a string representation
49
- */
50
- constructor(raw: string);
51
- /**
52
- * Parses the raw data into a full name
53
- * @param options how to parse
54
- */
55
- parse(options: {
56
- orderedBy: NameOrder;
57
- separator: Separator;
58
- bypass: boolean;
59
- }): Fullname;
60
- }
@@ -1,62 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const index_1 = require("./index");
4
- /**
5
- * Represents a string parser
6
- * @class
7
- * @implements {Parser}
8
- * @classdesc
9
- * This parser parses a string name using a separator, if set, or simply using
10
- * the space character <' '> as a basis for the split.
11
- *
12
- * **NOTE**:
13
- * A string name is basically a string type containing the name parts differentiated
14
- * with the help of a separator. The default separator is the character <space>
15
- * or <' '>. However, it can be very, very helpful to use a distinct separator
16
- * (e.g., a colon <:>) to handle multiple names for a `Namon`. That is to say,
17
- * a piece of name shaped as `De La Cruz` is a last name that needs to be handled
18
- * as a whole, and therefore requires that a different type of separator to split
19
- * up the name parts. Alternatively, the `ArrayStringParser` can be used by indicating
20
- * specifically which part of the name is what. Do note that this parser is actually
21
- * a wrapper of the `ArrayStringParser`.
22
- *
23
- * @example
24
- * Given the name `Maria De La Cruz`, using this parser without indicating a
25
- * separator different than <space> will definitely throw an error. So, if the proper
26
- * proper of doing when `De La Cruz` is the last name:
27
- * ```
28
- * > const name = new Namefully('Maria:De La Cruz', { separator: Separator.COLON })
29
- * > console.log(name.getLastname())
30
- * De La Cruz
31
- * ```
32
- * Or
33
- * ```
34
- * > const name = new Namefully(['Maria', 'De La Cruz'])
35
- * > console.log(name.getLastname())
36
- * De La Cruz
37
- * ```
38
- */
39
- class StringParser {
40
- /**
41
- * Create a parser ready to parse the raw data
42
- * @param {string} raw data as a string representation
43
- */
44
- constructor(raw) {
45
- this.raw = raw;
46
- }
47
- /**
48
- * Parses the raw data into a full name
49
- * @param options how to parse
50
- */
51
- parse(options) {
52
- // given this setting
53
- const { orderedBy, separator, bypass } = options;
54
- // then distribute all the elements accordingly
55
- const nama = this.raw.split(separator);
56
- const fullname = new index_1.ArrayStringParser(nama).parse({ orderedBy, bypass });
57
- // finally return high quality of data
58
- return fullname;
59
- }
60
- }
61
- exports.default = StringParser;
62
- //# sourceMappingURL=string.parser.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"string.parser.js","sourceRoot":"","sources":["../../../../src/core/parsers/string.parser.ts"],"names":[],"mappings":";;AAOA,mCAAoD;AAGpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAqB,YAAY;IAE7B;;;OAGG;IACH,YAAmB,GAAW;QAAX,QAAG,GAAH,GAAG,CAAQ;IAAG,CAAC;IAElC;;;OAGG;IACH,KAAK,CAAC,OAIL;QAEG,qBAAqB;QACrB,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QAEjD,+CAA+C;QAC/C,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACvC,MAAM,QAAQ,GAAG,IAAI,yBAAiB,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC;QAE1E,sCAAsC;QACtC,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ;AA5BD,+BA4BC"}
@@ -1,52 +0,0 @@
1
- /**
2
- * Utils for the core functionalities of `Namefully`
3
- *
4
- * Created on March 16, 2020
5
- * @author Ralph Florent <ralflornt@gmail.com>
6
- */
7
- import { NameIndex, NameOrder, NameType } from '../models';
8
- /**
9
- * Capitalizes a string
10
- * @param str string value
11
- * @param {'initial' | 'all'} [option] how to capitalize it
12
- */
13
- export declare function capitalize(str: string, option?: 'initial' | 'all'): string;
14
- /**
15
- * De-capitalizes a string
16
- * @param str string value
17
- * @param {'initial' | 'all'} [option] how to decapitalize it
18
- */
19
- export declare function decapitalize(str: string, option?: 'initial' | 'all'): string;
20
- /**
21
- * Toggles a string representation
22
- * @param str string value to toggle
23
- */
24
- export declare function toggleCase(str: string): string;
25
- /**
26
- * Reorganizes the existing global indexes for array of name parts
27
- * @param orderedBy by first or last name
28
- * @param argLength length of the provided array
29
- * @param nameIndex global preset of indexing
30
- */
31
- export declare function organizeNameIndex(orderedBy: NameOrder, argLength: number, nameIndex?: NameIndex): NameIndex;
32
- /**
33
- * Makes it easy to manipulate shortcuts for this `NameType`
34
- * @param type name type
35
- */
36
- export declare function allowShortNameType(type: NameType): NameType;
37
- /**
38
- * Makes it easy to manipulate shortcuts for this `NameOrder`
39
- * @param type name type
40
- */
41
- export declare function allowShortNameOrder(type: NameOrder): NameOrder;
42
- /**
43
- * Converts to ascii characters (using UTF-16)
44
- * @param str string content
45
- * @param restrictions unneeded content to skip
46
- */
47
- export declare function convertToAscii(str: string, restrictions?: string[]): number[];
48
- /**
49
- * Generates a password
50
- * @param str string content
51
- */
52
- export declare function generatePassword(str: string): string;
@@ -1,178 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /**
4
- * Utils for the core functionalities of `Namefully`
5
- *
6
- * Created on March 16, 2020
7
- * @author Ralph Florent <ralflornt@gmail.com>
8
- */
9
- const models_1 = require("../models");
10
- const core_1 = require("../core");
11
- /**
12
- * Capitalizes a string
13
- * @param str string value
14
- * @param {'initial' | 'all'} [option] how to capitalize it
15
- */
16
- function capitalize(str, option = 'initial') {
17
- if (!str)
18
- return '';
19
- const initial = str[0].toUpperCase();
20
- const rest = str.slice(1).toLowerCase();
21
- return option === 'initial' ? initial.concat(rest) : str.toUpperCase();
22
- }
23
- exports.capitalize = capitalize;
24
- /**
25
- * De-capitalizes a string
26
- * @param str string value
27
- * @param {'initial' | 'all'} [option] how to decapitalize it
28
- */
29
- function decapitalize(str, option = 'initial') {
30
- if (!str)
31
- return '';
32
- const initial = str[0].toLowerCase();
33
- const rest = str.slice(1);
34
- return option === 'initial' ? initial.concat(rest) : str.toLowerCase();
35
- }
36
- exports.decapitalize = decapitalize;
37
- /**
38
- * Toggles a string representation
39
- * @param str string value to toggle
40
- */
41
- function toggleCase(str) {
42
- const chars = [];
43
- for (const c of str) {
44
- if (c === c.toUpperCase()) {
45
- chars.push(c.toLowerCase());
46
- }
47
- else {
48
- chars.push(c.toUpperCase());
49
- }
50
- }
51
- return chars.join(models_1.Separator.EMPTY);
52
- }
53
- exports.toggleCase = toggleCase;
54
- /**
55
- * Reorganizes the existing global indexes for array of name parts
56
- * @param orderedBy by first or last name
57
- * @param argLength length of the provided array
58
- * @param nameIndex global preset of indexing
59
- */
60
- function organizeNameIndex(orderedBy, argLength, nameIndex = core_1.NAME_INDEX) {
61
- const out = Object.assign({}, nameIndex);
62
- if (orderedBy === 'firstname') {
63
- switch (argLength) {
64
- case core_1.FIRST_LAST_NAME_INDEX: // first name + last name
65
- out.firstname = 0;
66
- out.lastname = 1;
67
- break;
68
- case core_1.FIRST_MIDDLE_LAST_NAME_INDEX: // first name + middle name + last name
69
- out.firstname = 0;
70
- out.middlename = 1;
71
- out.lastname = 2;
72
- break;
73
- case core_1.PREFIX_FIRST_MIDDLE_LAST_NAME_INDEX: // prefix + first name + middle name + last name
74
- out.prefix = 0;
75
- out.firstname = 1;
76
- out.middlename = 2;
77
- out.lastname = 3;
78
- break;
79
- case core_1.PREFIX_FIRST_MIDDLE_LAST_SUFFIX_NAME_INDEX: // prefix + first name + middle name + last name + suffix
80
- out.prefix = 0;
81
- out.firstname = 1;
82
- out.middlename = 2;
83
- out.lastname = 3;
84
- out.suffix = 4;
85
- break;
86
- }
87
- }
88
- else {
89
- switch (argLength) {
90
- case core_1.LAST_FIRST_NAME_INDEX: // last name + first name
91
- out.lastname = 0;
92
- out.firstname = 1;
93
- break;
94
- case core_1.LAST_FIRST_MIDDLE_NAME_INDEX: // last name + first name + middle name
95
- out.lastname = 0;
96
- out.firstname = 1;
97
- out.middlename = 2;
98
- break;
99
- case core_1.PREFIX_LAST_FIRST_MIDDLE_NAME_INDEX: // prefix + last name + first name + middle name
100
- out.prefix = 0;
101
- out.lastname = 1;
102
- out.firstname = 2;
103
- out.middlename = 3;
104
- break;
105
- case core_1.PREFIX_LAST_FIRST_MIDDLE_SUFFIX_NAME_INDEX: // prefix + last name + first name + middle name + suffix
106
- out.prefix = 0;
107
- out.lastname = 1;
108
- out.firstname = 2;
109
- out.middlename = 3;
110
- out.suffix = 4;
111
- break;
112
- }
113
- }
114
- return out;
115
- }
116
- exports.organizeNameIndex = organizeNameIndex;
117
- /**
118
- * Makes it easy to manipulate shortcuts for this `NameType`
119
- * @param type name type
120
- */
121
- function allowShortNameType(type) {
122
- switch (type) {
123
- case 'firstname':
124
- case 'fn': return 'firstname';
125
- case 'lastname':
126
- case 'ln': return 'lastname';
127
- case 'middlename':
128
- case 'mn': return 'middlename';
129
- default:
130
- return type;
131
- }
132
- }
133
- exports.allowShortNameType = allowShortNameType;
134
- /**
135
- * Makes it easy to manipulate shortcuts for this `NameOrder`
136
- * @param type name type
137
- */
138
- function allowShortNameOrder(type) {
139
- switch (type) {
140
- case 'firstname':
141
- case 'fn': return 'firstname';
142
- case 'lastname':
143
- case 'ln': return 'lastname';
144
- default:
145
- return type;
146
- }
147
- }
148
- exports.allowShortNameOrder = allowShortNameOrder;
149
- /**
150
- * Converts to ascii characters (using UTF-16)
151
- * @param str string content
152
- * @param restrictions unneeded content to skip
153
- */
154
- function convertToAscii(str, restrictions = [...core_1.RESTRICTED_CHARS]) {
155
- return str
156
- .split(models_1.Separator.EMPTY)
157
- .filter(c => restrictions.indexOf(c) === -1)
158
- .map(c => c.charCodeAt(0));
159
- }
160
- exports.convertToAscii = convertToAscii;
161
- /**
162
- * Generates a password
163
- * @param str string content
164
- */
165
- function generatePassword(str) {
166
- const mapper = core_1.PASSWORD_MAPPER;
167
- const password = str
168
- .split(models_1.Separator.EMPTY)
169
- .map(char => {
170
- if (mapper.has(char.toLowerCase()))
171
- return mapper.get(char.toLowerCase()).random();
172
- return mapper.get('$').random();
173
- })
174
- .join(models_1.Separator.EMPTY);
175
- return password;
176
- }
177
- exports.generatePassword = generatePassword;
178
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/core/utils.ts"],"names":[],"mappings":";;AAAA;;;;;GAKG;AACH,sCAAsE;AACtE,kCAYiB;AAEjB;;;;GAIG;AACH,SAAgB,UAAU,CAAC,GAAW,EAAE,SAA4B,SAAS;IACzE,IAAI,CAAC,GAAG;QAAE,OAAO,EAAE,CAAC;IACpB,MAAM,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IACrC,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IACxC,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;AAC3E,CAAC;AALD,gCAKC;AAED;;;;GAIG;AACH,SAAgB,YAAY,CAAC,GAAW,EAAE,SAA4B,SAAS;IAC3E,IAAI,CAAC,GAAG;QAAE,OAAO,EAAE,CAAC;IACpB,MAAM,OAAO,GAAG,GAAG,CAAC,CAAC,C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AC;SACtB,GAAG,CAAC,IAAI,CAAC,EAAE;QACR,IAAI,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YAC9B,OAAO,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;QACnD,OAAO,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC;IACpC,CAAC,CAAC;SACD,IAAI,CAAC,kBAAS,CAAC,KAAK,CAAC,CAAC;IAC3B,OAAO,QAAQ,CAAC;AACpB,CAAC;AAZD,4CAYC"}
@@ -1,10 +0,0 @@
1
- /**
2
- * Main entry to `Namefully`
3
- *
4
- * Created on March 03, 2020
5
- * @author Ralph Florent <ralflornt@gmail.com>
6
- */
7
- export * from './namefully';
8
- export * from './core';
9
- export * from './models';
10
- export * from './validators';
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,sDAA4B;AAC5B,iDAAuB;AACvB,mDAAyB;AACzB,uDAA6B"}
@@ -1,106 +0,0 @@
1
- /**
2
- * All the enums are listed here
3
- *
4
- * Created on March 06, 2020
5
- * @author Ralph Florent <ralflornt@gmail.com>
6
- */
7
- /**
8
- * Enum `Namon` contains the finite set of a representative piece of a name
9
- * @readonly
10
- * @enum {string}
11
- * The word `Namon` is the singular form used to refer to a chunk|part|piece of
12
- * a name. And the plural form is `Nama`. (Same idea as in criterion/criteria)
13
- */
14
- export declare enum Namon {
15
- PREFIX = "prefix",
16
- LAST_NAME = "lastname",
17
- MIDDLE_NAME = "middlename",
18
- FIRST_NAME = "firstname",
19
- SUFFIX = "suffix"
20
- }
21
- /**
22
- * Enum `Alphabet` for the list of writing systems
23
- * @readonly
24
- * @enum {string}
25
- */
26
- export declare enum Alphabet {
27
- LATIN = "Latin",
28
- CYRILLIC = "Cyrillic",
29
- GREEK = "Greek",
30
- ARMENIAN = "Armenian",
31
- GEORGIAN = "Georgian",
32
- HANGUL = "Hangul"
33
- }
34
- /**
35
- * Enum for the prefix values
36
- * @readonly
37
- * @enum {string}
38
- * American and Canadian English follow slightly different rules for abbreviated
39
- * titles than British and Australian English. In North American English, titles
40
- * before a name require a period: `Mr., Mrs., Ms., Dr.` In British and Australian
41
- * English, no full stops are used in these abbreviations.
42
- */
43
- export declare enum Prefix {
44
- FIRT_LIEUTENANT = "1st Lt",
45
- ADMIRAL = "Adm",
46
- ATTORNEY = "Atty",
47
- BROTHER = "Brother",
48
- CAPTAIN = "Capt",
49
- CHIEF = "Chief",
50
- COMMANDER = "Cmdr",
51
- COLONEL = "Col",
52
- UNI_DEAN = "Dean",
53
- DOCTOR = "Dr",
54
- ELDER = "Elder",
55
- FATHER = "Father",
56
- GENERAL = "Gen",
57
- HONORABLE = "Hon",
58
- LIEUTENANT_COLONEL = "Lt Col",
59
- MAJOR = "Maj",
60
- MASTER_SERGEANT = "MSgt",
61
- MISTER = "Mr",
62
- MARRIED_WOMAN = "Mrs",
63
- SINGLE_WOMAN = "Ms",
64
- PRINCE = "Prince",
65
- PROFESSOR = "Prof",
66
- RABBI = "Rabbi",
67
- REVEREND = "Rev",
68
- SISTER = "Sister"
69
- }
70
- /**
71
- * Enum for the suffix values
72
- * @readonly
73
- * @enum {string}
74
- */
75
- export declare enum Suffix {
76
- THE_SECOND = "II",
77
- THE_THIRD = "III",
78
- THE_FOURTH = "IV",
79
- CERT_PUB_ACCOUNTANT = "CPA",
80
- DOCTOR_DENTAL_MED = "DDS",
81
- ESQUIRE = "Esq",
82
- JURIST_DOCTOR = "JD",
83
- JUNIOR = "Jr",
84
- DOCTOR_OF_LAWS = "LLD",
85
- DOCTORATE = "PhD",
86
- RETIRED_ARMED_FORCES = "Ret",
87
- REGISTERED_NURSE = "RN",
88
- SENIOR = "Sr",
89
- DOCTOR_OF_OSTEO = "DO"
90
- }
91
- /**
92
- * Enum for the separator values representing some of the ASCII characters
93
- * @readonly
94
- * @enum {string}
95
- */
96
- export declare enum Separator {
97
- COLON = ":",
98
- COMMA = ",",
99
- EMPTY = "",
100
- HYPHEN = "-",
101
- PERIOD = ".",
102
- SPACE = " ",
103
- SINGLE_QUOTE = "'",
104
- DOUBLE_QUOTE = "\"",
105
- UNDERSCORE = "_"
106
- }
@@ -1,114 +0,0 @@
1
- "use strict";
2
- /**
3
- * All the enums are listed here
4
- *
5
- * Created on March 06, 2020
6
- * @author Ralph Florent <ralflornt@gmail.com>
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- /**
10
- * Enum `Namon` contains the finite set of a representative piece of a name
11
- * @readonly
12
- * @enum {string}
13
- * The word `Namon` is the singular form used to refer to a chunk|part|piece of
14
- * a name. And the plural form is `Nama`. (Same idea as in criterion/criteria)
15
- */
16
- var Namon;
17
- (function (Namon) {
18
- Namon["PREFIX"] = "prefix";
19
- Namon["LAST_NAME"] = "lastname";
20
- Namon["MIDDLE_NAME"] = "middlename";
21
- Namon["FIRST_NAME"] = "firstname";
22
- Namon["SUFFIX"] = "suffix";
23
- })(Namon = exports.Namon || (exports.Namon = {}));
24
- /**
25
- * Enum `Alphabet` for the list of writing systems
26
- * @readonly
27
- * @enum {string}
28
- */
29
- var Alphabet;
30
- (function (Alphabet) {
31
- Alphabet["LATIN"] = "Latin";
32
- Alphabet["CYRILLIC"] = "Cyrillic";
33
- Alphabet["GREEK"] = "Greek";
34
- Alphabet["ARMENIAN"] = "Armenian";
35
- Alphabet["GEORGIAN"] = "Georgian";
36
- Alphabet["HANGUL"] = "Hangul";
37
- })(Alphabet = exports.Alphabet || (exports.Alphabet = {}));
38
- /**
39
- * Enum for the prefix values
40
- * @readonly
41
- * @enum {string}
42
- * American and Canadian English follow slightly different rules for abbreviated
43
- * titles than British and Australian English. In North American English, titles
44
- * before a name require a period: `Mr., Mrs., Ms., Dr.` In British and Australian
45
- * English, no full stops are used in these abbreviations.
46
- */
47
- var Prefix;
48
- (function (Prefix) {
49
- Prefix["FIRT_LIEUTENANT"] = "1st Lt";
50
- Prefix["ADMIRAL"] = "Adm";
51
- Prefix["ATTORNEY"] = "Atty";
52
- Prefix["BROTHER"] = "Brother";
53
- Prefix["CAPTAIN"] = "Capt";
54
- Prefix["CHIEF"] = "Chief";
55
- Prefix["COMMANDER"] = "Cmdr";
56
- Prefix["COLONEL"] = "Col";
57
- Prefix["UNI_DEAN"] = "Dean";
58
- Prefix["DOCTOR"] = "Dr";
59
- Prefix["ELDER"] = "Elder";
60
- Prefix["FATHER"] = "Father";
61
- Prefix["GENERAL"] = "Gen";
62
- Prefix["HONORABLE"] = "Hon";
63
- Prefix["LIEUTENANT_COLONEL"] = "Lt Col";
64
- Prefix["MAJOR"] = "Maj";
65
- Prefix["MASTER_SERGEANT"] = "MSgt";
66
- Prefix["MISTER"] = "Mr";
67
- Prefix["MARRIED_WOMAN"] = "Mrs";
68
- Prefix["SINGLE_WOMAN"] = "Ms";
69
- Prefix["PRINCE"] = "Prince";
70
- Prefix["PROFESSOR"] = "Prof";
71
- Prefix["RABBI"] = "Rabbi";
72
- Prefix["REVEREND"] = "Rev";
73
- Prefix["SISTER"] = "Sister";
74
- })(Prefix = exports.Prefix || (exports.Prefix = {}));
75
- /**
76
- * Enum for the suffix values
77
- * @readonly
78
- * @enum {string}
79
- */
80
- var Suffix;
81
- (function (Suffix) {
82
- Suffix["THE_SECOND"] = "II";
83
- Suffix["THE_THIRD"] = "III";
84
- Suffix["THE_FOURTH"] = "IV";
85
- Suffix["CERT_PUB_ACCOUNTANT"] = "CPA";
86
- Suffix["DOCTOR_DENTAL_MED"] = "DDS";
87
- Suffix["ESQUIRE"] = "Esq";
88
- Suffix["JURIST_DOCTOR"] = "JD";
89
- Suffix["JUNIOR"] = "Jr";
90
- Suffix["DOCTOR_OF_LAWS"] = "LLD";
91
- Suffix["DOCTORATE"] = "PhD";
92
- Suffix["RETIRED_ARMED_FORCES"] = "Ret";
93
- Suffix["REGISTERED_NURSE"] = "RN";
94
- Suffix["SENIOR"] = "Sr";
95
- Suffix["DOCTOR_OF_OSTEO"] = "DO";
96
- })(Suffix = exports.Suffix || (exports.Suffix = {}));
97
- /**
98
- * Enum for the separator values representing some of the ASCII characters
99
- * @readonly
100
- * @enum {string}
101
- */
102
- var Separator;
103
- (function (Separator) {
104
- Separator["COLON"] = ":";
105
- Separator["COMMA"] = ",";
106
- Separator["EMPTY"] = "";
107
- Separator["HYPHEN"] = "-";
108
- Separator["PERIOD"] = ".";
109
- Separator["SPACE"] = " ";
110
- Separator["SINGLE_QUOTE"] = "'";
111
- Separator["DOUBLE_QUOTE"] = "\"";
112
- Separator["UNDERSCORE"] = "_";
113
- })(Separator = exports.Separator || (exports.Separator = {}));
114
- //# sourceMappingURL=enums.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"enums.js","sourceRoot":"","sources":["../../../src/models/enums.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAEH;;;;;;GAMG;AACH,IAAY,KAMX;AAND,WAAY,KAAK;IACb,0BAAiB,CAAA;IACjB,+BAAsB,CAAA;IACtB,mCAA0B,CAAA;IAC1B,iCAAwB,CAAA;IACxB,0BAAiB,CAAA;AACrB,CAAC,EANW,KAAK,GAAL,aAAK,KAAL,aAAK,QAMhB;AAED;;;;GAIG;AACH,IAAY,QAOX;AAPD,WAAY,QAAQ;IAChB,2BAAe,CAAA;IACf,iCAAqB,CAAA;IACrB,2BAAe,CAAA;IAClB,iCAAqB,CAAA;IACrB,iCAAqB,CAAA;IACrB,6BAAiB,CAAA;AAClB,CAAC,EAPW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAOnB;AAED;;;;;;;;GAQG;AACH,IAAY,MA0BX;AA1BD,WAAY,MAAM;IACd,oCAA0B,CAAA;IAC1B,yBAAe,CAAA;IACf,2BAAiB,CAAA;IACjB,6BAAmB,CAAA;IACnB,0BAAgB,CAAA;IAChB,yBAAe,CAAA;IACf,4BAAkB,CAAA;IAClB,yBAAe,CAAA;IACf,2BAAiB,CAAA;IACjB,uBAAa,CAAA;IACb,yBAAe,CAAA;IACf,2BAAiB,CAAA;IACjB,yBAAe,CAAA;IACf,2BAAiB,CAAA;IACjB,uCAA6B,CAAA;IAC7B,uBAAa,CAAA;IACb,kCAAwB,CAAA;IACxB,uBAAa,CAAA;IACb,+BAAqB,CAAA;IACrB,6BAAmB,CAAA;IACnB,2BAAiB,CAAA;IACjB,4BAAkB,CAAA;IAClB,yBAAe,CAAA;IACf,0BAAgB,CAAA;IAChB,2BAAiB,CAAA;AACrB,CAAC,EA1BW,MAAM,GAAN,cAAM,KAAN,cAAM,QA0BjB;AAED;;;;GAIG;AACH,IAAY,MAeX;AAfD,WAAY,MAAM;IACd,2BAAiB,CAAA;IACjB,2BAAiB,CAAA;IACjB,2BAAiB,CAAA;IACjB,qCAA2B,CAAA;IAC3B,mCAAyB,CAAA;IACzB,yBAAe,CAAA;IACf,8BAAoB,CAAA;IACpB,uBAAa,CAAA;IACb,gCAAsB,CAAA;IACtB,2BAAiB,CAAA;IACjB,sCAA4B,CAAA;IAC5B,iCAAuB,CAAA;IACvB,uBAAa,CAAA;IACb,gCAAsB,CAAA;AAC1B,CAAC,EAfW,MAAM,GAAN,cAAM,KAAN,cAAM,QAejB;AAED;;;;GAIG;AACH,IAAY,SAUX;AAVD,WAAY,SAAS;IACjB,wBAAW,CAAA;IACX,wBAAW,CAAA;IACX,uBAAU,CAAA;IACV,yBAAY,CAAA;IACZ,yBAAY,CAAA;IACZ,wBAAW,CAAA;IACX,+BAAkB,CAAA;IAClB,gCAAkB,CAAA;IAClB,6BAAgB,CAAA;AACpB,CAAC,EAVW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAUpB"}
@@ -1,77 +0,0 @@
1
- /**
2
- * First name class definition
3
- *
4
- * Created on March 06, 2020
5
- * @author Ralph Florent <ralflornt@gmail.com>
6
- */
7
- import { Name, Summary } from './index';
8
- /**
9
- * Represents a first name with some extra functionalities
10
- * @class
11
- * @extends Name
12
- */
13
- export declare class Firstname extends Name {
14
- namon: string;
15
- more: string[];
16
- /**
17
- * Constructs a `Firstname`
18
- * @param {string} namon a piece of string that will be defined as a namon
19
- * @param {string[]} [more] additional pieces considered as a given name
20
- */
21
- constructor(namon: string, ...more: string[]);
22
- /**
23
- * Determines whether a first name has more name parts
24
- */
25
- hasMore(): boolean;
26
- /**
27
- * Gives some descriptive statistics that summarize the central tendency,
28
- * dispersion and shape of the characters' distribution.
29
- * @param {boolean} includeAll whether to include other pieces of the first
30
- * name in the summary
31
- * @see {@link describe} in `Namefully` class for further information
32
- */
33
- describe(includeAll?: boolean): Summary;
34
- /**
35
- * Returns a string representation of the first name
36
- * @param {boolean} includeAll whether to include other pieces of the first
37
- * name
38
- */
39
- tostring(includeAll?: boolean): string;
40
- /**
41
- * Gets the initials of the first name
42
- */
43
- getInitials(includeAll?: boolean): string[];
44
- /**
45
- * Capitalizes a first name
46
- * @param {'initial' | 'all'} option how to capitalize its subparts
47
- */
48
- capitalize(option?: 'initial' | 'all'): Firstname;
49
- /**
50
- * De-capitalizes a first name
51
- * @param {'initial' | 'all'} option how to decapitalize its subparts
52
- */
53
- decapitalize(option?: 'initial' | 'all'): Firstname;
54
- /**
55
- * Normalizes the first name as it should be
56
- */
57
- normalize(): Firstname;
58
- /**
59
- * Returns an ascii representation of each characters of a first name
60
- * @param restrictions chars to skip
61
- */
62
- ascii(restrictions?: string[]): number[];
63
- /**
64
- * Returns a password-like representation of a first name
65
- */
66
- passwd(): string;
67
- }
68
- /**
69
- * Aliases for `Firstname`
70
- */
71
- export interface Firstname {
72
- cap: typeof Firstname.prototype.capitalize;
73
- decap: typeof Firstname.prototype.decapitalize;
74
- norm: typeof Firstname.prototype.normalize;
75
- stats: typeof Firstname.prototype.describe;
76
- inits: typeof Firstname.prototype.getInitials;
77
- }