namefully 1.3.0 → 1.3.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.
@@ -1,6 +1,4 @@
1
- /**
2
- * Make a type nullable.
3
- */
1
+ /** Make a type nullable. */
4
2
  export type Nullable<T> = T | null | undefined;
5
3
  /**
6
4
  * The abbreviation type to indicate whether or not to add period to a prefix
@@ -23,25 +21,19 @@ export declare enum Surname {
23
21
  HYPHENATED = "hyphenated",
24
22
  ALL = "all"
25
23
  }
26
- /**
27
- * The order of appearance of a `FullName`.
28
- */
24
+ /** The order of appearance of a `FullName`. */
29
25
  export declare enum NameOrder {
30
26
  FIRST_NAME = "firstName",
31
27
  LAST_NAME = "lastName"
32
28
  }
33
- /**
34
- * The types of name handled in this according the name standards.
35
- */
29
+ /** The types of name handled in this according the name standards. */
36
30
  export declare enum NameType {
37
31
  FIRST_NAME = "firstName",
38
32
  MIDDLE_NAME = "middleName",
39
33
  LAST_NAME = "lastName",
40
34
  BIRTH_NAME = "birthName"
41
35
  }
42
- /**
43
- * The possible variants to indicate how to flatten a `FullName`.
44
- */
36
+ /** The possible variants to indicate how to flatten a `FullName`. */
45
37
  export declare enum Flat {
46
38
  FIRST_NAME = "firstName",
47
39
  MIDDLE_NAME = "middleName",
@@ -50,17 +42,13 @@ export declare enum Flat {
50
42
  MID_LAST = "midLast",
51
43
  ALL = "all"
52
44
  }
53
- /**
54
- * The range to use when capitalizing a string content.
55
- */
45
+ /** The range to use when capitalizing a string content. */
56
46
  export declare enum CapsRange {
57
47
  NONE = 0,
58
48
  INITIAL = 1,
59
49
  ALL = 2
60
50
  }
61
- /**
62
- * The types of name handled in this utility according the name standards.
63
- */
51
+ /** The types of name handled in this utility according the name standards. */
64
52
  export declare class Namon {
65
53
  readonly index: number;
66
54
  readonly key: string;
@@ -69,35 +57,22 @@ export declare class Namon {
69
57
  static readonly MIDDLE_NAME: Namon;
70
58
  static readonly LAST_NAME: Namon;
71
59
  static readonly SUFFIX: Namon;
72
- /**
73
- * The list of supported name types.
74
- */
60
+ /** The list of supported name types. */
75
61
  static readonly values: Namon[];
76
- /**
77
- * All the predefined name types.
78
- */
62
+ /** All the predefined name types. */
79
63
  static readonly all: Map<string, Namon>;
64
+ private static readonly aliases;
80
65
  private constructor();
81
- /**
82
- * Whether this string key is part of the predefined keys.
83
- */
66
+ /** Whether this string key is part of the predefined keys. */
84
67
  static has(key: string): boolean;
85
- /**
86
- * Makes a string key a namon type.
87
- */
68
+ /** Makes a string key a namon type. */
88
69
  static cast(key: string): Nullable<Namon>;
89
- /**
90
- * String representation of this object.
91
- */
70
+ /** String representation of this object. */
92
71
  toString(): string;
93
- /**
94
- * Whether this and the other value are equal.
95
- */
72
+ /** Whether this and the other value are equal. */
96
73
  equal(other: Namon | unknown): boolean;
97
74
  }
98
- /**
99
- * The token used to indicate how to split string values.
100
- */
75
+ /** The token used to indicate how to split string values. */
101
76
  export declare class Separator {
102
77
  readonly name: string;
103
78
  readonly token: string;
@@ -111,17 +86,13 @@ export declare class Separator {
111
86
  static readonly SINGLE_QUOTE: Separator;
112
87
  static readonly SPACE: Separator;
113
88
  static readonly UNDERSCORE: Separator;
114
- /**
115
- * All the available separators.
116
- */
89
+ /** All the available separators. */
117
90
  static readonly all: Map<string, Separator>;
118
- /**
119
- * All the available tokens.
120
- */
91
+ /** All the available tokens. */
121
92
  static readonly tokens: string[];
122
93
  private constructor();
123
- /**
124
- * String representation of this object.
125
- */
94
+ /** Makes a string key a separator type. */
95
+ static cast(key: string): Nullable<Separator>;
96
+ /** String representation of this object. */
126
97
  toString(): string;
127
98
  }
@@ -1,6 +1,6 @@
1
1
  import { NameOrder, CapsRange } from './types';
2
2
  /**
3
- * A fixed set of values to handle specific positions for list of names.
3
+ * A set of values to handle specific positions for list of names.
4
4
  *
5
5
  * As for list of names, this helps to follow a specific order based on the
6
6
  * count of elements. It is expected that the list has to be between two and
@@ -42,14 +42,12 @@ export declare class NameIndex {
42
42
  static when(order: NameOrder, count?: number): NameIndex;
43
43
  static only({ prefix, firstName, middleName, lastName, suffix }: Record<string, number>): NameIndex;
44
44
  toJson(): Record<string, number>;
45
+ json: () => Record<string, number>;
45
46
  }
46
- /**
47
- * Capitalizes a string via a `CapsRange` option.
48
- */
47
+ /** Capitalizes a string via a `CapsRange` option. */
49
48
  export declare function capitalize(str: string, range?: CapsRange): string;
50
49
  /** Decapitalizes a string via a `CapsRange` option. */
51
50
  export declare function decapitalize(str: string, range?: CapsRange): string;
52
51
  /** Toggles a string representation. */
53
52
  export declare function toggleCase(str: string): string;
54
- export declare function isStringArray(value?: unknown): boolean;
55
- export declare function isNameArray(value?: unknown): boolean;
53
+ export declare function isStringArray(value?: unknown): value is string[];
@@ -1,6 +1,6 @@
1
- import { FirstName, LastName, Name } from './name';
2
1
  import { Namon } from './types';
3
2
  import { NameIndex } from './utils';
3
+ import { FirstName, LastName, Name } from './name';
4
4
  export interface Validator<T> {
5
5
  validate(value: T): void;
6
6
  }