id int32 0 58k | repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 |
|---|---|---|---|---|---|---|---|---|---|---|---|
39,500 | alexcjohnson/world-calendars | jquery-src/jquery.calendars.picker.js | function(event) {
var inst = plugin._getInst((event.data && event.data.elem) || event.target);
if (!$.isEmptyObject(inst) && inst.options.constrainInput) {
var ch = String.fromCharCode(event.keyCode || event.charCode);
var allowedChars = plugin._allowedChars(inst);
return (event.metaKey || inst.ctrlKe... | javascript | function(event) {
var inst = plugin._getInst((event.data && event.data.elem) || event.target);
if (!$.isEmptyObject(inst) && inst.options.constrainInput) {
var ch = String.fromCharCode(event.keyCode || event.charCode);
var allowedChars = plugin._allowedChars(inst);
return (event.metaKey || inst.ctrlKe... | [
"function",
"(",
"event",
")",
"{",
"var",
"inst",
"=",
"plugin",
".",
"_getInst",
"(",
"(",
"event",
".",
"data",
"&&",
"event",
".",
"data",
".",
"elem",
")",
"||",
"event",
".",
"target",
")",
";",
"if",
"(",
"!",
"$",
".",
"isEmptyObject",
"(... | Filter keystrokes in the datepicker.
@memberof CalendarsPicker
@private
@param event {KeyEvent} The keystroke.
@return {boolean} <code>true</code> if allowed, <code>false</code> if not allowed. | [
"Filter",
"keystrokes",
"in",
"the",
"datepicker",
"."
] | 810693882512dec1b804456f8d435b962bd6cf31 | https://github.com/alexcjohnson/world-calendars/blob/810693882512dec1b804456f8d435b962bd6cf31/jquery-src/jquery.calendars.picker.js#L1085-L1094 | |
39,501 | alexcjohnson/world-calendars | jquery-src/jquery.calendars.picker.js | function(inst) {
var allowedChars = (inst.options.multiSelect ? inst.options.multiSeparator :
(inst.options.rangeSelect ? inst.options.rangeSeparator : ''));
var literal = false;
var hasNum = false;
var dateFormat = inst.get('dateFormat');
for (var i = 0; i < dateFormat.length; i++) {
var ch = da... | javascript | function(inst) {
var allowedChars = (inst.options.multiSelect ? inst.options.multiSeparator :
(inst.options.rangeSelect ? inst.options.rangeSeparator : ''));
var literal = false;
var hasNum = false;
var dateFormat = inst.get('dateFormat');
for (var i = 0; i < dateFormat.length; i++) {
var ch = da... | [
"function",
"(",
"inst",
")",
"{",
"var",
"allowedChars",
"=",
"(",
"inst",
".",
"options",
".",
"multiSelect",
"?",
"inst",
".",
"options",
".",
"multiSeparator",
":",
"(",
"inst",
".",
"options",
".",
"rangeSelect",
"?",
"inst",
".",
"options",
".",
... | Determine the set of characters allowed by the date format.
@memberof CalendarsPicker
@private
@param inst {object} The current instance settings.
@return {string} The set of allowed characters, or <code>null</code> if anything allowed. | [
"Determine",
"the",
"set",
"of",
"characters",
"allowed",
"by",
"the",
"date",
"format",
"."
] | 810693882512dec1b804456f8d435b962bd6cf31 | https://github.com/alexcjohnson/world-calendars/blob/810693882512dec1b804456f8d435b962bd6cf31/jquery-src/jquery.calendars.picker.js#L1101-L1141 | |
39,502 | alexcjohnson/world-calendars | jquery-src/jquery.calendars.picker.js | function(event) {
var elem = (event.data && event.data.elem) || event.target;
var inst = plugin._getInst(elem);
if (!$.isEmptyObject(inst) && !inst.ctrlKey && inst.lastVal !== inst.elem.val()) {
try {
var dates = plugin._extractDates(inst, inst.elem.val());
if (dates.length > 0) {
plugin.se... | javascript | function(event) {
var elem = (event.data && event.data.elem) || event.target;
var inst = plugin._getInst(elem);
if (!$.isEmptyObject(inst) && !inst.ctrlKey && inst.lastVal !== inst.elem.val()) {
try {
var dates = plugin._extractDates(inst, inst.elem.val());
if (dates.length > 0) {
plugin.se... | [
"function",
"(",
"event",
")",
"{",
"var",
"elem",
"=",
"(",
"event",
".",
"data",
"&&",
"event",
".",
"data",
".",
"elem",
")",
"||",
"event",
".",
"target",
";",
"var",
"inst",
"=",
"plugin",
".",
"_getInst",
"(",
"elem",
")",
";",
"if",
"(",
... | Synchronise datepicker with the field.
@memberof CalendarsPicker
@private
@param event {KeyEvent} The keystroke.
@return {boolean} <code>true</code> if allowed, <code>false</code> if not allowed. | [
"Synchronise",
"datepicker",
"with",
"the",
"field",
"."
] | 810693882512dec1b804456f8d435b962bd6cf31 | https://github.com/alexcjohnson/world-calendars/blob/810693882512dec1b804456f8d435b962bd6cf31/jquery-src/jquery.calendars.picker.js#L1148-L1163 | |
39,503 | alexcjohnson/world-calendars | jquery-src/jquery.calendars.picker.js | function(elem) {
var inst = this._getInst(elem);
if (!$.isEmptyObject(inst)) {
inst.selectedDates = [];
this.hide(elem);
var defaultDate = inst.get('defaultDate');
if (inst.options.selectDefaultDate && defaultDate) {
this.setDate(elem, (defaultDate || inst.options.calendar.today()).newDate())... | javascript | function(elem) {
var inst = this._getInst(elem);
if (!$.isEmptyObject(inst)) {
inst.selectedDates = [];
this.hide(elem);
var defaultDate = inst.get('defaultDate');
if (inst.options.selectDefaultDate && defaultDate) {
this.setDate(elem, (defaultDate || inst.options.calendar.today()).newDate())... | [
"function",
"(",
"elem",
")",
"{",
"var",
"inst",
"=",
"this",
".",
"_getInst",
"(",
"elem",
")",
";",
"if",
"(",
"!",
"$",
".",
"isEmptyObject",
"(",
"inst",
")",
")",
"{",
"inst",
".",
"selectedDates",
"=",
"[",
"]",
";",
"this",
".",
"hide",
... | Clear an input and close a popup datepicker.
@memberof CalendarsPicker
@param elem {Element} The control to use.
@example $(selector).datepick('clear') | [
"Clear",
"an",
"input",
"and",
"close",
"a",
"popup",
"datepicker",
"."
] | 810693882512dec1b804456f8d435b962bd6cf31 | https://github.com/alexcjohnson/world-calendars/blob/810693882512dec1b804456f8d435b962bd6cf31/jquery-src/jquery.calendars.picker.js#L1188-L1201 | |
39,504 | alexcjohnson/world-calendars | jquery-src/jquery.calendars.picker.js | function(elem, date) {
var inst = this._getInst(elem);
if ($.isEmptyObject(inst)) {
return false;
}
date = inst.options.calendar.determineDate(date,
inst.selectedDates[0] || inst.options.calendar.today(), null,
inst.options.dateFormat, inst.getConfig());
return this._isSelectable(elem, date, ... | javascript | function(elem, date) {
var inst = this._getInst(elem);
if ($.isEmptyObject(inst)) {
return false;
}
date = inst.options.calendar.determineDate(date,
inst.selectedDates[0] || inst.options.calendar.today(), null,
inst.options.dateFormat, inst.getConfig());
return this._isSelectable(elem, date, ... | [
"function",
"(",
"elem",
",",
"date",
")",
"{",
"var",
"inst",
"=",
"this",
".",
"_getInst",
"(",
"elem",
")",
";",
"if",
"(",
"$",
".",
"isEmptyObject",
"(",
"inst",
")",
")",
"{",
"return",
"false",
";",
"}",
"date",
"=",
"inst",
".",
"options"... | Determine whether a date is selectable for this datepicker.
@memberof CalendarsPicker
@private
@param elem {Element} The control to check.
@param date {CDate|string|number} The date to check.
@return {boolean} <code>true</code> if selectable, <code>false</code> if not.
@example var selectable = $(selector).datepick('is... | [
"Determine",
"whether",
"a",
"date",
"is",
"selectable",
"for",
"this",
"datepicker",
"."
] | 810693882512dec1b804456f8d435b962bd6cf31 | https://github.com/alexcjohnson/world-calendars/blob/810693882512dec1b804456f8d435b962bd6cf31/jquery-src/jquery.calendars.picker.js#L1283-L1293 | |
39,505 | alexcjohnson/world-calendars | jquery-src/jquery.calendars.picker.js | function(elem, date, onDate, minDate, maxDate) {
var dateInfo = (typeof onDate === 'boolean' ? {selectable: onDate} :
(!$.isFunction(onDate) ? {} : onDate.apply(elem, [date, true])));
return (dateInfo.selectable !== false) &&
(!minDate || date.toJD() >= minDate.toJD()) && (!maxDate || date.toJD() <= maxDa... | javascript | function(elem, date, onDate, minDate, maxDate) {
var dateInfo = (typeof onDate === 'boolean' ? {selectable: onDate} :
(!$.isFunction(onDate) ? {} : onDate.apply(elem, [date, true])));
return (dateInfo.selectable !== false) &&
(!minDate || date.toJD() >= minDate.toJD()) && (!maxDate || date.toJD() <= maxDa... | [
"function",
"(",
"elem",
",",
"date",
",",
"onDate",
",",
"minDate",
",",
"maxDate",
")",
"{",
"var",
"dateInfo",
"=",
"(",
"typeof",
"onDate",
"===",
"'boolean'",
"?",
"{",
"selectable",
":",
"onDate",
"}",
":",
"(",
"!",
"$",
".",
"isFunction",
"("... | Internally determine whether a date is selectable for this datepicker.
@memberof CalendarsPicker
@private
@param elem {Element} the control to check.
@param date {CDate} The date to check.
@param onDate {function|boolean} Any <code>onDate</code> callback or <code>callback.selectable</code>.
@param minDate {CDate} The m... | [
"Internally",
"determine",
"whether",
"a",
"date",
"is",
"selectable",
"for",
"this",
"datepicker",
"."
] | 810693882512dec1b804456f8d435b962bd6cf31 | https://github.com/alexcjohnson/world-calendars/blob/810693882512dec1b804456f8d435b962bd6cf31/jquery-src/jquery.calendars.picker.js#L1304-L1309 | |
39,506 | alexcjohnson/world-calendars | jquery-src/jquery.calendars.picker.js | function(elem, action) {
var inst = this._getInst(elem);
if (!$.isEmptyObject(inst) && !this.isDisabled(elem)) {
var commands = inst.options.commands;
if (commands[action] && commands[action].enabled.apply(elem, [inst])) {
commands[action].action.apply(elem, [inst]);
}
}
} | javascript | function(elem, action) {
var inst = this._getInst(elem);
if (!$.isEmptyObject(inst) && !this.isDisabled(elem)) {
var commands = inst.options.commands;
if (commands[action] && commands[action].enabled.apply(elem, [inst])) {
commands[action].action.apply(elem, [inst]);
}
}
} | [
"function",
"(",
"elem",
",",
"action",
")",
"{",
"var",
"inst",
"=",
"this",
".",
"_getInst",
"(",
"elem",
")",
";",
"if",
"(",
"!",
"$",
".",
"isEmptyObject",
"(",
"inst",
")",
"&&",
"!",
"this",
".",
"isDisabled",
"(",
"elem",
")",
")",
"{",
... | Perform a named action for a datepicker.
@memberof CalendarsPicker
@param elem {element} The control to affect.
@param action {string} The name of the action. | [
"Perform",
"a",
"named",
"action",
"for",
"a",
"datepicker",
"."
] | 810693882512dec1b804456f8d435b962bd6cf31 | https://github.com/alexcjohnson/world-calendars/blob/810693882512dec1b804456f8d435b962bd6cf31/jquery-src/jquery.calendars.picker.js#L1315-L1323 | |
39,507 | alexcjohnson/world-calendars | jquery-src/jquery.calendars.picker.js | function(elem, year, month, day) {
var inst = this._getInst(elem);
if (!$.isEmptyObject(inst) && (day != null ||
(inst.drawDate.year() !== year || inst.drawDate.month() !== month))) {
inst.prevDate = inst.drawDate.newDate();
var calendar = inst.options.calendar;
var show = this._checkMinMax((year... | javascript | function(elem, year, month, day) {
var inst = this._getInst(elem);
if (!$.isEmptyObject(inst) && (day != null ||
(inst.drawDate.year() !== year || inst.drawDate.month() !== month))) {
inst.prevDate = inst.drawDate.newDate();
var calendar = inst.options.calendar;
var show = this._checkMinMax((year... | [
"function",
"(",
"elem",
",",
"year",
",",
"month",
",",
"day",
")",
"{",
"var",
"inst",
"=",
"this",
".",
"_getInst",
"(",
"elem",
")",
";",
"if",
"(",
"!",
"$",
".",
"isEmptyObject",
"(",
"inst",
")",
"&&",
"(",
"day",
"!=",
"null",
"||",
"("... | Set the currently shown month, defaulting to today's.
@memberof CalendarsPicker
@param elem {Element} The control to affect.
@param [year] {number} The year to show.
@param [month] {number} The month to show (1-12).
@param [day] {number} The day to show.
@example $(selector).datepick('showMonth', 2014, 12, 25) | [
"Set",
"the",
"currently",
"shown",
"month",
"defaulting",
"to",
"today",
"s",
"."
] | 810693882512dec1b804456f8d435b962bd6cf31 | https://github.com/alexcjohnson/world-calendars/blob/810693882512dec1b804456f8d435b962bd6cf31/jquery-src/jquery.calendars.picker.js#L1332-L1345 | |
39,508 | alexcjohnson/world-calendars | jquery-src/jquery.calendars.picker.js | function(elem, offset) {
var inst = this._getInst(elem);
if (!$.isEmptyObject(inst)) {
var date = inst.drawDate.newDate().add(offset, 'm');
this.showMonth(elem, date.year(), date.month());
}
} | javascript | function(elem, offset) {
var inst = this._getInst(elem);
if (!$.isEmptyObject(inst)) {
var date = inst.drawDate.newDate().add(offset, 'm');
this.showMonth(elem, date.year(), date.month());
}
} | [
"function",
"(",
"elem",
",",
"offset",
")",
"{",
"var",
"inst",
"=",
"this",
".",
"_getInst",
"(",
"elem",
")",
";",
"if",
"(",
"!",
"$",
".",
"isEmptyObject",
"(",
"inst",
")",
")",
"{",
"var",
"date",
"=",
"inst",
".",
"drawDate",
".",
"newDat... | Adjust the currently shown month.
@memberof CalendarsPicker
@param elem {Element} The control to affect.
@param offset {number} The number of months to change by.
@example $(selector).datepick('changeMonth', 2) | [
"Adjust",
"the",
"currently",
"shown",
"month",
"."
] | 810693882512dec1b804456f8d435b962bd6cf31 | https://github.com/alexcjohnson/world-calendars/blob/810693882512dec1b804456f8d435b962bd6cf31/jquery-src/jquery.calendars.picker.js#L1352-L1358 | |
39,509 | alexcjohnson/world-calendars | jquery-src/jquery.calendars.picker.js | function(elem, target) {
var inst = this._getInst(elem);
return ($.isEmptyObject(inst) ? null : inst.options.calendar.fromJD(
parseFloat(target.className.replace(/^.*jd(\d+\.5).*$/, '$1'))));
} | javascript | function(elem, target) {
var inst = this._getInst(elem);
return ($.isEmptyObject(inst) ? null : inst.options.calendar.fromJD(
parseFloat(target.className.replace(/^.*jd(\d+\.5).*$/, '$1'))));
} | [
"function",
"(",
"elem",
",",
"target",
")",
"{",
"var",
"inst",
"=",
"this",
".",
"_getInst",
"(",
"elem",
")",
";",
"return",
"(",
"$",
".",
"isEmptyObject",
"(",
"inst",
")",
"?",
"null",
":",
"inst",
".",
"options",
".",
"calendar",
".",
"fromJ... | Retrieve the date associated with an entry in the datepicker.
@memberof CalendarsPicker
@param elem {Element} The control to examine.
@param target {Element} The selected datepicker element.
@return {CDate} The corresponding date, or <code>null</code>.
@example var date = $(selector).datepick('retrieveDate', $('div.dat... | [
"Retrieve",
"the",
"date",
"associated",
"with",
"an",
"entry",
"in",
"the",
"datepicker",
"."
] | 810693882512dec1b804456f8d435b962bd6cf31 | https://github.com/alexcjohnson/world-calendars/blob/810693882512dec1b804456f8d435b962bd6cf31/jquery-src/jquery.calendars.picker.js#L1392-L1396 | |
39,510 | alexcjohnson/world-calendars | jquery-src/jquery.calendars.picker.js | function(elem, target) {
var inst = this._getInst(elem);
if (!$.isEmptyObject(inst) && !this.isDisabled(elem)) {
var date = this.retrieveDate(elem, target);
if (inst.options.multiSelect) {
var found = false;
for (var i = 0; i < inst.selectedDates.length; i++) {
if (date.compareTo(inst.sele... | javascript | function(elem, target) {
var inst = this._getInst(elem);
if (!$.isEmptyObject(inst) && !this.isDisabled(elem)) {
var date = this.retrieveDate(elem, target);
if (inst.options.multiSelect) {
var found = false;
for (var i = 0; i < inst.selectedDates.length; i++) {
if (date.compareTo(inst.sele... | [
"function",
"(",
"elem",
",",
"target",
")",
"{",
"var",
"inst",
"=",
"this",
".",
"_getInst",
"(",
"elem",
")",
";",
"if",
"(",
"!",
"$",
".",
"isEmptyObject",
"(",
"inst",
")",
"&&",
"!",
"this",
".",
"isDisabled",
"(",
"elem",
")",
")",
"{",
... | Select a date for this datepicker.
@memberof CalendarsPicker
@param elem {Element} The control to examine.
@param target {Element} The selected datepicker element.
@example $(selector).datepick('selectDate', $('div.datepick-popup a:contains(10)')[0]) | [
"Select",
"a",
"date",
"for",
"this",
"datepicker",
"."
] | 810693882512dec1b804456f8d435b962bd6cf31 | https://github.com/alexcjohnson/world-calendars/blob/810693882512dec1b804456f8d435b962bd6cf31/jquery-src/jquery.calendars.picker.js#L1403-L1442 | |
39,511 | alexcjohnson/world-calendars | jquery-src/jquery.calendars.picker.js | function(value) {
return (inst.options.localNumbers && calendar.local.digits ? calendar.local.digits(value) : value);
} | javascript | function(value) {
return (inst.options.localNumbers && calendar.local.digits ? calendar.local.digits(value) : value);
} | [
"function",
"(",
"value",
")",
"{",
"return",
"(",
"inst",
".",
"options",
".",
"localNumbers",
"&&",
"calendar",
".",
"local",
".",
"digits",
"?",
"calendar",
".",
"local",
".",
"digits",
"(",
"value",
")",
":",
"value",
")",
";",
"}"
] | Localise numbers if requested and available | [
"Localise",
"numbers",
"if",
"requested",
"and",
"available"
] | 810693882512dec1b804456f8d435b962bd6cf31 | https://github.com/alexcjohnson/world-calendars/blob/810693882512dec1b804456f8d435b962bd6cf31/jquery-src/jquery.calendars.picker.js#L1609-L1611 | |
39,512 | alexcjohnson/world-calendars | jquery-src/jquery.calendars.picker.js | function(inst, calendar, renderer) {
var firstDay = inst.options.firstDay;
firstDay = (firstDay == null ? calendar.local.firstDay : firstDay);
var header = '';
for (var day = 0; day < calendar.daysInWeek(); day++) {
var dow = (day + firstDay) % calendar.daysInWeek();
header += this._prepare(renderer... | javascript | function(inst, calendar, renderer) {
var firstDay = inst.options.firstDay;
firstDay = (firstDay == null ? calendar.local.firstDay : firstDay);
var header = '';
for (var day = 0; day < calendar.daysInWeek(); day++) {
var dow = (day + firstDay) % calendar.daysInWeek();
header += this._prepare(renderer... | [
"function",
"(",
"inst",
",",
"calendar",
",",
"renderer",
")",
"{",
"var",
"firstDay",
"=",
"inst",
".",
"options",
".",
"firstDay",
";",
"firstDay",
"=",
"(",
"firstDay",
"==",
"null",
"?",
"calendar",
".",
"local",
".",
"firstDay",
":",
"firstDay",
... | Generate the HTML for the day headers.
@memberof CalendarsPicker
@private
@param inst {object} The current instance settings.
@param calendar {BaseCalendar} The current calendar.
@param renderer {object} The rendering templates.
@return {string} A week's worth of day headers. | [
"Generate",
"the",
"HTML",
"for",
"the",
"day",
"headers",
"."
] | 810693882512dec1b804456f8d435b962bd6cf31 | https://github.com/alexcjohnson/world-calendars/blob/810693882512dec1b804456f8d435b962bd6cf31/jquery-src/jquery.calendars.picker.js#L1681-L1692 | |
39,513 | alexcjohnson/world-calendars | jquery-src/jquery.calendars.hebrew.js | function(year, month, day) {
var date = this._validate(year, month, day, $.calendars.local.invalidDate);
return {yearType: (this.leapYear(date) ? 'embolismic' : 'common') + ' ' +
['deficient', 'regular', 'complete'][this.daysInYear(date) % 10 - 3]};
} | javascript | function(year, month, day) {
var date = this._validate(year, month, day, $.calendars.local.invalidDate);
return {yearType: (this.leapYear(date) ? 'embolismic' : 'common') + ' ' +
['deficient', 'regular', 'complete'][this.daysInYear(date) % 10 - 3]};
} | [
"function",
"(",
"year",
",",
"month",
",",
"day",
")",
"{",
"var",
"date",
"=",
"this",
".",
"_validate",
"(",
"year",
",",
"month",
",",
"day",
",",
"$",
".",
"calendars",
".",
"local",
".",
"invalidDate",
")",
";",
"return",
"{",
"yearType",
":"... | Retrieve additional information about a date - year type.
@memberof HebrewCalendar
@param year {CDate|number} The date to examine or the year to examine.
@param [month] {number} The month to examine.
@param [day] {number} The day to examine.
@return {object} Additional information - contents depends on calendar.
@throw... | [
"Retrieve",
"additional",
"information",
"about",
"a",
"date",
"-",
"year",
"type",
"."
] | 810693882512dec1b804456f8d435b962bd6cf31 | https://github.com/alexcjohnson/world-calendars/blob/810693882512dec1b804456f8d435b962bd6cf31/jquery-src/jquery.calendars.hebrew.js#L167-L171 | |
39,514 | alexcjohnson/world-calendars | jquery-src/jquery.calendars.hebrew.js | function(year) {
var months = Math.floor((235 * year - 234) / 19);
var parts = 12084 + 13753 * months;
var day = months * 29 + Math.floor(parts / 25920);
if (mod(3 * (day + 1), 7) < 3) {
day++;
}
return day;
} | javascript | function(year) {
var months = Math.floor((235 * year - 234) / 19);
var parts = 12084 + 13753 * months;
var day = months * 29 + Math.floor(parts / 25920);
if (mod(3 * (day + 1), 7) < 3) {
day++;
}
return day;
} | [
"function",
"(",
"year",
")",
"{",
"var",
"months",
"=",
"Math",
".",
"floor",
"(",
"(",
"235",
"*",
"year",
"-",
"234",
")",
"/",
"19",
")",
";",
"var",
"parts",
"=",
"12084",
"+",
"13753",
"*",
"months",
";",
"var",
"day",
"=",
"months",
"*",... | Test for delay of start of new year and to avoid
Sunday, Wednesday, or Friday as start of the new year.
@memberof HebrewCalendar
@private
@param year {number} The year to examine.
@return {number} The days to offset by. | [
"Test",
"for",
"delay",
"of",
"start",
"of",
"new",
"year",
"and",
"to",
"avoid",
"Sunday",
"Wednesday",
"or",
"Friday",
"as",
"start",
"of",
"the",
"new",
"year",
"."
] | 810693882512dec1b804456f8d435b962bd6cf31 | https://github.com/alexcjohnson/world-calendars/blob/810693882512dec1b804456f8d435b962bd6cf31/jquery-src/jquery.calendars.hebrew.js#L211-L219 | |
39,515 | alexcjohnson/world-calendars | jquery-src/jquery.calendars.hebrew.js | function(year) {
var last = this._delay1(year - 1);
var present = this._delay1(year);
var next = this._delay1(year + 1);
return ((next - present) === 356 ? 2 : ((present - last) === 382 ? 1 : 0));
} | javascript | function(year) {
var last = this._delay1(year - 1);
var present = this._delay1(year);
var next = this._delay1(year + 1);
return ((next - present) === 356 ? 2 : ((present - last) === 382 ? 1 : 0));
} | [
"function",
"(",
"year",
")",
"{",
"var",
"last",
"=",
"this",
".",
"_delay1",
"(",
"year",
"-",
"1",
")",
";",
"var",
"present",
"=",
"this",
".",
"_delay1",
"(",
"year",
")",
";",
"var",
"next",
"=",
"this",
".",
"_delay1",
"(",
"year",
"+",
... | Check for delay in start of new year due to length of adjacent years.
@memberof HebrewCalendar
@private
@param year {number} The year to examine.
@return {number} The days to offset by. | [
"Check",
"for",
"delay",
"in",
"start",
"of",
"new",
"year",
"due",
"to",
"length",
"of",
"adjacent",
"years",
"."
] | 810693882512dec1b804456f8d435b962bd6cf31 | https://github.com/alexcjohnson/world-calendars/blob/810693882512dec1b804456f8d435b962bd6cf31/jquery-src/jquery.calendars.hebrew.js#L226-L231 | |
39,516 | biancojs/events | index.next.js | manageEvents | function manageEvents(els, evList, cb, method, options) {
els = domToArray(els)
split(evList).forEach((e) => {
els.forEach(el => el[method](e, cb, options || false))
})
} | javascript | function manageEvents(els, evList, cb, method, options) {
els = domToArray(els)
split(evList).forEach((e) => {
els.forEach(el => el[method](e, cb, options || false))
})
} | [
"function",
"manageEvents",
"(",
"els",
",",
"evList",
",",
"cb",
",",
"method",
",",
"options",
")",
"{",
"els",
"=",
"domToArray",
"(",
"els",
")",
"split",
"(",
"evList",
")",
".",
"forEach",
"(",
"(",
"e",
")",
"=>",
"{",
"els",
".",
"forEach",... | Set a listener for all the events received separated by spaces
@param { HTMLElement|NodeList|Array } els - DOM node/s where the listeners will be bound
@param { string } evList - list of events we want to bind or unbind space separated
@param { Function } cb - liste... | [
"Set",
"a",
"listener",
"for",
"all",
"the",
"events",
"received",
"separated",
"by",
"spaces"
] | 5f7f23932676b4349102dc41fff565a727cd97dc | https://github.com/biancojs/events/blob/5f7f23932676b4349102dc41fff565a727cd97dc/index.next.js#L21-L27 |
39,517 | seattleacademy/mcp9808 | index.js | WriteData | function WriteData(Register, ByteArray, Callback)
{
i2cdevice.writeBytes(Register, ByteArray, function(err)
{
Callback(err);
});
} | javascript | function WriteData(Register, ByteArray, Callback)
{
i2cdevice.writeBytes(Register, ByteArray, function(err)
{
Callback(err);
});
} | [
"function",
"WriteData",
"(",
"Register",
",",
"ByteArray",
",",
"Callback",
")",
"{",
"i2cdevice",
".",
"writeBytes",
"(",
"Register",
",",
"ByteArray",
",",
"function",
"(",
"err",
")",
"{",
"Callback",
"(",
"err",
")",
";",
"}",
")",
";",
"}"
] | sends the LSB first. The device wants the MSB first. | [
"sends",
"the",
"LSB",
"first",
".",
"The",
"device",
"wants",
"the",
"MSB",
"first",
"."
] | 211c07158e0585dfc3c2149b1e5e93d105d89723 | https://github.com/seattleacademy/mcp9808/blob/211c07158e0585dfc3c2149b1e5e93d105d89723/index.js#L69-L75 |
39,518 | mangojuicejs/mangojuice | packages/mangojuice-lazy/src/createLazyBlock.js | createLazyBlock | function createLazyBlock(
{ resolver, chunkName, initModel, loadingView, messages } = {}
) {
const resolveState = { resolver: null, block: null, msgs: [], chunkName };
resolveState.resolver = createBlockResolver(resolver, resolveState);
const lazyLogic = createLazyLogic(resolveState, initModel);
const lazyVie... | javascript | function createLazyBlock(
{ resolver, chunkName, initModel, loadingView, messages } = {}
) {
const resolveState = { resolver: null, block: null, msgs: [], chunkName };
resolveState.resolver = createBlockResolver(resolver, resolveState);
const lazyLogic = createLazyLogic(resolveState, initModel);
const lazyVie... | [
"function",
"createLazyBlock",
"(",
"{",
"resolver",
",",
"chunkName",
",",
"initModel",
",",
"loadingView",
",",
"messages",
"}",
"=",
"{",
"}",
")",
"{",
"const",
"resolveState",
"=",
"{",
"resolver",
":",
"null",
",",
"block",
":",
"null",
",",
"msgs"... | Creates a Block which works as a proxy for some other block,
which will be returned by `resolver` function provided in the
options object. `resolver` can also return a promise which should
resolve and actual block.
@param {function} options.resolver
@param {string} options.chunkName
@param {string} options.initMode... | [
"Creates",
"a",
"Block",
"which",
"works",
"as",
"a",
"proxy",
"for",
"some",
"other",
"block",
"which",
"will",
"be",
"returned",
"by",
"resolver",
"function",
"provided",
"in",
"the",
"options",
"object",
".",
"resolver",
"can",
"also",
"return",
"a",
"p... | 15bda5648462c171cc8e2dd0f8f15696655ce11a | https://github.com/mangojuicejs/mangojuice/blob/15bda5648462c171cc8e2dd0f8f15696655ce11a/packages/mangojuice-lazy/src/createLazyBlock.js#L129-L144 |
39,519 | landau/fscache | lib/cache.js | function(arg) {
var hash = crypto.createHash('md5')
.update(JSON.stringify(arg))
.digest('hex');
return path.join(this.dir, hash);
} | javascript | function(arg) {
var hash = crypto.createHash('md5')
.update(JSON.stringify(arg))
.digest('hex');
return path.join(this.dir, hash);
} | [
"function",
"(",
"arg",
")",
"{",
"var",
"hash",
"=",
"crypto",
".",
"createHash",
"(",
"'md5'",
")",
".",
"update",
"(",
"JSON",
".",
"stringify",
"(",
"arg",
")",
")",
".",
"digest",
"(",
"'hex'",
")",
";",
"return",
"path",
".",
"join",
"(",
"... | Creates a md5 hash based on the stringified arg | [
"Creates",
"a",
"md5",
"hash",
"based",
"on",
"the",
"stringified",
"arg"
] | 18d0127c06c4da6b2ac03701f8e136ee19ac722c | https://github.com/landau/fscache/blob/18d0127c06c4da6b2ac03701f8e136ee19ac722c/lib/cache.js#L24-L29 | |
39,520 | gusnips/koa-error-ejs | index.js | error | function error(opts) {
//define your custom views
opts = opts || {};
//custom views
if(!opts.custom)
opts.custom={};
// better to disable layout in not explicity set, in case there are error in it
if(!opts.layout)
opts.layout= false;
// @todo to be easier to install, should render from this module... | javascript | function error(opts) {
//define your custom views
opts = opts || {};
//custom views
if(!opts.custom)
opts.custom={};
// better to disable layout in not explicity set, in case there are error in it
if(!opts.layout)
opts.layout= false;
// @todo to be easier to install, should render from this module... | [
"function",
"error",
"(",
"opts",
")",
"{",
"//define your custom views",
"opts",
"=",
"opts",
"||",
"{",
"}",
";",
"//custom views",
"if",
"(",
"!",
"opts",
".",
"custom",
")",
"opts",
".",
"custom",
"=",
"{",
"}",
";",
"// better to disable layout in not e... | Error middleware for EJS.
@param {Object} opts
`custom` Object views for a status, for example:
{
404: 'error/not-found'
}
`view` String default error view. Defaults to {view.root}/error
`layout` String|Boolean layout to use on error view, or false if none. False by default. | [
"Error",
"middleware",
"for",
"EJS",
"."
] | 177ff9d13f0d95151961106f43d97ade0fa4e0aa | https://github.com/gusnips/koa-error-ejs/blob/177ff9d13f0d95151961106f43d97ade0fa4e0aa/index.js#L24-L92 |
39,521 | chrisJohn404/ljswitchboard-ljm_device_curator | lib/device_curator.js | function(addresses) {
var defered = q.defer();
var currentStep = 0;
var numSteps = addresses.length;
var results = [];
var handleReadSuccess = function(res) {
results.push({'address': addresses[currentStep], 'isErr': false, 'data': res});
if(currentStep < numSteps) {
currentStep += 1;
performRe... | javascript | function(addresses) {
var defered = q.defer();
var currentStep = 0;
var numSteps = addresses.length;
var results = [];
var handleReadSuccess = function(res) {
results.push({'address': addresses[currentStep], 'isErr': false, 'data': res});
if(currentStep < numSteps) {
currentStep += 1;
performRe... | [
"function",
"(",
"addresses",
")",
"{",
"var",
"defered",
"=",
"q",
".",
"defer",
"(",
")",
";",
"var",
"currentStep",
"=",
"0",
";",
"var",
"numSteps",
"=",
"addresses",
".",
"length",
";",
"var",
"results",
"=",
"[",
"]",
";",
"var",
"handleReadSuc... | An experimental implementation of the readMultiple function that doesn't use the async library. | [
"An",
"experimental",
"implementation",
"of",
"the",
"readMultiple",
"function",
"that",
"doesn",
"t",
"use",
"the",
"async",
"library",
"."
] | 36cb25645dfa0a68e906d5ec43e5514391947257 | https://github.com/chrisJohn404/ljswitchboard-ljm_device_curator/blob/36cb25645dfa0a68e906d5ec43e5514391947257/lib/device_curator.js#L1226-L1258 | |
39,522 | sorellabs/black | src/core.js | unpack | function unpack(kind, root, target, proto, source){
if (ownp(kind)) do_unpack(proto, source, methodize)
if (genericp(kind)) do_unpack(target, source)
if (utilsp(kind)) do_unpack(root, source.$black_utils)
} | javascript | function unpack(kind, root, target, proto, source){
if (ownp(kind)) do_unpack(proto, source, methodize)
if (genericp(kind)) do_unpack(target, source)
if (utilsp(kind)) do_unpack(root, source.$black_utils)
} | [
"function",
"unpack",
"(",
"kind",
",",
"root",
",",
"target",
",",
"proto",
",",
"source",
")",
"{",
"if",
"(",
"ownp",
"(",
"kind",
")",
")",
"do_unpack",
"(",
"proto",
",",
"source",
",",
"methodize",
")",
"if",
"(",
"genericp",
"(",
"kind",
")"... | Unpacks a black module so it's used in a sane way | [
"Unpacks",
"a",
"black",
"module",
"so",
"it",
"s",
"used",
"in",
"a",
"sane",
"way"
] | 713a5ac396c4b8d5d501f5370272c20713839fc1 | https://github.com/sorellabs/black/blob/713a5ac396c4b8d5d501f5370272c20713839fc1/src/core.js#L24-L28 |
39,523 | sorellabs/black | src/core.js | unpack_all | function unpack_all(kind, global) {
keys(this).forEach(function(module) {
module = this[module]
if (!fnp(module)) unpack( kind
, global || top
, module.$black_box
, module.$bla... | javascript | function unpack_all(kind, global) {
keys(this).forEach(function(module) {
module = this[module]
if (!fnp(module)) unpack( kind
, global || top
, module.$black_box
, module.$bla... | [
"function",
"unpack_all",
"(",
"kind",
",",
"global",
")",
"{",
"keys",
"(",
"this",
")",
".",
"forEach",
"(",
"function",
"(",
"module",
")",
"{",
"module",
"=",
"this",
"[",
"module",
"]",
"if",
"(",
"!",
"fnp",
"(",
"module",
")",
")",
"unpack",... | Unpacks all modules in black. Utils go in `target` or the global obj | [
"Unpacks",
"all",
"modules",
"in",
"black",
".",
"Utils",
"go",
"in",
"target",
"or",
"the",
"global",
"obj"
] | 713a5ac396c4b8d5d501f5370272c20713839fc1 | https://github.com/sorellabs/black/blob/713a5ac396c4b8d5d501f5370272c20713839fc1/src/core.js#L41-L49 |
39,524 | sorellabs/black | src/core.js | methodize | function methodize(fn) {
return function() { var args
args = slice.call(arguments)
return fn.apply(this, [this].concat(args)) }
} | javascript | function methodize(fn) {
return function() { var args
args = slice.call(arguments)
return fn.apply(this, [this].concat(args)) }
} | [
"function",
"methodize",
"(",
"fn",
")",
"{",
"return",
"function",
"(",
")",
"{",
"var",
"args",
"args",
"=",
"slice",
".",
"call",
"(",
"arguments",
")",
"return",
"fn",
".",
"apply",
"(",
"this",
",",
"[",
"this",
"]",
".",
"concat",
"(",
"args"... | Transforms a generic method into a SLOOOOOOOOOOOW instance method. | [
"Transforms",
"a",
"generic",
"method",
"into",
"a",
"SLOOOOOOOOOOOW",
"instance",
"method",
"."
] | 713a5ac396c4b8d5d501f5370272c20713839fc1 | https://github.com/sorellabs/black/blob/713a5ac396c4b8d5d501f5370272c20713839fc1/src/core.js#L52-L56 |
39,525 | chrisJohn404/ljswitchboard-ljm_device_curator | lib/manufacturing_info_operations.js | createReadManufacturingInfoBundle | function createReadManufacturingInfoBundle() {
debugRMIOps('in createReadManufacturingInfoBundle');
// Initialize the bundle object with some basic data.
var bundle = {
'info': {},
'infoString': '',
'manufacturingData': manufacturingData,
'isError': false,
'errorStep': '',
'error': undefined,... | javascript | function createReadManufacturingInfoBundle() {
debugRMIOps('in createReadManufacturingInfoBundle');
// Initialize the bundle object with some basic data.
var bundle = {
'info': {},
'infoString': '',
'manufacturingData': manufacturingData,
'isError': false,
'errorStep': '',
'error': undefined,... | [
"function",
"createReadManufacturingInfoBundle",
"(",
")",
"{",
"debugRMIOps",
"(",
"'in createReadManufacturingInfoBundle'",
")",
";",
"// Initialize the bundle object with some basic data.",
"var",
"bundle",
"=",
"{",
"'info'",
":",
"{",
"}",
",",
"'infoString'",
":",
"... | Define a function that is used to initialize the data object built up during the process of reading the manufacturing data from a T7. | [
"Define",
"a",
"function",
"that",
"is",
"used",
"to",
"initialize",
"the",
"data",
"object",
"built",
"up",
"during",
"the",
"process",
"of",
"reading",
"the",
"manufacturing",
"data",
"from",
"a",
"T7",
"."
] | 36cb25645dfa0a68e906d5ec43e5514391947257 | https://github.com/chrisJohn404/ljswitchboard-ljm_device_curator/blob/36cb25645dfa0a68e906d5ec43e5514391947257/lib/manufacturing_info_operations.js#L145-L172 |
39,526 | chrisJohn404/ljswitchboard-ljm_device_curator | lib/manufacturing_info_operations.js | readManufacturingInfoFlashData | function readManufacturingInfoFlashData(bundle) {
debugRMIOps('in readManufacturingInfoFlashData');
var defered = q.defer();
var startingAddress = 0x3C6000;
var numIntsToRead = 8*8;
self.readFlash(startingAddress, numIntsToRead)
.then(function(res) {
// res is an object with an attribute "results" that i... | javascript | function readManufacturingInfoFlashData(bundle) {
debugRMIOps('in readManufacturingInfoFlashData');
var defered = q.defer();
var startingAddress = 0x3C6000;
var numIntsToRead = 8*8;
self.readFlash(startingAddress, numIntsToRead)
.then(function(res) {
// res is an object with an attribute "results" that i... | [
"function",
"readManufacturingInfoFlashData",
"(",
"bundle",
")",
"{",
"debugRMIOps",
"(",
"'in readManufacturingInfoFlashData'",
")",
";",
"var",
"defered",
"=",
"q",
".",
"defer",
"(",
")",
";",
"var",
"startingAddress",
"=",
"0x3C6000",
";",
"var",
"numIntsToRe... | Read the manufacturing data from a T7. | [
"Read",
"the",
"manufacturing",
"data",
"from",
"a",
"T7",
"."
] | 36cb25645dfa0a68e906d5ec43e5514391947257 | https://github.com/chrisJohn404/ljswitchboard-ljm_device_curator/blob/36cb25645dfa0a68e906d5ec43e5514391947257/lib/manufacturing_info_operations.js#L175-L249 |
39,527 | dataminr/expanded-react-test-utils | lib/SelectorMatchers.js | function(element, rule){
var elementClassName = element.className,
elementID = element.id,
elementTagName = element.tagName,
elementDisplayName = element.constructor.displayName;
if(rule.tagName && !this.tagName(rule.tagName, elementTagName, elementDisplayName)){
... | javascript | function(element, rule){
var elementClassName = element.className,
elementID = element.id,
elementTagName = element.tagName,
elementDisplayName = element.constructor.displayName;
if(rule.tagName && !this.tagName(rule.tagName, elementTagName, elementDisplayName)){
... | [
"function",
"(",
"element",
",",
"rule",
")",
"{",
"var",
"elementClassName",
"=",
"element",
".",
"className",
",",
"elementID",
"=",
"element",
".",
"id",
",",
"elementTagName",
"=",
"element",
".",
"tagName",
",",
"elementDisplayName",
"=",
"element",
"."... | Given an array, reduces the items based on the provided parsed CSS pseudo selector.
@param {Object} element Element to test
@param {Object} rule Parsed pseudo CSS selector
@return {Array} Reduced matches based on selector processing | [
"Given",
"an",
"array",
"reduces",
"the",
"items",
"based",
"on",
"the",
"provided",
"parsed",
"CSS",
"pseudo",
"selector",
"."
] | cb23cd10cd29839401939561ee0081a49235b358 | https://github.com/dataminr/expanded-react-test-utils/blob/cb23cd10cd29839401939561ee0081a49235b358/lib/SelectorMatchers.js#L10-L34 | |
39,528 | dataminr/expanded-react-test-utils | lib/SelectorMatchers.js | function(pseudoRule, element, elementTagName){
if(pseudoRule.name === 'checked'){
return this.checked(element, elementTagName);
}
if(pseudoRule.name === 'empty'){
return this.empty(element);
}
} | javascript | function(pseudoRule, element, elementTagName){
if(pseudoRule.name === 'checked'){
return this.checked(element, elementTagName);
}
if(pseudoRule.name === 'empty'){
return this.empty(element);
}
} | [
"function",
"(",
"pseudoRule",
",",
"element",
",",
"elementTagName",
")",
"{",
"if",
"(",
"pseudoRule",
".",
"name",
"===",
"'checked'",
")",
"{",
"return",
"this",
".",
"checked",
"(",
"element",
",",
"elementTagName",
")",
";",
"}",
"if",
"(",
"pseudo... | Routes pseudo selector to proper handler
@param {Object} pseudoRule Parsed CSS pseudo rule
@param {Object} element Element to check against pseudo rule
@param {String} elementTagName Tag name of the element
@return {Bool} Whether element matches pseudo rule | [
"Routes",
"pseudo",
"selector",
"to",
"proper",
"handler"
] | cb23cd10cd29839401939561ee0081a49235b358 | https://github.com/dataminr/expanded-react-test-utils/blob/cb23cd10cd29839401939561ee0081a49235b358/lib/SelectorMatchers.js#L43-L50 | |
39,529 | dataminr/expanded-react-test-utils | lib/SelectorMatchers.js | function(attributeRules, element){
for(var i = 0; i < attributeRules.length; i++){
var attributeName = attributeRules[i].name,
objectToCheck = element;
if(typeof element.context === 'undefined'){
//Native DOM node
if(_.startsWith(attributeN... | javascript | function(attributeRules, element){
for(var i = 0; i < attributeRules.length; i++){
var attributeName = attributeRules[i].name,
objectToCheck = element;
if(typeof element.context === 'undefined'){
//Native DOM node
if(_.startsWith(attributeN... | [
"function",
"(",
"attributeRules",
",",
"element",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"attributeRules",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"attributeName",
"=",
"attributeRules",
"[",
"i",
"]",
".",
"name",
",",
... | Validates if the provided element matches the provided array of
attribute CSS selectors.
@param {Array} attributeRules Array of attribute rules to check
@param {Object} element Element to check
@return {Bool} Whether element matches all attribute rules | [
"Validates",
"if",
"the",
"provided",
"element",
"matches",
"the",
"provided",
"array",
"of",
"attribute",
"CSS",
"selectors",
"."
] | cb23cd10cd29839401939561ee0081a49235b358 | https://github.com/dataminr/expanded-react-test-utils/blob/cb23cd10cd29839401939561ee0081a49235b358/lib/SelectorMatchers.js#L59-L91 | |
39,530 | dataminr/expanded-react-test-utils | lib/SelectorMatchers.js | function(ruleClassName, elementClassName){
if(!elementClassName){
return false;
}
for(var i = 0; i < ruleClassName.length; i++){
if((' ' + elementClassName + ' ').indexOf(' ' + ruleClassName[i] + ' ') === -1){
return false;
}
}
... | javascript | function(ruleClassName, elementClassName){
if(!elementClassName){
return false;
}
for(var i = 0; i < ruleClassName.length; i++){
if((' ' + elementClassName + ' ').indexOf(' ' + ruleClassName[i] + ' ') === -1){
return false;
}
}
... | [
"function",
"(",
"ruleClassName",
",",
"elementClassName",
")",
"{",
"if",
"(",
"!",
"elementClassName",
")",
"{",
"return",
"false",
";",
"}",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"ruleClassName",
".",
"length",
";",
"i",
"++",
")",
"{",... | Checks if the element class names match the provided CSS selector names
@param {Array} ruleClassName Class name of CSS selector
@param {String} elementClassName Class name of element
@return {Bool} Whether element class names CSS selectors | [
"Checks",
"if",
"the",
"element",
"class",
"names",
"match",
"the",
"provided",
"CSS",
"selector",
"names"
] | cb23cd10cd29839401939561ee0081a49235b358 | https://github.com/dataminr/expanded-react-test-utils/blob/cb23cd10cd29839401939561ee0081a49235b358/lib/SelectorMatchers.js#L128-L138 | |
39,531 | dataminr/expanded-react-test-utils | lib/SelectorMatchers.js | function(element, tagName){
if(!tagName || tagName.toLowerCase() !== 'input'){
return false;
}
var inputType = element.type.toLowerCase();
if(inputType !== 'checkbox' && inputType !== 'radio'){
return false;
}
return element.checked !== false;
... | javascript | function(element, tagName){
if(!tagName || tagName.toLowerCase() !== 'input'){
return false;
}
var inputType = element.type.toLowerCase();
if(inputType !== 'checkbox' && inputType !== 'radio'){
return false;
}
return element.checked !== false;
... | [
"function",
"(",
"element",
",",
"tagName",
")",
"{",
"if",
"(",
"!",
"tagName",
"||",
"tagName",
".",
"toLowerCase",
"(",
")",
"!==",
"'input'",
")",
"{",
"return",
"false",
";",
"}",
"var",
"inputType",
"=",
"element",
".",
"type",
".",
"toLowerCase"... | Checks if the provided element is "checked". Only applies to inputs of type radio
and checkbox. Checks for both the checked property and defaultChecked property.
@param {Object} element Element to test
@param {String} tagName Tag name of the element
@return {Bool} Whether element is the correct input type a... | [
"Checks",
"if",
"the",
"provided",
"element",
"is",
"checked",
".",
"Only",
"applies",
"to",
"inputs",
"of",
"type",
"radio",
"and",
"checkbox",
".",
"Checks",
"for",
"both",
"the",
"checked",
"property",
"and",
"defaultChecked",
"property",
"."
] | cb23cd10cd29839401939561ee0081a49235b358 | https://github.com/dataminr/expanded-react-test-utils/blob/cb23cd10cd29839401939561ee0081a49235b358/lib/SelectorMatchers.js#L156-L167 | |
39,532 | dataminr/expanded-react-test-utils | lib/SelectorMatchers.js | function(property, operator, value){
if(operator === '='){
return this.compareElementPropertyEquality(property, value);
}
if(operator === '~='){
return String(property).split(" ").indexOf(value) !== -1;
}
if(operator === '^='){
return _.startsW... | javascript | function(property, operator, value){
if(operator === '='){
return this.compareElementPropertyEquality(property, value);
}
if(operator === '~='){
return String(property).split(" ").indexOf(value) !== -1;
}
if(operator === '^='){
return _.startsW... | [
"function",
"(",
"property",
",",
"operator",
",",
"value",
")",
"{",
"if",
"(",
"operator",
"===",
"'='",
")",
"{",
"return",
"this",
".",
"compareElementPropertyEquality",
"(",
"property",
",",
"value",
")",
";",
"}",
"if",
"(",
"operator",
"===",
"'~=... | Function to parse attribute CSS queries for the various types of comparitor functions supported
in attribute queries and then performs the specific comparison of property and value
@param {Mixed} property Value of component prop to compare against
@param {String} operator Comparison operator
@param {String} value ... | [
"Function",
"to",
"parse",
"attribute",
"CSS",
"queries",
"for",
"the",
"various",
"types",
"of",
"comparitor",
"functions",
"supported",
"in",
"attribute",
"queries",
"and",
"then",
"performs",
"the",
"specific",
"comparison",
"of",
"property",
"and",
"value"
] | cb23cd10cd29839401939561ee0081a49235b358 | https://github.com/dataminr/expanded-react-test-utils/blob/cb23cd10cd29839401939561ee0081a49235b358/lib/SelectorMatchers.js#L177-L194 | |
39,533 | dataminr/expanded-react-test-utils | lib/SelectorMatchers.js | function(property, value){
//When doing direct comparisons, do some conversions between numbers, booleans, null/undefined since
//the value in the selector always comes through as a string
if(_.isNumber(property)){
return property === parseInt(value);
}
else if(_.isBo... | javascript | function(property, value){
//When doing direct comparisons, do some conversions between numbers, booleans, null/undefined since
//the value in the selector always comes through as a string
if(_.isNumber(property)){
return property === parseInt(value);
}
else if(_.isBo... | [
"function",
"(",
"property",
",",
"value",
")",
"{",
"//When doing direct comparisons, do some conversions between numbers, booleans, null/undefined since",
"//the value in the selector always comes through as a string",
"if",
"(",
"_",
".",
"isNumber",
"(",
"property",
")",
")",
... | Does a equality comparison, handling for the fact that value is always a string. Supports casting
of values into numbers, booleans, and null.
@param {Mixed} property Element prop value to check
@param {String} value CSS selector value to compare
@return {Bool} Whether property and value match | [
"Does",
"a",
"equality",
"comparison",
"handling",
"for",
"the",
"fact",
"that",
"value",
"is",
"always",
"a",
"string",
".",
"Supports",
"casting",
"of",
"values",
"into",
"numbers",
"booleans",
"and",
"null",
"."
] | cb23cd10cd29839401939561ee0081a49235b358 | https://github.com/dataminr/expanded-react-test-utils/blob/cb23cd10cd29839401939561ee0081a49235b358/lib/SelectorMatchers.js#L203-L216 | |
39,534 | S3bb1/ah-dashboard-plugin | public/dashboard/bower_components/fancytree/dist/jquery.fancytree-all.js | isVersionAtLeast | function isVersionAtLeast(dottedVersion, major, minor, patch){
var i, v, t,
verParts = $.map($.trim(dottedVersion).split("."), function(e){ return parseInt(e, 10); }),
testParts = $.map(Array.prototype.slice.call(arguments, 1), function(e){ return parseInt(e, 10); });
for( i = 0; i < testParts.length; i++ ){
v... | javascript | function isVersionAtLeast(dottedVersion, major, minor, patch){
var i, v, t,
verParts = $.map($.trim(dottedVersion).split("."), function(e){ return parseInt(e, 10); }),
testParts = $.map(Array.prototype.slice.call(arguments, 1), function(e){ return parseInt(e, 10); });
for( i = 0; i < testParts.length; i++ ){
v... | [
"function",
"isVersionAtLeast",
"(",
"dottedVersion",
",",
"major",
",",
"minor",
",",
"patch",
")",
"{",
"var",
"i",
",",
"v",
",",
"t",
",",
"verParts",
"=",
"$",
".",
"map",
"(",
"$",
".",
"trim",
"(",
"dottedVersion",
")",
".",
"split",
"(",
"\... | Return true if dotted version string is equal or higher than requested version.
See http://jsfiddle.net/mar10/FjSAN/ | [
"Return",
"true",
"if",
"dotted",
"version",
"string",
"is",
"equal",
"or",
"higher",
"than",
"requested",
"version",
"."
] | c283370ec0f99a25db5bb7029a98b4febf8c5251 | https://github.com/S3bb1/ah-dashboard-plugin/blob/c283370ec0f99a25db5bb7029a98b4febf8c5251/public/dashboard/bower_components/fancytree/dist/jquery.fancytree-all.js#L73-L86 |
39,535 | S3bb1/ah-dashboard-plugin | public/dashboard/bower_components/fancytree/dist/jquery.fancytree-all.js | function(targetNode, mode, map) {
if(mode === undefined || mode === "over"){
mode = "child";
}
var pos,
prevParent = this.parent,
targetParent = (mode === "child") ? targetNode : targetNode.parent;
if(this === targetNode){
return;
}else if( !this.parent ){
throw "Cannot move system root";
}... | javascript | function(targetNode, mode, map) {
if(mode === undefined || mode === "over"){
mode = "child";
}
var pos,
prevParent = this.parent,
targetParent = (mode === "child") ? targetNode : targetNode.parent;
if(this === targetNode){
return;
}else if( !this.parent ){
throw "Cannot move system root";
}... | [
"function",
"(",
"targetNode",
",",
"mode",
",",
"map",
")",
"{",
"if",
"(",
"mode",
"===",
"undefined",
"||",
"mode",
"===",
"\"over\"",
")",
"{",
"mode",
"=",
"\"child\"",
";",
"}",
"var",
"pos",
",",
"prevParent",
"=",
"this",
".",
"parent",
",",
... | Move this node to targetNode.
@param {FancytreeNode} targetNode
@param {string} mode <pre>
'child': append this node as last child of targetNode.
This is the default. To be compatble with the D'n'd
hitMode, we also accept 'over'.
'before': add this node as sibling before targetNode.
'after': add this node as sibling af... | [
"Move",
"this",
"node",
"to",
"targetNode",
"."
] | c283370ec0f99a25db5bb7029a98b4febf8c5251 | https://github.com/S3bb1/ah-dashboard-plugin/blob/c283370ec0f99a25db5bb7029a98b4febf8c5251/public/dashboard/bower_components/fancytree/dist/jquery.fancytree-all.js#L1073-L1208 | |
39,536 | S3bb1/ah-dashboard-plugin | public/dashboard/bower_components/fancytree/dist/jquery.fancytree-all.js | function(stopOnParents) {
var nodeList = [];
this.rootNode.visit(function(node){
if( node.selected ) {
nodeList.push(node);
if( stopOnParents === true ){
return "skip"; // stop processing this branch
}
}
});
return nodeList;
} | javascript | function(stopOnParents) {
var nodeList = [];
this.rootNode.visit(function(node){
if( node.selected ) {
nodeList.push(node);
if( stopOnParents === true ){
return "skip"; // stop processing this branch
}
}
});
return nodeList;
} | [
"function",
"(",
"stopOnParents",
")",
"{",
"var",
"nodeList",
"=",
"[",
"]",
";",
"this",
".",
"rootNode",
".",
"visit",
"(",
"function",
"(",
"node",
")",
"{",
"if",
"(",
"node",
".",
"selected",
")",
"{",
"nodeList",
".",
"push",
"(",
"node",
")... | Return an array of selected nodes.
@param {boolean} [stopOnParents=false] only return the topmost selected
node (useful with selectMode 3)
@returns {FancytreeNode[]} | [
"Return",
"an",
"array",
"of",
"selected",
"nodes",
"."
] | c283370ec0f99a25db5bb7029a98b4febf8c5251 | https://github.com/S3bb1/ah-dashboard-plugin/blob/c283370ec0f99a25db5bb7029a98b4febf8c5251/public/dashboard/bower_components/fancytree/dist/jquery.fancytree-all.js#L2067-L2078 | |
39,537 | S3bb1/ah-dashboard-plugin | public/dashboard/bower_components/fancytree/dist/jquery.fancytree-all.js | function(setFocus) {
var node = this.activeNode;
if( node ) {
this.activeNode = null; // Force re-activating
node.setActive();
if( setFocus ){
node.setFocus();
}
}
} | javascript | function(setFocus) {
var node = this.activeNode;
if( node ) {
this.activeNode = null; // Force re-activating
node.setActive();
if( setFocus ){
node.setFocus();
}
}
} | [
"function",
"(",
"setFocus",
")",
"{",
"var",
"node",
"=",
"this",
".",
"activeNode",
";",
"if",
"(",
"node",
")",
"{",
"this",
".",
"activeNode",
"=",
"null",
";",
"// Force re-activating",
"node",
".",
"setActive",
"(",
")",
";",
"if",
"(",
"setFocus... | Re-fire beforeActivate and activate events. | [
"Re",
"-",
"fire",
"beforeActivate",
"and",
"activate",
"events",
"."
] | c283370ec0f99a25db5bb7029a98b4febf8c5251 | https://github.com/S3bb1/ah-dashboard-plugin/blob/c283370ec0f99a25db5bb7029a98b4febf8c5251/public/dashboard/bower_components/fancytree/dist/jquery.fancytree-all.js#L2195-L2204 | |
39,538 | S3bb1/ah-dashboard-plugin | public/dashboard/bower_components/fancytree/dist/jquery.fancytree-all.js | function(ctx) {
// TODO: return promise?
if( ctx.targetType === "title" && ctx.options.clickFolderMode === 4) {
// this.nodeSetFocus(ctx);
// this._callHook("nodeSetActive", ctx, true);
this._callHook("nodeToggleExpanded", ctx);
}
// TODO: prevent text selection on dblclicks
if( ctx.targetType === "tit... | javascript | function(ctx) {
// TODO: return promise?
if( ctx.targetType === "title" && ctx.options.clickFolderMode === 4) {
// this.nodeSetFocus(ctx);
// this._callHook("nodeSetActive", ctx, true);
this._callHook("nodeToggleExpanded", ctx);
}
// TODO: prevent text selection on dblclicks
if( ctx.targetType === "tit... | [
"function",
"(",
"ctx",
")",
"{",
"// TODO: return promise?",
"if",
"(",
"ctx",
".",
"targetType",
"===",
"\"title\"",
"&&",
"ctx",
".",
"options",
".",
"clickFolderMode",
"===",
"4",
")",
"{",
"//\t\t\tthis.nodeSetFocus(ctx);",
"//\t\t\tthis._callHook(\"nodeSetActive... | Default handling for mouse douleclick events.
@param {EventData} ctx | [
"Default",
"handling",
"for",
"mouse",
"douleclick",
"events",
"."
] | c283370ec0f99a25db5bb7029a98b4febf8c5251 | https://github.com/S3bb1/ah-dashboard-plugin/blob/c283370ec0f99a25db5bb7029a98b4febf8c5251/public/dashboard/bower_components/fancytree/dist/jquery.fancytree-all.js#L2375-L2386 | |
39,539 | S3bb1/ah-dashboard-plugin | public/dashboard/bower_components/fancytree/dist/jquery.fancytree-all.js | function(ctx) {
var node = ctx.node;
// FT.debug("nodeRemoveChildMarkup()", node.toString());
// TODO: Unlink attr.ftnode to support GC
if(node.ul){
if( node.isRoot() ) {
$(node.ul).empty();
} else {
$(node.ul).remove();
node.ul = null;
}
node.visit(function(n){
n.li = n.ul = null;
... | javascript | function(ctx) {
var node = ctx.node;
// FT.debug("nodeRemoveChildMarkup()", node.toString());
// TODO: Unlink attr.ftnode to support GC
if(node.ul){
if( node.isRoot() ) {
$(node.ul).empty();
} else {
$(node.ul).remove();
node.ul = null;
}
node.visit(function(n){
n.li = n.ul = null;
... | [
"function",
"(",
"ctx",
")",
"{",
"var",
"node",
"=",
"ctx",
".",
"node",
";",
"// FT.debug(\"nodeRemoveChildMarkup()\", node.toString());",
"// TODO: Unlink attr.ftnode to support GC",
"if",
"(",
"node",
".",
"ul",
")",
"{",
"if",
"(",
"node",
".",
"isRoot",
"(",... | Remove HTML markup for all descendents of ctx.node.
@param {EventData} ctx | [
"Remove",
"HTML",
"markup",
"for",
"all",
"descendents",
"of",
"ctx",
".",
"node",
"."
] | c283370ec0f99a25db5bb7029a98b4febf8c5251 | https://github.com/S3bb1/ah-dashboard-plugin/blob/c283370ec0f99a25db5bb7029a98b4febf8c5251/public/dashboard/bower_components/fancytree/dist/jquery.fancytree-all.js#L2628-L2644 | |
39,540 | S3bb1/ah-dashboard-plugin | public/dashboard/bower_components/fancytree/dist/jquery.fancytree-all.js | function(ctx, flag) {
// ctx.node.debug("nodeSetFocus(" + flag + ")");
var ctx2,
tree = ctx.tree,
node = ctx.node;
flag = (flag !== false);
// Blur previous node if any
if(tree.focusNode){
if(tree.focusNode === node && flag){
// node.debug("nodeSetFocus(" + flag + "): nothing to do");
retur... | javascript | function(ctx, flag) {
// ctx.node.debug("nodeSetFocus(" + flag + ")");
var ctx2,
tree = ctx.tree,
node = ctx.node;
flag = (flag !== false);
// Blur previous node if any
if(tree.focusNode){
if(tree.focusNode === node && flag){
// node.debug("nodeSetFocus(" + flag + "): nothing to do");
retur... | [
"function",
"(",
"ctx",
",",
"flag",
")",
"{",
"// ctx.node.debug(\"nodeSetFocus(\" + flag + \")\");",
"var",
"ctx2",
",",
"tree",
"=",
"ctx",
".",
"tree",
",",
"node",
"=",
"ctx",
".",
"node",
";",
"flag",
"=",
"(",
"flag",
"!==",
"false",
")",
";",
"//... | Focus ot blur this node.
@param {EventData} ctx
@param {boolean} [flag=true] | [
"Focus",
"ot",
"blur",
"this",
"node",
"."
] | c283370ec0f99a25db5bb7029a98b4febf8c5251 | https://github.com/S3bb1/ah-dashboard-plugin/blob/c283370ec0f99a25db5bb7029a98b4febf8c5251/public/dashboard/bower_components/fancytree/dist/jquery.fancytree-all.js#L3302-L3342 | |
39,541 | S3bb1/ah-dashboard-plugin | public/dashboard/bower_components/fancytree/dist/jquery.fancytree-all.js | function(el){
if(el instanceof FancytreeNode){
return el; // el already was a FancytreeNode
}else if(el.selector !== undefined){
el = el[0]; // el was a jQuery object: use the DOM element
}else if(el.originalEvent !== undefined){
el = el.target; // el was an Event
}
while( el ) {
if(el.ftnode) {
... | javascript | function(el){
if(el instanceof FancytreeNode){
return el; // el already was a FancytreeNode
}else if(el.selector !== undefined){
el = el[0]; // el was a jQuery object: use the DOM element
}else if(el.originalEvent !== undefined){
el = el.target; // el was an Event
}
while( el ) {
if(el.ftnode) {
... | [
"function",
"(",
"el",
")",
"{",
"if",
"(",
"el",
"instanceof",
"FancytreeNode",
")",
"{",
"return",
"el",
";",
"// el already was a FancytreeNode",
"}",
"else",
"if",
"(",
"el",
".",
"selector",
"!==",
"undefined",
")",
"{",
"el",
"=",
"el",
"[",
"0",
... | Return a FancytreeNode instance from element.
@param {Element | jQueryObject | Event} el
@returns {FancytreeNode} matching node or null | [
"Return",
"a",
"FancytreeNode",
"instance",
"from",
"element",
"."
] | c283370ec0f99a25db5bb7029a98b4febf8c5251 | https://github.com/S3bb1/ah-dashboard-plugin/blob/c283370ec0f99a25db5bb7029a98b4febf8c5251/public/dashboard/bower_components/fancytree/dist/jquery.fancytree-all.js#L4033-L4048 | |
39,542 | S3bb1/ah-dashboard-plugin | public/dashboard/bower_components/fancytree/dist/jquery.fancytree-all.js | function(ctx, title) {
var node = ctx.node,
extOpts = ctx.options.childcounter,
count = (node.data.childCounter == null) ? node.countChildren(extOpts.deep) : +node.data.childCounter;
// Let the base implementation render the title
this._super(ctx, title);
// Append a counter badge
if( (count || ! extOpts.hi... | javascript | function(ctx, title) {
var node = ctx.node,
extOpts = ctx.options.childcounter,
count = (node.data.childCounter == null) ? node.countChildren(extOpts.deep) : +node.data.childCounter;
// Let the base implementation render the title
this._super(ctx, title);
// Append a counter badge
if( (count || ! extOpts.hi... | [
"function",
"(",
"ctx",
",",
"title",
")",
"{",
"var",
"node",
"=",
"ctx",
".",
"node",
",",
"extOpts",
"=",
"ctx",
".",
"options",
".",
"childcounter",
",",
"count",
"=",
"(",
"node",
".",
"data",
".",
"childCounter",
"==",
"null",
")",
"?",
"node... | Overload the `renderTitle` hook, to append a counter badge | [
"Overload",
"the",
"renderTitle",
"hook",
"to",
"append",
"a",
"counter",
"badge"
] | c283370ec0f99a25db5bb7029a98b4febf8c5251 | https://github.com/S3bb1/ah-dashboard-plugin/blob/c283370ec0f99a25db5bb7029a98b4febf8c5251/public/dashboard/bower_components/fancytree/dist/jquery.fancytree-all.js#L4345-L4355 | |
39,543 | S3bb1/ah-dashboard-plugin | public/dashboard/bower_components/fancytree/dist/jquery.fancytree-all.js | function(event) {
var sourceNode = $.ui.fancytree.getNode(event.target);
if(!sourceNode){ // Dynatree issue 211
// might happen, if dragging a table *header*
return "<div>ERROR?: helper requested but sourceNode not found</div>";
}
return sourceNode.tree.ext.dnd._onDragEvent("helper", sourceNod... | javascript | function(event) {
var sourceNode = $.ui.fancytree.getNode(event.target);
if(!sourceNode){ // Dynatree issue 211
// might happen, if dragging a table *header*
return "<div>ERROR?: helper requested but sourceNode not found</div>";
}
return sourceNode.tree.ext.dnd._onDragEvent("helper", sourceNod... | [
"function",
"(",
"event",
")",
"{",
"var",
"sourceNode",
"=",
"$",
".",
"ui",
".",
"fancytree",
".",
"getNode",
"(",
"event",
".",
"target",
")",
";",
"if",
"(",
"!",
"sourceNode",
")",
"{",
"// Dynatree issue 211",
"// might happen, if dragging a table *heade... | Let source tree create the helper element | [
"Let",
"source",
"tree",
"create",
"the",
"helper",
"element"
] | c283370ec0f99a25db5bb7029a98b4febf8c5251 | https://github.com/S3bb1/ah-dashboard-plugin/blob/c283370ec0f99a25db5bb7029a98b4febf8c5251/public/dashboard/bower_components/fancytree/dist/jquery.fancytree-all.js#L4872-L4879 | |
39,544 | lemonde/knex-schema | lib/resolver.js | isResolved | function isResolved(schema, schemas) {
return (schema.deps || []).every(_.partial(function (tableNames, tableName) {
return tableNames.indexOf(tableName) > -1;
}, _.pluck(schemas, 'tableName')));
} | javascript | function isResolved(schema, schemas) {
return (schema.deps || []).every(_.partial(function (tableNames, tableName) {
return tableNames.indexOf(tableName) > -1;
}, _.pluck(schemas, 'tableName')));
} | [
"function",
"isResolved",
"(",
"schema",
",",
"schemas",
")",
"{",
"return",
"(",
"schema",
".",
"deps",
"||",
"[",
"]",
")",
".",
"every",
"(",
"_",
".",
"partial",
"(",
"function",
"(",
"tableNames",
",",
"tableName",
")",
"{",
"return",
"tableNames"... | Return true if given schema.deps meet
schemas entries.
@param Schema schema
@param [Schema] schemas
@return {Boolean} | [
"Return",
"true",
"if",
"given",
"schema",
".",
"deps",
"meet",
"schemas",
"entries",
"."
] | 3e0f6cde374d240552eb08e50e123a513fda44ae | https://github.com/lemonde/knex-schema/blob/3e0f6cde374d240552eb08e50e123a513fda44ae/lib/resolver.js#L55-L59 |
39,545 | vadimdemedes/list-dir | index.js | listDir | function listDir (path, originalPath) {
if (!originalPath) {
originalPath = path + separator;
}
// promises for sub listDir calls
var dirs = [];
return Promise.resolve(fs.readdir(path))
// include only files
.filter(function (item) {
var absolutePath = join(path, item);
return fs.st... | javascript | function listDir (path, originalPath) {
if (!originalPath) {
originalPath = path + separator;
}
// promises for sub listDir calls
var dirs = [];
return Promise.resolve(fs.readdir(path))
// include only files
.filter(function (item) {
var absolutePath = join(path, item);
return fs.st... | [
"function",
"listDir",
"(",
"path",
",",
"originalPath",
")",
"{",
"if",
"(",
"!",
"originalPath",
")",
"{",
"originalPath",
"=",
"path",
"+",
"separator",
";",
"}",
"// promises for sub listDir calls",
"var",
"dirs",
"=",
"[",
"]",
";",
"return",
"Promise",... | List directory recursively
@param {String} path
@return {Promise} | [
"List",
"directory",
"recursively"
] | 4efce85e42e7e6f0eca7f22bbc5abf0af282596d | https://github.com/vadimdemedes/list-dir/blob/4efce85e42e7e6f0eca7f22bbc5abf0af282596d/index.js#L29-L78 |
39,546 | jxson/haiku | lib/page.js | read | function read(src, basedir, callback){
var page = new Page(src, basedir)
page.read(callback)
} | javascript | function read(src, basedir, callback){
var page = new Page(src, basedir)
page.read(callback)
} | [
"function",
"read",
"(",
"src",
",",
"basedir",
",",
"callback",
")",
"{",
"var",
"page",
"=",
"new",
"Page",
"(",
"src",
",",
"basedir",
")",
"page",
".",
"read",
"(",
"callback",
")",
"}"
] | Async read and instantiate a page from a file | [
"Async",
"read",
"and",
"instantiate",
"a",
"page",
"from",
"a",
"file"
] | d7dcb3c3b39012082277cf0ed1bcb5c91440c76e | https://github.com/jxson/haiku/blob/d7dcb3c3b39012082277cf0ed1bcb5c91440c76e/lib/page.js#L13-L17 |
39,547 | Knorcedger/apier | index.js | apier | function apier(config) {
// on server start..
db.connect(config.mongoUrl);
accessVerifier.init(config.access);
schemaExtender.handleErrors = true;
reqlog.info('apier initialized!!');
var app = function(req, res) {
// this is the final handler if no match found
router(req, res, function(error) {
if (error)... | javascript | function apier(config) {
// on server start..
db.connect(config.mongoUrl);
accessVerifier.init(config.access);
schemaExtender.handleErrors = true;
reqlog.info('apier initialized!!');
var app = function(req, res) {
// this is the final handler if no match found
router(req, res, function(error) {
if (error)... | [
"function",
"apier",
"(",
"config",
")",
"{",
"// on server start..",
"db",
".",
"connect",
"(",
"config",
".",
"mongoUrl",
")",
";",
"accessVerifier",
".",
"init",
"(",
"config",
".",
"access",
")",
";",
"schemaExtender",
".",
"handleErrors",
"=",
"true",
... | Create an apier app
@method apier
@param {object} config The app configuration
It must contain the following options
mongoUrl: String. The mongo url to connect to
handleErrors: Boolean. Define if the schemaExtender will handle the db errors
@return {Function} The app to use as server | [
"Create",
"an",
"apier",
"app"
] | de980ebc7656459656d0c850f6584e4da3761b53 | https://github.com/Knorcedger/apier/blob/de980ebc7656459656d0c850f6584e4da3761b53/index.js#L26-L49 |
39,548 | Knorcedger/apier | index.js | endpoint | function endpoint(options) {
// find the middlewares
options.permissions = options.permissions || ['null'];
options.middlewares = options.middlewares || [];
options.middlewares.unshift([permissioner(options.permissions)]);
for (var i = 0, length = options.methods.length; i < length; i++) {
var method = options.... | javascript | function endpoint(options) {
// find the middlewares
options.permissions = options.permissions || ['null'];
options.middlewares = options.middlewares || [];
options.middlewares.unshift([permissioner(options.permissions)]);
for (var i = 0, length = options.methods.length; i < length; i++) {
var method = options.... | [
"function",
"endpoint",
"(",
"options",
")",
"{",
"// find the middlewares",
"options",
".",
"permissions",
"=",
"options",
".",
"permissions",
"||",
"[",
"'null'",
"]",
";",
"options",
".",
"middlewares",
"=",
"options",
".",
"middlewares",
"||",
"[",
"]",
... | Create an endpoint
@method endpoint
@param {object} options It contains the following options
methods: Array. Can contain 'post', 'get', 'delete', 'put'
url: String. The matching url e.g. /users, /users/:id/update
middlewares: Array. The middlewares (functions) that will be called before the callback
permissions: A... | [
"Create",
"an",
"endpoint"
] | de980ebc7656459656d0c850f6584e4da3761b53 | https://github.com/Knorcedger/apier/blob/de980ebc7656459656d0c850f6584e4da3761b53/index.js#L80-L95 |
39,549 | Knorcedger/apier | index.js | routerCallback | function routerCallback(req, res, callback) {
var innerSelf = {
req: req,
res: res,
send: function(data) {
send.call(this, data);
},
setStatusCode: function(statusCode) {
setStatusCode.call(this, statusCode);
}
};
reqlog.info('inside routerCallback for endpoint: ', req.url);
callback.call(innerSel... | javascript | function routerCallback(req, res, callback) {
var innerSelf = {
req: req,
res: res,
send: function(data) {
send.call(this, data);
},
setStatusCode: function(statusCode) {
setStatusCode.call(this, statusCode);
}
};
reqlog.info('inside routerCallback for endpoint: ', req.url);
callback.call(innerSel... | [
"function",
"routerCallback",
"(",
"req",
",",
"res",
",",
"callback",
")",
"{",
"var",
"innerSelf",
"=",
"{",
"req",
":",
"req",
",",
"res",
":",
"res",
",",
"send",
":",
"function",
"(",
"data",
")",
"{",
"send",
".",
"call",
"(",
"this",
",",
... | Defines the endpoint callback passed into the router
create an object to apply as this in the callback
its used to be able to call the send function inside the callback
without having to also pass the req and res
@method routerCallback
@param {object} req A request object
@param {object} res A ... | [
"Defines",
"the",
"endpoint",
"callback",
"passed",
"into",
"the",
"router"
] | de980ebc7656459656d0c850f6584e4da3761b53 | https://github.com/Knorcedger/apier/blob/de980ebc7656459656d0c850f6584e4da3761b53/index.js#L128-L141 |
39,550 | lemonde/knex-schema | lib/sync.js | sync | function sync(schemas) {
var resolver = new Resolver(schemas);
// Reduce force sequential execution.
return Promise.resolve(Promise.reduce(resolver.resolve(), syncSchema.bind(this), []))
.tap(function () {
var knex = this.knex;
return Promise.map(schemas || [], function(schema) {
return (schema.po... | javascript | function sync(schemas) {
var resolver = new Resolver(schemas);
// Reduce force sequential execution.
return Promise.resolve(Promise.reduce(resolver.resolve(), syncSchema.bind(this), []))
.tap(function () {
var knex = this.knex;
return Promise.map(schemas || [], function(schema) {
return (schema.po... | [
"function",
"sync",
"(",
"schemas",
")",
"{",
"var",
"resolver",
"=",
"new",
"Resolver",
"(",
"schemas",
")",
";",
"// Reduce force sequential execution.",
"return",
"Promise",
".",
"resolve",
"(",
"Promise",
".",
"reduce",
"(",
"resolver",
".",
"resolve",
"("... | Synchronize given schemas with database. If it exists, it calls `postBuild` afterwards
@param {[Schemas]} schemas
@return {Promise} | [
"Synchronize",
"given",
"schemas",
"with",
"database",
".",
"If",
"it",
"exists",
"it",
"calls",
"postBuild",
"afterwards"
] | 3e0f6cde374d240552eb08e50e123a513fda44ae | https://github.com/lemonde/knex-schema/blob/3e0f6cde374d240552eb08e50e123a513fda44ae/lib/sync.js#L20-L30 |
39,551 | lemonde/knex-schema | lib/sync.js | syncSchema | function syncSchema(result, schema) {
var knex = this.knex;
return knex.schema.hasTable(schema.tableName)
.then(function (exists) {
if (exists) return result;
return knex.schema.createTable(schema.tableName, defineSchemaTable(schema))
.then(function () {
return result.concat([schema]);
});
... | javascript | function syncSchema(result, schema) {
var knex = this.knex;
return knex.schema.hasTable(schema.tableName)
.then(function (exists) {
if (exists) return result;
return knex.schema.createTable(schema.tableName, defineSchemaTable(schema))
.then(function () {
return result.concat([schema]);
});
... | [
"function",
"syncSchema",
"(",
"result",
",",
"schema",
")",
"{",
"var",
"knex",
"=",
"this",
".",
"knex",
";",
"return",
"knex",
".",
"schema",
".",
"hasTable",
"(",
"schema",
".",
"tableName",
")",
".",
"then",
"(",
"function",
"(",
"exists",
")",
... | Synchronize given schema with database.
@param {[Schema]} result - reduce accumulator
@param {Schema} schema
@return {Promise} | [
"Synchronize",
"given",
"schema",
"with",
"database",
"."
] | 3e0f6cde374d240552eb08e50e123a513fda44ae | https://github.com/lemonde/knex-schema/blob/3e0f6cde374d240552eb08e50e123a513fda44ae/lib/sync.js#L40-L50 |
39,552 | lemonde/knex-schema | lib/sync.js | defineSchemaTable | function defineSchemaTable(schema) {
return function (table) {
table.timestamps();
(schema.build || _.noop)(table);
};
} | javascript | function defineSchemaTable(schema) {
return function (table) {
table.timestamps();
(schema.build || _.noop)(table);
};
} | [
"function",
"defineSchemaTable",
"(",
"schema",
")",
"{",
"return",
"function",
"(",
"table",
")",
"{",
"table",
".",
"timestamps",
"(",
")",
";",
"(",
"schema",
".",
"build",
"||",
"_",
".",
"noop",
")",
"(",
"table",
")",
";",
"}",
";",
"}"
] | Define default properties on the given schema.
@param {Schema} schema
@return {Function} | [
"Define",
"default",
"properties",
"on",
"the",
"given",
"schema",
"."
] | 3e0f6cde374d240552eb08e50e123a513fda44ae | https://github.com/lemonde/knex-schema/blob/3e0f6cde374d240552eb08e50e123a513fda44ae/lib/sync.js#L59-L64 |
39,553 | gflarity/response | lib/graphite.js | function( data ) {
var read_buffer = read_buffers_by_connection[tcp_connection];
read_buffer += data;
//split by new lines,
var messages = read_buffer.split('\n');
//last element is either a partial message, or ''
... | javascript | function( data ) {
var read_buffer = read_buffers_by_connection[tcp_connection];
read_buffer += data;
//split by new lines,
var messages = read_buffer.split('\n');
//last element is either a partial message, or ''
... | [
"function",
"(",
"data",
")",
"{",
"var",
"read_buffer",
"=",
"read_buffers_by_connection",
"[",
"tcp_connection",
"]",
";",
"read_buffer",
"+=",
"data",
";",
"//split by new lines, ",
"var",
"messages",
"=",
"read_buffer",
".",
"split",
"(",
"'\\n'",
")",
";",
... | setup our handlers for this connection data | [
"setup",
"our",
"handlers",
"for",
"this",
"connection",
"data"
] | bf1f7342afbdf460970935e61abda14d8ef947fe | https://github.com/gflarity/response/blob/bf1f7342afbdf460970935e61abda14d8ef947fe/lib/graphite.js#L34-L57 | |
39,554 | kaelzhang/make-array | index.js | isArrayLikeObject | function isArrayLikeObject (subject) {
var length = subject.length
if (
typeof subject === 'function'
|| Object(subject) !== subject
|| typeof length !== 'number'
// `window` already has a property `length`
|| 'setInterval' in subject
) {
return false
}
return length === 0
|| len... | javascript | function isArrayLikeObject (subject) {
var length = subject.length
if (
typeof subject === 'function'
|| Object(subject) !== subject
|| typeof length !== 'number'
// `window` already has a property `length`
|| 'setInterval' in subject
) {
return false
}
return length === 0
|| len... | [
"function",
"isArrayLikeObject",
"(",
"subject",
")",
"{",
"var",
"length",
"=",
"subject",
".",
"length",
"if",
"(",
"typeof",
"subject",
"===",
"'function'",
"||",
"Object",
"(",
"subject",
")",
"!==",
"subject",
"||",
"typeof",
"length",
"!==",
"'number'"... | altered from jQuery | [
"altered",
"from",
"jQuery"
] | 4e04c3fe7586ccb3fe1e96d06aa694df0c656327 | https://github.com/kaelzhang/make-array/blob/4e04c3fe7586ccb3fe1e96d06aa694df0c656327/index.js#L40-L55 |
39,555 | kaelzhang/make-array | index.js | clonePureArray | function clonePureArray (subject, host) {
var i = subject.length
var start = host.length
while (i --) {
host[start + i] = subject[i]
}
return host
} | javascript | function clonePureArray (subject, host) {
var i = subject.length
var start = host.length
while (i --) {
host[start + i] = subject[i]
}
return host
} | [
"function",
"clonePureArray",
"(",
"subject",
",",
"host",
")",
"{",
"var",
"i",
"=",
"subject",
".",
"length",
"var",
"start",
"=",
"host",
".",
"length",
"while",
"(",
"i",
"--",
")",
"{",
"host",
"[",
"start",
"+",
"i",
"]",
"=",
"subject",
"[",... | clone an object as a pure subject, and ignore non-number properties
@param {Array} subject
@param {Array|Object} host required, receiver which the subject be cloned to | [
"clone",
"an",
"object",
"as",
"a",
"pure",
"subject",
"and",
"ignore",
"non",
"-",
"number",
"properties"
] | 4e04c3fe7586ccb3fe1e96d06aa694df0c656327 | https://github.com/kaelzhang/make-array/blob/4e04c3fe7586ccb3fe1e96d06aa694df0c656327/index.js#L62-L71 |
39,556 | emeryrose/mtree | lib/tree.js | MerkleTree | function MerkleTree(leaves, hasher) {
if (!(this instanceof MerkleTree)) {
return new MerkleTree(leaves, hasher);
}
this._hasher = hasher || this._hasher;
this._leaves = [];
this._depth = 0;
this._rows = [];
this._count = 0;
assert(Array.isArray(leaves), 'Invalid leaves array supplied');
assert(... | javascript | function MerkleTree(leaves, hasher) {
if (!(this instanceof MerkleTree)) {
return new MerkleTree(leaves, hasher);
}
this._hasher = hasher || this._hasher;
this._leaves = [];
this._depth = 0;
this._rows = [];
this._count = 0;
assert(Array.isArray(leaves), 'Invalid leaves array supplied');
assert(... | [
"function",
"MerkleTree",
"(",
"leaves",
",",
"hasher",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"MerkleTree",
")",
")",
"{",
"return",
"new",
"MerkleTree",
"(",
"leaves",
",",
"hasher",
")",
";",
"}",
"this",
".",
"_hasher",
"=",
"hasher",... | Implements a merkle hash tree
@constructor
@param {Array} leaves - Initial tree input
@param {Function} hasher - Hash function for building tree | [
"Implements",
"a",
"merkle",
"hash",
"tree"
] | 21428212a4955d0498f1272c7df17645dcc379f6 | https://github.com/emeryrose/mtree/blob/21428212a4955d0498f1272c7df17645dcc379f6/lib/tree.js#L12-L31 |
39,557 | ofzza/enTT | tasks/index.js | queueTasks | function queueTasks (testTasks, buildTasks) {
// Queue up test tasks, removing them if already queued up
_.forEach({ test: testTasks, build: buildTasks }, (queuingTasks, type) => {
_.forEach(queuingTasks, (task) => {
// Remove if already queued
const removed = _.remove(queue[type... | javascript | function queueTasks (testTasks, buildTasks) {
// Queue up test tasks, removing them if already queued up
_.forEach({ test: testTasks, build: buildTasks }, (queuingTasks, type) => {
_.forEach(queuingTasks, (task) => {
// Remove if already queued
const removed = _.remove(queue[type... | [
"function",
"queueTasks",
"(",
"testTasks",
",",
"buildTasks",
")",
"{",
"// Queue up test tasks, removing them if already queued up",
"_",
".",
"forEach",
"(",
"{",
"test",
":",
"testTasks",
",",
"build",
":",
"buildTasks",
"}",
",",
"(",
"queuingTasks",
",",
"ty... | Queues up tasks for execution
@param {any} testTasks Array of test tasks names
@param {any} buildTasks Array of build task names | [
"Queues",
"up",
"tasks",
"for",
"execution"
] | fdf27de4142b3c65a3e51dee70e0d7625dff897c | https://github.com/ofzza/enTT/blob/fdf27de4142b3c65a3e51dee70e0d7625dff897c/tasks/index.js#L81-L102 |
39,558 | ofzza/enTT | tasks/index.js | executeQueuedTasks | function executeQueuedTasks () {
// Delay execution to allow for more tasks to queue up
setTimeout(() => {
// Check if already executing and if any tasks ready for execution
if (!executing && (queue.test.length || queue.build.length)) {
// Flag executing status
executing ... | javascript | function executeQueuedTasks () {
// Delay execution to allow for more tasks to queue up
setTimeout(() => {
// Check if already executing and if any tasks ready for execution
if (!executing && (queue.test.length || queue.build.length)) {
// Flag executing status
executing ... | [
"function",
"executeQueuedTasks",
"(",
")",
"{",
"// Delay execution to allow for more tasks to queue up",
"setTimeout",
"(",
"(",
")",
"=>",
"{",
"// Check if already executing and if any tasks ready for execution",
"if",
"(",
"!",
"executing",
"&&",
"(",
"queue",
".",
"te... | Executes previously queued up tasks, one-by-one | [
"Executes",
"previously",
"queued",
"up",
"tasks",
"one",
"-",
"by",
"-",
"one"
] | fdf27de4142b3c65a3e51dee70e0d7625dff897c | https://github.com/ofzza/enTT/blob/fdf27de4142b3c65a3e51dee70e0d7625dff897c/tasks/index.js#L107-L131 |
39,559 | ecomfe/jformatter | jformatter.js | function () {
return {
lineSeparator: '\n', // done
maxLength: 120, // TODO
wrapIfLong: false, // TODO
indent: 4, // done
useTabIndent: false, // done
spaces: {
around: {
unaryOperators: false, // TODO
... | javascript | function () {
return {
lineSeparator: '\n', // done
maxLength: 120, // TODO
wrapIfLong: false, // TODO
indent: 4, // done
useTabIndent: false, // done
spaces: {
around: {
unaryOperators: false, // TODO
... | [
"function",
"(",
")",
"{",
"return",
"{",
"lineSeparator",
":",
"'\\n'",
",",
"// done",
"maxLength",
":",
"120",
",",
"// TODO",
"wrapIfLong",
":",
"false",
",",
"// TODO",
"indent",
":",
"4",
",",
"// done",
"useTabIndent",
":",
"false",
",",
"// done",
... | returns default config
@returns {Object} | [
"returns",
"default",
"config"
] | fce4c775a54362a7dc67cab71f8dc8f54d809b3d | https://github.com/ecomfe/jformatter/blob/fce4c775a54362a7dc67cab71f8dc8f54d809b3d/jformatter.js#L11-L66 | |
39,560 | ecomfe/jformatter | jformatter.js | function (defaults, configure) {
for (var key in defaults) {
if (defaults.hasOwnProperty(key)) {
if (typeof defaults[key] === 'object') {
// recursive
if (typeof configure[key] === 'object') {
overwriteConfig(defaults[ke... | javascript | function (defaults, configure) {
for (var key in defaults) {
if (defaults.hasOwnProperty(key)) {
if (typeof defaults[key] === 'object') {
// recursive
if (typeof configure[key] === 'object') {
overwriteConfig(defaults[ke... | [
"function",
"(",
"defaults",
",",
"configure",
")",
"{",
"for",
"(",
"var",
"key",
"in",
"defaults",
")",
"{",
"if",
"(",
"defaults",
".",
"hasOwnProperty",
"(",
"key",
")",
")",
"{",
"if",
"(",
"typeof",
"defaults",
"[",
"key",
"]",
"===",
"'object'... | defaults the config | [
"defaults",
"the",
"config"
] | fce4c775a54362a7dc67cab71f8dc8f54d809b3d | https://github.com/ecomfe/jformatter/blob/fce4c775a54362a7dc67cab71f8dc8f54d809b3d/jformatter.js#L71-L87 | |
39,561 | ecomfe/jformatter | jformatter.js | function () {
var indentStr = '';
for (var i = 0; i < indentLevel; i++) {
indentStr += INDENT;
}
return {
type: 'WhiteSpace',
value: indentStr
};
} | javascript | function () {
var indentStr = '';
for (var i = 0; i < indentLevel; i++) {
indentStr += INDENT;
}
return {
type: 'WhiteSpace',
value: indentStr
};
} | [
"function",
"(",
")",
"{",
"var",
"indentStr",
"=",
"''",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"indentLevel",
";",
"i",
"++",
")",
"{",
"indentStr",
"+=",
"INDENT",
";",
"}",
"return",
"{",
"type",
":",
"'WhiteSpace'",
",",
"valu... | create a indent token with indent level
@returns {Object} | [
"create",
"a",
"indent",
"token",
"with",
"indent",
"level"
] | fce4c775a54362a7dc67cab71f8dc8f54d809b3d | https://github.com/ecomfe/jformatter/blob/fce4c775a54362a7dc67cab71f8dc8f54d809b3d/jformatter.js#L135-L144 | |
39,562 | ecomfe/jformatter | jformatter.js | function (token) {
var inline = false;
if (token) {
if (token.type === 'LineComment') {
inline = true;
} else if (token.type === 'BlockComment') {
inline = (token.value.indexOf('\n') === -1);
}
}
... | javascript | function (token) {
var inline = false;
if (token) {
if (token.type === 'LineComment') {
inline = true;
} else if (token.type === 'BlockComment') {
inline = (token.value.indexOf('\n') === -1);
}
}
... | [
"function",
"(",
"token",
")",
"{",
"var",
"inline",
"=",
"false",
";",
"if",
"(",
"token",
")",
"{",
"if",
"(",
"token",
".",
"type",
"===",
"'LineComment'",
")",
"{",
"inline",
"=",
"true",
";",
"}",
"else",
"if",
"(",
"token",
".",
"type",
"==... | check if a token is comment in one line
@param {Object} token - the token to check
@returns {boolean} | [
"check",
"if",
"a",
"token",
"is",
"comment",
"in",
"one",
"line"
] | fce4c775a54362a7dc67cab71f8dc8f54d809b3d | https://github.com/ecomfe/jformatter/blob/fce4c775a54362a7dc67cab71f8dc8f54d809b3d/jformatter.js#L226-L236 | |
39,563 | ecomfe/jformatter | jformatter.js | function (startToken, endToken, types) {
var is = true;
var token = startToken;
while (token.next && token.next !== endToken) {
token = token.next;
if (types.indexOf(token.type) === -1) {
is = false;
break;
... | javascript | function (startToken, endToken, types) {
var is = true;
var token = startToken;
while (token.next && token.next !== endToken) {
token = token.next;
if (types.indexOf(token.type) === -1) {
is = false;
break;
... | [
"function",
"(",
"startToken",
",",
"endToken",
",",
"types",
")",
"{",
"var",
"is",
"=",
"true",
";",
"var",
"token",
"=",
"startToken",
";",
"while",
"(",
"token",
".",
"next",
"&&",
"token",
".",
"next",
"!==",
"endToken",
")",
"{",
"token",
"=",
... | check if only types between startToken and endToken
@param {Object} startToken - the token to start check
@param {Object} endToken - the token to end check
@param {Array} types - allow types array
@returns {boolean} | [
"check",
"if",
"only",
"types",
"between",
"startToken",
"and",
"endToken"
] | fce4c775a54362a7dc67cab71f8dc8f54d809b3d | https://github.com/ecomfe/jformatter/blob/fce4c775a54362a7dc67cab71f8dc8f54d809b3d/jformatter.js#L246-L257 | |
39,564 | sithmel/obj-path-expression-parser | lib/parser/grammar.js | pathExpression | function pathExpression (token, tokens) {
const expression = []
while (true) {
if (!token) {
break
}
if (token === ')') {
tokens.unshift(token)
break
}
if (includes('}]', token)) {
throw new Error(`A fragment can't contain "${token}"`)
}
if (token === ',') {
... | javascript | function pathExpression (token, tokens) {
const expression = []
while (true) {
if (!token) {
break
}
if (token === ')') {
tokens.unshift(token)
break
}
if (includes('}]', token)) {
throw new Error(`A fragment can't contain "${token}"`)
}
if (token === ',') {
... | [
"function",
"pathExpression",
"(",
"token",
",",
"tokens",
")",
"{",
"const",
"expression",
"=",
"[",
"]",
"while",
"(",
"true",
")",
"{",
"if",
"(",
"!",
"token",
")",
"{",
"break",
"}",
"if",
"(",
"token",
"===",
"')'",
")",
"{",
"tokens",
".",
... | ends with "," or with "end of string" | [
"ends",
"with",
"or",
"with",
"end",
"of",
"string"
] | ba942086d98f42d01ea34592328630179c4bde80 | https://github.com/sithmel/obj-path-expression-parser/blob/ba942086d98f42d01ea34592328630179c4bde80/lib/parser/grammar.js#L91-L121 |
39,565 | jonschlinkert/api-toc | index.js | context | function context(str) {
var arr = code(str);
var len = arr.length, i = 0;
var res = {};
while (len--) {
var ele = arr[i++];
if (ele.type !== 'comment') {
res[ele.name] = ele.begin;
}
}
return res;
} | javascript | function context(str) {
var arr = code(str);
var len = arr.length, i = 0;
var res = {};
while (len--) {
var ele = arr[i++];
if (ele.type !== 'comment') {
res[ele.name] = ele.begin;
}
}
return res;
} | [
"function",
"context",
"(",
"str",
")",
"{",
"var",
"arr",
"=",
"code",
"(",
"str",
")",
";",
"var",
"len",
"=",
"arr",
".",
"length",
",",
"i",
"=",
"0",
";",
"var",
"res",
"=",
"{",
"}",
";",
"while",
"(",
"len",
"--",
")",
"{",
"var",
"e... | Get the code context for a JavaScript file. | [
"Get",
"the",
"code",
"context",
"for",
"a",
"JavaScript",
"file",
"."
] | 2723a7b597a1a9629309396e0e613591783f841b | https://github.com/jonschlinkert/api-toc/blob/2723a7b597a1a9629309396e0e613591783f841b/index.js#L67-L79 |
39,566 | jonschlinkert/api-toc | index.js | format | function format(obj, opts, fn) {
if (typeof opts === 'function') {
fn = opts; opts = {};
}
opts = opts || {};
if (Array.isArray(opts.filter) || typeof opts.filter === 'string') {
obj = filter(obj, opts.filter);
}
var keys = Object.keys(obj);
var len = keys.length, i = 0;
var str = '';
var to... | javascript | function format(obj, opts, fn) {
if (typeof opts === 'function') {
fn = opts; opts = {};
}
opts = opts || {};
if (Array.isArray(opts.filter) || typeof opts.filter === 'string') {
obj = filter(obj, opts.filter);
}
var keys = Object.keys(obj);
var len = keys.length, i = 0;
var str = '';
var to... | [
"function",
"format",
"(",
"obj",
",",
"opts",
",",
"fn",
")",
"{",
"if",
"(",
"typeof",
"opts",
"===",
"'function'",
")",
"{",
"fn",
"=",
"opts",
";",
"opts",
"=",
"{",
"}",
";",
"}",
"opts",
"=",
"opts",
"||",
"{",
"}",
";",
"if",
"(",
"Arr... | Generate a formatted list that includes the given files,
and their respective methods. Uses code context to build
the list.
@param {Object} `obj` Object, The key is a file name and the properties are the methods.
@return {Object} | [
"Generate",
"a",
"formatted",
"list",
"that",
"includes",
"the",
"given",
"files",
"and",
"their",
"respective",
"methods",
".",
"Uses",
"code",
"context",
"to",
"build",
"the",
"list",
"."
] | 2723a7b597a1a9629309396e0e613591783f841b | https://github.com/jonschlinkert/api-toc/blob/2723a7b597a1a9629309396e0e613591783f841b/index.js#L90-L122 |
39,567 | jonschlinkert/api-toc | index.js | listify | function listify(fp, methods, ctx) {
var len = methods.length, i = 0;
var res = [''];
while (len--) {
var method = methods[i++];
var line = ctx[method];
var item = line ? linkify('.' + method, fp, '#L' + line) : method;
item = ' - ' + item;
res.push(item);
}
return res.sort().join('\n');
... | javascript | function listify(fp, methods, ctx) {
var len = methods.length, i = 0;
var res = [''];
while (len--) {
var method = methods[i++];
var line = ctx[method];
var item = line ? linkify('.' + method, fp, '#L' + line) : method;
item = ' - ' + item;
res.push(item);
}
return res.sort().join('\n');
... | [
"function",
"listify",
"(",
"fp",
",",
"methods",
",",
"ctx",
")",
"{",
"var",
"len",
"=",
"methods",
".",
"length",
",",
"i",
"=",
"0",
";",
"var",
"res",
"=",
"[",
"''",
"]",
";",
"while",
"(",
"len",
"--",
")",
"{",
"var",
"method",
"=",
"... | Create a formatted list for a file and it methods.
@param {String} `fp` File path
@param {Array} `items` Array of items to format.
@param {Object} `ctx` Code context, mainly for getting line numbers to create links.
@return {Array} | [
"Create",
"a",
"formatted",
"list",
"for",
"a",
"file",
"and",
"it",
"methods",
"."
] | 2723a7b597a1a9629309396e0e613591783f841b | https://github.com/jonschlinkert/api-toc/blob/2723a7b597a1a9629309396e0e613591783f841b/index.js#L133-L144 |
39,568 | EricCrosson/coinmarketcap-cli | index.js | tableize | function tableize(tableData) {
var table = new Table({
head: Object.keys(tableData[0]),
chars: {'mid': '', 'left-mid': '', 'mid-mid': '', 'right-mid': ''},
style: { 'padding-left': 0, 'padding-right': 0 }
});
_.each(tableData, function(row, index) {
table.push(_.values(row))... | javascript | function tableize(tableData) {
var table = new Table({
head: Object.keys(tableData[0]),
chars: {'mid': '', 'left-mid': '', 'mid-mid': '', 'right-mid': ''},
style: { 'padding-left': 0, 'padding-right': 0 }
});
_.each(tableData, function(row, index) {
table.push(_.values(row))... | [
"function",
"tableize",
"(",
"tableData",
")",
"{",
"var",
"table",
"=",
"new",
"Table",
"(",
"{",
"head",
":",
"Object",
".",
"keys",
"(",
"tableData",
"[",
"0",
"]",
")",
",",
"chars",
":",
"{",
"'mid'",
":",
"''",
",",
"'left-mid'",
":",
"''",
... | returns a table object | [
"returns",
"a",
"table",
"object"
] | bdf4fbf28f8706d80415905d90b9458bd37f905d | https://github.com/EricCrosson/coinmarketcap-cli/blob/bdf4fbf28f8706d80415905d90b9458bd37f905d/index.js#L13-L24 |
39,569 | CandleFW/wick | build/wick.node.js | CreateSchemedProperty | function CreateSchemedProperty(object, scheme, schema_name, index) {
if (object[schema_name])
return;
Object.defineProperty(object, schema_name, {
configurable: false,
enumerable: true,
get: function() {
return this.getHook(schema_name, this.prop_array[index]);
... | javascript | function CreateSchemedProperty(object, scheme, schema_name, index) {
if (object[schema_name])
return;
Object.defineProperty(object, schema_name, {
configurable: false,
enumerable: true,
get: function() {
return this.getHook(schema_name, this.prop_array[index]);
... | [
"function",
"CreateSchemedProperty",
"(",
"object",
",",
"scheme",
",",
"schema_name",
",",
"index",
")",
"{",
"if",
"(",
"object",
"[",
"schema_name",
"]",
")",
"return",
";",
"Object",
".",
"defineProperty",
"(",
"object",
",",
"schema_name",
",",
"{",
"... | This is used by Model to create custom property getter and setters on non-ModelContainerBase and non-Model properties of the Model constructor.
@protected
@memberof module:wick~internals.model | [
"This",
"is",
"used",
"by",
"Model",
"to",
"create",
"custom",
"property",
"getter",
"and",
"setters",
"on",
"non",
"-",
"ModelContainerBase",
"and",
"non",
"-",
"Model",
"properties",
"of",
"the",
"Model",
"constructor",
"."
] | 139861e3696598db5b1e5c809ce36691ae61c633 | https://github.com/CandleFW/wick/blob/139861e3696598db5b1e5c809ce36691ae61c633/build/wick.node.js#L3628-L3653 |
39,570 | CandleFW/wick | build/wick.node.js | CreateModelProperty | function CreateModelProperty(object, model, schema_name, index) {
Object.defineProperty(object, schema_name, {
configurable: false,
enumerable: true,
get: function() {
let m = this.prop_array[index];
if (!m) {
let address = this.address.slice();
... | javascript | function CreateModelProperty(object, model, schema_name, index) {
Object.defineProperty(object, schema_name, {
configurable: false,
enumerable: true,
get: function() {
let m = this.prop_array[index];
if (!m) {
let address = this.address.slice();
... | [
"function",
"CreateModelProperty",
"(",
"object",
",",
"model",
",",
"schema_name",
",",
"index",
")",
"{",
"Object",
".",
"defineProperty",
"(",
"object",
",",
"schema_name",
",",
"{",
"configurable",
":",
"false",
",",
"enumerable",
":",
"true",
",",
"get"... | This is used by Model to create custom property getter and setters on Model properties of the Model constructor.
@protected
@memberof module:wick~internals.model | [
"This",
"is",
"used",
"by",
"Model",
"to",
"create",
"custom",
"property",
"getter",
"and",
"setters",
"on",
"Model",
"properties",
"of",
"the",
"Model",
"constructor",
"."
] | 139861e3696598db5b1e5c809ce36691ae61c633 | https://github.com/CandleFW/wick/blob/139861e3696598db5b1e5c809ce36691ae61c633/build/wick.node.js#L3660-L3682 |
39,571 | CandleFW/wick | build/wick.node.js | function(node = this.fch) {
if (node && node.nxt != this.fch && this.fch)
return node.nxt;
return null;
} | javascript | function(node = this.fch) {
if (node && node.nxt != this.fch && this.fch)
return node.nxt;
return null;
} | [
"function",
"(",
"node",
"=",
"this",
".",
"fch",
")",
"{",
"if",
"(",
"node",
"&&",
"node",
".",
"nxt",
"!=",
"this",
".",
"fch",
"&&",
"this",
".",
"fch",
")",
"return",
"node",
".",
"nxt",
";",
"return",
"null",
";",
"}"
] | Gets the next node.
@param {HTMLNode} node The node to get the sibling of.
@return {HTMLNode | TextNode | undefined} | [
"Gets",
"the",
"next",
"node",
"."
] | 139861e3696598db5b1e5c809ce36691ae61c633 | https://github.com/CandleFW/wick/blob/139861e3696598db5b1e5c809ce36691ae61c633/build/wick.node.js#L4881-L4885 | |
39,572 | CandleFW/wick | build/wick.node.js | function(index, node = this.fch) {
if(node.par !== this)
node = this.fch;
let first = node;
let i = 0;
while (node && node != first) {
if (i++ == index)
return node;
... | javascript | function(index, node = this.fch) {
if(node.par !== this)
node = this.fch;
let first = node;
let i = 0;
while (node && node != first) {
if (i++ == index)
return node;
... | [
"function",
"(",
"index",
",",
"node",
"=",
"this",
".",
"fch",
")",
"{",
"if",
"(",
"node",
".",
"par",
"!==",
"this",
")",
"node",
"=",
"this",
".",
"fch",
";",
"let",
"first",
"=",
"node",
";",
"let",
"i",
"=",
"0",
";",
"while",
"(",
"nod... | Gets the child at index.
@param {number} index The index | [
"Gets",
"the",
"child",
"at",
"index",
"."
] | 139861e3696598db5b1e5c809ce36691ae61c633 | https://github.com/CandleFW/wick/blob/139861e3696598db5b1e5c809ce36691ae61c633/build/wick.node.js#L4892-L4905 | |
39,573 | CandleFW/wick | build/wick.node.js | JSExpressionIdentifiers | function JSExpressionIdentifiers(lex) {
let _identifiers_ = [];
let model_cache = {};
let IN_OBJ = false,
CAN_BE_ID = true;
while (!lex.END) {
switch (lex.ty) {
case lex.types.id:
if (!IN_OBJ || CAN_BE_ID) {
let id = lex.tx;
... | javascript | function JSExpressionIdentifiers(lex) {
let _identifiers_ = [];
let model_cache = {};
let IN_OBJ = false,
CAN_BE_ID = true;
while (!lex.END) {
switch (lex.ty) {
case lex.types.id:
if (!IN_OBJ || CAN_BE_ID) {
let id = lex.tx;
... | [
"function",
"JSExpressionIdentifiers",
"(",
"lex",
")",
"{",
"let",
"_identifiers_",
"=",
"[",
"]",
";",
"let",
"model_cache",
"=",
"{",
"}",
";",
"let",
"IN_OBJ",
"=",
"false",
",",
"CAN_BE_ID",
"=",
"true",
";",
"while",
"(",
"!",
"lex",
".",
"END",
... | Basic JS Parser Kludge to get legitimate foreign identifiers from expressions.
This could later be expanded into a full JS parser to generate proper JS ASTs.
@class JSExpressionIdentifiers
@param {Lexer} lex The lex
@return {Object} { description_of_the_return_value } | [
"Basic",
"JS",
"Parser",
"Kludge",
"to",
"get",
"legitimate",
"foreign",
"identifiers",
"from",
"expressions",
".",
"This",
"could",
"later",
"be",
"expanded",
"into",
"a",
"full",
"JS",
"parser",
"to",
"generate",
"proper",
"JS",
"ASTs",
"."
] | 139861e3696598db5b1e5c809ce36691ae61c633 | https://github.com/CandleFW/wick/blob/139861e3696598db5b1e5c809ce36691ae61c633/build/wick.node.js#L10247-L10311 |
39,574 | CandleFW/wick | build/wick.node.js | TransformTo | function TransformTo(element_from, element_to, duration = 500, easing = Animation.easing.linear, HIDE_OTHER) {
let rect = element_from.getBoundingClientRect();
let cs = window.getComputedStyle(element_from, null);
let margin_left = parseFloat(cs.getPropertyValue("margin"));
let seq = Animation.cre... | javascript | function TransformTo(element_from, element_to, duration = 500, easing = Animation.easing.linear, HIDE_OTHER) {
let rect = element_from.getBoundingClientRect();
let cs = window.getComputedStyle(element_from, null);
let margin_left = parseFloat(cs.getPropertyValue("margin"));
let seq = Animation.cre... | [
"function",
"TransformTo",
"(",
"element_from",
",",
"element_to",
",",
"duration",
"=",
"500",
",",
"easing",
"=",
"Animation",
".",
"easing",
".",
"linear",
",",
"HIDE_OTHER",
")",
"{",
"let",
"rect",
"=",
"element_from",
".",
"getBoundingClientRect",
"(",
... | Transform one element from another back to itself
@alias module:wick~internals.TransformTo | [
"Transform",
"one",
"element",
"from",
"another",
"back",
"to",
"itself"
] | 139861e3696598db5b1e5c809ce36691ae61c633 | https://github.com/CandleFW/wick/blob/139861e3696598db5b1e5c809ce36691ae61c633/build/wick.node.js#L11928-L11956 |
39,575 | CandleFW/wick | build/wick.node.js | CreateHTMLNode | function CreateHTMLNode(tag) {
//jump table.
switch (tag[0]) {
case "w":
switch (tag) {
case "w-s":
return new SourceNode$1(); //This node is used to
case "w-c":
return new SourceTemplateNode$1(); //This node is used to... | javascript | function CreateHTMLNode(tag) {
//jump table.
switch (tag[0]) {
case "w":
switch (tag) {
case "w-s":
return new SourceNode$1(); //This node is used to
case "w-c":
return new SourceTemplateNode$1(); //This node is used to... | [
"function",
"CreateHTMLNode",
"(",
"tag",
")",
"{",
"//jump table.",
"switch",
"(",
"tag",
"[",
"0",
"]",
")",
"{",
"case",
"\"w\"",
":",
"switch",
"(",
"tag",
")",
"{",
"case",
"\"w-s\"",
":",
"return",
"new",
"SourceNode$1",
"(",
")",
";",
"//This no... | Since all nodes extend the RootNode, this needs to be declared here to prevent module cycles. | [
"Since",
"all",
"nodes",
"extend",
"the",
"RootNode",
"this",
"needs",
"to",
"be",
"declared",
"here",
"to",
"prevent",
"module",
"cycles",
"."
] | 139861e3696598db5b1e5c809ce36691ae61c633 | https://github.com/CandleFW/wick/blob/139861e3696598db5b1e5c809ce36691ae61c633/build/wick.node.js#L13092-L13121 |
39,576 | CandleFW/wick | build/wick.node.js | CompileSource | function CompileSource(SourcePackage, presets, element, url, win = window) {
let lex;
if (element instanceof whind$1.constructor) {
lex = element;
} else if (typeof(element) == "string")
lex = whind$1(element);
else if (element instanceof EL) {
if (element.tagName == "TEMPLATE") ... | javascript | function CompileSource(SourcePackage, presets, element, url, win = window) {
let lex;
if (element instanceof whind$1.constructor) {
lex = element;
} else if (typeof(element) == "string")
lex = whind$1(element);
else if (element instanceof EL) {
if (element.tagName == "TEMPLATE") ... | [
"function",
"CompileSource",
"(",
"SourcePackage",
",",
"presets",
",",
"element",
",",
"url",
",",
"win",
"=",
"window",
")",
"{",
"let",
"lex",
";",
"if",
"(",
"element",
"instanceof",
"whind$1",
".",
"constructor",
")",
"{",
"lex",
"=",
"element",
";"... | Compiles an object graph based input into a SourcePackage.
@param {SourcePackage} SourcePackage The source package
@param {Presets} presets The global Presets instance
@param {HTMLElement | Lexer | string} element The element
@memberof module:wick~internals.templateCompiler
@alias Co... | [
"Compiles",
"an",
"object",
"graph",
"based",
"input",
"into",
"a",
"SourcePackage",
"."
] | 139861e3696598db5b1e5c809ce36691ae61c633 | https://github.com/CandleFW/wick/blob/139861e3696598db5b1e5c809ce36691ae61c633/build/wick.node.js#L13267-L13286 |
39,577 | wikimedia/web-html-stream | lib/cssSelectorParser.js | parseCSSSelector | function parseCSSSelector(selector) {
const match = SELECTOR_RE.exec(selector);
if (!match) {
throw new Error("Unsupported or invalid CSS selector: " + selector);
}
const res = { nodeName: match[1].trim() };
if (match[2]) {
const attr = [match[2]];
if (match[3]) { attr.push(m... | javascript | function parseCSSSelector(selector) {
const match = SELECTOR_RE.exec(selector);
if (!match) {
throw new Error("Unsupported or invalid CSS selector: " + selector);
}
const res = { nodeName: match[1].trim() };
if (match[2]) {
const attr = [match[2]];
if (match[3]) { attr.push(m... | [
"function",
"parseCSSSelector",
"(",
"selector",
")",
"{",
"const",
"match",
"=",
"SELECTOR_RE",
".",
"exec",
"(",
"selector",
")",
";",
"if",
"(",
"!",
"match",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Unsupported or invalid CSS selector: \"",
"+",
"selecto... | Simple CSS selector parser.
Limitations:
- Only supports single attribute selector. | [
"Simple",
"CSS",
"selector",
"parser",
"."
] | 21a42a0dc6769dfbb8e9430ae41c323512bb762b | https://github.com/wikimedia/web-html-stream/blob/21a42a0dc6769dfbb8e9430ae41c323512bb762b/lib/cssSelectorParser.js#L21-L39 |
39,578 | patrick-steele-idem/events-light | src/index.js | function(type, listener) {
checkListener(listener);
var events = this.$e;
var listeners;
if (events && (listeners = events[type])) {
if (isFunction(listeners)) {
if (listeners === listener) {
delete events[type];
}
... | javascript | function(type, listener) {
checkListener(listener);
var events = this.$e;
var listeners;
if (events && (listeners = events[type])) {
if (isFunction(listeners)) {
if (listeners === listener) {
delete events[type];
}
... | [
"function",
"(",
"type",
",",
"listener",
")",
"{",
"checkListener",
"(",
"listener",
")",
";",
"var",
"events",
"=",
"this",
".",
"$e",
";",
"var",
"listeners",
";",
"if",
"(",
"events",
"&&",
"(",
"listeners",
"=",
"events",
"[",
"type",
"]",
")",
... | emits a 'removeListener' event iff the listener was removed | [
"emits",
"a",
"removeListener",
"event",
"iff",
"the",
"listener",
"was",
"removed"
] | eb1081346caf33f0f4c6f66e2d988984d379d40c | https://github.com/patrick-steele-idem/events-light/blob/eb1081346caf33f0f4c6f66e2d988984d379d40c/src/index.js#L129-L150 | |
39,579 | imwtr/find-free-port-sync | find-free-port-sync.js | FindFreePortSync | function FindFreePortSync(options = {}) {
this.defaultOptions = {
// port start for scan
start: 1,
// port end for scan
end: 65534,
// ports number for scan
num: 1,
// specify ip for scan
ip: '0.0.0.0|127.0.0.1',
// for inner usage, some platfo... | javascript | function FindFreePortSync(options = {}) {
this.defaultOptions = {
// port start for scan
start: 1,
// port end for scan
end: 65534,
// ports number for scan
num: 1,
// specify ip for scan
ip: '0.0.0.0|127.0.0.1',
// for inner usage, some platfo... | [
"function",
"FindFreePortSync",
"(",
"options",
"=",
"{",
"}",
")",
"{",
"this",
".",
"defaultOptions",
"=",
"{",
"// port start for scan",
"start",
":",
"1",
",",
"// port end for scan",
"end",
":",
"65534",
",",
"// ports number for scan",
"num",
":",
"1",
"... | Finding free port synchronously
@param {Object} options [description] | [
"Finding",
"free",
"port",
"synchronously"
] | 6eb36867d80072cf4b20b1d5a878ab02170b6198 | https://github.com/imwtr/find-free-port-sync/blob/6eb36867d80072cf4b20b1d5a878ab02170b6198/find-free-port-sync.js#L8-L29 |
39,580 | base/base-generators | index.js | function(name, val, options) {
debug('.generator', name, val);
if (this.hasGenerator(name)) {
return this.getGenerator(name);
}
this.setGenerator.apply(this, arguments);
return this.getGenerator(name);
} | javascript | function(name, val, options) {
debug('.generator', name, val);
if (this.hasGenerator(name)) {
return this.getGenerator(name);
}
this.setGenerator.apply(this, arguments);
return this.getGenerator(name);
} | [
"function",
"(",
"name",
",",
"val",
",",
"options",
")",
"{",
"debug",
"(",
"'.generator'",
",",
"name",
",",
"val",
")",
";",
"if",
"(",
"this",
".",
"hasGenerator",
"(",
"name",
")",
")",
"{",
"return",
"this",
".",
"getGenerator",
"(",
"name",
... | Get and invoke generator `name`, or register generator `name` with
the given `val` and `options`, then invoke and return the generator
instance. This method differs from `.register`, which lazily invokes
generator functions when `.generate` is called.
```js
app.generator('foo', function(app, base, env, options) {
// "... | [
"Get",
"and",
"invoke",
"generator",
"name",
"or",
"register",
"generator",
"name",
"with",
"the",
"given",
"val",
"and",
"options",
"then",
"invoke",
"and",
"return",
"the",
"generator",
"instance",
".",
"This",
"method",
"differs",
"from",
".",
"register",
... | 9a741117b80ed19b281177169c0f98059cb97c90 | https://github.com/base/base-generators/blob/9a741117b80ed19b281177169c0f98059cb97c90/index.js#L85-L94 | |
39,581 | base/base-generators | index.js | function(name, val, options) {
debug('.setGenerator', name);
if (this.hasGenerator(name)) {
return this.findGenerator(name);
}
// ensure local sub-generator paths are resolved
if (typeof val === 'string' && val.charAt(0) === '.' && this.env) {
val = path.res... | javascript | function(name, val, options) {
debug('.setGenerator', name);
if (this.hasGenerator(name)) {
return this.findGenerator(name);
}
// ensure local sub-generator paths are resolved
if (typeof val === 'string' && val.charAt(0) === '.' && this.env) {
val = path.res... | [
"function",
"(",
"name",
",",
"val",
",",
"options",
")",
"{",
"debug",
"(",
"'.setGenerator'",
",",
"name",
")",
";",
"if",
"(",
"this",
".",
"hasGenerator",
"(",
"name",
")",
")",
"{",
"return",
"this",
".",
"findGenerator",
"(",
"name",
")",
";",
... | Store a generator by file path or instance with the given
`name` and `options`.
```js
app.setGenerator('foo', function(app, base) {
// "app" - private instance created for generator "foo"
// "base" - instance shared by all generators
// "env" - environment object for the generator
// "options" - options passed to the ... | [
"Store",
"a",
"generator",
"by",
"file",
"path",
"or",
"instance",
"with",
"the",
"given",
"name",
"and",
"options",
"."
] | 9a741117b80ed19b281177169c0f98059cb97c90 | https://github.com/base/base-generators/blob/9a741117b80ed19b281177169c0f98059cb97c90/index.js#L116-L129 | |
39,582 | base/base-generators | index.js | fn | function fn(name, options) {
debug('.findGenerator', name);
if (utils.isObject(name)) {
return name;
}
if (Array.isArray(name)) {
name = name.join('.');
}
if (typeof name !== 'string') {
throw new TypeError('expected name to be a string');
... | javascript | function fn(name, options) {
debug('.findGenerator', name);
if (utils.isObject(name)) {
return name;
}
if (Array.isArray(name)) {
name = name.join('.');
}
if (typeof name !== 'string') {
throw new TypeError('expected name to be a string');
... | [
"function",
"fn",
"(",
"name",
",",
"options",
")",
"{",
"debug",
"(",
"'.findGenerator'",
",",
"name",
")",
";",
"if",
"(",
"utils",
".",
"isObject",
"(",
"name",
")",
")",
"{",
"return",
"name",
";",
"}",
"if",
"(",
"Array",
".",
"isArray",
"(",
... | Find generator `name`, by first searching the cache, then searching the
cache of the `base` generator. Use this to get a generator without invoking it.
```js
// search by "alias"
var foo = app.findGenerator('foo');
// search by "full name"
var foo = app.findGenerator('generate-foo');
```
@name .findGenerator
@param {... | [
"Find",
"generator",
"name",
"by",
"first",
"searching",
"the",
"cache",
"then",
"searching",
"the",
"cache",
"of",
"the",
"base",
"generator",
".",
"Use",
"this",
"to",
"get",
"a",
"generator",
"without",
"invoking",
"it",
"."
] | 9a741117b80ed19b281177169c0f98059cb97c90 | https://github.com/base/base-generators/blob/9a741117b80ed19b281177169c0f98059cb97c90/index.js#L179-L222 |
39,583 | base/base-generators | index.js | function(name, options) {
if (this.generators.hasOwnProperty(name)) {
return this.generators[name];
}
if (~name.indexOf('.')) {
return this.getSubGenerator.apply(this, arguments);
}
var opts = utils.extend({}, this.options, options);
if (typeof opts.... | javascript | function(name, options) {
if (this.generators.hasOwnProperty(name)) {
return this.generators[name];
}
if (~name.indexOf('.')) {
return this.getSubGenerator.apply(this, arguments);
}
var opts = utils.extend({}, this.options, options);
if (typeof opts.... | [
"function",
"(",
"name",
",",
"options",
")",
"{",
"if",
"(",
"this",
".",
"generators",
".",
"hasOwnProperty",
"(",
"name",
")",
")",
"{",
"return",
"this",
".",
"generators",
"[",
"name",
"]",
";",
"}",
"if",
"(",
"~",
"name",
".",
"indexOf",
"("... | Private method used by `.findGenerator`. | [
"Private",
"method",
"used",
"by",
".",
"findGenerator",
"."
] | 9a741117b80ed19b281177169c0f98059cb97c90 | https://github.com/base/base-generators/blob/9a741117b80ed19b281177169c0f98059cb97c90/index.js#L228-L245 | |
39,584 | base/base-generators | index.js | function(name, options) {
debug('.getSubGenerator', name);
var segs = name.split('.');
var len = segs.length;
var idx = -1;
var app = this;
while (++idx < len) {
var key = segs[idx];
app = app.getGenerator(key, options);
if (!app) {
... | javascript | function(name, options) {
debug('.getSubGenerator', name);
var segs = name.split('.');
var len = segs.length;
var idx = -1;
var app = this;
while (++idx < len) {
var key = segs[idx];
app = app.getGenerator(key, options);
if (!app) {
... | [
"function",
"(",
"name",
",",
"options",
")",
"{",
"debug",
"(",
"'.getSubGenerator'",
",",
"name",
")",
";",
"var",
"segs",
"=",
"name",
".",
"split",
"(",
"'.'",
")",
";",
"var",
"len",
"=",
"segs",
".",
"length",
";",
"var",
"idx",
"=",
"-",
"... | Get sub-generator `name`, optionally using dot-notation for nested generators.
```js
app.getSubGenerator('foo.bar.baz');
```
@name .getSubGenerator
@param {String} `name` The property-path of the generator to get
@param {Object} `options`
@api public | [
"Get",
"sub",
"-",
"generator",
"name",
"optionally",
"using",
"dot",
"-",
"notation",
"for",
"nested",
"generators",
"."
] | 9a741117b80ed19b281177169c0f98059cb97c90 | https://github.com/base/base-generators/blob/9a741117b80ed19b281177169c0f98059cb97c90/index.js#L259-L274 | |
39,585 | base/base-generators | index.js | function(name, options, fn) {
debug('.lookupGenerator', name);
if (typeof options === 'function') {
fn = options;
options = {};
}
if (typeof fn !== 'function') {
throw new TypeError('expected `fn` to be a lookup function');
}
options = opti... | javascript | function(name, options, fn) {
debug('.lookupGenerator', name);
if (typeof options === 'function') {
fn = options;
options = {};
}
if (typeof fn !== 'function') {
throw new TypeError('expected `fn` to be a lookup function');
}
options = opti... | [
"function",
"(",
"name",
",",
"options",
",",
"fn",
")",
"{",
"debug",
"(",
"'.lookupGenerator'",
",",
"name",
")",
";",
"if",
"(",
"typeof",
"options",
"===",
"'function'",
")",
"{",
"fn",
"=",
"options",
";",
"options",
"=",
"{",
"}",
";",
"}",
"... | Tries to find a registered generator that matches `name`
by iterating over the `generators` object, and doing a strict
comparison of each name returned by the given lookup `fn`.
The lookup function receives `name` and must return an array
of names to use for the lookup.
For example, if the lookup `name` is `foo`, the ... | [
"Tries",
"to",
"find",
"a",
"registered",
"generator",
"that",
"matches",
"name",
"by",
"iterating",
"over",
"the",
"generators",
"object",
"and",
"doing",
"a",
"strict",
"comparison",
"of",
"each",
"name",
"returned",
"by",
"the",
"given",
"lookup",
"fn",
"... | 9a741117b80ed19b281177169c0f98059cb97c90 | https://github.com/base/base-generators/blob/9a741117b80ed19b281177169c0f98059cb97c90/index.js#L329-L361 | |
39,586 | base/base-generators | index.js | function(name, options) {
if (typeof name === 'function') {
this.use(name, options);
return this;
}
if (Array.isArray(name)) {
var len = name.length;
var idx = -1;
while (++idx < len) {
this.extendWith(name[idx], options);
... | javascript | function(name, options) {
if (typeof name === 'function') {
this.use(name, options);
return this;
}
if (Array.isArray(name)) {
var len = name.length;
var idx = -1;
while (++idx < len) {
this.extendWith(name[idx], options);
... | [
"function",
"(",
"name",
",",
"options",
")",
"{",
"if",
"(",
"typeof",
"name",
"===",
"'function'",
")",
"{",
"this",
".",
"use",
"(",
"name",
",",
"options",
")",
";",
"return",
"this",
";",
"}",
"if",
"(",
"Array",
".",
"isArray",
"(",
"name",
... | Extend the generator instance with settings and features
of another generator.
```js
var foo = base.generator('foo');
app.extendWith(foo);
// or
app.extendWith('foo');
// or
app.extendWith(['foo', 'bar', 'baz']);
app.extendWith(require('generate-defaults'));
```
@name .extendWith
@param {String|Object} `app`
@return... | [
"Extend",
"the",
"generator",
"instance",
"with",
"settings",
"and",
"features",
"of",
"another",
"generator",
"."
] | 9a741117b80ed19b281177169c0f98059cb97c90 | https://github.com/base/base-generators/blob/9a741117b80ed19b281177169c0f98059cb97c90/index.js#L384-L419 | |
39,587 | base/base-generators | index.js | function(name, options) {
if (typeof options === 'function') {
return options(name);
}
if (options && typeof options.toAlias === 'function') {
return options.toAlias(name);
}
if (typeof app.options.toAlias === 'function') {
return app.options.toAlias... | javascript | function(name, options) {
if (typeof options === 'function') {
return options(name);
}
if (options && typeof options.toAlias === 'function') {
return options.toAlias(name);
}
if (typeof app.options.toAlias === 'function') {
return app.options.toAlias... | [
"function",
"(",
"name",
",",
"options",
")",
"{",
"if",
"(",
"typeof",
"options",
"===",
"'function'",
")",
"{",
"return",
"options",
"(",
"name",
")",
";",
"}",
"if",
"(",
"options",
"&&",
"typeof",
"options",
".",
"toAlias",
"===",
"'function'",
")"... | Create a generator alias from the given `name`. By default the alias
is the string after the last dash. Or the whole string if no dash exists.
```js
var camelcase = require('camel-case');
var alias = app.toAlias('foo-bar-baz');
//=> 'baz'
// custom `toAlias` function
app.option('toAlias', function(name) {
return came... | [
"Create",
"a",
"generator",
"alias",
"from",
"the",
"given",
"name",
".",
"By",
"default",
"the",
"alias",
"is",
"the",
"string",
"after",
"the",
"last",
"dash",
".",
"Or",
"the",
"whole",
"string",
"if",
"no",
"dash",
"exists",
"."
] | 9a741117b80ed19b281177169c0f98059cb97c90 | https://github.com/base/base-generators/blob/9a741117b80ed19b281177169c0f98059cb97c90/index.js#L554-L565 | |
39,588 | jonschlinkert/lang-map | index.js | map | function map() {
var cache = {};
if (!cache.extensions) cache.extensions = require('./lib/exts.json');
if (!cache.languages) cache.languages = require('./lib/lang.json');
return cache;
} | javascript | function map() {
var cache = {};
if (!cache.extensions) cache.extensions = require('./lib/exts.json');
if (!cache.languages) cache.languages = require('./lib/lang.json');
return cache;
} | [
"function",
"map",
"(",
")",
"{",
"var",
"cache",
"=",
"{",
"}",
";",
"if",
"(",
"!",
"cache",
".",
"extensions",
")",
"cache",
".",
"extensions",
"=",
"require",
"(",
"'./lib/exts.json'",
")",
";",
"if",
"(",
"!",
"cache",
".",
"languages",
")",
"... | Lazy-load and cache extensions and languages | [
"Lazy",
"-",
"load",
"and",
"cache",
"extensions",
"and",
"languages"
] | d12ec51ffda3a4bffee9e7cfb49c1e400af145a6 | https://github.com/jonschlinkert/lang-map/blob/d12ec51ffda3a4bffee9e7cfb49c1e400af145a6/index.js#L11-L16 |
39,589 | presort/pre-toast | lib/utils/Assertions.js | isUrl | function isUrl(url, error) {
if (!Assertions.urlPattern.test(url)) {
if (error) {
throw new Error("Given url is not valid ! URL :" + url);
}
return false;
}
return true;
} | javascript | function isUrl(url, error) {
if (!Assertions.urlPattern.test(url)) {
if (error) {
throw new Error("Given url is not valid ! URL :" + url);
}
return false;
}
return true;
} | [
"function",
"isUrl",
"(",
"url",
",",
"error",
")",
"{",
"if",
"(",
"!",
"Assertions",
".",
"urlPattern",
".",
"test",
"(",
"url",
")",
")",
"{",
"if",
"(",
"error",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Given url is not valid ! URL :\"",
"+",
"ur... | Checks if the string is a valid URL.
@param {String} url string to check.
@param {boolean} error defines the return type of method. If it is true it will throw in case of error , else it will return false.
@returns {boolean} "true": is url , "false": is not url.
@throws exception if error is true and url provided is no... | [
"Checks",
"if",
"the",
"string",
"is",
"a",
"valid",
"URL",
"."
] | 0a6b329dd37cd68c70735b8703869b8c03800a71 | https://github.com/presort/pre-toast/blob/0a6b329dd37cd68c70735b8703869b8c03800a71/lib/utils/Assertions.js#L66-L74 |
39,590 | presort/pre-toast | lib/utils/Assertions.js | isReactComponent | function isReactComponent(instance, error) {
/* disable-eslint no-underscore-dangle */
if (!(instance && instance.$$typeof)) {
if (error) {
throw new Error("Given component is not a react component ! Component :" + instance);
}
... | javascript | function isReactComponent(instance, error) {
/* disable-eslint no-underscore-dangle */
if (!(instance && instance.$$typeof)) {
if (error) {
throw new Error("Given component is not a react component ! Component :" + instance);
}
... | [
"function",
"isReactComponent",
"(",
"instance",
",",
"error",
")",
"{",
"/* disable-eslint no-underscore-dangle */",
"if",
"(",
"!",
"(",
"instance",
"&&",
"instance",
".",
"$$typeof",
")",
")",
"{",
"if",
"(",
"error",
")",
"{",
"throw",
"new",
"Error",
"(... | Checks instance is React Component or not.
@param {Object} instance
@param {boolean} error
@returns {boolean} | [
"Checks",
"instance",
"is",
"React",
"Component",
"or",
"not",
"."
] | 0a6b329dd37cd68c70735b8703869b8c03800a71 | https://github.com/presort/pre-toast/blob/0a6b329dd37cd68c70735b8703869b8c03800a71/lib/utils/Assertions.js#L314-L323 |
39,591 | MaximilianBuegler/node-kinetics | src/kinetics.js | extractVerticalComponent | function extractVerticalComponent(accelerometerData, attitudeData) {
var res=[];
var rm;
for (var i=0;i<accelerometerData.length;i++){
rm=new Matrix(module.exports.composeRotation(attitudeData[i][0],attitudeData[i][1],0));
res[i]=new Matrix([accelerometerData[i][0],accel... | javascript | function extractVerticalComponent(accelerometerData, attitudeData) {
var res=[];
var rm;
for (var i=0;i<accelerometerData.length;i++){
rm=new Matrix(module.exports.composeRotation(attitudeData[i][0],attitudeData[i][1],0));
res[i]=new Matrix([accelerometerData[i][0],accel... | [
"function",
"extractVerticalComponent",
"(",
"accelerometerData",
",",
"attitudeData",
")",
"{",
"var",
"res",
"=",
"[",
"]",
";",
"var",
"rm",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"accelerometerData",
".",
"length",
";",
"i",
"++",
")... | Rotate accelerometer signal using attitude data and extract vertical component.
Useful for instance for implementing a pedometer
@param {2D array} (linear) accelerometerData 2D array containing time series of acceleration values [[x1, y1, z1],[x2, y2, z2],...]
@param {2D array} attitudeData 2D array containing time se... | [
"Rotate",
"accelerometer",
"signal",
"using",
"attitude",
"data",
"and",
"extract",
"vertical",
"component",
".",
"Useful",
"for",
"instance",
"for",
"implementing",
"a",
"pedometer"
] | fdaea742843014227e42e12bea40827b7fc3d516 | https://github.com/MaximilianBuegler/node-kinetics/blob/fdaea742843014227e42e12bea40827b7fc3d516/src/kinetics.js#L34-L42 |
39,592 | observing/mongo-query-filter | index.js | Filter | function Filter(options) {
this.options = options || {};
for (var group in operators) {
var prop = group.toLowerCase();
this[prop] = this.mask(group, this.options[prop]);
}
} | javascript | function Filter(options) {
this.options = options || {};
for (var group in operators) {
var prop = group.toLowerCase();
this[prop] = this.mask(group, this.options[prop]);
}
} | [
"function",
"Filter",
"(",
"options",
")",
"{",
"this",
".",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"for",
"(",
"var",
"group",
"in",
"operators",
")",
"{",
"var",
"prop",
"=",
"group",
".",
"toLowerCase",
"(",
")",
";",
"this",
"[",
"prop... | Strip MongoDB operators from user provided objects.
@Constructor
@param {Object} options
@api public | [
"Strip",
"MongoDB",
"operators",
"from",
"user",
"provided",
"objects",
"."
] | 32bcb4b2cbce3c84022bba449f67cc048978b52e | https://github.com/observing/mongo-query-filter/blob/32bcb4b2cbce3c84022bba449f67cc048978b52e/index.js#L12-L19 |
39,593 | worldline/easydoc | lib/easydoc.js | errorPage | function errorPage(res, err) {
if (err) {
console.error(err.message);
res.send(err, {'Content-Type': 'text/plain'}, 500);
} else {
res.send(404);
}
} | javascript | function errorPage(res, err) {
if (err) {
console.error(err.message);
res.send(err, {'Content-Type': 'text/plain'}, 500);
} else {
res.send(404);
}
} | [
"function",
"errorPage",
"(",
"res",
",",
"err",
")",
"{",
"if",
"(",
"err",
")",
"{",
"console",
".",
"error",
"(",
"err",
".",
"message",
")",
";",
"res",
".",
"send",
"(",
"err",
",",
"{",
"'Content-Type'",
":",
"'text/plain'",
"}",
",",
"500",
... | Displays an HTTP error response. If an error is provided, the error is displayed with a 500 error code, otherwise it's a empty 404 error. @param res [Object] Http response @param err [String] Error message. Facultative. | [
"Displays",
"an",
"HTTP",
"error",
"response",
".",
"If",
"an",
"error",
"is",
"provided",
"the",
"error",
"is",
"displayed",
"with",
"a",
"500",
"error",
"code",
"otherwise",
"it",
"s",
"a",
"empty",
"404",
"error",
"."
] | c055d5aa99be460fef38ac629909ea4a653aaaaf | https://github.com/worldline/easydoc/blob/c055d5aa99be460fef38ac629909ea4a653aaaaf/lib/easydoc.js#L61-L68 |
39,594 | worldline/easydoc | lib/easydoc.js | compileAndRender | function compileAndRender(templatePath, content, callback) {
if (templatePath in templates) {
return callback(null, templates[templatePath].render(content));
}
fs.readFile(templatePath, 'utf8', function(err, template) {
if (err) {
return callback(err)
}
templates[templatePath] = hogan.compile(temp... | javascript | function compileAndRender(templatePath, content, callback) {
if (templatePath in templates) {
return callback(null, templates[templatePath].render(content));
}
fs.readFile(templatePath, 'utf8', function(err, template) {
if (err) {
return callback(err)
}
templates[templatePath] = hogan.compile(temp... | [
"function",
"compileAndRender",
"(",
"templatePath",
",",
"content",
",",
"callback",
")",
"{",
"if",
"(",
"templatePath",
"in",
"templates",
")",
"{",
"return",
"callback",
"(",
"null",
",",
"templates",
"[",
"templatePath",
"]",
".",
"render",
"(",
"conten... | Render a given template with appropriate content. Use cached pre-compiled template if possible, and populate cache for new templates. @param templatePath [String] path to rendered template, used as key in cache @param content [Object] object used to be rendered inside the template @param callback [Function] end proces... | [
"Render",
"a",
"given",
"template",
"with",
"appropriate",
"content",
".",
"Use",
"cached",
"pre",
"-",
"compiled",
"template",
"if",
"possible",
"and",
"populate",
"cache",
"for",
"new",
"templates",
"."
] | c055d5aa99be460fef38ac629909ea4a653aaaaf | https://github.com/worldline/easydoc/blob/c055d5aa99be460fef38ac629909ea4a653aaaaf/lib/easydoc.js#L78-L89 |
39,595 | worldline/easydoc | lib/easydoc.js | search | function search(searched, callback) {
var root = pathUtils.resolve(options.root);
// search command is platform dependant: use grep on linux, and findstr on windaube.
var command = os.platform() === 'win32' ?
'findstr /spin /c:"'+searched+'" '+ pathUtils.join(root, '*.*') :
'grep -rin "'+searched+'" '+root... | javascript | function search(searched, callback) {
var root = pathUtils.resolve(options.root);
// search command is platform dependant: use grep on linux, and findstr on windaube.
var command = os.platform() === 'win32' ?
'findstr /spin /c:"'+searched+'" '+ pathUtils.join(root, '*.*') :
'grep -rin "'+searched+'" '+root... | [
"function",
"search",
"(",
"searched",
",",
"callback",
")",
"{",
"var",
"root",
"=",
"pathUtils",
".",
"resolve",
"(",
"options",
".",
"root",
")",
";",
"// search command is platform dependant: use grep on linux, and findstr on windaube.",
"var",
"command",
"=",
"os... | Performs a local-drive search by executing an os-specific command. Uses grep on linux, and findstr on windaube. @param callback [Function] A callback function that will received following arguments: @option callback err [String] an error if somthing goes wrong, null otherwise @option callback results [Array] an array ... | [
"Performs",
"a",
"local",
"-",
"drive",
"search",
"by",
"executing",
"an",
"os",
"-",
"specific",
"command",
".",
"Uses",
"grep",
"on",
"linux",
"and",
"findstr",
"on",
"windaube",
"."
] | c055d5aa99be460fef38ac629909ea4a653aaaaf | https://github.com/worldline/easydoc/blob/c055d5aa99be460fef38ac629909ea4a653aaaaf/lib/easydoc.js#L162-L213 |
39,596 | adrai/node-cqs | lib/domain/bases/commandHandlerBase.js | function(aggregate, vm, callback) {
if(aggregate.get('destroyed')) {
var reason = {
name: 'AggregateDestroyed',
message: 'Aggregate has already been destroyed!',
aggregateRevision: aggregate.get('revision'),
... | javascript | function(aggregate, vm, callback) {
if(aggregate.get('destroyed')) {
var reason = {
name: 'AggregateDestroyed',
message: 'Aggregate has already been destroyed!',
aggregateRevision: aggregate.get('revision'),
... | [
"function",
"(",
"aggregate",
",",
"vm",
",",
"callback",
")",
"{",
"if",
"(",
"aggregate",
".",
"get",
"(",
"'destroyed'",
")",
")",
"{",
"var",
"reason",
"=",
"{",
"name",
":",
"'AggregateDestroyed'",
",",
"message",
":",
"'Aggregate has already been destr... | reject command if aggregate has already been destroyed | [
"reject",
"command",
"if",
"aggregate",
"has",
"already",
"been",
"destroyed"
] | 1691670a6e35d0b20904a5bd1b74adbe92f496eb | https://github.com/adrai/node-cqs/blob/1691670a6e35d0b20904a5bd1b74adbe92f496eb/lib/domain/bases/commandHandlerBase.js#L33-L45 | |
39,597 | adrai/node-cqs | lib/domain/bases/commandHandlerBase.js | function(aggregate, vm, callback) {
self.validate(cmd.command, cmd.payload, function(err) {
callback(err, aggregate, vm);
});
} | javascript | function(aggregate, vm, callback) {
self.validate(cmd.command, cmd.payload, function(err) {
callback(err, aggregate, vm);
});
} | [
"function",
"(",
"aggregate",
",",
"vm",
",",
"callback",
")",
"{",
"self",
".",
"validate",
"(",
"cmd",
".",
"command",
",",
"cmd",
".",
"payload",
",",
"function",
"(",
"err",
")",
"{",
"callback",
"(",
"err",
",",
"aggregate",
",",
"vm",
")",
";... | call validate command | [
"call",
"validate",
"command"
] | 1691670a6e35d0b20904a5bd1b74adbe92f496eb | https://github.com/adrai/node-cqs/blob/1691670a6e35d0b20904a5bd1b74adbe92f496eb/lib/domain/bases/commandHandlerBase.js#L55-L59 | |
39,598 | adrai/node-cqs | lib/domain/bases/commandHandlerBase.js | function(aggregate, vm, callback) {
aggregate[cmd.command](cmd.payload, function(err) {
callback(err, aggregate, vm);
});
} | javascript | function(aggregate, vm, callback) {
aggregate[cmd.command](cmd.payload, function(err) {
callback(err, aggregate, vm);
});
} | [
"function",
"(",
"aggregate",
",",
"vm",
",",
"callback",
")",
"{",
"aggregate",
"[",
"cmd",
".",
"command",
"]",
"(",
"cmd",
".",
"payload",
",",
"function",
"(",
"err",
")",
"{",
"callback",
"(",
"err",
",",
"aggregate",
",",
"vm",
")",
";",
"}",... | call command function on aggregate | [
"call",
"command",
"function",
"on",
"aggregate"
] | 1691670a6e35d0b20904a5bd1b74adbe92f496eb | https://github.com/adrai/node-cqs/blob/1691670a6e35d0b20904a5bd1b74adbe92f496eb/lib/domain/bases/commandHandlerBase.js#L62-L66 | |
39,599 | adrai/node-cqs | lib/domain/bases/commandHandlerBase.js | function(aggregate, vm, callback) {
vm.set(aggregate.toJSON());
self.commit(vm, function(err) {
callback(err, aggregate, cmd);
});
} | javascript | function(aggregate, vm, callback) {
vm.set(aggregate.toJSON());
self.commit(vm, function(err) {
callback(err, aggregate, cmd);
});
} | [
"function",
"(",
"aggregate",
",",
"vm",
",",
"callback",
")",
"{",
"vm",
".",
"set",
"(",
"aggregate",
".",
"toJSON",
"(",
")",
")",
";",
"self",
".",
"commit",
"(",
"vm",
",",
"function",
"(",
"err",
")",
"{",
"callback",
"(",
"err",
",",
"aggr... | commit the new events | [
"commit",
"the",
"new",
"events"
] | 1691670a6e35d0b20904a5bd1b74adbe92f496eb | https://github.com/adrai/node-cqs/blob/1691670a6e35d0b20904a5bd1b74adbe92f496eb/lib/domain/bases/commandHandlerBase.js#L69-L74 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.