_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q24300 | chunkArray | train | function chunkArray(myArray, chunk_size){
var results = [];
while (myArray.length) {
results.push(myArray.splice(0, chunk_size));
}
return results;
} | javascript | {
"resource": ""
} |
q24301 | train | function() {
var args = [], arg;
arg = $(this.expression);
while (arg) {
args.push(arg);
if (! $(',')) { break; }
arg = $(this.expression);
}
retu... | javascript | {
"resource": ""
} | |
q24302 | train | function() {
var c = input.charCodeAt(i);
if ((c > 57 || c < 45) || c === 47) return;
var value = $(/^(-?\d*\.?\d+(?:[eE][-+]?\d+)?)(\%|\w+)?/);
if (value) {
return new tree.Dimension(value[1], value[2], memo, env.fi... | javascript | {
"resource": ""
} | |
q24303 | train | function() {
var a, attachment,
e, elements = [],
f, filters = new tree.Filterset(),
z, zooms = [],
segments = 0, conditions = 0;
while (
(e = $(this.element)) ||
... | javascript | {
"resource": ""
} | |
q24304 | train | function() {
var m, a, op, operation;
m = $(this.operand);
if (m) {
while ((op = ($('/') || $('*') || $('%'))) && (a = $(this.operand))) {
operation = new tree.Operation(op, [operation || m, a], memo, env.filename);
... | javascript | {
"resource": ""
} | |
q24305 | train | function() {
var e, entities = [];
e = $(this.addition);
while (e || $(this.entity)) {
entities.push(e);
e = $(this.addition);
}
if (entities.length > 0) {
return new tree.Expres... | javascript | {
"resource": ""
} | |
q24306 | train | function (val) {
var color, mode;
if (arguments.length > 1) color = arguments[1];
if (arguments.length > 2) mode = arguments[2];
return {
is: 'tag',
val: val,
color: color,
mode: mode,
toString: function(env) {
... | javascript | {
"resource": ""
} | |
q24307 | addRules | train | function addRules(current, definition, byFilter) {
var newFilters = definition.filters,
newRules = definition.rules,
updatedFilters, clone, previous;
// The current definition might have been split up into
// multiple definitions already.
for (var k = 0; k < current.length; k++) {
... | javascript | {
"resource": ""
} |
q24308 | inheritDefinitions | train | function inheritDefinitions(definitions, env) {
var inheritTime = +new Date();
// definitions are ordered by specificity,
// high (index 0) to low
var byAttachment = {},
byFilter = {};
var result = [];
var current, attachment;
// Evaluate the filters specified by each definition wit... | javascript | {
"resource": ""
} |
q24309 | foldStyle | train | function foldStyle(style) {
for (var i = 0; i < style.length; i++) {
for (var j = style.length - 1; j > i; j--) {
if (style[j].filters.cloneWith(style[i].filters) === null) {
style.splice(j, 1);
}
}
}
return style;
} | javascript | {
"resource": ""
} |
q24310 | train | function(env) {
for (var i = 0; i < this.selectors.length; i++) {
var zval = tree.Zoom.all;
for (var z = 0; z < this.selectors[i].zoom.length; z++) {
zval = zval & this.selectors[i].zoom[z].ev(env).zoom;
}
this.selectors[i].zoom = zval;
}
... | javascript | {
"resource": ""
} | |
q24311 | symbolizerList | train | function symbolizerList(sym_order) {
return sym_order.sort(function(a, b) { return a[1] - b[1]; })
.map(function(v) { return v[0]; });
} | javascript | {
"resource": ""
} |
q24312 | train | function() {
if (this.hsl !== null) {
if (this.alpha < 1.0) {
if (this.perceptual) {
return 'rgba(' + hsluv.hsluvToRgb([this.hsl[0], this.hsl[1] * 100, this.hsl[2] * 100]).map(function(c) {
return Math.round(c * 255);
})... | javascript | {
"resource": ""
} | |
q24313 | train | function(env, op, other) {
var result = [],
rgb2;
if (other instanceof tree.Color) {
rgb2 = chroma(other.toString()).rgb();
}
else if (_.isArray(other)) {
rgb2 = _.slice(other, 0, Math.max(other.length, 3));
}
else if (_.isObject(other... | javascript | {
"resource": ""
} | |
q24314 | train | function(vcal) {
var allsubs, properties, vtimezones, reqTzid, i, tzid;
if (!vcal || vcal.name !== "vcalendar") {
//not a top-level vcalendar component
return vcal;
}
//Store vtimezone subcomponents in an object reference by tzid.
//Store properties from everything else in another arra... | javascript | {
"resource": ""
} | |
q24315 | train | function(string) {
var result = parseInt(string, 10);
if (ICAL.helpers.isStrictlyNaN(result)) {
throw new Error(
'Could not extract integer from "' + string + '"'
);
}
return result;
} | javascript | {
"resource": ""
} | |
q24316 | formatClassType | train | function formatClassType(data, type) {
if (typeof(data) === 'undefined') {
return undefined;
}
if (data instanceof type) {
return data;
}
return new type(data);
} | javascript | {
"resource": ""
} |
q24317 | train | function(buffer, search, pos) {
while ((pos = buffer.indexOf(search, pos)) !== -1) {
if (pos > 0 && buffer[pos - 1] === '\\') {
pos += 1;
} else {
return pos;
}
}
return -1;
} | javascript | {
"resource": ""
} | |
q24318 | train | function(list, seekVal, cmpfunc) {
if (!list.length)
return 0;
var low = 0, high = list.length - 1,
mid, cmpval;
while (low <= high) {
mid = low + Math.floor((high - low) / 2);
cmpval = cmpfunc(seekVal, list[mid]);
if (cmpval < 0)
high = mid - 1;
else if (cmp... | javascript | {
"resource": ""
} | |
q24319 | train | function() {
if (!ICAL.debug) {
return;
}
if (typeof (console) !== 'undefined' && 'log' in console) {
ICAL.helpers.dumpn = function consoleDumpn(input) {
console.log(input);
};
} else {
ICAL.helpers.dumpn = function geckoDumpn(input) {
dump(input + '\n');
}... | javascript | {
"resource": ""
} | |
q24320 | train | function(aSrc, aDeep) {
if (!aSrc || typeof aSrc != "object") {
return aSrc;
} else if (aSrc instanceof Date) {
return new Date(aSrc.getTime());
} else if ("clone" in aSrc) {
return aSrc.clone();
} else if (Array.isArray(aSrc)) {
var arr = [];
for (var i = 0; i < aSrc.lengt... | javascript | {
"resource": ""
} | |
q24321 | foldline | train | function foldline(aLine) {
var result = "";
var line = aLine || "";
while (line.length) {
result += ICAL.newLineChar + " " + line.substr(0, ICAL.foldLength);
line = line.substr(ICAL.foldLength);
}
return result.substr(ICAL.newLineChar.length + 1);
} | javascript | {
"resource": ""
} |
q24322 | pad | train | function pad(data) {
if (typeof(data) !== 'string') {
// handle fractions.
if (typeof(data) === 'number') {
data = parseInt(data);
}
data = String(data);
}
var len = data.length;
switch (len) {
case 0:
return '00';
case 1:
return '0' + data;
... | javascript | {
"resource": ""
} |
q24323 | train | function(base, child, extra) {
function F() {}
F.prototype = base.prototype;
child.prototype = new F();
if (extra) {
ICAL.helpers.extend(extra, child.prototype);
}
} | javascript | {
"resource": ""
} | |
q24324 | train | function(source, target) {
for (var key in source) {
var descr = Object.getOwnPropertyDescriptor(source, key);
if (descr && !Object.getOwnPropertyDescriptor(target, key)) {
Object.defineProperty(target, key, descr);
}
}
return target;
} | javascript | {
"resource": ""
} | |
q24325 | train | function(componentName) {
var isInDesign = componentName && componentName in design.components;
return isInDesign ? design.components[componentName] : design.defaultSet;
} | javascript | {
"resource": ""
} | |
q24326 | ParserError | train | function ParserError(message) {
this.message = message;
this.name = 'ParserError';
try {
throw new Error();
} catch (e) {
if (e.stack) {
var split = e.stack.split('\n');
split.shift();
this.stack = split.join('\n');
}
}
} | javascript | {
"resource": ""
} |
q24327 | train | function(name) {
if (name) {
var i = 0;
var comps = this.jCal[COMPONENT_INDEX];
var len = comps.length;
for (; i < len; i++) {
if (comps[i][NAME_INDEX] === name) {
var result = this._hydrateComponent(i);
return result;
}
}
... | javascript | {
"resource": ""
} | |
q24328 | train | function(name) {
var jCalLen = this.jCal[COMPONENT_INDEX].length;
var i = 0;
if (name) {
var comps = this.jCal[COMPONENT_INDEX];
var result = [];
for (; i < jCalLen; i++) {
if (name === comps[i][NAME_INDEX]) {
result.push(
this._hydrateComp... | javascript | {
"resource": ""
} | |
q24329 | train | function(name) {
var props = this.jCal[PROPERTY_INDEX];
var len = props.length;
var i = 0;
for (; i < len; i++) {
// 0 is property name
if (props[i][NAME_INDEX] === name) {
return true;
}
}
return false;
} | javascript | {
"resource": ""
} | |
q24330 | train | function(name) {
if (name) {
var i = 0;
var props = this.jCal[PROPERTY_INDEX];
var len = props.length;
for (; i < len; i++) {
if (props[i][NAME_INDEX] === name) {
var result = this._hydrateProperty(i);
return result;
}
}
} ... | javascript | {
"resource": ""
} | |
q24331 | train | function(name) {
var jCalLen = this.jCal[PROPERTY_INDEX].length;
var i = 0;
if (name) {
var props = this.jCal[PROPERTY_INDEX];
var result = [];
for (; i < jCalLen; i++) {
if (name === props[i][NAME_INDEX]) {
result.push(
this._hydrateProper... | javascript | {
"resource": ""
} | |
q24332 | train | function(component) {
if (!this._components) {
this._components = [];
this._hydratedComponentCount = 0;
}
if (component.parent) {
component.parent.removeSubcomponent(component);
}
var idx = this.jCal[COMPONENT_INDEX].push(component.jCal);
this._components[id... | javascript | {
"resource": ""
} | |
q24333 | train | function(name, value) {
var prop = new ICAL.Property(name);
prop.setValue(value);
this.addProperty(prop);
return prop;
} | javascript | {
"resource": ""
} | |
q24334 | train | function(name, value) {
var prop = this.getFirstProperty(name);
if (prop) {
prop.setValue(value);
} else {
prop = this.addPropertyWithValue(name, value);
}
return prop;
} | javascript | {
"resource": ""
} | |
q24335 | train | function() {
var designSet = this._designSet;
if (this.type in designSet.value) {
var designType = designSet.value[this.type];
if ('decorate' in designSet.value[this.type]) {
this.isDecorated = true;
} else {
this.isDecorated = false;
}
if (this... | javascript | {
"resource": ""
} | |
q24336 | train | function(value, index) {
if (!this._values) {
this._values = [];
}
if (typeof(value) === 'object' && 'icaltype' in value) {
// decorated value
this.jCal[VALUE_INDEX + index] = this._undecorate(value);
this._values[index] = value;
} else {
// undecorated v... | javascript | {
"resource": ""
} | |
q24337 | train | function(name, value) {
var lcname = name.toLowerCase();
if (typeof value === "string" &&
lcname in this._designSet.param &&
'multiValue' in this._designSet.param[lcname]) {
value = [value];
}
this.jCal[PROP_INDEX][name] = value;
} | javascript | {
"resource": ""
} | |
q24338 | train | function() {
var name = this.jCal[NAME_INDEX];
var designSet = this._designSet;
if (name in designSet.property) {
var details = designSet.property[name];
if ('defaultType' in details) {
return details.defaultType;
}
}
return design.defaultType;
} | javascript | {
"resource": ""
} | |
q24339 | train | function() {
var len = this.jCal.length - VALUE_INDEX;
if (len < 1) {
// its possible for a property to have no value.
return [];
}
var i = 0;
var result = [];
for (; i < len; i++) {
result[i] = this._hydrateValue(i);
}
return result;
} | javascript | {
"resource": ""
} | |
q24340 | train | function(values) {
if (!this.isMultiValue) {
throw new Error(
this.name + ': does not not support mulitValue.\n' +
'override isMultiValue'
);
}
var len = values.length;
var i = 0;
this.removeAllValues();
if (len > 0 &&
typeof(values[0])... | javascript | {
"resource": ""
} | |
q24341 | train | function(value) {
this.removeAllValues();
if (typeof(value) === 'object' && 'icaltype' in value) {
this.resetType(value.icaltype);
}
if (this.isDecorated) {
this._setDecoratedValue(value, 0);
} else {
this.jCal[VALUE_INDEX] = value;
}
} | javascript | {
"resource": ""
} | |
q24342 | icaltime_compare | train | function icaltime_compare(other) {
var a = this.toSeconds();
var b = other.toSeconds();
return (a > b) - (b > a);
} | javascript | {
"resource": ""
} |
q24343 | train | function() {
return ICAL.Period.fromData({
start: this.start ? this.start.clone() : null,
end: this.end ? this.end.clone() : null,
duration: this.duration ? this.duration.clone() : null
});
} | javascript | {
"resource": ""
} | |
q24344 | toSeconds | train | function toSeconds() {
var seconds = this.seconds + 60 * this.minutes + 3600 * this.hours +
86400 * this.days + 7 * 86400 * this.weeks;
return (this.isNegative ? -seconds : seconds);
} | javascript | {
"resource": ""
} |
q24345 | compare | train | function compare(aOther) {
var thisSeconds = this.toSeconds();
var otherSeconds = aOther.toSeconds();
return (thisSeconds > otherSeconds) - (thisSeconds < otherSeconds);
} | javascript | {
"resource": ""
} |
q24346 | parseDurationChunk | train | function parseDurationChunk(letter, number, object) {
var type;
switch (letter) {
case 'P':
if (number && number === '-') {
object.isNegative = true;
} else {
object.isNegative = false;
}
// period
break;
case 'D':
type = 'days';
... | javascript | {
"resource": ""
} |
q24347 | utcOffset | train | function utcOffset(tt) {
if (this == ICAL.Timezone.utcTimezone || this == ICAL.Timezone.localTimezone) {
return 0;
}
this._ensureCoverage(tt.year);
if (!this.changes.length) {
return 0;
}
var tt_change = {
year: tt.year,
month: tt.month,
day... | javascript | {
"resource": ""
} |
q24348 | train | function(name, timezone) {
if (name instanceof ICAL.Component) {
if (name.name === 'vtimezone') {
timezone = new ICAL.Timezone(name);
name = timezone.tzid;
}
}
if (timezone instanceof ICAL.Timezone) {
zones[name] = timezone;
} else {
throw new... | javascript | {
"resource": ""
} | |
q24349 | icaltime_fromJSDate | train | function icaltime_fromJSDate(aDate, useUTC) {
if (!aDate) {
this.reset();
} else {
if (useUTC) {
this.zone = ICAL.Timezone.utcTimezone;
this.year = aDate.getUTCFullYear();
this.month = aDate.getUTCMonth() + 1;
this.day = aDate.getUTCDate();
t... | javascript | {
"resource": ""
} |
q24350 | icaltime_dayOfWeek | train | function icaltime_dayOfWeek() {
var dowCacheKey = (this.year << 9) + (this.month << 5) + this.day;
if (dowCacheKey in ICAL.Time._dowCache) {
return ICAL.Time._dowCache[dowCacheKey];
}
// Using Zeller's algorithm
var q = this.day;
var m = this.month + (this.month < 3 ? 12 : 0... | javascript | {
"resource": ""
} |
q24351 | dayOfYear | train | function dayOfYear() {
var is_leap = (ICAL.Time.isLeapYear(this.year) ? 1 : 0);
var diypm = ICAL.Time.daysInYearPassedMonth;
return diypm[is_leap][this.month - 1] + this.day;
} | javascript | {
"resource": ""
} |
q24352 | startDoyWeek | train | function startDoyWeek(aFirstDayOfWeek) {
var firstDow = aFirstDayOfWeek || ICAL.Time.SUNDAY;
var delta = this.dayOfWeek() - firstDow;
if (delta < 0) delta += 7;
return this.dayOfYear() - delta;
} | javascript | {
"resource": ""
} |
q24353 | train | function(aDayOfWeek, aPos) {
var dow = this.dayOfWeek();
if (aPos === 0 && dow === aDayOfWeek) {
return true;
}
// get pos
var day = this.nthWeekDay(aDayOfWeek, aPos);
if (day === this.day) {
return true;
}
return false;
} | javascript | {
"resource": ""
} | |
q24354 | weekNumber | train | function weekNumber(aWeekStart) {
var wnCacheKey = (this.year << 12) + (this.month << 8) + (this.day << 3) + aWeekStart;
if (wnCacheKey in ICAL.Time._wnCache) {
return ICAL.Time._wnCache[wnCacheKey];
}
// This function courtesty of Julian Bucknall, published under the MIT license
/... | javascript | {
"resource": ""
} |
q24355 | icaltime_add | train | function icaltime_add(aDuration) {
var mult = (aDuration.isNegative ? -1 : 1);
// because of the duration optimizations it is much
// more efficient to grab all the values up front
// then set them directly (which will avoid a normalization call).
// So we don't actually normalize until w... | javascript | {
"resource": ""
} |
q24356 | icaltime_subtract_abs | train | function icaltime_subtract_abs(aDate) {
var unixTime = this.toUnixTime();
var other = aDate.toUnixTime();
return ICAL.Duration.fromSeconds(unixTime - other);
} | javascript | {
"resource": ""
} |
q24357 | icaltime_compare | train | function icaltime_compare(other) {
var a = this.toUnixTime();
var b = other.toUnixTime();
if (a > b) return 1;
if (b > a) return -1;
return 0;
} | javascript | {
"resource": ""
} |
q24358 | icaltime_compareDateOnlyTz | train | function icaltime_compareDateOnlyTz(other, tz) {
function cmp(attr) {
return ICAL.Time._cmp_attr(a, b, attr);
}
var a = this.convertToZone(tz);
var b = other.convertToZone(tz);
var rc = 0;
if ((rc = cmp("year")) != 0) return rc;
if ((rc = cmp("month")) != 0) return rc;... | javascript | {
"resource": ""
} |
q24359 | convertToZone | train | function convertToZone(zone) {
var copy = this.clone();
var zone_equals = (this.zone.tzid == zone.tzid);
if (!this.isDate && !zone_equals) {
ICAL.Timezone.convert_time(copy, this.zone, zone);
}
copy.zone = zone;
return copy;
} | javascript | {
"resource": ""
} |
q24360 | train | function() {
var string = this.toString();
if (string.length > 10) {
return ICAL.design.icalendar.value['date-time'].toICAL(string);
} else {
return ICAL.design.icalendar.value.date.toICAL(string);
}
} | javascript | {
"resource": ""
} | |
q24361 | toJSDate | train | function toJSDate() {
if (this.zone == ICAL.Timezone.localTimezone) {
if (this.isDate) {
return new Date(this.year, this.month - 1, this.day);
} else {
return new Date(this.year, this.month - 1, this.day,
this.hour, this.minute, this.second, 0);
... | javascript | {
"resource": ""
} |
q24362 | fromUnixTime | train | function fromUnixTime(seconds) {
this.zone = ICAL.Timezone.utcTimezone;
var epoch = ICAL.Time.epochTime.clone();
epoch.adjust(0, 0, 0, seconds);
this.year = epoch.year;
this.month = epoch.month;
this.day = epoch.day;
this.hour = epoch.hour;
this.minute = epoch.minute;
... | javascript | {
"resource": ""
} |
q24363 | toUnixTime | train | function toUnixTime() {
if (this._cachedUnixTime !== null) {
return this._cachedUnixTime;
}
var offset = this.utcOffset();
// we use the offset trick to ensure
// that we are getting the actual UTC time
var ms = Date.UTC(
this.year,
this.month - 1,
th... | javascript | {
"resource": ""
} |
q24364 | train | function() {
var copy = [
'year',
'month',
'day',
'hour',
'minute',
'second',
'isDate'
];
var result = Object.create(null);
var i = 0;
var len = copy.length;
var prop;
for (; i < len; i++) {
prop = copy[i];
... | javascript | {
"resource": ""
} | |
q24365 | train | function() {
var res = Object.create(null);
res.freq = this.freq;
if (this.count) {
res.count = this.count;
}
if (this.interval > 1) {
res.interval = this.interval;
}
for (var k in this.parts) {
/* istanbul ignore if */
if (!this.parts.hasOwnP... | javascript | {
"resource": ""
} | |
q24366 | icalrecur_toString | train | function icalrecur_toString() {
// TODO retain order
var str = "FREQ=" + this.freq;
if (this.count) {
str += ";COUNT=" + this.count;
}
if (this.interval > 1) {
str += ";INTERVAL=" + this.interval;
}
for (var k in this.parts) {
/* istanbul ignore else */
... | javascript | {
"resource": ""
} |
q24367 | train | function(options) {
this.rule = ICAL.helpers.formatClassType(options.rule, ICAL.Recur);
if (!this.rule) {
throw new Error('iterator requires a (ICAL.Recur) rule');
}
this.dtstart = ICAL.helpers.formatClassType(options.dtstart, ICAL.Time);
if (!this.dtstart) {
throw new E... | javascript | {
"resource": ""
} | |
q24368 | icalrecur_iterator_next | train | function icalrecur_iterator_next() {
var before = (this.last ? this.last.clone() : null);
if ((this.rule.count && this.occurrence_number >= this.rule.count) ||
(this.rule.until && this.last.compare(this.rule.until) > 0)) {
//XXX: right now this is just a flag and has no impact
//... | javascript | {
"resource": ""
} |
q24369 | check_set_position | train | function check_set_position(aPos) {
if (this.has_by_data('BYSETPOS')) {
var idx = this.by_data.BYSETPOS.indexOf(aPos);
// negative numbers are not false-y
return idx !== -1;
}
return false;
} | javascript | {
"resource": ""
} |
q24370 | train | function() {
var result = Object.create(null);
result.initialized = this.initialized;
result.rule = this.rule.toJSON();
result.dtstart = this.dtstart.toJSON();
result.by_data = this.by_data;
result.days = this.days;
result.last = this.last.toJSON();
result.by_indices = t... | javascript | {
"resource": ""
} | |
q24371 | train | function() {
var iter;
var ruleOfDay;
var next;
var compare;
var maxTries = 500;
var currentTry = 0;
while (true) {
if (currentTry++ > maxTries) {
throw new Error(
'max tries have occured, rule may be impossible to forfill.'
);
... | javascript | {
"resource": ""
} | |
q24372 | train | function() {
function toJSON(item) {
return item.toJSON();
}
var result = Object.create(null);
result.ruleIterators = this.ruleIterators.map(toJSON);
if (this.ruleDates) {
result.ruleDates = this.ruleDates.map(toJSON);
}
if (this.exDates) {
result.exD... | javascript | {
"resource": ""
} | |
q24373 | train | function(component, propertyName) {
function handleProp(prop) {
idx = ICAL.helpers.binsearchInsert(
result,
prop,
compareTime
);
// ordered insert
result.splice(idx, 0, prop);
}
var result = [];
var props = component.getAllPropertie... | javascript | {
"resource": ""
} | |
q24374 | train | function(component) {
this.ruleIterators = [];
this.last = this.dtstart.clone();
// to provide api consistency non-recurring
// events can also use the iterator though it will
// only return a single time.
if (!isRecurringComponent(component)) {
this.ruleDate = this.last.cl... | javascript | {
"resource": ""
} | |
q24375 | train | function() {
var iters = this.ruleIterators;
if (iters.length === 0) {
return null;
}
var len = iters.length;
var iter;
var iterTime;
var iterIdx = 0;
var chosenIter;
// loop through each iterator
for (; iterIdx < len; iterIdx++) {
iter = it... | javascript | {
"resource": ""
} | |
q24376 | train | function(obj) {
if (this.isRecurrenceException()) {
throw new Error('cannot relate exception to exceptions');
}
if (obj instanceof ICAL.Component) {
obj = new ICAL.Event(obj);
}
if (this.strictExceptions && obj.uid !== this.uid) {
throw new Error('attempted to rel... | javascript | {
"resource": ""
} | |
q24377 | train | function(time) {
if (!this.rangeExceptions.length) {
return null;
}
var utc = time.toUnixTime();
var idx = ICAL.helpers.binsearchInsert(
this.rangeExceptions,
[utc],
compareRangeException
);
idx -= 1;
// occurs before
if (idx < 0) {
... | javascript | {
"resource": ""
} | |
q24378 | train | function() {
var rules = this.component.getAllProperties('rrule');
var i = 0;
var len = rules.length;
var result = Object.create(null);
for (; i < len; i++) {
var value = rules[i].getFirstValue();
result[value.freq] = true;
}
return result;
} | javascript | {
"resource": ""
} | |
q24379 | train | function(ical) {
//TODO: this is sync now in the future we will have a incremental parser.
if (typeof(ical) === 'string') {
ical = ICAL.parse(ical);
}
if (!(ical instanceof ICAL.Component)) {
ical = new ICAL.Component(ical);
}
var components = ical.getAllSubcomponen... | javascript | {
"resource": ""
} | |
q24380 | deployMQTrigger | train | function deployMQTrigger(mqType, name, namespace, topic, options) {
const opts = _.defaults({}, options, {
log: console.log,
});
const trigger = {
apiVersion: 'kubeless.io/v1beta1',
kind: `${mqType}Trigger`,
metadata: {
name: _.kebabCase(`${name}-${topic}`),
namespace,
labels: {
... | javascript | {
"resource": ""
} |
q24381 | handleMQTDeployment | train | function handleMQTDeployment(trigger, name, namespace, options) {
let mqTrigger = trigger;
// If only a string is passed, expect it to be the subject
if (typeof mqTrigger === 'string') {
// Defaults to Kafka
mqTrigger = {
queue: 'kafka',
topic: mqTrigger,
};
} else {
// Otherwise exp... | javascript | {
"resource": ""
} |
q24382 | train | function (elements) {
elements.forEach(function(element) {
document.getElementById(element).innerHTML = ''
document.getElementById(element).value = ''
})
} | javascript | {
"resource": ""
} | |
q24383 | train | function (newTokens, oldTokens) {
var i;
var token;
var replacedTokens = {};
var removedTokens = subtractAsSets(oldTokens, newTokens);
for (i = 0; i < removedTokens.length; i++) {
var removedToken... | javascript | {
"resource": ""
} | |
q24384 | train | function (data) {
// convert {0: "Jan", 1: "Feb", ...} to ["Jan", "Feb", ...]
return (Object.keys(data) || []).reduce(
function (rslt, el) {
rslt.push(data[el]);
return rslt;
... | javascript | {
"resource": ""
} | |
q24385 | createButtonClassName | train | function createButtonClassName(props) {
return createClassName(
props.noDefaultClassName ? null : 'button',
props.className,
props.size,
props.color,
{
'hollow': props.isHollow,
'clear': props.isClear,
'expanded': props.isExpanded,
'disabled': props.isDisabled,
'dropd... | javascript | {
"resource": ""
} |
q24386 | FeedMessage | train | function FeedMessage(properties) {
this.entity = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | {
"resource": ""
} |
q24387 | FeedHeader | train | function FeedHeader(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | {
"resource": ""
} |
q24388 | FeedEntity | train | function FeedEntity(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | {
"resource": ""
} |
q24389 | TripUpdate | train | function TripUpdate(properties) {
this.stopTimeUpdate = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | {
"resource": ""
} |
q24390 | StopTimeEvent | train | function StopTimeEvent(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | {
"resource": ""
} |
q24391 | StopTimeUpdate | train | function StopTimeUpdate(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | {
"resource": ""
} |
q24392 | VehiclePosition | train | function VehiclePosition(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | {
"resource": ""
} |
q24393 | Alert | train | function Alert(properties) {
this.activePeriod = [];
this.informedEntity = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties... | javascript | {
"resource": ""
} |
q24394 | TimeRange | train | function TimeRange(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | {
"resource": ""
} |
q24395 | Position | train | function Position(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | {
"resource": ""
} |
q24396 | TripDescriptor | train | function TripDescriptor(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | {
"resource": ""
} |
q24397 | VehicleDescriptor | train | function VehicleDescriptor(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | {
"resource": ""
} |
q24398 | EntitySelector | train | function EntitySelector(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | {
"resource": ""
} |
q24399 | TranslatedString | train | function TranslatedString(properties) {
this.translation = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.