MCPcopy Create free account
hub / github.com/DHTMLX/scheduler / optionsToString

Function optionsToString

codebase/sources/dhtmlxscheduler.es.js:17176–17246  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

17174 return DateWithZone2;
17175}();
17176function optionsToString(options) {
17177 var rrule = [];
17178 var dtstart = "";
17179 var keys = Object.keys(options);
17180 var defaultKeys2 = Object.keys(DEFAULT_OPTIONS$1);
17181 for (var i = 0; i < keys.length; i++) {
17182 if (keys[i] === "tzid")
17183 continue;
17184 if (!includes(defaultKeys2, keys[i]))
17185 continue;
17186 var key = keys[i].toUpperCase();
17187 var value = options[keys[i]];
17188 var outValue = "";
17189 if (!isPresent(value) || isArray(value) && !value.length)
17190 continue;
17191 switch (key) {
17192 case "FREQ":
17193 outValue = RRule.FREQUENCIES[options.freq];
17194 break;
17195 case "WKST":
17196 if (isNumber(value)) {
17197 outValue = new Weekday(value).toString();
17198 } else {
17199 outValue = value.toString();
17200 }
17201 break;
17202 case "BYWEEKDAY":
17203 key = "BYDAY";
17204 outValue = toArray(value).map(function(wday) {
17205 if (wday instanceof Weekday) {
17206 return wday;
17207 }
17208 if (isArray(wday)) {
17209 return new Weekday(wday[0], wday[1]);
17210 }
17211 return new Weekday(wday);
17212 }).toString();
17213 break;
17214 case "DTSTART":
17215 dtstart = buildDtstart(value, options.tzid);
17216 break;
17217 case "UNTIL":
17218 outValue = timeToUntilString(value, !options.tzid);
17219 break;
17220 default:
17221 if (isArray(value)) {
17222 var strValues = [];
17223 for (var j = 0; j < value.length; j++) {
17224 strValues[j] = String(value[j]);
17225 }
17226 outValue = strValues.toString();
17227 } else {
17228 outValue = String(value);
17229 }
17230 }
17231 if (outValue) {
17232 rrule.push([key, outValue]);
17233 }

Callers 1

Calls 6

includesFunction · 0.70
isPresentFunction · 0.70
isNumberFunction · 0.70
toArrayFunction · 0.70
buildDtstartFunction · 0.70
timeToUntilStringFunction · 0.70

Tested by

no test coverage detected