Skip to content

Commit 1a8cdd8

Browse files
committed
Small tweaks to JSDoc and bug fix for Birthday
1 parent 9a81d81 commit 1a8cdd8

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

types/contacts.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ class Address {
5252
* Builds an address object for a contact.
5353
* A contact can contain multiple addresses.
5454
*
55-
* @param {String} country Full country name
56-
* @param {String} country_code Two-letter country abbreviation
57-
* @param {String} state State abbreviation
58-
* @param {String} city City name
59-
* @param {String} street Street number and name
60-
* @param {String} zip ZIP code
61-
* @param {String} type Address type. Standard Values: HOME, WORK
55+
* @param {String} [country] Full country name
56+
* @param {String} [country_code] Two-letter country abbreviation
57+
* @param {String} [state] State abbreviation
58+
* @param {String} [city] City name
59+
* @param {String} [street] Street number and name
60+
* @param {String} [zip] ZIP code
61+
* @param {String} [type] Address type. Standard Values: HOME, WORK
6262
*/
6363
constructor(country, country_code, state, city, street, zip, type) {
6464
if (country) this.country = country;
@@ -85,9 +85,9 @@ class Birthday {
8585
* @throws {Error} If the year, month, or day don't have a valid length
8686
*/
8787
constructor(year, month, day) {
88-
if (year.length !== 4) throw new Error("Year must be 4 digits");
89-
if (month.length !== 2) throw new Error("Month must be 2 digits");
90-
if (day.length !== 2) throw new Error("Day must be 2 digits");
88+
if (year?.length !== 4) throw new Error("Year must be 4 digits");
89+
if (month?.length !== 2) throw new Error("Month must be 2 digits");
90+
if (day?.length !== 2) throw new Error("Day must be 2 digits");
9191
this.birthday = `${year}-${month}-${day}`;
9292
this._ = "birthday";
9393
}
@@ -101,8 +101,8 @@ class Email {
101101
* Builds an email object for a contact.
102102
* A contact can contain multiple emails.
103103
*
104-
* @param {String} email Email address
105-
* @param {String} type Email type. Standard Values: HOME, WORK
104+
* @param {String} [email] Email address
105+
* @param {String} [type] Email type. Standard Values: HOME, WORK
106106
*/
107107
constructor(email, type) {
108108
if (email) this.email = email;
@@ -150,9 +150,9 @@ class Organization {
150150
/**
151151
* Builds an organization object for a contact
152152
*
153-
* @param {String} company Name of the contact's company
154-
* @param {String} department Name of the contact's department
155-
* @param {String} title Contact's business title
153+
* @param {String} [company] Name of the contact's company
154+
* @param {String} [department] Name of the contact's department
155+
* @param {String} [title] Contact's business title
156156
*/
157157
constructor(company, department, title) {
158158
if (company) this.company = company;
@@ -170,9 +170,9 @@ class Phone {
170170
* Builds a phone object for a contact.
171171
* A contact can contain multiple phones.
172172
*
173-
* @param {String} phone Phone number, automatically populated with the wa_id value as a formatted phone number
174-
* @param {String} type Phone type. Standard Values: CELL, MAIN, IPHONE, HOME, WORK
175-
* @param {String} wa_id WhatsApp ID. If present, number will be ignored. Usually it's the numeric part of the phone number
173+
* @param {String} [phone] Phone number, automatically populated with the wa_id value as a formatted phone number
174+
* @param {String} [type] Phone type. Standard Values: CELL, MAIN, IPHONE, HOME, WORK
175+
* @param {String} [wa_id] WhatsApp ID. If present, number will be ignored. Usually it's the numeric part of the phone number
176176
*/
177177
constructor(phone, type, wa_id) {
178178
if (phone && !wa_id) this.phone = phone;
@@ -190,8 +190,8 @@ class Url {
190190
* Builds an url object for a contact.
191191
* A contact can contain multiple urls.
192192
*
193-
* @param {String} url URL
194-
* @param {String} type URL type. Standard Values: HOME, WORK
193+
* @param {String} [url] URL
194+
* @param {String} [type] URL type. Standard Values: HOME, WORK
195195
*/
196196
constructor(url, type) {
197197
if (url) this.url = url;

0 commit comments

Comments
 (0)