namefully 1.2.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 (53) hide show
  1. package/dist/lib/config.js +67 -144
  2. package/dist/lib/constants.js +2 -3
  3. package/dist/lib/error.js +3 -121
  4. package/dist/lib/full-name.js +46 -78
  5. package/dist/lib/index.js +9 -15
  6. package/dist/lib/name.js +57 -149
  7. package/dist/lib/namefully.js +128 -441
  8. package/dist/lib/parser.js +33 -68
  9. package/dist/lib/types.js +6 -80
  10. package/dist/lib/utils.js +14 -60
  11. package/dist/lib/validator.js +46 -77
  12. package/dist/{lib/src → types}/config.d.ts +9 -33
  13. package/dist/{lib/src → types}/constants.d.ts +1 -1
  14. package/dist/{lib → types}/error.d.ts +8 -22
  15. package/dist/{lib → types}/full-name.d.ts +7 -24
  16. package/dist/{lib → types}/index.d.ts +1 -0
  17. package/dist/{lib/src → types}/name.d.ts +30 -81
  18. package/dist/{lib → types}/namefully.d.ts +29 -95
  19. package/dist/{lib → types}/parser.d.ts +1 -6
  20. package/dist/{lib/src → types}/types.d.ts +1 -1
  21. package/dist/{lib → types}/utils.d.ts +5 -15
  22. package/dist/{lib → types}/validator.d.ts +7 -16
  23. package/dist/umd/namefully.js +455 -1270
  24. package/dist/umd/namefully.min.js +1 -3
  25. package/package.json +44 -50
  26. package/readme.md +11 -10
  27. package/dist/example/index.js +0 -2734
  28. package/dist/lib/config.d.ts +0 -121
  29. package/dist/lib/config.js.map +0 -1
  30. package/dist/lib/constants.d.ts +0 -4
  31. package/dist/lib/constants.js.map +0 -1
  32. package/dist/lib/error.js.map +0 -1
  33. package/dist/lib/example/example.d.ts +0 -1
  34. package/dist/lib/full-name.js.map +0 -1
  35. package/dist/lib/index.js.map +0 -1
  36. package/dist/lib/name.d.ts +0 -177
  37. package/dist/lib/name.js.map +0 -1
  38. package/dist/lib/namefully.js.map +0 -1
  39. package/dist/lib/parser.js.map +0 -1
  40. package/dist/lib/src/error.d.ts +0 -172
  41. package/dist/lib/src/full-name.d.ts +0 -71
  42. package/dist/lib/src/index.d.ts +0 -20
  43. package/dist/lib/src/namefully.d.ts +0 -379
  44. package/dist/lib/src/parser.d.ts +0 -46
  45. package/dist/lib/src/utils.d.ts +0 -63
  46. package/dist/lib/src/validator.d.ts +0 -66
  47. package/dist/lib/types.d.ts +0 -127
  48. package/dist/lib/types.js.map +0 -1
  49. package/dist/lib/utils.js.map +0 -1
  50. package/dist/lib/validator.js.map +0 -1
  51. package/dist/umd/namefully.js.map +0 -1
  52. package/dist/umd/namefully.min.js.LICENSE.txt +0 -12
  53. package/dist/umd/namefully.min.js.map +0 -1
@@ -47,14 +47,7 @@ import { Flat, NameOrder, NameType, Namon, Nullable, Surname } from './types';
47
47
  * Happy name handling 😊!
48
48
  */
49
49
  export declare class Namefully {
50
- /**
51
- * A copy of high-quality name data.
52
- */
53
- private _fullName;
54
- /**
55
- * A copy of the default configuration (combined with a custom one if any).
56
- */
57
- private _config;
50
+ #private;
58
51
  /**
59
52
  * Creates a name with distinguishable parts from a raw string content.
60
53
  * @param names element to parse.
@@ -88,77 +81,41 @@ export declare class Namefully {
88
81
  * process.
89
82
  */
90
83
  static parse(text: string): Promise<Namefully>;
91
- /**
92
- * The current configuration.
93
- */
84
+ /** The current configuration. */
94
85
  get config(): Config;
95
- /**
96
- * The number of characters of the `birthName`, including spaces.
97
- */
86
+ /** The number of characters of the `birthName`, including spaces. */
98
87
  get length(): number;
99
- /**
100
- * The prefix part.
101
- */
88
+ /** The prefix part. */
102
89
  get prefix(): Nullable<string>;
103
- /**
104
- * The firt name.
105
- */
90
+ /** The firt name part. */
106
91
  get first(): string;
107
- /**
108
- * The first middle name if any.
109
- */
92
+ /** The first middle name part if any. */
110
93
  get middle(): Nullable<string>;
111
- /**
112
- * Returns true if any middle name has been set.
113
- */
94
+ /** Returns true if any middle name has been set. */
114
95
  get hasMiddle(): boolean;
115
- /**
116
- * The last name.
117
- */
96
+ /** The last name part. */
118
97
  get last(): string;
119
- /**
120
- * The suffix part.
121
- */
98
+ /** The suffix part. */
122
99
  get suffix(): Nullable<string>;
123
- /**
124
- * The birth name.
125
- */
100
+ /** The birth name part. */
126
101
  get birth(): string;
127
- /**
128
- * The shortest version of a person name.
129
- */
102
+ /** The shortest version of a person name. */
130
103
  get short(): string;
131
- /**
132
- * The longest version of a person name.
133
- */
104
+ /** The longest version of a person name. */
134
105
  get long(): string;
135
- /**
136
- * The entire name set.
137
- */
106
+ /** The entire name set. */
138
107
  get full(): string;
139
- /**
140
- * The first name combined with the last name's initial.
141
- */
108
+ /** The first name combined with the last name's initial. */
142
109
  get public(): string;
143
- /**
144
- * Returns the full name as set.
145
- */
110
+ /** Returns the full name as set. */
146
111
  toString(): string;
147
- /**
148
- * Fetches the raw form of a name piece.
149
- */
112
+ /** Fetches the raw form of a name piece. */
150
113
  get(namon: Namon): Nullable<Name | Name[]>;
151
- /**
152
- * Whether this name is equal to another one from a raw-string perspective.
153
- */
114
+ /** Whether this name is equal to another one from a raw-string perspective. */
154
115
  equal(other: Namefully): boolean;
155
- /**
156
- * Gets a JSON representation of the full name.
157
- */
116
+ /** Gets a JSON representation of the full name. */
158
117
  toJson(): JsonName;
159
- /**
160
- * Confirms that a name part has been set.
161
- */
118
+ /** Confirms that a name part has been set. */
162
119
  has(namon: Namon): boolean;
163
120
  /**
164
121
  * Gets the full name ordered as configured.
@@ -191,9 +148,7 @@ export declare class Namefully {
191
148
  * name.
192
149
  */
193
150
  firstName(withMore?: boolean): string;
194
- /**
195
- * Gets the middle name part of the `FullName`.
196
- */
151
+ /** Gets the middle name part of the `FullName`. */
197
152
  middleName(): string[];
198
153
  /**
199
154
  * Gets the last name part of the `FullName`.
@@ -327,9 +282,7 @@ export declare class Namefully {
327
282
  * first, middle, and last names.
328
283
  */
329
284
  format(pattern: string): string;
330
- /**
331
- * Flips definitely the name order from the preset/current config.
332
- */
285
+ /** Flips definitely the name order from the preset/current config. */
333
286
  flip(): void;
334
287
  /**
335
288
  * Splits the name parts of a birth name.
@@ -341,39 +294,20 @@ export declare class Namefully {
341
294
  * @param separator token for the junction.
342
295
  */
343
296
  join(separator?: string): string;
344
- /**
345
- * Transforms a birth name into UPPERCASE
346
- */
297
+ /** Transforms a birth name into UPPERCASE. */
347
298
  toUpperCase(): string;
348
- /**
349
- * Transforms a birth name into lowercase
350
- */
299
+ /** Transforms a birth name into lowercase. */
351
300
  toLowerCase(): string;
352
- /**
353
- * Transforms a birth name into camelCase
354
- */
301
+ /** Transforms a birth name into camelCase. */
355
302
  toCamelCase(): string;
356
- /**
357
- * Transforms a birth name into PascalCase
358
- */
303
+ /** Transforms a birth name into PascalCase. */
359
304
  toPascalCase(): string;
360
- /**
361
- * Transforms a birth name into snake_case
362
- */
305
+ /** Transforms a birth name into snake_case. */
363
306
  toSnakeCase(): string;
364
- /**
365
- * Transforms a birth name into hyphen-case
366
- */
307
+ /** Transforms a birth name into hyphen-case. */
367
308
  toHyphenCase(): string;
368
- /**
369
- * Transforms a birth name into dot.case
370
- */
309
+ /** Transforms a birth name into dot.case. */
371
310
  toDotCase(): string;
372
- /**
373
- * Transforms a birth name into ToGgLeCaSe
374
- */
311
+ /** Transforms a birth name into ToGgLeCaSe. */
375
312
  toToggleCase(): string;
376
- private build;
377
- private toParser;
378
- private map;
379
313
  }
@@ -27,20 +27,15 @@ export declare abstract class Parser<T = any> {
27
27
  abstract parse(options?: Partial<Config>): FullName;
28
28
  }
29
29
  export declare class StringParser extends Parser<string> {
30
- constructor(raw: string);
31
30
  parse(options: Partial<Config>): FullName;
32
31
  }
33
32
  export declare class ArrayStringParser extends Parser<string[]> {
34
- constructor(raw: string[]);
35
33
  parse(options: Partial<Config>): FullName;
36
- private split;
37
34
  }
38
35
  export declare class NamaParser extends Parser<JsonName> {
39
- constructor(raw: JsonName);
36
+ #private;
40
37
  parse(options: Partial<Config>): FullName;
41
- private asNama;
42
38
  }
43
39
  export declare class ArrayNameParser extends Parser<Name[]> {
44
- constructor(raw: Name[]);
45
40
  parse(options: Partial<Config>): FullName;
46
41
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Make a type nullable.
3
3
  */
4
- export declare type Nullable<T> = T | null | undefined;
4
+ export type Nullable<T> = T | null | undefined;
5
5
  /**
6
6
  * The abbreviation type to indicate whether or not to add period to a prefix
7
7
  * using the American or British way.
@@ -28,18 +28,12 @@ export declare class NameIndex {
28
28
  readonly middleName: number;
29
29
  readonly lastName: number;
30
30
  readonly suffix: number;
31
- /**
32
- * The minimum number of parts in a list of names.
33
- */
31
+ /** The minimum number of parts in a list of names. */
34
32
  static get min(): number;
35
- /**
36
- * The maximum number of parts in a list of names.
37
- */
33
+ /** The maximum number of parts in a list of names. */
38
34
  static get max(): number;
39
35
  private constructor();
40
- /**
41
- * The default or base indexing: firstName lastName.
42
- */
36
+ /** The default or base indexing: firstName lastName. */
43
37
  static base(): NameIndex;
44
38
  /**
45
39
  * Gets the name index for a list of names based on the `count` of elements
@@ -51,13 +45,9 @@ export declare class NameIndex {
51
45
  * Capitalizes a string via a `CapsRange` option.
52
46
  */
53
47
  export declare function capitalize(str: string, range?: CapsRange): string;
54
- /**
55
- * Decapitalizes a string via a `CapsRange` option.
56
- */
48
+ /** Decapitalizes a string via a `CapsRange` option. */
57
49
  export declare function decapitalize(str: string, range?: CapsRange): string;
58
- /**
59
- * Toggles a string representation.
60
- */
50
+ /** Toggles a string representation. */
61
51
  export declare function toggleCase(str: string): string;
62
52
  export declare function isStringArray(value?: unknown): boolean;
63
53
  export declare function isNameArray(value?: unknown): boolean;
@@ -8,32 +8,27 @@ declare class ArrayValidator<T extends string | Name> implements Validator<T[]>
8
8
  validate(values: T[]): void;
9
9
  }
10
10
  declare class NamonValidator implements Validator<string | Name> {
11
- private static validator;
12
- private constructor();
11
+ #private;
13
12
  static create(): NamonValidator;
14
13
  validate(value: string | Name, type?: Namon): void;
15
14
  }
16
15
  declare class FirstNameValidator implements Validator<string | FirstName> {
17
- private static validator;
18
- private constructor();
16
+ #private;
19
17
  static create(): FirstNameValidator;
20
18
  validate(value: string | FirstName): void;
21
19
  }
22
20
  declare class MiddleNameValidator implements Validator<string | string[] | Name[]> {
23
- private static validator;
24
- private constructor();
21
+ #private;
25
22
  static create(): MiddleNameValidator;
26
23
  validate(value: string | string[] | Name[]): void;
27
24
  }
28
25
  declare class LastNameValidator implements Validator<string | LastName> {
29
- private static validator;
30
- private constructor();
26
+ #private;
31
27
  static create(): LastNameValidator;
32
28
  validate(value: string | LastName): void;
33
29
  }
34
30
  export declare class NamaValidator implements Validator<Map<Namon, string>> {
35
- private static validator;
36
- private constructor();
31
+ #private;
37
32
  static create(): NamaValidator;
38
33
  validate(value: Map<Namon, string>): void;
39
34
  validateKeys(nama: Map<Namon, string>): void;
@@ -45,15 +40,11 @@ export declare class ArrayStringValidator extends ArrayValidator<string> {
45
40
  validateIndex(values: string[]): void;
46
41
  }
47
42
  export declare class ArrayNameValidator implements Validator<Name[]> {
48
- private static validator;
49
- private constructor();
43
+ #private;
50
44
  static create(): ArrayNameValidator;
51
45
  validate(value: Name[]): void;
52
- private hasBasicNames;
53
46
  }
54
- /**
55
- * A list of validators for a specific namon.
56
- */
47
+ /** A list of validators for a specific namon. */
57
48
  export declare abstract class Validators {
58
49
  static namon: NamonValidator;
59
50
  static nama: NamaValidator;