id int32 0 58k | repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 |
|---|---|---|---|---|---|---|---|---|---|---|---|
51,200 | noblesamurai/noblerecord | src/migration.js | columnToSQL | function columnToSQL(col) {
var sql = "`" + col.name + "` ";
sql += nrutil.typeToSQL(col.type);
if (col['additional']) {
sql += ' ' + col['additional'];
}
if (!col['allow_null']) {
sql += " NOT NULL";
}
if (col['default_value'] !== undefined) {
var def = col['default_value']
sql += " DEFAULT " + nru... | javascript | function columnToSQL(col) {
var sql = "`" + col.name + "` ";
sql += nrutil.typeToSQL(col.type);
if (col['additional']) {
sql += ' ' + col['additional'];
}
if (!col['allow_null']) {
sql += " NOT NULL";
}
if (col['default_value'] !== undefined) {
var def = col['default_value']
sql += " DEFAULT " + nru... | [
"function",
"columnToSQL",
"(",
"col",
")",
"{",
"var",
"sql",
"=",
"\"`\"",
"+",
"col",
".",
"name",
"+",
"\"` \"",
";",
"sql",
"+=",
"nrutil",
".",
"typeToSQL",
"(",
"col",
".",
"type",
")",
";",
"if",
"(",
"col",
"[",
"'additional'",
"]",
")",
... | Generates the SQL fragment defining a given column. | [
"Generates",
"the",
"SQL",
"fragment",
"defining",
"a",
"given",
"column",
"."
] | fc7d3aac186598c4c7023f5448979d4162ab5e38 | https://github.com/noblesamurai/noblerecord/blob/fc7d3aac186598c4c7023f5448979d4162ab5e38/src/migration.js#L26-L50 |
51,201 | noblesamurai/noblerecord | src/migration.js | function(name, newname) {
var act = new NobleMachine(function() {
act.toNext(db.query("SHOW COLUMNS FROM `" + tablename + "`;"));
});
act.next(function(result) {
var sql = "ALTER TABLE `" + tablename + "` CHANGE `" + name + "` `" + newname + "`";
result.forEach(function(coldatum) {
if... | javascript | function(name, newname) {
var act = new NobleMachine(function() {
act.toNext(db.query("SHOW COLUMNS FROM `" + tablename + "`;"));
});
act.next(function(result) {
var sql = "ALTER TABLE `" + tablename + "` CHANGE `" + name + "` `" + newname + "`";
result.forEach(function(coldatum) {
if... | [
"function",
"(",
"name",
",",
"newname",
")",
"{",
"var",
"act",
"=",
"new",
"NobleMachine",
"(",
"function",
"(",
")",
"{",
"act",
".",
"toNext",
"(",
"db",
".",
"query",
"(",
"\"SHOW COLUMNS FROM `\"",
"+",
"tablename",
"+",
"\"`;\"",
")",
")",
";",
... | There doesn't seem to be a proper RENAME COLUMN statement in MySQL. As such, it is necessary to use CHANGE after extracting the current column definition. | [
"There",
"doesn",
"t",
"seem",
"to",
"be",
"a",
"proper",
"RENAME",
"COLUMN",
"statement",
"in",
"MySQL",
".",
"As",
"such",
"it",
"is",
"necessary",
"to",
"use",
"CHANGE",
"after",
"extracting",
"the",
"current",
"column",
"definition",
"."
] | fc7d3aac186598c4c7023f5448979d4162ab5e38 | https://github.com/noblesamurai/noblerecord/blob/fc7d3aac186598c4c7023f5448979d4162ab5e38/src/migration.js#L109-L142 | |
51,202 | noblesamurai/noblerecord | src/migration.js | function() {
var me = {};
var db = common.config.database;
me.act = new NobleMachine();
return _.extend(me, {
create_table: function(name, definer) {
var t = new TableDefinition(name, 'create', definer);
me.act.next(t.act);
},
change_table: function(name, definer) {
var t = new TableDefinition(nam... | javascript | function() {
var me = {};
var db = common.config.database;
me.act = new NobleMachine();
return _.extend(me, {
create_table: function(name, definer) {
var t = new TableDefinition(name, 'create', definer);
me.act.next(t.act);
},
change_table: function(name, definer) {
var t = new TableDefinition(nam... | [
"function",
"(",
")",
"{",
"var",
"me",
"=",
"{",
"}",
";",
"var",
"db",
"=",
"common",
".",
"config",
".",
"database",
";",
"me",
".",
"act",
"=",
"new",
"NobleMachine",
"(",
")",
";",
"return",
"_",
".",
"extend",
"(",
"me",
",",
"{",
"create... | Database definition class. Conglomerates TableDefinitions and SQL actions corresponding to friendly definition calls. | [
"Database",
"definition",
"class",
".",
"Conglomerates",
"TableDefinitions",
"and",
"SQL",
"actions",
"corresponding",
"to",
"friendly",
"definition",
"calls",
"."
] | fc7d3aac186598c4c7023f5448979d4162ab5e38 | https://github.com/noblesamurai/noblerecord/blob/fc7d3aac186598c4c7023f5448979d4162ab5e38/src/migration.js#L175-L200 | |
51,203 | jonschlinkert/verbalize | examples/index.js | helpPlugin | function helpPlugin() {
return function(app) {
// style to turn `[ ]` strings into
// colored strings with backticks
app.style('codify', function(msg) {
var re = /\[([^\]]*\[?[^\]]*\]?[^[]*)\]/g;
return msg.replace(re, function(str, code) {
return this.red('`' + code + '`');
}.b... | javascript | function helpPlugin() {
return function(app) {
// style to turn `[ ]` strings into
// colored strings with backticks
app.style('codify', function(msg) {
var re = /\[([^\]]*\[?[^\]]*\]?[^[]*)\]/g;
return msg.replace(re, function(str, code) {
return this.red('`' + code + '`');
}.b... | [
"function",
"helpPlugin",
"(",
")",
"{",
"return",
"function",
"(",
"app",
")",
"{",
"// style to turn `[ ]` strings into",
"// colored strings with backticks",
"app",
".",
"style",
"(",
"'codify'",
",",
"function",
"(",
"msg",
")",
"{",
"var",
"re",
"=",
"/",
... | This plugin adds styles and emitters to make it
easier to log out help text | [
"This",
"plugin",
"adds",
"styles",
"and",
"emitters",
"to",
"make",
"it",
"easier",
"to",
"log",
"out",
"help",
"text"
] | 3d590602fde6a13682d0eebc180c731ea386b64f | https://github.com/jonschlinkert/verbalize/blob/3d590602fde6a13682d0eebc180c731ea386b64f/examples/index.js#L20-L98 |
51,204 | tolokoban/ToloFrameWork | lib/util.js | removeDoubles | function removeDoubles( arrInput ) {
const
arrOutput = [],
map = {};
arrInput.forEach( function forEachItem( itm ) {
if ( itm in map ) return;
map[ itm ] = 1;
arrOutput.push( itm );
} );
return arrOutput;
} | javascript | function removeDoubles( arrInput ) {
const
arrOutput = [],
map = {};
arrInput.forEach( function forEachItem( itm ) {
if ( itm in map ) return;
map[ itm ] = 1;
arrOutput.push( itm );
} );
return arrOutput;
} | [
"function",
"removeDoubles",
"(",
"arrInput",
")",
"{",
"const",
"arrOutput",
"=",
"[",
"]",
",",
"map",
"=",
"{",
"}",
";",
"arrInput",
".",
"forEach",
"(",
"function",
"forEachItem",
"(",
"itm",
")",
"{",
"if",
"(",
"itm",
"in",
"map",
")",
"return... | Return a copy of an array after removing all doubles.
@param {array} arrInput array of any comparable object.
@returns {array} A copy of the input array without doubles. | [
"Return",
"a",
"copy",
"of",
"an",
"array",
"after",
"removing",
"all",
"doubles",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/lib/util.js#L307-L317 |
51,205 | tolokoban/ToloFrameWork | lib/util.js | cleanDir | function cleanDir( path, _preserveGit ) {
const
preserveGit = typeof _preserveGit !== 'undefined' ? _preserveGit : false,
fullPath = Path.resolve( path );
// If the pah does not exist, everything is fine!
if ( !FS.existsSync( fullPath ) ) return;
if ( preserveGit ) {
/*
* We m... | javascript | function cleanDir( path, _preserveGit ) {
const
preserveGit = typeof _preserveGit !== 'undefined' ? _preserveGit : false,
fullPath = Path.resolve( path );
// If the pah does not exist, everything is fine!
if ( !FS.existsSync( fullPath ) ) return;
if ( preserveGit ) {
/*
* We m... | [
"function",
"cleanDir",
"(",
"path",
",",
"_preserveGit",
")",
"{",
"const",
"preserveGit",
"=",
"typeof",
"_preserveGit",
"!==",
"'undefined'",
"?",
"_preserveGit",
":",
"false",
",",
"fullPath",
"=",
"Path",
".",
"resolve",
"(",
"path",
")",
";",
"// If th... | Remove all files and directories found in `path`, but not `path` itself.
@param {string} path - The folder we want to clean the content.
@param {boolean} _preserveGit [false] - If `true`, the folder ".git" is not deleted.
@returns {undefined} | [
"Remove",
"all",
"files",
"and",
"directories",
"found",
"in",
"path",
"but",
"not",
"path",
"itself",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/lib/util.js#L325-L353 |
51,206 | tolokoban/ToloFrameWork | lib/util.js | isNewerThan | function isNewerThan( inputs, target ) {
if ( !FS.existsSync( target ) ) return true;
const files = Array.isArray( inputs ) ? inputs : [ inputs ],
statTarget = FS.statSync( target ),
targetTime = statTarget.mtime;
for ( const file of files ) {
if ( !FS.existsSync( file ) ) cont... | javascript | function isNewerThan( inputs, target ) {
if ( !FS.existsSync( target ) ) return true;
const files = Array.isArray( inputs ) ? inputs : [ inputs ],
statTarget = FS.statSync( target ),
targetTime = statTarget.mtime;
for ( const file of files ) {
if ( !FS.existsSync( file ) ) cont... | [
"function",
"isNewerThan",
"(",
"inputs",
",",
"target",
")",
"{",
"if",
"(",
"!",
"FS",
".",
"existsSync",
"(",
"target",
")",
")",
"return",
"true",
";",
"const",
"files",
"=",
"Array",
".",
"isArray",
"(",
"inputs",
")",
"?",
"inputs",
":",
"[",
... | Check if at least one file is newer than the target one.
@param {array} inputs - Array of files (with full path) to compare to `target`.
@param {string} target - Full path of the reference file.
@returns {Boolean} `true` if `target` does not exist, or if at leat one input is newer than `target`. | [
"Check",
"if",
"at",
"least",
"one",
"file",
"is",
"newer",
"than",
"the",
"target",
"one",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/lib/util.js#L467-L483 |
51,207 | keleko34/KObservableData | KObservableData/KObservableData.js | addData | function addData(a)
{
if(isObject(a.event.value) || isArray(a.event.value))
{
if(!isObservable(a.event.value))
{
a.preventDefault();
var local = a.event.local,
str = local.__kbscopeString+(loc... | javascript | function addData(a)
{
if(isObject(a.event.value) || isArray(a.event.value))
{
if(!isObservable(a.event.value))
{
a.preventDefault();
var local = a.event.local,
str = local.__kbscopeString+(loc... | [
"function",
"addData",
"(",
"a",
")",
"{",
"if",
"(",
"isObject",
"(",
"a",
".",
"event",
".",
"value",
")",
"||",
"isArray",
"(",
"a",
".",
"event",
".",
"value",
")",
")",
"{",
"if",
"(",
"!",
"isObservable",
"(",
"a",
".",
"event",
".",
"val... | these take care of recursion for us | [
"these",
"take",
"care",
"of",
"recursion",
"for",
"us"
] | 22a3637cba73be7533a76141803644472443b606 | https://github.com/keleko34/KObservableData/blob/22a3637cba73be7533a76141803644472443b606/KObservableData/KObservableData.js#L269-L295 |
51,208 | perfectapi/ami-generator | www/build/tools/csslint-rhino.js | SyntaxUnit | function SyntaxUnit(text, line, col){
/**
* The column of text on which the unit resides.
* @type int
* @property col
*/
this.col = col;
/**
* The line of text on which the unit resides.
* @type int
* @property line
*/
this.line = line;
/**
* The text... | javascript | function SyntaxUnit(text, line, col){
/**
* The column of text on which the unit resides.
* @type int
* @property col
*/
this.col = col;
/**
* The line of text on which the unit resides.
* @type int
* @property line
*/
this.line = line;
/**
* The text... | [
"function",
"SyntaxUnit",
"(",
"text",
",",
"line",
",",
"col",
")",
"{",
"/**\n * The column of text on which the unit resides.\n * @type int\n * @property col\n */",
"this",
".",
"col",
"=",
"col",
";",
"/**\n * The line of text on which the unit resides.\n ... | Base type to represent a single syntactic unit.
@class SyntaxUnit
@namespace parserlib.util
@constructor
@param {String} text The text of the unit.
@param {int} line The line of text on which the unit resides.
@param {int} col The column of text on which the unit resides. | [
"Base",
"type",
"to",
"represent",
"a",
"single",
"syntactic",
"unit",
"."
] | 7913f300cccc79c59a2feac42225bbb26c042766 | https://github.com/perfectapi/ami-generator/blob/7913f300cccc79c59a2feac42225bbb26c042766/www/build/tools/csslint-rhino.js#L452-L476 |
51,209 | perfectapi/ami-generator | www/build/tools/csslint-rhino.js | function(type, listener){
if (this._handlers[type] instanceof Array){
var handlers = this._handlers[type];
for (var i=0, len=handlers.length; i < len; i++){
if (handlers[i] === listener){
handlers.splice(i, 1);
break;
... | javascript | function(type, listener){
if (this._handlers[type] instanceof Array){
var handlers = this._handlers[type];
for (var i=0, len=handlers.length; i < len; i++){
if (handlers[i] === listener){
handlers.splice(i, 1);
break;
... | [
"function",
"(",
"type",
",",
"listener",
")",
"{",
"if",
"(",
"this",
".",
"_handlers",
"[",
"type",
"]",
"instanceof",
"Array",
")",
"{",
"var",
"handlers",
"=",
"this",
".",
"_handlers",
"[",
"type",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
... | Removes a listener for a given event type.
@param {String} type The type of event to remove a listener from.
@param {Function} listener The function to remove from the event.
@return {void}
@method detach | [
"Removes",
"a",
"listener",
"for",
"a",
"given",
"event",
"type",
"."
] | 7913f300cccc79c59a2feac42225bbb26c042766 | https://github.com/perfectapi/ami-generator/blob/7913f300cccc79c59a2feac42225bbb26c042766/www/build/tools/csslint-rhino.js#L4912-L4922 | |
51,210 | perfectapi/ami-generator | www/build/tools/csslint-rhino.js | function(receiver, supplier){
for (var prop in supplier){
if (supplier.hasOwnProperty(prop)){
receiver[prop] = supplier[prop];
}
}
return receiver;
} | javascript | function(receiver, supplier){
for (var prop in supplier){
if (supplier.hasOwnProperty(prop)){
receiver[prop] = supplier[prop];
}
}
return receiver;
} | [
"function",
"(",
"receiver",
",",
"supplier",
")",
"{",
"for",
"(",
"var",
"prop",
"in",
"supplier",
")",
"{",
"if",
"(",
"supplier",
".",
"hasOwnProperty",
"(",
"prop",
")",
")",
"{",
"receiver",
"[",
"prop",
"]",
"=",
"supplier",
"[",
"prop",
"]",
... | Mixes the own properties from the supplier onto the
receiver.
@param {Object} receiver The object to receive the properties.
@param {Object} supplier The object to supply the properties.
@return {Object} The receiver that was passed in.
@method mix
@static | [
"Mixes",
"the",
"own",
"properties",
"from",
"the",
"supplier",
"onto",
"the",
"receiver",
"."
] | 7913f300cccc79c59a2feac42225bbb26c042766 | https://github.com/perfectapi/ami-generator/blob/7913f300cccc79c59a2feac42225bbb26c042766/www/build/tools/csslint-rhino.js#L4956-L4965 | |
51,211 | perfectapi/ami-generator | www/build/tools/csslint-rhino.js | function (expected, actual, message) {
YUITest.Assert._increment();
if (expected !== actual) {
throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(message, "Values should be the same."), expected, actual);
}
} | javascript | function (expected, actual, message) {
YUITest.Assert._increment();
if (expected !== actual) {
throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(message, "Values should be the same."), expected, actual);
}
} | [
"function",
"(",
"expected",
",",
"actual",
",",
"message",
")",
"{",
"YUITest",
".",
"Assert",
".",
"_increment",
"(",
")",
";",
"if",
"(",
"expected",
"!==",
"actual",
")",
"{",
"throw",
"new",
"YUITest",
".",
"ComparisonFailure",
"(",
"YUITest",
".",
... | Asserts that a value is the same as another. This uses the triple equals sign
so no type cohersion may occur.
@param {Object} expected The expected value.
@param {Object} actual The actual value to test.
@param {String} message (Optional) The message to display if the assertion fails.
@method areSame
@static | [
"Asserts",
"that",
"a",
"value",
"is",
"the",
"same",
"as",
"another",
".",
"This",
"uses",
"the",
"triple",
"equals",
"sign",
"so",
"no",
"type",
"cohersion",
"may",
"occur",
"."
] | 7913f300cccc79c59a2feac42225bbb26c042766 | https://github.com/perfectapi/ami-generator/blob/7913f300cccc79c59a2feac42225bbb26c042766/www/build/tools/csslint-rhino.js#L5429-L5434 | |
51,212 | perfectapi/ami-generator | www/build/tools/csslint-rhino.js | function (actual, message) {
YUITest.Assert._increment();
if (true !== actual) {
throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(message, "Value should be true."), true, actual);
}
} | javascript | function (actual, message) {
YUITest.Assert._increment();
if (true !== actual) {
throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(message, "Value should be true."), true, actual);
}
} | [
"function",
"(",
"actual",
",",
"message",
")",
"{",
"YUITest",
".",
"Assert",
".",
"_increment",
"(",
")",
";",
"if",
"(",
"true",
"!==",
"actual",
")",
"{",
"throw",
"new",
"YUITest",
".",
"ComparisonFailure",
"(",
"YUITest",
".",
"Assert",
".",
"_fo... | Asserts that a value is true. This uses the triple equals sign
so no type cohersion may occur.
@param {Object} actual The actual value to test.
@param {String} message (Optional) The message to display if the assertion fails.
@method isTrue
@static | [
"Asserts",
"that",
"a",
"value",
"is",
"true",
".",
"This",
"uses",
"the",
"triple",
"equals",
"sign",
"so",
"no",
"type",
"cohersion",
"may",
"occur",
"."
] | 7913f300cccc79c59a2feac42225bbb26c042766 | https://github.com/perfectapi/ami-generator/blob/7913f300cccc79c59a2feac42225bbb26c042766/www/build/tools/csslint-rhino.js#L5463-L5469 | |
51,213 | perfectapi/ami-generator | www/build/tools/csslint-rhino.js | function (actual, message) {
YUITest.Assert._increment();
if (actual !== null) {
throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(message, "Value should be null."), null, actual);
}
} | javascript | function (actual, message) {
YUITest.Assert._increment();
if (actual !== null) {
throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(message, "Value should be null."), null, actual);
}
} | [
"function",
"(",
"actual",
",",
"message",
")",
"{",
"YUITest",
".",
"Assert",
".",
"_increment",
"(",
")",
";",
"if",
"(",
"actual",
"!==",
"null",
")",
"{",
"throw",
"new",
"YUITest",
".",
"ComparisonFailure",
"(",
"YUITest",
".",
"Assert",
".",
"_fo... | Asserts that a value is null. This uses the triple equals sign
so no type cohersion may occur.
@param {Object} actual The actual value to test.
@param {String} message (Optional) The message to display if the assertion fails.
@method isNull
@static | [
"Asserts",
"that",
"a",
"value",
"is",
"null",
".",
"This",
"uses",
"the",
"triple",
"equals",
"sign",
"so",
"no",
"type",
"cohersion",
"may",
"occur",
"."
] | 7913f300cccc79c59a2feac42225bbb26c042766 | https://github.com/perfectapi/ami-generator/blob/7913f300cccc79c59a2feac42225bbb26c042766/www/build/tools/csslint-rhino.js#L5541-L5546 | |
51,214 | perfectapi/ami-generator | www/build/tools/csslint-rhino.js | function (actual, message) {
YUITest.Assert._increment();
if (typeof actual != "undefined") {
throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(message, "Value should be undefined."), undefined, actual);
}
} | javascript | function (actual, message) {
YUITest.Assert._increment();
if (typeof actual != "undefined") {
throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(message, "Value should be undefined."), undefined, actual);
}
} | [
"function",
"(",
"actual",
",",
"message",
")",
"{",
"YUITest",
".",
"Assert",
".",
"_increment",
"(",
")",
";",
"if",
"(",
"typeof",
"actual",
"!=",
"\"undefined\"",
")",
"{",
"throw",
"new",
"YUITest",
".",
"ComparisonFailure",
"(",
"YUITest",
".",
"As... | Asserts that a value is undefined. This uses the triple equals sign
so no type cohersion may occur.
@param {Object} actual The actual value to test.
@param {String} message (Optional) The message to display if the assertion fails.
@method isUndefined
@static | [
"Asserts",
"that",
"a",
"value",
"is",
"undefined",
".",
"This",
"uses",
"the",
"triple",
"equals",
"sign",
"so",
"no",
"type",
"cohersion",
"may",
"occur",
"."
] | 7913f300cccc79c59a2feac42225bbb26c042766 | https://github.com/perfectapi/ami-generator/blob/7913f300cccc79c59a2feac42225bbb26c042766/www/build/tools/csslint-rhino.js#L5556-L5561 | |
51,215 | perfectapi/ami-generator | www/build/tools/csslint-rhino.js | function (actual, message) {
YUITest.Assert._increment();
if (typeof actual != "boolean"){
throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(message, "Value should be a Boolean."), actual);
}
} | javascript | function (actual, message) {
YUITest.Assert._increment();
if (typeof actual != "boolean"){
throw new YUITest.UnexpectedValue(YUITest.Assert._formatMessage(message, "Value should be a Boolean."), actual);
}
} | [
"function",
"(",
"actual",
",",
"message",
")",
"{",
"YUITest",
".",
"Assert",
".",
"_increment",
"(",
")",
";",
"if",
"(",
"typeof",
"actual",
"!=",
"\"boolean\"",
")",
"{",
"throw",
"new",
"YUITest",
".",
"UnexpectedValue",
"(",
"YUITest",
".",
"Assert... | Asserts that a value is a Boolean.
@param {Object} actual The value to test.
@param {String} message (Optional) The message to display if the assertion fails.
@method isBoolean
@static | [
"Asserts",
"that",
"a",
"value",
"is",
"a",
"Boolean",
"."
] | 7913f300cccc79c59a2feac42225bbb26c042766 | https://github.com/perfectapi/ami-generator/blob/7913f300cccc79c59a2feac42225bbb26c042766/www/build/tools/csslint-rhino.js#L5594-L5599 | |
51,216 | perfectapi/ami-generator | www/build/tools/csslint-rhino.js | function (expectedType, actualValue, message){
YUITest.Assert._increment();
if (typeof actualValue != expectedType){
throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(message, "Value should be of type " + expectedType + "."), expectedType, typeof actualValue);
}
} | javascript | function (expectedType, actualValue, message){
YUITest.Assert._increment();
if (typeof actualValue != expectedType){
throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(message, "Value should be of type " + expectedType + "."), expectedType, typeof actualValue);
}
} | [
"function",
"(",
"expectedType",
",",
"actualValue",
",",
"message",
")",
"{",
"YUITest",
".",
"Assert",
".",
"_increment",
"(",
")",
";",
"if",
"(",
"typeof",
"actualValue",
"!=",
"expectedType",
")",
"{",
"throw",
"new",
"YUITest",
".",
"ComparisonFailure"... | Asserts that a value is of a particular type.
@param {String} expectedType The expected type of the variable.
@param {Object} actualValue The actual value to test.
@param {String} message (Optional) The message to display if the assertion fails.
@method isTypeOf
@static | [
"Asserts",
"that",
"a",
"value",
"is",
"of",
"a",
"particular",
"type",
"."
] | 7913f300cccc79c59a2feac42225bbb26c042766 | https://github.com/perfectapi/ami-generator/blob/7913f300cccc79c59a2feac42225bbb26c042766/www/build/tools/csslint-rhino.js#L5682-L5687 | |
51,217 | perfectapi/ami-generator | www/build/tools/csslint-rhino.js | function (needle, haystack,
message) {
YUITest.Assert._increment();
if (this._indexOf(haystack, needle) == -1){
YUITest.Assert.fail(YUITest.Assert._formatMessage(message, "Value " + needle + " (" + (typeof needle) + ") not found in array [" + haystack + "]."));
... | javascript | function (needle, haystack,
message) {
YUITest.Assert._increment();
if (this._indexOf(haystack, needle) == -1){
YUITest.Assert.fail(YUITest.Assert._formatMessage(message, "Value " + needle + " (" + (typeof needle) + ") not found in array [" + haystack + "]."));
... | [
"function",
"(",
"needle",
",",
"haystack",
",",
"message",
")",
"{",
"YUITest",
".",
"Assert",
".",
"_increment",
"(",
")",
";",
"if",
"(",
"this",
".",
"_indexOf",
"(",
"haystack",
",",
"needle",
")",
"==",
"-",
"1",
")",
"{",
"YUITest",
".",
"As... | Asserts that a value is present in an array. This uses the triple equals
sign so no type cohersion may occur.
@param {Object} needle The value that is expected in the array.
@param {Array} haystack An array of values.
@param {String} message (Optional) The message to display if the assertion fails.
@method contains
@st... | [
"Asserts",
"that",
"a",
"value",
"is",
"present",
"in",
"an",
"array",
".",
"This",
"uses",
"the",
"triple",
"equals",
"sign",
"so",
"no",
"type",
"cohersion",
"may",
"occur",
"."
] | 7913f300cccc79c59a2feac42225bbb26c042766 | https://github.com/perfectapi/ami-generator/blob/7913f300cccc79c59a2feac42225bbb26c042766/www/build/tools/csslint-rhino.js#L5824-L5832 | |
51,218 | perfectapi/ami-generator | www/build/tools/csslint-rhino.js | function (needles, haystack,
message) {
YUITest.Assert._increment();
for (var i=0; i < needles.length; i++){
if (this._indexOf(haystack, needles[i]) > -1){
YUITest.Assert.fail(YUITest.Assert._formatMessage(message, "Value found in array [" + hayst... | javascript | function (needles, haystack,
message) {
YUITest.Assert._increment();
for (var i=0; i < needles.length; i++){
if (this._indexOf(haystack, needles[i]) > -1){
YUITest.Assert.fail(YUITest.Assert._formatMessage(message, "Value found in array [" + hayst... | [
"function",
"(",
"needles",
",",
"haystack",
",",
"message",
")",
"{",
"YUITest",
".",
"Assert",
".",
"_increment",
"(",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"needles",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"... | Asserts that a set of values are not present in an array. This uses the triple equals
sign so no type cohersion may occur. For this assertion to pass, all values must
not be found.
@param {Object[]} needles An array of values that are not expected in the array.
@param {Array} haystack An array of values to check.
@para... | [
"Asserts",
"that",
"a",
"set",
"of",
"values",
"are",
"not",
"present",
"in",
"an",
"array",
".",
"This",
"uses",
"the",
"triple",
"equals",
"sign",
"so",
"no",
"type",
"cohersion",
"may",
"occur",
".",
"For",
"this",
"assertion",
"to",
"pass",
"all",
... | 7913f300cccc79c59a2feac42225bbb26c042766 | https://github.com/perfectapi/ami-generator/blob/7913f300cccc79c59a2feac42225bbb26c042766/www/build/tools/csslint-rhino.js#L5909-L5920 | |
51,219 | perfectapi/ami-generator | www/build/tools/csslint-rhino.js | function (matcher, haystack,
message) {
YUITest.Assert._increment();
//check for valid matcher
if (typeof matcher != "function"){
throw new TypeError("ArrayAssert.doesNotContainMatch(): First argument must be a function.");
}
if (this._so... | javascript | function (matcher, haystack,
message) {
YUITest.Assert._increment();
//check for valid matcher
if (typeof matcher != "function"){
throw new TypeError("ArrayAssert.doesNotContainMatch(): First argument must be a function.");
}
if (this._so... | [
"function",
"(",
"matcher",
",",
"haystack",
",",
"message",
")",
"{",
"YUITest",
".",
"Assert",
".",
"_increment",
"(",
")",
";",
"//check for valid matcher",
"if",
"(",
"typeof",
"matcher",
"!=",
"\"function\"",
")",
"{",
"throw",
"new",
"TypeError",
"(",
... | Asserts that no values matching a condition are present in an array. This uses
a function to determine a match.
@param {Function} matcher A function that returns true if the item matches or false if not.
@param {Array} haystack An array of values.
@param {String} message (Optional) The message to display if the asserti... | [
"Asserts",
"that",
"no",
"values",
"matching",
"a",
"condition",
"are",
"present",
"in",
"an",
"array",
".",
"This",
"uses",
"a",
"function",
"to",
"determine",
"a",
"match",
"."
] | 7913f300cccc79c59a2feac42225bbb26c042766 | https://github.com/perfectapi/ami-generator/blob/7913f300cccc79c59a2feac42225bbb26c042766/www/build/tools/csslint-rhino.js#L5931-L5944 | |
51,220 | perfectapi/ami-generator | www/build/tools/csslint-rhino.js | function (expected, actual,
message) {
YUITest.Assert._increment();
//first check array length
if (expected.length != actual.length){
YUITest.Assert.fail(YUITest.Assert._formatMessage(message, "Array should have a length of " + expected.length + " but has... | javascript | function (expected, actual,
message) {
YUITest.Assert._increment();
//first check array length
if (expected.length != actual.length){
YUITest.Assert.fail(YUITest.Assert._formatMessage(message, "Array should have a length of " + expected.length + " but has... | [
"function",
"(",
"expected",
",",
"actual",
",",
"message",
")",
"{",
"YUITest",
".",
"Assert",
".",
"_increment",
"(",
")",
";",
"//first check array length",
"if",
"(",
"expected",
".",
"length",
"!=",
"actual",
".",
"length",
")",
"{",
"YUITest",
".",
... | Asserts that the values in an array are equal, and in the same position,
as values in another array. This uses the double equals sign
so type cohersion may occur. Note that the array objects themselves
need not be the same for this test to pass.
@param {Array} expected An array of the expected values.
@param {Array} ac... | [
"Asserts",
"that",
"the",
"values",
"in",
"an",
"array",
"are",
"equal",
"and",
"in",
"the",
"same",
"position",
"as",
"values",
"in",
"another",
"array",
".",
"This",
"uses",
"the",
"double",
"equals",
"sign",
"so",
"type",
"cohersion",
"may",
"occur",
... | 7913f300cccc79c59a2feac42225bbb26c042766 | https://github.com/perfectapi/ami-generator/blob/7913f300cccc79c59a2feac42225bbb26c042766/www/build/tools/csslint-rhino.js#L5985-L6001 | |
51,221 | perfectapi/ami-generator | www/build/tools/csslint-rhino.js | function (actual, message) {
YUITest.Assert._increment();
if (actual.length > 0){
YUITest.Assert.fail(YUITest.Assert._formatMessage(message, "Array should be empty."));
}
} | javascript | function (actual, message) {
YUITest.Assert._increment();
if (actual.length > 0){
YUITest.Assert.fail(YUITest.Assert._formatMessage(message, "Array should be empty."));
}
} | [
"function",
"(",
"actual",
",",
"message",
")",
"{",
"YUITest",
".",
"Assert",
".",
"_increment",
"(",
")",
";",
"if",
"(",
"actual",
".",
"length",
">",
"0",
")",
"{",
"YUITest",
".",
"Assert",
".",
"fail",
"(",
"YUITest",
".",
"Assert",
".",
"_fo... | Asserts that an array is empty.
@param {Array} actual The array to test.
@param {String} message (Optional) The message to display if the assertion fails.
@method isEmpty
@static | [
"Asserts",
"that",
"an",
"array",
"is",
"empty",
"."
] | 7913f300cccc79c59a2feac42225bbb26c042766 | https://github.com/perfectapi/ami-generator/blob/7913f300cccc79c59a2feac42225bbb26c042766/www/build/tools/csslint-rhino.js#L6047-L6052 | |
51,222 | perfectapi/ami-generator | www/build/tools/csslint-rhino.js | function (needle, haystack, index, message) {
//try to find the value in the array
for (var i=haystack.length; i >= 0; i--){
if (haystack[i] === needle){
if (index != i){
YUITest.Assert.fail(YUITest.Assert._formatMessage(message, "Value exists at index " ... | javascript | function (needle, haystack, index, message) {
//try to find the value in the array
for (var i=haystack.length; i >= 0; i--){
if (haystack[i] === needle){
if (index != i){
YUITest.Assert.fail(YUITest.Assert._formatMessage(message, "Value exists at index " ... | [
"function",
"(",
"needle",
",",
"haystack",
",",
"index",
",",
"message",
")",
"{",
"//try to find the value in the array",
"for",
"(",
"var",
"i",
"=",
"haystack",
".",
"length",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"if",
"(",
"haystack",
"[... | Asserts that the given value is contained in an array at the specified index,
starting from the back of the array.
This uses the triple equals sign so no type cohersion will occur.
@param {Object} needle The value to look for.
@param {Array} haystack The array to search in.
@param {int} index The index at which the val... | [
"Asserts",
"that",
"the",
"given",
"value",
"is",
"contained",
"in",
"an",
"array",
"at",
"the",
"specified",
"index",
"starting",
"from",
"the",
"back",
"of",
"the",
"array",
".",
"This",
"uses",
"the",
"triple",
"equals",
"sign",
"so",
"no",
"type",
"c... | 7913f300cccc79c59a2feac42225bbb26c042766 | https://github.com/perfectapi/ami-generator/blob/7913f300cccc79c59a2feac42225bbb26c042766/www/build/tools/csslint-rhino.js#L6108-L6122 | |
51,223 | perfectapi/ami-generator | www/build/tools/csslint-rhino.js | function(expected, actual, message) {
YUITest.Assert._increment();
for (var name in expected){
if (expected.hasOwnProperty(name)){
if (expected[name] != actual[name]){
throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(message, "Values shou... | javascript | function(expected, actual, message) {
YUITest.Assert._increment();
for (var name in expected){
if (expected.hasOwnProperty(name)){
if (expected[name] != actual[name]){
throw new YUITest.ComparisonFailure(YUITest.Assert._formatMessage(message, "Values shou... | [
"function",
"(",
"expected",
",",
"actual",
",",
"message",
")",
"{",
"YUITest",
".",
"Assert",
".",
"_increment",
"(",
")",
";",
"for",
"(",
"var",
"name",
"in",
"expected",
")",
"{",
"if",
"(",
"expected",
".",
"hasOwnProperty",
"(",
"name",
")",
"... | Asserts that an object has all of the same properties
and property values as the other.
@param {Object} expected The object with all expected properties and values.
@param {Object} actual The object to inspect.
@param {String} message (Optional) The message to display if the assertion fails.
@method areEqual
@static
@d... | [
"Asserts",
"that",
"an",
"object",
"has",
"all",
"of",
"the",
"same",
"properties",
"and",
"property",
"values",
"as",
"the",
"other",
"."
] | 7913f300cccc79c59a2feac42225bbb26c042766 | https://github.com/perfectapi/ami-generator/blob/7913f300cccc79c59a2feac42225bbb26c042766/www/build/tools/csslint-rhino.js#L6146-L6156 | |
51,224 | perfectapi/ami-generator | www/build/tools/csslint-rhino.js | function (object, message) {
YUITest.Assert._increment();
var count = 0,
name;
for (name in object){
if (object.hasOwnProperty(name)){
count++;
}
}
if (count !== 0){
YUITest.Assert.fail(YUITest.Assert._formatMessage... | javascript | function (object, message) {
YUITest.Assert._increment();
var count = 0,
name;
for (name in object){
if (object.hasOwnProperty(name)){
count++;
}
}
if (count !== 0){
YUITest.Assert.fail(YUITest.Assert._formatMessage... | [
"function",
"(",
"object",
",",
"message",
")",
"{",
"YUITest",
".",
"Assert",
".",
"_increment",
"(",
")",
";",
"var",
"count",
"=",
"0",
",",
"name",
";",
"for",
"(",
"name",
"in",
"object",
")",
"{",
"if",
"(",
"object",
".",
"hasOwnProperty",
"... | Asserts that an object owns no properties.
@param {Object} object The object to check.
@param {String} message (Optional) The message to display if the assertion fails.
@method ownsNoKeys
@static | [
"Asserts",
"that",
"an",
"object",
"owns",
"no",
"properties",
"."
] | 7913f300cccc79c59a2feac42225bbb26c042766 | https://github.com/perfectapi/ami-generator/blob/7913f300cccc79c59a2feac42225bbb26c042766/www/build/tools/csslint-rhino.js#L6255-L6269 | |
51,225 | perfectapi/ami-generator | www/build/tools/csslint-rhino.js | function (propertyName, object, message) {
YUITest.Assert._increment();
if (!(propertyName in object)){
YUITest.Assert.fail(YUITest.Assert._formatMessage(message, "Property '" + propertyName + "' not found on object."));
}
} | javascript | function (propertyName, object, message) {
YUITest.Assert._increment();
if (!(propertyName in object)){
YUITest.Assert.fail(YUITest.Assert._formatMessage(message, "Property '" + propertyName + "' not found on object."));
}
} | [
"function",
"(",
"propertyName",
",",
"object",
",",
"message",
")",
"{",
"YUITest",
".",
"Assert",
".",
"_increment",
"(",
")",
";",
"if",
"(",
"!",
"(",
"propertyName",
"in",
"object",
")",
")",
"{",
"YUITest",
".",
"Assert",
".",
"fail",
"(",
"YUI... | Asserts that an object has a property with the given name.
@param {String} propertyName The name of the property to test.
@param {Object} object The object to search.
@param {String} message (Optional) The message to display if the assertion fails.
@method ownsOrInheritsKey
@static | [
"Asserts",
"that",
"an",
"object",
"has",
"a",
"property",
"with",
"the",
"given",
"name",
"."
] | 7913f300cccc79c59a2feac42225bbb26c042766 | https://github.com/perfectapi/ami-generator/blob/7913f300cccc79c59a2feac42225bbb26c042766/www/build/tools/csslint-rhino.js#L6279-L6284 | |
51,226 | perfectapi/ami-generator | www/build/tools/csslint-rhino.js | function (properties, object, message) {
YUITest.Assert._increment();
for (var i=0; i < properties.length; i++){
if (!(properties[i] in object)){
YUITest.Assert.fail(YUITest.Assert._formatMessage(message, "Property '" + properties[i] + "' not found on object."));
... | javascript | function (properties, object, message) {
YUITest.Assert._increment();
for (var i=0; i < properties.length; i++){
if (!(properties[i] in object)){
YUITest.Assert.fail(YUITest.Assert._formatMessage(message, "Property '" + properties[i] + "' not found on object."));
... | [
"function",
"(",
"properties",
",",
"object",
",",
"message",
")",
"{",
"YUITest",
".",
"Assert",
".",
"_increment",
"(",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"properties",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",... | Asserts that an object has all properties of a reference object.
@param {Array} properties An array of property names that should be on the object.
@param {Object} object The object to search.
@param {String} message (Optional) The message to display if the assertion fails.
@method ownsOrInheritsKeys
@static | [
"Asserts",
"that",
"an",
"object",
"has",
"all",
"properties",
"of",
"a",
"reference",
"object",
"."
] | 7913f300cccc79c59a2feac42225bbb26c042766 | https://github.com/perfectapi/ami-generator/blob/7913f300cccc79c59a2feac42225bbb26c042766/www/build/tools/csslint-rhino.js#L6294-L6301 | |
51,227 | perfectapi/ami-generator | www/build/tools/csslint-rhino.js | function (expected, actual, message){
YUITest.Assert._increment();
if (expected instanceof Date && actual instanceof Date){
var msg = "";
//check years first
if (expected.getFullYear() != actual.getFullYear()){
msg = "Years should be equal.";
... | javascript | function (expected, actual, message){
YUITest.Assert._increment();
if (expected instanceof Date && actual instanceof Date){
var msg = "";
//check years first
if (expected.getFullYear() != actual.getFullYear()){
msg = "Years should be equal.";
... | [
"function",
"(",
"expected",
",",
"actual",
",",
"message",
")",
"{",
"YUITest",
".",
"Assert",
".",
"_increment",
"(",
")",
";",
"if",
"(",
"expected",
"instanceof",
"Date",
"&&",
"actual",
"instanceof",
"Date",
")",
"{",
"var",
"msg",
"=",
"\"\"",
";... | Asserts that a date's month, day, and year are equal to another date's.
@param {Date} expected The expected date.
@param {Date} actual The actual date to test.
@param {String} message (Optional) The message to display if the assertion fails.
@method datesAreEqual
@static | [
"Asserts",
"that",
"a",
"date",
"s",
"month",
"day",
"and",
"year",
"are",
"equal",
"to",
"another",
"date",
"s",
"."
] | 7913f300cccc79c59a2feac42225bbb26c042766 | https://github.com/perfectapi/ami-generator/blob/7913f300cccc79c59a2feac42225bbb26c042766/www/build/tools/csslint-rhino.js#L6324-L6350 | |
51,228 | perfectapi/ami-generator | www/build/tools/csslint-rhino.js | function (expected, actual, message){
YUITest.Assert._increment();
if (expected instanceof Date && actual instanceof Date){
var msg = "";
//check hours first
if (expected.getHours() != actual.getHours()){
msg = "Hours should be equal.";
}
... | javascript | function (expected, actual, message){
YUITest.Assert._increment();
if (expected instanceof Date && actual instanceof Date){
var msg = "";
//check hours first
if (expected.getHours() != actual.getHours()){
msg = "Hours should be equal.";
}
... | [
"function",
"(",
"expected",
",",
"actual",
",",
"message",
")",
"{",
"YUITest",
".",
"Assert",
".",
"_increment",
"(",
")",
";",
"if",
"(",
"expected",
"instanceof",
"Date",
"&&",
"actual",
"instanceof",
"Date",
")",
"{",
"var",
"msg",
"=",
"\"\"",
";... | Asserts that a date's hour, minutes, and seconds are equal to another date's.
@param {Date} expected The expected date.
@param {Date} actual The actual date to test.
@param {String} message (Optional) The message to display if the assertion fails.
@method timesAreEqual
@static | [
"Asserts",
"that",
"a",
"date",
"s",
"hour",
"minutes",
"and",
"seconds",
"are",
"equal",
"to",
"another",
"date",
"s",
"."
] | 7913f300cccc79c59a2feac42225bbb26c042766 | https://github.com/perfectapi/ami-generator/blob/7913f300cccc79c59a2feac42225bbb26c042766/www/build/tools/csslint-rhino.js#L6360-L6386 | |
51,229 | perfectapi/ami-generator | www/build/tools/csslint-rhino.js | function (segment, delay){
var actualDelay = (typeof segment == "number" ? segment : delay);
actualDelay = (typeof actualDelay == "number" ? actualDelay : 10000);
if (typeof segment == "function"){
throw new YUITest.Wait(segment, actualDelay);
} else {
throw new YUITe... | javascript | function (segment, delay){
var actualDelay = (typeof segment == "number" ? segment : delay);
actualDelay = (typeof actualDelay == "number" ? actualDelay : 10000);
if (typeof segment == "function"){
throw new YUITest.Wait(segment, actualDelay);
} else {
throw new YUITe... | [
"function",
"(",
"segment",
",",
"delay",
")",
"{",
"var",
"actualDelay",
"=",
"(",
"typeof",
"segment",
"==",
"\"number\"",
"?",
"segment",
":",
"delay",
")",
";",
"actualDelay",
"=",
"(",
"typeof",
"actualDelay",
"==",
"\"number\"",
"?",
"actualDelay",
"... | Causes the test case to wait a specified amount of time and then
continue executing the given code.
@param {Function} segment (Optional) The function to run after the delay.
If omitted, the TestRunner will wait until resume() is called.
@param {int} delay (Optional) The number of milliseconds to wait before running
the... | [
"Causes",
"the",
"test",
"case",
"to",
"wait",
"a",
"specified",
"amount",
"of",
"time",
"and",
"then",
"continue",
"executing",
"the",
"given",
"code",
"."
] | 7913f300cccc79c59a2feac42225bbb26c042766 | https://github.com/perfectapi/ami-generator/blob/7913f300cccc79c59a2feac42225bbb26c042766/www/build/tools/csslint-rhino.js#L6754-L6766 | |
51,230 | perfectapi/ami-generator | www/build/tools/csslint-rhino.js | function (testObject) {
if (testObject instanceof YUITest.TestSuite || testObject instanceof YUITest.TestCase) {
this.items.push(testObject);
}
return this;
} | javascript | function (testObject) {
if (testObject instanceof YUITest.TestSuite || testObject instanceof YUITest.TestCase) {
this.items.push(testObject);
}
return this;
} | [
"function",
"(",
"testObject",
")",
"{",
"if",
"(",
"testObject",
"instanceof",
"YUITest",
".",
"TestSuite",
"||",
"testObject",
"instanceof",
"YUITest",
".",
"TestCase",
")",
"{",
"this",
".",
"items",
".",
"push",
"(",
"testObject",
")",
";",
"}",
"retur... | Adds a test suite or test case to the test suite.
@param {YUITest.TestSuite||YUITest.TestCase} testObject The test suite or test case to add.
@return {Void}
@method add | [
"Adds",
"a",
"test",
"suite",
"or",
"test",
"case",
"to",
"the",
"test",
"suite",
"."
] | 7913f300cccc79c59a2feac42225bbb26c042766 | https://github.com/perfectapi/ami-generator/blob/7913f300cccc79c59a2feac42225bbb26c042766/www/build/tools/csslint-rhino.js#L6890-L6895 | |
51,231 | perfectapi/ami-generator | www/build/tools/csslint-rhino.js | function(results) {
function serializeToXML(results){
var xml = "<" + results.type + " name=\"" + xmlEscape(results.name) + "\"";
if (typeof(results.duration)=="number"){
xml += " duration=\"" + results.duration + "\"";
}
... | javascript | function(results) {
function serializeToXML(results){
var xml = "<" + results.type + " name=\"" + xmlEscape(results.name) + "\"";
if (typeof(results.duration)=="number"){
xml += " duration=\"" + results.duration + "\"";
}
... | [
"function",
"(",
"results",
")",
"{",
"function",
"serializeToXML",
"(",
"results",
")",
"{",
"var",
"xml",
"=",
"\"<\"",
"+",
"results",
".",
"type",
"+",
"\" name=\\\"\"",
"+",
"xmlEscape",
"(",
"results",
".",
"name",
")",
"+",
"\"\\\"\"",
";",
"if",
... | Returns test results formatted as an XML string.
@param {Object} result The results object created by TestRunner.
@return {String} An XML-formatted string of results.
@method XML
@static | [
"Returns",
"test",
"results",
"formatted",
"as",
"an",
"XML",
"string",
"."
] | 7913f300cccc79c59a2feac42225bbb26c042766 | https://github.com/perfectapi/ami-generator/blob/7913f300cccc79c59a2feac42225bbb26c042766/www/build/tools/csslint-rhino.js#L6968-L6997 | |
51,232 | perfectapi/ami-generator | www/build/tools/csslint-rhino.js | function() {
if (this._form){
this._form.parentNode.removeChild(this._form);
this._form = null;
}
if (this._iframe){
this._iframe.parentNode.removeChild(this._iframe);
this._iframe = null;
}
this.... | javascript | function() {
if (this._form){
this._form.parentNode.removeChild(this._form);
this._form = null;
}
if (this._iframe){
this._iframe.parentNode.removeChild(this._iframe);
this._iframe = null;
}
this.... | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"_form",
")",
"{",
"this",
".",
"_form",
".",
"parentNode",
".",
"removeChild",
"(",
"this",
".",
"_form",
")",
";",
"this",
".",
"_form",
"=",
"null",
";",
"}",
"if",
"(",
"this",
".",
"_iframe"... | Cleans up the memory associated with the TestReporter, removing DOM elements
that were created.
@return {Void}
@method destroy | [
"Cleans",
"up",
"the",
"memory",
"associated",
"with",
"the",
"TestReporter",
"removing",
"DOM",
"elements",
"that",
"were",
"created",
"."
] | 7913f300cccc79c59a2feac42225bbb26c042766 | https://github.com/perfectapi/ami-generator/blob/7913f300cccc79c59a2feac42225bbb26c042766/www/build/tools/csslint-rhino.js#L7959-L7969 | |
51,233 | perfectapi/ami-generator | www/build/tools/csslint-rhino.js | function(results){
//if the form hasn't been created yet, create it
if (!this._form){
this._form = document.createElement("form");
this._form.method = "post";
this._form.style.visibility = "hidden";
this._form.style.position = "abs... | javascript | function(results){
//if the form hasn't been created yet, create it
if (!this._form){
this._form = document.createElement("form");
this._form.method = "post";
this._form.style.visibility = "hidden";
this._form.style.position = "abs... | [
"function",
"(",
"results",
")",
"{",
"//if the form hasn't been created yet, create it",
"if",
"(",
"!",
"this",
".",
"_form",
")",
"{",
"this",
".",
"_form",
"=",
"document",
".",
"createElement",
"(",
"\"form\"",
")",
";",
"this",
".",
"_form",
".",
"meth... | Sends the report to the server.
@param {Object} results The results object created by TestRunner.
@return {Void}
@method report | [
"Sends",
"the",
"report",
"to",
"the",
"server",
"."
] | 7913f300cccc79c59a2feac42225bbb26c042766 | https://github.com/perfectapi/ami-generator/blob/7913f300cccc79c59a2feac42225bbb26c042766/www/build/tools/csslint-rhino.js#L7977-L8039 | |
51,234 | perfectapi/ami-generator | www/build/tools/csslint-rhino.js | function (page, results){
var r = this._results;
r.passed += results.passed;
r.failed += results.failed;
r.ignored += results.ignored;
r.total += results.total;
r.duration += results.duration;
if (results.failed){
r.failedPages.push(page);
}... | javascript | function (page, results){
var r = this._results;
r.passed += results.passed;
r.failed += results.failed;
r.ignored += results.ignored;
r.total += results.total;
r.duration += results.duration;
if (results.failed){
r.failedPages.push(page);
}... | [
"function",
"(",
"page",
",",
"results",
")",
"{",
"var",
"r",
"=",
"this",
".",
"_results",
";",
"r",
".",
"passed",
"+=",
"results",
".",
"passed",
";",
"r",
".",
"failed",
"+=",
"results",
".",
"failed",
";",
"r",
".",
"ignored",
"+=",
"results"... | Processes the results of a test page run, outputting log messages
for failed tests.
@return {Void}
@method _processResults
@private
@static | [
"Processes",
"the",
"results",
"of",
"a",
"test",
"page",
"run",
"outputting",
"log",
"messages",
"for",
"failed",
"tests",
"."
] | 7913f300cccc79c59a2feac42225bbb26c042766 | https://github.com/perfectapi/ami-generator/blob/7913f300cccc79c59a2feac42225bbb26c042766/www/build/tools/csslint-rhino.js#L8183-L8203 | |
51,235 | perfectapi/ami-generator | www/build/tools/csslint-rhino.js | function () /*:Void*/ {
//set the current page
this._curPage = this._pages.shift();
this.fire(this.TEST_PAGE_BEGIN_EVENT, this._curPage);
//load the frame - destroy history in case there are other iframes that
//need testing
this._frame.location.replace(this._curPage);... | javascript | function () /*:Void*/ {
//set the current page
this._curPage = this._pages.shift();
this.fire(this.TEST_PAGE_BEGIN_EVENT, this._curPage);
//load the frame - destroy history in case there are other iframes that
//need testing
this._frame.location.replace(this._curPage);... | [
"function",
"(",
")",
"/*:Void*/",
"{",
"//set the current page",
"this",
".",
"_curPage",
"=",
"this",
".",
"_pages",
".",
"shift",
"(",
")",
";",
"this",
".",
"fire",
"(",
"this",
".",
"TEST_PAGE_BEGIN_EVENT",
",",
"this",
".",
"_curPage",
")",
";",
"/... | Loads the next test page into the iframe.
@return {Void}
@method _run
@static
@private | [
"Loads",
"the",
"next",
"test",
"page",
"into",
"the",
"iframe",
"."
] | 7913f300cccc79c59a2feac42225bbb26c042766 | https://github.com/perfectapi/ami-generator/blob/7913f300cccc79c59a2feac42225bbb26c042766/www/build/tools/csslint-rhino.js#L8212-L8223 | |
51,236 | perfectapi/ami-generator | www/build/tools/csslint-rhino.js | function () /*:Void*/ {
if (!this._initialized) {
/**
* Fires when loading a test page
* @event testpagebegin
* @param curPage {string} the page being loaded
* @static
*/
/**
* Fires when a test page is comp... | javascript | function () /*:Void*/ {
if (!this._initialized) {
/**
* Fires when loading a test page
* @event testpagebegin
* @param curPage {string} the page being loaded
* @static
*/
/**
* Fires when a test page is comp... | [
"function",
"(",
")",
"/*:Void*/",
"{",
"if",
"(",
"!",
"this",
".",
"_initialized",
")",
"{",
"/**\n * Fires when loading a test page\n * @event testpagebegin\n * @param curPage {string} the page being loaded\n * @static\n */",
... | Begins the process of running the tests.
@return {Void}
@method start
@static | [
"Begins",
"the",
"process",
"of",
"running",
"the",
"tests",
"."
] | 7913f300cccc79c59a2feac42225bbb26c042766 | https://github.com/perfectapi/ami-generator/blob/7913f300cccc79c59a2feac42225bbb26c042766/www/build/tools/csslint-rhino.js#L8270-L8351 | |
51,237 | perfectapi/ami-generator | www/build/tools/csslint-rhino.js | function (parentNode, testSuite) {
//add the test suite
var node = parentNode.appendChild(testSuite);
//iterate over the items in the master suite
for (var i=0; i < testSuite.items.length; i++){
if (testSuite.items[i] instanceof YUITe... | javascript | function (parentNode, testSuite) {
//add the test suite
var node = parentNode.appendChild(testSuite);
//iterate over the items in the master suite
for (var i=0; i < testSuite.items.length; i++){
if (testSuite.items[i] instanceof YUITe... | [
"function",
"(",
"parentNode",
",",
"testSuite",
")",
"{",
"//add the test suite",
"var",
"node",
"=",
"parentNode",
".",
"appendChild",
"(",
"testSuite",
")",
";",
"//iterate over the items in the master suite",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
... | Adds a test suite to the test tree as a child of the specified node.
@param {TestNode} parentNode The node to add the test suite to as a child.
@param {YUITest.TestSuite} testSuite The test suite to add.
@return {Void}
@static
@private
@method _addTestSuiteToTestTree | [
"Adds",
"a",
"test",
"suite",
"to",
"the",
"test",
"tree",
"as",
"a",
"child",
"of",
"the",
"specified",
"node",
"."
] | 7913f300cccc79c59a2feac42225bbb26c042766 | https://github.com/perfectapi/ami-generator/blob/7913f300cccc79c59a2feac42225bbb26c042766/www/build/tools/csslint-rhino.js#L8699-L8712 | |
51,238 | perfectapi/ami-generator | www/build/tools/csslint-rhino.js | function () {
this._root = new TestNode(this.masterSuite);
//this._cur = this._root;
//iterate over the items in the master suite
for (var i=0; i < this.masterSuite.items.length; i++){
if (this.masterSuite.items[i] instanceof YUITest.... | javascript | function () {
this._root = new TestNode(this.masterSuite);
//this._cur = this._root;
//iterate over the items in the master suite
for (var i=0; i < this.masterSuite.items.length; i++){
if (this.masterSuite.items[i] instanceof YUITest.... | [
"function",
"(",
")",
"{",
"this",
".",
"_root",
"=",
"new",
"TestNode",
"(",
"this",
".",
"masterSuite",
")",
";",
"//this._cur = this._root;",
"//iterate over the items in the master suite",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"ma... | Builds the test tree based on items in the master suite. The tree is a hierarchical
representation of the test suites, test cases, and test functions. The resulting tree
is stored in _root and the pointer _cur is set to the root initially.
@return {Void}
@static
@private
@method _buildTestTree | [
"Builds",
"the",
"test",
"tree",
"based",
"on",
"items",
"in",
"the",
"master",
"suite",
".",
"The",
"tree",
"is",
"a",
"hierarchical",
"representation",
"of",
"the",
"test",
"suites",
"test",
"cases",
"and",
"test",
"functions",
".",
"The",
"resulting",
"... | 7913f300cccc79c59a2feac42225bbb26c042766 | https://github.com/perfectapi/ami-generator/blob/7913f300cccc79c59a2feac42225bbb26c042766/www/build/tools/csslint-rhino.js#L8723-L8737 | |
51,239 | perfectapi/ami-generator | www/build/tools/csslint-rhino.js | function () {
//flag to indicate if the TestRunner should wait before continuing
var shouldWait = false;
//get the next test node
var node = this._next();
if (node !== null) {
//set flag to say the testrunner is runn... | javascript | function () {
//flag to indicate if the TestRunner should wait before continuing
var shouldWait = false;
//get the next test node
var node = this._next();
if (node !== null) {
//set flag to say the testrunner is runn... | [
"function",
"(",
")",
"{",
"//flag to indicate if the TestRunner should wait before continuing",
"var",
"shouldWait",
"=",
"false",
";",
"//get the next test node",
"var",
"node",
"=",
"this",
".",
"_next",
"(",
")",
";",
"if",
"(",
"node",
"!==",
"null",
")",
"{"... | Runs a test case or test suite, returning the results.
@param {YUITest.TestCase|YUITest.TestSuite} testObject The test case or test suite to run.
@return {Object} Results of the execution with properties passed, failed, and total.
@private
@method _run
@static | [
"Runs",
"a",
"test",
"case",
"or",
"test",
"suite",
"returning",
"the",
"results",
"."
] | 7913f300cccc79c59a2feac42225bbb26c042766 | https://github.com/perfectapi/ami-generator/blob/7913f300cccc79c59a2feac42225bbb26c042766/www/build/tools/csslint-rhino.js#L8862-L8920 | |
51,240 | perfectapi/ami-generator | www/build/tools/csslint-rhino.js | function (node) {
//get relevant information
var testName = node.testObject,
testCase = node.parent.testObject,
test = testCase[testName],
//get the "should" test cases
shouldIgnore = testName.indexOf("igno... | javascript | function (node) {
//get relevant information
var testName = node.testObject,
testCase = node.parent.testObject,
test = testCase[testName],
//get the "should" test cases
shouldIgnore = testName.indexOf("igno... | [
"function",
"(",
"node",
")",
"{",
"//get relevant information",
"var",
"testName",
"=",
"node",
".",
"testObject",
",",
"testCase",
"=",
"node",
".",
"parent",
".",
"testObject",
",",
"test",
"=",
"testCase",
"[",
"testName",
"]",
",",
"//get the \"should\" t... | Runs a single test based on the data provided in the node.
@param {TestNode} node The TestNode representing the test to run.
@return {Void}
@static
@private
@name _runTest | [
"Runs",
"a",
"single",
"test",
"based",
"on",
"the",
"data",
"provided",
"in",
"the",
"node",
"."
] | 7913f300cccc79c59a2feac42225bbb26c042766 | https://github.com/perfectapi/ami-generator/blob/7913f300cccc79c59a2feac42225bbb26c042766/www/build/tools/csslint-rhino.js#L9122-L9171 | |
51,241 | perfectapi/ami-generator | www/build/tools/csslint-rhino.js | function (options) {
options = options || {};
//pointer to runner to avoid scope issues
var runner = YUITest.TestRunner,
oldMode = options.oldMode;
//if there's only one suite on the masterSuite, move it up
if (!old... | javascript | function (options) {
options = options || {};
//pointer to runner to avoid scope issues
var runner = YUITest.TestRunner,
oldMode = options.oldMode;
//if there's only one suite on the masterSuite, move it up
if (!old... | [
"function",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"//pointer to runner to avoid scope issues",
"var",
"runner",
"=",
"YUITest",
".",
"TestRunner",
",",
"oldMode",
"=",
"options",
".",
"oldMode",
";",
"//if there's only one suite... | Runs the test suite.
@param {Object|Boolean} options (Optional) Options for the runner:
<code>oldMode</code> indicates the TestRunner should work in the YUI <= 2.8 way
of internally managing test suites. <code>groups</code> is an array
of test groups indicating which tests to run.
@return {Void}
@method run
@static | [
"Runs",
"the",
"test",
"suite",
"."
] | 7913f300cccc79c59a2feac42225bbb26c042766 | https://github.com/perfectapi/ami-generator/blob/7913f300cccc79c59a2feac42225bbb26c042766/www/build/tools/csslint-rhino.js#L9335-L9362 | |
51,242 | perfectapi/ami-generator | www/build/tools/csslint-rhino.js | function(filename, options) {
var input = readFile(filename),
result = CSSLint.verify(input, gatherRules(options)),
formatId = options.format || "text",
messages = result.messages || [],
exitCode = 0;
if (!input) {
print("csslint: Could not read file data in " + filename... | javascript | function(filename, options) {
var input = readFile(filename),
result = CSSLint.verify(input, gatherRules(options)),
formatId = options.format || "text",
messages = result.messages || [],
exitCode = 0;
if (!input) {
print("csslint: Could not read file data in " + filename... | [
"function",
"(",
"filename",
",",
"options",
")",
"{",
"var",
"input",
"=",
"readFile",
"(",
"filename",
")",
",",
"result",
"=",
"CSSLint",
".",
"verify",
"(",
"input",
",",
"gatherRules",
"(",
"options",
")",
")",
",",
"formatId",
"=",
"options",
"."... | process a list of files, return 1 if one or more error occurred | [
"process",
"a",
"list",
"of",
"files",
"return",
"1",
"if",
"one",
"or",
"more",
"error",
"occurred"
] | 7913f300cccc79c59a2feac42225bbb26c042766 | https://github.com/perfectapi/ami-generator/blob/7913f300cccc79c59a2feac42225bbb26c042766/www/build/tools/csslint-rhino.js#L11008-L11027 | |
51,243 | yiwn/compact | lib/compact.js | compact | function compact(source) {
if (!source) return null;
if (isArray(source))
return compactArray(source);
if (typeof source == 'object')
return compactObject(source);
return source;
} | javascript | function compact(source) {
if (!source) return null;
if (isArray(source))
return compactArray(source);
if (typeof source == 'object')
return compactObject(source);
return source;
} | [
"function",
"compact",
"(",
"source",
")",
"{",
"if",
"(",
"!",
"source",
")",
"return",
"null",
";",
"if",
"(",
"isArray",
"(",
"source",
")",
")",
"return",
"compactArray",
"(",
"source",
")",
";",
"if",
"(",
"typeof",
"source",
"==",
"'object'",
"... | Strip `null` and `undefined` values.
@param {Object|Array} source
@return {Object|Array}
@api public | [
"Strip",
"null",
"and",
"undefined",
"values",
"."
] | a30105810a94bfb06d5d4d55020a540c85901809 | https://github.com/yiwn/compact/blob/a30105810a94bfb06d5d4d55020a540c85901809/lib/compact.js#L23-L33 |
51,244 | yiwn/compact | lib/compact.js | compactArray | function compactArray(source) {
return source.reduce(function(result, value){
if (value != void 0)
result.push(value);
return result;
}, []);
} | javascript | function compactArray(source) {
return source.reduce(function(result, value){
if (value != void 0)
result.push(value);
return result;
}, []);
} | [
"function",
"compactArray",
"(",
"source",
")",
"{",
"return",
"source",
".",
"reduce",
"(",
"function",
"(",
"result",
",",
"value",
")",
"{",
"if",
"(",
"value",
"!=",
"void",
"0",
")",
"result",
".",
"push",
"(",
"value",
")",
";",
"return",
"resu... | Remove `null` and `undefined` from array;
@param {Array} source
@return {Array}
@api private | [
"Remove",
"null",
"and",
"undefined",
"from",
"array",
";"
] | a30105810a94bfb06d5d4d55020a540c85901809 | https://github.com/yiwn/compact/blob/a30105810a94bfb06d5d4d55020a540c85901809/lib/compact.js#L43-L49 |
51,245 | yiwn/compact | lib/compact.js | compactObject | function compactObject(source) {
var result = {}, key;
for (key in source) {
var value = source[key];
if (value != void 0)
result[key] = value;
}
return result;
} | javascript | function compactObject(source) {
var result = {}, key;
for (key in source) {
var value = source[key];
if (value != void 0)
result[key] = value;
}
return result;
} | [
"function",
"compactObject",
"(",
"source",
")",
"{",
"var",
"result",
"=",
"{",
"}",
",",
"key",
";",
"for",
"(",
"key",
"in",
"source",
")",
"{",
"var",
"value",
"=",
"source",
"[",
"key",
"]",
";",
"if",
"(",
"value",
"!=",
"void",
"0",
")",
... | Remove `null` and `undefined` from object;
@param {Object} source
@return {Object}
@api private | [
"Remove",
"null",
"and",
"undefined",
"from",
"object",
";"
] | a30105810a94bfb06d5d4d55020a540c85901809 | https://github.com/yiwn/compact/blob/a30105810a94bfb06d5d4d55020a540c85901809/lib/compact.js#L60-L70 |
51,246 | XadillaX/algorithmjs | lib/algorithm/qsort.js | qsort | function qsort(array, l, r, func) {
if(l < r) {
var i = l, j = r;
var x = array[l];
while(i < j) {
while(i < j && func(x, array[j])) j--;
array[i] = array[j];
while(i < j && func(array[i], x)) i++;
array[j] = array[i];
}
array[... | javascript | function qsort(array, l, r, func) {
if(l < r) {
var i = l, j = r;
var x = array[l];
while(i < j) {
while(i < j && func(x, array[j])) j--;
array[i] = array[j];
while(i < j && func(array[i], x)) i++;
array[j] = array[i];
}
array[... | [
"function",
"qsort",
"(",
"array",
",",
"l",
",",
"r",
",",
"func",
")",
"{",
"if",
"(",
"l",
"<",
"r",
")",
"{",
"var",
"i",
"=",
"l",
",",
"j",
"=",
"r",
";",
"var",
"x",
"=",
"array",
"[",
"l",
"]",
";",
"while",
"(",
"i",
"<",
"j",
... | qsort main function
@param array
@param l
@param r
@param func
@return | [
"qsort",
"main",
"function"
] | b291834446fdead3c5303f7759b496110b57d42c | https://github.com/XadillaX/algorithmjs/blob/b291834446fdead3c5303f7759b496110b57d42c/lib/algorithm/qsort.js#L22-L38 |
51,247 | noderaider/redux-addons | lib/context.js | validateLibOpts | function validateLibOpts(libOptsRaw) {
_chai.assert.ok(libOptsRaw, 'libOpts definition is required');
var libName = libOptsRaw.libName;
var validateContext = libOptsRaw.validateContext;
var configureAppContext = libOptsRaw.configureAppContext;
var configureInitialState = libOptsRaw.configureInitialState;
(... | javascript | function validateLibOpts(libOptsRaw) {
_chai.assert.ok(libOptsRaw, 'libOpts definition is required');
var libName = libOptsRaw.libName;
var validateContext = libOptsRaw.validateContext;
var configureAppContext = libOptsRaw.configureAppContext;
var configureInitialState = libOptsRaw.configureInitialState;
(... | [
"function",
"validateLibOpts",
"(",
"libOptsRaw",
")",
"{",
"_chai",
".",
"assert",
".",
"ok",
"(",
"libOptsRaw",
",",
"'libOpts definition is required'",
")",
";",
"var",
"libName",
"=",
"libOptsRaw",
".",
"libName",
";",
"var",
"validateContext",
"=",
"libOpts... | Validates library creators options | [
"Validates",
"library",
"creators",
"options"
] | 7b11262b5a89039e7d96e47b8391840e72510fe1 | https://github.com/noderaider/redux-addons/blob/7b11262b5a89039e7d96e47b8391840e72510fe1/lib/context.js#L62-L80 |
51,248 | noderaider/redux-addons | lib/context.js | validateAppOpts | function validateAppOpts(appOptsRaw) {
_chai.assert.ok(appOptsRaw, 'appOpts are required');
var appName = appOptsRaw.appName;
(0, _chai.assert)(typeof appName === 'string', 'appName opt must be a string');
(0, _chai.assert)(appName.length > 0, 'appName opt must not be empty');
} | javascript | function validateAppOpts(appOptsRaw) {
_chai.assert.ok(appOptsRaw, 'appOpts are required');
var appName = appOptsRaw.appName;
(0, _chai.assert)(typeof appName === 'string', 'appName opt must be a string');
(0, _chai.assert)(appName.length > 0, 'appName opt must not be empty');
} | [
"function",
"validateAppOpts",
"(",
"appOptsRaw",
")",
"{",
"_chai",
".",
"assert",
".",
"ok",
"(",
"appOptsRaw",
",",
"'appOpts are required'",
")",
";",
"var",
"appName",
"=",
"appOptsRaw",
".",
"appName",
";",
"(",
"0",
",",
"_chai",
".",
"assert",
")",... | Validates library consumers options | [
"Validates",
"library",
"consumers",
"options"
] | 7b11262b5a89039e7d96e47b8391840e72510fe1 | https://github.com/noderaider/redux-addons/blob/7b11262b5a89039e7d96e47b8391840e72510fe1/lib/context.js#L83-L90 |
51,249 | konfirm/node-submerge | lib/submerge.js | monitorArray | function monitorArray(a, emit) {
['copyWithin', 'fill', 'pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift']
.forEach(function(key) {
var original = a[key];
a[key] = function() {
var result = original.apply(a, arguments);
emit();
return result;
};
});
return a;
} | javascript | function monitorArray(a, emit) {
['copyWithin', 'fill', 'pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift']
.forEach(function(key) {
var original = a[key];
a[key] = function() {
var result = original.apply(a, arguments);
emit();
return result;
};
});
return a;
} | [
"function",
"monitorArray",
"(",
"a",
",",
"emit",
")",
"{",
"[",
"'copyWithin'",
",",
"'fill'",
",",
"'pop'",
",",
"'push'",
",",
"'reverse'",
",",
"'shift'",
",",
"'sort'",
",",
"'splice'",
",",
"'unshift'",
"]",
".",
"forEach",
"(",
"function",
"(",
... | Wrap all modifying array methods, so change-emisions can be triggered
@name monitorArray
@access internal
@param Array a
@param function emitter
@return Array a | [
"Wrap",
"all",
"modifying",
"array",
"methods",
"so",
"change",
"-",
"emisions",
"can",
"be",
"triggered"
] | 5c471a1c8f794eb3827ca216e739263b512ff16c | https://github.com/konfirm/node-submerge/blob/5c471a1c8f794eb3827ca216e739263b512ff16c/lib/submerge.js#L45-L60 |
51,250 | konfirm/node-submerge | lib/submerge.js | inherit | function inherit(options, destination, source, key) {
var define, override, path;
if (key in destination) {
if (isObject(destination[key]) && isObject(source[key])) {
// live up to the name and merge the sub objects
Object.keys(source[key]).forEach(function(k) {
inherit(options, destination[key], ... | javascript | function inherit(options, destination, source, key) {
var define, override, path;
if (key in destination) {
if (isObject(destination[key]) && isObject(source[key])) {
// live up to the name and merge the sub objects
Object.keys(source[key]).forEach(function(k) {
inherit(options, destination[key], ... | [
"function",
"inherit",
"(",
"options",
",",
"destination",
",",
"source",
",",
"key",
")",
"{",
"var",
"define",
",",
"override",
",",
"path",
";",
"if",
"(",
"key",
"in",
"destination",
")",
"{",
"if",
"(",
"isObject",
"(",
"destination",
"[",
"key",
... | Inherit the value at key of one object from a single other object
@name inherit
@access internal
@param object options {live:bool, locked:bool}
@param object destination
@param object source
@param string key
@return void | [
"Inherit",
"the",
"value",
"at",
"key",
"of",
"one",
"object",
"from",
"a",
"single",
"other",
"object"
] | 5c471a1c8f794eb3827ca216e739263b512ff16c | https://github.com/konfirm/node-submerge/blob/5c471a1c8f794eb3827ca216e739263b512ff16c/lib/submerge.js#L72-L128 |
51,251 | jokeyrhyme/promised-requirejs.js | index.js | promisedRequire | function promisedRequire (name, retries=0) {
if (Array.isArray(name)) {
return Promise.all(name.map((n) => {
return promisedRequire(n);
}));
}
return new Promise(function (resolve, reject) {
global.requirejs([name], (result) => {
resolve(result);
}, (err) => {
var failedId = err... | javascript | function promisedRequire (name, retries=0) {
if (Array.isArray(name)) {
return Promise.all(name.map((n) => {
return promisedRequire(n);
}));
}
return new Promise(function (resolve, reject) {
global.requirejs([name], (result) => {
resolve(result);
}, (err) => {
var failedId = err... | [
"function",
"promisedRequire",
"(",
"name",
",",
"retries",
"=",
"0",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"name",
")",
")",
"{",
"return",
"Promise",
".",
"all",
"(",
"name",
".",
"map",
"(",
"(",
"n",
")",
"=>",
"{",
"return",
"pr... | this module
- @param {(String|String[])} name - module(s) that you wish to load
- @param {Number} [retries=0] - number of extra attempts in case of error | [
"this",
"module",
"-"
] | 2a250ad5306ce555fa76299803b367b1247427a8 | https://github.com/jokeyrhyme/promised-requirejs.js/blob/2a250ad5306ce555fa76299803b367b1247427a8/index.js#L9-L37 |
51,252 | Tennu/tennu-factoids | factoids.js | function (key) {
const value = db.get(key);
if (!value) {
db.set(key, {
frozen: true
});
return;
}
db.set(key, {
intent: value.intent,
message: value.message,
... | javascript | function (key) {
const value = db.get(key);
if (!value) {
db.set(key, {
frozen: true
});
return;
}
db.set(key, {
intent: value.intent,
message: value.message,
... | [
"function",
"(",
"key",
")",
"{",
"const",
"value",
"=",
"db",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"!",
"value",
")",
"{",
"db",
".",
"set",
"(",
"key",
",",
"{",
"frozen",
":",
"true",
"}",
")",
";",
"return",
";",
"}",
"db",
".",... | String -> Boolean | [
"String",
"-",
">",
"Boolean"
] | 1b806563c35e3f75109a6dcb561168972cf990fe | https://github.com/Tennu/tennu-factoids/blob/1b806563c35e3f75109a6dcb561168972cf990fe/factoids.js#L280-L299 | |
51,253 | Nazariglez/perenquen | lib/pixi/src/core/utils/pluginTarget.js | pluginTarget | function pluginTarget(obj)
{
obj.__plugins = {};
/**
* Adds a plugin to an object
*
* @param pluginName {string} The events that should be listed.
* @param ctor {Object} ?? @alvin
*/
obj.registerPlugin = function (pluginName, ctor)
{
obj.__plugins[pluginName] = ctor;
... | javascript | function pluginTarget(obj)
{
obj.__plugins = {};
/**
* Adds a plugin to an object
*
* @param pluginName {string} The events that should be listed.
* @param ctor {Object} ?? @alvin
*/
obj.registerPlugin = function (pluginName, ctor)
{
obj.__plugins[pluginName] = ctor;
... | [
"function",
"pluginTarget",
"(",
"obj",
")",
"{",
"obj",
".",
"__plugins",
"=",
"{",
"}",
";",
"/**\n * Adds a plugin to an object\n *\n * @param pluginName {string} The events that should be listed.\n * @param ctor {Object} ?? @alvin\n */",
"obj",
".",
"registerP... | Mixins functionality to make an object have "plugins".
@mixin
@memberof PIXI.utils
@param obj {object} The object to mix into.
@example
function MyObject() {}
pluginTarget.mixin(MyObject); | [
"Mixins",
"functionality",
"to",
"make",
"an",
"object",
"have",
"plugins",
"."
] | e023964d05afeefebdcac4e2044819fdfa3899ae | https://github.com/Nazariglez/perenquen/blob/e023964d05afeefebdcac4e2044819fdfa3899ae/lib/pixi/src/core/utils/pluginTarget.js#L12-L55 |
51,254 | jamespdlynn/microjs | examples/game/lib/view.js | function(){
canvas = document.getElementById("canvas");
canvas.width = Zone.prototype.WIDTH;
canvas.height = Zone.prototype.HEIGHT;
frameCount = 0;
if (GameView.isRunning()){
run();
}
//Add a listener on our global ... | javascript | function(){
canvas = document.getElementById("canvas");
canvas.width = Zone.prototype.WIDTH;
canvas.height = Zone.prototype.HEIGHT;
frameCount = 0;
if (GameView.isRunning()){
run();
}
//Add a listener on our global ... | [
"function",
"(",
")",
"{",
"canvas",
"=",
"document",
".",
"getElementById",
"(",
"\"canvas\"",
")",
";",
"canvas",
".",
"width",
"=",
"Zone",
".",
"prototype",
".",
"WIDTH",
";",
"canvas",
".",
"height",
"=",
"Zone",
".",
"prototype",
".",
"HEIGHT",
"... | Set up Game View | [
"Set",
"up",
"Game",
"View"
] | 780a4074de84bcd74e3ae50d0ed64144b4474166 | https://github.com/jamespdlynn/microjs/blob/780a4074de84bcd74e3ae50d0ed64144b4474166/examples/game/lib/view.js#L19-L35 | |
51,255 | jamespdlynn/microjs | examples/game/lib/view.js | angleDiff | function angleDiff(angle1, angle2){
var deltaAngle = angle1-angle2;
while (deltaAngle < -Math.PI) deltaAngle += (2*Math.PI);
while (deltaAngle > Math.PI) deltaAngle -= (2*Math.PI);
return Math.abs(deltaAngle);
} | javascript | function angleDiff(angle1, angle2){
var deltaAngle = angle1-angle2;
while (deltaAngle < -Math.PI) deltaAngle += (2*Math.PI);
while (deltaAngle > Math.PI) deltaAngle -= (2*Math.PI);
return Math.abs(deltaAngle);
} | [
"function",
"angleDiff",
"(",
"angle1",
",",
"angle2",
")",
"{",
"var",
"deltaAngle",
"=",
"angle1",
"-",
"angle2",
";",
"while",
"(",
"deltaAngle",
"<",
"-",
"Math",
".",
"PI",
")",
"deltaAngle",
"+=",
"(",
"2",
"*",
"Math",
".",
"PI",
")",
";",
"... | Calculates the delta between two angles | [
"Calculates",
"the",
"delta",
"between",
"two",
"angles"
] | 780a4074de84bcd74e3ae50d0ed64144b4474166 | https://github.com/jamespdlynn/microjs/blob/780a4074de84bcd74e3ae50d0ed64144b4474166/examples/game/lib/view.js#L175-L180 |
51,256 | alexpods/ClazzJS | src/components/meta/Property/Constratins.js | function(object, constraints, property) {
var that = this;
object.__addSetter(property, this.SETTER_NAME, this.SETTER_WEIGHT, function(value, fields) {
return that.apply(value, constraints, property, fields, this);
});
} | javascript | function(object, constraints, property) {
var that = this;
object.__addSetter(property, this.SETTER_NAME, this.SETTER_WEIGHT, function(value, fields) {
return that.apply(value, constraints, property, fields, this);
});
} | [
"function",
"(",
"object",
",",
"constraints",
",",
"property",
")",
"{",
"var",
"that",
"=",
"this",
";",
"object",
".",
"__addSetter",
"(",
"property",
",",
"this",
".",
"SETTER_NAME",
",",
"this",
".",
"SETTER_WEIGHT",
",",
"function",
"(",
"value",
"... | Add constraints setter to object
@param {object} object Object to which constraints will be applied
@param {object} constraints Hash of constraints
@param {string} property Property name
@this {metaProcessor} | [
"Add",
"constraints",
"setter",
"to",
"object"
] | 2f94496019669813c8246d48fcceb12a3e68a870 | https://github.com/alexpods/ClazzJS/blob/2f94496019669813c8246d48fcceb12a3e68a870/src/components/meta/Property/Constratins.js#L19-L25 | |
51,257 | alexpods/ClazzJS | src/components/meta/Property/Constratins.js | function(value, constraints, property, fields, object) {
_.each(constraints, function(constraint, name) {
if (!constraint.call(object, value, fields, property)) {
throw new Error('Constraint "' + name + '" was failed!');
}
});
return value;
} | javascript | function(value, constraints, property, fields, object) {
_.each(constraints, function(constraint, name) {
if (!constraint.call(object, value, fields, property)) {
throw new Error('Constraint "' + name + '" was failed!');
}
});
return value;
} | [
"function",
"(",
"value",
",",
"constraints",
",",
"property",
",",
"fields",
",",
"object",
")",
"{",
"_",
".",
"each",
"(",
"constraints",
",",
"function",
"(",
"constraint",
",",
"name",
")",
"{",
"if",
"(",
"!",
"constraint",
".",
"call",
"(",
"o... | Applies property constraints to object
@param {*} value Property value
@param {object} constraints Hash of property constraints
@param {string} property Property name
@param {array} fields Property fields
@param {object} object Object
@returns {*} value Processed property value
@throws ... | [
"Applies",
"property",
"constraints",
"to",
"object"
] | 2f94496019669813c8246d48fcceb12a3e68a870 | https://github.com/alexpods/ClazzJS/blob/2f94496019669813c8246d48fcceb12a3e68a870/src/components/meta/Property/Constratins.js#L42-L51 | |
51,258 | vader-httpclient/vader | build/node/restClient/utils.js | normalizeUrl | function normalizeUrl(url) {
if (!IS_ABSOLUTE.test(url)) {
return (0, _normalizeUrl2['default'])(url).replace('http://', '');
} else {
return (0, _normalizeUrl2['default'])(url);
}
} | javascript | function normalizeUrl(url) {
if (!IS_ABSOLUTE.test(url)) {
return (0, _normalizeUrl2['default'])(url).replace('http://', '');
} else {
return (0, _normalizeUrl2['default'])(url);
}
} | [
"function",
"normalizeUrl",
"(",
"url",
")",
"{",
"if",
"(",
"!",
"IS_ABSOLUTE",
".",
"test",
"(",
"url",
")",
")",
"{",
"return",
"(",
"0",
",",
"_normalizeUrl2",
"[",
"'default'",
"]",
")",
"(",
"url",
")",
".",
"replace",
"(",
"'http://'",
",",
... | Normalize an url.
@param {String} url
@return {String} | [
"Normalize",
"an",
"url",
"."
] | 4c0f5a51faae5ea143a4ce9157ef557b148be55a | https://github.com/vader-httpclient/vader/blob/4c0f5a51faae5ea143a4ce9157ef557b148be55a/build/node/restClient/utils.js#L37-L43 |
51,259 | Psychopoulet/node-promfs | lib/extends/_isFile.js | _isFile | function _isFile (file, callback) {
if ("undefined" === typeof file) {
throw new ReferenceError("missing \"file\" argument");
}
else if ("string" !== typeof file) {
throw new TypeError("\"file\" argument is not a string");
}
else if ("" === file.trim()) {
throw new Error("\"file\" argum... | javascript | function _isFile (file, callback) {
if ("undefined" === typeof file) {
throw new ReferenceError("missing \"file\" argument");
}
else if ("string" !== typeof file) {
throw new TypeError("\"file\" argument is not a string");
}
else if ("" === file.trim()) {
throw new Error("\"file\" argum... | [
"function",
"_isFile",
"(",
"file",
",",
"callback",
")",
"{",
"if",
"(",
"\"undefined\"",
"===",
"typeof",
"file",
")",
"{",
"throw",
"new",
"ReferenceError",
"(",
"\"missing \\\"file\\\" argument\"",
")",
";",
"}",
"else",
"if",
"(",
"\"string\"",
"!==",
"... | methods
Async isFile
@param {string} file : file to check
@param {function} callback : operation's result
@returns {void} | [
"methods",
"Async",
"isFile"
] | 016e272fc58c6ef6eae5ea551a0e8873f0ac20cc | https://github.com/Psychopoulet/node-promfs/blob/016e272fc58c6ef6eae5ea551a0e8873f0ac20cc/lib/extends/_isFile.js#L18-L43 |
51,260 | jonschlinkert/normalize-keywords | words.js | common | function common(words) {
return _.map(words, function(o) {
return o.word.toLowerCase();
}).sort();
} | javascript | function common(words) {
return _.map(words, function(o) {
return o.word.toLowerCase();
}).sort();
} | [
"function",
"common",
"(",
"words",
")",
"{",
"return",
"_",
".",
"map",
"(",
"words",
",",
"function",
"(",
"o",
")",
"{",
"return",
"o",
".",
"word",
".",
"toLowerCase",
"(",
")",
";",
"}",
")",
".",
"sort",
"(",
")",
";",
"}"
] | Get an array of the 100 most common english words | [
"Get",
"an",
"array",
"of",
"the",
"100",
"most",
"common",
"english",
"words"
] | f4d1a92fab85c49636929d3a23652b1795b9ac22 | https://github.com/jonschlinkert/normalize-keywords/blob/f4d1a92fab85c49636929d3a23652b1795b9ac22/words.js#L10-L14 |
51,261 | cli-kit/cli-mid-unparsed | index.js | filter | function filter(unparsed) {
var cmds = this.commands()
, alias = this.finder.getCommandByName;
var i, l = unparsed.length;
for(i = 0;i < l;i++) {
//console.log('unparsed filter %s', unparsed[i]);
if(alias(unparsed[i], cmds)) {
unparsed.splice(i, 1);
i--;
l--;
}
}
//console.lo... | javascript | function filter(unparsed) {
var cmds = this.commands()
, alias = this.finder.getCommandByName;
var i, l = unparsed.length;
for(i = 0;i < l;i++) {
//console.log('unparsed filter %s', unparsed[i]);
if(alias(unparsed[i], cmds)) {
unparsed.splice(i, 1);
i--;
l--;
}
}
//console.lo... | [
"function",
"filter",
"(",
"unparsed",
")",
"{",
"var",
"cmds",
"=",
"this",
".",
"commands",
"(",
")",
",",
"alias",
"=",
"this",
".",
"finder",
".",
"getCommandByName",
";",
"var",
"i",
",",
"l",
"=",
"unparsed",
".",
"length",
";",
"for",
"(",
"... | Filters commands from the unparsed arguments array.
Note that currently this only filters top-level commands. | [
"Filters",
"commands",
"from",
"the",
"unparsed",
"arguments",
"array",
"."
] | 7b5432ab5718ff388f690047448018b6459ee4cb | https://github.com/cli-kit/cli-mid-unparsed/blob/7b5432ab5718ff388f690047448018b6459ee4cb/index.js#L8-L22 |
51,262 | leoxy520/Sling2JCR | index.js | startUp | function startUp(dir) {
var config = {
jcr_root: dir,
servers: [{
host: commander.host || "http://localhost:4502",
username: commander.username || "admin",
password: commander.password || "admin"
}]
};
//create a new instance
va... | javascript | function startUp(dir) {
var config = {
jcr_root: dir,
servers: [{
host: commander.host || "http://localhost:4502",
username: commander.username || "admin",
password: commander.password || "admin"
}]
};
//create a new instance
va... | [
"function",
"startUp",
"(",
"dir",
")",
"{",
"var",
"config",
"=",
"{",
"jcr_root",
":",
"dir",
",",
"servers",
":",
"[",
"{",
"host",
":",
"commander",
".",
"host",
"||",
"\"http://localhost:4502\"",
",",
"username",
":",
"commander",
".",
"username",
"... | end with parse to parse through the input | [
"end",
"with",
"parse",
"to",
"parse",
"through",
"the",
"input"
] | f7bc671c0de6d2d6b4e039da1a67b7456186179b | https://github.com/leoxy520/Sling2JCR/blob/f7bc671c0de6d2d6b4e039da1a67b7456186179b/index.js#L17-L43 |
51,263 | flowthings/node-client | flowthings/websocketFactory.js | crudable | function crudable(flowthingsWs) {
return {
create: function(obj, params, responseHandler, cb) {
if (typeof params === 'function') {
cb = responseHandler; responseHandler = params; params = {};
} else if (!params) {
params = {};
}
baseWs(flowthingsWs, this.objectType, 'crea... | javascript | function crudable(flowthingsWs) {
return {
create: function(obj, params, responseHandler, cb) {
if (typeof params === 'function') {
cb = responseHandler; responseHandler = params; params = {};
} else if (!params) {
params = {};
}
baseWs(flowthingsWs, this.objectType, 'crea... | [
"function",
"crudable",
"(",
"flowthingsWs",
")",
"{",
"return",
"{",
"create",
":",
"function",
"(",
"obj",
",",
"params",
",",
"responseHandler",
",",
"cb",
")",
"{",
"if",
"(",
"typeof",
"params",
"===",
"'function'",
")",
"{",
"cb",
"=",
"responseHan... | These are in the private API. We don't really want people to access them directly. | [
"These",
"are",
"in",
"the",
"private",
"API",
".",
"We",
"don",
"t",
"really",
"want",
"people",
"to",
"access",
"them",
"directly",
"."
] | 0a9e9660e28bface0da4e919fd1e2617deabbf77 | https://github.com/flowthings/node-client/blob/0a9e9660e28bface0da4e919fd1e2617deabbf77/flowthings/websocketFactory.js#L247-L299 |
51,264 | flowthings/node-client | flowthings/websocketFactory.js | dropCreate | function dropCreate(flowthingsWs) {
return {
create: function(drop, params, responseHandler, cb) {
if (typeof params === 'function') {
cb = responseHandler; responseHandler = params; params = {};
} else if (!params) {
params = {};
}
if (this.flowId.charAt(0) === '/') {
... | javascript | function dropCreate(flowthingsWs) {
return {
create: function(drop, params, responseHandler, cb) {
if (typeof params === 'function') {
cb = responseHandler; responseHandler = params; params = {};
} else if (!params) {
params = {};
}
if (this.flowId.charAt(0) === '/') {
... | [
"function",
"dropCreate",
"(",
"flowthingsWs",
")",
"{",
"return",
"{",
"create",
":",
"function",
"(",
"drop",
",",
"params",
",",
"responseHandler",
",",
"cb",
")",
"{",
"if",
"(",
"typeof",
"params",
"===",
"'function'",
")",
"{",
"cb",
"=",
"response... | can I roll this into the normal create? | [
"can",
"I",
"roll",
"this",
"into",
"the",
"normal",
"create?"
] | 0a9e9660e28bface0da4e919fd1e2617deabbf77 | https://github.com/flowthings/node-client/blob/0a9e9660e28bface0da4e919fd1e2617deabbf77/flowthings/websocketFactory.js#L318-L336 |
51,265 | biggora/trinte-creator | scripts/controllers/AppsController.js | function(req, res, next) {
/**
* If you want to redirect to another controller, uncomment
*/
var controllers = [];
fs.readdir(__dirname + '/', function(err, files) {
if (err) {
throw err;
}
files.forEach(function(file) {
... | javascript | function(req, res, next) {
/**
* If you want to redirect to another controller, uncomment
*/
var controllers = [];
fs.readdir(__dirname + '/', function(err, files) {
if (err) {
throw err;
}
files.forEach(function(file) {
... | [
"function",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"/**\n * If you want to redirect to another controller, uncomment\n */",
"var",
"controllers",
"=",
"[",
"]",
";",
"fs",
".",
"readdir",
"(",
"__dirname",
"+",
"'/'",
",",
"function",
"(",
... | Default Application index - shows a list of the controllers.
Redirect here if you prefer another controller to be your index.
@param req
@param res
@param next | [
"Default",
"Application",
"index",
"-",
"shows",
"a",
"list",
"of",
"the",
"controllers",
".",
"Redirect",
"here",
"if",
"you",
"prefer",
"another",
"controller",
"to",
"be",
"your",
"index",
"."
] | fdd723405418967ca8a690867940863fd77e636b | https://github.com/biggora/trinte-creator/blob/fdd723405418967ca8a690867940863fd77e636b/scripts/controllers/AppsController.js#L20-L46 | |
51,266 | Psychopoulet/node-promfs | lib/extends/_mkdirp.js | _mkdirp | function _mkdirp (directory, mode, callback) {
if ("undefined" === typeof directory) {
throw new ReferenceError("missing \"directory\" argument");
}
else if ("string" !== typeof directory) {
throw new TypeError("\"directory\" argument is not a string");
}
else if ("" === directory.trim()) {
... | javascript | function _mkdirp (directory, mode, callback) {
if ("undefined" === typeof directory) {
throw new ReferenceError("missing \"directory\" argument");
}
else if ("string" !== typeof directory) {
throw new TypeError("\"directory\" argument is not a string");
}
else if ("" === directory.trim()) {
... | [
"function",
"_mkdirp",
"(",
"directory",
",",
"mode",
",",
"callback",
")",
"{",
"if",
"(",
"\"undefined\"",
"===",
"typeof",
"directory",
")",
"{",
"throw",
"new",
"ReferenceError",
"(",
"\"missing \\\"directory\\\" argument\"",
")",
";",
"}",
"else",
"if",
"... | methods
Async mkdirp
@param {string} directory : directory path
@param {number} mode : creation mode
@param {function|null} callback : operation's result
@returns {void} | [
"methods",
"Async",
"mkdirp"
] | 016e272fc58c6ef6eae5ea551a0e8873f0ac20cc | https://github.com/Psychopoulet/node-promfs/blob/016e272fc58c6ef6eae5ea551a0e8873f0ac20cc/lib/extends/_mkdirp.js#L27-L93 |
51,267 | redisjs/jsr-server | lib/command/server/debug.js | diff | function diff(req, res) {
// defined and loaded commands
var cmds = this.execs
// map of all standard top-level commands
, map = Constants.MAP
// output multi bulk reply list
, list = []
, k;
for(k in map) {
if(!cmds[k]) list.push(k);
}
res.send(null, list);
} | javascript | function diff(req, res) {
// defined and loaded commands
var cmds = this.execs
// map of all standard top-level commands
, map = Constants.MAP
// output multi bulk reply list
, list = []
, k;
for(k in map) {
if(!cmds[k]) list.push(k);
}
res.send(null, list);
} | [
"function",
"diff",
"(",
"req",
",",
"res",
")",
"{",
"// defined and loaded commands",
"var",
"cmds",
"=",
"this",
".",
"execs",
"// map of all standard top-level commands",
",",
"map",
"=",
"Constants",
".",
"MAP",
"// output multi bulk reply list",
",",
"list",
"... | Respond to the DIFF subcommand.
Non-standard debug subcommand that returns a diff between the list
of standard redis commands and the commands loaded.
Primarily useful to determine which commands have not yet been
implemented, but in a scenario where commands have been renamed, deleted
or custom commands loaded this ... | [
"Respond",
"to",
"the",
"DIFF",
"subcommand",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/server/debug.js#L33-L47 |
51,268 | redisjs/jsr-server | lib/command/server/debug.js | reload | function reload(req, res) {
var log = this.log;
if(Persistence.loading) {
return res.send(new Error('database load in progress'));
}
Persistence.load(this.state.store, this.state.conf,
function onLoad(err, time, diff, version) {
if(err) return log.warning('db reload error: %s', err.message);
... | javascript | function reload(req, res) {
var log = this.log;
if(Persistence.loading) {
return res.send(new Error('database load in progress'));
}
Persistence.load(this.state.store, this.state.conf,
function onLoad(err, time, diff, version) {
if(err) return log.warning('db reload error: %s', err.message);
... | [
"function",
"reload",
"(",
"req",
",",
"res",
")",
"{",
"var",
"log",
"=",
"this",
".",
"log",
";",
"if",
"(",
"Persistence",
".",
"loading",
")",
"{",
"return",
"res",
".",
"send",
"(",
"new",
"Error",
"(",
"'database load in progress'",
")",
")",
"... | Respond to the RELOAD subcommand. | [
"Respond",
"to",
"the",
"RELOAD",
"subcommand",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/server/debug.js#L52-L65 |
51,269 | Nazariglez/perenquen | lib/pixi/src/core/math/shapes/Ellipse.js | Ellipse | function Ellipse(x, y, width, height)
{
/**
* @member {number}
* @default 0
*/
this.x = x || 0;
/**
* @member {number}
* @default 0
*/
this.y = y || 0;
/**
* @member {number}
* @default 0
*/
this.width = width || 0;
/**
* @member {number}
... | javascript | function Ellipse(x, y, width, height)
{
/**
* @member {number}
* @default 0
*/
this.x = x || 0;
/**
* @member {number}
* @default 0
*/
this.y = y || 0;
/**
* @member {number}
* @default 0
*/
this.width = width || 0;
/**
* @member {number}
... | [
"function",
"Ellipse",
"(",
"x",
",",
"y",
",",
"width",
",",
"height",
")",
"{",
"/**\n * @member {number}\n * @default 0\n */",
"this",
".",
"x",
"=",
"x",
"||",
"0",
";",
"/**\n * @member {number}\n * @default 0\n */",
"this",
".",
"y",
"=... | The Ellipse object can be used to specify a hit area for displayObjects
@class
@memberof PIXI
@param x {number} The X coordinate of the center of the ellipse
@param y {number} The Y coordinate of the center of the ellipse
@param width {number} The half width of this ellipse
@param height {number} The half height of th... | [
"The",
"Ellipse",
"object",
"can",
"be",
"used",
"to",
"specify",
"a",
"hit",
"area",
"for",
"displayObjects"
] | e023964d05afeefebdcac4e2044819fdfa3899ae | https://github.com/Nazariglez/perenquen/blob/e023964d05afeefebdcac4e2044819fdfa3899ae/lib/pixi/src/core/math/shapes/Ellipse.js#L14-L46 |
51,270 | haraldrudell/apprunner | lib/apperror.js | apiError | function apiError(err) {
var f = testProbe ? testProbe : anomaly.anomaly
f.apply(this, Array.prototype.slice.call(arguments))
} | javascript | function apiError(err) {
var f = testProbe ? testProbe : anomaly.anomaly
f.apply(this, Array.prototype.slice.call(arguments))
} | [
"function",
"apiError",
"(",
"err",
")",
"{",
"var",
"f",
"=",
"testProbe",
"?",
"testProbe",
":",
"anomaly",
".",
"anomaly",
"f",
".",
"apply",
"(",
"this",
",",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
")",
")",
"}"
] | report error from unknown api | [
"report",
"error",
"from",
"unknown",
"api"
] | 8d7dead166c919d160b429e00c49a62027994c33 | https://github.com/haraldrudell/apprunner/blob/8d7dead166c919d160b429e00c49a62027994c33/lib/apperror.js#L16-L19 |
51,271 | cortexjs-legacy/cortex-scaffold-generator | index.js | function (done) {
var root = node_path.join(__dirname, 'templates', template);
fs.exists(root, function(exists){
if(exists){
template_root = root;
}else{
template_root = node_path.join(DIR_CUSTOM_TEMPLATES, template)
}
done(null);
});
} | javascript | function (done) {
var root = node_path.join(__dirname, 'templates', template);
fs.exists(root, function(exists){
if(exists){
template_root = root;
}else{
template_root = node_path.join(DIR_CUSTOM_TEMPLATES, template)
}
done(null);
});
} | [
"function",
"(",
"done",
")",
"{",
"var",
"root",
"=",
"node_path",
".",
"join",
"(",
"__dirname",
",",
"'templates'",
",",
"template",
")",
";",
"fs",
".",
"exists",
"(",
"root",
",",
"function",
"(",
"exists",
")",
"{",
"if",
"(",
"exists",
")",
... | set template root | [
"set",
"template",
"root"
] | da5e4b18832e478176babb9c065d3e3178b88331 | https://github.com/cortexjs-legacy/cortex-scaffold-generator/blob/da5e4b18832e478176babb9c065d3e3178b88331/index.js#L75-L86 | |
51,272 | cortexjs-legacy/cortex-scaffold-generator | index.js | function (done) {
var p = clone(pkg);
delete p.devDependencies;
var content = JSON.stringify(p, null, 2);
write_if_not_exists('package.json', content, done);
} | javascript | function (done) {
var p = clone(pkg);
delete p.devDependencies;
var content = JSON.stringify(p, null, 2);
write_if_not_exists('package.json', content, done);
} | [
"function",
"(",
"done",
")",
"{",
"var",
"p",
"=",
"clone",
"(",
"pkg",
")",
";",
"delete",
"p",
".",
"devDependencies",
";",
"var",
"content",
"=",
"JSON",
".",
"stringify",
"(",
"p",
",",
"null",
",",
"2",
")",
";",
"write_if_not_exists",
"(",
"... | write package.json | [
"write",
"package",
".",
"json"
] | da5e4b18832e478176babb9c065d3e3178b88331 | https://github.com/cortexjs-legacy/cortex-scaffold-generator/blob/da5e4b18832e478176babb9c065d3e3178b88331/index.js#L116-L121 | |
51,273 | timrwood/grunt-haychtml | lib/haychtml.js | extensionMatches | function extensionMatches (filename) {
var extname = path.extname(filename);
if (extname) {
return extname === extension;
}
return true;
} | javascript | function extensionMatches (filename) {
var extname = path.extname(filename);
if (extname) {
return extname === extension;
}
return true;
} | [
"function",
"extensionMatches",
"(",
"filename",
")",
"{",
"var",
"extname",
"=",
"path",
".",
"extname",
"(",
"filename",
")",
";",
"if",
"(",
"extname",
")",
"{",
"return",
"extname",
"===",
"extension",
";",
"}",
"return",
"true",
";",
"}"
] | We only want files that end with the correct extension | [
"We",
"only",
"want",
"files",
"that",
"end",
"with",
"the",
"correct",
"extension"
] | 70bfa1ba754d91ae481a8b3ab0a2a566b7d73b1c | https://github.com/timrwood/grunt-haychtml/blob/70bfa1ba754d91ae481a8b3ab0a2a566b7d73b1c/lib/haychtml.js#L106-L112 |
51,274 | timrwood/grunt-haychtml | lib/haychtml.js | handleDirectoryOrFile | function handleDirectoryOrFile (filename) {
var absolutePath = path.join(dir, recursePath, filename),
relativePath = path.join(recursePath, filename);
if (fs.statSync(absolutePath).isDirectory()) {
find(dir, extension, relativePath).forEach(addFileToOutput);
} else {
addFileToOutput(new File(relativePat... | javascript | function handleDirectoryOrFile (filename) {
var absolutePath = path.join(dir, recursePath, filename),
relativePath = path.join(recursePath, filename);
if (fs.statSync(absolutePath).isDirectory()) {
find(dir, extension, relativePath).forEach(addFileToOutput);
} else {
addFileToOutput(new File(relativePat... | [
"function",
"handleDirectoryOrFile",
"(",
"filename",
")",
"{",
"var",
"absolutePath",
"=",
"path",
".",
"join",
"(",
"dir",
",",
"recursePath",
",",
"filename",
")",
",",
"relativePath",
"=",
"path",
".",
"join",
"(",
"recursePath",
",",
"filename",
")",
... | If the path is a file, create a File object and add it to the output array. | [
"If",
"the",
"path",
"is",
"a",
"file",
"create",
"a",
"File",
"object",
"and",
"add",
"it",
"to",
"the",
"output",
"array",
"."
] | 70bfa1ba754d91ae481a8b3ab0a2a566b7d73b1c | https://github.com/timrwood/grunt-haychtml/blob/70bfa1ba754d91ae481a8b3ab0a2a566b7d73b1c/lib/haychtml.js#L124-L133 |
51,275 | tjmehta/mongooseware | lib/method-lists/list-class-methods.js | listClassMethods | function listClassMethods (Model) {
var classMethods = Object.keys(Model.schema.statics);
for (var method in Model) {
if (!isPrivateMethod(method) && isFunction(Model[method])) {
classMethods.push(method);
}
}
return classMethods;
} | javascript | function listClassMethods (Model) {
var classMethods = Object.keys(Model.schema.statics);
for (var method in Model) {
if (!isPrivateMethod(method) && isFunction(Model[method])) {
classMethods.push(method);
}
}
return classMethods;
} | [
"function",
"listClassMethods",
"(",
"Model",
")",
"{",
"var",
"classMethods",
"=",
"Object",
".",
"keys",
"(",
"Model",
".",
"schema",
".",
"statics",
")",
";",
"for",
"(",
"var",
"method",
"in",
"Model",
")",
"{",
"if",
"(",
"!",
"isPrivateMethod",
"... | Returns list of non-private class methods
@param {Object} Model
@return {Array} | [
"Returns",
"list",
"of",
"non",
"-",
"private",
"class",
"methods"
] | c62ce0bac82880826b3528231e08f5e5b3efdb83 | https://github.com/tjmehta/mongooseware/blob/c62ce0bac82880826b3528231e08f5e5b3efdb83/lib/method-lists/list-class-methods.js#L18-L26 |
51,276 | DeadAlready/node-foldermap | lib/utils.js | clone | function clone(obj) {
if (typeof obj !== 'object') {
return obj;
}
var ret;
if (util.isArray(obj)) {
ret = [];
obj.forEach(function (val) {
ret.push(clone(val));
});
return ret;
}
ret = {};
Object.keys(obj).forEach(function (key) {
... | javascript | function clone(obj) {
if (typeof obj !== 'object') {
return obj;
}
var ret;
if (util.isArray(obj)) {
ret = [];
obj.forEach(function (val) {
ret.push(clone(val));
});
return ret;
}
ret = {};
Object.keys(obj).forEach(function (key) {
... | [
"function",
"clone",
"(",
"obj",
")",
"{",
"if",
"(",
"typeof",
"obj",
"!==",
"'object'",
")",
"{",
"return",
"obj",
";",
"}",
"var",
"ret",
";",
"if",
"(",
"util",
".",
"isArray",
"(",
"obj",
")",
")",
"{",
"ret",
"=",
"[",
"]",
";",
"obj",
... | Function for creating a clone of an object
@param o {Object} object to clone
@return {Object} | [
"Function",
"for",
"creating",
"a",
"clone",
"of",
"an",
"object"
] | be6048cb3b3e9fa3b6f36542cb8835d48c7bde1d | https://github.com/DeadAlready/node-foldermap/blob/be6048cb3b3e9fa3b6f36542cb8835d48c7bde1d/lib/utils.js#L14-L31 |
51,277 | DeadAlready/node-foldermap | lib/utils.js | extend | function extend(a, b, noClone) { // A extends B
a = a || {};
if (typeof a !== 'object') {
return noClone ? b : clone(b);
}
if (typeof b !== 'object') {
return b;
}
if (!noClone) {
a = clone(a);
}
Object.keys(b).forEach(function (key) {
if (!a.hasOwnPro... | javascript | function extend(a, b, noClone) { // A extends B
a = a || {};
if (typeof a !== 'object') {
return noClone ? b : clone(b);
}
if (typeof b !== 'object') {
return b;
}
if (!noClone) {
a = clone(a);
}
Object.keys(b).forEach(function (key) {
if (!a.hasOwnPro... | [
"function",
"extend",
"(",
"a",
",",
"b",
",",
"noClone",
")",
"{",
"// A extends B",
"a",
"=",
"a",
"||",
"{",
"}",
";",
"if",
"(",
"typeof",
"a",
"!==",
"'object'",
")",
"{",
"return",
"noClone",
"?",
"b",
":",
"clone",
"(",
"b",
")",
";",
"}... | A extends B
util.inherits works only with objects derived from Object
@return {Object} Extended object | [
"A",
"extends",
"B"
] | be6048cb3b3e9fa3b6f36542cb8835d48c7bde1d | https://github.com/DeadAlready/node-foldermap/blob/be6048cb3b3e9fa3b6f36542cb8835d48c7bde1d/lib/utils.js#L40-L65 |
51,278 | Zingle/tlsfs | index.js | readCertsSync | function readCertsSync(paths) {
var opts = {};
if (!(paths instanceof Array))
throw new TypeError("readCertsSync expects Array argument");
switch (paths.length) {
case 1:
opts.pfx = fs.readFileSync(paths[0]);
break;
case 2:
opts.cert = fs.readFil... | javascript | function readCertsSync(paths) {
var opts = {};
if (!(paths instanceof Array))
throw new TypeError("readCertsSync expects Array argument");
switch (paths.length) {
case 1:
opts.pfx = fs.readFileSync(paths[0]);
break;
case 2:
opts.cert = fs.readFil... | [
"function",
"readCertsSync",
"(",
"paths",
")",
"{",
"var",
"opts",
"=",
"{",
"}",
";",
"if",
"(",
"!",
"(",
"paths",
"instanceof",
"Array",
")",
")",
"throw",
"new",
"TypeError",
"(",
"\"readCertsSync expects Array argument\"",
")",
";",
"switch",
"(",
"p... | Read TLS certs from filesystem synchronously. Return TLS options object
with 'pfx' or 'cert', 'key', and 'ca' options, depending on the number of
paths provided.
@param {string[]} paths
@returns {object} | [
"Read",
"TLS",
"certs",
"from",
"filesystem",
"synchronously",
".",
"Return",
"TLS",
"options",
"object",
"with",
"pfx",
"or",
"cert",
"key",
"and",
"ca",
"options",
"depending",
"on",
"the",
"number",
"of",
"paths",
"provided",
"."
] | ea541c70728263867b9277369943f039c9b82bbd | https://github.com/Zingle/tlsfs/blob/ea541c70728263867b9277369943f039c9b82bbd/index.js#L11-L35 |
51,279 | Zingle/tlsfs | index.js | readCerts | function readCerts(paths, done) {
if (!(paths instanceof Array))
throw new TypeError("readCertsSync expects Array argument");
async.map(paths, fs.readFile, function(err, files) {
var opts = {};
if (err) done(err);
else switch (files.length) {
case 1:
... | javascript | function readCerts(paths, done) {
if (!(paths instanceof Array))
throw new TypeError("readCertsSync expects Array argument");
async.map(paths, fs.readFile, function(err, files) {
var opts = {};
if (err) done(err);
else switch (files.length) {
case 1:
... | [
"function",
"readCerts",
"(",
"paths",
",",
"done",
")",
"{",
"if",
"(",
"!",
"(",
"paths",
"instanceof",
"Array",
")",
")",
"throw",
"new",
"TypeError",
"(",
"\"readCertsSync expects Array argument\"",
")",
";",
"async",
".",
"map",
"(",
"paths",
",",
"fs... | Read TLS certs from filesystem. Pass TLS options object to callback with
'pfx' or 'cert', 'key', and 'ca' options, depending on the number of paths
provided.
@param {string[]} paths
@param {function} done | [
"Read",
"TLS",
"certs",
"from",
"filesystem",
".",
"Pass",
"TLS",
"options",
"object",
"to",
"callback",
"with",
"pfx",
"or",
"cert",
"key",
"and",
"ca",
"options",
"depending",
"on",
"the",
"number",
"of",
"paths",
"provided",
"."
] | ea541c70728263867b9277369943f039c9b82bbd | https://github.com/Zingle/tlsfs/blob/ea541c70728263867b9277369943f039c9b82bbd/index.js#L44-L68 |
51,280 | nerdvibe/awesome_starter | error_handling.js | expressResponseError_silent | function expressResponseError_silent(response, message) {
let errorMessage = "there was an error in the request";
if(message)
errorMessage = message
response.json({ success: false, error: errorMessage });
} | javascript | function expressResponseError_silent(response, message) {
let errorMessage = "there was an error in the request";
if(message)
errorMessage = message
response.json({ success: false, error: errorMessage });
} | [
"function",
"expressResponseError_silent",
"(",
"response",
",",
"message",
")",
"{",
"let",
"errorMessage",
"=",
"\"there was an error in the request\"",
";",
"if",
"(",
"message",
")",
"errorMessage",
"=",
"message",
"response",
".",
"json",
"(",
"{",
"success",
... | General internal error for express | [
"General",
"internal",
"error",
"for",
"express"
] | 9440d54c43dd8459f6cb5865cc65d5f0ce352523 | https://github.com/nerdvibe/awesome_starter/blob/9440d54c43dd8459f6cb5865cc65d5f0ce352523/error_handling.js#L11-L16 |
51,281 | nerdvibe/awesome_starter | error_handling.js | expressResponseError | function expressResponseError(response, error, message) {
let errorMessage = "there was an error in the request";
if(message)
errorMessage = message
response.json({ success: false, error: errorMessage });
console.error(error);
} | javascript | function expressResponseError(response, error, message) {
let errorMessage = "there was an error in the request";
if(message)
errorMessage = message
response.json({ success: false, error: errorMessage });
console.error(error);
} | [
"function",
"expressResponseError",
"(",
"response",
",",
"error",
",",
"message",
")",
"{",
"let",
"errorMessage",
"=",
"\"there was an error in the request\"",
";",
"if",
"(",
"message",
")",
"errorMessage",
"=",
"message",
"response",
".",
"json",
"(",
"{",
"... | General internal error for express with console.error | [
"General",
"internal",
"error",
"for",
"express",
"with",
"console",
".",
"error"
] | 9440d54c43dd8459f6cb5865cc65d5f0ce352523 | https://github.com/nerdvibe/awesome_starter/blob/9440d54c43dd8459f6cb5865cc65d5f0ce352523/error_handling.js#L21-L27 |
51,282 | jonschlinkert/normalize-keywords | index.js | properize | function properize(word, options) {
options = _.extend({inflect: false}, options);
if (!/\./.test(word)) {
word = changeCase(word);
if (options.inflect === false) {
return word;
}
return inflection.singularize(word);
}
return word;
} | javascript | function properize(word, options) {
options = _.extend({inflect: false}, options);
if (!/\./.test(word)) {
word = changeCase(word);
if (options.inflect === false) {
return word;
}
return inflection.singularize(word);
}
return word;
} | [
"function",
"properize",
"(",
"word",
",",
"options",
")",
"{",
"options",
"=",
"_",
".",
"extend",
"(",
"{",
"inflect",
":",
"false",
"}",
",",
"options",
")",
";",
"if",
"(",
"!",
"/",
"\\.",
"/",
".",
"test",
"(",
"word",
")",
")",
"{",
"wor... | Make the word lowercase, dashed, and singular.
@param {String} `word`
@return {String} | [
"Make",
"the",
"word",
"lowercase",
"dashed",
"and",
"singular",
"."
] | f4d1a92fab85c49636929d3a23652b1795b9ac22 | https://github.com/jonschlinkert/normalize-keywords/blob/f4d1a92fab85c49636929d3a23652b1795b9ac22/index.js#L60-L70 |
51,283 | jonschlinkert/normalize-keywords | index.js | chop | function chop(keywords) {
return keywords.slice(0)
.reduce(function(acc, ele) {
acc = acc.concat(ele.split('-'));
return acc;
}, []);
} | javascript | function chop(keywords) {
return keywords.slice(0)
.reduce(function(acc, ele) {
acc = acc.concat(ele.split('-'));
return acc;
}, []);
} | [
"function",
"chop",
"(",
"keywords",
")",
"{",
"return",
"keywords",
".",
"slice",
"(",
"0",
")",
".",
"reduce",
"(",
"function",
"(",
"acc",
",",
"ele",
")",
"{",
"acc",
"=",
"acc",
".",
"concat",
"(",
"ele",
".",
"split",
"(",
"'-'",
")",
")",
... | Clone the array and split words by dashes,
then concat the results back into the array
@param {Array} keywords
@return {Array} | [
"Clone",
"the",
"array",
"and",
"split",
"words",
"by",
"dashes",
"then",
"concat",
"the",
"results",
"back",
"into",
"the",
"array"
] | f4d1a92fab85c49636929d3a23652b1795b9ac22 | https://github.com/jonschlinkert/normalize-keywords/blob/f4d1a92fab85c49636929d3a23652b1795b9ac22/index.js#L80-L86 |
51,284 | jonschlinkert/normalize-keywords | index.js | changeCase | function changeCase(str) {
if (str == null) return '';
str = String(str);
str = str.replace(/\./g, 'zzz')
str = str.replace(/_/g, '-')
str = str.replace(/([A-Z]+)/g, function (_, $1) {
return '-' + $1.toLowerCase();
});
str = str.replace(/[^a-z-]+/g, '-')
str = str.replace(/^[-\s]+|[-\s]+$/g, '');
... | javascript | function changeCase(str) {
if (str == null) return '';
str = String(str);
str = str.replace(/\./g, 'zzz')
str = str.replace(/_/g, '-')
str = str.replace(/([A-Z]+)/g, function (_, $1) {
return '-' + $1.toLowerCase();
});
str = str.replace(/[^a-z-]+/g, '-')
str = str.replace(/^[-\s]+|[-\s]+$/g, '');
... | [
"function",
"changeCase",
"(",
"str",
")",
"{",
"if",
"(",
"str",
"==",
"null",
")",
"return",
"''",
";",
"str",
"=",
"String",
"(",
"str",
")",
";",
"str",
"=",
"str",
".",
"replace",
"(",
"/",
"\\.",
"/",
"g",
",",
"'zzz'",
")",
"str",
"=",
... | Convert camelcase to slugs, remove leading and trailing
dashes and whitespace. Convert underscores to dashes.
@param {String} `str`
@return {String} | [
"Convert",
"camelcase",
"to",
"slugs",
"remove",
"leading",
"and",
"trailing",
"dashes",
"and",
"whitespace",
".",
"Convert",
"underscores",
"to",
"dashes",
"."
] | f4d1a92fab85c49636929d3a23652b1795b9ac22 | https://github.com/jonschlinkert/normalize-keywords/blob/f4d1a92fab85c49636929d3a23652b1795b9ac22/index.js#L109-L121 |
51,285 | jonschlinkert/normalize-keywords | index.js | sanitize | function sanitize(arr, opts) {
return _.reduce(arr, function (acc, keywords) {
keywords = keywords.split(' ').filter(Boolean);
return acc.concat(keywords).map(function (keyword, i) {
if (opts && opts.sanitize) {
return opts.sanitize(keyword, i, keywords);
}
return keyword.toLowerCase... | javascript | function sanitize(arr, opts) {
return _.reduce(arr, function (acc, keywords) {
keywords = keywords.split(' ').filter(Boolean);
return acc.concat(keywords).map(function (keyword, i) {
if (opts && opts.sanitize) {
return opts.sanitize(keyword, i, keywords);
}
return keyword.toLowerCase... | [
"function",
"sanitize",
"(",
"arr",
",",
"opts",
")",
"{",
"return",
"_",
".",
"reduce",
"(",
"arr",
",",
"function",
"(",
"acc",
",",
"keywords",
")",
"{",
"keywords",
"=",
"keywords",
".",
"split",
"(",
"' '",
")",
".",
"filter",
"(",
"Boolean",
... | Clean up empty values, sentences, and non-word characters
that shouldn't polute the keywords.
@param {Array} `arr`
@return {Array} | [
"Clean",
"up",
"empty",
"values",
"sentences",
"and",
"non",
"-",
"word",
"characters",
"that",
"shouldn",
"t",
"polute",
"the",
"keywords",
"."
] | f4d1a92fab85c49636929d3a23652b1795b9ac22 | https://github.com/jonschlinkert/normalize-keywords/blob/f4d1a92fab85c49636929d3a23652b1795b9ac22/index.js#L132-L142 |
51,286 | jonschlinkert/normalize-keywords | index.js | uniq | function uniq(arr) {
if (arr == null || arr.length === 0) {
return [];
}
return _.reduce(arr, function(acc, ele) {
var letter = exclusions.singleLetters;
if (acc.indexOf(ele) === -1 && letter.indexOf(ele) === -1) {
acc.push(ele);
}
return acc;
}, []);
} | javascript | function uniq(arr) {
if (arr == null || arr.length === 0) {
return [];
}
return _.reduce(arr, function(acc, ele) {
var letter = exclusions.singleLetters;
if (acc.indexOf(ele) === -1 && letter.indexOf(ele) === -1) {
acc.push(ele);
}
return acc;
}, []);
} | [
"function",
"uniq",
"(",
"arr",
")",
"{",
"if",
"(",
"arr",
"==",
"null",
"||",
"arr",
".",
"length",
"===",
"0",
")",
"{",
"return",
"[",
"]",
";",
"}",
"return",
"_",
".",
"reduce",
"(",
"arr",
",",
"function",
"(",
"acc",
",",
"ele",
")",
... | Uniqueify keywords.
@param {Array} `arr`
@return {Array} | [
"Uniqueify",
"keywords",
"."
] | f4d1a92fab85c49636929d3a23652b1795b9ac22 | https://github.com/jonschlinkert/normalize-keywords/blob/f4d1a92fab85c49636929d3a23652b1795b9ac22/index.js#L152-L165 |
51,287 | ecliptic/webpack-blocks-copy | lib/index.js | copy | function copy (from, to) {
return Object.assign(
function (context) {
return function (prevConfig) {
context.copyPlugin = context.copyPlugin || {patterns: []}
// Merge the provided simple pattern into the config
context.copyPlugin = _extends({}, context.copyPlugin, {
patte... | javascript | function copy (from, to) {
return Object.assign(
function (context) {
return function (prevConfig) {
context.copyPlugin = context.copyPlugin || {patterns: []}
// Merge the provided simple pattern into the config
context.copyPlugin = _extends({}, context.copyPlugin, {
patte... | [
"function",
"copy",
"(",
"from",
",",
"to",
")",
"{",
"return",
"Object",
".",
"assign",
"(",
"function",
"(",
"context",
")",
"{",
"return",
"function",
"(",
"prevConfig",
")",
"{",
"context",
".",
"copyPlugin",
"=",
"context",
".",
"copyPlugin",
"||",
... | Adds a simple copy pattern to the list of patterns for the plugin. | [
"Adds",
"a",
"simple",
"copy",
"pattern",
"to",
"the",
"list",
"of",
"patterns",
"for",
"the",
"plugin",
"."
] | 3bd12137a35a9237a9bdc6c4443e5ed29bfc8812 | https://github.com/ecliptic/webpack-blocks-copy/blob/3bd12137a35a9237a9bdc6c4443e5ed29bfc8812/lib/index.js#L36-L55 |
51,288 | ecliptic/webpack-blocks-copy | lib/index.js | copyPattern | function copyPattern (pattern) {
return Object.assign(
function (context) {
return function (prevConfig) {
context.copyPlugin = context.copyPlugin || {patterns: []}
// Merge the provided advanced pattern into the config
context.copyPlugin = _extends({}, context.copyPlugin, {
... | javascript | function copyPattern (pattern) {
return Object.assign(
function (context) {
return function (prevConfig) {
context.copyPlugin = context.copyPlugin || {patterns: []}
// Merge the provided advanced pattern into the config
context.copyPlugin = _extends({}, context.copyPlugin, {
... | [
"function",
"copyPattern",
"(",
"pattern",
")",
"{",
"return",
"Object",
".",
"assign",
"(",
"function",
"(",
"context",
")",
"{",
"return",
"function",
"(",
"prevConfig",
")",
"{",
"context",
".",
"copyPlugin",
"=",
"context",
".",
"copyPlugin",
"||",
"{"... | Adds an advanced pattern to the list of patterns for the plugin. | [
"Adds",
"an",
"advanced",
"pattern",
"to",
"the",
"list",
"of",
"patterns",
"for",
"the",
"plugin",
"."
] | 3bd12137a35a9237a9bdc6c4443e5ed29bfc8812 | https://github.com/ecliptic/webpack-blocks-copy/blob/3bd12137a35a9237a9bdc6c4443e5ed29bfc8812/lib/index.js#L60-L77 |
51,289 | ecliptic/webpack-blocks-copy | lib/index.js | copyOptions | function copyOptions (options) {
return Object.assign(
function (context) {
return function (prevConfig) {
context.copyPlugin = context.copyPlugin || {}
// Merge the provided copy plugin config into the context
context.copyPlugin = _extends({}, context.copyPlugin, {
option... | javascript | function copyOptions (options) {
return Object.assign(
function (context) {
return function (prevConfig) {
context.copyPlugin = context.copyPlugin || {}
// Merge the provided copy plugin config into the context
context.copyPlugin = _extends({}, context.copyPlugin, {
option... | [
"function",
"copyOptions",
"(",
"options",
")",
"{",
"return",
"Object",
".",
"assign",
"(",
"function",
"(",
"context",
")",
"{",
"return",
"function",
"(",
"prevConfig",
")",
"{",
"context",
".",
"copyPlugin",
"=",
"context",
".",
"copyPlugin",
"||",
"{"... | Sets options for the copy plugin. | [
"Sets",
"options",
"for",
"the",
"copy",
"plugin",
"."
] | 3bd12137a35a9237a9bdc6c4443e5ed29bfc8812 | https://github.com/ecliptic/webpack-blocks-copy/blob/3bd12137a35a9237a9bdc6c4443e5ed29bfc8812/lib/index.js#L82-L99 |
51,290 | ecliptic/webpack-blocks-copy | lib/index.js | postConfig | function postConfig (context, _ref) {
var merge = _ref.merge
return function (prevConfig) {
var _context$copyPlugin = context.copyPlugin,
patterns = _context$copyPlugin.patterns,
options = _context$copyPlugin.options
var plugin = new _copyWebpackPlugin2.default(patterns, options)
return me... | javascript | function postConfig (context, _ref) {
var merge = _ref.merge
return function (prevConfig) {
var _context$copyPlugin = context.copyPlugin,
patterns = _context$copyPlugin.patterns,
options = _context$copyPlugin.options
var plugin = new _copyWebpackPlugin2.default(patterns, options)
return me... | [
"function",
"postConfig",
"(",
"context",
",",
"_ref",
")",
"{",
"var",
"merge",
"=",
"_ref",
".",
"merge",
"return",
"function",
"(",
"prevConfig",
")",
"{",
"var",
"_context$copyPlugin",
"=",
"context",
".",
"copyPlugin",
",",
"patterns",
"=",
"_context$co... | Instantiate the copy plugin. | [
"Instantiate",
"the",
"copy",
"plugin",
"."
] | 3bd12137a35a9237a9bdc6c4443e5ed29bfc8812 | https://github.com/ecliptic/webpack-blocks-copy/blob/3bd12137a35a9237a9bdc6c4443e5ed29bfc8812/lib/index.js#L104-L115 |
51,291 | MORPOL/createClass | createclass.js | function( mElement, aArray ) {
for( var i=0; i<aArray.length; i++ )
if( aArray[i]==mElement )
return i;
return -1;
} | javascript | function( mElement, aArray ) {
for( var i=0; i<aArray.length; i++ )
if( aArray[i]==mElement )
return i;
return -1;
} | [
"function",
"(",
"mElement",
",",
"aArray",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"aArray",
".",
"length",
";",
"i",
"++",
")",
"if",
"(",
"aArray",
"[",
"i",
"]",
"==",
"mElement",
")",
"return",
"i",
";",
"return",
"-",
... | Check whether or not the given element exists in the given array
@param mElement The element to be searched for (double equal comparison)
@param aArray The array to be searched
@return The index of the element within the array or -1 if it wasn't found | [
"Check",
"whether",
"or",
"not",
"the",
"given",
"element",
"exists",
"in",
"the",
"given",
"array"
] | 3e839121357fd25ff1b20fcd4ca02062f1192583 | https://github.com/MORPOL/createClass/blob/3e839121357fd25ff1b20fcd4ca02062f1192583/createclass.js#L57-L63 | |
51,292 | MORPOL/createClass | createclass.js | function() {
var v = [];
for( var i in this )
if( typeof this[i]=="function" && this[i].__virtual )
v.push( i );
if( v.length )
createClass.log( 'error', 'INCOMPLETE CLASS '+this.__className+' HAS AT LEAST ONE PURE VIRTUAL FUNCTION: '+v.join(", ") );
} | javascript | function() {
var v = [];
for( var i in this )
if( typeof this[i]=="function" && this[i].__virtual )
v.push( i );
if( v.length )
createClass.log( 'error', 'INCOMPLETE CLASS '+this.__className+' HAS AT LEAST ONE PURE VIRTUAL FUNCTION: '+v.join(", ") );
} | [
"function",
"(",
")",
"{",
"var",
"v",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"in",
"this",
")",
"if",
"(",
"typeof",
"this",
"[",
"i",
"]",
"==",
"\"function\"",
"&&",
"this",
"[",
"i",
"]",
".",
"__virtual",
")",
"v",
".",
"push",
"(",... | Check for virtual errors, i.e. functions that should have been overridden, but weren't | [
"Check",
"for",
"virtual",
"errors",
"i",
".",
"e",
".",
"functions",
"that",
"should",
"have",
"been",
"overridden",
"but",
"weren",
"t"
] | 3e839121357fd25ff1b20fcd4ca02062f1192583 | https://github.com/MORPOL/createClass/blob/3e839121357fd25ff1b20fcd4ca02062f1192583/createclass.js#L291-L299 | |
51,293 | tjmehta/string-reduce | index.js | stringReduce | function stringReduce (string, reducerCallback, initialValue) {
if (string.length === 0) {
assertErr(initialValue, TypeError, 'Reduce of empty string with no initial value')
return initialValue
}
var initialValuePassed = arguments.length === 3
var result
var startIndex
if (initialValuePassed) {
... | javascript | function stringReduce (string, reducerCallback, initialValue) {
if (string.length === 0) {
assertErr(initialValue, TypeError, 'Reduce of empty string with no initial value')
return initialValue
}
var initialValuePassed = arguments.length === 3
var result
var startIndex
if (initialValuePassed) {
... | [
"function",
"stringReduce",
"(",
"string",
",",
"reducerCallback",
",",
"initialValue",
")",
"{",
"if",
"(",
"string",
".",
"length",
"===",
"0",
")",
"{",
"assertErr",
"(",
"initialValue",
",",
"TypeError",
",",
"'Reduce of empty string with no initial value'",
"... | reduce a string to a value
@param {string} string string to reduce
@param {function} reducerCb reducer function
@param {*} initialValue reduce initial value
@return {*} result | [
"reduce",
"a",
"string",
"to",
"a",
"value"
] | ff3e69a3b68115c793aa2d43f2ab3376688527a2 | https://github.com/tjmehta/string-reduce/blob/ff3e69a3b68115c793aa2d43f2ab3376688527a2/index.js#L12-L37 |
51,294 | nknapp/deep-aplus | index.js | handleAny | function handleAny (obj) {
if (isPromiseAlike(obj)) {
return obj.then(handleAny)
} else if (isPlainObject(obj)) {
return handleObject(obj)
} else if (Object.prototype.toString.call(obj) === '[object Array]') {
return handleArray(obj)
} else {
return new Promise(function (resolve,... | javascript | function handleAny (obj) {
if (isPromiseAlike(obj)) {
return obj.then(handleAny)
} else if (isPlainObject(obj)) {
return handleObject(obj)
} else if (Object.prototype.toString.call(obj) === '[object Array]') {
return handleArray(obj)
} else {
return new Promise(function (resolve,... | [
"function",
"handleAny",
"(",
"obj",
")",
"{",
"if",
"(",
"isPromiseAlike",
"(",
"obj",
")",
")",
"{",
"return",
"obj",
".",
"then",
"(",
"handleAny",
")",
"}",
"else",
"if",
"(",
"isPlainObject",
"(",
"obj",
")",
")",
"{",
"return",
"handleObject",
... | Return a promise for an object, array, or other value, with all internal promises resolved.
@param {*} obj
@returns {Promise<*>}
@private | [
"Return",
"a",
"promise",
"for",
"an",
"object",
"array",
"or",
"other",
"value",
"with",
"all",
"internal",
"promises",
"resolved",
"."
] | da8c5432e895c5087dc1f1a2234be4273ab0592c | https://github.com/nknapp/deep-aplus/blob/da8c5432e895c5087dc1f1a2234be4273ab0592c/index.js#L78-L90 |
51,295 | redisjs/jsr-server | lib/command/database/key/dump.js | execute | function execute(req, res) {
var value = req.db.getKey(req.args[0], req);
if(value === undefined) return res.send(null, null);
var buf = dump(
{value: value}, value.rtype || Constants.TYPE_NAMES.STRING, null);
res.send(null, buf);
} | javascript | function execute(req, res) {
var value = req.db.getKey(req.args[0], req);
if(value === undefined) return res.send(null, null);
var buf = dump(
{value: value}, value.rtype || Constants.TYPE_NAMES.STRING, null);
res.send(null, buf);
} | [
"function",
"execute",
"(",
"req",
",",
"res",
")",
"{",
"var",
"value",
"=",
"req",
".",
"db",
".",
"getKey",
"(",
"req",
".",
"args",
"[",
"0",
"]",
",",
"req",
")",
";",
"if",
"(",
"value",
"===",
"undefined",
")",
"return",
"res",
".",
"sen... | Respond to the DUMP command. | [
"Respond",
"to",
"the",
"DUMP",
"command",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/database/key/dump.js#L18-L24 |
51,296 | rendrjs/grunt-rendr-stitch | tasks/rendr_stitch.js | assertFiles | function assertFiles(expectedNumFiles, tmpDir, callback) {
function countFiles() {
var numFiles = 0;
grunt.file.recurse(tmpDir, function(abspath, rootdir, subdir, filename) {
numFiles++;
});
return numFiles === expectedNumFiles;
}
var interval = setInterval(function() {
... | javascript | function assertFiles(expectedNumFiles, tmpDir, callback) {
function countFiles() {
var numFiles = 0;
grunt.file.recurse(tmpDir, function(abspath, rootdir, subdir, filename) {
numFiles++;
});
return numFiles === expectedNumFiles;
}
var interval = setInterval(function() {
... | [
"function",
"assertFiles",
"(",
"expectedNumFiles",
",",
"tmpDir",
",",
"callback",
")",
"{",
"function",
"countFiles",
"(",
")",
"{",
"var",
"numFiles",
"=",
"0",
";",
"grunt",
".",
"file",
".",
"recurse",
"(",
"tmpDir",
",",
"function",
"(",
"abspath",
... | Sometimes, the Stitch compliation appears to happen before all files are copied over to
the `tmpDir`. We simply wait until they are. | [
"Sometimes",
"the",
"Stitch",
"compliation",
"appears",
"to",
"happen",
"before",
"all",
"files",
"are",
"copied",
"over",
"to",
"the",
"tmpDir",
".",
"We",
"simply",
"wait",
"until",
"they",
"are",
"."
] | de05755007d4af4817c7f4b46c31e4d96c42aee1 | https://github.com/rendrjs/grunt-rendr-stitch/blob/de05755007d4af4817c7f4b46c31e4d96c42aee1/tasks/rendr_stitch.js#L117-L132 |
51,297 | AndreasMadsen/thintalk | lib/layers/TCP.js | jsonStream | function jsonStream(target, socket) {
// first set the channel encodeing to utf8
socket.setEncoding('utf8');
// data chunks may not contain a complete json string, thats why we store the data
var jsonBuffer = '';
// emits when new data from TCP connection is received
socket.on('data', function (chunk) {
... | javascript | function jsonStream(target, socket) {
// first set the channel encodeing to utf8
socket.setEncoding('utf8');
// data chunks may not contain a complete json string, thats why we store the data
var jsonBuffer = '';
// emits when new data from TCP connection is received
socket.on('data', function (chunk) {
... | [
"function",
"jsonStream",
"(",
"target",
",",
"socket",
")",
"{",
"// first set the channel encodeing to utf8",
"socket",
".",
"setEncoding",
"(",
"'utf8'",
")",
";",
"// data chunks may not contain a complete json string, thats why we store the data",
"var",
"jsonBuffer",
"=",... | Since data from a socket comes in buffer streams in an unknown length this helper store the data until a complete json object has been received when a json object is received it will emit the message event on target. JSON strings will be isolated by a newline sign. | [
"Since",
"data",
"from",
"a",
"socket",
"comes",
"in",
"buffer",
"streams",
"in",
"an",
"unknown",
"length",
"this",
"helper",
"store",
"the",
"data",
"until",
"a",
"complete",
"json",
"object",
"has",
"been",
"received",
"when",
"a",
"json",
"object",
"is... | 1ea0c2703d303874fc50d8efb2013ee4d7dadeb1 | https://github.com/AndreasMadsen/thintalk/blob/1ea0c2703d303874fc50d8efb2013ee4d7dadeb1/lib/layers/TCP.js#L21-L53 |
51,298 | congajs/conga-twig | lib/tags/twig.tag.assets.js | function (token, context, chain) {
var i ,
len ,
files = [] ,
output = '' ,
viewData = Object.create(context) ,
env = container.getParameter('kernel.environment') ,
data = container.get('assets.template.helper.assets')
.assets(token.files[0], token.files[1], token.files[2], false);
... | javascript | function (token, context, chain) {
var i ,
len ,
files = [] ,
output = '' ,
viewData = Object.create(context) ,
env = container.getParameter('kernel.environment') ,
data = container.get('assets.template.helper.assets')
.assets(token.files[0], token.files[1], token.files[2], false);
... | [
"function",
"(",
"token",
",",
"context",
",",
"chain",
")",
"{",
"var",
"i",
",",
"len",
",",
"files",
"=",
"[",
"]",
",",
"output",
"=",
"''",
",",
"viewData",
"=",
"Object",
".",
"create",
"(",
"context",
")",
",",
"env",
"=",
"container",
"."... | Runs when the template is rendered | [
"Runs",
"when",
"the",
"template",
"is",
"rendered"
] | a3d60fccb655fcf5afa91f254632c48675bebda5 | https://github.com/congajs/conga-twig/blob/a3d60fccb655fcf5afa91f254632c48675bebda5/lib/tags/twig.tag.assets.js#L85-L120 | |
51,299 | jaredhanson/jsmt | lib/module.js | Module | function Module(id, parent) {
this.id = id
this.parent = parent;
if (parent && parent.children) {
parent.children.push(this);
}
this.children = [];
this.filename = null;
this.format = undefined;
this.loaded = false;
} | javascript | function Module(id, parent) {
this.id = id
this.parent = parent;
if (parent && parent.children) {
parent.children.push(this);
}
this.children = [];
this.filename = null;
this.format = undefined;
this.loaded = false;
} | [
"function",
"Module",
"(",
"id",
",",
"parent",
")",
"{",
"this",
".",
"id",
"=",
"id",
"this",
".",
"parent",
"=",
"parent",
";",
"if",
"(",
"parent",
"&&",
"parent",
".",
"children",
")",
"{",
"parent",
".",
"children",
".",
"push",
"(",
"this",
... | `Module` constructor.
Constructs a new module with the given `id` and `parent`. If `parent` is
not null, the created module will be added as a child of `parent`.
@param {String} id
@param {Module} parent
@api public | [
"Module",
"constructor",
"."
] | 13962176250ef41931d8f7e2290d630bd492e4af | https://github.com/jaredhanson/jsmt/blob/13962176250ef41931d8f7e2290d630bd492e4af/lib/module.js#L25-L36 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.