ical-generator 6.0.1-develop.9 → 6.0.2-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/dist/index.cjs CHANGED
@@ -57,7 +57,7 @@
57
57
  `),this.data.lastModified&&(t+="LAST-MODIFIED:"+o(this.calendar.timezone(),this.data.lastModified)+`\r
58
58
  `),this.data.class&&(t+="CLASS:"+this.data.class.toUpperCase()+`\r
59
59
  `),t+=`END:VEVENT\r
60
- `,t}};var Y=(h=>(h.PUBLISH="PUBLISH",h.REQUEST="REQUEST",h.REPLY="REPLY",h.ADD="ADD",h.CANCEL="CANCEL",h.REFRESH="REFRESH",h.COUNTER="COUNTER",h.DECLINECOUNTER="DECLINECOUNTER",h))(Y||{}),y=class{constructor(t={}){this.data={prodId:"//sebbo.net//ical-generator//EN",method:null,name:null,description:null,timezone:null,source:null,url:null,scale:null,ttl:null,events:[],x:[]},t.prodId!==void 0&&this.prodId(t.prodId),t.method!==void 0&&this.method(t.method),t.name!==void 0&&this.name(t.name),t.description!==void 0&&this.description(t.description),t.timezone!==void 0&&this.timezone(t.timezone),t.source!==void 0&&this.source(t.source),t.url!==void 0&&this.url(t.url),t.scale!==void 0&&this.scale(t.scale),t.ttl!==void 0&&this.ttl(t.ttl),t.events!==void 0&&this.events(t.events),t.x!==void 0&&this.x(t.x)}prodId(t){if(!t)return this.data.prodId;if(typeof t=="string"&&/^\/\/(.+)\/\/(.+)\/\/([A-Z]{1,4})$/.test(t))return this.data.prodId=t,this;if(typeof t=="string")throw new Error("`prodId` isn't formated correctly. See https://sebbo2002.github.io/ical-generator/develop/reference/classes/ICalCalendar.html#prodId");if(typeof t!="object")throw new Error("`prodid` needs to be a valid formed string or an object!");if(!t.company)throw new Error("`prodid.company` is a mandatory item!");if(!t.product)throw new Error("`prodid.product` is a mandatory item!");let n=(t.language||"EN").toUpperCase();return this.data.prodId="//"+t.company+"//"+t.product+"//"+n,this}method(t){return t===void 0?this.data.method:t?(this.data.method=d(Y,t),this):(this.data.method=null,this)}name(t){return t===void 0?this.data.name:(this.data.name=t?String(t):null,this)}description(t){return t===void 0?this.data.description:(this.data.description=t?String(t):null,this)}timezone(t){var e;return t===void 0?((e=this.data.timezone)==null?void 0:e.name)||null:(t==="UTC"?this.data.timezone=null:typeof t=="string"?this.data.timezone={name:t}:t===null?this.data.timezone=null:this.data.timezone=t,this)}source(t){return t===void 0?this.data.source:(this.data.source=t||null,this)}url(t){return t===void 0?this.data.url:(this.data.url=t||null,this)}scale(t){return t===void 0?this.data.scale:(t===null?this.data.scale=null:this.data.scale=t.toUpperCase(),this)}ttl(t){return t===void 0?this.data.ttl:(W(t)?this.data.ttl=t.asSeconds():t&&t>0?this.data.ttl=t:this.data.ttl=null,this)}createEvent(t){let e=t instanceof D?t:new D(t,this);return this.data.events.push(e),e}events(t){return t?(t.forEach(e=>this.createEvent(e)),this):this.data.events}clear(){return this.data.events=[],this}x(t,e){if(t===void 0)return u(this.data);if(typeof t=="string"&&typeof e=="string")u(this.data,t,e);else if(typeof t=="object")u(this.data,t);else throw new Error("Either key or value is not a string!");return this}toJSON(){return Object.assign({},this.data,{timezone:this.timezone(),events:this.data.events.map(t=>t.toJSON()),x:this.x()})}length(){return this.data.events.length}toString(){var e,n;let t="";return t=`BEGIN:VCALENDAR\r
60
+ `,t}};var Y=(h=>(h.PUBLISH="PUBLISH",h.REQUEST="REQUEST",h.REPLY="REPLY",h.ADD="ADD",h.CANCEL="CANCEL",h.REFRESH="REFRESH",h.COUNTER="COUNTER",h.DECLINECOUNTER="DECLINECOUNTER",h))(Y||{}),y=class{constructor(t={}){this.data={prodId:"//sebbo.net//ical-generator//EN",method:null,name:null,description:null,timezone:null,source:null,url:null,scale:null,ttl:null,events:[],x:[]},t.prodId!==void 0&&this.prodId(t.prodId),t.method!==void 0&&this.method(t.method),t.name!==void 0&&this.name(t.name),t.description!==void 0&&this.description(t.description),t.timezone!==void 0&&this.timezone(t.timezone),t.source!==void 0&&this.source(t.source),t.url!==void 0&&this.url(t.url),t.scale!==void 0&&this.scale(t.scale),t.ttl!==void 0&&this.ttl(t.ttl),t.events!==void 0&&this.events(t.events),t.x!==void 0&&this.x(t.x)}prodId(t){if(!t)return this.data.prodId;if(typeof t=="string")return this.data.prodId=t,this;if(typeof t!="object")throw new Error("`prodid` needs to be a string or an object!");if(!t.company)throw new Error("`prodid.company` is a mandatory item!");if(!t.product)throw new Error("`prodid.product` is a mandatory item!");let e=(t.language||"EN").toUpperCase();return this.data.prodId="//"+t.company+"//"+t.product+"//"+e,this}method(t){return t===void 0?this.data.method:t?(this.data.method=d(Y,t),this):(this.data.method=null,this)}name(t){return t===void 0?this.data.name:(this.data.name=t?String(t):null,this)}description(t){return t===void 0?this.data.description:(this.data.description=t?String(t):null,this)}timezone(t){var e;return t===void 0?((e=this.data.timezone)==null?void 0:e.name)||null:(t==="UTC"?this.data.timezone=null:typeof t=="string"?this.data.timezone={name:t}:t===null?this.data.timezone=null:this.data.timezone=t,this)}source(t){return t===void 0?this.data.source:(this.data.source=t||null,this)}url(t){return t===void 0?this.data.url:(this.data.url=t||null,this)}scale(t){return t===void 0?this.data.scale:(t===null?this.data.scale=null:this.data.scale=t.toUpperCase(),this)}ttl(t){return t===void 0?this.data.ttl:(W(t)?this.data.ttl=t.asSeconds():t&&t>0?this.data.ttl=t:this.data.ttl=null,this)}createEvent(t){let e=t instanceof D?t:new D(t,this);return this.data.events.push(e),e}events(t){return t?(t.forEach(e=>this.createEvent(e)),this):this.data.events}clear(){return this.data.events=[],this}x(t,e){if(t===void 0)return u(this.data);if(typeof t=="string"&&typeof e=="string")u(this.data,t,e);else if(typeof t=="object")u(this.data,t);else throw new Error("Either key or value is not a string!");return this}toJSON(){return Object.assign({},this.data,{timezone:this.timezone(),events:this.data.events.map(t=>t.toJSON()),x:this.x()})}length(){return this.data.events.length}toString(){var e,n;let t="";return t=`BEGIN:VCALENDAR\r
61
61
  VERSION:2.0\r
62
62
  `,t+="PRODID:-"+this.data.prodId+`\r
63
63
  `,this.data.url&&(t+="URL:"+this.data.url+`\r