ical-generator 8.1.2-develop.8 → 9.0.0-develop.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.
package/src/category.ts CHANGED
@@ -1,21 +1,17 @@
1
1
  'use strict';
2
2
 
3
-
4
- import {escape} from './tools.ts';
5
-
3
+ import { escape } from './tools.ts';
6
4
 
7
5
  export interface ICalCategoryData {
8
6
  name: string;
9
7
  }
10
8
 
9
+ export type ICalCategoryInternalData = ICalCategoryJSONData;
11
10
 
12
11
  export interface ICalCategoryJSONData {
13
12
  name: string;
14
13
  }
15
14
 
16
- export type ICalCategoryInternalData = ICalCategoryJSONData;
17
-
18
-
19
15
  /**
20
16
  * Usually you get an {@link ICalCategory} object like this:
21
17
  *
@@ -43,29 +39,27 @@ export default class ICalCategory {
43
39
  */
44
40
  constructor(data: ICalCategoryData) {
45
41
  this.data = {
46
- name: ''
42
+ name: '',
47
43
  };
48
44
 
49
- if(!data.name) {
45
+ if (!data.name) {
50
46
  throw new Error('No value for `name` in ICalCategory given!');
51
47
  }
52
48
 
53
49
  this.name(data.name);
54
50
  }
55
51
 
56
-
57
52
  /**
58
53
  * Get the category name
59
54
  * @since 0.3.0
60
55
  */
61
56
  name(): string;
62
-
63
57
  /**
64
58
  * Set the category name
65
59
  * @since 0.3.0
66
60
  */
67
61
  name(name: string): this;
68
- name(name?: string): this | string {
62
+ name(name?: string): string | this {
69
63
  if (name === undefined) {
70
64
  return this.data.name;
71
65
  }
@@ -74,7 +68,6 @@ export default class ICalCategory {
74
68
  return this;
75
69
  }
76
70
 
77
-
78
71
  /**
79
72
  * Return a shallow copy of the category's options for JSON stringification.
80
73
  * Can be used for persistence.
@@ -85,7 +78,6 @@ export default class ICalCategory {
85
78
  return Object.assign({}, this.data);
86
79
  }
87
80
 
88
-
89
81
  /**
90
82
  * Return generated category name as a string.
91
83
  *
@@ -94,7 +86,6 @@ export default class ICalCategory {
94
86
  * ```
95
87
  */
96
88
  toString(): string {
97
-
98
89
  // CN / Name
99
90
  return escape(this.data.name, false);
100
91
  }