repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
urturn/urturn-expression-api | dist/iframe.js | function(options, callback) {
if(typeof options === 'function') {
callback = options;
options = {};
}
if(options.items) {
options.users = options.users || [];
for(var i = 0; i < options.items.length ; i++){
options.users.push(options.items[i]._key);
}
... | javascript | function(options, callback) {
if(typeof options === 'function') {
callback = options;
options = {};
}
if(options.items) {
options.users = options.users || [];
for(var i = 0; i < options.items.length ; i++){
options.users.push(options.items[i]._key);
}
... | [
"function",
"(",
"options",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"options",
"===",
"'function'",
")",
"{",
"callback",
"=",
"options",
";",
"options",
"=",
"{",
"}",
";",
"}",
"if",
"(",
"options",
".",
"items",
")",
"{",
"options",
".",
... | Send a request to list users with the given ids. | [
"Send",
"a",
"request",
"to",
"list",
"users",
"with",
"the",
"given",
"ids",
"."
] | 009a272ee670dbbe5eefb5c070ed827dd778bb07 | https://github.com/urturn/urturn-expression-api/blob/009a272ee670dbbe5eefb5c070ed827dd778bb07/dist/iframe.js#L3056-L3079 | train | |
hairyhenderson/node-fellowshipone | lib/f1.js | F1 | function F1 (config) {
var valErrors = jjv.validate(configSchema, config)
if (valErrors && valErrors.validation) {
throw new Error('Validation errors: ' +
JSON.stringify(valErrors.validation, null, 3))
}
this.config = config
} | javascript | function F1 (config) {
var valErrors = jjv.validate(configSchema, config)
if (valErrors && valErrors.validation) {
throw new Error('Validation errors: ' +
JSON.stringify(valErrors.validation, null, 3))
}
this.config = config
} | [
"function",
"F1",
"(",
"config",
")",
"{",
"var",
"valErrors",
"=",
"jjv",
".",
"validate",
"(",
"configSchema",
",",
"config",
")",
"if",
"(",
"valErrors",
"&&",
"valErrors",
".",
"validation",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Validation errors: ... | F1 utility class
@constructor
@param config The config option | [
"F1",
"utility",
"class"
] | 5e80eb9ec31fb6dceee1e8c211e7b6e0e373b08b | https://github.com/hairyhenderson/node-fellowshipone/blob/5e80eb9ec31fb6dceee1e8c211e7b6e0e373b08b/lib/f1.js#L14-L22 | train |
1stdibs/backbone-base-and-form-view | backbone-formview.js | function (optionCollection, key, model, collection) {
if (optionCollection) {
return strTo(optionCollection, model, Collection) || collection;
}
return strTo(key, model, Collection) || null;
} | javascript | function (optionCollection, key, model, collection) {
if (optionCollection) {
return strTo(optionCollection, model, Collection) || collection;
}
return strTo(key, model, Collection) || null;
} | [
"function",
"(",
"optionCollection",
",",
"key",
",",
"model",
",",
"collection",
")",
"{",
"if",
"(",
"optionCollection",
")",
"{",
"return",
"strTo",
"(",
"optionCollection",
",",
"model",
",",
"Collection",
")",
"||",
"collection",
";",
"}",
"return",
"... | Similar to getSubModel except for collections and does not pass the parent collection if no option collection is specified and the schema key cannot locate a sub collection, then null is returned | [
"Similar",
"to",
"getSubModel",
"except",
"for",
"collections",
"and",
"does",
"not",
"pass",
"the",
"parent",
"collection",
"if",
"no",
"option",
"collection",
"is",
"specified",
"and",
"the",
"schema",
"key",
"cannot",
"locate",
"a",
"sub",
"collection",
"th... | 9c49f9ac059ba3177b61f7395151de78b506e8f7 | https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-formview.js#L122-L127 | train | |
1stdibs/backbone-base-and-form-view | backbone-formview.js | function (alias, construct) {
var aliases = {};
var currAliases = Backbone.FormView.prototype.fieldAlias;
if (construct) {
aliases[alias] = construct;
} else { aliases = alias; }
defaults(currAliases, aliases);
} | javascript | function (alias, construct) {
var aliases = {};
var currAliases = Backbone.FormView.prototype.fieldAlias;
if (construct) {
aliases[alias] = construct;
} else { aliases = alias; }
defaults(currAliases, aliases);
} | [
"function",
"(",
"alias",
",",
"construct",
")",
"{",
"var",
"aliases",
"=",
"{",
"}",
";",
"var",
"currAliases",
"=",
"Backbone",
".",
"FormView",
".",
"prototype",
".",
"fieldAlias",
";",
"if",
"(",
"construct",
")",
"{",
"aliases",
"[",
"alias",
"]"... | Add a Field Alias to the list of field aliases. For example
You have a view constructor DateFieldView and you want to
make it easy to put that field in a schema, you can use this
static function to add an allias 'Date' for that constructor
@memberOf Backbone.FormView
@param {String} alias Name of the alias
@param {... | [
"Add",
"a",
"Field",
"Alias",
"to",
"the",
"list",
"of",
"field",
"aliases",
".",
"For",
"example",
"You",
"have",
"a",
"view",
"constructor",
"DateFieldView",
"and",
"you",
"want",
"to",
"make",
"it",
"easy",
"to",
"put",
"that",
"field",
"in",
"a",
"... | 9c49f9ac059ba3177b61f7395151de78b506e8f7 | https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-formview.js#L404-L411 | train | |
1stdibs/backbone-base-and-form-view | backbone-formview.js | function (schema) {
if (!this.rowConfig.options) { this.rowConfig.options = {}; }
this.rowConfig.options.schema = schema || this.options.rowSchema || this.rowSchema;
return this;
} | javascript | function (schema) {
if (!this.rowConfig.options) { this.rowConfig.options = {}; }
this.rowConfig.options.schema = schema || this.options.rowSchema || this.rowSchema;
return this;
} | [
"function",
"(",
"schema",
")",
"{",
"if",
"(",
"!",
"this",
".",
"rowConfig",
".",
"options",
")",
"{",
"this",
".",
"rowConfig",
".",
"options",
"=",
"{",
"}",
";",
"}",
"this",
".",
"rowConfig",
".",
"options",
".",
"schema",
"=",
"schema",
"||"... | Set the schema used for each row.
@memberOf Backbone.CollectionFormView#
@param {object} [schema]
@return {Backbone.CollectionFormView} | [
"Set",
"the",
"schema",
"used",
"for",
"each",
"row",
"."
] | 9c49f9ac059ba3177b61f7395151de78b506e8f7 | https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-formview.js#L534-L538 | train | |
1stdibs/backbone-base-and-form-view | backbone-formview.js | function () {
this.subs.detachElems();
this.$el.html(this.template(this._getTemplateVars()));
if (!this.getRows() || !this.getRows().length) {
this.setupRows();
}
this.subs.renderByKey('row', { appendTo: this.getRowWrapper() });
ret... | javascript | function () {
this.subs.detachElems();
this.$el.html(this.template(this._getTemplateVars()));
if (!this.getRows() || !this.getRows().length) {
this.setupRows();
}
this.subs.renderByKey('row', { appendTo: this.getRowWrapper() });
ret... | [
"function",
"(",
")",
"{",
"this",
".",
"subs",
".",
"detachElems",
"(",
")",
";",
"this",
".",
"$el",
".",
"html",
"(",
"this",
".",
"template",
"(",
"this",
".",
"_getTemplateVars",
"(",
")",
")",
")",
";",
"if",
"(",
"!",
"this",
".",
"getRows... | Like Backbone.FormView.render, except that each a subView will be rendered
for each field in the schema and for each model in the collection.
Each model in the collection will have a 'row' associated with it,
and each row will contain each of the fields in the schema.
@memberOf Backbone.CollectionFormView#
@return {Bac... | [
"Like",
"Backbone",
".",
"FormView",
".",
"render",
"except",
"that",
"each",
"a",
"subView",
"will",
"be",
"rendered",
"for",
"each",
"field",
"in",
"the",
"schema",
"and",
"for",
"each",
"model",
"in",
"the",
"collection",
".",
"Each",
"model",
"in",
"... | 9c49f9ac059ba3177b61f7395151de78b506e8f7 | https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-formview.js#L547-L555 | train | |
1stdibs/backbone-base-and-form-view | backbone-formview.js | function (obj) {
var model = (obj instanceof Model) ? obj : null;
var view = (!model && obj instanceof Backbone.View) ? obj : null;
var arr = (!model && !view && isArray(obj)) ? obj : null;
if (arr) {
each(arr, this.deleteRow, this);
retur... | javascript | function (obj) {
var model = (obj instanceof Model) ? obj : null;
var view = (!model && obj instanceof Backbone.View) ? obj : null;
var arr = (!model && !view && isArray(obj)) ? obj : null;
if (arr) {
each(arr, this.deleteRow, this);
retur... | [
"function",
"(",
"obj",
")",
"{",
"var",
"model",
"=",
"(",
"obj",
"instanceof",
"Model",
")",
"?",
"obj",
":",
"null",
";",
"var",
"view",
"=",
"(",
"!",
"model",
"&&",
"obj",
"instanceof",
"Backbone",
".",
"View",
")",
"?",
"obj",
":",
"null",
... | Removes a row or rows from the CollectionFormView and
corresponding collection.
@memberOf Backbone.CollectionFormView#
@param {Backbone.Model|Backbone.View|Backbone.View[]|Backbone.Model[]} obj
Used to find models in the collection and views in the subViewManager
and remove them.
@return {Backbone.CollectionFormView} | [
"Removes",
"a",
"row",
"or",
"rows",
"from",
"the",
"CollectionFormView",
"and",
"corresponding",
"collection",
"."
] | 9c49f9ac059ba3177b61f7395151de78b506e8f7 | https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-formview.js#L600-L619 | train | |
1stdibs/backbone-base-and-form-view | backbone-formview.js | function () {
var $input;
var id = this.inputId;
var attrs = this.addId ? { id : id, name: id } : {};
var valForInput = this.getValueForInput();
$input = Backbone.$('<' + this.elementType + '>');
if (this.elementType === 'input') { attrs.type = 't... | javascript | function () {
var $input;
var id = this.inputId;
var attrs = this.addId ? { id : id, name: id } : {};
var valForInput = this.getValueForInput();
$input = Backbone.$('<' + this.elementType + '>');
if (this.elementType === 'input') { attrs.type = 't... | [
"function",
"(",
")",
"{",
"var",
"$input",
";",
"var",
"id",
"=",
"this",
".",
"inputId",
";",
"var",
"attrs",
"=",
"this",
".",
"addId",
"?",
"{",
"id",
":",
"id",
",",
"name",
":",
"id",
"}",
":",
"{",
"}",
";",
"var",
"valForInput",
"=",
... | Renders the field input and places it in the wrapper in
the element with the 'data-input' attribute
@memberOf Backbone.fields.FieldView#
@return {Backbone.fields.FieldView} | [
"Renders",
"the",
"field",
"input",
"and",
"places",
"it",
"in",
"the",
"wrapper",
"in",
"the",
"element",
"with",
"the",
"data",
"-",
"input",
"attribute"
] | 9c49f9ac059ba3177b61f7395151de78b506e8f7 | https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-formview.js#L893-L907 | train | |
1stdibs/backbone-base-and-form-view | backbone-formview.js | function () {
var possibleVals = result(this, 'possibleVals');
var key;
var i = 0;
var possibleVal;
var $checkbox;
var isSelected;
var $inputWrapper = this.getInputWrapper().empty();
for (key in possibleVals) {
... | javascript | function () {
var possibleVals = result(this, 'possibleVals');
var key;
var i = 0;
var possibleVal;
var $checkbox;
var isSelected;
var $inputWrapper = this.getInputWrapper().empty();
for (key in possibleVals) {
... | [
"function",
"(",
")",
"{",
"var",
"possibleVals",
"=",
"result",
"(",
"this",
",",
"'possibleVals'",
")",
";",
"var",
"key",
";",
"var",
"i",
"=",
"0",
";",
"var",
"possibleVal",
";",
"var",
"$checkbox",
";",
"var",
"isSelected",
";",
"var",
"$inputWra... | Renders the radio inputs and appends them to the input wrapper.
@memberOf Backbone.fields.RadioListView#
@return {Backbone.fields.RadioListView} | [
"Renders",
"the",
"radio",
"inputs",
"and",
"appends",
"them",
"to",
"the",
"input",
"wrapper",
"."
] | 9c49f9ac059ba3177b61f7395151de78b506e8f7 | https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-formview.js#L1076-L1095 | train | |
1stdibs/backbone-base-and-form-view | backbone-formview.js | function (key) {
var modelVal = this.getModelVal();
modelVal = this.multiple ? modelVal : [modelVal];
return (_.indexOf(_.map(modelVal, toStr), toStr(key)) > -1);
} | javascript | function (key) {
var modelVal = this.getModelVal();
modelVal = this.multiple ? modelVal : [modelVal];
return (_.indexOf(_.map(modelVal, toStr), toStr(key)) > -1);
} | [
"function",
"(",
"key",
")",
"{",
"var",
"modelVal",
"=",
"this",
".",
"getModelVal",
"(",
")",
";",
"modelVal",
"=",
"this",
".",
"multiple",
"?",
"modelVal",
":",
"[",
"modelVal",
"]",
";",
"return",
"(",
"_",
".",
"indexOf",
"(",
"_",
".",
"map"... | Returns true or false if the option should be selected
@memberOf Backbone.fields.SelectListView#
@param {string} key The key of the possibleVal that is being tested
@return {boolean} | [
"Returns",
"true",
"or",
"false",
"if",
"the",
"option",
"should",
"be",
"selected"
] | 9c49f9ac059ba3177b61f7395151de78b506e8f7 | https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-formview.js#L1185-L1189 | train | |
1stdibs/backbone-base-and-form-view | backbone-formview.js | function () {
var possibleVals = result(this, 'possibleVals');
var id = this.inputId;
var $select = Backbone.$('<' + this.elementType + '>')
.attr(extend((this.addId ? { id: id, name: id } : {}), this.inputAttrs));
this.getInputWrapper().html($select)... | javascript | function () {
var possibleVals = result(this, 'possibleVals');
var id = this.inputId;
var $select = Backbone.$('<' + this.elementType + '>')
.attr(extend((this.addId ? { id: id, name: id } : {}), this.inputAttrs));
this.getInputWrapper().html($select)... | [
"function",
"(",
")",
"{",
"var",
"possibleVals",
"=",
"result",
"(",
"this",
",",
"'possibleVals'",
")",
";",
"var",
"id",
"=",
"this",
".",
"inputId",
";",
"var",
"$select",
"=",
"Backbone",
".",
"$",
"(",
"'<'",
"+",
"this",
".",
"elementType",
"+... | Renders the select element and the options
@memberOf Backbone.fields.SelectListView#
@return {Backbone.fields.SelectListView} | [
"Renders",
"the",
"select",
"element",
"and",
"the",
"options"
] | 9c49f9ac059ba3177b61f7395151de78b506e8f7 | https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-formview.js#L1195-L1208 | train | |
1stdibs/backbone-base-and-form-view | backbone-formview.js | function (possibleVal, isChecked, index) {
var $listItem;
var $label;
var id = this.inputId;
var attributes = { type: 'checkbox', value: possibleVal.value};
if (this.addId) { extend(attributes, { name: id, id: (id + '-' + index) }); }
attributes =... | javascript | function (possibleVal, isChecked, index) {
var $listItem;
var $label;
var id = this.inputId;
var attributes = { type: 'checkbox', value: possibleVal.value};
if (this.addId) { extend(attributes, { name: id, id: (id + '-' + index) }); }
attributes =... | [
"function",
"(",
"possibleVal",
",",
"isChecked",
",",
"index",
")",
"{",
"var",
"$listItem",
";",
"var",
"$label",
";",
"var",
"id",
"=",
"this",
".",
"inputId",
";",
"var",
"attributes",
"=",
"{",
"type",
":",
"'checkbox'",
",",
"value",
":",
"possib... | Renders and returns a single checkbox in a CheckList
@memberOf Backbone.fields.CheckListView#
@param {string} possibleVal the key from possibleVals
@param {boolean} isChecked if the box should be checked or not
@param {number} index the index of the checkbox
@return {$} | [
"Renders",
"and",
"returns",
"a",
"single",
"checkbox",
"in",
"a",
"CheckList"
] | 9c49f9ac059ba3177b61f7395151de78b506e8f7 | https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-formview.js#L1326-L1339 | train | |
feedhenry/fh-component-metrics | lib/clients/redis.js | RedisClient | function RedisClient(opts) {
opts = opts || {};
BaseClient.apply(this, arguments);
this.recordsToKeep = opts.recordsToKeep || 1000;
this.namespace = opts.namespace || 'stats';
this.client = opts.redisClient;
} | javascript | function RedisClient(opts) {
opts = opts || {};
BaseClient.apply(this, arguments);
this.recordsToKeep = opts.recordsToKeep || 1000;
this.namespace = opts.namespace || 'stats';
this.client = opts.redisClient;
} | [
"function",
"RedisClient",
"(",
"opts",
")",
"{",
"opts",
"=",
"opts",
"||",
"{",
"}",
";",
"BaseClient",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"this",
".",
"recordsToKeep",
"=",
"opts",
".",
"recordsToKeep",
"||",
"1000",
";",
"this",... | A client that can send metrics data to a redis backend
@param {Object} opts
@param {Object} opts.redisClient an instance of the redis nodejs client.
@param {Number} opts.recordsToKeep the number of records to keep for each metric. Default is 1000.
@param {String} opts.namespace name space for each metric key. It will b... | [
"A",
"client",
"that",
"can",
"send",
"metrics",
"data",
"to",
"a",
"redis",
"backend"
] | c97a1a82ff0144f2a7c2abecbc22084fade1cbc8 | https://github.com/feedhenry/fh-component-metrics/blob/c97a1a82ff0144f2a7c2abecbc22084fade1cbc8/lib/clients/redis.js#L15-L21 | train |
Mammut-FE/nejm | src/util/flash/flash.js | function(_options){
// bugfix for ie title with flash
_title = document.title;
var _parent = _e._$get(_options.parent)||document.body,
_html = _t0._$get(_seed_html,_options);
_parent.insertAdjacentHTML(
!_options.hidden?'beforeEnd':'afterBeg... | javascript | function(_options){
// bugfix for ie title with flash
_title = document.title;
var _parent = _e._$get(_options.parent)||document.body,
_html = _t0._$get(_seed_html,_options);
_parent.insertAdjacentHTML(
!_options.hidden?'beforeEnd':'afterBeg... | [
"function",
"(",
"_options",
")",
"{",
"// bugfix for ie title with flash",
"_title",
"=",
"document",
".",
"title",
";",
"var",
"_parent",
"=",
"_e",
".",
"_$get",
"(",
"_options",
".",
"parent",
")",
"||",
"document",
".",
"body",
",",
"_html",
"=",
"_t0... | append flash element | [
"append",
"flash",
"element"
] | dfc09ac66a8d67620a7aea65e34d8a179976b3fb | https://github.com/Mammut-FE/nejm/blob/dfc09ac66a8d67620a7aea65e34d8a179976b3fb/src/util/flash/flash.js#L111-L119 | train | |
Mammut-FE/nejm | src/util/flash/flash.js | function(_id,_event){
var _type = _event.type.toLowerCase();
_t1.requestAnimationFrame(function(){
_v._$dispatchEvent(_id,_type);
});
} | javascript | function(_id,_event){
var _type = _event.type.toLowerCase();
_t1.requestAnimationFrame(function(){
_v._$dispatchEvent(_id,_type);
});
} | [
"function",
"(",
"_id",
",",
"_event",
")",
"{",
"var",
"_type",
"=",
"_event",
".",
"type",
".",
"toLowerCase",
"(",
")",
";",
"_t1",
".",
"requestAnimationFrame",
"(",
"function",
"(",
")",
"{",
"_v",
".",
"_$dispatchEvent",
"(",
"_id",
",",
"_type",... | listen flash mouse event | [
"listen",
"flash",
"mouse",
"event"
] | dfc09ac66a8d67620a7aea65e34d8a179976b3fb | https://github.com/Mammut-FE/nejm/blob/dfc09ac66a8d67620a7aea65e34d8a179976b3fb/src/util/flash/flash.js#L121-L126 | train | |
Mammut-FE/nejm | src/util/flash/flash.js | function(_options){
// init flash vars
var _id = _options.id,
_params = _options.params;
if (!_params){
_params = {};
_options.params = _params;
}
var _vars = _params.flashvars||'';
_vars += (!_vars?'... | javascript | function(_options){
// init flash vars
var _id = _options.id,
_params = _options.params;
if (!_params){
_params = {};
_options.params = _params;
}
var _vars = _params.flashvars||'';
_vars += (!_vars?'... | [
"function",
"(",
"_options",
")",
"{",
"// init flash vars",
"var",
"_id",
"=",
"_options",
".",
"id",
",",
"_params",
"=",
"_options",
".",
"params",
";",
"if",
"(",
"!",
"_params",
")",
"{",
"_params",
"=",
"{",
"}",
";",
"_options",
".",
"params",
... | init flash event | [
"init",
"flash",
"event"
] | dfc09ac66a8d67620a7aea65e34d8a179976b3fb | https://github.com/Mammut-FE/nejm/blob/dfc09ac66a8d67620a7aea65e34d8a179976b3fb/src/util/flash/flash.js#L151-L175 | train | |
veo-labs/openveo-api | lib/providers/EntityProvider.js | EntityProvider | function EntityProvider(storage, location) {
EntityProvider.super_.call(this, storage);
Object.defineProperties(this, {
/**
* The location of the entities in the storage.
*
* @property location
* @type String
* @final
*/
location: {value: location}
});
if (Object.protot... | javascript | function EntityProvider(storage, location) {
EntityProvider.super_.call(this, storage);
Object.defineProperties(this, {
/**
* The location of the entities in the storage.
*
* @property location
* @type String
* @final
*/
location: {value: location}
});
if (Object.protot... | [
"function",
"EntityProvider",
"(",
"storage",
",",
"location",
")",
"{",
"EntityProvider",
".",
"super_",
".",
"call",
"(",
"this",
",",
"storage",
")",
";",
"Object",
".",
"defineProperties",
"(",
"this",
",",
"{",
"/**\n * The location of the entities in the... | Defines a provider holding a single type of resources.
An entity provider manages a single type of resources. These resources are stored into the given storage / location.
@class EntityProvider
@extends Provider
@constructor
@param {Storage} storage The storage to use to store provider entities
@param {String} locati... | [
"Defines",
"a",
"provider",
"holding",
"a",
"single",
"type",
"of",
"resources",
"."
] | 493a811e9a5ba4d3e14910facaa7452caba1ab38 | https://github.com/veo-labs/openveo-api/blob/493a811e9a5ba4d3e14910facaa7452caba1ab38/lib/providers/EntityProvider.js#L22-L40 | train |
veo-labs/openveo-api | lib/providers/EntityProvider.js | getEntities | function getEntities(callback) {
self.get(filter, fields, null, page, sort, function(error, entities, pagination) {
if (error) return callback(error);
allEntities = allEntities.concat(entities);
if (page < pagination.pages - 1) {
// There are other pages
// Get next page
... | javascript | function getEntities(callback) {
self.get(filter, fields, null, page, sort, function(error, entities, pagination) {
if (error) return callback(error);
allEntities = allEntities.concat(entities);
if (page < pagination.pages - 1) {
// There are other pages
// Get next page
... | [
"function",
"getEntities",
"(",
"callback",
")",
"{",
"self",
".",
"get",
"(",
"filter",
",",
"fields",
",",
"null",
",",
"page",
",",
"sort",
",",
"function",
"(",
"error",
",",
"entities",
",",
"pagination",
")",
"{",
"if",
"(",
"error",
")",
"retu... | Fetches all entities iterating on all pages.
@param {Function} callback The function to call when it's done | [
"Fetches",
"all",
"entities",
"iterating",
"on",
"all",
"pages",
"."
] | 493a811e9a5ba4d3e14910facaa7452caba1ab38 | https://github.com/veo-labs/openveo-api/blob/493a811e9a5ba4d3e14910facaa7452caba1ab38/lib/providers/EntityProvider.js#L121-L141 | train |
coz-labo/coz-handlebars-engine | shim/node/engine.js | registerHelper | function registerHelper(name, helper) {
var s = this;
s.helpers = s.helpers || {};
s.helpers[name] = helper;
return s;
} | javascript | function registerHelper(name, helper) {
var s = this;
s.helpers = s.helpers || {};
s.helpers[name] = helper;
return s;
} | [
"function",
"registerHelper",
"(",
"name",
",",
"helper",
")",
"{",
"var",
"s",
"=",
"this",
";",
"s",
".",
"helpers",
"=",
"s",
".",
"helpers",
"||",
"{",
"}",
";",
"s",
".",
"helpers",
"[",
"name",
"]",
"=",
"helper",
";",
"return",
"s",
";",
... | Register a helper.
@param {string} name - Name of the helper.
@param {function} helper - Helper function.
@returns {HandlebarsEngine} - Returns self. | [
"Register",
"a",
"helper",
"."
] | 47c7d984ad3e97fc130f65ad9954c0a797f3be9e | https://github.com/coz-labo/coz-handlebars-engine/blob/47c7d984ad3e97fc130f65ad9954c0a797f3be9e/shim/node/engine.js#L73-L78 | train |
coz-labo/coz-handlebars-engine | shim/node/engine.js | registerHelpers | function registerHelpers(helpers) {
var s = this;
var names = Object.keys(helpers || {});
for (var i = 0, len = names.length; i < len; i++) {
var name = names[i];
s.registerHelper(name, helpers[name]);
}
return s;
} | javascript | function registerHelpers(helpers) {
var s = this;
var names = Object.keys(helpers || {});
for (var i = 0, len = names.length; i < len; i++) {
var name = names[i];
s.registerHelper(name, helpers[name]);
}
return s;
} | [
"function",
"registerHelpers",
"(",
"helpers",
")",
"{",
"var",
"s",
"=",
"this",
";",
"var",
"names",
"=",
"Object",
".",
"keys",
"(",
"helpers",
"||",
"{",
"}",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"names",
".",
"length"... | Register multiple helpers.
@param {object} helpers - Helpers to register.
@returns {HandlebarsEngine} - Returns self. | [
"Register",
"multiple",
"helpers",
"."
] | 47c7d984ad3e97fc130f65ad9954c0a797f3be9e | https://github.com/coz-labo/coz-handlebars-engine/blob/47c7d984ad3e97fc130f65ad9954c0a797f3be9e/shim/node/engine.js#L85-L95 | train |
veo-labs/openveo-api | lib/socket/SocketNamespace.js | SocketNamespace | function SocketNamespace() {
var self = this;
var namespace = null;
Object.defineProperties(this, {
/**
* The list of messages' handlers.
*
* @property handlers
* @type Object
*/
handlers: {value: {}},
/**
* The list of middlewares.
*
* @property middlewares
... | javascript | function SocketNamespace() {
var self = this;
var namespace = null;
Object.defineProperties(this, {
/**
* The list of messages' handlers.
*
* @property handlers
* @type Object
*/
handlers: {value: {}},
/**
* The list of middlewares.
*
* @property middlewares
... | [
"function",
"SocketNamespace",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"namespace",
"=",
"null",
";",
"Object",
".",
"defineProperties",
"(",
"this",
",",
"{",
"/**\n * The list of messages' handlers.\n *\n * @property handlers\n * @type Obj... | Defines socket.io namespace wrapper.
SocketNamespace wraps a socket.io namespace to be able to connect the namespace to the server after
adding handlers to it.
Creating a Namespace using socket.io can't be done without creating the server
and attaching the namespace to it.
var openVeoApi = require('@openveo/api');
va... | [
"Defines",
"socket",
".",
"io",
"namespace",
"wrapper",
"."
] | 493a811e9a5ba4d3e14910facaa7452caba1ab38 | https://github.com/veo-labs/openveo-api/blob/493a811e9a5ba4d3e14910facaa7452caba1ab38/lib/socket/SocketNamespace.js#L72-L113 | train |
atsid/circuits-js | js/NativeJsonpDataProvider.js | function (params) {
var element = document.createElement('script'),
headElement = document.getElementsByTagName('head')[0],
load = params.load,
error = params.error,
jsonpCallback = params.jsonpCallback,
... | javascript | function (params) {
var element = document.createElement('script'),
headElement = document.getElementsByTagName('head')[0],
load = params.load,
error = params.error,
jsonpCallback = params.jsonpCallback,
... | [
"function",
"(",
"params",
")",
"{",
"var",
"element",
"=",
"document",
".",
"createElement",
"(",
"'script'",
")",
",",
"headElement",
"=",
"document",
".",
"getElementsByTagName",
"(",
"'head'",
")",
"[",
"0",
"]",
",",
"load",
"=",
"params",
".",
"loa... | Adds script tag to header of page to make jsonp request and invokes the callback.
@param {object} params | [
"Adds",
"script",
"tag",
"to",
"header",
"of",
"page",
"to",
"make",
"jsonp",
"request",
"and",
"invokes",
"the",
"callback",
"."
] | f1fa5e98d406b3b9f577dd8995782c7115d6b346 | https://github.com/atsid/circuits-js/blob/f1fa5e98d406b3b9f577dd8995782c7115d6b346/js/NativeJsonpDataProvider.js#L72-L115 | train | |
atsid/circuits-js | js/NativeJsonpDataProvider.js | function (url, key, value) {
var regex = new RegExp("([?|&])" + key + "=.*?(&|#|$)(.*)", "gi"),
separator,
hash;
if (regex.test(url)) {
url = url.replace(regex, '$1' + key + "=" + value + '$2$3');
} else {
... | javascript | function (url, key, value) {
var regex = new RegExp("([?|&])" + key + "=.*?(&|#|$)(.*)", "gi"),
separator,
hash;
if (regex.test(url)) {
url = url.replace(regex, '$1' + key + "=" + value + '$2$3');
} else {
... | [
"function",
"(",
"url",
",",
"key",
",",
"value",
")",
"{",
"var",
"regex",
"=",
"new",
"RegExp",
"(",
"\"([?|&])\"",
"+",
"key",
"+",
"\"=.*?(&|#|$)(.*)\"",
",",
"\"gi\"",
")",
",",
"separator",
",",
"hash",
";",
"if",
"(",
"regex",
".",
"test",
"("... | Appends the callback parameter to the existing url
@param {string} url
@param {string} key
@param {string} value
@returns {string} | [
"Appends",
"the",
"callback",
"parameter",
"to",
"the",
"existing",
"url"
] | f1fa5e98d406b3b9f577dd8995782c7115d6b346 | https://github.com/atsid/circuits-js/blob/f1fa5e98d406b3b9f577dd8995782c7115d6b346/js/NativeJsonpDataProvider.js#L124-L137 | train | |
jonschlinkert/template-render | index.js | norender | function norender(app, ext, file, locals) {
return !app.engines.hasOwnProperty(ext)
|| app.isTrue('norender') || app.isFalse('render')
|| file.norender === true || file.render === false
|| locals.norender === true || locals.render === false;
} | javascript | function norender(app, ext, file, locals) {
return !app.engines.hasOwnProperty(ext)
|| app.isTrue('norender') || app.isFalse('render')
|| file.norender === true || file.render === false
|| locals.norender === true || locals.render === false;
} | [
"function",
"norender",
"(",
"app",
",",
"ext",
",",
"file",
",",
"locals",
")",
"{",
"return",
"!",
"app",
".",
"engines",
".",
"hasOwnProperty",
"(",
"ext",
")",
"||",
"app",
".",
"isTrue",
"(",
"'norender'",
")",
"||",
"app",
".",
"isFalse",
"(",
... | Push the `file` through if the user has specfied
not to render it. | [
"Push",
"the",
"file",
"through",
"if",
"the",
"user",
"has",
"specfied",
"not",
"to",
"render",
"it",
"."
] | 43d9aca25c834f9d8a895fe96aa987762c69e8ca | https://github.com/jonschlinkert/template-render/blob/43d9aca25c834f9d8a895fe96aa987762c69e8ca/index.js#L67-L72 | train |
get-focus/deprecated-focus-graph | src/middlewares/validate.js | validateProperty | function validateProperty(property, validator) {
let isValid;
if (!validator) {
return void 0;
}
if (!property) {
return void 0;
}
const {value} = property;
const {options} = validator;
const isValueNullOrUndefined = isNull(value) || isUndefined(value );
isValid = (()... | javascript | function validateProperty(property, validator) {
let isValid;
if (!validator) {
return void 0;
}
if (!property) {
return void 0;
}
const {value} = property;
const {options} = validator;
const isValueNullOrUndefined = isNull(value) || isUndefined(value );
isValid = (()... | [
"function",
"validateProperty",
"(",
"property",
",",
"validator",
")",
"{",
"let",
"isValid",
";",
"if",
"(",
"!",
"validator",
")",
"{",
"return",
"void",
"0",
";",
"}",
"if",
"(",
"!",
"property",
")",
"{",
"return",
"void",
"0",
";",
"}",
"const"... | Validate a property.
@param {object} property - The property to validate.
@param {function} validator - The validator to apply.
@return {object} - The property validation status. | [
"Validate",
"a",
"property",
"."
] | 40fa139456d9c1c91af67870df484fe5eb353291 | https://github.com/get-focus/deprecated-focus-graph/blob/40fa139456d9c1c91af67870df484fe5eb353291/src/middlewares/validate.js#L97-L145 | train |
ofidj/fidj | .todo/miapp.tools.js | function (evt,stopBubble) {
'use strict';
//console.log('fidjBlockMove');
// All but scrollable element = .c4p-container-scroll-y
//if (evt.preventDefault) evt.preventDefault() ;
//if (evt.preventDefault && !$(evt.target).parents('.c4p-container-scroll-y')[0]) {
// evt.preventDefault();
/... | javascript | function (evt,stopBubble) {
'use strict';
//console.log('fidjBlockMove');
// All but scrollable element = .c4p-container-scroll-y
//if (evt.preventDefault) evt.preventDefault() ;
//if (evt.preventDefault && !$(evt.target).parents('.c4p-container-scroll-y')[0]) {
// evt.preventDefault();
/... | [
"function",
"(",
"evt",
",",
"stopBubble",
")",
"{",
"'use strict'",
";",
"//console.log('fidjBlockMove');",
"// All but scrollable element = .c4p-container-scroll-y",
"//if (evt.preventDefault) evt.preventDefault() ;",
"//if (evt.preventDefault && !$(evt.target).parents('.c4p-container-scro... | Invoke the function immediately to create this class. Usefull | [
"Invoke",
"the",
"function",
"immediately",
"to",
"create",
"this",
"class",
".",
"Usefull"
] | e57ebece54ee68211d43802a8e0feeef098d3e36 | https://github.com/ofidj/fidj/blob/e57ebece54ee68211d43802a8e0feeef098d3e36/.todo/miapp.tools.js#L371-L387 | train | |
ofidj/fidj | .todo/miapp.tools.js | fidjDateParse | function fidjDateParse(date) {
if (!date || typeof date != 'string' || date == '') return false;
// Date (choose 0 in date to force an error if parseInt fails)
var yearS = parseInt(date.substr(0,4), 10) || 0;
var monthS = parseInt(date.substr(5,2), 10) || 0;
var dayS = parseInt(date.substr(8,2), 10)... | javascript | function fidjDateParse(date) {
if (!date || typeof date != 'string' || date == '') return false;
// Date (choose 0 in date to force an error if parseInt fails)
var yearS = parseInt(date.substr(0,4), 10) || 0;
var monthS = parseInt(date.substr(5,2), 10) || 0;
var dayS = parseInt(date.substr(8,2), 10)... | [
"function",
"fidjDateParse",
"(",
"date",
")",
"{",
"if",
"(",
"!",
"date",
"||",
"typeof",
"date",
"!=",
"'string'",
"||",
"date",
"==",
"''",
")",
"return",
"false",
";",
"// Date (choose 0 in date to force an error if parseInt fails)",
"var",
"yearS",
"=",
"p... | Parse a date string to create a Date object
@param {string} date string at format "yyyy-MM-dd HH:mm:ss"
@returns {Date} Date object or false if invalid date | [
"Parse",
"a",
"date",
"string",
"to",
"create",
"a",
"Date",
"object"
] | e57ebece54ee68211d43802a8e0feeef098d3e36 | https://github.com/ofidj/fidj/blob/e57ebece54ee68211d43802a8e0feeef098d3e36/.todo/miapp.tools.js#L1576-L1601 | train |
ofidj/fidj | .todo/miapp.tools.js | function (position) {
var lat = position.coords.latitude;
var lng = position.coords.longitude;
geo_codeLatLng(lat, lng);
} | javascript | function (position) {
var lat = position.coords.latitude;
var lng = position.coords.longitude;
geo_codeLatLng(lat, lng);
} | [
"function",
"(",
"position",
")",
"{",
"var",
"lat",
"=",
"position",
".",
"coords",
".",
"latitude",
";",
"var",
"lng",
"=",
"position",
".",
"coords",
".",
"longitude",
";",
"geo_codeLatLng",
"(",
"lat",
",",
"lng",
")",
";",
"}"
] | Get the latitude and the longitude; | [
"Get",
"the",
"latitude",
"and",
"the",
"longitude",
";"
] | e57ebece54ee68211d43802a8e0feeef098d3e36 | https://github.com/ofidj/fidj/blob/e57ebece54ee68211d43802a8e0feeef098d3e36/.todo/miapp.tools.js#L3818-L3822 | train | |
lighterio/ltl | ltl.js | function (name) {
var filters = ltl.filters
var filter = filters[name]
if (!filter) {
try {
filter = filters[name] = ltl.scope[name] || (typeof require !== 'undefined' ? require(name) : null)
} catch (ignore) {
}
}
if (!filter) {
var todo = 'Set window.ltl.filters.' +... | javascript | function (name) {
var filters = ltl.filters
var filter = filters[name]
if (!filter) {
try {
filter = filters[name] = ltl.scope[name] || (typeof require !== 'undefined' ? require(name) : null)
} catch (ignore) {
}
}
if (!filter) {
var todo = 'Set window.ltl.filters.' +... | [
"function",
"(",
"name",
")",
"{",
"var",
"filters",
"=",
"ltl",
".",
"filters",
"var",
"filter",
"=",
"filters",
"[",
"name",
"]",
"if",
"(",
"!",
"filter",
")",
"{",
"try",
"{",
"filter",
"=",
"filters",
"[",
"name",
"]",
"=",
"ltl",
".",
"scop... | Get a module for filtering. | [
"Get",
"a",
"module",
"for",
"filtering",
"."
] | 98ecafbf42b3003ba451ed8e9759ac9eeab09d46 | https://github.com/lighterio/ltl/blob/98ecafbf42b3003ba451ed8e9759ac9eeab09d46/ltl.js#L56-L71 | train | |
emeryrose/coalescent | lib/middleware/courier.js | Courier | function Courier(opts) {
stream.Transform.call(this, { objectMode: true });
this.options = merge(Object.create(Courier.DEFAULTS), opts || {});
} | javascript | function Courier(opts) {
stream.Transform.call(this, { objectMode: true });
this.options = merge(Object.create(Courier.DEFAULTS), opts || {});
} | [
"function",
"Courier",
"(",
"opts",
")",
"{",
"stream",
".",
"Transform",
".",
"call",
"(",
"this",
",",
"{",
"objectMode",
":",
"true",
"}",
")",
";",
"this",
".",
"options",
"=",
"merge",
"(",
"Object",
".",
"create",
"(",
"Courier",
".",
"DEFAULTS... | JSON parsing middleware designed for easy message routing
@constructor
@param {object} options | [
"JSON",
"parsing",
"middleware",
"designed",
"for",
"easy",
"message",
"routing"
] | 5e722d4e1c16b9a9e959b281f6bb07713c60c46a | https://github.com/emeryrose/coalescent/blob/5e722d4e1c16b9a9e959b281f6bb07713c60c46a/lib/middleware/courier.js#L25-L29 | train |
emeryrose/coalescent | lib/middleware/smartrelay.js | SmartRelay | function SmartRelay(socket, options) {
stream.Transform.call(this, {});
this.options = merge(Object.create(SmartRelay.DEFAULTS), options || {});
this.socket = socket;
this.recentData = [];
this.peers = function () {
return [];
};
} | javascript | function SmartRelay(socket, options) {
stream.Transform.call(this, {});
this.options = merge(Object.create(SmartRelay.DEFAULTS), options || {});
this.socket = socket;
this.recentData = [];
this.peers = function () {
return [];
};
} | [
"function",
"SmartRelay",
"(",
"socket",
",",
"options",
")",
"{",
"stream",
".",
"Transform",
".",
"call",
"(",
"this",
",",
"{",
"}",
")",
";",
"this",
".",
"options",
"=",
"merge",
"(",
"Object",
".",
"create",
"(",
"SmartRelay",
".",
"DEFAULTS",
... | Smarter implementation of a gossip protocol
@constructor
@param {object} socket
@param {object} options | [
"Smarter",
"implementation",
"of",
"a",
"gossip",
"protocol"
] | 5e722d4e1c16b9a9e959b281f6bb07713c60c46a | https://github.com/emeryrose/coalescent/blob/5e722d4e1c16b9a9e959b281f6bb07713c60c46a/lib/middleware/smartrelay.js#L24-L34 | train |
ortoo/angular-resource | src/model.js | save | function save() {
var res = this;
res.$created = true;
return this.$loc.$save(this.$toObject()).then(function() {
emitter.emit('updated', res);
if (!res.$resolved) {
res.$deferred.resolve(res);
res.$resolved = true;
}
return res;
... | javascript | function save() {
var res = this;
res.$created = true;
return this.$loc.$save(this.$toObject()).then(function() {
emitter.emit('updated', res);
if (!res.$resolved) {
res.$deferred.resolve(res);
res.$resolved = true;
}
return res;
... | [
"function",
"save",
"(",
")",
"{",
"var",
"res",
"=",
"this",
";",
"res",
".",
"$created",
"=",
"true",
";",
"return",
"this",
".",
"$loc",
".",
"$save",
"(",
"this",
".",
"$toObject",
"(",
")",
")",
".",
"then",
"(",
"function",
"(",
")",
"{",
... | The promise resolves once the save has been committed | [
"The",
"promise",
"resolves",
"once",
"the",
"save",
"has",
"been",
"committed"
] | c4a23525237a89d7e36268c6f683f5f57e138c66 | https://github.com/ortoo/angular-resource/blob/c4a23525237a89d7e36268c6f683f5f57e138c66/src/model.js#L109-L120 | train |
ortoo/angular-resource | src/model.js | updateOrCreate | function updateOrCreate(val) {
var res = _resources[val._id];
if (!res) {
res = new Resource(val, false, new Date().getTime());
} else {
res.$updateServer(val);
}
return res;
} | javascript | function updateOrCreate(val) {
var res = _resources[val._id];
if (!res) {
res = new Resource(val, false, new Date().getTime());
} else {
res.$updateServer(val);
}
return res;
} | [
"function",
"updateOrCreate",
"(",
"val",
")",
"{",
"var",
"res",
"=",
"_resources",
"[",
"val",
".",
"_id",
"]",
";",
"if",
"(",
"!",
"res",
")",
"{",
"res",
"=",
"new",
"Resource",
"(",
"val",
",",
"false",
",",
"new",
"Date",
"(",
")",
".",
... | updates or creates a model depending on whether we know about it already. This is usually used when we recieve a response with model data from the server using a non-standard method | [
"updates",
"or",
"creates",
"a",
"model",
"depending",
"on",
"whether",
"we",
"know",
"about",
"it",
"already",
".",
"This",
"is",
"usually",
"used",
"when",
"we",
"recieve",
"a",
"response",
"with",
"model",
"data",
"from",
"the",
"server",
"using",
"a",
... | c4a23525237a89d7e36268c6f683f5f57e138c66 | https://github.com/ortoo/angular-resource/blob/c4a23525237a89d7e36268c6f683f5f57e138c66/src/model.js#L228-L237 | train |
atsid/circuits-js | js/ServiceFactory.js | function (modelName, plugins) {
logger.debug("Getting service for model: " + modelName);
var smd = this.config.resolverByModel(modelName);
return this.getService(smd, plugins);
} | javascript | function (modelName, plugins) {
logger.debug("Getting service for model: " + modelName);
var smd = this.config.resolverByModel(modelName);
return this.getService(smd, plugins);
} | [
"function",
"(",
"modelName",
",",
"plugins",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Getting service for model: \"",
"+",
"modelName",
")",
";",
"var",
"smd",
"=",
"this",
".",
"config",
".",
"resolverByModel",
"(",
"modelName",
")",
";",
"return",
"this"... | Returns an instance of a Service that can provide crud operations for a model.
@param modelName - the model that will be served.
@param plugins - plugins for read/write and other operations, which modify default service method behavior
@return {circuits/Service} - the realized service. | [
"Returns",
"an",
"instance",
"of",
"a",
"Service",
"that",
"can",
"provide",
"crud",
"operations",
"for",
"a",
"model",
"."
] | f1fa5e98d406b3b9f577dd8995782c7115d6b346 | https://github.com/atsid/circuits-js/blob/f1fa5e98d406b3b9f577dd8995782c7115d6b346/js/ServiceFactory.js#L75-L79 | train | |
atsid/circuits-js | js/ServiceFactory.js | function (serviceName, plugins) {
logger.debug("Getting service: " + serviceName);
var smd = this.config.resolver(serviceName);
return this.getService(smd, plugins);
} | javascript | function (serviceName, plugins) {
logger.debug("Getting service: " + serviceName);
var smd = this.config.resolver(serviceName);
return this.getService(smd, plugins);
} | [
"function",
"(",
"serviceName",
",",
"plugins",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Getting service: \"",
"+",
"serviceName",
")",
";",
"var",
"smd",
"=",
"this",
".",
"config",
".",
"resolver",
"(",
"serviceName",
")",
";",
"return",
"this",
".",
... | Returns an instance of a Service using its name.
@param serviceName - the string name of the service that can be resolved to an smd by the configured resolver.
@param plugins - plugins for read/write and other operations, which modify default service method behavior
@return {circuits.Service} - the realized service. | [
"Returns",
"an",
"instance",
"of",
"a",
"Service",
"using",
"its",
"name",
"."
] | f1fa5e98d406b3b9f577dd8995782c7115d6b346 | https://github.com/atsid/circuits-js/blob/f1fa5e98d406b3b9f577dd8995782c7115d6b346/js/ServiceFactory.js#L88-L92 | train | |
atsid/circuits-js | js/ServiceFactory.js | function (smd, plugins) {
var reader = this.newReader(smd),
provider = this.config.provider,
matcher = this.pluginMatcher,
sentPlugins = plugins || [],
mixinPlugins = [],
pertinentMethods,
... | javascript | function (smd, plugins) {
var reader = this.newReader(smd),
provider = this.config.provider,
matcher = this.pluginMatcher,
sentPlugins = plugins || [],
mixinPlugins = [],
pertinentMethods,
... | [
"function",
"(",
"smd",
",",
"plugins",
")",
"{",
"var",
"reader",
"=",
"this",
".",
"newReader",
"(",
"smd",
")",
",",
"provider",
"=",
"this",
".",
"config",
".",
"provider",
",",
"matcher",
"=",
"this",
".",
"pluginMatcher",
",",
"sentPlugins",
"=",... | Returns an instance of a Service using its SMD.
@param smd - the SMD instance to use for service parameters
@param callbacks - load and error handlers for each service method, or optionally globally. Empty defaults will be mixed in to avoid errors.
@param plugins - plugins for read/write and other operations, which mo... | [
"Returns",
"an",
"instance",
"of",
"a",
"Service",
"using",
"its",
"SMD",
"."
] | f1fa5e98d406b3b9f577dd8995782c7115d6b346 | https://github.com/atsid/circuits-js/blob/f1fa5e98d406b3b9f577dd8995782c7115d6b346/js/ServiceFactory.js#L115-L143 | train | |
atsid/circuits-js | js/ServiceFactory.js | function (smd) {
// zyp format by default.
var ret = new ZypSMDReader(smd, this.config.resolver);
if (!smd.SMDVersion) {
//not zyp then fail.
throw new Error("Argument is not an SMD.");
}
return ret;
... | javascript | function (smd) {
// zyp format by default.
var ret = new ZypSMDReader(smd, this.config.resolver);
if (!smd.SMDVersion) {
//not zyp then fail.
throw new Error("Argument is not an SMD.");
}
return ret;
... | [
"function",
"(",
"smd",
")",
"{",
"// zyp format by default.",
"var",
"ret",
"=",
"new",
"ZypSMDReader",
"(",
"smd",
",",
"this",
".",
"config",
".",
"resolver",
")",
";",
"if",
"(",
"!",
"smd",
".",
"SMDVersion",
")",
"{",
"//not zyp then fail.",
"throw",... | Retrieves a reader capable of handling the passed service descriptor.
@param {Object} smd - the service descriptor to retrieve a reader for. | [
"Retrieves",
"a",
"reader",
"capable",
"of",
"handling",
"the",
"passed",
"service",
"descriptor",
"."
] | f1fa5e98d406b3b9f577dd8995782c7115d6b346 | https://github.com/atsid/circuits-js/blob/f1fa5e98d406b3b9f577dd8995782c7115d6b346/js/ServiceFactory.js#L187-L195 | train | |
artdecocode/promto | build/index.js | createPromiseWithTimeout | async function createPromiseWithTimeout(promise, timeout, desc) {
if (!(promise instanceof Promise))
throw new Error('Promise expected')
if (!timeout)
throw new Error('Timeout must be a number')
if (timeout < 0)
throw new Error('Timeout cannot be negative')
const { promise: toPromise, timeout: to }... | javascript | async function createPromiseWithTimeout(promise, timeout, desc) {
if (!(promise instanceof Promise))
throw new Error('Promise expected')
if (!timeout)
throw new Error('Timeout must be a number')
if (timeout < 0)
throw new Error('Timeout cannot be negative')
const { promise: toPromise, timeout: to }... | [
"async",
"function",
"createPromiseWithTimeout",
"(",
"promise",
",",
"timeout",
",",
"desc",
")",
"{",
"if",
"(",
"!",
"(",
"promise",
"instanceof",
"Promise",
")",
")",
"throw",
"new",
"Error",
"(",
"'Promise expected'",
")",
"if",
"(",
"!",
"timeout",
"... | Create a promise which will be rejected after a timeout.
@param {!Promise} promise A promise to race with
@param {number} timeout Timeout in ms after which to reject
@param {string} [desc] Description of a promise to be printed in error
@returns {!Promise} A promise with a timeout | [
"Create",
"a",
"promise",
"which",
"will",
"be",
"rejected",
"after",
"a",
"timeout",
"."
] | 1a66afc43611e078f8ab4ed41aa10a675d395682 | https://github.com/artdecocode/promto/blob/1a66afc43611e078f8ab4ed41aa10a675d395682/build/index.js#L25-L42 | train |
konfirm/node-is-type | source/type.js | ancestry | function ancestry(input) {
const proto = input && typeof input === 'object' ? Object.getPrototypeOf(input) : null;
return proto ? ancestry(proto).concat(proto) : [];
} | javascript | function ancestry(input) {
const proto = input && typeof input === 'object' ? Object.getPrototypeOf(input) : null;
return proto ? ancestry(proto).concat(proto) : [];
} | [
"function",
"ancestry",
"(",
"input",
")",
"{",
"const",
"proto",
"=",
"input",
"&&",
"typeof",
"input",
"===",
"'object'",
"?",
"Object",
".",
"getPrototypeOf",
"(",
"input",
")",
":",
"null",
";",
"return",
"proto",
"?",
"ancestry",
"(",
"proto",
")",
... | Obtain the prototype chain for the given input
@param {any} input
@return {array} ancestry | [
"Obtain",
"the",
"prototype",
"chain",
"for",
"the",
"given",
"input"
] | daaa18de5ccfbca7661357bcee855bb7df26c5c8 | https://github.com/konfirm/node-is-type/blob/daaa18de5ccfbca7661357bcee855bb7df26c5c8/source/type.js#L11-L15 | train |
konfirm/node-is-type | source/type.js | typeInAncestry | function typeInAncestry(type, input) {
return ancestry(input)
.reduce((carry, obj) => carry || Type.objectName(obj) === type, false);
} | javascript | function typeInAncestry(type, input) {
return ancestry(input)
.reduce((carry, obj) => carry || Type.objectName(obj) === type, false);
} | [
"function",
"typeInAncestry",
"(",
"type",
",",
"input",
")",
"{",
"return",
"ancestry",
"(",
"input",
")",
".",
"reduce",
"(",
"(",
"carry",
",",
"obj",
")",
"=>",
"carry",
"||",
"Type",
".",
"objectName",
"(",
"obj",
")",
"===",
"type",
",",
"false... | Verify whether the given type resides in the prototype chain of the input
@param {string} type
@param {any} input
@return {boolean} type in chain | [
"Verify",
"whether",
"the",
"given",
"type",
"resides",
"in",
"the",
"prototype",
"chain",
"of",
"the",
"input"
] | daaa18de5ccfbca7661357bcee855bb7df26c5c8 | https://github.com/konfirm/node-is-type/blob/daaa18de5ccfbca7661357bcee855bb7df26c5c8/source/type.js#L24-L27 | train |
konfirm/node-is-type | source/type.js | isType | function isType(type, input) {
if (input === null) {
return type.toLowerCase() === 'null';
}
return typeof input === type.toLowerCase() || Type.is(type, input);
} | javascript | function isType(type, input) {
if (input === null) {
return type.toLowerCase() === 'null';
}
return typeof input === type.toLowerCase() || Type.is(type, input);
} | [
"function",
"isType",
"(",
"type",
",",
"input",
")",
"{",
"if",
"(",
"input",
"===",
"null",
")",
"{",
"return",
"type",
".",
"toLowerCase",
"(",
")",
"===",
"'null'",
";",
"}",
"return",
"typeof",
"input",
"===",
"type",
".",
"toLowerCase",
"(",
")... | Determine if the given input matches the type
@param {string} type
@param {any} input
@return {boolean} is type | [
"Determine",
"if",
"the",
"given",
"input",
"matches",
"the",
"type"
] | daaa18de5ccfbca7661357bcee855bb7df26c5c8 | https://github.com/konfirm/node-is-type/blob/daaa18de5ccfbca7661357bcee855bb7df26c5c8/source/type.js#L36-L42 | train |
konfirm/node-is-type | source/type.js | cachedTypeDetector | function cachedTypeDetector(type) {
if (!cache.has(type)) {
cache.set(type, (input) => isType(type, input) || typeInAncestry(type, input));
}
return cache.get(type);
} | javascript | function cachedTypeDetector(type) {
if (!cache.has(type)) {
cache.set(type, (input) => isType(type, input) || typeInAncestry(type, input));
}
return cache.get(type);
} | [
"function",
"cachedTypeDetector",
"(",
"type",
")",
"{",
"if",
"(",
"!",
"cache",
".",
"has",
"(",
"type",
")",
")",
"{",
"cache",
".",
"set",
"(",
"type",
",",
"(",
"input",
")",
"=>",
"isType",
"(",
"type",
",",
"input",
")",
"||",
"typeInAncestr... | Ensure a delegate function exists for the given type and return it
@param {string} type
@return {function} detector | [
"Ensure",
"a",
"delegate",
"function",
"exists",
"for",
"the",
"given",
"type",
"and",
"return",
"it"
] | daaa18de5ccfbca7661357bcee855bb7df26c5c8 | https://github.com/konfirm/node-is-type/blob/daaa18de5ccfbca7661357bcee855bb7df26c5c8/source/type.js#L50-L56 | train |
bootprint/customize-write-files | index.js | mapFiles | async function mapFiles (customizeResult, targetDir, callback) {
const files = mergeEngineResults(customizeResult)
const results = mapValues(files, (file, filename) => {
// Write each file
const fullpath = path.join(targetDir, filename)
return callback(fullpath, file.contents)
})
return deep(results... | javascript | async function mapFiles (customizeResult, targetDir, callback) {
const files = mergeEngineResults(customizeResult)
const results = mapValues(files, (file, filename) => {
// Write each file
const fullpath = path.join(targetDir, filename)
return callback(fullpath, file.contents)
})
return deep(results... | [
"async",
"function",
"mapFiles",
"(",
"customizeResult",
",",
"targetDir",
",",
"callback",
")",
"{",
"const",
"files",
"=",
"mergeEngineResults",
"(",
"customizeResult",
")",
"const",
"results",
"=",
"mapValues",
"(",
"files",
",",
"(",
"file",
",",
"filename... | Map the merged files in the customize-result onto a function a promised object of values.
The type T is the return value of the callback (promised)
@param {object<object<string|Buffer|Readable|undefined>>} customizeResult
@param {function(fullpath: string, contents: (string|Buffer|Readable|undefined)):Promise<T>} cal... | [
"Map",
"the",
"merged",
"files",
"in",
"the",
"customize",
"-",
"result",
"onto",
"a",
"function",
"a",
"promised",
"object",
"of",
"values",
"."
] | af77ce78b5196f40ce90670bfdb6e1e7e496a415 | https://github.com/bootprint/customize-write-files/blob/af77ce78b5196f40ce90670bfdb6e1e7e496a415/index.js#L65-L73 | train |
bootprint/customize-write-files | index.js | mapValues | function mapValues (obj, fn) {
return Object.keys(obj).reduce(function (subresult, key) {
subresult[key] = fn(obj[key], key)
return subresult
}, {})
} | javascript | function mapValues (obj, fn) {
return Object.keys(obj).reduce(function (subresult, key) {
subresult[key] = fn(obj[key], key)
return subresult
}, {})
} | [
"function",
"mapValues",
"(",
"obj",
",",
"fn",
")",
"{",
"return",
"Object",
".",
"keys",
"(",
"obj",
")",
".",
"reduce",
"(",
"function",
"(",
"subresult",
",",
"key",
")",
"{",
"subresult",
"[",
"key",
"]",
"=",
"fn",
"(",
"obj",
"[",
"key",
"... | Apply a function to each value of an object and return the result
@param {object<any>} obj
@param {function(any, string): any} fn
@returns {object<any>}
@private | [
"Apply",
"a",
"function",
"to",
"each",
"value",
"of",
"an",
"object",
"and",
"return",
"the",
"result"
] | af77ce78b5196f40ce90670bfdb6e1e7e496a415 | https://github.com/bootprint/customize-write-files/blob/af77ce78b5196f40ce90670bfdb6e1e7e496a415/index.js#L82-L87 | train |
eface2face/meteor-blaze | blaze.js | function (elem, func) {
var elt = new TeardownCallback(func);
var propName = DOMBackend.Teardown._CB_PROP;
if (! elem[propName]) {
// create an empty node that is never unlinked
elem[propName] = new TeardownCallback;
// Set up the event, only the first time.
$jq(elem).on(DOMBackend... | javascript | function (elem, func) {
var elt = new TeardownCallback(func);
var propName = DOMBackend.Teardown._CB_PROP;
if (! elem[propName]) {
// create an empty node that is never unlinked
elem[propName] = new TeardownCallback;
// Set up the event, only the first time.
$jq(elem).on(DOMBackend... | [
"function",
"(",
"elem",
",",
"func",
")",
"{",
"var",
"elt",
"=",
"new",
"TeardownCallback",
"(",
"func",
")",
";",
"var",
"propName",
"=",
"DOMBackend",
".",
"Teardown",
".",
"_CB_PROP",
";",
"if",
"(",
"!",
"elem",
"[",
"propName",
"]",
")",
"{",
... | Registers a callback function to be called when the given element or one of its ancestors is removed from the DOM via the backend library. The callback function is called at most once, and it receives the element in question as an argument. | [
"Registers",
"a",
"callback",
"function",
"to",
"be",
"called",
"when",
"the",
"given",
"element",
"or",
"one",
"of",
"its",
"ancestors",
"is",
"removed",
"from",
"the",
"DOM",
"via",
"the",
"backend",
"library",
".",
"The",
"callback",
"function",
"is",
"... | c284d160b7edf2bab3a2568a94094d5fea7bac7f | https://github.com/eface2face/meteor-blaze/blob/c284d160b7edf2bab3a2568a94094d5fea7bac7f/blaze.js#L160-L175 | train | |
eface2face/meteor-blaze | blaze.js | function (elem) {
var elems = [];
// Array.prototype.slice.call doesn't work when given a NodeList in
// IE8 ("JScript object expected").
var nodeList = elem.getElementsByTagName('*');
for (var i = 0; i < nodeList.length; i++) {
elems.push(nodeList[i]);
}
elems.push(elem);
$jq.clea... | javascript | function (elem) {
var elems = [];
// Array.prototype.slice.call doesn't work when given a NodeList in
// IE8 ("JScript object expected").
var nodeList = elem.getElementsByTagName('*');
for (var i = 0; i < nodeList.length; i++) {
elems.push(nodeList[i]);
}
elems.push(elem);
$jq.clea... | [
"function",
"(",
"elem",
")",
"{",
"var",
"elems",
"=",
"[",
"]",
";",
"// Array.prototype.slice.call doesn't work when given a NodeList in",
"// IE8 (\"JScript object expected\").",
"var",
"nodeList",
"=",
"elem",
".",
"getElementsByTagName",
"(",
"'*'",
")",
";",
"for... | Recursively call all teardown hooks, in the backend and registered through DOMBackend.onElementTeardown. | [
"Recursively",
"call",
"all",
"teardown",
"hooks",
"in",
"the",
"backend",
"and",
"registered",
"through",
"DOMBackend",
".",
"onElementTeardown",
"."
] | c284d160b7edf2bab3a2568a94094d5fea7bac7f | https://github.com/eface2face/meteor-blaze/blob/c284d160b7edf2bab3a2568a94094d5fea7bac7f/blaze.js#L178-L188 | train | |
eface2face/meteor-blaze | blaze.js | function () {
var eventDict = element.$blaze_events;
if (! eventDict)
return;
// newHandlerRecs has only one item unless you specify multiple
// event types. If this code is slow, it's because we have to
// iterate over handlerList here. Clearing a whole handlerList
// via ... | javascript | function () {
var eventDict = element.$blaze_events;
if (! eventDict)
return;
// newHandlerRecs has only one item unless you specify multiple
// event types. If this code is slow, it's because we have to
// iterate over handlerList here. Clearing a whole handlerList
// via ... | [
"function",
"(",
")",
"{",
"var",
"eventDict",
"=",
"element",
".",
"$blaze_events",
";",
"if",
"(",
"!",
"eventDict",
")",
"return",
";",
"// newHandlerRecs has only one item unless you specify multiple",
"// event types. If this code is slow, it's because we have to",
"// ... | closes over just `element` and `newHandlerRecs` | [
"closes",
"over",
"just",
"element",
"and",
"newHandlerRecs"
] | c284d160b7edf2bab3a2568a94094d5fea7bac7f | https://github.com/eface2face/meteor-blaze/blob/c284d160b7edf2bab3a2568a94094d5fea7bac7f/blaze.js#L884-L907 | train | |
eface2face/meteor-blaze | blaze.js | function (content) {
checkRenderContent(content);
if (content instanceof Blaze.Template) {
return content.constructView();
} else if (content instanceof Blaze.View) {
return content;
} else {
var func = content;
if (typeof func !== 'function') {
func = function () {
return content... | javascript | function (content) {
checkRenderContent(content);
if (content instanceof Blaze.Template) {
return content.constructView();
} else if (content instanceof Blaze.View) {
return content;
} else {
var func = content;
if (typeof func !== 'function') {
func = function () {
return content... | [
"function",
"(",
"content",
")",
"{",
"checkRenderContent",
"(",
"content",
")",
";",
"if",
"(",
"content",
"instanceof",
"Blaze",
".",
"Template",
")",
"{",
"return",
"content",
".",
"constructView",
"(",
")",
";",
"}",
"else",
"if",
"(",
"content",
"in... | For Blaze.render and Blaze.toHTML, take content and wrap it in a View, unless it's a single View or Template already. | [
"For",
"Blaze",
".",
"render",
"and",
"Blaze",
".",
"toHTML",
"take",
"content",
"and",
"wrap",
"it",
"in",
"a",
"View",
"unless",
"it",
"s",
"a",
"single",
"View",
"or",
"Template",
"already",
"."
] | c284d160b7edf2bab3a2568a94094d5fea7bac7f | https://github.com/eface2face/meteor-blaze/blob/c284d160b7edf2bab3a2568a94094d5fea7bac7f/blaze.js#L2094-L2110 | train | |
eface2face/meteor-blaze | blaze.js | function (x) {
if (typeof x === 'function') {
return function () {
var data = Blaze.getData();
if (data == null)
data = {};
return x.apply(data, arguments);
};
}
return x;
} | javascript | function (x) {
if (typeof x === 'function') {
return function () {
var data = Blaze.getData();
if (data == null)
data = {};
return x.apply(data, arguments);
};
}
return x;
} | [
"function",
"(",
"x",
")",
"{",
"if",
"(",
"typeof",
"x",
"===",
"'function'",
")",
"{",
"return",
"function",
"(",
")",
"{",
"var",
"data",
"=",
"Blaze",
".",
"getData",
"(",
")",
";",
"if",
"(",
"data",
"==",
"null",
")",
"data",
"=",
"{",
"}... | If `x` is a function, binds the value of `this` for that function to the current data context. | [
"If",
"x",
"is",
"a",
"function",
"binds",
"the",
"value",
"of",
"this",
"for",
"that",
"function",
"to",
"the",
"current",
"data",
"context",
"."
] | c284d160b7edf2bab3a2568a94094d5fea7bac7f | https://github.com/eface2face/meteor-blaze/blob/c284d160b7edf2bab3a2568a94094d5fea7bac7f/blaze.js#L2797-L2807 | train | |
the-labo/the-resource-base | lib/isResourceClass.js | isResourceClass | function isResourceClass(Class) {
const hitByClass =
Class.prototype instanceof TheResource || Class === TheResource
if (hitByClass) {
return true
}
let named = Class
while (!!named) {
const hit = named.name && named.name.startsWith('TheResource')
if (hit) {
return true
}
named =... | javascript | function isResourceClass(Class) {
const hitByClass =
Class.prototype instanceof TheResource || Class === TheResource
if (hitByClass) {
return true
}
let named = Class
while (!!named) {
const hit = named.name && named.name.startsWith('TheResource')
if (hit) {
return true
}
named =... | [
"function",
"isResourceClass",
"(",
"Class",
")",
"{",
"const",
"hitByClass",
"=",
"Class",
".",
"prototype",
"instanceof",
"TheResource",
"||",
"Class",
"===",
"TheResource",
"if",
"(",
"hitByClass",
")",
"{",
"return",
"true",
"}",
"let",
"named",
"=",
"Cl... | Detect is a resource class
@param Class | [
"Detect",
"is",
"a",
"resource",
"class"
] | 76be3780904893641851f17e9edda316c63f147a | https://github.com/the-labo/the-resource-base/blob/76be3780904893641851f17e9edda316c63f147a/lib/isResourceClass.js#L13-L28 | train |
mongodb-js/deployment-model | lib/probe.js | Probe | function Probe(connection, done) {
if (!(this instanceof Probe)) {
return new Probe(connection, done);
}
if (typeof connection === 'string') {
connection = Connection.from(
Deployment.getId(connection));
}
debug('connection is `%j`', connection);
this.deployment = new Deployment({
_id: I... | javascript | function Probe(connection, done) {
if (!(this instanceof Probe)) {
return new Probe(connection, done);
}
if (typeof connection === 'string') {
connection = Connection.from(
Deployment.getId(connection));
}
debug('connection is `%j`', connection);
this.deployment = new Deployment({
_id: I... | [
"function",
"Probe",
"(",
"connection",
",",
"done",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Probe",
")",
")",
"{",
"return",
"new",
"Probe",
"(",
"connection",
",",
"done",
")",
";",
"}",
"if",
"(",
"typeof",
"connection",
"===",
"'str... | Use the metadata of `connection` to discover
details about the MongoDB deployment behind it
and persist the results in `store`.
@param {Connection} connection
@param {Function} done - Callback `(err, {Deployment})`
@return {Probe}
@api public | [
"Use",
"the",
"metadata",
"of",
"connection",
"to",
"discover",
"details",
"about",
"the",
"MongoDB",
"deployment",
"behind",
"it",
"and",
"persist",
"the",
"results",
"in",
"store",
"."
] | f3a7da2ede53db020e1fc9d1899071184d5c5e9f | https://github.com/mongodb-js/deployment-model/blob/f3a7da2ede53db020e1fc9d1899071184d5c5e9f/lib/probe.js#L21-L45 | train |
Mammut-FE/nejm | src/util/chain/NodeList.js | function(_dest, _src){
var _nodeName, _attr;
if (_dest.nodeType !== 1) {
return;
}
// lt ie9 才有
if (_dest.clearAttributes) {
_dest.clearAttributes();
_dest.mergeAttributes(_src);
... | javascript | function(_dest, _src){
var _nodeName, _attr;
if (_dest.nodeType !== 1) {
return;
}
// lt ie9 才有
if (_dest.clearAttributes) {
_dest.clearAttributes();
_dest.mergeAttributes(_src);
... | [
"function",
"(",
"_dest",
",",
"_src",
")",
"{",
"var",
"_nodeName",
",",
"_attr",
";",
"if",
"(",
"_dest",
".",
"nodeType",
"!==",
"1",
")",
"{",
"return",
";",
"}",
"// lt ie9 才有",
"if",
"(",
"_dest",
".",
"clearAttributes",
")",
"{",
"_dest",
".",... | dest src attribute fixed | [
"dest",
"src",
"attribute",
"fixed"
] | dfc09ac66a8d67620a7aea65e34d8a179976b3fb | https://github.com/Mammut-FE/nejm/blob/dfc09ac66a8d67620a7aea65e34d8a179976b3fb/src/util/chain/NodeList.js#L387-L407 | train | |
hairyhenderson/node-fellowshipone | lib/person_addresses.js | PersonAddresses | function PersonAddresses (f1, personID) {
if (!personID) {
throw new Error('PersonAddresses requires a person ID!')
}
Addresses.call(this, f1, {
path: '/People/' + personID + '/Addresses'
})
} | javascript | function PersonAddresses (f1, personID) {
if (!personID) {
throw new Error('PersonAddresses requires a person ID!')
}
Addresses.call(this, f1, {
path: '/People/' + personID + '/Addresses'
})
} | [
"function",
"PersonAddresses",
"(",
"f1",
",",
"personID",
")",
"{",
"if",
"(",
"!",
"personID",
")",
"{",
"throw",
"new",
"Error",
"(",
"'PersonAddresses requires a person ID!'",
")",
"}",
"Addresses",
".",
"call",
"(",
"this",
",",
"f1",
",",
"{",
"path"... | The Addresses object, in a Person context.
@param {Object} f1 - the F1 object
@param {Number} personID - the Person ID, for context | [
"The",
"Addresses",
"object",
"in",
"a",
"Person",
"context",
"."
] | 5e80eb9ec31fb6dceee1e8c211e7b6e0e373b08b | https://github.com/hairyhenderson/node-fellowshipone/blob/5e80eb9ec31fb6dceee1e8c211e7b6e0e373b08b/lib/person_addresses.js#L10-L17 | train |
the-labo/the-html | shim/TheHtmlStyle.js | TheHtmlStyle | function TheHtmlStyle(_ref) {
var className = _ref.className,
id = _ref.id,
options = _ref.options;
return _react.default.createElement(_theStyle.TheStyle, (0, _extends2.default)({
id: id
}, {
className: (0, _classnames.default)('the-html-style', className),
styles: TheHtmlStyle.data(optio... | javascript | function TheHtmlStyle(_ref) {
var className = _ref.className,
id = _ref.id,
options = _ref.options;
return _react.default.createElement(_theStyle.TheStyle, (0, _extends2.default)({
id: id
}, {
className: (0, _classnames.default)('the-html-style', className),
styles: TheHtmlStyle.data(optio... | [
"function",
"TheHtmlStyle",
"(",
"_ref",
")",
"{",
"var",
"className",
"=",
"_ref",
".",
"className",
",",
"id",
"=",
"_ref",
".",
"id",
",",
"options",
"=",
"_ref",
".",
"options",
";",
"return",
"_react",
".",
"default",
".",
"createElement",
"(",
"_... | Style for TheHtml | [
"Style",
"for",
"TheHtml"
] | df3c2ccff712a4a2da45f2ce1d8695eca007d08c | https://github.com/the-labo/the-html/blob/df3c2ccff712a4a2da45f2ce1d8695eca007d08c/shim/TheHtmlStyle.js#L21-L31 | train |
nanlabs/econsole | index.js | initFileLogger | function initFileLogger(filepath) {
currentFilePath = filepath || currentFilePath;
var logDir = path.dirname(currentFilePath);
appenders.push(logToFile);
if(!fs.existsSync(logDir)) fs.mkdirSync(logDir);
} | javascript | function initFileLogger(filepath) {
currentFilePath = filepath || currentFilePath;
var logDir = path.dirname(currentFilePath);
appenders.push(logToFile);
if(!fs.existsSync(logDir)) fs.mkdirSync(logDir);
} | [
"function",
"initFileLogger",
"(",
"filepath",
")",
"{",
"currentFilePath",
"=",
"filepath",
"||",
"currentFilePath",
";",
"var",
"logDir",
"=",
"path",
".",
"dirname",
"(",
"currentFilePath",
")",
";",
"appenders",
".",
"push",
"(",
"logToFile",
")",
";",
"... | Initialzes the file logger
@param filepath path to the log file | [
"Initialzes",
"the",
"file",
"logger"
] | 2377a33e266b4e39a35cf981ece14b6b6a16af46 | https://github.com/nanlabs/econsole/blob/2377a33e266b4e39a35cf981ece14b6b6a16af46/index.js#L134-L140 | train |
nanlabs/econsole | index.js | writeLog | function writeLog(level, msg) {
var line;
if(showSourceInfo) {
var si = getSourceInfo();
if (includeDate) {
line = util.format("[%s] <%s>\t[%s:%s] %s", moment().format(), level, si.file, si.lineNumber, msg);
} else {
line = util.format("<%s>\t[%s:%s] %s", level, si.file, si.lineNumber, msg);... | javascript | function writeLog(level, msg) {
var line;
if(showSourceInfo) {
var si = getSourceInfo();
if (includeDate) {
line = util.format("[%s] <%s>\t[%s:%s] %s", moment().format(), level, si.file, si.lineNumber, msg);
} else {
line = util.format("<%s>\t[%s:%s] %s", level, si.file, si.lineNumber, msg);... | [
"function",
"writeLog",
"(",
"level",
",",
"msg",
")",
"{",
"var",
"line",
";",
"if",
"(",
"showSourceInfo",
")",
"{",
"var",
"si",
"=",
"getSourceInfo",
"(",
")",
";",
"if",
"(",
"includeDate",
")",
"{",
"line",
"=",
"util",
".",
"format",
"(",
"\... | Writes the log to stderr
Partially based on clim (http://github.com/epeli/node-clim)
Copyright (c) 2009-2011 Esa-Matti Suuronen <esa-matti@suuronen.org> | [
"Writes",
"the",
"log",
"to",
"stderr"
] | 2377a33e266b4e39a35cf981ece14b6b6a16af46 | https://github.com/nanlabs/econsole/blob/2377a33e266b4e39a35cf981ece14b6b6a16af46/index.js#L148-L169 | train |
nanlabs/econsole | index.js | getSourceInfo | function getSourceInfo() {
var exec = getStack()[3];
var pos = exec.getFileName().lastIndexOf('\\');
if(pos < 0) exec.getFileName().lastIndexOf('/');
return {
methodName: exec.getFunctionName() || 'anonymous',
file: exec.getFileName().substring(pos + 1),
lineNumber: exec.getLineNumber()
};
} | javascript | function getSourceInfo() {
var exec = getStack()[3];
var pos = exec.getFileName().lastIndexOf('\\');
if(pos < 0) exec.getFileName().lastIndexOf('/');
return {
methodName: exec.getFunctionName() || 'anonymous',
file: exec.getFileName().substring(pos + 1),
lineNumber: exec.getLineNumber()
};
} | [
"function",
"getSourceInfo",
"(",
")",
"{",
"var",
"exec",
"=",
"getStack",
"(",
")",
"[",
"3",
"]",
";",
"var",
"pos",
"=",
"exec",
".",
"getFileName",
"(",
")",
".",
"lastIndexOf",
"(",
"'\\\\'",
")",
";",
"if",
"(",
"pos",
"<",
"0",
")",
"exec... | Gets the source information from the line being log | [
"Gets",
"the",
"source",
"information",
"from",
"the",
"line",
"being",
"log"
] | 2377a33e266b4e39a35cf981ece14b6b6a16af46 | https://github.com/nanlabs/econsole/blob/2377a33e266b4e39a35cf981ece14b6b6a16af46/index.js#L190-L201 | train |
DavidSouther/JEFRi | modeler/angular/app/scripts/lib/angular/ui/angular-ui.js | function ($scope, element, attrs) {
var opts = {};
if (attrs.uiAnimate) {
opts = $scope.$eval(attrs.uiAnimate);
if (angular.isString(opts)) {
opts = {'class': opts};
}
}
opts = angular.extend({'class': 'ui-animate'}, options, opts);
element.addC... | javascript | function ($scope, element, attrs) {
var opts = {};
if (attrs.uiAnimate) {
opts = $scope.$eval(attrs.uiAnimate);
if (angular.isString(opts)) {
opts = {'class': opts};
}
}
opts = angular.extend({'class': 'ui-animate'}, options, opts);
element.addC... | [
"function",
"(",
"$scope",
",",
"element",
",",
"attrs",
")",
"{",
"var",
"opts",
"=",
"{",
"}",
";",
"if",
"(",
"attrs",
".",
"uiAnimate",
")",
"{",
"opts",
"=",
"$scope",
".",
"$eval",
"(",
"attrs",
".",
"uiAnimate",
")",
";",
"if",
"(",
"angul... | supports using directive as element, attribute and class | [
"supports",
"using",
"directive",
"as",
"element",
"attribute",
"and",
"class"
] | 161f24e242e05b9b2114cc1123a257141a60eaf2 | https://github.com/DavidSouther/JEFRi/blob/161f24e242e05b9b2114cc1123a257141a60eaf2/modeler/angular/app/scripts/lib/angular/ui/angular-ui.js#L32-L46 | train | |
DavidSouther/JEFRi | modeler/angular/app/scripts/lib/angular/ui/angular-ui.js | bindMapEvents | function bindMapEvents(scope, eventsStr, googleObject, element) {
angular.forEach(eventsStr.split(' '), function (eventName) {
//Prefix all googlemap events with 'map-', so eg 'click'
//for the googlemap doesn't interfere with a normal 'click' event
var $event = { type: 'map-' + eventName };
... | javascript | function bindMapEvents(scope, eventsStr, googleObject, element) {
angular.forEach(eventsStr.split(' '), function (eventName) {
//Prefix all googlemap events with 'map-', so eg 'click'
//for the googlemap doesn't interfere with a normal 'click' event
var $event = { type: 'map-' + eventName };
... | [
"function",
"bindMapEvents",
"(",
"scope",
",",
"eventsStr",
",",
"googleObject",
",",
"element",
")",
"{",
"angular",
".",
"forEach",
"(",
"eventsStr",
".",
"split",
"(",
"' '",
")",
",",
"function",
"(",
"eventName",
")",
"{",
"//Prefix all googlemap events ... | Setup map events from a google map object to trigger on a given element too, then we just use ui-event to catch events from an element | [
"Setup",
"map",
"events",
"from",
"a",
"google",
"map",
"object",
"to",
"trigger",
"on",
"a",
"given",
"element",
"too",
"then",
"we",
"just",
"use",
"ui",
"-",
"event",
"to",
"catch",
"events",
"from",
"an",
"element"
] | 161f24e242e05b9b2114cc1123a257141a60eaf2 | https://github.com/DavidSouther/JEFRi/blob/161f24e242e05b9b2114cc1123a257141a60eaf2/modeler/angular/app/scripts/lib/angular/ui/angular-ui.js#L468-L481 | train |
liamray/nexl-engine | nexl-engine/nexl-source-utils.js | resolveIncludeDirectives | function resolveIncludeDirectives(text, fileItem) {
var result = [];
// parse source code with esprima
try {
var srcParsed = esprima.parse(text);
} catch (e) {
logger.error(buildErrMsg(fileItem.ancestor, 'Failed to parse a [%s] JavaScript file. Reason : [%s]', fileItem.filePath, e));
throw buildShortErrMsg(f... | javascript | function resolveIncludeDirectives(text, fileItem) {
var result = [];
// parse source code with esprima
try {
var srcParsed = esprima.parse(text);
} catch (e) {
logger.error(buildErrMsg(fileItem.ancestor, 'Failed to parse a [%s] JavaScript file. Reason : [%s]', fileItem.filePath, e));
throw buildShortErrMsg(f... | [
"function",
"resolveIncludeDirectives",
"(",
"text",
",",
"fileItem",
")",
"{",
"var",
"result",
"=",
"[",
"]",
";",
"// parse source code with esprima",
"try",
"{",
"var",
"srcParsed",
"=",
"esprima",
".",
"parse",
"(",
"text",
")",
";",
"}",
"catch",
"(",
... | parses JavaScript provided as text and resolves nexl include directives ( like "@import ../../src.js"; ) | [
"parses",
"JavaScript",
"provided",
"as",
"text",
"and",
"resolves",
"nexl",
"include",
"directives",
"(",
"like"
] | 47cd168460dbe724626953047b4d3268ba981abf | https://github.com/liamray/nexl-engine/blob/47cd168460dbe724626953047b4d3268ba981abf/nexl-engine/nexl-source-utils.js#L63-L86 | train |
Mammut-FE/nejm | src/util/ajax/proxy/upload.js | function(){
var _body,_text;
try{
var _body = this.__frame.contentWindow.document.body,
_text = (_body.innerText||_body.textContent||'').trim();
// check result for same domain with upload proxy html
if (_text.indexOf(_xflag)>=0... | javascript | function(){
var _body,_text;
try{
var _body = this.__frame.contentWindow.document.body,
_text = (_body.innerText||_body.textContent||'').trim();
// check result for same domain with upload proxy html
if (_text.indexOf(_xflag)>=0... | [
"function",
"(",
")",
"{",
"var",
"_body",
",",
"_text",
";",
"try",
"{",
"var",
"_body",
"=",
"this",
".",
"__frame",
".",
"contentWindow",
".",
"document",
".",
"body",
",",
"_text",
"=",
"(",
"_body",
".",
"innerText",
"||",
"_body",
".",
"textCon... | same domain upload result check | [
"same",
"domain",
"upload",
"result",
"check"
] | dfc09ac66a8d67620a7aea65e34d8a179976b3fb | https://github.com/Mammut-FE/nejm/blob/dfc09ac66a8d67620a7aea65e34d8a179976b3fb/src/util/ajax/proxy/upload.js#L113-L129 | train | |
Mammut-FE/nejm | src/util/ajax/proxy/upload.js | function(_url,_mode,_cookie){
_j0._$request(_url,{
type:'json',
method:'POST',
cookie:_cookie,
mode:parseInt(_mode)||0,
onload:function(_data){
if (!this.__timer) return;
this._$dispatchEv... | javascript | function(_url,_mode,_cookie){
_j0._$request(_url,{
type:'json',
method:'POST',
cookie:_cookie,
mode:parseInt(_mode)||0,
onload:function(_data){
if (!this.__timer) return;
this._$dispatchEv... | [
"function",
"(",
"_url",
",",
"_mode",
",",
"_cookie",
")",
"{",
"_j0",
".",
"_$request",
"(",
"_url",
",",
"{",
"type",
":",
"'json'",
",",
"method",
":",
"'POST'",
",",
"cookie",
":",
"_cookie",
",",
"mode",
":",
"parseInt",
"(",
"_mode",
")",
"|... | check upload progress | [
"check",
"upload",
"progress"
] | dfc09ac66a8d67620a7aea65e34d8a179976b3fb | https://github.com/Mammut-FE/nejm/blob/dfc09ac66a8d67620a7aea65e34d8a179976b3fb/src/util/ajax/proxy/upload.js#L131-L155 | train | |
vesln/hydro | lib/cli/index.js | Cli | function Cli(hydro, argv) {
if (!(this instanceof Cli)) {
return new Cli(hydro, argv);
}
this.hydro = hydro;
this.argv = argv;
this.options = {};
this.conf = [];
this.commands = [ 'help', 'version' ];
this.arrayParams = { plugins: true };
} | javascript | function Cli(hydro, argv) {
if (!(this instanceof Cli)) {
return new Cli(hydro, argv);
}
this.hydro = hydro;
this.argv = argv;
this.options = {};
this.conf = [];
this.commands = [ 'help', 'version' ];
this.arrayParams = { plugins: true };
} | [
"function",
"Cli",
"(",
"hydro",
",",
"argv",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Cli",
")",
")",
"{",
"return",
"new",
"Cli",
"(",
"hydro",
",",
"argv",
")",
";",
"}",
"this",
".",
"hydro",
"=",
"hydro",
";",
"this",
".",
"ar... | CLI runner.
@param {Object} hydro
@param {Object} argv
@constructor | [
"CLI",
"runner",
"."
] | 3f4d2e4926f913976187376e82f1496514c39890 | https://github.com/vesln/hydro/blob/3f4d2e4926f913976187376e82f1496514c39890/lib/cli/index.js#L16-L27 | train |
LaxarJS/laxar-tooling | src/artifact_collector.js | followEntryRefs | function followEntryRefs( key, callback ) {
return function( entry ) {
const refs = entry[ key ] || [];
return Promise.all( refs.map( callback ) ).then( flatten );
};
} | javascript | function followEntryRefs( key, callback ) {
return function( entry ) {
const refs = entry[ key ] || [];
return Promise.all( refs.map( callback ) ).then( flatten );
};
} | [
"function",
"followEntryRefs",
"(",
"key",
",",
"callback",
")",
"{",
"return",
"function",
"(",
"entry",
")",
"{",
"const",
"refs",
"=",
"entry",
"[",
"key",
"]",
"||",
"[",
"]",
";",
"return",
"Promise",
".",
"all",
"(",
"refs",
".",
"map",
"(",
... | Create a function that expects an artifact entry as a parameter and follows the given key of it with
a given function.
@private
@param {String} key the key to follow
@param {Function} callback the function to call for each ref listed in the key
@return {Function} a function returning a promise for a list of entries re... | [
"Create",
"a",
"function",
"that",
"expects",
"an",
"artifact",
"entry",
"as",
"a",
"parameter",
"and",
"follows",
"the",
"given",
"key",
"of",
"it",
"with",
"a",
"given",
"function",
"."
] | 1c4a221994f342ec03a98b68533c4de77ccfeec6 | https://github.com/LaxarJS/laxar-tooling/blob/1c4a221994f342ec03a98b68533c4de77ccfeec6/src/artifact_collector.js#L715-L720 | train |
veo-labs/openveo-api | lib/storages/databases/mongodb/MongoDatabase.js | MongoDatabase | function MongoDatabase(configuration) {
MongoDatabase.super_.call(this, configuration);
Object.defineProperties(this, {
/**
* The name of the replica set.
*
* @property replicaSet
* @type String
* @final
*/
replicaSet: {value: configuration.replicaSet},
/**
* A comm... | javascript | function MongoDatabase(configuration) {
MongoDatabase.super_.call(this, configuration);
Object.defineProperties(this, {
/**
* The name of the replica set.
*
* @property replicaSet
* @type String
* @final
*/
replicaSet: {value: configuration.replicaSet},
/**
* A comm... | [
"function",
"MongoDatabase",
"(",
"configuration",
")",
"{",
"MongoDatabase",
".",
"super_",
".",
"call",
"(",
"this",
",",
"configuration",
")",
";",
"Object",
".",
"defineProperties",
"(",
"this",
",",
"{",
"/**\n * The name of the replica set.\n *\n * @... | Defines a MongoDB Database.
@class MongoDatabase
@extends Database
@constructor
@param {Object} configuration A database configuration object
@param {String} configuration.host MongoDB server host
@param {Number} configuration.port MongoDB server port
@param {String} configuration.database The name of the database
@pa... | [
"Defines",
"a",
"MongoDB",
"Database",
"."
] | 493a811e9a5ba4d3e14910facaa7452caba1ab38 | https://github.com/veo-labs/openveo-api/blob/493a811e9a5ba4d3e14910facaa7452caba1ab38/lib/storages/databases/mongodb/MongoDatabase.js#L32-L68 | train |
veo-labs/openveo-api | lib/storages/databases/mongodb/MongoDatabase.js | buildFilters | function buildFilters(filters) {
var builtFilters = [];
filters.forEach(function(filter) {
builtFilters.push(MongoDatabase.buildFilter(filter));
});
return builtFilters;
} | javascript | function buildFilters(filters) {
var builtFilters = [];
filters.forEach(function(filter) {
builtFilters.push(MongoDatabase.buildFilter(filter));
});
return builtFilters;
} | [
"function",
"buildFilters",
"(",
"filters",
")",
"{",
"var",
"builtFilters",
"=",
"[",
"]",
";",
"filters",
".",
"forEach",
"(",
"function",
"(",
"filter",
")",
"{",
"builtFilters",
".",
"push",
"(",
"MongoDatabase",
".",
"buildFilter",
"(",
"filter",
")",... | Builds a list of filters.
@param {Array} filters The list of filters to build
@return {Array} The list of built filters | [
"Builds",
"a",
"list",
"of",
"filters",
"."
] | 493a811e9a5ba4d3e14910facaa7452caba1ab38 | https://github.com/veo-labs/openveo-api/blob/493a811e9a5ba4d3e14910facaa7452caba1ab38/lib/storages/databases/mongodb/MongoDatabase.js#L93-L99 | train |
veo-labs/openveo-api | lib/storages/ResourceFilter.js | isValidType | function isValidType(value, authorizedTypes) {
var valueToString = Object.prototype.toString.call(value);
for (var i = 0; i < authorizedTypes.length; i++)
if (valueToString === '[object ' + authorizedTypes[i] + ']') return true;
return false;
} | javascript | function isValidType(value, authorizedTypes) {
var valueToString = Object.prototype.toString.call(value);
for (var i = 0; i < authorizedTypes.length; i++)
if (valueToString === '[object ' + authorizedTypes[i] + ']') return true;
return false;
} | [
"function",
"isValidType",
"(",
"value",
",",
"authorizedTypes",
")",
"{",
"var",
"valueToString",
"=",
"Object",
".",
"prototype",
".",
"toString",
".",
"call",
"(",
"value",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"authorizedTypes",
... | Validates the type of a value.
@method isValidType
@private
@param {String} value The value to test
@param {Array} The list of authorized types as strings
@return {Boolean} true if valid, false otherwise | [
"Validates",
"the",
"type",
"of",
"a",
"value",
"."
] | 493a811e9a5ba4d3e14910facaa7452caba1ab38 | https://github.com/veo-labs/openveo-api/blob/493a811e9a5ba4d3e14910facaa7452caba1ab38/lib/storages/ResourceFilter.js#L93-L100 | train |
veo-labs/openveo-api | lib/storages/ResourceFilter.js | addComparisonOperation | function addComparisonOperation(field, value, operator, authorizedTypes) {
if (!isValidType(field, ['String'])) throw new TypeError('Invalid field');
if (!isValidType(value, authorizedTypes)) throw new TypeError('Invalid value');
this.operations.push({
type: operator,
field: field,
value: value
});... | javascript | function addComparisonOperation(field, value, operator, authorizedTypes) {
if (!isValidType(field, ['String'])) throw new TypeError('Invalid field');
if (!isValidType(value, authorizedTypes)) throw new TypeError('Invalid value');
this.operations.push({
type: operator,
field: field,
value: value
});... | [
"function",
"addComparisonOperation",
"(",
"field",
",",
"value",
",",
"operator",
",",
"authorizedTypes",
")",
"{",
"if",
"(",
"!",
"isValidType",
"(",
"field",
",",
"[",
"'String'",
"]",
")",
")",
"throw",
"new",
"TypeError",
"(",
"'Invalid field'",
")",
... | Adds a comparison operation to the filter.
@method addComparisonOperation
@private
@param {String} field The name of the field
@param {String|Number|Boolean|Date} value The value to compare the field to
@param {String} Resource filter operator
@param {Array} The list of authorized types as strings
@return {ResourceFil... | [
"Adds",
"a",
"comparison",
"operation",
"to",
"the",
"filter",
"."
] | 493a811e9a5ba4d3e14910facaa7452caba1ab38 | https://github.com/veo-labs/openveo-api/blob/493a811e9a5ba4d3e14910facaa7452caba1ab38/lib/storages/ResourceFilter.js#L114-L124 | train |
veo-labs/openveo-api | lib/storages/ResourceFilter.js | addLogicalOperation | function addLogicalOperation(filters, operator) {
for (var i = 0; i < filters.length; i++)
if (!(filters[i] instanceof ResourceFilter)) throw new TypeError('Invalid filters');
if (this.hasOperation(operator)) {
// This logical operator already exists in the list of operations
// Just add the new filte... | javascript | function addLogicalOperation(filters, operator) {
for (var i = 0; i < filters.length; i++)
if (!(filters[i] instanceof ResourceFilter)) throw new TypeError('Invalid filters');
if (this.hasOperation(operator)) {
// This logical operator already exists in the list of operations
// Just add the new filte... | [
"function",
"addLogicalOperation",
"(",
"filters",
",",
"operator",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"filters",
".",
"length",
";",
"i",
"++",
")",
"if",
"(",
"!",
"(",
"filters",
"[",
"i",
"]",
"instanceof",
"ResourceFilter... | Adds a logical operation to the filter.
Only one logical operation can be added in a filter.
@method addLogicalOperation
@private
@param {Array} filters The list of filters
@return {ResourceFilter} The actual filter
@throws {TypeError} An error if field and / or value is not valid | [
"Adds",
"a",
"logical",
"operation",
"to",
"the",
"filter",
"."
] | 493a811e9a5ba4d3e14910facaa7452caba1ab38 | https://github.com/veo-labs/openveo-api/blob/493a811e9a5ba4d3e14910facaa7452caba1ab38/lib/storages/ResourceFilter.js#L137-L162 | train |
rtgibbons/grunt-cloudfiles | tasks/cloudfiles.js | hashFile | function hashFile(filename, callback) {
var calledBack = false,
md5sum = crypto.createHash('md5'),
stream = fs.ReadStream(filename);
stream.on('data', function (data) {
md5sum.update(data);
});
stream.on('end', function () {
var hash = md5sum.digest('hex');
callback(... | javascript | function hashFile(filename, callback) {
var calledBack = false,
md5sum = crypto.createHash('md5'),
stream = fs.ReadStream(filename);
stream.on('data', function (data) {
md5sum.update(data);
});
stream.on('end', function () {
var hash = md5sum.digest('hex');
callback(... | [
"function",
"hashFile",
"(",
"filename",
",",
"callback",
")",
"{",
"var",
"calledBack",
"=",
"false",
",",
"md5sum",
"=",
"crypto",
".",
"createHash",
"(",
"'md5'",
")",
",",
"stream",
"=",
"fs",
".",
"ReadStream",
"(",
"filename",
")",
";",
"stream",
... | Used to MD5 a file, useful when checking against already uploaded assets | [
"Used",
"to",
"MD5",
"a",
"file",
"useful",
"when",
"checking",
"against",
"already",
"uploaded",
"assets"
] | e4f55d379f935b1bb9bc39a9000930073cff1570 | https://github.com/rtgibbons/grunt-cloudfiles/blob/e4f55d379f935b1bb9bc39a9000930073cff1570/tasks/cloudfiles.js#L198-L225 | train |
dapphub/dapple-core | controller.js | function (state, cli) {
var name = cli['<name>'];
var chains = Object.keys(state.state.pointers);
if(chains.indexOf(name) > -1) {
console.log(`Error: Chain ${name} is already known, please choose another name.`);
process.exit();
}
newChain({name}, state, (err, chaindata) => {
i... | javascript | function (state, cli) {
var name = cli['<name>'];
var chains = Object.keys(state.state.pointers);
if(chains.indexOf(name) > -1) {
console.log(`Error: Chain ${name} is already known, please choose another name.`);
process.exit();
}
newChain({name}, state, (err, chaindata) => {
i... | [
"function",
"(",
"state",
",",
"cli",
")",
"{",
"var",
"name",
"=",
"cli",
"[",
"'<name>'",
"]",
";",
"var",
"chains",
"=",
"Object",
".",
"keys",
"(",
"state",
".",
"state",
".",
"pointers",
")",
";",
"if",
"(",
"chains",
".",
"indexOf",
"(",
"n... | Create a new environment | [
"Create",
"a",
"new",
"environment"
] | 4e59dc44b728bc431c1b5b49f32755e796ab496e | https://github.com/dapphub/dapple-core/blob/4e59dc44b728bc431c1b5b49f32755e796ab496e/controller.js#L18-L35 | train | |
vsch/obj-each-break | index.js | hasOwnProperties | function hasOwnProperties(exclude) {
const arg = this;
if (!isObjectLike(arg)) return false;
if (!isValid(exclude)) {
const keys = Object.keys(arg);
return keys.length > 0;
}
return !!eachProp.call(arg, resolveTestFunc(exclude, objectHasNotOwnPropertyBreakTrue, arrayContainsNotKeyBr... | javascript | function hasOwnProperties(exclude) {
const arg = this;
if (!isObjectLike(arg)) return false;
if (!isValid(exclude)) {
const keys = Object.keys(arg);
return keys.length > 0;
}
return !!eachProp.call(arg, resolveTestFunc(exclude, objectHasNotOwnPropertyBreakTrue, arrayContainsNotKeyBr... | [
"function",
"hasOwnProperties",
"(",
"exclude",
")",
"{",
"const",
"arg",
"=",
"this",
";",
"if",
"(",
"!",
"isObjectLike",
"(",
"arg",
")",
")",
"return",
"false",
";",
"if",
"(",
"!",
"isValid",
"(",
"exclude",
")",
")",
"{",
"const",
"keys",
"=",
... | test if this has own properties ie. not empty object, optionally apply exclusion filter to
ignore some properties
@this {*} value to test
@param exclude {*} function, array, object or value containing keys to be excluded
@return {boolean} | [
"test",
"if",
"this",
"has",
"own",
"properties",
"ie",
".",
"not",
"empty",
"object",
"optionally",
"apply",
"exclusion",
"filter",
"to",
"ignore",
"some",
"properties"
] | c23f6573045a9442ae9bb4655a93901de88e5601 | https://github.com/vsch/obj-each-break/blob/c23f6573045a9442ae9bb4655a93901de88e5601/index.js#L159-L168 | train |
vsch/obj-each-break | index.js | objFiltered | function objFiltered(filter, thisArg) {
const dst = isArray(this) ? [] : {};
copyFiltered.call(dst, this, filter, thisArg);
return dst;
} | javascript | function objFiltered(filter, thisArg) {
const dst = isArray(this) ? [] : {};
copyFiltered.call(dst, this, filter, thisArg);
return dst;
} | [
"function",
"objFiltered",
"(",
"filter",
",",
"thisArg",
")",
"{",
"const",
"dst",
"=",
"isArray",
"(",
"this",
")",
"?",
"[",
"]",
":",
"{",
"}",
";",
"copyFiltered",
".",
"call",
"(",
"dst",
",",
"this",
",",
"filter",
",",
"thisArg",
")",
";",
... | filter function applied to objects and array's own properties not just indexed contents
results in object or array
@this array or object
@param filter see copyFiltered
@param thisArg if filter is function then what to use for this
@return {object|array} depending on this passed on call | [
"filter",
"function",
"applied",
"to",
"objects",
"and",
"array",
"s",
"own",
"properties",
"not",
"just",
"indexed",
"contents",
"results",
"in",
"object",
"or",
"array"
] | c23f6573045a9442ae9bb4655a93901de88e5601 | https://github.com/vsch/obj-each-break/blob/c23f6573045a9442ae9bb4655a93901de88e5601/index.js#L509-L513 | train |
vsch/obj-each-break | index.js | objMapped | function objMapped(callback, thisArg = UNDEFINED) {
const dst = isArray(this) ? [] : {};
eachProp.call(this, (value, key, src) => {
const result = callback.call(thisArg, value, key, src);
if (result === BREAK) return BREAK;
if (result !== UNDEFINED) {
dst[key] = result;
... | javascript | function objMapped(callback, thisArg = UNDEFINED) {
const dst = isArray(this) ? [] : {};
eachProp.call(this, (value, key, src) => {
const result = callback.call(thisArg, value, key, src);
if (result === BREAK) return BREAK;
if (result !== UNDEFINED) {
dst[key] = result;
... | [
"function",
"objMapped",
"(",
"callback",
",",
"thisArg",
"=",
"UNDEFINED",
")",
"{",
"const",
"dst",
"=",
"isArray",
"(",
"this",
")",
"?",
"[",
"]",
":",
"{",
"}",
";",
"eachProp",
".",
"call",
"(",
"this",
",",
"(",
"value",
",",
"key",
",",
"... | map function applied to objects and array's own properties not just indexed contents
results in object or array
@this array or object
@param callback function(value,key,collection)
if BREAK returned then breaks out of loop, returned BREAK value ignored
@param thisArg what to use for this for callback
@return {... | [
"map",
"function",
"applied",
"to",
"objects",
"and",
"array",
"s",
"own",
"properties",
"not",
"just",
"indexed",
"contents",
"results",
"in",
"object",
"or",
"array"
] | c23f6573045a9442ae9bb4655a93901de88e5601 | https://github.com/vsch/obj-each-break/blob/c23f6573045a9442ae9bb4655a93901de88e5601/index.js#L548-L558 | train |
vsch/obj-each-break | index.js | objMap | function objMap(callback, thisArg = UNDEFINED) {
const dst = [];
each.call(this, (value, key, src) => {
const result = callback.call(thisArg, value, key, src);
if (result === BREAK) return BREAK;
if (result !== UNDEFINED) {
dst.push(result);
}
});
return dst;
... | javascript | function objMap(callback, thisArg = UNDEFINED) {
const dst = [];
each.call(this, (value, key, src) => {
const result = callback.call(thisArg, value, key, src);
if (result === BREAK) return BREAK;
if (result !== UNDEFINED) {
dst.push(result);
}
});
return dst;
... | [
"function",
"objMap",
"(",
"callback",
",",
"thisArg",
"=",
"UNDEFINED",
")",
"{",
"const",
"dst",
"=",
"[",
"]",
";",
"each",
".",
"call",
"(",
"this",
",",
"(",
"value",
",",
"key",
",",
"src",
")",
"=>",
"{",
"const",
"result",
"=",
"callback",
... | map function applied to objects and array's own properties not just indexed contents
results accumulated in an array
@this array or object
@param callback function taking (value, key, collection) and returning value to accumulate,
undefined is skipped, BREAK will break out of loop, returned BREAK value ignored
... | [
"map",
"function",
"applied",
"to",
"objects",
"and",
"array",
"s",
"own",
"properties",
"not",
"just",
"indexed",
"contents",
"results",
"accumulated",
"in",
"an",
"array"
] | c23f6573045a9442ae9bb4655a93901de88e5601 | https://github.com/vsch/obj-each-break/blob/c23f6573045a9442ae9bb4655a93901de88e5601/index.js#L571-L581 | train |
vsch/obj-each-break | index.js | objSome | function objSome(callback, thisArg = UNDEFINED) {
return !!each.call(this, (value, key, src) => {
BREAK.setDefault(true);
const result = callback.call(thisArg, value, key, src);
if (result === BREAK) return BREAK;
if (result) return BREAK(true);
});
} | javascript | function objSome(callback, thisArg = UNDEFINED) {
return !!each.call(this, (value, key, src) => {
BREAK.setDefault(true);
const result = callback.call(thisArg, value, key, src);
if (result === BREAK) return BREAK;
if (result) return BREAK(true);
});
} | [
"function",
"objSome",
"(",
"callback",
",",
"thisArg",
"=",
"UNDEFINED",
")",
"{",
"return",
"!",
"!",
"each",
".",
"call",
"(",
"this",
",",
"(",
"value",
",",
"key",
",",
"src",
")",
"=>",
"{",
"BREAK",
".",
"setDefault",
"(",
"true",
")",
";",
... | some function applied to objects and array's own properties not just indexed contents
results accumulated in an array
@this array or object
@param callback function taking (value, key, collection) and returning value to test for
truth if BREAK returned then result of function will be true, if BREAK(arg) then re... | [
"some",
"function",
"applied",
"to",
"objects",
"and",
"array",
"s",
"own",
"properties",
"not",
"just",
"indexed",
"contents",
"results",
"accumulated",
"in",
"an",
"array"
] | c23f6573045a9442ae9bb4655a93901de88e5601 | https://github.com/vsch/obj-each-break/blob/c23f6573045a9442ae9bb4655a93901de88e5601/index.js#L595-L602 | train |
vsch/obj-each-break | index.js | objReduceLeft | function objReduceLeft(callback/*, initialValue = UNDEFINED*/) {
const args = Array.prototype.slice.call(arguments, 0);
args.unshift(each);
return objReduceIterated.apply(this, args);
} | javascript | function objReduceLeft(callback/*, initialValue = UNDEFINED*/) {
const args = Array.prototype.slice.call(arguments, 0);
args.unshift(each);
return objReduceIterated.apply(this, args);
} | [
"function",
"objReduceLeft",
"(",
"callback",
"/*, initialValue = UNDEFINED*/",
")",
"{",
"const",
"args",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
",",
"0",
")",
";",
"args",
".",
"unshift",
"(",
"each",
")",
";",
"retu... | reduce function applied to object's and array's own properties not just indexed contents
where order of reduction is left to right, first indexed properties, then ascii sorted
non-indexed properties
@this array or object
@param callback function taking (prevValue, value, key, collection) and returning reduced
v... | [
"reduce",
"function",
"applied",
"to",
"object",
"s",
"and",
"array",
"s",
"own",
"properties",
"not",
"just",
"indexed",
"contents",
"where",
"order",
"of",
"reduction",
"is",
"left",
"to",
"right",
"first",
"indexed",
"properties",
"then",
"ascii",
"sorted",... | c23f6573045a9442ae9bb4655a93901de88e5601 | https://github.com/vsch/obj-each-break/blob/c23f6573045a9442ae9bb4655a93901de88e5601/index.js#L692-L696 | train |
vsch/obj-each-break | index.js | objReduceRight | function objReduceRight(callback/*, initialValue = UNDEFINED*/) {
const args = Array.prototype.slice.call(arguments, 0);
args.unshift(eachRight);
return objReduceIterated.apply(this, args);
} | javascript | function objReduceRight(callback/*, initialValue = UNDEFINED*/) {
const args = Array.prototype.slice.call(arguments, 0);
args.unshift(eachRight);
return objReduceIterated.apply(this, args);
} | [
"function",
"objReduceRight",
"(",
"callback",
"/*, initialValue = UNDEFINED*/",
")",
"{",
"const",
"args",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
",",
"0",
")",
";",
"args",
".",
"unshift",
"(",
"eachRight",
")",
";",
... | reduceRight function applied to object's and array's own properties not just indexed
contents
where order of reduction is right to left, ascii sorted non-indexed properties in reverse
order, then indexed properties in reverse order
@this array or object
@param callback function taking (prevValue, value, key, co... | [
"reduceRight",
"function",
"applied",
"to",
"object",
"s",
"and",
"array",
"s",
"own",
"properties",
"not",
"just",
"indexed",
"contents",
"where",
"order",
"of",
"reduction",
"is",
"right",
"to",
"left",
"ascii",
"sorted",
"non",
"-",
"indexed",
"properties",... | c23f6573045a9442ae9bb4655a93901de88e5601 | https://github.com/vsch/obj-each-break/blob/c23f6573045a9442ae9bb4655a93901de88e5601/index.js#L712-L716 | train |
ofidj/fidj | .todo/miapp.sdk.base.js | encodeParams | function encodeParams(params) {
var queryString;
if (params && Object.keys(params)) {
queryString = [].slice.call(arguments).reduce(function (a, b) {
return a.concat(b instanceof Array ? b : [b]);
}, []).filter(function (c) {
return "object" === typeof c;
}).reduc... | javascript | function encodeParams(params) {
var queryString;
if (params && Object.keys(params)) {
queryString = [].slice.call(arguments).reduce(function (a, b) {
return a.concat(b instanceof Array ? b : [b]);
}, []).filter(function (c) {
return "object" === typeof c;
}).reduc... | [
"function",
"encodeParams",
"(",
"params",
")",
"{",
"var",
"queryString",
";",
"if",
"(",
"params",
"&&",
"Object",
".",
"keys",
"(",
"params",
")",
")",
"{",
"queryString",
"=",
"[",
"]",
".",
"slice",
".",
"call",
"(",
"arguments",
")",
".",
"redu... | method to encode the query string parameters | [
"method",
"to",
"encode",
"the",
"query",
"string",
"parameters"
] | e57ebece54ee68211d43802a8e0feeef098d3e36 | https://github.com/ofidj/fidj/blob/e57ebece54ee68211d43802a8e0feeef098d3e36/.todo/miapp.sdk.base.js#L390-L416 | train |
1stdibs/backbone-base-and-form-view | examples/example-todo-formview.js | function (e) {
var keyCode = e.keyCode || e.which;
// If the user pressed enter
if (keyCode === 13) {
this.addRow();
// Get the last row viewEvents, then get the title field, then have jQuery
... | javascript | function (e) {
var keyCode = e.keyCode || e.which;
// If the user pressed enter
if (keyCode === 13) {
this.addRow();
// Get the last row viewEvents, then get the title field, then have jQuery
... | [
"function",
"(",
"e",
")",
"{",
"var",
"keyCode",
"=",
"e",
".",
"keyCode",
"||",
"e",
".",
"which",
";",
"// If the user pressed enter",
"if",
"(",
"keyCode",
"===",
"13",
")",
"{",
"this",
".",
"addRow",
"(",
")",
";",
"// Get the last row viewEvents, th... | When the user presses enter, add a row | [
"When",
"the",
"user",
"presses",
"enter",
"add",
"a",
"row"
] | 9c49f9ac059ba3177b61f7395151de78b506e8f7 | https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/examples/example-todo-formview.js#L167-L176 | train | |
LeisureLink/magicbus | lib/amqp/queue.js | getAssertQueueOptions | function getAssertQueueOptions() {
const aliases ={
queueLimit: 'maxLength',
deadLetter: 'deadLetterExchange',
deadLetterRoutingKey: 'deadLetterRoutingKey'
};
const itemsToOmit = ['limit', 'noBatch'];
let aliased = _.transform(options, function(result, value, key) {
let alias = ... | javascript | function getAssertQueueOptions() {
const aliases ={
queueLimit: 'maxLength',
deadLetter: 'deadLetterExchange',
deadLetterRoutingKey: 'deadLetterRoutingKey'
};
const itemsToOmit = ['limit', 'noBatch'];
let aliased = _.transform(options, function(result, value, key) {
let alias = ... | [
"function",
"getAssertQueueOptions",
"(",
")",
"{",
"const",
"aliases",
"=",
"{",
"queueLimit",
":",
"'maxLength'",
",",
"deadLetter",
":",
"'deadLetterExchange'",
",",
"deadLetterRoutingKey",
":",
"'deadLetterRoutingKey'",
"}",
";",
"const",
"itemsToOmit",
"=",
"["... | Get options for amqp assertQueue call
@private | [
"Get",
"options",
"for",
"amqp",
"assertQueue",
"call"
] | 0370c38ebb8c7917cfd3894263d734aefc2d3d29 | https://github.com/LeisureLink/magicbus/blob/0370c38ebb8c7917cfd3894263d734aefc2d3d29/lib/amqp/queue.js#L66-L80 | train |
LeisureLink/magicbus | lib/amqp/queue.js | purge | function purge() {
qLog.info(`Purging queue ${channelName} - ${connectionName}`);
return channel.purgeQueue(channelName).then(function(){
qLog.debug(`Successfully purged queue ${channelName} - ${connectionName}`);
});
} | javascript | function purge() {
qLog.info(`Purging queue ${channelName} - ${connectionName}`);
return channel.purgeQueue(channelName).then(function(){
qLog.debug(`Successfully purged queue ${channelName} - ${connectionName}`);
});
} | [
"function",
"purge",
"(",
")",
"{",
"qLog",
".",
"info",
"(",
"`",
"${",
"channelName",
"}",
"${",
"connectionName",
"}",
"`",
")",
";",
"return",
"channel",
".",
"purgeQueue",
"(",
"channelName",
")",
".",
"then",
"(",
"function",
"(",
")",
"{",
"qL... | Purge message queue. Useful for testing
@public | [
"Purge",
"message",
"queue",
".",
"Useful",
"for",
"testing"
] | 0370c38ebb8c7917cfd3894263d734aefc2d3d29 | https://github.com/LeisureLink/magicbus/blob/0370c38ebb8c7917cfd3894263d734aefc2d3d29/lib/amqp/queue.js#L86-L91 | train |
LeisureLink/magicbus | lib/amqp/queue.js | getNoBatchOps | function getNoBatchOps(raw) {
messages.receivedCount += 1;
return {
ack: function() {
qLog.debug(`Acking tag ${raw.fields.deliveryTag} on ${messages.name} - ${messages.connectionName}`);
channel.ack({ fields: { deliveryTag: raw.fields.deliveryTag } }, false);
},
nack: function... | javascript | function getNoBatchOps(raw) {
messages.receivedCount += 1;
return {
ack: function() {
qLog.debug(`Acking tag ${raw.fields.deliveryTag} on ${messages.name} - ${messages.connectionName}`);
channel.ack({ fields: { deliveryTag: raw.fields.deliveryTag } }, false);
},
nack: function... | [
"function",
"getNoBatchOps",
"(",
"raw",
")",
"{",
"messages",
".",
"receivedCount",
"+=",
"1",
";",
"return",
"{",
"ack",
":",
"function",
"(",
")",
"{",
"qLog",
".",
"debug",
"(",
"`",
"${",
"raw",
".",
"fields",
".",
"deliveryTag",
"}",
"${",
"mes... | Get message operations for an unbatched queue
@private | [
"Get",
"message",
"operations",
"for",
"an",
"unbatched",
"queue"
] | 0370c38ebb8c7917cfd3894263d734aefc2d3d29 | https://github.com/LeisureLink/magicbus/blob/0370c38ebb8c7917cfd3894263d734aefc2d3d29/lib/amqp/queue.js#L129-L146 | train |
LeisureLink/magicbus | lib/amqp/queue.js | getResolutionOperations | function getResolutionOperations(raw, consumeOptions) {
if (consumeOptions.noAck) {
return getUntrackedOps(raw);
}
if (consumeOptions.noBatch) {
return getNoBatchOps(raw);
}
return getTrackedOps(raw);
} | javascript | function getResolutionOperations(raw, consumeOptions) {
if (consumeOptions.noAck) {
return getUntrackedOps(raw);
}
if (consumeOptions.noBatch) {
return getNoBatchOps(raw);
}
return getTrackedOps(raw);
} | [
"function",
"getResolutionOperations",
"(",
"raw",
",",
"consumeOptions",
")",
"{",
"if",
"(",
"consumeOptions",
".",
"noAck",
")",
"{",
"return",
"getUntrackedOps",
"(",
"raw",
")",
";",
"}",
"if",
"(",
"consumeOptions",
".",
"noBatch",
")",
"{",
"return",
... | Get message operations
@private | [
"Get",
"message",
"operations"
] | 0370c38ebb8c7917cfd3894263d734aefc2d3d29 | https://github.com/LeisureLink/magicbus/blob/0370c38ebb8c7917cfd3894263d734aefc2d3d29/lib/amqp/queue.js#L152-L162 | train |
LeisureLink/magicbus | lib/amqp/queue.js | subscribe | function subscribe(callback, subscribeOptions) {
let consumeOptions = {};
_.assign(consumeOptions, options, subscribeOptions);
consumeOptions = _.pick(consumeOptions, ['consumerTag', 'noAck', 'noBatch', 'limit', 'exclusive', 'priority', 'arguments']);
let shouldAck = !consumeOptions.noAck;
let shou... | javascript | function subscribe(callback, subscribeOptions) {
let consumeOptions = {};
_.assign(consumeOptions, options, subscribeOptions);
consumeOptions = _.pick(consumeOptions, ['consumerTag', 'noAck', 'noBatch', 'limit', 'exclusive', 'priority', 'arguments']);
let shouldAck = !consumeOptions.noAck;
let shou... | [
"function",
"subscribe",
"(",
"callback",
",",
"subscribeOptions",
")",
"{",
"let",
"consumeOptions",
"=",
"{",
"}",
";",
"_",
".",
"assign",
"(",
"consumeOptions",
",",
"options",
",",
"subscribeOptions",
")",
";",
"consumeOptions",
"=",
"_",
".",
"pick",
... | Subscribe to the queue's messages
@public
@param {Function} callback - the function to call for each message received from queue. Should have signature function (message, operations) where operations contains ack, nack, and reject functions
@param {Object} subscribeOptions - details in consuming from the queue. Overrid... | [
"Subscribe",
"to",
"the",
"queue",
"s",
"messages"
] | 0370c38ebb8c7917cfd3894263d734aefc2d3d29 | https://github.com/LeisureLink/magicbus/blob/0370c38ebb8c7917cfd3894263d734aefc2d3d29/lib/amqp/queue.js#L177-L212 | train |
LeisureLink/magicbus | lib/amqp/queue.js | define | function define() {
let aqOptions = getAssertQueueOptions();
topLog.info(`Declaring queue \'${channelName}\' on connection \'${connectionName}\' with the options: ${JSON.stringify(_.omit(aqOptions, ['name']))}`);
return channel.assertQueue(channelName, aqOptions);
} | javascript | function define() {
let aqOptions = getAssertQueueOptions();
topLog.info(`Declaring queue \'${channelName}\' on connection \'${connectionName}\' with the options: ${JSON.stringify(_.omit(aqOptions, ['name']))}`);
return channel.assertQueue(channelName, aqOptions);
} | [
"function",
"define",
"(",
")",
"{",
"let",
"aqOptions",
"=",
"getAssertQueueOptions",
"(",
")",
";",
"topLog",
".",
"info",
"(",
"`",
"\\'",
"${",
"channelName",
"}",
"\\'",
"\\'",
"${",
"connectionName",
"}",
"\\'",
"${",
"JSON",
".",
"stringify",
"(",... | Define the queue
@public | [
"Define",
"the",
"queue"
] | 0370c38ebb8c7917cfd3894263d734aefc2d3d29 | https://github.com/LeisureLink/magicbus/blob/0370c38ebb8c7917cfd3894263d734aefc2d3d29/lib/amqp/queue.js#L230-L234 | train |
Mammut-FE/nejm | src/util/ajax/platform/message.patch.js | function(_map,_index,_list){
if (_u._$indexOf(_checklist,_map.w)<0){
_checklist.push(_map.w);
_list.splice(_index,1);
_map.w.name = _map.d;
}
} | javascript | function(_map,_index,_list){
if (_u._$indexOf(_checklist,_map.w)<0){
_checklist.push(_map.w);
_list.splice(_index,1);
_map.w.name = _map.d;
}
} | [
"function",
"(",
"_map",
",",
"_index",
",",
"_list",
")",
"{",
"if",
"(",
"_u",
".",
"_$indexOf",
"(",
"_checklist",
",",
"_map",
".",
"w",
")",
"<",
"0",
")",
"{",
"_checklist",
".",
"push",
"(",
"_map",
".",
"w",
")",
";",
"_list",
".",
"spl... | set window.name | [
"set",
"window",
".",
"name"
] | dfc09ac66a8d67620a7aea65e34d8a179976b3fb | https://github.com/Mammut-FE/nejm/blob/dfc09ac66a8d67620a7aea65e34d8a179976b3fb/src/util/ajax/platform/message.patch.js#L63-L69 | train | |
Mammut-FE/nejm | src/util/ajax/platform/message.patch.js | function(_data){
var _result = {};
_data = _data||_o;
_result.origin = _data.origin||'';
_result.ref = location.href;
_result.self = _data.source;
_result.data = JSON.stringify(_data.data);
return _key+_u._$... | javascript | function(_data){
var _result = {};
_data = _data||_o;
_result.origin = _data.origin||'';
_result.ref = location.href;
_result.self = _data.source;
_result.data = JSON.stringify(_data.data);
return _key+_u._$... | [
"function",
"(",
"_data",
")",
"{",
"var",
"_result",
"=",
"{",
"}",
";",
"_data",
"=",
"_data",
"||",
"_o",
";",
"_result",
".",
"origin",
"=",
"_data",
".",
"origin",
"||",
"''",
";",
"_result",
".",
"ref",
"=",
"location",
".",
"href",
";",
"_... | serialize send data | [
"serialize",
"send",
"data"
] | dfc09ac66a8d67620a7aea65e34d8a179976b3fb | https://github.com/Mammut-FE/nejm/blob/dfc09ac66a8d67620a7aea65e34d8a179976b3fb/src/util/ajax/platform/message.patch.js#L84-L92 | train | |
odopod/code-library | packages/odo-on-swipe/dist/odo-on-swipe.js | OnSwipe | function OnSwipe(element, fn) {
var axis = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : OdoPointer.Axis.X;
classCallCheck(this, OnSwipe);
this.fn = fn;
this.pointer = new OdoPointer(element, {
axis: axis
});
this._onEnd = this._handlePointerEnd.bind(... | javascript | function OnSwipe(element, fn) {
var axis = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : OdoPointer.Axis.X;
classCallCheck(this, OnSwipe);
this.fn = fn;
this.pointer = new OdoPointer(element, {
axis: axis
});
this._onEnd = this._handlePointerEnd.bind(... | [
"function",
"OnSwipe",
"(",
"element",
",",
"fn",
")",
"{",
"var",
"axis",
"=",
"arguments",
".",
"length",
">",
"2",
"&&",
"arguments",
"[",
"2",
"]",
"!==",
"undefined",
"?",
"arguments",
"[",
"2",
"]",
":",
"OdoPointer",
".",
"Axis",
".",
"X",
"... | Provides a callback for swipe events.
@param {Element} element Element to watch for swipes.
@param {function(PointerEvent)} fn Callback when swiped.
@param {OdoPointer.Axis} [axis] Optional axis. Defaults to 'x'.
@constructor | [
"Provides",
"a",
"callback",
"for",
"swipe",
"events",
"."
] | ceb47654545ec0b734c8650b3128a6c07504845a | https://github.com/odopod/code-library/blob/ceb47654545ec0b734c8650b3128a6c07504845a/packages/odo-on-swipe/dist/odo-on-swipe.js#L23-L36 | train |
odopod/code-library | docs/odo-on-swipe/scripts/demo.js | swiped | function swiped(event) {
console.log(event);
event.currentTarget.querySelector('span').textContent = 'Swiped ' + event.direction;
} | javascript | function swiped(event) {
console.log(event);
event.currentTarget.querySelector('span').textContent = 'Swiped ' + event.direction;
} | [
"function",
"swiped",
"(",
"event",
")",
"{",
"console",
".",
"log",
"(",
"event",
")",
";",
"event",
".",
"currentTarget",
".",
"querySelector",
"(",
"'span'",
")",
".",
"textContent",
"=",
"'Swiped '",
"+",
"event",
".",
"direction",
";",
"}"
] | On Swipe handler.
@param {PointerEvent} event Pointer event object. | [
"On",
"Swipe",
"handler",
"."
] | ceb47654545ec0b734c8650b3128a6c07504845a | https://github.com/odopod/code-library/blob/ceb47654545ec0b734c8650b3128a6c07504845a/docs/odo-on-swipe/scripts/demo.js#L10-L13 | train |
odopod/code-library | packages/odo-helpers/src/events.js | getTransitionEndEvent | function getTransitionEndEvent() {
const div = document.createElement('div');
div.style.transitionProperty = 'width';
// Test the value which was just set. If it wasn't able to be set,
// then it shouldn't use unprefixed transitions.
/* istanbul ignore next */
if (div.style.transitionProperty !== 'width' &... | javascript | function getTransitionEndEvent() {
const div = document.createElement('div');
div.style.transitionProperty = 'width';
// Test the value which was just set. If it wasn't able to be set,
// then it shouldn't use unprefixed transitions.
/* istanbul ignore next */
if (div.style.transitionProperty !== 'width' &... | [
"function",
"getTransitionEndEvent",
"(",
")",
"{",
"const",
"div",
"=",
"document",
".",
"createElement",
"(",
"'div'",
")",
";",
"div",
".",
"style",
".",
"transitionProperty",
"=",
"'width'",
";",
"// Test the value which was just set. If it wasn't able to be set,",
... | Returns a normalized transition end event name.
Issue with Modernizr prefixing related to stock Android 4.1.2
That version of Android has both unprefixed and prefixed transitions
built in, but will only listen to the prefixed on in certain cases
https://github.com/Modernizr/Modernizr/issues/897
@return {string} A pat... | [
"Returns",
"a",
"normalized",
"transition",
"end",
"event",
"name",
"."
] | ceb47654545ec0b734c8650b3128a6c07504845a | https://github.com/odopod/code-library/blob/ceb47654545ec0b734c8650b3128a6c07504845a/packages/odo-helpers/src/events.js#L28-L44 | train |
vega/vega-transforms | src/Pivot.js | aggregateParams | function aggregateParams(_, pulse) {
var key = _.field,
value = _.value,
op = (_.op === 'count' ? '__count__' : _.op) || 'sum',
fields = accessorFields(key).concat(accessorFields(value)),
keys = pivotKeys(key, _.limit || 0, pulse);
return {
key: _.key,
groupby: _.groupby... | javascript | function aggregateParams(_, pulse) {
var key = _.field,
value = _.value,
op = (_.op === 'count' ? '__count__' : _.op) || 'sum',
fields = accessorFields(key).concat(accessorFields(value)),
keys = pivotKeys(key, _.limit || 0, pulse);
return {
key: _.key,
groupby: _.groupby... | [
"function",
"aggregateParams",
"(",
"_",
",",
"pulse",
")",
"{",
"var",
"key",
"=",
"_",
".",
"field",
",",
"value",
"=",
"_",
".",
"value",
",",
"op",
"=",
"(",
"_",
".",
"op",
"===",
"'count'",
"?",
"'__count__'",
":",
"_",
".",
"op",
")",
"|... | Shoehorn a pivot transform into an aggregate transform! First collect all unique pivot field values. Then generate aggregate fields for each output pivot field. | [
"Shoehorn",
"a",
"pivot",
"transform",
"into",
"an",
"aggregate",
"transform!",
"First",
"collect",
"all",
"unique",
"pivot",
"field",
"values",
".",
"Then",
"generate",
"aggregate",
"fields",
"for",
"each",
"output",
"pivot",
"field",
"."
] | 0f7049cc73ec67630a487aa916119769073d5a87 | https://github.com/vega/vega-transforms/blob/0f7049cc73ec67630a487aa916119769073d5a87/src/Pivot.js#L49-L64 | train |
vega/vega-transforms | src/Pivot.js | get | function get(k, key, value, fields) {
return accessor(
function(d) { return key(d) === k ? value(d) : NaN; },
fields,
k + ''
);
} | javascript | function get(k, key, value, fields) {
return accessor(
function(d) { return key(d) === k ? value(d) : NaN; },
fields,
k + ''
);
} | [
"function",
"get",
"(",
"k",
",",
"key",
",",
"value",
",",
"fields",
")",
"{",
"return",
"accessor",
"(",
"function",
"(",
"d",
")",
"{",
"return",
"key",
"(",
"d",
")",
"===",
"k",
"?",
"value",
"(",
"d",
")",
":",
"NaN",
";",
"}",
",",
"fi... | Generate aggregate field accessor. Output NaN for non-existent values; aggregator will ignore! | [
"Generate",
"aggregate",
"field",
"accessor",
".",
"Output",
"NaN",
"for",
"non",
"-",
"existent",
"values",
";",
"aggregator",
"will",
"ignore!"
] | 0f7049cc73ec67630a487aa916119769073d5a87 | https://github.com/vega/vega-transforms/blob/0f7049cc73ec67630a487aa916119769073d5a87/src/Pivot.js#L68-L74 | train |
odopod/code-library | packages/odo-viewport/dist/odo-viewport.js | ViewportItem | function ViewportItem(options, parent) {
classCallCheck(this, ViewportItem);
this.parent = parent;
this.id = Math.random().toString(36).substring(7);
this.triggered = false;
this.threshold = 200;
this.isThresholdPercentage = false;
// Override defaults with options.
Obj... | javascript | function ViewportItem(options, parent) {
classCallCheck(this, ViewportItem);
this.parent = parent;
this.id = Math.random().toString(36).substring(7);
this.triggered = false;
this.threshold = 200;
this.isThresholdPercentage = false;
// Override defaults with options.
Obj... | [
"function",
"ViewportItem",
"(",
"options",
",",
"parent",
")",
"{",
"classCallCheck",
"(",
"this",
",",
"ViewportItem",
")",
";",
"this",
".",
"parent",
"=",
"parent",
";",
"this",
".",
"id",
"=",
"Math",
".",
"random",
"(",
")",
".",
"toString",
"(",... | A viewport item represents an element being watched by the Viewport component.
@param {Object} options Viewport item options.
@param {Viewport} parent A reference to the viewport.
@constructor | [
"A",
"viewport",
"item",
"represents",
"an",
"element",
"being",
"watched",
"by",
"the",
"Viewport",
"component",
"."
] | ceb47654545ec0b734c8650b3128a6c07504845a | https://github.com/odopod/code-library/blob/ceb47654545ec0b734c8650b3128a6c07504845a/packages/odo-viewport/dist/odo-viewport.js#L40-L63 | train |
odopod/code-library | packages/odo-viewport/dist/odo-viewport.js | Viewport | function Viewport() {
classCallCheck(this, Viewport);
this.addId = null;
this.hasActiveHandlers = false;
this.items = new Map();
// Assume there is no horizontal scrollbar. documentElement.clientHeight
// is incorrect on iOS 8 because it includes toolbars.
this.viewportHeight... | javascript | function Viewport() {
classCallCheck(this, Viewport);
this.addId = null;
this.hasActiveHandlers = false;
this.items = new Map();
// Assume there is no horizontal scrollbar. documentElement.clientHeight
// is incorrect on iOS 8 because it includes toolbars.
this.viewportHeight... | [
"function",
"Viewport",
"(",
")",
"{",
"classCallCheck",
"(",
"this",
",",
"Viewport",
")",
";",
"this",
".",
"addId",
"=",
"null",
";",
"this",
".",
"hasActiveHandlers",
"=",
"false",
";",
"this",
".",
"items",
"=",
"new",
"Map",
"(",
")",
";",
"// ... | Viewport singleton.
@constructor | [
"Viewport",
"singleton",
"."
] | ceb47654545ec0b734c8650b3128a6c07504845a | https://github.com/odopod/code-library/blob/ceb47654545ec0b734c8650b3128a6c07504845a/packages/odo-viewport/dist/odo-viewport.js#L132-L149 | train |
popomore/ypkgfiles | index.js | resolveEntry | function resolveEntry(options) {
const cwd = options.cwd;
const pkg = options.pkg;
let entries = [];
if (is.array(options.entry)) entries = options.entry;
if (is.string(options.entry)) entries.push(options.entry);
const result = new Set();
try {
// set the entry that module exports
result.add(re... | javascript | function resolveEntry(options) {
const cwd = options.cwd;
const pkg = options.pkg;
let entries = [];
if (is.array(options.entry)) entries = options.entry;
if (is.string(options.entry)) entries.push(options.entry);
const result = new Set();
try {
// set the entry that module exports
result.add(re... | [
"function",
"resolveEntry",
"(",
"options",
")",
"{",
"const",
"cwd",
"=",
"options",
".",
"cwd",
";",
"const",
"pkg",
"=",
"options",
".",
"pkg",
";",
"let",
"entries",
"=",
"[",
"]",
";",
"if",
"(",
"is",
".",
"array",
"(",
"options",
".",
"entry... | return entries with fullpath based on options.entry | [
"return",
"entries",
"with",
"fullpath",
"based",
"on",
"options",
".",
"entry"
] | f99f76089e6a30318be8013fc21dfa9838016d29 | https://github.com/popomore/ypkgfiles/blob/f99f76089e6a30318be8013fc21dfa9838016d29/index.js#L53-L94 | train |
lmalave/aframe-speech-command-component | examples/components/set-image.js | function () {
var data = this.data;
var targetEl = this.data.target;
// Only set up once.
if (targetEl.dataset.setImageFadeSetup) { return; }
targetEl.dataset.setImageFadeSetup = true;
// Create animation.
targetEl.setAttribute('animation__fade', {
p... | javascript | function () {
var data = this.data;
var targetEl = this.data.target;
// Only set up once.
if (targetEl.dataset.setImageFadeSetup) { return; }
targetEl.dataset.setImageFadeSetup = true;
// Create animation.
targetEl.setAttribute('animation__fade', {
p... | [
"function",
"(",
")",
"{",
"var",
"data",
"=",
"this",
".",
"data",
";",
"var",
"targetEl",
"=",
"this",
".",
"data",
".",
"target",
";",
"// Only set up once.",
"if",
"(",
"targetEl",
".",
"dataset",
".",
"setImageFadeSetup",
")",
"{",
"return",
";",
... | Setup fade-in + fade-out. | [
"Setup",
"fade",
"-",
"in",
"+",
"fade",
"-",
"out",
"."
] | 5859588e54649c585c74b2cdc41c13a28cbb89c1 | https://github.com/lmalave/aframe-speech-command-component/blob/5859588e54649c585c74b2cdc41c13a28cbb89c1/examples/components/set-image.js#L35-L52 | train | |
dominictarr/map-filter-reduce | make.js | arrayGroup | function arrayGroup (set, get, reduce) {
//we can use a different lookup path on the right hand object
//is always the "needle"
function _compare (hay, needle) {
for(var i in set) {
var x = u.get(hay, set[i]), y = needle[i]
if(x !== y) return compare(x, y)
}
return 0
}
return functio... | javascript | function arrayGroup (set, get, reduce) {
//we can use a different lookup path on the right hand object
//is always the "needle"
function _compare (hay, needle) {
for(var i in set) {
var x = u.get(hay, set[i]), y = needle[i]
if(x !== y) return compare(x, y)
}
return 0
}
return functio... | [
"function",
"arrayGroup",
"(",
"set",
",",
"get",
",",
"reduce",
")",
"{",
"//we can use a different lookup path on the right hand object",
"//is always the \"needle\"",
"function",
"_compare",
"(",
"hay",
",",
"needle",
")",
"{",
"for",
"(",
"var",
"i",
"in",
"set"... | rawpaths, reducedpaths, reduce | [
"rawpaths",
"reducedpaths",
"reduce"
] | 2f94c186a812066c3d52612887189ac552bd386d | https://github.com/dominictarr/map-filter-reduce/blob/2f94c186a812066c3d52612887189ac552bd386d/make.js#L95-L117 | train |
dominictarr/map-filter-reduce | make.js | _compare | function _compare (hay, needle) {
for(var i in set) {
var x = u.get(hay, set[i]), y = needle[i]
if(x !== y) return compare(x, y)
}
return 0
} | javascript | function _compare (hay, needle) {
for(var i in set) {
var x = u.get(hay, set[i]), y = needle[i]
if(x !== y) return compare(x, y)
}
return 0
} | [
"function",
"_compare",
"(",
"hay",
",",
"needle",
")",
"{",
"for",
"(",
"var",
"i",
"in",
"set",
")",
"{",
"var",
"x",
"=",
"u",
".",
"get",
"(",
"hay",
",",
"set",
"[",
"i",
"]",
")",
",",
"y",
"=",
"needle",
"[",
"i",
"]",
"if",
"(",
"... | we can use a different lookup path on the right hand object is always the "needle" | [
"we",
"can",
"use",
"a",
"different",
"lookup",
"path",
"on",
"the",
"right",
"hand",
"object",
"is",
"always",
"the",
"needle"
] | 2f94c186a812066c3d52612887189ac552bd386d | https://github.com/dominictarr/map-filter-reduce/blob/2f94c186a812066c3d52612887189ac552bd386d/make.js#L99-L105 | train |
odopod/code-library | packages/odo-helpers/src/even-heights.js | getTallest | function getTallest(elements) {
let tallest = 0;
for (let i = elements.length - 1; i >= 0; i--) {
if (elements[i].offsetHeight > tallest) {
tallest = elements[i].offsetHeight;
}
}
return tallest;
} | javascript | function getTallest(elements) {
let tallest = 0;
for (let i = elements.length - 1; i >= 0; i--) {
if (elements[i].offsetHeight > tallest) {
tallest = elements[i].offsetHeight;
}
}
return tallest;
} | [
"function",
"getTallest",
"(",
"elements",
")",
"{",
"let",
"tallest",
"=",
"0",
";",
"for",
"(",
"let",
"i",
"=",
"elements",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"if",
"(",
"elements",
"[",
"i",
"]",
".",
... | Determine which element in an array is the tallest.
@param {ArrayLike<HTMLElement>} elements Array-like of elements.
@return {number} Height of the tallest element. | [
"Determine",
"which",
"element",
"in",
"an",
"array",
"is",
"the",
"tallest",
"."
] | ceb47654545ec0b734c8650b3128a6c07504845a | https://github.com/odopod/code-library/blob/ceb47654545ec0b734c8650b3128a6c07504845a/packages/odo-helpers/src/even-heights.js#L6-L16 | train |
Subsets and Splits
SQL Console for semeru/code-text-javascript
Retrieves 20,000 non-null code samples labeled as JavaScript, providing a basic overview of the dataset.