carlsednaoui / add-to-calendar-buttons

Easily add a "add to calendar" button to your websites. This JavaScript library supports Google Calendar, iCal, Outlook and Yahoo Calendar.
476 stars 171 forks source link

Why are `options` and `data` separate? #34

Open ubershmekel opened 5 years ago

ubershmekel commented 5 years ago

If we're breaking compatibility - can options and data be merged?

https://github.com/carlsednaoui/add-to-calendar-buttons/pull/33

commonpike commented 5 years ago

Why are options and data separate?

Because they apply to different things.

The data is used to generate the calendar links. Different types of calendars can be added later. There could for example be a calendar for 'zoom invite' one day. These calendars need not be aware of the 'options'.

The options are used to decide how and where these calendars should be generated. Different types of options could be added later. There could for example be an option called 'style' one day, to get a dark and a light version. These options need not be aware of the 'data'.

can options and data be merged?

Curious - why do you want this ?

ubershmekel commented 4 years ago

It seems tedious to have two objects as input instead of one. Just more API surface to learn. Many JS functions cram every single option and data into one object. It's especially nicer when the objects are big, so indentation doesn't get awkward with two multiline objects in one function call.

But if you prefer to keep them separate, do your thing.