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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
AlexanderMoskovkin/qunit-harness | vendor/qunit-1.20.0.js | priorityFill | function priorityFill( callback ) {
var queue, prioritizedQueue;
queue = config.queue.slice( priorityFill.pos );
prioritizedQueue = config.queue.slice( 0, -config.queue.length + priorityFill.pos );
queue.unshift( callback );
queue.unshift.apply( queue, prioritizedQueue );
config.queue = queue;
priorityFill.p... | javascript | function priorityFill( callback ) {
var queue, prioritizedQueue;
queue = config.queue.slice( priorityFill.pos );
prioritizedQueue = config.queue.slice( 0, -config.queue.length + priorityFill.pos );
queue.unshift( callback );
queue.unshift.apply( queue, prioritizedQueue );
config.queue = queue;
priorityFill.p... | [
"function",
"priorityFill",
"(",
"callback",
")",
"{",
"var",
"queue",
",",
"prioritizedQueue",
";",
"queue",
"=",
"config",
".",
"queue",
".",
"slice",
"(",
"priorityFill",
".",
"pos",
")",
";",
"prioritizedQueue",
"=",
"config",
".",
"queue",
".",
"slice... | Place previously failed tests on a queue priority line, respecting the order they get assigned. | [
"Place",
"previously",
"failed",
"tests",
"on",
"a",
"queue",
"priority",
"line",
"respecting",
"the",
"order",
"they",
"get",
"assigned",
"."
] | fde6210031e9d7fb6759f7124e689d0dbe70e747 | https://github.com/AlexanderMoskovkin/qunit-harness/blob/fde6210031e9d7fb6759f7124e689d0dbe70e747/vendor/qunit-1.20.0.js#L1265-L1277 | train |
AlexanderMoskovkin/qunit-harness | vendor/qunit-1.20.0.js | function( count ) {
var test = this.test,
popped = false,
acceptCallCount = count;
if ( typeof acceptCallCount === "undefined" ) {
acceptCallCount = 1;
}
test.semaphore += 1;
test.usedAsync = true;
pauseProcessing();
return function done() {
if ( popped ) {
test.pushFailure( "Too many ... | javascript | function( count ) {
var test = this.test,
popped = false,
acceptCallCount = count;
if ( typeof acceptCallCount === "undefined" ) {
acceptCallCount = 1;
}
test.semaphore += 1;
test.usedAsync = true;
pauseProcessing();
return function done() {
if ( popped ) {
test.pushFailure( "Too many ... | [
"function",
"(",
"count",
")",
"{",
"var",
"test",
"=",
"this",
".",
"test",
",",
"popped",
"=",
"false",
",",
"acceptCallCount",
"=",
"count",
";",
"if",
"(",
"typeof",
"acceptCallCount",
"===",
"\"undefined\"",
")",
"{",
"acceptCallCount",
"=",
"1",
";... | Increment this Test's semaphore counter, then return a function that decrements that counter a maximum of once. | [
"Increment",
"this",
"Test",
"s",
"semaphore",
"counter",
"then",
"return",
"a",
"function",
"that",
"decrements",
"that",
"counter",
"a",
"maximum",
"of",
"once",
"."
] | fde6210031e9d7fb6759f7124e689d0dbe70e747 | https://github.com/AlexanderMoskovkin/qunit-harness/blob/fde6210031e9d7fb6759f7124e689d0dbe70e747/vendor/qunit-1.20.0.js#L1401-L1430 | train | |
CodeboxIDE/large-watcher | find.js | find | function find(dirname, args, cb) {
var spawned = execFile(
'/usr/bin/find',
['./'].concat(args),
{
maxBuffer: 4000*1024,
cwd: dirname,
},
execHandler(cb)
);
// Handle error
spawned.once('error', cb);
} | javascript | function find(dirname, args, cb) {
var spawned = execFile(
'/usr/bin/find',
['./'].concat(args),
{
maxBuffer: 4000*1024,
cwd: dirname,
},
execHandler(cb)
);
// Handle error
spawned.once('error', cb);
} | [
"function",
"find",
"(",
"dirname",
",",
"args",
",",
"cb",
")",
"{",
"var",
"spawned",
"=",
"execFile",
"(",
"'/usr/bin/find'",
",",
"[",
"'./'",
"]",
".",
"concat",
"(",
"args",
")",
",",
"{",
"maxBuffer",
":",
"4000",
"*",
"1024",
",",
"cwd",
":... | Wrapper of find command | [
"Wrapper",
"of",
"find",
"command"
] | 876af5d8964b73348d5bcaaecff9b4d3fb7f8d03 | https://github.com/CodeboxIDE/large-watcher/blob/876af5d8964b73348d5bcaaecff9b4d3fb7f8d03/find.js#L26-L39 | train |
CodeboxIDE/large-watcher | find.js | modifiedSince | function modifiedSince(dirname, time, shouldPrune, cb) {
// Make sure time is in seconds
var timestr = Math.ceil(time + 1).toString();
var args = [
'-type', 'f',
// Modified less than time seconds ago
'-newermt',
timestr+' seconds ago',
];
if(shouldPrune) {
a... | javascript | function modifiedSince(dirname, time, shouldPrune, cb) {
// Make sure time is in seconds
var timestr = Math.ceil(time + 1).toString();
var args = [
'-type', 'f',
// Modified less than time seconds ago
'-newermt',
timestr+' seconds ago',
];
if(shouldPrune) {
a... | [
"function",
"modifiedSince",
"(",
"dirname",
",",
"time",
",",
"shouldPrune",
",",
"cb",
")",
"{",
"// Make sure time is in seconds",
"var",
"timestr",
"=",
"Math",
".",
"ceil",
"(",
"time",
"+",
"1",
")",
".",
"toString",
"(",
")",
";",
"var",
"args",
"... | Get all modified files since "time" seconds ago | [
"Get",
"all",
"modified",
"files",
"since",
"time",
"seconds",
"ago"
] | 876af5d8964b73348d5bcaaecff9b4d3fb7f8d03 | https://github.com/CodeboxIDE/large-watcher/blob/876af5d8964b73348d5bcaaecff9b4d3fb7f8d03/find.js#L42-L58 | train |
CodeboxIDE/large-watcher | find.js | dumpTree | function dumpTree(dirname, shouldPrune, cb) {
var args = ['-type', 'f'];
if(shouldPrune) {
args = EXCLUDED_ARGS.concat(args);
}
find(dirname, args, cb);
} | javascript | function dumpTree(dirname, shouldPrune, cb) {
var args = ['-type', 'f'];
if(shouldPrune) {
args = EXCLUDED_ARGS.concat(args);
}
find(dirname, args, cb);
} | [
"function",
"dumpTree",
"(",
"dirname",
",",
"shouldPrune",
",",
"cb",
")",
"{",
"var",
"args",
"=",
"[",
"'-type'",
",",
"'f'",
"]",
";",
"if",
"(",
"shouldPrune",
")",
"{",
"args",
"=",
"EXCLUDED_ARGS",
".",
"concat",
"(",
"args",
")",
";",
"}",
... | Get filetree of a folder | [
"Get",
"filetree",
"of",
"a",
"folder"
] | 876af5d8964b73348d5bcaaecff9b4d3fb7f8d03 | https://github.com/CodeboxIDE/large-watcher/blob/876af5d8964b73348d5bcaaecff9b4d3fb7f8d03/find.js#L61-L68 | train |
evanlucas/lintit | rules/indent.js | validateTokenIndent | function validateTokenIndent(token, desiredIndentLevel) {
const indentation = tokenInfo.getTokenIndent(token);
const expectedChar = indentType === "space" ? " " : "\t";
return indentation === expectedChar.repeat(desiredIndentLevel * indentSize) ||
// To avoid confli... | javascript | function validateTokenIndent(token, desiredIndentLevel) {
const indentation = tokenInfo.getTokenIndent(token);
const expectedChar = indentType === "space" ? " " : "\t";
return indentation === expectedChar.repeat(desiredIndentLevel * indentSize) ||
// To avoid confli... | [
"function",
"validateTokenIndent",
"(",
"token",
",",
"desiredIndentLevel",
")",
"{",
"const",
"indentation",
"=",
"tokenInfo",
".",
"getTokenIndent",
"(",
"token",
")",
";",
"const",
"expectedChar",
"=",
"indentType",
"===",
"\"space\"",
"?",
"\" \"",
":",
"\"\... | Checks if a token's indentation is correct
@param {Token} token Token to examine
@param {int} desiredIndentLevel needed indent level
@returns {boolean} `true` if the token's indentation is correct | [
"Checks",
"if",
"a",
"token",
"s",
"indentation",
"is",
"correct"
] | 7ae771e973a618eeb533184cdd8bec051cb7cd33 | https://github.com/evanlucas/lintit/blob/7ae771e973a618eeb533184cdd8bec051cb7cd33/rules/indent.js#L728-L736 | train |
evanlucas/lintit | rules/indent.js | getFirstToken | function getFirstToken(element) {
let token = sourceCode.getTokenBefore(element);
while (astUtils.isOpeningParenToken(token) && token !== startToken) {
token = sourceCode.getTokenBefore(token);
}
return sourceCode.getTokenAfter(token);... | javascript | function getFirstToken(element) {
let token = sourceCode.getTokenBefore(element);
while (astUtils.isOpeningParenToken(token) && token !== startToken) {
token = sourceCode.getTokenBefore(token);
}
return sourceCode.getTokenAfter(token);... | [
"function",
"getFirstToken",
"(",
"element",
")",
"{",
"let",
"token",
"=",
"sourceCode",
".",
"getTokenBefore",
"(",
"element",
")",
";",
"while",
"(",
"astUtils",
".",
"isOpeningParenToken",
"(",
"token",
")",
"&&",
"token",
"!==",
"startToken",
")",
"{",
... | Gets the first token of a given element, including surrounding parentheses.
@param {ASTNode} element A node in the `elements` list
@returns {Token} The first token of this element | [
"Gets",
"the",
"first",
"token",
"of",
"a",
"given",
"element",
"including",
"surrounding",
"parentheses",
"."
] | 7ae771e973a618eeb533184cdd8bec051cb7cd33 | https://github.com/evanlucas/lintit/blob/7ae771e973a618eeb533184cdd8bec051cb7cd33/rules/indent.js#L787-L794 | train |
evanlucas/lintit | rules/indent.js | addBlocklessNodeIndent | function addBlocklessNodeIndent(node) {
if (node.type !== "BlockStatement") {
const lastParentToken = sourceCode.getTokenBefore(node, astUtils.isNotOpeningParenToken);
let firstBodyToken = sourceCode.getFirstToken(node);
let lastBodyToken = sourceCode.getLast... | javascript | function addBlocklessNodeIndent(node) {
if (node.type !== "BlockStatement") {
const lastParentToken = sourceCode.getTokenBefore(node, astUtils.isNotOpeningParenToken);
let firstBodyToken = sourceCode.getFirstToken(node);
let lastBodyToken = sourceCode.getLast... | [
"function",
"addBlocklessNodeIndent",
"(",
"node",
")",
"{",
"if",
"(",
"node",
".",
"type",
"!==",
"\"BlockStatement\"",
")",
"{",
"const",
"lastParentToken",
"=",
"sourceCode",
".",
"getTokenBefore",
"(",
"node",
",",
"astUtils",
".",
"isNotOpeningParenToken",
... | Check and decide whether to check for indentation for blockless nodes
Scenarios are for or while statements without braces around them
@param {ASTNode} node node to examine
@returns {void} | [
"Check",
"and",
"decide",
"whether",
"to",
"check",
"for",
"indentation",
"for",
"blockless",
"nodes",
"Scenarios",
"are",
"for",
"or",
"while",
"statements",
"without",
"braces",
"around",
"them"
] | 7ae771e973a618eeb533184cdd8bec051cb7cd33 | https://github.com/evanlucas/lintit/blob/7ae771e973a618eeb533184cdd8bec051cb7cd33/rules/indent.js#L834-L863 | train |
evanlucas/lintit | rules/indent.js | addParensIndent | function addParensIndent(tokens) {
const parenStack = [];
const parenPairs = [];
tokens.forEach(nextToken => {
// Accumulate a list of parenthesis pairs
if (astUtils.isOpeningParenToken(nextToken)) {
parenStack.push(nextToken);
... | javascript | function addParensIndent(tokens) {
const parenStack = [];
const parenPairs = [];
tokens.forEach(nextToken => {
// Accumulate a list of parenthesis pairs
if (astUtils.isOpeningParenToken(nextToken)) {
parenStack.push(nextToken);
... | [
"function",
"addParensIndent",
"(",
"tokens",
")",
"{",
"const",
"parenStack",
"=",
"[",
"]",
";",
"const",
"parenPairs",
"=",
"[",
"]",
";",
"tokens",
".",
"forEach",
"(",
"nextToken",
"=>",
"{",
"// Accumulate a list of parenthesis pairs",
"if",
"(",
"astUti... | Checks the indentation of parenthesized values, given a list of tokens in a program
@param {Token[]} tokens A list of tokens
@returns {void} | [
"Checks",
"the",
"indentation",
"of",
"parenthesized",
"values",
"given",
"a",
"list",
"of",
"tokens",
"in",
"a",
"program"
] | 7ae771e973a618eeb533184cdd8bec051cb7cd33 | https://github.com/evanlucas/lintit/blob/7ae771e973a618eeb533184cdd8bec051cb7cd33/rules/indent.js#L892-L923 | train |
evanlucas/lintit | rules/indent.js | ignoreNode | function ignoreNode(node) {
const unknownNodeTokens = new Set(sourceCode.getTokens(node, { includeComments: true }));
unknownNodeTokens.forEach(token => {
if (!unknownNodeTokens.has(offsets.getFirstDependency(token))) {
const firstTokenOfLine = tokenInfo.getF... | javascript | function ignoreNode(node) {
const unknownNodeTokens = new Set(sourceCode.getTokens(node, { includeComments: true }));
unknownNodeTokens.forEach(token => {
if (!unknownNodeTokens.has(offsets.getFirstDependency(token))) {
const firstTokenOfLine = tokenInfo.getF... | [
"function",
"ignoreNode",
"(",
"node",
")",
"{",
"const",
"unknownNodeTokens",
"=",
"new",
"Set",
"(",
"sourceCode",
".",
"getTokens",
"(",
"node",
",",
"{",
"includeComments",
":",
"true",
"}",
")",
")",
";",
"unknownNodeTokens",
".",
"forEach",
"(",
"tok... | Ignore all tokens within an unknown node whose offset do not depend
on another token's offset within the unknown node
@param {ASTNode} node Unknown Node
@returns {void} | [
"Ignore",
"all",
"tokens",
"within",
"an",
"unknown",
"node",
"whose",
"offset",
"do",
"not",
"depend",
"on",
"another",
"token",
"s",
"offset",
"within",
"the",
"unknown",
"node"
] | 7ae771e973a618eeb533184cdd8bec051cb7cd33 | https://github.com/evanlucas/lintit/blob/7ae771e973a618eeb533184cdd8bec051cb7cd33/rules/indent.js#L931-L945 | train |
evanlucas/lintit | rules/indent.js | isFirstTokenOfStatement | function isFirstTokenOfStatement(token, leafNode) {
let node = leafNode;
while (node.parent && !node.parent.type.endsWith("Statement") && !node.parent.type.endsWith("Declaration")) {
node = node.parent;
}
node = node.parent;
return !node || n... | javascript | function isFirstTokenOfStatement(token, leafNode) {
let node = leafNode;
while (node.parent && !node.parent.type.endsWith("Statement") && !node.parent.type.endsWith("Declaration")) {
node = node.parent;
}
node = node.parent;
return !node || n... | [
"function",
"isFirstTokenOfStatement",
"(",
"token",
",",
"leafNode",
")",
"{",
"let",
"node",
"=",
"leafNode",
";",
"while",
"(",
"node",
".",
"parent",
"&&",
"!",
"node",
".",
"parent",
".",
"type",
".",
"endsWith",
"(",
"\"Statement\"",
")",
"&&",
"!"... | Check whether the given token is the first token of a statement.
@param {Token} token The token to check.
@param {ASTNode} leafNode The expression node that the token belongs directly.
@returns {boolean} `true` if the token is the first token of a statement. | [
"Check",
"whether",
"the",
"given",
"token",
"is",
"the",
"first",
"token",
"of",
"a",
"statement",
"."
] | 7ae771e973a618eeb533184cdd8bec051cb7cd33 | https://github.com/evanlucas/lintit/blob/7ae771e973a618eeb533184cdd8bec051cb7cd33/rules/indent.js#L953-L962 | train |
flogvit/textify | lib/textify.js | prototypeString | function prototypeString(method) {
for(var func in funcs) {
if (method !== undefined && func != method) {
continue;
}
var mod = funcs[func];
var pcount = mods[mod].funcs[func];
if (!String.prototype.hasOwnProperty(func)) {
var proto = "Object.defineProperty(String.prototype, "
+"'"+func+"'... | javascript | function prototypeString(method) {
for(var func in funcs) {
if (method !== undefined && func != method) {
continue;
}
var mod = funcs[func];
var pcount = mods[mod].funcs[func];
if (!String.prototype.hasOwnProperty(func)) {
var proto = "Object.defineProperty(String.prototype, "
+"'"+func+"'... | [
"function",
"prototypeString",
"(",
"method",
")",
"{",
"for",
"(",
"var",
"func",
"in",
"funcs",
")",
"{",
"if",
"(",
"method",
"!==",
"undefined",
"&&",
"func",
"!=",
"method",
")",
"{",
"continue",
";",
"}",
"var",
"mod",
"=",
"funcs",
"[",
"func"... | Add methods to String prototype
Examples:
textify.prototypeString(); // prototype all methods
textify.prototypeString("texturize"); // prototype texturize method
'test'.texturize();
@param {String} method
@return {null} | [
"Add",
"methods",
"to",
"String",
"prototype"
] | c8510ac4d5b9f9f86339141a5ae5fa4e1f2db339 | https://github.com/flogvit/textify/blob/c8510ac4d5b9f9f86339141a5ae5fa4e1f2db339/lib/textify.js#L30-L45 | train |
jonschlinkert/option-cache | index.js | Options | function Options(options) {
if (!(this instanceof Options)) {
return new Options(options);
}
this.defaults = this.defaults || {};
this.options = this.options || {};
if (options) {
this.option(options);
}
} | javascript | function Options(options) {
if (!(this instanceof Options)) {
return new Options(options);
}
this.defaults = this.defaults || {};
this.options = this.options || {};
if (options) {
this.option(options);
}
} | [
"function",
"Options",
"(",
"options",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Options",
")",
")",
"{",
"return",
"new",
"Options",
"(",
"options",
")",
";",
"}",
"this",
".",
"defaults",
"=",
"this",
".",
"defaults",
"||",
"{",
"}",
... | Create a new instance of `Options`.
```js
var app = new Options();
```
@param {Object} `options` Initialize with default options.
@api public | [
"Create",
"a",
"new",
"instance",
"of",
"Options",
"."
] | f7f390b3b083f7885a63f2b15926ea5d88ecedfd | https://github.com/jonschlinkert/option-cache/blob/f7f390b3b083f7885a63f2b15926ea5d88ecedfd/index.js#L24-L33 | train |
jonschlinkert/option-cache | index.js | function(key, value) {
switch (utils.typeOf(key)) {
case 'object':
this.visit('default', key);
break;
case 'string':
if (typeof value === 'undefined') {
return utils.get(this.defaults, key);
}
utils.set(this.defaults, key, value);
break;
de... | javascript | function(key, value) {
switch (utils.typeOf(key)) {
case 'object':
this.visit('default', key);
break;
case 'string':
if (typeof value === 'undefined') {
return utils.get(this.defaults, key);
}
utils.set(this.defaults, key, value);
break;
de... | [
"function",
"(",
"key",
",",
"value",
")",
"{",
"switch",
"(",
"utils",
".",
"typeOf",
"(",
"key",
")",
")",
"{",
"case",
"'object'",
":",
"this",
".",
"visit",
"(",
"'default'",
",",
"key",
")",
";",
"break",
";",
"case",
"'string'",
":",
"if",
... | Set or get a default value. Defaults are cached on the `.defaults`
object.
```js
app.default('admin', false);
app.default('admin');
//=> false
app.option('admin');
//=> false
app.option('admin', true);
app.option('admin');
//=> true
```
@name .option
@param {String} `key` The option name.
@param {*} `value` The valu... | [
"Set",
"or",
"get",
"a",
"default",
"value",
".",
"Defaults",
"are",
"cached",
"on",
"the",
".",
"defaults",
"object",
"."
] | f7f390b3b083f7885a63f2b15926ea5d88ecedfd | https://github.com/jonschlinkert/option-cache/blob/f7f390b3b083f7885a63f2b15926ea5d88ecedfd/index.js#L65-L81 | train | |
jonschlinkert/option-cache | index.js | function(key, value, type) {
var val = utils.get(this.options, key);
if (typeof val === 'undefined' || (type && utils.typeOf(val) !== type)) {
return value;
}
return val;
} | javascript | function(key, value, type) {
var val = utils.get(this.options, key);
if (typeof val === 'undefined' || (type && utils.typeOf(val) !== type)) {
return value;
}
return val;
} | [
"function",
"(",
"key",
",",
"value",
",",
"type",
")",
"{",
"var",
"val",
"=",
"utils",
".",
"get",
"(",
"this",
".",
"options",
",",
"key",
")",
";",
"if",
"(",
"typeof",
"val",
"===",
"'undefined'",
"||",
"(",
"type",
"&&",
"utils",
".",
"type... | Returns the value of `key` or `value`, Or, if `type` is passed
and the value of `key` is not the same javascript native type
as `type`, then `value` is returned.
```js
app.option('admin', true);
console.log(app.either('admin', false));
//=> true
console.log(app.either('collaborator', false));
//=> false
```
@param {S... | [
"Returns",
"the",
"value",
"of",
"key",
"or",
"value",
"Or",
"if",
"type",
"is",
"passed",
"and",
"the",
"value",
"of",
"key",
"is",
"not",
"the",
"same",
"javascript",
"native",
"type",
"as",
"type",
"then",
"value",
"is",
"returned",
"."
] | f7f390b3b083f7885a63f2b15926ea5d88ecedfd | https://github.com/jonschlinkert/option-cache/blob/f7f390b3b083f7885a63f2b15926ea5d88ecedfd/index.js#L138-L144 | train | |
jrmerz/node-ckan | lib/ckan-exporter.js | getPackageSet | function getPackageSet(index, callback) {
var page = {
limit : 100,
offset : index*100
}
ckan.exec('current_package_list_with_resources', page, function(err, resp){
checkError(err, resp);
for( var i = 0; i < resp.result.length; i++ ) {
data.packages[resp.result[i].id] = resp.result[i];
}
if( res... | javascript | function getPackageSet(index, callback) {
var page = {
limit : 100,
offset : index*100
}
ckan.exec('current_package_list_with_resources', page, function(err, resp){
checkError(err, resp);
for( var i = 0; i < resp.result.length; i++ ) {
data.packages[resp.result[i].id] = resp.result[i];
}
if( res... | [
"function",
"getPackageSet",
"(",
"index",
",",
"callback",
")",
"{",
"var",
"page",
"=",
"{",
"limit",
":",
"100",
",",
"offset",
":",
"index",
"*",
"100",
"}",
"ckan",
".",
"exec",
"(",
"'current_package_list_with_resources'",
",",
"page",
",",
"function... | get 100 packages at a time | [
"get",
"100",
"packages",
"at",
"a",
"time"
] | 55f6bb1ece7f57ccd5ba57be7888e4d3941bc659 | https://github.com/jrmerz/node-ckan/blob/55f6bb1ece7f57ccd5ba57be7888e4d3941bc659/lib/ckan-exporter.js#L54-L75 | train |
jperezov/vargate | src/models/util.js | function (message, important) {
/** @type {string} */
const prefix = 'VarGate SG1 Log:';
/** @type {Array} */
let args = [];
if (window['DEBUG_MODE']) {
if (typeof message !== 'string' && message.length) {
args = message;
... | javascript | function (message, important) {
/** @type {string} */
const prefix = 'VarGate SG1 Log:';
/** @type {Array} */
let args = [];
if (window['DEBUG_MODE']) {
if (typeof message !== 'string' && message.length) {
args = message;
... | [
"function",
"(",
"message",
",",
"important",
")",
"{",
"/** @type {string} */",
"const",
"prefix",
"=",
"'VarGate SG1 Log:'",
";",
"/** @type {Array} */",
"let",
"args",
"=",
"[",
"]",
";",
"if",
"(",
"window",
"[",
"'DEBUG_MODE'",
"]",
")",
"{",
"if",
"(",... | Conditionally logs messages to help debug based on the value of DEBUG_MODE
@param {Array|string} message
@param {boolean=} important | [
"Conditionally",
"logs",
"messages",
"to",
"help",
"debug",
"based",
"on",
"the",
"value",
"of",
"DEBUG_MODE"
] | 97993224d59639cec9eda935694cdb0394d72082 | https://github.com/jperezov/vargate/blob/97993224d59639cec9eda935694cdb0394d72082/src/models/util.js#L38-L68 | train | |
blakeembrey/popsicle-server | popsicle-server.js | popsicleServer | function popsicleServer (app) {
var server = serverAddress(app)
return function (req, next) {
server.listen()
req.url = server.url(req.url)
return promiseFinally(next(), function () {
server.close()
})
}
} | javascript | function popsicleServer (app) {
var server = serverAddress(app)
return function (req, next) {
server.listen()
req.url = server.url(req.url)
return promiseFinally(next(), function () {
server.close()
})
}
} | [
"function",
"popsicleServer",
"(",
"app",
")",
"{",
"var",
"server",
"=",
"serverAddress",
"(",
"app",
")",
"return",
"function",
"(",
"req",
",",
"next",
")",
"{",
"server",
".",
"listen",
"(",
")",
"req",
".",
"url",
"=",
"server",
".",
"url",
"(",... | Create a request interceptor that listens and disconnects automatically.
@param {Function} app
@return {Function} | [
"Create",
"a",
"request",
"interceptor",
"that",
"listens",
"and",
"disconnects",
"automatically",
"."
] | a245a4a6071099445e317d341376ba39f551e191 | https://github.com/blakeembrey/popsicle-server/blob/a245a4a6071099445e317d341376ba39f551e191/popsicle-server.js#L15-L27 | train |
onecommons/base | public/js/jquery.downCount.js | function () {
// get client's current date
var date = new Date();
// turn date to utc
var utc = date.getTime() + (date.getTimezoneOffset() * 60000);
// set new Date object
var new_date = new Date(utc + (3600000*settings.offset))
retu... | javascript | function () {
// get client's current date
var date = new Date();
// turn date to utc
var utc = date.getTime() + (date.getTimezoneOffset() * 60000);
// set new Date object
var new_date = new Date(utc + (3600000*settings.offset))
retu... | [
"function",
"(",
")",
"{",
"// get client's current date",
"var",
"date",
"=",
"new",
"Date",
"(",
")",
";",
"// turn date to utc",
"var",
"utc",
"=",
"date",
".",
"getTime",
"(",
")",
"+",
"(",
"date",
".",
"getTimezoneOffset",
"(",
")",
"*",
"60000",
"... | Change client's local date to match offset timezone
@return {Object} Fixed Date object. | [
"Change",
"client",
"s",
"local",
"date",
"to",
"match",
"offset",
"timezone"
] | 4f35d9f714d0367b0622a3504802363404290246 | https://github.com/onecommons/base/blob/4f35d9f714d0367b0622a3504802363404290246/public/js/jquery.downCount.js#L31-L42 | train | |
onecommons/base | public/js/jquery.downCount.js | countdown | function countdown () {
var target_date = new Date(settings.date), // set target date
current_date = currentDate(); // get fixed current date
// difference of dates
var difference = target_date - current_date;
// if difference is negative than it's pass ... | javascript | function countdown () {
var target_date = new Date(settings.date), // set target date
current_date = currentDate(); // get fixed current date
// difference of dates
var difference = target_date - current_date;
// if difference is negative than it's pass ... | [
"function",
"countdown",
"(",
")",
"{",
"var",
"target_date",
"=",
"new",
"Date",
"(",
"settings",
".",
"date",
")",
",",
"// set target date",
"current_date",
"=",
"currentDate",
"(",
")",
";",
"// get fixed current date",
"// difference of dates",
"var",
"differ... | Main downCount function that calculates everything | [
"Main",
"downCount",
"function",
"that",
"calculates",
"everything"
] | 4f35d9f714d0367b0622a3504802363404290246 | https://github.com/onecommons/base/blob/4f35d9f714d0367b0622a3504802363404290246/public/js/jquery.downCount.js#L47-L98 | train |
websiteflash/grunt-ftp-upload | tasks/ftp_upload.js | ftpCwd | function ftpCwd(inPath, cb) {
ftp.raw.cwd(inPath, function(err) {
if (err) {
ftp.raw.mkd(inPath, function(err) {
if (err) {
log.error('Error creating new remote folder ' + inPath + ' --> ' + err);
cb(err);
} else {
log.ok('New remote folder creat... | javascript | function ftpCwd(inPath, cb) {
ftp.raw.cwd(inPath, function(err) {
if (err) {
ftp.raw.mkd(inPath, function(err) {
if (err) {
log.error('Error creating new remote folder ' + inPath + ' --> ' + err);
cb(err);
} else {
log.ok('New remote folder creat... | [
"function",
"ftpCwd",
"(",
"inPath",
",",
"cb",
")",
"{",
"ftp",
".",
"raw",
".",
"cwd",
"(",
"inPath",
",",
"function",
"(",
"err",
")",
"{",
"if",
"(",
"err",
")",
"{",
"ftp",
".",
"raw",
".",
"mkd",
"(",
"inPath",
",",
"function",
"(",
"err"... | A method for changing the remote working directory and creating one if it doesn't already exist | [
"A",
"method",
"for",
"changing",
"the",
"remote",
"working",
"directory",
"and",
"creating",
"one",
"if",
"it",
"doesn",
"t",
"already",
"exist"
] | 12b955779ba831c6849a2211061d3f72548d96c1 | https://github.com/websiteflash/grunt-ftp-upload/blob/12b955779ba831c6849a2211061d3f72548d96c1/tasks/ftp_upload.js#L109-L125 | train |
PsychoLlama/mytosis | workspaces/mytosis-leveldb/src/index.js | streamToGenerator | async function* streamToGenerator(stream) {
let promise;
stream.on('data', data => promise.resolve(data));
stream.once('end', () => promise.resolve(null));
stream.on('error', error => {
stream.removeAllListeners();
promise.reject(error);
});
while (true) {
promise = defer();
yield promis... | javascript | async function* streamToGenerator(stream) {
let promise;
stream.on('data', data => promise.resolve(data));
stream.once('end', () => promise.resolve(null));
stream.on('error', error => {
stream.removeAllListeners();
promise.reject(error);
});
while (true) {
promise = defer();
yield promis... | [
"async",
"function",
"*",
"streamToGenerator",
"(",
"stream",
")",
"{",
"let",
"promise",
";",
"stream",
".",
"on",
"(",
"'data'",
",",
"data",
"=>",
"promise",
".",
"resolve",
"(",
"data",
")",
")",
";",
"stream",
".",
"once",
"(",
"'end'",
",",
"("... | Reads values from a object mode readable stream as an async iterator.
@param {Stream.Readable} stream - A value stream from levelup.
@return {Promise<Object>} - Resolves with each node. | [
"Reads",
"values",
"from",
"a",
"object",
"mode",
"readable",
"stream",
"as",
"an",
"async",
"iterator",
"."
] | 4ebe5acb090b1d97d2369e4436a065bd8ec7fbdb | https://github.com/PsychoLlama/mytosis/blob/4ebe5acb090b1d97d2369e4436a065bd8ec7fbdb/workspaces/mytosis-leveldb/src/index.js#L62-L78 | train |
pwambach/mini-mock-api | lib/mini-mock-api.js | function(filePath){
var parts = filePath.split('/');
if(parts.length > 0){
var id = parts.pop();
return {
id: id,
path: parts.join('/')
}
} else {
return false;
}
} | javascript | function(filePath){
var parts = filePath.split('/');
if(parts.length > 0){
var id = parts.pop();
return {
id: id,
path: parts.join('/')
}
} else {
return false;
}
} | [
"function",
"(",
"filePath",
")",
"{",
"var",
"parts",
"=",
"filePath",
".",
"split",
"(",
"'/'",
")",
";",
"if",
"(",
"parts",
".",
"length",
">",
"0",
")",
"{",
"var",
"id",
"=",
"parts",
".",
"pop",
"(",
")",
";",
"return",
"{",
"id",
":",
... | split path in subpath and uuid | [
"split",
"path",
"in",
"subpath",
"and",
"uuid"
] | 1db889af3b61757c7020177e44d9fbc64edb5f06 | https://github.com/pwambach/mini-mock-api/blob/1db889af3b61757c7020177e44d9fbc64edb5f06/lib/mini-mock-api.js#L159-L170 | train | |
vid/SenseBase | lib/search.js | getQueuedLink | function getQueuedLink(callback, seconds) {
var dateField = 'queued.lastAttempt';
seconds = seconds || DELAY_SECONDS;
// function to process the link
var process = function(err, res) {
var queuedLink = null;
if (res && res.hits && res.hits.hits.length) {
var hit = res.hits.hits[0]._source;
v... | javascript | function getQueuedLink(callback, seconds) {
var dateField = 'queued.lastAttempt';
seconds = seconds || DELAY_SECONDS;
// function to process the link
var process = function(err, res) {
var queuedLink = null;
if (res && res.hits && res.hits.hits.length) {
var hit = res.hits.hits[0]._source;
v... | [
"function",
"getQueuedLink",
"(",
"callback",
",",
"seconds",
")",
"{",
"var",
"dateField",
"=",
"'queued.lastAttempt'",
";",
"seconds",
"=",
"seconds",
"||",
"DELAY_SECONDS",
";",
"// function to process the link",
"var",
"process",
"=",
"function",
"(",
"err",
"... | Get a queued link that hasn't been attempted recently. Callback is usually `getLinkContents`. | [
"Get",
"a",
"queued",
"link",
"that",
"hasn",
"t",
"been",
"attempted",
"recently",
".",
"Callback",
"is",
"usually",
"getLinkContents",
"."
] | d60bcf28239e7dde437d8a6bdae41a6921dcd05b | https://github.com/vid/SenseBase/blob/d60bcf28239e7dde437d8a6bdae41a6921dcd05b/lib/search.js#L23-L55 | train |
vid/SenseBase | lib/search.js | function(err, res) {
var queuedLink = null;
if (res && res.hits && res.hits.hits.length) {
var hit = res.hits.hits[0]._source;
var queued = hit.queued;
queuedLink = { uri: hit.uri, queued: queued, total: res.hits.total };
queued.lastAttempt = new Date().toISOString();
queued.attemp... | javascript | function(err, res) {
var queuedLink = null;
if (res && res.hits && res.hits.hits.length) {
var hit = res.hits.hits[0]._source;
var queued = hit.queued;
queuedLink = { uri: hit.uri, queued: queued, total: res.hits.total };
queued.lastAttempt = new Date().toISOString();
queued.attemp... | [
"function",
"(",
"err",
",",
"res",
")",
"{",
"var",
"queuedLink",
"=",
"null",
";",
"if",
"(",
"res",
"&&",
"res",
".",
"hits",
"&&",
"res",
".",
"hits",
".",
"hits",
".",
"length",
")",
"{",
"var",
"hit",
"=",
"res",
".",
"hits",
".",
"hits",... | function to process the link | [
"function",
"to",
"process",
"the",
"link"
] | d60bcf28239e7dde437d8a6bdae41a6921dcd05b | https://github.com/vid/SenseBase/blob/d60bcf28239e7dde437d8a6bdae41a6921dcd05b/lib/search.js#L27-L49 | train | |
vid/SenseBase | lib/search.js | getLinkContents | function getLinkContents(err, queuedLink) {
// no link found
if (!queuedLink) {
return;
}
// retrieve https directly
var method = (queuedLink.uri.toString().indexOf('https') === 0) ? utils.retrieveHTTPS : utils.retrieve;
method(queuedLink.uri, function(err, data) {
contentLib.indexContentItem({ uri... | javascript | function getLinkContents(err, queuedLink) {
// no link found
if (!queuedLink) {
return;
}
// retrieve https directly
var method = (queuedLink.uri.toString().indexOf('https') === 0) ? utils.retrieveHTTPS : utils.retrieve;
method(queuedLink.uri, function(err, data) {
contentLib.indexContentItem({ uri... | [
"function",
"getLinkContents",
"(",
"err",
",",
"queuedLink",
")",
"{",
"// no link found",
"if",
"(",
"!",
"queuedLink",
")",
"{",
"return",
";",
"}",
"// retrieve https directly",
"var",
"method",
"=",
"(",
"queuedLink",
".",
"uri",
".",
"toString",
"(",
"... | retrieve and process any queued link | [
"retrieve",
"and",
"process",
"any",
"queued",
"link"
] | d60bcf28239e7dde437d8a6bdae41a6921dcd05b | https://github.com/vid/SenseBase/blob/d60bcf28239e7dde437d8a6bdae41a6921dcd05b/lib/search.js#L58-L80 | train |
vid/SenseBase | lib/search.js | queueLinks | function queueLinks(cItem) {
if (!cItem.queued || !cItem.queued.categories) {
GLOBAL.error('missing queued || queued.categories', cItem.uri, cItem.queued);
return;
}
var relevance = cItem.queued.relevance;
if (relevance > 0) {
relevance--;
var links = contentLib.getRecognizedLinks(cItem);
va... | javascript | function queueLinks(cItem) {
if (!cItem.queued || !cItem.queued.categories) {
GLOBAL.error('missing queued || queued.categories', cItem.uri, cItem.queued);
return;
}
var relevance = cItem.queued.relevance;
if (relevance > 0) {
relevance--;
var links = contentLib.getRecognizedLinks(cItem);
va... | [
"function",
"queueLinks",
"(",
"cItem",
")",
"{",
"if",
"(",
"!",
"cItem",
".",
"queued",
"||",
"!",
"cItem",
".",
"queued",
".",
"categories",
")",
"{",
"GLOBAL",
".",
"error",
"(",
"'missing queued || queued.categories'",
",",
"cItem",
".",
"uri",
",",
... | add relevant links from cItem | [
"add",
"relevant",
"links",
"from",
"cItem"
] | d60bcf28239e7dde437d8a6bdae41a6921dcd05b | https://github.com/vid/SenseBase/blob/d60bcf28239e7dde437d8a6bdae41a6921dcd05b/lib/search.js#L84-L104 | train |
vid/SenseBase | lib/search.js | queueLink | function queueLink(uri, context) {
var queuedDetails = { queueOnly: true, member: context.member, categories: context.categories, relevance: context.relevance, attempts: 0, lastAttempt: new Date().toISOString(), team: context.team };
var toQueue = { title: 'Queued ' + context.categories, uri: uri, state: utils.stat... | javascript | function queueLink(uri, context) {
var queuedDetails = { queueOnly: true, member: context.member, categories: context.categories, relevance: context.relevance, attempts: 0, lastAttempt: new Date().toISOString(), team: context.team };
var toQueue = { title: 'Queued ' + context.categories, uri: uri, state: utils.stat... | [
"function",
"queueLink",
"(",
"uri",
",",
"context",
")",
"{",
"var",
"queuedDetails",
"=",
"{",
"queueOnly",
":",
"true",
",",
"member",
":",
"context",
".",
"member",
",",
"categories",
":",
"context",
".",
"categories",
",",
"relevance",
":",
"context",... | queue an individual link | [
"queue",
"an",
"individual",
"link"
] | d60bcf28239e7dde437d8a6bdae41a6921dcd05b | https://github.com/vid/SenseBase/blob/d60bcf28239e7dde437d8a6bdae41a6921dcd05b/lib/search.js#L107-L111 | train |
vid/SenseBase | lib/search.js | queueSearcher | function queueSearcher(data, cb) {
// validate
if (data.team && data.team.length > 0 && data.input && data.member && data.categories && data.categories.length > 0) {
// log the search
GLOBAL.svc.indexer.saveSearchLog({searchID: GLOBAL.svc.indexer.searchID(data), searchDate: new Date()}, utils.passingError)... | javascript | function queueSearcher(data, cb) {
// validate
if (data.team && data.team.length > 0 && data.input && data.member && data.categories && data.categories.length > 0) {
// log the search
GLOBAL.svc.indexer.saveSearchLog({searchID: GLOBAL.svc.indexer.searchID(data), searchDate: new Date()}, utils.passingError)... | [
"function",
"queueSearcher",
"(",
"data",
",",
"cb",
")",
"{",
"// validate",
"if",
"(",
"data",
".",
"team",
"&&",
"data",
".",
"team",
".",
"length",
">",
"0",
"&&",
"data",
".",
"input",
"&&",
"data",
".",
"member",
"&&",
"data",
".",
"categories"... | Process queued searches by members. receives form data, validates it passes links via queueLink for Searchers, queues up found links use cb to send updates | [
"Process",
"queued",
"searches",
"by",
"members",
".",
"receives",
"form",
"data",
"validates",
"it",
"passes",
"links",
"via",
"queueLink",
"for",
"Searchers",
"queues",
"up",
"found",
"links",
"use",
"cb",
"to",
"send",
"updates"
] | d60bcf28239e7dde437d8a6bdae41a6921dcd05b | https://github.com/vid/SenseBase/blob/d60bcf28239e7dde437d8a6bdae41a6921dcd05b/lib/search.js#L119-L173 | train |
vid/SenseBase | web/lib/annoTree.js | function(o) {
this._id++;
o.__id = this._id;
// FIXME collusion with tree state
o._state = o.state;
this.mapped[this._id] = o;
return this._id;
} | javascript | function(o) {
this._id++;
o.__id = this._id;
// FIXME collusion with tree state
o._state = o.state;
this.mapped[this._id] = o;
return this._id;
} | [
"function",
"(",
"o",
")",
"{",
"this",
".",
"_id",
"++",
";",
"o",
".",
"__id",
"=",
"this",
".",
"_id",
";",
"// FIXME collusion with tree state",
"o",
".",
"_state",
"=",
"o",
".",
"state",
";",
"this",
".",
"mapped",
"[",
"this",
".",
"_id",
"]... | get an id | [
"get",
"an",
"id"
] | d60bcf28239e7dde437d8a6bdae41a6921dcd05b | https://github.com/vid/SenseBase/blob/d60bcf28239e7dde437d8a6bdae41a6921dcd05b/web/lib/annoTree.js#L25-L32 | train | |
jperezov/vargate | vargate.js | checkDefined | function checkDefined(key) {
//noinspection JSPotentiallyInvalidUsageOfThis
if (! data[`${this.moduleName}.${key}`] && typeof parent.get(key) !== 'undefined' && ! util.squelch()) {
// Not allowing sub-modules to name variables already defined in the parent (unless using override)... | javascript | function checkDefined(key) {
//noinspection JSPotentiallyInvalidUsageOfThis
if (! data[`${this.moduleName}.${key}`] && typeof parent.get(key) !== 'undefined' && ! util.squelch()) {
// Not allowing sub-modules to name variables already defined in the parent (unless using override)... | [
"function",
"checkDefined",
"(",
"key",
")",
"{",
"//noinspection JSPotentiallyInvalidUsageOfThis",
"if",
"(",
"!",
"data",
"[",
"`",
"${",
"this",
".",
"moduleName",
"}",
"${",
"key",
"}",
"`",
"]",
"&&",
"typeof",
"parent",
".",
"get",
"(",
"key",
")",
... | Used to prevent users from overriding a key without using a function meant to explicitly do so.
Only works when `window.DEV_MODE` is 'strict' or 'warn'
@param {string} key | [
"Used",
"to",
"prevent",
"users",
"from",
"overriding",
"a",
"key",
"without",
"using",
"a",
"function",
"meant",
"to",
"explicitly",
"do",
"so",
".",
"Only",
"works",
"when",
"window",
".",
"DEV_MODE",
"is",
"strict",
"or",
"warn"
] | 97993224d59639cec9eda935694cdb0394d72082 | https://github.com/jperezov/vargate/blob/97993224d59639cec9eda935694cdb0394d72082/vargate.js#L480-L488 | train |
jperezov/vargate | vargate.js | assignNestedPropertyListener | function assignNestedPropertyListener(object, key, fullKey, context) {
/** @type {Array} */
const pathArray = key.split('.');
if (pathArray.length === 1 && typeof key === 'string') {
// Sanitize `key`
key = key.replace(/[^\w$]/g, '');
i... | javascript | function assignNestedPropertyListener(object, key, fullKey, context) {
/** @type {Array} */
const pathArray = key.split('.');
if (pathArray.length === 1 && typeof key === 'string') {
// Sanitize `key`
key = key.replace(/[^\w$]/g, '');
i... | [
"function",
"assignNestedPropertyListener",
"(",
"object",
",",
"key",
",",
"fullKey",
",",
"context",
")",
"{",
"/** @type {Array} */",
"const",
"pathArray",
"=",
"key",
".",
"split",
"(",
"'.'",
")",
";",
"if",
"(",
"pathArray",
".",
"length",
"===",
"1",
... | Listens and marks when a property is available
@param {Object} object
@param {string} key
@param {string} fullKey
@param {VarGate} context | [
"Listens",
"and",
"marks",
"when",
"a",
"property",
"is",
"available"
] | 97993224d59639cec9eda935694cdb0394d72082 | https://github.com/jperezov/vargate/blob/97993224d59639cec9eda935694cdb0394d72082/vargate.js#L496-L521 | train |
ucscXena/ehmutable | js/index.js | arrAssoc | function arrAssoc(x, k, v) {
var y;
if (k < 0 || k > x.length) {
throw new Error('Index ' + k + ' out of bounds [0,' + x.length + ']');
}
y = [].concat(x);
y[k] = v;
return y;
} | javascript | function arrAssoc(x, k, v) {
var y;
if (k < 0 || k > x.length) {
throw new Error('Index ' + k + ' out of bounds [0,' + x.length + ']');
}
y = [].concat(x);
y[k] = v;
return y;
} | [
"function",
"arrAssoc",
"(",
"x",
",",
"k",
",",
"v",
")",
"{",
"var",
"y",
";",
"if",
"(",
"k",
"<",
"0",
"||",
"k",
">",
"x",
".",
"length",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Index '",
"+",
"k",
"+",
"' out of bounds [0,'",
"+",
"x",
... | Immutable collection operations, based on doing a naive path copy. Should be performant for objects that are not too large, and nesting not too deep. | [
"Immutable",
"collection",
"operations",
"based",
"on",
"doing",
"a",
"naive",
"path",
"copy",
".",
"Should",
"be",
"performant",
"for",
"objects",
"that",
"are",
"not",
"too",
"large",
"and",
"nesting",
"not",
"too",
"deep",
"."
] | 5dfb342588944620adbdc33547904e074e2ed372 | https://github.com/ucscXena/ehmutable/blob/5dfb342588944620adbdc33547904e074e2ed372/js/index.js#L23-L31 | train |
gusenov/web-store-js | tree.js | WebTreeStore | function WebTreeStore(storageObject, storageId, dataChanged) {
this.storage = storageObject;
this.id = storageId;
this._setItem(this.id + "-tree", true);
this.dataChanged = dataChanged;
} | javascript | function WebTreeStore(storageObject, storageId, dataChanged) {
this.storage = storageObject;
this.id = storageId;
this._setItem(this.id + "-tree", true);
this.dataChanged = dataChanged;
} | [
"function",
"WebTreeStore",
"(",
"storageObject",
",",
"storageId",
",",
"dataChanged",
")",
"{",
"this",
".",
"storage",
"=",
"storageObject",
";",
"this",
".",
"id",
"=",
"storageId",
";",
"this",
".",
"_setItem",
"(",
"this",
".",
"id",
"+",
"\"-tree\""... | Creates a new instance of class WebTreeStore.
@access public
@augments WebStore
@constructs WebTreeStore | [
"Creates",
"a",
"new",
"instance",
"of",
"class",
"WebTreeStore",
"."
] | efc80715a601f657340b171c690dc0164e12386b | https://github.com/gusenov/web-store-js/blob/efc80715a601f657340b171c690dc0164e12386b/tree.js#L22-L27 | train |
chapmanu/hb | lib/services/twitter/stream.js | function(service, credentials, accounts, keywords) {
Stream.call(this, service, credentials, accounts, keywords);
this._twit = new Twit(credentials);
this.responder = new Responder();
this._changes = [];
this._interval = setInterval(this.intervalMethod.bind(this), QUEUE_PERIOD_DEFAULT);
} | javascript | function(service, credentials, accounts, keywords) {
Stream.call(this, service, credentials, accounts, keywords);
this._twit = new Twit(credentials);
this.responder = new Responder();
this._changes = [];
this._interval = setInterval(this.intervalMethod.bind(this), QUEUE_PERIOD_DEFAULT);
} | [
"function",
"(",
"service",
",",
"credentials",
",",
"accounts",
",",
"keywords",
")",
"{",
"Stream",
".",
"call",
"(",
"this",
",",
"service",
",",
"credentials",
",",
"accounts",
",",
"keywords",
")",
";",
"this",
".",
"_twit",
"=",
"new",
"Twit",
"(... | Manages the streaming connection to Twitter
@constructor
@extends Stream | [
"Manages",
"the",
"streaming",
"connection",
"to",
"Twitter"
] | 5edd8de89c7c5fdffc3df0c627513889220f7d51 | https://github.com/chapmanu/hb/blob/5edd8de89c7c5fdffc3df0c627513889220f7d51/lib/services/twitter/stream.js#L18-L25 | train | |
coreh-deprecated/ferret | ferret.js | function(ferret, fn) {
if (ferret._ready) {
return fn(null)
} else if (ferret._error) {
return fn(new Error('Not connected to the database'))
} else {
ferret._readyQueue.push(fn)
}
} | javascript | function(ferret, fn) {
if (ferret._ready) {
return fn(null)
} else if (ferret._error) {
return fn(new Error('Not connected to the database'))
} else {
ferret._readyQueue.push(fn)
}
} | [
"function",
"(",
"ferret",
",",
"fn",
")",
"{",
"if",
"(",
"ferret",
".",
"_ready",
")",
"{",
"return",
"fn",
"(",
"null",
")",
"}",
"else",
"if",
"(",
"ferret",
".",
"_error",
")",
"{",
"return",
"fn",
"(",
"new",
"Error",
"(",
"'Not connected to ... | Run a function right now if ready, or queue it for later | [
"Run",
"a",
"function",
"right",
"now",
"if",
"ready",
"or",
"queue",
"it",
"for",
"later"
] | 951803a107f9e5366323fca12b139f8de2de53d8 | https://github.com/coreh-deprecated/ferret/blob/951803a107f9e5366323fca12b139f8de2de53d8/ferret.js#L84-L92 | train | |
coreh-deprecated/ferret | ferret.js | function(ferret, collection_name, callback) {
_ready(ferret, function(err) {
if (err) {
process.nextTick(function() {
callback(err)
})
} else {
if (ferret._collections[collection_name]) {
process.nextTick(function() {
... | javascript | function(ferret, collection_name, callback) {
_ready(ferret, function(err) {
if (err) {
process.nextTick(function() {
callback(err)
})
} else {
if (ferret._collections[collection_name]) {
process.nextTick(function() {
... | [
"function",
"(",
"ferret",
",",
"collection_name",
",",
"callback",
")",
"{",
"_ready",
"(",
"ferret",
",",
"function",
"(",
"err",
")",
"{",
"if",
"(",
"err",
")",
"{",
"process",
".",
"nextTick",
"(",
"function",
"(",
")",
"{",
"callback",
"(",
"er... | Try loading a collection from the cache. If that fails, get it from the driver | [
"Try",
"loading",
"a",
"collection",
"from",
"the",
"cache",
".",
"If",
"that",
"fails",
"get",
"it",
"from",
"the",
"driver"
] | 951803a107f9e5366323fca12b139f8de2de53d8 | https://github.com/coreh-deprecated/ferret/blob/951803a107f9e5366323fca12b139f8de2de53d8/ferret.js#L95-L114 | train | |
henrytseng/angular-state-router | src/utils/url.js | function() {
var pairs = _self.querystring().split('&');
var params = {};
for(var i=0; i<pairs.length; i++) {
if(pairs[i] === '') continue;
var nameValue = pairs[i].split('=');
params[nameValue[0]] = (typeof nameValue[1] === 'undefined' || nameValue[1] === '') ? true : decodeU... | javascript | function() {
var pairs = _self.querystring().split('&');
var params = {};
for(var i=0; i<pairs.length; i++) {
if(pairs[i] === '') continue;
var nameValue = pairs[i].split('=');
params[nameValue[0]] = (typeof nameValue[1] === 'undefined' || nameValue[1] === '') ? true : decodeU... | [
"function",
"(",
")",
"{",
"var",
"pairs",
"=",
"_self",
".",
"querystring",
"(",
")",
".",
"split",
"(",
"'&'",
")",
";",
"var",
"params",
"=",
"{",
"}",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"pairs",
".",
"length",
";",
"i",... | Get the querystring of a URL parameters as a hash
@return {String} A querystring from URL | [
"Get",
"the",
"querystring",
"of",
"a",
"URL",
"parameters",
"as",
"a",
"hash"
] | 5b8147d5f5fe8a8e8453dddf61fe0b01fe5b5e9b | https://github.com/henrytseng/angular-state-router/blob/5b8147d5f5fe8a8e8453dddf61fe0b01fe5b5e9b/src/utils/url.js#L32-L43 | train | |
evsheffield/node-donedone-api | lib/donedone-api.js | function(subdomain, username, passwordOrAPIToken, methodURL, requestMethod, callback, data, attachments) {
var baseUrl = subdomain + '.mydonedone.com'
, path = '/issuetracker/api/v2/' + methodURL
, auth = new Buffer(username + ':' + passwordOrAPIToken).toString('base64')
, options = {
hostname: ba... | javascript | function(subdomain, username, passwordOrAPIToken, methodURL, requestMethod, callback, data, attachments) {
var baseUrl = subdomain + '.mydonedone.com'
, path = '/issuetracker/api/v2/' + methodURL
, auth = new Buffer(username + ':' + passwordOrAPIToken).toString('base64')
, options = {
hostname: ba... | [
"function",
"(",
"subdomain",
",",
"username",
",",
"passwordOrAPIToken",
",",
"methodURL",
",",
"requestMethod",
",",
"callback",
",",
"data",
",",
"attachments",
")",
"{",
"var",
"baseUrl",
"=",
"subdomain",
"+",
"'.mydonedone.com'",
",",
"path",
"=",
"'/iss... | A wrapper for performing all API calls.
@param {string} subdomain The DoneDone subdomain, e.g. 'foobar' in 'foobar.mydonedone.com'
@param {string} username DoneDone username
@param {string} passwordOrAPIToken DoneDone password or API token
@param {string} methodURL The URL for t... | [
"A",
"wrapper",
"for",
"performing",
"all",
"API",
"calls",
"."
] | 9b1d8ddb86c4fe654509e9191fc7d666334c4a03 | https://github.com/evsheffield/node-donedone-api/blob/9b1d8ddb86c4fe654509e9191fc7d666334c4a03/lib/donedone-api.js#L28-L84 | train | |
evsheffield/node-donedone-api | lib/donedone-api.js | function(cb) {
exports.getReleaseBuildInfo(subdomain, username, passwordOrAPIToken, id, function(err, respData) {
cb(err, respData);
});
} | javascript | function(cb) {
exports.getReleaseBuildInfo(subdomain, username, passwordOrAPIToken, id, function(err, respData) {
cb(err, respData);
});
} | [
"function",
"(",
"cb",
")",
"{",
"exports",
".",
"getReleaseBuildInfo",
"(",
"subdomain",
",",
"username",
",",
"passwordOrAPIToken",
",",
"id",
",",
"function",
"(",
"err",
",",
"respData",
")",
"{",
"cb",
"(",
"err",
",",
"respData",
")",
";",
"}",
"... | Get release build information | [
"Get",
"release",
"build",
"information"
] | 9b1d8ddb86c4fe654509e9191fc7d666334c4a03 | https://github.com/evsheffield/node-donedone-api/blob/9b1d8ddb86c4fe654509e9191fc7d666334c4a03/lib/donedone-api.js#L305-L309 | train | |
evsheffield/node-donedone-api | lib/donedone-api.js | function(releaseBuildInfo, cb) {
orderNumbers = releaseBuildInfo.order_numbers_ready_for_next_release.join(',');
// Trigger an error when there are no issues that are ready to release
if('' === orderNumbers) {
cb('Cannot create release build, there are no issues marked as "Ready for Next Relea... | javascript | function(releaseBuildInfo, cb) {
orderNumbers = releaseBuildInfo.order_numbers_ready_for_next_release.join(',');
// Trigger an error when there are no issues that are ready to release
if('' === orderNumbers) {
cb('Cannot create release build, there are no issues marked as "Ready for Next Relea... | [
"function",
"(",
"releaseBuildInfo",
",",
"cb",
")",
"{",
"orderNumbers",
"=",
"releaseBuildInfo",
".",
"order_numbers_ready_for_next_release",
".",
"join",
"(",
"','",
")",
";",
"// Trigger an error when there are no issues that are ready to release",
"if",
"(",
"''",
"=... | Get people in the project | [
"Get",
"people",
"in",
"the",
"project"
] | 9b1d8ddb86c4fe654509e9191fc7d666334c4a03 | https://github.com/evsheffield/node-donedone-api/blob/9b1d8ddb86c4fe654509e9191fc7d666334c4a03/lib/donedone-api.js#L311-L322 | train | |
evsheffield/node-donedone-api | lib/donedone-api.js | function(peopleInProject, cb) {
userIdsToCc = _.pluck(peopleInProject, 'id').join(',');
exports.getProject(subdomain, username, passwordOrAPIToken, id, function(err, respData) {
cb(err, respData);
});
} | javascript | function(peopleInProject, cb) {
userIdsToCc = _.pluck(peopleInProject, 'id').join(',');
exports.getProject(subdomain, username, passwordOrAPIToken, id, function(err, respData) {
cb(err, respData);
});
} | [
"function",
"(",
"peopleInProject",
",",
"cb",
")",
"{",
"userIdsToCc",
"=",
"_",
".",
"pluck",
"(",
"peopleInProject",
",",
"'id'",
")",
".",
"join",
"(",
"','",
")",
";",
"exports",
".",
"getProject",
"(",
"subdomain",
",",
"username",
",",
"passwordOr... | Get project information so we can include the project title in the email body. | [
"Get",
"project",
"information",
"so",
"we",
"can",
"include",
"the",
"project",
"title",
"in",
"the",
"email",
"body",
"."
] | 9b1d8ddb86c4fe654509e9191fc7d666334c4a03 | https://github.com/evsheffield/node-donedone-api/blob/9b1d8ddb86c4fe654509e9191fc7d666334c4a03/lib/donedone-api.js#L324-L329 | train | |
evsheffield/node-donedone-api | lib/donedone-api.js | function(projectInfo, cb) {
projectTitle = projectInfo.title;
if(projectTitle) {
emailBody = emailBody.replace('{{Project Name}}', projectTitle);
}
exports.createReleaseBuildForProject(subdomain, username, passwordOrAPIToken, id, orderNumbers, title, description, emailBody, userIdsToCc, ... | javascript | function(projectInfo, cb) {
projectTitle = projectInfo.title;
if(projectTitle) {
emailBody = emailBody.replace('{{Project Name}}', projectTitle);
}
exports.createReleaseBuildForProject(subdomain, username, passwordOrAPIToken, id, orderNumbers, title, description, emailBody, userIdsToCc, ... | [
"function",
"(",
"projectInfo",
",",
"cb",
")",
"{",
"projectTitle",
"=",
"projectInfo",
".",
"title",
";",
"if",
"(",
"projectTitle",
")",
"{",
"emailBody",
"=",
"emailBody",
".",
"replace",
"(",
"'{{Project Name}}'",
",",
"projectTitle",
")",
";",
"}",
"... | Create a release build for the retrieved items, sent to the indicated people | [
"Create",
"a",
"release",
"build",
"for",
"the",
"retrieved",
"items",
"sent",
"to",
"the",
"indicated",
"people"
] | 9b1d8ddb86c4fe654509e9191fc7d666334c4a03 | https://github.com/evsheffield/node-donedone-api/blob/9b1d8ddb86c4fe654509e9191fc7d666334c4a03/lib/donedone-api.js#L331-L339 | train | |
emmetio/math-expression | lib/parser.js | op1 | function op1(value, priority) {
if (value === MINUS) {
priority += 2;
}
return new Token(OP1, value, priority);
} | javascript | function op1(value, priority) {
if (value === MINUS) {
priority += 2;
}
return new Token(OP1, value, priority);
} | [
"function",
"op1",
"(",
"value",
",",
"priority",
")",
"{",
"if",
"(",
"value",
"===",
"MINUS",
")",
"{",
"priority",
"+=",
"2",
";",
"}",
"return",
"new",
"Token",
"(",
"OP1",
",",
"value",
",",
"priority",
")",
";",
"}"
] | Unary operator factory
@param {Number} value Operator character code
@param {Number} priority Operator execution priority
@return {Token[]} | [
"Unary",
"operator",
"factory"
] | 31dc028f80c27b5b00be9395e35ebd07c9cd8862 | https://github.com/emmetio/math-expression/blob/31dc028f80c27b5b00be9395e35ebd07c9cd8862/lib/parser.js#L285-L290 | train |
emmetio/math-expression | lib/parser.js | op2 | function op2(value, priority) {
if (value === MULTIPLY) {
priority += 1;
} else if (value === DIVIDE || value === INT_DIVIDE) {
priority += 2;
}
return new Token(OP2, value, priority);
} | javascript | function op2(value, priority) {
if (value === MULTIPLY) {
priority += 1;
} else if (value === DIVIDE || value === INT_DIVIDE) {
priority += 2;
}
return new Token(OP2, value, priority);
} | [
"function",
"op2",
"(",
"value",
",",
"priority",
")",
"{",
"if",
"(",
"value",
"===",
"MULTIPLY",
")",
"{",
"priority",
"+=",
"1",
";",
"}",
"else",
"if",
"(",
"value",
"===",
"DIVIDE",
"||",
"value",
"===",
"INT_DIVIDE",
")",
"{",
"priority",
"+=",... | Binary operator factory
@param {Number} value Operator character code
@param {Number} priority Operator execution priority
@return {Token[]} | [
"Binary",
"operator",
"factory"
] | 31dc028f80c27b5b00be9395e35ebd07c9cd8862 | https://github.com/emmetio/math-expression/blob/31dc028f80c27b5b00be9395e35ebd07c9cd8862/lib/parser.js#L298-L306 | train |
throneteki/throneteki-deck-helper | lib/formatDeckAsShortCards.js | formatDeckAsShortCards | function formatDeckAsShortCards(deck) {
var newDeck = {
_id: deck._id,
name: deck.name,
username: deck.username,
lastUpdated: deck.lastUpdated,
faction: { name: deck.faction.name, value: deck.faction.value }
};
if (deck.agenda) {
newDeck.agenda = { code: deck... | javascript | function formatDeckAsShortCards(deck) {
var newDeck = {
_id: deck._id,
name: deck.name,
username: deck.username,
lastUpdated: deck.lastUpdated,
faction: { name: deck.faction.name, value: deck.faction.value }
};
if (deck.agenda) {
newDeck.agenda = { code: deck... | [
"function",
"formatDeckAsShortCards",
"(",
"deck",
")",
"{",
"var",
"newDeck",
"=",
"{",
"_id",
":",
"deck",
".",
"_id",
",",
"name",
":",
"deck",
".",
"name",
",",
"username",
":",
"deck",
".",
"username",
",",
"lastUpdated",
":",
"deck",
".",
"lastUp... | Creates a clone of the existing deck with only card codes instead of full
card data. | [
"Creates",
"a",
"clone",
"of",
"the",
"existing",
"deck",
"with",
"only",
"card",
"codes",
"instead",
"of",
"full",
"card",
"data",
"."
] | 700280f5747b99d626c8ea6033064bd01f93da60 | https://github.com/throneteki/throneteki-deck-helper/blob/700280f5747b99d626c8ea6033064bd01f93da60/lib/formatDeckAsShortCards.js#L7-L28 | train |
goliatone/core.io-express-server | lib/middleware/poweredBy.js | poweredBy | function poweredBy(app, config) {
config = extend({}, defaults, config);
if(config.disablePoweredBy) {
return app.disable('x-powered-by');
}
if(config.poweredBy === false) {
return;
}
app.use(function xPoweredBy(req, res, next) {
res.header('x-powered-by', config.... | javascript | function poweredBy(app, config) {
config = extend({}, defaults, config);
if(config.disablePoweredBy) {
return app.disable('x-powered-by');
}
if(config.poweredBy === false) {
return;
}
app.use(function xPoweredBy(req, res, next) {
res.header('x-powered-by', config.... | [
"function",
"poweredBy",
"(",
"app",
",",
"config",
")",
"{",
"config",
"=",
"extend",
"(",
"{",
"}",
",",
"defaults",
",",
"config",
")",
";",
"if",
"(",
"config",
".",
"disablePoweredBy",
")",
"{",
"return",
"app",
".",
"disable",
"(",
"'x-powered-by... | The configuration object will be the module's
configuration object.
We probably want to create an entry for this
specific middleware...
@param {Express} app Express application
@param {Object} config Configuration object | [
"The",
"configuration",
"object",
"will",
"be",
"the",
"module",
"s",
"configuration",
"object",
".",
"We",
"probably",
"want",
"to",
"create",
"an",
"entry",
"for",
"this",
"specific",
"middleware",
"..."
] | 920225b923eaf1f142cd0ee1db78a208f8ecdbe2 | https://github.com/goliatone/core.io-express-server/blob/920225b923eaf1f142cd0ee1db78a208f8ecdbe2/lib/middleware/poweredBy.js#L17-L33 | train |
mesmotronic/conbo | lib/conbo.js | function(namespace)
{
if (!namespace || !conbo.isString(namespace))
{
conbo.warn('First parameter must be the namespace string, received', namespace);
return;
}
if (!__namespaces[namespace])
{
__namespaces[namespace] = new conbo.Namespace();
}
var ns = __namespaces[namespace],
params = c... | javascript | function(namespace)
{
if (!namespace || !conbo.isString(namespace))
{
conbo.warn('First parameter must be the namespace string, received', namespace);
return;
}
if (!__namespaces[namespace])
{
__namespaces[namespace] = new conbo.Namespace();
}
var ns = __namespaces[namespace],
params = c... | [
"function",
"(",
"namespace",
")",
"{",
"if",
"(",
"!",
"namespace",
"||",
"!",
"conbo",
".",
"isString",
"(",
"namespace",
")",
")",
"{",
"conbo",
".",
"warn",
"(",
"'First parameter must be the namespace string, received'",
",",
"namespace",
")",
";",
"retur... | ConboJS is a lightweight MVx application framework for JavaScript featuring
dependency injection, context and encapsulation, data binding, command
pattern and an event model which enables callback scoping and consistent
event handling
All ConboJS classes, methods and properties live within the conbo namespace
@namesp... | [
"ConboJS",
"is",
"a",
"lightweight",
"MVx",
"application",
"framework",
"for",
"JavaScript",
"featuring",
"dependency",
"injection",
"context",
"and",
"encapsulation",
"data",
"binding",
"command",
"pattern",
"and",
"an",
"event",
"model",
"which",
"enables",
"callb... | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/lib/conbo.js#L84-L113 | train | |
mesmotronic/conbo | lib/conbo.js | function(obj, propName, value)
{
if (conbo.isAccessor(obj, propName)) return;
if (arguments.length < 3) value = obj[propName];
var enumerable = propName.indexOf('_') != 0;
var internalName = '__'+propName;
__definePrivateProperty(obj, internalName, value);
var getter = function()
{
return this... | javascript | function(obj, propName, value)
{
if (conbo.isAccessor(obj, propName)) return;
if (arguments.length < 3) value = obj[propName];
var enumerable = propName.indexOf('_') != 0;
var internalName = '__'+propName;
__definePrivateProperty(obj, internalName, value);
var getter = function()
{
return this... | [
"function",
"(",
"obj",
",",
"propName",
",",
"value",
")",
"{",
"if",
"(",
"conbo",
".",
"isAccessor",
"(",
"obj",
",",
"propName",
")",
")",
"return",
";",
"if",
"(",
"arguments",
".",
"length",
"<",
"3",
")",
"value",
"=",
"obj",
"[",
"propName"... | Creates a property which can be bound to DOM elements and others
@param {Object} obj - The EventDispatcher object on which the property will be defined
@param {string} propName - The name of the property to be defined
@param {*} [value] - The initial value of the property (optional)
@private | [
"Creates",
"a",
"property",
"which",
"can",
"be",
"bound",
"to",
"DOM",
"elements",
"and",
"others"
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/lib/conbo.js#L365-L390 | train | |
mesmotronic/conbo | lib/conbo.js | function(obj)
{
var regExp = arguments[1];
var keys = regExp instanceof RegExp
? conbo.filter(conbo.keys(obj), function(key) { return regExp.test(key); })
: (arguments.length > 1 ? conbo.rest(arguments) : conbo.keys(obj));
keys.forEach(function(key)
{
var descriptor = Object.getOwnPropertyDescri... | javascript | function(obj)
{
var regExp = arguments[1];
var keys = regExp instanceof RegExp
? conbo.filter(conbo.keys(obj), function(key) { return regExp.test(key); })
: (arguments.length > 1 ? conbo.rest(arguments) : conbo.keys(obj));
keys.forEach(function(key)
{
var descriptor = Object.getOwnPropertyDescri... | [
"function",
"(",
"obj",
")",
"{",
"var",
"regExp",
"=",
"arguments",
"[",
"1",
"]",
";",
"var",
"keys",
"=",
"regExp",
"instanceof",
"RegExp",
"?",
"conbo",
".",
"filter",
"(",
"conbo",
".",
"keys",
"(",
"obj",
")",
",",
"function",
"(",
"key",
")"... | Convert enumerable properties of the specified object into non-enumerable ones
@private | [
"Convert",
"enumerable",
"properties",
"of",
"the",
"specified",
"object",
"into",
"non",
"-",
"enumerable",
"ones"
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/lib/conbo.js#L424-L440 | train | |
mesmotronic/conbo | lib/conbo.js | function(value)
{
if (value == undefined) return conbo.identity;
if (conbo.isFunction(value)) return value;
return conbo.property(value);
} | javascript | function(value)
{
if (value == undefined) return conbo.identity;
if (conbo.isFunction(value)) return value;
return conbo.property(value);
} | [
"function",
"(",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"undefined",
")",
"return",
"conbo",
".",
"identity",
";",
"if",
"(",
"conbo",
".",
"isFunction",
"(",
"value",
")",
")",
"return",
"value",
";",
"return",
"conbo",
".",
"property",
"(",
"... | An internal function to generate lookup iterators.
@private | [
"An",
"internal",
"function",
"to",
"generate",
"lookup",
"iterators",
"."
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/lib/conbo.js#L847-L852 | train | |
mesmotronic/conbo | lib/conbo.js | function(type, handler, scope)
{
if (!this.__queue || !(type in this.__queue) || !this.__queue[type].length)
{
return false;
}
var filtered = this.__queue[type].filter(function(queued)
{
return (!handler || queued.handler == handler) && (!scope || queued.scope == scope);
});
... | javascript | function(type, handler, scope)
{
if (!this.__queue || !(type in this.__queue) || !this.__queue[type].length)
{
return false;
}
var filtered = this.__queue[type].filter(function(queued)
{
return (!handler || queued.handler == handler) && (!scope || queued.scope == scope);
});
... | [
"function",
"(",
"type",
",",
"handler",
",",
"scope",
")",
"{",
"if",
"(",
"!",
"this",
".",
"__queue",
"||",
"!",
"(",
"type",
"in",
"this",
".",
"__queue",
")",
"||",
"!",
"this",
".",
"__queue",
"[",
"type",
"]",
".",
"length",
")",
"{",
"r... | Does this object have an event listener of the specified type?
@param {string} type - Type of event (e.g. 'change')
@param {Function} [handler] - Function that should be called
@param {Object} [scope] - The scope in which the handler is set to run
@returns {boolean} True if this object has the specified event list... | [
"Does",
"this",
"object",
"have",
"an",
"event",
"listener",
"of",
"the",
"specified",
"type?"
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/lib/conbo.js#L3994-L4007 | train | |
mesmotronic/conbo | lib/conbo.js | function(event)
{
if (!(event instanceof conbo.Event))
{
throw new Error('event parameter is not an instance of conbo.Event');
}
if (!this.__queue || (!(event.type in this.__queue) && !this.__queue.all)) return this;
if (!event.target) event.target = this;
event.currentTarget =... | javascript | function(event)
{
if (!(event instanceof conbo.Event))
{
throw new Error('event parameter is not an instance of conbo.Event');
}
if (!this.__queue || (!(event.type in this.__queue) && !this.__queue.all)) return this;
if (!event.target) event.target = this;
event.currentTarget =... | [
"function",
"(",
"event",
")",
"{",
"if",
"(",
"!",
"(",
"event",
"instanceof",
"conbo",
".",
"Event",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"'event parameter is not an instance of conbo.Event'",
")",
";",
"}",
"if",
"(",
"!",
"this",
".",
"__queue"... | Dispatch the event to listeners
@param {conbo.Event} event - The event to dispatch
@returns {conbo.EventDispatcher} A reference to this class instance | [
"Dispatch",
"the",
"event",
"to",
"listeners"
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/lib/conbo.js#L4014-L4038 | train | |
mesmotronic/conbo | lib/conbo.js | function(contextClass, cloneSingletons, cloneCommands)
{
contextClass || (contextClass = conbo.Context);
return new contextClass
({
context: this,
app: this.app,
namespace: this.namespace,
commands: cloneCommands ? conbo.clone(this.__commands) : undefined,
singletons: cloneSingletons ? co... | javascript | function(contextClass, cloneSingletons, cloneCommands)
{
contextClass || (contextClass = conbo.Context);
return new contextClass
({
context: this,
app: this.app,
namespace: this.namespace,
commands: cloneCommands ? conbo.clone(this.__commands) : undefined,
singletons: cloneSingletons ? co... | [
"function",
"(",
"contextClass",
",",
"cloneSingletons",
",",
"cloneCommands",
")",
"{",
"contextClass",
"||",
"(",
"contextClass",
"=",
"conbo",
".",
"Context",
")",
";",
"return",
"new",
"contextClass",
"(",
"{",
"context",
":",
"this",
",",
"app",
":",
... | Create a new subcontext that shares the same application
and namespace as this one
@param {class} [contextClass] - The context class to use (default: conbo.Context)
@param {boolean} [cloneSingletons] - Should this Context's singletons be duplicated on the new subcontext? (default: false)
@param {boolean} [cloneCommand... | [
"Create",
"a",
"new",
"subcontext",
"that",
"shares",
"the",
"same",
"application",
"and",
"namespace",
"as",
"this",
"one"
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/lib/conbo.js#L4288-L4299 | train | |
mesmotronic/conbo | lib/conbo.js | function(eventType, commandClass)
{
if (!eventType) throw new Error('eventType cannot be undefined');
if (!commandClass) throw new Error('commandClass for '+eventType+' cannot be undefined');
if (this.__commands[eventType] && this.__commands[eventType].indexOf(commandClass) != -1)
{
return this;
... | javascript | function(eventType, commandClass)
{
if (!eventType) throw new Error('eventType cannot be undefined');
if (!commandClass) throw new Error('commandClass for '+eventType+' cannot be undefined');
if (this.__commands[eventType] && this.__commands[eventType].indexOf(commandClass) != -1)
{
return this;
... | [
"function",
"(",
"eventType",
",",
"commandClass",
")",
"{",
"if",
"(",
"!",
"eventType",
")",
"throw",
"new",
"Error",
"(",
"'eventType cannot be undefined'",
")",
";",
"if",
"(",
"!",
"commandClass",
")",
"throw",
"new",
"Error",
"(",
"'commandClass for '",
... | Map specified Command class the given event
@param {string} eventType - The name of the event
@param {class} commandClass - The command class to instantiate when the event is dispatched | [
"Map",
"specified",
"Command",
"class",
"the",
"given",
"event"
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/lib/conbo.js#L4306-L4320 | train | |
mesmotronic/conbo | lib/conbo.js | function(eventType, commandClass)
{
if (!eventType) throw new Error('eventType cannot be undefined');
if (commandClass === undefined)
{
delete this.__commands[eventType];
return this;
}
if (!this.__commands[eventType]) return;
var index = this.__commands[eventType].indexOf(commandCla... | javascript | function(eventType, commandClass)
{
if (!eventType) throw new Error('eventType cannot be undefined');
if (commandClass === undefined)
{
delete this.__commands[eventType];
return this;
}
if (!this.__commands[eventType]) return;
var index = this.__commands[eventType].indexOf(commandCla... | [
"function",
"(",
"eventType",
",",
"commandClass",
")",
"{",
"if",
"(",
"!",
"eventType",
")",
"throw",
"new",
"Error",
"(",
"'eventType cannot be undefined'",
")",
";",
"if",
"(",
"commandClass",
"===",
"undefined",
")",
"{",
"delete",
"this",
".",
"__comma... | Unmap specified Command class from given event | [
"Unmap",
"specified",
"Command",
"class",
"from",
"given",
"event"
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/lib/conbo.js#L4325-L4341 | train | |
mesmotronic/conbo | lib/conbo.js | function(propertyName, singletonClass)
{
if (!propertyName) throw new Error('propertyName cannot be undefined');
if (singletonClass === undefined)
{
conbo.warn('singletonClass for '+propertyName+' is undefined');
}
if (conbo.isClass(singletonClass))
{
var args = conbo.rest(arguments);
... | javascript | function(propertyName, singletonClass)
{
if (!propertyName) throw new Error('propertyName cannot be undefined');
if (singletonClass === undefined)
{
conbo.warn('singletonClass for '+propertyName+' is undefined');
}
if (conbo.isClass(singletonClass))
{
var args = conbo.rest(arguments);
... | [
"function",
"(",
"propertyName",
",",
"singletonClass",
")",
"{",
"if",
"(",
"!",
"propertyName",
")",
"throw",
"new",
"Error",
"(",
"'propertyName cannot be undefined'",
")",
";",
"if",
"(",
"singletonClass",
"===",
"undefined",
")",
"{",
"conbo",
".",
"warn"... | Map class instance to a property name
To inject a property into a class, register the property name
with the Context and declare the value as undefined in your class
to enable it to be injected at run time
@example context.mapSingleton('myProperty', MyModel);
@example myProperty: undefined | [
"Map",
"class",
"instance",
"to",
"a",
"property",
"name"
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/lib/conbo.js#L4353-L4379 | train | |
mesmotronic/conbo | lib/conbo.js | function(obj)
{
var scope = this;
for (var a in scope.__singletons)
{
if (a in obj)
{
(function(value)
{
Object.defineProperty(obj, a,
{
configurable: true,
get: function() { return value; }
});
})(scope.__singletons[a]);
}
}
return this;... | javascript | function(obj)
{
var scope = this;
for (var a in scope.__singletons)
{
if (a in obj)
{
(function(value)
{
Object.defineProperty(obj, a,
{
configurable: true,
get: function() { return value; }
});
})(scope.__singletons[a]);
}
}
return this;... | [
"function",
"(",
"obj",
")",
"{",
"var",
"scope",
"=",
"this",
";",
"for",
"(",
"var",
"a",
"in",
"scope",
".",
"__singletons",
")",
"{",
"if",
"(",
"a",
"in",
"obj",
")",
"{",
"(",
"function",
"(",
"value",
")",
"{",
"Object",
".",
"defineProper... | Inject singleton instances into specified object
@param obj {Object} The object to inject singletons into | [
"Inject",
"singleton",
"instances",
"into",
"specified",
"object"
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/lib/conbo.js#L4431-L4451 | train | |
mesmotronic/conbo | lib/conbo.js | function(obj)
{
for (var a in this.__singletons)
{
if (a in obj)
{
Object.defineProperty(obj, a,
{
configurable: true,
value: undefined
});
}
}
return this;
} | javascript | function(obj)
{
for (var a in this.__singletons)
{
if (a in obj)
{
Object.defineProperty(obj, a,
{
configurable: true,
value: undefined
});
}
}
return this;
} | [
"function",
"(",
"obj",
")",
"{",
"for",
"(",
"var",
"a",
"in",
"this",
".",
"__singletons",
")",
"{",
"if",
"(",
"a",
"in",
"obj",
")",
"{",
"Object",
".",
"defineProperty",
"(",
"obj",
",",
"a",
",",
"{",
"configurable",
":",
"true",
",",
"valu... | Set all singleton instances on the specified object to undefined
@param obj {Object} The object to remove singletons from | [
"Set",
"all",
"singleton",
"instances",
"on",
"the",
"specified",
"object",
"to",
"undefined"
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/lib/conbo.js#L4458-L4473 | train | |
mesmotronic/conbo | lib/conbo.js | function()
{
conbo.assign(this,
{
__commands: undefined,
__singletons: undefined,
__app: undefined,
__namespace: undefined,
__parentContext: undefined
});
this.removeEventListener();
return this;
} | javascript | function()
{
conbo.assign(this,
{
__commands: undefined,
__singletons: undefined,
__app: undefined,
__namespace: undefined,
__parentContext: undefined
});
this.removeEventListener();
return this;
} | [
"function",
"(",
")",
"{",
"conbo",
".",
"assign",
"(",
"this",
",",
"{",
"__commands",
":",
"undefined",
",",
"__singletons",
":",
"undefined",
",",
"__app",
":",
"undefined",
",",
"__namespace",
":",
"undefined",
",",
"__parentContext",
":",
"undefined",
... | Clears all commands and singletons, and removes all listeners | [
"Clears",
"all",
"commands",
"and",
"singletons",
"and",
"removes",
"all",
"listeners"
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/lib/conbo.js#L4478-L4492 | train | |
mesmotronic/conbo | lib/conbo.js | function(item)
{
var items = conbo.toArray(arguments);
if (items.length)
{
this.source.push.apply(this.source, this.__applyItemClass(items));
this.__updateBindings(items);
this.dispatchEvent(new conbo.ConboEvent(conbo.ConboEvent.ADD));
this.dispatchChange('length');
}
return thi... | javascript | function(item)
{
var items = conbo.toArray(arguments);
if (items.length)
{
this.source.push.apply(this.source, this.__applyItemClass(items));
this.__updateBindings(items);
this.dispatchEvent(new conbo.ConboEvent(conbo.ConboEvent.ADD));
this.dispatchChange('length');
}
return thi... | [
"function",
"(",
"item",
")",
"{",
"var",
"items",
"=",
"conbo",
".",
"toArray",
"(",
"arguments",
")",
";",
"if",
"(",
"items",
".",
"length",
")",
"{",
"this",
".",
"source",
".",
"push",
".",
"apply",
"(",
"this",
".",
"source",
",",
"this",
"... | Add an item to the end of the collection. | [
"Add",
"an",
"item",
"to",
"the",
"end",
"of",
"the",
"collection",
"."
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/lib/conbo.js#L4731-L4744 | train | |
mesmotronic/conbo | lib/conbo.js | function()
{
if (!this.length) return;
var item = this.source.pop();
this.__updateBindings(item, false);
this.dispatchEvent(new conbo.ConboEvent(conbo.ConboEvent.REMOVE));
this.dispatchChange('length');
return item;
} | javascript | function()
{
if (!this.length) return;
var item = this.source.pop();
this.__updateBindings(item, false);
this.dispatchEvent(new conbo.ConboEvent(conbo.ConboEvent.REMOVE));
this.dispatchChange('length');
return item;
} | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"length",
")",
"return",
";",
"var",
"item",
"=",
"this",
".",
"source",
".",
"pop",
"(",
")",
";",
"this",
".",
"__updateBindings",
"(",
"item",
",",
"false",
")",
";",
"this",
".",
"dispat... | Remove an item from the end of the collection. | [
"Remove",
"an",
"item",
"from",
"the",
"end",
"of",
"the",
"collection",
"."
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/lib/conbo.js#L4749-L4760 | train | |
mesmotronic/conbo | lib/conbo.js | function(begin, length)
{
begin || (begin = 0);
if (conbo.isUndefined(length)) length = this.length;
return new conbo.List({source:this.source.slice(begin, length)});
} | javascript | function(begin, length)
{
begin || (begin = 0);
if (conbo.isUndefined(length)) length = this.length;
return new conbo.List({source:this.source.slice(begin, length)});
} | [
"function",
"(",
"begin",
",",
"length",
")",
"{",
"begin",
"||",
"(",
"begin",
"=",
"0",
")",
";",
"if",
"(",
"conbo",
".",
"isUndefined",
"(",
"length",
")",
")",
"length",
"=",
"this",
".",
"length",
";",
"return",
"new",
"conbo",
".",
"List",
... | Slice out a sub-array of items from the collection. | [
"Slice",
"out",
"a",
"sub",
"-",
"array",
"of",
"items",
"from",
"the",
"collection",
"."
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/lib/conbo.js#L4797-L4803 | train | |
mesmotronic/conbo | lib/conbo.js | function(begin, length)
{
begin || (begin = 0);
if (conbo.isUndefined(length)) length = this.length;
var inserts = conbo.rest(arguments,2);
var items = this.source.splice.apply(this.source, [begin, length].concat(inserts));
if (items.length) this.dispatchEvent(new conbo.ConboEvent(conbo.ConboEv... | javascript | function(begin, length)
{
begin || (begin = 0);
if (conbo.isUndefined(length)) length = this.length;
var inserts = conbo.rest(arguments,2);
var items = this.source.splice.apply(this.source, [begin, length].concat(inserts));
if (items.length) this.dispatchEvent(new conbo.ConboEvent(conbo.ConboEv... | [
"function",
"(",
"begin",
",",
"length",
")",
"{",
"begin",
"||",
"(",
"begin",
"=",
"0",
")",
";",
"if",
"(",
"conbo",
".",
"isUndefined",
"(",
"length",
")",
")",
"length",
"=",
"this",
".",
"length",
";",
"var",
"inserts",
"=",
"conbo",
".",
"... | Splice out a sub-array of items from the collection. | [
"Splice",
"out",
"a",
"sub",
"-",
"array",
"of",
"items",
"from",
"the",
"collection",
"."
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/lib/conbo.js#L4808-L4825 | train | |
mesmotronic/conbo | lib/conbo.js | function(compareFunction)
{
this.source.sort(compareFunction);
this.dispatchEvent(new conbo.ConboEvent(conbo.ConboEvent.CHANGE));
return this;
} | javascript | function(compareFunction)
{
this.source.sort(compareFunction);
this.dispatchEvent(new conbo.ConboEvent(conbo.ConboEvent.CHANGE));
return this;
} | [
"function",
"(",
"compareFunction",
")",
"{",
"this",
".",
"source",
".",
"sort",
"(",
"compareFunction",
")",
";",
"this",
".",
"dispatchEvent",
"(",
"new",
"conbo",
".",
"ConboEvent",
"(",
"conbo",
".",
"ConboEvent",
".",
"CHANGE",
")",
")",
";",
"retu... | Force the collection to re-sort itself.
@param {Function} [compareFunction] - Compare function to determine sort order | [
"Force",
"the",
"collection",
"to",
"re",
"-",
"sort",
"itself",
"."
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/lib/conbo.js#L4864-L4870 | train | |
mesmotronic/conbo | lib/conbo.js | function(items, enabled)
{
var method = enabled === false ? 'removeEventListener' : 'addEventListener';
items = (conbo.isArray(items) ? items : [items]).slice();
while (items.length)
{
var item = items.pop();
if (item instanceof conbo.EventDispatcher)
{
item[method](conbo.Con... | javascript | function(items, enabled)
{
var method = enabled === false ? 'removeEventListener' : 'addEventListener';
items = (conbo.isArray(items) ? items : [items]).slice();
while (items.length)
{
var item = items.pop();
if (item instanceof conbo.EventDispatcher)
{
item[method](conbo.Con... | [
"function",
"(",
"items",
",",
"enabled",
")",
"{",
"var",
"method",
"=",
"enabled",
"===",
"false",
"?",
"'removeEventListener'",
":",
"'addEventListener'",
";",
"items",
"=",
"(",
"conbo",
".",
"isArray",
"(",
"items",
")",
"?",
"items",
":",
"[",
"ite... | Listen to the events of Bindable values so we can detect changes
@param {any} models
@param {Boolean} enabled
@private | [
"Listen",
"to",
"the",
"events",
"of",
"Bindable",
"values",
"so",
"we",
"can",
"detect",
"changes"
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/lib/conbo.js#L4904-L4919 | train | |
mesmotronic/conbo | lib/conbo.js | function()
{
var el = this.__obj;
var a = {};
if (el)
{
conbo.forEach(el.attributes, function(p)
{
a[conbo.toCamelCase(p.name)] = p.value;
});
}
return a;
} | javascript | function()
{
var el = this.__obj;
var a = {};
if (el)
{
conbo.forEach(el.attributes, function(p)
{
a[conbo.toCamelCase(p.name)] = p.value;
});
}
return a;
} | [
"function",
"(",
")",
"{",
"var",
"el",
"=",
"this",
".",
"__obj",
";",
"var",
"a",
"=",
"{",
"}",
";",
"if",
"(",
"el",
")",
"{",
"conbo",
".",
"forEach",
"(",
"el",
".",
"attributes",
",",
"function",
"(",
"p",
")",
"{",
"a",
"[",
"conbo",
... | Returns object containing the value of all attributes on a DOM element
@returns {Object}
@example
ep.attributes; // results in something like {src:"foo/bar.jpg"} | [
"Returns",
"object",
"containing",
"the",
"value",
"of",
"all",
"attributes",
"on",
"a",
"DOM",
"element"
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/lib/conbo.js#L7103-L7117 | train | |
mesmotronic/conbo | lib/conbo.js | function(obj)
{
var el = this.__obj;
if (el && obj)
{
conbo.forEach(obj, function(value, name)
{
el.setAttribute(conbo.toKebabCase(name), value);
});
}
return this;
} | javascript | function(obj)
{
var el = this.__obj;
if (el && obj)
{
conbo.forEach(obj, function(value, name)
{
el.setAttribute(conbo.toKebabCase(name), value);
});
}
return this;
} | [
"function",
"(",
"obj",
")",
"{",
"var",
"el",
"=",
"this",
".",
"__obj",
";",
"if",
"(",
"el",
"&&",
"obj",
")",
"{",
"conbo",
".",
"forEach",
"(",
"obj",
",",
"function",
"(",
"value",
",",
"name",
")",
"{",
"el",
".",
"setAttribute",
"(",
"c... | Sets the attributes on a DOM element from an Object, converting camelCase to kebab-case, if needed
@param {Element} obj - Object containing the attributes to set
@returns {conbo.ElementProxy}
@example
ep.setAttributes({foo:1, bar:"red"}); | [
"Sets",
"the",
"attributes",
"on",
"a",
"DOM",
"element",
"from",
"an",
"Object",
"converting",
"camelCase",
"to",
"kebab",
"-",
"case",
"if",
"needed"
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/lib/conbo.js#L7128-L7141 | train | |
mesmotronic/conbo | lib/conbo.js | function(className)
{
var el = this.__obj;
return el instanceof Element && className
? el.classList.contains(className)
: false;
} | javascript | function(className)
{
var el = this.__obj;
return el instanceof Element && className
? el.classList.contains(className)
: false;
} | [
"function",
"(",
"className",
")",
"{",
"var",
"el",
"=",
"this",
".",
"__obj",
";",
"return",
"el",
"instanceof",
"Element",
"&&",
"className",
"?",
"el",
".",
"classList",
".",
"contains",
"(",
"className",
")",
":",
"false",
";",
"}"
] | Is this element using the specified CSS class?
@param {string} className - CSS class name
@returns {boolean} | [
"Is",
"this",
"element",
"using",
"the",
"specified",
"CSS",
"class?"
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/lib/conbo.js#L7245-L7252 | train | |
mesmotronic/conbo | lib/conbo.js | function(selector)
{
var el = this.__obj;
if (el)
{
var matchesFn;
['matches','webkitMatchesSelector','mozMatchesSelector','msMatchesSelector','oMatchesSelector'].some(function(fn)
{
if (typeof document.body[fn] == 'function')
{
matchesFn = fn;
return true;
}... | javascript | function(selector)
{
var el = this.__obj;
if (el)
{
var matchesFn;
['matches','webkitMatchesSelector','mozMatchesSelector','msMatchesSelector','oMatchesSelector'].some(function(fn)
{
if (typeof document.body[fn] == 'function')
{
matchesFn = fn;
return true;
}... | [
"function",
"(",
"selector",
")",
"{",
"var",
"el",
"=",
"this",
".",
"__obj",
";",
"if",
"(",
"el",
")",
"{",
"var",
"matchesFn",
";",
"[",
"'matches'",
",",
"'webkitMatchesSelector'",
",",
"'mozMatchesSelector'",
",",
"'msMatchesSelector'",
",",
"'oMatches... | Finds the closest parent element matching the specified selector
@param {string} selector - Query selector
@returns {Element} | [
"Finds",
"the",
"closest",
"parent",
"element",
"matching",
"the",
"specified",
"selector"
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/lib/conbo.js#L7260-L7294 | train | |
mesmotronic/conbo | lib/conbo.js | function(el)
{
var attrs = conbo.assign({}, this.attributes);
if (this.id && !el.id)
{
attrs.id = this.id;
}
el.classList.add('cb-glimpse');
el.cbGlimpse = this;
for (var attr in attrs)
{
el.setAttribute(conbo.toKebabCase(attr), attrs[attr]);
}
if (this.style... | javascript | function(el)
{
var attrs = conbo.assign({}, this.attributes);
if (this.id && !el.id)
{
attrs.id = this.id;
}
el.classList.add('cb-glimpse');
el.cbGlimpse = this;
for (var attr in attrs)
{
el.setAttribute(conbo.toKebabCase(attr), attrs[attr]);
}
if (this.style... | [
"function",
"(",
"el",
")",
"{",
"var",
"attrs",
"=",
"conbo",
".",
"assign",
"(",
"{",
"}",
",",
"this",
".",
"attributes",
")",
";",
"if",
"(",
"this",
".",
"id",
"&&",
"!",
"el",
".",
"id",
")",
"{",
"attrs",
".",
"id",
"=",
"this",
".",
... | Set this View's element
@private | [
"Set",
"this",
"View",
"s",
"element"
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/lib/conbo.js#L7410-L7435 | train | |
mesmotronic/conbo | lib/conbo.js | function(selector, deep)
{
if (this.el)
{
var results = conbo.toArray(this.el.querySelectorAll(selector));
if (!deep)
{
var views = this.el.querySelectorAll('.cb-view, [cb-view], [cb-app]');
// Remove elements in child Views
conbo.forEach(views, function(el)
{
va... | javascript | function(selector, deep)
{
if (this.el)
{
var results = conbo.toArray(this.el.querySelectorAll(selector));
if (!deep)
{
var views = this.el.querySelectorAll('.cb-view, [cb-view], [cb-app]');
// Remove elements in child Views
conbo.forEach(views, function(el)
{
va... | [
"function",
"(",
"selector",
",",
"deep",
")",
"{",
"if",
"(",
"this",
".",
"el",
")",
"{",
"var",
"results",
"=",
"conbo",
".",
"toArray",
"(",
"this",
".",
"el",
".",
"querySelectorAll",
"(",
"selector",
")",
")",
";",
"if",
"(",
"!",
"deep",
"... | Uses querySelectorAll to find all matching elements contained within the
current View's element, but not within the elements of child Views
@param {string} selector - The selector to use
@param {boolean} deep - Include elements in child Views?
@returns {Array} All elements matching the selector | [
"Uses",
"querySelectorAll",
"to",
"find",
"all",
"matching",
"elements",
"contained",
"within",
"the",
"current",
"View",
"s",
"element",
"but",
"not",
"within",
"the",
"elements",
"of",
"child",
"Views"
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/lib/conbo.js#L7706-L7728 | train | |
mesmotronic/conbo | lib/conbo.js | function()
{
try
{
var el = this.el;
if (el.parentNode)
{
el.parentNode.removeChild(el);
this.dispatchEvent(new conbo.ConboEvent(conbo.ConboEvent.DETACH));
}
}
catch(e) {}
return this;
} | javascript | function()
{
try
{
var el = this.el;
if (el.parentNode)
{
el.parentNode.removeChild(el);
this.dispatchEvent(new conbo.ConboEvent(conbo.ConboEvent.DETACH));
}
}
catch(e) {}
return this;
} | [
"function",
"(",
")",
"{",
"try",
"{",
"var",
"el",
"=",
"this",
".",
"el",
";",
"if",
"(",
"el",
".",
"parentNode",
")",
"{",
"el",
".",
"parentNode",
".",
"removeChild",
"(",
"el",
")",
";",
"this",
".",
"dispatchEvent",
"(",
"new",
"conbo",
".... | Take the View's element element out of the DOM
@returns {this} | [
"Take",
"the",
"View",
"s",
"element",
"element",
"out",
"of",
"the",
"DOM"
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/lib/conbo.js#L7734-L7749 | train | |
mesmotronic/conbo | lib/conbo.js | function()
{
this.dispatchEvent(new conbo.ConboEvent(conbo.ConboEvent.REMOVE));
if (this.data)
{
this.data = undefined;
}
if (this.subcontext && this.subcontext != this.context)
{
this.subcontext.destroy();
this.subcontext = undefined;
}
if (this.context)
{
this.... | javascript | function()
{
this.dispatchEvent(new conbo.ConboEvent(conbo.ConboEvent.REMOVE));
if (this.data)
{
this.data = undefined;
}
if (this.subcontext && this.subcontext != this.context)
{
this.subcontext.destroy();
this.subcontext = undefined;
}
if (this.context)
{
this.... | [
"function",
"(",
")",
"{",
"this",
".",
"dispatchEvent",
"(",
"new",
"conbo",
".",
"ConboEvent",
"(",
"conbo",
".",
"ConboEvent",
".",
"REMOVE",
")",
")",
";",
"if",
"(",
"this",
".",
"data",
")",
"{",
"this",
".",
"data",
"=",
"undefined",
";",
"}... | Remove and destroy this View by taking the element out of the DOM,
unbinding it, removing all event listeners and removing the View from
its Context.
You should use a REMOVE event handler to destroy any event listeners,
timers or other persistent code you may have added.
@returns {this} | [
"Remove",
"and",
"destroy",
"this",
"View",
"by",
"taking",
"the",
"element",
"out",
"of",
"the",
"DOM",
"unbinding",
"it",
"removing",
"all",
"event",
"listeners",
"and",
"removing",
"the",
"View",
"from",
"its",
"Context",
"."
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/lib/conbo.js#L7761-L7803 | train | |
mesmotronic/conbo | lib/conbo.js | function(view)
{
if (arguments.length > 1)
{
conbo.forEach(arguments, function(view, index, list)
{
this.appendView(view);
},
this);
return this;
}
if (typeof view === 'function')
{
view = new view(this.context);
}
if (!(view instanceof conbo.View))
{
... | javascript | function(view)
{
if (arguments.length > 1)
{
conbo.forEach(arguments, function(view, index, list)
{
this.appendView(view);
},
this);
return this;
}
if (typeof view === 'function')
{
view = new view(this.context);
}
if (!(view instanceof conbo.View))
{
... | [
"function",
"(",
"view",
")",
"{",
"if",
"(",
"arguments",
".",
"length",
">",
"1",
")",
"{",
"conbo",
".",
"forEach",
"(",
"arguments",
",",
"function",
"(",
"view",
",",
"index",
",",
"list",
")",
"{",
"this",
".",
"appendView",
"(",
"view",
")",... | Append this DOM element from one View class instance this class
instances DOM element
@param {conbo.View|Function} view - The View instance to append
@returns {this} | [
"Append",
"this",
"DOM",
"element",
"from",
"one",
"View",
"class",
"instance",
"this",
"class",
"instances",
"DOM",
"element"
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/lib/conbo.js#L7812-L7838 | train | |
mesmotronic/conbo | lib/conbo.js | function(view)
{
if (arguments.length > 1)
{
conbo.forEach(arguments, function(view, index, list)
{
this.prependView(view);
},
this);
return this;
}
if (typeof view === 'function')
{
view = new view(this.context);
}
if (!(view instanceof conbo.View))
... | javascript | function(view)
{
if (arguments.length > 1)
{
conbo.forEach(arguments, function(view, index, list)
{
this.prependView(view);
},
this);
return this;
}
if (typeof view === 'function')
{
view = new view(this.context);
}
if (!(view instanceof conbo.View))
... | [
"function",
"(",
"view",
")",
"{",
"if",
"(",
"arguments",
".",
"length",
">",
"1",
")",
"{",
"conbo",
".",
"forEach",
"(",
"arguments",
",",
"function",
"(",
"view",
",",
"index",
",",
"list",
")",
"{",
"this",
".",
"prependView",
"(",
"view",
")"... | Prepend this DOM element from one View class instance this class
instances DOM element
@param {conbo.View} view - The View instance to preppend
@returns {this} | [
"Prepend",
"this",
"DOM",
"element",
"from",
"one",
"View",
"class",
"instance",
"this",
"class",
"instances",
"DOM",
"element"
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/lib/conbo.js#L7847-L7877 | train | |
mesmotronic/conbo | lib/conbo.js | function()
{
var template = this.template;
if (!!this.templateUrl)
{
this.loadTemplate();
}
else
{
if (conbo.isFunction(template))
{
template = template(this);
}
var el = this.el;
if (conbo.isString(template))
{
el.innerHTML = this.__parseTemplate(... | javascript | function()
{
var template = this.template;
if (!!this.templateUrl)
{
this.loadTemplate();
}
else
{
if (conbo.isFunction(template))
{
template = template(this);
}
var el = this.el;
if (conbo.isString(template))
{
el.innerHTML = this.__parseTemplate(... | [
"function",
"(",
")",
"{",
"var",
"template",
"=",
"this",
".",
"template",
";",
"if",
"(",
"!",
"!",
"this",
".",
"templateUrl",
")",
"{",
"this",
".",
"loadTemplate",
"(",
")",
";",
"}",
"else",
"{",
"if",
"(",
"conbo",
".",
"isFunction",
"(",
... | Initialize the View's template, either by loading the templateUrl
or using the contents of the template property, if either exist
@returns {this} | [
"Initialize",
"the",
"View",
"s",
"template",
"either",
"by",
"loading",
"the",
"templateUrl",
"or",
"using",
"the",
"contents",
"of",
"the",
"template",
"property",
"if",
"either",
"exist"
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/lib/conbo.js#L7908-L7938 | train | |
mesmotronic/conbo | lib/conbo.js | function(url)
{
url || (url = this.templateUrl);
var el = this.body;
this.unbindView();
if (this.templateCacheEnabled !== false && View__templateCache[url])
{
el.innerHTML = View__templateCache[url];
this.__initView();
return this;
}
var resultHandler = function(e... | javascript | function(url)
{
url || (url = this.templateUrl);
var el = this.body;
this.unbindView();
if (this.templateCacheEnabled !== false && View__templateCache[url])
{
el.innerHTML = View__templateCache[url];
this.__initView();
return this;
}
var resultHandler = function(e... | [
"function",
"(",
"url",
")",
"{",
"url",
"||",
"(",
"url",
"=",
"this",
".",
"templateUrl",
")",
";",
"var",
"el",
"=",
"this",
".",
"body",
";",
"this",
".",
"unbindView",
"(",
")",
";",
"if",
"(",
"this",
".",
"templateCacheEnabled",
"!==",
"fals... | Load HTML template and use it to populate this View's element
@param {string} [url] - The URL to which the request is sent
@returns {this} | [
"Load",
"HTML",
"template",
"and",
"use",
"it",
"to",
"populate",
"this",
"View",
"s",
"element"
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/lib/conbo.js#L7946-L7989 | train | |
mesmotronic/conbo | lib/conbo.js | function(command, data, method, resultClass)
{
var scope = this;
data = conbo.clone(data || {});
command = this.parseUrl(command, data);
data = this.encodeFunction(data, method);
return new Promise(function(resolve, reject)
{
conbo.httpRequest
({
data: data,
type: method || '... | javascript | function(command, data, method, resultClass)
{
var scope = this;
data = conbo.clone(data || {});
command = this.parseUrl(command, data);
data = this.encodeFunction(data, method);
return new Promise(function(resolve, reject)
{
conbo.httpRequest
({
data: data,
type: method || '... | [
"function",
"(",
"command",
",",
"data",
",",
"method",
",",
"resultClass",
")",
"{",
"var",
"scope",
"=",
"this",
";",
"data",
"=",
"conbo",
".",
"clone",
"(",
"data",
"||",
"{",
"}",
")",
";",
"command",
"=",
"this",
".",
"parseUrl",
"(",
"comman... | Call a method of the web service using the specified verb
@param {string} command - The name of the command
@param {Object} [data] - Object containing the data to send to the web service
@param {string} [method=GET] - GET, POST, etc (default: GET)
@param {Class} [resultClass] - Optional
@returns {Promise} | [
"Call",
"a",
"method",
"of",
"the",
"web",
"service",
"using",
"the",
"specified",
"verb"
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/lib/conbo.js#L8695-L8728 | train | |
mesmotronic/conbo | lib/conbo.js | function(command, method, resultClass)
{
if (conbo.isObject(command))
{
method = command.method;
resultClass = command.resultClass;
command = command.command;
}
this[conbo.toCamelCase(command)] = function(data)
{
return this.call(command, data, method, resultClass);
};
ret... | javascript | function(command, method, resultClass)
{
if (conbo.isObject(command))
{
method = command.method;
resultClass = command.resultClass;
command = command.command;
}
this[conbo.toCamelCase(command)] = function(data)
{
return this.call(command, data, method, resultClass);
};
ret... | [
"function",
"(",
"command",
",",
"method",
",",
"resultClass",
")",
"{",
"if",
"(",
"conbo",
".",
"isObject",
"(",
"command",
")",
")",
"{",
"method",
"=",
"command",
".",
"method",
";",
"resultClass",
"=",
"command",
".",
"resultClass",
";",
"command",
... | Call a method of the web service using the DELETE verb
@memberof conbo.HttpService.prototype
@method delete
@param {string} command - The name of the command
@param {Object} [data] - Object containing the data to send to the web service
@param {Class} [resultClass] - Optional
@returns {Promise}
Add one or more... | [
"Call",
"a",
"method",
"of",
"the",
"web",
"service",
"using",
"the",
"DELETE",
"verb"
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/lib/conbo.js#L8791-L8806 | train | |
mesmotronic/conbo | lib/conbo.js | function(url, data)
{
var parsedUrl = url,
matches = parsedUrl.match(/:\b\w+\b/g);
if (!!matches)
{
matches.forEach(function(key)
{
key = key.substr(1);
if (!(key in data))
{
throw new Error('Property "'+key+'" required but not found in data');
}
});
}
... | javascript | function(url, data)
{
var parsedUrl = url,
matches = parsedUrl.match(/:\b\w+\b/g);
if (!!matches)
{
matches.forEach(function(key)
{
key = key.substr(1);
if (!(key in data))
{
throw new Error('Property "'+key+'" required but not found in data');
}
});
}
... | [
"function",
"(",
"url",
",",
"data",
")",
"{",
"var",
"parsedUrl",
"=",
"url",
",",
"matches",
"=",
"parsedUrl",
".",
"match",
"(",
"/",
":\\b\\w+\\b",
"/",
"g",
")",
";",
"if",
"(",
"!",
"!",
"matches",
")",
"{",
"matches",
".",
"forEach",
"(",
... | Splice data into URL and remove spliced properties from data object | [
"Splice",
"data",
"into",
"URL",
"and",
"remove",
"spliced",
"properties",
"from",
"data",
"object"
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/lib/conbo.js#L8842-L8872 | train | |
mesmotronic/conbo | lib/conbo.js | function(fragment, options)
{
options || (options = {});
fragment = this.__getFragment(fragment);
if (this.fragment === fragment)
{
return;
}
var location = this.location;
this.fragment = fragment;
if (options.replace)
{
var href = location.href.replace(/(javascript... | javascript | function(fragment, options)
{
options || (options = {});
fragment = this.__getFragment(fragment);
if (this.fragment === fragment)
{
return;
}
var location = this.location;
this.fragment = fragment;
if (options.replace)
{
var href = location.href.replace(/(javascript... | [
"function",
"(",
"fragment",
",",
"options",
")",
"{",
"options",
"||",
"(",
"options",
"=",
"{",
"}",
")",
";",
"fragment",
"=",
"this",
".",
"__getFragment",
"(",
"fragment",
")",
";",
"if",
"(",
"this",
".",
"fragment",
"===",
"fragment",
")",
"{"... | Set the current path
@param {string} path - The path
@param {} | [
"Set",
"the",
"current",
"path"
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/lib/conbo.js#L9111-L9141 | train | |
mesmotronic/conbo | lib/conbo.js | function(fragmentOverride)
{
var fragment = this.fragment = this.__getFragment(fragmentOverride);
var matched = conbo.some(this.handlers, function(handler)
{
if (handler.route.test(fragment))
{
handler.callback(fragment);
return true;
}
});
if (!matched)
{
this.disp... | javascript | function(fragmentOverride)
{
var fragment = this.fragment = this.__getFragment(fragmentOverride);
var matched = conbo.some(this.handlers, function(handler)
{
if (handler.route.test(fragment))
{
handler.callback(fragment);
return true;
}
});
if (!matched)
{
this.disp... | [
"function",
"(",
"fragmentOverride",
")",
"{",
"var",
"fragment",
"=",
"this",
".",
"fragment",
"=",
"this",
".",
"__getFragment",
"(",
"fragmentOverride",
")",
";",
"var",
"matched",
"=",
"conbo",
".",
"some",
"(",
"this",
".",
"handlers",
",",
"function"... | Attempt to load the current URL fragment
@private
@returns {boolean} Whether or not the path is a valid route | [
"Attempt",
"to",
"load",
"the",
"current",
"URL",
"fragment"
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/lib/conbo.js#L9173-L9192 | train | |
openmason/aonx | lib/aonx.js | _postHandlers | function _postHandlers() {
// any authentication checks first
if(config.authentication.enabled) {
logger.info(pkgname + " authentication to API's enabled");
app.all(config.api.path, function(req, res, next) {
if(config.authentication.ignores && req.params) {
// check if the params is in ignor... | javascript | function _postHandlers() {
// any authentication checks first
if(config.authentication.enabled) {
logger.info(pkgname + " authentication to API's enabled");
app.all(config.api.path, function(req, res, next) {
if(config.authentication.ignores && req.params) {
// check if the params is in ignor... | [
"function",
"_postHandlers",
"(",
")",
"{",
"// any authentication checks first",
"if",
"(",
"config",
".",
"authentication",
".",
"enabled",
")",
"{",
"logger",
".",
"info",
"(",
"pkgname",
"+",
"\" authentication to API's enabled\"",
")",
";",
"app",
".",
"all"... | all post handlers go here | [
"all",
"post",
"handlers",
"go",
"here"
] | e224668b6f5a3e939535e82218e17e00412cc39a | https://github.com/openmason/aonx/blob/e224668b6f5a3e939535e82218e17e00412cc39a/lib/aonx.js#L205-L271 | train |
openmason/aonx | lib/aonx.js | _errorHandlers | function _errorHandlers() {
// middleware with an arity of 4 are considered
// error handling middleware. When you next(err)
// it will be passed through the defined middleware
// in order, but ONLY those with an arity of 4, ignoring
// regular middleware.
app.use(function(err, req, res, next){
logger.e... | javascript | function _errorHandlers() {
// middleware with an arity of 4 are considered
// error handling middleware. When you next(err)
// it will be passed through the defined middleware
// in order, but ONLY those with an arity of 4, ignoring
// regular middleware.
app.use(function(err, req, res, next){
logger.e... | [
"function",
"_errorHandlers",
"(",
")",
"{",
"// middleware with an arity of 4 are considered",
"// error handling middleware. When you next(err)",
"// it will be passed through the defined middleware",
"// in order, but ONLY those with an arity of 4, ignoring",
"// regular middleware.",
"app",
... | register these error handlers in the express configuration | [
"register",
"these",
"error",
"handlers",
"in",
"the",
"express",
"configuration"
] | e224668b6f5a3e939535e82218e17e00412cc39a | https://github.com/openmason/aonx/blob/e224668b6f5a3e939535e82218e17e00412cc39a/lib/aonx.js#L287-L317 | train |
voorhoede/voorhoede-ocelot-formatter | lib/render-code.js | getCode | function getCode(code, language) {
if (prism.languages.hasOwnProperty(language)) {
code = prism.highlight(code, prism.languages[language]);
return `<pre class="language-${language}"><code>${code}</code></pre>`;
} else {
return `<pre class="language-unknown"><code>${code}</code></pre>`;
... | javascript | function getCode(code, language) {
if (prism.languages.hasOwnProperty(language)) {
code = prism.highlight(code, prism.languages[language]);
return `<pre class="language-${language}"><code>${code}</code></pre>`;
} else {
return `<pre class="language-unknown"><code>${code}</code></pre>`;
... | [
"function",
"getCode",
"(",
"code",
",",
"language",
")",
"{",
"if",
"(",
"prism",
".",
"languages",
".",
"hasOwnProperty",
"(",
"language",
")",
")",
"{",
"code",
"=",
"prism",
".",
"highlight",
"(",
"code",
",",
"prism",
".",
"languages",
"[",
"langu... | adds `json` to global `prism.languages` instance | [
"adds",
"json",
"to",
"global",
"prism",
".",
"languages",
"instance"
] | b0dc3c6cd0d1e956974a51129def29ce9d27d030 | https://github.com/voorhoede/voorhoede-ocelot-formatter/blob/b0dc3c6cd0d1e956974a51129def29ce9d27d030/lib/render-code.js#L4-L11 | train |
socialally/air | lib/air/children.js | children | function children(selector) {
var arr = [], slice = this.slice, nodes, matches;
this.each(function(el) {
nodes = slice.call(el.childNodes);
// only include elements
nodes = nodes.filter(function(n) {
if(n instanceof Element) { return n;}
})
// filter direct descendants by selector
if(s... | javascript | function children(selector) {
var arr = [], slice = this.slice, nodes, matches;
this.each(function(el) {
nodes = slice.call(el.childNodes);
// only include elements
nodes = nodes.filter(function(n) {
if(n instanceof Element) { return n;}
})
// filter direct descendants by selector
if(s... | [
"function",
"children",
"(",
"selector",
")",
"{",
"var",
"arr",
"=",
"[",
"]",
",",
"slice",
"=",
"this",
".",
"slice",
",",
"nodes",
",",
"matches",
";",
"this",
".",
"each",
"(",
"function",
"(",
"el",
")",
"{",
"nodes",
"=",
"slice",
".",
"ca... | Get the children of each element in the set of matched elements,
optionally filtering by selector. | [
"Get",
"the",
"children",
"of",
"each",
"element",
"in",
"the",
"set",
"of",
"matched",
"elements",
"optionally",
"filtering",
"by",
"selector",
"."
] | a3d94de58aaa4930a425fbcc7266764bf6ca8ca6 | https://github.com/socialally/air/blob/a3d94de58aaa4930a425fbcc7266764bf6ca8ca6/lib/air/children.js#L5-L27 | train |
mchalapuk/hyper-text-slider | lib/utils/dom.spec-helper.js | getSibling | function getSibling(node, relativeIndex) {
var parent = node.parentNode;
if (parent === null) {
return null;
}
var currentIndex = parent.childNodes.indexOf(node);
var siblingIndex = currentIndex + relativeIndex;
if (siblingIndex < 0 || siblingIndex > parent.childNodes.length - 1) {
return null;
}
... | javascript | function getSibling(node, relativeIndex) {
var parent = node.parentNode;
if (parent === null) {
return null;
}
var currentIndex = parent.childNodes.indexOf(node);
var siblingIndex = currentIndex + relativeIndex;
if (siblingIndex < 0 || siblingIndex > parent.childNodes.length - 1) {
return null;
}
... | [
"function",
"getSibling",
"(",
"node",
",",
"relativeIndex",
")",
"{",
"var",
"parent",
"=",
"node",
".",
"parentNode",
";",
"if",
"(",
"parent",
"===",
"null",
")",
"{",
"return",
"null",
";",
"}",
"var",
"currentIndex",
"=",
"parent",
".",
"childNodes"... | returns a sibling of given node | [
"returns",
"a",
"sibling",
"of",
"given",
"node"
] | 2711b41b9bbf1d528e4a0bd31b2efdf91dce55b4 | https://github.com/mchalapuk/hyper-text-slider/blob/2711b41b9bbf1d528e4a0bd31b2efdf91dce55b4/lib/utils/dom.spec-helper.js#L115-L126 | train |
wmluke/grunt-inline-angular-templates | tasks/inline_angular_templates.js | function (rawHtml) {
var matchKeys = Object.keys(options.unescape);
if (matchKeys.length === 0) {
return rawHtml;
}
var pattern = new RegExp('(' + matchKeys.join('|') + ')', 'g');
return rawHtml.replace(pattern, function (match) {
... | javascript | function (rawHtml) {
var matchKeys = Object.keys(options.unescape);
if (matchKeys.length === 0) {
return rawHtml;
}
var pattern = new RegExp('(' + matchKeys.join('|') + ')', 'g');
return rawHtml.replace(pattern, function (match) {
... | [
"function",
"(",
"rawHtml",
")",
"{",
"var",
"matchKeys",
"=",
"Object",
".",
"keys",
"(",
"options",
".",
"unescape",
")",
";",
"if",
"(",
"matchKeys",
".",
"length",
"===",
"0",
")",
"{",
"return",
"rawHtml",
";",
"}",
"var",
"pattern",
"=",
"new",... | Replace characters according to 'unescape' option | [
"Replace",
"characters",
"according",
"to",
"unescape",
"option"
] | 335ddff1e5c12e1526579936939211f9b8f37f28 | https://github.com/wmluke/grunt-inline-angular-templates/blob/335ddff1e5c12e1526579936939211f9b8f37f28/tasks/inline_angular_templates.js#L26-L35 | train | |
renancouto/json2sass | lib/json2sass.js | readFile | function readFile(file) {
try {
file = require(path.relative(__dirname, file));
} catch (err) {
return err;
}
return file;
} | javascript | function readFile(file) {
try {
file = require(path.relative(__dirname, file));
} catch (err) {
return err;
}
return file;
} | [
"function",
"readFile",
"(",
"file",
")",
"{",
"try",
"{",
"file",
"=",
"require",
"(",
"path",
".",
"relative",
"(",
"__dirname",
",",
"file",
")",
")",
";",
"}",
"catch",
"(",
"err",
")",
"{",
"return",
"err",
";",
"}",
"return",
"file",
";",
"... | read json file
@param {string} file [json file]
@return {string} [json content] | [
"read",
"json",
"file"
] | dda57d99a1d7d031fd8dba8b28f3b304019f5983 | https://github.com/renancouto/json2sass/blob/dda57d99a1d7d031fd8dba8b28f3b304019f5983/lib/json2sass.js#L14-L22 | train |
renancouto/json2sass | lib/json2sass.js | writeFile | function writeFile(input, output, type) {
var json = readFile(input),
content = getContent(json, type);
fs.writeFile(output, content, function (err) {
if (err) {
throw err;
}
console.log('The file "' + output + '" was written successfully!');
});
} | javascript | function writeFile(input, output, type) {
var json = readFile(input),
content = getContent(json, type);
fs.writeFile(output, content, function (err) {
if (err) {
throw err;
}
console.log('The file "' + output + '" was written successfully!');
});
} | [
"function",
"writeFile",
"(",
"input",
",",
"output",
",",
"type",
")",
"{",
"var",
"json",
"=",
"readFile",
"(",
"input",
")",
",",
"content",
"=",
"getContent",
"(",
"json",
",",
"type",
")",
";",
"fs",
".",
"writeFile",
"(",
"output",
",",
"conten... | write json content to file
@param {string} input [input file]
@param {string} output [output file]
@param {string} type [file type: sass || scss] | [
"write",
"json",
"content",
"to",
"file"
] | dda57d99a1d7d031fd8dba8b28f3b304019f5983 | https://github.com/renancouto/json2sass/blob/dda57d99a1d7d031fd8dba8b28f3b304019f5983/lib/json2sass.js#L84-L95 | train |
theboyWhoCriedWoolf/transition-manager | src/parsers/dataParser.js | _extractActions | function _extractActions( opts )
{
// main properties
const data = opts.data,
configState = opts.stateData,
stateView = opts.stateView,
stateName = opts.stateName;
// new defined properties
let stateTransitions = [],
viewData = opts.viewData,
appDataView,
action,
statePrefix;
... | javascript | function _extractActions( opts )
{
// main properties
const data = opts.data,
configState = opts.stateData,
stateView = opts.stateView,
stateName = opts.stateName;
// new defined properties
let stateTransitions = [],
viewData = opts.viewData,
appDataView,
action,
statePrefix;
... | [
"function",
"_extractActions",
"(",
"opts",
")",
"{",
"// main properties",
"const",
"data",
"=",
"opts",
".",
"data",
",",
"configState",
"=",
"opts",
".",
"stateData",
",",
"stateView",
"=",
"opts",
".",
"stateView",
",",
"stateName",
"=",
"opts",
".",
"... | extract the actual transition data for the state
@param {object} configState - state data
@return {array} transition array - FSM | [
"extract",
"the",
"actual",
"transition",
"data",
"for",
"the",
"state"
] | a20fda0bb07c0098bf709ea03770b1ee2a855655 | https://github.com/theboyWhoCriedWoolf/transition-manager/blob/a20fda0bb07c0098bf709ea03770b1ee2a855655/src/parsers/dataParser.js#L14-L54 | train |
theboyWhoCriedWoolf/transition-manager | src/parsers/dataParser.js | _extractTransitions | function _extractTransitions( prop, stateView, nextView )
{
var groupedTransitions = [];
if( prop.transitions ) { // if more transitions exist, add them
groupedTransitions = prop.transitions.map( ( transitionObject ) => {
return transitionObject;
});
}
prop.views = unique( prop.views, [ stateVie... | javascript | function _extractTransitions( prop, stateView, nextView )
{
var groupedTransitions = [];
if( prop.transitions ) { // if more transitions exist, add them
groupedTransitions = prop.transitions.map( ( transitionObject ) => {
return transitionObject;
});
}
prop.views = unique( prop.views, [ stateVie... | [
"function",
"_extractTransitions",
"(",
"prop",
",",
"stateView",
",",
"nextView",
")",
"{",
"var",
"groupedTransitions",
"=",
"[",
"]",
";",
"if",
"(",
"prop",
".",
"transitions",
")",
"{",
"// if more transitions exist, add them",
"groupedTransitions",
"=",
"pro... | extract transition information
and extract data if transition information is
an array of transitions
@param {onbject} prop
@param {string} stateView - id of state view
@param {string} nextView - id of view this transition goes to
@return {array} array of transitions fot this action | [
"extract",
"transition",
"information",
"and",
"extract",
"data",
"if",
"transition",
"information",
"is",
"an",
"array",
"of",
"transitions"
] | a20fda0bb07c0098bf709ea03770b1ee2a855655 | https://github.com/theboyWhoCriedWoolf/transition-manager/blob/a20fda0bb07c0098bf709ea03770b1ee2a855655/src/parsers/dataParser.js#L65-L76 | train |
bline/remix | lib/remix.js | ReMix | function ReMix(name) {
var args = _.flatten(_.toArray(arguments));
if (_.isString(name) || _.isNull(name) || _.isUndefined(name))
args = args.slice(1);
else
name = undefined;
/**
* Unique id used for storing data in RegExp objects
* @private
*/
this._id = genguid... | javascript | function ReMix(name) {
var args = _.flatten(_.toArray(arguments));
if (_.isString(name) || _.isNull(name) || _.isUndefined(name))
args = args.slice(1);
else
name = undefined;
/**
* Unique id used for storing data in RegExp objects
* @private
*/
this._id = genguid... | [
"function",
"ReMix",
"(",
"name",
")",
"{",
"var",
"args",
"=",
"_",
".",
"flatten",
"(",
"_",
".",
"toArray",
"(",
"arguments",
")",
")",
";",
"if",
"(",
"_",
".",
"isString",
"(",
"name",
")",
"||",
"_",
".",
"isNull",
"(",
"name",
")",
"||",... | Construct a new `ReMix` object.
The name sets this ReMix's name. The name is used when
returning matches. All sub-child matches are namespaced based
on the hierarchy of names. `name` is optional.
Any arguments after `name` are passed to {@link ReMix#add}.
@constructor
@alias ReMix
@public
@param {ReMix~Name} [name] -... | [
"Construct",
"a",
"new",
"ReMix",
"object",
"."
] | 0b8a00b95d0c9b756e8451d2f1be7d69451236b8 | https://github.com/bline/remix/blob/0b8a00b95d0c9b756e8451d2f1be7d69451236b8/lib/remix.js#L51-L97 | train |
vid/SenseBase | lib/form-query.js | shouldFilter | function shouldFilter(filters, anno) {
for (var i = filters.length - 1; i > -1; i--) {
var filter = filters[i];
if (filter.type === anno.type) {
if (_.isEqual(filter.position, anno.position)) {
if (anno.isA && anno.isA === 'Date') {
var filterDate = new Date(filter.value), fieldDate = ... | javascript | function shouldFilter(filters, anno) {
for (var i = filters.length - 1; i > -1; i--) {
var filter = filters[i];
if (filter.type === anno.type) {
if (_.isEqual(filter.position, anno.position)) {
if (anno.isA && anno.isA === 'Date') {
var filterDate = new Date(filter.value), fieldDate = ... | [
"function",
"shouldFilter",
"(",
"filters",
",",
"anno",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"filters",
".",
"length",
"-",
"1",
";",
"i",
">",
"-",
"1",
";",
"i",
"--",
")",
"{",
"var",
"filter",
"=",
"filters",
"[",
"i",
"]",
";",
"if",
... | Return true if this field should be filtered out | [
"Return",
"true",
"if",
"this",
"field",
"should",
"be",
"filtered",
"out"
] | d60bcf28239e7dde437d8a6bdae41a6921dcd05b | https://github.com/vid/SenseBase/blob/d60bcf28239e7dde437d8a6bdae41a6921dcd05b/lib/form-query.js#L36-L57 | train |
leoselig/grunt-concat-deps | tasks/concat_deps.js | function(name) {
var match = null;
list.forEach(function(file) {
if(_.indexOf(file.modules, name) >= 0) {
match = file;
return false;
}
});
return match;
} | javascript | function(name) {
var match = null;
list.forEach(function(file) {
if(_.indexOf(file.modules, name) >= 0) {
match = file;
return false;
}
});
return match;
} | [
"function",
"(",
"name",
")",
"{",
"var",
"match",
"=",
"null",
";",
"list",
".",
"forEach",
"(",
"function",
"(",
"file",
")",
"{",
"if",
"(",
"_",
".",
"indexOf",
"(",
"file",
".",
"modules",
",",
"name",
")",
">=",
"0",
")",
"{",
"match",
"=... | Gets the file object info for one of its modules name | [
"Gets",
"the",
"file",
"object",
"info",
"for",
"one",
"of",
"its",
"modules",
"name"
] | 9ad4964f4396b48b994684ae08bb73c0e62a69ea | https://github.com/leoselig/grunt-concat-deps/blob/9ad4964f4396b48b994684ae08bb73c0e62a69ea/tasks/concat_deps.js#L63-L72 | train | |
leoselig/grunt-concat-deps | tasks/concat_deps.js | function(module) {
if (!module) {
return;
}
var file = fileByModules(module);
Array.prototype.push.apply(seen, file.modules);
file.requires.forEach(function(module) {
// Ignore resoled modules and dependencies in own file
if((_.indexOf(resolved, module) < 0) &&
(_.indexOf(file.modules... | javascript | function(module) {
if (!module) {
return;
}
var file = fileByModules(module);
Array.prototype.push.apply(seen, file.modules);
file.requires.forEach(function(module) {
// Ignore resoled modules and dependencies in own file
if((_.indexOf(resolved, module) < 0) &&
(_.indexOf(file.modules... | [
"function",
"(",
"module",
")",
"{",
"if",
"(",
"!",
"module",
")",
"{",
"return",
";",
"}",
"var",
"file",
"=",
"fileByModules",
"(",
"module",
")",
";",
"Array",
".",
"prototype",
".",
"push",
".",
"apply",
"(",
"seen",
",",
"file",
".",
"modules... | Resolves a module and its dependencies | [
"Resolves",
"a",
"module",
"and",
"its",
"dependencies"
] | 9ad4964f4396b48b994684ae08bb73c0e62a69ea | https://github.com/leoselig/grunt-concat-deps/blob/9ad4964f4396b48b994684ae08bb73c0e62a69ea/tasks/concat_deps.js#L75-L98 | train | |
warehouseai/warehouse-models | lib/index.js | WarehouseModels | function WarehouseModels(datastar) {
this.Build = require('./build')(datastar, this);
this.BuildFile = require('./build-file')(datastar, this);
this.BuildHead = require('./build-head')(datastar, this);
this.Package = require('./package')(datastar, this);
this.PackageCache = require('./package-cache')(datastar... | javascript | function WarehouseModels(datastar) {
this.Build = require('./build')(datastar, this);
this.BuildFile = require('./build-file')(datastar, this);
this.BuildHead = require('./build-head')(datastar, this);
this.Package = require('./package')(datastar, this);
this.PackageCache = require('./package-cache')(datastar... | [
"function",
"WarehouseModels",
"(",
"datastar",
")",
"{",
"this",
".",
"Build",
"=",
"require",
"(",
"'./build'",
")",
"(",
"datastar",
",",
"this",
")",
";",
"this",
".",
"BuildFile",
"=",
"require",
"(",
"'./build-file'",
")",
"(",
"datastar",
",",
"th... | Make a predictable constructor based object and pass in the context with datastar
because we are adding all of the models to this parent `WarehouseModels` constructor
and they should have access to each other if needed
@param {Datastar} datastar Instance of Datastar | [
"Make",
"a",
"predictable",
"constructor",
"based",
"object",
"and",
"pass",
"in",
"the",
"context",
"with",
"datastar",
"because",
"we",
"are",
"adding",
"all",
"of",
"the",
"models",
"to",
"this",
"parent",
"WarehouseModels",
"constructor",
"and",
"they",
"s... | ee65aa759adc6a7f83f4b02608a4e74fe562aa89 | https://github.com/warehouseai/warehouse-models/blob/ee65aa759adc6a7f83f4b02608a4e74fe562aa89/lib/index.js#L24-L36 | train |
KyperTech/matter | lib/utils/token.js | _delete | function _delete() {
// Remove string token
cookiesUtil.deleteCookie(_config2.default.tokenName);
// Remove user data
envStorage.removeItem(_config2.default.tokenDataName);
_logger2.default.log({
description: 'Token was removed.',
func: 'delete', obj: 'token'
});
} | javascript | function _delete() {
// Remove string token
cookiesUtil.deleteCookie(_config2.default.tokenName);
// Remove user data
envStorage.removeItem(_config2.default.tokenDataName);
_logger2.default.log({
description: 'Token was removed.',
func: 'delete', obj: 'token'
});
} | [
"function",
"_delete",
"(",
")",
"{",
"// Remove string token",
"cookiesUtil",
".",
"deleteCookie",
"(",
"_config2",
".",
"default",
".",
"tokenName",
")",
";",
"// Remove user data",
"envStorage",
".",
"removeItem",
"(",
"_config2",
".",
"default",
".",
"tokenDat... | Delete token data | [
"Delete",
"token",
"data"
] | 2a8f2fce565fd66d3718a40f35ed857b044e6483 | https://github.com/KyperTech/matter/blob/2a8f2fce565fd66d3718a40f35ed857b044e6483/lib/utils/token.js#L104-L113 | train |
vadr-vr/VR-Analytics-JSCore | index.js | initVadRAnalytics | function initVadRAnalytics(params){
timeManager.init();
dataCollector.init();
dataManager.init();
deviceData.init();
user.init();
initState = true;
// set initial params if provided
_setParams(params);
} | javascript | function initVadRAnalytics(params){
timeManager.init();
dataCollector.init();
dataManager.init();
deviceData.init();
user.init();
initState = true;
// set initial params if provided
_setParams(params);
} | [
"function",
"initVadRAnalytics",
"(",
"params",
")",
"{",
"timeManager",
".",
"init",
"(",
")",
";",
"dataCollector",
".",
"init",
"(",
")",
";",
"dataManager",
".",
"init",
"(",
")",
";",
"deviceData",
".",
"init",
"(",
")",
";",
"user",
".",
"init",
... | inits the vadr analytics core for a new application
@param {*} params default event configuration and extra session metadata | [
"inits",
"the",
"vadr",
"analytics",
"core",
"for",
"a",
"new",
"application"
] | 7e4a493c824c2c1716360dcb6a3bfecfede5df3b | https://github.com/vadr-vr/VR-Analytics-JSCore/blob/7e4a493c824c2c1716360dcb6a3bfecfede5df3b/index.js#L26-L39 | 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.