@@ -17,57 +17,57 @@ import * as constants from './utils/constants'
1717
1818export default class VCard {
1919 /**
20- * Default Charset
20+ * Default Charset.
2121 *
2222 * @var string
2323 */
2424 public charset : string = constants . DEFAULT_CHARACTER_SET
2525
2626 /**
27- * Default ContentType
27+ * Default ContentType.
2828 *
2929 * @var string
3030 */
3131 private contentType : ContentType = constants . DEFAULT_CONTENT_TYPE
3232
3333 /**
34- * Default filename
34+ * Default filename.
3535 *
3636 * @var string
3737 */
3838 private filename : string = constants . DEFAULT_FILENAME
3939
4040 /**
41- * Default fileExtension
41+ * Default fileExtension.
4242 *
4343 * @var string
4444 */
4545 private fileExtension : string = constants . DEFAULT_EXTENSION
4646
4747 /**
48- * Properties
48+ * Properties.
4949 *
5050 * @var array
5151 */
5252 private properties : Property [ ] = [ ]
5353
5454 /**
55- * definedElements
55+ * Defined elements.
5656 *
5757 * @var object
5858 */
5959 private definedElements : DefinedElements = { }
6060
6161 /**
62- * Multiple properties for element allowed
62+ * Multiple properties for element allowed.
6363 *
6464 * @var array
6565 */
6666 private multiplePropertiesForElementAllowed : Element [ ] =
6767 constants . ALLOWED_MULTIPLE_PROPERTIES
6868
6969 /**
70- * Defines the output format
70+ * Defines the output format.
7171 *
7272 * @var bool
7373 */
@@ -80,7 +80,7 @@ export default class VCard {
8080 }
8181
8282 /**
83- * Set format
83+ * Set format.
8484 *
8585 * @param {Format } format Either 'vcard' or 'vcalendar'
8686 * @return {void }
@@ -96,7 +96,7 @@ export default class VCard {
9696 }
9797
9898 /**
99- * Add address
99+ * Add address.
100100 *
101101 * @param {string } [name='']
102102 * @param {string } [extended='']
@@ -133,7 +133,7 @@ ${name};${extended};${street};${city};${region};${zip};${country}\
133133 }
134134
135135 /**
136- * Add birthday
136+ * Add birthday.
137137 *
138138 * @param {string } date Format is YYYY-MM-DD
139139 * @return {this }
@@ -145,7 +145,7 @@ ${name};${extended};${street};${city};${region};${zip};${country}\
145145 }
146146
147147 /**
148- * Add company
148+ * Add company.
149149 *
150150 * @param {string } company
151151 * @param {string } department
@@ -162,7 +162,7 @@ ${name};${extended};${street};${city};${region};${zip};${country}\
162162 }
163163
164164 /**
165- * Add email
165+ * Add email.
166166 *
167167 * @param {string } address The e-mail address
168168 * @param {string } [type='']
@@ -182,9 +182,9 @@ ${name};${extended};${street};${city};${region};${zip};${country}\
182182 }
183183
184184 /**
185- * Add jobtitle
185+ * Add jobtitle.
186186 *
187- * @param {string } jobtitle The jobtitle for the person.
187+ * @param {string } jobtitle The jobtitle for the person
188188 * @return {this }
189189 */
190190 public addJobtitle ( jobtitle : string ) : this {
@@ -194,9 +194,9 @@ ${name};${extended};${street};${city};${region};${zip};${country}\
194194 }
195195
196196 /**
197- * Add role
197+ * Add role.
198198 *
199- * @param {string } role The role for the person.
199+ * @param {string } role The role for the person
200200 * @return {this }
201201 */
202202 public addRole ( role : string ) : this {
@@ -206,7 +206,7 @@ ${name};${extended};${street};${city};${region};${zip};${country}\
206206 }
207207
208208 /**
209- * Add a photo or logo (depending on property name)
209+ * Add a photo or logo (depending on property name).
210210 *
211211 * @param {string } property 'LOGO' | 'PHOTO'
212212 * @param {string } url Image url or filename
@@ -220,7 +220,7 @@ ${name};${extended};${street};${city};${region};${zip};${country}\
220220 }
221221
222222 /**
223- * Add a photo or logo (depending on property name)
223+ * Add a photo or logo (depending on property name).
224224 *
225225 * @param {string } property 'LOGO' | 'PHOTO'
226226 * @param {string } content Image content
@@ -249,7 +249,7 @@ ${name};${extended};${street};${city};${region};${zip};${country}\
249249 }
250250
251251 /**
252- * Add name
252+ * Add name.
253253 *
254254 * @param {string } [lastName='']
255255 * @param {string } [firstName='']
@@ -287,7 +287,7 @@ ${lastName};${firstName};${additional};${prefix};${suffix}\
287287 }
288288
289289 /**
290- * Add nickname
290+ * Add nickname.
291291 *
292292 * @param {string|string[] } nickname
293293 */
@@ -330,7 +330,7 @@ ${lastName};${firstName};${additional};${prefix};${suffix}\
330330 }
331331
332332 /**
333- * Add phone number
333+ * Add phone number.
334334 *
335335 * @param {number | string } number
336336 * @param {string } [type='']
@@ -350,7 +350,7 @@ ${lastName};${firstName};${additional};${prefix};${suffix}\
350350 }
351351
352352 /**
353- * Add Logo
353+ * Add Logo.
354354 *
355355 * @link https://tools.ietf.org/html/rfc2426#section-3.5.3
356356 * @param {string } url Image url or filename
@@ -363,7 +363,7 @@ ${lastName};${firstName};${additional};${prefix};${suffix}\
363363 }
364364
365365 /**
366- * Add Logo
366+ * Add Logo.
367367 *
368368 * @link https://tools.ietf.org/html/rfc2426#section-3.5.3
369369 * @param {string } image Base64 encoded image content
@@ -380,7 +380,7 @@ ${lastName};${firstName};${additional};${prefix};${suffix}\
380380 }
381381
382382 /**
383- * Add Photo
383+ * Add Photo URL.
384384 *
385385 * @link https://tools.ietf.org/html/rfc2426#section-3.1.4
386386 * @param {string } url Image url or filename
@@ -393,7 +393,7 @@ ${lastName};${firstName};${additional};${prefix};${suffix}\
393393 }
394394
395395 /**
396- * Add Photo
396+ * Add Photo.
397397 *
398398 * @link https://tools.ietf.org/html/rfc2426#section-3.1.4
399399 * @param {string } image Base64 encoded image content
@@ -410,7 +410,7 @@ ${lastName};${firstName};${additional};${prefix};${suffix}\
410410 }
411411
412412 /**
413- * Add URL
413+ * Add URL.
414414 *
415415 * @param {string } url
416416 * @param {string } [type=''] Type may be WORK | HOME
@@ -423,7 +423,7 @@ ${lastName};${firstName};${additional};${prefix};${suffix}\
423423 }
424424
425425 /**
426- * Add social profile
426+ * Add social profile.
427427 *
428428 * @param {string } url The URL to the user's profile.
429429 * @param {string } type The social media type (e.g., Twitter, LinkedIn, etc.)
@@ -443,7 +443,7 @@ ${lastName};${firstName};${additional};${prefix};${suffix}\
443443 }
444444
445445 /**
446- * Add UID
446+ * Add UID.
447447 *
448448 * @param {string } uid
449449 * @return {this }
@@ -455,7 +455,7 @@ ${lastName};${firstName};${additional};${prefix};${suffix}\
455455 }
456456
457457 /**
458- * Build vCard (.vcf)
458+ * Build vCard (.vcf).
459459 *
460460 * @return {string }
461461 */
@@ -490,12 +490,14 @@ ${lastName};${firstName};${additional};${prefix};${suffix}\
490490 const dtstart = `${ nowBase } 00`
491491 const dtend = `${ nowBase } 01`
492492
493- // Base 64 it to be used as an attachemnt to the 'calendar appointment
493+ // Base 64 it to be used as an attachemnt to the 'calendar' appointment
494494 const b64vcard = b64encode ( this . buildVCard ( ) )
495495
496- // Chunk the single long line of b64 text in accordance with RFC2045
497- // (and the exact line length determined from the original .ics file
498- // exported from Apple calendar
496+ /*
497+ * Chunk the single long line of b64 text in accordance with RFC2045
498+ * (and the exact line length determined from the original .ics file
499+ * exported from Apple calendar
500+ */
499501 const b64mline = chunkSplit ( b64vcard , 74 , '\n' )
500502
501503 // Need to indent all the lines by 1 space for the iPhone
@@ -520,7 +522,7 @@ END:VCALENDAR
520522 }
521523
522524 /**
523- * Get output as string
525+ * Get output as string.
524526 *
525527 * @return {string }
526528 */
@@ -529,7 +531,7 @@ END:VCALENDAR
529531 }
530532
531533 /**
532- * Get charset
534+ * Get charset.
533535 *
534536 * @return {string }
535537 */
@@ -538,7 +540,7 @@ END:VCALENDAR
538540 }
539541
540542 /**
541- * Get charset string
543+ * Get charset string.
542544 *
543545 * @return {string }
544546 */
@@ -553,7 +555,7 @@ END:VCALENDAR
553555 }
554556
555557 /**
556- * Get content type
558+ * Get content type.
557559 *
558560 * @return {string }
559561 */
@@ -562,7 +564,7 @@ END:VCALENDAR
562564 }
563565
564566 /**
565- * Get filename
567+ * Get filename.
566568 *
567569 * @return {string }
568570 */
@@ -571,7 +573,7 @@ END:VCALENDAR
571573 }
572574
573575 /**
574- * Get file extension
576+ * Get file extension.
575577 *
576578 * @return {string }
577579 */
@@ -580,7 +582,7 @@ END:VCALENDAR
580582 }
581583
582584 /**
583- * Get output as string
585+ * Get output as string.
584586 *
585587 * iOS devices (and safari < iOS 8 in particular)can not read .vcf (= vcard)
586588 * files. So there is a workaround to build a .ics (= vcalender) file.
@@ -592,7 +594,7 @@ END:VCALENDAR
592594 }
593595
594596 /**
595- * Get properties
597+ * Get properties.
596598 *
597599 * @return {Array<{key: string, value: string}> }
598600 */
@@ -601,25 +603,21 @@ END:VCALENDAR
601603 }
602604
603605 /**
604- * Has property
606+ * Has property.
605607 *
606608 * @param {string } key
607609 * @return {boolean }
608610 */
609611 public hasProperty ( key : string ) : boolean {
610- const pproperties = this . getProperties ( )
611- // eslint-disable-next-line consistent-return
612- pproperties . forEach ( ( property : Property ) => {
613- if ( property . key === key && property . value !== '' ) {
614- return true
615- }
616- } )
612+ const properties = this . getProperties ( )
617613
618- return false
614+ return properties . some (
615+ ( property : Property ) => property . key === key && property . value !== '' ,
616+ )
619617 }
620618
621619 /**
622- * Set charset
620+ * Set charset.
623621 *
624622 * @param {string } charset
625623 * @return {void }
@@ -629,7 +627,7 @@ END:VCALENDAR
629627 }
630628
631629 /**
632- * Set filename
630+ * Set filename.
633631 *
634632 * @param {string } value
635633 * @return {void }
@@ -643,7 +641,7 @@ END:VCALENDAR
643641 }
644642
645643 /**
646- * Set property
644+ * Set property.
647645 *
648646 * @param {Element } element The element name you want to set,
649647 * e.g.: name, email, phoneNumber, ...
0 commit comments