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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
moay/afterglow | vendor/videojs/video.js | ErrorDisplay | function ErrorDisplay(player, options) {
_classCallCheck(this, ErrorDisplay);
var _this = _possibleConstructorReturn(this, _ModalDialog.call(this, player, options));
_this.on(player, 'error', _this.open);
return _this;
} | javascript | function ErrorDisplay(player, options) {
_classCallCheck(this, ErrorDisplay);
var _this = _possibleConstructorReturn(this, _ModalDialog.call(this, player, options));
_this.on(player, 'error', _this.open);
return _this;
} | [
"function",
"ErrorDisplay",
"(",
"player",
",",
"options",
")",
"{",
"_classCallCheck",
"(",
"this",
",",
"ErrorDisplay",
")",
";",
"var",
"_this",
"=",
"_possibleConstructorReturn",
"(",
"this",
",",
"_ModalDialog",
".",
"call",
"(",
"this",
",",
"player",
... | Constructor for error display modal.
@param {Player} player
@param {Object} [options] | [
"Constructor",
"for",
"error",
"display",
"modal",
"."
] | a7fbc889a18188147fcd8418c5d3bb801608b9a7 | https://github.com/moay/afterglow/blob/a7fbc889a18188147fcd8418c5d3bb801608b9a7/vendor/videojs/video.js#L6060-L6067 | train |
moay/afterglow | vendor/videojs/video.js | ModalDialog | function ModalDialog(player, options) {
_classCallCheck(this, ModalDialog);
var _this = _possibleConstructorReturn(this, _Component.call(this, player, options));
_this.opened_ = _this.hasBeenOpened_ = _this.hasBeenFilled_ = false;
_this.closeable(!_this.options_.uncloseable);
_this.content(_this.... | javascript | function ModalDialog(player, options) {
_classCallCheck(this, ModalDialog);
var _this = _possibleConstructorReturn(this, _Component.call(this, player, options));
_this.opened_ = _this.hasBeenOpened_ = _this.hasBeenFilled_ = false;
_this.closeable(!_this.options_.uncloseable);
_this.content(_this.... | [
"function",
"ModalDialog",
"(",
"player",
",",
"options",
")",
"{",
"_classCallCheck",
"(",
"this",
",",
"ModalDialog",
")",
";",
"var",
"_this",
"=",
"_possibleConstructorReturn",
"(",
"this",
",",
"_Component",
".",
"call",
"(",
"this",
",",
"player",
",",... | Constructor for modals.
@param {Player} player
@param {Object} [options]
@param {Mixed} [options.content=undefined]
Provide customized content for this modal.
@param {String} [options.description]
A text description for the modal, primarily for accessibility.
@param {Boolean} [options.fillAlways=false]
Normally... | [
"Constructor",
"for",
"modals",
"."
] | a7fbc889a18188147fcd8418c5d3bb801608b9a7 | https://github.com/moay/afterglow/blob/a7fbc889a18188147fcd8418c5d3bb801608b9a7/vendor/videojs/video.js#L7208-L7236 | train |
moay/afterglow | vendor/videojs/video.js | loadTrack | function loadTrack(src, track) {
var opts = {
uri: src
};
var crossOrigin = (0, _url.isCrossOrigin)(src);
if (crossOrigin) {
opts.cors = crossOrigin;
}
(0, _xhr2['default'])(opts, Fn.bind(this, function (err, response, responseBody) {
if (err) {
return _log2['default'].error(err, respons... | javascript | function loadTrack(src, track) {
var opts = {
uri: src
};
var crossOrigin = (0, _url.isCrossOrigin)(src);
if (crossOrigin) {
opts.cors = crossOrigin;
}
(0, _xhr2['default'])(opts, Fn.bind(this, function (err, response, responseBody) {
if (err) {
return _log2['default'].error(err, respons... | [
"function",
"loadTrack",
"(",
"src",
",",
"track",
")",
"{",
"var",
"opts",
"=",
"{",
"uri",
":",
"src",
"}",
";",
"var",
"crossOrigin",
"=",
"(",
"0",
",",
"_url",
".",
"isCrossOrigin",
")",
"(",
"src",
")",
";",
"if",
"(",
"crossOrigin",
")",
"... | load a track from a specifed url
@param {String} src url to load track from
@param {Track} track track to addcues to | [
"load",
"a",
"track",
"from",
"a",
"specifed",
"url"
] | a7fbc889a18188147fcd8418c5d3bb801608b9a7 | https://github.com/moay/afterglow/blob/a7fbc889a18188147fcd8418c5d3bb801608b9a7/vendor/videojs/video.js#L16462-L16499 | train |
moay/afterglow | vendor/videojs/video.js | bufferedPercent | function bufferedPercent(buffered, duration) {
var bufferedDuration = 0;
var start = void 0;
var end = void 0;
if (!duration) {
return 0;
}
if (!buffered || !buffered.length) {
buffered = (0, _timeRanges.createTimeRange)(0, 0);
}
for (var i = 0; i < buffered.length; i++) {
start = buffere... | javascript | function bufferedPercent(buffered, duration) {
var bufferedDuration = 0;
var start = void 0;
var end = void 0;
if (!duration) {
return 0;
}
if (!buffered || !buffered.length) {
buffered = (0, _timeRanges.createTimeRange)(0, 0);
}
for (var i = 0; i < buffered.length; i++) {
start = buffere... | [
"function",
"bufferedPercent",
"(",
"buffered",
",",
"duration",
")",
"{",
"var",
"bufferedDuration",
"=",
"0",
";",
"var",
"start",
"=",
"void",
"0",
";",
"var",
"end",
"=",
"void",
"0",
";",
"if",
"(",
"!",
"duration",
")",
"{",
"return",
"0",
";",... | Compute how much your video has been buffered
@param {Object} Buffered object
@param {Number} Total duration
@return {Number} Percent buffered of the total duration
@private
@function bufferedPercent | [
"Compute",
"how",
"much",
"your",
"video",
"has",
"been",
"buffered"
] | a7fbc889a18188147fcd8418c5d3bb801608b9a7 | https://github.com/moay/afterglow/blob/a7fbc889a18188147fcd8418c5d3bb801608b9a7/vendor/videojs/video.js#L17469-L17495 | train |
moay/afterglow | vendor/videojs/video.js | createEl | function createEl() {
var tagName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'div';
var properties = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var attributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var el = _document2['d... | javascript | function createEl() {
var tagName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'div';
var properties = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var attributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var el = _document2['d... | [
"function",
"createEl",
"(",
")",
"{",
"var",
"tagName",
"=",
"arguments",
".",
"length",
">",
"0",
"&&",
"arguments",
"[",
"0",
"]",
"!==",
"undefined",
"?",
"arguments",
"[",
"0",
"]",
":",
"'div'",
";",
"var",
"properties",
"=",
"arguments",
".",
... | Creates an element and applies properties.
@param {String} [tagName='div'] Name of tag to be created.
@param {Object} [properties={}] Element properties to be applied.
@param {Object} [attributes={}] Element attributes to be applied.
@return {Element}
@function createEl | [
"Creates",
"an",
"element",
"and",
"applies",
"properties",
"."
] | a7fbc889a18188147fcd8418c5d3bb801608b9a7 | https://github.com/moay/afterglow/blob/a7fbc889a18188147fcd8418c5d3bb801608b9a7/vendor/videojs/video.js#L17654-L17680 | train |
moay/afterglow | vendor/videojs/video.js | textContent | function textContent(el, text) {
if (typeof el.textContent === 'undefined') {
el.innerText = text;
} else {
el.textContent = text;
}
} | javascript | function textContent(el, text) {
if (typeof el.textContent === 'undefined') {
el.innerText = text;
} else {
el.textContent = text;
}
} | [
"function",
"textContent",
"(",
"el",
",",
"text",
")",
"{",
"if",
"(",
"typeof",
"el",
".",
"textContent",
"===",
"'undefined'",
")",
"{",
"el",
".",
"innerText",
"=",
"text",
";",
"}",
"else",
"{",
"el",
".",
"textContent",
"=",
"text",
";",
"}",
... | Injects text into an element, replacing any existing contents entirely.
@param {Element} el
@param {String} text
@return {Element}
@function textContent | [
"Injects",
"text",
"into",
"an",
"element",
"replacing",
"any",
"existing",
"contents",
"entirely",
"."
] | a7fbc889a18188147fcd8418c5d3bb801608b9a7 | https://github.com/moay/afterglow/blob/a7fbc889a18188147fcd8418c5d3bb801608b9a7/vendor/videojs/video.js#L17690-L17696 | train |
moay/afterglow | vendor/videojs/video.js | insertElFirst | function insertElFirst(child, parent) {
if (parent.firstChild) {
parent.insertBefore(child, parent.firstChild);
} else {
parent.appendChild(child);
}
} | javascript | function insertElFirst(child, parent) {
if (parent.firstChild) {
parent.insertBefore(child, parent.firstChild);
} else {
parent.appendChild(child);
}
} | [
"function",
"insertElFirst",
"(",
"child",
",",
"parent",
")",
"{",
"if",
"(",
"parent",
".",
"firstChild",
")",
"{",
"parent",
".",
"insertBefore",
"(",
"child",
",",
"parent",
".",
"firstChild",
")",
";",
"}",
"else",
"{",
"parent",
".",
"appendChild",... | Insert an element as the first child node of another
@param {Element} child Element to insert
@param {Element} parent Element to insert child into
@private
@function insertElFirst | [
"Insert",
"an",
"element",
"as",
"the",
"first",
"child",
"node",
"of",
"another"
] | a7fbc889a18188147fcd8418c5d3bb801608b9a7 | https://github.com/moay/afterglow/blob/a7fbc889a18188147fcd8418c5d3bb801608b9a7/vendor/videojs/video.js#L17706-L17712 | train |
moay/afterglow | vendor/videojs/video.js | getElData | function getElData(el) {
var id = el[elIdAttr];
if (!id) {
id = el[elIdAttr] = Guid.newGUID();
}
if (!elData[id]) {
elData[id] = {};
}
return elData[id];
} | javascript | function getElData(el) {
var id = el[elIdAttr];
if (!id) {
id = el[elIdAttr] = Guid.newGUID();
}
if (!elData[id]) {
elData[id] = {};
}
return elData[id];
} | [
"function",
"getElData",
"(",
"el",
")",
"{",
"var",
"id",
"=",
"el",
"[",
"elIdAttr",
"]",
";",
"if",
"(",
"!",
"id",
")",
"{",
"id",
"=",
"el",
"[",
"elIdAttr",
"]",
"=",
"Guid",
".",
"newGUID",
"(",
")",
";",
"}",
"if",
"(",
"!",
"elData",... | Returns the cache object where data for an element is stored
@param {Element} el Element to store data for.
@return {Object}
@function getElData | [
"Returns",
"the",
"cache",
"object",
"where",
"data",
"for",
"an",
"element",
"is",
"stored"
] | a7fbc889a18188147fcd8418c5d3bb801608b9a7 | https://github.com/moay/afterglow/blob/a7fbc889a18188147fcd8418c5d3bb801608b9a7/vendor/videojs/video.js#L17740-L17752 | train |
moay/afterglow | vendor/videojs/video.js | removeElData | function removeElData(el) {
var id = el[elIdAttr];
if (!id) {
return;
}
// Remove all stored data
delete elData[id];
// Remove the elIdAttr property from the DOM node
try {
delete el[elIdAttr];
} catch (e) {
if (el.removeAttribute) {
el.removeAttribute(elIdAttr);
} else {
... | javascript | function removeElData(el) {
var id = el[elIdAttr];
if (!id) {
return;
}
// Remove all stored data
delete elData[id];
// Remove the elIdAttr property from the DOM node
try {
delete el[elIdAttr];
} catch (e) {
if (el.removeAttribute) {
el.removeAttribute(elIdAttr);
} else {
... | [
"function",
"removeElData",
"(",
"el",
")",
"{",
"var",
"id",
"=",
"el",
"[",
"elIdAttr",
"]",
";",
"if",
"(",
"!",
"id",
")",
"{",
"return",
";",
"}",
"// Remove all stored data",
"delete",
"elData",
"[",
"id",
"]",
";",
"// Remove the elIdAttr property f... | Delete data for the element from the cache and the guid attr from getElementById
@param {Element} el Remove data for an element
@private
@function removeElData | [
"Delete",
"data",
"for",
"the",
"element",
"from",
"the",
"cache",
"and",
"the",
"guid",
"attr",
"from",
"getElementById"
] | a7fbc889a18188147fcd8418c5d3bb801608b9a7 | https://github.com/moay/afterglow/blob/a7fbc889a18188147fcd8418c5d3bb801608b9a7/vendor/videojs/video.js#L17779-L17800 | train |
moay/afterglow | vendor/videojs/video.js | hasElClass | function hasElClass(element, classToCheck) {
throwIfWhitespace(classToCheck);
if (element.classList) {
return element.classList.contains(classToCheck);
}
return classRegExp(classToCheck).test(element.className);
} | javascript | function hasElClass(element, classToCheck) {
throwIfWhitespace(classToCheck);
if (element.classList) {
return element.classList.contains(classToCheck);
}
return classRegExp(classToCheck).test(element.className);
} | [
"function",
"hasElClass",
"(",
"element",
",",
"classToCheck",
")",
"{",
"throwIfWhitespace",
"(",
"classToCheck",
")",
";",
"if",
"(",
"element",
".",
"classList",
")",
"{",
"return",
"element",
".",
"classList",
".",
"contains",
"(",
"classToCheck",
")",
"... | Check if an element has a CSS class
@function hasElClass
@param {Element} element Element to check
@param {String} classToCheck Classname to check | [
"Check",
"if",
"an",
"element",
"has",
"a",
"CSS",
"class"
] | a7fbc889a18188147fcd8418c5d3bb801608b9a7 | https://github.com/moay/afterglow/blob/a7fbc889a18188147fcd8418c5d3bb801608b9a7/vendor/videojs/video.js#L17809-L17815 | train |
moay/afterglow | vendor/videojs/video.js | addElClass | function addElClass(element, classToAdd) {
if (element.classList) {
element.classList.add(classToAdd);
// Don't need to `throwIfWhitespace` here because `hasElClass` will do it
// in the case of classList not being supported.
} else if (!hasElClass(element, classToAdd)) {
element.className = (eleme... | javascript | function addElClass(element, classToAdd) {
if (element.classList) {
element.classList.add(classToAdd);
// Don't need to `throwIfWhitespace` here because `hasElClass` will do it
// in the case of classList not being supported.
} else if (!hasElClass(element, classToAdd)) {
element.className = (eleme... | [
"function",
"addElClass",
"(",
"element",
",",
"classToAdd",
")",
"{",
"if",
"(",
"element",
".",
"classList",
")",
"{",
"element",
".",
"classList",
".",
"add",
"(",
"classToAdd",
")",
";",
"// Don't need to `throwIfWhitespace` here because `hasElClass` will do it",
... | Add a CSS class name to an element
@function addElClass
@param {Element} element Element to add class name to
@param {String} classToAdd Classname to add | [
"Add",
"a",
"CSS",
"class",
"name",
"to",
"an",
"element"
] | a7fbc889a18188147fcd8418c5d3bb801608b9a7 | https://github.com/moay/afterglow/blob/a7fbc889a18188147fcd8418c5d3bb801608b9a7/vendor/videojs/video.js#L17824-L17835 | train |
moay/afterglow | vendor/videojs/video.js | removeElClass | function removeElClass(element, classToRemove) {
if (element.classList) {
element.classList.remove(classToRemove);
} else {
throwIfWhitespace(classToRemove);
element.className = element.className.split(/\s+/).filter(function (c) {
return c !== classToRemove;
}).join(' ');
}
return element... | javascript | function removeElClass(element, classToRemove) {
if (element.classList) {
element.classList.remove(classToRemove);
} else {
throwIfWhitespace(classToRemove);
element.className = element.className.split(/\s+/).filter(function (c) {
return c !== classToRemove;
}).join(' ');
}
return element... | [
"function",
"removeElClass",
"(",
"element",
",",
"classToRemove",
")",
"{",
"if",
"(",
"element",
".",
"classList",
")",
"{",
"element",
".",
"classList",
".",
"remove",
"(",
"classToRemove",
")",
";",
"}",
"else",
"{",
"throwIfWhitespace",
"(",
"classToRem... | Remove a CSS class name from an element
@function removeElClass
@param {Element} element Element to remove from class name
@param {String} classToRemove Classname to remove | [
"Remove",
"a",
"CSS",
"class",
"name",
"from",
"an",
"element"
] | a7fbc889a18188147fcd8418c5d3bb801608b9a7 | https://github.com/moay/afterglow/blob/a7fbc889a18188147fcd8418c5d3bb801608b9a7/vendor/videojs/video.js#L17844-L17855 | train |
moay/afterglow | vendor/videojs/video.js | setElAttributes | function setElAttributes(el, attributes) {
Object.getOwnPropertyNames(attributes).forEach(function (attrName) {
var attrValue = attributes[attrName];
if (attrValue === null || typeof attrValue === 'undefined' || attrValue === false) {
el.removeAttribute(attrName);
} else {
el.setAttribute(att... | javascript | function setElAttributes(el, attributes) {
Object.getOwnPropertyNames(attributes).forEach(function (attrName) {
var attrValue = attributes[attrName];
if (attrValue === null || typeof attrValue === 'undefined' || attrValue === false) {
el.removeAttribute(attrName);
} else {
el.setAttribute(att... | [
"function",
"setElAttributes",
"(",
"el",
",",
"attributes",
")",
"{",
"Object",
".",
"getOwnPropertyNames",
"(",
"attributes",
")",
".",
"forEach",
"(",
"function",
"(",
"attrName",
")",
"{",
"var",
"attrValue",
"=",
"attributes",
"[",
"attrName",
"]",
";",... | Apply attributes to an HTML element.
@param {Element} el Target element.
@param {Object=} attributes Element attributes to be applied.
@private
@function setElAttributes | [
"Apply",
"attributes",
"to",
"an",
"HTML",
"element",
"."
] | a7fbc889a18188147fcd8418c5d3bb801608b9a7 | https://github.com/moay/afterglow/blob/a7fbc889a18188147fcd8418c5d3bb801608b9a7/vendor/videojs/video.js#L17907-L17917 | train |
moay/afterglow | vendor/videojs/video.js | normalizeContent | function normalizeContent(content) {
// First, invoke content if it is a function. If it produces an array,
// that needs to happen before normalization.
if (typeof content === 'function') {
content = content();
}
// Next up, normalize to an array, so one or many items can be normalized,
// filtered, ... | javascript | function normalizeContent(content) {
// First, invoke content if it is a function. If it produces an array,
// that needs to happen before normalization.
if (typeof content === 'function') {
content = content();
}
// Next up, normalize to an array, so one or many items can be normalized,
// filtered, ... | [
"function",
"normalizeContent",
"(",
"content",
")",
"{",
"// First, invoke content if it is a function. If it produces an array,",
"// that needs to happen before normalization.",
"if",
"(",
"typeof",
"content",
"===",
"'function'",
")",
"{",
"content",
"=",
"content",
"(",
... | Normalizes content for eventual insertion into the DOM.
This allows a wide range of content definition methods, but protects
from falling into the trap of simply writing to `innerHTML`, which is
an XSS concern.
The content for an element can be passed in multiple types and
combinations, whose behavior is as follows:
... | [
"Normalizes",
"content",
"for",
"eventual",
"insertion",
"into",
"the",
"DOM",
"."
] | a7fbc889a18188147fcd8418c5d3bb801608b9a7 | https://github.com/moay/afterglow/blob/a7fbc889a18188147fcd8418c5d3bb801608b9a7/vendor/videojs/video.js#L18111-L18139 | train |
moay/afterglow | vendor/videojs/video.js | _cleanUpEvents | function _cleanUpEvents(elem, type) {
var data = Dom.getElData(elem);
// Remove the events of a particular type if there are none left
if (data.handlers[type].length === 0) {
delete data.handlers[type];
// data.handlers[type] = null;
// Setting to null was causing an error with data.handlers
// ... | javascript | function _cleanUpEvents(elem, type) {
var data = Dom.getElData(elem);
// Remove the events of a particular type if there are none left
if (data.handlers[type].length === 0) {
delete data.handlers[type];
// data.handlers[type] = null;
// Setting to null was causing an error with data.handlers
// ... | [
"function",
"_cleanUpEvents",
"(",
"elem",
",",
"type",
")",
"{",
"var",
"data",
"=",
"Dom",
".",
"getElData",
"(",
"elem",
")",
";",
"// Remove the events of a particular type if there are none left",
"if",
"(",
"data",
".",
"handlers",
"[",
"type",
"]",
".",
... | Clean up the listener cache and dispatchers
@param {Element|Object} elem Element to clean up
@param {String} type Type of event to clean up
@private
@method _cleanUpEvents | [
"Clean",
"up",
"the",
"listener",
"cache",
"and",
"dispatchers"
] | a7fbc889a18188147fcd8418c5d3bb801608b9a7 | https://github.com/moay/afterglow/blob/a7fbc889a18188147fcd8418c5d3bb801608b9a7/vendor/videojs/video.js#L18249-L18277 | train |
moay/afterglow | vendor/videojs/video.js | off | function off(elem, type, fn) {
// Don't want to add a cache object through getElData if not needed
if (!Dom.hasElData(elem)) {
return;
}
var data = Dom.getElData(elem);
// If no events exist, nothing to unbind
if (!data.handlers) {
return;
}
if (Array.isArray(type)) {
return _handleMultip... | javascript | function off(elem, type, fn) {
// Don't want to add a cache object through getElData if not needed
if (!Dom.hasElData(elem)) {
return;
}
var data = Dom.getElData(elem);
// If no events exist, nothing to unbind
if (!data.handlers) {
return;
}
if (Array.isArray(type)) {
return _handleMultip... | [
"function",
"off",
"(",
"elem",
",",
"type",
",",
"fn",
")",
"{",
"// Don't want to add a cache object through getElData if not needed",
"if",
"(",
"!",
"Dom",
".",
"hasElData",
"(",
"elem",
")",
")",
"{",
"return",
";",
"}",
"var",
"data",
"=",
"Dom",
".",
... | Removes event listeners from an element
@param {Element|Object} elem Object to remove listeners from
@param {String|Array=} type Type of listener to remove. Don't include to remove all events from element.
@param {Function} fn Specific listener to remove. Don't include to remove listeners for an event type.
@... | [
"Removes",
"event",
"listeners",
"from",
"an",
"element"
] | a7fbc889a18188147fcd8418c5d3bb801608b9a7 | https://github.com/moay/afterglow/blob/a7fbc889a18188147fcd8418c5d3bb801608b9a7/vendor/videojs/video.js#L18507-L18561 | train |
moay/afterglow | vendor/videojs/video.js | trigger | function trigger(elem, event, hash) {
// Fetches element data and a reference to the parent (for bubbling).
// Don't want to add a data object to cache for every parent,
// so checking hasElData first.
var elemData = Dom.hasElData(elem) ? Dom.getElData(elem) : {};
var parent = elem.parentNode || elem.ownerDoc... | javascript | function trigger(elem, event, hash) {
// Fetches element data and a reference to the parent (for bubbling).
// Don't want to add a data object to cache for every parent,
// so checking hasElData first.
var elemData = Dom.hasElData(elem) ? Dom.getElData(elem) : {};
var parent = elem.parentNode || elem.ownerDoc... | [
"function",
"trigger",
"(",
"elem",
",",
"event",
",",
"hash",
")",
"{",
"// Fetches element data and a reference to the parent (for bubbling).",
"// Don't want to add a data object to cache for every parent,",
"// so checking hasElData first.",
"var",
"elemData",
"=",
"Dom",
".",
... | Trigger an event for an element
@param {Element|Object} elem Element to trigger an event on
@param {Event|Object|String} event A string (the type) or an event object with a type attribute
@param {Object} [hash] data hash to pass along with the event
@return {Boolean=} Returned only if default was prevented
@m... | [
"Trigger",
"an",
"event",
"for",
"an",
"element"
] | a7fbc889a18188147fcd8418c5d3bb801608b9a7 | https://github.com/moay/afterglow/blob/a7fbc889a18188147fcd8418c5d3bb801608b9a7/vendor/videojs/video.js#L18572-L18617 | train |
moay/afterglow | vendor/videojs/video.js | ParsingError | function ParsingError(errorData, message) {
this.name = "ParsingError";
this.code = errorData.code;
this.message = message || errorData.message;
} | javascript | function ParsingError(errorData, message) {
this.name = "ParsingError";
this.code = errorData.code;
this.message = message || errorData.message;
} | [
"function",
"ParsingError",
"(",
"errorData",
",",
"message",
")",
"{",
"this",
".",
"name",
"=",
"\"ParsingError\"",
";",
"this",
".",
"code",
"=",
"errorData",
".",
"code",
";",
"this",
".",
"message",
"=",
"message",
"||",
"errorData",
".",
"message",
... | Creates a new ParserError object from an errorData object. The errorData object should have default code and message properties. The default message property can be overriden by passing in a message parameter. See ParsingError.Errors below for acceptable errors. | [
"Creates",
"a",
"new",
"ParserError",
"object",
"from",
"an",
"errorData",
"object",
".",
"The",
"errorData",
"object",
"should",
"have",
"default",
"code",
"and",
"message",
"properties",
".",
"The",
"default",
"message",
"property",
"can",
"be",
"overriden",
... | a7fbc889a18188147fcd8418c5d3bb801608b9a7 | https://github.com/moay/afterglow/blob/a7fbc889a18188147fcd8418c5d3bb801608b9a7/vendor/videojs/video.js#L23182-L23186 | train |
moay/afterglow | vendor/videojs/video.js | parseTimeStamp | function parseTimeStamp(input) {
function computeSeconds(h, m, s, f) {
return (h | 0) * 3600 + (m | 0) * 60 + (s | 0) + (f | 0) / 1000;
}
var m = input.match(/^(\d+):(\d{2})(:\d{2})?\.(\d{3})/);
if (!m) {
return null;
}
if (m[3]) {
// Timestamp takes the form of [hours]:[min... | javascript | function parseTimeStamp(input) {
function computeSeconds(h, m, s, f) {
return (h | 0) * 3600 + (m | 0) * 60 + (s | 0) + (f | 0) / 1000;
}
var m = input.match(/^(\d+):(\d{2})(:\d{2})?\.(\d{3})/);
if (!m) {
return null;
}
if (m[3]) {
// Timestamp takes the form of [hours]:[min... | [
"function",
"parseTimeStamp",
"(",
"input",
")",
"{",
"function",
"computeSeconds",
"(",
"h",
",",
"m",
",",
"s",
",",
"f",
")",
"{",
"return",
"(",
"h",
"|",
"0",
")",
"*",
"3600",
"+",
"(",
"m",
"|",
"0",
")",
"*",
"60",
"+",
"(",
"s",
"|",... | Try to parse input as a time stamp. | [
"Try",
"to",
"parse",
"input",
"as",
"a",
"time",
"stamp",
"."
] | a7fbc889a18188147fcd8418c5d3bb801608b9a7 | https://github.com/moay/afterglow/blob/a7fbc889a18188147fcd8418c5d3bb801608b9a7/vendor/videojs/video.js#L23203-L23225 | train |
moay/afterglow | vendor/videojs/video.js | function(k, dflt, defaultKey) {
if (defaultKey) {
return this.has(k) ? this.values[k] : dflt[defaultKey];
}
return this.has(k) ? this.values[k] : dflt;
} | javascript | function(k, dflt, defaultKey) {
if (defaultKey) {
return this.has(k) ? this.values[k] : dflt[defaultKey];
}
return this.has(k) ? this.values[k] : dflt;
} | [
"function",
"(",
"k",
",",
"dflt",
",",
"defaultKey",
")",
"{",
"if",
"(",
"defaultKey",
")",
"{",
"return",
"this",
".",
"has",
"(",
"k",
")",
"?",
"this",
".",
"values",
"[",
"k",
"]",
":",
"dflt",
"[",
"defaultKey",
"]",
";",
"}",
"return",
... | Return the value for a key, or a default value. If 'defaultKey' is passed then 'dflt' is assumed to be an object with a number of possible default values as properties where 'defaultKey' is the key of the property that will be chosen; otherwise it's assumed to be a single value. | [
"Return",
"the",
"value",
"for",
"a",
"key",
"or",
"a",
"default",
"value",
".",
"If",
"defaultKey",
"is",
"passed",
"then",
"dflt",
"is",
"assumed",
"to",
"be",
"an",
"object",
"with",
"a",
"number",
"of",
"possible",
"default",
"values",
"as",
"propert... | a7fbc889a18188147fcd8418c5d3bb801608b9a7 | https://github.com/moay/afterglow/blob/a7fbc889a18188147fcd8418c5d3bb801608b9a7/vendor/videojs/video.js#L23245-L23250 | train | |
moay/afterglow | vendor/videojs/video.js | function(k, v, a) {
for (var n = 0; n < a.length; ++n) {
if (v === a[n]) {
this.set(k, v);
break;
}
}
} | javascript | function(k, v, a) {
for (var n = 0; n < a.length; ++n) {
if (v === a[n]) {
this.set(k, v);
break;
}
}
} | [
"function",
"(",
"k",
",",
"v",
",",
"a",
")",
"{",
"for",
"(",
"var",
"n",
"=",
"0",
";",
"n",
"<",
"a",
".",
"length",
";",
"++",
"n",
")",
"{",
"if",
"(",
"v",
"===",
"a",
"[",
"n",
"]",
")",
"{",
"this",
".",
"set",
"(",
"k",
",",... | Accept a setting if its one of the given alternatives. | [
"Accept",
"a",
"setting",
"if",
"its",
"one",
"of",
"the",
"given",
"alternatives",
"."
] | a7fbc889a18188147fcd8418c5d3bb801608b9a7 | https://github.com/moay/afterglow/blob/a7fbc889a18188147fcd8418c5d3bb801608b9a7/vendor/videojs/video.js#L23256-L23263 | train | |
moay/afterglow | vendor/videojs/video.js | function(k, v) {
var m;
if ((m = v.match(/^([\d]{1,3})(\.[\d]*)?%$/))) {
v = parseFloat(v);
if (v >= 0 && v <= 100) {
this.set(k, v);
return true;
}
}
return false;
} | javascript | function(k, v) {
var m;
if ((m = v.match(/^([\d]{1,3})(\.[\d]*)?%$/))) {
v = parseFloat(v);
if (v >= 0 && v <= 100) {
this.set(k, v);
return true;
}
}
return false;
} | [
"function",
"(",
"k",
",",
"v",
")",
"{",
"var",
"m",
";",
"if",
"(",
"(",
"m",
"=",
"v",
".",
"match",
"(",
"/",
"^([\\d]{1,3})(\\.[\\d]*)?%$",
"/",
")",
")",
")",
"{",
"v",
"=",
"parseFloat",
"(",
"v",
")",
";",
"if",
"(",
"v",
">=",
"0",
... | Accept a setting if its a valid percentage. | [
"Accept",
"a",
"setting",
"if",
"its",
"a",
"valid",
"percentage",
"."
] | a7fbc889a18188147fcd8418c5d3bb801608b9a7 | https://github.com/moay/afterglow/blob/a7fbc889a18188147fcd8418c5d3bb801608b9a7/vendor/videojs/video.js#L23271-L23281 | train | |
moay/afterglow | vendor/videojs/video.js | consumeTimeStamp | function consumeTimeStamp() {
var ts = parseTimeStamp(input);
if (ts === null) {
throw new ParsingError(ParsingError.Errors.BadTimeStamp,
"Malformed timestamp: " + oInput);
}
// Remove time stamp from input.
input = input.replace(/^[^\sa-zA-Z-]+/, "");... | javascript | function consumeTimeStamp() {
var ts = parseTimeStamp(input);
if (ts === null) {
throw new ParsingError(ParsingError.Errors.BadTimeStamp,
"Malformed timestamp: " + oInput);
}
// Remove time stamp from input.
input = input.replace(/^[^\sa-zA-Z-]+/, "");... | [
"function",
"consumeTimeStamp",
"(",
")",
"{",
"var",
"ts",
"=",
"parseTimeStamp",
"(",
"input",
")",
";",
"if",
"(",
"ts",
"===",
"null",
")",
"{",
"throw",
"new",
"ParsingError",
"(",
"ParsingError",
".",
"Errors",
".",
"BadTimeStamp",
",",
"\"Malformed ... | 4.1 WebVTT timestamp | [
"4",
".",
"1",
"WebVTT",
"timestamp"
] | a7fbc889a18188147fcd8418c5d3bb801608b9a7 | https://github.com/moay/afterglow/blob/a7fbc889a18188147fcd8418c5d3bb801608b9a7/vendor/videojs/video.js#L23306-L23315 | train |
moay/afterglow | vendor/videojs/video.js | consumeCueSettings | function consumeCueSettings(input, cue) {
var settings = new Settings();
parseOptions(input, function (k, v) {
switch (k) {
case "region":
// Find the last region we parsed with the same region id.
for (var i = regionList.length - 1; i >= 0; i--) {
if (region... | javascript | function consumeCueSettings(input, cue) {
var settings = new Settings();
parseOptions(input, function (k, v) {
switch (k) {
case "region":
// Find the last region we parsed with the same region id.
for (var i = regionList.length - 1; i >= 0; i--) {
if (region... | [
"function",
"consumeCueSettings",
"(",
"input",
",",
"cue",
")",
"{",
"var",
"settings",
"=",
"new",
"Settings",
"(",
")",
";",
"parseOptions",
"(",
"input",
",",
"function",
"(",
"k",
",",
"v",
")",
"{",
"switch",
"(",
"k",
")",
"{",
"case",
"\"regi... | 4.4.2 WebVTT cue settings | [
"4",
".",
"4",
".",
"2",
"WebVTT",
"cue",
"settings"
] | a7fbc889a18188147fcd8418c5d3bb801608b9a7 | https://github.com/moay/afterglow/blob/a7fbc889a18188147fcd8418c5d3bb801608b9a7/vendor/videojs/video.js#L23318-L23383 | train |
moay/afterglow | vendor/videojs/video.js | createElement | function createElement(type, annotation) {
var tagName = TAG_NAME[type];
if (!tagName) {
return null;
}
var element = window.document.createElement(tagName);
element.localName = tagName;
var name = TAG_ANNOTATION[type];
if (name && annotation) {
element[name] = ... | javascript | function createElement(type, annotation) {
var tagName = TAG_NAME[type];
if (!tagName) {
return null;
}
var element = window.document.createElement(tagName);
element.localName = tagName;
var name = TAG_ANNOTATION[type];
if (name && annotation) {
element[name] = ... | [
"function",
"createElement",
"(",
"type",
",",
"annotation",
")",
"{",
"var",
"tagName",
"=",
"TAG_NAME",
"[",
"type",
"]",
";",
"if",
"(",
"!",
"tagName",
")",
"{",
"return",
"null",
";",
"}",
"var",
"element",
"=",
"window",
".",
"document",
".",
"... | Create an element for this tag. | [
"Create",
"an",
"element",
"for",
"this",
"tag",
"."
] | a7fbc889a18188147fcd8418c5d3bb801608b9a7 | https://github.com/moay/afterglow/blob/a7fbc889a18188147fcd8418c5d3bb801608b9a7/vendor/videojs/video.js#L23473-L23485 | train |
moay/afterglow | vendor/videojs/video.js | BoxPosition | function BoxPosition(obj) {
var isIE8 = (/MSIE\s8\.0/).test(navigator.userAgent);
// Either a BoxPosition was passed in and we need to copy it, or a StyleBox
// was passed in and we need to copy the results of 'getBoundingClientRect'
// as the object returned is readonly. All co-ordinate values are in ... | javascript | function BoxPosition(obj) {
var isIE8 = (/MSIE\s8\.0/).test(navigator.userAgent);
// Either a BoxPosition was passed in and we need to copy it, or a StyleBox
// was passed in and we need to copy the results of 'getBoundingClientRect'
// as the object returned is readonly. All co-ordinate values are in ... | [
"function",
"BoxPosition",
"(",
"obj",
")",
"{",
"var",
"isIE8",
"=",
"(",
"/",
"MSIE\\s8\\.0",
"/",
")",
".",
"test",
"(",
"navigator",
".",
"userAgent",
")",
";",
"// Either a BoxPosition was passed in and we need to copy it, or a StyleBox",
"// was passed in and we n... | Represents the co-ordinates of an Element in a way that we can easily compute things with such as if it overlaps or intersects with another Element. Can initialize it with either a StyleBox or another BoxPosition. | [
"Represents",
"the",
"co",
"-",
"ordinates",
"of",
"an",
"Element",
"in",
"a",
"way",
"that",
"we",
"can",
"easily",
"compute",
"things",
"with",
"such",
"as",
"if",
"it",
"overlaps",
"or",
"intersects",
"with",
"another",
"Element",
".",
"Can",
"initializ... | a7fbc889a18188147fcd8418c5d3bb801608b9a7 | https://github.com/moay/afterglow/blob/a7fbc889a18188147fcd8418c5d3bb801608b9a7/vendor/videojs/video.js#L23972-L24007 | train |
moay/afterglow | vendor/videojs/video.js | shouldCompute | function shouldCompute(cues) {
for (var i = 0; i < cues.length; i++) {
if (cues[i].hasBeenReset || !cues[i].displayState) {
return true;
}
}
return false;
} | javascript | function shouldCompute(cues) {
for (var i = 0; i < cues.length; i++) {
if (cues[i].hasBeenReset || !cues[i].displayState) {
return true;
}
}
return false;
} | [
"function",
"shouldCompute",
"(",
"cues",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"cues",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"cues",
"[",
"i",
"]",
".",
"hasBeenReset",
"||",
"!",
"cues",
"[",
"i",
"]",
"."... | Determine if we need to compute the display states of the cues. This could be the case if a cue's state has been changed since the last computation or if it has not been computed yet. | [
"Determine",
"if",
"we",
"need",
"to",
"compute",
"the",
"display",
"states",
"of",
"the",
"cues",
".",
"This",
"could",
"be",
"the",
"case",
"if",
"a",
"cue",
"s",
"state",
"has",
"been",
"changed",
"since",
"the",
"last",
"computation",
"or",
"if",
"... | a7fbc889a18188147fcd8418c5d3bb801608b9a7 | https://github.com/moay/afterglow/blob/a7fbc889a18188147fcd8418c5d3bb801608b9a7/vendor/videojs/video.js#L24306-L24313 | train |
moay/afterglow | vendor/videojs/video.js | parseRegion | function parseRegion(input) {
var settings = new Settings();
parseOptions(input, function (k, v) {
switch (k) {
case "id":
settings.set(k, v);
break;
case "width":
settings.percent(k, v);
break;
case "lines":
... | javascript | function parseRegion(input) {
var settings = new Settings();
parseOptions(input, function (k, v) {
switch (k) {
case "id":
settings.set(k, v);
break;
case "width":
settings.percent(k, v);
break;
case "lines":
... | [
"function",
"parseRegion",
"(",
"input",
")",
"{",
"var",
"settings",
"=",
"new",
"Settings",
"(",
")",
";",
"parseOptions",
"(",
"input",
",",
"function",
"(",
"k",
",",
"v",
")",
"{",
"switch",
"(",
"k",
")",
"{",
"case",
"\"id\"",
":",
"settings",... | 3.4 WebVTT region and WebVTT region settings syntax | [
"3",
".",
"4",
"WebVTT",
"region",
"and",
"WebVTT",
"region",
"settings",
"syntax"
] | a7fbc889a18188147fcd8418c5d3bb801608b9a7 | https://github.com/moay/afterglow/blob/a7fbc889a18188147fcd8418c5d3bb801608b9a7/vendor/videojs/video.js#L24409-L24466 | train |
smbolton/dagre-d3v4 | gulpfile.js | prettifyJson | function prettifyJson(str) {
var json = JSON.parse(str);
return JSON.stringify(json, null, 2);
} | javascript | function prettifyJson(str) {
var json = JSON.parse(str);
return JSON.stringify(json, null, 2);
} | [
"function",
"prettifyJson",
"(",
"str",
")",
"{",
"var",
"json",
"=",
"JSON",
".",
"parse",
"(",
"str",
")",
";",
"return",
"JSON",
".",
"stringify",
"(",
"json",
",",
"null",
",",
"2",
")",
";",
"}"
] | Given a JSON string return a prettified version of the string. | [
"Given",
"a",
"JSON",
"string",
"return",
"a",
"prettified",
"version",
"of",
"the",
"string",
"."
] | 78f537785332005b618e087e4226c0267c069ec6 | https://github.com/smbolton/dagre-d3v4/blob/78f537785332005b618e087e4226c0267c069ec6/gulpfile.js#L224-L227 | train |
APIs-guru/raml-to-swagger | src/index.js | unwrapItems | function unwrapItems(schema) {
if (_.isEmpty(schema.items))
schema.items = {};
else {
assert(_.isPlainObject(schema.items[0]));
schema.items = schema.items[0];
}
return schema;
} | javascript | function unwrapItems(schema) {
if (_.isEmpty(schema.items))
schema.items = {};
else {
assert(_.isPlainObject(schema.items[0]));
schema.items = schema.items[0];
}
return schema;
} | [
"function",
"unwrapItems",
"(",
"schema",
")",
"{",
"if",
"(",
"_",
".",
"isEmpty",
"(",
"schema",
".",
"items",
")",
")",
"schema",
".",
"items",
"=",
"{",
"}",
";",
"else",
"{",
"assert",
"(",
"_",
".",
"isPlainObject",
"(",
"schema",
".",
"items... | Fix case then 'items' value is empty or single element array. | [
"Fix",
"case",
"then",
"items",
"value",
"is",
"empty",
"or",
"single",
"element",
"array",
"."
] | 7311d4dd8895eaeeacaa642405b65f86dd779d2a | https://github.com/APIs-guru/raml-to-swagger/blob/7311d4dd8895eaeeacaa642405b65f86dd779d2a/src/index.js#L484-L493 | train |
cerner/canadarm | lib/core.js | init | function init(settings) {
var opts = settings || {},
i;
if (opts.onError !== false) {
Canadarm.setUpOnErrorHandler();
}
if (opts.wrapEvents !== false) {
Canadarm.setUpEventListening();
}
if (opts.appenders) {
for (i = 0; i < opts.appenders.length; i++) {
Canadarm.addAppender(opts.ap... | javascript | function init(settings) {
var opts = settings || {},
i;
if (opts.onError !== false) {
Canadarm.setUpOnErrorHandler();
}
if (opts.wrapEvents !== false) {
Canadarm.setUpEventListening();
}
if (opts.appenders) {
for (i = 0; i < opts.appenders.length; i++) {
Canadarm.addAppender(opts.ap... | [
"function",
"init",
"(",
"settings",
")",
"{",
"var",
"opts",
"=",
"settings",
"||",
"{",
"}",
",",
"i",
";",
"if",
"(",
"opts",
".",
"onError",
"!==",
"false",
")",
"{",
"Canadarm",
".",
"setUpOnErrorHandler",
"(",
")",
";",
"}",
"if",
"(",
"opts"... | Used to setup Canadarm for consumers. The properties below are for the settings
object passed to the init function.
@example
Canadarm.init({
onError: true, // Set to false if you do not want window.onerror set.
wrapEvents: true, // Set to false if you do not want all event handlers to be logged for errors
logLevel: C... | [
"Used",
"to",
"setup",
"Canadarm",
"for",
"consumers",
".",
"The",
"properties",
"below",
"are",
"for",
"the",
"settings",
"object",
"passed",
"to",
"the",
"init",
"function",
"."
] | 6ea144d18ada46e0e6668dc86034d1d73130002e | https://github.com/cerner/canadarm/blob/6ea144d18ada46e0e6668dc86034d1d73130002e/lib/core.js#L56-L83 | train |
cerner/canadarm | lib/core.js | gatherErrors | function gatherErrors(level, exception, message, data, appenders) {
var logAttributes = {},
localAppenders = appenders || errorAppenders,
errorAppender, attributeName, attributes, i, key;
// Go over every log appender and add it's attributes so we can log them.
for (i = 0; i < localAppenders.length; i++)... | javascript | function gatherErrors(level, exception, message, data, appenders) {
var logAttributes = {},
localAppenders = appenders || errorAppenders,
errorAppender, attributeName, attributes, i, key;
// Go over every log appender and add it's attributes so we can log them.
for (i = 0; i < localAppenders.length; i++)... | [
"function",
"gatherErrors",
"(",
"level",
",",
"exception",
",",
"message",
",",
"data",
",",
"appenders",
")",
"{",
"var",
"logAttributes",
"=",
"{",
"}",
",",
"localAppenders",
"=",
"appenders",
"||",
"errorAppenders",
",",
"errorAppender",
",",
"attributeNa... | Used to gather the errors that have occurred. This function loops over the existing
logAppenders and creates the attributes that will be logged to the errors. Returns
an object of errors to log.
@function gatherErrors
@private
@param {string} level - Log level of the exception. (e.g. ERROR, FATAL)
@param {error... | [
"Used",
"to",
"gather",
"the",
"errors",
"that",
"have",
"occurred",
".",
"This",
"function",
"loops",
"over",
"the",
"existing",
"logAppenders",
"and",
"creates",
"the",
"attributes",
"that",
"will",
"be",
"logged",
"to",
"the",
"errors",
".",
"Returns",
"a... | 6ea144d18ada46e0e6668dc86034d1d73130002e | https://github.com/cerner/canadarm/blob/6ea144d18ada46e0e6668dc86034d1d73130002e/lib/core.js#L128-L147 | train |
cerner/canadarm | lib/core.js | pushErrors | function pushErrors(logAttributes, handlers) {
var localHandlers = handlers || errorHandlers,
errorHandler, i;
// Go over every log handler so we can actually create logs.
for (i = 0; i < localHandlers.length; i++) {
errorHandler = localHandlers[i];
errorHandler(logAttributes);
}
} | javascript | function pushErrors(logAttributes, handlers) {
var localHandlers = handlers || errorHandlers,
errorHandler, i;
// Go over every log handler so we can actually create logs.
for (i = 0; i < localHandlers.length; i++) {
errorHandler = localHandlers[i];
errorHandler(logAttributes);
}
} | [
"function",
"pushErrors",
"(",
"logAttributes",
",",
"handlers",
")",
"{",
"var",
"localHandlers",
"=",
"handlers",
"||",
"errorHandlers",
",",
"errorHandler",
",",
"i",
";",
"// Go over every log handler so we can actually create logs.",
"for",
"(",
"i",
"=",
"0",
... | Sends the errors passed in `logAttributes` for each logHandler.
@method pushErrors
@private
@param {object} logAttributes -- A key/value pairing of the attributes to log.
@param {array} handlers -- If passed will override existing handlers and be used. | [
"Sends",
"the",
"errors",
"passed",
"in",
"logAttributes",
"for",
"each",
"logHandler",
"."
] | 6ea144d18ada46e0e6668dc86034d1d73130002e | https://github.com/cerner/canadarm/blob/6ea144d18ada46e0e6668dc86034d1d73130002e/lib/core.js#L158-L167 | train |
cerner/canadarm | lib/core.js | customLogEvent | function customLogEvent(level) {
// options should contain the appenders and handlers to override the
// global ones defined in errorAppenders, and errorHandlers.
// Used by Canadarm.localWatch to wrap local appender calls.
return function (message, exception, data, settings) {
// If we are are below the ... | javascript | function customLogEvent(level) {
// options should contain the appenders and handlers to override the
// global ones defined in errorAppenders, and errorHandlers.
// Used by Canadarm.localWatch to wrap local appender calls.
return function (message, exception, data, settings) {
// If we are are below the ... | [
"function",
"customLogEvent",
"(",
"level",
")",
"{",
"// options should contain the appenders and handlers to override the",
"// global ones defined in errorAppenders, and errorHandlers.",
"// Used by Canadarm.localWatch to wrap local appender calls.",
"return",
"function",
"(",
"message",
... | Used to generate our custom loggers.
@function customLogEvent
@private
@param {string} level - The level to log the events.
@returns a function that logs what is passed. Signature is: message, exception, data, settings. | [
"Used",
"to",
"generate",
"our",
"custom",
"loggers",
"."
] | 6ea144d18ada46e0e6668dc86034d1d73130002e | https://github.com/cerner/canadarm/blob/6ea144d18ada46e0e6668dc86034d1d73130002e/lib/core.js#L180-L198 | train |
cerner/canadarm | lib/handler/console.js | consoleLogHandler | function consoleLogHandler(logAttributes) {
var logValues = '', key;
if (console) {
// detect IE
if (window.attachEvent) {
// Put attributes into a format that are easy for IE 8 to read.
for (key in logAttributes) {
if (!logAttributes.hasOwnProperty(key)) {
continue;
}... | javascript | function consoleLogHandler(logAttributes) {
var logValues = '', key;
if (console) {
// detect IE
if (window.attachEvent) {
// Put attributes into a format that are easy for IE 8 to read.
for (key in logAttributes) {
if (!logAttributes.hasOwnProperty(key)) {
continue;
}... | [
"function",
"consoleLogHandler",
"(",
"logAttributes",
")",
"{",
"var",
"logValues",
"=",
"''",
",",
"key",
";",
"if",
"(",
"console",
")",
"{",
"// detect IE",
"if",
"(",
"window",
".",
"attachEvent",
")",
"{",
"// Put attributes into a format that are easy for I... | Console log handler. Outputs logs to console.
@memberof Canadarm.Handler
@function consoleLogHandler
@example
Canadarm.addHandler(Canadarm.Handler.consoleLogHandler);
// In Chrome the output looks similar to:
[ERROR]: two is not defined
characterSet: "windows-1252"
columnNumber: "17"
language: "en-US"
lineNumber: "1... | [
"Console",
"log",
"handler",
".",
"Outputs",
"logs",
"to",
"console",
"."
] | 6ea144d18ada46e0e6668dc86034d1d73130002e | https://github.com/cerner/canadarm/blob/6ea144d18ada46e0e6668dc86034d1d73130002e/lib/handler/console.js#L28-L49 | train |
cerner/canadarm | lib/instrument/global.js | _onError | function _onError(errorMessage, url, lineNumber, columnNumber, exception) {
var onErrorReturn;
// Execute the original window.onerror handler, if any
if (_oldOnError && typeof _oldOnError === 'function') {
onErrorReturn = _oldOnError.apply(this, arguments);
}
Canadarm.fatal(errorMessage, exception, {
... | javascript | function _onError(errorMessage, url, lineNumber, columnNumber, exception) {
var onErrorReturn;
// Execute the original window.onerror handler, if any
if (_oldOnError && typeof _oldOnError === 'function') {
onErrorReturn = _oldOnError.apply(this, arguments);
}
Canadarm.fatal(errorMessage, exception, {
... | [
"function",
"_onError",
"(",
"errorMessage",
",",
"url",
",",
"lineNumber",
",",
"columnNumber",
",",
"exception",
")",
"{",
"var",
"onErrorReturn",
";",
"// Execute the original window.onerror handler, if any",
"if",
"(",
"_oldOnError",
"&&",
"typeof",
"_oldOnError",
... | Logs the errors that have occurred. Its signature matches that of `window.onerror`.
Will replace the `window.onerror`. It will still call the original `window.onerror`
as well if it existed.
@function _onError
@private | [
"Logs",
"the",
"errors",
"that",
"have",
"occurred",
".",
"Its",
"signature",
"matches",
"that",
"of",
"window",
".",
"onerror",
".",
"Will",
"replace",
"the",
"window",
".",
"onerror",
".",
"It",
"will",
"still",
"call",
"the",
"original",
"window",
".",
... | 6ea144d18ada46e0e6668dc86034d1d73130002e | https://github.com/cerner/canadarm/blob/6ea144d18ada46e0e6668dc86034d1d73130002e/lib/instrument/global.js#L21-L36 | train |
cerner/canadarm | build/canadarm.js | findStackData | function findStackData(stack) {
// If the stack is not in the error we cannot get any information and
// should return immediately.
if (stack === undefined || stack === null) {
return {
'url': Canadarm.constant.UNKNOWN_LOG,
'lineNumber': Canadarm.constant.UNKNOWN_LOG,
'columnNu... | javascript | function findStackData(stack) {
// If the stack is not in the error we cannot get any information and
// should return immediately.
if (stack === undefined || stack === null) {
return {
'url': Canadarm.constant.UNKNOWN_LOG,
'lineNumber': Canadarm.constant.UNKNOWN_LOG,
'columnNu... | [
"function",
"findStackData",
"(",
"stack",
")",
"{",
"// If the stack is not in the error we cannot get any information and",
"// should return immediately.",
"if",
"(",
"stack",
"===",
"undefined",
"||",
"stack",
"===",
"null",
")",
"{",
"return",
"{",
"'url'",
":",
"C... | Generates the url, lineNumber, and Column number of the error. | [
"Generates",
"the",
"url",
"lineNumber",
"and",
"Column",
"number",
"of",
"the",
"error",
"."
] | 6ea144d18ada46e0e6668dc86034d1d73130002e | https://github.com/cerner/canadarm/blob/6ea144d18ada46e0e6668dc86034d1d73130002e/build/canadarm.js#L414-L442 | train |
vowstar/gitbook-plugin-uml | index.js | function() {
// NOTE: This fixed issue #7
// https://github.com/vowstar/gitbook-plugin-uml/issues/7
// HTML will load after this operation
// Copy images to output folder every time
var book = this;
var output = book.output;
var rootPat... | javascript | function() {
// NOTE: This fixed issue #7
// https://github.com/vowstar/gitbook-plugin-uml/issues/7
// HTML will load after this operation
// Copy images to output folder every time
var book = this;
var output = book.output;
var rootPat... | [
"function",
"(",
")",
"{",
"// NOTE: This fixed issue #7",
"// https://github.com/vowstar/gitbook-plugin-uml/issues/7",
"// HTML will load after this operation",
"// Copy images to output folder every time",
"var",
"book",
"=",
"this",
";",
"var",
"output",
"=",
"book",
".",
"out... | Before the end of book generation | [
"Before",
"the",
"end",
"of",
"book",
"generation"
] | 4cf519c265b4207a71ffc6cd280df9a506201755 | https://github.com/vowstar/gitbook-plugin-uml/blob/4cf519c265b4207a71ffc6cd280df9a506201755/index.js#L119-L131 | train | |
alexgorbatchev/gulp-changed-in-place | index.js | processFileByModifiedTime | function processFileByModifiedTime(stream, firstPass, basePath, file, cache) {
var newTime = file.stat && file.stat.mtime;
var filePath = basePath ? path.relative(basePath, file.path) : file.path;
var oldTime = cache[filePath];
cache[filePath] = newTime.getTime();
if ((!oldTime && firstPass) || (oldTime && ... | javascript | function processFileByModifiedTime(stream, firstPass, basePath, file, cache) {
var newTime = file.stat && file.stat.mtime;
var filePath = basePath ? path.relative(basePath, file.path) : file.path;
var oldTime = cache[filePath];
cache[filePath] = newTime.getTime();
if ((!oldTime && firstPass) || (oldTime && ... | [
"function",
"processFileByModifiedTime",
"(",
"stream",
",",
"firstPass",
",",
"basePath",
",",
"file",
",",
"cache",
")",
"{",
"var",
"newTime",
"=",
"file",
".",
"stat",
"&&",
"file",
".",
"stat",
".",
"mtime",
";",
"var",
"filePath",
"=",
"basePath",
... | look for changes by mtime | [
"look",
"for",
"changes",
"by",
"mtime"
] | 31a97e9a77e467b9e57f91148e1058fc742c7496 | https://github.com/alexgorbatchev/gulp-changed-in-place/blob/31a97e9a77e467b9e57f91148e1058fc742c7496/index.js#L8-L18 | train |
alexgorbatchev/gulp-changed-in-place | index.js | processFileBySha1Hash | function processFileBySha1Hash(stream, firstPass, basePath, file, cache) {
// null cannot be hashed
if (file.contents === null) {
// if element is really a file, something weird happened, but it's safer
// to assume it was changed (because we cannot said that it wasn't)
// if it's not a file, we don't c... | javascript | function processFileBySha1Hash(stream, firstPass, basePath, file, cache) {
// null cannot be hashed
if (file.contents === null) {
// if element is really a file, something weird happened, but it's safer
// to assume it was changed (because we cannot said that it wasn't)
// if it's not a file, we don't c... | [
"function",
"processFileBySha1Hash",
"(",
"stream",
",",
"firstPass",
",",
"basePath",
",",
"file",
",",
"cache",
")",
"{",
"// null cannot be hashed",
"if",
"(",
"file",
".",
"contents",
"===",
"null",
")",
"{",
"// if element is really a file, something weird happen... | look for changes by sha1 hash | [
"look",
"for",
"changes",
"by",
"sha1",
"hash"
] | 31a97e9a77e467b9e57f91148e1058fc742c7496 | https://github.com/alexgorbatchev/gulp-changed-in-place/blob/31a97e9a77e467b9e57f91148e1058fc742c7496/index.js#L21-L41 | train |
DekodeInteraktiv/heisenberg | packages/heisenberg-scripts/scripts/build.js | build | async function build( previousFileSizes ) {
console.log( 'Creating an optimized production build...' );
const filenames = await getFilenames( FILENAMES );
const webpackConfig = await createWebpackConfig( config( filenames ) );
const compiler = webpack( webpackConfig );
return new Promise( ( resolve, reject ) => ... | javascript | async function build( previousFileSizes ) {
console.log( 'Creating an optimized production build...' );
const filenames = await getFilenames( FILENAMES );
const webpackConfig = await createWebpackConfig( config( filenames ) );
const compiler = webpack( webpackConfig );
return new Promise( ( resolve, reject ) => ... | [
"async",
"function",
"build",
"(",
"previousFileSizes",
")",
"{",
"console",
".",
"log",
"(",
"'Creating an optimized production build...'",
")",
";",
"const",
"filenames",
"=",
"await",
"getFilenames",
"(",
"FILENAMES",
")",
";",
"const",
"webpackConfig",
"=",
"a... | Build script. | [
"Build",
"script",
"."
] | 7e307243d727a9489bbc980608f7bb8db74a5d28 | https://github.com/DekodeInteraktiv/heisenberg/blob/7e307243d727a9489bbc980608f7bb8db74a5d28/packages/heisenberg-scripts/scripts/build.js#L41-L83 | train |
standardhealth/shr-models | lib/export/formatters/commons.js | constructCode | function constructCode(code, system, display) {
const codeObj = new models.Concept(system, code, display);
return codeObj;
} | javascript | function constructCode(code, system, display) {
const codeObj = new models.Concept(system, code, display);
return codeObj;
} | [
"function",
"constructCode",
"(",
"code",
",",
"system",
",",
"display",
")",
"{",
"const",
"codeObj",
"=",
"new",
"models",
".",
"Concept",
"(",
"system",
",",
"code",
",",
"display",
")",
";",
"return",
"codeObj",
";",
"}"
] | Concept from components
Constructs a Concept object from component details.
@param {string} code - the code component of a Concept Code
@param {uri} system - the code system component of a Concept Code
@param {string} display - descriptive display text to show alongside the Concept Code
@returns {Concept} A Concept o... | [
"Concept",
"from",
"components"
] | ae43390c92834950299e06b627a9bdc0e155e6fe | https://github.com/standardhealth/shr-models/blob/ae43390c92834950299e06b627a9bdc0e155e6fe/lib/export/formatters/commons.js#L114-L117 | train |
standardhealth/shr-models | lib/export/formatters/commons.js | shorthandFromCodesystem | function shorthandFromCodesystem(cs) {
if (!cs) {
return '';
}
if (shorthands[cs]) {
return shorthands[cs];
} else if (cs.match(/http:\/\/standardhealthrecord.org\/shr\/[A-Za-z]*\/cs\/(#[A-Za-z]*CS)/)) {
return '';
} else {
return cs;
}
} | javascript | function shorthandFromCodesystem(cs) {
if (!cs) {
return '';
}
if (shorthands[cs]) {
return shorthands[cs];
} else if (cs.match(/http:\/\/standardhealthrecord.org\/shr\/[A-Za-z]*\/cs\/(#[A-Za-z]*CS)/)) {
return '';
} else {
return cs;
}
} | [
"function",
"shorthandFromCodesystem",
"(",
"cs",
")",
"{",
"if",
"(",
"!",
"cs",
")",
"{",
"return",
"''",
";",
"}",
"if",
"(",
"shorthands",
"[",
"cs",
"]",
")",
"{",
"return",
"shorthands",
"[",
"cs",
"]",
";",
"}",
"else",
"if",
"(",
"cs",
".... | Converts a code system URI to a shorthand symbol.
This contains popularly used shorthands. For other code systems,
it will generate a generic shorthand.
For URI's that match the project's URL, we omit a shorthand as
that is unnecessary in CIMPL 5.
@todo Aggregate generic shorthands
@todo Convert shr.org to config pr... | [
"Converts",
"a",
"code",
"system",
"URI",
"to",
"a",
"shorthand",
"symbol",
"."
] | ae43390c92834950299e06b627a9bdc0e155e6fe | https://github.com/standardhealth/shr-models/blob/ae43390c92834950299e06b627a9bdc0e155e6fe/lib/export/formatters/commons.js#L134-L146 | train |
standardhealth/shr-models | lib/export/formatters/commons.js | formattedCodeFromConcept | function formattedCodeFromConcept(concept) {
var formattedConceptCode = `${shorthandFromCodesystem(concept.system)}#${concept.code}`;
if (concept.display) {
formattedConceptCode = `${formattedConceptCode} "${concept.display}"`;
} else if (concept.description) {
formattedConceptCode = `${formattedConceptCo... | javascript | function formattedCodeFromConcept(concept) {
var formattedConceptCode = `${shorthandFromCodesystem(concept.system)}#${concept.code}`;
if (concept.display) {
formattedConceptCode = `${formattedConceptCode} "${concept.display}"`;
} else if (concept.description) {
formattedConceptCode = `${formattedConceptCo... | [
"function",
"formattedCodeFromConcept",
"(",
"concept",
")",
"{",
"var",
"formattedConceptCode",
"=",
"`",
"${",
"shorthandFromCodesystem",
"(",
"concept",
".",
"system",
")",
"}",
"${",
"concept",
".",
"code",
"}",
"`",
";",
"if",
"(",
"concept",
".",
"disp... | Outputs concept code text fragment
@param {Concept} concept
@returns {string} - formatted concept code text fragment | [
"Outputs",
"concept",
"code",
"text",
"fragment"
] | ae43390c92834950299e06b627a9bdc0e155e6fe | https://github.com/standardhealth/shr-models/blob/ae43390c92834950299e06b627a9bdc0e155e6fe/lib/export/formatters/commons.js#L154-L163 | train |
nelsonomuto/angular-ui-form-validation | dist/bower_components/jquery/src/attributes.js | function( elem, name, isXML ) {
var ret;
return isXML ?
undefined :
(ret = elem.getAttributeNode( name )) && ret.value !== "" ?
ret.value :
null;
} | javascript | function( elem, name, isXML ) {
var ret;
return isXML ?
undefined :
(ret = elem.getAttributeNode( name )) && ret.value !== "" ?
ret.value :
null;
} | [
"function",
"(",
"elem",
",",
"name",
",",
"isXML",
")",
"{",
"var",
"ret",
";",
"return",
"isXML",
"?",
"undefined",
":",
"(",
"ret",
"=",
"elem",
".",
"getAttributeNode",
"(",
"name",
")",
")",
"&&",
"ret",
".",
"value",
"!==",
"\"\"",
"?",
"ret"... | Some attributes are constructed with empty-string values when not defined | [
"Some",
"attributes",
"are",
"constructed",
"with",
"empty",
"-",
"string",
"values",
"when",
"not",
"defined"
] | 5ab88160fe3512e0a7abbb369aaf0af652753766 | https://github.com/nelsonomuto/angular-ui-form-validation/blob/5ab88160fe3512e0a7abbb369aaf0af652753766/dist/bower_components/jquery/src/attributes.js#L535-L542 | train | |
nelsonomuto/angular-ui-form-validation | dist/bower_components/jquery/Gruntfile.js | function( flag, needsFlag ) {
// optIn defaults implicit behavior to weak exclusion
if ( optIn && !modules[ flag ] && !modules[ "+" + flag ] ) {
excluded[ flag ] = false;
}
// explicit or inherited strong exclusion
if ( excluded[ needsFlag ] || modules[ "-" + flag ] ) {
excluded[ f... | javascript | function( flag, needsFlag ) {
// optIn defaults implicit behavior to weak exclusion
if ( optIn && !modules[ flag ] && !modules[ "+" + flag ] ) {
excluded[ flag ] = false;
}
// explicit or inherited strong exclusion
if ( excluded[ needsFlag ] || modules[ "-" + flag ] ) {
excluded[ f... | [
"function",
"(",
"flag",
",",
"needsFlag",
")",
"{",
"// optIn defaults implicit behavior to weak exclusion",
"if",
"(",
"optIn",
"&&",
"!",
"modules",
"[",
"flag",
"]",
"&&",
"!",
"modules",
"[",
"\"+\"",
"+",
"flag",
"]",
")",
"{",
"excluded",
"[",
"flag",... | Concat specified files. | [
"Concat",
"specified",
"files",
"."
] | 5ab88160fe3512e0a7abbb369aaf0af652753766 | https://github.com/nelsonomuto/angular-ui-form-validation/blob/5ab88160fe3512e0a7abbb369aaf0af652753766/dist/bower_components/jquery/Gruntfile.js#L312-L336 | train | |
nelsonomuto/angular-ui-form-validation | dist/bower_components/lazy.js/lazy.js | getEachForSource | function getEachForSource(source) {
if (source.length < 40) {
return UniqueArrayWrapper.prototype.eachNoCache;
} else if (source.length < 100) {
return UniqueArrayWrapper.prototype.eachArrayCache;
} else {
return UniqueArrayWrapper.prototype.eachSetCache;
}
} | javascript | function getEachForSource(source) {
if (source.length < 40) {
return UniqueArrayWrapper.prototype.eachNoCache;
} else if (source.length < 100) {
return UniqueArrayWrapper.prototype.eachArrayCache;
} else {
return UniqueArrayWrapper.prototype.eachSetCache;
}
} | [
"function",
"getEachForSource",
"(",
"source",
")",
"{",
"if",
"(",
"source",
".",
"length",
"<",
"40",
")",
"{",
"return",
"UniqueArrayWrapper",
".",
"prototype",
".",
"eachNoCache",
";",
"}",
"else",
"if",
"(",
"source",
".",
"length",
"<",
"100",
")",... | My latest findings here...
So I hadn't really given the set-based approach enough credit. The main issue
was that my Set implementation was totally not optimized at all. After pretty
heavily optimizing it (just take a look; it's a monstrosity now!), it now
becomes the fastest option for much smaller values of N. | [
"My",
"latest",
"findings",
"here",
"..."
] | 5ab88160fe3512e0a7abbb369aaf0af652753766 | https://github.com/nelsonomuto/angular-ui-form-validation/blob/5ab88160fe3512e0a7abbb369aaf0af652753766/dist/bower_components/lazy.js/lazy.js#L3164-L3172 | train |
nelsonomuto/angular-ui-form-validation | dist/bower_components/lazy.js/lazy.js | createCallback | function createCallback(callback, defaultValue) {
switch (typeof callback) {
case "function":
return callback;
case "string":
return function(e) {
return e[callback];
};
case "object":
return function(e) {
return Lazy(callback).all(function(val... | javascript | function createCallback(callback, defaultValue) {
switch (typeof callback) {
case "function":
return callback;
case "string":
return function(e) {
return e[callback];
};
case "object":
return function(e) {
return Lazy(callback).all(function(val... | [
"function",
"createCallback",
"(",
"callback",
",",
"defaultValue",
")",
"{",
"switch",
"(",
"typeof",
"callback",
")",
"{",
"case",
"\"function\"",
":",
"return",
"callback",
";",
"case",
"\"string\"",
":",
"return",
"function",
"(",
"e",
")",
"{",
"return"... | Creates a callback... you know, Lo-Dash style.
- for functions, just returns the function
- for strings, returns a pluck-style callback
- for objects, returns a where-style callback
@private
@param {Function|string|Object} callback A function, string, or object to
convert to a callback.
@param {*} defaultReturn If th... | [
"Creates",
"a",
"callback",
"...",
"you",
"know",
"Lo",
"-",
"Dash",
"style",
"."
] | 5ab88160fe3512e0a7abbb369aaf0af652753766 | https://github.com/nelsonomuto/angular-ui-form-validation/blob/5ab88160fe3512e0a7abbb369aaf0af652753766/dist/bower_components/lazy.js/lazy.js#L5288-L5313 | train |
nelsonomuto/angular-ui-form-validation | dist/bower_components/lazy.js/lazy.js | createSet | function createSet(values) {
var set = new Set();
Lazy(values || []).flatten().each(function(e) {
set.add(e);
});
return set;
} | javascript | function createSet(values) {
var set = new Set();
Lazy(values || []).flatten().each(function(e) {
set.add(e);
});
return set;
} | [
"function",
"createSet",
"(",
"values",
")",
"{",
"var",
"set",
"=",
"new",
"Set",
"(",
")",
";",
"Lazy",
"(",
"values",
"||",
"[",
"]",
")",
".",
"flatten",
"(",
")",
".",
"each",
"(",
"function",
"(",
"e",
")",
"{",
"set",
".",
"add",
"(",
... | Creates a Set containing the specified values.
@param {...Array} values One or more array(s) of values used to populate the
set.
@returns {Set} A new set containing the values passed in. | [
"Creates",
"a",
"Set",
"containing",
"the",
"specified",
"values",
"."
] | 5ab88160fe3512e0a7abbb369aaf0af652753766 | https://github.com/nelsonomuto/angular-ui-form-validation/blob/5ab88160fe3512e0a7abbb369aaf0af652753766/dist/bower_components/lazy.js/lazy.js#L5322-L5328 | train |
nelsonomuto/angular-ui-form-validation | dist/bower_components/lazy.js/lazy.js | compare | function compare(x, y, fn) {
if (typeof fn === "function") {
return compare(fn(x), fn(y));
}
if (x === y) {
return 0;
}
return x > y ? 1 : -1;
} | javascript | function compare(x, y, fn) {
if (typeof fn === "function") {
return compare(fn(x), fn(y));
}
if (x === y) {
return 0;
}
return x > y ? 1 : -1;
} | [
"function",
"compare",
"(",
"x",
",",
"y",
",",
"fn",
")",
"{",
"if",
"(",
"typeof",
"fn",
"===",
"\"function\"",
")",
"{",
"return",
"compare",
"(",
"fn",
"(",
"x",
")",
",",
"fn",
"(",
"y",
")",
")",
";",
"}",
"if",
"(",
"x",
"===",
"y",
... | Compares two elements for sorting purposes.
@private
@param {*} x The left element to compare.
@param {*} y The right element to compare.
@param {Function=} fn An optional function to call on each element, to get
the values to compare.
@returns {number} 1 if x > y, -1 if x < y, or 0 if x and y are equal.
@examples
co... | [
"Compares",
"two",
"elements",
"for",
"sorting",
"purposes",
"."
] | 5ab88160fe3512e0a7abbb369aaf0af652753766 | https://github.com/nelsonomuto/angular-ui-form-validation/blob/5ab88160fe3512e0a7abbb369aaf0af652753766/dist/bower_components/lazy.js/lazy.js#L5346-L5356 | train |
nelsonomuto/angular-ui-form-validation | dist/bower_components/lazy.js/lazy.js | forEach | function forEach(array, fn) {
var i = -1,
len = array.length;
while (++i < len) {
if (fn(array[i], i) === false) {
return false;
}
}
return true;
} | javascript | function forEach(array, fn) {
var i = -1,
len = array.length;
while (++i < len) {
if (fn(array[i], i) === false) {
return false;
}
}
return true;
} | [
"function",
"forEach",
"(",
"array",
",",
"fn",
")",
"{",
"var",
"i",
"=",
"-",
"1",
",",
"len",
"=",
"array",
".",
"length",
";",
"while",
"(",
"++",
"i",
"<",
"len",
")",
"{",
"if",
"(",
"fn",
"(",
"array",
"[",
"i",
"]",
",",
"i",
")",
... | Iterates over every element in an array.
@param {Array} array The array.
@param {Function} fn The function to call on every element, which can return
false to stop the iteration early.
@returns {boolean} True if every element in the entire sequence was iterated,
otherwise false. | [
"Iterates",
"over",
"every",
"element",
"in",
"an",
"array",
"."
] | 5ab88160fe3512e0a7abbb369aaf0af652753766 | https://github.com/nelsonomuto/angular-ui-form-validation/blob/5ab88160fe3512e0a7abbb369aaf0af652753766/dist/bower_components/lazy.js/lazy.js#L5367-L5378 | train |
nelsonomuto/angular-ui-form-validation | dist/bower_components/lazy.js/lazy.js | arrayContains | function arrayContains(array, element) {
var i = -1,
length = array.length;
// Special handling for NaN
if (element !== element) {
while (++i < length) {
if (array[i] !== array[i]) {
return true;
}
}
return false;
}
while (++i < length) {
i... | javascript | function arrayContains(array, element) {
var i = -1,
length = array.length;
// Special handling for NaN
if (element !== element) {
while (++i < length) {
if (array[i] !== array[i]) {
return true;
}
}
return false;
}
while (++i < length) {
i... | [
"function",
"arrayContains",
"(",
"array",
",",
"element",
")",
"{",
"var",
"i",
"=",
"-",
"1",
",",
"length",
"=",
"array",
".",
"length",
";",
"// Special handling for NaN",
"if",
"(",
"element",
"!==",
"element",
")",
"{",
"while",
"(",
"++",
"i",
"... | Checks if an element exists in an array.
@private
@param {Array} array
@param {*} element
@returns {boolean} Whether or not the element exists in the array.
@examples
arrayContains([1, 2], 2) // => true
arrayContains([1, 2], 3) // => false
arrayContains([undefined], undefined) // => true
arr... | [
"Checks",
"if",
"an",
"element",
"exists",
"in",
"an",
"array",
"."
] | 5ab88160fe3512e0a7abbb369aaf0af652753766 | https://github.com/nelsonomuto/angular-ui-form-validation/blob/5ab88160fe3512e0a7abbb369aaf0af652753766/dist/bower_components/lazy.js/lazy.js#L5403-L5423 | train |
nelsonomuto/angular-ui-form-validation | dist/bower_components/lazy.js/lazy.js | arrayContainsBefore | function arrayContainsBefore(array, element, index, keyFn) {
var i = -1;
if (keyFn) {
keyFn = createCallback(keyFn);
while (++i < index) {
if (keyFn(array[i]) === keyFn(element)) {
return true;
}
}
} else {
while (++i < index) {
if (array[i] === el... | javascript | function arrayContainsBefore(array, element, index, keyFn) {
var i = -1;
if (keyFn) {
keyFn = createCallback(keyFn);
while (++i < index) {
if (keyFn(array[i]) === keyFn(element)) {
return true;
}
}
} else {
while (++i < index) {
if (array[i] === el... | [
"function",
"arrayContainsBefore",
"(",
"array",
",",
"element",
",",
"index",
",",
"keyFn",
")",
"{",
"var",
"i",
"=",
"-",
"1",
";",
"if",
"(",
"keyFn",
")",
"{",
"keyFn",
"=",
"createCallback",
"(",
"keyFn",
")",
";",
"while",
"(",
"++",
"i",
"<... | Checks if an element exists in an array before a given index.
@private
@param {Array} array
@param {*} element
@param {number} index
@param {Function} keyFn
@returns {boolean}
@examples
arrayContainsBefore([1, 2, 3], 3, 2) // => false
arrayContainsBefore([1, 2, 3], 3, 3) // => true | [
"Checks",
"if",
"an",
"element",
"exists",
"in",
"an",
"array",
"before",
"a",
"given",
"index",
"."
] | 5ab88160fe3512e0a7abbb369aaf0af652753766 | https://github.com/nelsonomuto/angular-ui-form-validation/blob/5ab88160fe3512e0a7abbb369aaf0af652753766/dist/bower_components/lazy.js/lazy.js#L5439-L5459 | train |
nelsonomuto/angular-ui-form-validation | dist/bower_components/lazy.js/lazy.js | swap | function swap(array, i, j) {
var temp = array[i];
array[i] = array[j];
array[j] = temp;
} | javascript | function swap(array, i, j) {
var temp = array[i];
array[i] = array[j];
array[j] = temp;
} | [
"function",
"swap",
"(",
"array",
",",
"i",
",",
"j",
")",
"{",
"var",
"temp",
"=",
"array",
"[",
"i",
"]",
";",
"array",
"[",
"i",
"]",
"=",
"array",
"[",
"j",
"]",
";",
"array",
"[",
"j",
"]",
"=",
"temp",
";",
"}"
] | Swaps the elements at two specified positions of an array.
@private
@param {Array} array
@param {number} i
@param {number} j
@examples
var array = [1, 2, 3, 4, 5];
swap(array, 2, 3) // array == [1, 2, 4, 3, 5] | [
"Swaps",
"the",
"elements",
"at",
"two",
"specified",
"positions",
"of",
"an",
"array",
"."
] | 5ab88160fe3512e0a7abbb369aaf0af652753766 | https://github.com/nelsonomuto/angular-ui-form-validation/blob/5ab88160fe3512e0a7abbb369aaf0af652753766/dist/bower_components/lazy.js/lazy.js#L5474-L5478 | train |
nelsonomuto/angular-ui-form-validation | dist/bower_components/lazy.js/lazy.js | defineSequenceType | function defineSequenceType(base, name, overrides) {
/** @constructor */
var ctor = function ctor() {};
// Make this type inherit from the specified base.
ctor.prototype = new base();
// Attach overrides to the new sequence type's prototype.
for (var override in overrides) {
ctor.prototy... | javascript | function defineSequenceType(base, name, overrides) {
/** @constructor */
var ctor = function ctor() {};
// Make this type inherit from the specified base.
ctor.prototype = new base();
// Attach overrides to the new sequence type's prototype.
for (var override in overrides) {
ctor.prototy... | [
"function",
"defineSequenceType",
"(",
"base",
",",
"name",
",",
"overrides",
")",
"{",
"/** @constructor */",
"var",
"ctor",
"=",
"function",
"ctor",
"(",
")",
"{",
"}",
";",
"// Make this type inherit from the specified base.",
"ctor",
".",
"prototype",
"=",
"ne... | Shared base method for defining new sequence types. | [
"Shared",
"base",
"method",
"for",
"defining",
"new",
"sequence",
"types",
"."
] | 5ab88160fe3512e0a7abbb369aaf0af652753766 | https://github.com/nelsonomuto/angular-ui-form-validation/blob/5ab88160fe3512e0a7abbb369aaf0af652753766/dist/bower_components/lazy.js/lazy.js#L5750-L5786 | train |
nelsonomuto/angular-ui-form-validation | dist/bower_components/log4js/log4js-site/xdocs/skins/common/scripts/breadcrumbs.js | getDirectoriesInURL | function getDirectoriesInURL()
{
var trail = document.location.pathname.split( PATH_SEPARATOR );
// check whether last section is a file or a directory
var lastcrumb = trail[trail.length-1];
for( var i = 0; i < FILE_EXTENSIONS.length; i++ )
{
if( lastcrumb.indexOf( FILE_EXTENSIONS[i] ) )
{
// it is, remove... | javascript | function getDirectoriesInURL()
{
var trail = document.location.pathname.split( PATH_SEPARATOR );
// check whether last section is a file or a directory
var lastcrumb = trail[trail.length-1];
for( var i = 0; i < FILE_EXTENSIONS.length; i++ )
{
if( lastcrumb.indexOf( FILE_EXTENSIONS[i] ) )
{
// it is, remove... | [
"function",
"getDirectoriesInURL",
"(",
")",
"{",
"var",
"trail",
"=",
"document",
".",
"location",
".",
"pathname",
".",
"split",
"(",
"PATH_SEPARATOR",
")",
";",
"// check whether last section is a file or a directory",
"var",
"lastcrumb",
"=",
"trail",
"[",
"trai... | Returns an array containing the names of all the directories in the
current document URL | [
"Returns",
"an",
"array",
"containing",
"the",
"names",
"of",
"all",
"the",
"directories",
"in",
"the",
"current",
"document",
"URL"
] | 5ab88160fe3512e0a7abbb369aaf0af652753766 | https://github.com/nelsonomuto/angular-ui-form-validation/blob/5ab88160fe3512e0a7abbb369aaf0af652753766/dist/bower_components/log4js/log4js-site/xdocs/skins/common/scripts/breadcrumbs.js#L124-L141 | train |
nelsonomuto/angular-ui-form-validation | dist/bower_components/log4js/log4js-site/xdocs/skins/common/scripts/breadcrumbs.js | getCrumbTrail | function getCrumbTrail( crumbs )
{
var xhtml = DISPLAY_PREPREND;
for( var i = 0; i < crumbs.length; i++ )
{
xhtml += '<a href="' + crumbs[i][1] + '" >';
xhtml += unescape( crumbs[i][0] ) + '</a>';
if( i != (crumbs.length-1) )
{
xhtml += DISPLAY_SEPARATOR;
}
}
xhtml += DISPLAY_POSTPREND;
return xht... | javascript | function getCrumbTrail( crumbs )
{
var xhtml = DISPLAY_PREPREND;
for( var i = 0; i < crumbs.length; i++ )
{
xhtml += '<a href="' + crumbs[i][1] + '" >';
xhtml += unescape( crumbs[i][0] ) + '</a>';
if( i != (crumbs.length-1) )
{
xhtml += DISPLAY_SEPARATOR;
}
}
xhtml += DISPLAY_POSTPREND;
return xht... | [
"function",
"getCrumbTrail",
"(",
"crumbs",
")",
"{",
"var",
"xhtml",
"=",
"DISPLAY_PREPREND",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"crumbs",
".",
"length",
";",
"i",
"++",
")",
"{",
"xhtml",
"+=",
"'<a href=\"'",
"+",
"crumbs",
"[",... | Return a string containing a simple text breadcrumb trail based on the
two-dimensional array passed in. | [
"Return",
"a",
"string",
"containing",
"a",
"simple",
"text",
"breadcrumb",
"trail",
"based",
"on",
"the",
"two",
"-",
"dimensional",
"array",
"passed",
"in",
"."
] | 5ab88160fe3512e0a7abbb369aaf0af652753766 | https://github.com/nelsonomuto/angular-ui-form-validation/blob/5ab88160fe3512e0a7abbb369aaf0af652753766/dist/bower_components/log4js/log4js-site/xdocs/skins/common/scripts/breadcrumbs.js#L180-L197 | train |
nelsonomuto/angular-ui-form-validation | dist/bower_components/log4js/log4js-site/xdocs/skins/common/scripts/breadcrumbs.js | getCrumbTrailXHTML | function getCrumbTrailXHTML( crumbs )
{
var xhtml = '<span class="' + CSS_CLASS_TRAIL + '">';
xhtml += DISPLAY_PREPREND;
for( var i = 0; i < crumbs.length; i++ )
{
xhtml += '<a href="' + crumbs[i][1] + '" class="' + CSS_CLASS_CRUMB + '">';
xhtml += unescape( crumbs[i][0] ) + '</a>';
if( i != (crumbs.length-... | javascript | function getCrumbTrailXHTML( crumbs )
{
var xhtml = '<span class="' + CSS_CLASS_TRAIL + '">';
xhtml += DISPLAY_PREPREND;
for( var i = 0; i < crumbs.length; i++ )
{
xhtml += '<a href="' + crumbs[i][1] + '" class="' + CSS_CLASS_CRUMB + '">';
xhtml += unescape( crumbs[i][0] ) + '</a>';
if( i != (crumbs.length-... | [
"function",
"getCrumbTrailXHTML",
"(",
"crumbs",
")",
"{",
"var",
"xhtml",
"=",
"'<span class=\"'",
"+",
"CSS_CLASS_TRAIL",
"+",
"'\">'",
";",
"xhtml",
"+=",
"DISPLAY_PREPREND",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"crumbs",
".",
"length",... | Return a string containing an XHTML breadcrumb trail based on the
two-dimensional array passed in. | [
"Return",
"a",
"string",
"containing",
"an",
"XHTML",
"breadcrumb",
"trail",
"based",
"on",
"the",
"two",
"-",
"dimensional",
"array",
"passed",
"in",
"."
] | 5ab88160fe3512e0a7abbb369aaf0af652753766 | https://github.com/nelsonomuto/angular-ui-form-validation/blob/5ab88160fe3512e0a7abbb369aaf0af652753766/dist/bower_components/log4js/log4js-site/xdocs/skins/common/scripts/breadcrumbs.js#L203-L222 | train |
nelsonomuto/angular-ui-form-validation | dist/bower_components/log4js/log4js/src/main/js/log4js.js | function(categoryName) {
// Use default logger if categoryName is not specified or invalid
if (!(typeof categoryName == "string")) {
categoryName = "[default]";
}
if (!Log4js.loggers[categoryName]) {
// Create the logger for this name if it doesn't already exist
Log4js.loggers[categoryName] = new L... | javascript | function(categoryName) {
// Use default logger if categoryName is not specified or invalid
if (!(typeof categoryName == "string")) {
categoryName = "[default]";
}
if (!Log4js.loggers[categoryName]) {
// Create the logger for this name if it doesn't already exist
Log4js.loggers[categoryName] = new L... | [
"function",
"(",
"categoryName",
")",
"{",
"// Use default logger if categoryName is not specified or invalid",
"if",
"(",
"!",
"(",
"typeof",
"categoryName",
"==",
"\"string\"",
")",
")",
"{",
"categoryName",
"=",
"\"[default]\"",
";",
"}",
"if",
"(",
"!",
"Log4js"... | Get a logger instance. Instance is cached on categoryName level.
@param {String} categoryName name of category to log to.
@return {Logger} instance of logger for the category
@static | [
"Get",
"a",
"logger",
"instance",
".",
"Instance",
"is",
"cached",
"on",
"categoryName",
"level",
"."
] | 5ab88160fe3512e0a7abbb369aaf0af652753766 | https://github.com/nelsonomuto/angular-ui-form-validation/blob/5ab88160fe3512e0a7abbb369aaf0af652753766/dist/bower_components/log4js/log4js/src/main/js/log4js.js#L76-L89 | train | |
nelsonomuto/angular-ui-form-validation | dist/bower_components/log4js/log4js/src/main/js/log4js.js | function (element, name, observer) {
if (element.addEventListener) { //DOM event model
element.addEventListener(name, observer, false);
} else if (element.attachEvent) { //M$ event model
element.attachEvent('on' + name, observer);
}
} | javascript | function (element, name, observer) {
if (element.addEventListener) { //DOM event model
element.addEventListener(name, observer, false);
} else if (element.attachEvent) { //M$ event model
element.attachEvent('on' + name, observer);
}
} | [
"function",
"(",
"element",
",",
"name",
",",
"observer",
")",
"{",
"if",
"(",
"element",
".",
"addEventListener",
")",
"{",
"//DOM event model",
"element",
".",
"addEventListener",
"(",
"name",
",",
"observer",
",",
"false",
")",
";",
"}",
"else",
"if",
... | Atatch an observer function to an elements event browser independent.
@param element element to attach event
@param name name of event
@param observer observer method to be called
@private | [
"Atatch",
"an",
"observer",
"function",
"to",
"an",
"elements",
"event",
"browser",
"independent",
"."
] | 5ab88160fe3512e0a7abbb369aaf0af652753766 | https://github.com/nelsonomuto/angular-ui-form-validation/blob/5ab88160fe3512e0a7abbb369aaf0af652753766/dist/bower_components/log4js/log4js/src/main/js/log4js.js#L108-L114 | train | |
nelsonomuto/angular-ui-form-validation | dist/bower_components/log4js/log4js/src/main/js/log4js.js | function(sArg, defaultLevel) {
if(sArg === null) {
return defaultLevel;
}
if(typeof sArg == "string") {
var s = sArg.toUpperCase();
if(s == "ALL") {return Log4js.Level.ALL;}
if(s == "DEBUG") {return Log4js.Level.DEBUG;}
if(s == "INFO") {return Log4js.Level.INFO;}
if(s ... | javascript | function(sArg, defaultLevel) {
if(sArg === null) {
return defaultLevel;
}
if(typeof sArg == "string") {
var s = sArg.toUpperCase();
if(s == "ALL") {return Log4js.Level.ALL;}
if(s == "DEBUG") {return Log4js.Level.DEBUG;}
if(s == "INFO") {return Log4js.Level.INFO;}
if(s ... | [
"function",
"(",
"sArg",
",",
"defaultLevel",
")",
"{",
"if",
"(",
"sArg",
"===",
"null",
")",
"{",
"return",
"defaultLevel",
";",
"}",
"if",
"(",
"typeof",
"sArg",
"==",
"\"string\"",
")",
"{",
"var",
"s",
"=",
"sArg",
".",
"toUpperCase",
"(",
")",
... | converts given String to corresponding Level
@param {String} sArg String value of Level
@param {Log4js.Level} defaultLevel default Level, if no String representation
@return Level object
@type Log4js.Level | [
"converts",
"given",
"String",
"to",
"corresponding",
"Level"
] | 5ab88160fe3512e0a7abbb369aaf0af652753766 | https://github.com/nelsonomuto/angular-ui-form-validation/blob/5ab88160fe3512e0a7abbb369aaf0af652753766/dist/bower_components/log4js/log4js/src/main/js/log4js.js#L191-L223 | train | |
nelsonomuto/angular-ui-form-validation | dist/bower_components/log4js/log4js/src/main/js/log4js.js | function(appender) {
if (appender instanceof Log4js.Appender) {
appender.setLogger(this);
this.appenders.push(appender);
} else {
throw "Not instance of an Appender: " + appender;
}
} | javascript | function(appender) {
if (appender instanceof Log4js.Appender) {
appender.setLogger(this);
this.appenders.push(appender);
} else {
throw "Not instance of an Appender: " + appender;
}
} | [
"function",
"(",
"appender",
")",
"{",
"if",
"(",
"appender",
"instanceof",
"Log4js",
".",
"Appender",
")",
"{",
"appender",
".",
"setLogger",
"(",
"this",
")",
";",
"this",
".",
"appenders",
".",
"push",
"(",
"appender",
")",
";",
"}",
"else",
"{",
... | add additional appender. DefaultAppender always is there.
@param appender additional wanted appender | [
"add",
"additional",
"appender",
".",
"DefaultAppender",
"always",
"is",
"there",
"."
] | 5ab88160fe3512e0a7abbb369aaf0af652753766 | https://github.com/nelsonomuto/angular-ui-form-validation/blob/5ab88160fe3512e0a7abbb369aaf0af652753766/dist/bower_components/log4js/log4js/src/main/js/log4js.js#L489-L496 | train | |
nelsonomuto/angular-ui-form-validation | dist/bower_components/log4js/log4js/src/main/js/log4js.js | function(appenders) {
//clear first all existing appenders
for(var i = 0; i < this.appenders.length; i++) {
this.appenders[i].doClear();
}
this.appenders = appenders;
for(var j = 0; j < this.appenders.length; j++) {
this.appenders[j].setLogger(this);
}
} | javascript | function(appenders) {
//clear first all existing appenders
for(var i = 0; i < this.appenders.length; i++) {
this.appenders[i].doClear();
}
this.appenders = appenders;
for(var j = 0; j < this.appenders.length; j++) {
this.appenders[j].setLogger(this);
}
} | [
"function",
"(",
"appenders",
")",
"{",
"//clear first all existing appenders",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"appenders",
".",
"length",
";",
"i",
"++",
")",
"{",
"this",
".",
"appenders",
"[",
"i",
"]",
".",
"doClear",... | set Array of appenders. Previous Appenders are cleared and removed.
@param {Array} appenders Array of Appenders | [
"set",
"Array",
"of",
"appenders",
".",
"Previous",
"Appenders",
"are",
"cleared",
"and",
"removed",
"."
] | 5ab88160fe3512e0a7abbb369aaf0af652753766 | https://github.com/nelsonomuto/angular-ui-form-validation/blob/5ab88160fe3512e0a7abbb369aaf0af652753766/dist/bower_components/log4js/log4js/src/main/js/log4js.js#L502-L513 | train | |
nelsonomuto/angular-ui-form-validation | dist/bower_components/log4js/log4js/src/main/js/log4js.js | function(logLevel, message, exception) {
var loggingEvent = new Log4js.LoggingEvent(this.category, logLevel,
message, exception, this);
this.loggingEvents.push(loggingEvent);
this.onlog.dispatch(loggingEvent);
} | javascript | function(logLevel, message, exception) {
var loggingEvent = new Log4js.LoggingEvent(this.category, logLevel,
message, exception, this);
this.loggingEvents.push(loggingEvent);
this.onlog.dispatch(loggingEvent);
} | [
"function",
"(",
"logLevel",
",",
"message",
",",
"exception",
")",
"{",
"var",
"loggingEvent",
"=",
"new",
"Log4js",
".",
"LoggingEvent",
"(",
"this",
".",
"category",
",",
"logLevel",
",",
"message",
",",
"exception",
",",
"this",
")",
";",
"this",
"."... | main log method logging to all available appenders
@private | [
"main",
"log",
"method",
"logging",
"to",
"all",
"available",
"appenders"
] | 5ab88160fe3512e0a7abbb369aaf0af652753766 | https://github.com/nelsonomuto/angular-ui-form-validation/blob/5ab88160fe3512e0a7abbb369aaf0af652753766/dist/bower_components/log4js/log4js/src/main/js/log4js.js#L527-L532 | train | |
nelsonomuto/angular-ui-form-validation | dist/bower_components/log4js/log4js/src/main/js/log4js.js | function(msg, url, line){
var message = "Error in (" + (url || window.location) + ") on line "+ line +" with message (" + msg + ")";
this.log(Log4js.Level.FATAL, message, null);
} | javascript | function(msg, url, line){
var message = "Error in (" + (url || window.location) + ") on line "+ line +" with message (" + msg + ")";
this.log(Log4js.Level.FATAL, message, null);
} | [
"function",
"(",
"msg",
",",
"url",
",",
"line",
")",
"{",
"var",
"message",
"=",
"\"Error in (\"",
"+",
"(",
"url",
"||",
"window",
".",
"location",
")",
"+",
"\") on line \"",
"+",
"line",
"+",
"\" with message (\"",
"+",
"msg",
"+",
"\")\"",
";",
"t... | Capture main window errors and log as fatal.
@private | [
"Capture",
"main",
"window",
"errors",
"and",
"log",
"as",
"fatal",
"."
] | 5ab88160fe3512e0a7abbb369aaf0af652753766 | https://github.com/nelsonomuto/angular-ui-form-validation/blob/5ab88160fe3512e0a7abbb369aaf0af652753766/dist/bower_components/log4js/log4js/src/main/js/log4js.js#L671-L674 | train | |
nelsonomuto/angular-ui-form-validation | dist/bower_components/log4js/log4js/src/main/js/log4js.js | function(logger){
// add listener to the logger methods
logger.onlog.addListener(Log4js.bind(this.doAppend, this));
logger.onclear.addListener(Log4js.bind(this.doClear, this));
this.logger = logger;
} | javascript | function(logger){
// add listener to the logger methods
logger.onlog.addListener(Log4js.bind(this.doAppend, this));
logger.onclear.addListener(Log4js.bind(this.doClear, this));
this.logger = logger;
} | [
"function",
"(",
"logger",
")",
"{",
"// add listener to the logger methods",
"logger",
".",
"onlog",
".",
"addListener",
"(",
"Log4js",
".",
"bind",
"(",
"this",
".",
"doAppend",
",",
"this",
")",
")",
";",
"logger",
".",
"onclear",
".",
"addListener",
"(",... | Set reference to the logger.
@param {Log4js.Logger} the invoking logger | [
"Set",
"reference",
"to",
"the",
"logger",
"."
] | 5ab88160fe3512e0a7abbb369aaf0af652753766 | https://github.com/nelsonomuto/angular-ui-form-validation/blob/5ab88160fe3512e0a7abbb369aaf0af652753766/dist/bower_components/log4js/log4js/src/main/js/log4js.js#L747-L753 | train | |
nelsonomuto/angular-ui-form-validation | dist/bower_components/log4js/log4js/src/main/js/log4js.js | function(loggingEvent) {
log4jsLogger.trace("> AjaxAppender.append");
if (this.loggingEventMap.length() <= this.threshold || this.isInProgress === true) {
this.loggingEventMap.push(loggingEvent);
}
if(this.loggingEventMap.length() >= this.threshold && this.isInProgress === false) {
//if threshold is ... | javascript | function(loggingEvent) {
log4jsLogger.trace("> AjaxAppender.append");
if (this.loggingEventMap.length() <= this.threshold || this.isInProgress === true) {
this.loggingEventMap.push(loggingEvent);
}
if(this.loggingEventMap.length() >= this.threshold && this.isInProgress === false) {
//if threshold is ... | [
"function",
"(",
"loggingEvent",
")",
"{",
"log4jsLogger",
".",
"trace",
"(",
"\"> AjaxAppender.append\"",
")",
";",
"if",
"(",
"this",
".",
"loggingEventMap",
".",
"length",
"(",
")",
"<=",
"this",
".",
"threshold",
"||",
"this",
".",
"isInProgress",
"===",... | sends the logs to the server
@param loggingEvent event to be logged
@see Log4js.Appender#doAppend | [
"sends",
"the",
"logs",
"to",
"the",
"server"
] | 5ab88160fe3512e0a7abbb369aaf0af652753766 | https://github.com/nelsonomuto/angular-ui-form-validation/blob/5ab88160fe3512e0a7abbb369aaf0af652753766/dist/bower_components/log4js/log4js/src/main/js/log4js.js#L1329-L1342 | train | |
nelsonomuto/angular-ui-form-validation | dist/bower_components/log4js/log4js/src/main/js/log4js.js | function() {
if(this.loggingEventMap.length() >0) {
log4jsLogger.trace("> AjaxAppender.send");
this.isInProgress = true;
var a = [];
for(var i = 0; i < this.loggingEventMap.length() && i < this.threshold; i++) {
a.push(this.layout.format(this.loggingEventMap.pull()));
}
var ... | javascript | function() {
if(this.loggingEventMap.length() >0) {
log4jsLogger.trace("> AjaxAppender.send");
this.isInProgress = true;
var a = [];
for(var i = 0; i < this.loggingEventMap.length() && i < this.threshold; i++) {
a.push(this.layout.format(this.loggingEventMap.pull()));
}
var ... | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"loggingEventMap",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"log4jsLogger",
".",
"trace",
"(",
"\"> AjaxAppender.send\"",
")",
";",
"this",
".",
"isInProgress",
"=",
"true",
";",
"var",
"a",
"=",
... | send the request. | [
"send",
"the",
"request",
"."
] | 5ab88160fe3512e0a7abbb369aaf0af652753766 | https://github.com/nelsonomuto/angular-ui-form-validation/blob/5ab88160fe3512e0a7abbb369aaf0af652753766/dist/bower_components/log4js/log4js/src/main/js/log4js.js#L1375-L1425 | train | |
nelsonomuto/angular-ui-form-validation | dist/bower_components/log4js/log4js/src/main/js/log4js.js | function() {
log4jsLogger.trace("> AjaxAppender.getXmlHttpRequest");
var httpRequest = false;
try {
if (window.XMLHttpRequest) { // Mozilla, Safari, IE7...
httpRequest = new XMLHttpRequest();
if (httpRequest.overrideMimeType) {
httpRequest.overrideMimeType(this.layout.getContentType());
... | javascript | function() {
log4jsLogger.trace("> AjaxAppender.getXmlHttpRequest");
var httpRequest = false;
try {
if (window.XMLHttpRequest) { // Mozilla, Safari, IE7...
httpRequest = new XMLHttpRequest();
if (httpRequest.overrideMimeType) {
httpRequest.overrideMimeType(this.layout.getContentType());
... | [
"function",
"(",
")",
"{",
"log4jsLogger",
".",
"trace",
"(",
"\"> AjaxAppender.getXmlHttpRequest\"",
")",
";",
"var",
"httpRequest",
"=",
"false",
";",
"try",
"{",
"if",
"(",
"window",
".",
"XMLHttpRequest",
")",
"{",
"// Mozilla, Safari, IE7...",
"httpRequest",
... | Get the XMLHttpRequest object independent of browser.
@private | [
"Get",
"the",
"XMLHttpRequest",
"object",
"independent",
"of",
"browser",
"."
] | 5ab88160fe3512e0a7abbb369aaf0af652753766 | https://github.com/nelsonomuto/angular-ui-form-validation/blob/5ab88160fe3512e0a7abbb369aaf0af652753766/dist/bower_components/log4js/log4js/src/main/js/log4js.js#L1457-L1485 | train | |
nelsonomuto/angular-ui-form-validation | dist/bower_components/log4js/log4js/src/main/js/log4js.js | function(ex) {
if (ex) {
var exStr = "\t<log4js:throwable>";
if (ex.message) {
exStr += "\t\t<log4js:message><![CDATA[" + this.escapeCdata(ex.message) + "]]></log4js:message>\n";
}
if (ex.description) {
exStr += "\t\t<log4js:description><![CDATA[" + this.escapeCdata(ex.description) + "]]></lo... | javascript | function(ex) {
if (ex) {
var exStr = "\t<log4js:throwable>";
if (ex.message) {
exStr += "\t\t<log4js:message><![CDATA[" + this.escapeCdata(ex.message) + "]]></log4js:message>\n";
}
if (ex.description) {
exStr += "\t\t<log4js:description><![CDATA[" + this.escapeCdata(ex.description) + "]]></lo... | [
"function",
"(",
"ex",
")",
"{",
"if",
"(",
"ex",
")",
"{",
"var",
"exStr",
"=",
"\"\\t<log4js:throwable>\"",
";",
"if",
"(",
"ex",
".",
"message",
")",
"{",
"exStr",
"+=",
"\"\\t\\t<log4js:message><![CDATA[\"",
"+",
"this",
".",
"escapeCdata",
"(",
"ex",
... | better readable formatted Exceptions.
@param ex {Exception} the exception to be formatted.
@return {String} the formatted String representation of the exception.
@private | [
"better",
"readable",
"formatted",
"Exceptions",
"."
] | 5ab88160fe3512e0a7abbb369aaf0af652753766 | https://github.com/nelsonomuto/angular-ui-form-validation/blob/5ab88160fe3512e0a7abbb369aaf0af652753766/dist/bower_components/log4js/log4js/src/main/js/log4js.js#L2115-L2132 | train | |
localytics/lambda-slack-router | index.js | SlackBot | function SlackBot(config) {
this.config = config || {};
this.commands = {};
this.aliases = {};
if (!this.config.structureResponse) {
this.config.structureResponse = function (response) {
return response;
};
}
} | javascript | function SlackBot(config) {
this.config = config || {};
this.commands = {};
this.aliases = {};
if (!this.config.structureResponse) {
this.config.structureResponse = function (response) {
return response;
};
}
} | [
"function",
"SlackBot",
"(",
"config",
")",
"{",
"this",
".",
"config",
"=",
"config",
"||",
"{",
"}",
";",
"this",
".",
"commands",
"=",
"{",
"}",
";",
"this",
".",
"aliases",
"=",
"{",
"}",
";",
"if",
"(",
"!",
"this",
".",
"config",
".",
"st... | wraps logic around routing | [
"wraps",
"logic",
"around",
"routing"
] | 824e864080188a5146c08cb426c986ff1defdbcc | https://github.com/localytics/lambda-slack-router/blob/824e864080188a5146c08cb426c986ff1defdbcc/index.js#L7-L17 | train |
donejs/autorender | src/init.js | translate | function translate(load){
var filename;
//!steal-remove-start
filename = getFilename(load.name);
//!steal-remove-end
var result = parse(load.source, this, zoneOpts);
// Add any import specifiers to the load.
addImportSpecifiers(load, result);
load.metadata.originalSource = load.source;
// ... | javascript | function translate(load){
var filename;
//!steal-remove-start
filename = getFilename(load.name);
//!steal-remove-end
var result = parse(load.source, this, zoneOpts);
// Add any import specifiers to the load.
addImportSpecifiers(load, result);
load.metadata.originalSource = load.source;
// ... | [
"function",
"translate",
"(",
"load",
")",
"{",
"var",
"filename",
";",
"//!steal-remove-start",
"filename",
"=",
"getFilename",
"(",
"load",
".",
"name",
")",
";",
"//!steal-remove-end",
"var",
"result",
"=",
"parse",
"(",
"load",
".",
"source",
",",
"this"... | !steal-remove-end Takes the stache template and translates it to JS. | [
"!steal",
"-",
"remove",
"-",
"end",
"Takes",
"the",
"stache",
"template",
"and",
"translates",
"it",
"to",
"JS",
"."
] | f3434239969b23181c4a456f784bfb84ea955efb | https://github.com/donejs/autorender/blob/f3434239969b23181c4a456f784bfb84ea955efb/src/init.js#L72-L124 | train |
hakib/MassAutocomplete | massautocomplete.js | ensure_element_id | function ensure_element_id(element) {
if (!element.id || element.id === '') {
element.id = config.generate_random_id('ac_element');
return true;
}
return false;
} | javascript | function ensure_element_id(element) {
if (!element.id || element.id === '') {
element.id = config.generate_random_id('ac_element');
return true;
}
return false;
} | [
"function",
"ensure_element_id",
"(",
"element",
")",
"{",
"if",
"(",
"!",
"element",
".",
"id",
"||",
"element",
".",
"id",
"===",
"''",
")",
"{",
"element",
".",
"id",
"=",
"config",
".",
"generate_random_id",
"(",
"'ac_element'",
")",
";",
"return",
... | Make sure an element has id. Return true if id was generated. | [
"Make",
"sure",
"an",
"element",
"has",
"id",
".",
"Return",
"true",
"if",
"id",
"was",
"generated",
"."
] | 6bb50c86f246589aa1a573cb489cd13c1b2ad4e9 | https://github.com/hakib/MassAutocomplete/blob/6bb50c86f246589aa1a573cb489cd13c1b2ad4e9/massautocomplete.js#L150-L156 | train |
hakib/MassAutocomplete | massautocomplete.js | _attach | function _attach(ngmodel, target_element, options) {
// Element is already attached.
if (current_element === target_element) {
return;
}
// Safe: clear previously attached elements.
if (current_element) {
that.detach();
}
// The element is st... | javascript | function _attach(ngmodel, target_element, options) {
// Element is already attached.
if (current_element === target_element) {
return;
}
// Safe: clear previously attached elements.
if (current_element) {
that.detach();
}
// The element is st... | [
"function",
"_attach",
"(",
"ngmodel",
",",
"target_element",
",",
"options",
")",
"{",
"// Element is already attached.",
"if",
"(",
"current_element",
"===",
"target_element",
")",
"{",
"return",
";",
"}",
"// Safe: clear previously attached elements.",
"if",
"(",
"... | Attach autocomplete behavior to an input element. | [
"Attach",
"autocomplete",
"behavior",
"to",
"an",
"input",
"element",
"."
] | 6bb50c86f246589aa1a573cb489cd13c1b2ad4e9 | https://github.com/hakib/MassAutocomplete/blob/6bb50c86f246589aa1a573cb489cd13c1b2ad4e9/massautocomplete.js#L215-L263 | train |
hakib/MassAutocomplete | massautocomplete.js | set_selection | function set_selection(i) {
// We use value instead of setting the model's view value
// because we watch the model value and setting it will trigger
// a new suggestion cycle.
var selected = $scope.results[i];
current_element.val(selected.value);
$scope.selected_index = ... | javascript | function set_selection(i) {
// We use value instead of setting the model's view value
// because we watch the model value and setting it will trigger
// a new suggestion cycle.
var selected = $scope.results[i];
current_element.val(selected.value);
$scope.selected_index = ... | [
"function",
"set_selection",
"(",
"i",
")",
"{",
"// We use value instead of setting the model's view value",
"// because we watch the model value and setting it will trigger",
"// a new suggestion cycle.",
"var",
"selected",
"=",
"$scope",
".",
"results",
"[",
"i",
"]",
";",
"... | Set the current selection while navigating through the menu. | [
"Set",
"the",
"current",
"selection",
"while",
"navigating",
"through",
"the",
"menu",
"."
] | 6bb50c86f246589aa1a573cb489cd13c1b2ad4e9 | https://github.com/hakib/MassAutocomplete/blob/6bb50c86f246589aa1a573cb489cd13c1b2ad4e9/massautocomplete.js#L310-L319 | train |
react-component/rn-packager | react-native/local-cli/templates/HelloNavigation/lib/Backend.js | fetchChatList | async function fetchChatList() {
return _makeSimulatedNetworkRequest((resolve, reject) => {
resolve(backendStateForLoggedInPerson.chats.map(chat => chat.name));
});
} | javascript | async function fetchChatList() {
return _makeSimulatedNetworkRequest((resolve, reject) => {
resolve(backendStateForLoggedInPerson.chats.map(chat => chat.name));
});
} | [
"async",
"function",
"fetchChatList",
"(",
")",
"{",
"return",
"_makeSimulatedNetworkRequest",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"resolve",
"(",
"backendStateForLoggedInPerson",
".",
"chats",
".",
"map",
"(",
"chat",
"=>",
"chat",
".",
"name"... | Fetch a list of all chats for the logged in person. | [
"Fetch",
"a",
"list",
"of",
"all",
"chats",
"for",
"the",
"logged",
"in",
"person",
"."
] | 8fbf4066ff791bc18155fc929d76b6e51be40515 | https://github.com/react-component/rn-packager/blob/8fbf4066ff791bc18155fc929d76b6e51be40515/react-native/local-cli/templates/HelloNavigation/lib/Backend.js#L62-L66 | train |
react-component/rn-packager | react-native/local-cli/templates/HelloNavigation/lib/Backend.js | fetchChat | async function fetchChat(name) {
return _makeSimulatedNetworkRequest((resolve, reject) => {
resolve(
backendStateForLoggedInPerson.chats.find(
chat => chat.name === name
)
);
});
} | javascript | async function fetchChat(name) {
return _makeSimulatedNetworkRequest((resolve, reject) => {
resolve(
backendStateForLoggedInPerson.chats.find(
chat => chat.name === name
)
);
});
} | [
"async",
"function",
"fetchChat",
"(",
"name",
")",
"{",
"return",
"_makeSimulatedNetworkRequest",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"resolve",
"(",
"backendStateForLoggedInPerson",
".",
"chats",
".",
"find",
"(",
"chat",
"=>",
"chat",
".",
... | Fetch a single chat. | [
"Fetch",
"a",
"single",
"chat",
"."
] | 8fbf4066ff791bc18155fc929d76b6e51be40515 | https://github.com/react-component/rn-packager/blob/8fbf4066ff791bc18155fc929d76b6e51be40515/react-native/local-cli/templates/HelloNavigation/lib/Backend.js#L71-L79 | train |
react-component/rn-packager | react-native/local-cli/templates/HelloNavigation/lib/Backend.js | sendMessage | async function sendMessage({name, message}) {
return _makeSimulatedNetworkRequest((resolve, reject) => {
const chatForName = backendStateForLoggedInPerson.chats.find(
chat => chat.name === name
);
if (chatForName) {
chatForName.messages.push({
name: 'Me',
text: message,
}... | javascript | async function sendMessage({name, message}) {
return _makeSimulatedNetworkRequest((resolve, reject) => {
const chatForName = backendStateForLoggedInPerson.chats.find(
chat => chat.name === name
);
if (chatForName) {
chatForName.messages.push({
name: 'Me',
text: message,
}... | [
"async",
"function",
"sendMessage",
"(",
"{",
"name",
",",
"message",
"}",
")",
"{",
"return",
"_makeSimulatedNetworkRequest",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"const",
"chatForName",
"=",
"backendStateForLoggedInPerson",
".",
"chats",
".",
... | Send given message to given person. | [
"Send",
"given",
"message",
"to",
"given",
"person",
"."
] | 8fbf4066ff791bc18155fc929d76b6e51be40515 | https://github.com/react-component/rn-packager/blob/8fbf4066ff791bc18155fc929d76b6e51be40515/react-native/local-cli/templates/HelloNavigation/lib/Backend.js#L84-L99 | train |
react-component/rn-packager | react-native/packager/src/node-haste/lib/getInverseDependencies.js | getInverseDependencies | function getInverseDependencies(resolutionResponse) {
const cache = new Map();
resolutionResponse.dependencies.forEach(module => {
resolveModuleRequires(resolutionResponse, module).forEach(dependency => {
getModuleDependents(cache, dependency).add(module);
});
});
return cache;
} | javascript | function getInverseDependencies(resolutionResponse) {
const cache = new Map();
resolutionResponse.dependencies.forEach(module => {
resolveModuleRequires(resolutionResponse, module).forEach(dependency => {
getModuleDependents(cache, dependency).add(module);
});
});
return cache;
} | [
"function",
"getInverseDependencies",
"(",
"resolutionResponse",
")",
"{",
"const",
"cache",
"=",
"new",
"Map",
"(",
")",
";",
"resolutionResponse",
".",
"dependencies",
".",
"forEach",
"(",
"module",
"=>",
"{",
"resolveModuleRequires",
"(",
"resolutionResponse",
... | Returns an object that indicates in which module each module is required. | [
"Returns",
"an",
"object",
"that",
"indicates",
"in",
"which",
"module",
"each",
"module",
"is",
"required",
"."
] | 8fbf4066ff791bc18155fc929d76b6e51be40515 | https://github.com/react-component/rn-packager/blob/8fbf4066ff791bc18155fc929d76b6e51be40515/react-native/packager/src/node-haste/lib/getInverseDependencies.js#L30-L40 | train |
react-component/rn-packager | react-native/local-cli/server/util/copyToClipBoard.js | copyToClipBoard | function copyToClipBoard(content) {
switch (process.platform) {
case 'darwin':
var child = spawn('pbcopy', []);
child.stdin.end(new Buffer(content, 'utf8'));
return true;
case 'win32':
var child = spawn('clip', []);
child.stdin.end(new Buffer(content, 'utf8'));
return true;
default:
... | javascript | function copyToClipBoard(content) {
switch (process.platform) {
case 'darwin':
var child = spawn('pbcopy', []);
child.stdin.end(new Buffer(content, 'utf8'));
return true;
case 'win32':
var child = spawn('clip', []);
child.stdin.end(new Buffer(content, 'utf8'));
return true;
default:
... | [
"function",
"copyToClipBoard",
"(",
"content",
")",
"{",
"switch",
"(",
"process",
".",
"platform",
")",
"{",
"case",
"'darwin'",
":",
"var",
"child",
"=",
"spawn",
"(",
"'pbcopy'",
",",
"[",
"]",
")",
";",
"child",
".",
"stdin",
".",
"end",
"(",
"ne... | Copy the content to host system clipboard.
This is only supported on Mac and Windows for now. | [
"Copy",
"the",
"content",
"to",
"host",
"system",
"clipboard",
".",
"This",
"is",
"only",
"supported",
"on",
"Mac",
"and",
"Windows",
"for",
"now",
"."
] | 8fbf4066ff791bc18155fc929d76b6e51be40515 | https://github.com/react-component/rn-packager/blob/8fbf4066ff791bc18155fc929d76b6e51be40515/react-native/local-cli/server/util/copyToClipBoard.js#L18-L31 | train |
ssbc/muxrpc | api.js | recurse | function recurse (obj, manifest, path, remoteCall) {
for(var name in manifest) (function (name, type) {
var _path = path ? path.concat(name) : [name]
obj[name] =
isObject(type)
? recurse({}, type, _path, remoteCall)
: function () {
return remoteCall(type, _path, [].slice.call(arg... | javascript | function recurse (obj, manifest, path, remoteCall) {
for(var name in manifest) (function (name, type) {
var _path = path ? path.concat(name) : [name]
obj[name] =
isObject(type)
? recurse({}, type, _path, remoteCall)
: function () {
return remoteCall(type, _path, [].slice.call(arg... | [
"function",
"recurse",
"(",
"obj",
",",
"manifest",
",",
"path",
",",
"remoteCall",
")",
"{",
"for",
"(",
"var",
"name",
"in",
"manifest",
")",
"(",
"function",
"(",
"name",
",",
"type",
")",
"{",
"var",
"_path",
"=",
"path",
"?",
"path",
".",
"con... | add all the api methods to the emitter recursively | [
"add",
"all",
"the",
"api",
"methods",
"to",
"the",
"emitter",
"recursively"
] | 49a360ae898bb6f3d0f5c4a13098042e02ba5a57 | https://github.com/ssbc/muxrpc/blob/49a360ae898bb6f3d0f5c4a13098042e02ba5a57/api.js#L18-L29 | train |
react-component/rn-packager | react-native/packager/transformer.js | buildBabelConfig | function buildBabelConfig(filename, options) {
const babelRC = getBabelRC(options.projectRoots);
const extraConfig = {
code: false,
filename,
};
let config = Object.assign({}, babelRC, extraConfig);
// Add extra plugins
const extraPlugins = [externalHelpersPlugin];
var inlineRequires = options... | javascript | function buildBabelConfig(filename, options) {
const babelRC = getBabelRC(options.projectRoots);
const extraConfig = {
code: false,
filename,
};
let config = Object.assign({}, babelRC, extraConfig);
// Add extra plugins
const extraPlugins = [externalHelpersPlugin];
var inlineRequires = options... | [
"function",
"buildBabelConfig",
"(",
"filename",
",",
"options",
")",
"{",
"const",
"babelRC",
"=",
"getBabelRC",
"(",
"options",
".",
"projectRoots",
")",
";",
"const",
"extraConfig",
"=",
"{",
"code",
":",
"false",
",",
"filename",
",",
"}",
";",
"let",
... | Given a filename and options, build a Babel
config object with the appropriate plugins. | [
"Given",
"a",
"filename",
"and",
"options",
"build",
"a",
"Babel",
"config",
"object",
"with",
"the",
"appropriate",
"plugins",
"."
] | 8fbf4066ff791bc18155fc929d76b6e51be40515 | https://github.com/react-component/rn-packager/blob/8fbf4066ff791bc18155fc929d76b6e51be40515/react-native/packager/transformer.js#L72-L99 | train |
ssbc/muxrpc | pull-weird.js | once | function once (fn) {
var done = false
return function (err, val) {
if(done) return
done = true
fn(err, val)
}
} | javascript | function once (fn) {
var done = false
return function (err, val) {
if(done) return
done = true
fn(err, val)
}
} | [
"function",
"once",
"(",
"fn",
")",
"{",
"var",
"done",
"=",
"false",
"return",
"function",
"(",
"err",
",",
"val",
")",
"{",
"if",
"(",
"done",
")",
"return",
"done",
"=",
"true",
"fn",
"(",
"err",
",",
"val",
")",
"}",
"}"
] | wrap pull streams around packet-stream's weird streams. | [
"wrap",
"pull",
"streams",
"around",
"packet",
"-",
"stream",
"s",
"weird",
"streams",
"."
] | 49a360ae898bb6f3d0f5c4a13098042e02ba5a57 | https://github.com/ssbc/muxrpc/blob/49a360ae898bb6f3d0f5c4a13098042e02ba5a57/pull-weird.js#L5-L12 | train |
react-component/rn-packager | react-native/local-cli/library/library.js | library | function library(argv, config, args) {
if (!isValidPackageName(args.name)) {
return Promise.reject(
args.name + ' is not a valid name for a project. Please use a valid ' +
'identifier name (alphanumeric).'
);
}
const root = process.cwd();
const libraries = path.resolve(root, 'Libraries');
... | javascript | function library(argv, config, args) {
if (!isValidPackageName(args.name)) {
return Promise.reject(
args.name + ' is not a valid name for a project. Please use a valid ' +
'identifier name (alphanumeric).'
);
}
const root = process.cwd();
const libraries = path.resolve(root, 'Libraries');
... | [
"function",
"library",
"(",
"argv",
",",
"config",
",",
"args",
")",
"{",
"if",
"(",
"!",
"isValidPackageName",
"(",
"args",
".",
"name",
")",
")",
"{",
"return",
"Promise",
".",
"reject",
"(",
"args",
".",
"name",
"+",
"' is not a valid name for a project... | Creates a new native library with the given name | [
"Creates",
"a",
"new",
"native",
"library",
"with",
"the",
"given",
"name"
] | 8fbf4066ff791bc18155fc929d76b6e51be40515 | https://github.com/react-component/rn-packager/blob/8fbf4066ff791bc18155fc929d76b6e51be40515/react-native/local-cli/library/library.js#L20-L62 | train |
react-component/rn-packager | react-native/local-cli/eject/eject.js | eject | function eject() {
const doesIOSExist = fs.existsSync(path.resolve('ios'));
const doesAndroidExist = fs.existsSync(path.resolve('android'));
if (doesIOSExist && doesAndroidExist) {
console.error(
'Both the iOS and Android folders already exist! Please delete `ios` and/or `android` ' +
'before eje... | javascript | function eject() {
const doesIOSExist = fs.existsSync(path.resolve('ios'));
const doesAndroidExist = fs.existsSync(path.resolve('android'));
if (doesIOSExist && doesAndroidExist) {
console.error(
'Both the iOS and Android folders already exist! Please delete `ios` and/or `android` ' +
'before eje... | [
"function",
"eject",
"(",
")",
"{",
"const",
"doesIOSExist",
"=",
"fs",
".",
"existsSync",
"(",
"path",
".",
"resolve",
"(",
"'ios'",
")",
")",
";",
"const",
"doesAndroidExist",
"=",
"fs",
".",
"existsSync",
"(",
"path",
".",
"resolve",
"(",
"'android'",... | The eject command re-creates the `android` and `ios` native folders. Because native code can be
difficult to maintain, this new script allows an `app.json` to be defined for the project, which
is used to configure the native app.
The `app.json` config may contain the following keys:
- `name` - The short name used for... | [
"The",
"eject",
"command",
"re",
"-",
"creates",
"the",
"android",
"and",
"ios",
"native",
"folders",
".",
"Because",
"native",
"code",
"can",
"be",
"difficult",
"to",
"maintain",
"this",
"new",
"script",
"allows",
"an",
"app",
".",
"json",
"to",
"be",
"... | 8fbf4066ff791bc18155fc929d76b6e51be40515 | https://github.com/react-component/rn-packager/blob/8fbf4066ff791bc18155fc929d76b6e51be40515/react-native/local-cli/eject/eject.js#L26-L89 | train |
react-component/rn-packager | react-native/local-cli/util/copyAndReplace.js | copyAndReplace | function copyAndReplace(srcPath, destPath, replacements, contentChangedCallback) {
if (fs.lstatSync(srcPath).isDirectory()) {
if (!fs.existsSync(destPath)) {
fs.mkdirSync(destPath);
}
// Not recursive
return;
}
const extension = path.extname(srcPath);
if (binaryExtensions.indexOf(extensio... | javascript | function copyAndReplace(srcPath, destPath, replacements, contentChangedCallback) {
if (fs.lstatSync(srcPath).isDirectory()) {
if (!fs.existsSync(destPath)) {
fs.mkdirSync(destPath);
}
// Not recursive
return;
}
const extension = path.extname(srcPath);
if (binaryExtensions.indexOf(extensio... | [
"function",
"copyAndReplace",
"(",
"srcPath",
",",
"destPath",
",",
"replacements",
",",
"contentChangedCallback",
")",
"{",
"if",
"(",
"fs",
".",
"lstatSync",
"(",
"srcPath",
")",
".",
"isDirectory",
"(",
")",
")",
"{",
"if",
"(",
"!",
"fs",
".",
"exist... | Copy a file to given destination, replacing parts of its contents.
@param srcPath Path to a file to be copied.
@param destPath Destination path.
@param replacements: e.g. {'TextToBeReplaced': 'Replacement'}
@param contentChangedCallback
Used when upgrading projects. Based on if file contents would change
when being rep... | [
"Copy",
"a",
"file",
"to",
"given",
"destination",
"replacing",
"parts",
"of",
"its",
"contents",
"."
] | 8fbf4066ff791bc18155fc929d76b6e51be40515 | https://github.com/react-component/rn-packager/blob/8fbf4066ff791bc18155fc929d76b6e51be40515/react-native/local-cli/util/copyAndReplace.js#L29-L98 | train |
datalanche/json-bignum | lib/bignumber.js | BigNumber | function BigNumber(number) {
this.numberStr = number.toString();
// not a number
if (isNaN(parseFloat(this.numberStr)) === true
|| isFinite(this.numberStr) === false) {
throw new Error(number + ' is not a number');
}
} | javascript | function BigNumber(number) {
this.numberStr = number.toString();
// not a number
if (isNaN(parseFloat(this.numberStr)) === true
|| isFinite(this.numberStr) === false) {
throw new Error(number + ' is not a number');
}
} | [
"function",
"BigNumber",
"(",
"number",
")",
"{",
"this",
".",
"numberStr",
"=",
"number",
".",
"toString",
"(",
")",
";",
"// not a number",
"if",
"(",
"isNaN",
"(",
"parseFloat",
"(",
"this",
".",
"numberStr",
")",
")",
"===",
"true",
"||",
"isFinite",... | wraps a large number, does not support arithmetic | [
"wraps",
"a",
"large",
"number",
"does",
"not",
"support",
"arithmetic"
] | 68f270db0ec25f6b19260103e5127a2f9424405e | https://github.com/datalanche/json-bignum/blob/68f270db0ec25f6b19260103e5127a2f9424405e/lib/bignumber.js#L5-L13 | train |
react-component/rn-packager | react-native/local-cli/util/PackageManager.js | callYarnOrNpm | function callYarnOrNpm(yarnCommand, npmCommand) {
let command;
if (isYarnAvailable) {
command = yarnCommand;
} else {
command = npmCommand;
}
const args = command.split(' ');
const cmd = args.shift();
const res = spawnSync(cmd, args, spawnOpts);
return res;
} | javascript | function callYarnOrNpm(yarnCommand, npmCommand) {
let command;
if (isYarnAvailable) {
command = yarnCommand;
} else {
command = npmCommand;
}
const args = command.split(' ');
const cmd = args.shift();
const res = spawnSync(cmd, args, spawnOpts);
return res;
} | [
"function",
"callYarnOrNpm",
"(",
"yarnCommand",
",",
"npmCommand",
")",
"{",
"let",
"command",
";",
"if",
"(",
"isYarnAvailable",
")",
"{",
"command",
"=",
"yarnCommand",
";",
"}",
"else",
"{",
"command",
"=",
"npmCommand",
";",
"}",
"const",
"args",
"=",... | Execute npm or yarn command
@param {String} yarnCommand Yarn command to be executed eg. yarn add package
@param {String} npmCommand Npm command to be executed eg. npm install package
@return {object} spawnSync's result object | [
"Execute",
"npm",
"or",
"yarn",
"command"
] | 8fbf4066ff791bc18155fc929d76b6e51be40515 | https://github.com/react-component/rn-packager/blob/8fbf4066ff791bc18155fc929d76b6e51be40515/react-native/local-cli/util/PackageManager.js#L30-L45 | train |
react-component/rn-packager | react-native/local-cli/link/link.js | link | function link(args, config) {
var project;
try {
project = config.getProjectConfig();
} catch (err) {
log.error(
'ERRPACKAGEJSON',
'No package found. Are you sure it\'s a React Native project?'
);
return Promise.reject(err);
}
let packageName = args[0];
// Check if install packa... | javascript | function link(args, config) {
var project;
try {
project = config.getProjectConfig();
} catch (err) {
log.error(
'ERRPACKAGEJSON',
'No package found. Are you sure it\'s a React Native project?'
);
return Promise.reject(err);
}
let packageName = args[0];
// Check if install packa... | [
"function",
"link",
"(",
"args",
",",
"config",
")",
"{",
"var",
"project",
";",
"try",
"{",
"project",
"=",
"config",
".",
"getProjectConfig",
"(",
")",
";",
"}",
"catch",
"(",
"err",
")",
"{",
"log",
".",
"error",
"(",
"'ERRPACKAGEJSON'",
",",
"'No... | Updates project and links all dependencies to it
If optional argument [packageName] is provided, it's the only one that's checked | [
"Updates",
"project",
"and",
"links",
"all",
"dependencies",
"to",
"it"
] | 8fbf4066ff791bc18155fc929d76b6e51be40515 | https://github.com/react-component/rn-packager/blob/8fbf4066ff791bc18155fc929d76b6e51be40515/react-native/local-cli/link/link.js#L132-L177 | train |
react-component/rn-packager | react-native/local-cli/init/init.js | addJestToPackageJson | function addJestToPackageJson(destinationRoot) {
var packageJSONPath = path.join(destinationRoot, 'package.json');
var packageJSON = JSON.parse(fs.readFileSync(packageJSONPath));
packageJSON.scripts.test = 'jest';
packageJSON.jest = {
preset: 'react-native'
};
fs.writeFileSync(packageJSONPath, JSON.str... | javascript | function addJestToPackageJson(destinationRoot) {
var packageJSONPath = path.join(destinationRoot, 'package.json');
var packageJSON = JSON.parse(fs.readFileSync(packageJSONPath));
packageJSON.scripts.test = 'jest';
packageJSON.jest = {
preset: 'react-native'
};
fs.writeFileSync(packageJSONPath, JSON.str... | [
"function",
"addJestToPackageJson",
"(",
"destinationRoot",
")",
"{",
"var",
"packageJSONPath",
"=",
"path",
".",
"join",
"(",
"destinationRoot",
",",
"'package.json'",
")",
";",
"var",
"packageJSON",
"=",
"JSON",
".",
"parse",
"(",
"fs",
".",
"readFileSync",
... | Add Jest-related stuff to package.json, which was created by the react-native-cli. | [
"Add",
"Jest",
"-",
"related",
"stuff",
"to",
"package",
".",
"json",
"which",
"was",
"created",
"by",
"the",
"react",
"-",
"native",
"-",
"cli",
"."
] | 8fbf4066ff791bc18155fc929d76b6e51be40515 | https://github.com/react-component/rn-packager/blob/8fbf4066ff791bc18155fc929d76b6e51be40515/react-native/local-cli/init/init.js#L108-L117 | train |
groupon/gofer | lib/fetch.browser.js | isValidBody | function isValidBody(body) {
return (
body === undefined ||
typeof body === 'string' ||
(typeof FormData !== 'undefined' && body instanceof FormData) ||
(typeof URLSearchParams !== 'undefined' && body instanceof URLSearchParams)
);
} | javascript | function isValidBody(body) {
return (
body === undefined ||
typeof body === 'string' ||
(typeof FormData !== 'undefined' && body instanceof FormData) ||
(typeof URLSearchParams !== 'undefined' && body instanceof URLSearchParams)
);
} | [
"function",
"isValidBody",
"(",
"body",
")",
"{",
"return",
"(",
"body",
"===",
"undefined",
"||",
"typeof",
"body",
"===",
"'string'",
"||",
"(",
"typeof",
"FormData",
"!==",
"'undefined'",
"&&",
"body",
"instanceof",
"FormData",
")",
"||",
"(",
"typeof",
... | Blob or BufferSource or FormData or URLSearchParams or USVString | [
"Blob",
"or",
"BufferSource",
"or",
"FormData",
"or",
"URLSearchParams",
"or",
"USVString"
] | b21b894ae00ddd8a836370cd905e259fc13791c5 | https://github.com/groupon/gofer/blob/b21b894ae00ddd8a836370cd905e259fc13791c5/lib/fetch.browser.js#L80-L87 | train |
fpirsch/twin-bcrypt | src/twin-bcrypt.js | string2utf8Bytes | function string2utf8Bytes(s) {
var utf8 = unescape(encodeURIComponent(s)),
len = utf8.length,
bytes = new Array(len);
for (var i = 0; i < len; i++) {
bytes[i] = utf8.charCodeAt(i);
}
return bytes;
} | javascript | function string2utf8Bytes(s) {
var utf8 = unescape(encodeURIComponent(s)),
len = utf8.length,
bytes = new Array(len);
for (var i = 0; i < len; i++) {
bytes[i] = utf8.charCodeAt(i);
}
return bytes;
} | [
"function",
"string2utf8Bytes",
"(",
"s",
")",
"{",
"var",
"utf8",
"=",
"unescape",
"(",
"encodeURIComponent",
"(",
"s",
")",
")",
",",
"len",
"=",
"utf8",
".",
"length",
",",
"bytes",
"=",
"new",
"Array",
"(",
"len",
")",
";",
"for",
"(",
"var",
"... | utf-8 conversion for browsers and Node. | [
"utf",
"-",
"8",
"conversion",
"for",
"browsers",
"and",
"Node",
"."
] | fd61025973f4764382b03bd98343e87f5cbdec3f | https://github.com/fpirsch/twin-bcrypt/blob/fd61025973f4764382b03bd98343e87f5cbdec3f/src/twin-bcrypt.js#L33-L41 | train |
sergeysova/telegram-typings | lib/parser.js | findPrev | function findPrev(type/*: string*/, element/*: Cheerio*/) {
let tries = 5
let prev = element
do {
if (prev.is(type)) {
return prev
}
prev = prev.prev()
}
while (--tries)
return prev
} | javascript | function findPrev(type/*: string*/, element/*: Cheerio*/) {
let tries = 5
let prev = element
do {
if (prev.is(type)) {
return prev
}
prev = prev.prev()
}
while (--tries)
return prev
} | [
"function",
"findPrev",
"(",
"type",
"/*: string*/",
",",
"element",
"/*: Cheerio*/",
")",
"{",
"let",
"tries",
"=",
"5",
"let",
"prev",
"=",
"element",
"do",
"{",
"if",
"(",
"prev",
".",
"is",
"(",
"type",
")",
")",
"{",
"return",
"prev",
"}",
"prev... | Find previous special typed element in siblings | [
"Find",
"previous",
"special",
"typed",
"element",
"in",
"siblings"
] | 786b2438721b5eb6fc8a3c6be2a82b4aea891529 | https://github.com/sergeysova/telegram-typings/blob/786b2438721b5eb6fc8a3c6be2a82b4aea891529/lib/parser.js#L17-L31 | train |
sergeysova/telegram-typings | lib/parser.js | findNext | function findNext(type, element) {
let tries = 5
let next = element
do {
if (next.is(type)) {
return next
}
next = next.next()
}
while (--tries)
return next
} | javascript | function findNext(type, element) {
let tries = 5
let next = element
do {
if (next.is(type)) {
return next
}
next = next.next()
}
while (--tries)
return next
} | [
"function",
"findNext",
"(",
"type",
",",
"element",
")",
"{",
"let",
"tries",
"=",
"5",
"let",
"next",
"=",
"element",
"do",
"{",
"if",
"(",
"next",
".",
"is",
"(",
"type",
")",
")",
"{",
"return",
"next",
"}",
"next",
"=",
"next",
".",
"next",
... | Find next special typed element in siblings
@param {string} type
@param {Cheerio} element | [
"Find",
"next",
"special",
"typed",
"element",
"in",
"siblings"
] | 786b2438721b5eb6fc8a3c6be2a82b4aea891529 | https://github.com/sergeysova/telegram-typings/blob/786b2438721b5eb6fc8a3c6be2a82b4aea891529/lib/parser.js#L38-L52 | train |
sergeysova/telegram-typings | lib/builders/base.js | smartComment | function smartComment(description/*:string*/ = '', links/*: string[]*/ = []) {
const descriptionLines = description.replace(/(.{1,72}\s)\s*?/g, '\n * $1')
const linksLines = links.reduce((acc, link) => (
`${acc} * @see ${link}\n`
), '')
return commentBlock(`*${descriptionLines}\n${linksLines} `)
} | javascript | function smartComment(description/*:string*/ = '', links/*: string[]*/ = []) {
const descriptionLines = description.replace(/(.{1,72}\s)\s*?/g, '\n * $1')
const linksLines = links.reduce((acc, link) => (
`${acc} * @see ${link}\n`
), '')
return commentBlock(`*${descriptionLines}\n${linksLines} `)
} | [
"function",
"smartComment",
"(",
"description",
"/*:string*/",
"=",
"''",
",",
"links",
"/*: string[]*/",
"=",
"[",
"]",
")",
"{",
"const",
"descriptionLines",
"=",
"description",
".",
"replace",
"(",
"/",
"(.{1,72}\\s)\\s*?",
"/",
"g",
",",
"'\\n * $1'",
")",... | Split description to lines add return AST node | [
"Split",
"description",
"to",
"lines",
"add",
"return",
"AST",
"node"
] | 786b2438721b5eb6fc8a3c6be2a82b4aea891529 | https://github.com/sergeysova/telegram-typings/blob/786b2438721b5eb6fc8a3c6be2a82b4aea891529/lib/builders/base.js#L219-L226 | train |
gulpjs/vinyl-sourcemap | lib/helpers.js | fixImportedSourceMap | function fixImportedSourceMap(file, state, callback) {
if (!state.map) {
return callback();
}
state.map.sourcesContent = state.map.sourcesContent || [];
nal.map(state.map.sources, normalizeSourcesAndContent, callback);
function assignSourcesContent(sourceContent, idx) {
state.map.sourcesContent[idx... | javascript | function fixImportedSourceMap(file, state, callback) {
if (!state.map) {
return callback();
}
state.map.sourcesContent = state.map.sourcesContent || [];
nal.map(state.map.sources, normalizeSourcesAndContent, callback);
function assignSourcesContent(sourceContent, idx) {
state.map.sourcesContent[idx... | [
"function",
"fixImportedSourceMap",
"(",
"file",
",",
"state",
",",
"callback",
")",
"{",
"if",
"(",
"!",
"state",
".",
"map",
")",
"{",
"return",
"callback",
"(",
")",
";",
"}",
"state",
".",
"map",
".",
"sourcesContent",
"=",
"state",
".",
"map",
"... | Fix source paths and sourceContent for imported source map | [
"Fix",
"source",
"paths",
"and",
"sourceContent",
"for",
"imported",
"source",
"map"
] | c86582cd9a0973a2ac9aa18fce5feb7d80ab1e3b | https://github.com/gulpjs/vinyl-sourcemap/blob/c86582cd9a0973a2ac9aa18fce5feb7d80ab1e3b/lib/helpers.js#L70-L126 | train |
contra/holla | holla.js | FlashWS | function FlashWS (options) {
WS.call(this, options);
this.flashPath = options.flashPath;
this.policyPort = options.policyPort;
} | javascript | function FlashWS (options) {
WS.call(this, options);
this.flashPath = options.flashPath;
this.policyPort = options.policyPort;
} | [
"function",
"FlashWS",
"(",
"options",
")",
"{",
"WS",
".",
"call",
"(",
"this",
",",
"options",
")",
";",
"this",
".",
"flashPath",
"=",
"options",
".",
"flashPath",
";",
"this",
".",
"policyPort",
"=",
"options",
".",
"policyPort",
";",
"}"
] | FlashWS constructor.
@api public | [
"FlashWS",
"constructor",
"."
] | 18f1018b50192793a56e2196119d3fa192578524 | https://github.com/contra/holla/blob/18f1018b50192793a56e2196119d3fa192578524/holla.js#L2644-L2648 | train |
contra/holla | holla.js | log | function log (type) {
return function(){
var str = Array.prototype.join.call(arguments, ' ');
debug('[websocketjs %s] %s', type, str);
};
} | javascript | function log (type) {
return function(){
var str = Array.prototype.join.call(arguments, ' ');
debug('[websocketjs %s] %s', type, str);
};
} | [
"function",
"log",
"(",
"type",
")",
"{",
"return",
"function",
"(",
")",
"{",
"var",
"str",
"=",
"Array",
".",
"prototype",
".",
"join",
".",
"call",
"(",
"arguments",
",",
"' '",
")",
";",
"debug",
"(",
"'[websocketjs %s] %s'",
",",
"type",
",",
"s... | instrument websocketjs logging | [
"instrument",
"websocketjs",
"logging"
] | 18f1018b50192793a56e2196119d3fa192578524 | https://github.com/contra/holla/blob/18f1018b50192793a56e2196119d3fa192578524/holla.js#L2677-L2682 | train |
contra/holla | holla.js | load | function load (arr, fn) {
function process (i) {
if (!arr[i]) return fn();
create(arr[i], function () {
process(++i);
});
};
process(0);
} | javascript | function load (arr, fn) {
function process (i) {
if (!arr[i]) return fn();
create(arr[i], function () {
process(++i);
});
};
process(0);
} | [
"function",
"load",
"(",
"arr",
",",
"fn",
")",
"{",
"function",
"process",
"(",
"i",
")",
"{",
"if",
"(",
"!",
"arr",
"[",
"i",
"]",
")",
"return",
"fn",
"(",
")",
";",
"create",
"(",
"arr",
"[",
"i",
"]",
",",
"function",
"(",
")",
"{",
"... | Loads scripts and fires a callback.
@param {Array} paths
@param {Function} callback | [
"Loads",
"scripts",
"and",
"fires",
"a",
"callback",
"."
] | 18f1018b50192793a56e2196119d3fa192578524 | https://github.com/contra/holla/blob/18f1018b50192793a56e2196119d3fa192578524/holla.js#L2861-L2870 | train |
anicollection/anicollection | config/grunt/tasks/generate_db.js | saveCategoryList | function saveCategoryList(categoryObject){
var destinationPath = config.dest + 'db_category_list.json';
grunt.file.write(destinationPath, JSON.stringify(categoryObject, null, 4));
grunt.log.writeln('Prefixed file "' + destinationPath + '" created.');
} | javascript | function saveCategoryList(categoryObject){
var destinationPath = config.dest + 'db_category_list.json';
grunt.file.write(destinationPath, JSON.stringify(categoryObject, null, 4));
grunt.log.writeln('Prefixed file "' + destinationPath + '" created.');
} | [
"function",
"saveCategoryList",
"(",
"categoryObject",
")",
"{",
"var",
"destinationPath",
"=",
"config",
".",
"dest",
"+",
"'db_category_list.json'",
";",
"grunt",
".",
"file",
".",
"write",
"(",
"destinationPath",
",",
"JSON",
".",
"stringify",
"(",
"categoryO... | Save the category List as json file
@author Dariel Noel <darielnoel@gmail.com>
@since 2015-03-10
@param {[type]} categoryObject [description]
@return {[type]} [description] | [
"Save",
"the",
"category",
"List",
"as",
"json",
"file"
] | f998306f29ae1d130eebcd4c64a9c9737a7613e9 | https://github.com/anicollection/anicollection/blob/f998306f29ae1d130eebcd4c64a9c9737a7613e9/config/grunt/tasks/generate_db.js#L81-L85 | train |
Subsets and Splits
SQL Console for semeru/code-text-javascript
Retrieves 20,000 non-null code samples labeled as JavaScript, providing a basic overview of the dataset.