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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
44,800 | Kawba/MoLIR | molir.js | returnRankedIntents | function returnRankedIntents(input, intents) {
return new Promise((resolve, reject) => {
let lowerCase = input.toLowerCase();
let totalScore = 0;
//loop through all loaded intents
intents.forEach((intent) => {
intent.score = 0;
intent.utterences.forEach((utte... | javascript | function returnRankedIntents(input, intents) {
return new Promise((resolve, reject) => {
let lowerCase = input.toLowerCase();
let totalScore = 0;
//loop through all loaded intents
intents.forEach((intent) => {
intent.score = 0;
intent.utterences.forEach((utte... | [
"function",
"returnRankedIntents",
"(",
"input",
",",
"intents",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"let",
"lowerCase",
"=",
"input",
".",
"toLowerCase",
"(",
")",
";",
"let",
"totalScore",
"=",
"0",... | Function to classify input based on loaded intents | [
"Function",
"to",
"classify",
"input",
"based",
"on",
"loaded",
"intents"
] | f235a565854e6d20ad8fc064022434b0d6a6718e | https://github.com/Kawba/MoLIR/blob/f235a565854e6d20ad8fc064022434b0d6a6718e/molir.js#L37-L91 |
44,801 | bonesoul/node-hpool-web | public/js/plugins/iCheck/icheck.js | operate | function operate(input, direct, method) {
var node = input[0],
state = /er/.test(method) ? _indeterminate : /bl/.test(method) ? _disabled : _checked,
active = method == _update ? {
checked: node[_checked],
disabled: node[_disabled],
indeterminate: input.attr(_indeterminate) == 't... | javascript | function operate(input, direct, method) {
var node = input[0],
state = /er/.test(method) ? _indeterminate : /bl/.test(method) ? _disabled : _checked,
active = method == _update ? {
checked: node[_checked],
disabled: node[_disabled],
indeterminate: input.attr(_indeterminate) == 't... | [
"function",
"operate",
"(",
"input",
",",
"direct",
",",
"method",
")",
"{",
"var",
"node",
"=",
"input",
"[",
"0",
"]",
",",
"state",
"=",
"/",
"er",
"/",
".",
"test",
"(",
"method",
")",
"?",
"_indeterminate",
":",
"/",
"bl",
"/",
".",
"test",
... | Do something with inputs | [
"Do",
"something",
"with",
"inputs"
] | 3d7749b2bcff8b59243939b5b3da19396c4878ff | https://github.com/bonesoul/node-hpool-web/blob/3d7749b2bcff8b59243939b5b3da19396c4878ff/public/js/plugins/iCheck/icheck.js#L309-L354 |
44,802 | bonesoul/node-hpool-web | public/js/plugins/iCheck/icheck.js | on | function on(input, state, keep) {
var node = input[0],
parent = input.parent(),
checked = state == _checked,
indeterminate = state == _indeterminate,
disabled = state == _disabled,
callback = indeterminate ? _determinate : checked ? _unchecked : 'enabled',
regular = option(input,... | javascript | function on(input, state, keep) {
var node = input[0],
parent = input.parent(),
checked = state == _checked,
indeterminate = state == _indeterminate,
disabled = state == _disabled,
callback = indeterminate ? _determinate : checked ? _unchecked : 'enabled',
regular = option(input,... | [
"function",
"on",
"(",
"input",
",",
"state",
",",
"keep",
")",
"{",
"var",
"node",
"=",
"input",
"[",
"0",
"]",
",",
"parent",
"=",
"input",
".",
"parent",
"(",
")",
",",
"checked",
"=",
"state",
"==",
"_checked",
",",
"indeterminate",
"=",
"state... | Add checked, disabled or indeterminate state | [
"Add",
"checked",
"disabled",
"or",
"indeterminate",
"state"
] | 3d7749b2bcff8b59243939b5b3da19396c4878ff | https://github.com/bonesoul/node-hpool-web/blob/3d7749b2bcff8b59243939b5b3da19396c4878ff/public/js/plugins/iCheck/icheck.js#L357-L426 |
44,803 | bonesoul/node-hpool-web | public/js/plugins/iCheck/icheck.js | off | function off(input, state, keep) {
var node = input[0],
parent = input.parent(),
checked = state == _checked,
indeterminate = state == _indeterminate,
disabled = state == _disabled,
callback = indeterminate ? _determinate : checked ? _unchecked : 'enabled',
regular = option(input... | javascript | function off(input, state, keep) {
var node = input[0],
parent = input.parent(),
checked = state == _checked,
indeterminate = state == _indeterminate,
disabled = state == _disabled,
callback = indeterminate ? _determinate : checked ? _unchecked : 'enabled',
regular = option(input... | [
"function",
"off",
"(",
"input",
",",
"state",
",",
"keep",
")",
"{",
"var",
"node",
"=",
"input",
"[",
"0",
"]",
",",
"parent",
"=",
"input",
".",
"parent",
"(",
")",
",",
"checked",
"=",
"state",
"==",
"_checked",
",",
"indeterminate",
"=",
"stat... | Remove checked, disabled or indeterminate state | [
"Remove",
"checked",
"disabled",
"or",
"indeterminate",
"state"
] | 3d7749b2bcff8b59243939b5b3da19396c4878ff | https://github.com/bonesoul/node-hpool-web/blob/3d7749b2bcff8b59243939b5b3da19396c4878ff/public/js/plugins/iCheck/icheck.js#L429-L464 |
44,804 | bonesoul/node-hpool-web | public/js/plugins/iCheck/icheck.js | tidy | function tidy(input, callback) {
if (input.data(_iCheck)) {
// Remove everything except input
input.parent().html(input.attr('style', input.data(_iCheck).s || ''));
// Callback
if (callback) {
input[_callback](callback);
};
// Unbind events
input.off('.i').unwrap... | javascript | function tidy(input, callback) {
if (input.data(_iCheck)) {
// Remove everything except input
input.parent().html(input.attr('style', input.data(_iCheck).s || ''));
// Callback
if (callback) {
input[_callback](callback);
};
// Unbind events
input.off('.i').unwrap... | [
"function",
"tidy",
"(",
"input",
",",
"callback",
")",
"{",
"if",
"(",
"input",
".",
"data",
"(",
"_iCheck",
")",
")",
"{",
"// Remove everything except input",
"input",
".",
"parent",
"(",
")",
".",
"html",
"(",
"input",
".",
"attr",
"(",
"'style'",
... | Remove all traces | [
"Remove",
"all",
"traces"
] | 3d7749b2bcff8b59243939b5b3da19396c4878ff | https://github.com/bonesoul/node-hpool-web/blob/3d7749b2bcff8b59243939b5b3da19396c4878ff/public/js/plugins/iCheck/icheck.js#L467-L482 |
44,805 | bonesoul/node-hpool-web | public/js/plugins/iCheck/icheck.js | option | function option(input, state, regular) {
if (input.data(_iCheck)) {
return input.data(_iCheck).o[state + (regular ? '' : 'Class')];
};
} | javascript | function option(input, state, regular) {
if (input.data(_iCheck)) {
return input.data(_iCheck).o[state + (regular ? '' : 'Class')];
};
} | [
"function",
"option",
"(",
"input",
",",
"state",
",",
"regular",
")",
"{",
"if",
"(",
"input",
".",
"data",
"(",
"_iCheck",
")",
")",
"{",
"return",
"input",
".",
"data",
"(",
"_iCheck",
")",
".",
"o",
"[",
"state",
"+",
"(",
"regular",
"?",
"''... | Get some option | [
"Get",
"some",
"option"
] | 3d7749b2bcff8b59243939b5b3da19396c4878ff | https://github.com/bonesoul/node-hpool-web/blob/3d7749b2bcff8b59243939b5b3da19396c4878ff/public/js/plugins/iCheck/icheck.js#L485-L489 |
44,806 | onecommons/base | public/js/data.js | ajaxCallback | function ajaxCallback(data, textStatus) {
//responses should be a list of successful responses
//if any request failed it *may or may not* be an http-level error
//depending on server-side implementation
// konsole.log("datarequest", data, textStatus, 'dbdata.'+txnId, comm... | javascript | function ajaxCallback(data, textStatus) {
//responses should be a list of successful responses
//if any request failed it *may or may not* be an http-level error
//depending on server-side implementation
// konsole.log("datarequest", data, textStatus, 'dbdata.'+txnId, comm... | [
"function",
"ajaxCallback",
"(",
"data",
",",
"textStatus",
")",
"{",
"//responses should be a list of successful responses",
"//if any request failed it *may or may not* be an http-level error",
"//depending on server-side implementation",
"// konsole.log(\"datarequest\", data, textStatus, 'd... | var clientErrorMsg = this.clientErrorMsg; | [
"var",
"clientErrorMsg",
"=",
"this",
".",
"clientErrorMsg",
";"
] | 4f35d9f714d0367b0622a3504802363404290246 | https://github.com/onecommons/base/blob/4f35d9f714d0367b0622a3504802363404290246/public/js/data.js#L188-L221 |
44,807 | onecommons/base | public/js/data.js | function( obj ) {
var accessor = this._getAccessor( obj );
var seen = {};
for( var i = 0; i < this.form.elements.length; i++) {
this.serializeField( this.form.elements[i], accessor, seen);
}
return accessor.target;
} | javascript | function( obj ) {
var accessor = this._getAccessor( obj );
var seen = {};
for( var i = 0; i < this.form.elements.length; i++) {
this.serializeField( this.form.elements[i], accessor, seen);
}
return accessor.target;
} | [
"function",
"(",
"obj",
")",
"{",
"var",
"accessor",
"=",
"this",
".",
"_getAccessor",
"(",
"obj",
")",
";",
"var",
"seen",
"=",
"{",
"}",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"form",
".",
"elements",
".",
"length"... | set the obj with form's current values | [
"set",
"the",
"obj",
"with",
"form",
"s",
"current",
"values"
] | 4f35d9f714d0367b0622a3504802363404290246 | https://github.com/onecommons/base/blob/4f35d9f714d0367b0622a3504802363404290246/public/js/data.js#L1030-L1037 | |
44,808 | onecommons/base | public/js/data.js | function( obj ) { //set form html
var accessor = this._getAccessor( obj );
for( var i = 0; i < this.form.elements.length; i++) {
this.deserializeField( this.form.elements[i], accessor );
}
return accessor.target;
} | javascript | function( obj ) { //set form html
var accessor = this._getAccessor( obj );
for( var i = 0; i < this.form.elements.length; i++) {
this.deserializeField( this.form.elements[i], accessor );
}
return accessor.target;
} | [
"function",
"(",
"obj",
")",
"{",
"//set form html",
"var",
"accessor",
"=",
"this",
".",
"_getAccessor",
"(",
"obj",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"form",
".",
"elements",
".",
"length",
";",
"i",
"++",
... | update the form with the object | [
"update",
"the",
"form",
"with",
"the",
"object"
] | 4f35d9f714d0367b0622a3504802363404290246 | https://github.com/onecommons/base/blob/4f35d9f714d0367b0622a3504802363404290246/public/js/data.js#L1142-L1148 | |
44,809 | onecommons/base | public/js/data.js | function( element, obj ) {
var accessor = this._getAccessor( obj );
var value = accessor.get( element.name || '');
value = this._format( element.name, value, element );
if( element.type == "radio" || element.type == "checkbox" ) {
element.checked = this._isSelected( element.value, value );
} ... | javascript | function( element, obj ) {
var accessor = this._getAccessor( obj );
var value = accessor.get( element.name || '');
value = this._format( element.name, value, element );
if( element.type == "radio" || element.type == "checkbox" ) {
element.checked = this._isSelected( element.value, value );
} ... | [
"function",
"(",
"element",
",",
"obj",
")",
"{",
"var",
"accessor",
"=",
"this",
".",
"_getAccessor",
"(",
"obj",
")",
";",
"var",
"value",
"=",
"accessor",
".",
"get",
"(",
"element",
".",
"name",
"||",
"''",
")",
";",
"value",
"=",
"this",
".",
... | update the form field with the property value | [
"update",
"the",
"form",
"field",
"with",
"the",
"property",
"value"
] | 4f35d9f714d0367b0622a3504802363404290246 | https://github.com/onecommons/base/blob/4f35d9f714d0367b0622a3504802363404290246/public/js/data.js#L1151-L1168 | |
44,810 | feedhenry/fh-mbaas-client | lib/app/appforms/submissions.js | uploadSubmissionFile | function uploadSubmissionFile(params, cb) {
var resourcePath = config.addURIParams("/appforms/submissions/:id/fields/:fieldId/files/:fileId", params);
var method = "POST";
var data = params.fileDetails;
params.resourcePath = resourcePath;
params.method = method;
params.data = data;
//Flagging This Reque... | javascript | function uploadSubmissionFile(params, cb) {
var resourcePath = config.addURIParams("/appforms/submissions/:id/fields/:fieldId/files/:fileId", params);
var method = "POST";
var data = params.fileDetails;
params.resourcePath = resourcePath;
params.method = method;
params.data = data;
//Flagging This Reque... | [
"function",
"uploadSubmissionFile",
"(",
"params",
",",
"cb",
")",
"{",
"var",
"resourcePath",
"=",
"config",
".",
"addURIParams",
"(",
"\"/appforms/submissions/:id/fields/:fieldId/files/:fileId\"",
",",
"params",
")",
";",
"var",
"method",
"=",
"\"POST\"",
";",
"va... | Upload A File Associated With A Submission | [
"Upload",
"A",
"File",
"Associated",
"With",
"A",
"Submission"
] | 2d5a9cbb32e1b2464d71ffa18513358fea388859 | https://github.com/feedhenry/fh-mbaas-client/blob/2d5a9cbb32e1b2464d71ffa18513358fea388859/lib/app/appforms/submissions.js#L38-L52 |
44,811 | feedhenry/fh-mbaas-client | lib/app/appforms/submissions.js | getSubmissionStatus | function getSubmissionStatus(params, cb) {
var resourcePath = config.addURIParams("/appforms/submissions/:id/status", params);
var method = "GET";
var data = {};
params.resourcePath = resourcePath;
params.method = method;
params.data = data;
//Flagging This Request As A File Request
params.fileRequest... | javascript | function getSubmissionStatus(params, cb) {
var resourcePath = config.addURIParams("/appforms/submissions/:id/status", params);
var method = "GET";
var data = {};
params.resourcePath = resourcePath;
params.method = method;
params.data = data;
//Flagging This Request As A File Request
params.fileRequest... | [
"function",
"getSubmissionStatus",
"(",
"params",
",",
"cb",
")",
"{",
"var",
"resourcePath",
"=",
"config",
".",
"addURIParams",
"(",
"\"/appforms/submissions/:id/status\"",
",",
"params",
")",
";",
"var",
"method",
"=",
"\"GET\"",
";",
"var",
"data",
"=",
"{... | Get The Current Status Of A Submission | [
"Get",
"The",
"Current",
"Status",
"Of",
"A",
"Submission"
] | 2d5a9cbb32e1b2464d71ffa18513358fea388859 | https://github.com/feedhenry/fh-mbaas-client/blob/2d5a9cbb32e1b2464d71ffa18513358fea388859/lib/app/appforms/submissions.js#L73-L86 |
44,812 | feedhenry/fh-mbaas-client | lib/app/appforms/submissions.js | exportCSV | function exportCSV(params, cb) {
var resourcePath = config.addURIParams("/appforms/submissions/export", params);
var method = "POST";
var data = params.queryParams;
params.resourcePath = resourcePath;
params.method = method;
params.data = data;
params.fileRequest = true;
mbaasRequest.app(params, cb);... | javascript | function exportCSV(params, cb) {
var resourcePath = config.addURIParams("/appforms/submissions/export", params);
var method = "POST";
var data = params.queryParams;
params.resourcePath = resourcePath;
params.method = method;
params.data = data;
params.fileRequest = true;
mbaasRequest.app(params, cb);... | [
"function",
"exportCSV",
"(",
"params",
",",
"cb",
")",
"{",
"var",
"resourcePath",
"=",
"config",
".",
"addURIParams",
"(",
"\"/appforms/submissions/export\"",
",",
"params",
")",
";",
"var",
"method",
"=",
"\"POST\"",
";",
"var",
"data",
"=",
"params",
"."... | Export Submissions As A Zip File Containing CSVs.
@param params
@param cb | [
"Export",
"Submissions",
"As",
"A",
"Zip",
"File",
"Containing",
"CSVs",
"."
] | 2d5a9cbb32e1b2464d71ffa18513358fea388859 | https://github.com/feedhenry/fh-mbaas-client/blob/2d5a9cbb32e1b2464d71ffa18513358fea388859/lib/app/appforms/submissions.js#L152-L164 |
44,813 | eHealthAfrica/data-models-deprecated | index.js | validate | function validate(candidate) {
if (candidate.doc_type) {
var schema = schemasDeepCopy()[candidate.doc_type];
validator.validate(candidate, schema);
var errors = validator.getLastErrors();
return errors;
}
return [{
dataModel: 'the object to be validated is missing a `doc_type` property'
}];... | javascript | function validate(candidate) {
if (candidate.doc_type) {
var schema = schemasDeepCopy()[candidate.doc_type];
validator.validate(candidate, schema);
var errors = validator.getLastErrors();
return errors;
}
return [{
dataModel: 'the object to be validated is missing a `doc_type` property'
}];... | [
"function",
"validate",
"(",
"candidate",
")",
"{",
"if",
"(",
"candidate",
".",
"doc_type",
")",
"{",
"var",
"schema",
"=",
"schemasDeepCopy",
"(",
")",
"[",
"candidate",
".",
"doc_type",
"]",
";",
"validator",
".",
"validate",
"(",
"candidate",
",",
"s... | Thin wrapper to make validation more convenient
@param {Object} candidate A model instance to validate
@return {[Error]} A list of errors or null | [
"Thin",
"wrapper",
"to",
"make",
"validation",
"more",
"convenient"
] | 93da821ed51f79b9b0411969b7721b49c7089890 | https://github.com/eHealthAfrica/data-models-deprecated/blob/93da821ed51f79b9b0411969b7721b49c7089890/index.js#L47-L58 |
44,814 | eHealthAfrica/data-models-deprecated | index.js | generate | function generate(model, count) {
count = count || 1;
var registry = {};
var models = [];
if (model) {
models = typeof model === 'string' ? [model] : model;
} else {
models = Object.keys(schemas);
}
function build(model) {
var instance = jsf(schemas[model]);
var invalid = validate(instan... | javascript | function generate(model, count) {
count = count || 1;
var registry = {};
var models = [];
if (model) {
models = typeof model === 'string' ? [model] : model;
} else {
models = Object.keys(schemas);
}
function build(model) {
var instance = jsf(schemas[model]);
var invalid = validate(instan... | [
"function",
"generate",
"(",
"model",
",",
"count",
")",
"{",
"count",
"=",
"count",
"||",
"1",
";",
"var",
"registry",
"=",
"{",
"}",
";",
"var",
"models",
"=",
"[",
"]",
";",
"if",
"(",
"model",
")",
"{",
"models",
"=",
"typeof",
"model",
"==="... | Generate instances populated with pseudo random data
@param {(String|[String])} model An optional model or list of models
@param {Number} count An optional number of instances to generate
@return {Object} A map of model-instances | [
"Generate",
"instances",
"populated",
"with",
"pseudo",
"random",
"data"
] | 93da821ed51f79b9b0411969b7721b49c7089890 | https://github.com/eHealthAfrica/data-models-deprecated/blob/93da821ed51f79b9b0411969b7721b49c7089890/index.js#L67-L99 |
44,815 | KTH/kth-node-server | index.js | serverClose | function serverClose (signal, done) {
_logger.info('Process received ' + signal + ', exiting ....')
if (done === undefined) {
done = function () {
process.exit(0)
}
}
if (server) {
server.close(done)
} else {
done()
}
} | javascript | function serverClose (signal, done) {
_logger.info('Process received ' + signal + ', exiting ....')
if (done === undefined) {
done = function () {
process.exit(0)
}
}
if (server) {
server.close(done)
} else {
done()
}
} | [
"function",
"serverClose",
"(",
"signal",
",",
"done",
")",
"{",
"_logger",
".",
"info",
"(",
"'Process received '",
"+",
"signal",
"+",
"', exiting ....'",
")",
"if",
"(",
"done",
"===",
"undefined",
")",
"{",
"done",
"=",
"function",
"(",
")",
"{",
"pr... | Closing the server
@param signal the log message depending on the given signal. | [
"Closing",
"the",
"server"
] | 0880a801c3d0298258084ba830929c9798e2275c | https://github.com/KTH/kth-node-server/blob/0880a801c3d0298258084ba830929c9798e2275c/index.js#L17-L29 |
44,816 | nodejitsu/contour | pagelets/nodejitsu/anchor/base.js | scroll | function scroll(e) {
var attr = e.element.attributes;
if (!(attr || attr.href)) return;
var target = $(attr.href.value).plain(0);
if (!target) return;
e.preventDefault();
//
// Store the current window top Y and difference.
//
this.y = document.body.scrollTop;
this.target = ta... | javascript | function scroll(e) {
var attr = e.element.attributes;
if (!(attr || attr.href)) return;
var target = $(attr.href.value).plain(0);
if (!target) return;
e.preventDefault();
//
// Store the current window top Y and difference.
//
this.y = document.body.scrollTop;
this.target = ta... | [
"function",
"scroll",
"(",
"e",
")",
"{",
"var",
"attr",
"=",
"e",
".",
"element",
".",
"attributes",
";",
"if",
"(",
"!",
"(",
"attr",
"||",
"attr",
".",
"href",
")",
")",
"return",
";",
"var",
"target",
"=",
"$",
"(",
"attr",
".",
"href",
"."... | Scroll to the target of data-scroll.
@param {Event} e
@api private | [
"Scroll",
"to",
"the",
"target",
"of",
"data",
"-",
"scroll",
"."
] | 0828e9bd25ef1eeb97ea231c447118d9867021b6 | https://github.com/nodejitsu/contour/blob/0828e9bd25ef1eeb97ea231c447118d9867021b6/pagelets/nodejitsu/anchor/base.js#L33-L54 |
44,817 | nodejitsu/contour | pagelets/nodejitsu/anchor/base.js | animate | function animate() {
var diff = this.speed;
//
// If we're getting close to the endpoint stop at 0.
//
if (this.delta < diff) {
clearInterval(this.animated);
diff = this.delta;
}
//
// Keep track of how much is scrolled.
//
this.delta = this.delta - diff;
this.y... | javascript | function animate() {
var diff = this.speed;
//
// If we're getting close to the endpoint stop at 0.
//
if (this.delta < diff) {
clearInterval(this.animated);
diff = this.delta;
}
//
// Keep track of how much is scrolled.
//
this.delta = this.delta - diff;
this.y... | [
"function",
"animate",
"(",
")",
"{",
"var",
"diff",
"=",
"this",
".",
"speed",
";",
"//",
"// If we're getting close to the endpoint stop at 0.",
"//",
"if",
"(",
"this",
".",
"delta",
"<",
"diff",
")",
"{",
"clearInterval",
"(",
"this",
".",
"animated",
")... | Calculations for the animation.
@api private | [
"Calculations",
"for",
"the",
"animation",
"."
] | 0828e9bd25ef1eeb97ea231c447118d9867021b6 | https://github.com/nodejitsu/contour/blob/0828e9bd25ef1eeb97ea231c447118d9867021b6/pagelets/nodejitsu/anchor/base.js#L61-L82 |
44,818 | writetome51/array-has | dist/privy/arrayHasAdjacent.js | arrayHasAdjacent | function arrayHasAdjacent(values, array) {
error_if_not_array_1.errorIfNotArray(values);
if (is_empty_not_empty_1.isEmpty(values))
return false;
var indexes = array_get_indexes_1.getIndexesOf(values[0], array);
var i = -1;
while (++i < indexes.length) {
if (indexes[i] + values.length... | javascript | function arrayHasAdjacent(values, array) {
error_if_not_array_1.errorIfNotArray(values);
if (is_empty_not_empty_1.isEmpty(values))
return false;
var indexes = array_get_indexes_1.getIndexesOf(values[0], array);
var i = -1;
while (++i < indexes.length) {
if (indexes[i] + values.length... | [
"function",
"arrayHasAdjacent",
"(",
"values",
",",
"array",
")",
"{",
"error_if_not_array_1",
".",
"errorIfNotArray",
"(",
"values",
")",
";",
"if",
"(",
"is_empty_not_empty_1",
".",
"isEmpty",
"(",
"values",
")",
")",
"return",
"false",
";",
"var",
"indexes"... | Checks if array contains adjacent values anywhere inside it. values cannot contain object. | [
"Checks",
"if",
"array",
"contains",
"adjacent",
"values",
"anywhere",
"inside",
"it",
".",
"values",
"cannot",
"contain",
"object",
"."
] | 8ced3fda5818940b814bbcdc37e03c65f285a965 | https://github.com/writetome51/array-has/blob/8ced3fda5818940b814bbcdc37e03c65f285a965/dist/privy/arrayHasAdjacent.js#L10-L24 |
44,819 | haraldrudell/nodegod | lib/appentity.js | restartAppFromWatching | function restartAppFromWatching(err) {
updateWatcherCount()
if (err) self.emit('error', err)
if (dashboard.state !== 'stop') {
log('Restarting ' + conf.name + ' due to file watch trigger')
appLink.afterThat('restart')
} else log('Watcher restart ignored in stop state')
} | javascript | function restartAppFromWatching(err) {
updateWatcherCount()
if (err) self.emit('error', err)
if (dashboard.state !== 'stop') {
log('Restarting ' + conf.name + ' due to file watch trigger')
appLink.afterThat('restart')
} else log('Watcher restart ignored in stop state')
} | [
"function",
"restartAppFromWatching",
"(",
"err",
")",
"{",
"updateWatcherCount",
"(",
")",
"if",
"(",
"err",
")",
"self",
".",
"emit",
"(",
"'error'",
",",
"err",
")",
"if",
"(",
"dashboard",
".",
"state",
"!==",
"'stop'",
")",
"{",
"log",
"(",
"'Rest... | restart due to file change or copy change | [
"restart",
"due",
"to",
"file",
"change",
"or",
"copy",
"change"
] | 3be4fb280fb18e0ec0a1c1a8fea3254d92f00b21 | https://github.com/haraldrudell/nodegod/blob/3be4fb280fb18e0ec0a1c1a8fea3254d92f00b21/lib/appentity.js#L165-L172 |
44,820 | jldec/pub-generator | render.js | renderTemplate | function renderTemplate(fragment, templateName) {
if (templateName === 'none') return fragment._txt;
var t = generator.template$[templateName];
if (!t) {
log('Unknown template %s for %s, using default.', templateName, fragment._href);
t = generator.template$.default;
}
var out;
try ... | javascript | function renderTemplate(fragment, templateName) {
if (templateName === 'none') return fragment._txt;
var t = generator.template$[templateName];
if (!t) {
log('Unknown template %s for %s, using default.', templateName, fragment._href);
t = generator.template$.default;
}
var out;
try ... | [
"function",
"renderTemplate",
"(",
"fragment",
",",
"templateName",
")",
"{",
"if",
"(",
"templateName",
"===",
"'none'",
")",
"return",
"fragment",
".",
"_txt",
";",
"var",
"t",
"=",
"generator",
".",
"template$",
"[",
"templateName",
"]",
";",
"if",
"(",... | template renderer handles missing template and template runtime errors | [
"template",
"renderer",
"handles",
"missing",
"template",
"and",
"template",
"runtime",
"errors"
] | 524081509921ac8cb897753142324d61e10afdf3 | https://github.com/jldec/pub-generator/blob/524081509921ac8cb897753142324d61e10afdf3/render.js#L79-L97 |
44,821 | jldec/pub-generator | render.js | renderPage | function renderPage(page) {
var template = pageTemplate(page);
var html = renderTemplate(page, template);
return '<div data-render-page="' + esc(template) + '">' + html + '</div>';
} | javascript | function renderPage(page) {
var template = pageTemplate(page);
var html = renderTemplate(page, template);
return '<div data-render-page="' + esc(template) + '">' + html + '</div>';
} | [
"function",
"renderPage",
"(",
"page",
")",
"{",
"var",
"template",
"=",
"pageTemplate",
"(",
"page",
")",
";",
"var",
"html",
"=",
"renderTemplate",
"(",
"page",
",",
"template",
")",
";",
"return",
"'<div data-render-page=\"'",
"+",
"esc",
"(",
"template",... | render a page with a non-layout page-specific template this provides the primary mode of offline navigation on sites with a single layout this function always wraps in marker divs | [
"render",
"a",
"page",
"with",
"a",
"non",
"-",
"layout",
"page",
"-",
"specific",
"template",
"this",
"provides",
"the",
"primary",
"mode",
"of",
"offline",
"navigation",
"on",
"sites",
"with",
"a",
"single",
"layout",
"this",
"function",
"always",
"wraps",... | 524081509921ac8cb897753142324d61e10afdf3 | https://github.com/jldec/pub-generator/blob/524081509921ac8cb897753142324d61e10afdf3/render.js#L124-L128 |
44,822 | jldec/pub-generator | render.js | docTemplate | function docTemplate(page) {
return page.doclayout ||
(page.notemplate && 'none') ||
(page.nolayout && page.template) ||
(generator.template$['doc-layout'] && 'doc-layout') ||
layoutTemplate(page);
} | javascript | function docTemplate(page) {
return page.doclayout ||
(page.notemplate && 'none') ||
(page.nolayout && page.template) ||
(generator.template$['doc-layout'] && 'doc-layout') ||
layoutTemplate(page);
} | [
"function",
"docTemplate",
"(",
"page",
")",
"{",
"return",
"page",
".",
"doclayout",
"||",
"(",
"page",
".",
"notemplate",
"&&",
"'none'",
")",
"||",
"(",
"page",
".",
"nolayout",
"&&",
"page",
".",
"template",
")",
"||",
"(",
"generator",
".",
"templ... | return name of document template for a page delegate to layoutTemplate if site has no doc template page.notemplate bypasses default templates and returns literal text | [
"return",
"name",
"of",
"document",
"template",
"for",
"a",
"page",
"delegate",
"to",
"layoutTemplate",
"if",
"site",
"has",
"no",
"doc",
"template",
"page",
".",
"notemplate",
"bypasses",
"default",
"templates",
"and",
"returns",
"literal",
"text"
] | 524081509921ac8cb897753142324d61e10afdf3 | https://github.com/jldec/pub-generator/blob/524081509921ac8cb897753142324d61e10afdf3/render.js#L133-L139 |
44,823 | jldec/pub-generator | render.js | rewriteLink | function rewriteLink(href, renderOpts) {
var imgRoute = renderOpts.fqImages && (renderOpts.fqImages.route || '/images/');
var imgPrefix = renderOpts.fqImages && renderOpts.fqImages.url;
var linkPrefix = renderOpts.fqLinks || renderOpts.relPath;
if (imgPrefix && u.startsWith(href, imgRoute)) { href = im... | javascript | function rewriteLink(href, renderOpts) {
var imgRoute = renderOpts.fqImages && (renderOpts.fqImages.route || '/images/');
var imgPrefix = renderOpts.fqImages && renderOpts.fqImages.url;
var linkPrefix = renderOpts.fqLinks || renderOpts.relPath;
if (imgPrefix && u.startsWith(href, imgRoute)) { href = im... | [
"function",
"rewriteLink",
"(",
"href",
",",
"renderOpts",
")",
"{",
"var",
"imgRoute",
"=",
"renderOpts",
".",
"fqImages",
"&&",
"(",
"renderOpts",
".",
"fqImages",
".",
"route",
"||",
"'/images/'",
")",
";",
"var",
"imgPrefix",
"=",
"renderOpts",
".",
"f... | Link rewriting logic - shared by renderLink and renderImage and hb.fixPath | [
"Link",
"rewriting",
"logic",
"-",
"shared",
"by",
"renderLink",
"and",
"renderImage",
"and",
"hb",
".",
"fixPath"
] | 524081509921ac8cb897753142324d61e10afdf3 | https://github.com/jldec/pub-generator/blob/524081509921ac8cb897753142324d61e10afdf3/render.js#L276-L285 |
44,824 | jldec/pub-generator | render.js | inventory | function inventory() {
var images = generator.images = {};
var currentPage;
var baseRenderImage = generator.renderer.image;
generator.renderer.image = function(href, title, text) {
if (!images[href]) { images[href] = []; }
images[href].push(currentPage._href);
return baseRenderImage(... | javascript | function inventory() {
var images = generator.images = {};
var currentPage;
var baseRenderImage = generator.renderer.image;
generator.renderer.image = function(href, title, text) {
if (!images[href]) { images[href] = []; }
images[href].push(currentPage._href);
return baseRenderImage(... | [
"function",
"inventory",
"(",
")",
"{",
"var",
"images",
"=",
"generator",
".",
"images",
"=",
"{",
"}",
";",
"var",
"currentPage",
";",
"var",
"baseRenderImage",
"=",
"generator",
".",
"renderer",
".",
"image",
";",
"generator",
".",
"renderer",
".",
"i... | similar to parseLinks temporarily hooks generator renderer to compile images and links for all pages | [
"similar",
"to",
"parseLinks",
"temporarily",
"hooks",
"generator",
"renderer",
"to",
"compile",
"images",
"and",
"links",
"for",
"all",
"pages"
] | 524081509921ac8cb897753142324d61e10afdf3 | https://github.com/jldec/pub-generator/blob/524081509921ac8cb897753142324d61e10afdf3/render.js#L342-L360 |
44,825 | vadr-vr/VR-Analytics-JSCore | js/dataManager/sessionManager.js | createSession | function createSession(){
// can also check if any ealier session can be used
if (!currentSession){
const createNewSession = _setSessionReferrer();
const currentSessionCookie = utils.getCookie(constants.sessionCookieName);
if (currentSessionCookie && !createNewSession){
... | javascript | function createSession(){
// can also check if any ealier session can be used
if (!currentSession){
const createNewSession = _setSessionReferrer();
const currentSessionCookie = utils.getCookie(constants.sessionCookieName);
if (currentSessionCookie && !createNewSession){
... | [
"function",
"createSession",
"(",
")",
"{",
"// can also check if any ealier session can be used",
"if",
"(",
"!",
"currentSession",
")",
"{",
"const",
"createNewSession",
"=",
"_setSessionReferrer",
"(",
")",
";",
"const",
"currentSessionCookie",
"=",
"utils",
".",
"... | Manages creation of current session.
@memberof DataManager
@private | [
"Manages",
"creation",
"of",
"current",
"session",
"."
] | 7e4a493c824c2c1716360dcb6a3bfecfede5df3b | https://github.com/vadr-vr/VR-Analytics-JSCore/blob/7e4a493c824c2c1716360dcb6a3bfecfede5df3b/js/dataManager/sessionManager.js#L19-L57 |
44,826 | chapmanu/hb | lib/services/instagram/subscriber.js | function(subscription_id) {
var params = {
client_id: this._credentials.client_id,
client_secret: this._credentials.client_secret
};
if (subscription_id==='users') {
params.object = 'user';
} else if (subscription_id==='all') {
params.object = 'all';
} else {
params... | javascript | function(subscription_id) {
var params = {
client_id: this._credentials.client_id,
client_secret: this._credentials.client_secret
};
if (subscription_id==='users') {
params.object = 'user';
} else if (subscription_id==='all') {
params.object = 'all';
} else {
params... | [
"function",
"(",
"subscription_id",
")",
"{",
"var",
"params",
"=",
"{",
"client_id",
":",
"this",
".",
"_credentials",
".",
"client_id",
",",
"client_secret",
":",
"this",
".",
"_credentials",
".",
"client_secret",
"}",
";",
"if",
"(",
"subscription_id",
"=... | Generate request parameters for unsubscribing | [
"Generate",
"request",
"parameters",
"for",
"unsubscribing"
] | 5edd8de89c7c5fdffc3df0c627513889220f7d51 | https://github.com/chapmanu/hb/blob/5edd8de89c7c5fdffc3df0c627513889220f7d51/lib/services/instagram/subscriber.js#L43-L56 | |
44,827 | chapmanu/hb | lib/services/instagram/subscriber.js | function() {
this.subscribe('user', function(error, response) {
if (!error && response) {
logger.info('instagram -', 'users', 'subscription confirmed');
Subscriber.prototype.subscriptions['users'] = response.id;
}
});
} | javascript | function() {
this.subscribe('user', function(error, response) {
if (!error && response) {
logger.info('instagram -', 'users', 'subscription confirmed');
Subscriber.prototype.subscriptions['users'] = response.id;
}
});
} | [
"function",
"(",
")",
"{",
"this",
".",
"subscribe",
"(",
"'user'",
",",
"function",
"(",
"error",
",",
"response",
")",
"{",
"if",
"(",
"!",
"error",
"&&",
"response",
")",
"{",
"logger",
".",
"info",
"(",
"'instagram -'",
",",
"'users'",
",",
"'sub... | Make a users subscription request | [
"Make",
"a",
"users",
"subscription",
"request"
] | 5edd8de89c7c5fdffc3df0c627513889220f7d51 | https://github.com/chapmanu/hb/blob/5edd8de89c7c5fdffc3df0c627513889220f7d51/lib/services/instagram/subscriber.js#L119-L126 | |
44,828 | vid/SenseBase | lib/annotations.js | createAnnotation | function createAnnotation(desc) {
utils.check(['type', 'hasTarget', 'annotatedBy'], desc);
var anno = { type: desc.type, hasTarget: desc.hasTarget, annotatedAt : desc.annotatedAt || new Date().toISOString(), annotatedBy : desc.annotatedBy, state: desc.state || utils.states.annotations.unvalidated};
// used to cr... | javascript | function createAnnotation(desc) {
utils.check(['type', 'hasTarget', 'annotatedBy'], desc);
var anno = { type: desc.type, hasTarget: desc.hasTarget, annotatedAt : desc.annotatedAt || new Date().toISOString(), annotatedBy : desc.annotatedBy, state: desc.state || utils.states.annotations.unvalidated};
// used to cr... | [
"function",
"createAnnotation",
"(",
"desc",
")",
"{",
"utils",
".",
"check",
"(",
"[",
"'type'",
",",
"'hasTarget'",
",",
"'annotatedBy'",
"]",
",",
"desc",
")",
";",
"var",
"anno",
"=",
"{",
"type",
":",
"desc",
".",
"type",
",",
"hasTarget",
":",
... | validates and creates an annotation. pass .roots to insert into hierarchy | [
"validates",
"and",
"creates",
"an",
"annotation",
".",
"pass",
".",
"roots",
"to",
"insert",
"into",
"hierarchy"
] | d60bcf28239e7dde437d8a6bdae41a6921dcd05b | https://github.com/vid/SenseBase/blob/d60bcf28239e7dde437d8a6bdae41a6921dcd05b/lib/annotations.js#L74-L128 |
44,829 | vid/SenseBase | lib/annotations.js | createRange | function createRange(desc) {
var fields = ['exact', 'offset', 'selector'];
utils.check(fields, desc);
return { exact: desc.exact, offset: desc.offset, selector: desc.selector};
} | javascript | function createRange(desc) {
var fields = ['exact', 'offset', 'selector'];
utils.check(fields, desc);
return { exact: desc.exact, offset: desc.offset, selector: desc.selector};
} | [
"function",
"createRange",
"(",
"desc",
")",
"{",
"var",
"fields",
"=",
"[",
"'exact'",
",",
"'offset'",
",",
"'selector'",
"]",
";",
"utils",
".",
"check",
"(",
"fields",
",",
"desc",
")",
";",
"return",
"{",
"exact",
":",
"desc",
".",
"exact",
",",... | validates and creates an annotation range | [
"validates",
"and",
"creates",
"an",
"annotation",
"range"
] | d60bcf28239e7dde437d8a6bdae41a6921dcd05b | https://github.com/vid/SenseBase/blob/d60bcf28239e7dde437d8a6bdae41a6921dcd05b/lib/annotations.js#L132-L136 |
44,830 | vid/SenseBase | lib/annotations.js | createInstance | function createInstance(desc) {
var fields = ['exact', 'instance', 'selector'];
utils.check(fields, desc);
return { exact: desc.exact, instance: desc.instance, selector: desc.selector};
} | javascript | function createInstance(desc) {
var fields = ['exact', 'instance', 'selector'];
utils.check(fields, desc);
return { exact: desc.exact, instance: desc.instance, selector: desc.selector};
} | [
"function",
"createInstance",
"(",
"desc",
")",
"{",
"var",
"fields",
"=",
"[",
"'exact'",
",",
"'instance'",
",",
"'selector'",
"]",
";",
"utils",
".",
"check",
"(",
"fields",
",",
"desc",
")",
";",
"return",
"{",
"exact",
":",
"desc",
".",
"exact",
... | validates and creates an annotation instance | [
"validates",
"and",
"creates",
"an",
"annotation",
"instance"
] | d60bcf28239e7dde437d8a6bdae41a6921dcd05b | https://github.com/vid/SenseBase/blob/d60bcf28239e7dde437d8a6bdae41a6921dcd05b/lib/annotations.js#L139-L143 |
44,831 | vid/SenseBase | web/iframe/injected-iframe.js | diffTable | function diffTable(results) {
var curRefs = $('.references-list li').text().toString().split('\n').map(function(r) { return r.trim(); });
$('#sbResults').html('<table><thead><tr><th>Title</th><th>Created</th><th>Source</th></tr></thead><tbody></tbody></table>');
console.log('diffResults', results);
if (results ... | javascript | function diffTable(results) {
var curRefs = $('.references-list li').text().toString().split('\n').map(function(r) { return r.trim(); });
$('#sbResults').html('<table><thead><tr><th>Title</th><th>Created</th><th>Source</th></tr></thead><tbody></tbody></table>');
console.log('diffResults', results);
if (results ... | [
"function",
"diffTable",
"(",
"results",
")",
"{",
"var",
"curRefs",
"=",
"$",
"(",
"'.references-list li'",
")",
".",
"text",
"(",
")",
".",
"toString",
"(",
")",
".",
"split",
"(",
"'\\n'",
")",
".",
"map",
"(",
"function",
"(",
"r",
")",
"{",
"r... | for a demo. sigh. | [
"for",
"a",
"demo",
".",
"sigh",
"."
] | d60bcf28239e7dde437d8a6bdae41a6921dcd05b | https://github.com/vid/SenseBase/blob/d60bcf28239e7dde437d8a6bdae41a6921dcd05b/web/iframe/injected-iframe.js#L22-L83 |
44,832 | vid/SenseBase | web/iframe/injected-iframe.js | findInstanceOffset | function findInstanceOffset(anno, text) {
var re = new RegExp('\\b'+anno.exact+'\\b', 'g'), cur = 1, match;
while ((match = re.exec(text)) !== null) {
if (cur === anno.instance) {
return match.index;
}
cur++;
}
} | javascript | function findInstanceOffset(anno, text) {
var re = new RegExp('\\b'+anno.exact+'\\b', 'g'), cur = 1, match;
while ((match = re.exec(text)) !== null) {
if (cur === anno.instance) {
return match.index;
}
cur++;
}
} | [
"function",
"findInstanceOffset",
"(",
"anno",
",",
"text",
")",
"{",
"var",
"re",
"=",
"new",
"RegExp",
"(",
"'\\\\b'",
"+",
"anno",
".",
"exact",
"+",
"'\\\\b'",
",",
"'g'",
")",
",",
"cur",
"=",
"1",
",",
"match",
";",
"while",
"(",
"(",
"match"... | find the starting position of an instance | [
"find",
"the",
"starting",
"position",
"of",
"an",
"instance"
] | d60bcf28239e7dde437d8a6bdae41a6921dcd05b | https://github.com/vid/SenseBase/blob/d60bcf28239e7dde437d8a6bdae41a6921dcd05b/web/iframe/injected-iframe.js#L168-L176 |
44,833 | vid/SenseBase | web/iframe/injected-iframe.js | displayAllAnnos | function displayAllAnnos(treeItems) {
var items = [], selector, newHTML, i;
// two passes; first assign offsets and add to array with the same selector
for (i in treeItems.map) {
var anno = treeItems.map[i];
console.log(anno);
if (anno.selector === 'body') {
anno.selector = '#SBEnc... | javascript | function displayAllAnnos(treeItems) {
var items = [], selector, newHTML, i;
// two passes; first assign offsets and add to array with the same selector
for (i in treeItems.map) {
var anno = treeItems.map[i];
console.log(anno);
if (anno.selector === 'body') {
anno.selector = '#SBEnc... | [
"function",
"displayAllAnnos",
"(",
"treeItems",
")",
"{",
"var",
"items",
"=",
"[",
"]",
",",
"selector",
",",
"newHTML",
",",
"i",
";",
"// two passes; first assign offsets and add to array with the same selector",
"for",
"(",
"i",
"in",
"treeItems",
".",
"map",
... | prepare and display eligible annotations | [
"prepare",
"and",
"display",
"eligible",
"annotations"
] | d60bcf28239e7dde437d8a6bdae41a6921dcd05b | https://github.com/vid/SenseBase/blob/d60bcf28239e7dde437d8a6bdae41a6921dcd05b/web/iframe/injected-iframe.js#L179-L220 |
44,834 | vid/SenseBase | web/iframe/injected-iframe.js | insertAnno | function insertAnno(anno, newHTML) {
var annoID = 'SB-anno-' + anno.__id;
var startTag = '<span id="' + annoID + '" class="sbAnnotation sbAnnotation-b">', endTag = '</span>';
anno.offset = findInstanceOffset(anno, newHTML);
return newHTML.substring(0, anno.offset) + startTag + anno.exact + endTag + new... | javascript | function insertAnno(anno, newHTML) {
var annoID = 'SB-anno-' + anno.__id;
var startTag = '<span id="' + annoID + '" class="sbAnnotation sbAnnotation-b">', endTag = '</span>';
anno.offset = findInstanceOffset(anno, newHTML);
return newHTML.substring(0, anno.offset) + startTag + anno.exact + endTag + new... | [
"function",
"insertAnno",
"(",
"anno",
",",
"newHTML",
")",
"{",
"var",
"annoID",
"=",
"'SB-anno-'",
"+",
"anno",
".",
"__id",
";",
"var",
"startTag",
"=",
"'<span id=\"'",
"+",
"annoID",
"+",
"'\" class=\"sbAnnotation sbAnnotation-b\">'",
",",
"endTag",
"=",
... | insert annotation categories at correct position | [
"insert",
"annotation",
"categories",
"at",
"correct",
"position"
] | d60bcf28239e7dde437d8a6bdae41a6921dcd05b | https://github.com/vid/SenseBase/blob/d60bcf28239e7dde437d8a6bdae41a6921dcd05b/web/iframe/injected-iframe.js#L223-L229 |
44,835 | Whitebolt/require-extra | src/Module.js | _getParent | function _getParent(config) {
if (config.hasOwnProperty('parent')) {
if (!isString(config.parent)) return config.parent;
if (cache.has(config.parent)) return cache.get(config.parent);
}
return settings.get('parent').parent || settings.get('parent');
} | javascript | function _getParent(config) {
if (config.hasOwnProperty('parent')) {
if (!isString(config.parent)) return config.parent;
if (cache.has(config.parent)) return cache.get(config.parent);
}
return settings.get('parent').parent || settings.get('parent');
} | [
"function",
"_getParent",
"(",
"config",
")",
"{",
"if",
"(",
"config",
".",
"hasOwnProperty",
"(",
"'parent'",
")",
")",
"{",
"if",
"(",
"!",
"isString",
"(",
"config",
".",
"parent",
")",
")",
"return",
"config",
".",
"parent",
";",
"if",
"(",
"cac... | Get the parent of the module we are trying to create. Use the given config object supplied to the constructor.
@private
@param {Object} config Constructor config.
@returns {Module} The parent. | [
"Get",
"the",
"parent",
"of",
"the",
"module",
"we",
"are",
"trying",
"to",
"create",
".",
"Use",
"the",
"given",
"config",
"object",
"supplied",
"to",
"the",
"constructor",
"."
] | 2a8f737aab67305c9fda3ee56aa7953e97cee859 | https://github.com/Whitebolt/require-extra/blob/2a8f737aab67305c9fda3ee56aa7953e97cee859/src/Module.js#L17-L24 |
44,836 | Whitebolt/require-extra | src/Module.js | _getRequire | function _getRequire(config) {
if (!config.syncRequire && !config.resolveModulePath) return requireLike(config.filename);
const _requireResolver = {
basedir:config.basedir||path.dirname(config.filename),
parent:config.filename,
scope:config.scope,
useSandbox:config.useSandbox,
squashErrors:!!((... | javascript | function _getRequire(config) {
if (!config.syncRequire && !config.resolveModulePath) return requireLike(config.filename);
const _requireResolver = {
basedir:config.basedir||path.dirname(config.filename),
parent:config.filename,
scope:config.scope,
useSandbox:config.useSandbox,
squashErrors:!!((... | [
"function",
"_getRequire",
"(",
"config",
")",
"{",
"if",
"(",
"!",
"config",
".",
"syncRequire",
"&&",
"!",
"config",
".",
"resolveModulePath",
")",
"return",
"requireLike",
"(",
"config",
".",
"filename",
")",
";",
"const",
"_requireResolver",
"=",
"{",
... | Create a require function to pass into the module.
@private
@param {Object} config Module construction config.
@returns {Function} The require function. | [
"Create",
"a",
"require",
"function",
"to",
"pass",
"into",
"the",
"module",
"."
] | 2a8f737aab67305c9fda3ee56aa7953e97cee859 | https://github.com/Whitebolt/require-extra/blob/2a8f737aab67305c9fda3ee56aa7953e97cee859/src/Module.js#L33-L60 |
44,837 | robeio/robe-json-server | src/server/mixins.js | createId | function createId (coll) {
var _ = this
var idProperty = _.__id()
if (_.isEmpty(coll)) {
return 1
} else {
var id = _.maxBy(coll, function (doc) {
return doc[idProperty]
})[idProperty]
if (_.isFinite(id)) {
// Increment integer id
return ++id
} else {
// Generate str... | javascript | function createId (coll) {
var _ = this
var idProperty = _.__id()
if (_.isEmpty(coll)) {
return 1
} else {
var id = _.maxBy(coll, function (doc) {
return doc[idProperty]
})[idProperty]
if (_.isFinite(id)) {
// Increment integer id
return ++id
} else {
// Generate str... | [
"function",
"createId",
"(",
"coll",
")",
"{",
"var",
"_",
"=",
"this",
"var",
"idProperty",
"=",
"_",
".",
"__id",
"(",
")",
"if",
"(",
"_",
".",
"isEmpty",
"(",
"coll",
")",
")",
"{",
"return",
"1",
"}",
"else",
"{",
"var",
"id",
"=",
"_",
... | Return incremented id or uuid Used to override underscore-db's createId with utils.createId | [
"Return",
"incremented",
"id",
"or",
"uuid",
"Used",
"to",
"override",
"underscore",
"-",
"db",
"s",
"createId",
"with",
"utils",
".",
"createId"
] | 89b217b08b9d01a8e7b5a72c8505337c85f68629 | https://github.com/robeio/robe-json-server/blob/89b217b08b9d01a8e7b5a72c8505337c85f68629/src/server/mixins.js#L38-L56 |
44,838 | socialally/air | lib/air/class.js | hasClass | function hasClass(className) {
var i, val;
for(i = 0;i < this.length;i++) {
val = this.get(i).getAttribute(attr);
val = val ? val.split(/\s+/) : [];
if(~val.indexOf(className)) {
return true;
}
}
return false;
} | javascript | function hasClass(className) {
var i, val;
for(i = 0;i < this.length;i++) {
val = this.get(i).getAttribute(attr);
val = val ? val.split(/\s+/) : [];
if(~val.indexOf(className)) {
return true;
}
}
return false;
} | [
"function",
"hasClass",
"(",
"className",
")",
"{",
"var",
"i",
",",
"val",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"length",
";",
"i",
"++",
")",
"{",
"val",
"=",
"this",
".",
"get",
"(",
"i",
")",
".",
"getAttribute",
"(... | Determine whether any of the matched elements are assigned the
given class. | [
"Determine",
"whether",
"any",
"of",
"the",
"matched",
"elements",
"are",
"assigned",
"the",
"given",
"class",
"."
] | a3d94de58aaa4930a425fbcc7266764bf6ca8ca6 | https://github.com/socialally/air/blob/a3d94de58aaa4930a425fbcc7266764bf6ca8ca6/lib/air/class.js#L32-L42 |
44,839 | socialally/air | lib/air/class.js | removeClass | function removeClass(className) {
if(!className) {
// remove all classes from all matched elements
this.each(function(el) {
el.removeAttribute(attr);
});
return this;
}
var classes = className.split(/\s+/);
this.each(function(el) {
var val = el.getAttribute(attr);
// no class attri... | javascript | function removeClass(className) {
if(!className) {
// remove all classes from all matched elements
this.each(function(el) {
el.removeAttribute(attr);
});
return this;
}
var classes = className.split(/\s+/);
this.each(function(el) {
var val = el.getAttribute(attr);
// no class attri... | [
"function",
"removeClass",
"(",
"className",
")",
"{",
"if",
"(",
"!",
"className",
")",
"{",
"// remove all classes from all matched elements",
"this",
".",
"each",
"(",
"function",
"(",
"el",
")",
"{",
"el",
".",
"removeAttribute",
"(",
"attr",
")",
";",
"... | Remove a single class, multiple classes, or all classes from
each element in the set of matched elements. | [
"Remove",
"a",
"single",
"class",
"multiple",
"classes",
"or",
"all",
"classes",
"from",
"each",
"element",
"in",
"the",
"set",
"of",
"matched",
"elements",
"."
] | a3d94de58aaa4930a425fbcc7266764bf6ca8ca6 | https://github.com/socialally/air/blob/a3d94de58aaa4930a425fbcc7266764bf6ca8ca6/lib/air/class.js#L48-L70 |
44,840 | socialally/air | lib/air/class.js | toggleClass | function toggleClass(className) {
var classes = className.split(/\s+/)
, name
, i;
for(i = 0;i < classes.length;i++) {
name = classes[i];
if(this.hasClass(name)) {
this.removeClass(name)
}else{
this.addClass(name)
}
}
} | javascript | function toggleClass(className) {
var classes = className.split(/\s+/)
, name
, i;
for(i = 0;i < classes.length;i++) {
name = classes[i];
if(this.hasClass(name)) {
this.removeClass(name)
}else{
this.addClass(name)
}
}
} | [
"function",
"toggleClass",
"(",
"className",
")",
"{",
"var",
"classes",
"=",
"className",
".",
"split",
"(",
"/",
"\\s+",
"/",
")",
",",
"name",
",",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"classes",
".",
"length",
";",
"i",
"++",
... | Add or remove one or more classes from each element in the set of
matched elements depending on the class's presence. | [
"Add",
"or",
"remove",
"one",
"or",
"more",
"classes",
"from",
"each",
"element",
"in",
"the",
"set",
"of",
"matched",
"elements",
"depending",
"on",
"the",
"class",
"s",
"presence",
"."
] | a3d94de58aaa4930a425fbcc7266764bf6ca8ca6 | https://github.com/socialally/air/blob/a3d94de58aaa4930a425fbcc7266764bf6ca8ca6/lib/air/class.js#L76-L88 |
44,841 | DScheglov/merest | lib/controllers/del-by-id.js | delById | function delById(req, res, next) {
res.__apiMethod = 'delete';
var self = this;
var id = req.params.id;
var filter = this.option('delete', 'filter');
if (filter instanceof Function) filter = filter.call(this, req);
var query = extend({_id: id}, filter);
this.model.remove(query).exec(function(err, a... | javascript | function delById(req, res, next) {
res.__apiMethod = 'delete';
var self = this;
var id = req.params.id;
var filter = this.option('delete', 'filter');
if (filter instanceof Function) filter = filter.call(this, req);
var query = extend({_id: id}, filter);
this.model.remove(query).exec(function(err, a... | [
"function",
"delById",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"res",
".",
"__apiMethod",
"=",
"'delete'",
";",
"var",
"self",
"=",
"this",
";",
"var",
"id",
"=",
"req",
".",
"params",
".",
"id",
";",
"var",
"filter",
"=",
"this",
".",
"op... | delById - controller that deletes a model instance
@param {express.Request} req the http(s) request
@param {express.Response} res the http(s) response
@param {Function} next the callback should be called if controller fails
@memberof ModelAPIRouter | [
"delById",
"-",
"controller",
"that",
"deletes",
"a",
"model",
"instance"
] | d39e7ef0d56236247773467e9bfe83cb128ebc01 | https://github.com/DScheglov/merest/blob/d39e7ef0d56236247773467e9bfe83cb128ebc01/lib/controllers/del-by-id.js#L13-L30 |
44,842 | jldec/pub-generator | update.js | labelFragment | function labelFragment(fragment, func, source) {
// use 'in' to handle case where delim is set to ''
var leftDelim = 'leftDelim' in source ? source.leftDelim : '----';
var rightDelim = 'rightDelim' in source ? source.rightDelim : '----';
var headerDelim = 'headerDelim' in source ? source.heade... | javascript | function labelFragment(fragment, func, source) {
// use 'in' to handle case where delim is set to ''
var leftDelim = 'leftDelim' in source ? source.leftDelim : '----';
var rightDelim = 'rightDelim' in source ? source.rightDelim : '----';
var headerDelim = 'headerDelim' in source ? source.heade... | [
"function",
"labelFragment",
"(",
"fragment",
",",
"func",
",",
"source",
")",
"{",
"// use 'in' to handle case where delim is set to ''",
"var",
"leftDelim",
"=",
"'leftDelim'",
"in",
"source",
"?",
"source",
".",
"leftDelim",
":",
"'----'",
";",
"var",
"rightDelim... | should move into util or parsefragments.js | [
"should",
"move",
"into",
"util",
"or",
"parsefragments",
".",
"js"
] | 524081509921ac8cb897753142324d61e10afdf3 | https://github.com/jldec/pub-generator/blob/524081509921ac8cb897753142324d61e10afdf3/update.js#L158-L181 |
44,843 | jldec/pub-generator | update.js | clientSave | function clientSave() {
u.each(sources, function(source) {
var dirtyFiles = u.filter(source.files, function(file) {
if (file._dirty) { // 1 means unsaved, 2 means saving
file._dirty = 2; // side effect of filter
return true;
}
return false;
});
if (... | javascript | function clientSave() {
u.each(sources, function(source) {
var dirtyFiles = u.filter(source.files, function(file) {
if (file._dirty) { // 1 means unsaved, 2 means saving
file._dirty = 2; // side effect of filter
return true;
}
return false;
});
if (... | [
"function",
"clientSave",
"(",
")",
"{",
"u",
".",
"each",
"(",
"sources",
",",
"function",
"(",
"source",
")",
"{",
"var",
"dirtyFiles",
"=",
"u",
".",
"filter",
"(",
"source",
".",
"files",
",",
"function",
"(",
"file",
")",
"{",
"if",
"(",
"file... | clientSave currently used only in browser | [
"clientSave",
"currently",
"used",
"only",
"in",
"browser"
] | 524081509921ac8cb897753142324d61e10afdf3 | https://github.com/jldec/pub-generator/blob/524081509921ac8cb897753142324d61e10afdf3/update.js#L184-L258 |
44,844 | jldec/pub-generator | update.js | reloadSources | function reloadSources(names) {
names = u.isArray(names) ? names :
names ? [names] :
u.keys(opts.source$);
var results = [];
u.each(names, function(name) {
var source = opts.source$[name];
if (source) {
source._reloadFromSource = true;
results.push(name);... | javascript | function reloadSources(names) {
names = u.isArray(names) ? names :
names ? [names] :
u.keys(opts.source$);
var results = [];
u.each(names, function(name) {
var source = opts.source$[name];
if (source) {
source._reloadFromSource = true;
results.push(name);... | [
"function",
"reloadSources",
"(",
"names",
")",
"{",
"names",
"=",
"u",
".",
"isArray",
"(",
"names",
")",
"?",
"names",
":",
"names",
"?",
"[",
"names",
"]",
":",
"u",
".",
"keys",
"(",
"opts",
".",
"source$",
")",
";",
"var",
"results",
"=",
"[... | trigger reload from source input = string or array of source names, nothing => all | [
"trigger",
"reload",
"from",
"source",
"input",
"=",
"string",
"or",
"array",
"of",
"source",
"names",
"nothing",
"=",
">",
"all"
] | 524081509921ac8cb897753142324d61e10afdf3 | https://github.com/jldec/pub-generator/blob/524081509921ac8cb897753142324d61e10afdf3/update.js#L324-L344 |
44,845 | bigpipe/alcatraz | index.js | Alcatraz | function Alcatraz(method, source, domain) {
if (!(this instanceof Alcatraz)) return new Alcatraz(method, source);
this.domain = domain || ('undefined' !== typeof document ? document.domain : '');
this.method = 'if ('+method+') '+ method;
this.source = source;
this.compiled = null;
} | javascript | function Alcatraz(method, source, domain) {
if (!(this instanceof Alcatraz)) return new Alcatraz(method, source);
this.domain = domain || ('undefined' !== typeof document ? document.domain : '');
this.method = 'if ('+method+') '+ method;
this.source = source;
this.compiled = null;
} | [
"function",
"Alcatraz",
"(",
"method",
",",
"source",
",",
"domain",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Alcatraz",
")",
")",
"return",
"new",
"Alcatraz",
"(",
"method",
",",
"source",
")",
";",
"this",
".",
"domain",
"=",
"domain",
... | Alcatraz is our source code sandboxing.
@constructor
@param {String} method The global/method name that processes messages.
@param {String} source The actual code.
@param {String} domain The domain name.
@api private | [
"Alcatraz",
"is",
"our",
"source",
"code",
"sandboxing",
"."
] | d754bb8607e9c75810b7ff5127d8d30393cb2f34 | https://github.com/bigpipe/alcatraz/blob/d754bb8607e9c75810b7ff5127d8d30393cb2f34/index.js#L12-L19 |
44,846 | bigpipe/alcatraz | index.js | polyconsole | function polyconsole(method) {
var attach = { debug: 1, error: 1, log: 1, warn: 1 };
//
// Ensure that this host environment always has working console.
//
global.console[method] = function polyfilled() {
var args = Array.prototype.slice.call(arguments, 0);
//
// ... | javascript | function polyconsole(method) {
var attach = { debug: 1, error: 1, log: 1, warn: 1 };
//
// Ensure that this host environment always has working console.
//
global.console[method] = function polyfilled() {
var args = Array.prototype.slice.call(arguments, 0);
//
// ... | [
"function",
"polyconsole",
"(",
"method",
")",
"{",
"var",
"attach",
"=",
"{",
"debug",
":",
"1",
",",
"error",
":",
"1",
",",
"log",
":",
"1",
",",
"warn",
":",
"1",
"}",
";",
"//",
"// Ensure that this host environment always has working console.",
"//",
... | Helper method to polyfill our global console method so we can proxy it's
usage to the
@param {String} method The console method we want to polyfill.
@api private | [
"Helper",
"method",
"to",
"polyfill",
"our",
"global",
"console",
"method",
"so",
"we",
"can",
"proxy",
"it",
"s",
"usage",
"to",
"the"
] | d754bb8607e9c75810b7ff5127d8d30393cb2f34 | https://github.com/bigpipe/alcatraz/blob/d754bb8607e9c75810b7ff5127d8d30393cb2f34/index.js#L138-L162 |
44,847 | haraldrudell/nodegod | lib/linearcalendar.js | getDate | function getDate(ymValue) {
checkNumber(ymValue)
var utcFullYear = Math.floor(ymValue / monthsPerYear) + zeroUtcFullYear
var utcMonth = modFix(Math.floor(ymValue), monthsPerYear) + zeroUtcMonth
return new Date(Date.UTC(utcFullYear, utcMonth))
} | javascript | function getDate(ymValue) {
checkNumber(ymValue)
var utcFullYear = Math.floor(ymValue / monthsPerYear) + zeroUtcFullYear
var utcMonth = modFix(Math.floor(ymValue), monthsPerYear) + zeroUtcMonth
return new Date(Date.UTC(utcFullYear, utcMonth))
} | [
"function",
"getDate",
"(",
"ymValue",
")",
"{",
"checkNumber",
"(",
"ymValue",
")",
"var",
"utcFullYear",
"=",
"Math",
".",
"floor",
"(",
"ymValue",
"/",
"monthsPerYear",
")",
"+",
"zeroUtcFullYear",
"var",
"utcMonth",
"=",
"modFix",
"(",
"Math",
".",
"fl... | convert linearValue to Date object | [
"convert",
"linearValue",
"to",
"Date",
"object"
] | 3be4fb280fb18e0ec0a1c1a8fea3254d92f00b21 | https://github.com/haraldrudell/nodegod/blob/3be4fb280fb18e0ec0a1c1a8fea3254d92f00b21/lib/linearcalendar.js#L35-L40 |
44,848 | haraldrudell/nodegod | lib/linearcalendar.js | encodeDate | function encodeDate(date) {
if (!(date instanceof Date)) throw new Error('Value not Date: ' + date)
return (date.getUTCFullYear() * monthsPerYear + date.getUTCMonth()) - yearMonthZero
} | javascript | function encodeDate(date) {
if (!(date instanceof Date)) throw new Error('Value not Date: ' + date)
return (date.getUTCFullYear() * monthsPerYear + date.getUTCMonth()) - yearMonthZero
} | [
"function",
"encodeDate",
"(",
"date",
")",
"{",
"if",
"(",
"!",
"(",
"date",
"instanceof",
"Date",
")",
")",
"throw",
"new",
"Error",
"(",
"'Value not Date: '",
"+",
"date",
")",
"return",
"(",
"date",
".",
"getUTCFullYear",
"(",
")",
"*",
"monthsPerYea... | get linearValue from Date object | [
"get",
"linearValue",
"from",
"Date",
"object"
] | 3be4fb280fb18e0ec0a1c1a8fea3254d92f00b21 | https://github.com/haraldrudell/nodegod/blob/3be4fb280fb18e0ec0a1c1a8fea3254d92f00b21/lib/linearcalendar.js#L43-L46 |
44,849 | ryb73/dealers-choice-meta | packages/server/lib/game-managers/choice-provider/rock-paper-scissors.js | handleIt | function handleIt(cb) {
callbacks = cb;
broadcast = callbacks.broadcast;
let msg = {
cmd: MessageType.RockPaperScissors,
handlerId: id
};
broadcast("action", msg);
// Return a promise for the result
deferred = q.defer();
return deferred.promise;
} | javascript | function handleIt(cb) {
callbacks = cb;
broadcast = callbacks.broadcast;
let msg = {
cmd: MessageType.RockPaperScissors,
handlerId: id
};
broadcast("action", msg);
// Return a promise for the result
deferred = q.defer();
return deferred.promise;
} | [
"function",
"handleIt",
"(",
"cb",
")",
"{",
"callbacks",
"=",
"cb",
";",
"broadcast",
"=",
"callbacks",
".",
"broadcast",
";",
"let",
"msg",
"=",
"{",
"cmd",
":",
"MessageType",
".",
"RockPaperScissors",
",",
"handlerId",
":",
"id",
"}",
";",
"broadcast... | Returns a promise for the ID of the player who won the game | [
"Returns",
"a",
"promise",
"for",
"the",
"ID",
"of",
"the",
"player",
"who",
"won",
"the",
"game"
] | 4632e8897c832b01d944a340cf87d5c807809925 | https://github.com/ryb73/dealers-choice-meta/blob/4632e8897c832b01d944a340cf87d5c807809925/packages/server/lib/game-managers/choice-provider/rock-paper-scissors.js#L34-L47 |
44,850 | ryb73/dealers-choice-meta | packages/server/lib/game-managers/choice-provider/rock-paper-scissors.js | beginCountdown | function beginCountdown() {
let msg = {
cmd: MessageType.RpsCountdown
};
broadcast("action", msg);
q.delay(COUNTDOWN_DELAY).done(determineWinner);
} | javascript | function beginCountdown() {
let msg = {
cmd: MessageType.RpsCountdown
};
broadcast("action", msg);
q.delay(COUNTDOWN_DELAY).done(determineWinner);
} | [
"function",
"beginCountdown",
"(",
")",
"{",
"let",
"msg",
"=",
"{",
"cmd",
":",
"MessageType",
".",
"RpsCountdown",
"}",
";",
"broadcast",
"(",
"\"action\"",
",",
"msg",
")",
";",
"q",
".",
"delay",
"(",
"COUNTDOWN_DELAY",
")",
".",
"done",
"(",
"dete... | This rock-paper-scissors game is SERIOUS | [
"This",
"rock",
"-",
"paper",
"-",
"scissors",
"game",
"is",
"SERIOUS"
] | 4632e8897c832b01d944a340cf87d5c807809925 | https://github.com/ryb73/dealers-choice-meta/blob/4632e8897c832b01d944a340cf87d5c807809925/packages/server/lib/game-managers/choice-provider/rock-paper-scissors.js#L63-L70 |
44,851 | ryb73/dealers-choice-meta | packages/server/lib/game-managers/choice-provider/rock-paper-scissors.js | restartGame | function restartGame(players) {
// Replace the current instance with a new instance
let newGame = new RockPaperScissors(game, players, winCounter, id);
proxy.swap(newGame);
q.delay(RESULTS_DELAY)
.done(function() {
deferred.resolve(newGame.handleIt(callbacks));
});
} | javascript | function restartGame(players) {
// Replace the current instance with a new instance
let newGame = new RockPaperScissors(game, players, winCounter, id);
proxy.swap(newGame);
q.delay(RESULTS_DELAY)
.done(function() {
deferred.resolve(newGame.handleIt(callbacks));
});
} | [
"function",
"restartGame",
"(",
"players",
")",
"{",
"// Replace the current instance with a new instance",
"let",
"newGame",
"=",
"new",
"RockPaperScissors",
"(",
"game",
",",
"players",
",",
"winCounter",
",",
"id",
")",
";",
"proxy",
".",
"swap",
"(",
"newGame"... | Starts a new game of RPS with the given array of players. A delay is added so that the client has time to show the results to the user. | [
"Starts",
"a",
"new",
"game",
"of",
"RPS",
"with",
"the",
"given",
"array",
"of",
"players",
".",
"A",
"delay",
"is",
"added",
"so",
"that",
"the",
"client",
"has",
"time",
"to",
"show",
"the",
"results",
"to",
"the",
"user",
"."
] | 4632e8897c832b01d944a340cf87d5c807809925 | https://github.com/ryb73/dealers-choice-meta/blob/4632e8897c832b01d944a340cf87d5c807809925/packages/server/lib/game-managers/choice-provider/rock-paper-scissors.js#L106-L115 |
44,852 | nodeca/hike-js | lib/shared.js | containsPath | function containsPath(self, dirname) {
return self.__paths__.some(function(p) {
return p === dirname.substr(0, p.length);
});
} | javascript | function containsPath(self, dirname) {
return self.__paths__.some(function(p) {
return p === dirname.substr(0, p.length);
});
} | [
"function",
"containsPath",
"(",
"self",
",",
"dirname",
")",
"{",
"return",
"self",
".",
"__paths__",
".",
"some",
"(",
"function",
"(",
"p",
")",
"{",
"return",
"p",
"===",
"dirname",
".",
"substr",
"(",
"0",
",",
"p",
".",
"length",
")",
";",
"}... | Returns true if `dirname` is a subdirectory of any of the `paths` | [
"Returns",
"true",
"if",
"dirname",
"is",
"a",
"subdirectory",
"of",
"any",
"of",
"the",
"paths"
] | 8d9b71473c7b1fa46991738b02e8f1e60b843d99 | https://github.com/nodeca/hike-js/blob/8d9b71473c7b1fa46991738b02e8f1e60b843d99/lib/shared.js#L59-L63 |
44,853 | nodeca/hike-js | lib/shared.js | sortMatches | function sortMatches(self, matches, basename) {
var weights = {};
var ext_name = path.extname(basename);
var aliases = has(self.__aliases__, ext_name) ? self.__aliases__[ext_name] : [];
matches.forEach(function(match) {
// XXX: this doesn't work well with aliases
// i.e. entry=index.php, extna... | javascript | function sortMatches(self, matches, basename) {
var weights = {};
var ext_name = path.extname(basename);
var aliases = has(self.__aliases__, ext_name) ? self.__aliases__[ext_name] : [];
matches.forEach(function(match) {
// XXX: this doesn't work well with aliases
// i.e. entry=index.php, extna... | [
"function",
"sortMatches",
"(",
"self",
",",
"matches",
",",
"basename",
")",
"{",
"var",
"weights",
"=",
"{",
"}",
";",
"var",
"ext_name",
"=",
"path",
".",
"extname",
"(",
"basename",
")",
";",
"var",
"aliases",
"=",
"has",
"(",
"self",
".",
"__ali... | Sorts candidate matches by their extension priority. Extensions in the front of the `extensions` carry more weight. | [
"Sorts",
"candidate",
"matches",
"by",
"their",
"extension",
"priority",
".",
"Extensions",
"in",
"the",
"front",
"of",
"the",
"extensions",
"carry",
"more",
"weight",
"."
] | 8d9b71473c7b1fa46991738b02e8f1e60b843d99 | https://github.com/nodeca/hike-js/blob/8d9b71473c7b1fa46991738b02e8f1e60b843d99/lib/shared.js#L92-L126 |
44,854 | nodeca/hike-js | lib/shared.js | match | function match(self, dirname, basename, callback) {
var pathname, stats, pattern, matches;
pattern = patternFor(self, basename);
matches = self.entries(dirname).filter(function(m) { return pattern.test(m); });
matches = sortMatches(self, matches, basename);
while (matches.length) {
pathname = path.join... | javascript | function match(self, dirname, basename, callback) {
var pathname, stats, pattern, matches;
pattern = patternFor(self, basename);
matches = self.entries(dirname).filter(function(m) { return pattern.test(m); });
matches = sortMatches(self, matches, basename);
while (matches.length) {
pathname = path.join... | [
"function",
"match",
"(",
"self",
",",
"dirname",
",",
"basename",
",",
"callback",
")",
"{",
"var",
"pathname",
",",
"stats",
",",
"pattern",
",",
"matches",
";",
"pattern",
"=",
"patternFor",
"(",
"self",
",",
"basename",
")",
";",
"matches",
"=",
"s... | Checks if the path is actually on the file system and performs any syscalls if necessary. | [
"Checks",
"if",
"the",
"path",
"is",
"actually",
"on",
"the",
"file",
"system",
"and",
"performs",
"any",
"syscalls",
"if",
"necessary",
"."
] | 8d9b71473c7b1fa46991738b02e8f1e60b843d99 | https://github.com/nodeca/hike-js/blob/8d9b71473c7b1fa46991738b02e8f1e60b843d99/lib/shared.js#L130-L145 |
44,855 | vadr-vr/VR-Analytics-JSCore | js/dataCollector/dataCollector.js | setPositionCallback | function setPositionCallback(positionFunction){
if (typeof(positionFunction) == 'function'){
orientationCollector.setPositionCallback(positionFunction);
callbacks.positionCallback = positionFunction;
}
else
logger.warn('Trying to set a non function object as position callback');
... | javascript | function setPositionCallback(positionFunction){
if (typeof(positionFunction) == 'function'){
orientationCollector.setPositionCallback(positionFunction);
callbacks.positionCallback = positionFunction;
}
else
logger.warn('Trying to set a non function object as position callback');
... | [
"function",
"setPositionCallback",
"(",
"positionFunction",
")",
"{",
"if",
"(",
"typeof",
"(",
"positionFunction",
")",
"==",
"'function'",
")",
"{",
"orientationCollector",
".",
"setPositionCallback",
"(",
"positionFunction",
")",
";",
"callbacks",
".",
"positionC... | Sets the function to call when setting position
@memberof DataCollector
@param {function} positionFunction | [
"Sets",
"the",
"function",
"to",
"call",
"when",
"setting",
"position"
] | 7e4a493c824c2c1716360dcb6a3bfecfede5df3b | https://github.com/vadr-vr/VR-Analytics-JSCore/blob/7e4a493c824c2c1716360dcb6a3bfecfede5df3b/js/dataCollector/dataCollector.js#L65-L76 |
44,856 | vadr-vr/VR-Analytics-JSCore | js/dataCollector/dataCollector.js | configureEventCollection | function configureEventCollection(eventType, collectionStatus, timePeriod){
if (eventType in dataConfig){
// check that collection status is present as true or false
collectionStatus = collectionStatus == false ? false : true;
dataConfig[eventType].status = collectionStatus;
if(!i... | javascript | function configureEventCollection(eventType, collectionStatus, timePeriod){
if (eventType in dataConfig){
// check that collection status is present as true or false
collectionStatus = collectionStatus == false ? false : true;
dataConfig[eventType].status = collectionStatus;
if(!i... | [
"function",
"configureEventCollection",
"(",
"eventType",
",",
"collectionStatus",
",",
"timePeriod",
")",
"{",
"if",
"(",
"eventType",
"in",
"dataConfig",
")",
"{",
"// check that collection status is present as true or false",
"collectionStatus",
"=",
"collectionStatus",
... | Configures which events to collect by default and by what frequency
@memberof DataCollector
@param {string} eventType type of event - Orientation, Gaze, Performance
@param {boolean} collectionStatus set to true if you want to collect the event
@param {number} timePeriod time period in milliseconds after which to collec... | [
"Configures",
"which",
"events",
"to",
"collect",
"by",
"default",
"and",
"by",
"what",
"frequency"
] | 7e4a493c824c2c1716360dcb6a3bfecfede5df3b | https://github.com/vadr-vr/VR-Analytics-JSCore/blob/7e4a493c824c2c1716360dcb6a3bfecfede5df3b/js/dataCollector/dataCollector.js#L121-L146 |
44,857 | vadr-vr/VR-Analytics-JSCore | js/dataCollector/dataCollector.js | tick | function tick(){
performanceCollector.tick();
const useMedia = dataManager.getMediaState();
const playTimeSinceStart = timeManager.getPlayTimeSinceStart();
for (let key in dataConfig){
const infoDict = dataConfig[key];
if (infoDict.status &&
playTimeSinceStart - infoDic... | javascript | function tick(){
performanceCollector.tick();
const useMedia = dataManager.getMediaState();
const playTimeSinceStart = timeManager.getPlayTimeSinceStart();
for (let key in dataConfig){
const infoDict = dataConfig[key];
if (infoDict.status &&
playTimeSinceStart - infoDic... | [
"function",
"tick",
"(",
")",
"{",
"performanceCollector",
".",
"tick",
"(",
")",
";",
"const",
"useMedia",
"=",
"dataManager",
".",
"getMediaState",
"(",
")",
";",
"const",
"playTimeSinceStart",
"=",
"timeManager",
".",
"getPlayTimeSinceStart",
"(",
")",
";",... | Checks if any default data needs to be collected after each frame
@memberof DataCollector | [
"Checks",
"if",
"any",
"default",
"data",
"needs",
"to",
"be",
"collected",
"after",
"each",
"frame"
] | 7e4a493c824c2c1716360dcb6a3bfecfede5df3b | https://github.com/vadr-vr/VR-Analytics-JSCore/blob/7e4a493c824c2c1716360dcb6a3bfecfede5df3b/js/dataCollector/dataCollector.js#L152-L180 |
44,858 | vadr-vr/VR-Analytics-JSCore | js/dataCollector/dataCollector.js | _setEvents | function _setEvents(eventsArray){
for (let i = 0; i < eventsArray.length; i++){
let event = eventsArray[i];
dataManager.registerEvent(event[0], event[1], event[2]);
}
} | javascript | function _setEvents(eventsArray){
for (let i = 0; i < eventsArray.length; i++){
let event = eventsArray[i];
dataManager.registerEvent(event[0], event[1], event[2]);
}
} | [
"function",
"_setEvents",
"(",
"eventsArray",
")",
"{",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"eventsArray",
".",
"length",
";",
"i",
"++",
")",
"{",
"let",
"event",
"=",
"eventsArray",
"[",
"i",
"]",
";",
"dataManager",
".",
"registerEven... | collects the events from the given array and adds to datamanager | [
"collects",
"the",
"events",
"from",
"the",
"given",
"array",
"and",
"adds",
"to",
"datamanager"
] | 7e4a493c824c2c1716360dcb6a3bfecfede5df3b | https://github.com/vadr-vr/VR-Analytics-JSCore/blob/7e4a493c824c2c1716360dcb6a3bfecfede5df3b/js/dataCollector/dataCollector.js#L183-L192 |
44,859 | mesmotronic/conbo | src/conbo/binding/BindingUtils.js | function(propertyName, value)
{
if (this[propertyName] === value)
{
return this;
}
// Ensure numbers are returned as Number not String
if (value && conbo.isString(value) && !isNaN(value))
{
value = parseFloat(value);
if (isNaN(value)) value = '';
}
this[propertyName] = valu... | javascript | function(propertyName, value)
{
if (this[propertyName] === value)
{
return this;
}
// Ensure numbers are returned as Number not String
if (value && conbo.isString(value) && !isNaN(value))
{
value = parseFloat(value);
if (isNaN(value)) value = '';
}
this[propertyName] = valu... | [
"function",
"(",
"propertyName",
",",
"value",
")",
"{",
"if",
"(",
"this",
"[",
"propertyName",
"]",
"===",
"value",
")",
"{",
"return",
"this",
";",
"}",
"// Ensure numbers are returned as Number not String\r",
"if",
"(",
"value",
"&&",
"conbo",
".",
"isStri... | Set the value of a property, ensuring Numbers are types correctly
@private
@param propertyName
@param value
@example BindingUtils__set.call(target, 'n', 123);
@returns this | [
"Set",
"the",
"value",
"of",
"a",
"property",
"ensuring",
"Numbers",
"are",
"types",
"correctly"
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/src/conbo/binding/BindingUtils.js#L18-L35 | |
44,860 | mesmotronic/conbo | src/conbo/binding/BindingUtils.js | function(source, propertyName)
{
if (!conbo.isAccessor(source, propertyName) && !conbo.isFunc(source, propertyName))
{
if (source instanceof conbo.EventDispatcher)
{
conbo.makeBindable(source, [propertyName]);
}
else
{
conbo.warn('It will not be possible to detect changes to "'+pro... | javascript | function(source, propertyName)
{
if (!conbo.isAccessor(source, propertyName) && !conbo.isFunc(source, propertyName))
{
if (source instanceof conbo.EventDispatcher)
{
conbo.makeBindable(source, [propertyName]);
}
else
{
conbo.warn('It will not be possible to detect changes to "'+pro... | [
"function",
"(",
"source",
",",
"propertyName",
")",
"{",
"if",
"(",
"!",
"conbo",
".",
"isAccessor",
"(",
"source",
",",
"propertyName",
")",
"&&",
"!",
"conbo",
".",
"isFunc",
"(",
"source",
",",
"propertyName",
")",
")",
"{",
"if",
"(",
"source",
... | Attempt to make a property bindable if it isn't already
@private
@param {string} value
@returns {Boolean} | [
"Attempt",
"to",
"make",
"a",
"property",
"bindable",
"if",
"it",
"isn",
"t",
"already"
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/src/conbo/binding/BindingUtils.js#L56-L69 | |
44,861 | mesmotronic/conbo | src/conbo/binding/BindingUtils.js | function(element, attributeName)
{
if (this.attributeExists(attributeName))
{
var camelCase = conbo.toCamelCase(attributeName),
ns = attributeName.split('-')[0],
attrFuncs = (ns == 'cb') ? BindingUtils__cbAttrs : BindingUtils__customAttrs,
fn = attrFuncs[camelCase]
;
i... | javascript | function(element, attributeName)
{
if (this.attributeExists(attributeName))
{
var camelCase = conbo.toCamelCase(attributeName),
ns = attributeName.split('-')[0],
attrFuncs = (ns == 'cb') ? BindingUtils__cbAttrs : BindingUtils__customAttrs,
fn = attrFuncs[camelCase]
;
i... | [
"function",
"(",
"element",
",",
"attributeName",
")",
"{",
"if",
"(",
"this",
".",
"attributeExists",
"(",
"attributeName",
")",
")",
"{",
"var",
"camelCase",
"=",
"conbo",
".",
"toCamelCase",
"(",
"attributeName",
")",
",",
"ns",
"=",
"attributeName",
".... | Applies the specified read-only Conbo or custom attribute to the specified element
@param {HTMLElement} element - DOM element to bind value to (two-way bind on input/form elements)
@param {string} attributeName - The attribute to bind as it appears in HTML, e.g. "cb-prop-name"
@returns {conbo.BindingUtils} A re... | [
"Applies",
"the",
"specified",
"read",
"-",
"only",
"Conbo",
"or",
"custom",
"attribute",
"to",
"the",
"specified",
"element"
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/src/conbo/binding/BindingUtils.js#L512-L537 | |
44,862 | mesmotronic/conbo | src/conbo/binding/BindingUtils.js | function(view)
{
if (!view)
{
throw new Error('view is undefined');
}
if (!view.__bindings || !view.__bindings.length)
{
return this;
}
var bindings = view.__bindings;
while (bindings.length)
{
var binding = bindings.pop();
try
{
... | javascript | function(view)
{
if (!view)
{
throw new Error('view is undefined');
}
if (!view.__bindings || !view.__bindings.length)
{
return this;
}
var bindings = view.__bindings;
while (bindings.length)
{
var binding = bindings.pop();
try
{
... | [
"function",
"(",
"view",
")",
"{",
"if",
"(",
"!",
"view",
")",
"{",
"throw",
"new",
"Error",
"(",
"'view is undefined'",
")",
";",
"}",
"if",
"(",
"!",
"view",
".",
"__bindings",
"||",
"!",
"view",
".",
"__bindings",
".",
"length",
")",
"{",
"retu... | Removes all data binding from the specified View instance
@param {conbo.View} view
@returns {conbo.BindingUtils} A reference to this object | [
"Removes",
"all",
"data",
"binding",
"from",
"the",
"specified",
"View",
"instance"
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/src/conbo/binding/BindingUtils.js#L712-L740 | |
44,863 | mesmotronic/conbo | src/conbo/binding/BindingUtils.js | function(rootView, namespace, type)
{
type || (type = 'view');
if (['view', 'glimpse'].indexOf(type) == -1)
{
throw new Error(type+' is not a valid type parameter for applyView');
}
var typeClass = conbo[type.charAt(0).toUpperCase()+type.slice(1)],
scope = this
;
... | javascript | function(rootView, namespace, type)
{
type || (type = 'view');
if (['view', 'glimpse'].indexOf(type) == -1)
{
throw new Error(type+' is not a valid type parameter for applyView');
}
var typeClass = conbo[type.charAt(0).toUpperCase()+type.slice(1)],
scope = this
;
... | [
"function",
"(",
"rootView",
",",
"namespace",
",",
"type",
")",
"{",
"type",
"||",
"(",
"type",
"=",
"'view'",
")",
";",
"if",
"(",
"[",
"'view'",
",",
"'glimpse'",
"]",
".",
"indexOf",
"(",
"type",
")",
"==",
"-",
"1",
")",
"{",
"throw",
"new",... | Applies View and Glimpse classes DOM elements based on their cb-view
attribute or tag name
@param {HTMLElement} rootView - DOM element, View or Application class instance
@param {conbo.Namespace} namespace - The current namespace
@param {string} [type=view] - View type, 'view' or 'glimpse'
@returns {conbo.Bin... | [
"Applies",
"View",
"and",
"Glimpse",
"classes",
"DOM",
"elements",
"based",
"on",
"their",
"cb",
"-",
"view",
"attribute",
"or",
"tag",
"name"
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/src/conbo/binding/BindingUtils.js#L751-L794 | |
44,864 | mesmotronic/conbo | src/conbo/binding/BindingUtils.js | function(className, namespace)
{
if (!className || !namespace) return;
try
{
var classReference = namespace[className];
if (conbo.isClass(classReference))
{
return classReference;
}
}
catch (e) {}
} | javascript | function(className, namespace)
{
if (!className || !namespace) return;
try
{
var classReference = namespace[className];
if (conbo.isClass(classReference))
{
return classReference;
}
}
catch (e) {}
} | [
"function",
"(",
"className",
",",
"namespace",
")",
"{",
"if",
"(",
"!",
"className",
"||",
"!",
"namespace",
")",
"return",
";",
"try",
"{",
"var",
"classReference",
"=",
"namespace",
"[",
"className",
"]",
";",
"if",
"(",
"conbo",
".",
"isClass",
"(... | Attempt to convert string into a conbo.Class in the specified namespace
@param {string} className - The name of the class
@param {conbo.Namespace} namespace - The namespace containing the class
@returns {*} | [
"Attempt",
"to",
"convert",
"string",
"into",
"a",
"conbo",
".",
"Class",
"in",
"the",
"specified",
"namespace"
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/src/conbo/binding/BindingUtils.js#L892-L906 | |
44,865 | mesmotronic/conbo | src/conbo/binding/BindingUtils.js | function(name, handler, readOnly, raw)
{
if (!conbo.isString(name) || !conbo.isFunction(handler))
{
conbo.warn("registerAttribute: both 'name' and 'handler' parameters are required");
return this;
}
var split = conbo.toUnderscoreCase(name).split('_');
if (split.length < 2)
... | javascript | function(name, handler, readOnly, raw)
{
if (!conbo.isString(name) || !conbo.isFunction(handler))
{
conbo.warn("registerAttribute: both 'name' and 'handler' parameters are required");
return this;
}
var split = conbo.toUnderscoreCase(name).split('_');
if (split.length < 2)
... | [
"function",
"(",
"name",
",",
"handler",
",",
"readOnly",
",",
"raw",
")",
"{",
"if",
"(",
"!",
"conbo",
".",
"isString",
"(",
"name",
")",
"||",
"!",
"conbo",
".",
"isFunction",
"(",
"handler",
")",
")",
"{",
"conbo",
".",
"warn",
"(",
"\"register... | Register a custom attribute handler
@param {string} name - camelCase version of the attribute name (must include a namespace prefix)
@param {Function} handler - function that will handle the data bound to the element
@param {boolean} readOnly - Whether or not the attribute is read-only (default: false)
@param {b... | [
"Register",
"a",
"custom",
"attribute",
"handler"
] | 339df613eefc48e054e115337079573ad842f717 | https://github.com/mesmotronic/conbo/blob/339df613eefc48e054e115337079573ad842f717/src/conbo/binding/BindingUtils.js#L924-L959 | |
44,866 | invercity/easy-report | lib.js | function(mask) {
var borders = ['border-top','border-right', 'border-bottom', 'border-left'];
var res = {};
for (var i = 0; i < 4; i++) {
if (!(mask & bin(i))) res[borders[i]] = 'none';
}
return res;
} | javascript | function(mask) {
var borders = ['border-top','border-right', 'border-bottom', 'border-left'];
var res = {};
for (var i = 0; i < 4; i++) {
if (!(mask & bin(i))) res[borders[i]] = 'none';
}
return res;
} | [
"function",
"(",
"mask",
")",
"{",
"var",
"borders",
"=",
"[",
"'border-top'",
",",
"'border-right'",
",",
"'border-bottom'",
",",
"'border-left'",
"]",
";",
"var",
"res",
"=",
"{",
"}",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"4",
";... | Exclude borders with 'none-border
@param mask
@return {{}} | [
"Exclude",
"borders",
"with",
"none",
"-",
"border"
] | 92e56a1fd98e6f07d31d5c91149eda9981d3b4b3 | https://github.com/invercity/easy-report/blob/92e56a1fd98e6f07d31d5c91149eda9981d3b4b3/lib.js#L50-L57 | |
44,867 | invercity/easy-report | lib.js | function (obj) {
var clone = _.clone(obj);
if (obj.style) {
var style = obj.style;
clone.style = {
"font-family": style.fontFamily,
"font-size": style.fontSize + "px",
"font-weight": (style.mask & bin(4)) ? "bold" : "normal",
... | javascript | function (obj) {
var clone = _.clone(obj);
if (obj.style) {
var style = obj.style;
clone.style = {
"font-family": style.fontFamily,
"font-size": style.fontSize + "px",
"font-weight": (style.mask & bin(4)) ? "bold" : "normal",
... | [
"function",
"(",
"obj",
")",
"{",
"var",
"clone",
"=",
"_",
".",
"clone",
"(",
"obj",
")",
";",
"if",
"(",
"obj",
".",
"style",
")",
"{",
"var",
"style",
"=",
"obj",
".",
"style",
";",
"clone",
".",
"style",
"=",
"{",
"\"font-family\"",
":",
"s... | Replace object.style with real style
@param obj
@return {*} | [
"Replace",
"object",
".",
"style",
"with",
"real",
"style"
] | 92e56a1fd98e6f07d31d5c91149eda9981d3b4b3 | https://github.com/invercity/easy-report/blob/92e56a1fd98e6f07d31d5c91149eda9981d3b4b3/lib.js#L64-L85 | |
44,868 | AlexisNo/pebo | index.js | callListenersSequentially | function callListenersSequentially(i, args) {
if (!this.events[eventName][i]) {
// If there is no more listener to execute, we return a promise of the event arguments/result
// So we are getting out of the recursive function
return new Promise((resolve, reject) => {
resolve(args);
})... | javascript | function callListenersSequentially(i, args) {
if (!this.events[eventName][i]) {
// If there is no more listener to execute, we return a promise of the event arguments/result
// So we are getting out of the recursive function
return new Promise((resolve, reject) => {
resolve(args);
})... | [
"function",
"callListenersSequentially",
"(",
"i",
",",
"args",
")",
"{",
"if",
"(",
"!",
"this",
".",
"events",
"[",
"eventName",
"]",
"[",
"i",
"]",
")",
"{",
"// If there is no more listener to execute, we return a promise of the event arguments/result",
"// So we ar... | Define a recusive function that will check if a plugin implements the hook, execute it and pass the eventually transformed arguments to the next one | [
"Define",
"a",
"recusive",
"function",
"that",
"will",
"check",
"if",
"a",
"plugin",
"implements",
"the",
"hook",
"execute",
"it",
"and",
"pass",
"the",
"eventually",
"transformed",
"arguments",
"to",
"the",
"next",
"one"
] | 59fe7698a099a12c469b09d3c1cda2a9e334f87e | https://github.com/AlexisNo/pebo/blob/59fe7698a099a12c469b09d3c1cda2a9e334f87e/index.js#L57-L80 |
44,869 | xudafeng/passme | demo/editor/kissy.js | function (arr, callback, initialValue) {
var len = arr.length;
if (typeof callback !== 'function') {
throw new TypeError('callback is not function!');
}
// no value to return if no initial value and an empty array
if (len === 0 && arguments.le... | javascript | function (arr, callback, initialValue) {
var len = arr.length;
if (typeof callback !== 'function') {
throw new TypeError('callback is not function!');
}
// no value to return if no initial value and an empty array
if (len === 0 && arguments.le... | [
"function",
"(",
"arr",
",",
"callback",
",",
"initialValue",
")",
"{",
"var",
"len",
"=",
"arr",
".",
"length",
";",
"if",
"(",
"typeof",
"callback",
"!==",
"'function'",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"'callback is not function!'",
")",
";",... | Executes the supplied function on each item in the array.
Returns a value which is accumulation of the value that the supplied
function returned.
@param arr {Array} the array to iterate
@param callback {Function} the function to execute on each item
@param initialValue {number} optional context object
refer: https://d... | [
"Executes",
"the",
"supplied",
"function",
"on",
"each",
"item",
"in",
"the",
"array",
".",
"Returns",
"a",
"value",
"which",
"is",
"accumulation",
"of",
"the",
"value",
"that",
"the",
"supplied",
"function",
"returned",
"."
] | 14c5a9d76569fc67101b35284ea2f049bcc9896e | https://github.com/xudafeng/passme/blob/14c5a9d76569fc67101b35284ea2f049bcc9896e/demo/editor/kissy.js#L906-L946 | |
44,870 | xudafeng/passme | demo/editor/kissy.js | function (o) {
if (o == null) {
return [];
}
if (S.isArray(o)) {
return o;
}
var lengthType = typeof o.length,
oType = typeof o;
// The strings and functions also have 'length'
if (lengthT... | javascript | function (o) {
if (o == null) {
return [];
}
if (S.isArray(o)) {
return o;
}
var lengthType = typeof o.length,
oType = typeof o;
// The strings and functions also have 'length'
if (lengthT... | [
"function",
"(",
"o",
")",
"{",
"if",
"(",
"o",
"==",
"null",
")",
"{",
"return",
"[",
"]",
";",
"}",
"if",
"(",
"S",
".",
"isArray",
"(",
"o",
")",
")",
"{",
"return",
"o",
";",
"}",
"var",
"lengthType",
"=",
"typeof",
"o",
".",
"length",
... | Converts object to a TRUE array.
@param o {object|Array} array like object or array
@return {Array} native Array
@member KISSY | [
"Converts",
"object",
"to",
"a",
"TRUE",
"array",
"."
] | 14c5a9d76569fc67101b35284ea2f049bcc9896e | https://github.com/xudafeng/passme/blob/14c5a9d76569fc67101b35284ea2f049bcc9896e/demo/editor/kissy.js#L999-L1025 | |
44,871 | xudafeng/passme | demo/editor/kissy.js | function (path, ext) {
var result = path.match(splitPathRe) || [],
basename;
basename = result[3] || '';
if (ext && basename && basename.slice(-1 * ext.length) == ext) {
basename = basename.slice(0, -1 * ext.length);
}
return ba... | javascript | function (path, ext) {
var result = path.match(splitPathRe) || [],
basename;
basename = result[3] || '';
if (ext && basename && basename.slice(-1 * ext.length) == ext) {
basename = basename.slice(0, -1 * ext.length);
}
return ba... | [
"function",
"(",
"path",
",",
"ext",
")",
"{",
"var",
"result",
"=",
"path",
".",
"match",
"(",
"splitPathRe",
")",
"||",
"[",
"]",
",",
"basename",
";",
"basename",
"=",
"result",
"[",
"3",
"]",
"||",
"''",
";",
"if",
"(",
"ext",
"&&",
"basename... | Get base name of path
@param {String} path
@param {String} [ext] ext to be stripped from result returned.
@return {String} | [
"Get",
"base",
"name",
"of",
"path"
] | 14c5a9d76569fc67101b35284ea2f049bcc9896e | https://github.com/xudafeng/passme/blob/14c5a9d76569fc67101b35284ea2f049bcc9896e/demo/editor/kissy.js#L2180-L2188 | |
44,872 | xudafeng/passme | demo/editor/kissy.js | function (key, value) {
var self = this,
_queryMap,
currentValue;
if (typeof key == 'string') {
parseQuery(self);
_queryMap = self._queryMap;
currentValue = _queryMap[key];
if (currentValue === undefi... | javascript | function (key, value) {
var self = this,
_queryMap,
currentValue;
if (typeof key == 'string') {
parseQuery(self);
_queryMap = self._queryMap;
currentValue = _queryMap[key];
if (currentValue === undefi... | [
"function",
"(",
"key",
",",
"value",
")",
"{",
"var",
"self",
"=",
"this",
",",
"_queryMap",
",",
"currentValue",
";",
"if",
"(",
"typeof",
"key",
"==",
"'string'",
")",
"{",
"parseQuery",
"(",
"self",
")",
";",
"_queryMap",
"=",
"self",
".",
"_quer... | Add parameter value corresponding to current key
@param {String} key
@param value
@chainable | [
"Add",
"parameter",
"value",
"corresponding",
"to",
"current",
"key"
] | 14c5a9d76569fc67101b35284ea2f049bcc9896e | https://github.com/xudafeng/passme/blob/14c5a9d76569fc67101b35284ea2f049bcc9896e/demo/editor/kissy.js#L2450-L2473 | |
44,873 | xudafeng/passme | demo/editor/kissy.js | function (other) {
var self = this;
// port and hostname has to be same
return equalsIgnoreCase(self.hostname, other['hostname']) &&
equalsIgnoreCase(self.scheme, other['scheme']) &&
equalsIgnoreCase(self.port, other['port']);
} | javascript | function (other) {
var self = this;
// port and hostname has to be same
return equalsIgnoreCase(self.hostname, other['hostname']) &&
equalsIgnoreCase(self.scheme, other['scheme']) &&
equalsIgnoreCase(self.port, other['port']);
} | [
"function",
"(",
"other",
")",
"{",
"var",
"self",
"=",
"this",
";",
"// port and hostname has to be same",
"return",
"equalsIgnoreCase",
"(",
"self",
".",
"hostname",
",",
"other",
"[",
"'hostname'",
"]",
")",
"&&",
"equalsIgnoreCase",
"(",
"self",
".",
"sche... | Judge whether two uri has same domain.
@param {KISSY.Uri} other
@return {Boolean} | [
"Judge",
"whether",
"two",
"uri",
"has",
"same",
"domain",
"."
] | 14c5a9d76569fc67101b35284ea2f049bcc9896e | https://github.com/xudafeng/passme/blob/14c5a9d76569fc67101b35284ea2f049bcc9896e/demo/editor/kissy.js#L2809-L2815 | |
44,874 | xudafeng/passme | demo/editor/kissy.js | function (serializeArray) {
var out = [],
self = this,
scheme,
hostname,
path,
port,
fragment,
query,
userInfo;
if (scheme = self.scheme) {
out.push(e... | javascript | function (serializeArray) {
var out = [],
self = this,
scheme,
hostname,
path,
port,
fragment,
query,
userInfo;
if (scheme = self.scheme) {
out.push(e... | [
"function",
"(",
"serializeArray",
")",
"{",
"var",
"out",
"=",
"[",
"]",
",",
"self",
"=",
"this",
",",
"scheme",
",",
"hostname",
",",
"path",
",",
"port",
",",
"fragment",
",",
"query",
",",
"userInfo",
";",
"if",
"(",
"scheme",
"=",
"self",
"."... | Serialize to string.
See rfc 5.3 Component Recomposition.
But kissy does not differentiate between undefined and empty.
@param {Boolean} [serializeArray=true]
whether append [] to key name when value 's type is array
@return {String} | [
"Serialize",
"to",
"string",
".",
"See",
"rfc",
"5",
".",
"3",
"Component",
"Recomposition",
".",
"But",
"kissy",
"does",
"not",
"differentiate",
"between",
"undefined",
"and",
"empty",
"."
] | 14c5a9d76569fc67101b35284ea2f049bcc9896e | https://github.com/xudafeng/passme/blob/14c5a9d76569fc67101b35284ea2f049bcc9896e/demo/editor/kissy.js#L2825-L2876 | |
44,875 | xudafeng/passme | demo/editor/kissy.js | function (runtime, modNames) {
S.each(modNames, function (m) {
Utils.createModuleInfo(runtime, m);
});
} | javascript | function (runtime, modNames) {
S.each(modNames, function (m) {
Utils.createModuleInfo(runtime, m);
});
} | [
"function",
"(",
"runtime",
",",
"modNames",
")",
"{",
"S",
".",
"each",
"(",
"modNames",
",",
"function",
"(",
"m",
")",
"{",
"Utils",
".",
"createModuleInfo",
"(",
"runtime",
",",
"m",
")",
";",
"}",
")",
";",
"}"
] | create modules info
@param runtime Module container, such as KISSY
@param {String[]} modNames to be created module names | [
"create",
"modules",
"info"
] | 14c5a9d76569fc67101b35284ea2f049bcc9896e | https://github.com/xudafeng/passme/blob/14c5a9d76569fc67101b35284ea2f049bcc9896e/demo/editor/kissy.js#L3619-L3623 | |
44,876 | xudafeng/passme | demo/editor/kissy.js | function (runtime, modNames) {
var mods = [runtime], mod,
unalias,
allOk,
m,
runtimeMods = runtime.Env.mods;
S.each(modNames, function (modName) {
mod = runtimeMods[modName];
if (!mod || mod.getType(... | javascript | function (runtime, modNames) {
var mods = [runtime], mod,
unalias,
allOk,
m,
runtimeMods = runtime.Env.mods;
S.each(modNames, function (modName) {
mod = runtimeMods[modName];
if (!mod || mod.getType(... | [
"function",
"(",
"runtime",
",",
"modNames",
")",
"{",
"var",
"mods",
"=",
"[",
"runtime",
"]",
",",
"mod",
",",
"unalias",
",",
"allOk",
",",
"m",
",",
"runtimeMods",
"=",
"runtime",
".",
"Env",
".",
"mods",
";",
"S",
".",
"each",
"(",
"modNames",... | Get module values
@param runtime Module container, such as KISSY
@param {String[]} modNames module names
@return {Array} module values | [
"Get",
"module",
"values"
] | 14c5a9d76569fc67101b35284ea2f049bcc9896e | https://github.com/xudafeng/passme/blob/14c5a9d76569fc67101b35284ea2f049bcc9896e/demo/editor/kissy.js#L3667-L3691 | |
44,877 | xudafeng/passme | demo/editor/kissy.js | function (runtime, mod) {
if (mod.status != LOADED) {
return;
}
var fn = mod.fn;
if (typeof fn === 'function') {
// 需要解开 index,相对路径
// 但是需要保留 alias,防止值不对应
mod.value = fn.apply(mod, Utils.getModules(runtime,... | javascript | function (runtime, mod) {
if (mod.status != LOADED) {
return;
}
var fn = mod.fn;
if (typeof fn === 'function') {
// 需要解开 index,相对路径
// 但是需要保留 alias,防止值不对应
mod.value = fn.apply(mod, Utils.getModules(runtime,... | [
"function",
"(",
"runtime",
",",
"mod",
")",
"{",
"if",
"(",
"mod",
".",
"status",
"!=",
"LOADED",
")",
"{",
"return",
";",
"}",
"var",
"fn",
"=",
"mod",
".",
"fn",
";",
"if",
"(",
"typeof",
"fn",
"===",
"'function'",
")",
"{",
"// 需要解开 index,相对路径"... | Attach specified mod.
@param runtime Module container, such as KISSY
@param {KISSY.Loader.Module} mod module instance | [
"Attach",
"specified",
"mod",
"."
] | 14c5a9d76569fc67101b35284ea2f049bcc9896e | https://github.com/xudafeng/passme/blob/14c5a9d76569fc67101b35284ea2f049bcc9896e/demo/editor/kissy.js#L3768-L3784 | |
44,878 | xudafeng/passme | demo/editor/kissy.js | function (runtime, path, rules) {
var mappedRules = rules ||
runtime.Config.mappedRules ||
[],
i,
m,
rule;
for (i = 0; i < mappedRules.length; i++) {
rule = mappedRules[i];
if ... | javascript | function (runtime, path, rules) {
var mappedRules = rules ||
runtime.Config.mappedRules ||
[],
i,
m,
rule;
for (i = 0; i < mappedRules.length; i++) {
rule = mappedRules[i];
if ... | [
"function",
"(",
"runtime",
",",
"path",
",",
"rules",
")",
"{",
"var",
"mappedRules",
"=",
"rules",
"||",
"runtime",
".",
"Config",
".",
"mappedRules",
"||",
"[",
"]",
",",
"i",
",",
"m",
",",
"rule",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
... | Get mapped path.
@param runtime Module container, such as KISSY
@param {String} path module path
@param [rules] map rules
@return {String} mapped path | [
"Get",
"mapped",
"path",
"."
] | 14c5a9d76569fc67101b35284ea2f049bcc9896e | https://github.com/xudafeng/passme/blob/14c5a9d76569fc67101b35284ea2f049bcc9896e/demo/editor/kissy.js#L3912-L3926 | |
44,879 | xudafeng/passme | demo/editor/kissy.js | function () {
var self = this;
if (self.packageUri) {
return self.packageUri;
}
return self.packageUri = new S.Uri(this.getPrefixUriForCombo());
} | javascript | function () {
var self = this;
if (self.packageUri) {
return self.packageUri;
}
return self.packageUri = new S.Uri(this.getPrefixUriForCombo());
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"self",
".",
"packageUri",
")",
"{",
"return",
"self",
".",
"packageUri",
";",
"}",
"return",
"self",
".",
"packageUri",
"=",
"new",
"S",
".",
"Uri",
"(",
"this",
".",
"getPrefi... | get package uri | [
"get",
"package",
"uri"
] | 14c5a9d76569fc67101b35284ea2f049bcc9896e | https://github.com/xudafeng/passme/blob/14c5a9d76569fc67101b35284ea2f049bcc9896e/demo/editor/kissy.js#L4011-L4017 | |
44,880 | xudafeng/passme | demo/editor/kissy.js | function () {
var self = this,
t,
fullPathUri,
packageBaseUri,
packageInfo,
packageName,
path;
if (!self.fullPathUri) {
if (self.fullpath) {
fullPathUri = new S.Uri... | javascript | function () {
var self = this,
t,
fullPathUri,
packageBaseUri,
packageInfo,
packageName,
path;
if (!self.fullPathUri) {
if (self.fullpath) {
fullPathUri = new S.Uri... | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
",",
"t",
",",
"fullPathUri",
",",
"packageBaseUri",
",",
"packageInfo",
",",
"packageName",
",",
"path",
";",
"if",
"(",
"!",
"self",
".",
"fullPathUri",
")",
"{",
"if",
"(",
"self",
".",
"fullp... | Get the fullpath uri of current module if load dynamically
@return {KISSY.Uri} | [
"Get",
"the",
"fullpath",
"uri",
"of",
"current",
"module",
"if",
"load",
"dynamically"
] | 14c5a9d76569fc67101b35284ea2f049bcc9896e | https://github.com/xudafeng/passme/blob/14c5a9d76569fc67101b35284ea2f049bcc9896e/demo/editor/kissy.js#L4133-L4163 | |
44,881 | xudafeng/passme | demo/editor/kissy.js | function () {
var self = this,
fullPathUri;
if (!self.fullpath) {
fullPathUri = self.getFullPathUri();
self.fullpath = Utils.getMappedPath(self.runtime, fullPathUri.toString());
}
return self.fullpath;
} | javascript | function () {
var self = this,
fullPathUri;
if (!self.fullpath) {
fullPathUri = self.getFullPathUri();
self.fullpath = Utils.getMappedPath(self.runtime, fullPathUri.toString());
}
return self.fullpath;
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
",",
"fullPathUri",
";",
"if",
"(",
"!",
"self",
".",
"fullpath",
")",
"{",
"fullPathUri",
"=",
"self",
".",
"getFullPathUri",
"(",
")",
";",
"self",
".",
"fullpath",
"=",
"Utils",
".",
"getMappe... | Get the fullpath of current module if load dynamically
@return {String} | [
"Get",
"the",
"fullpath",
"of",
"current",
"module",
"if",
"load",
"dynamically"
] | 14c5a9d76569fc67101b35284ea2f049bcc9896e | https://github.com/xudafeng/passme/blob/14c5a9d76569fc67101b35284ea2f049bcc9896e/demo/editor/kissy.js#L4169-L4177 | |
44,882 | xudafeng/passme | demo/editor/kissy.js | function () {
var self = this,
runtime = self.runtime;
return S.map(self.getNormalizedRequires(), function (r) {
return Utils.createModuleInfo(runtime, r);
});
} | javascript | function () {
var self = this,
runtime = self.runtime;
return S.map(self.getNormalizedRequires(), function (r) {
return Utils.createModuleInfo(runtime, r);
});
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
",",
"runtime",
"=",
"self",
".",
"runtime",
";",
"return",
"S",
".",
"map",
"(",
"self",
".",
"getNormalizedRequires",
"(",
")",
",",
"function",
"(",
"r",
")",
"{",
"return",
"Utils",
".",
"c... | Get module objects required by this module
@return {KISSY.Loader.Module[]} | [
"Get",
"module",
"objects",
"required",
"by",
"this",
"module"
] | 14c5a9d76569fc67101b35284ea2f049bcc9896e | https://github.com/xudafeng/passme/blob/14c5a9d76569fc67101b35284ea2f049bcc9896e/demo/editor/kissy.js#L4238-L4244 | |
44,883 | xudafeng/passme | demo/editor/kissy.js | function () {
var self = this,
normalizedRequires,
normalizedRequiresStatus = self.normalizedRequiresStatus,
status = self.status,
requires = self.requires;
if (!requires || requires.length == 0) {
return requires ||... | javascript | function () {
var self = this,
normalizedRequires,
normalizedRequiresStatus = self.normalizedRequiresStatus,
status = self.status,
requires = self.requires;
if (!requires || requires.length == 0) {
return requires ||... | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
",",
"normalizedRequires",
",",
"normalizedRequiresStatus",
"=",
"self",
".",
"normalizedRequiresStatus",
",",
"status",
"=",
"self",
".",
"status",
",",
"requires",
"=",
"self",
".",
"requires",
";",
"i... | Get module names required by this module
@return {KISSY.Loader.Module[]} | [
"Get",
"module",
"names",
"required",
"by",
"this",
"module"
] | 14c5a9d76569fc67101b35284ea2f049bcc9896e | https://github.com/xudafeng/passme/blob/14c5a9d76569fc67101b35284ea2f049bcc9896e/demo/editor/kissy.js#L4263-L4280 | |
44,884 | xudafeng/passme | demo/editor/kissy.js | function (moduleName) {
var moduleNames = Utils.unalias(S, Utils.normalizeModNamesWithAlias(S, [moduleName]));
if (Utils.attachModsRecursively(moduleNames, S)) {
return Utils.getModules(S, moduleNames)[1];
}
return undefined;
} | javascript | function (moduleName) {
var moduleNames = Utils.unalias(S, Utils.normalizeModNamesWithAlias(S, [moduleName]));
if (Utils.attachModsRecursively(moduleNames, S)) {
return Utils.getModules(S, moduleNames)[1];
}
return undefined;
} | [
"function",
"(",
"moduleName",
")",
"{",
"var",
"moduleNames",
"=",
"Utils",
".",
"unalias",
"(",
"S",
",",
"Utils",
".",
"normalizeModNamesWithAlias",
"(",
"S",
",",
"[",
"moduleName",
"]",
")",
")",
";",
"if",
"(",
"Utils",
".",
"attachModsRecursively",
... | get module value from KISSY module cache
@param {String} moduleName module name
@member KISSY
@return {*} value of module which name is moduleName | [
"get",
"module",
"value",
"from",
"KISSY",
"module",
"cache"
] | 14c5a9d76569fc67101b35284ea2f049bcc9896e | https://github.com/xudafeng/passme/blob/14c5a9d76569fc67101b35284ea2f049bcc9896e/demo/editor/kissy.js#L5349-L5355 | |
44,885 | xudafeng/passme | demo/editor/kissy.js | function (data) {
if (data && RE_NOT_WHITESPACE.test(data)) {
// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
// http://msdn.microsoft.com/en-us/library/ie/ms536420(v=vs.85).aspx always return null
( win.execScript ||... | javascript | function (data) {
if (data && RE_NOT_WHITESPACE.test(data)) {
// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
// http://msdn.microsoft.com/en-us/library/ie/ms536420(v=vs.85).aspx always return null
( win.execScript ||... | [
"function",
"(",
"data",
")",
"{",
"if",
"(",
"data",
"&&",
"RE_NOT_WHITESPACE",
".",
"test",
"(",
"data",
")",
")",
"{",
"// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context",
"// http://msdn.microsoft.com/en-us/library/ie/ms536420(v=vs.85)... | Evaluates a script in a global context.
@member KISSY | [
"Evaluates",
"a",
"script",
"in",
"a",
"global",
"context",
"."
] | 14c5a9d76569fc67101b35284ea2f049bcc9896e | https://github.com/xudafeng/passme/blob/14c5a9d76569fc67101b35284ea2f049bcc9896e/demo/editor/kissy.js#L5570-L5578 | |
44,886 | nodejitsu/contour | pagelets/pills.js | links | function links(options) {
var page = this.page;
return this.navigation.reduce(function reduce(menu, item) {
if (page === item.page) item.class = (item.class || '') + ' active';
if (item.class) item.class = ' class="' + item.class + '"';
if (item.swap) item.swap = ' data-swap="' + item.swap.h... | javascript | function links(options) {
var page = this.page;
return this.navigation.reduce(function reduce(menu, item) {
if (page === item.page) item.class = (item.class || '') + ' active';
if (item.class) item.class = ' class="' + item.class + '"';
if (item.swap) item.swap = ' data-swap="' + item.swap.h... | [
"function",
"links",
"(",
"options",
")",
"{",
"var",
"page",
"=",
"this",
".",
"page",
";",
"return",
"this",
".",
"navigation",
".",
"reduce",
"(",
"function",
"reduce",
"(",
"menu",
",",
"item",
")",
"{",
"if",
"(",
"page",
"===",
"item",
".",
"... | Handblebar helper to generate each pill. The base is defined by
the active page and should match the page defined in the navigation.
@param {Object} options
@return {String} generated template
@api private | [
"Handblebar",
"helper",
"to",
"generate",
"each",
"pill",
".",
"The",
"base",
"is",
"defined",
"by",
"the",
"active",
"page",
"and",
"should",
"match",
"the",
"page",
"defined",
"in",
"the",
"navigation",
"."
] | 0828e9bd25ef1eeb97ea231c447118d9867021b6 | https://github.com/nodejitsu/contour/blob/0828e9bd25ef1eeb97ea231c447118d9867021b6/pagelets/pills.js#L46-L59 |
44,887 | vid/SenseBase | lib/pubsub-client.js | publish | function publish(loc, data) {
data = data || {};
data.clientID = clientID;
fayeClient.publish(loc, data);
} | javascript | function publish(loc, data) {
data = data || {};
data.clientID = clientID;
fayeClient.publish(loc, data);
} | [
"function",
"publish",
"(",
"loc",
",",
"data",
")",
"{",
"data",
"=",
"data",
"||",
"{",
"}",
";",
"data",
".",
"clientID",
"=",
"clientID",
";",
"fayeClient",
".",
"publish",
"(",
"loc",
",",
"data",
")",
";",
"}"
] | send clientID with publish | [
"send",
"clientID",
"with",
"publish"
] | d60bcf28239e7dde437d8a6bdae41a6921dcd05b | https://github.com/vid/SenseBase/blob/d60bcf28239e7dde437d8a6bdae41a6921dcd05b/lib/pubsub-client.js#L16-L20 |
44,888 | vid/SenseBase | lib/pubsub-client.js | function(title, content, callback) {
console.log('mltc');
publish('/query/moreLikeThisContent', { title: title, content: content });
results(callback);
} | javascript | function(title, content, callback) {
console.log('mltc');
publish('/query/moreLikeThisContent', { title: title, content: content });
results(callback);
} | [
"function",
"(",
"title",
",",
"content",
",",
"callback",
")",
"{",
"console",
".",
"log",
"(",
"'mltc'",
")",
";",
"publish",
"(",
"'/query/moreLikeThisContent'",
",",
"{",
"title",
":",
"title",
",",
"content",
":",
"content",
"}",
")",
";",
"results"... | Perform a moreLikeThis query for text | [
"Perform",
"a",
"moreLikeThis",
"query",
"for",
"text"
] | d60bcf28239e7dde437d8a6bdae41a6921dcd05b | https://github.com/vid/SenseBase/blob/d60bcf28239e7dde437d8a6bdae41a6921dcd05b/lib/pubsub-client.js#L93-L97 | |
44,889 | vid/SenseBase | lib/pubsub-client.js | function(options, cb) {
console.log('/watch/request', options);
publish('/watch/request', options);
fayeClient.subscribe('/watch/results/' + clientID, cb);
} | javascript | function(options, cb) {
console.log('/watch/request', options);
publish('/watch/request', options);
fayeClient.subscribe('/watch/results/' + clientID, cb);
} | [
"function",
"(",
"options",
",",
"cb",
")",
"{",
"console",
".",
"log",
"(",
"'/watch/request'",
",",
"options",
")",
";",
"publish",
"(",
"'/watch/request'",
",",
"options",
")",
";",
"fayeClient",
".",
"subscribe",
"(",
"'/watch/results/'",
"+",
"clientID"... | Request subscriptions for user. | [
"Request",
"subscriptions",
"for",
"user",
"."
] | d60bcf28239e7dde437d8a6bdae41a6921dcd05b | https://github.com/vid/SenseBase/blob/d60bcf28239e7dde437d8a6bdae41a6921dcd05b/lib/pubsub-client.js#L213-L217 | |
44,890 | folkelib/folke-ko-infinite-scroll | dist/index.js | isElementInViewport | function isElementInViewport(el) {
var eap;
var rect = el.getBoundingClientRect();
var docEl = document.documentElement;
var vWidth = window.innerWidth || docEl.clientWidth;
var vHeight = window.innerHeight || docEl.clientHeight;
var efp = function (x, y) { return document.elementFromPoint(x, y)... | javascript | function isElementInViewport(el) {
var eap;
var rect = el.getBoundingClientRect();
var docEl = document.documentElement;
var vWidth = window.innerWidth || docEl.clientWidth;
var vHeight = window.innerHeight || docEl.clientHeight;
var efp = function (x, y) { return document.elementFromPoint(x, y)... | [
"function",
"isElementInViewport",
"(",
"el",
")",
"{",
"var",
"eap",
";",
"var",
"rect",
"=",
"el",
".",
"getBoundingClientRect",
"(",
")",
";",
"var",
"docEl",
"=",
"document",
".",
"documentElement",
";",
"var",
"vWidth",
"=",
"window",
".",
"innerWidth... | Checks if an element is in the viewport | [
"Checks",
"if",
"an",
"element",
"is",
"in",
"the",
"viewport"
] | 49aa555139b4f5cc7f75d47553b2b9b50b87bdf4 | https://github.com/folkelib/folke-ko-infinite-scroll/blob/49aa555139b4f5cc7f75d47553b2b9b50b87bdf4/dist/index.js#L17-L34 |
44,891 | canvaspop/grunt-static-versioning | tasks/versioning.js | versioningJSON | function versioningJSON ( obj, dest, ns ) {
var content = {};
content[ ns ] = obj;
var json = JSON.stringify( content, null, 2 );
grunt.log.subhead( 'Generating JSON config file' );
grunt.file.write( dest + '/assets.config.json', json );
grunt.log.ok( 'File "' + dest + '/... | javascript | function versioningJSON ( obj, dest, ns ) {
var content = {};
content[ ns ] = obj;
var json = JSON.stringify( content, null, 2 );
grunt.log.subhead( 'Generating JSON config file' );
grunt.file.write( dest + '/assets.config.json', json );
grunt.log.ok( 'File "' + dest + '/... | [
"function",
"versioningJSON",
"(",
"obj",
",",
"dest",
",",
"ns",
")",
"{",
"var",
"content",
"=",
"{",
"}",
";",
"content",
"[",
"ns",
"]",
"=",
"obj",
";",
"var",
"json",
"=",
"JSON",
".",
"stringify",
"(",
"content",
",",
"null",
",",
"2",
")"... | Generate a JSON config file
@todo Determine if keeping these in this file is the right approach
@param {Object} obj Versioning object created by the task
@param {String} dest Location to save the generated config file
@param {String} ns Namespace to wrap config content
@return {undefined} | [
"Generate",
"a",
"JSON",
"config",
"file"
] | f347fd40e86aee639ba0e3502ae3828705ed9434 | https://github.com/canvaspop/grunt-static-versioning/blob/f347fd40e86aee639ba0e3502ae3828705ed9434/tasks/versioning.js#L134-L141 |
44,892 | canvaspop/grunt-static-versioning | tasks/versioning.js | versioningPHP | function versioningPHP ( obj, dest, ns ) {
var contents = '<?php\n';
contents += 'return array(\n';
contents += ' \'' + ns + '\' => array(\n';
for ( var key in obj ) {
if ( obj.hasOwnProperty( key ) ) {
contents += ' \'' + key + '\' => array(\n';
... | javascript | function versioningPHP ( obj, dest, ns ) {
var contents = '<?php\n';
contents += 'return array(\n';
contents += ' \'' + ns + '\' => array(\n';
for ( var key in obj ) {
if ( obj.hasOwnProperty( key ) ) {
contents += ' \'' + key + '\' => array(\n';
... | [
"function",
"versioningPHP",
"(",
"obj",
",",
"dest",
",",
"ns",
")",
"{",
"var",
"contents",
"=",
"'<?php\\n'",
";",
"contents",
"+=",
"'return array(\\n'",
";",
"contents",
"+=",
"' \\''",
"+",
"ns",
"+",
"'\\' => array(\\n'",
";",
"for",
"(",
"var",
... | Generate a PHP config file
@todo Determine if keeping these in this file is the right approach
@param {Object} obj Versioning object created by the task
@param {String} dest Location to save the generated config file
@param {String} ns Namespace to wrap config content
@return {undefined} | [
"Generate",
"a",
"PHP",
"config",
"file"
] | f347fd40e86aee639ba0e3502ae3828705ed9434 | https://github.com/canvaspop/grunt-static-versioning/blob/f347fd40e86aee639ba0e3502ae3828705ed9434/tasks/versioning.js#L153-L175 |
44,893 | Stitchuuuu/thread-promisify | index.js | ParseMessageFromThread | function ParseMessageFromThread(o) {
var o = UnserializeFromProcess(o);
if (typeof(o) == "object" && o.name && o.args) {
// Process response from the thread
// Electron: If we are in the Main Process, and it is not a global message, we executed it too
if (!isElectron || electron.ipcRend... | javascript | function ParseMessageFromThread(o) {
var o = UnserializeFromProcess(o);
if (typeof(o) == "object" && o.name && o.args) {
// Process response from the thread
// Electron: If we are in the Main Process, and it is not a global message, we executed it too
if (!isElectron || electron.ipcRend... | [
"function",
"ParseMessageFromThread",
"(",
"o",
")",
"{",
"var",
"o",
"=",
"UnserializeFromProcess",
"(",
"o",
")",
";",
"if",
"(",
"typeof",
"(",
"o",
")",
"==",
"\"object\"",
"&&",
"o",
".",
"name",
"&&",
"o",
".",
"args",
")",
"{",
"// Process respo... | Parse the message from the thread or just passthrough to the Electron Renderer Process concerned | [
"Parse",
"the",
"message",
"from",
"the",
"thread",
"or",
"just",
"passthrough",
"to",
"the",
"Electron",
"Renderer",
"Process",
"concerned"
] | 5c6fc0b481520049e2078461693ceee7c27ddd53 | https://github.com/Stitchuuuu/thread-promisify/blob/5c6fc0b481520049e2078461693ceee7c27ddd53/index.js#L159-L175 |
44,894 | Stitchuuuu/thread-promisify | index.js | CheckPendingThreadRequests | function CheckPendingThreadRequests() {
while (PendingThreadRequests.length) {
var tq = PendingThreadRequests.shift();
if (!SendThreadRequest(tq)) {
// No available thread, we queue the request, again
PendingThreadRequests.unshift(tq);
break;
}
}
} | javascript | function CheckPendingThreadRequests() {
while (PendingThreadRequests.length) {
var tq = PendingThreadRequests.shift();
if (!SendThreadRequest(tq)) {
// No available thread, we queue the request, again
PendingThreadRequests.unshift(tq);
break;
}
}
} | [
"function",
"CheckPendingThreadRequests",
"(",
")",
"{",
"while",
"(",
"PendingThreadRequests",
".",
"length",
")",
"{",
"var",
"tq",
"=",
"PendingThreadRequests",
".",
"shift",
"(",
")",
";",
"if",
"(",
"!",
"SendThreadRequest",
"(",
"tq",
")",
")",
"{",
... | Check if there is a request waiting and execute it on an inactive thread available | [
"Check",
"if",
"there",
"is",
"a",
"request",
"waiting",
"and",
"execute",
"it",
"on",
"an",
"inactive",
"thread",
"available"
] | 5c6fc0b481520049e2078461693ceee7c27ddd53 | https://github.com/Stitchuuuu/thread-promisify/blob/5c6fc0b481520049e2078461693ceee7c27ddd53/index.js#L183-L192 |
44,895 | Stitchuuuu/thread-promisify | index.js | findObject | function findObject(c, obj, path, alreadyParsed) {
if (!path) {
path = [];
}
// Recursive reference : boooh, very wrong
if (!alreadyParsed) {
alreadyParsed = [];
}
var keys = Object.keys(obj);
alreadyParsed.push(obj);
for (var key = 0; key < keys.length; key++) {
... | javascript | function findObject(c, obj, path, alreadyParsed) {
if (!path) {
path = [];
}
// Recursive reference : boooh, very wrong
if (!alreadyParsed) {
alreadyParsed = [];
}
var keys = Object.keys(obj);
alreadyParsed.push(obj);
for (var key = 0; key < keys.length; key++) {
... | [
"function",
"findObject",
"(",
"c",
",",
"obj",
",",
"path",
",",
"alreadyParsed",
")",
"{",
"if",
"(",
"!",
"path",
")",
"{",
"path",
"=",
"[",
"]",
";",
"}",
"// Recursive reference : boooh, very wrong",
"if",
"(",
"!",
"alreadyParsed",
")",
"{",
"alre... | Find an object recursively and return the path where it was founded
Use in Threadify function to find the module and the path to the object
so we can clone it in the thread | [
"Find",
"an",
"object",
"recursively",
"and",
"return",
"the",
"path",
"where",
"it",
"was",
"founded",
"Use",
"in",
"Threadify",
"function",
"to",
"find",
"the",
"module",
"and",
"the",
"path",
"to",
"the",
"object",
"so",
"we",
"can",
"clone",
"it",
"i... | 5c6fc0b481520049e2078461693ceee7c27ddd53 | https://github.com/Stitchuuuu/thread-promisify/blob/5c6fc0b481520049e2078461693ceee7c27ddd53/index.js#L414-L444 |
44,896 | Stitchuuuu/thread-promisify | index.js | Threadify | function Threadify(options) {
if (typeof(options) == "string") {
options = {methods: [options]};
} else if (Array.isArray(options)) {
options = {methods: options};
} else {
if (options !== undefined && typeof(options) != "object") {
throw new Error("[Threadify] You must s... | javascript | function Threadify(options) {
if (typeof(options) == "string") {
options = {methods: [options]};
} else if (Array.isArray(options)) {
options = {methods: options};
} else {
if (options !== undefined && typeof(options) != "object") {
throw new Error("[Threadify] You must s... | [
"function",
"Threadify",
"(",
"options",
")",
"{",
"if",
"(",
"typeof",
"(",
"options",
")",
"==",
"\"string\"",
")",
"{",
"options",
"=",
"{",
"methods",
":",
"[",
"options",
"]",
"}",
";",
"}",
"else",
"if",
"(",
"Array",
".",
"isArray",
"(",
"op... | Threadify a class or an object defined in a separate uncore module
Cored module like fs, path, and others can't be threadified
Options can be:
- Nothing: all functions are threadified
- A String: the specific function is threadified
- An array of string: all the functions specified are threadified
For class only:
The... | [
"Threadify",
"a",
"class",
"or",
"an",
"object",
"defined",
"in",
"a",
"separate",
"uncore",
"module",
"Cored",
"module",
"like",
"fs",
"path",
"and",
"others",
"can",
"t",
"be",
"threadified"
] | 5c6fc0b481520049e2078461693ceee7c27ddd53 | https://github.com/Stitchuuuu/thread-promisify/blob/5c6fc0b481520049e2078461693ceee7c27ddd53/index.js#L461-L512 |
44,897 | fullcube/loopback-component-meta | index.js | getSettings | function getSettings (def) {
var settings = {}
for (var s in def) {
if (def.hasOwnProperty(s)) {
if (s !== 'name' || s !== 'properties') {
settings[ s ] = def[ s ]
}
}
}
return settings
} | javascript | function getSettings (def) {
var settings = {}
for (var s in def) {
if (def.hasOwnProperty(s)) {
if (s !== 'name' || s !== 'properties') {
settings[ s ] = def[ s ]
}
}
}
return settings
} | [
"function",
"getSettings",
"(",
"def",
")",
"{",
"var",
"settings",
"=",
"{",
"}",
"for",
"(",
"var",
"s",
"in",
"def",
")",
"{",
"if",
"(",
"def",
".",
"hasOwnProperty",
"(",
"s",
")",
")",
"{",
"if",
"(",
"s",
"!==",
"'name'",
"||",
"s",
"!==... | Remove properties that will confuse LB | [
"Remove",
"properties",
"that",
"will",
"confuse",
"LB"
] | b91bc0e93881f8e47ac88a77d4a91231053b219a | https://github.com/fullcube/loopback-component-meta/blob/b91bc0e93881f8e47ac88a77d4a91231053b219a/index.js#L5-L15 |
44,898 | vid/SenseBase | services/annotators/annotateLib.js | instancesFromMatches | function instancesFromMatches(word, text, selector) {
var match, ret = [];
var re = new RegExp('\\b'+utils.escapeRegex(word)+'\\b', 'gi');
var instance = 1;
while ((match = re.exec(text)) !== null) {
GLOBAL.debug(text.length, text.substring(0, 10), word, match.index, text.substr(match.index, word.length));
... | javascript | function instancesFromMatches(word, text, selector) {
var match, ret = [];
var re = new RegExp('\\b'+utils.escapeRegex(word)+'\\b', 'gi');
var instance = 1;
while ((match = re.exec(text)) !== null) {
GLOBAL.debug(text.length, text.substring(0, 10), word, match.index, text.substr(match.index, word.length));
... | [
"function",
"instancesFromMatches",
"(",
"word",
",",
"text",
",",
"selector",
")",
"{",
"var",
"match",
",",
"ret",
"=",
"[",
"]",
";",
"var",
"re",
"=",
"new",
"RegExp",
"(",
"'\\\\b'",
"+",
"utils",
".",
"escapeRegex",
"(",
"word",
")",
"+",
"'\\\... | convert instances of a match to instances | [
"convert",
"instances",
"of",
"a",
"match",
"to",
"instances"
] | d60bcf28239e7dde437d8a6bdae41a6921dcd05b | https://github.com/vid/SenseBase/blob/d60bcf28239e7dde437d8a6bdae41a6921dcd05b/services/annotators/annotateLib.js#L40-L53 |
44,899 | vid/SenseBase | services/annotators/annotateLib.js | rangesFromMatches | function rangesFromMatches(word, text, selector) {
var ret = [], match;
var re = new RegExp('\\b'+word+'\\b', 'gi');
while ((match = re.exec(text)) !== null) {
GLOBAL.debug(text.length, text.substring(0, 10), word, match.index, text.substr(match.index, word.length));
ret.push(annoLib.createRange({exact: ... | javascript | function rangesFromMatches(word, text, selector) {
var ret = [], match;
var re = new RegExp('\\b'+word+'\\b', 'gi');
while ((match = re.exec(text)) !== null) {
GLOBAL.debug(text.length, text.substring(0, 10), word, match.index, text.substr(match.index, word.length));
ret.push(annoLib.createRange({exact: ... | [
"function",
"rangesFromMatches",
"(",
"word",
",",
"text",
",",
"selector",
")",
"{",
"var",
"ret",
"=",
"[",
"]",
",",
"match",
";",
"var",
"re",
"=",
"new",
"RegExp",
"(",
"'\\\\b'",
"+",
"word",
"+",
"'\\\\b'",
",",
"'gi'",
")",
";",
"while",
"(... | convert instances of a match to ranges | [
"convert",
"instances",
"of",
"a",
"match",
"to",
"ranges"
] | d60bcf28239e7dde437d8a6bdae41a6921dcd05b | https://github.com/vid/SenseBase/blob/d60bcf28239e7dde437d8a6bdae41a6921dcd05b/services/annotators/annotateLib.js#L55-L63 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.