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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
soajs/grunt-soajs | lib/swagger/swagger.js | function (files, callback) {
//loop on all files and write them
async.each(files, function (fileObj, mCb) {
var data = swagger.cloneObj(fileObj.data);
//if tokens, replace all occurences with corresponding values
if (fileObj.tokens) {
for (var i in fileObj.tokens) {
var regexp = new RegExp("%"... | javascript | function (files, callback) {
//loop on all files and write them
async.each(files, function (fileObj, mCb) {
var data = swagger.cloneObj(fileObj.data);
//if tokens, replace all occurences with corresponding values
if (fileObj.tokens) {
for (var i in fileObj.tokens) {
var regexp = new RegExp("%"... | [
"function",
"(",
"files",
",",
"callback",
")",
"{",
"//loop on all files and write them",
"async",
".",
"each",
"(",
"files",
",",
"function",
"(",
"fileObj",
",",
"mCb",
")",
"{",
"var",
"data",
"=",
"swagger",
".",
"cloneObj",
"(",
"fileObj",
".",
"data... | function that generates the files for the microservice
@param files
@param callback | [
"function",
"that",
"generates",
"the",
"files",
"for",
"the",
"microservice"
] | 89b9583d2b62229430f4d710107c285149174a87 | https://github.com/soajs/grunt-soajs/blob/89b9583d2b62229430f4d710107c285149174a87/lib/swagger/swagger.js#L621-L651 | train | |
neurospeech/web-atoms-unit | index.js | function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
this.testCategory = name;
return construct(original, args);
} | javascript | function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
this.testCategory = name;
return construct(original, args);
} | [
"function",
"(",
")",
"{",
"var",
"args",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"_i",
"=",
"0",
";",
"_i",
"<",
"arguments",
".",
"length",
";",
"_i",
"++",
")",
"{",
"args",
"[",
"_i",
"]",
"=",
"arguments",
"[",
"_i",
"]",
";",
"}",
"thi... | the new constructor behaviour | [
"the",
"new",
"constructor",
"behaviour"
] | 16f51dd9a73a3c4ad896bc999c4b2ba05375158e | https://github.com/neurospeech/web-atoms-unit/blob/16f51dd9a73a3c4ad896bc999c4b2ba05375158e/index.js#L330-L337 | train | |
muraken720/retext-japanese | index.js | createWordNode | function createWordNode (item) {
var wordNode = parser.createParentNode('Word')
if (options && options.pos) {
wordNode.data = item
}
var textNode = parser.createTextNode('Text', item.surface_form)
parser.add(textNode, wordNode)
return wordNode
} | javascript | function createWordNode (item) {
var wordNode = parser.createParentNode('Word')
if (options && options.pos) {
wordNode.data = item
}
var textNode = parser.createTextNode('Text', item.surface_form)
parser.add(textNode, wordNode)
return wordNode
} | [
"function",
"createWordNode",
"(",
"item",
")",
"{",
"var",
"wordNode",
"=",
"parser",
".",
"createParentNode",
"(",
"'Word'",
")",
"if",
"(",
"options",
"&&",
"options",
".",
"pos",
")",
"{",
"wordNode",
".",
"data",
"=",
"item",
"}",
"var",
"textNode",... | Create WordNode with POS.
@param item
@returns {{type: string, value: *}} | [
"Create",
"WordNode",
"with",
"POS",
"."
] | a6b0c7da32be012618be848654924ea3e4fc2aed | https://github.com/muraken720/retext-japanese/blob/a6b0c7da32be012618be848654924ea3e4fc2aed/index.js#L42-L54 | train |
muraken720/retext-japanese | index.js | createTextNode | function createTextNode (type, item) {
var node = parser.createTextNode(type, item.surface_form)
if (options && options.pos) {
node.data = item
}
return node
} | javascript | function createTextNode (type, item) {
var node = parser.createTextNode(type, item.surface_form)
if (options && options.pos) {
node.data = item
}
return node
} | [
"function",
"createTextNode",
"(",
"type",
",",
"item",
")",
"{",
"var",
"node",
"=",
"parser",
".",
"createTextNode",
"(",
"type",
",",
"item",
".",
"surface_form",
")",
"if",
"(",
"options",
"&&",
"options",
".",
"pos",
")",
"{",
"node",
".",
"data",... | Create TextNode for SymbolNode, PunctuationNode, WhiteSpaceNode and SourceNode with POS.
@param type
@param item
@returns {{type: string, value: *}} | [
"Create",
"TextNode",
"for",
"SymbolNode",
"PunctuationNode",
"WhiteSpaceNode",
"and",
"SourceNode",
"with",
"POS",
"."
] | a6b0c7da32be012618be848654924ea3e4fc2aed | https://github.com/muraken720/retext-japanese/blob/a6b0c7da32be012618be848654924ea3e4fc2aed/index.js#L62-L70 | train |
crispy1989/node-xerror | xerror.js | XError | function XError(/*code, message, data, privateData, cause*/) {
if (Error.captureStackTrace) Error.captureStackTrace(this, this);
else this.stack = new Error().stack;
var code, message, data, cause, privateData;
for(var i = 0; i < arguments.length; i++) {
var arg = arguments[i];
if(XError.isXError(arg) || arg ... | javascript | function XError(/*code, message, data, privateData, cause*/) {
if (Error.captureStackTrace) Error.captureStackTrace(this, this);
else this.stack = new Error().stack;
var code, message, data, cause, privateData;
for(var i = 0; i < arguments.length; i++) {
var arg = arguments[i];
if(XError.isXError(arg) || arg ... | [
"function",
"XError",
"(",
"/*code, message, data, privateData, cause*/",
")",
"{",
"if",
"(",
"Error",
".",
"captureStackTrace",
")",
"Error",
".",
"captureStackTrace",
"(",
"this",
",",
"this",
")",
";",
"else",
"this",
".",
"stack",
"=",
"new",
"Error",
"("... | Construct a Extended Error instance.
All parameters are optional, with the exception that a code is required if a message is given, and
that data is required if privateData is given.
@class XError
@constructor
@extends Error
@uses ErrorCodeRegistry
@param {String} [code="internal_error"] - The error code of the error.... | [
"Construct",
"a",
"Extended",
"Error",
"instance",
".",
"All",
"parameters",
"are",
"optional",
"with",
"the",
"exception",
"that",
"a",
"code",
"is",
"required",
"if",
"a",
"message",
"is",
"given",
"and",
"that",
"data",
"is",
"required",
"if",
"privateDat... | d736c29d72dcdb6a93223073b9dcd05b08e5e07d | https://github.com/crispy1989/node-xerror/blob/d736c29d72dcdb6a93223073b9dcd05b08e5e07d/xerror.js#L19-L69 | train |
cuiyongjian/resource-meter | lib/myos.js | cpuAverage | function cpuAverage() {
//Initialise sum of idle and time of cores and fetch CPU info
var totalIdle = 0, totalTick = 0;
var cpus = os.cpus();
//Loop through CPU cores
for(var i = 0, len = cpus.length; i < len; i++) {
//Select CPU core
var cpu = cpus[i];
//Total u... | javascript | function cpuAverage() {
//Initialise sum of idle and time of cores and fetch CPU info
var totalIdle = 0, totalTick = 0;
var cpus = os.cpus();
//Loop through CPU cores
for(var i = 0, len = cpus.length; i < len; i++) {
//Select CPU core
var cpu = cpus[i];
//Total u... | [
"function",
"cpuAverage",
"(",
")",
"{",
"//Initialise sum of idle and time of cores and fetch CPU info",
"var",
"totalIdle",
"=",
"0",
",",
"totalTick",
"=",
"0",
";",
"var",
"cpus",
"=",
"os",
".",
"cpus",
"(",
")",
";",
"//Loop through CPU cores",
"for",
"(",
... | Create function to get CPU information | [
"Create",
"function",
"to",
"get",
"CPU",
"information"
] | 00298b6afa19e4b06cf344849a7c9559e2775d60 | https://github.com/cuiyongjian/resource-meter/blob/00298b6afa19e4b06cf344849a7c9559e2775d60/lib/myos.js#L89-L111 | train |
mattdesl/kami-base-batch | mixins.js | function(r, g, b, a) {
var rnum = typeof r === "number";
if (rnum
&& typeof g === "number"
&& typeof b === "number") {
//default alpha to one
a = typeof a === "number" ? a : 1.0;
} else {
r = g = b = a = rnum ? r : 1.0;
}
if (this.premultiplied) {
r *= a;
g *= a;
b *= a;
}
... | javascript | function(r, g, b, a) {
var rnum = typeof r === "number";
if (rnum
&& typeof g === "number"
&& typeof b === "number") {
//default alpha to one
a = typeof a === "number" ? a : 1.0;
} else {
r = g = b = a = rnum ? r : 1.0;
}
if (this.premultiplied) {
r *= a;
g *= a;
b *= a;
}
... | [
"function",
"(",
"r",
",",
"g",
",",
"b",
",",
"a",
")",
"{",
"var",
"rnum",
"=",
"typeof",
"r",
"===",
"\"number\"",
";",
"if",
"(",
"rnum",
"&&",
"typeof",
"g",
"===",
"\"number\"",
"&&",
"typeof",
"b",
"===",
"\"number\"",
")",
"{",
"//default a... | Sets the color of this sprite batcher, which is used in subsequent draw
calls. This does not flush the batch.
If r, g, b, are all numbers, this method assumes that RGB
or RGBA float values (0.0 to 1.0) are being passed. Alpha defaults to one
if undefined.
If one or more of the (r, g, b) arguments are non-numbers, we ... | [
"Sets",
"the",
"color",
"of",
"this",
"sprite",
"batcher",
"which",
"is",
"used",
"in",
"subsequent",
"draw",
"calls",
".",
"This",
"does",
"not",
"flush",
"the",
"batch",
"."
] | a090162d21959bc44832d724f1d12868883ec2ac | https://github.com/mattdesl/kami-base-batch/blob/a090162d21959bc44832d724f1d12868883ec2ac/mixins.js#L216-L239 | train | |
muraken720/parse-japanese-basic | lib/parse-japanese-basic.js | ParseJapaneseBasic | function ParseJapaneseBasic (file, options) {
var offset = 0
var line = 1
var column = 1
var position
if (!(this instanceof ParseJapaneseBasic)) {
return new ParseJapaneseBasic(file, options)
}
if (file && file.message) {
this.file = file
} else {
options = file
}
position = options &... | javascript | function ParseJapaneseBasic (file, options) {
var offset = 0
var line = 1
var column = 1
var position
if (!(this instanceof ParseJapaneseBasic)) {
return new ParseJapaneseBasic(file, options)
}
if (file && file.message) {
this.file = file
} else {
options = file
}
position = options &... | [
"function",
"ParseJapaneseBasic",
"(",
"file",
",",
"options",
")",
"{",
"var",
"offset",
"=",
"0",
"var",
"line",
"=",
"1",
"var",
"column",
"=",
"1",
"var",
"position",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"ParseJapaneseBasic",
")",
")",
"{",
"... | Transform Japanese natural language into
an NLCST-tree.
@param {VFile?} file - Virtual file.
@param {Object?} options - Configuration.
@constructor {ParseJapanese} | [
"Transform",
"Japanese",
"natural",
"language",
"into",
"an",
"NLCST",
"-",
"tree",
"."
] | ecbb712a11eed402192a17978e0079d6eb1a5888 | https://github.com/muraken720/parse-japanese-basic/blob/ecbb712a11eed402192a17978e0079d6eb1a5888/lib/parse-japanese-basic.js#L77-L102 | train |
purplecabbage/cordova-paramedic-OLD | paramedic.js | ParamedicRunner | function ParamedicRunner(_platformId,_plugins,_callback,bJustBuild,nPort,msTimeout,browserify,bSilent,bVerbose,platformPath) {
this.tunneledUrl = "";
this.port = nPort;
this.justBuild = bJustBuild;
this.plugins = _plugins;
this.platformId = _platformId;
this.callback = _callback;
this.tempFo... | javascript | function ParamedicRunner(_platformId,_plugins,_callback,bJustBuild,nPort,msTimeout,browserify,bSilent,bVerbose,platformPath) {
this.tunneledUrl = "";
this.port = nPort;
this.justBuild = bJustBuild;
this.plugins = _plugins;
this.platformId = _platformId;
this.callback = _callback;
this.tempFo... | [
"function",
"ParamedicRunner",
"(",
"_platformId",
",",
"_plugins",
",",
"_callback",
",",
"bJustBuild",
",",
"nPort",
",",
"msTimeout",
",",
"browserify",
",",
"bSilent",
",",
"bVerbose",
",",
"platformPath",
")",
"{",
"this",
".",
"tunneledUrl",
"=",
"\"\"",... | 10 minutes in msec - this will become a param | [
"10",
"minutes",
"in",
"msec",
"-",
"this",
"will",
"become",
"a",
"param"
] | 8615f31c9bca2f152a409d38a48c5c9587abf67d | https://github.com/purplecabbage/cordova-paramedic-OLD/blob/8615f31c9bca2f152a409d38a48c5c9587abf67d/paramedic.js#L17-L46 | train |
bammoo/get-less-imports | index.js | findImports | function findImports(filePath, result) {
var importPaths = getImportPaths(filePath);
var importPathsAbs = resolveImportPaths(filePath, importPaths);
if( importPathsAbs.length )
result.full[filePath] = importPathsAbs;
importPathsAbs.forEach(function(path){
if (result.simple.indexOf(path) === -1) {
... | javascript | function findImports(filePath, result) {
var importPaths = getImportPaths(filePath);
var importPathsAbs = resolveImportPaths(filePath, importPaths);
if( importPathsAbs.length )
result.full[filePath] = importPathsAbs;
importPathsAbs.forEach(function(path){
if (result.simple.indexOf(path) === -1) {
... | [
"function",
"findImports",
"(",
"filePath",
",",
"result",
")",
"{",
"var",
"importPaths",
"=",
"getImportPaths",
"(",
"filePath",
")",
";",
"var",
"importPathsAbs",
"=",
"resolveImportPaths",
"(",
"filePath",
",",
"importPaths",
")",
";",
"if",
"(",
"importPa... | Recursivley finds all @import paths of a LESS file, using a nice RegEx
@param {string} filePath - The path of the LESS file.
@param {Object} result
@returns {Object} | [
"Recursivley",
"finds",
"all"
] | 5577d46c95afecd4cde6889e991276b8ade02d93 | https://github.com/bammoo/get-less-imports/blob/5577d46c95afecd4cde6889e991276b8ade02d93/index.js#L16-L28 | train |
bammoo/get-less-imports | index.js | getImportPaths | function getImportPaths(filePath){
var importPaths = [];
try{
var contents = fs.readFileSync(filePath).toString('utf8');
importPaths = parseImpt(contents);
}
catch(exception){}
return importPaths;
} | javascript | function getImportPaths(filePath){
var importPaths = [];
try{
var contents = fs.readFileSync(filePath).toString('utf8');
importPaths = parseImpt(contents);
}
catch(exception){}
return importPaths;
} | [
"function",
"getImportPaths",
"(",
"filePath",
")",
"{",
"var",
"importPaths",
"=",
"[",
"]",
";",
"try",
"{",
"var",
"contents",
"=",
"fs",
".",
"readFileSync",
"(",
"filePath",
")",
".",
"toString",
"(",
"'utf8'",
")",
";",
"importPaths",
"=",
"parseIm... | Finds all the @import paths in a LESS file.
@param {string} filePath - The path of the LESS file. | [
"Finds",
"all",
"the"
] | 5577d46c95afecd4cde6889e991276b8ade02d93 | https://github.com/bammoo/get-less-imports/blob/5577d46c95afecd4cde6889e991276b8ade02d93/index.js#L46-L54 | train |
seznam/szn-tethered | szn-tethered.js | updatePosition | function updatePosition(instance, tetherBounds) {
const x = tetherBounds.x + (instance.horizontalAlignment === HORIZONTAL_ALIGN.LEFT ? 0 : tetherBounds.width)
const y = tetherBounds.y + (instance.verticalAlignment === VERTICAL_ALIGN.TOP ? 0 : tetherBounds.height)
if (transformsSupported) {
instance._... | javascript | function updatePosition(instance, tetherBounds) {
const x = tetherBounds.x + (instance.horizontalAlignment === HORIZONTAL_ALIGN.LEFT ? 0 : tetherBounds.width)
const y = tetherBounds.y + (instance.verticalAlignment === VERTICAL_ALIGN.TOP ? 0 : tetherBounds.height)
if (transformsSupported) {
instance._... | [
"function",
"updatePosition",
"(",
"instance",
",",
"tetherBounds",
")",
"{",
"const",
"x",
"=",
"tetherBounds",
".",
"x",
"+",
"(",
"instance",
".",
"horizontalAlignment",
"===",
"HORIZONTAL_ALIGN",
".",
"LEFT",
"?",
"0",
":",
"tetherBounds",
".",
"width",
... | Updates the position of the szn-tethered element according to the current tethering alignment and the provided
bounds of the tethering element.
@param {SznElements.SznTethered} instance The szn-tethered element instance.
@param {TetherBounds} tetherBounds The bounds (location and size) of the tethering element. | [
"Updates",
"the",
"position",
"of",
"the",
"szn",
"-",
"tethered",
"element",
"according",
"to",
"the",
"current",
"tethering",
"alignment",
"and",
"the",
"provided",
"bounds",
"of",
"the",
"tethering",
"element",
"."
] | 31e84b54b1fe66d5491d0913987c3a475b0d549b | https://github.com/seznam/szn-tethered/blob/31e84b54b1fe66d5491d0913987c3a475b0d549b/szn-tethered.js#L244-L254 | train |
seznam/szn-tethered | szn-tethered.js | updateAttributes | function updateAttributes(instance) {
if (instance.horizontalAlignment !== instance._lastHorizontalAlignment) {
const horizontalAlignment = instance.horizontalAlignment === HORIZONTAL_ALIGN.LEFT ? 'left' : 'right'
instance._root.setAttribute('data-horizontal-align', horizontalAlignment)
instance._... | javascript | function updateAttributes(instance) {
if (instance.horizontalAlignment !== instance._lastHorizontalAlignment) {
const horizontalAlignment = instance.horizontalAlignment === HORIZONTAL_ALIGN.LEFT ? 'left' : 'right'
instance._root.setAttribute('data-horizontal-align', horizontalAlignment)
instance._... | [
"function",
"updateAttributes",
"(",
"instance",
")",
"{",
"if",
"(",
"instance",
".",
"horizontalAlignment",
"!==",
"instance",
".",
"_lastHorizontalAlignment",
")",
"{",
"const",
"horizontalAlignment",
"=",
"instance",
".",
"horizontalAlignment",
"===",
"HORIZONTAL_... | Updates the attributes on the szn-tethered element reporting the current alignment to the tethering element.
@param {SznElements.SznTethered} instance The szn-tethered element instance. | [
"Updates",
"the",
"attributes",
"on",
"the",
"szn",
"-",
"tethered",
"element",
"reporting",
"the",
"current",
"alignment",
"to",
"the",
"tethering",
"element",
"."
] | 31e84b54b1fe66d5491d0913987c3a475b0d549b | https://github.com/seznam/szn-tethered/blob/31e84b54b1fe66d5491d0913987c3a475b0d549b/szn-tethered.js#L261-L272 | train |
seznam/szn-tethered | szn-tethered.js | getTetherBounds | function getTetherBounds(tether) {
const bounds = tether.getBoundingClientRect()
const width = bounds.width
const height = bounds.height
let x = 0
let y = 0
let tetherOffsetContainer = tether
while (tetherOffsetContainer) {
x += tetherOffsetContainer.offsetLeft
y += tetherOffset... | javascript | function getTetherBounds(tether) {
const bounds = tether.getBoundingClientRect()
const width = bounds.width
const height = bounds.height
let x = 0
let y = 0
let tetherOffsetContainer = tether
while (tetherOffsetContainer) {
x += tetherOffsetContainer.offsetLeft
y += tetherOffset... | [
"function",
"getTetherBounds",
"(",
"tether",
")",
"{",
"const",
"bounds",
"=",
"tether",
".",
"getBoundingClientRect",
"(",
")",
"const",
"width",
"=",
"bounds",
".",
"width",
"const",
"height",
"=",
"bounds",
".",
"height",
"let",
"x",
"=",
"0",
"let",
... | Calculates and returns both the on-screen and on-page location and dimensions of the provided tether element.
@param {Element} tether The tethering element.
@return {TetherBounds} The on-screen and on-page location and dimensions of the element. | [
"Calculates",
"and",
"returns",
"both",
"the",
"on",
"-",
"screen",
"and",
"on",
"-",
"page",
"location",
"and",
"dimensions",
"of",
"the",
"provided",
"tether",
"element",
"."
] | 31e84b54b1fe66d5491d0913987c3a475b0d549b | https://github.com/seznam/szn-tethered/blob/31e84b54b1fe66d5491d0913987c3a475b0d549b/szn-tethered.js#L280-L302 | train |
seznam/szn-tethered | szn-tethered.js | getContentDimensions | function getContentDimensions(instance) {
const contentElement = instance._root.firstElementChild
if (!contentElement) {
return {
width: 0,
height: 0,
}
}
let width
let height
if (window.devicePixelRatio > 1) {
// This is much less performant, so we use in only... | javascript | function getContentDimensions(instance) {
const contentElement = instance._root.firstElementChild
if (!contentElement) {
return {
width: 0,
height: 0,
}
}
let width
let height
if (window.devicePixelRatio > 1) {
// This is much less performant, so we use in only... | [
"function",
"getContentDimensions",
"(",
"instance",
")",
"{",
"const",
"contentElement",
"=",
"instance",
".",
"_root",
".",
"firstElementChild",
"if",
"(",
"!",
"contentElement",
")",
"{",
"return",
"{",
"width",
":",
"0",
",",
"height",
":",
"0",
",",
"... | Returns the dimensions of the content of the provided szn-tethered element.
@param {SznElements.SznTethered} instance The instance of the szn-tethered element.
@return {ContentDimensions} The dimensions of the tethered content. | [
"Returns",
"the",
"dimensions",
"of",
"the",
"content",
"of",
"the",
"provided",
"szn",
"-",
"tethered",
"element",
"."
] | 31e84b54b1fe66d5491d0913987c3a475b0d549b | https://github.com/seznam/szn-tethered/blob/31e84b54b1fe66d5491d0913987c3a475b0d549b/szn-tethered.js#L310-L335 | train |
jivesoftware/jive-persistence-sqlite | sqlite-dynamic.js | function( collectionID, criteria, cursor, limit) {
collectionID = collectionID.toLowerCase();
var deferred = q.defer();
// acquire a connection from the pool
db.getClient().then( function(dbClient) {
if ( !dbClient ) {
throw Error("Fai... | javascript | function( collectionID, criteria, cursor, limit) {
collectionID = collectionID.toLowerCase();
var deferred = q.defer();
// acquire a connection from the pool
db.getClient().then( function(dbClient) {
if ( !dbClient ) {
throw Error("Fai... | [
"function",
"(",
"collectionID",
",",
"criteria",
",",
"cursor",
",",
"limit",
")",
"{",
"collectionID",
"=",
"collectionID",
".",
"toLowerCase",
"(",
")",
";",
"var",
"deferred",
"=",
"q",
".",
"defer",
"(",
")",
";",
"// acquire a connection from the pool",
... | Retrieve a piece of data from a named collection, based on the criteria, return promise
with an array of the results when done.
@param collectionID
@param criteria
@param cursor if true, then returned item is a cursor; otherwise its a concrete collection (array) of items
@param limit optional | [
"Retrieve",
"a",
"piece",
"of",
"data",
"from",
"a",
"named",
"collection",
"based",
"on",
"the",
"criteria",
"return",
"promise",
"with",
"an",
"array",
"of",
"the",
"results",
"when",
"done",
"."
] | e61374ba629159d69e0239e1fe7f609c8654dc32 | https://github.com/jivesoftware/jive-persistence-sqlite/blob/e61374ba629159d69e0239e1fe7f609c8654dc32/sqlite-dynamic.js#L237-L301 | train | |
jivesoftware/jive-persistence-sqlite | sqlite-dynamic.js | function( collectionID, key ) {
collectionID = collectionID.toLowerCase();
var deferred = q.defer();
schemaSyncer.prepCollection(collectionID)
.then( function() {
sqliteObj.find( collectionID, {'_id': key}, false, 1 ).then(
// success
... | javascript | function( collectionID, key ) {
collectionID = collectionID.toLowerCase();
var deferred = q.defer();
schemaSyncer.prepCollection(collectionID)
.then( function() {
sqliteObj.find( collectionID, {'_id': key}, false, 1 ).then(
// success
... | [
"function",
"(",
"collectionID",
",",
"key",
")",
"{",
"collectionID",
"=",
"collectionID",
".",
"toLowerCase",
"(",
")",
";",
"var",
"deferred",
"=",
"q",
".",
"defer",
"(",
")",
";",
"schemaSyncer",
".",
"prepCollection",
"(",
"collectionID",
")",
".",
... | Retrieve a piece of data from a named collection whose key is the one provided.
@param collectionID
@param key | [
"Retrieve",
"a",
"piece",
"of",
"data",
"from",
"a",
"named",
"collection",
"whose",
"key",
"is",
"the",
"one",
"provided",
"."
] | e61374ba629159d69e0239e1fe7f609c8654dc32 | https://github.com/jivesoftware/jive-persistence-sqlite/blob/e61374ba629159d69e0239e1fe7f609c8654dc32/sqlite-dynamic.js#L308-L337 | train | |
jivesoftware/jive-persistence-sqlite | sqlite-dynamic.js | function( collectionID, key ) {
collectionID = collectionID.toLowerCase();
var deferred = q.defer();
// acquire a connection from the pool
db.getClient().then( function(dbClient) {
if ( !dbClient ) {
throw Error("Failed to acquire sqli... | javascript | function( collectionID, key ) {
collectionID = collectionID.toLowerCase();
var deferred = q.defer();
// acquire a connection from the pool
db.getClient().then( function(dbClient) {
if ( !dbClient ) {
throw Error("Failed to acquire sqli... | [
"function",
"(",
"collectionID",
",",
"key",
")",
"{",
"collectionID",
"=",
"collectionID",
".",
"toLowerCase",
"(",
")",
";",
"var",
"deferred",
"=",
"q",
".",
"defer",
"(",
")",
";",
"// acquire a connection from the pool",
"db",
".",
"getClient",
"(",
")"... | Remove a piece of data from a name collection, based to the provided key, return promise
containing removed items when done.
If no key is provided, all the data from the collection is removed.
Is transactional - will rollback on error.
@param collectionID
@param key | [
"Remove",
"a",
"piece",
"of",
"data",
"from",
"a",
"name",
"collection",
"based",
"to",
"the",
"provided",
"key",
"return",
"promise",
"containing",
"removed",
"items",
"when",
"done",
".",
"If",
"no",
"key",
"is",
"provided",
"all",
"the",
"data",
"from",... | e61374ba629159d69e0239e1fe7f609c8654dc32 | https://github.com/jivesoftware/jive-persistence-sqlite/blob/e61374ba629159d69e0239e1fe7f609c8654dc32/sqlite-dynamic.js#L347-L396 | train | |
yanni4night/jsdoc | src/jsdoc.js | Comment | function Comment() {
this.type = 'func'; //func or attr
this.descs = [];
this.attr = {
name: null
};
this.func = {
name: null,
params: null
};
this.clazz = null; //class
this.zuper = null; //super
this.tags = {
/*
name:[val1,val2]
*/
... | javascript | function Comment() {
this.type = 'func'; //func or attr
this.descs = [];
this.attr = {
name: null
};
this.func = {
name: null,
params: null
};
this.clazz = null; //class
this.zuper = null; //super
this.tags = {
/*
name:[val1,val2]
*/
... | [
"function",
"Comment",
"(",
")",
"{",
"this",
".",
"type",
"=",
"'func'",
";",
"//func or attr",
"this",
".",
"descs",
"=",
"[",
"]",
";",
"this",
".",
"attr",
"=",
"{",
"name",
":",
"null",
"}",
";",
"this",
".",
"func",
"=",
"{",
"name",
":",
... | Comment is a block of source comemnt.
As comment is only for function(class) and attribute,
so we define a type which indicates what type it is.
For different,'attr'/'func' saves the real payload data.
@class
@since 0.1.0
@version 0.1.0 | [
"Comment",
"is",
"a",
"block",
"of",
"source",
"comemnt",
"."
] | 76a0804cfc96b267061079bb80d337a7ea9b029a | https://github.com/yanni4night/jsdoc/blob/76a0804cfc96b267061079bb80d337a7ea9b029a/src/jsdoc.js#L34-L53 | train |
yanni4night/jsdoc | src/jsdoc.js | function(name, value) {
name = name.trim();
value = (value || "").trim();
switch (name) {
//The following are single allowed.
case 'return':
case 'copyright':
case 'author':
case 'since':
case 'description':
case... | javascript | function(name, value) {
name = name.trim();
value = (value || "").trim();
switch (name) {
//The following are single allowed.
case 'return':
case 'copyright':
case 'author':
case 'since':
case 'description':
case... | [
"function",
"(",
"name",
",",
"value",
")",
"{",
"name",
"=",
"name",
".",
"trim",
"(",
")",
";",
"value",
"=",
"(",
"value",
"||",
"\"\"",
")",
".",
"trim",
"(",
")",
";",
"switch",
"(",
"name",
")",
"{",
"//The following are single allowed.",
"case... | Add a tag except 'class','extends'
@param {String} name
@param {String} value
@class Comment
@since 0.1.0 | [
"Add",
"a",
"tag",
"except",
"class",
"extends"
] | 76a0804cfc96b267061079bb80d337a7ea9b029a | https://github.com/yanni4night/jsdoc/blob/76a0804cfc96b267061079bb80d337a7ea9b029a/src/jsdoc.js#L120-L159 | train | |
yanni4night/jsdoc | src/jsdoc.js | SourceTextParser | function SourceTextParser(sourceText, classes, methods) {
this.Comments = [];
this.sourceText = sourceText;
this.classes = classes;
this.methods = methods;
} | javascript | function SourceTextParser(sourceText, classes, methods) {
this.Comments = [];
this.sourceText = sourceText;
this.classes = classes;
this.methods = methods;
} | [
"function",
"SourceTextParser",
"(",
"sourceText",
",",
"classes",
",",
"methods",
")",
"{",
"this",
".",
"Comments",
"=",
"[",
"]",
";",
"this",
".",
"sourceText",
"=",
"sourceText",
";",
"this",
".",
"classes",
"=",
"classes",
";",
"this",
".",
"method... | Source text parser.
@class
@param {String} sourceText
@param {Object} classes
@param {Object} methods
@since 0.1.0 | [
"Source",
"text",
"parser",
"."
] | 76a0804cfc96b267061079bb80d337a7ea9b029a | https://github.com/yanni4night/jsdoc/blob/76a0804cfc96b267061079bb80d337a7ea9b029a/src/jsdoc.js#L193-L199 | train |
yanni4night/jsdoc | src/jsdoc.js | function() {
var line, lines = this.sourceText.split(/\n/mg),
lineLen = lines.length;
var inCommenting, curComment, closeCommentIdx;
for (var i = 0; i < lineLen; ++i) {
line = lines[i].trim();
if (line.startsWith('/**')) {
inCommenting = true... | javascript | function() {
var line, lines = this.sourceText.split(/\n/mg),
lineLen = lines.length;
var inCommenting, curComment, closeCommentIdx;
for (var i = 0; i < lineLen; ++i) {
line = lines[i].trim();
if (line.startsWith('/**')) {
inCommenting = true... | [
"function",
"(",
")",
"{",
"var",
"line",
",",
"lines",
"=",
"this",
".",
"sourceText",
".",
"split",
"(",
"/",
"\\n",
"/",
"mg",
")",
",",
"lineLen",
"=",
"lines",
".",
"length",
";",
"var",
"inCommenting",
",",
"curComment",
",",
"closeCommentIdx",
... | Parse the source text to Comment structure.
@since 0.1.0
@class SourceTextParser
@return {Undefined} | [
"Parse",
"the",
"source",
"text",
"to",
"Comment",
"structure",
"."
] | 76a0804cfc96b267061079bb80d337a7ea9b029a | https://github.com/yanni4night/jsdoc/blob/76a0804cfc96b267061079bb80d337a7ea9b029a/src/jsdoc.js#L209-L248 | train | |
mode777/page-gen | js/index.js | createPage | function createPage(filename) {
let page = {
path: filename,
rawContent: fs.readFileSync(filename, "utf8"),
name: path.basename(filename).replace(/\.[^/.]+$/, ""),
filename: path.basename(filename),
folder: path.dirname(filename),
ext: path... | javascript | function createPage(filename) {
let page = {
path: filename,
rawContent: fs.readFileSync(filename, "utf8"),
name: path.basename(filename).replace(/\.[^/.]+$/, ""),
filename: path.basename(filename),
folder: path.dirname(filename),
ext: path... | [
"function",
"createPage",
"(",
"filename",
")",
"{",
"let",
"page",
"=",
"{",
"path",
":",
"filename",
",",
"rawContent",
":",
"fs",
".",
"readFileSync",
"(",
"filename",
",",
"\"utf8\"",
")",
",",
"name",
":",
"path",
".",
"basename",
"(",
"filename",
... | Create page-templates | [
"Create",
"page",
"-",
"templates"
] | bf7e15187f12f554c46c9a2b9759a97bd5220721 | https://github.com/mode777/page-gen/blob/bf7e15187f12f554c46c9a2b9759a97bd5220721/js/index.js#L74-L91 | train |
kmalakoff/knockback-inspector | vendor/backbone-relational-0.6.0.js | function( model ) {
model.unbind( 'destroy', this.unregister );
var coll = this.getCollection( model );
coll && coll.remove( model );
} | javascript | function( model ) {
model.unbind( 'destroy', this.unregister );
var coll = this.getCollection( model );
coll && coll.remove( model );
} | [
"function",
"(",
"model",
")",
"{",
"model",
".",
"unbind",
"(",
"'destroy'",
",",
"this",
".",
"unregister",
")",
";",
"var",
"coll",
"=",
"this",
".",
"getCollection",
"(",
"model",
")",
";",
"coll",
"&&",
"coll",
".",
"remove",
"(",
"model",
")",
... | Remove a 'model' from the store.
@param {Backbone.RelationalModel} model | [
"Remove",
"a",
"model",
"from",
"the",
"store",
"."
] | 9c3f6dbdc490c8a799e199f1925485055fccac42 | https://github.com/kmalakoff/knockback-inspector/blob/9c3f6dbdc490c8a799e199f1925485055fccac42/vendor/backbone-relational-0.6.0.js#L367-L371 | train | |
kmalakoff/knockback-inspector | vendor/backbone-relational-0.6.0.js | function( collection ) {
if ( this.related ) {
this.related
.unbind( 'relational:add', this.handleAddition )
.unbind( 'relational:remove', this.handleRemoval )
.unbind( 'relational:reset', this.handleReset )
}
if ( !collection || !( collection instanceof Backbone.Collection ) ) {
collec... | javascript | function( collection ) {
if ( this.related ) {
this.related
.unbind( 'relational:add', this.handleAddition )
.unbind( 'relational:remove', this.handleRemoval )
.unbind( 'relational:reset', this.handleReset )
}
if ( !collection || !( collection instanceof Backbone.Collection ) ) {
collec... | [
"function",
"(",
"collection",
")",
"{",
"if",
"(",
"this",
".",
"related",
")",
"{",
"this",
".",
"related",
".",
"unbind",
"(",
"'relational:add'",
",",
"this",
".",
"handleAddition",
")",
".",
"unbind",
"(",
"'relational:remove'",
",",
"this",
".",
"h... | Bind events and setup collectionKeys for a collection that is to be used as the backing store for a HasMany.
If no 'collection' is supplied, a new collection will be created of the specified 'collectionType' option.
@param {Backbone.Collection} [collection] | [
"Bind",
"events",
"and",
"setup",
"collectionKeys",
"for",
"a",
"collection",
"that",
"is",
"to",
"be",
"used",
"as",
"the",
"backing",
"store",
"for",
"a",
"HasMany",
".",
"If",
"no",
"collection",
"is",
"supplied",
"a",
"new",
"collection",
"will",
"be",... | 9c3f6dbdc490c8a799e199f1925485055fccac42 | https://github.com/kmalakoff/knockback-inspector/blob/9c3f6dbdc490c8a799e199f1925485055fccac42/vendor/backbone-relational-0.6.0.js#L804-L837 | train | |
kmalakoff/knockback-inspector | vendor/backbone-relational-0.6.0.js | function( attributes, options ) {
var model = this;
// 'build' is a possible entrypoint; it's possible no model hierarchy has been determined yet.
this.initializeModelHierarchy();
// Determine what type of (sub)model should be built if applicable.
// Lookup the proper subModelType in 'this._subModels'.... | javascript | function( attributes, options ) {
var model = this;
// 'build' is a possible entrypoint; it's possible no model hierarchy has been determined yet.
this.initializeModelHierarchy();
// Determine what type of (sub)model should be built if applicable.
// Lookup the proper subModelType in 'this._subModels'.... | [
"function",
"(",
"attributes",
",",
"options",
")",
"{",
"var",
"model",
"=",
"this",
";",
"// 'build' is a possible entrypoint; it's possible no model hierarchy has been determined yet.",
"this",
".",
"initializeModelHierarchy",
"(",
")",
";",
"// Determine what type of (sub)m... | Create a 'Backbone.Model' instance based on 'attributes'.
@param {Object} attributes
@param {Object} [options]
@return {Backbone.Model} | [
"Create",
"a",
"Backbone",
".",
"Model",
"instance",
"based",
"on",
"attributes",
"."
] | 9c3f6dbdc490c8a799e199f1925485055fccac42 | https://github.com/kmalakoff/knockback-inspector/blob/9c3f6dbdc490c8a799e199f1925485055fccac42/vendor/backbone-relational-0.6.0.js#L1450-L1467 | train | |
ReaxDev/accessible-bootstrap3 | index.js | function (element) {
var event = document.createEvent('MouseEvents');
event.initMouseEvent('mousedown', true, true, window);
element.dispatchEvent(event);
} | javascript | function (element) {
var event = document.createEvent('MouseEvents');
event.initMouseEvent('mousedown', true, true, window);
element.dispatchEvent(event);
} | [
"function",
"(",
"element",
")",
"{",
"var",
"event",
"=",
"document",
".",
"createEvent",
"(",
"'MouseEvents'",
")",
";",
"event",
".",
"initMouseEvent",
"(",
"'mousedown'",
",",
"true",
",",
"true",
",",
"window",
")",
";",
"element",
".",
"dispatchEvent... | click element with virtual mouse. | [
"click",
"element",
"with",
"virtual",
"mouse",
"."
] | 7a9c0c904f27a0524d6e1c53deacdd6437a6837d | https://github.com/ReaxDev/accessible-bootstrap3/blob/7a9c0c904f27a0524d6e1c53deacdd6437a6837d/index.js#L160-L164 | train | |
ReaxDev/accessible-bootstrap3 | index.js | function(event) {
var inputs = $(event.target).parents("form").eq(0).find(":input:visible");
var inputIndex = inputs.index(event.target);
// If at end of focusable elements return false, if not move forward one.
if (inputIndex == inputs.length - 1) {
// return false on last form input so we know t... | javascript | function(event) {
var inputs = $(event.target).parents("form").eq(0).find(":input:visible");
var inputIndex = inputs.index(event.target);
// If at end of focusable elements return false, if not move forward one.
if (inputIndex == inputs.length - 1) {
// return false on last form input so we know t... | [
"function",
"(",
"event",
")",
"{",
"var",
"inputs",
"=",
"$",
"(",
"event",
".",
"target",
")",
".",
"parents",
"(",
"\"form\"",
")",
".",
"eq",
"(",
"0",
")",
".",
"find",
"(",
"\":input:visible\"",
")",
";",
"var",
"inputIndex",
"=",
"inputs",
"... | Move tab index forward one input inside the form an event originates. | [
"Move",
"tab",
"index",
"forward",
"one",
"input",
"inside",
"the",
"form",
"an",
"event",
"originates",
"."
] | 7a9c0c904f27a0524d6e1c53deacdd6437a6837d | https://github.com/ReaxDev/accessible-bootstrap3/blob/7a9c0c904f27a0524d6e1c53deacdd6437a6837d/index.js#L167-L175 | train | |
robzolkos/courier_finder | couriers/australia_post/index.js | valid | function valid(connote) {
if (typeof connote != "string") {
return false;
}
connote = connote.trim().toUpperCase();
// handle 14 character couriers please
if (connote.length === 14 && connote.indexOf("CP") === 0) {
return false;
}
return [10, 14, 18, 21, 39, 40].indexOf(connote.length) != -1;
} | javascript | function valid(connote) {
if (typeof connote != "string") {
return false;
}
connote = connote.trim().toUpperCase();
// handle 14 character couriers please
if (connote.length === 14 && connote.indexOf("CP") === 0) {
return false;
}
return [10, 14, 18, 21, 39, 40].indexOf(connote.length) != -1;
} | [
"function",
"valid",
"(",
"connote",
")",
"{",
"if",
"(",
"typeof",
"connote",
"!=",
"\"string\"",
")",
"{",
"return",
"false",
";",
"}",
"connote",
"=",
"connote",
".",
"trim",
"(",
")",
".",
"toUpperCase",
"(",
")",
";",
"// handle 14 character couriers ... | AustraliaPost connotes are various lengths | [
"AustraliaPost",
"connotes",
"are",
"various",
"lengths"
] | b5e5d43ce3329569270fb0e7765d49697ba25e87 | https://github.com/robzolkos/courier_finder/blob/b5e5d43ce3329569270fb0e7765d49697ba25e87/couriers/australia_post/index.js#L6-L19 | train |
mayanklahiri/node-runtype | lib/enforce.js | enforce | function enforce(targetFunction) {
assert(_.isFunction(targetFunction), 'argument to wrap must be a function');
assert(
_.isObject(targetFunction.$schema),
`Function "${targetFunction.name}" has no $schema property.`);
assert(
_.isArray(targetFunction.$schema.arguments),
`Function "${targetFunctio... | javascript | function enforce(targetFunction) {
assert(_.isFunction(targetFunction), 'argument to wrap must be a function');
assert(
_.isObject(targetFunction.$schema),
`Function "${targetFunction.name}" has no $schema property.`);
assert(
_.isArray(targetFunction.$schema.arguments),
`Function "${targetFunctio... | [
"function",
"enforce",
"(",
"targetFunction",
")",
"{",
"assert",
"(",
"_",
".",
"isFunction",
"(",
"targetFunction",
")",
",",
"'argument to wrap must be a function'",
")",
";",
"assert",
"(",
"_",
".",
"isObject",
"(",
"targetFunction",
".",
"$schema",
")",
... | Wraps an asychronous function with runtime type argument and return value
type checking.
@param {function} targetFunction The asynchronous function to wrap;
its last argument must be a callback function.
@return {function} An asynchronous function that will synchronously throw
on argument errors, or pass a type-checki... | [
"Wraps",
"an",
"asychronous",
"function",
"with",
"runtime",
"type",
"argument",
"and",
"return",
"value",
"type",
"checking",
"."
] | efcf457ae797535b0e6e98bbeac461e66327c88e | https://github.com/mayanklahiri/node-runtype/blob/efcf457ae797535b0e6e98bbeac461e66327c88e/lib/enforce.js#L16-L106 | train |
mayanklahiri/node-runtype | lib/enforce.js | wrappedFunc | function wrappedFunc(...args) {
if (!args.length) {
throw new Error(
`Function "${fnName}" invoked without arguments, callback required.`);
}
//
// Splice callback out of arguments array.
//
let originalCb = _.last(args);
assert(
_.isFunction(originalCb),
`Function... | javascript | function wrappedFunc(...args) {
if (!args.length) {
throw new Error(
`Function "${fnName}" invoked without arguments, callback required.`);
}
//
// Splice callback out of arguments array.
//
let originalCb = _.last(args);
assert(
_.isFunction(originalCb),
`Function... | [
"function",
"wrappedFunc",
"(",
"...",
"args",
")",
"{",
"if",
"(",
"!",
"args",
".",
"length",
")",
"{",
"throw",
"new",
"Error",
"(",
"`",
"${",
"fnName",
"}",
"`",
")",
";",
"}",
"//",
"// Splice callback out of arguments array.",
"//",
"let",
"origin... | Return wrapped function, executes in a new context.. | [
"Return",
"wrapped",
"function",
"executes",
"in",
"a",
"new",
"context",
".."
] | efcf457ae797535b0e6e98bbeac461e66327c88e | https://github.com/mayanklahiri/node-runtype/blob/efcf457ae797535b0e6e98bbeac461e66327c88e/lib/enforce.js#L31-L102 | train |
hl198181/neptune | misc/demo/public/vendor/angular-ui-tree/angular-ui-tree.js | countSubTreeDepth | function countSubTreeDepth(scope) {
var thisLevelDepth = 0,
childNodes = scope.childNodes(),
childNode,
childDepth,
i;
if (!childNodes || childNodes.length === 0) {
return 0;
}
for (i = childNodes.length - 1; i >... | javascript | function countSubTreeDepth(scope) {
var thisLevelDepth = 0,
childNodes = scope.childNodes(),
childNode,
childDepth,
i;
if (!childNodes || childNodes.length === 0) {
return 0;
}
for (i = childNodes.length - 1; i >... | [
"function",
"countSubTreeDepth",
"(",
"scope",
")",
"{",
"var",
"thisLevelDepth",
"=",
"0",
",",
"childNodes",
"=",
"scope",
".",
"childNodes",
"(",
")",
",",
"childNode",
",",
"childDepth",
",",
"i",
";",
"if",
"(",
"!",
"childNodes",
"||",
"childNodes",
... | Returns the depth of the deepest subtree under this node
@param scope a TreeNodesController scope object
@returns Depth of all nodes *beneath* this node. If scope belongs to a leaf node, the
result is 0 (it has no subtree). | [
"Returns",
"the",
"depth",
"of",
"the",
"deepest",
"subtree",
"under",
"this",
"node"
] | 88030bb4222945900e6a225469380cc43a016c13 | https://github.com/hl198181/neptune/blob/88030bb4222945900e6a225469380cc43a016c13/misc/demo/public/vendor/angular-ui-tree/angular-ui-tree.js#L162-L177 | train |
hl198181/neptune | misc/demo/public/vendor/angular-ui-tree/angular-ui-tree.js | function (parent, siblings, index) {
this.parent = parent;
this.siblings = siblings.slice(0);
// If source node is in the target nodes
var i = this.siblings.indexOf(this.source);
if (i > -1) {
this.siblings.splice(i, 1);
... | javascript | function (parent, siblings, index) {
this.parent = parent;
this.siblings = siblings.slice(0);
// If source node is in the target nodes
var i = this.siblings.indexOf(this.source);
if (i > -1) {
this.siblings.splice(i, 1);
... | [
"function",
"(",
"parent",
",",
"siblings",
",",
"index",
")",
"{",
"this",
".",
"parent",
"=",
"parent",
";",
"this",
".",
"siblings",
"=",
"siblings",
".",
"slice",
"(",
"0",
")",
";",
"// If source node is in the target nodes",
"var",
"i",
"=",
"this",
... | Move the node to a new position | [
"Move",
"the",
"node",
"to",
"a",
"new",
"position"
] | 88030bb4222945900e6a225469380cc43a016c13 | https://github.com/hl198181/neptune/blob/88030bb4222945900e6a225469380cc43a016c13/misc/demo/public/vendor/angular-ui-tree/angular-ui-tree.js#L1181-L1196 | train | |
mgesmundo/multicast-events | lib/multicast-events.js | encrypt | function encrypt(message) {
if (this.secure && this.cipher && this.secret) {
if (this.secret === 'secret') {
console.warn('PLEASE change default secret password!');
}
debug('%s encrypt message with %s', this.name, this.cipher);
var cipher = crypto.createCipher(this.cipher, this.secret);
retu... | javascript | function encrypt(message) {
if (this.secure && this.cipher && this.secret) {
if (this.secret === 'secret') {
console.warn('PLEASE change default secret password!');
}
debug('%s encrypt message with %s', this.name, this.cipher);
var cipher = crypto.createCipher(this.cipher, this.secret);
retu... | [
"function",
"encrypt",
"(",
"message",
")",
"{",
"if",
"(",
"this",
".",
"secure",
"&&",
"this",
".",
"cipher",
"&&",
"this",
".",
"secret",
")",
"{",
"if",
"(",
"this",
".",
"secret",
"===",
"'secret'",
")",
"{",
"console",
".",
"warn",
"(",
"'PLE... | Encrypt a message
@param {Buffer} message The message to encrypt
@return {Buffer} The encrypted message
@ignore | [
"Encrypt",
"a",
"message"
] | 1e6d0a9828ec82ec5854af82c13ae9a7c554ff35 | https://github.com/mgesmundo/multicast-events/blob/1e6d0a9828ec82ec5854af82c13ae9a7c554ff35/lib/multicast-events.js#L93-L103 | train |
mgesmundo/multicast-events | lib/multicast-events.js | decrypt | function decrypt(message) {
if (this.secure && this.cipher && this.secret) {
if (this.secret === 'secret') {
console.warn('PLEASE change default secret password!');
}
debug('%s decrypt message with %s', this.name, this.cipher);
var decipher = crypto.createDecipher(this.cipher, this.secret);
... | javascript | function decrypt(message) {
if (this.secure && this.cipher && this.secret) {
if (this.secret === 'secret') {
console.warn('PLEASE change default secret password!');
}
debug('%s decrypt message with %s', this.name, this.cipher);
var decipher = crypto.createDecipher(this.cipher, this.secret);
... | [
"function",
"decrypt",
"(",
"message",
")",
"{",
"if",
"(",
"this",
".",
"secure",
"&&",
"this",
".",
"cipher",
"&&",
"this",
".",
"secret",
")",
"{",
"if",
"(",
"this",
".",
"secret",
"===",
"'secret'",
")",
"{",
"console",
".",
"warn",
"(",
"'PLE... | Decrypt a message
@param {Buffer} message The encrypted message
@return {Buffer} The decrypted buffer
@ignore | [
"Decrypt",
"a",
"message"
] | 1e6d0a9828ec82ec5854af82c13ae9a7c554ff35 | https://github.com/mgesmundo/multicast-events/blob/1e6d0a9828ec82ec5854af82c13ae9a7c554ff35/lib/multicast-events.js#L111-L121 | train |
mgesmundo/multicast-events | lib/multicast-events.js | verifyAddress | function verifyAddress(address) {
var ifs = os.networkInterfaces();
var nics = Object.keys(ifs);
var i, j, match = false;
nicLoop:
for (i = 0; i < nics.length; i++) {
var nic = ifs[nics[i]];
for (j = 0; j < nic.length; j++) {
if (nic[j].address === address && !nic[j].internal) {
... | javascript | function verifyAddress(address) {
var ifs = os.networkInterfaces();
var nics = Object.keys(ifs);
var i, j, match = false;
nicLoop:
for (i = 0; i < nics.length; i++) {
var nic = ifs[nics[i]];
for (j = 0; j < nic.length; j++) {
if (nic[j].address === address && !nic[j].internal) {
... | [
"function",
"verifyAddress",
"(",
"address",
")",
"{",
"var",
"ifs",
"=",
"os",
".",
"networkInterfaces",
"(",
")",
";",
"var",
"nics",
"=",
"Object",
".",
"keys",
"(",
"ifs",
")",
";",
"var",
"i",
",",
"j",
",",
"match",
"=",
"false",
";",
"nicLoo... | Verify that a provided address is configured on a NIC
@param {String} address The address to verify
@return {Boolean} True if the address is configured on a NIC | [
"Verify",
"that",
"a",
"provided",
"address",
"is",
"configured",
"on",
"a",
"NIC"
] | 1e6d0a9828ec82ec5854af82c13ae9a7c554ff35 | https://github.com/mgesmundo/multicast-events/blob/1e6d0a9828ec82ec5854af82c13ae9a7c554ff35/lib/multicast-events.js#L148-L163 | train |
mnichols/ankh | lib/registrations.js | flatten | function flatten(arr) {
return arr.reduce(function (flat, toFlatten) {
// See if this index is an array that itself needs to be flattened.
if(toFlatten.some && toFlatten.some(Array.isArray)) {
return flat.concat(flatten(toFlatten));
// Otherwise just add the current index to ... | javascript | function flatten(arr) {
return arr.reduce(function (flat, toFlatten) {
// See if this index is an array that itself needs to be flattened.
if(toFlatten.some && toFlatten.some(Array.isArray)) {
return flat.concat(flatten(toFlatten));
// Otherwise just add the current index to ... | [
"function",
"flatten",
"(",
"arr",
")",
"{",
"return",
"arr",
".",
"reduce",
"(",
"function",
"(",
"flat",
",",
"toFlatten",
")",
"{",
"// See if this index is an array that itself needs to be flattened.",
"if",
"(",
"toFlatten",
".",
"some",
"&&",
"toFlatten",
".... | flattens array of arrays of arrays... | [
"flattens",
"array",
"of",
"arrays",
"of",
"arrays",
"..."
] | b5f6eae24b2dece4025b4f11cea7f1560d3b345f | https://github.com/mnichols/ankh/blob/b5f6eae24b2dece4025b4f11cea7f1560d3b345f/lib/registrations.js#L26-L36 | train |
mnichols/ankh | lib/registrations.js | Registrations | function Registrations() {
Object.defineProperty(this,'_registrations',{
value: {}
,enumerable: false
,configurable: false
,writable: false
})
this.get = this.get.bind(this)
this.put = this.put.bind(this)
this.clear = this.clear.bind(this)
this.has = this.has.bind... | javascript | function Registrations() {
Object.defineProperty(this,'_registrations',{
value: {}
,enumerable: false
,configurable: false
,writable: false
})
this.get = this.get.bind(this)
this.put = this.put.bind(this)
this.clear = this.clear.bind(this)
this.has = this.has.bind... | [
"function",
"Registrations",
"(",
")",
"{",
"Object",
".",
"defineProperty",
"(",
"this",
",",
"'_registrations'",
",",
"{",
"value",
":",
"{",
"}",
",",
"enumerable",
":",
"false",
",",
"configurable",
":",
"false",
",",
"writable",
":",
"false",
"}",
"... | Registrations collection stores all configurations
created for the container to resolve at runtime | [
"Registrations",
"collection",
"stores",
"all",
"configurations",
"created",
"for",
"the",
"container",
"to",
"resolve",
"at",
"runtime"
] | b5f6eae24b2dece4025b4f11cea7f1560d3b345f | https://github.com/mnichols/ankh/blob/b5f6eae24b2dece4025b4f11cea7f1560d3b345f/lib/registrations.js#L41-L52 | train |
KonstantinKo/rform | src/containers/Form.js | assembleAttrsFromServer | function assembleAttrsFromServer(seedData, formObjectClass) {
// Early return when there was no serialized object provided by the server
if (!seedData) { return {} }
// Otherwise assemble main and submodels' fields
let attrs = merge({}, seedData.fields, seedData.errors)
// TODO: reenable this, but consider t... | javascript | function assembleAttrsFromServer(seedData, formObjectClass) {
// Early return when there was no serialized object provided by the server
if (!seedData) { return {} }
// Otherwise assemble main and submodels' fields
let attrs = merge({}, seedData.fields, seedData.errors)
// TODO: reenable this, but consider t... | [
"function",
"assembleAttrsFromServer",
"(",
"seedData",
",",
"formObjectClass",
")",
"{",
"// Early return when there was no serialized object provided by the server",
"if",
"(",
"!",
"seedData",
")",
"{",
"return",
"{",
"}",
"}",
"// Otherwise assemble main and submodels' fiel... | the values we want from the server-provided serialized object are nested under `fields`. The same is true for included submodels. | [
"the",
"values",
"we",
"want",
"from",
"the",
"server",
"-",
"provided",
"serialized",
"object",
"are",
"nested",
"under",
"fields",
".",
"The",
"same",
"is",
"true",
"for",
"included",
"submodels",
"."
] | 35213340dc8e792583ff4f089a62e2dfa60c5657 | https://github.com/KonstantinKo/rform/blob/35213340dc8e792583ff4f089a62e2dfa60c5657/src/containers/Form.js#L58-L72 | train |
CCISEL/connect-controller | lib/connectController.js | addCtrActionsToRouter | function addCtrActionsToRouter(ctr, router, name, options) {
for(let prop in ctr) {
if(ctr[prop] instanceof Function) {
const info = new RouteInfo(ctr, name, prop, ctr[prop], options)
/**
* e.g. router.get(path, Middleware).
*/
const path ... | javascript | function addCtrActionsToRouter(ctr, router, name, options) {
for(let prop in ctr) {
if(ctr[prop] instanceof Function) {
const info = new RouteInfo(ctr, name, prop, ctr[prop], options)
/**
* e.g. router.get(path, Middleware).
*/
const path ... | [
"function",
"addCtrActionsToRouter",
"(",
"ctr",
",",
"router",
",",
"name",
",",
"options",
")",
"{",
"for",
"(",
"let",
"prop",
"in",
"ctr",
")",
"{",
"if",
"(",
"ctr",
"[",
"prop",
"]",
"instanceof",
"Function",
")",
"{",
"const",
"info",
"=",
"ne... | For each method of ctr object creates a new Middleware that
is added to router argument.
Route, query or body parameters are automatically mapped
to method arguments.
@param {Object} ctr Controller instance
@param {Router} router express.Router instance
@param {String} name controller name
@param {Object} options objec... | [
"For",
"each",
"method",
"of",
"ctr",
"object",
"creates",
"a",
"new",
"Middleware",
"that",
"is",
"added",
"to",
"router",
"argument",
".",
"Route",
"query",
"or",
"body",
"parameters",
"are",
"automatically",
"mapped",
"to",
"method",
"arguments",
"."
] | c8e2587c5a31e3cb54e3668c4b98b7b7526d69b4 | https://github.com/CCISEL/connect-controller/blob/c8e2587c5a31e3cb54e3668c4b98b7b7526d69b4/lib/connectController.js#L69-L83 | train |
sittingbool/sbool-node-utils | util/configLoader.js | function( path) {
var stat = null;
try {
stat = fs.statSync( path );
} catch (err) {
console.log(err);
}
return ( stat && stat.isFile() );
} | javascript | function( path) {
var stat = null;
try {
stat = fs.statSync( path );
} catch (err) {
console.log(err);
}
return ( stat && stat.isFile() );
} | [
"function",
"(",
"path",
")",
"{",
"var",
"stat",
"=",
"null",
";",
"try",
"{",
"stat",
"=",
"fs",
".",
"statSync",
"(",
"path",
")",
";",
"}",
"catch",
"(",
"err",
")",
"{",
"console",
".",
"log",
"(",
"err",
")",
";",
"}",
"return",
"(",
"s... | Loads config file with many options
@param configDir - directory which should be used for
@param options - object that can take following parameters:
configEnvironmentVar: key that is used on process.env[<key>] to use it as oath to config directory
subDirPath: path within the directory loaded over configEnvironmentVa... | [
"Loads",
"config",
"file",
"with",
"many",
"options"
] | 30a5b71bc258b160883451ede8c6c3991294fd68 | https://github.com/sittingbool/sbool-node-utils/blob/30a5b71bc258b160883451ede8c6c3991294fd68/util/configLoader.js#L24-L35 | train | |
joshwnj/marki | src/setup-highlighter.js | loadHighlighter | function loadHighlighter () {
var headElem = d.querySelector('head');
headElem.appendChild(h('link', {
rel: 'stylesheet',
href: 'http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/default.min.css'
}));
headElem.appendChild(h('script', {
src: 'http://cdnjs.cloudflare.com/ajax/libs/highli... | javascript | function loadHighlighter () {
var headElem = d.querySelector('head');
headElem.appendChild(h('link', {
rel: 'stylesheet',
href: 'http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/default.min.css'
}));
headElem.appendChild(h('script', {
src: 'http://cdnjs.cloudflare.com/ajax/libs/highli... | [
"function",
"loadHighlighter",
"(",
")",
"{",
"var",
"headElem",
"=",
"d",
".",
"querySelector",
"(",
"'head'",
")",
";",
"headElem",
".",
"appendChild",
"(",
"h",
"(",
"'link'",
",",
"{",
"rel",
":",
"'stylesheet'",
",",
"href",
":",
"'http://cdnjs.cloudf... | load syntax highlighting code | [
"load",
"syntax",
"highlighting",
"code"
] | 1809630593c74b38313add82d54f88491e00cd4f | https://github.com/joshwnj/marki/blob/1809630593c74b38313add82d54f88491e00cd4f/src/setup-highlighter.js#L5-L23 | train |
fibo/algebra-ring | algebra-ring.js | algebraRing | function algebraRing (identities, given) {
// A ring is a group, with multiplication.
const ring = group({
identity: identities[0],
contains: given.contains,
equality: given.equality,
compositionLaw: given.addition,
inversion: given.negation
})
// operators
function multiplication () {
... | javascript | function algebraRing (identities, given) {
// A ring is a group, with multiplication.
const ring = group({
identity: identities[0],
contains: given.contains,
equality: given.equality,
compositionLaw: given.addition,
inversion: given.negation
})
// operators
function multiplication () {
... | [
"function",
"algebraRing",
"(",
"identities",
",",
"given",
")",
"{",
"// A ring is a group, with multiplication.",
"const",
"ring",
"=",
"group",
"(",
"{",
"identity",
":",
"identities",
"[",
"0",
"]",
",",
"contains",
":",
"given",
".",
"contains",
",",
"equ... | Define an algebra ring structure
@param {Array} identities
@param {*} identities[0] a.k.a zero
@param {*} identities[1] a.k.a uno
@param {Object} given operator functions
@param {Function} given.contains
@param {Function} given.equality
@param {Function} given.addition
@param {Function} given.negation
@param... | [
"Define",
"an",
"algebra",
"ring",
"structure"
] | 5fb3c6e88e6ded23f20b478eb5aeb1ff142a59a4 | https://github.com/fibo/algebra-ring/blob/5fb3c6e88e6ded23f20b478eb5aeb1ff142a59a4/algebra-ring.js#L37-L92 | train |
substance/converter | src/converter.js | __pandocAvailable | function __pandocAvailable(cb) {
var test = spawn('pandoc', ['--help']);
test.on('error', function() {
console.error('Pandoc not found');
cb('Pandoc not found');
});
test.on('exit', function() { cb(null); });
test.stdin.end();
} | javascript | function __pandocAvailable(cb) {
var test = spawn('pandoc', ['--help']);
test.on('error', function() {
console.error('Pandoc not found');
cb('Pandoc not found');
});
test.on('exit', function() { cb(null); });
test.stdin.end();
} | [
"function",
"__pandocAvailable",
"(",
"cb",
")",
"{",
"var",
"test",
"=",
"spawn",
"(",
"'pandoc'",
",",
"[",
"'--help'",
"]",
")",
";",
"test",
".",
"on",
"(",
"'error'",
",",
"function",
"(",
")",
"{",
"console",
".",
"error",
"(",
"'Pandoc not found... | Checks if the pandoc tool is available | [
"Checks",
"if",
"the",
"pandoc",
"tool",
"is",
"available"
] | d98f4d531a339cada47ac6329cec4b7aaacb1605 | https://github.com/substance/converter/blob/d98f4d531a339cada47ac6329cec4b7aaacb1605/src/converter.js#L30-L38 | train |
RnbWd/parse-browserify | lib/facebook.js | function(user, permissions, options) {
if (!permissions || _.isString(permissions)) {
if (!initialized) {
throw "You must initialize FacebookUtils before calling link.";
}
requestedPermissions = permissions;
return user._linkWith("facebook", options);
} else {
... | javascript | function(user, permissions, options) {
if (!permissions || _.isString(permissions)) {
if (!initialized) {
throw "You must initialize FacebookUtils before calling link.";
}
requestedPermissions = permissions;
return user._linkWith("facebook", options);
} else {
... | [
"function",
"(",
"user",
",",
"permissions",
",",
"options",
")",
"{",
"if",
"(",
"!",
"permissions",
"||",
"_",
".",
"isString",
"(",
"permissions",
")",
")",
"{",
"if",
"(",
"!",
"initialized",
")",
"{",
"throw",
"\"You must initialize FacebookUtils before... | Links Facebook to an existing PFUser. This method delegates to the
Facebook SDK to authenticate the user, and then automatically links
the account to the Parse.User.
@param {Parse.User} user User to link to Facebook. This must be the
current user.
@param {String, Object} permissions The permissions required for Facebo... | [
"Links",
"Facebook",
"to",
"an",
"existing",
"PFUser",
".",
"This",
"method",
"delegates",
"to",
"the",
"Facebook",
"SDK",
"to",
"authenticate",
"the",
"user",
"and",
"then",
"automatically",
"links",
"the",
"account",
"to",
"the",
"Parse",
".",
"User",
"."
... | c19c1b798e4010a552e130b1a9ce3b5d084dc101 | https://github.com/RnbWd/parse-browserify/blob/c19c1b798e4010a552e130b1a9ce3b5d084dc101/lib/facebook.js#L162-L174 | train | |
cli-kit/cli-property | lib/expand.js | expand | function expand(source, opts) {
opts = opts || {};
var re = opts.re = opts.re || '.'
, isre = (re instanceof RegExp)
, o = {}, k, v, parts, i, p;
for(k in source) {
v = source[k];
if(isre ? !re.test(k) : !~k.indexOf(re)) {
o[k] = v;
}else{
parts = k.split(re);
p = o;
fo... | javascript | function expand(source, opts) {
opts = opts || {};
var re = opts.re = opts.re || '.'
, isre = (re instanceof RegExp)
, o = {}, k, v, parts, i, p;
for(k in source) {
v = source[k];
if(isre ? !re.test(k) : !~k.indexOf(re)) {
o[k] = v;
}else{
parts = k.split(re);
p = o;
fo... | [
"function",
"expand",
"(",
"source",
",",
"opts",
")",
"{",
"opts",
"=",
"opts",
"||",
"{",
"}",
";",
"var",
"re",
"=",
"opts",
".",
"re",
"=",
"opts",
".",
"re",
"||",
"'.'",
",",
"isre",
"=",
"(",
"re",
"instanceof",
"RegExp",
")",
",",
"o",
... | Takes a source object with dot-delimited keys
and expands it to a deep object representation.
Such that:
{'obj.field.num': 10}
Becomes:
{obj:{field: {num: 10}}}
Returns the transformed object.
@param source The source object to expand.
@param opts Processing opts.
@param opts.re The string or regexp delimiter
use... | [
"Takes",
"a",
"source",
"object",
"with",
"dot",
"-",
"delimited",
"keys",
"and",
"expands",
"it",
"to",
"a",
"deep",
"object",
"representation",
"."
] | de6f727af1f8fc1f613fe42200c5e070aa6b0b21 | https://github.com/cli-kit/cli-property/blob/de6f727af1f8fc1f613fe42200c5e070aa6b0b21/lib/expand.js#L20-L44 | train |
ugate/releasebot | lib/utils.js | validateFile | function validateFile(path, rollCall) {
var stat = path ? fs.statSync(path) : {
size : 0
};
if (!stat.size) {
rollCall.error('Failed to find any entries in "' + path + '" (file size: ' + stat.size + ')');
return false;
}
return true;
} | javascript | function validateFile(path, rollCall) {
var stat = path ? fs.statSync(path) : {
size : 0
};
if (!stat.size) {
rollCall.error('Failed to find any entries in "' + path + '" (file size: ' + stat.size + ')');
return false;
}
return true;
} | [
"function",
"validateFile",
"(",
"path",
",",
"rollCall",
")",
"{",
"var",
"stat",
"=",
"path",
"?",
"fs",
".",
"statSync",
"(",
"path",
")",
":",
"{",
"size",
":",
"0",
"}",
";",
"if",
"(",
"!",
"stat",
".",
"size",
")",
"{",
"rollCall",
".",
... | Determines if a file has content and logs an error when the the file is empty
@param path
the path to the file
@param the
roll call instance
@returns true when the file contains data or the path is invalid | [
"Determines",
"if",
"a",
"file",
"has",
"content",
"and",
"logs",
"an",
"error",
"when",
"the",
"the",
"file",
"is",
"empty"
] | 1a2ff42796e77f47f9590992c014fee461aad80b | https://github.com/ugate/releasebot/blob/1a2ff42796e77f47f9590992c014fee461aad80b/lib/utils.js#L85-L94 | train |
ugate/releasebot | lib/utils.js | updateFiles | function updateFiles(files, func, bpath, eh) {
try {
if (Array.isArray(files) && typeof func === 'function') {
for (var i = 0; i < files.length; i++) {
var p = path.join(bpath, files[i]), au = '';
var content = rbot.file.read(p, {
encoding : rbot.file.defaultEncoding
});
var ec = func(content... | javascript | function updateFiles(files, func, bpath, eh) {
try {
if (Array.isArray(files) && typeof func === 'function') {
for (var i = 0; i < files.length; i++) {
var p = path.join(bpath, files[i]), au = '';
var content = rbot.file.read(p, {
encoding : rbot.file.defaultEncoding
});
var ec = func(content... | [
"function",
"updateFiles",
"(",
"files",
",",
"func",
",",
"bpath",
",",
"eh",
")",
"{",
"try",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"files",
")",
"&&",
"typeof",
"func",
"===",
"'function'",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
"... | Updates file contents using a specified function
@param files
the {Array} of files to read/write
@param func
the function to call for the read/write operation
@param bpath
the base path to that will be used to prefix each file used in the
update process
@param eh
an optional function that will be called when the updat... | [
"Updates",
"file",
"contents",
"using",
"a",
"specified",
"function"
] | 1a2ff42796e77f47f9590992c014fee461aad80b | https://github.com/ugate/releasebot/blob/1a2ff42796e77f47f9590992c014fee461aad80b/lib/utils.js#L110-L131 | train |
sdgluck/pick-to-array | index.js | pickToArray | function pickToArray (entities, property, deep) {
if (!(entities instanceof Array) && !isPlainObject(entities)) {
throw new Error('Expecting entity to be object or array of objects')
} else if (typeof property !== 'string' && !(property instanceof Array)) {
throw new Error('Expecting property to be string o... | javascript | function pickToArray (entities, property, deep) {
if (!(entities instanceof Array) && !isPlainObject(entities)) {
throw new Error('Expecting entity to be object or array of objects')
} else if (typeof property !== 'string' && !(property instanceof Array)) {
throw new Error('Expecting property to be string o... | [
"function",
"pickToArray",
"(",
"entities",
",",
"property",
",",
"deep",
")",
"{",
"if",
"(",
"!",
"(",
"entities",
"instanceof",
"Array",
")",
"&&",
"!",
"isPlainObject",
"(",
"entities",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Expecting entity to... | Pick the value of the `property` property from each object in `entities`.
Operation is recursive with `deep == true`.
@param {Array|Object} entities An array of objects or a single object
@param {String|Array} property Property name(s) to pick
@param {Boolean} [deep] Pick from nested properties, default false
@returns ... | [
"Pick",
"the",
"value",
"of",
"the",
"property",
"property",
"from",
"each",
"object",
"in",
"entities",
".",
"Operation",
"is",
"recursive",
"with",
"deep",
"==",
"true",
"."
] | b496e27770b41ad9aa1260390664b1c282498a34 | https://github.com/sdgluck/pick-to-array/blob/b496e27770b41ad9aa1260390664b1c282498a34/index.js#L35-L66 | train |
rxaviers/builder-amd-css | bower_components/require-css/css-builder.js | loadFile | function loadFile(path) {
if ( config.asReference && config.asReference.loadFile ) {
return config.asReference.loadFile( path );
} else if (typeof process !== "undefined" && process.versions && !!process.versions.node && require.nodeRequire) {
var fs = require.nodeRequire('fs');
var file = fs.... | javascript | function loadFile(path) {
if ( config.asReference && config.asReference.loadFile ) {
return config.asReference.loadFile( path );
} else if (typeof process !== "undefined" && process.versions && !!process.versions.node && require.nodeRequire) {
var fs = require.nodeRequire('fs');
var file = fs.... | [
"function",
"loadFile",
"(",
"path",
")",
"{",
"if",
"(",
"config",
".",
"asReference",
"&&",
"config",
".",
"asReference",
".",
"loadFile",
")",
"{",
"return",
"config",
".",
"asReference",
".",
"loadFile",
"(",
"path",
")",
";",
"}",
"else",
"if",
"(... | load file code - stolen from text plugin | [
"load",
"file",
"code",
"-",
"stolen",
"from",
"text",
"plugin"
] | ad225d76285a68c5fa750fdc31e2f2c7365aa8b3 | https://github.com/rxaviers/builder-amd-css/blob/ad225d76285a68c5fa750fdc31e2f2c7365aa8b3/bower_components/require-css/css-builder.js#L35-L65 | train |
rxaviers/builder-amd-css | bower_components/require-css/css-builder.js | escape | function escape(content) {
return content.replace(/(["'\\])/g, '\\$1')
.replace(/[\f]/g, "\\f")
.replace(/[\b]/g, "\\b")
.replace(/[\n]/g, "\\n")
.replace(/[\t]/g, "\\t")
.replace(/[\r]/g, "\\r");
} | javascript | function escape(content) {
return content.replace(/(["'\\])/g, '\\$1')
.replace(/[\f]/g, "\\f")
.replace(/[\b]/g, "\\b")
.replace(/[\n]/g, "\\n")
.replace(/[\t]/g, "\\t")
.replace(/[\r]/g, "\\r");
} | [
"function",
"escape",
"(",
"content",
")",
"{",
"return",
"content",
".",
"replace",
"(",
"/",
"([\"'\\\\])",
"/",
"g",
",",
"'\\\\$1'",
")",
".",
"replace",
"(",
"/",
"[\\f]",
"/",
"g",
",",
"\"\\\\f\"",
")",
".",
"replace",
"(",
"/",
"[\\b]",
"/",
... | when adding to the link buffer, paths are normalised to the baseUrl when removing from the link buffer, paths are normalised to the output file path | [
"when",
"adding",
"to",
"the",
"link",
"buffer",
"paths",
"are",
"normalised",
"to",
"the",
"baseUrl",
"when",
"removing",
"from",
"the",
"link",
"buffer",
"paths",
"are",
"normalised",
"to",
"the",
"output",
"file",
"path"
] | ad225d76285a68c5fa750fdc31e2f2c7365aa8b3 | https://github.com/rxaviers/builder-amd-css/blob/ad225d76285a68c5fa750fdc31e2f2c7365aa8b3/bower_components/require-css/css-builder.js#L91-L98 | train |
agitojs/agito-json-loader | lib/agitoJsonLoader.js | areArgumentsValid | function areArgumentsValid(args) {
var isValid = args.every(function(arg) {
if (Array.isArray(arg)) {
return areArgumentsValid(arg);
}
return (arg !== null && typeof arg === 'object');
});
return isValid;
} | javascript | function areArgumentsValid(args) {
var isValid = args.every(function(arg) {
if (Array.isArray(arg)) {
return areArgumentsValid(arg);
}
return (arg !== null && typeof arg === 'object');
});
return isValid;
} | [
"function",
"areArgumentsValid",
"(",
"args",
")",
"{",
"var",
"isValid",
"=",
"args",
".",
"every",
"(",
"function",
"(",
"arg",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"arg",
")",
")",
"{",
"return",
"areArgumentsValid",
"(",
"arg",
")",
... | Check if the passed arguments are valid. As long as arrays are encountered,
they are recursively checked.
@param {*[]} args - The arguments to check
@return {Boolean} - true when the arguments are correct, otherwise false | [
"Check",
"if",
"the",
"passed",
"arguments",
"are",
"valid",
".",
"As",
"long",
"as",
"arrays",
"are",
"encountered",
"they",
"are",
"recursively",
"checked",
"."
] | 158543455359bcc2bed8cc28c794f9b7b50244aa | https://github.com/agitojs/agito-json-loader/blob/158543455359bcc2bed8cc28c794f9b7b50244aa/lib/agitoJsonLoader.js#L33-L44 | train |
prescottprue/devshare | examples/react/app/containers/Account/Account.js | mapStateToProps | function mapStateToProps (state) {
return {
account: state.account ? state.entities.accounts[state.account.id] : null,
router: state.router
}
} | javascript | function mapStateToProps (state) {
return {
account: state.account ? state.entities.accounts[state.account.id] : null,
router: state.router
}
} | [
"function",
"mapStateToProps",
"(",
"state",
")",
"{",
"return",
"{",
"account",
":",
"state",
".",
"account",
"?",
"state",
".",
"entities",
".",
"accounts",
"[",
"state",
".",
"account",
".",
"id",
"]",
":",
"null",
",",
"router",
":",
"state",
".",
... | Place state of redux store into props of component | [
"Place",
"state",
"of",
"redux",
"store",
"into",
"props",
"of",
"component"
] | 38a7081f210857f2ef106836c30ea404c12c1643 | https://github.com/prescottprue/devshare/blob/38a7081f210857f2ef106836c30ea404c12c1643/examples/react/app/containers/Account/Account.js#L44-L49 | train |
skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/dom/range.js | function() {
var clone = new CKEDITOR.dom.range( this.root );
clone.startContainer = this.startContainer;
clone.startOffset = this.startOffset;
clone.endContainer = this.endContainer;
clone.endOffset = this.endOffset;
clone.collapsed = this.collapsed;
return clone;
} | javascript | function() {
var clone = new CKEDITOR.dom.range( this.root );
clone.startContainer = this.startContainer;
clone.startOffset = this.startOffset;
clone.endContainer = this.endContainer;
clone.endOffset = this.endOffset;
clone.collapsed = this.collapsed;
return clone;
} | [
"function",
"(",
")",
"{",
"var",
"clone",
"=",
"new",
"CKEDITOR",
".",
"dom",
".",
"range",
"(",
"this",
".",
"root",
")",
";",
"clone",
".",
"startContainer",
"=",
"this",
".",
"startContainer",
";",
"clone",
".",
"startOffset",
"=",
"this",
".",
"... | Clones this range.
@returns {CKEDITOR.dom.range} | [
"Clones",
"this",
"range",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/dom/range.js#L460-L470 | train | |
skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/dom/range.js | getLengthOfPrecedingTextNodes | function getLengthOfPrecedingTextNodes( node ) {
var sum = 0;
while ( ( node = node.getPrevious() ) && node.type == CKEDITOR.NODE_TEXT )
sum += node.getLength();
return sum;
} | javascript | function getLengthOfPrecedingTextNodes( node ) {
var sum = 0;
while ( ( node = node.getPrevious() ) && node.type == CKEDITOR.NODE_TEXT )
sum += node.getLength();
return sum;
} | [
"function",
"getLengthOfPrecedingTextNodes",
"(",
"node",
")",
"{",
"var",
"sum",
"=",
"0",
";",
"while",
"(",
"(",
"node",
"=",
"node",
".",
"getPrevious",
"(",
")",
")",
"&&",
"node",
".",
"type",
"==",
"CKEDITOR",
".",
"NODE_TEXT",
")",
"sum",
"+=",... | Sums lengths of all preceding text nodes. | [
"Sums",
"lengths",
"of",
"all",
"preceding",
"text",
"nodes",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/dom/range.js#L647-L654 | train |
skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/dom/range.js | function() {
var startNode = this.startContainer,
endNode = this.endContainer,
startOffset = this.startOffset,
endOffset = this.endOffset,
childCount;
if ( startNode.type == CKEDITOR.NODE_ELEMENT ) {
childCount = startNode.getChildCount();
if ( childCount > startOffset )
startNode = ... | javascript | function() {
var startNode = this.startContainer,
endNode = this.endContainer,
startOffset = this.startOffset,
endOffset = this.endOffset,
childCount;
if ( startNode.type == CKEDITOR.NODE_ELEMENT ) {
childCount = startNode.getChildCount();
if ( childCount > startOffset )
startNode = ... | [
"function",
"(",
")",
"{",
"var",
"startNode",
"=",
"this",
".",
"startContainer",
",",
"endNode",
"=",
"this",
".",
"endContainer",
",",
"startOffset",
"=",
"this",
".",
"startOffset",
",",
"endOffset",
"=",
"this",
".",
"endOffset",
",",
"childCount",
";... | Returns two nodes which are on the boundaries of this range.
@returns {Object}
@returns {CKEDITOR.dom.node} return.startNode
@returns {CKEDITOR.dom.node} return.endNode
@todo precise desc/algorithm | [
"Returns",
"two",
"nodes",
"which",
"are",
"on",
"the",
"boundaries",
"of",
"this",
"range",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/dom/range.js#L769-L818 | train | |
skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/dom/range.js | function( includeSelf, ignoreTextNode ) {
var start = this.startContainer,
end = this.endContainer,
ancestor;
if ( start.equals( end ) ) {
if ( includeSelf && start.type == CKEDITOR.NODE_ELEMENT && this.startOffset == this.endOffset - 1 )
ancestor = start.getChild( this.startOffset );
else
... | javascript | function( includeSelf, ignoreTextNode ) {
var start = this.startContainer,
end = this.endContainer,
ancestor;
if ( start.equals( end ) ) {
if ( includeSelf && start.type == CKEDITOR.NODE_ELEMENT && this.startOffset == this.endOffset - 1 )
ancestor = start.getChild( this.startOffset );
else
... | [
"function",
"(",
"includeSelf",
",",
"ignoreTextNode",
")",
"{",
"var",
"start",
"=",
"this",
".",
"startContainer",
",",
"end",
"=",
"this",
".",
"endContainer",
",",
"ancestor",
";",
"if",
"(",
"start",
".",
"equals",
"(",
"end",
")",
")",
"{",
"if",... | Find the node which fully contains the range.
@param {Boolean} [includeSelf=false]
@param {Boolean} [ignoreTextNode=false] Whether ignore {@link CKEDITOR#NODE_TEXT} type.
@returns {CKEDITOR.dom.element} | [
"Find",
"the",
"node",
"which",
"fully",
"contains",
"the",
"range",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/dom/range.js#L827-L842 | train | |
skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/dom/range.js | getValidEnlargeable | function getValidEnlargeable( enlargeable ) {
return enlargeable && enlargeable.type == CKEDITOR.NODE_ELEMENT && enlargeable.hasAttribute( 'contenteditable' ) ?
null : enlargeable;
} | javascript | function getValidEnlargeable( enlargeable ) {
return enlargeable && enlargeable.type == CKEDITOR.NODE_ELEMENT && enlargeable.hasAttribute( 'contenteditable' ) ?
null : enlargeable;
} | [
"function",
"getValidEnlargeable",
"(",
"enlargeable",
")",
"{",
"return",
"enlargeable",
"&&",
"enlargeable",
".",
"type",
"==",
"CKEDITOR",
".",
"NODE_ELEMENT",
"&&",
"enlargeable",
".",
"hasAttribute",
"(",
"'contenteditable'",
")",
"?",
"null",
":",
"enlargeab... | Ensures that returned element can be enlarged by selection, null otherwise. @param {CKEDITOR.dom.element} enlargeable @returns {CKEDITOR.dom.element/null} | [
"Ensures",
"that",
"returned",
"element",
"can",
"be",
"enlarged",
"by",
"selection",
"null",
"otherwise",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/dom/range.js#L1468-L1471 | train |
skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/dom/range.js | function( mode, selectContents, shrinkOnBlockBoundary ) {
// Unable to shrink a collapsed range.
if ( !this.collapsed ) {
mode = mode || CKEDITOR.SHRINK_TEXT;
var walkerRange = this.clone();
var startContainer = this.startContainer,
endContainer = this.endContainer,
startOffset = this.star... | javascript | function( mode, selectContents, shrinkOnBlockBoundary ) {
// Unable to shrink a collapsed range.
if ( !this.collapsed ) {
mode = mode || CKEDITOR.SHRINK_TEXT;
var walkerRange = this.clone();
var startContainer = this.startContainer,
endContainer = this.endContainer,
startOffset = this.star... | [
"function",
"(",
"mode",
",",
"selectContents",
",",
"shrinkOnBlockBoundary",
")",
"{",
"// Unable to shrink a collapsed range.",
"if",
"(",
"!",
"this",
".",
"collapsed",
")",
"{",
"mode",
"=",
"mode",
"||",
"CKEDITOR",
".",
"SHRINK_TEXT",
";",
"var",
"walkerRa... | Descrease the range to make sure that boundaries
always anchor beside text nodes or innermost element.
@param {Number} mode The shrinking mode ({@link CKEDITOR#SHRINK_ELEMENT} or {@link CKEDITOR#SHRINK_TEXT}).
* {@link CKEDITOR#SHRINK_ELEMENT} - Shrink the range boundaries to the edge of the innermost element.
* {@li... | [
"Descrease",
"the",
"range",
"to",
"make",
"sure",
"that",
"boundaries",
"always",
"anchor",
"beside",
"text",
"nodes",
"or",
"innermost",
"element",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/dom/range.js#L1486-L1572 | train | |
skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/dom/range.js | function( node ) {
this.optimizeBookmark();
this.trim( false, true );
var startContainer = this.startContainer;
var startOffset = this.startOffset;
var nextNode = startContainer.getChild( startOffset );
if ( nextNode )
node.insertBefore( nextNode );
else
startContainer.append( node );
... | javascript | function( node ) {
this.optimizeBookmark();
this.trim( false, true );
var startContainer = this.startContainer;
var startOffset = this.startOffset;
var nextNode = startContainer.getChild( startOffset );
if ( nextNode )
node.insertBefore( nextNode );
else
startContainer.append( node );
... | [
"function",
"(",
"node",
")",
"{",
"this",
".",
"optimizeBookmark",
"(",
")",
";",
"this",
".",
"trim",
"(",
"false",
",",
"true",
")",
";",
"var",
"startContainer",
"=",
"this",
".",
"startContainer",
";",
"var",
"startOffset",
"=",
"this",
".",
"star... | Inserts a node at the start of the range. The range will be expanded
the contain the node.
@param {CKEDITOR.dom.node} node | [
"Inserts",
"a",
"node",
"at",
"the",
"start",
"of",
"the",
"range",
".",
"The",
"range",
"will",
"be",
"expanded",
"the",
"contain",
"the",
"node",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/dom/range.js#L1580-L1600 | train | |
skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/dom/range.js | function( range ) {
this.setStart( range.startContainer, range.startOffset );
this.setEnd( range.endContainer, range.endOffset );
} | javascript | function( range ) {
this.setStart( range.startContainer, range.startOffset );
this.setEnd( range.endContainer, range.endOffset );
} | [
"function",
"(",
"range",
")",
"{",
"this",
".",
"setStart",
"(",
"range",
".",
"startContainer",
",",
"range",
".",
"startOffset",
")",
";",
"this",
".",
"setEnd",
"(",
"range",
".",
"endContainer",
",",
"range",
".",
"endOffset",
")",
";",
"}"
] | Moves the range to the exact position of the specified range.
@param {CKEDITOR.dom.range} range | [
"Moves",
"the",
"range",
"to",
"the",
"exact",
"position",
"of",
"the",
"specified",
"range",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/dom/range.js#L1626-L1629 | train | |
skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/dom/range.js | function( startNode, startOffset ) {
// W3C requires a check for the new position. If it is after the end
// boundary, the range should be collapsed to the new start. It seams
// we will not need this check for our use of this class so we can
// ignore it for now.
// Fixing invalid range start inside dt... | javascript | function( startNode, startOffset ) {
// W3C requires a check for the new position. If it is after the end
// boundary, the range should be collapsed to the new start. It seams
// we will not need this check for our use of this class so we can
// ignore it for now.
// Fixing invalid range start inside dt... | [
"function",
"(",
"startNode",
",",
"startOffset",
")",
"{",
"// W3C requires a check for the new position. If it is after the end",
"// boundary, the range should be collapsed to the new start. It seams",
"// we will not need this check for our use of this class so we can",
"// ignore it for now... | Sets the start position of a range.
@param {CKEDITOR.dom.node} startNode The node to start the range.
@param {Number} startOffset An integer greater than or equal to zero
representing the offset for the start of the range from the start
of `startNode`. | [
"Sets",
"the",
"start",
"position",
"of",
"a",
"range",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/dom/range.js#L1649-L1668 | train | |
skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/dom/range.js | function( endNode, endOffset ) {
// W3C requires a check for the new position. If it is before the start
// boundary, the range should be collapsed to the new end. It seams we
// will not need this check for our use of this class so we can ignore
// it for now.
// Fixing invalid range end inside dtd emp... | javascript | function( endNode, endOffset ) {
// W3C requires a check for the new position. If it is before the start
// boundary, the range should be collapsed to the new end. It seams we
// will not need this check for our use of this class so we can ignore
// it for now.
// Fixing invalid range end inside dtd emp... | [
"function",
"(",
"endNode",
",",
"endOffset",
")",
"{",
"// W3C requires a check for the new position. If it is before the start",
"// boundary, the range should be collapsed to the new end. It seams we",
"// will not need this check for our use of this class so we can ignore",
"// it for now.",... | Sets the end position of a Range.
@param {CKEDITOR.dom.node} endNode The node to end the range.
@param {Number} endOffset An integer greater than or equal to zero
representing the offset for the end of the range from the start
of `endNode`. | [
"Sets",
"the",
"end",
"position",
"of",
"a",
"Range",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/dom/range.js#L1678-L1697 | train | |
skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/dom/range.js | function( toSplit ) {
if ( !this.collapsed )
return null;
// Extract the contents of the block from the selection point to the end
// of its contents.
this.setEndAt( toSplit, CKEDITOR.POSITION_BEFORE_END );
var documentFragment = this.extractContents();
// Duplicate the element after it.
var ... | javascript | function( toSplit ) {
if ( !this.collapsed )
return null;
// Extract the contents of the block from the selection point to the end
// of its contents.
this.setEndAt( toSplit, CKEDITOR.POSITION_BEFORE_END );
var documentFragment = this.extractContents();
// Duplicate the element after it.
var ... | [
"function",
"(",
"toSplit",
")",
"{",
"if",
"(",
"!",
"this",
".",
"collapsed",
")",
"return",
"null",
";",
"// Extract the contents of the block from the selection point to the end",
"// of its contents.",
"this",
".",
"setEndAt",
"(",
"toSplit",
",",
"CKEDITOR",
"."... | Branch the specified element from the collapsed range position and
place the caret between the two result branches.
**Note:** The range must be collapsed and been enclosed by this element.
@param {CKEDITOR.dom.element} element
@returns {CKEDITOR.dom.element} Root element of the new branch after the split. | [
"Branch",
"the",
"specified",
"element",
"from",
"the",
"collapsed",
"range",
"position",
"and",
"place",
"the",
"caret",
"between",
"the",
"two",
"result",
"branches",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/dom/range.js#L1953-L1970 | train | |
skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/dom/range.js | function() {
var walkerRange = this.clone();
// Optimize and analyze the range to avoid DOM destructive nature of walker. (#5780)
walkerRange.optimize();
if ( walkerRange.startContainer.type != CKEDITOR.NODE_ELEMENT || walkerRange.endContainer.type != CKEDITOR.NODE_ELEMENT )
return null;
var walker... | javascript | function() {
var walkerRange = this.clone();
// Optimize and analyze the range to avoid DOM destructive nature of walker. (#5780)
walkerRange.optimize();
if ( walkerRange.startContainer.type != CKEDITOR.NODE_ELEMENT || walkerRange.endContainer.type != CKEDITOR.NODE_ELEMENT )
return null;
var walker... | [
"function",
"(",
")",
"{",
"var",
"walkerRange",
"=",
"this",
".",
"clone",
"(",
")",
";",
"// Optimize and analyze the range to avoid DOM destructive nature of walker. (#5780)",
"walkerRange",
".",
"optimize",
"(",
")",
";",
"if",
"(",
"walkerRange",
".",
"startConta... | Get the single node enclosed within the range if there's one.
@returns {CKEDITOR.dom.node} | [
"Get",
"the",
"single",
"node",
"enclosed",
"within",
"the",
"range",
"if",
"there",
"s",
"one",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/dom/range.js#L2368-L2386 | train | |
skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/dom/range.js | function() {
// The reference element contains a zero-width space to avoid
// a premature removal. The view is to be scrolled with respect
// to this element.
var reference = new CKEDITOR.dom.element.createFromHtml( '<span> </span>', this.document ),
afterCaretNode, startContainerText, isStartText... | javascript | function() {
// The reference element contains a zero-width space to avoid
// a premature removal. The view is to be scrolled with respect
// to this element.
var reference = new CKEDITOR.dom.element.createFromHtml( '<span> </span>', this.document ),
afterCaretNode, startContainerText, isStartText... | [
"function",
"(",
")",
"{",
"// The reference element contains a zero-width space to avoid",
"// a premature removal. The view is to be scrolled with respect",
"// to this element.",
"var",
"reference",
"=",
"new",
"CKEDITOR",
".",
"dom",
".",
"element",
".",
"createFromHtml",
"("... | Scrolls the start of current range into view. | [
"Scrolls",
"the",
"start",
"of",
"current",
"range",
"into",
"view",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/dom/range.js#L2440-L2483 | train | |
JChapman202/flux-rx | src/PureView.js | shallowEquals | function shallowEquals(objA, objB) {
var returnVal = false;
if (objA === objB || objA === null && objB === null) {
returnVal = true;
}
if (!returnVal) {
var propsEqual = true;
if (Object.keys(objA).length === Object.keys(objB).length) {
for (var key in objA) {
propsEqual = propsEqual && objA[key] ===... | javascript | function shallowEquals(objA, objB) {
var returnVal = false;
if (objA === objB || objA === null && objB === null) {
returnVal = true;
}
if (!returnVal) {
var propsEqual = true;
if (Object.keys(objA).length === Object.keys(objB).length) {
for (var key in objA) {
propsEqual = propsEqual && objA[key] ===... | [
"function",
"shallowEquals",
"(",
"objA",
",",
"objB",
")",
"{",
"var",
"returnVal",
"=",
"false",
";",
"if",
"(",
"objA",
"===",
"objB",
"||",
"objA",
"===",
"null",
"&&",
"objB",
"===",
"null",
")",
"{",
"returnVal",
"=",
"true",
";",
"}",
"if",
... | Utility function which evaluates if the two provided instances
have all of the same properties as each other and if all
of the properties on each other are equal.
@param {Object} objA [description]
@param {Object} objB [description]
@return {Boolean} [description] | [
"Utility",
"function",
"which",
"evaluates",
"if",
"the",
"two",
"provided",
"instances",
"have",
"all",
"of",
"the",
"same",
"properties",
"as",
"each",
"other",
"and",
"if",
"all",
"of",
"the",
"properties",
"on",
"each",
"other",
"are",
"equal",
"."
] | 0063c400c991c5347e6a9751f9a86f8f2aa083fe | https://github.com/JChapman202/flux-rx/blob/0063c400c991c5347e6a9751f9a86f8f2aa083fe/src/PureView.js#L23-L42 | train |
ngageoint/eslint-plugin-opensphere | no-suppress.js | checkCommentForSuppress | function checkCommentForSuppress(node) {
// Skip if types aren't provided or the comment is empty.
if (!node || !node.value || node.value.length === 0) {
return;
}
const match = node.value.match(/@suppress \{(.*?)\}/);
if (match && match.length === 2) {
if (!blacklistedTyp... | javascript | function checkCommentForSuppress(node) {
// Skip if types aren't provided or the comment is empty.
if (!node || !node.value || node.value.length === 0) {
return;
}
const match = node.value.match(/@suppress \{(.*?)\}/);
if (match && match.length === 2) {
if (!blacklistedTyp... | [
"function",
"checkCommentForSuppress",
"(",
"node",
")",
"{",
"// Skip if types aren't provided or the comment is empty.",
"if",
"(",
"!",
"node",
"||",
"!",
"node",
".",
"value",
"||",
"node",
".",
"value",
".",
"length",
"===",
"0",
")",
"{",
"return",
";",
... | Reports a given comment if it contains blocked suppress types.
@param {ASTNode} node A comment node to check. | [
"Reports",
"a",
"given",
"comment",
"if",
"it",
"contains",
"blocked",
"suppress",
"types",
"."
] | 3d1804b49a0349aeba0eb694e45266fb2cb2d83b | https://github.com/ngageoint/eslint-plugin-opensphere/blob/3d1804b49a0349aeba0eb694e45266fb2cb2d83b/no-suppress.js#L28-L55 | train |
ForbesLindesay-Unmaintained/to-bool-function | index.js | toBoolFunction | function toBoolFunction(selector, condition) {
if (arguments.length == 2) {
selector = toBoolFunction(selector);
condition = toBoolFunction(condition);
return function () {
return condition(selector.apply(this, arguments));
};
} else {
condition = selector;
}
var alternate = false;
t... | javascript | function toBoolFunction(selector, condition) {
if (arguments.length == 2) {
selector = toBoolFunction(selector);
condition = toBoolFunction(condition);
return function () {
return condition(selector.apply(this, arguments));
};
} else {
condition = selector;
}
var alternate = false;
t... | [
"function",
"toBoolFunction",
"(",
"selector",
",",
"condition",
")",
"{",
"if",
"(",
"arguments",
".",
"length",
"==",
"2",
")",
"{",
"selector",
"=",
"toBoolFunction",
"(",
"selector",
")",
";",
"condition",
"=",
"toBoolFunction",
"(",
"condition",
")",
... | Convert various possible things into a match function
@param {Any} [selector]
@param {Any} condition
@return {Function} | [
"Convert",
"various",
"possible",
"things",
"into",
"a",
"match",
"function"
] | 731073819369d97559ef4038937df998df3e5e90 | https://github.com/ForbesLindesay-Unmaintained/to-bool-function/blob/731073819369d97559ef4038937df998df3e5e90/index.js#L12-L45 | train |
ForbesLindesay-Unmaintained/to-bool-function | index.js | objectToFunction | function objectToFunction(obj) {
var fns = Object.keys(obj)
.map(function (key) {
return toBoolFunction(key, obj[key]);
});
return function(o){
for (var i = 0; i < fns.length; i++) {
if (!fns[i](o)) return false;
}
return true;
}
} | javascript | function objectToFunction(obj) {
var fns = Object.keys(obj)
.map(function (key) {
return toBoolFunction(key, obj[key]);
});
return function(o){
for (var i = 0; i < fns.length; i++) {
if (!fns[i](o)) return false;
}
return true;
}
} | [
"function",
"objectToFunction",
"(",
"obj",
")",
"{",
"var",
"fns",
"=",
"Object",
".",
"keys",
"(",
"obj",
")",
".",
"map",
"(",
"function",
"(",
"key",
")",
"{",
"return",
"toBoolFunction",
"(",
"key",
",",
"obj",
"[",
"key",
"]",
")",
";",
"}",
... | Convert `obj` into a match function.
@param {Object} obj
@return {Function}
@api private | [
"Convert",
"obj",
"into",
"a",
"match",
"function",
"."
] | 731073819369d97559ef4038937df998df3e5e90 | https://github.com/ForbesLindesay-Unmaintained/to-bool-function/blob/731073819369d97559ef4038937df998df3e5e90/index.js#L67-L78 | train |
ForbesLindesay-Unmaintained/to-bool-function | index.js | stringToFunction | function stringToFunction(str) {
// immediate such as "> 20"
if (/^ *\W+/.test(str)) return new Function('_', 'return _ ' + str);
// properties such as "name.first" or "age > 18"
var fn = new Function('_', 'return _.' + str);
return fn
} | javascript | function stringToFunction(str) {
// immediate such as "> 20"
if (/^ *\W+/.test(str)) return new Function('_', 'return _ ' + str);
// properties such as "name.first" or "age > 18"
var fn = new Function('_', 'return _.' + str);
return fn
} | [
"function",
"stringToFunction",
"(",
"str",
")",
"{",
"// immediate such as \"> 20\"",
"if",
"(",
"/",
"^ *\\W+",
"/",
".",
"test",
"(",
"str",
")",
")",
"return",
"new",
"Function",
"(",
"'_'",
",",
"'return _ '",
"+",
"str",
")",
";",
"// properties such a... | Convert property `str` to a function.
@param {String} str
@return {Function}
@api private | [
"Convert",
"property",
"str",
"to",
"a",
"function",
"."
] | 731073819369d97559ef4038937df998df3e5e90 | https://github.com/ForbesLindesay-Unmaintained/to-bool-function/blob/731073819369d97559ef4038937df998df3e5e90/index.js#L88-L95 | train |
benzhou1/iod | index.js | function(apiKey, host, port, reqOpts) {
var iod = this
if (_.isObject(host)) {
reqOpts = host
host = null
}
else if (_.isObject(port)) {
reqOpts = port
port = null
}
if (!apiKey) throw Error('IOD apiKey is missing!')
else if (host && !url.parse(host, false, true).protocol) {
throw Error('Protocol not... | javascript | function(apiKey, host, port, reqOpts) {
var iod = this
if (_.isObject(host)) {
reqOpts = host
host = null
}
else if (_.isObject(port)) {
reqOpts = port
port = null
}
if (!apiKey) throw Error('IOD apiKey is missing!')
else if (host && !url.parse(host, false, true).protocol) {
throw Error('Protocol not... | [
"function",
"(",
"apiKey",
",",
"host",
",",
"port",
",",
"reqOpts",
")",
"{",
"var",
"iod",
"=",
"this",
"if",
"(",
"_",
".",
"isObject",
"(",
"host",
")",
")",
"{",
"reqOpts",
"=",
"host",
"host",
"=",
"null",
"}",
"else",
"if",
"(",
"_",
"."... | Creates a IOD object with specified apiKey, host and port.
@param {String} apiKey - Api key
@param {String} [host] - IOD host
@param {Integer | null} [port] - IOD port
@param {Integer} [reqOpts] - Request options
@property {String} apiKey - Api key
@property {String} host - IOD host
@property {Integer} port - IOD port... | [
"Creates",
"a",
"IOD",
"object",
"with",
"specified",
"apiKey",
"host",
"and",
"port",
"."
] | a346628f9bc5e4420e4d00e8f21c4cb268b6237c | https://github.com/benzhou1/iod/blob/a346628f9bc5e4420e4d00e8f21c4cb268b6237c/index.js#L35-L73 | train | |
icanjs/grid-filter | src/jquery-tokeninput/jquery-tokeninput.js | insert_token | function insert_token(item) {
var $this_token = $($(input).data("settings").tokenFormatter(item));
var readonly = item.readonly === true ? true : false;
if(readonly) $this_token.addClass($(input).data("settings").classes.tokenReadOnly);
$this_token.addClass($(input).data("setti... | javascript | function insert_token(item) {
var $this_token = $($(input).data("settings").tokenFormatter(item));
var readonly = item.readonly === true ? true : false;
if(readonly) $this_token.addClass($(input).data("settings").classes.tokenReadOnly);
$this_token.addClass($(input).data("setti... | [
"function",
"insert_token",
"(",
"item",
")",
"{",
"var",
"$this_token",
"=",
"$",
"(",
"$",
"(",
"input",
")",
".",
"data",
"(",
"\"settings\"",
")",
".",
"tokenFormatter",
"(",
"item",
")",
")",
";",
"var",
"readonly",
"=",
"item",
".",
"readonly",
... | Inner function to a token to the list | [
"Inner",
"function",
"to",
"a",
"token",
"to",
"the",
"list"
] | 48d9ce876cdc6ef459fcae70ac67b23229e85a5a | https://github.com/icanjs/grid-filter/blob/48d9ce876cdc6ef459fcae70ac67b23229e85a5a/src/jquery-tokeninput/jquery-tokeninput.js#L607-L649 | train |
icanjs/grid-filter | src/jquery-tokeninput/jquery-tokeninput.js | add_token | function add_token (item) {
var callback = $(input).data("settings").onAdd;
// See if the token already exists and select it if we don't want duplicates
if(token_count > 0 && $(input).data("settings").preventDuplicates) {
var found_existing_token = null;
token_... | javascript | function add_token (item) {
var callback = $(input).data("settings").onAdd;
// See if the token already exists and select it if we don't want duplicates
if(token_count > 0 && $(input).data("settings").preventDuplicates) {
var found_existing_token = null;
token_... | [
"function",
"add_token",
"(",
"item",
")",
"{",
"var",
"callback",
"=",
"$",
"(",
"input",
")",
".",
"data",
"(",
"\"settings\"",
")",
".",
"onAdd",
";",
"// See if the token already exists and select it if we don't want duplicates",
"if",
"(",
"token_count",
">",
... | Add a token to the token list based on user input | [
"Add",
"a",
"token",
"to",
"the",
"token",
"list",
"based",
"on",
"user",
"input"
] | 48d9ce876cdc6ef459fcae70ac67b23229e85a5a | https://github.com/icanjs/grid-filter/blob/48d9ce876cdc6ef459fcae70ac67b23229e85a5a/src/jquery-tokeninput/jquery-tokeninput.js#L652-L696 | train |
icanjs/grid-filter | src/jquery-tokeninput/jquery-tokeninput.js | select_token | function select_token (token) {
if (!$(input).data("settings").disabled) {
token.addClass($(input).data("settings").classes.selectedToken);
selected_token = token.get(0);
// Hide input box
input_box.val("");
// Hide dropdown if it is visi... | javascript | function select_token (token) {
if (!$(input).data("settings").disabled) {
token.addClass($(input).data("settings").classes.selectedToken);
selected_token = token.get(0);
// Hide input box
input_box.val("");
// Hide dropdown if it is visi... | [
"function",
"select_token",
"(",
"token",
")",
"{",
"if",
"(",
"!",
"$",
"(",
"input",
")",
".",
"data",
"(",
"\"settings\"",
")",
".",
"disabled",
")",
"{",
"token",
".",
"addClass",
"(",
"$",
"(",
"input",
")",
".",
"data",
"(",
"\"settings\"",
"... | Select a token in the token list | [
"Select",
"a",
"token",
"in",
"the",
"token",
"list"
] | 48d9ce876cdc6ef459fcae70ac67b23229e85a5a | https://github.com/icanjs/grid-filter/blob/48d9ce876cdc6ef459fcae70ac67b23229e85a5a/src/jquery-tokeninput/jquery-tokeninput.js#L699-L710 | train |
icanjs/grid-filter | src/jquery-tokeninput/jquery-tokeninput.js | deselect_token | function deselect_token (token, position) {
token.removeClass($(input).data("settings").classes.selectedToken);
selected_token = null;
if(position === POSITION.BEFORE) {
input_token.insertBefore(token);
selected_token_index--;
} else if(position === P... | javascript | function deselect_token (token, position) {
token.removeClass($(input).data("settings").classes.selectedToken);
selected_token = null;
if(position === POSITION.BEFORE) {
input_token.insertBefore(token);
selected_token_index--;
} else if(position === P... | [
"function",
"deselect_token",
"(",
"token",
",",
"position",
")",
"{",
"token",
".",
"removeClass",
"(",
"$",
"(",
"input",
")",
".",
"data",
"(",
"\"settings\"",
")",
".",
"classes",
".",
"selectedToken",
")",
";",
"selected_token",
"=",
"null",
";",
"i... | Deselect a token in the token list | [
"Deselect",
"a",
"token",
"in",
"the",
"token",
"list"
] | 48d9ce876cdc6ef459fcae70ac67b23229e85a5a | https://github.com/icanjs/grid-filter/blob/48d9ce876cdc6ef459fcae70ac67b23229e85a5a/src/jquery-tokeninput/jquery-tokeninput.js#L713-L730 | train |
icanjs/grid-filter | src/jquery-tokeninput/jquery-tokeninput.js | toggle_select_token | function toggle_select_token(token) {
var previous_selected_token = selected_token;
if(selected_token) {
deselect_token($(selected_token), POSITION.END);
}
if(previous_selected_token === token.get(0)) {
deselect_token(token, POSITION.END);
... | javascript | function toggle_select_token(token) {
var previous_selected_token = selected_token;
if(selected_token) {
deselect_token($(selected_token), POSITION.END);
}
if(previous_selected_token === token.get(0)) {
deselect_token(token, POSITION.END);
... | [
"function",
"toggle_select_token",
"(",
"token",
")",
"{",
"var",
"previous_selected_token",
"=",
"selected_token",
";",
"if",
"(",
"selected_token",
")",
"{",
"deselect_token",
"(",
"$",
"(",
"selected_token",
")",
",",
"POSITION",
".",
"END",
")",
";",
"}",
... | Toggle selection of a token in the token list | [
"Toggle",
"selection",
"of",
"a",
"token",
"in",
"the",
"token",
"list"
] | 48d9ce876cdc6ef459fcae70ac67b23229e85a5a | https://github.com/icanjs/grid-filter/blob/48d9ce876cdc6ef459fcae70ac67b23229e85a5a/src/jquery-tokeninput/jquery-tokeninput.js#L733-L745 | train |
icanjs/grid-filter | src/jquery-tokeninput/jquery-tokeninput.js | delete_token | function delete_token (token) {
// Remove the id from the saved list
var token_data = $.data(token.get(0), "tokeninput");
var callback = $(input).data("settings").onDelete;
var index = token.prevAll().length;
if(index > selected_token_index) index--;
// Dele... | javascript | function delete_token (token) {
// Remove the id from the saved list
var token_data = $.data(token.get(0), "tokeninput");
var callback = $(input).data("settings").onDelete;
var index = token.prevAll().length;
if(index > selected_token_index) index--;
// Dele... | [
"function",
"delete_token",
"(",
"token",
")",
"{",
"// Remove the id from the saved list",
"var",
"token_data",
"=",
"$",
".",
"data",
"(",
"token",
".",
"get",
"(",
"0",
")",
",",
"\"tokeninput\"",
")",
";",
"var",
"callback",
"=",
"$",
"(",
"input",
")"... | Delete a token from the token list | [
"Delete",
"a",
"token",
"from",
"the",
"token",
"list"
] | 48d9ce876cdc6ef459fcae70ac67b23229e85a5a | https://github.com/icanjs/grid-filter/blob/48d9ce876cdc6ef459fcae70ac67b23229e85a5a/src/jquery-tokeninput/jquery-tokeninput.js#L748-L786 | train |
icanjs/grid-filter | src/jquery-tokeninput/jquery-tokeninput.js | update_hidden_input | function update_hidden_input(saved_tokens, hidden_input) {
var token_values = $.map(saved_tokens, function (el) {
if(typeof $(input).data("settings").tokenValue == 'function')
return $(input).data("settings").tokenValue.call(this, el);
return el[$(input).data("sett... | javascript | function update_hidden_input(saved_tokens, hidden_input) {
var token_values = $.map(saved_tokens, function (el) {
if(typeof $(input).data("settings").tokenValue == 'function')
return $(input).data("settings").tokenValue.call(this, el);
return el[$(input).data("sett... | [
"function",
"update_hidden_input",
"(",
"saved_tokens",
",",
"hidden_input",
")",
"{",
"var",
"token_values",
"=",
"$",
".",
"map",
"(",
"saved_tokens",
",",
"function",
"(",
"el",
")",
"{",
"if",
"(",
"typeof",
"$",
"(",
"input",
")",
".",
"data",
"(",
... | Update the hidden input box value | [
"Update",
"the",
"hidden",
"input",
"box",
"value"
] | 48d9ce876cdc6ef459fcae70ac67b23229e85a5a | https://github.com/icanjs/grid-filter/blob/48d9ce876cdc6ef459fcae70ac67b23229e85a5a/src/jquery-tokeninput/jquery-tokeninput.js#L789-L798 | train |
icanjs/grid-filter | src/jquery-tokeninput/jquery-tokeninput.js | highlight_term | function highlight_term(value, term) {
return value.replace(
new RegExp(
"(?![^&;]+;)(?!<[^<>]*)(" + regexp_escape(term) + ")(?![^<>]*>)(?![^&;]+;)",
"gi"
), function(match, p1) {
return "<b>" + escapeHTML(p1) + "</b>";
}
... | javascript | function highlight_term(value, term) {
return value.replace(
new RegExp(
"(?![^&;]+;)(?!<[^<>]*)(" + regexp_escape(term) + ")(?![^<>]*>)(?![^&;]+;)",
"gi"
), function(match, p1) {
return "<b>" + escapeHTML(p1) + "</b>";
}
... | [
"function",
"highlight_term",
"(",
"value",
",",
"term",
")",
"{",
"return",
"value",
".",
"replace",
"(",
"new",
"RegExp",
"(",
"\"(?![^&;]+;)(?!<[^<>]*)(\"",
"+",
"regexp_escape",
"(",
"term",
")",
"+",
"\")(?![^<>]*>)(?![^&;]+;)\"",
",",
"\"gi\"",
")",
",",
... | Highlight the query part of the search term | [
"Highlight",
"the",
"query",
"part",
"of",
"the",
"search",
"term"
] | 48d9ce876cdc6ef459fcae70ac67b23229e85a5a | https://github.com/icanjs/grid-filter/blob/48d9ce876cdc6ef459fcae70ac67b23229e85a5a/src/jquery-tokeninput/jquery-tokeninput.js#L838-L847 | train |
icanjs/grid-filter | src/jquery-tokeninput/jquery-tokeninput.js | excludeCurrent | function excludeCurrent(results) {
if ($(input).data("settings").excludeCurrent) {
var currentTokens = $(input).data("tokenInputObject").getTokens(),
trimmedList = [];
if (currentTokens.length) {
$.each(results, function(index, value) {
... | javascript | function excludeCurrent(results) {
if ($(input).data("settings").excludeCurrent) {
var currentTokens = $(input).data("tokenInputObject").getTokens(),
trimmedList = [];
if (currentTokens.length) {
$.each(results, function(index, value) {
... | [
"function",
"excludeCurrent",
"(",
"results",
")",
"{",
"if",
"(",
"$",
"(",
"input",
")",
".",
"data",
"(",
"\"settings\"",
")",
".",
"excludeCurrent",
")",
"{",
"var",
"currentTokens",
"=",
"$",
"(",
"input",
")",
".",
"data",
"(",
"\"tokenInputObject\... | exclude existing tokens from dropdown, so the list is clearer | [
"exclude",
"existing",
"tokens",
"from",
"dropdown",
"so",
"the",
"list",
"is",
"clearer"
] | 48d9ce876cdc6ef459fcae70ac67b23229e85a5a | https://github.com/icanjs/grid-filter/blob/48d9ce876cdc6ef459fcae70ac67b23229e85a5a/src/jquery-tokeninput/jquery-tokeninput.js#L854-L877 | train |
icanjs/grid-filter | src/jquery-tokeninput/jquery-tokeninput.js | populate_dropdown | function populate_dropdown (query, results) {
// exclude current tokens if configured
results = excludeCurrent(results);
if(results && results.length) {
dropdown.empty();
var dropdown_ul = $("<ul/>")
.appendTo(dropdown)
.mous... | javascript | function populate_dropdown (query, results) {
// exclude current tokens if configured
results = excludeCurrent(results);
if(results && results.length) {
dropdown.empty();
var dropdown_ul = $("<ul/>")
.appendTo(dropdown)
.mous... | [
"function",
"populate_dropdown",
"(",
"query",
",",
"results",
")",
"{",
"// exclude current tokens if configured",
"results",
"=",
"excludeCurrent",
"(",
"results",
")",
";",
"if",
"(",
"results",
"&&",
"results",
".",
"length",
")",
"{",
"dropdown",
".",
"empt... | Populate the results dropdown with some results | [
"Populate",
"the",
"results",
"dropdown",
"with",
"some",
"results"
] | 48d9ce876cdc6ef459fcae70ac67b23229e85a5a | https://github.com/icanjs/grid-filter/blob/48d9ce876cdc6ef459fcae70ac67b23229e85a5a/src/jquery-tokeninput/jquery-tokeninput.js#L880-L934 | train |
icanjs/grid-filter | src/jquery-tokeninput/jquery-tokeninput.js | select_dropdown_item | function select_dropdown_item (item) {
if(item) {
if(selected_dropdown_item) {
deselect_dropdown_item($(selected_dropdown_item));
}
item.addClass($(input).data("settings").classes.selectedDropdownItem);
selected_dropdown_item = item.ge... | javascript | function select_dropdown_item (item) {
if(item) {
if(selected_dropdown_item) {
deselect_dropdown_item($(selected_dropdown_item));
}
item.addClass($(input).data("settings").classes.selectedDropdownItem);
selected_dropdown_item = item.ge... | [
"function",
"select_dropdown_item",
"(",
"item",
")",
"{",
"if",
"(",
"item",
")",
"{",
"if",
"(",
"selected_dropdown_item",
")",
"{",
"deselect_dropdown_item",
"(",
"$",
"(",
"selected_dropdown_item",
")",
")",
";",
"}",
"item",
".",
"addClass",
"(",
"$",
... | Highlight an item in the results dropdown | [
"Highlight",
"an",
"item",
"in",
"the",
"results",
"dropdown"
] | 48d9ce876cdc6ef459fcae70ac67b23229e85a5a | https://github.com/icanjs/grid-filter/blob/48d9ce876cdc6ef459fcae70ac67b23229e85a5a/src/jquery-tokeninput/jquery-tokeninput.js#L937-L946 | train |
icanjs/grid-filter | src/jquery-tokeninput/jquery-tokeninput.js | deselect_dropdown_item | function deselect_dropdown_item (item) {
item.removeClass($(input).data("settings").classes.selectedDropdownItem);
selected_dropdown_item = null;
} | javascript | function deselect_dropdown_item (item) {
item.removeClass($(input).data("settings").classes.selectedDropdownItem);
selected_dropdown_item = null;
} | [
"function",
"deselect_dropdown_item",
"(",
"item",
")",
"{",
"item",
".",
"removeClass",
"(",
"$",
"(",
"input",
")",
".",
"data",
"(",
"\"settings\"",
")",
".",
"classes",
".",
"selectedDropdownItem",
")",
";",
"selected_dropdown_item",
"=",
"null",
";",
"}... | Remove highlighting from an item in the results dropdown | [
"Remove",
"highlighting",
"from",
"an",
"item",
"in",
"the",
"results",
"dropdown"
] | 48d9ce876cdc6ef459fcae70ac67b23229e85a5a | https://github.com/icanjs/grid-filter/blob/48d9ce876cdc6ef459fcae70ac67b23229e85a5a/src/jquery-tokeninput/jquery-tokeninput.js#L949-L952 | train |
icanjs/grid-filter | src/jquery-tokeninput/jquery-tokeninput.js | computeURL | function computeURL() {
var url = $(input).data("settings").url;
if(typeof $(input).data("settings").url == 'function') {
url = $(input).data("settings").url.call($(input).data("settings"));
}
return url;
} | javascript | function computeURL() {
var url = $(input).data("settings").url;
if(typeof $(input).data("settings").url == 'function') {
url = $(input).data("settings").url.call($(input).data("settings"));
}
return url;
} | [
"function",
"computeURL",
"(",
")",
"{",
"var",
"url",
"=",
"$",
"(",
"input",
")",
".",
"data",
"(",
"\"settings\"",
")",
".",
"url",
";",
"if",
"(",
"typeof",
"$",
"(",
"input",
")",
".",
"data",
"(",
"\"settings\"",
")",
".",
"url",
"==",
"'fu... | compute the dynamic URL | [
"compute",
"the",
"dynamic",
"URL"
] | 48d9ce876cdc6ef459fcae70ac67b23229e85a5a | https://github.com/icanjs/grid-filter/blob/48d9ce876cdc6ef459fcae70ac67b23229e85a5a/src/jquery-tokeninput/jquery-tokeninput.js#L1064-L1070 | train |
shyam-dasgupta/mongo-query-builder | index.js | _matchAllFields | function _matchAllFields(fields, matchAnyRegex) {
var regExp = regExps ? matchAnyRegex ? regExps.any : regExps.all : null;
if (regExp) {
for (var i = 0; i < fields.length; ++i) {
parentBuilder.field(fields[i]).is("$regex", regExp);
}
}
return paren... | javascript | function _matchAllFields(fields, matchAnyRegex) {
var regExp = regExps ? matchAnyRegex ? regExps.any : regExps.all : null;
if (regExp) {
for (var i = 0; i < fields.length; ++i) {
parentBuilder.field(fields[i]).is("$regex", regExp);
}
}
return paren... | [
"function",
"_matchAllFields",
"(",
"fields",
",",
"matchAnyRegex",
")",
"{",
"var",
"regExp",
"=",
"regExps",
"?",
"matchAnyRegex",
"?",
"regExps",
".",
"any",
":",
"regExps",
".",
"all",
":",
"null",
";",
"if",
"(",
"regExp",
")",
"{",
"for",
"(",
"v... | Matches the given Regular expression with all the fields.
@param {Array.<string>} fields Array of document fields.
@param {boolean} [matchAnyRegex=false] If true, match any
of the search query tokens, else match all.
@returns {QueryBuilder} the parent Builder.
@private | [
"Matches",
"the",
"given",
"Regular",
"expression",
"with",
"all",
"the",
"fields",
"."
] | adc7af2389aeba40d3041e81c91ffee9bd6ca68a | https://github.com/shyam-dasgupta/mongo-query-builder/blob/adc7af2389aeba40d3041e81c91ffee9bd6ca68a/index.js#L39-L47 | train |
shyam-dasgupta/mongo-query-builder | index.js | _matchAnyField | function _matchAnyField(fields, matchAnyRegex) {
var regExp = regExps ? matchAnyRegex ? regExps.any : regExps.all : null;
if (regExp) {
var orBuilder = parentBuilder.either();
for (var i = 0; i < fields.length; ++i) {
orBuilder = orBuilder.or().field(fields[i]).is... | javascript | function _matchAnyField(fields, matchAnyRegex) {
var regExp = regExps ? matchAnyRegex ? regExps.any : regExps.all : null;
if (regExp) {
var orBuilder = parentBuilder.either();
for (var i = 0; i < fields.length; ++i) {
orBuilder = orBuilder.or().field(fields[i]).is... | [
"function",
"_matchAnyField",
"(",
"fields",
",",
"matchAnyRegex",
")",
"{",
"var",
"regExp",
"=",
"regExps",
"?",
"matchAnyRegex",
"?",
"regExps",
".",
"any",
":",
"regExps",
".",
"all",
":",
"null",
";",
"if",
"(",
"regExp",
")",
"{",
"var",
"orBuilder... | Matches the given Regular expression with at least one
of the fields.
@param {Array.<string>} fields Array of document fields.
@param {boolean} [matchAnyRegex=false] If true, match any
of the search query tokens, else match all.
@returns {QueryBuilder} the parent Builder.
@private | [
"Matches",
"the",
"given",
"Regular",
"expression",
"with",
"at",
"least",
"one",
"of",
"the",
"fields",
"."
] | adc7af2389aeba40d3041e81c91ffee9bd6ca68a | https://github.com/shyam-dasgupta/mongo-query-builder/blob/adc7af2389aeba40d3041e81c91ffee9bd6ca68a/index.js#L58-L67 | train |
shyam-dasgupta/mongo-query-builder | index.js | function (parentBuilder, field) {
if (!dataUtils.isValidStr(field)) throw "Invalid field, should be a string: " + dataUtils.JSONstringify(field);
/**
* Ensures a comparison of the field with the value.
* @param {string} comparator e.g. "$gt", "$gte", etc.
* @param {*} value
* @returns {Quer... | javascript | function (parentBuilder, field) {
if (!dataUtils.isValidStr(field)) throw "Invalid field, should be a string: " + dataUtils.JSONstringify(field);
/**
* Ensures a comparison of the field with the value.
* @param {string} comparator e.g. "$gt", "$gte", etc.
* @param {*} value
* @returns {Quer... | [
"function",
"(",
"parentBuilder",
",",
"field",
")",
"{",
"if",
"(",
"!",
"dataUtils",
".",
"isValidStr",
"(",
"field",
")",
")",
"throw",
"\"Invalid field, should be a string: \"",
"+",
"dataUtils",
".",
"JSONstringify",
"(",
"field",
")",
";",
"/**\n * Ens... | This builder helps create efficient queries and expressions
for document fields.
@param {QueryBuilder} parentBuilder The parent query builder.
@param {string} field A field in the target document.
@constructor | [
"This",
"builder",
"helps",
"create",
"efficient",
"queries",
"and",
"expressions",
"for",
"document",
"fields",
"."
] | adc7af2389aeba40d3041e81c91ffee9bd6ca68a | https://github.com/shyam-dasgupta/mongo-query-builder/blob/adc7af2389aeba40d3041e81c91ffee9bd6ca68a/index.js#L180-L226 | train | |
shyam-dasgupta/mongo-query-builder | index.js | function () {
var _orBuilder = this;
var _queries = [];
var _currentChildBuilder = new ChildQueryBuilder(_orBuilder);
/**
* Process the current OR entry, and continue adding to this OR
* query group.
* @returns {ChildQueryBuilder} A new {@link ChildQueryBuilder}
* child in this OR g... | javascript | function () {
var _orBuilder = this;
var _queries = [];
var _currentChildBuilder = new ChildQueryBuilder(_orBuilder);
/**
* Process the current OR entry, and continue adding to this OR
* query group.
* @returns {ChildQueryBuilder} A new {@link ChildQueryBuilder}
* child in this OR g... | [
"function",
"(",
")",
"{",
"var",
"_orBuilder",
"=",
"this",
";",
"var",
"_queries",
"=",
"[",
"]",
";",
"var",
"_currentChildBuilder",
"=",
"new",
"ChildQueryBuilder",
"(",
"_orBuilder",
")",
";",
"/**\n * Process the current OR entry, and continue adding to this... | This builder helps create efficient OR queries and expressions.
@constructor | [
"This",
"builder",
"helps",
"create",
"efficient",
"OR",
"queries",
"and",
"expressions",
"."
] | adc7af2389aeba40d3041e81c91ffee9bd6ca68a | https://github.com/shyam-dasgupta/mongo-query-builder/blob/adc7af2389aeba40d3041e81c91ffee9bd6ca68a/index.js#L232-L265 | train | |
travism/solid-logger-js | lib/solid-logger.js | init | function init(configuration){
var self = {
config : configuration,
adapters : [],
getWhenCurrentWritesDone : getWhenCurrentWritesDone
};
_.each(self.config.adapters, function(adapter){
var adapterInstance;
try {
adapterInstance = require('./adapters/' + ... | javascript | function init(configuration){
var self = {
config : configuration,
adapters : [],
getWhenCurrentWritesDone : getWhenCurrentWritesDone
};
_.each(self.config.adapters, function(adapter){
var adapterInstance;
try {
adapterInstance = require('./adapters/' + ... | [
"function",
"init",
"(",
"configuration",
")",
"{",
"var",
"self",
"=",
"{",
"config",
":",
"configuration",
",",
"adapters",
":",
"[",
"]",
",",
"getWhenCurrentWritesDone",
":",
"getWhenCurrentWritesDone",
"}",
";",
"_",
".",
"each",
"(",
"self",
".",
"co... | Public method required to load in all of the configuration info for adapters.
Init initialize and reinitializes, so the list of adapters is set to empty before it runs.
@param configuration Object for your adapters.
@returns {logger} | [
"Public",
"method",
"required",
"to",
"load",
"in",
"all",
"of",
"the",
"configuration",
"info",
"for",
"adapters",
".",
"Init",
"initialize",
"and",
"reinitializes",
"so",
"the",
"list",
"of",
"adapters",
"is",
"set",
"to",
"empty",
"before",
"it",
"runs",
... | e5287dcfc680fcfa3eb449dd29bc8c92106184a9 | https://github.com/travism/solid-logger-js/blob/e5287dcfc680fcfa3eb449dd29bc8c92106184a9/lib/solid-logger.js#L23-L70 | train |
travism/solid-logger-js | lib/solid-logger.js | initWithFile | function initWithFile(configPath){
var configString = fs.readFileSync(path.resolve(configPath));
this.config = JSON.parse(configString);
this.init(this.config);
return this;
} | javascript | function initWithFile(configPath){
var configString = fs.readFileSync(path.resolve(configPath));
this.config = JSON.parse(configString);
this.init(this.config);
return this;
} | [
"function",
"initWithFile",
"(",
"configPath",
")",
"{",
"var",
"configString",
"=",
"fs",
".",
"readFileSync",
"(",
"path",
".",
"resolve",
"(",
"configPath",
")",
")",
";",
"this",
".",
"config",
"=",
"JSON",
".",
"parse",
"(",
"configString",
")",
";"... | Method that will load configuration info for your adapters from a file.
Method that will load configuration info for your adapters from a file.
@param configPath path to your configuration file
@returns {logger} | [
"Method",
"that",
"will",
"load",
"configuration",
"info",
"for",
"your",
"adapters",
"from",
"a",
"file",
".",
"Method",
"that",
"will",
"load",
"configuration",
"info",
"for",
"your",
"adapters",
"from",
"a",
"file",
"."
] | e5287dcfc680fcfa3eb449dd29bc8c92106184a9 | https://github.com/travism/solid-logger-js/blob/e5287dcfc680fcfa3eb449dd29bc8c92106184a9/lib/solid-logger.js#L78-L85 | train |
travism/solid-logger-js | lib/solid-logger.js | _write | function _write(type, category, message){
var config = this.config;
this.adapters.forEach(function(adapter) {
//Check configuration to see if we should continue.
if(adapter.config.filter && (adapter.config.filter.indexOf(type) > -1)){
return;
}
//We are not filterin... | javascript | function _write(type, category, message){
var config = this.config;
this.adapters.forEach(function(adapter) {
//Check configuration to see if we should continue.
if(adapter.config.filter && (adapter.config.filter.indexOf(type) > -1)){
return;
}
//We are not filterin... | [
"function",
"_write",
"(",
"type",
",",
"category",
",",
"message",
")",
"{",
"var",
"config",
"=",
"this",
".",
"config",
";",
"this",
".",
"adapters",
".",
"forEach",
"(",
"function",
"(",
"adapter",
")",
"{",
"//Check configuration to see if we should conti... | Local method to load up a write 'job'. We create a tracker so that the async callbacks stay in order and then we
kick off the adapterWrite method which recursively loads the adapters and write per their 'write' method. It will
also load in the configuration for the adapter each time so you can have the same type of ada... | [
"Local",
"method",
"to",
"load",
"up",
"a",
"write",
"job",
".",
"We",
"create",
"a",
"tracker",
"so",
"that",
"the",
"async",
"callbacks",
"stay",
"in",
"order",
"and",
"then",
"we",
"kick",
"off",
"the",
"adapterWrite",
"method",
"which",
"recursively",
... | e5287dcfc680fcfa3eb449dd29bc8c92106184a9 | https://github.com/travism/solid-logger-js/blob/e5287dcfc680fcfa3eb449dd29bc8c92106184a9/lib/solid-logger.js#L109-L121 | train |
CloudCoreo/gitane-windows | index.js | clone | function clone(args, baseDir, privKey, cb) {
run(baseDir, privKey, "git clone " + args, cb)
} | javascript | function clone(args, baseDir, privKey, cb) {
run(baseDir, privKey, "git clone " + args, cb)
} | [
"function",
"clone",
"(",
"args",
",",
"baseDir",
",",
"privKey",
",",
"cb",
")",
"{",
"run",
"(",
"baseDir",
",",
"privKey",
",",
"\"git clone \"",
"+",
"args",
",",
"cb",
")",
"}"
] | convenience wrapper for clone. maybe add more later. | [
"convenience",
"wrapper",
"for",
"clone",
".",
"maybe",
"add",
"more",
"later",
"."
] | 4adf92f1640cc7e5c34ccc17722d0ecf409e03d7 | https://github.com/CloudCoreo/gitane-windows/blob/4adf92f1640cc7e5c34ccc17722d0ecf409e03d7/index.js#L185-L187 | train |
bestander/jasmine-node-sugar | index.js | function (spec) {
spec.addMatchers({
/**
* Array contains all elements of another array
* @param needles another array
* @returns {Boolean} true/false
*/
toContainAll: function(needles) {
var haystack = this.actual;
return needles.every(function (elem) {
... | javascript | function (spec) {
spec.addMatchers({
/**
* Array contains all elements of another array
* @param needles another array
* @returns {Boolean} true/false
*/
toContainAll: function(needles) {
var haystack = this.actual;
return needles.every(function (elem) {
... | [
"function",
"(",
"spec",
")",
"{",
"spec",
".",
"addMatchers",
"(",
"{",
"/**\n * Array contains all elements of another array\n * @param needles another array\n * @returns {Boolean} true/false\n */",
"toContainAll",
":",
"function",
"(",
"needles",
")",
"{"... | call this in beforeEach method to add more available matchers
@param spec "this" within spec | [
"call",
"this",
"in",
"beforeEach",
"method",
"to",
"add",
"more",
"available",
"matchers"
] | 8e49710fa63b6216ec717b4dbecd84a77eee2148 | https://github.com/bestander/jasmine-node-sugar/blob/8e49710fa63b6216ec717b4dbecd84a77eee2148/index.js#L20-L36 | train | |
kjirou/mocha-automatic-coffeemaker | index.js | function(data) {
var filePath = data.filePath;
var noExtensionFilePath = data.noExtensionFilePath;
var fileName = data.fileName;
var noExtensionFileName = data.noExtensionFileName;
return [
"describe('" + noExtensionFilePath + "', function() {",
"});",
].join('\n');
} | javascript | function(data) {
var filePath = data.filePath;
var noExtensionFilePath = data.noExtensionFilePath;
var fileName = data.fileName;
var noExtensionFileName = data.noExtensionFileName;
return [
"describe('" + noExtensionFilePath + "', function() {",
"});",
].join('\n');
} | [
"function",
"(",
"data",
")",
"{",
"var",
"filePath",
"=",
"data",
".",
"filePath",
";",
"var",
"noExtensionFilePath",
"=",
"data",
".",
"noExtensionFilePath",
";",
"var",
"fileName",
"=",
"data",
".",
"fileName",
";",
"var",
"noExtensionFileName",
"=",
"dat... | get test code template | [
"get",
"test",
"code",
"template"
] | 52db2766030bc039e9f9ffc133dbd2b8bc162085 | https://github.com/kjirou/mocha-automatic-coffeemaker/blob/52db2766030bc039e9f9ffc133dbd2b8bc162085/index.js#L54-L64 | train | |
75lb/reduce-extract | lib/reduce-extract.js | extract | function extract (query) {
var toSplice = []
var extracted = []
return function (prev, curr, index, array) {
if (prev !== extracted) {
if (testValue(prev, query)) {
extracted.push(prev)
toSplice.push(index - 1)
}
}
if (testValue(curr, query)) {
extracted.push(curr)
... | javascript | function extract (query) {
var toSplice = []
var extracted = []
return function (prev, curr, index, array) {
if (prev !== extracted) {
if (testValue(prev, query)) {
extracted.push(prev)
toSplice.push(index - 1)
}
}
if (testValue(curr, query)) {
extracted.push(curr)
... | [
"function",
"extract",
"(",
"query",
")",
"{",
"var",
"toSplice",
"=",
"[",
"]",
"var",
"extracted",
"=",
"[",
"]",
"return",
"function",
"(",
"prev",
",",
"curr",
",",
"index",
",",
"array",
")",
"{",
"if",
"(",
"prev",
"!==",
"extracted",
")",
"{... | Removes items from `array` which satisfy the query. Modifies the input array, returns the extracted.
@param {Array} - the input array, modified directly
@param {any} - if an item in the input array passes this test it is removed
@alias module:reduce-extract
@example
> DJs = [
{ name: "Trevor", sacked: true },
{ name: ... | [
"Removes",
"items",
"from",
"array",
"which",
"satisfy",
"the",
"query",
".",
"Modifies",
"the",
"input",
"array",
"returns",
"the",
"extracted",
"."
] | 6482517dd0107b4adea56aa3516e586c189e44f5 | https://github.com/75lb/reduce-extract/blob/6482517dd0107b4adea56aa3516e586c189e44f5/lib/reduce-extract.js#L32-L56 | train |
fresheneesz/grapetree-core | grapetreeCore.js | getNewRouteInfo | function getNewRouteInfo(that, newRoutePath, path, pathToEmit) {
var indexes = getDivergenceIndexes(that.currentPath, path, newRoutePath)
if(indexes === undefined) {
return undefined
}
var routeDivergenceIndex = indexes.routeIndex
var pathDivergenceIndex = indexes.pa... | javascript | function getNewRouteInfo(that, newRoutePath, path, pathToEmit) {
var indexes = getDivergenceIndexes(that.currentPath, path, newRoutePath)
if(indexes === undefined) {
return undefined
}
var routeDivergenceIndex = indexes.routeIndex
var pathDivergenceIndex = indexes.pa... | [
"function",
"getNewRouteInfo",
"(",
"that",
",",
"newRoutePath",
",",
"path",
",",
"pathToEmit",
")",
"{",
"var",
"indexes",
"=",
"getDivergenceIndexes",
"(",
"that",
".",
"currentPath",
",",
"path",
",",
"newRoutePath",
")",
"if",
"(",
"indexes",
"===",
"un... | returns an object with the properties newRoutes - an array of Route objects; the list of new routes to enter divergenceIndex - the route divergence index pathToEmit - the path to use when emitting the 'change' event or undefined - if the paths are the same | [
"returns",
"an",
"object",
"with",
"the",
"properties",
"newRoutes",
"-",
"an",
"array",
"of",
"Route",
"objects",
";",
"the",
"list",
"of",
"new",
"routes",
"to",
"enter",
"divergenceIndex",
"-",
"the",
"route",
"divergence",
"index",
"pathToEmit",
"-",
"th... | 3dbe622ba56cb1d227e104dd68d4787ae9aaf201 | https://github.com/fresheneesz/grapetree-core/blob/3dbe622ba56cb1d227e104dd68d4787ae9aaf201/grapetreeCore.js#L136-L182 | train |
fresheneesz/grapetree-core | grapetreeCore.js | loopThroughHandlers | function loopThroughHandlers(lastFuture, n) {
if(n < routes.length) {
var route = routes[n].route
var handler = route[handlerProperty]
if(direction === -1) {
var originalIndexFromCurrentRoutes = currentRoutes.length - n - 1
... | javascript | function loopThroughHandlers(lastFuture, n) {
if(n < routes.length) {
var route = routes[n].route
var handler = route[handlerProperty]
if(direction === -1) {
var originalIndexFromCurrentRoutes = currentRoutes.length - n - 1
... | [
"function",
"loopThroughHandlers",
"(",
"lastFuture",
",",
"n",
")",
"{",
"if",
"(",
"n",
"<",
"routes",
".",
"length",
")",
"{",
"var",
"route",
"=",
"routes",
"[",
"n",
"]",
".",
"route",
"var",
"handler",
"=",
"route",
"[",
"handlerProperty",
"]",
... | returns a future that resolves to the maximum depth that succeeded | [
"returns",
"a",
"future",
"that",
"resolves",
"to",
"the",
"maximum",
"depth",
"that",
"succeeded"
] | 3dbe622ba56cb1d227e104dd68d4787ae9aaf201 | https://github.com/fresheneesz/grapetree-core/blob/3dbe622ba56cb1d227e104dd68d4787ae9aaf201/grapetreeCore.js#L413-L463 | train |
feedm3/hypem-resolver | hypem-resolver.js | urlToId | function urlToId(hypemUrl) {
var trimmedUrl = _.trim(hypemUrl);
if (_.startsWith(trimmedUrl, HYPEM_TRACK_URL)) {
var parsedUrl = url.parse(hypemUrl);
var pathname = parsedUrl.pathname; // '/trach/31jfi/...'
var hypemId = pathname.split("/")[2];
return hype... | javascript | function urlToId(hypemUrl) {
var trimmedUrl = _.trim(hypemUrl);
if (_.startsWith(trimmedUrl, HYPEM_TRACK_URL)) {
var parsedUrl = url.parse(hypemUrl);
var pathname = parsedUrl.pathname; // '/trach/31jfi/...'
var hypemId = pathname.split("/")[2];
return hype... | [
"function",
"urlToId",
"(",
"hypemUrl",
")",
"{",
"var",
"trimmedUrl",
"=",
"_",
".",
"trim",
"(",
"hypemUrl",
")",
";",
"if",
"(",
"_",
".",
"startsWith",
"(",
"trimmedUrl",
",",
"HYPEM_TRACK_URL",
")",
")",
"{",
"var",
"parsedUrl",
"=",
"url",
".",
... | Extract the hypem id from a song's url.
@param {string} hypemUrl the url to extract the id
@returns {string} the id or "" if no id was found | [
"Extract",
"the",
"hypem",
"id",
"from",
"a",
"song",
"s",
"url",
"."
] | e20e0cf1ba93eac47f830c4b8693f13c4ca2588b | https://github.com/feedm3/hypem-resolver/blob/e20e0cf1ba93eac47f830c4b8693f13c4ca2588b/hypem-resolver.js#L27-L36 | train |
feedm3/hypem-resolver | hypem-resolver.js | getById | function getById(hypemId, callback) {
var options = {
method: 'HEAD',
url: HYPEM_GO_URL + hypemId,
followRedirect: false,
timeout: FIVE_SECONDS_IN_MILLIS
};
request(options, function (error, response) {
if (error || response.statusCode... | javascript | function getById(hypemId, callback) {
var options = {
method: 'HEAD',
url: HYPEM_GO_URL + hypemId,
followRedirect: false,
timeout: FIVE_SECONDS_IN_MILLIS
};
request(options, function (error, response) {
if (error || response.statusCode... | [
"function",
"getById",
"(",
"hypemId",
",",
"callback",
")",
"{",
"var",
"options",
"=",
"{",
"method",
":",
"'HEAD'",
",",
"url",
":",
"HYPEM_GO_URL",
"+",
"hypemId",
",",
"followRedirect",
":",
"false",
",",
"timeout",
":",
"FIVE_SECONDS_IN_MILLIS",
"}",
... | Get the soundcloud or mp3 url from a song's id.
@param hypemId {string} the id of the song
@param {Function}[callback] callback function
@param {Error} callback.err null if no error occurred
@param {string} callback.url the soundcloud or mp3 url | [
"Get",
"the",
"soundcloud",
"or",
"mp3",
"url",
"from",
"a",
"song",
"s",
"id",
"."
] | e20e0cf1ba93eac47f830c4b8693f13c4ca2588b | https://github.com/feedm3/hypem-resolver/blob/e20e0cf1ba93eac47f830c4b8693f13c4ca2588b/hypem-resolver.js#L46-L73 | 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.