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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
50,300 | tolokoban/ToloFrameWork | ker/mod/wdg.js | function() {
var e = this._element;
if (e) {
var p = e.parentNode;
if (p) {
p.removeChild(e);
}
}
return this;
} | javascript | function() {
var e = this._element;
if (e) {
var p = e.parentNode;
if (p) {
p.removeChild(e);
}
}
return this;
} | [
"function",
"(",
")",
"{",
"var",
"e",
"=",
"this",
".",
"_element",
";",
"if",
"(",
"e",
")",
"{",
"var",
"p",
"=",
"e",
".",
"parentNode",
";",
"if",
"(",
"p",
")",
"{",
"p",
".",
"removeChild",
"(",
"e",
")",
";",
"}",
"}",
"return",
"th... | Remove this element from its parent.
@memberof wdg | [
"Remove",
"this",
"element",
"from",
"its",
"parent",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/wdg.js#L62-L71 | |
50,301 | tolokoban/ToloFrameWork | ker/mod/wdg.js | function() {
var i, arg;
for (i = 0 ; i < arguments.length ; i++) {
arg = arguments[i];
if (typeof arg === 'number') arg = "" + arg;
if (typeof arg === 'undefined' || typeof arg === 'null'
|| (typeof arg !== 'object' && typeof arg !== 'string')) {
console.error("[Widget.appen... | javascript | function() {
var i, arg;
for (i = 0 ; i < arguments.length ; i++) {
arg = arguments[i];
if (typeof arg === 'number') arg = "" + arg;
if (typeof arg === 'undefined' || typeof arg === 'null'
|| (typeof arg !== 'object' && typeof arg !== 'string')) {
console.error("[Widget.appen... | [
"function",
"(",
")",
"{",
"var",
"i",
",",
"arg",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"arguments",
".",
"length",
";",
"i",
"++",
")",
"{",
"arg",
"=",
"arguments",
"[",
"i",
"]",
";",
"if",
"(",
"typeof",
"arg",
"===",
"'number'"... | Append children to this widget. | [
"Append",
"children",
"to",
"this",
"widget",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/wdg.js#L251-L294 | |
50,302 | tolokoban/ToloFrameWork | ker/mod/wdg.js | function(parent) {
if (!parent) return this;
if (typeof parent.append === 'function') {
parent.append(this);
} else if (typeof parent.appendChild === 'function') {
parent.appendChild(this._element);
this.onAppend();
}
return this;
} | javascript | function(parent) {
if (!parent) return this;
if (typeof parent.append === 'function') {
parent.append(this);
} else if (typeof parent.appendChild === 'function') {
parent.appendChild(this._element);
this.onAppend();
}
return this;
} | [
"function",
"(",
"parent",
")",
"{",
"if",
"(",
"!",
"parent",
")",
"return",
"this",
";",
"if",
"(",
"typeof",
"parent",
".",
"append",
"===",
"'function'",
")",
"{",
"parent",
".",
"append",
"(",
"this",
")",
";",
"}",
"else",
"if",
"(",
"typeof"... | Append this widget to a parent.
@param parent
@memberof wdg | [
"Append",
"this",
"widget",
"to",
"a",
"parent",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/wdg.js#L301-L310 | |
50,303 | tolokoban/ToloFrameWork | ker/mod/wdg.js | function() {
// (!) On préfère retirer les éléments un par un du DOM plutôt que d'utiliser simplement
// this.html("").
// En effet, le code simplifié a des conséquences inattendues dans IE9 et IE10 au moins.
// Le bug des markers qui disparaissaients sur les cartes de Trail-Passion 4 a été corrigé
... | javascript | function() {
// (!) On préfère retirer les éléments un par un du DOM plutôt que d'utiliser simplement
// this.html("").
// En effet, le code simplifié a des conséquences inattendues dans IE9 et IE10 au moins.
// Le bug des markers qui disparaissaients sur les cartes de Trail-Passion 4 a été corrigé
... | [
"function",
"(",
")",
"{",
"// (!) On préfère retirer les éléments un par un du DOM plutôt que d'utiliser simplement",
"// this.html(\"\").",
"// En effet, le code simplifié a des conséquences inattendues dans IE9 et IE10 au moins.",
"// Le bug des markers qui disparaissaients sur les cartes de Trail-... | Remove all children of this widget.
Any argument passed will be appended to this widget.
@memberof wdg | [
"Remove",
"all",
"children",
"of",
"this",
"widget",
".",
"Any",
"argument",
"passed",
"will",
"be",
"appended",
"to",
"this",
"widget",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/wdg.js#L384-L401 | |
50,304 | tolokoban/ToloFrameWork | ker/mod/wdg.js | function() {
var e = this._element;
if (!e) return null;
if (typeof e.getBoundingClientRect !== 'function') {
console.error("[wdg.rect] This element has non `getBoundingClientRect` function:", e);
}
var r = e.getBoundingClientRect();
if( typeof r.width === 'undefined' ) r.width = r.right -... | javascript | function() {
var e = this._element;
if (!e) return null;
if (typeof e.getBoundingClientRect !== 'function') {
console.error("[wdg.rect] This element has non `getBoundingClientRect` function:", e);
}
var r = e.getBoundingClientRect();
if( typeof r.width === 'undefined' ) r.width = r.right -... | [
"function",
"(",
")",
"{",
"var",
"e",
"=",
"this",
".",
"_element",
";",
"if",
"(",
"!",
"e",
")",
"return",
"null",
";",
"if",
"(",
"typeof",
"e",
".",
"getBoundingClientRect",
"!==",
"'function'",
")",
"{",
"console",
".",
"error",
"(",
"\"[wdg.re... | Returns the bounds of the underlying element.
@memberof wdg | [
"Returns",
"the",
"bounds",
"of",
"the",
"underlying",
"element",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/wdg.js#L474-L484 | |
50,305 | vmarkdown/vremark-parse | packages/mdast-util-to-hast/lib/revert.js | revert | function revert(h, node) {
var subtype = node.referenceType
var suffix = ']'
var contents
var head
var tail
if (subtype === 'collapsed') {
suffix += '[]'
} else if (subtype === 'full') {
suffix += '[' + node.identifier + ']'
}
if (node.type === 'imageReference') {
... | javascript | function revert(h, node) {
var subtype = node.referenceType
var suffix = ']'
var contents
var head
var tail
if (subtype === 'collapsed') {
suffix += '[]'
} else if (subtype === 'full') {
suffix += '[' + node.identifier + ']'
}
if (node.type === 'imageReference') {
... | [
"function",
"revert",
"(",
"h",
",",
"node",
")",
"{",
"var",
"subtype",
"=",
"node",
".",
"referenceType",
"var",
"suffix",
"=",
"']'",
"var",
"contents",
"var",
"head",
"var",
"tail",
"if",
"(",
"subtype",
"===",
"'collapsed'",
")",
"{",
"suffix",
"+... | Return the content of a reference without definition as markdown. | [
"Return",
"the",
"content",
"of",
"a",
"reference",
"without",
"definition",
"as",
"markdown",
"."
] | d7b353dcb5d021eeceb40f3c505ece893202db7a | https://github.com/vmarkdown/vremark-parse/blob/d7b353dcb5d021eeceb40f3c505ece893202db7a/packages/mdast-util-to-hast/lib/revert.js#L9-L44 |
50,306 | straticjs/gulp-attach-to-template | index.js | function(callback) {
// TODO: don't wait until the end. Instead, emit immediately upon finding the template
if (!templateFile) throw new Error('template not found in stream');
templateFile.data = templateFile.data || {};
files.forEach(function(file) {
var newFile = templateFile.clone();
newFile.data.f... | javascript | function(callback) {
// TODO: don't wait until the end. Instead, emit immediately upon finding the template
if (!templateFile) throw new Error('template not found in stream');
templateFile.data = templateFile.data || {};
files.forEach(function(file) {
var newFile = templateFile.clone();
newFile.data.f... | [
"function",
"(",
"callback",
")",
"{",
"// TODO: don't wait until the end. Instead, emit immediately upon finding the template",
"if",
"(",
"!",
"templateFile",
")",
"throw",
"new",
"Error",
"(",
"'template not found in stream'",
")",
";",
"templateFile",
".",
"data",
"=",
... | Wait until all files have come through, then attach the non-template files | [
"Wait",
"until",
"all",
"files",
"have",
"come",
"through",
"then",
"attach",
"the",
"non",
"-",
"template",
"files"
] | 417309e94db8491a96fd4a52b483f4db7dcc1290 | https://github.com/straticjs/gulp-attach-to-template/blob/417309e94db8491a96fd4a52b483f4db7dcc1290/index.js#L39-L56 | |
50,307 | finvernizzi/mplane_http_transport | mplane_http_transport.js | registerSpecification | function registerSpecification(specification, remoteDN , options , callback){
// Serialize the capability Object
var post_data = {};
post_data[remoteDN] = JSON.parse(specification.to_dict());
post_data = JSON.stringify(post_data);
var proto = https;
var post_options = {
path: SUPERVISOR... | javascript | function registerSpecification(specification, remoteDN , options , callback){
// Serialize the capability Object
var post_data = {};
post_data[remoteDN] = JSON.parse(specification.to_dict());
post_data = JSON.stringify(post_data);
var proto = https;
var post_options = {
path: SUPERVISOR... | [
"function",
"registerSpecification",
"(",
"specification",
",",
"remoteDN",
",",
"options",
",",
"callback",
")",
"{",
"// Serialize the capability Object",
"var",
"post_data",
"=",
"{",
"}",
";",
"post_data",
"[",
"remoteDN",
"]",
"=",
"JSON",
".",
"parse",
"("... | Register with a POST a specification to the supervisor
@param specification an mPlane Spcification
options MUST include (or an INVALID parameters error is thrown):
- options.host
- options.port
- options.caFile
- options.keyFile
- options.certFile | [
"Register",
"with",
"a",
"POST",
"a",
"specification",
"to",
"the",
"supervisor"
] | 1102d8e1458c3010f3b126b536434114c790b180 | https://github.com/finvernizzi/mplane_http_transport/blob/1102d8e1458c3010f3b126b536434114c790b180/mplane_http_transport.js#L191-L234 |
50,308 | finvernizzi/mplane_http_transport | mplane_http_transport.js | showResults | function showResults(redeem , options , callback){
if (typeof redeem !== 'object')
redeem = new mplane.Redemption(redeem);
var post_data = redeem.to_dict();
var post_options = {
path: SUPERVISOR_PATH_SHOW_RESULT,
method: 'POST',
host: options.host,
port: options.p... | javascript | function showResults(redeem , options , callback){
if (typeof redeem !== 'object')
redeem = new mplane.Redemption(redeem);
var post_data = redeem.to_dict();
var post_options = {
path: SUPERVISOR_PATH_SHOW_RESULT,
method: 'POST',
host: options.host,
port: options.p... | [
"function",
"showResults",
"(",
"redeem",
",",
"options",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"redeem",
"!==",
"'object'",
")",
"redeem",
"=",
"new",
"mplane",
".",
"Redemption",
"(",
"redeem",
")",
";",
"var",
"post_data",
"=",
"redeem",
"."... | Given a redeem, ask if results are ready
@param redeem
@param options
@param callback | [
"Given",
"a",
"redeem",
"ask",
"if",
"results",
"are",
"ready"
] | 1102d8e1458c3010f3b126b536434114c790b180 | https://github.com/finvernizzi/mplane_http_transport/blob/1102d8e1458c3010f3b126b536434114c790b180/mplane_http_transport.js#L294-L337 |
50,309 | finvernizzi/mplane_http_transport | mplane_http_transport.js | showCapabilities | function showCapabilities( options, callback){
options.url = 'https://'+options.host+':'+options.port+SUPERVISOR_PATH_SHOW_CAPABILITY;
options.ca = ssl_files.readCaChain(options.caFile);
options.key = ssl_files.readFileContent(options.keyFile);
options.cert = ssl_files.readFileContent(options.certFile)... | javascript | function showCapabilities( options, callback){
options.url = 'https://'+options.host+':'+options.port+SUPERVISOR_PATH_SHOW_CAPABILITY;
options.ca = ssl_files.readCaChain(options.caFile);
options.key = ssl_files.readFileContent(options.keyFile);
options.cert = ssl_files.readFileContent(options.certFile)... | [
"function",
"showCapabilities",
"(",
"options",
",",
"callback",
")",
"{",
"options",
".",
"url",
"=",
"'https://'",
"+",
"options",
".",
"host",
"+",
"':'",
"+",
"options",
".",
"port",
"+",
"SUPERVISOR_PATH_SHOW_CAPABILITY",
";",
"options",
".",
"ca",
"=",... | Contact the supervisor for requesting all the registered capabilities
@param options
@param callback | [
"Contact",
"the",
"supervisor",
"for",
"requesting",
"all",
"the",
"registered",
"capabilities"
] | 1102d8e1458c3010f3b126b536434114c790b180 | https://github.com/finvernizzi/mplane_http_transport/blob/1102d8e1458c3010f3b126b536434114c790b180/mplane_http_transport.js#L344-L359 |
50,310 | finvernizzi/mplane_http_transport | mplane_http_transport.js | info | function info(options , callback){
options.url = 'https://'+options.host+':'+options.port+SUPERVISOR_PATH_INFO;
options.key = ssl_files.readFileContent(options.keyFile);
options.cert = ssl_files.readFileContent(options.certFile);
options.ca = ssl_files.readCaChain(options.ca);
request(options, fun... | javascript | function info(options , callback){
options.url = 'https://'+options.host+':'+options.port+SUPERVISOR_PATH_INFO;
options.key = ssl_files.readFileContent(options.keyFile);
options.cert = ssl_files.readFileContent(options.certFile);
options.ca = ssl_files.readCaChain(options.ca);
request(options, fun... | [
"function",
"info",
"(",
"options",
",",
"callback",
")",
"{",
"options",
".",
"url",
"=",
"'https://'",
"+",
"options",
".",
"host",
"+",
"':'",
"+",
"options",
".",
"port",
"+",
"SUPERVISOR_PATH_INFO",
";",
"options",
".",
"key",
"=",
"ssl_files",
".",... | Reads supervisor informations | [
"Reads",
"supervisor",
"informations"
] | 1102d8e1458c3010f3b126b536434114c790b180 | https://github.com/finvernizzi/mplane_http_transport/blob/1102d8e1458c3010f3b126b536434114c790b180/mplane_http_transport.js#L362-L376 |
50,311 | jedrichards/twitreq | lib/twitreq.js | genReq | function genReq (options,cb) {
log(options.verbose,"Starting twitreq ...");
if ( typeof options.protocol === "undefined" ) {
options.protocol = PROTOCOL;
}
if ( typeof options.host === "undefined" ) {
options.host = HOST;
}
if ( typeof options.oAuthSignatureMethod === "undefi... | javascript | function genReq (options,cb) {
log(options.verbose,"Starting twitreq ...");
if ( typeof options.protocol === "undefined" ) {
options.protocol = PROTOCOL;
}
if ( typeof options.host === "undefined" ) {
options.host = HOST;
}
if ( typeof options.oAuthSignatureMethod === "undefi... | [
"function",
"genReq",
"(",
"options",
",",
"cb",
")",
"{",
"log",
"(",
"options",
".",
"verbose",
",",
"\"Starting twitreq ...\"",
")",
";",
"if",
"(",
"typeof",
"options",
".",
"protocol",
"===",
"\"undefined\"",
")",
"{",
"options",
".",
"protocol",
"=",... | Generate a Node HTTP request options object based on a valid set of options. | [
"Generate",
"a",
"Node",
"HTTP",
"request",
"options",
"object",
"based",
"on",
"a",
"valid",
"set",
"of",
"options",
"."
] | 6d6a1702acc812b333401db7aba0aa003904b76b | https://github.com/jedrichards/twitreq/blob/6d6a1702acc812b333401db7aba0aa003904b76b/lib/twitreq.js#L47-L107 |
50,312 | jedrichards/twitreq | lib/twitreq.js | genQueryString | function genQueryString (options) {
if ( !options.queryParams ) {
return "";
}
log(options.verbose,"Now generating query string value ...");
var queryStringParams = [];
Object.keys(options.queryParams).forEach(function (key) {
queryStringParams.push(createEncodedParam(key,options... | javascript | function genQueryString (options) {
if ( !options.queryParams ) {
return "";
}
log(options.verbose,"Now generating query string value ...");
var queryStringParams = [];
Object.keys(options.queryParams).forEach(function (key) {
queryStringParams.push(createEncodedParam(key,options... | [
"function",
"genQueryString",
"(",
"options",
")",
"{",
"if",
"(",
"!",
"options",
".",
"queryParams",
")",
"{",
"return",
"\"\"",
";",
"}",
"log",
"(",
"options",
".",
"verbose",
",",
"\"Now generating query string value ...\"",
")",
";",
"var",
"queryStringP... | Generate a percent encoded query string from the supplied options. | [
"Generate",
"a",
"percent",
"encoded",
"query",
"string",
"from",
"the",
"supplied",
"options",
"."
] | 6d6a1702acc812b333401db7aba0aa003904b76b | https://github.com/jedrichards/twitreq/blob/6d6a1702acc812b333401db7aba0aa003904b76b/lib/twitreq.js#L112-L141 |
50,313 | jedrichards/twitreq | lib/twitreq.js | percentEncode | function percentEncode (value) {
var result = encodeURIComponent(value);
return result.replace(/\!/g, "%21")
.replace(/\'/g, "%27")
.replace(/\(/g, "%28")
.replace(/\)/g, "%29")
.replace(/\*/g, "%2A");
} | javascript | function percentEncode (value) {
var result = encodeURIComponent(value);
return result.replace(/\!/g, "%21")
.replace(/\'/g, "%27")
.replace(/\(/g, "%28")
.replace(/\)/g, "%29")
.replace(/\*/g, "%2A");
} | [
"function",
"percentEncode",
"(",
"value",
")",
"{",
"var",
"result",
"=",
"encodeURIComponent",
"(",
"value",
")",
";",
"return",
"result",
".",
"replace",
"(",
"/",
"\\!",
"/",
"g",
",",
"\"%21\"",
")",
".",
"replace",
"(",
"/",
"\\'",
"/",
"g",
",... | Return a RFC3986 compliant percent encoded string. | [
"Return",
"a",
"RFC3986",
"compliant",
"percent",
"encoded",
"string",
"."
] | 6d6a1702acc812b333401db7aba0aa003904b76b | https://github.com/jedrichards/twitreq/blob/6d6a1702acc812b333401db7aba0aa003904b76b/lib/twitreq.js#L267-L274 |
50,314 | scrapjs/hmu-plugin | lib/index.js | error | function error(err) {
this.log(`${chalk.red(`${err.name.toLowerCase()}:`)} ${err.message}`);
} | javascript | function error(err) {
this.log(`${chalk.red(`${err.name.toLowerCase()}:`)} ${err.message}`);
} | [
"function",
"error",
"(",
"err",
")",
"{",
"this",
".",
"log",
"(",
"`",
"${",
"chalk",
".",
"red",
"(",
"`",
"${",
"err",
".",
"name",
".",
"toLowerCase",
"(",
")",
"}",
"`",
")",
"}",
"${",
"err",
".",
"message",
"}",
"`",
")",
";",
"}"
] | Log plugin error | [
"Log",
"plugin",
"error"
] | d96f71274646304ad158c9834ee210c7141a8099 | https://github.com/scrapjs/hmu-plugin/blob/d96f71274646304ad158c9834ee210c7141a8099/lib/index.js#L22-L24 |
50,315 | scrapjs/hmu-plugin | lib/index.js | status | function status(url, code, mod) {
return this.get(url, mod).then(req => req.statusCode === code);
} | javascript | function status(url, code, mod) {
return this.get(url, mod).then(req => req.statusCode === code);
} | [
"function",
"status",
"(",
"url",
",",
"code",
",",
"mod",
")",
"{",
"return",
"this",
".",
"get",
"(",
"url",
",",
"mod",
")",
".",
"then",
"(",
"req",
"=>",
"req",
".",
"statusCode",
"===",
"code",
")",
";",
"}"
] | Fast status checking | [
"Fast",
"status",
"checking"
] | d96f71274646304ad158c9834ee210c7141a8099 | https://github.com/scrapjs/hmu-plugin/blob/d96f71274646304ad158c9834ee210c7141a8099/lib/index.js#L35-L37 |
50,316 | squid-app/config | index.js | Config | function Config( defaults, extend, envName )
{
// Constants
// -------------
// test instance uniqueness
this._UID = _.uniqueId('config_')
this._DEFAULTENV = 'default'
// CORE's settings
// ------------------------
// default app configuration
var confDefault = this.getConfigParam( defau... | javascript | function Config( defaults, extend, envName )
{
// Constants
// -------------
// test instance uniqueness
this._UID = _.uniqueId('config_')
this._DEFAULTENV = 'default'
// CORE's settings
// ------------------------
// default app configuration
var confDefault = this.getConfigParam( defau... | [
"function",
"Config",
"(",
"defaults",
",",
"extend",
",",
"envName",
")",
"{",
"// Constants",
"// -------------",
"// test instance uniqueness",
"this",
".",
"_UID",
"=",
"_",
".",
"uniqueId",
"(",
"'config_'",
")",
"this",
".",
"_DEFAULTENV",
"=",
"'default'"... | Initialize Config Class @params {mixed} object or file path @params {mixed} object or file path @return {object} Config instance | [
"Initialize",
"Config",
"Class"
] | 476b589fb5d74b4093e6c3ebf0edcd8bfad16884 | https://github.com/squid-app/config/blob/476b589fb5d74b4093e6c3ebf0edcd8bfad16884/index.js#L24-L52 |
50,317 | vesln/obsessed | lib/async-runner.js | AsyncRunner | function AsyncRunner(times, fn) {
Runner.apply(this, arguments);
this.pause = 0;
this.end = noop;
this.times = times;
} | javascript | function AsyncRunner(times, fn) {
Runner.apply(this, arguments);
this.pause = 0;
this.end = noop;
this.times = times;
} | [
"function",
"AsyncRunner",
"(",
"times",
",",
"fn",
")",
"{",
"Runner",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"this",
".",
"pause",
"=",
"0",
";",
"this",
".",
"end",
"=",
"noop",
";",
"this",
".",
"times",
"=",
"times",
";",
"}"... | Async task runner.
@param {String|Number} times
@param {Function} [optional] task to execute
@constructor | [
"Async",
"task",
"runner",
"."
] | 4878dfafdea241bff9ad5c57acc2395a4f3487a6 | https://github.com/vesln/obsessed/blob/4878dfafdea241bff9ad5c57acc2395a4f3487a6/lib/async-runner.js#L22-L28 |
50,318 | tab58/minimatrix | src/utils.js | printMatrix2 | function printMatrix2 (m) {
const tStr = m.elements.map(formatPrintNumber);
const matrixString = `
+- -+
| ${tStr[0]} ${tStr[2]} |
| ${tStr[1]} ${tStr[3]} |
+- -+`;
return matrixString;
} | javascript | function printMatrix2 (m) {
const tStr = m.elements.map(formatPrintNumber);
const matrixString = `
+- -+
| ${tStr[0]} ${tStr[2]} |
| ${tStr[1]} ${tStr[3]} |
+- -+`;
return matrixString;
} | [
"function",
"printMatrix2",
"(",
"m",
")",
"{",
"const",
"tStr",
"=",
"m",
".",
"elements",
".",
"map",
"(",
"formatPrintNumber",
")",
";",
"const",
"matrixString",
"=",
"`",
"${",
"tStr",
"[",
"0",
"]",
"}",
"${",
"tStr",
"[",
"2",
"]",
"}",
"${",... | Pretty prints a Matrix2.
@memberof Utils
@param {Matrix2} m The 2x2 matrix.
@returns {string} The formatted string. | [
"Pretty",
"prints",
"a",
"Matrix2",
"."
] | 542f1d964b7ae92f96b1069ff5f3495561fe75cd | https://github.com/tab58/minimatrix/blob/542f1d964b7ae92f96b1069ff5f3495561fe75cd/src/utils.js#L47-L55 |
50,319 | tab58/minimatrix | src/utils.js | printMatrix3 | function printMatrix3 (m) {
const tStr = m.elements.map(formatPrintNumber);
const matrixString = `
+- -+
| ${tStr[0]} ${tStr[3]} ${tStr[6]} |
| ${tStr[1]} ${tStr[4]} ${tStr[7]} |
| ${tStr[2]} ${tStr[5]} ${tStr[8]} |
+- -+`;
return matrixString;
} | javascript | function printMatrix3 (m) {
const tStr = m.elements.map(formatPrintNumber);
const matrixString = `
+- -+
| ${tStr[0]} ${tStr[3]} ${tStr[6]} |
| ${tStr[1]} ${tStr[4]} ${tStr[7]} |
| ${tStr[2]} ${tStr[5]} ${tStr[8]} |
+- -+`;
return matrixString;
} | [
"function",
"printMatrix3",
"(",
"m",
")",
"{",
"const",
"tStr",
"=",
"m",
".",
"elements",
".",
"map",
"(",
"formatPrintNumber",
")",
";",
"const",
"matrixString",
"=",
"`",
"${",
"tStr",
"[",
"0",
"]",
"}",
"${",
"tStr",
"[",
"3",
"]",
"}",
"${",... | Pretty prints a Matrix3.
@memberof Utils
@param {Matrix2} m The 3x3 matrix.
@returns {string} The formatted string. | [
"Pretty",
"prints",
"a",
"Matrix3",
"."
] | 542f1d964b7ae92f96b1069ff5f3495561fe75cd | https://github.com/tab58/minimatrix/blob/542f1d964b7ae92f96b1069ff5f3495561fe75cd/src/utils.js#L63-L72 |
50,320 | benoror/node-pate | lib/pate.js | xpathFn | function xpathFn(token, rootEl, ns) {
var split = token.trim().split('@');
var retVal = rootEl;
var path = split[0].replace(/\/$/, "") || null;
var attr = split[1] || null;
if(path)
retVal = retVal.get(path, ns);
if(attr) {
retVal = retVal ? retVal.attr(attr) : "";
ret... | javascript | function xpathFn(token, rootEl, ns) {
var split = token.trim().split('@');
var retVal = rootEl;
var path = split[0].replace(/\/$/, "") || null;
var attr = split[1] || null;
if(path)
retVal = retVal.get(path, ns);
if(attr) {
retVal = retVal ? retVal.attr(attr) : "";
ret... | [
"function",
"xpathFn",
"(",
"token",
",",
"rootEl",
",",
"ns",
")",
"{",
"var",
"split",
"=",
"token",
".",
"trim",
"(",
")",
".",
"split",
"(",
"'@'",
")",
";",
"var",
"retVal",
"=",
"rootEl",
";",
"var",
"path",
"=",
"split",
"[",
"0",
"]",
"... | XPatch matcher function | [
"XPatch",
"matcher",
"function"
] | 869a6e82f588563d5dea6c892cb011505bba7ed3 | https://github.com/benoror/node-pate/blob/869a6e82f588563d5dea6c892cb011505bba7ed3/lib/pate.js#L46-L64 |
50,321 | benoror/node-pate | lib/pate.js | evalFn | function evalFn(token, format_lib) {
var splited = token.trim().split(/[\(\)]/g);
if (splited.length < 3)
return token;
if (!format_lib)
return token
var fnstring = splited[0];
var fnparams = splited.slice(1, splited.length - 1);
var fn = format_lib[fnstring];
if (typeof ... | javascript | function evalFn(token, format_lib) {
var splited = token.trim().split(/[\(\)]/g);
if (splited.length < 3)
return token;
if (!format_lib)
return token
var fnstring = splited[0];
var fnparams = splited.slice(1, splited.length - 1);
var fn = format_lib[fnstring];
if (typeof ... | [
"function",
"evalFn",
"(",
"token",
",",
"format_lib",
")",
"{",
"var",
"splited",
"=",
"token",
".",
"trim",
"(",
")",
".",
"split",
"(",
"/",
"[\\(\\)]",
"/",
"g",
")",
";",
"if",
"(",
"splited",
".",
"length",
"<",
"3",
")",
"return",
"token",
... | Eval matcher function | [
"Eval",
"matcher",
"function"
] | 869a6e82f588563d5dea6c892cb011505bba7ed3 | https://github.com/benoror/node-pate/blob/869a6e82f588563d5dea6c892cb011505bba7ed3/lib/pate.js#L69-L86 |
50,322 | RikardLegge/modulin-fetch | src/modulin/css/modulizeCss.js | generateClassNameSubstitutions | function generateClassNameSubstitutions(tokens, substitutionPattern, substitutions) {
tokens.forEach((tokenList)=> {
var token = tokenList[0];
generateSubstitution(token, substitutionPattern, substitutions);
});
} | javascript | function generateClassNameSubstitutions(tokens, substitutionPattern, substitutions) {
tokens.forEach((tokenList)=> {
var token = tokenList[0];
generateSubstitution(token, substitutionPattern, substitutions);
});
} | [
"function",
"generateClassNameSubstitutions",
"(",
"tokens",
",",
"substitutionPattern",
",",
"substitutions",
")",
"{",
"tokens",
".",
"forEach",
"(",
"(",
"tokenList",
")",
"=>",
"{",
"var",
"token",
"=",
"tokenList",
"[",
"0",
"]",
";",
"generateSubstitution"... | Generate an array of substitutions keyed by class name
@param tokens Token[]
@param substitutionPattern string
@param substitutions {{string: string[]}}
@returns {{string: string}} | [
"Generate",
"an",
"array",
"of",
"substitutions",
"keyed",
"by",
"class",
"name"
] | 1a31b6b6957cfc7f608e233f10ac5050cd15bb5f | https://github.com/RikardLegge/modulin-fetch/blob/1a31b6b6957cfc7f608e233f10ac5050cd15bb5f/src/modulin/css/modulizeCss.js#L111-L116 |
50,323 | RikardLegge/modulin-fetch | src/modulin/css/modulizeCss.js | generateSubstitution | function generateSubstitution(token, substitutionPattern, substitutions) {
var substitution = substitutionPattern.replace(/{([^}]+)}/ig, (all, group)=> {
switch (group) {
case 'namespace':
return token.namespace;
case 'name':
return token.className;
case 'random':
return ... | javascript | function generateSubstitution(token, substitutionPattern, substitutions) {
var substitution = substitutionPattern.replace(/{([^}]+)}/ig, (all, group)=> {
switch (group) {
case 'namespace':
return token.namespace;
case 'name':
return token.className;
case 'random':
return ... | [
"function",
"generateSubstitution",
"(",
"token",
",",
"substitutionPattern",
",",
"substitutions",
")",
"{",
"var",
"substitution",
"=",
"substitutionPattern",
".",
"replace",
"(",
"/",
"{([^}]+)}",
"/",
"ig",
",",
"(",
"all",
",",
"group",
")",
"=>",
"{",
... | Generate a substitution for the class or id selector
@param token Token
@param substitutionPattern string
@param substitutions {{string: string[]}}
@returns {string} | [
"Generate",
"a",
"substitution",
"for",
"the",
"class",
"or",
"id",
"selector"
] | 1a31b6b6957cfc7f608e233f10ac5050cd15bb5f | https://github.com/RikardLegge/modulin-fetch/blob/1a31b6b6957cfc7f608e233f10ac5050cd15bb5f/src/modulin/css/modulizeCss.js#L126-L145 |
50,324 | dpjanes/iotdb-errors | errors.js | Timestamp | function Timestamp(message, code_id) {
Error.call(this);
this.message = message || "timestamp out of date";
this.code_id = code_id || null;
this.statusCode = 409;
} | javascript | function Timestamp(message, code_id) {
Error.call(this);
this.message = message || "timestamp out of date";
this.code_id = code_id || null;
this.statusCode = 409;
} | [
"function",
"Timestamp",
"(",
"message",
",",
"code_id",
")",
"{",
"Error",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"message",
"=",
"message",
"||",
"\"timestamp out of date\"",
";",
"this",
".",
"code_id",
"=",
"code_id",
"||",
"null",
";",
"th... | Timestanp was out of date | [
"Timestanp",
"was",
"out",
"of",
"date"
] | 15abf13b7666c4afc505b365bcf562cb85c44f84 | https://github.com/dpjanes/iotdb-errors/blob/15abf13b7666c4afc505b365bcf562cb85c44f84/errors.js#L73-L78 |
50,325 | dpjanes/iotdb-errors | errors.js | NotReady | function NotReady(message, code_id) {
Error.call(this);
this.message = message || "resource is not ready yet";
this.code_id = code_id || null;
this.statusCode = 423;
} | javascript | function NotReady(message, code_id) {
Error.call(this);
this.message = message || "resource is not ready yet";
this.code_id = code_id || null;
this.statusCode = 423;
} | [
"function",
"NotReady",
"(",
"message",
",",
"code_id",
")",
"{",
"Error",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"message",
"=",
"message",
"||",
"\"resource is not ready yet\"",
";",
"this",
".",
"code_id",
"=",
"code_id",
"||",
"null",
";",
... | waiting for some processing to happen | [
"waiting",
"for",
"some",
"processing",
"to",
"happen"
] | 15abf13b7666c4afc505b365bcf562cb85c44f84 | https://github.com/dpjanes/iotdb-errors/blob/15abf13b7666c4afc505b365bcf562cb85c44f84/errors.js#L121-L126 |
50,326 | dpjanes/iotdb-errors | errors.js | Locked | function Locked(message, code_id) {
Error.call(this);
this.message = message || "resource is locked"
this.code_id = code_id || null;
this.statusCode = 423;
} | javascript | function Locked(message, code_id) {
Error.call(this);
this.message = message || "resource is locked"
this.code_id = code_id || null;
this.statusCode = 423;
} | [
"function",
"Locked",
"(",
"message",
",",
"code_id",
")",
"{",
"Error",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"message",
"=",
"message",
"||",
"\"resource is locked\"",
"this",
".",
"code_id",
"=",
"code_id",
"||",
"null",
";",
"this",
".",
... | Resource is Locked | [
"Resource",
"is",
"Locked"
] | 15abf13b7666c4afc505b365bcf562cb85c44f84 | https://github.com/dpjanes/iotdb-errors/blob/15abf13b7666c4afc505b365bcf562cb85c44f84/errors.js#L133-L138 |
50,327 | dpjanes/iotdb-errors | errors.js | NeverImplemented | function NeverImplemented(message, code_id) {
Error.call(this);
this.message = message || "never will be implemented";
this.code_id = code_id || null;
this.statusCode = 501;
} | javascript | function NeverImplemented(message, code_id) {
Error.call(this);
this.message = message || "never will be implemented";
this.code_id = code_id || null;
this.statusCode = 501;
} | [
"function",
"NeverImplemented",
"(",
"message",
",",
"code_id",
")",
"{",
"Error",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"message",
"=",
"message",
"||",
"\"never will be implemented\"",
";",
"this",
".",
"code_id",
"=",
"code_id",
"||",
"null",
... | This is not implemented and never will be implemented | [
"This",
"is",
"not",
"implemented",
"and",
"never",
"will",
"be",
"implemented"
] | 15abf13b7666c4afc505b365bcf562cb85c44f84 | https://github.com/dpjanes/iotdb-errors/blob/15abf13b7666c4afc505b365bcf562cb85c44f84/errors.js#L181-L186 |
50,328 | dpjanes/iotdb-errors | errors.js | SetupRequired | function SetupRequired(message, code_id) {
Error.call(this);
this.message = message || "setup required";
this.code_id = code_id || null;
this.statusCode = 500;
} | javascript | function SetupRequired(message, code_id) {
Error.call(this);
this.message = message || "setup required";
this.code_id = code_id || null;
this.statusCode = 500;
} | [
"function",
"SetupRequired",
"(",
"message",
",",
"code_id",
")",
"{",
"Error",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"message",
"=",
"message",
"||",
"\"setup required\"",
";",
"this",
".",
"code_id",
"=",
"code_id",
"||",
"null",
";",
"this"... | Additional setup is required | [
"Additional",
"setup",
"is",
"required"
] | 15abf13b7666c4afc505b365bcf562cb85c44f84 | https://github.com/dpjanes/iotdb-errors/blob/15abf13b7666c4afc505b365bcf562cb85c44f84/errors.js#L193-L198 |
50,329 | dpjanes/iotdb-errors | errors.js | Internal | function Internal(message, code_id) {
Error.call(this);
this.message = message || "internal error";
this.code_id = code_id || null;
this.statusCode = 500;
} | javascript | function Internal(message, code_id) {
Error.call(this);
this.message = message || "internal error";
this.code_id = code_id || null;
this.statusCode = 500;
} | [
"function",
"Internal",
"(",
"message",
",",
"code_id",
")",
"{",
"Error",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"message",
"=",
"message",
"||",
"\"internal error\"",
";",
"this",
".",
"code_id",
"=",
"code_id",
"||",
"null",
";",
"this",
"... | Some sort of internal error | [
"Some",
"sort",
"of",
"internal",
"error"
] | 15abf13b7666c4afc505b365bcf562cb85c44f84 | https://github.com/dpjanes/iotdb-errors/blob/15abf13b7666c4afc505b365bcf562cb85c44f84/errors.js#L205-L210 |
50,330 | dpjanes/iotdb-errors | errors.js | Unavailable | function Unavailable(message, code_id) {
Error.call(this);
this.message = message || "temporarily unavailable";
this.code_id = code_id || null;
this.statusCode = 503;
} | javascript | function Unavailable(message, code_id) {
Error.call(this);
this.message = message || "temporarily unavailable";
this.code_id = code_id || null;
this.statusCode = 503;
} | [
"function",
"Unavailable",
"(",
"message",
",",
"code_id",
")",
"{",
"Error",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"message",
"=",
"message",
"||",
"\"temporarily unavailable\"",
";",
"this",
".",
"code_id",
"=",
"code_id",
"||",
"null",
";",
... | Can't do this right now | [
"Can",
"t",
"do",
"this",
"right",
"now"
] | 15abf13b7666c4afc505b365bcf562cb85c44f84 | https://github.com/dpjanes/iotdb-errors/blob/15abf13b7666c4afc505b365bcf562cb85c44f84/errors.js#L217-L222 |
50,331 | angelini/lozigo | lib/lozigo.js | function() {
var that = this;
var boundEmitComplete = emitComplete.bind(this);
EventEmitter.call(this);
this.middleware = [];
this.server = net.createServer(function(conn) {
var buffer = '';
var info = null;
conn.on('data', function(data) {
buffer += data;
if(!info) {
if(... | javascript | function() {
var that = this;
var boundEmitComplete = emitComplete.bind(this);
EventEmitter.call(this);
this.middleware = [];
this.server = net.createServer(function(conn) {
var buffer = '';
var info = null;
conn.on('data', function(data) {
buffer += data;
if(!info) {
if(... | [
"function",
"(",
")",
"{",
"var",
"that",
"=",
"this",
";",
"var",
"boundEmitComplete",
"=",
"emitComplete",
".",
"bind",
"(",
"this",
")",
";",
"EventEmitter",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"middleware",
"=",
"[",
"]",
";",
"this"... | Main Lozigo Object | [
"Main",
"Lozigo",
"Object"
] | bcca0cda8a7786493def08fd7189b1edb07091f9 | https://github.com/angelini/lozigo/blob/bcca0cda8a7786493def08fd7189b1edb07091f9/lib/lozigo.js#L55-L96 | |
50,332 | nbrownus/ppunit | lib/reporters/XUnit.js | function (ppunit, writer) {
writer.useColors = false
BaseReporter.call(this, ppunit, writer)
var self = this
ppunit.on('finish', function () {
writer.write(
self.tag(
'testsuite'
, {
name: 'PPUnit Tests'
, tests: ... | javascript | function (ppunit, writer) {
writer.useColors = false
BaseReporter.call(this, ppunit, writer)
var self = this
ppunit.on('finish', function () {
writer.write(
self.tag(
'testsuite'
, {
name: 'PPUnit Tests'
, tests: ... | [
"function",
"(",
"ppunit",
",",
"writer",
")",
"{",
"writer",
".",
"useColors",
"=",
"false",
"BaseReporter",
".",
"call",
"(",
"this",
",",
"ppunit",
",",
"writer",
")",
"var",
"self",
"=",
"this",
"ppunit",
".",
"on",
"(",
"'finish'",
",",
"function"... | Outputs xunit compatible xml for reporting test stats
@extends BaseReporter | [
"Outputs",
"xunit",
"compatible",
"xml",
"for",
"reporting",
"test",
"stats"
] | dcce602497d9548ce9085a8db115e65561dcc3de | https://github.com/nbrownus/ppunit/blob/dcce602497d9548ce9085a8db115e65561dcc3de/lib/reporters/XUnit.js#L11-L44 | |
50,333 | Crafity/crafity-storage | lib/providers/CouchDB.Provider.js | CouchDB | function CouchDB(config, nano) {
if (!config) {
throw new Error("Expected a CouchDB configuration");
}
if (!config.url) {
throw new Error("Expected a url in the CouchDB configuration");
}
if (!config.database) {
throw new Error("Expected a database name in the CouchDB configuration");
}
if (!config.design... | javascript | function CouchDB(config, nano) {
if (!config) {
throw new Error("Expected a CouchDB configuration");
}
if (!config.url) {
throw new Error("Expected a url in the CouchDB configuration");
}
if (!config.database) {
throw new Error("Expected a database name in the CouchDB configuration");
}
if (!config.design... | [
"function",
"CouchDB",
"(",
"config",
",",
"nano",
")",
"{",
"if",
"(",
"!",
"config",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Expected a CouchDB configuration\"",
")",
";",
"}",
"if",
"(",
"!",
"config",
".",
"url",
")",
"{",
"throw",
"new",
"Error... | CouchDB Provider Constructor
@constructor | [
"CouchDB",
"Provider",
"Constructor"
] | 1bea8268bc3deb85f9b07c63ce9ab3c5b989efe0 | https://github.com/Crafity/crafity-storage/blob/1bea8268bc3deb85f9b07c63ce9ab3c5b989efe0/lib/providers/CouchDB.Provider.js#L23-L54 |
50,334 | panezhang/ejs-extension-plus | lib/loader/ScriptLoader.class.js | function (path) {
var foundPath = self.PathTool.findLibScript(path);
if (foundPath) {
self.scriptList.push(foundPath);
} else {
self.logger.warn('script:%s not found!', path);
}
} | javascript | function (path) {
var foundPath = self.PathTool.findLibScript(path);
if (foundPath) {
self.scriptList.push(foundPath);
} else {
self.logger.warn('script:%s not found!', path);
}
} | [
"function",
"(",
"path",
")",
"{",
"var",
"foundPath",
"=",
"self",
".",
"PathTool",
".",
"findLibScript",
"(",
"path",
")",
";",
"if",
"(",
"foundPath",
")",
"{",
"self",
".",
"scriptList",
".",
"push",
"(",
"foundPath",
")",
";",
"}",
"else",
"{",
... | path to the static dir or id | [
"path",
"to",
"the",
"static",
"dir",
"or",
"id"
] | 802cfc643eb1a42d6341ef2fa7c3a91efc64a16e | https://github.com/panezhang/ejs-extension-plus/blob/802cfc643eb1a42d6341ef2fa7c3a91efc64a16e/lib/loader/ScriptLoader.class.js#L40-L47 | |
50,335 | tauren/arrayize | index.js | arrayize | function arrayize(values) {
// return empty array if values is empty
if (typeof values === 'undefined' || values === null ) {
return [];
}
// return array of values, converting to array if necessary
return util.isArray(values) ? values : [values];
} | javascript | function arrayize(values) {
// return empty array if values is empty
if (typeof values === 'undefined' || values === null ) {
return [];
}
// return array of values, converting to array if necessary
return util.isArray(values) ? values : [values];
} | [
"function",
"arrayize",
"(",
"values",
")",
"{",
"// return empty array if values is empty",
"if",
"(",
"typeof",
"values",
"===",
"'undefined'",
"||",
"values",
"===",
"null",
")",
"{",
"return",
"[",
"]",
";",
"}",
"// return array of values, converting to array if ... | Make sure to always return an array. If passed undefined or null,
return an empty array. If an array is passed, then return the
array. If passed anything else, return an array containing
that value.
@param {*} values Array of values or a single value
@return {Array} Array of values | [
"Make",
"sure",
"to",
"always",
"return",
"an",
"array",
".",
"If",
"passed",
"undefined",
"or",
"null",
"return",
"an",
"empty",
"array",
".",
"If",
"an",
"array",
"is",
"passed",
"then",
"return",
"the",
"array",
".",
"If",
"passed",
"anything",
"else"... | f5c08bee330ffa011b18e13adbecc80d2112af33 | https://github.com/tauren/arrayize/blob/f5c08bee330ffa011b18e13adbecc80d2112af33/index.js#L14-L21 |
50,336 | terminalvelocity/sails-generate-seeds-backend | lib/before.js | function() {
// Combine random and case-specific factors into a base string
var factors = {
creationDate: (new Date()).getTime(),
random: Math.random() * (Math.random() * 1000),
nodeVersion: process.version
};
var basestring = '';
_.each(factors, function (val) {
basestring += val;
});
//... | javascript | function() {
// Combine random and case-specific factors into a base string
var factors = {
creationDate: (new Date()).getTime(),
random: Math.random() * (Math.random() * 1000),
nodeVersion: process.version
};
var basestring = '';
_.each(factors, function (val) {
basestring += val;
});
//... | [
"function",
"(",
")",
"{",
"// Combine random and case-specific factors into a base string",
"var",
"factors",
"=",
"{",
"creationDate",
":",
"(",
"new",
"Date",
"(",
")",
")",
".",
"getTime",
"(",
")",
",",
"random",
":",
"Math",
".",
"random",
"(",
")",
"*... | Generate session secret
@return {[type]} [description] | [
"Generate",
"session",
"secret"
] | 9197acae0328163e0caba5ab2b61e38102c03193 | https://github.com/terminalvelocity/sails-generate-seeds-backend/blob/9197acae0328163e0caba5ab2b61e38102c03193/lib/before.js#L16-L35 | |
50,337 | sinfo/ampersand-io-collection | ampersand-io-collection.js | function (id, options, cb) {
if (arguments.length !== 3) {
cb = options;
options = {};
}
var self = this;
var model = this.get(id);
if (model){
return cb(null, model);
}
function done() {
var model = self.get(id);
if (model) {
if (cb){
cb(null,... | javascript | function (id, options, cb) {
if (arguments.length !== 3) {
cb = options;
options = {};
}
var self = this;
var model = this.get(id);
if (model){
return cb(null, model);
}
function done() {
var model = self.get(id);
if (model) {
if (cb){
cb(null,... | [
"function",
"(",
"id",
",",
"options",
",",
"cb",
")",
"{",
"if",
"(",
"arguments",
".",
"length",
"!==",
"3",
")",
"{",
"cb",
"=",
"options",
";",
"options",
"=",
"{",
"}",
";",
"}",
"var",
"self",
"=",
"this",
";",
"var",
"model",
"=",
"this"... | Get or fetch a model by Id. | [
"Get",
"or",
"fetch",
"a",
"model",
"by",
"Id",
"."
] | 81cd1ce246e5a84fe7ba881e8fa441e2f5cbbd67 | https://github.com/sinfo/ampersand-io-collection/blob/81cd1ce246e5a84fe7ba881e8fa441e2f5cbbd67/ampersand-io-collection.js#L106-L133 | |
50,338 | sinfo/ampersand-io-collection | ampersand-io-collection.js | function(err, model, response, options){
if (options.cb){
options.cb(err, model, response);
}
if (err){
model.trigger('error', err, model, options);
}
} | javascript | function(err, model, response, options){
if (options.cb){
options.cb(err, model, response);
}
if (err){
model.trigger('error', err, model, options);
}
} | [
"function",
"(",
"err",
",",
"model",
",",
"response",
",",
"options",
")",
"{",
"if",
"(",
"options",
".",
"cb",
")",
"{",
"options",
".",
"cb",
"(",
"err",
",",
"model",
",",
"response",
")",
";",
"}",
"if",
"(",
"err",
")",
"{",
"model",
"."... | Aux func used to trigger errors if they exist and use the optional callback function if given | [
"Aux",
"func",
"used",
"to",
"trigger",
"errors",
"if",
"they",
"exist",
"and",
"use",
"the",
"optional",
"callback",
"function",
"if",
"given"
] | 81cd1ce246e5a84fe7ba881e8fa441e2f5cbbd67 | https://github.com/sinfo/ampersand-io-collection/blob/81cd1ce246e5a84fe7ba881e8fa441e2f5cbbd67/ampersand-io-collection.js#L163-L170 | |
50,339 | el2iot2/grunt-hogan | example/Gruntfile.js | function(fileName) {
//Grab the path package here locally for clarity
var _path = require('path');
//'yada/yada/multi1.html' -> 'multi1'
var name = _path
.basename(
fileName,
_path.extname(fileName));
... | javascript | function(fileName) {
//Grab the path package here locally for clarity
var _path = require('path');
//'yada/yada/multi1.html' -> 'multi1'
var name = _path
.basename(
fileName,
_path.extname(fileName));
... | [
"function",
"(",
"fileName",
")",
"{",
"//Grab the path package here locally for clarity",
"var",
"_path",
"=",
"require",
"(",
"'path'",
")",
";",
"//'yada/yada/multi1.html' -> 'multi1'",
"var",
"name",
"=",
"_path",
".",
"basename",
"(",
"fileName",
",",
"_path",
... | Specify a custom name function | [
"Specify",
"a",
"custom",
"name",
"function"
] | 47962b7f63593c61fa0e2b0158f10bc6f8d51ca8 | https://github.com/el2iot2/grunt-hogan/blob/47962b7f63593c61fa0e2b0158f10bc6f8d51ca8/example/Gruntfile.js#L64-L76 | |
50,340 | joneit/synonomous | index.js | function(name, transformations) {
var synonyms = [];
if (typeof name === 'string' && name) {
transformations = transformations || this.transformations;
if (!Array.isArray(transformations)) {
transformations = Object.keys(transformations);
}
... | javascript | function(name, transformations) {
var synonyms = [];
if (typeof name === 'string' && name) {
transformations = transformations || this.transformations;
if (!Array.isArray(transformations)) {
transformations = Object.keys(transformations);
}
... | [
"function",
"(",
"name",
",",
"transformations",
")",
"{",
"var",
"synonyms",
"=",
"[",
"]",
";",
"if",
"(",
"typeof",
"name",
"===",
"'string'",
"&&",
"name",
")",
"{",
"transformations",
"=",
"transformations",
"||",
"this",
".",
"transformations",
";",
... | default for all instances, settable by Synonomous.prototype.dictPath setter
If `name` is a string and non-blank, returns an array containing unique non-blank synonyms of `name` generated by the transformer functions named in `this.transformations`.
@param {string} name - String to make synonyms of.
@parma {string[]|ob... | [
"default",
"for",
"all",
"instances",
"settable",
"by",
"Synonomous",
".",
"prototype",
".",
"dictPath",
"setter",
"If",
"name",
"is",
"a",
"string",
"and",
"non",
"-",
"blank",
"returns",
"an",
"array",
"containing",
"unique",
"non",
"-",
"blank",
"synonyms... | 38e1a540ef796050fa32ad4c229820d729648d1c | https://github.com/joneit/synonomous/blob/38e1a540ef796050fa32ad4c229820d729648d1c/index.js#L113-L131 | |
50,341 | sintaxi/yonder | lib/yonder.js | function(req, rsp, cb){
fs.readFile(path.resolve(routerPath), function(err, buff){
if (buff) {
var arrs = buff2arrs(buff)
return cb(arrs)
} else {
return cb(null)
}
})
} | javascript | function(req, rsp, cb){
fs.readFile(path.resolve(routerPath), function(err, buff){
if (buff) {
var arrs = buff2arrs(buff)
return cb(arrs)
} else {
return cb(null)
}
})
} | [
"function",
"(",
"req",
",",
"rsp",
",",
"cb",
")",
"{",
"fs",
".",
"readFile",
"(",
"path",
".",
"resolve",
"(",
"routerPath",
")",
",",
"function",
"(",
"err",
",",
"buff",
")",
"{",
"if",
"(",
"buff",
")",
"{",
"var",
"arrs",
"=",
"buff2arrs",... | returns array of routes. | [
"returns",
"array",
"of",
"routes",
"."
] | 6f50b36bf17cc348672089ecc71ad0f8d3f33698 | https://github.com/sintaxi/yonder/blob/6f50b36bf17cc348672089ecc71ad0f8d3f33698/lib/yonder.js#L119-L128 | |
50,342 | byron-dupreez/aws-stream-consumer-core | batch.js | discardIfOverAttempted | function discardIfOverAttempted(tasksByName, count) {
if (tasksByName) {
taskUtils.getTasks(tasksByName).forEach(task => {
const n = task.discardIfOverAttempted(maxNumberOfAttempts, true);
if (count) overAttempted += n;
});
}
} | javascript | function discardIfOverAttempted(tasksByName, count) {
if (tasksByName) {
taskUtils.getTasks(tasksByName).forEach(task => {
const n = task.discardIfOverAttempted(maxNumberOfAttempts, true);
if (count) overAttempted += n;
});
}
} | [
"function",
"discardIfOverAttempted",
"(",
"tasksByName",
",",
"count",
")",
"{",
"if",
"(",
"tasksByName",
")",
"{",
"taskUtils",
".",
"getTasks",
"(",
"tasksByName",
")",
".",
"forEach",
"(",
"task",
"=>",
"{",
"const",
"n",
"=",
"task",
".",
"discardIfO... | Mark any over-attempted tasks as discarded | [
"Mark",
"any",
"over",
"-",
"attempted",
"tasks",
"as",
"discarded"
] | 9b256084297f80d373bcf483aaf68a9da176b3d7 | https://github.com/byron-dupreez/aws-stream-consumer-core/blob/9b256084297f80d373bcf483aaf68a9da176b3d7/batch.js#L683-L690 |
50,343 | nateGeorge/google-ims | index.js | Client | function Client (id, apiKey) {
if (!(this instanceof Client)) {
return new Client(id, apiKey);
}
this.endpoint = 'https://www.googleapis.com';
this.apiKey = apiKey;
this.id = id;
} | javascript | function Client (id, apiKey) {
if (!(this instanceof Client)) {
return new Client(id, apiKey);
}
this.endpoint = 'https://www.googleapis.com';
this.apiKey = apiKey;
this.id = id;
} | [
"function",
"Client",
"(",
"id",
",",
"apiKey",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Client",
")",
")",
"{",
"return",
"new",
"Client",
"(",
"id",
",",
"apiKey",
")",
";",
"}",
"this",
".",
"endpoint",
"=",
"'https://www.googleapis.com... | Google Images Client | [
"Google",
"Images",
"Client"
] | 60df00899a45c2b06fcd1e7767025aa1d252f420 | https://github.com/nateGeorge/google-ims/blob/60df00899a45c2b06fcd1e7767025aa1d252f420/index.js#L14-L22 |
50,344 | sendanor/nor-ref | src/ref.js | is_https | function is_https(req) {
if(req.headers && req.headers['x-forwarded-proto'] && req.headers['x-forwarded-proto'] === 'https') { return true; }
return (req && req.connection && req.connection.encrypted) ? true : false;
} | javascript | function is_https(req) {
if(req.headers && req.headers['x-forwarded-proto'] && req.headers['x-forwarded-proto'] === 'https') { return true; }
return (req && req.connection && req.connection.encrypted) ? true : false;
} | [
"function",
"is_https",
"(",
"req",
")",
"{",
"if",
"(",
"req",
".",
"headers",
"&&",
"req",
".",
"headers",
"[",
"'x-forwarded-proto'",
"]",
"&&",
"req",
".",
"headers",
"[",
"'x-forwarded-proto'",
"]",
"===",
"'https'",
")",
"{",
"return",
"true",
";",... | Check if connection is HTTPS | [
"Check",
"if",
"connection",
"is",
"HTTPS"
] | 879667125e12317f63f99fea0344eb9dc298fdeb | https://github.com/sendanor/nor-ref/blob/879667125e12317f63f99fea0344eb9dc298fdeb/src/ref.js#L10-L13 |
50,345 | jcare44/node-logmatic | src/logmatic.js | function(message) {
if (!_.isObject(message)) {
message = {
message: message
};
}
try {
message = JSON.stringify(_.defaultsDeep({}, message, this.config.defaultProps));
} catch (e) {
return this.logger.error('Logmatic - error while parsing log message. Not sending', e);
... | javascript | function(message) {
if (!_.isObject(message)) {
message = {
message: message
};
}
try {
message = JSON.stringify(_.defaultsDeep({}, message, this.config.defaultProps));
} catch (e) {
return this.logger.error('Logmatic - error while parsing log message. Not sending', e);
... | [
"function",
"(",
"message",
")",
"{",
"if",
"(",
"!",
"_",
".",
"isObject",
"(",
"message",
")",
")",
"{",
"message",
"=",
"{",
"message",
":",
"message",
"}",
";",
"}",
"try",
"{",
"message",
"=",
"JSON",
".",
"stringify",
"(",
"_",
".",
"defaul... | Send log message
@param {object|any} message | [
"Send",
"log",
"message"
] | 5cbe6c5d0ae67929b3d159facb4f81c3cc8e6db5 | https://github.com/jcare44/node-logmatic/blob/5cbe6c5d0ae67929b3d159facb4f81c3cc8e6db5/src/logmatic.js#L84-L102 | |
50,346 | dalekjs/dalek-driver-sauce | lib/commands/execute.js | function (script, args, hash) {
this.actionQueue.push(this.webdriverClient.execute.bind(this.webdriverClient, {script: script.toString(), arguments: args}));
this.actionQueue.push(this._setExecuteCb.bind(this, script.toString(), args, hash));
return this;
} | javascript | function (script, args, hash) {
this.actionQueue.push(this.webdriverClient.execute.bind(this.webdriverClient, {script: script.toString(), arguments: args}));
this.actionQueue.push(this._setExecuteCb.bind(this, script.toString(), args, hash));
return this;
} | [
"function",
"(",
"script",
",",
"args",
",",
"hash",
")",
"{",
"this",
".",
"actionQueue",
".",
"push",
"(",
"this",
".",
"webdriverClient",
".",
"execute",
".",
"bind",
"(",
"this",
".",
"webdriverClient",
",",
"{",
"script",
":",
"script",
".",
"toSt... | Executes a JavaScript function
@method execute
@param {function} script Script to execute
@param {array} args Arguments to pass to the function
@param {string} hash Unique hash of that fn call
@chainable | [
"Executes",
"a",
"JavaScript",
"function"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/lib/commands/execute.js#L50-L54 | |
50,347 | dalekjs/dalek-driver-sauce | lib/commands/execute.js | function (script, args, hash, data) {
var deferred = Q.defer();
this.events.emit('driver:message', {key: 'execute', value: JSON.parse(data).value, uuid: hash, hash: hash});
deferred.resolve();
return deferred.promise;
} | javascript | function (script, args, hash, data) {
var deferred = Q.defer();
this.events.emit('driver:message', {key: 'execute', value: JSON.parse(data).value, uuid: hash, hash: hash});
deferred.resolve();
return deferred.promise;
} | [
"function",
"(",
"script",
",",
"args",
",",
"hash",
",",
"data",
")",
"{",
"var",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
";",
"this",
".",
"events",
".",
"emit",
"(",
"'driver:message'",
",",
"{",
"key",
":",
"'execute'",
",",
"value",
":",... | Sends out an event with the results of the `execute` call
@method _setExecuteCb
@param {function} script Script to execute
@param {array} args Arguments to pass to the function
@param {string} hash Unique hash of that fn call
@param {string} result Serialized JSON with the results of the call
@return {object} promise ... | [
"Sends",
"out",
"an",
"event",
"with",
"the",
"results",
"of",
"the",
"execute",
"call"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/lib/commands/execute.js#L68-L73 | |
50,348 | dalekjs/dalek-driver-sauce | lib/commands/execute.js | function (script, args, timeout, hash) {
this.actionQueue.push(this.webdriverClient.execute.bind(this.webdriverClient, {script: script.toString(), arguments: args}));
this.actionQueue.push(this._waitForCb.bind(this, script.toString(), args, timeout, hash));
return this;
} | javascript | function (script, args, timeout, hash) {
this.actionQueue.push(this.webdriverClient.execute.bind(this.webdriverClient, {script: script.toString(), arguments: args}));
this.actionQueue.push(this._waitForCb.bind(this, script.toString(), args, timeout, hash));
return this;
} | [
"function",
"(",
"script",
",",
"args",
",",
"timeout",
",",
"hash",
")",
"{",
"this",
".",
"actionQueue",
".",
"push",
"(",
"this",
".",
"webdriverClient",
".",
"execute",
".",
"bind",
"(",
"this",
".",
"webdriverClient",
",",
"{",
"script",
":",
"scr... | Executes a JavaScript function until the timeout rans out or
the function returns true
@method execute
@param {function} script Script to execute
@param {array} args Arguments to pass to the function
@param {integer} timeout Timeout of the function
@param {string} hash Unique hash of that fn call
@chainable | [
"Executes",
"a",
"JavaScript",
"function",
"until",
"the",
"timeout",
"rans",
"out",
"or",
"the",
"function",
"returns",
"true"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/lib/commands/execute.js#L87-L91 | |
50,349 | dalekjs/dalek-driver-sauce | lib/commands/execute.js | function (script, args, timeout, hash, data) {
var deferred = Q.defer();
var ret = JSON.parse(data);
var checker = function (yData) {
if (JSON.parse(yData).value.userRet === true) {
this.events.emit('driver:message', {key: 'waitFor', value: '', uuid: hash, hash: hash});
deferred.resolv... | javascript | function (script, args, timeout, hash, data) {
var deferred = Q.defer();
var ret = JSON.parse(data);
var checker = function (yData) {
if (JSON.parse(yData).value.userRet === true) {
this.events.emit('driver:message', {key: 'waitFor', value: '', uuid: hash, hash: hash});
deferred.resolv... | [
"function",
"(",
"script",
",",
"args",
",",
"timeout",
",",
"hash",
",",
"data",
")",
"{",
"var",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
";",
"var",
"ret",
"=",
"JSON",
".",
"parse",
"(",
"data",
")",
";",
"var",
"checker",
"=",
"function... | Sends out an event with the results of the `waitFor` call
@method _setExecuteCb
@param {function} script Script to execute
@param {array} args Arguments to pass to the function
@param {integer} timeout Timeout of the function
@param {string} hash Unique hash of that fn call
@param {string} data Serialized JSON with th... | [
"Sends",
"out",
"an",
"event",
"with",
"the",
"results",
"of",
"the",
"waitFor",
"call"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/lib/commands/execute.js#L106-L133 | |
50,350 | dgalvez/Tere | node-http-proxy/lib/node-http-proxy/http-proxy.js | onUpgrade | function onUpgrade (reverseProxy, proxySocket) {
if (!reverseProxy) {
proxySocket.end();
socket.end();
return;
}
//
// Any incoming data on this WebSocket to the proxy target
// will be written to the `reverseProxy` socket.
//
proxySocket.on('data', listeners.onIncoming = ... | javascript | function onUpgrade (reverseProxy, proxySocket) {
if (!reverseProxy) {
proxySocket.end();
socket.end();
return;
}
//
// Any incoming data on this WebSocket to the proxy target
// will be written to the `reverseProxy` socket.
//
proxySocket.on('data', listeners.onIncoming = ... | [
"function",
"onUpgrade",
"(",
"reverseProxy",
",",
"proxySocket",
")",
"{",
"if",
"(",
"!",
"reverseProxy",
")",
"{",
"proxySocket",
".",
"end",
"(",
")",
";",
"socket",
".",
"end",
"(",
")",
";",
"return",
";",
"}",
"//",
"// Any incoming data on this Web... | On `upgrade` from the Agent socket, listen to the appropriate events. | [
"On",
"upgrade",
"from",
"the",
"Agent",
"socket",
"listen",
"to",
"the",
"appropriate",
"events",
"."
] | 0b0dcfb1871fea668ad987807e3ed3d8365ab885 | https://github.com/dgalvez/Tere/blob/0b0dcfb1871fea668ad987807e3ed3d8365ab885/node-http-proxy/lib/node-http-proxy/http-proxy.js#L475-L573 |
50,351 | dgalvez/Tere | node-http-proxy/lib/node-http-proxy/http-proxy.js | detach | function detach() {
proxySocket.destroySoon();
proxySocket.removeListener('end', listeners.onIncomingClose);
proxySocket.removeListener('data', listeners.onIncoming);
reverseProxy.incoming.socket.destroySoon();
reverseProxy.incoming.socket.removeListener('end', listeners.onOutgoingClose);
... | javascript | function detach() {
proxySocket.destroySoon();
proxySocket.removeListener('end', listeners.onIncomingClose);
proxySocket.removeListener('data', listeners.onIncoming);
reverseProxy.incoming.socket.destroySoon();
reverseProxy.incoming.socket.removeListener('end', listeners.onOutgoingClose);
... | [
"function",
"detach",
"(",
")",
"{",
"proxySocket",
".",
"destroySoon",
"(",
")",
";",
"proxySocket",
".",
"removeListener",
"(",
"'end'",
",",
"listeners",
".",
"onIncomingClose",
")",
";",
"proxySocket",
".",
"removeListener",
"(",
"'data'",
",",
"listeners"... | Helper function to detach all event listeners from `reverseProxy` and `proxySocket`. | [
"Helper",
"function",
"to",
"detach",
"all",
"event",
"listeners",
"from",
"reverseProxy",
"and",
"proxySocket",
"."
] | 0b0dcfb1871fea668ad987807e3ed3d8365ab885 | https://github.com/dgalvez/Tere/blob/0b0dcfb1871fea668ad987807e3ed3d8365ab885/node-http-proxy/lib/node-http-proxy/http-proxy.js#L546-L553 |
50,352 | dgalvez/Tere | node-http-proxy/lib/node-http-proxy/http-proxy.js | proxyError | function proxyError (err) {
reverseProxy.destroy();
process.nextTick(function () {
//
// Destroy the incoming socket in the next tick, in case the error handler
// wants to write to it.
//
socket.destroy();
});
self.emit('webSocketProxyError', req, socket, head);
} | javascript | function proxyError (err) {
reverseProxy.destroy();
process.nextTick(function () {
//
// Destroy the incoming socket in the next tick, in case the error handler
// wants to write to it.
//
socket.destroy();
});
self.emit('webSocketProxyError', req, socket, head);
} | [
"function",
"proxyError",
"(",
"err",
")",
"{",
"reverseProxy",
".",
"destroy",
"(",
")",
";",
"process",
".",
"nextTick",
"(",
"function",
"(",
")",
"{",
"//",
"// Destroy the incoming socket in the next tick, in case the error handler",
"// wants to write to it.",
"//... | On any errors from the `reverseProxy` emit the `webSocketProxyError` and close the appropriate connections. | [
"On",
"any",
"errors",
"from",
"the",
"reverseProxy",
"emit",
"the",
"webSocketProxyError",
"and",
"close",
"the",
"appropriate",
"connections",
"."
] | 0b0dcfb1871fea668ad987807e3ed3d8365ab885 | https://github.com/dgalvez/Tere/blob/0b0dcfb1871fea668ad987807e3ed3d8365ab885/node-http-proxy/lib/node-http-proxy/http-proxy.js#L615-L627 |
50,353 | jaredhanson/crane-amqp | lib/broker.js | Broker | function Broker(options) {
EventEmitter.call(this);
this._exchange = null;
this._queues = {};
this._ctags = {};
this._options = options;
} | javascript | function Broker(options) {
EventEmitter.call(this);
this._exchange = null;
this._queues = {};
this._ctags = {};
this._options = options;
} | [
"function",
"Broker",
"(",
"options",
")",
"{",
"EventEmitter",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"_exchange",
"=",
"null",
";",
"this",
".",
"_queues",
"=",
"{",
"}",
";",
"this",
".",
"_ctags",
"=",
"{",
"}",
";",
"this",
".",
"_... | `Broker` constructor.
@api public | [
"Broker",
"constructor",
"."
] | 2f2a653a5567550d035daf8a2587fac0ebc9d8ce | https://github.com/jaredhanson/crane-amqp/blob/2f2a653a5567550d035daf8a2587fac0ebc9d8ce/lib/broker.js#L26-L33 |
50,354 | ottojs/otto-errors | lib/save.error.js | ErrorSave | function ErrorSave (message) {
Error.call(this);
// Add Information
this.name = 'ErrorSave';
this.type = 'server';
this.status = 500;
if (message) {
this.message = message;
}
} | javascript | function ErrorSave (message) {
Error.call(this);
// Add Information
this.name = 'ErrorSave';
this.type = 'server';
this.status = 500;
if (message) {
this.message = message;
}
} | [
"function",
"ErrorSave",
"(",
"message",
")",
"{",
"Error",
".",
"call",
"(",
"this",
")",
";",
"// Add Information",
"this",
".",
"name",
"=",
"'ErrorSave'",
";",
"this",
".",
"type",
"=",
"'server'",
";",
"this",
".",
"status",
"=",
"500",
";",
"if",... | Error - ErrorSave | [
"Error",
"-",
"ErrorSave"
] | a3c6d98fd5d35ce3c136ed7e1edd2f800af268d9 | https://github.com/ottojs/otto-errors/blob/a3c6d98fd5d35ce3c136ed7e1edd2f800af268d9/lib/save.error.js#L8-L20 |
50,355 | AtlasIQ/makedeb | lib/validate.js | isRealDirectory | function isRealDirectory(p) {
var stats;
try {
stats = fs.statSync(p);
} catch (error) {
// Not a valid path if stat fails.
return false;
}
return (stats.isDirectory());
} | javascript | function isRealDirectory(p) {
var stats;
try {
stats = fs.statSync(p);
} catch (error) {
// Not a valid path if stat fails.
return false;
}
return (stats.isDirectory());
} | [
"function",
"isRealDirectory",
"(",
"p",
")",
"{",
"var",
"stats",
";",
"try",
"{",
"stats",
"=",
"fs",
".",
"statSync",
"(",
"p",
")",
";",
"}",
"catch",
"(",
"error",
")",
"{",
"// Not a valid path if stat fails.",
"return",
"false",
";",
"}",
"return"... | Expects that a path points to a real directory. | [
"Expects",
"that",
"a",
"path",
"points",
"to",
"a",
"real",
"directory",
"."
] | 017719bc0e0d3594a05d7b30af2430c635e49363 | https://github.com/AtlasIQ/makedeb/blob/017719bc0e0d3594a05d7b30af2430c635e49363/lib/validate.js#L15-L25 |
50,356 | dwilhelm89/RandomGeoJSON | index.js | generatePolygon | function generatePolygon() {
var coordNumber = getRandomNumber(3, options.maxCoordCount);
var feature = rawFeature();
feature.geometry.type = 'Polygon';
feature.geometry.coordinates = [
[]
];
var firstCoordinate = generateLonLat();
feature.geometry.coordinates[0].push(firstCoordinate);
addCoordin... | javascript | function generatePolygon() {
var coordNumber = getRandomNumber(3, options.maxCoordCount);
var feature = rawFeature();
feature.geometry.type = 'Polygon';
feature.geometry.coordinates = [
[]
];
var firstCoordinate = generateLonLat();
feature.geometry.coordinates[0].push(firstCoordinate);
addCoordin... | [
"function",
"generatePolygon",
"(",
")",
"{",
"var",
"coordNumber",
"=",
"getRandomNumber",
"(",
"3",
",",
"options",
".",
"maxCoordCount",
")",
";",
"var",
"feature",
"=",
"rawFeature",
"(",
")",
";",
"feature",
".",
"geometry",
".",
"type",
"=",
"'Polygo... | Generates a Polygon
@return {Object} GeoJSON Polygon | [
"Generates",
"a",
"Polygon"
] | 539070dcbf6e67fcb6c4047c24dfb9588a702de9 | https://github.com/dwilhelm89/RandomGeoJSON/blob/539070dcbf6e67fcb6c4047c24dfb9588a702de9/index.js#L42-L58 |
50,357 | dwilhelm89/RandomGeoJSON | index.js | generateLineString | function generateLineString() {
var coordNumber = getRandomNumber(3, options.maxCoordCount);
var feature = rawFeature();
feature.geometry.type = 'LineString';
addCoordinates(feature.geometry.coordinates, coordNumber);
return feature;
} | javascript | function generateLineString() {
var coordNumber = getRandomNumber(3, options.maxCoordCount);
var feature = rawFeature();
feature.geometry.type = 'LineString';
addCoordinates(feature.geometry.coordinates, coordNumber);
return feature;
} | [
"function",
"generateLineString",
"(",
")",
"{",
"var",
"coordNumber",
"=",
"getRandomNumber",
"(",
"3",
",",
"options",
".",
"maxCoordCount",
")",
";",
"var",
"feature",
"=",
"rawFeature",
"(",
")",
";",
"feature",
".",
"geometry",
".",
"type",
"=",
"'Lin... | Generates a LineString
@return {Object} GeoJSON LineString | [
"Generates",
"a",
"LineString"
] | 539070dcbf6e67fcb6c4047c24dfb9588a702de9 | https://github.com/dwilhelm89/RandomGeoJSON/blob/539070dcbf6e67fcb6c4047c24dfb9588a702de9/index.js#L65-L74 |
50,358 | dwilhelm89/RandomGeoJSON | index.js | generateFeatures | function generateFeatures() {
var collection = {
type: 'FeatureCollection',
features: []
};
for (var i = 0; i < options.number; i++) {
collection.features.push(generateFeature(randomType()));
}
return collection;
} | javascript | function generateFeatures() {
var collection = {
type: 'FeatureCollection',
features: []
};
for (var i = 0; i < options.number; i++) {
collection.features.push(generateFeature(randomType()));
}
return collection;
} | [
"function",
"generateFeatures",
"(",
")",
"{",
"var",
"collection",
"=",
"{",
"type",
":",
"'FeatureCollection'",
",",
"features",
":",
"[",
"]",
"}",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"options",
".",
"number",
";",
"i",
"++",
"... | Creates a FeatureCollection and adds features
@return {Object} GeoJSON FeatureCollection | [
"Creates",
"a",
"FeatureCollection",
"and",
"adds",
"features"
] | 539070dcbf6e67fcb6c4047c24dfb9588a702de9 | https://github.com/dwilhelm89/RandomGeoJSON/blob/539070dcbf6e67fcb6c4047c24dfb9588a702de9/index.js#L115-L125 |
50,359 | dwilhelm89/RandomGeoJSON | index.js | addCoordinates | function addCoordinates(coordArray, number) {
for (var i = 0; i < number; i++) {
coordArray.push(generateLonLat());
}
} | javascript | function addCoordinates(coordArray, number) {
for (var i = 0; i < number; i++) {
coordArray.push(generateLonLat());
}
} | [
"function",
"addCoordinates",
"(",
"coordArray",
",",
"number",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"number",
";",
"i",
"++",
")",
"{",
"coordArray",
".",
"push",
"(",
"generateLonLat",
"(",
")",
")",
";",
"}",
"}"
] | Adds a random coordinate to an array
@param {Array} coordArray the coordinate array
@param {Number} number amount of coordinates which should be added | [
"Adds",
"a",
"random",
"coordinate",
"to",
"an",
"array"
] | 539070dcbf6e67fcb6c4047c24dfb9588a702de9 | https://github.com/dwilhelm89/RandomGeoJSON/blob/539070dcbf6e67fcb6c4047c24dfb9588a702de9/index.js#L163-L167 |
50,360 | Becklyn/becklyn-gulp | tasks/js_simple.js | compileSingleFile | function compileSingleFile (filePath, isDebug, options)
{
var outputPath = "./" + path.dirname(filePath).replace(/(^|\/)assets\/js/, "$1public/js");
var uglifyOptions = {};
gulpUtil.log(gulpUtil.colors.blue("Uglify"), pathHelper.makeRelative(filePath), " -> ", pathHelper.makeRelative(outputPath) + "/" + pa... | javascript | function compileSingleFile (filePath, isDebug, options)
{
var outputPath = "./" + path.dirname(filePath).replace(/(^|\/)assets\/js/, "$1public/js");
var uglifyOptions = {};
gulpUtil.log(gulpUtil.colors.blue("Uglify"), pathHelper.makeRelative(filePath), " -> ", pathHelper.makeRelative(outputPath) + "/" + pa... | [
"function",
"compileSingleFile",
"(",
"filePath",
",",
"isDebug",
",",
"options",
")",
"{",
"var",
"outputPath",
"=",
"\"./\"",
"+",
"path",
".",
"dirname",
"(",
"filePath",
")",
".",
"replace",
"(",
"/",
"(^|\\/)assets\\/js",
"/",
",",
"\"$1public/js\"",
")... | Compiles a single file
@param {string} filePath
@param {boolean} isDebug
@param {UglifyTaskOptions} options
@returns {*} | [
"Compiles",
"a",
"single",
"file"
] | 1c633378d561f07101f9db19ccd153617b8e0252 | https://github.com/Becklyn/becklyn-gulp/blob/1c633378d561f07101f9db19ccd153617b8e0252/tasks/js_simple.js#L31-L53 |
50,361 | tylerbeck/grunt-bower-map | classes/BowerMap.js | validateParameters | function validateParameters() {
grunt.verbose.writeln( 'BowerMap::validateParameters' );
//flag used to determine if validation passes
var check = true;
//lib path must be set
//TODO: get default bowerpath from .bowerrc
bowerPath = bowerPath || "bower_components";
if ( typeof bowerPath !== 'string' ) {
... | javascript | function validateParameters() {
grunt.verbose.writeln( 'BowerMap::validateParameters' );
//flag used to determine if validation passes
var check = true;
//lib path must be set
//TODO: get default bowerpath from .bowerrc
bowerPath = bowerPath || "bower_components";
if ( typeof bowerPath !== 'string' ) {
... | [
"function",
"validateParameters",
"(",
")",
"{",
"grunt",
".",
"verbose",
".",
"writeln",
"(",
"'BowerMap::validateParameters'",
")",
";",
"//flag used to determine if validation passes",
"var",
"check",
"=",
"true",
";",
"//lib path must be set",
"//TODO: get default bower... | validates bower copy task parameters
@returns {boolean} | [
"validates",
"bower",
"copy",
"task",
"parameters"
] | b72e43719123a8a1c09eff5bea48fe494693cb1d | https://github.com/tylerbeck/grunt-bower-map/blob/b72e43719123a8a1c09eff5bea48fe494693cb1d/classes/BowerMap.js#L103-L164 |
50,362 | tylerbeck/grunt-bower-map | classes/BowerMap.js | handleListResults | function handleListResults( results ) {
grunt.verbose.writeln( 'BowerMap::handleListResults' );
for ( var k in results ) {
if ( results.hasOwnProperty( k ) ) {
grunt.verbose.writeln( '------------------------------------' );
grunt.verbose.writeln( ' ' + k + ' - ' + results[k] );
if ( ignore.index... | javascript | function handleListResults( results ) {
grunt.verbose.writeln( 'BowerMap::handleListResults' );
for ( var k in results ) {
if ( results.hasOwnProperty( k ) ) {
grunt.verbose.writeln( '------------------------------------' );
grunt.verbose.writeln( ' ' + k + ' - ' + results[k] );
if ( ignore.index... | [
"function",
"handleListResults",
"(",
"results",
")",
"{",
"grunt",
".",
"verbose",
".",
"writeln",
"(",
"'BowerMap::handleListResults'",
")",
";",
"for",
"(",
"var",
"k",
"in",
"results",
")",
"{",
"if",
"(",
"results",
".",
"hasOwnProperty",
"(",
"k",
")... | bower list results handler
@param results | [
"bower",
"list",
"results",
"handler"
] | b72e43719123a8a1c09eff5bea48fe494693cb1d | https://github.com/tylerbeck/grunt-bower-map/blob/b72e43719123a8a1c09eff5bea48fe494693cb1d/classes/BowerMap.js#L283-L299 |
50,363 | tylerbeck/grunt-bower-map | classes/BowerMap.js | copyComponentFiles | function copyComponentFiles( name, files ) {
grunt.verbose.writeln( 'BowerMap::copyComponentFiles - ' + name );
//get map of files to copy
var componentMap = getComponentMapping( name, files );
//copy files
for ( var k in componentMap ) {
if ( componentMap.hasOwnProperty( k ) ) {
//console.log( path.f... | javascript | function copyComponentFiles( name, files ) {
grunt.verbose.writeln( 'BowerMap::copyComponentFiles - ' + name );
//get map of files to copy
var componentMap = getComponentMapping( name, files );
//copy files
for ( var k in componentMap ) {
if ( componentMap.hasOwnProperty( k ) ) {
//console.log( path.f... | [
"function",
"copyComponentFiles",
"(",
"name",
",",
"files",
")",
"{",
"grunt",
".",
"verbose",
".",
"writeln",
"(",
"'BowerMap::copyComponentFiles - '",
"+",
"name",
")",
";",
"//get map of files to copy",
"var",
"componentMap",
"=",
"getComponentMapping",
"(",
"na... | copies specified component files based on mapping
@param name
@param files
@returns {boolean} | [
"copies",
"specified",
"component",
"files",
"based",
"on",
"mapping"
] | b72e43719123a8a1c09eff5bea48fe494693cb1d | https://github.com/tylerbeck/grunt-bower-map/blob/b72e43719123a8a1c09eff5bea48fe494693cb1d/classes/BowerMap.js#L308-L327 |
50,364 | tylerbeck/grunt-bower-map | classes/BowerMap.js | getComponentMapping | function getComponentMapping( name, files ) {
grunt.verbose.writeln( 'BowerMap::getComponentMapping - ' + name );
//first get list of all files
var fileList = [];
if ( shim[ name ] !== undefined ) {
grunt.verbose.writeln( ' using shim value' );
//use shim value
fileList = fileList.concat( shim[ na... | javascript | function getComponentMapping( name, files ) {
grunt.verbose.writeln( 'BowerMap::getComponentMapping - ' + name );
//first get list of all files
var fileList = [];
if ( shim[ name ] !== undefined ) {
grunt.verbose.writeln( ' using shim value' );
//use shim value
fileList = fileList.concat( shim[ na... | [
"function",
"getComponentMapping",
"(",
"name",
",",
"files",
")",
"{",
"grunt",
".",
"verbose",
".",
"writeln",
"(",
"'BowerMap::getComponentMapping - '",
"+",
"name",
")",
";",
"//first get list of all files",
"var",
"fileList",
"=",
"[",
"]",
";",
"if",
"(",
... | gets file mapping for specified component
@param name
@param files
@returns {{}} | [
"gets",
"file",
"mapping",
"for",
"specified",
"component"
] | b72e43719123a8a1c09eff5bea48fe494693cb1d | https://github.com/tylerbeck/grunt-bower-map/blob/b72e43719123a8a1c09eff5bea48fe494693cb1d/classes/BowerMap.js#L335-L415 |
50,365 | tylerbeck/grunt-bower-map | classes/BowerMap.js | getCommonPathBase | function getCommonPathBase( paths ) {
var list = [];
var minLength = 999999999;
var commonPath = "";
//break up paths into parts
paths.forEach( function( file ) {
//normalize path seperators
file = file.replace( pathSepRegExp, path.sep );
//get resolved path parts for file directory
if ( file... | javascript | function getCommonPathBase( paths ) {
var list = [];
var minLength = 999999999;
var commonPath = "";
//break up paths into parts
paths.forEach( function( file ) {
//normalize path seperators
file = file.replace( pathSepRegExp, path.sep );
//get resolved path parts for file directory
if ( file... | [
"function",
"getCommonPathBase",
"(",
"paths",
")",
"{",
"var",
"list",
"=",
"[",
"]",
";",
"var",
"minLength",
"=",
"999999999",
";",
"var",
"commonPath",
"=",
"\"\"",
";",
"//break up paths into parts",
"paths",
".",
"forEach",
"(",
"function",
"(",
"file"... | determines a shared base path among paths
@param paths {Array} of strings
@returns {String} | [
"determines",
"a",
"shared",
"base",
"path",
"among",
"paths"
] | b72e43719123a8a1c09eff5bea48fe494693cb1d | https://github.com/tylerbeck/grunt-bower-map/blob/b72e43719123a8a1c09eff5bea48fe494693cb1d/classes/BowerMap.js#L423-L493 |
50,366 | shuvava/dev-http-server | lib/httpserver.js | urlWeight | function urlWeight(config) {
if (isUndefined(config) || config.url == undefined) { // eslint-disable-line eqeqeq
return 0;
}
if (config.url instanceof RegExp) {
return 1 + config.url.toString().length;
}
if (isFunction(config.url)) {
return 1;
}
return 100 + config.ur... | javascript | function urlWeight(config) {
if (isUndefined(config) || config.url == undefined) { // eslint-disable-line eqeqeq
return 0;
}
if (config.url instanceof RegExp) {
return 1 + config.url.toString().length;
}
if (isFunction(config.url)) {
return 1;
}
return 100 + config.ur... | [
"function",
"urlWeight",
"(",
"config",
")",
"{",
"if",
"(",
"isUndefined",
"(",
"config",
")",
"||",
"config",
".",
"url",
"==",
"undefined",
")",
"{",
"// eslint-disable-line eqeqeq",
"return",
"0",
";",
"}",
"if",
"(",
"config",
".",
"url",
"instanceof"... | Calculate relative weight of URL comparing object
@param {Object} config Internal object of URL comparing
@param {string|RegExp} [config.url] URL pattern to compare
@return {number} relative weight | [
"Calculate",
"relative",
"weight",
"of",
"URL",
"comparing",
"object"
] | db0f3b28f5805125959679828d81c1919cf519b6 | https://github.com/shuvava/dev-http-server/blob/db0f3b28f5805125959679828d81c1919cf519b6/lib/httpserver.js#L44-L55 |
50,367 | andrewscwei/requiem | src/helpers/defineProperty.js | defineProperty | function defineProperty(element, propertyName, descriptor, scope) {
assert(element, 'Parameter \'element\' must be defined');
assertType(descriptor, 'object', false, 'Parameter \'descriptor\' must be an object literal');
assertType(descriptor.configurable, 'boolean', true, 'Optional configurable key in descriptor... | javascript | function defineProperty(element, propertyName, descriptor, scope) {
assert(element, 'Parameter \'element\' must be defined');
assertType(descriptor, 'object', false, 'Parameter \'descriptor\' must be an object literal');
assertType(descriptor.configurable, 'boolean', true, 'Optional configurable key in descriptor... | [
"function",
"defineProperty",
"(",
"element",
",",
"propertyName",
",",
"descriptor",
",",
"scope",
")",
"{",
"assert",
"(",
"element",
",",
"'Parameter \\'element\\' must be defined'",
")",
";",
"assertType",
"(",
"descriptor",
",",
"'object'",
",",
"false",
",",... | Defines a property in an element instance.
@param {Node} element - Element instance to define the new property in.
@param {string} propertyName - Name of the property to be defined.
@param {Object} descriptor - An object literal that defines the behavior of
this new property. This object literal inherits
that of the d... | [
"Defines",
"a",
"property",
"in",
"an",
"element",
"instance",
"."
] | c4182bfffc9841c6de5718f689ad3c2060511777 | https://github.com/andrewscwei/requiem/blob/c4182bfffc9841c6de5718f689ad3c2060511777/src/helpers/defineProperty.js#L54-L146 |
50,368 | jmjuanes/readl-async | index.js | function(file, opt)
{
//Check the file
if(typeof file !== 'string'){ throw new Error('Missing file argument'); return null; }
//Check the options
if(typeof opt === 'undefined'){ var opt = {}; }
//Save the file name
this._file = file;
//Check the encoding option
this._encoding = (typeof opt.encoding =... | javascript | function(file, opt)
{
//Check the file
if(typeof file !== 'string'){ throw new Error('Missing file argument'); return null; }
//Check the options
if(typeof opt === 'undefined'){ var opt = {}; }
//Save the file name
this._file = file;
//Check the encoding option
this._encoding = (typeof opt.encoding =... | [
"function",
"(",
"file",
",",
"opt",
")",
"{",
"//Check the file",
"if",
"(",
"typeof",
"file",
"!==",
"'string'",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Missing file argument'",
")",
";",
"return",
"null",
";",
"}",
"//Check the options",
"if",
"(",
"t... | Read line by line object | [
"Read",
"line",
"by",
"line",
"object"
] | e263adbae41972cf7301360b412f293285305d75 | https://github.com/jmjuanes/readl-async/blob/e263adbae41972cf7301360b412f293285305d75/index.js#L6-L43 | |
50,369 | joerx/grunt-crontab | lib/grunt-crontab.js | setup | function setup(done) {
crontab.load(function(err, ct) {
if (err) return done(err);
clean(ct);
load(ct);
ct.save(done);
});
} | javascript | function setup(done) {
crontab.load(function(err, ct) {
if (err) return done(err);
clean(ct);
load(ct);
ct.save(done);
});
} | [
"function",
"setup",
"(",
"done",
")",
"{",
"crontab",
".",
"load",
"(",
"function",
"(",
"err",
",",
"ct",
")",
"{",
"if",
"(",
"err",
")",
"return",
"done",
"(",
"err",
")",
";",
"clean",
"(",
"ct",
")",
";",
"load",
"(",
"ct",
")",
";",
"c... | Remove cronjobs from given crontab | [
"Remove",
"cronjobs",
"from",
"given",
"crontab"
] | 47e26c3d7897f79524ac1d37cd48acaf963fc1f3 | https://github.com/joerx/grunt-crontab/blob/47e26c3d7897f79524ac1d37cd48acaf963fc1f3/lib/grunt-crontab.js#L21-L28 |
50,370 | joerx/grunt-crontab | lib/grunt-crontab.js | readCronFile | function readCronFile(cronfile) {
var substitutes = {
project: {
baseDir: process.cwd()
},
pkg: pkg
}
var content = _.template(grunt.file.read(cronfile), substitutes);
return JSON.parse(content).jobs;
} | javascript | function readCronFile(cronfile) {
var substitutes = {
project: {
baseDir: process.cwd()
},
pkg: pkg
}
var content = _.template(grunt.file.read(cronfile), substitutes);
return JSON.parse(content).jobs;
} | [
"function",
"readCronFile",
"(",
"cronfile",
")",
"{",
"var",
"substitutes",
"=",
"{",
"project",
":",
"{",
"baseDir",
":",
"process",
".",
"cwd",
"(",
")",
"}",
",",
"pkg",
":",
"pkg",
"}",
"var",
"content",
"=",
"_",
".",
"template",
"(",
"grunt",
... | Read cronjob definition file from disk. | [
"Read",
"cronjob",
"definition",
"file",
"from",
"disk",
"."
] | 47e26c3d7897f79524ac1d37cd48acaf963fc1f3 | https://github.com/joerx/grunt-crontab/blob/47e26c3d7897f79524ac1d37cd48acaf963fc1f3/lib/grunt-crontab.js#L59-L68 |
50,371 | underdogio/resolve-link | lib/resolve-link.js | resolveLink | function resolveLink(srcUrl, targetUrl) {
// Parse the src URL
var srcUrlObj = url.parse(srcUrl);
// If there isn't a protocol
// DEV: `node@0.8` has this as `undefined`, `node@0.10` has this as `null`
if (!srcUrlObj.protocol) {
// With no protocol, we have everything in pathname. Add on `//` and force t... | javascript | function resolveLink(srcUrl, targetUrl) {
// Parse the src URL
var srcUrlObj = url.parse(srcUrl);
// If there isn't a protocol
// DEV: `node@0.8` has this as `undefined`, `node@0.10` has this as `null`
if (!srcUrlObj.protocol) {
// With no protocol, we have everything in pathname. Add on `//` and force t... | [
"function",
"resolveLink",
"(",
"srcUrl",
",",
"targetUrl",
")",
"{",
"// Parse the src URL",
"var",
"srcUrlObj",
"=",
"url",
".",
"parse",
"(",
"srcUrl",
")",
";",
"// If there isn't a protocol",
"// DEV: `node@0.8` has this as `undefined`, `node@0.10` has this as `null`",
... | Define our helper | [
"Define",
"our",
"helper"
] | 075ee9be703806ac0cb4cf36a8550c5357f4a686 | https://github.com/underdogio/resolve-link/blob/075ee9be703806ac0cb4cf36a8550c5357f4a686/lib/resolve-link.js#L6-L54 |
50,372 | Nazariglez/perenquen | lib/pixi/src/core/textures/RenderTexture.js | RenderTexture | function RenderTexture(renderer, width, height, scaleMode, resolution)
{
if (!renderer)
{
throw new Error('Unable to create RenderTexture, you must pass a renderer into the constructor.');
}
width = width || 100;
height = height || 100;
resolution = resolution || CONST.RESOLUTION;
... | javascript | function RenderTexture(renderer, width, height, scaleMode, resolution)
{
if (!renderer)
{
throw new Error('Unable to create RenderTexture, you must pass a renderer into the constructor.');
}
width = width || 100;
height = height || 100;
resolution = resolution || CONST.RESOLUTION;
... | [
"function",
"RenderTexture",
"(",
"renderer",
",",
"width",
",",
"height",
",",
"scaleMode",
",",
"resolution",
")",
"{",
"if",
"(",
"!",
"renderer",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Unable to create RenderTexture, you must pass a renderer into the constructo... | A RenderTexture is a special texture that allows any Pixi display object to be rendered to it.
__Hint__: All DisplayObjects (i.e. Sprites) that render to a RenderTexture should be preloaded
otherwise black rectangles will be drawn instead.
A RenderTexture takes a snapshot of any Display Object given to its render met... | [
"A",
"RenderTexture",
"is",
"a",
"special",
"texture",
"that",
"allows",
"any",
"Pixi",
"display",
"object",
"to",
"be",
"rendered",
"to",
"it",
"."
] | e023964d05afeefebdcac4e2044819fdfa3899ae | https://github.com/Nazariglez/perenquen/blob/e023964d05afeefebdcac4e2044819fdfa3899ae/lib/pixi/src/core/textures/RenderTexture.js#L51-L174 |
50,373 | senecajs-labs/seneca-sqlite-store | lib/sqlite-store.js | function (args, done) {
var q = _.clone(args.q)
var qent = args.qent
q.limit$ = 1
var qs = schemastm(qent)
self.connection.all(qs.text, function (err, results) {
if (err) {
return done(err)
}
var schema = {}
results.forEach(function (row) {
... | javascript | function (args, done) {
var q = _.clone(args.q)
var qent = args.qent
q.limit$ = 1
var qs = schemastm(qent)
self.connection.all(qs.text, function (err, results) {
if (err) {
return done(err)
}
var schema = {}
results.forEach(function (row) {
... | [
"function",
"(",
"args",
",",
"done",
")",
"{",
"var",
"q",
"=",
"_",
".",
"clone",
"(",
"args",
".",
"q",
")",
"var",
"qent",
"=",
"args",
".",
"qent",
"q",
".",
"limit$",
"=",
"1",
"var",
"qs",
"=",
"schemastm",
"(",
"qent",
")",
"self",
".... | load the first matching entity | [
"load",
"the",
"first",
"matching",
"entity"
] | 9d3f45f1ae093de30d709dbb990c4921263bf45e | https://github.com/senecajs-labs/seneca-sqlite-store/blob/9d3f45f1ae093de30d709dbb990c4921263bf45e/lib/sqlite-store.js#L52-L81 | |
50,374 | forumone/yeoman-generator-bluebird | index.js | promptAsync | function promptAsync(prompts) {
return new Promise(function(resolve, reject) {
parent.prompt.call(parent, prompts, function(answers) {
resolve(answers)
});
});
} | javascript | function promptAsync(prompts) {
return new Promise(function(resolve, reject) {
parent.prompt.call(parent, prompts, function(answers) {
resolve(answers)
});
});
} | [
"function",
"promptAsync",
"(",
"prompts",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"parent",
".",
"prompt",
".",
"call",
"(",
"parent",
",",
"prompts",
",",
"function",
"(",
"answers",
")",
"{",
"... | Asynchronous prompt function that returns a Promise
@param prompts
@returns {Promise} | [
"Asynchronous",
"prompt",
"function",
"that",
"returns",
"a",
"Promise"
] | 01d917fe4bc9081e512a206d390b9661947d1f2f | https://github.com/forumone/yeoman-generator-bluebird/blob/01d917fe4bc9081e512a206d390b9661947d1f2f/index.js#L17-L23 |
50,375 | forumone/yeoman-generator-bluebird | index.js | remoteAsync | function remoteAsync() {
var generator = this.generator;
var username;
var repo;
var branch;
var refresh;
var url;
// With URL and refresh
if (arguments.length <= 2) {
url = arguments[0];
refresh = arguments[1];
} else {
username = arguments[0];
repo = arguments[1];
branch = ar... | javascript | function remoteAsync() {
var generator = this.generator;
var username;
var repo;
var branch;
var refresh;
var url;
// With URL and refresh
if (arguments.length <= 2) {
url = arguments[0];
refresh = arguments[1];
} else {
username = arguments[0];
repo = arguments[1];
branch = ar... | [
"function",
"remoteAsync",
"(",
")",
"{",
"var",
"generator",
"=",
"this",
".",
"generator",
";",
"var",
"username",
";",
"var",
"repo",
";",
"var",
"branch",
";",
"var",
"refresh",
";",
"var",
"url",
";",
"// With URL and refresh",
"if",
"(",
"arguments",... | Asynchronous remote function that returns a Promise
@returns {Promise} | [
"Asynchronous",
"remote",
"function",
"that",
"returns",
"a",
"Promise"
] | 01d917fe4bc9081e512a206d390b9661947d1f2f | https://github.com/forumone/yeoman-generator-bluebird/blob/01d917fe4bc9081e512a206d390b9661947d1f2f/index.js#L30-L61 |
50,376 | Wizcorp/panopticon | lib/TimedSample.js | TimedSample | function TimedSample(dt, timeStamp, persistObj, scaleFactor) {
var time = (dt[0] + dt[1] / 1e9) * 1000 / scaleFactor;
this.scaleFactor = scaleFactor;
this.min = time;
this.max = time;
this.sigma = new StandardDeviation(time);
this.average = new Average(time);
this.timeStamp = timeStamp;
if (persistObj) {
va... | javascript | function TimedSample(dt, timeStamp, persistObj, scaleFactor) {
var time = (dt[0] + dt[1] / 1e9) * 1000 / scaleFactor;
this.scaleFactor = scaleFactor;
this.min = time;
this.max = time;
this.sigma = new StandardDeviation(time);
this.average = new Average(time);
this.timeStamp = timeStamp;
if (persistObj) {
va... | [
"function",
"TimedSample",
"(",
"dt",
",",
"timeStamp",
",",
"persistObj",
",",
"scaleFactor",
")",
"{",
"var",
"time",
"=",
"(",
"dt",
"[",
"0",
"]",
"+",
"dt",
"[",
"1",
"]",
"/",
"1e9",
")",
"*",
"1000",
"/",
"scaleFactor",
";",
"this",
".",
"... | Timed sample object constructor.
@param {Number[]} dt Takes the output of a diff produced by feeding the result of one
hrtime as the parameter to another.
@param {Number} timeStamp A unix time stamp (in ms).
@param {Object} persistObj Emits reset events. An instance of timed sample belongs to this
object.
@p... | [
"Timed",
"sample",
"object",
"constructor",
"."
] | e0d660cd5287b45aafdb5a91e54affa7364b14e0 | https://github.com/Wizcorp/panopticon/blob/e0d660cd5287b45aafdb5a91e54affa7364b14e0/lib/TimedSample.js#L18-L35 |
50,377 | MaximTovstashev/brest | lib/middleware/bodyparser.js | addMode | function addMode(middle, mode, settings) {
if (!modes.includes(mode)) throw `Incorrect bodyparser mode ${mode}`;
middle.push(bodyParser[mode](settings[mode]));
} | javascript | function addMode(middle, mode, settings) {
if (!modes.includes(mode)) throw `Incorrect bodyparser mode ${mode}`;
middle.push(bodyParser[mode](settings[mode]));
} | [
"function",
"addMode",
"(",
"middle",
",",
"mode",
",",
"settings",
")",
"{",
"if",
"(",
"!",
"modes",
".",
"includes",
"(",
"mode",
")",
")",
"throw",
"`",
"${",
"mode",
"}",
"`",
";",
"middle",
".",
"push",
"(",
"bodyParser",
"[",
"mode",
"]",
... | Add a single parse mode to the route middleware
@param middle
@param mode
@param settings | [
"Add",
"a",
"single",
"parse",
"mode",
"to",
"the",
"route",
"middleware"
] | 9b0bd6ee452e55b86cd01d1647f0dff460ad191f | https://github.com/MaximTovstashev/brest/blob/9b0bd6ee452e55b86cd01d1647f0dff460ad191f/lib/middleware/bodyparser.js#L29-L32 |
50,378 | MaximTovstashev/brest | lib/middleware/bodyparser.js | initEndpoint | function initEndpoint(brest, description) {
const settings = _.defaultsDeep(description.bodyParser, settingsDefault);
if (description.bodyParserModes) {
description.bodyParserModes.forEach((mode) => addMode(description.middle, mode, settings));
} else {
const mode = description.bodyParserM... | javascript | function initEndpoint(brest, description) {
const settings = _.defaultsDeep(description.bodyParser, settingsDefault);
if (description.bodyParserModes) {
description.bodyParserModes.forEach((mode) => addMode(description.middle, mode, settings));
} else {
const mode = description.bodyParserM... | [
"function",
"initEndpoint",
"(",
"brest",
",",
"description",
")",
"{",
"const",
"settings",
"=",
"_",
".",
"defaultsDeep",
"(",
"description",
".",
"bodyParser",
",",
"settingsDefault",
")",
";",
"if",
"(",
"description",
".",
"bodyParserModes",
")",
"{",
"... | Setup bodyParser middleware according to settings
@param brest
@param description | [
"Setup",
"bodyParser",
"middleware",
"according",
"to",
"settings"
] | 9b0bd6ee452e55b86cd01d1647f0dff460ad191f | https://github.com/MaximTovstashev/brest/blob/9b0bd6ee452e55b86cd01d1647f0dff460ad191f/lib/middleware/bodyparser.js#L39-L51 |
50,379 | ritenv/ng-wistia-components | ng-wistia-components.js | function (e, data) {
ctrl.coreWistia.setError(); //clear any previous errors
data
.submit()
.then(function (result, textStatus, jqXHR) {
ctrl.coreWistia.playVideo(result.hashed_id);
})
.catch(fun... | javascript | function (e, data) {
ctrl.coreWistia.setError(); //clear any previous errors
data
.submit()
.then(function (result, textStatus, jqXHR) {
ctrl.coreWistia.playVideo(result.hashed_id);
})
.catch(fun... | [
"function",
"(",
"e",
",",
"data",
")",
"{",
"ctrl",
".",
"coreWistia",
".",
"setError",
"(",
")",
";",
"//clear any previous errors",
"data",
".",
"submit",
"(",
")",
".",
"then",
"(",
"function",
"(",
"result",
",",
"textStatus",
",",
"jqXHR",
")",
"... | Called when a file is added for uploading | [
"Called",
"when",
"a",
"file",
"is",
"added",
"for",
"uploading"
] | d3aa58c2c52550e8784168073d91f1d62d90ed76 | https://github.com/ritenv/ng-wistia-components/blob/d3aa58c2c52550e8784168073d91f1d62d90ed76/ng-wistia-components.js#L194-L208 | |
50,380 | ritenv/ng-wistia-components | ng-wistia-components.js | function (e, data) {
var progress = parseInt(data.loaded / data.total * 100, 10);
$timeout(function() {
ctrl.coreWistia.setProgress(progress);
});
} | javascript | function (e, data) {
var progress = parseInt(data.loaded / data.total * 100, 10);
$timeout(function() {
ctrl.coreWistia.setProgress(progress);
});
} | [
"function",
"(",
"e",
",",
"data",
")",
"{",
"var",
"progress",
"=",
"parseInt",
"(",
"data",
".",
"loaded",
"/",
"data",
".",
"total",
"*",
"100",
",",
"10",
")",
";",
"$timeout",
"(",
"function",
"(",
")",
"{",
"ctrl",
".",
"coreWistia",
".",
"... | Called whenever upload progress is updated | [
"Called",
"whenever",
"upload",
"progress",
"is",
"updated"
] | d3aa58c2c52550e8784168073d91f1d62d90ed76 | https://github.com/ritenv/ng-wistia-components/blob/d3aa58c2c52550e8784168073d91f1d62d90ed76/ng-wistia-components.js#L213-L219 | |
50,381 | andreaswillems/mongo-crud-layer | lib/mongo-crud-layer.js | MongoCrud | function MongoCrud(uri, options, gridFS) {
this.uri = uri || 'mongodb://localhost:27017/mongo-crud-test';
this.options = options || {};
this.gridFS = gridFS;
} | javascript | function MongoCrud(uri, options, gridFS) {
this.uri = uri || 'mongodb://localhost:27017/mongo-crud-test';
this.options = options || {};
this.gridFS = gridFS;
} | [
"function",
"MongoCrud",
"(",
"uri",
",",
"options",
",",
"gridFS",
")",
"{",
"this",
".",
"uri",
"=",
"uri",
"||",
"'mongodb://localhost:27017/mongo-crud-test'",
";",
"this",
".",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"this",
".",
"gridFS",
"=",... | Creates a MongoCrudLayer instance with given properties.
@param uri - the MongoDB URI, defaults to 'mongodb://localhost:27017/mongo-crud-test
@param options - Options used when connecting to MongoDB, defaults to an empty object
@param gridFS - set to true, if objects exceed MongoDB document limit of 16mb, to store
obj... | [
"Creates",
"a",
"MongoCrudLayer",
"instance",
"with",
"given",
"properties",
"."
] | 571c523c6b4f37226626c7eff339f745d94cbe68 | https://github.com/andreaswillems/mongo-crud-layer/blob/571c523c6b4f37226626c7eff339f745d94cbe68/lib/mongo-crud-layer.js#L24-L28 |
50,382 | origin1tech/mustr | dist/cli.js | help | function help() {
var padBtm = [0, 0, 1, 0];
var msg = ' See additional required/optional arguments for each command below. \n';
pargv
.logo('Mustr', 'cyan')
.ui(95)
.join(chalk.magenta('Usage:'), 'mu', chalk.cyan('<cmd>'), '\n')
.div({ text: chalk.bgBlue.white(msg) })
... | javascript | function help() {
var padBtm = [0, 0, 1, 0];
var msg = ' See additional required/optional arguments for each command below. \n';
pargv
.logo('Mustr', 'cyan')
.ui(95)
.join(chalk.magenta('Usage:'), 'mu', chalk.cyan('<cmd>'), '\n')
.div({ text: chalk.bgBlue.white(msg) })
... | [
"function",
"help",
"(",
")",
"{",
"var",
"padBtm",
"=",
"[",
"0",
",",
"0",
",",
"1",
",",
"0",
"]",
";",
"var",
"msg",
"=",
"' See additional required/optional arguments for each command below. \\n'",
";",
"pargv",
".",
"logo",
"(",
"'Mustr'",
",",
"'cyan'... | Handler for help. | [
"Handler",
"for",
"help",
"."
] | 66e6a9fbbf8c7d3a3939bf3d2c69f56e047909d8 | https://github.com/origin1tech/mustr/blob/66e6a9fbbf8c7d3a3939bf3d2c69f56e047909d8/dist/cli.js#L37-L56 |
50,383 | origin1tech/mustr | dist/cli.js | generate | function generate() {
var parsed = ensureConfig();
if (!parsed.name)
mu.log.error('cannot generate template using name of undefined.\n').write().exit();
// Generate the template.
mu.render(parsed.name, parsed.output, parsed.options);
} | javascript | function generate() {
var parsed = ensureConfig();
if (!parsed.name)
mu.log.error('cannot generate template using name of undefined.\n').write().exit();
// Generate the template.
mu.render(parsed.name, parsed.output, parsed.options);
} | [
"function",
"generate",
"(",
")",
"{",
"var",
"parsed",
"=",
"ensureConfig",
"(",
")",
";",
"if",
"(",
"!",
"parsed",
".",
"name",
")",
"mu",
".",
"log",
".",
"error",
"(",
"'cannot generate template using name of undefined.\\n'",
")",
".",
"write",
"(",
"... | Handler for generating templates. | [
"Handler",
"for",
"generating",
"templates",
"."
] | 66e6a9fbbf8c7d3a3939bf3d2c69f56e047909d8 | https://github.com/origin1tech/mustr/blob/66e6a9fbbf8c7d3a3939bf3d2c69f56e047909d8/dist/cli.js#L62-L68 |
50,384 | origin1tech/mustr | dist/cli.js | rollback | function rollback() {
var parsed = ensureConfig();
var name = parsed.name;
// check if is an index number.
// if yes try to lookup the id
// by its index.
try {
var idx = void 0;
if (/^[0-9]+$/.test(name)) {
idx = parseInt(parsed.name) - 1;
if (idx >= 0) {... | javascript | function rollback() {
var parsed = ensureConfig();
var name = parsed.name;
// check if is an index number.
// if yes try to lookup the id
// by its index.
try {
var idx = void 0;
if (/^[0-9]+$/.test(name)) {
idx = parseInt(parsed.name) - 1;
if (idx >= 0) {... | [
"function",
"rollback",
"(",
")",
"{",
"var",
"parsed",
"=",
"ensureConfig",
"(",
")",
";",
"var",
"name",
"=",
"parsed",
".",
"name",
";",
"// check if is an index number.",
"// if yes try to lookup the id",
"// by its index.",
"try",
"{",
"var",
"idx",
"=",
"v... | Handler for rollbacks | [
"Handler",
"for",
"rollbacks"
] | 66e6a9fbbf8c7d3a3939bf3d2c69f56e047909d8 | https://github.com/origin1tech/mustr/blob/66e6a9fbbf8c7d3a3939bf3d2c69f56e047909d8/dist/cli.js#L70-L90 |
50,385 | origin1tech/mustr | dist/cli.js | show | function show() {
var parsed = ensureConfig();
function showRollbacks() {
var rollbacks = mu.getRollbacks();
var keys = Object.keys(rollbacks);
var padBtm = [0, 0, 1, 0];
var ui = pargv.ui(105);
var i = keys.length;
var hdrNo = { text: " ", width: 5 };
var... | javascript | function show() {
var parsed = ensureConfig();
function showRollbacks() {
var rollbacks = mu.getRollbacks();
var keys = Object.keys(rollbacks);
var padBtm = [0, 0, 1, 0];
var ui = pargv.ui(105);
var i = keys.length;
var hdrNo = { text: " ", width: 5 };
var... | [
"function",
"show",
"(",
")",
"{",
"var",
"parsed",
"=",
"ensureConfig",
"(",
")",
";",
"function",
"showRollbacks",
"(",
")",
"{",
"var",
"rollbacks",
"=",
"mu",
".",
"getRollbacks",
"(",
")",
";",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"ro... | Handler for show | [
"Handler",
"for",
"show"
] | 66e6a9fbbf8c7d3a3939bf3d2c69f56e047909d8 | https://github.com/origin1tech/mustr/blob/66e6a9fbbf8c7d3a3939bf3d2c69f56e047909d8/dist/cli.js#L92-L128 |
50,386 | syntheticore/declaire | src/clientAuth.js | function(username, pw) {
return _.ajax({
verb: 'POST',
url: '/login',
data: {
username: username,
password: pw
}
}).then(function(id) {
document.cookie = 'user=' + id;
return id;
});
} | javascript | function(username, pw) {
return _.ajax({
verb: 'POST',
url: '/login',
data: {
username: username,
password: pw
}
}).then(function(id) {
document.cookie = 'user=' + id;
return id;
});
} | [
"function",
"(",
"username",
",",
"pw",
")",
"{",
"return",
"_",
".",
"ajax",
"(",
"{",
"verb",
":",
"'POST'",
",",
"url",
":",
"'/login'",
",",
"data",
":",
"{",
"username",
":",
"username",
",",
"password",
":",
"pw",
"}",
"}",
")",
".",
"then"... | Return a promise that resolves to a user ID if authorization was successful | [
"Return",
"a",
"promise",
"that",
"resolves",
"to",
"a",
"user",
"ID",
"if",
"authorization",
"was",
"successful"
] | cb5ea205eeb3aa26fd0c6348e86d840c04e9ba9f | https://github.com/syntheticore/declaire/blob/cb5ea205eeb3aa26fd0c6348e86d840c04e9ba9f/src/clientAuth.js#L6-L18 | |
50,387 | tableflip/uri-to-multiaddr | index.js | multiaddrFromUri | function multiaddrFromUri (uriStr, opts) {
opts = opts || {}
const defaultDnsType = opts.defaultDnsType || 'dns4'
const { scheme, hostname, port } = parseUri(uriStr)
const parts = [
tupleForHostname(hostname, defaultDnsType),
tupleForPort(port, scheme),
tupleForScheme(scheme)
]
const multiaddrSt... | javascript | function multiaddrFromUri (uriStr, opts) {
opts = opts || {}
const defaultDnsType = opts.defaultDnsType || 'dns4'
const { scheme, hostname, port } = parseUri(uriStr)
const parts = [
tupleForHostname(hostname, defaultDnsType),
tupleForPort(port, scheme),
tupleForScheme(scheme)
]
const multiaddrSt... | [
"function",
"multiaddrFromUri",
"(",
"uriStr",
",",
"opts",
")",
"{",
"opts",
"=",
"opts",
"||",
"{",
"}",
"const",
"defaultDnsType",
"=",
"opts",
".",
"defaultDnsType",
"||",
"'dns4'",
"const",
"{",
"scheme",
",",
"hostname",
",",
"port",
"}",
"=",
"par... | Convert a URI to a multiaddr
http://foobar.com => /dns4/foobar.com/tcp/80/http
https://foobar.com => /dns4/foobar.com/tcp/443/https
https://foobar.com:5001 => /dns4/foobar.com/tcp/5001/https
https://127.0.0.1:8080 => /ip4/127.0.0.1/tcp/8080/https
http://[::1]:8080 => /ip6/::1/tcp/8080/http
tcp://foobar.com:8080 => /dn... | [
"Convert",
"a",
"URI",
"to",
"a",
"multiaddr"
] | f92410ebc04f0d46eede7905c06e235f5c698758 | https://github.com/tableflip/uri-to-multiaddr/blob/f92410ebc04f0d46eede7905c06e235f5c698758/index.js#L16-L31 |
50,388 | makanaleu/wmt-marketplace-auth | lib/headers.js | sign | function sign(custom, request) {
/**
* An Epoch timestamp is required for the digital signature.
*/
let epoch = Util.epochInMilliseconds();
/**
* Override the generated Epoch timestamp if a timestamp was included in the
* custom headers.
*/
if (custom.WMSecurity && custom.WMSecu... | javascript | function sign(custom, request) {
/**
* An Epoch timestamp is required for the digital signature.
*/
let epoch = Util.epochInMilliseconds();
/**
* Override the generated Epoch timestamp if a timestamp was included in the
* custom headers.
*/
if (custom.WMSecurity && custom.WMSecu... | [
"function",
"sign",
"(",
"custom",
",",
"request",
")",
"{",
"/**\n * An Epoch timestamp is required for the digital signature.\n */",
"let",
"epoch",
"=",
"Util",
".",
"epochInMilliseconds",
"(",
")",
";",
"/**\n * Override the generated Epoch timestamp if a timestam... | Returns the signed headers required for the API request.
@param custom Walmart authentication headers. Use the custom class to set custom
values to the headers before adding to the request.
@param request The request properties required to generate the digital signature. | [
"Returns",
"the",
"signed",
"headers",
"required",
"for",
"the",
"API",
"request",
"."
] | 1c48336293d52709bdda774ec1158193edf90773 | https://github.com/makanaleu/wmt-marketplace-auth/blob/1c48336293d52709bdda774ec1158193edf90773/lib/headers.js#L58-L95 |
50,389 | makanaleu/wmt-marketplace-auth | lib/headers.js | digitalSignature | function digitalSignature(custom, request, epoch) {
/**
* Node Crypto Sign object that uses the given algorithm.
*
* @see {@link https://nodejs.org/api/crypto.html#crypto_class_sign}
*/
const signer = crypto_1.createSign('RSA-SHA256');
/**
* Walmart API request string to be signed.
... | javascript | function digitalSignature(custom, request, epoch) {
/**
* Node Crypto Sign object that uses the given algorithm.
*
* @see {@link https://nodejs.org/api/crypto.html#crypto_class_sign}
*/
const signer = crypto_1.createSign('RSA-SHA256');
/**
* Walmart API request string to be signed.
... | [
"function",
"digitalSignature",
"(",
"custom",
",",
"request",
",",
"epoch",
")",
"{",
"/**\n * Node Crypto Sign object that uses the given algorithm.\n *\n * @see {@link https://nodejs.org/api/crypto.html#crypto_class_sign}\n */",
"const",
"signer",
"=",
"crypto_1",
".... | Generates the digital signature required for the API request.
@param custom Walmart authentication headers. Use the custom class to set custom
values to the headers before adding to the request.
@param request The request properties required to generate the digital signature.
@param epoch An Epoch timestamp is requ... | [
"Generates",
"the",
"digital",
"signature",
"required",
"for",
"the",
"API",
"request",
"."
] | 1c48336293d52709bdda774ec1158193edf90773 | https://github.com/makanaleu/wmt-marketplace-auth/blob/1c48336293d52709bdda774ec1158193edf90773/lib/headers.js#L105-L127 |
50,390 | andrewscwei/requiem | src/dom/namespace.js | namespace | function namespace(path, scope) {
assertType(path, 'string', true, 'Invalid parameter: path');
assertType(scope, 'object', true, 'Invalid optional parameter: scope');
if (!scope) scope = (window) ? window : {};
if (path === undefined || path === '') return scope;
let groups = path.split('.');
let currentS... | javascript | function namespace(path, scope) {
assertType(path, 'string', true, 'Invalid parameter: path');
assertType(scope, 'object', true, 'Invalid optional parameter: scope');
if (!scope) scope = (window) ? window : {};
if (path === undefined || path === '') return scope;
let groups = path.split('.');
let currentS... | [
"function",
"namespace",
"(",
"path",
",",
"scope",
")",
"{",
"assertType",
"(",
"path",
",",
"'string'",
",",
"true",
",",
"'Invalid parameter: path'",
")",
";",
"assertType",
"(",
"scope",
",",
"'object'",
",",
"true",
",",
"'Invalid optional parameter: scope'... | Generates a nested namespace in the specified scope, as described by the dot-
notated namespace path.
@param {string} [path] - Namespace path with keywords separated by dots.
@param {Object|window} [scope=window|{}] - Scope/object to create the nested
namespace in. If browser
environment is detected, this
param will d... | [
"Generates",
"a",
"nested",
"namespace",
"in",
"the",
"specified",
"scope",
"as",
"described",
"by",
"the",
"dot",
"-",
"notated",
"namespace",
"path",
"."
] | c4182bfffc9841c6de5718f689ad3c2060511777 | https://github.com/andrewscwei/requiem/blob/c4182bfffc9841c6de5718f689ad3c2060511777/src/dom/namespace.js#L23-L38 |
50,391 | tolokoban/ToloFrameWork | lib/boilerplate.view.template.js | isSpecial | function isSpecial( obj, name ) {
if ( !obj ) return false;
if ( typeof obj[ 0 ] !== 'string' ) return false;
if ( typeof name === 'string' ) {
return obj[ 0 ].toLowerCase() === name;
}
return true;
} | javascript | function isSpecial( obj, name ) {
if ( !obj ) return false;
if ( typeof obj[ 0 ] !== 'string' ) return false;
if ( typeof name === 'string' ) {
return obj[ 0 ].toLowerCase() === name;
}
return true;
} | [
"function",
"isSpecial",
"(",
"obj",
",",
"name",
")",
"{",
"if",
"(",
"!",
"obj",
")",
"return",
"false",
";",
"if",
"(",
"typeof",
"obj",
"[",
"0",
"]",
"!==",
"'string'",
")",
"return",
"false",
";",
"if",
"(",
"typeof",
"name",
"===",
"'string'... | An object is special of and only if it's attribute of key "0" is a
string. | [
"An",
"object",
"is",
"special",
"of",
"and",
"only",
"if",
"it",
"s",
"attribute",
"of",
"key",
"0",
"is",
"a",
"string",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/lib/boilerplate.view.template.js#L557-L564 |
50,392 | tolokoban/ToloFrameWork | lib/boilerplate.view.template.js | createSectionStructure | function createSectionStructure() {
return {
init: null,
comments: [],
attribs: {
define: [],
init: []
},
elements: {
define: [],
init: []
},
events: [],
links: [],
ons: [],
statics: []
... | javascript | function createSectionStructure() {
return {
init: null,
comments: [],
attribs: {
define: [],
init: []
},
elements: {
define: [],
init: []
},
events: [],
links: [],
ons: [],
statics: []
... | [
"function",
"createSectionStructure",
"(",
")",
"{",
"return",
"{",
"init",
":",
"null",
",",
"comments",
":",
"[",
"]",
",",
"attribs",
":",
"{",
"define",
":",
"[",
"]",
",",
"init",
":",
"[",
"]",
"}",
",",
"elements",
":",
"{",
"define",
":",
... | Returns the initial content of Template.section.
@returns {object} Initial content of Template.section. | [
"Returns",
"the",
"initial",
"content",
"of",
"Template",
".",
"section",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/lib/boilerplate.view.template.js#L595-L612 |
50,393 | goblindegook/findup-node-modules | index.js | findPath | function findPath(path, directories) {
var cwd = directories[0];
if (!cwd) {
return null;
}
return findup(path, {cwd: cwd}) || findPath(path, slice.call(directories, 1));
} | javascript | function findPath(path, directories) {
var cwd = directories[0];
if (!cwd) {
return null;
}
return findup(path, {cwd: cwd}) || findPath(path, slice.call(directories, 1));
} | [
"function",
"findPath",
"(",
"path",
",",
"directories",
")",
"{",
"var",
"cwd",
"=",
"directories",
"[",
"0",
"]",
";",
"if",
"(",
"!",
"cwd",
")",
"{",
"return",
"null",
";",
"}",
"return",
"findup",
"(",
"path",
",",
"{",
"cwd",
":",
"cwd",
"}... | Find the requested path inside a list of candidate directories.
@param {String} path Path to locate.
@param {Array} directories Array of directories.
@return {String} Located path, or null if not found. | [
"Find",
"the",
"requested",
"path",
"inside",
"a",
"list",
"of",
"candidate",
"directories",
"."
] | 9baecb55c615bd36d804226dc1568218ba059b11 | https://github.com/goblindegook/findup-node-modules/blob/9baecb55c615bd36d804226dc1568218ba059b11/index.js#L14-L22 |
50,394 | tgi-io/tgi-store-local | spec/html-runner.js | log | function log(txt) {
var p = document.createElement("p");
p.style.margin = '2px';
p.style.padding = '1px';
p.style.backgroundColor = "#FFFFF0";
p.style.border = "solid";
p.style.borderWidth = "1px";
p.style.borderColor = "#7F7F8F";
p.style.l... | javascript | function log(txt) {
var p = document.createElement("p");
p.style.margin = '2px';
p.style.padding = '1px';
p.style.backgroundColor = "#FFFFF0";
p.style.border = "solid";
p.style.borderWidth = "1px";
p.style.borderColor = "#7F7F8F";
p.style.l... | [
"function",
"log",
"(",
"txt",
")",
"{",
"var",
"p",
"=",
"document",
".",
"createElement",
"(",
"\"p\"",
")",
";",
"p",
".",
"style",
".",
"margin",
"=",
"'2px'",
";",
"p",
".",
"style",
".",
"padding",
"=",
"'1px'",
";",
"p",
".",
"style",
".",... | DOM rendering functions | [
"DOM",
"rendering",
"functions"
] | e046eb06c1b2f9594988ecbad184d94176d267ae | https://github.com/tgi-io/tgi-store-local/blob/e046eb06c1b2f9594988ecbad184d94176d267ae/spec/html-runner.js#L33-L44 |
50,395 | nbrownus/ppunit | lib/reporters/Dependencies.js | function (ppunit, writer) {
Dependencies.super_.call(this, ppunit, writer)
var self = this
self.subGraphs = []
ppunit.on('start', function () {
writer.write('digraph PPUnit {')
self.printNodes()
self.printSubGraphs()
self.printDependencies()
writer.write('}')
... | javascript | function (ppunit, writer) {
Dependencies.super_.call(this, ppunit, writer)
var self = this
self.subGraphs = []
ppunit.on('start', function () {
writer.write('digraph PPUnit {')
self.printNodes()
self.printSubGraphs()
self.printDependencies()
writer.write('}')
... | [
"function",
"(",
"ppunit",
",",
"writer",
")",
"{",
"Dependencies",
".",
"super_",
".",
"call",
"(",
"this",
",",
"ppunit",
",",
"writer",
")",
"var",
"self",
"=",
"this",
"self",
".",
"subGraphs",
"=",
"[",
"]",
"ppunit",
".",
"on",
"(",
"'start'",
... | Outputs graphviz dot notation of the test dependency graph
@param {PPUnit} ppunit PPUnit instance
@param {Object} writer An object that has a write method
@param {function} writer.write A method that writes the output
@constructor | [
"Outputs",
"graphviz",
"dot",
"notation",
"of",
"the",
"test",
"dependency",
"graph"
] | dcce602497d9548ce9085a8db115e65561dcc3de | https://github.com/nbrownus/ppunit/blob/dcce602497d9548ce9085a8db115e65561dcc3de/lib/reporters/Dependencies.js#L14-L27 | |
50,396 | icelab/attache-upload.js | lib/index.js | abortXHRRequest | function abortXHRRequest(uid, fn) {
if (reqs.hasOwnProperty(uid)) {
if (!reqs[uid]) return;
if (fn) {
fn();
} else {
reqs[uid].abort();
}
delete reqs[uid];
return reqs;
}
} | javascript | function abortXHRRequest(uid, fn) {
if (reqs.hasOwnProperty(uid)) {
if (!reqs[uid]) return;
if (fn) {
fn();
} else {
reqs[uid].abort();
}
delete reqs[uid];
return reqs;
}
} | [
"function",
"abortXHRRequest",
"(",
"uid",
",",
"fn",
")",
"{",
"if",
"(",
"reqs",
".",
"hasOwnProperty",
"(",
"uid",
")",
")",
"{",
"if",
"(",
"!",
"reqs",
"[",
"uid",
"]",
")",
"return",
";",
"if",
"(",
"fn",
")",
"{",
"fn",
"(",
")",
";",
... | abortXHRRequest
Abort a XHR request by 'uid'
@param {String} uid
@param {Function} optional function
@return {Object} | [
"abortXHRRequest",
"Abort",
"a",
"XHR",
"request",
"by",
"uid"
] | ff40a9d8caa45c53e147c810dc7449de685fcaf4 | https://github.com/icelab/attache-upload.js/blob/ff40a9d8caa45c53e147c810dc7449de685fcaf4/lib/index.js#L62-L74 |
50,397 | icelab/attache-upload.js | lib/index.js | customError | function customError(name, error) {
return {
error: error,
message: error.message,
name: name
};
} | javascript | function customError(name, error) {
return {
error: error,
message: error.message,
name: name
};
} | [
"function",
"customError",
"(",
"name",
",",
"error",
")",
"{",
"return",
"{",
"error",
":",
"error",
",",
"message",
":",
"error",
".",
"message",
",",
"name",
":",
"name",
"}",
";",
"}"
] | customError
return an object forming a custom error message
@param {String} name
@param {Object} error
@return {Object} | [
"customError",
"return",
"an",
"object",
"forming",
"a",
"custom",
"error",
"message"
] | ff40a9d8caa45c53e147c810dc7449de685fcaf4 | https://github.com/icelab/attache-upload.js/blob/ff40a9d8caa45c53e147c810dc7449de685fcaf4/lib/index.js#L84-L90 |
50,398 | icelab/attache-upload.js | lib/index.js | responseStatus | function responseStatus(res) {
if (res.status >= 200 && res.status < 300) {
return res;
} else {
var error = new Error(res.statusText);
error.response = res;
throw customError('responseStatus', error);
}
} | javascript | function responseStatus(res) {
if (res.status >= 200 && res.status < 300) {
return res;
} else {
var error = new Error(res.statusText);
error.response = res;
throw customError('responseStatus', error);
}
} | [
"function",
"responseStatus",
"(",
"res",
")",
"{",
"if",
"(",
"res",
".",
"status",
">=",
"200",
"&&",
"res",
".",
"status",
"<",
"300",
")",
"{",
"return",
"res",
";",
"}",
"else",
"{",
"var",
"error",
"=",
"new",
"Error",
"(",
"res",
".",
"sta... | responseStatus
take a response and check the response `status` property
if between 200-300 return the response object
else throw a custom error
@param {Object} res
@return {Object} | [
"responseStatus",
"take",
"a",
"response",
"and",
"check",
"the",
"response",
"status",
"property",
"if",
"between",
"200",
"-",
"300",
"return",
"the",
"response",
"object",
"else",
"throw",
"a",
"custom",
"error"
] | ff40a9d8caa45c53e147c810dc7449de685fcaf4 | https://github.com/icelab/attache-upload.js/blob/ff40a9d8caa45c53e147c810dc7449de685fcaf4/lib/index.js#L101-L109 |
50,399 | icelab/attache-upload.js | lib/index.js | buildUploadURL | function buildUploadURL(url, uuid, expiration, hmac, filename) {
return url + '?uuid=' + uuid + '&expiration=' + expiration + '&hmac=' + hmac + '&file=' + filename;
} | javascript | function buildUploadURL(url, uuid, expiration, hmac, filename) {
return url + '?uuid=' + uuid + '&expiration=' + expiration + '&hmac=' + hmac + '&file=' + filename;
} | [
"function",
"buildUploadURL",
"(",
"url",
",",
"uuid",
",",
"expiration",
",",
"hmac",
",",
"filename",
")",
"{",
"return",
"url",
"+",
"'?uuid='",
"+",
"uuid",
"+",
"'&expiration='",
"+",
"expiration",
"+",
"'&hmac='",
"+",
"hmac",
"+",
"'&file='",
"+",
... | buildUploadURL
Construct a string using params
@param {String} url
@param {String} uuid
@param {String} expiration
@param {String} hmac
@param {String} filename
@return {String} | [
"buildUploadURL",
"Construct",
"a",
"string",
"using",
"params"
] | ff40a9d8caa45c53e147c810dc7449de685fcaf4 | https://github.com/icelab/attache-upload.js/blob/ff40a9d8caa45c53e147c810dc7449de685fcaf4/lib/index.js#L133-L135 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.