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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
dalekjs/dalek-driver-sauce | lib/commands/element.js | function (selector, expected, hash) {
this.actionQueue.push(this.webdriverClient.element.bind(this.webdriverClient, selector));
this.actionQueue.push(this.webdriverClient.getAttribute.bind(this.webdriverClient, 'value'));
this.actionQueue.push(this._valCb.bind(this, selector, hash, expected));
return th... | javascript | function (selector, expected, hash) {
this.actionQueue.push(this.webdriverClient.element.bind(this.webdriverClient, selector));
this.actionQueue.push(this.webdriverClient.getAttribute.bind(this.webdriverClient, 'value'));
this.actionQueue.push(this._valCb.bind(this, selector, hash, expected));
return th... | [
"function",
"(",
"selector",
",",
"expected",
",",
"hash",
")",
"{",
"this",
".",
"actionQueue",
".",
"push",
"(",
"this",
".",
"webdriverClient",
".",
"element",
".",
"bind",
"(",
"this",
".",
"webdriverClient",
",",
"selector",
")",
")",
";",
"this",
... | Checks if an element has the expected value
@method val
@param {string} selector Selector expression to find the element
@param {string} expected The expected content
@param {string} hash Unique hash of that fn call
@chainable | [
"Checks",
"if",
"an",
"element",
"has",
"the",
"expected",
"value"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/lib/commands/element.js#L301-L306 | train | |
dalekjs/dalek-driver-sauce | lib/commands/element.js | function (selector, expected, hash) {
this.actionQueue.push(this.webdriverClient.element.bind(this.webdriverClient, selector));
this.actionQueue.push(this.webdriverClient.selected.bind(this.webdriverClient));
this.actionQueue.push(this._selectedCb.bind(this, selector, hash, expected));
return this;
} | javascript | function (selector, expected, hash) {
this.actionQueue.push(this.webdriverClient.element.bind(this.webdriverClient, selector));
this.actionQueue.push(this.webdriverClient.selected.bind(this.webdriverClient));
this.actionQueue.push(this._selectedCb.bind(this, selector, hash, expected));
return this;
} | [
"function",
"(",
"selector",
",",
"expected",
",",
"hash",
")",
"{",
"this",
".",
"actionQueue",
".",
"push",
"(",
"this",
".",
"webdriverClient",
".",
"element",
".",
"bind",
"(",
"this",
".",
"webdriverClient",
",",
"selector",
")",
")",
";",
"this",
... | Checks if an element is selected
@method selected
@param {string} selector Selector expression to find the element
@param {string} expected The expected content
@param {string} hash Unique hash of that fn call
@chainable | [
"Checks",
"if",
"an",
"element",
"is",
"selected"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/lib/commands/element.js#L337-L342 | train | |
dalekjs/dalek-driver-sauce | lib/commands/element.js | function (selector, expected, hash) {
this.actionQueue.push(this.webdriverClient.element.bind(this.webdriverClient, selector));
this.actionQueue.push(this.webdriverClient.enabled.bind(this.webdriverClient));
this.actionQueue.push(this._enabledCb.bind(this, selector, hash, expected));
return this;
} | javascript | function (selector, expected, hash) {
this.actionQueue.push(this.webdriverClient.element.bind(this.webdriverClient, selector));
this.actionQueue.push(this.webdriverClient.enabled.bind(this.webdriverClient));
this.actionQueue.push(this._enabledCb.bind(this, selector, hash, expected));
return this;
} | [
"function",
"(",
"selector",
",",
"expected",
",",
"hash",
")",
"{",
"this",
".",
"actionQueue",
".",
"push",
"(",
"this",
".",
"webdriverClient",
".",
"element",
".",
"bind",
"(",
"this",
".",
"webdriverClient",
",",
"selector",
")",
")",
";",
"this",
... | Checks if an element is enabled
@method enabled
@param {string} selector Selector expression to find the element
@param {string} expected The expected content
@param {string} hash Unique hash of that fn call
@chainable | [
"Checks",
"if",
"an",
"element",
"is",
"enabled"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/lib/commands/element.js#L373-L378 | train | |
dalekjs/dalek-driver-sauce | lib/commands/element.js | function (selector, hash, uuid) {
this.actionQueue.push(this.webdriverClient.element.bind(this.webdriverClient, selector));
this.actionQueue.push(this.webdriverClient.submit.bind(this.webdriverClient));
this.actionQueue.push(this._submitCb.bind(this, selector, hash, uuid));
return this;
} | javascript | function (selector, hash, uuid) {
this.actionQueue.push(this.webdriverClient.element.bind(this.webdriverClient, selector));
this.actionQueue.push(this.webdriverClient.submit.bind(this.webdriverClient));
this.actionQueue.push(this._submitCb.bind(this, selector, hash, uuid));
return this;
} | [
"function",
"(",
"selector",
",",
"hash",
",",
"uuid",
")",
"{",
"this",
".",
"actionQueue",
".",
"push",
"(",
"this",
".",
"webdriverClient",
".",
"element",
".",
"bind",
"(",
"this",
".",
"webdriverClient",
",",
"selector",
")",
")",
";",
"this",
"."... | Submits a form
@method submit
@param {string} selector Selector expression to find the element
@param {string} hash Unique hash of that fn call
@param {string} uuid Unique hash of that fn call
@chainable | [
"Submits",
"a",
"form"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/lib/commands/element.js#L409-L414 | train | |
dalekjs/dalek-driver-sauce | lib/commands/element.js | function (selector, hash, uuid) {
var deferred = Q.defer();
this.events.emit('driver:message', {key: 'submit', value: selector, uuid: uuid, hash: hash});
deferred.resolve();
return deferred.promise;
} | javascript | function (selector, hash, uuid) {
var deferred = Q.defer();
this.events.emit('driver:message', {key: 'submit', value: selector, uuid: uuid, hash: hash});
deferred.resolve();
return deferred.promise;
} | [
"function",
"(",
"selector",
",",
"hash",
",",
"uuid",
")",
"{",
"var",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
";",
"this",
".",
"events",
".",
"emit",
"(",
"'driver:message'",
",",
"{",
"key",
":",
"'submit'",
",",
"value",
":",
"selector",
... | Sends out an event with the results of the `submit` call
@method _submitCb
@param {string} selector Selector expression to find the element
@param {string} hash Unique hash of that fn call
@param {string} uuid Unique hash of that fn call
@return {object} promise Click promise
@private | [
"Sends",
"out",
"an",
"event",
"with",
"the",
"results",
"of",
"the",
"submit",
"call"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/lib/commands/element.js#L427-L432 | train | |
dalekjs/dalek-driver-sauce | lib/commands/element.js | function (selector, options, hash, uuid) {
this.actionQueue.push(this.webdriverClient.element.bind(this.webdriverClient, selector, options));
this.actionQueue.push(this.webdriverClient.scroll.bind(this.webdriverClient));
this.actionQueue.push(this._clickCb.bind(this, selector, options, hash, uuid));
ret... | javascript | function (selector, options, hash, uuid) {
this.actionQueue.push(this.webdriverClient.element.bind(this.webdriverClient, selector, options));
this.actionQueue.push(this.webdriverClient.scroll.bind(this.webdriverClient));
this.actionQueue.push(this._clickCb.bind(this, selector, options, hash, uuid));
ret... | [
"function",
"(",
"selector",
",",
"options",
",",
"hash",
",",
"uuid",
")",
"{",
"this",
".",
"actionQueue",
".",
"push",
"(",
"this",
".",
"webdriverClient",
".",
"element",
".",
"bind",
"(",
"this",
".",
"webdriverClient",
",",
"selector",
",",
"option... | Scrolls from an element to a location defined in pixels
@method scroll
@param {string} selector Selector expression to find the element
@param {object} options X offset, Y offset, Speed
@param {string} hash Unique hash of that fn call
@param {string} uuid Unique hash of that fn call
@chainable | [
"Scrolls",
"from",
"an",
"element",
"to",
"a",
"location",
"defined",
"in",
"pixels"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/lib/commands/element.js#L480-L485 | train | |
dalekjs/dalek-driver-sauce | lib/commands/element.js | function (selector, timeout, hash, uuid) {
this.actionQueue.push(this.webdriverClient.implicitWait.bind(this.webdriverClient, timeout));
this.actionQueue.push(this._waitForElementCb.bind(this, selector, hash, uuid));
return this;
} | javascript | function (selector, timeout, hash, uuid) {
this.actionQueue.push(this.webdriverClient.implicitWait.bind(this.webdriverClient, timeout));
this.actionQueue.push(this._waitForElementCb.bind(this, selector, hash, uuid));
return this;
} | [
"function",
"(",
"selector",
",",
"timeout",
",",
"hash",
",",
"uuid",
")",
"{",
"this",
".",
"actionQueue",
".",
"push",
"(",
"this",
".",
"webdriverClient",
".",
"implicitWait",
".",
"bind",
"(",
"this",
".",
"webdriverClient",
",",
"timeout",
")",
")"... | Wait for an element for a specific amount of time
@method waitForElement
@param {string} selector Selector expression to find the element
@param {integer} timeout Time to wait in ms
@param {string} hash Unique hash of that fn call
@param {string} uuid Unique hash of that fn call
@chainable | [
"Wait",
"for",
"an",
"element",
"for",
"a",
"specific",
"amount",
"of",
"time"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/lib/commands/element.js#L584-L588 | train | |
dalekjs/dalek-driver-sauce | lib/commands/element.js | function (selector, expected, hash) {
this.actionQueue.push(this.webdriverClient.elements.bind(this.webdriverClient, selector));
this.actionQueue.push(this._getNumberOfElementsCb.bind(this, selector, hash, expected));
return this;
} | javascript | function (selector, expected, hash) {
this.actionQueue.push(this.webdriverClient.elements.bind(this.webdriverClient, selector));
this.actionQueue.push(this._getNumberOfElementsCb.bind(this, selector, hash, expected));
return this;
} | [
"function",
"(",
"selector",
",",
"expected",
",",
"hash",
")",
"{",
"this",
".",
"actionQueue",
".",
"push",
"(",
"this",
".",
"webdriverClient",
".",
"elements",
".",
"bind",
"(",
"this",
".",
"webdriverClient",
",",
"selector",
")",
")",
";",
"this",
... | Returns the number of elements matched by the selector
@method getNumberOfElements
@param {string} selector Selector expression to find the elements
@param {integer} expected Expected number of matched elements
@param {string} uuid Unique hash of that fn call
@chainable | [
"Returns",
"the",
"number",
"of",
"elements",
"matched",
"by",
"the",
"selector"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/lib/commands/element.js#L618-L622 | train | |
dalekjs/dalek-driver-sauce | lib/commands/element.js | function (selector, expected, hash) {
this.actionQueue.push(this.webdriverClient.elements.bind(this.webdriverClient, selector));
this.actionQueue.push(function (result) {
var deferred = Q.defer();
var res = JSON.parse(result);
var resLength = res.value.length;
var curLength = 0;
va... | javascript | function (selector, expected, hash) {
this.actionQueue.push(this.webdriverClient.elements.bind(this.webdriverClient, selector));
this.actionQueue.push(function (result) {
var deferred = Q.defer();
var res = JSON.parse(result);
var resLength = res.value.length;
var curLength = 0;
va... | [
"function",
"(",
"selector",
",",
"expected",
",",
"hash",
")",
"{",
"this",
".",
"actionQueue",
".",
"push",
"(",
"this",
".",
"webdriverClient",
".",
"elements",
".",
"bind",
"(",
"this",
".",
"webdriverClient",
",",
"selector",
")",
")",
";",
"this",
... | Returns the number of visible elements matched by the selector
@method getNumberOfVisibleElements
@param {string} selector Selector expression to find the elements
@param {integer} expected Expected number of matched elements
@param {string} uuid Unique hash of that fn call
@chainable | [
"Returns",
"the",
"number",
"of",
"visible",
"elements",
"matched",
"by",
"the",
"selector"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/lib/commands/element.js#L661-L688 | train | |
dalekjs/dalek-driver-sauce | lib/commands/element.js | function (selector, hash, expected, res) {
var deferred = Q.defer();
var result = JSON.parse(res);
// check if the expression matched any element
if (result.value === -1) {
this.events.emit('driver:message', {key: 'numberOfVisibleElements', hash: hash, selector: selector, expected: expected, valu... | javascript | function (selector, hash, expected, res) {
var deferred = Q.defer();
var result = JSON.parse(res);
// check if the expression matched any element
if (result.value === -1) {
this.events.emit('driver:message', {key: 'numberOfVisibleElements', hash: hash, selector: selector, expected: expected, valu... | [
"function",
"(",
"selector",
",",
"hash",
",",
"expected",
",",
"res",
")",
"{",
"var",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
";",
"var",
"result",
"=",
"JSON",
".",
"parse",
"(",
"res",
")",
";",
"// check if the expression matched any element",
... | Sends out an event with the results of the `getNumberOfVisibleElements` call
@method _getNumberOfElementsCb
@param {string} selector Selector expression to find the element
@param {string} hash Unique hash of that fn call
@param {integer} expected Expected number of matched elements
@param {string} res Serialized JSON... | [
"Sends",
"out",
"an",
"event",
"with",
"the",
"results",
"of",
"the",
"getNumberOfVisibleElements",
"call"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/lib/commands/element.js#L702-L715 | train | |
mobilehero-archive/aplus-underscore | aplus-underscore.js | replace_content | function replace_content(fullpath) {
var source = fs.readFileSync(fullpath, 'utf8');
var regex = /(require\s*\(\s*['"]alloy\/underscore['"]\s*\))._/g
var test = regex.test(source);
if(test) {
logger.trace("Fixing file: " + fullpath);
source = source.replace(regex, "$1");
fs.writeFileSync(fullpath, source);
}... | javascript | function replace_content(fullpath) {
var source = fs.readFileSync(fullpath, 'utf8');
var regex = /(require\s*\(\s*['"]alloy\/underscore['"]\s*\))._/g
var test = regex.test(source);
if(test) {
logger.trace("Fixing file: " + fullpath);
source = source.replace(regex, "$1");
fs.writeFileSync(fullpath, source);
}... | [
"function",
"replace_content",
"(",
"fullpath",
")",
"{",
"var",
"source",
"=",
"fs",
".",
"readFileSync",
"(",
"fullpath",
",",
"'utf8'",
")",
";",
"var",
"regex",
"=",
"/",
"(require\\s*\\(\\s*['\"]alloy\\/underscore['\"]\\s*\\))._",
"/",
"g",
"var",
"test",
"... | Remove invalid underscore calls from a file
@param {string} fullpath | [
"Remove",
"invalid",
"underscore",
"calls",
"from",
"a",
"file"
] | bb518fec188b04053131225b28d8fe36becd1d41 | https://github.com/mobilehero-archive/aplus-underscore/blob/bb518fec188b04053131225b28d8fe36becd1d41/aplus-underscore.js#L39-L48 | train |
mobilehero-archive/aplus-underscore | aplus-underscore.js | plugin | function plugin(params) {
logger = params.logger;
params.dirname = params.dirname ? _.template(params.dirname)(params) : params.event.dir.resourcesPlatform;
logger.trace("fixing underscore in directory: " + params.dirname);
replace_content(path.join(params.dirname, "alloy.js"))
replace_content(path.join(params.di... | javascript | function plugin(params) {
logger = params.logger;
params.dirname = params.dirname ? _.template(params.dirname)(params) : params.event.dir.resourcesPlatform;
logger.trace("fixing underscore in directory: " + params.dirname);
replace_content(path.join(params.dirname, "alloy.js"))
replace_content(path.join(params.di... | [
"function",
"plugin",
"(",
"params",
")",
"{",
"logger",
"=",
"params",
".",
"logger",
";",
"params",
".",
"dirname",
"=",
"params",
".",
"dirname",
"?",
"_",
".",
"template",
"(",
"params",
".",
"dirname",
")",
"(",
"params",
")",
":",
"params",
"."... | Fix certain usages of underscore.js in Alloy source code
@param {object} params | [
"Fix",
"certain",
"usages",
"of",
"underscore",
".",
"js",
"in",
"Alloy",
"source",
"code"
] | bb518fec188b04053131225b28d8fe36becd1d41 | https://github.com/mobilehero-archive/aplus-underscore/blob/bb518fec188b04053131225b28d8fe36becd1d41/aplus-underscore.js#L55-L63 | train |
Crafity/crafity-core | lib/modules/crafity.query.js | Enumerator | function Enumerator(getCurrent, moveNext, reset) {
var index = 0,
self = this;
/**
* Get the current index of the enumerator
*/
this.getIndex = function getIndexEnumeratorInternal() {
return index;
};
/**
* Function that retrieves the current value
* @function
* @returns {Object} The c... | javascript | function Enumerator(getCurrent, moveNext, reset) {
var index = 0,
self = this;
/**
* Get the current index of the enumerator
*/
this.getIndex = function getIndexEnumeratorInternal() {
return index;
};
/**
* Function that retrieves the current value
* @function
* @returns {Object} The c... | [
"function",
"Enumerator",
"(",
"getCurrent",
",",
"moveNext",
",",
"reset",
")",
"{",
"var",
"index",
"=",
"0",
",",
"self",
"=",
"this",
";",
"/**\n * Get the current index of the enumerator\n */",
"this",
".",
"getIndex",
"=",
"function",
"getIndexEnumeratorIn... | The Enumerator base class
@class Enumerator
@param {Function} getCurrent Function that retrieves the current value
@param {Function} moveNext Function that moves to the next item and returns true if there was a next item, otherwise false
@param {Function} reset Function that resets the enumerator to the beginning of th... | [
"The",
"Enumerator",
"base",
"class"
] | c0f2271fa6f9c1164450928b2b480f397c9ec20b | https://github.com/Crafity/crafity-core/blob/c0f2271fa6f9c1164450928b2b480f397c9ec20b/lib/modules/crafity.query.js#L84-L127 | train |
svbatalov/ractive-component-iscroll | index.js | function (t) {
var self = this;
this.node = t.node;
var userOpts = this.get('opts');
this.opts = extend(defaultOpts, userOpts);
setTimeout(function () {
self.s = new IScroll(t.node, self.opts);
t.complete();
}, 0);
} | javascript | function (t) {
var self = this;
this.node = t.node;
var userOpts = this.get('opts');
this.opts = extend(defaultOpts, userOpts);
setTimeout(function () {
self.s = new IScroll(t.node, self.opts);
t.complete();
}, 0);
} | [
"function",
"(",
"t",
")",
"{",
"var",
"self",
"=",
"this",
";",
"this",
".",
"node",
"=",
"t",
".",
"node",
";",
"var",
"userOpts",
"=",
"this",
".",
"get",
"(",
"'opts'",
")",
";",
"this",
".",
"opts",
"=",
"extend",
"(",
"defaultOpts",
",",
... | Use intro transition to determine when wrapped template has finished animations and to get actual DOM node. | [
"Use",
"intro",
"transition",
"to",
"determine",
"when",
"wrapped",
"template",
"has",
"finished",
"animations",
"and",
"to",
"get",
"actual",
"DOM",
"node",
"."
] | ab378a53b2b047b1d9fa494ac76f3bdcc716a2d0 | https://github.com/svbatalov/ractive-component-iscroll/blob/ab378a53b2b047b1d9fa494ac76f3bdcc716a2d0/index.js#L55-L65 | train | |
dalekjs/dalek-driver-sauce | lib/commands/page.js | function (message, hash) {
var deferred = Q.defer();
this.events.emit('driver:message', {key: 'noop', uuid: hash, hash: hash, value: message});
deferred.resolve();
return deferred.promise;
} | javascript | function (message, hash) {
var deferred = Q.defer();
this.events.emit('driver:message', {key: 'noop', uuid: hash, hash: hash, value: message});
deferred.resolve();
return deferred.promise;
} | [
"function",
"(",
"message",
",",
"hash",
")",
"{",
"var",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
";",
"this",
".",
"events",
".",
"emit",
"(",
"'driver:message'",
",",
"{",
"key",
":",
"'noop'",
",",
"uuid",
":",
"hash",
",",
"hash",
":",
... | Sends out an event with the results of the `noop` call
@method _noopCb
@param {mixed} message Whatever yu like
@param {string} hash Unique hash of that fn call
@return {object} Promise
@private | [
"Sends",
"out",
"an",
"event",
"with",
"the",
"results",
"of",
"the",
"noop",
"call"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/lib/commands/page.js#L64-L69 | train | |
dalekjs/dalek-driver-sauce | lib/commands/page.js | function (hash) {
this.actionQueue.push(this.webdriverClient.source.bind(this.webdriverClient));
this.actionQueue.push(this._sourceCb.bind(this, hash));
return this;
} | javascript | function (hash) {
this.actionQueue.push(this.webdriverClient.source.bind(this.webdriverClient));
this.actionQueue.push(this._sourceCb.bind(this, hash));
return this;
} | [
"function",
"(",
"hash",
")",
"{",
"this",
".",
"actionQueue",
".",
"push",
"(",
"this",
".",
"webdriverClient",
".",
"source",
".",
"bind",
"(",
"this",
".",
"webdriverClient",
")",
")",
";",
"this",
".",
"actionQueue",
".",
"push",
"(",
"this",
".",
... | Gets the HTML source of a page
@method source
@param {string} hash Unique hash of that fn call
@chainable | [
"Gets",
"the",
"HTML",
"source",
"of",
"a",
"page"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/lib/commands/page.js#L79-L83 | train | |
dalekjs/dalek-driver-sauce | lib/commands/page.js | function (hash, source) {
var deferred = Q.defer();
this.events.emit('driver:message', {key: 'source', uuid: hash, hash: hash, value: JSON.parse(source).value});
deferred.resolve();
return deferred.promise;
} | javascript | function (hash, source) {
var deferred = Q.defer();
this.events.emit('driver:message', {key: 'source', uuid: hash, hash: hash, value: JSON.parse(source).value});
deferred.resolve();
return deferred.promise;
} | [
"function",
"(",
"hash",
",",
"source",
")",
"{",
"var",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
";",
"this",
".",
"events",
".",
"emit",
"(",
"'driver:message'",
",",
"{",
"key",
":",
"'source'",
",",
"uuid",
":",
"hash",
",",
"hash",
":",
... | Sends out an event with the results of the `source` call
@method _sourceCb
@param {string} hash Unique hash of that fn call
@param {string} source Serialized JSON with the results of the source call
@return {object} Promise
@private | [
"Sends",
"out",
"an",
"event",
"with",
"the",
"results",
"of",
"the",
"source",
"call"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/lib/commands/page.js#L95-L100 | train | |
dalekjs/dalek-driver-sauce | lib/commands/page.js | function (expected, hash) {
this.actionQueue.push(this.webdriverClient.title.bind(this.webdriverClient));
this.actionQueue.push(this._titleCb.bind(this, expected, hash));
return this;
} | javascript | function (expected, hash) {
this.actionQueue.push(this.webdriverClient.title.bind(this.webdriverClient));
this.actionQueue.push(this._titleCb.bind(this, expected, hash));
return this;
} | [
"function",
"(",
"expected",
",",
"hash",
")",
"{",
"this",
".",
"actionQueue",
".",
"push",
"(",
"this",
".",
"webdriverClient",
".",
"title",
".",
"bind",
"(",
"this",
".",
"webdriverClient",
")",
")",
";",
"this",
".",
"actionQueue",
".",
"push",
"(... | Checks the document title of a page
@method title
@param {string} expected Expected page title
@param {string} hash Unique hash of that fn call
@chainable | [
"Checks",
"the",
"document",
"title",
"of",
"a",
"page"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/lib/commands/page.js#L111-L115 | train | |
dalekjs/dalek-driver-sauce | lib/commands/page.js | function (expected, hash, title) {
var deferred = Q.defer();
this.events.emit('driver:message', {key: 'title', expected: expected, hash: hash, value: JSON.parse(title).value});
deferred.resolve();
return deferred.promise;
} | javascript | function (expected, hash, title) {
var deferred = Q.defer();
this.events.emit('driver:message', {key: 'title', expected: expected, hash: hash, value: JSON.parse(title).value});
deferred.resolve();
return deferred.promise;
} | [
"function",
"(",
"expected",
",",
"hash",
",",
"title",
")",
"{",
"var",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
";",
"this",
".",
"events",
".",
"emit",
"(",
"'driver:message'",
",",
"{",
"key",
":",
"'title'",
",",
"expected",
":",
"expected"... | Sends out an event with the results of the `title` call
@method _titleCb
@param {string} expected Expected page title
@param {string} hash Unique hash of that fn call
@param {string} title Serialized JSON with the results of the title call
@return {object} promise Title promise
@private | [
"Sends",
"out",
"an",
"event",
"with",
"the",
"results",
"of",
"the",
"title",
"call"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/lib/commands/page.js#L128-L133 | train | |
dalekjs/dalek-driver-sauce | lib/commands/page.js | function (expected, hash) {
this.actionQueue.push(this.webdriverClient.alertText.bind(this.webdriverClient));
this.actionQueue.push(this._alertTextCb.bind(this, expected, hash));
return this;
} | javascript | function (expected, hash) {
this.actionQueue.push(this.webdriverClient.alertText.bind(this.webdriverClient));
this.actionQueue.push(this._alertTextCb.bind(this, expected, hash));
return this;
} | [
"function",
"(",
"expected",
",",
"hash",
")",
"{",
"this",
".",
"actionQueue",
".",
"push",
"(",
"this",
".",
"webdriverClient",
".",
"alertText",
".",
"bind",
"(",
"this",
".",
"webdriverClient",
")",
")",
";",
"this",
".",
"actionQueue",
".",
"push",
... | Checks the text of an alaert, prompt or confirm dialog
@method alertText
@param {string} expected Expected alert text
@param {string} hash Unique hash of that fn call
@chainable | [
"Checks",
"the",
"text",
"of",
"an",
"alaert",
"prompt",
"or",
"confirm",
"dialog"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/lib/commands/page.js#L144-L148 | train | |
dalekjs/dalek-driver-sauce | lib/commands/page.js | function (text, hash) {
this.actionQueue.push(this.webdriverClient.promptText.bind(this.webdriverClient, text));
this.actionQueue.push(this._promptTextCb.bind(this, text, hash));
return this;
} | javascript | function (text, hash) {
this.actionQueue.push(this.webdriverClient.promptText.bind(this.webdriverClient, text));
this.actionQueue.push(this._promptTextCb.bind(this, text, hash));
return this;
} | [
"function",
"(",
"text",
",",
"hash",
")",
"{",
"this",
".",
"actionQueue",
".",
"push",
"(",
"this",
".",
"webdriverClient",
".",
"promptText",
".",
"bind",
"(",
"this",
".",
"webdriverClient",
",",
"text",
")",
")",
";",
"this",
".",
"actionQueue",
"... | Sends text to a javascript prompt dialog box
@method promptText
@param {object} dimensions New window width & height
@param {string} hash Unique hash of that fn call
@chainable | [
"Sends",
"text",
"to",
"a",
"javascript",
"prompt",
"dialog",
"box"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/lib/commands/page.js#L177-L181 | train | |
dalekjs/dalek-driver-sauce | lib/commands/page.js | function (timeout, hash, uuid) {
this.actionQueue.push(this.webdriverClient.implicitWait.bind(this.webdriverClient, timeout));
this.actionQueue.push(this._waitCb.bind(this, timeout, hash, uuid));
return this;
} | javascript | function (timeout, hash, uuid) {
this.actionQueue.push(this.webdriverClient.implicitWait.bind(this.webdriverClient, timeout));
this.actionQueue.push(this._waitCb.bind(this, timeout, hash, uuid));
return this;
} | [
"function",
"(",
"timeout",
",",
"hash",
",",
"uuid",
")",
"{",
"this",
".",
"actionQueue",
".",
"push",
"(",
"this",
".",
"webdriverClient",
".",
"implicitWait",
".",
"bind",
"(",
"this",
".",
"webdriverClient",
",",
"timeout",
")",
")",
";",
"this",
... | Wait for a specific amount of time
@method wait
@param {integer} timeout Time to wait in ms
@param {string} hash Unique hash of that fn call
@param {string} uuid Unique hash of that fn call
@chainable | [
"Wait",
"for",
"a",
"specific",
"amount",
"of",
"time"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/lib/commands/page.js#L273-L277 | train | |
dalekjs/dalek-driver-sauce | lib/commands/page.js | function (timeout, hash, uuid) {
var deferred = Q.defer();
this.events.emit('driver:message', {key: 'wait', timeout: timeout, uuid: uuid, hash: hash, value: timeout + ' ms'});
setTimeout(function () {
deferred.resolve();
}.bind(this), timeout);
return deferred.promise;
} | javascript | function (timeout, hash, uuid) {
var deferred = Q.defer();
this.events.emit('driver:message', {key: 'wait', timeout: timeout, uuid: uuid, hash: hash, value: timeout + ' ms'});
setTimeout(function () {
deferred.resolve();
}.bind(this), timeout);
return deferred.promise;
} | [
"function",
"(",
"timeout",
",",
"hash",
",",
"uuid",
")",
"{",
"var",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
";",
"this",
".",
"events",
".",
"emit",
"(",
"'driver:message'",
",",
"{",
"key",
":",
"'wait'",
",",
"timeout",
":",
"timeout",
"... | Sends out an event with the results of the `wait` call
@method _waitCb
@param {integer} timeout Time to wait in ms
@param {string} hash Unique hash of that fn call
@param {string} uuid Unique hash of that fn call
@return {object} promise WaitForElement promise
@private | [
"Sends",
"out",
"an",
"event",
"with",
"the",
"results",
"of",
"the",
"wait",
"call"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/lib/commands/page.js#L290-L297 | train | |
psalaets/pie-slice | lib/pie.js | function(referencePoint, otherPoint) {
if (this.yDown) {
if (otherPoint.y > referencePoint.y) {
otherPoint = {
x: otherPoint.x,
y: referencePoint.y - (otherPoint.y - referencePoint.y)
}
} else if (otherPoint.y < referencePoint.y) {
otherPoint = {
x: ... | javascript | function(referencePoint, otherPoint) {
if (this.yDown) {
if (otherPoint.y > referencePoint.y) {
otherPoint = {
x: otherPoint.x,
y: referencePoint.y - (otherPoint.y - referencePoint.y)
}
} else if (otherPoint.y < referencePoint.y) {
otherPoint = {
x: ... | [
"function",
"(",
"referencePoint",
",",
"otherPoint",
")",
"{",
"if",
"(",
"this",
".",
"yDown",
")",
"{",
"if",
"(",
"otherPoint",
".",
"y",
">",
"referencePoint",
".",
"y",
")",
"{",
"otherPoint",
"=",
"{",
"x",
":",
"otherPoint",
".",
"x",
",",
... | Tells what slice some point is in relative to a reference point.
@param referencePoint Object with x and y properties
@param otherPoint Object with x and y properties
@return zero based slice number | [
"Tells",
"what",
"slice",
"some",
"point",
"is",
"in",
"relative",
"to",
"a",
"reference",
"point",
"."
] | ca119bb63ccefc09cc66ebfdf0bc19ebce364b88 | https://github.com/psalaets/pie-slice/blob/ca119bb63ccefc09cc66ebfdf0bc19ebce364b88/lib/pie.js#L13-L37 | train | |
redisjs/jsr-server | lib/command/database/string/getbit.js | validate | function validate(cmd, args, info) {
AbstractCommand.prototype.validate.apply(this, arguments);
var offset = parseInt('' + args[1]);
if(isNaN(offset) || offset < 0 || offset > Constants.MAX_BIT_LEN) {
throw IntegerRange;
}
args[1] = offset;
} | javascript | function validate(cmd, args, info) {
AbstractCommand.prototype.validate.apply(this, arguments);
var offset = parseInt('' + args[1]);
if(isNaN(offset) || offset < 0 || offset > Constants.MAX_BIT_LEN) {
throw IntegerRange;
}
args[1] = offset;
} | [
"function",
"validate",
"(",
"cmd",
",",
"args",
",",
"info",
")",
"{",
"AbstractCommand",
".",
"prototype",
".",
"validate",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"var",
"offset",
"=",
"parseInt",
"(",
"''",
"+",
"args",
"[",
"1",
"... | Validate the GETBIT command. | [
"Validate",
"the",
"GETBIT",
"command",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/database/string/getbit.js#L19-L26 | train |
buzzin0609/tagbuildr | src/handleClassesAndId.js | handleClassesAndId | function handleClassesAndId(str) {
return str.replace(/(.*?)([\.|#].[^|]*)(.*)/, function (fullStr, tag, classAndIds, end) {
if (classAndIds[0] === '|') {
return fullStr;
}
const clsIdArr = classAndIds.split(/(\..[^\.|#]*)/).filter(Boolean);
const returnArr = [];
let i = clsIdArr.length;
while (i--) {
... | javascript | function handleClassesAndId(str) {
return str.replace(/(.*?)([\.|#].[^|]*)(.*)/, function (fullStr, tag, classAndIds, end) {
if (classAndIds[0] === '|') {
return fullStr;
}
const clsIdArr = classAndIds.split(/(\..[^\.|#]*)/).filter(Boolean);
const returnArr = [];
let i = clsIdArr.length;
while (i--) {
... | [
"function",
"handleClassesAndId",
"(",
"str",
")",
"{",
"return",
"str",
".",
"replace",
"(",
"/",
"(.*?)([\\.|#].[^|]*)(.*)",
"/",
",",
"function",
"(",
"fullStr",
",",
"tag",
",",
"classAndIds",
",",
"end",
")",
"{",
"if",
"(",
"classAndIds",
"[",
"0",
... | Remove the css style classes and ids then replace them with tagbuildr attribute strings to use later on
@private
@param {string} str
@return {string} reformatted tagString | [
"Remove",
"the",
"css",
"style",
"classes",
"and",
"ids",
"then",
"replace",
"them",
"with",
"tagbuildr",
"attribute",
"strings",
"to",
"use",
"later",
"on"
] | 9d6a52ad51c0fc3230de2da1e8e3f63f95a6e542 | https://github.com/buzzin0609/tagbuildr/blob/9d6a52ad51c0fc3230de2da1e8e3f63f95a6e542/src/handleClassesAndId.js#L13-L27 | train |
mathieudutour/nplint | lib/config.js | readConfigFromFile | function readConfigFromFile(filePath) {
var config = {};
if (isFilePath(filePath)) {
try {
config = yaml.safeLoad(stripComments(fs.readFileSync(filePath, 'utf8'))) || {};
} catch (e) {
e.message = 'Cannot read config file: ' + filePath + '\nError: ' + e.message;
throw e;
}
if (pa... | javascript | function readConfigFromFile(filePath) {
var config = {};
if (isFilePath(filePath)) {
try {
config = yaml.safeLoad(stripComments(fs.readFileSync(filePath, 'utf8'))) || {};
} catch (e) {
e.message = 'Cannot read config file: ' + filePath + '\nError: ' + e.message;
throw e;
}
if (pa... | [
"function",
"readConfigFromFile",
"(",
"filePath",
")",
"{",
"var",
"config",
"=",
"{",
"}",
";",
"if",
"(",
"isFilePath",
"(",
"filePath",
")",
")",
"{",
"try",
"{",
"config",
"=",
"yaml",
".",
"safeLoad",
"(",
"stripComments",
"(",
"fs",
".",
"readFi... | Read the config from the config JSON file
@param {string} filePath the path to the JSON config file
@returns {Object} config object
@private | [
"Read",
"the",
"config",
"from",
"the",
"config",
"JSON",
"file"
] | ef444abcc6dd08fb61d5fc8ce618598d4455e08e | https://github.com/mathieudutour/nplint/blob/ef444abcc6dd08fb61d5fc8ce618598d4455e08e/lib/config.js#L51-L88 | train |
mathieudutour/nplint | lib/config.js | loadConfig | function loadConfig(configToLoad) {
var config = {};
var filePath = '';
if (configToLoad) {
if (isObject(configToLoad)) {
config = configToLoad;
} else {
filePath = configToLoad;
config = readConfigFromFile(filePath);
}
if (!config.rules) {
config.rules = {};
}
c... | javascript | function loadConfig(configToLoad) {
var config = {};
var filePath = '';
if (configToLoad) {
if (isObject(configToLoad)) {
config = configToLoad;
} else {
filePath = configToLoad;
config = readConfigFromFile(filePath);
}
if (!config.rules) {
config.rules = {};
}
c... | [
"function",
"loadConfig",
"(",
"configToLoad",
")",
"{",
"var",
"config",
"=",
"{",
"}",
";",
"var",
"filePath",
"=",
"''",
";",
"if",
"(",
"configToLoad",
")",
"{",
"if",
"(",
"isObject",
"(",
"configToLoad",
")",
")",
"{",
"config",
"=",
"configToLoa... | Load and parse a JSON config object from a file.
@param {string|Object} configToLoad the path to the JSON config file or the config object itself.
@returns {Object} the parsed config object (empty object if there was a parse error)
@private | [
"Load",
"and",
"parse",
"a",
"JSON",
"config",
"object",
"from",
"a",
"file",
"."
] | ef444abcc6dd08fb61d5fc8ce618598d4455e08e | https://github.com/mathieudutour/nplint/blob/ef444abcc6dd08fb61d5fc8ce618598d4455e08e/lib/config.js#L96-L163 | train |
mathieudutour/nplint | lib/config.js | getPluginsConfig | function getPluginsConfig(pluginNames) {
var pluginConfig = {};
pluginNames.forEach(function(pluginName) {
var pluginNamespace = util.getNamespace(pluginName),
pluginNameWithoutNamespace = util.removeNameSpace(pluginName),
pluginNameWithoutPrefix = util.removePluginPrefix(pluginNameWithoutNamespace... | javascript | function getPluginsConfig(pluginNames) {
var pluginConfig = {};
pluginNames.forEach(function(pluginName) {
var pluginNamespace = util.getNamespace(pluginName),
pluginNameWithoutNamespace = util.removeNameSpace(pluginName),
pluginNameWithoutPrefix = util.removePluginPrefix(pluginNameWithoutNamespace... | [
"function",
"getPluginsConfig",
"(",
"pluginNames",
")",
"{",
"var",
"pluginConfig",
"=",
"{",
"}",
";",
"pluginNames",
".",
"forEach",
"(",
"function",
"(",
"pluginName",
")",
"{",
"var",
"pluginNamespace",
"=",
"util",
".",
"getNamespace",
"(",
"pluginName",... | Load configuration for all plugins provided.
@param {string[]} pluginNames An array of plugin names which should be loaded.
@returns {Object} all plugin configurations merged together | [
"Load",
"configuration",
"for",
"all",
"plugins",
"provided",
"."
] | ef444abcc6dd08fb61d5fc8ce618598d4455e08e | https://github.com/mathieudutour/nplint/blob/ef444abcc6dd08fb61d5fc8ce618598d4455e08e/lib/config.js#L170-L203 | train |
mathieudutour/nplint | lib/config.js | getLocalConfig | function getLocalConfig(thisConfig, directory) {
var found,
i,
localConfig,
localConfigFile,
config = {},
localConfigFiles = thisConfig.findLocalConfigFiles(directory),
numFiles = localConfigFiles.length,
rootPath,
projectConfigPath = path.join(process.cwd(), LOCAL_CONFIG_FILENAME);
... | javascript | function getLocalConfig(thisConfig, directory) {
var found,
i,
localConfig,
localConfigFile,
config = {},
localConfigFiles = thisConfig.findLocalConfigFiles(directory),
numFiles = localConfigFiles.length,
rootPath,
projectConfigPath = path.join(process.cwd(), LOCAL_CONFIG_FILENAME);
... | [
"function",
"getLocalConfig",
"(",
"thisConfig",
",",
"directory",
")",
"{",
"var",
"found",
",",
"i",
",",
"localConfig",
",",
"localConfigFile",
",",
"config",
"=",
"{",
"}",
",",
"localConfigFiles",
"=",
"thisConfig",
".",
"findLocalConfigFiles",
"(",
"dire... | Get a local config object.
@param {Object} thisConfig A Config object.
@param {string} directory The directory to start looking in for a local config file.
@returns {Object} The local config object, or an empty object if there is no local config. | [
"Get",
"a",
"local",
"config",
"object",
"."
] | ef444abcc6dd08fb61d5fc8ce618598d4455e08e | https://github.com/mathieudutour/nplint/blob/ef444abcc6dd08fb61d5fc8ce618598d4455e08e/lib/config.js#L226-L270 | train |
vkiding/jud-vue-render | src/render/browser/extend/components/neighbor/index.js | SliderNeighbor | function SliderNeighbor (data) {
this.autoPlay = false // default value is false.
this.interval = DEFAULT_INTERVAL
this.direction = 'row' // 'column' is not temporarily supported.
this.slides = []
this.isPageShow = true
this.isDomRendering = true
this.currentIndex = 0
this.neighborSpac... | javascript | function SliderNeighbor (data) {
this.autoPlay = false // default value is false.
this.interval = DEFAULT_INTERVAL
this.direction = 'row' // 'column' is not temporarily supported.
this.slides = []
this.isPageShow = true
this.isDomRendering = true
this.currentIndex = 0
this.neighborSpac... | [
"function",
"SliderNeighbor",
"(",
"data",
")",
"{",
"this",
".",
"autoPlay",
"=",
"false",
"// default value is false.",
"this",
".",
"interval",
"=",
"DEFAULT_INTERVAL",
"this",
".",
"direction",
"=",
"'row'",
"// 'column' is not temporarily supported.",
"this",
"."... | data.attr
support slider's attributes and three
@param {number} neighbor-space 0 - 375, the exposing width of slides on both other sides.
@param {number} neighbor-alpha 0 - 1, opacity of both other sides of slides, default is 0.6.
@param {number} neighbor-scale 0 - 1, the scale of both other sides of slides, default is... | [
"data",
".",
"attr",
"support",
"slider",
"s",
"attributes",
"and",
"three"
] | 07d8ab08d0ef86cf2819e5f2bf1f4b06381f4d47 | https://github.com/vkiding/jud-vue-render/blob/07d8ab08d0ef86cf2819e5f2bf1f4b06381f4d47/src/render/browser/extend/components/neighbor/index.js#L610-L629 | train |
wenwuwu/array-es5 | lib/arrays.js | function (key, array, index, fnEqual) {
var idx = Arrays.indexOf(key, array, index, fnEqual);
if (idx >= 0)
array.splice(idx, 1);
return idx;
} | javascript | function (key, array, index, fnEqual) {
var idx = Arrays.indexOf(key, array, index, fnEqual);
if (idx >= 0)
array.splice(idx, 1);
return idx;
} | [
"function",
"(",
"key",
",",
"array",
",",
"index",
",",
"fnEqual",
")",
"{",
"var",
"idx",
"=",
"Arrays",
".",
"indexOf",
"(",
"key",
",",
"array",
",",
"index",
",",
"fnEqual",
")",
";",
"if",
"(",
"idx",
">=",
"0",
")",
"array",
".",
"splice",... | Removes an item from an Array. The search for the item is
left-to-right. This method returns the index position at which
the item was found.
@param key {Object}
@param array {Array}
@param index {Number or String} Optional.
@param fnEqual {Function} Optional. The function to use to compare "key"
with each item within... | [
"Removes",
"an",
"item",
"from",
"an",
"Array",
".",
"The",
"search",
"for",
"the",
"item",
"is",
"left",
"-",
"to",
"-",
"right",
".",
"This",
"method",
"returns",
"the",
"index",
"position",
"at",
"which",
"the",
"item",
"was",
"found",
"."
] | 5331feed7e779534989f20919764a8224073ead2 | https://github.com/wenwuwu/array-es5/blob/5331feed7e779534989f20919764a8224073ead2/lib/arrays.js#L636-L641 | train | |
wenwuwu/array-es5 | lib/arrays.js | function (key, array, index) {
var idx = Arrays.lastIndexOf(key, array, index);
if (idx >= 0)
array.splice(idx, 1);
return idx;
} | javascript | function (key, array, index) {
var idx = Arrays.lastIndexOf(key, array, index);
if (idx >= 0)
array.splice(idx, 1);
return idx;
} | [
"function",
"(",
"key",
",",
"array",
",",
"index",
")",
"{",
"var",
"idx",
"=",
"Arrays",
".",
"lastIndexOf",
"(",
"key",
",",
"array",
",",
"index",
")",
";",
"if",
"(",
"idx",
">=",
"0",
")",
"array",
".",
"splice",
"(",
"idx",
",",
"1",
")"... | Removes an item from an Array. The search for the item is
right-to-left. This method returns the index position at which
the item was found.
@param key {Object}
@param array {Array}
@param index {Number or String} optional
@returns {Number} Integer. The index position of the removed item,
or -1 if the array was not m... | [
"Removes",
"an",
"item",
"from",
"an",
"Array",
".",
"The",
"search",
"for",
"the",
"item",
"is",
"right",
"-",
"to",
"-",
"left",
".",
"This",
"method",
"returns",
"the",
"index",
"position",
"at",
"which",
"the",
"item",
"was",
"found",
"."
] | 5331feed7e779534989f20919764a8224073ead2 | https://github.com/wenwuwu/array-es5/blob/5331feed7e779534989f20919764a8224073ead2/lib/arrays.js#L653-L658 | train | |
wenwuwu/array-es5 | lib/arrays.js | function (items, array, index) {
// There might be some optimization to be made here.
// Right now, I'm just going for a simple solution.
if ( !(items instanceof Array)
|| !(array instanceof Array) )
throw "IllegalArgumentException: items and ar... | javascript | function (items, array, index) {
// There might be some optimization to be made here.
// Right now, I'm just going for a simple solution.
if ( !(items instanceof Array)
|| !(array instanceof Array) )
throw "IllegalArgumentException: items and ar... | [
"function",
"(",
"items",
",",
"array",
",",
"index",
")",
"{",
"// There might be some optimization to be made here.\r",
"// Right now, I'm just going for a simple solution.\r",
"if",
"(",
"!",
"(",
"items",
"instanceof",
"Array",
")",
"||",
"!",
"(",
"array",
"instanc... | Removes a list of items from an Array.
@param items {Array} Items to be removed
@param array {Array} Array from which to remove the items.
@param index {Number or String} optional
@returns {Number} The number of successfully removed items. | [
"Removes",
"a",
"list",
"of",
"items",
"from",
"an",
"Array",
"."
] | 5331feed7e779534989f20919764a8224073ead2 | https://github.com/wenwuwu/array-es5/blob/5331feed7e779534989f20919764a8224073ead2/lib/arrays.js#L667-L683 | train | |
redisjs/jsr-resp | lib/interpreter.js | Interpreter | function Interpreter(options) {
options = options || {};
this.quote = typeof options.quote === 'boolean' ? options.quote : true;
} | javascript | function Interpreter(options) {
options = options || {};
this.quote = typeof options.quote === 'boolean' ? options.quote : true;
} | [
"function",
"Interpreter",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"this",
".",
"quote",
"=",
"typeof",
"options",
".",
"quote",
"===",
"'boolean'",
"?",
"options",
".",
"quote",
":",
"true",
";",
"}"
] | Interprets a single string value into a command string
and corresponding arguments.
Typically used to recieve input from stdin and create a command
that may be sent to a server.
Arguments are coerced to strings or integers.
The values `null`, `true` and `false` are interpreted as strings.
Quotes (single or double) ... | [
"Interprets",
"a",
"single",
"string",
"value",
"into",
"a",
"command",
"string",
"and",
"corresponding",
"arguments",
"."
] | 9f998fc65a4494a358fca296adfe37fc5fb3f03c | https://github.com/redisjs/jsr-resp/blob/9f998fc65a4494a358fca296adfe37fc5fb3f03c/lib/interpreter.js#L20-L23 | train |
redisjs/jsr-resp | lib/interpreter.js | interpret | function interpret(input) {
var cli = []
, exp = null
, i
, s
, q
, e
, sre = /^("|').*/
, ere = /.*("|')$/;
assert(
typeof input === 'string' || input instanceof String,
'interpret invalid input: must be a string');
input = '' + input;
assert(
input && !/^\s+$/.test(i... | javascript | function interpret(input) {
var cli = []
, exp = null
, i
, s
, q
, e
, sre = /^("|').*/
, ere = /.*("|')$/;
assert(
typeof input === 'string' || input instanceof String,
'interpret invalid input: must be a string');
input = '' + input;
assert(
input && !/^\s+$/.test(i... | [
"function",
"interpret",
"(",
"input",
")",
"{",
"var",
"cli",
"=",
"[",
"]",
",",
"exp",
"=",
"null",
",",
"i",
",",
"s",
",",
"q",
",",
"e",
",",
"sre",
"=",
"/",
"^(\"|').*",
"/",
",",
"ere",
"=",
"/",
".*(\"|')$",
"/",
";",
"assert",
"(",... | Interpret a string value into a command
and arguments.
@param input The input string.
@return An array containing a command and arguments. | [
"Interpret",
"a",
"string",
"value",
"into",
"a",
"command",
"and",
"arguments",
"."
] | 9f998fc65a4494a358fca296adfe37fc5fb3f03c | https://github.com/redisjs/jsr-resp/blob/9f998fc65a4494a358fca296adfe37fc5fb3f03c/lib/interpreter.js#L33-L102 | train |
nbrownus/ppunit | lib/writers/FileWriter.js | function (options) {
if (!options.path) {
throw new Error('A path must be supplied to write to')
}
this.path = options.path
this.useColors = options.useColors || false
mkdirp.sync(path.dirname(this.path))
this.fd = fs.openSync(this.path, 'w', options.mode || 0644)
} | javascript | function (options) {
if (!options.path) {
throw new Error('A path must be supplied to write to')
}
this.path = options.path
this.useColors = options.useColors || false
mkdirp.sync(path.dirname(this.path))
this.fd = fs.openSync(this.path, 'w', options.mode || 0644)
} | [
"function",
"(",
"options",
")",
"{",
"if",
"(",
"!",
"options",
".",
"path",
")",
"{",
"throw",
"new",
"Error",
"(",
"'A path must be supplied to write to'",
")",
"}",
"this",
".",
"path",
"=",
"options",
".",
"path",
"this",
".",
"useColors",
"=",
"opt... | Handles writing output to a file
@param {Object} options An object containing options pertaining to this writer
@param {String} options.path An absolute or relative path to write output to
@param {String} [options.useColors=false] Whether or not to use colors
@param {String} [options.mode=0644] A file mode to create t... | [
"Handles",
"writing",
"output",
"to",
"a",
"file"
] | dcce602497d9548ce9085a8db115e65561dcc3de | https://github.com/nbrownus/ppunit/blob/dcce602497d9548ce9085a8db115e65561dcc3de/lib/writers/FileWriter.js#L17-L28 | train | |
interlockjs/plugins | packages/css/src/gen-css-bundles.js | replaceCssModules | function replaceCssModules (bundles, cssBundles, originBundleCssBundleMap, moduleClassnameMaps) {
const cssBundlesStats = moduleClassnameMaps && cssBundles.map(bundle => {
const moduleClassnames = bundle.modules.map(module => moduleClassnameMaps[module.path]);
const combinedJson = assign(...[{}].concat(modul... | javascript | function replaceCssModules (bundles, cssBundles, originBundleCssBundleMap, moduleClassnameMaps) {
const cssBundlesStats = moduleClassnameMaps && cssBundles.map(bundle => {
const moduleClassnames = bundle.modules.map(module => moduleClassnameMaps[module.path]);
const combinedJson = assign(...[{}].concat(modul... | [
"function",
"replaceCssModules",
"(",
"bundles",
",",
"cssBundles",
",",
"originBundleCssBundleMap",
",",
"moduleClassnameMaps",
")",
"{",
"const",
"cssBundlesStats",
"=",
"moduleClassnameMaps",
"&&",
"cssBundles",
".",
"map",
"(",
"bundle",
"=>",
"{",
"const",
"mod... | Replace CSS modules with JavaScript modules which reference the CSS
output bundle destination.
@param {Array} bundles Original bundles array.
@param {Array} cssBundles New CSS bundles.
@param {Object} originBundleCssBundleMap Mapping of origin bundle to sibling
CSS bundle.
@param {... | [
"Replace",
"CSS",
"modules",
"with",
"JavaScript",
"modules",
"which",
"reference",
"the",
"CSS",
"output",
"bundle",
"destination",
"."
] | 05197e4511b64d269260fe3c701ceff864897ab3 | https://github.com/interlockjs/plugins/blob/05197e4511b64d269260fe3c701ceff864897ab3/packages/css/src/gen-css-bundles.js#L25-L60 | train |
mountain/miniweb | miniweb/environment.js | visitEntry | function visitEntry (pkey, context, callback) {
_(context).chain().keys().each(function (key) {
var entry = context[key], curkey = pkey?(pkey + '.' + key):key;
if(_.isFunction(entry) || _.isString(entry) || _.isBoolean(entry) ||
_.isArray(entry) || _.isNumber(entry) || _.isRegExp(entry)) ... | javascript | function visitEntry (pkey, context, callback) {
_(context).chain().keys().each(function (key) {
var entry = context[key], curkey = pkey?(pkey + '.' + key):key;
if(_.isFunction(entry) || _.isString(entry) || _.isBoolean(entry) ||
_.isArray(entry) || _.isNumber(entry) || _.isRegExp(entry)) ... | [
"function",
"visitEntry",
"(",
"pkey",
",",
"context",
",",
"callback",
")",
"{",
"_",
"(",
"context",
")",
".",
"chain",
"(",
")",
".",
"keys",
"(",
")",
".",
"each",
"(",
"function",
"(",
"key",
")",
"{",
"var",
"entry",
"=",
"context",
"[",
"k... | Visit object hierachy structure | [
"Visit",
"object",
"hierachy",
"structure"
] | 8d06fd298cb2236a99d8a71b4b2486d27e607f04 | https://github.com/mountain/miniweb/blob/8d06fd298cb2236a99d8a71b4b2486d27e607f04/miniweb/environment.js#L53-L63 | train |
mountain/miniweb | miniweb/environment.js | accessEntry | function accessEntry (context, keys) {
_.each(keys, function (key) {
if (context) {
context = context[key];
}
});
return context;
} | javascript | function accessEntry (context, keys) {
_.each(keys, function (key) {
if (context) {
context = context[key];
}
});
return context;
} | [
"function",
"accessEntry",
"(",
"context",
",",
"keys",
")",
"{",
"_",
".",
"each",
"(",
"keys",
",",
"function",
"(",
"key",
")",
"{",
"if",
"(",
"context",
")",
"{",
"context",
"=",
"context",
"[",
"key",
"]",
";",
"}",
"}",
")",
";",
"return",... | Access object hierachy structure | [
"Access",
"object",
"hierachy",
"structure"
] | 8d06fd298cb2236a99d8a71b4b2486d27e607f04 | https://github.com/mountain/miniweb/blob/8d06fd298cb2236a99d8a71b4b2486d27e607f04/miniweb/environment.js#L74-L81 | train |
statticjs/stattic-parseurl | index.js | Get | function Get(url)
{
//Initialize the output
var out = {"path": "", "file": "", "ext": "", "query": {}, "hashtag": ""};
//Save the file path
out.path = url;
//Find if exists a ? or #
var p1 = out.path.indexOf('?');
var p2 = out.path.indexOf('#');
//Check for hashtag
if(p2 != -1)
{
//Get the ha... | javascript | function Get(url)
{
//Initialize the output
var out = {"path": "", "file": "", "ext": "", "query": {}, "hashtag": ""};
//Save the file path
out.path = url;
//Find if exists a ? or #
var p1 = out.path.indexOf('?');
var p2 = out.path.indexOf('#');
//Check for hashtag
if(p2 != -1)
{
//Get the ha... | [
"function",
"Get",
"(",
"url",
")",
"{",
"//Initialize the output",
"var",
"out",
"=",
"{",
"\"path\"",
":",
"\"\"",
",",
"\"file\"",
":",
"\"\"",
",",
"\"ext\"",
":",
"\"\"",
",",
"\"query\"",
":",
"{",
"}",
",",
"\"hashtag\"",
":",
"\"\"",
"}",
";",
... | Get the ext name sync | [
"Get",
"the",
"ext",
"name",
"sync"
] | b479a413c94a8d11af7bed9f95a2f1c3029600e8 | https://github.com/statticjs/stattic-parseurl/blob/b479a413c94a8d11af7bed9f95a2f1c3029600e8/index.js#L5-L58 | train |
Psychopoulet/node-promfs | lib/extends/_directoryToFile.js | _directoryToFile | function _directoryToFile (directory, target, separator, callback) {
if ("undefined" === typeof directory) {
throw new ReferenceError("missing \"directory\" argument");
}
else if ("string" !== typeof directory) {
throw new TypeError("\"directory\" argument is not a string");
}
else if ("" ==... | javascript | function _directoryToFile (directory, target, separator, callback) {
if ("undefined" === typeof directory) {
throw new ReferenceError("missing \"directory\" argument");
}
else if ("string" !== typeof directory) {
throw new TypeError("\"directory\" argument is not a string");
}
else if ("" ==... | [
"function",
"_directoryToFile",
"(",
"directory",
",",
"target",
",",
"separator",
",",
"callback",
")",
"{",
"if",
"(",
"\"undefined\"",
"===",
"typeof",
"directory",
")",
"{",
"throw",
"new",
"ReferenceError",
"(",
"\"missing \\\"directory\\\" argument\"",
")",
... | methods
Async directoryToFile
@param {string} directory : directory to work with
@param {string} target : file to write in
@param {string} separator : used to separate content (can be "")
@param {function|null} callback : operation's result
@returns {void} | [
"methods",
"Async",
"directoryToFile"
] | 016e272fc58c6ef6eae5ea551a0e8873f0ac20cc | https://github.com/Psychopoulet/node-promfs/blob/016e272fc58c6ef6eae5ea551a0e8873f0ac20cc/lib/extends/_directoryToFile.js#L24-L66 | train |
AndCake/glassbil | src/store.js | deepFreeze | function deepFreeze(obj) {
// if it's already frozen, don't bother going deep into it...
if (obj === null || typeof obj === 'undefined' || typeof obj.toJS === 'function' || typeof obj !== 'object') {
return obj;
}
// Retrieve the property names defined on obj
let propNames = Object.getOwnPr... | javascript | function deepFreeze(obj) {
// if it's already frozen, don't bother going deep into it...
if (obj === null || typeof obj === 'undefined' || typeof obj.toJS === 'function' || typeof obj !== 'object') {
return obj;
}
// Retrieve the property names defined on obj
let propNames = Object.getOwnPr... | [
"function",
"deepFreeze",
"(",
"obj",
")",
"{",
"// if it's already frozen, don't bother going deep into it...",
"if",
"(",
"obj",
"===",
"null",
"||",
"typeof",
"obj",
"===",
"'undefined'",
"||",
"typeof",
"obj",
".",
"toJS",
"===",
"'function'",
"||",
"typeof",
... | Create an immutable object lazily.
@param {Object} obj
@returns {Object} the immutable object created | [
"Create",
"an",
"immutable",
"object",
"lazily",
"."
] | 4fec5179d61e86ba32dac136ebe966de0c224844 | https://github.com/AndCake/glassbil/blob/4fec5179d61e86ba32dac136ebe966de0c224844/src/store.js#L28-L63 | train |
hotosm/oam-browser-filters | index.js | getCombination | function getCombination (dateFilter, resolutionFilter, dataTypeFilter) {
var c = {
date: getFilter(date, dateFilter),
resolution: getFilter(resolution, resolutionFilter),
dataType: getFilter(dataType, dataTypeFilter),
searchParameters: getSearchParameters(dateFilter, resolutionFilter, dataTypeFilter)
... | javascript | function getCombination (dateFilter, resolutionFilter, dataTypeFilter) {
var c = {
date: getFilter(date, dateFilter),
resolution: getFilter(resolution, resolutionFilter),
dataType: getFilter(dataType, dataTypeFilter),
searchParameters: getSearchParameters(dateFilter, resolutionFilter, dataTypeFilter)
... | [
"function",
"getCombination",
"(",
"dateFilter",
",",
"resolutionFilter",
",",
"dataTypeFilter",
")",
"{",
"var",
"c",
"=",
"{",
"date",
":",
"getFilter",
"(",
"date",
",",
"dateFilter",
")",
",",
"resolution",
":",
"getFilter",
"(",
"resolution",
",",
"reso... | Get the combination of the given dateFilter, resolutionFilter,
dataTypeFilter combination. | [
"Get",
"the",
"combination",
"of",
"the",
"given",
"dateFilter",
"resolutionFilter",
"dataTypeFilter",
"combination",
"."
] | c3086925d2d198c1d7c2426eb7e0790e37a46013 | https://github.com/hotosm/oam-browser-filters/blob/c3086925d2d198c1d7c2426eb7e0790e37a46013/index.js#L56-L66 | train |
hotosm/oam-browser-filters | index.js | getAllCombinations | function getAllCombinations () {
var combinations = [];
date.forEach(function (tf) {
resolution.forEach(function (rf) {
dataType.forEach(function (sf) {
combinations.push(getCombination(tf, rf, sf));
});
});
});
return combinations;
} | javascript | function getAllCombinations () {
var combinations = [];
date.forEach(function (tf) {
resolution.forEach(function (rf) {
dataType.forEach(function (sf) {
combinations.push(getCombination(tf, rf, sf));
});
});
});
return combinations;
} | [
"function",
"getAllCombinations",
"(",
")",
"{",
"var",
"combinations",
"=",
"[",
"]",
";",
"date",
".",
"forEach",
"(",
"function",
"(",
"tf",
")",
"{",
"resolution",
".",
"forEach",
"(",
"function",
"(",
"rf",
")",
"{",
"dataType",
".",
"forEach",
"(... | Get an array of all possible filter combinations. | [
"Get",
"an",
"array",
"of",
"all",
"possible",
"filter",
"combinations",
"."
] | c3086925d2d198c1d7c2426eb7e0790e37a46013 | https://github.com/hotosm/oam-browser-filters/blob/c3086925d2d198c1d7c2426eb7e0790e37a46013/index.js#L101-L112 | train |
meltmedia/node-usher | lib/decider/tasks/while-loop.js | WhileLoop | function WhileLoop(name, deps, fragment, doneFn, options) {
if (!(this instanceof WhileLoop)) {
return new WhileLoop(name, deps, fragment, doneFn, options);
}
Task.apply(this, Array.prototype.slice.call(arguments));
this.fragment = fragment;
if (!_.isFunction(doneFn)) {
throw new Error('You must pr... | javascript | function WhileLoop(name, deps, fragment, doneFn, options) {
if (!(this instanceof WhileLoop)) {
return new WhileLoop(name, deps, fragment, doneFn, options);
}
Task.apply(this, Array.prototype.slice.call(arguments));
this.fragment = fragment;
if (!_.isFunction(doneFn)) {
throw new Error('You must pr... | [
"function",
"WhileLoop",
"(",
"name",
",",
"deps",
",",
"fragment",
",",
"doneFn",
",",
"options",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"WhileLoop",
")",
")",
"{",
"return",
"new",
"WhileLoop",
"(",
"name",
",",
"deps",
",",
"fragment",... | The loop executes the `fragment` until the `doneFn` returns a truthy value
@constructor | [
"The",
"loop",
"executes",
"the",
"fragment",
"until",
"the",
"doneFn",
"returns",
"a",
"truthy",
"value"
] | fe6183bf7097f84bef935e8d9c19463accc08ad6 | https://github.com/meltmedia/node-usher/blob/fe6183bf7097f84bef935e8d9c19463accc08ad6/lib/decider/tasks/while-loop.js#L24-L39 | train |
jmendiara/gitftw | src/gitftw.js | readStream | function readStream(stream) {
return new Promise(function(resolve) {
stream.pipe(concat(function(data) {
resolve(data.toString().trim());
}));
});
} | javascript | function readStream(stream) {
return new Promise(function(resolve) {
stream.pipe(concat(function(data) {
resolve(data.toString().trim());
}));
});
} | [
"function",
"readStream",
"(",
"stream",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
")",
"{",
"stream",
".",
"pipe",
"(",
"concat",
"(",
"function",
"(",
"data",
")",
"{",
"resolve",
"(",
"data",
".",
"toString",
"(",
")",
... | Reads an stream
@private
@param {Stream} stream
@returns {Promise} resolves with the value | [
"Reads",
"an",
"stream"
] | ba91b0d68b7791b5b557addc685737f6c912b4f3 | https://github.com/jmendiara/gitftw/blob/ba91b0d68b7791b5b557addc685737f6c912b4f3/src/gitftw.js#L51-L57 | train |
jmendiara/gitftw | src/gitftw.js | createGitCmdPromise | function createGitCmdPromise(args) {
return new Promise(function(resolve, reject) {
//Remove null values from the final git arguments
args = args.filter(function(arg) {
/*jshint eqnull:true */
return arg != null;
});
/**
* @name git#command
* @event
* @param {String} Strin... | javascript | function createGitCmdPromise(args) {
return new Promise(function(resolve, reject) {
//Remove null values from the final git arguments
args = args.filter(function(arg) {
/*jshint eqnull:true */
return arg != null;
});
/**
* @name git#command
* @event
* @param {String} Strin... | [
"function",
"createGitCmdPromise",
"(",
"args",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"//Remove null values from the final git arguments",
"args",
"=",
"args",
".",
"filter",
"(",
"function",
"(",
"arg",
... | Creates a promise for a Git Execution
@private
@param {Resolvable|Array<String|null>} args The arguments to pass to git command
@returns {Promise} | [
"Creates",
"a",
"promise",
"for",
"a",
"Git",
"Execution"
] | ba91b0d68b7791b5b557addc685737f6c912b4f3 | https://github.com/jmendiara/gitftw/blob/ba91b0d68b7791b5b557addc685737f6c912b4f3/src/gitftw.js#L66-L120 | train |
jmendiara/gitftw | src/gitftw.js | spawnGit | function spawnGit(args) {
//don't bother with throws, they are catched by promises
gitCmd = gitCmd || which('git');
assert.ok(args, 'arguments to git is mandatory');
executionCount++;
if (executionPromise) {
executionPromise = executionPromise.then(
createGitCmdPromise.bind(null, args),
c... | javascript | function spawnGit(args) {
//don't bother with throws, they are catched by promises
gitCmd = gitCmd || which('git');
assert.ok(args, 'arguments to git is mandatory');
executionCount++;
if (executionPromise) {
executionPromise = executionPromise.then(
createGitCmdPromise.bind(null, args),
c... | [
"function",
"spawnGit",
"(",
"args",
")",
"{",
"//don't bother with throws, they are catched by promises",
"gitCmd",
"=",
"gitCmd",
"||",
"which",
"(",
"'git'",
")",
";",
"assert",
".",
"ok",
"(",
"args",
",",
"'arguments to git is mandatory'",
")",
";",
"executionC... | Spawns a git process with the provider arguments
This function is called when you call directly the require of `gitftw`
If you provide a second parameter
DISCLAIMER: I've not found any way to document this in jsdoc and this
template in a proper way. Sorry for the possible missunderstanding
@example
var git = require... | [
"Spawns",
"a",
"git",
"process",
"with",
"the",
"provider",
"arguments",
"This",
"function",
"is",
"called",
"when",
"you",
"call",
"directly",
"the",
"require",
"of",
"gitftw"
] | ba91b0d68b7791b5b557addc685737f6c912b4f3 | https://github.com/jmendiara/gitftw/blob/ba91b0d68b7791b5b557addc685737f6c912b4f3/src/gitftw.js#L149-L169 | train |
jmendiara/gitftw | src/gitftw.js | decorator | function decorator(fn, options, cb) {
if (typeof options === 'function') {
cb = options;
options = null;
}
return resolvable(options)
.then(fn)
.nodeify(cb);
} | javascript | function decorator(fn, options, cb) {
if (typeof options === 'function') {
cb = options;
options = null;
}
return resolvable(options)
.then(fn)
.nodeify(cb);
} | [
"function",
"decorator",
"(",
"fn",
",",
"options",
",",
"cb",
")",
"{",
"if",
"(",
"typeof",
"options",
"===",
"'function'",
")",
"{",
"cb",
"=",
"options",
";",
"options",
"=",
"null",
";",
"}",
"return",
"resolvable",
"(",
"options",
")",
".",
"th... | Decorates a function resolving its resolvables before calling it,
adding node callback api
@private
@param {Function} fn The function to decorate
@param {Object} [options] The options object passed to the command
@param {callback} [cb] Callback used when in callback mode
@returns {Promise|undefined} A promise when in ... | [
"Decorates",
"a",
"function",
"resolving",
"its",
"resolvables",
"before",
"calling",
"it",
"adding",
"node",
"callback",
"api"
] | ba91b0d68b7791b5b557addc685737f6c912b4f3 | https://github.com/jmendiara/gitftw/blob/ba91b0d68b7791b5b557addc685737f6c912b4f3/src/gitftw.js#L181-L190 | train |
zland/zland-map | actions/MapActionCreators.js | function(projection, map) {
Dispatcher.dispatch({
type: Constants.MAP_PROJECTION,
projection: projection,
map: map
});
} | javascript | function(projection, map) {
Dispatcher.dispatch({
type: Constants.MAP_PROJECTION,
projection: projection,
map: map
});
} | [
"function",
"(",
"projection",
",",
"map",
")",
"{",
"Dispatcher",
".",
"dispatch",
"(",
"{",
"type",
":",
"Constants",
".",
"MAP_PROJECTION",
",",
"projection",
":",
"projection",
",",
"map",
":",
"map",
"}",
")",
";",
"}"
] | when goole map is rendered the stores need to get the projection
to convert positions from pixels to latlng and vice versa
@param {Object} projection google map projection
@param {Object} map google map object | [
"when",
"goole",
"map",
"is",
"rendered",
"the",
"stores",
"need",
"to",
"get",
"the",
"projection",
"to",
"convert",
"positions",
"from",
"pixels",
"to",
"latlng",
"and",
"vice",
"versa"
] | adff5510e3c267ce87e166f0a0354c7a85db8752 | https://github.com/zland/zland-map/blob/adff5510e3c267ce87e166f0a0354c7a85db8752/actions/MapActionCreators.js#L33-L39 | train | |
inviqa/deck-task-registry | src/assets/buildFonts.js | buildFonts | function buildFonts(conf, undertaker) {
const fontSrc = path.join(conf.themeConfig.root, conf.themeConfig.fonts.src, '**', '*.{eot,ttf,woff,woff2,otf,svg}');
const fontDest = path.join(conf.themeConfig.root, conf.themeConfig.fonts.dest);
return undertaker.src(fontSrc)
.pipe(undertaker.dest(fontDest));
} | javascript | function buildFonts(conf, undertaker) {
const fontSrc = path.join(conf.themeConfig.root, conf.themeConfig.fonts.src, '**', '*.{eot,ttf,woff,woff2,otf,svg}');
const fontDest = path.join(conf.themeConfig.root, conf.themeConfig.fonts.dest);
return undertaker.src(fontSrc)
.pipe(undertaker.dest(fontDest));
} | [
"function",
"buildFonts",
"(",
"conf",
",",
"undertaker",
")",
"{",
"const",
"fontSrc",
"=",
"path",
".",
"join",
"(",
"conf",
".",
"themeConfig",
".",
"root",
",",
"conf",
".",
"themeConfig",
".",
"fonts",
".",
"src",
",",
"'**'",
",",
"'*.{eot,ttf,woff... | Build project fonts.
@param {ConfigParser} conf A configuration parser object.
@param {Undertaker} undertaker An Undertaker instance.
@returns {Stream} A stream of files. | [
"Build",
"project",
"fonts",
"."
] | 4c31787b978e9d99a47052e090d4589a50cd3015 | https://github.com/inviqa/deck-task-registry/blob/4c31787b978e9d99a47052e090d4589a50cd3015/src/assets/buildFonts.js#L13-L21 | train |
konfirm/gulp-chain | lib/chain.js | chain | function chain() {
let arg = Array.from(arguments),
pipe = arg.length > 0 ? arg.shift() : stream => stream;
return function() {
let writer = through.obj();
return duplexer(
{objectMode: true},
writer,
pipe.apply(null, [writer].concat(merge(arguments, arg)))
);
};
} | javascript | function chain() {
let arg = Array.from(arguments),
pipe = arg.length > 0 ? arg.shift() : stream => stream;
return function() {
let writer = through.obj();
return duplexer(
{objectMode: true},
writer,
pipe.apply(null, [writer].concat(merge(arguments, arg)))
);
};
} | [
"function",
"chain",
"(",
")",
"{",
"let",
"arg",
"=",
"Array",
".",
"from",
"(",
"arguments",
")",
",",
"pipe",
"=",
"arg",
".",
"length",
">",
"0",
"?",
"arg",
".",
"shift",
"(",
")",
":",
"stream",
"=>",
"stream",
";",
"return",
"function",
"(... | Prepare a gulp-plugin like chain function
@name chain
@access internal
@param variadic ...
@return function | [
"Prepare",
"a",
"gulp",
"-",
"plugin",
"like",
"chain",
"function"
] | 69e604ea85352a5910885ee0a62c9812d208109e | https://github.com/konfirm/gulp-chain/blob/69e604ea85352a5910885ee0a62c9812d208109e/lib/chain.js#L34-L47 | train |
mcax/reporter | lib/reporter.js | coordinates | function coordinates(index, source) {
if (!index || !source)
return void 0;
var lines = source
.slice(0, index)
.split('\n');
return lines.length + ':' + lines.pop().length;
} | javascript | function coordinates(index, source) {
if (!index || !source)
return void 0;
var lines = source
.slice(0, index)
.split('\n');
return lines.length + ':' + lines.pop().length;
} | [
"function",
"coordinates",
"(",
"index",
",",
"source",
")",
"{",
"if",
"(",
"!",
"index",
"||",
"!",
"source",
")",
"return",
"void",
"0",
";",
"var",
"lines",
"=",
"source",
".",
"slice",
"(",
"0",
",",
"index",
")",
".",
"split",
"(",
"'\\n'",
... | Get row and column number in given string at given index.
@param {Number} index
@param {String} source
@return {String}
@api private | [
"Get",
"row",
"and",
"column",
"number",
"in",
"given",
"string",
"at",
"given",
"index",
"."
] | 11b70b80001cb6d339561c4efbaef97e11022438 | https://github.com/mcax/reporter/blob/11b70b80001cb6d339561c4efbaef97e11022438/lib/reporter.js#L32-L41 | train |
MakerCollider/node-red-contrib-smartnode-hook | html/scripts/RGraph/RGraph.common.effects.js | iterator | function iterator ()
{
// Begin by clearing the canvas
RG.clear(obj.canvas, color);
obj.context.save();
// First draw the circle and clip to it
obj.context.beginPath();
obj.context.arc(centerx, centery, currentRadius, 0, RG.TWO... | javascript | function iterator ()
{
// Begin by clearing the canvas
RG.clear(obj.canvas, color);
obj.context.save();
// First draw the circle and clip to it
obj.context.beginPath();
obj.context.arc(centerx, centery, currentRadius, 0, RG.TWO... | [
"function",
"iterator",
"(",
")",
"{",
"// Begin by clearing the canvas",
"RG",
".",
"clear",
"(",
"obj",
".",
"canvas",
",",
"color",
")",
";",
"obj",
".",
"context",
".",
"save",
"(",
")",
";",
"// First draw the circle and clip to it",
"obj",
".",
"context"... | This is the iterator function which gradually increases the radius of the clip circle | [
"This",
"is",
"the",
"iterator",
"function",
"which",
"gradually",
"increases",
"the",
"radius",
"of",
"the",
"clip",
"circle"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/RGraph/RGraph.common.effects.js#L773-L802 | train |
shaozilee/tufu | lib/tufu.js | Tufu | function Tufu(src){
if(!(this instanceof Tufu)){
return new Tufu(src);
}
this.src = src;
var bufferData = fs.readFileSync(this.src);
this.codec = Tufu.adaptCodec(bufferData);
this.imageData = this.codec.decode(bufferData);
//set image quality 100%
this.quality = 100;
} | javascript | function Tufu(src){
if(!(this instanceof Tufu)){
return new Tufu(src);
}
this.src = src;
var bufferData = fs.readFileSync(this.src);
this.codec = Tufu.adaptCodec(bufferData);
this.imageData = this.codec.decode(bufferData);
//set image quality 100%
this.quality = 100;
} | [
"function",
"Tufu",
"(",
"src",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Tufu",
")",
")",
"{",
"return",
"new",
"Tufu",
"(",
"src",
")",
";",
"}",
"this",
".",
"src",
"=",
"src",
";",
"var",
"bufferData",
"=",
"fs",
".",
"readFileSyn... | start of Tufu
@param {[String]} filePath
@return {[Tufu]} new instance Tufu | [
"start",
"of",
"Tufu"
] | 06ae6c7bb0f32a1c186545366dac1dde2fd6d84e | https://github.com/shaozilee/tufu/blob/06ae6c7bb0f32a1c186545366dac1dde2fd6d84e/lib/tufu.js#L35-L45 | train |
nathanhood/postcss-js-mixins | index.js | castArgument | function castArgument(arg) {
if (isNumber(arg)) {
return parseFloat(arg);
}
if (helpers.isFraction(arg)) {
arg = arg.split('/');
return arg[0] / arg[1];
}
if (arg === 'false' || arg === 'true') {
return arg === 'true';
}
return arg.length ? arg : undefined;
} | javascript | function castArgument(arg) {
if (isNumber(arg)) {
return parseFloat(arg);
}
if (helpers.isFraction(arg)) {
arg = arg.split('/');
return arg[0] / arg[1];
}
if (arg === 'false' || arg === 'true') {
return arg === 'true';
}
return arg.length ? arg : undefined;
} | [
"function",
"castArgument",
"(",
"arg",
")",
"{",
"if",
"(",
"isNumber",
"(",
"arg",
")",
")",
"{",
"return",
"parseFloat",
"(",
"arg",
")",
";",
"}",
"if",
"(",
"helpers",
".",
"isFraction",
"(",
"arg",
")",
")",
"{",
"arg",
"=",
"arg",
".",
"sp... | Convert argument to proper type
@param {string} arg
@returns {*} | [
"Convert",
"argument",
"to",
"proper",
"type"
] | b43e94b5eaa4b1f169d34ee98c65b8c94bee30b5 | https://github.com/nathanhood/postcss-js-mixins/blob/b43e94b5eaa4b1f169d34ee98c65b8c94bee30b5/index.js#L28-L44 | train |
nathanhood/postcss-js-mixins | index.js | getArguments | function getArguments(name, mixin, obj) {
let named = obj.named,
ordered = obj.ordered,
args = [],
parameters;
// Cache function parameter names
if (! mixinArguments[name]) {
mixinArguments[name] = mixin.toString()
// Strip out quoted strings (stripping possible commas from parameters)
.repla... | javascript | function getArguments(name, mixin, obj) {
let named = obj.named,
ordered = obj.ordered,
args = [],
parameters;
// Cache function parameter names
if (! mixinArguments[name]) {
mixinArguments[name] = mixin.toString()
// Strip out quoted strings (stripping possible commas from parameters)
.repla... | [
"function",
"getArguments",
"(",
"name",
",",
"mixin",
",",
"obj",
")",
"{",
"let",
"named",
"=",
"obj",
".",
"named",
",",
"ordered",
"=",
"obj",
".",
"ordered",
",",
"args",
"=",
"[",
"]",
",",
"parameters",
";",
"// Cache function parameter names",
"i... | Generate arguments array
@param {string} name
@param {function} mixin
@param {object} obj - mixin arguments property
@returns {Array} | [
"Generate",
"arguments",
"array"
] | b43e94b5eaa4b1f169d34ee98c65b8c94bee30b5 | https://github.com/nathanhood/postcss-js-mixins/blob/b43e94b5eaa4b1f169d34ee98c65b8c94bee30b5/index.js#L54-L88 | train |
gethuman/pancakes-recipe | services/adapters/apiclient/apiclient.adapter.js | ApiclientAdapter | function ApiclientAdapter(resource) {
this.admin = admin;
this.resource = resource || {};
// loop through API interface for resource to get methods to expose
var me = this;
_.each(resource.api, function (methodInfo, httpMethod) {
_.each(methodInfo, function (operation, path) {
m... | javascript | function ApiclientAdapter(resource) {
this.admin = admin;
this.resource = resource || {};
// loop through API interface for resource to get methods to expose
var me = this;
_.each(resource.api, function (methodInfo, httpMethod) {
_.each(methodInfo, function (operation, path) {
m... | [
"function",
"ApiclientAdapter",
"(",
"resource",
")",
"{",
"this",
".",
"admin",
"=",
"admin",
";",
"this",
".",
"resource",
"=",
"resource",
"||",
"{",
"}",
";",
"// loop through API interface for resource to get methods to expose",
"var",
"me",
"=",
"this",
";",... | Initialize the methods for this interface using the resource. This will
loop through the routes defined in the api section of the resource file
and auto generate method interfaces which all end up make REST API calls.
@param resource
@constructor | [
"Initialize",
"the",
"methods",
"for",
"this",
"interface",
"using",
"the",
"resource",
".",
"This",
"will",
"loop",
"through",
"the",
"routes",
"defined",
"in",
"the",
"api",
"section",
"of",
"the",
"resource",
"file",
"and",
"auto",
"generate",
"method",
"... | ea3feb8839e2edaf1b4577c052b8958953db4498 | https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/services/adapters/apiclient/apiclient.adapter.js#L23-L36 | train |
gethuman/pancakes-recipe | services/adapters/apiclient/apiclient.adapter.js | init | function init(config) {
var tokenConfig = config.security.token || {};
var privateKey = tokenConfig.privateKey;
var decryptedToken = {
_id: tokenConfig.webserverId,
authToken: tokenConfig.webserverToken
};
var jwt = jsonwebtoken.sign(decryptedToken, privateKey);
headers = { 'Aut... | javascript | function init(config) {
var tokenConfig = config.security.token || {};
var privateKey = tokenConfig.privateKey;
var decryptedToken = {
_id: tokenConfig.webserverId,
authToken: tokenConfig.webserverToken
};
var jwt = jsonwebtoken.sign(decryptedToken, privateKey);
headers = { 'Aut... | [
"function",
"init",
"(",
"config",
")",
"{",
"var",
"tokenConfig",
"=",
"config",
".",
"security",
".",
"token",
"||",
"{",
"}",
";",
"var",
"privateKey",
"=",
"tokenConfig",
".",
"privateKey",
";",
"var",
"decryptedToken",
"=",
"{",
"_id",
":",
"tokenCo... | Init called at startup and is used to
@param config | [
"Init",
"called",
"at",
"startup",
"and",
"is",
"used",
"to"
] | ea3feb8839e2edaf1b4577c052b8958953db4498 | https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/services/adapters/apiclient/apiclient.adapter.js#L42-L72 | train |
gethuman/pancakes-recipe | services/adapters/apiclient/apiclient.adapter.js | send | function send(httpMethod, path, req) {
req = req || {};
httpMethod = httpMethod.toUpperCase();
var deferred = Q.defer();
var url = baseUrl + path;
var data = req.data || {}; // separate out data from request
delete req.data;
var isAdmin = req.caller && req.caller.role === 'admin';... | javascript | function send(httpMethod, path, req) {
req = req || {};
httpMethod = httpMethod.toUpperCase();
var deferred = Q.defer();
var url = baseUrl + path;
var data = req.data || {}; // separate out data from request
delete req.data;
var isAdmin = req.caller && req.caller.role === 'admin';... | [
"function",
"send",
"(",
"httpMethod",
",",
"path",
",",
"req",
")",
"{",
"req",
"=",
"req",
"||",
"{",
"}",
";",
"httpMethod",
"=",
"httpMethod",
".",
"toUpperCase",
"(",
")",
";",
"var",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
";",
"var",
... | Send the request to the restful endpoint
@param httpMethod
@param path
@param req | [
"Send",
"the",
"request",
"to",
"the",
"restful",
"endpoint"
] | ea3feb8839e2edaf1b4577c052b8958953db4498 | https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/services/adapters/apiclient/apiclient.adapter.js#L86-L140 | train |
alexpods/ClazzJS | src/components/meta/Property/Getters.js | function(object, getters, property) {
_.each(getters, function(getter, name) {
object.__addGetter(property, name, getter);
});
} | javascript | function(object, getters, property) {
_.each(getters, function(getter, name) {
object.__addGetter(property, name, getter);
});
} | [
"function",
"(",
"object",
",",
"getters",
",",
"property",
")",
"{",
"_",
".",
"each",
"(",
"getters",
",",
"function",
"(",
"getter",
",",
"name",
")",
"{",
"object",
".",
"__addGetter",
"(",
"property",
",",
"name",
",",
"getter",
")",
";",
"}",
... | Add property getters to object
@param {object} object Some object
@param {object} getters Hash of property getters
@param {string} property Property name
@this {metaProcessor} | [
"Add",
"property",
"getters",
"to",
"object"
] | 2f94496019669813c8246d48fcceb12a3e68a870 | https://github.com/alexpods/ClazzJS/blob/2f94496019669813c8246d48fcceb12a3e68a870/src/components/meta/Property/Getters.js#L16-L21 | train | |
wescravens/class-decorators | dist/index.js | _flatten | function _flatten(_ref) {
var _ref2 = _toArray(_ref);
var first = _ref2[0];
var rest = _ref2.slice(1);
if (first === undefined) {
return [];
} else if (!Array.isArray(first)) {
return [first].concat(_toConsumableArray(_flatten(rest)));
} else {
return [].concat(_toConsumableArray(_flatten(fir... | javascript | function _flatten(_ref) {
var _ref2 = _toArray(_ref);
var first = _ref2[0];
var rest = _ref2.slice(1);
if (first === undefined) {
return [];
} else if (!Array.isArray(first)) {
return [first].concat(_toConsumableArray(_flatten(rest)));
} else {
return [].concat(_toConsumableArray(_flatten(fir... | [
"function",
"_flatten",
"(",
"_ref",
")",
"{",
"var",
"_ref2",
"=",
"_toArray",
"(",
"_ref",
")",
";",
"var",
"first",
"=",
"_ref2",
"[",
"0",
"]",
";",
"var",
"rest",
"=",
"_ref2",
".",
"slice",
"(",
"1",
")",
";",
"if",
"(",
"first",
"===",
"... | Utility function for flattening nested arrays | [
"Utility",
"function",
"for",
"flattening",
"nested",
"arrays"
] | 72323df2857564f1997191364ea447adfe51007c | https://github.com/wescravens/class-decorators/blob/72323df2857564f1997191364ea447adfe51007c/dist/index.js#L149-L163 | train |
noblesamurai/noblerecord | src/nrutil.js | serialize | function serialize(val) {
if (val == null) {
return 'NULL'
} else if (typeof val == 'string') {
return "'" + val.replace(/(\\)/g, '\\$1').replace(/(')/g, '\\$1') + "'";
} else if (typeof val == 'number') {
if (isNaN(val)) {
return 'NULL';
} else {
return val.toString();
}
} else if ([true, false... | javascript | function serialize(val) {
if (val == null) {
return 'NULL'
} else if (typeof val == 'string') {
return "'" + val.replace(/(\\)/g, '\\$1').replace(/(')/g, '\\$1') + "'";
} else if (typeof val == 'number') {
if (isNaN(val)) {
return 'NULL';
} else {
return val.toString();
}
} else if ([true, false... | [
"function",
"serialize",
"(",
"val",
")",
"{",
"if",
"(",
"val",
"==",
"null",
")",
"{",
"return",
"'NULL'",
"}",
"else",
"if",
"(",
"typeof",
"val",
"==",
"'string'",
")",
"{",
"return",
"\"'\"",
"+",
"val",
".",
"replace",
"(",
"/",
"(\\\\)",
"/"... | Attempt to serialize a value as a string acceptable for an SQL statement. | [
"Attempt",
"to",
"serialize",
"a",
"value",
"as",
"a",
"string",
"acceptable",
"for",
"an",
"SQL",
"statement",
"."
] | fc7d3aac186598c4c7023f5448979d4162ab5e38 | https://github.com/noblesamurai/noblerecord/blob/fc7d3aac186598c4c7023f5448979d4162ab5e38/src/nrutil.js#L55-L78 | train |
noblesamurai/noblerecord | src/nrutil.js | parseSQLVal | function parseSQLVal(type, val) {
if (val == 'NULL') {
return null;
}
switch (type) {
case 'datetime':
case 'timestamp':
if (val == 'CURRENT_TIMESTAMP') {
return val;
} else if (val == '0000-00-00 00:00:00') {
// HACK(arlen): Not sure if this is correct, but constructing
... | javascript | function parseSQLVal(type, val) {
if (val == 'NULL') {
return null;
}
switch (type) {
case 'datetime':
case 'timestamp':
if (val == 'CURRENT_TIMESTAMP') {
return val;
} else if (val == '0000-00-00 00:00:00') {
// HACK(arlen): Not sure if this is correct, but constructing
... | [
"function",
"parseSQLVal",
"(",
"type",
",",
"val",
")",
"{",
"if",
"(",
"val",
"==",
"'NULL'",
")",
"{",
"return",
"null",
";",
"}",
"switch",
"(",
"type",
")",
"{",
"case",
"'datetime'",
":",
"case",
"'timestamp'",
":",
"if",
"(",
"val",
"==",
"'... | Parses an SQL string into a JS object given the friendly type. | [
"Parses",
"an",
"SQL",
"string",
"into",
"a",
"JS",
"object",
"given",
"the",
"friendly",
"type",
"."
] | fc7d3aac186598c4c7023f5448979d4162ab5e38 | https://github.com/noblesamurai/noblerecord/blob/fc7d3aac186598c4c7023f5448979d4162ab5e38/src/nrutil.js#L146-L176 | train |
micro-app/micro-storage | src/entry/micro-storage.js | microStorage | function microStorage ( namespace ) {
list[namespace] = list[namespace] || {};
localStorage.setItem(packageName, JSON.stringify(list));
/**
* Get or set value from storage
* @param {String} name key
* @param {AnyType} value value
* @return {AnyType} value
*/
function storage ( name... | javascript | function microStorage ( namespace ) {
list[namespace] = list[namespace] || {};
localStorage.setItem(packageName, JSON.stringify(list));
/**
* Get or set value from storage
* @param {String} name key
* @param {AnyType} value value
* @return {AnyType} value
*/
function storage ( name... | [
"function",
"microStorage",
"(",
"namespace",
")",
"{",
"list",
"[",
"namespace",
"]",
"=",
"list",
"[",
"namespace",
"]",
"||",
"{",
"}",
";",
"localStorage",
".",
"setItem",
"(",
"packageName",
",",
"JSON",
".",
"stringify",
"(",
"list",
")",
")",
";... | A lite localStorage plugin with namespace
@param {String} namespace namespace
@return {Function} function | [
"A",
"lite",
"localStorage",
"plugin",
"with",
"namespace"
] | 775f73f4eb6651b2eba78d3408626dcb3a67e192 | https://github.com/micro-app/micro-storage/blob/775f73f4eb6651b2eba78d3408626dcb3a67e192/src/entry/micro-storage.js#L17-L70 | train |
micro-app/micro-storage | src/entry/micro-storage.js | storage | function storage ( name, value ) {
if (arguments.length == 0) {
return;
}
if (arguments.length == 1) {
let result = JSON.parse(localStorage.getItem(`${ namespace }.${ name }`));
return result ? result.$ : result;
}
localStorage.setItem(`${ name... | javascript | function storage ( name, value ) {
if (arguments.length == 0) {
return;
}
if (arguments.length == 1) {
let result = JSON.parse(localStorage.getItem(`${ namespace }.${ name }`));
return result ? result.$ : result;
}
localStorage.setItem(`${ name... | [
"function",
"storage",
"(",
"name",
",",
"value",
")",
"{",
"if",
"(",
"arguments",
".",
"length",
"==",
"0",
")",
"{",
"return",
";",
"}",
"if",
"(",
"arguments",
".",
"length",
"==",
"1",
")",
"{",
"let",
"result",
"=",
"JSON",
".",
"parse",
"(... | Get or set value from storage
@param {String} name key
@param {AnyType} value value
@return {AnyType} value | [
"Get",
"or",
"set",
"value",
"from",
"storage"
] | 775f73f4eb6651b2eba78d3408626dcb3a67e192 | https://github.com/micro-app/micro-storage/blob/775f73f4eb6651b2eba78d3408626dcb3a67e192/src/entry/micro-storage.js#L28-L40 | train |
byron-dupreez/logging-utils | logging.js | isLoggingConfigured | function isLoggingConfigured(target) {
return target && isBoolean(target.warnEnabled) && isBoolean(target.infoEnabled) && isBoolean(target.debugEnabled)
&& isBoolean(target.traceEnabled) && typeof target.error === 'function' && typeof target.warn === 'function'
&& typeof target.info === 'function' && typeof t... | javascript | function isLoggingConfigured(target) {
return target && isBoolean(target.warnEnabled) && isBoolean(target.infoEnabled) && isBoolean(target.debugEnabled)
&& isBoolean(target.traceEnabled) && typeof target.error === 'function' && typeof target.warn === 'function'
&& typeof target.info === 'function' && typeof t... | [
"function",
"isLoggingConfigured",
"(",
"target",
")",
"{",
"return",
"target",
"&&",
"isBoolean",
"(",
"target",
".",
"warnEnabled",
")",
"&&",
"isBoolean",
"(",
"target",
".",
"infoEnabled",
")",
"&&",
"isBoolean",
"(",
"target",
".",
"debugEnabled",
")",
... | Returns true, if the given target already has logging functionality configured on it; otherwise returns false.
@param {Object} target the target object to check
@return {*} true if configured; otherwise false | [
"Returns",
"true",
"if",
"the",
"given",
"target",
"already",
"has",
"logging",
"functionality",
"configured",
"on",
"it",
";",
"otherwise",
"returns",
"false",
"."
] | b5edac6efb288a2276dc88159a935d36816a859f | https://github.com/byron-dupreez/logging-utils/blob/b5edac6efb288a2276dc88159a935d36816a859f/logging.js#L112-L116 | train |
byron-dupreez/logging-utils | logging.js | isValidLogLevel | function isValidLogLevel(logLevel) {
const level = cleanLogLevel(logLevel);
switch (level) {
case LogLevel.ERROR:
case LogLevel.WARN:
case LogLevel.INFO:
case LogLevel.DEBUG:
case LogLevel.TRACE:
return true;
default:
return false;
}
} | javascript | function isValidLogLevel(logLevel) {
const level = cleanLogLevel(logLevel);
switch (level) {
case LogLevel.ERROR:
case LogLevel.WARN:
case LogLevel.INFO:
case LogLevel.DEBUG:
case LogLevel.TRACE:
return true;
default:
return false;
}
} | [
"function",
"isValidLogLevel",
"(",
"logLevel",
")",
"{",
"const",
"level",
"=",
"cleanLogLevel",
"(",
"logLevel",
")",
";",
"switch",
"(",
"level",
")",
"{",
"case",
"LogLevel",
".",
"ERROR",
":",
"case",
"LogLevel",
".",
"WARN",
":",
"case",
"LogLevel",
... | Returns true if the given log level is a valid logging level; otherwise returns false.
@param {LogLevel|string|undefined} [logLevel] - the optional log level to validate
@returns {boolean} true if a valid logging level; false otherwise | [
"Returns",
"true",
"if",
"the",
"given",
"log",
"level",
"is",
"a",
"valid",
"logging",
"level",
";",
"otherwise",
"returns",
"false",
"."
] | b5edac6efb288a2276dc88159a935d36816a859f | https://github.com/byron-dupreez/logging-utils/blob/b5edac6efb288a2276dc88159a935d36816a859f/logging.js#L321-L333 | train |
jvandemo/contentful-agent | lib/agent.js | prepareResults | function prepareResults(contentTypes) {
var results = _.reduce(contentTypes, function (result, contentType, key) {
// If content type is string, treat is as content type id
if(_.isString(contentType)){
var id = contentType;
contentType = {
id: id
}
}
contentType.name = key;
... | javascript | function prepareResults(contentTypes) {
var results = _.reduce(contentTypes, function (result, contentType, key) {
// If content type is string, treat is as content type id
if(_.isString(contentType)){
var id = contentType;
contentType = {
id: id
}
}
contentType.name = key;
... | [
"function",
"prepareResults",
"(",
"contentTypes",
")",
"{",
"var",
"results",
"=",
"_",
".",
"reduce",
"(",
"contentTypes",
",",
"function",
"(",
"result",
",",
"contentType",
",",
"key",
")",
"{",
"// If content type is string, treat is as content type id",
"if",
... | Convert object with content types to array with content types
FROM: { 'team-members': { id: '', filters: {} } }
TO: [ { id: '', filters: {}, name: 'team-members' } ]
@param contentTypes
@returns {*} | [
"Convert",
"object",
"with",
"content",
"types",
"to",
"array",
"with",
"content",
"types"
] | f7abdd7f72ca6411abfdcc90e6c201f1c3e8b493 | https://github.com/jvandemo/contentful-agent/blob/f7abdd7f72ca6411abfdcc90e6c201f1c3e8b493/lib/agent.js#L68-L83 | train |
jvandemo/contentful-agent | lib/agent.js | fetchEntries | function fetchEntries(contentTypes) {
return when.map(contentTypes, function (contentType) {
if (!contentType.id) {
return when.reject('Content type `' + contentType.name + '` is missing an `id` value');
}
var filters = _.merge({}, contentType.filters, {content_type: contentType.id});
return cli... | javascript | function fetchEntries(contentTypes) {
return when.map(contentTypes, function (contentType) {
if (!contentType.id) {
return when.reject('Content type `' + contentType.name + '` is missing an `id` value');
}
var filters = _.merge({}, contentType.filters, {content_type: contentType.id});
return cli... | [
"function",
"fetchEntries",
"(",
"contentTypes",
")",
"{",
"return",
"when",
".",
"map",
"(",
"contentTypes",
",",
"function",
"(",
"contentType",
")",
"{",
"if",
"(",
"!",
"contentType",
".",
"id",
")",
"{",
"return",
"when",
".",
"reject",
"(",
"'Conte... | Fetch entries from contentful
@param contentTypes [ { id: '', filters: {}, name: 'team-members' } ] | [
"Fetch",
"entries",
"from",
"contentful"
] | f7abdd7f72ca6411abfdcc90e6c201f1c3e8b493 | https://github.com/jvandemo/contentful-agent/blob/f7abdd7f72ca6411abfdcc90e6c201f1c3e8b493/lib/agent.js#L90-L100 | train |
wbyoung/corazon | lib/class.js | function(properties, cls, superClass, options) {
var opts = _.defaults({}, options, { wrap: true });
if (opts.wrap) {
var prototype = cls.prototype;
if (superClass) {
// combine the cls prototype with the superClass prototype, but do so
// using a new prototype chain to avoid copying (and invoki... | javascript | function(properties, cls, superClass, options) {
var opts = _.defaults({}, options, { wrap: true });
if (opts.wrap) {
var prototype = cls.prototype;
if (superClass) {
// combine the cls prototype with the superClass prototype, but do so
// using a new prototype chain to avoid copying (and invoki... | [
"function",
"(",
"properties",
",",
"cls",
",",
"superClass",
",",
"options",
")",
"{",
"var",
"opts",
"=",
"_",
".",
"defaults",
"(",
"{",
"}",
",",
"options",
",",
"{",
"wrap",
":",
"true",
"}",
")",
";",
"if",
"(",
"opts",
".",
"wrap",
")",
... | Generic reopen to use for both instance and static methods.
@name Class~reopen
@param {Object} properties The properties to add.
@param {ClassConstructor} cls The class to add properties to.
@param {ClassConstructor} superClass The class's super class.
@param {Object} [options]
@param {Boolean} [options.wrap=true] Whe... | [
"Generic",
"reopen",
"to",
"use",
"for",
"both",
"instance",
"and",
"static",
"methods",
"."
] | c3cc87f3de28f8e40ab091c8f215479c9e61f379 | https://github.com/wbyoung/corazon/blob/c3cc87f3de28f8e40ab091c8f215479c9e61f379/lib/class.js#L163-L178 | train | |
Everyplay/backbone-db-indexing-adapter | lib/indexed_collection_mixin.js | function(model, options) {
options = options ? _.clone(options) : {};
if (!(model = this._prepareModel(model, options))) return false;
if (!options.wait) this.add(model, options);
return this._callAdapter('addToIndex', options, model);
} | javascript | function(model, options) {
options = options ? _.clone(options) : {};
if (!(model = this._prepareModel(model, options))) return false;
if (!options.wait) this.add(model, options);
return this._callAdapter('addToIndex', options, model);
} | [
"function",
"(",
"model",
",",
"options",
")",
"{",
"options",
"=",
"options",
"?",
"_",
".",
"clone",
"(",
"options",
")",
":",
"{",
"}",
";",
"if",
"(",
"!",
"(",
"model",
"=",
"this",
".",
"_prepareModel",
"(",
"model",
",",
"options",
")",
")... | Adds a new model key to the index.
@param {Model} model model whose key (id) is added to index
@param {Object} options options
@returns {Promise} promise | [
"Adds",
"a",
"new",
"model",
"key",
"to",
"the",
"index",
"."
] | 9e6e51dd918f4c2e71ef1d478fa9bc7e4eae3112 | https://github.com/Everyplay/backbone-db-indexing-adapter/blob/9e6e51dd918f4c2e71ef1d478fa9bc7e4eae3112/lib/indexed_collection_mixin.js#L14-L19 | train | |
Everyplay/backbone-db-indexing-adapter | lib/indexed_collection_mixin.js | function(options) {
options = options ? _.clone(options) : {};
options.indexKeys = this.indexKeys || options.indexKeys;
options.unionKey = this.unionKey || options.unionKey;
if (this.indexKey) options.indexKeys.push(this.indexKey);
var args = [this, options];
return nodefn.apply(_.bind(this.inde... | javascript | function(options) {
options = options ? _.clone(options) : {};
options.indexKeys = this.indexKeys || options.indexKeys;
options.unionKey = this.unionKey || options.unionKey;
if (this.indexKey) options.indexKeys.push(this.indexKey);
var args = [this, options];
return nodefn.apply(_.bind(this.inde... | [
"function",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"?",
"_",
".",
"clone",
"(",
"options",
")",
":",
"{",
"}",
";",
"options",
".",
"indexKeys",
"=",
"this",
".",
"indexKeys",
"||",
"options",
".",
"indexKeys",
";",
"options",
".",
"uni... | Read all keys from multiple indexes.
@param {Object} options options
@returns {Promise} promise | [
"Read",
"all",
"keys",
"from",
"multiple",
"indexes",
"."
] | 9e6e51dd918f4c2e71ef1d478fa9bc7e4eae3112 | https://github.com/Everyplay/backbone-db-indexing-adapter/blob/9e6e51dd918f4c2e71ef1d478fa9bc7e4eae3112/lib/indexed_collection_mixin.js#L35-L42 | train | |
Everyplay/backbone-db-indexing-adapter | lib/indexed_collection_mixin.js | function(models, options) {
if(!models) return false;
this.remove(models, options);
var singular = !_.isArray(models);
models = singular ? [models] : _.clone(models);
return this._callAdapter('removeFromIndex', options, models);
} | javascript | function(models, options) {
if(!models) return false;
this.remove(models, options);
var singular = !_.isArray(models);
models = singular ? [models] : _.clone(models);
return this._callAdapter('removeFromIndex', options, models);
} | [
"function",
"(",
"models",
",",
"options",
")",
"{",
"if",
"(",
"!",
"models",
")",
"return",
"false",
";",
"this",
".",
"remove",
"(",
"models",
",",
"options",
")",
";",
"var",
"singular",
"=",
"!",
"_",
".",
"isArray",
"(",
"models",
")",
";",
... | Removes a model's key from index
@param {Array} models model(s) whose keys (ids) are removed from index
@param {Object} options options
@returns {Promise} promise | [
"Removes",
"a",
"model",
"s",
"key",
"from",
"index"
] | 9e6e51dd918f4c2e71ef1d478fa9bc7e4eae3112 | https://github.com/Everyplay/backbone-db-indexing-adapter/blob/9e6e51dd918f4c2e71ef1d478fa9bc7e4eae3112/lib/indexed_collection_mixin.js#L50-L56 | train | |
Psychopoulet/node-promfs | lib/extends/_isDirectory.js | _isDirectory | function _isDirectory (directory, callback) {
if ("undefined" === typeof directory) {
throw new ReferenceError("missing \"directory\" argument");
}
else if ("string" !== typeof directory) {
throw new TypeError("\"directory\" argument is not a string");
}
else if ("" === directory.trim()) {
... | javascript | function _isDirectory (directory, callback) {
if ("undefined" === typeof directory) {
throw new ReferenceError("missing \"directory\" argument");
}
else if ("string" !== typeof directory) {
throw new TypeError("\"directory\" argument is not a string");
}
else if ("" === directory.trim()) {
... | [
"function",
"_isDirectory",
"(",
"directory",
",",
"callback",
")",
"{",
"if",
"(",
"\"undefined\"",
"===",
"typeof",
"directory",
")",
"{",
"throw",
"new",
"ReferenceError",
"(",
"\"missing \\\"directory\\\" argument\"",
")",
";",
"}",
"else",
"if",
"(",
"\"str... | methods
Async isDirectory
@param {string} directory : directory to check
@param {function|null} callback : operation's result
@returns {void} | [
"methods",
"Async",
"isDirectory"
] | 016e272fc58c6ef6eae5ea551a0e8873f0ac20cc | https://github.com/Psychopoulet/node-promfs/blob/016e272fc58c6ef6eae5ea551a0e8873f0ac20cc/lib/extends/_isDirectory.js#L18-L43 | train |
semantic-math/math-traverse | lib/traverse.js | traverse | function traverse(node, {enter = () => {}, leave = () => {}}, path = []) {
switch (node.type) {
// regular non-leaf nodes
case 'Apply':
enter(node, path)
node.args.forEach((arg, index) =>
traverse(arg, {enter, leave}, [...path, 'args', index]))
lea... | javascript | function traverse(node, {enter = () => {}, leave = () => {}}, path = []) {
switch (node.type) {
// regular non-leaf nodes
case 'Apply':
enter(node, path)
node.args.forEach((arg, index) =>
traverse(arg, {enter, leave}, [...path, 'args', index]))
lea... | [
"function",
"traverse",
"(",
"node",
",",
"{",
"enter",
"=",
"(",
")",
"=>",
"{",
"}",
",",
"leave",
"=",
"(",
")",
"=>",
"{",
"}",
"}",
",",
"path",
"=",
"[",
"]",
")",
"{",
"switch",
"(",
"node",
".",
"type",
")",
"{",
"// regular non-leaf no... | traverse - walk all of the nodes in a tree. | [
"traverse",
"-",
"walk",
"all",
"of",
"the",
"nodes",
"in",
"a",
"tree",
"."
] | 251430b4a984200fb1b3fd373fde2da50a78830c | https://github.com/semantic-math/math-traverse/blob/251430b4a984200fb1b3fd373fde2da50a78830c/lib/traverse.js#L5-L55 | train |
a-labo/aschema | shim/browser/aschema.js | validate | function validate(values) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var s = this;
var _tv4$validateMultiple = tv4.validateMultiple(values, s),
valid = _tv4$validateMultiple.valid,
errors = _tv4$validateMultiple.errors;
if (valid) {
re... | javascript | function validate(values) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var s = this;
var _tv4$validateMultiple = tv4.validateMultiple(values, s),
valid = _tv4$validateMultiple.valid,
errors = _tv4$validateMultiple.errors;
if (valid) {
re... | [
"function",
"validate",
"(",
"values",
")",
"{",
"var",
"options",
"=",
"arguments",
".",
"length",
">",
"1",
"&&",
"arguments",
"[",
"1",
"]",
"!==",
"undefined",
"?",
"arguments",
"[",
"1",
"]",
":",
"{",
"}",
";",
"var",
"s",
"=",
"this",
";",
... | Validate values.
@param {object} values - Values to validate.
@param {object} [options] - Optional settings.
@returns {object|null} - Null if success. | [
"Validate",
"values",
"."
] | b67da07ff618dd9a660646962e0e7ea04a763623 | https://github.com/a-labo/aschema/blob/b67da07ff618dd9a660646962e0e7ea04a763623/shim/browser/aschema.js#L38-L64 | train |
a-labo/aschema | shim/browser/aschema.js | validateToThrow | function validateToThrow() {
var s = this;
var error = s.validate.apply(s, arguments);
if (error) {
throw error;
}
} | javascript | function validateToThrow() {
var s = this;
var error = s.validate.apply(s, arguments);
if (error) {
throw error;
}
} | [
"function",
"validateToThrow",
"(",
")",
"{",
"var",
"s",
"=",
"this",
";",
"var",
"error",
"=",
"s",
".",
"validate",
".",
"apply",
"(",
"s",
",",
"arguments",
")",
";",
"if",
"(",
"error",
")",
"{",
"throw",
"error",
";",
"}",
"}"
] | Throw an error if validate failed
@throws Error | [
"Throw",
"an",
"error",
"if",
"validate",
"failed"
] | b67da07ff618dd9a660646962e0e7ea04a763623 | https://github.com/a-labo/aschema/blob/b67da07ff618dd9a660646962e0e7ea04a763623/shim/browser/aschema.js#L70-L77 | train |
a-labo/aschema | shim/browser/aschema.js | set | function set(values) {
var s = this;
if (arguments.length === 2) {
values = {};
var key = arguments[0];
values[key] = arguments[1];
}
Object.assign(s, values);
return s;
} | javascript | function set(values) {
var s = this;
if (arguments.length === 2) {
values = {};
var key = arguments[0];
values[key] = arguments[1];
}
Object.assign(s, values);
return s;
} | [
"function",
"set",
"(",
"values",
")",
"{",
"var",
"s",
"=",
"this",
";",
"if",
"(",
"arguments",
".",
"length",
"===",
"2",
")",
"{",
"values",
"=",
"{",
"}",
";",
"var",
"key",
"=",
"arguments",
"[",
"0",
"]",
";",
"values",
"[",
"key",
"]",
... | Set values.
@param {object} values - Values to set
@returns {ASchema} - Returns self. | [
"Set",
"values",
"."
] | b67da07ff618dd9a660646962e0e7ea04a763623 | https://github.com/a-labo/aschema/blob/b67da07ff618dd9a660646962e0e7ea04a763623/shim/browser/aschema.js#L94-L105 | train |
a-labo/aschema | shim/browser/aschema.js | toJSON | function toJSON() {
var s = this;
var values = Object.assign({}, s.schema);
Object.keys(values).forEach(function (key) {
var isFunc = iftype.isFunction(values[key]);
if (isFunc) {
delete values[key];
}
});
return values;
} | javascript | function toJSON() {
var s = this;
var values = Object.assign({}, s.schema);
Object.keys(values).forEach(function (key) {
var isFunc = iftype.isFunction(values[key]);
if (isFunc) {
delete values[key];
}
});
return values;
} | [
"function",
"toJSON",
"(",
")",
"{",
"var",
"s",
"=",
"this",
";",
"var",
"values",
"=",
"Object",
".",
"assign",
"(",
"{",
"}",
",",
"s",
".",
"schema",
")",
";",
"Object",
".",
"keys",
"(",
"values",
")",
".",
"forEach",
"(",
"function",
"(",
... | Convert to json.
@returns {object} - JSON schema. | [
"Convert",
"to",
"json",
"."
] | b67da07ff618dd9a660646962e0e7ea04a763623 | https://github.com/a-labo/aschema/blob/b67da07ff618dd9a660646962e0e7ea04a763623/shim/browser/aschema.js#L111-L122 | train |
Lindurion/closure-pro-build | lib/closure-pro-build.js | expandFileGlobs | function expandFileGlobs(filesAndPatterns, rootDir, callbackFn) {
fileMatcher.resolveAnyGlobPatternsAsync(filesAndPatterns, rootDir)
.then(function(result) { callbackFn(null, result); })
.fail(callbackFn);
} | javascript | function expandFileGlobs(filesAndPatterns, rootDir, callbackFn) {
fileMatcher.resolveAnyGlobPatternsAsync(filesAndPatterns, rootDir)
.then(function(result) { callbackFn(null, result); })
.fail(callbackFn);
} | [
"function",
"expandFileGlobs",
"(",
"filesAndPatterns",
",",
"rootDir",
",",
"callbackFn",
")",
"{",
"fileMatcher",
".",
"resolveAnyGlobPatternsAsync",
"(",
"filesAndPatterns",
",",
"rootDir",
")",
".",
"then",
"(",
"function",
"(",
"result",
")",
"{",
"callbackFn... | As an exported convenience function, expands all glob patterns in the given
list of filesAndPatterns into the list of matched files.
@param {!Array.<string>} filesAndPatterns List of files and file patterns,
e.g. ['my/single/file.js', 'dir/of/*.js'].
@param {string} rootDir Root directory that filesAndPatterns are rela... | [
"As",
"an",
"exported",
"convenience",
"function",
"expands",
"all",
"glob",
"patterns",
"in",
"the",
"given",
"list",
"of",
"filesAndPatterns",
"into",
"the",
"list",
"of",
"matched",
"files",
"."
] | c279d0fcc3a65969d2fe965f55e627b074792f1a | https://github.com/Lindurion/closure-pro-build/blob/c279d0fcc3a65969d2fe965f55e627b074792f1a/lib/closure-pro-build.js#L64-L68 | train |
eaze/potluck-opentok-adapter | vendor/opentok.js | function(selector, context) {
var results = [];
if (typeof(selector) === 'string') {
var idSelector = detectIdSelectors.exec(selector);
context = context || document;
if (idSelector && idSelector[1]) {
var element = context.getElementById(idSelector[1]);
if (element) results.... | javascript | function(selector, context) {
var results = [];
if (typeof(selector) === 'string') {
var idSelector = detectIdSelectors.exec(selector);
context = context || document;
if (idSelector && idSelector[1]) {
var element = context.getElementById(idSelector[1]);
if (element) results.... | [
"function",
"(",
"selector",
",",
"context",
")",
"{",
"var",
"results",
"=",
"[",
"]",
";",
"if",
"(",
"typeof",
"(",
"selector",
")",
"===",
"'string'",
")",
"{",
"var",
"idSelector",
"=",
"detectIdSelectors",
".",
"exec",
"(",
"selector",
")",
";",
... | The top-level namespace, also performs basic DOMElement selecting. @example Get the DOM element with the id of 'domId' OTHelpers('#domId') @example Get all video elements OTHelpers('video') @example Get all elements with the class name of 'foo' OTHelpers('.foo') @example Get all elements with the class name of 'foo... | [
"The",
"top",
"-",
"level",
"namespace",
"also",
"performs",
"basic",
"DOMElement",
"selecting",
"."
] | 2b88a58ec0a8588955ee99004bc7d4bc361c5b12 | https://github.com/eaze/potluck-opentok-adapter/blob/2b88a58ec0a8588955ee99004bc7d4bc361c5b12/vendor/opentok.js#L83-L111 | train | |
eaze/potluck-opentok-adapter | vendor/opentok.js | nodeListToArray | function nodeListToArray (nodes) {
if ($.env.name !== 'IE' || $.env.version > 9) {
return prototypeSlice.call(nodes);
}
// IE 9 and below call use Array.prototype.slice.call against
// a NodeList, hence the following
var array = [];
for (var i=0, num=nodes.length; i<num; ++i) {
arr... | javascript | function nodeListToArray (nodes) {
if ($.env.name !== 'IE' || $.env.version > 9) {
return prototypeSlice.call(nodes);
}
// IE 9 and below call use Array.prototype.slice.call against
// a NodeList, hence the following
var array = [];
for (var i=0, num=nodes.length; i<num; ++i) {
arr... | [
"function",
"nodeListToArray",
"(",
"nodes",
")",
"{",
"if",
"(",
"$",
".",
"env",
".",
"name",
"!==",
"'IE'",
"||",
"$",
".",
"env",
".",
"version",
">",
"9",
")",
"{",
"return",
"prototypeSlice",
".",
"call",
"(",
"nodes",
")",
";",
"}",
"// IE 9... | A helper for converting a NodeList to a JS Array | [
"A",
"helper",
"for",
"converting",
"a",
"NodeList",
"to",
"a",
"JS",
"Array"
] | 2b88a58ec0a8588955ee99004bc7d4bc361c5b12 | https://github.com/eaze/potluck-opentok-adapter/blob/2b88a58ec0a8588955ee99004bc7d4bc361c5b12/vendor/opentok.js#L117-L131 | train |
eaze/potluck-opentok-adapter | vendor/opentok.js | versionGEThan | function versionGEThan (otherVersion) {
if (otherVersion === version) return true;
if (typeof(otherVersion) === 'number' && typeof(version) === 'number') {
return otherVersion > version;
}
// The versions have multiple components (i.e. 0.10.30) and
// must be compared piecewise.
... | javascript | function versionGEThan (otherVersion) {
if (otherVersion === version) return true;
if (typeof(otherVersion) === 'number' && typeof(version) === 'number') {
return otherVersion > version;
}
// The versions have multiple components (i.e. 0.10.30) and
// must be compared piecewise.
... | [
"function",
"versionGEThan",
"(",
"otherVersion",
")",
"{",
"if",
"(",
"otherVersion",
"===",
"version",
")",
"return",
"true",
";",
"if",
"(",
"typeof",
"(",
"otherVersion",
")",
"===",
"'number'",
"&&",
"typeof",
"(",
"version",
")",
"===",
"'number'",
"... | Returns true if otherVersion is greater than the current environment version. | [
"Returns",
"true",
"if",
"otherVersion",
"is",
"greater",
"than",
"the",
"current",
"environment",
"version",
"."
] | 2b88a58ec0a8588955ee99004bc7d4bc361c5b12 | https://github.com/eaze/potluck-opentok-adapter/blob/2b88a58ec0a8588955ee99004bc7d4bc361c5b12/vendor/opentok.js#L2727-L2756 | train |
eaze/potluck-opentok-adapter | vendor/opentok.js | executeListenersAsyncronously | function executeListenersAsyncronously(name, args, defaultAction) {
var listeners = api.events[name];
if (!listeners || listeners.length === 0) return;
var listenerAcks = listeners.length;
$.forEach(listeners, function(listener) { // , index
function filterHandlers(_listener)... | javascript | function executeListenersAsyncronously(name, args, defaultAction) {
var listeners = api.events[name];
if (!listeners || listeners.length === 0) return;
var listenerAcks = listeners.length;
$.forEach(listeners, function(listener) { // , index
function filterHandlers(_listener)... | [
"function",
"executeListenersAsyncronously",
"(",
"name",
",",
"args",
",",
"defaultAction",
")",
"{",
"var",
"listeners",
"=",
"api",
".",
"events",
"[",
"name",
"]",
";",
"if",
"(",
"!",
"listeners",
"||",
"listeners",
".",
"length",
"===",
"0",
")",
"... | Execute each handler in +listeners+ with +args+. Each handler will be executed async. On completion the defaultAction handler will be executed with the args. @param [Array] listeners An array of functions to execute. Each will be passed args. @param [Array] args An array of arguments to execute each function in +li... | [
"Execute",
"each",
"handler",
"in",
"+",
"listeners",
"+",
"with",
"+",
"args",
"+",
".",
"Each",
"handler",
"will",
"be",
"executed",
"async",
".",
"On",
"completion",
"the",
"defaultAction",
"handler",
"will",
"be",
"executed",
"with",
"the",
"args",
"."... | 2b88a58ec0a8588955ee99004bc7d4bc361c5b12 | https://github.com/eaze/potluck-opentok-adapter/blob/2b88a58ec0a8588955ee99004bc7d4bc361c5b12/vendor/opentok.js#L2985-L3014 | train |
eaze/potluck-opentok-adapter | vendor/opentok.js | executeListenersSyncronously | function executeListenersSyncronously(name, args) { // defaultAction is not used
var listeners = api.events[name];
if (!listeners || listeners.length === 0) return;
$.forEach(listeners, function(listener) { // index
(listener.closure || listener.handler).apply(listener.context || null... | javascript | function executeListenersSyncronously(name, args) { // defaultAction is not used
var listeners = api.events[name];
if (!listeners || listeners.length === 0) return;
$.forEach(listeners, function(listener) { // index
(listener.closure || listener.handler).apply(listener.context || null... | [
"function",
"executeListenersSyncronously",
"(",
"name",
",",
"args",
")",
"{",
"// defaultAction is not used",
"var",
"listeners",
"=",
"api",
".",
"events",
"[",
"name",
"]",
";",
"if",
"(",
"!",
"listeners",
"||",
"listeners",
".",
"length",
"===",
"0",
"... | This is identical to executeListenersAsyncronously except that handlers will be executed syncronously. On completion the defaultAction handler will be executed with the args. @param [Array] listeners An array of functions to execute. Each will be passed args. @param [Array] args An array of arguments to execute each... | [
"This",
"is",
"identical",
"to",
"executeListenersAsyncronously",
"except",
"that",
"handlers",
"will",
"be",
"executed",
"syncronously",
".",
"On",
"completion",
"the",
"defaultAction",
"handler",
"will",
"be",
"executed",
"with",
"the",
"args",
"."
] | 2b88a58ec0a8588955ee99004bc7d4bc361c5b12 | https://github.com/eaze/potluck-opentok-adapter/blob/2b88a58ec0a8588955ee99004bc7d4bc361c5b12/vendor/opentok.js#L3038-L3045 | train |
eaze/potluck-opentok-adapter | vendor/opentok.js | appendToLogs | function appendToLogs(level, args) {
if (!args) return;
var message = toDebugString(args);
if (message.length <= 2) return;
_logs.push(
[level, formatDateStamp(), message]
);
} | javascript | function appendToLogs(level, args) {
if (!args) return;
var message = toDebugString(args);
if (message.length <= 2) return;
_logs.push(
[level, formatDateStamp(), message]
);
} | [
"function",
"appendToLogs",
"(",
"level",
",",
"args",
")",
"{",
"if",
"(",
"!",
"args",
")",
"return",
";",
"var",
"message",
"=",
"toDebugString",
"(",
"args",
")",
";",
"if",
"(",
"message",
".",
"length",
"<=",
"2",
")",
"return",
";",
"_logs",
... | Append +args+ to logs, along with the current log level and the a date stamp. | [
"Append",
"+",
"args",
"+",
"to",
"logs",
"along",
"with",
"the",
"current",
"log",
"level",
"and",
"the",
"a",
"date",
"stamp",
"."
] | 2b88a58ec0a8588955ee99004bc7d4bc361c5b12 | https://github.com/eaze/potluck-opentok-adapter/blob/2b88a58ec0a8588955ee99004bc7d4bc361c5b12/vendor/opentok.js#L3502-L3511 | train |
eaze/potluck-opentok-adapter | vendor/opentok.js | function (name, callback) {
capabilities[name] = function() {
var result = callback();
capabilities[name] = function() {
return result;
};
return result;
};
} | javascript | function (name, callback) {
capabilities[name] = function() {
var result = callback();
capabilities[name] = function() {
return result;
};
return result;
};
} | [
"function",
"(",
"name",
",",
"callback",
")",
"{",
"capabilities",
"[",
"name",
"]",
"=",
"function",
"(",
")",
"{",
"var",
"result",
"=",
"callback",
"(",
")",
";",
"capabilities",
"[",
"name",
"]",
"=",
"function",
"(",
")",
"{",
"return",
"result... | Wrap up a capability test in a function that memorises the result. | [
"Wrap",
"up",
"a",
"capability",
"test",
"in",
"a",
"function",
"that",
"memorises",
"the",
"result",
"."
] | 2b88a58ec0a8588955ee99004bc7d4bc361c5b12 | https://github.com/eaze/potluck-opentok-adapter/blob/2b88a58ec0a8588955ee99004bc7d4bc361c5b12/vendor/opentok.js#L3949-L3958 | train | |
eaze/potluck-opentok-adapter | vendor/opentok.js | shim | function shim () {
if (!Function.prototype.bind) {
Function.prototype.bind = function (oThis) {
if (typeof this !== 'function') {
// closest thing possible to the ECMAScript 5 internal IsCallable function
throw new TypeError('Function.prototype.bind - what is trying to be bound is ... | javascript | function shim () {
if (!Function.prototype.bind) {
Function.prototype.bind = function (oThis) {
if (typeof this !== 'function') {
// closest thing possible to the ECMAScript 5 internal IsCallable function
throw new TypeError('Function.prototype.bind - what is trying to be bound is ... | [
"function",
"shim",
"(",
")",
"{",
"if",
"(",
"!",
"Function",
".",
"prototype",
".",
"bind",
")",
"{",
"Function",
".",
"prototype",
".",
"bind",
"=",
"function",
"(",
"oThis",
")",
"{",
"if",
"(",
"typeof",
"this",
"!==",
"'function'",
")",
"{",
... | Shims for various missing things from JS Applied only after init is called to prevent unnecessary polution | [
"Shims",
"for",
"various",
"missing",
"things",
"from",
"JS",
"Applied",
"only",
"after",
"init",
"is",
"called",
"to",
"prevent",
"unnecessary",
"polution"
] | 2b88a58ec0a8588955ee99004bc7d4bc361c5b12 | https://github.com/eaze/potluck-opentok-adapter/blob/2b88a58ec0a8588955ee99004bc7d4bc361c5b12/vendor/opentok.js#L6185-L6274 | train |
eaze/potluck-opentok-adapter | vendor/opentok.js | function (options, completion) {
var Proto = function PluginProxy() {},
api = new Proto(),
waitForReadySignal = pluginEventingBehaviour(api);
refCountBehaviour(api);
// Assign +plugin+ to this object and setup all the public
// accessors that relate to the DOM Object.
//
var se... | javascript | function (options, completion) {
var Proto = function PluginProxy() {},
api = new Proto(),
waitForReadySignal = pluginEventingBehaviour(api);
refCountBehaviour(api);
// Assign +plugin+ to this object and setup all the public
// accessors that relate to the DOM Object.
//
var se... | [
"function",
"(",
"options",
",",
"completion",
")",
"{",
"var",
"Proto",
"=",
"function",
"PluginProxy",
"(",
")",
"{",
"}",
",",
"api",
"=",
"new",
"Proto",
"(",
")",
",",
"waitForReadySignal",
"=",
"pluginEventingBehaviour",
"(",
"api",
")",
";",
"refC... | Reference counted wrapper for a plugin object | [
"Reference",
"counted",
"wrapper",
"for",
"a",
"plugin",
"object"
] | 2b88a58ec0a8588955ee99004bc7d4bc361c5b12 | https://github.com/eaze/potluck-opentok-adapter/blob/2b88a58ec0a8588955ee99004bc7d4bc361c5b12/vendor/opentok.js#L6603-L6681 | train | |
eaze/potluck-opentok-adapter | vendor/opentok.js | setPlugin | function setPlugin (plugin) {
if (plugin) {
api._ = plugin;
api.parentElement = plugin.parentElement;
api.$ = $(plugin);
}
else {
api._ = null;
api.parentElement = null;
api.$ = $();
}
} | javascript | function setPlugin (plugin) {
if (plugin) {
api._ = plugin;
api.parentElement = plugin.parentElement;
api.$ = $(plugin);
}
else {
api._ = null;
api.parentElement = null;
api.$ = $();
}
} | [
"function",
"setPlugin",
"(",
"plugin",
")",
"{",
"if",
"(",
"plugin",
")",
"{",
"api",
".",
"_",
"=",
"plugin",
";",
"api",
".",
"parentElement",
"=",
"plugin",
".",
"parentElement",
";",
"api",
".",
"$",
"=",
"$",
"(",
"plugin",
")",
";",
"}",
... | Assign +plugin+ to this object and setup all the public accessors that relate to the DOM Object. | [
"Assign",
"+",
"plugin",
"+",
"to",
"this",
"object",
"and",
"setup",
"all",
"the",
"public",
"accessors",
"that",
"relate",
"to",
"the",
"DOM",
"Object",
"."
] | 2b88a58ec0a8588955ee99004bc7d4bc361c5b12 | https://github.com/eaze/potluck-opentok-adapter/blob/2b88a58ec0a8588955ee99004bc7d4bc361c5b12/vendor/opentok.js#L6613-L6624 | train |
eaze/potluck-opentok-adapter | vendor/opentok.js | makeMediaCapturerProxy | function makeMediaCapturerProxy (api) {
api.selectSources = function() {
return api._.selectSources.apply(api._, arguments);
};
return api;
} | javascript | function makeMediaCapturerProxy (api) {
api.selectSources = function() {
return api._.selectSources.apply(api._, arguments);
};
return api;
} | [
"function",
"makeMediaCapturerProxy",
"(",
"api",
")",
"{",
"api",
".",
"selectSources",
"=",
"function",
"(",
")",
"{",
"return",
"api",
".",
"_",
".",
"selectSources",
".",
"apply",
"(",
"api",
".",
"_",
",",
"arguments",
")",
";",
"}",
";",
"return"... | Specialisation for the MediaCapturer API surface | [
"Specialisation",
"for",
"the",
"MediaCapturer",
"API",
"surface"
] | 2b88a58ec0a8588955ee99004bc7d4bc361c5b12 | https://github.com/eaze/potluck-opentok-adapter/blob/2b88a58ec0a8588955ee99004bc7d4bc361c5b12/vendor/opentok.js#L6687-L6694 | train |
eaze/potluck-opentok-adapter | vendor/opentok.js | makeMediaPeerProxy | function makeMediaPeerProxy (api) {
api.setStream = function(stream, completion) {
api._.setStream(stream);
if (completion) {
if (stream.hasVideo()) {
// FIX ME renderingStarted currently doesn't first
// api.once('renderingStarted', completion);
var verifyStream =... | javascript | function makeMediaPeerProxy (api) {
api.setStream = function(stream, completion) {
api._.setStream(stream);
if (completion) {
if (stream.hasVideo()) {
// FIX ME renderingStarted currently doesn't first
// api.once('renderingStarted', completion);
var verifyStream =... | [
"function",
"makeMediaPeerProxy",
"(",
"api",
")",
"{",
"api",
".",
"setStream",
"=",
"function",
"(",
"stream",
",",
"completion",
")",
"{",
"api",
".",
"_",
".",
"setStream",
"(",
"stream",
")",
";",
"if",
"(",
"completion",
")",
"{",
"if",
"(",
"s... | Specialisation for the MediaPeer API surface | [
"Specialisation",
"for",
"the",
"MediaPeer",
"API",
"surface"
] | 2b88a58ec0a8588955ee99004bc7d4bc361c5b12 | https://github.com/eaze/potluck-opentok-adapter/blob/2b88a58ec0a8588955ee99004bc7d4bc361c5b12/vendor/opentok.js#L6698-L6736 | train |
eaze/potluck-opentok-adapter | vendor/opentok.js | versionGreaterThan | function versionGreaterThan (version1, version2) {
if (version1 === version2) return false;
if (version1 === -1) return version2;
if (version2 === -1) return version1;
if (version1.indexOf('.') === -1 && version2.indexOf('.') === -1) {
return version1 > version2;
}
// The v... | javascript | function versionGreaterThan (version1, version2) {
if (version1 === version2) return false;
if (version1 === -1) return version2;
if (version2 === -1) return version1;
if (version1.indexOf('.') === -1 && version2.indexOf('.') === -1) {
return version1 > version2;
}
// The v... | [
"function",
"versionGreaterThan",
"(",
"version1",
",",
"version2",
")",
"{",
"if",
"(",
"version1",
"===",
"version2",
")",
"return",
"false",
";",
"if",
"(",
"version1",
"===",
"-",
"1",
")",
"return",
"version2",
";",
"if",
"(",
"version2",
"===",
"-"... | <- cached version, use getInstallerMimeType instead | [
"<",
"-",
"cached",
"version",
"use",
"getInstallerMimeType",
"instead"
] | 2b88a58ec0a8588955ee99004bc7d4bc361c5b12 | https://github.com/eaze/potluck-opentok-adapter/blob/2b88a58ec0a8588955ee99004bc7d4bc361c5b12/vendor/opentok.js#L7535-L7567 | train |
eaze/potluck-opentok-adapter | vendor/opentok.js | _getUserMedia | function _getUserMedia(mediaConstraints, success, error) {
PluginProxies.createMediaPeer(function(err, plugin) {
if (err) {
error.call(OTPlugin, err);
return;
}
plugin._.getUserMedia(mediaConstraints.toHash(), function(streamJson) {
success.call(OTPlugin, MediaStream.fromJ... | javascript | function _getUserMedia(mediaConstraints, success, error) {
PluginProxies.createMediaPeer(function(err, plugin) {
if (err) {
error.call(OTPlugin, err);
return;
}
plugin._.getUserMedia(mediaConstraints.toHash(), function(streamJson) {
success.call(OTPlugin, MediaStream.fromJ... | [
"function",
"_getUserMedia",
"(",
"mediaConstraints",
",",
"success",
",",
"error",
")",
"{",
"PluginProxies",
".",
"createMediaPeer",
"(",
"function",
"(",
"err",
",",
"plugin",
")",
"{",
"if",
"(",
"err",
")",
"{",
"error",
".",
"call",
"(",
"OTPlugin",
... | Helper function for OTPlugin.getUserMedia | [
"Helper",
"function",
"for",
"OTPlugin",
".",
"getUserMedia"
] | 2b88a58ec0a8588955ee99004bc7d4bc361c5b12 | https://github.com/eaze/potluck-opentok-adapter/blob/2b88a58ec0a8588955ee99004bc7d4bc361c5b12/vendor/opentok.js#L7908-L7919 | train |
eaze/potluck-opentok-adapter | vendor/opentok.js | measureUploadBandwidth | function measureUploadBandwidth(url, payload) {
var xhr = new XMLHttpRequest(),
resultPromise = new OT.$.RSVP.Promise(function(resolve, reject) {
var startTs,
lastTs,
lastLoaded;
xhr.upload.addEventListener('progress', function(evt) {
if (!startTs) ... | javascript | function measureUploadBandwidth(url, payload) {
var xhr = new XMLHttpRequest(),
resultPromise = new OT.$.RSVP.Promise(function(resolve, reject) {
var startTs,
lastTs,
lastLoaded;
xhr.upload.addEventListener('progress', function(evt) {
if (!startTs) ... | [
"function",
"measureUploadBandwidth",
"(",
"url",
",",
"payload",
")",
"{",
"var",
"xhr",
"=",
"new",
"XMLHttpRequest",
"(",
")",
",",
"resultPromise",
"=",
"new",
"OT",
".",
"$",
".",
"RSVP",
".",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject... | Measures the bandwidth in bps.
@param {string} url
@param {ArrayBuffer} payload
@returns {{promise: Promise, abort: function}} | [
"Measures",
"the",
"bandwidth",
"in",
"bps",
"."
] | 2b88a58ec0a8588955ee99004bc7d4bc361c5b12 | https://github.com/eaze/potluck-opentok-adapter/blob/2b88a58ec0a8588955ee99004bc7d4bc361c5b12/vendor/opentok.js#L11291-L11324 | train |
eaze/potluck-opentok-adapter | vendor/opentok.js | getMLineIndex | function getMLineIndex(sdpLines, mediaType) {
var targetMLine = 'm=' + mediaType;
// Find the index of the media line for +type+
return OT.$.findIndex(sdpLines, function(line) {
if (line.indexOf(targetMLine) !== -1) {
return true;
}
return false;
});
} | javascript | function getMLineIndex(sdpLines, mediaType) {
var targetMLine = 'm=' + mediaType;
// Find the index of the media line for +type+
return OT.$.findIndex(sdpLines, function(line) {
if (line.indexOf(targetMLine) !== -1) {
return true;
}
return false;
});
} | [
"function",
"getMLineIndex",
"(",
"sdpLines",
",",
"mediaType",
")",
"{",
"var",
"targetMLine",
"=",
"'m='",
"+",
"mediaType",
";",
"// Find the index of the media line for +type+",
"return",
"OT",
".",
"$",
".",
"findIndex",
"(",
"sdpLines",
",",
"function",
"(",... | Search through sdpLines to find the Media Line of type +mediaType+. | [
"Search",
"through",
"sdpLines",
"to",
"find",
"the",
"Media",
"Line",
"of",
"type",
"+",
"mediaType",
"+",
"."
] | 2b88a58ec0a8588955ee99004bc7d4bc361c5b12 | https://github.com/eaze/potluck-opentok-adapter/blob/2b88a58ec0a8588955ee99004bc7d4bc361c5b12/vendor/opentok.js#L11391-L11402 | train |
eaze/potluck-opentok-adapter | vendor/opentok.js | getMLinePayloadTypes | function getMLinePayloadTypes (mediaLine, mediaType) {
var mLineSelector = new RegExp('^m=' + mediaType +
' \\d+(/\\d+)? [a-zA-Z0-9/]+(( [a-zA-Z0-9/]+)+)$', 'i');
// Get all payload types that the line supports
var payloadTypes = mediaLine.match(mLineSelector);
if (!... | javascript | function getMLinePayloadTypes (mediaLine, mediaType) {
var mLineSelector = new RegExp('^m=' + mediaType +
' \\d+(/\\d+)? [a-zA-Z0-9/]+(( [a-zA-Z0-9/]+)+)$', 'i');
// Get all payload types that the line supports
var payloadTypes = mediaLine.match(mLineSelector);
if (!... | [
"function",
"getMLinePayloadTypes",
"(",
"mediaLine",
",",
"mediaType",
")",
"{",
"var",
"mLineSelector",
"=",
"new",
"RegExp",
"(",
"'^m='",
"+",
"mediaType",
"+",
"' \\\\d+(/\\\\d+)? [a-zA-Z0-9/]+(( [a-zA-Z0-9/]+)+)$'",
",",
"'i'",
")",
";",
"// Get all payload types ... | Extract the payload types for a give Media Line. | [
"Extract",
"the",
"payload",
"types",
"for",
"a",
"give",
"Media",
"Line",
"."
] | 2b88a58ec0a8588955ee99004bc7d4bc361c5b12 | https://github.com/eaze/potluck-opentok-adapter/blob/2b88a58ec0a8588955ee99004bc7d4bc361c5b12/vendor/opentok.js#L11406-L11418 | train |
eaze/potluck-opentok-adapter | vendor/opentok.js | removeMediaEncoding | function removeMediaEncoding (sdp, mediaType, encodingName) {
var sdpLines = sdp.split('\r\n'),
mLineIndex = SDPHelpers.getMLineIndex(sdpLines, mediaType),
mLine = mLineIndex > -1 ? sdpLines[mLineIndex] : void 0,
typesToRemove = [],
payloadTypes,
match;
if ... | javascript | function removeMediaEncoding (sdp, mediaType, encodingName) {
var sdpLines = sdp.split('\r\n'),
mLineIndex = SDPHelpers.getMLineIndex(sdpLines, mediaType),
mLine = mLineIndex > -1 ? sdpLines[mLineIndex] : void 0,
typesToRemove = [],
payloadTypes,
match;
if ... | [
"function",
"removeMediaEncoding",
"(",
"sdp",
",",
"mediaType",
",",
"encodingName",
")",
"{",
"var",
"sdpLines",
"=",
"sdp",
".",
"split",
"(",
"'\\r\\n'",
")",
",",
"mLineIndex",
"=",
"SDPHelpers",
".",
"getMLineIndex",
"(",
"sdpLines",
",",
"mediaType",
... | Remove all references to a particular encodingName from a particular media type | [
"Remove",
"all",
"references",
"to",
"a",
"particular",
"encodingName",
"from",
"a",
"particular",
"media",
"type"
] | 2b88a58ec0a8588955ee99004bc7d4bc361c5b12 | https://github.com/eaze/potluck-opentok-adapter/blob/2b88a58ec0a8588955ee99004bc7d4bc361c5b12/vendor/opentok.js#L11429-L11475 | 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.