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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
eclipse/orion.client | bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js | function(start, end, line, offset, len) {
// We use typeof because we need to distinguish the number 0 from an undefined or null parameter
if (typeof(start) === "number") { //$NON-NLS-0$
if (typeof(end) !== "number") { //$NON-NLS-0$
end = start;
}
this.moveSelection(start, end);
return true;
... | javascript | function(start, end, line, offset, len) {
// We use typeof because we need to distinguish the number 0 from an undefined or null parameter
if (typeof(start) === "number") { //$NON-NLS-0$
if (typeof(end) !== "number") { //$NON-NLS-0$
end = start;
}
this.moveSelection(start, end);
return true;
... | [
"function",
"(",
"start",
",",
"end",
",",
"line",
",",
"offset",
",",
"len",
")",
"{",
"// We use typeof because we need to distinguish the number 0 from an undefined or null parameter",
"if",
"(",
"typeof",
"(",
"start",
")",
"===",
"\"number\"",
")",
"{",
"//$NON-N... | Reveals and selects a portion of text.
@param {Number} start
@param {Number} end
@param {Number} line
@param {Number} offset
@param {Number} length | [
"Reveals",
"and",
"selects",
"a",
"portion",
"of",
"text",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js#L1500-L1521 | train | |
eclipse/orion.client | bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js | function(line, column, end, callback) {
if (this._textView) {
var model = this.getModel();
line = Math.max(0, Math.min(line, model.getLineCount() - 1));
var lineStart = model.getLineStart(line);
var start = 0;
if (end === undefined) {
end = 0;
}
if (typeof column === "string") { //$N... | javascript | function(line, column, end, callback) {
if (this._textView) {
var model = this.getModel();
line = Math.max(0, Math.min(line, model.getLineCount() - 1));
var lineStart = model.getLineStart(line);
var start = 0;
if (end === undefined) {
end = 0;
}
if (typeof column === "string") { //$N... | [
"function",
"(",
"line",
",",
"column",
",",
"end",
",",
"callback",
")",
"{",
"if",
"(",
"this",
".",
"_textView",
")",
"{",
"var",
"model",
"=",
"this",
".",
"getModel",
"(",
")",
";",
"line",
"=",
"Math",
".",
"max",
"(",
"0",
",",
"Math",
"... | Reveals a line in the editor, and optionally selects a portion of the line.
@param {Number} line - document base line index
@param {Number|String} column
@param {Number} [end] | [
"Reveals",
"a",
"line",
"in",
"the",
"editor",
"and",
"optionally",
"selects",
"a",
"portion",
"of",
"the",
"line",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js#L1564-L1587 | train | |
eclipse/orion.client | bundles/org.eclipse.orion.client.ui/web/orion/globalCommands.js | generateUserInfo | function generateUserInfo(serviceRegistry, keyAssistFunction, prefsService) {
prefsService.get("/userMenu").then(function(prefs) {
if (Boolean(prefs) && prefs.disabled === true) {
var menu = lib.node("userMenu");
if (Boolean(menu)) {
menu.parentElement.removeChild(menu);
}
return;
}
var ... | javascript | function generateUserInfo(serviceRegistry, keyAssistFunction, prefsService) {
prefsService.get("/userMenu").then(function(prefs) {
if (Boolean(prefs) && prefs.disabled === true) {
var menu = lib.node("userMenu");
if (Boolean(menu)) {
menu.parentElement.removeChild(menu);
}
return;
}
var ... | [
"function",
"generateUserInfo",
"(",
"serviceRegistry",
",",
"keyAssistFunction",
",",
"prefsService",
")",
"{",
"prefsService",
".",
"get",
"(",
"\"/userMenu\"",
")",
".",
"then",
"(",
"function",
"(",
"prefs",
")",
"{",
"if",
"(",
"Boolean",
"(",
"prefs",
... | Adds the user-related commands to the toolbar
@name orion.globalCommands#generateUserInfo
@function | [
"Adds",
"the",
"user",
"-",
"related",
"commands",
"to",
"the",
"toolbar"
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/globalCommands.js#L135-L179 | train |
eclipse/orion.client | bundles/org.eclipse.orion.client.ui/web/orion/globalCommands.js | setInvocation | function setInvocation(commandItem) {
var command = commandItem.command;
if (!command.visibleWhen || command.visibleWhen(item)) {
commandItem.invocation = new mCommands.CommandInvocation(item, item, null, command, commandRegistry);
return new Deferred().resolve(commandItem);
} else if (typeof alternate... | javascript | function setInvocation(commandItem) {
var command = commandItem.command;
if (!command.visibleWhen || command.visibleWhen(item)) {
commandItem.invocation = new mCommands.CommandInvocation(item, item, null, command, commandRegistry);
return new Deferred().resolve(commandItem);
} else if (typeof alternate... | [
"function",
"setInvocation",
"(",
"commandItem",
")",
"{",
"var",
"command",
"=",
"commandItem",
".",
"command",
";",
"if",
"(",
"!",
"command",
".",
"visibleWhen",
"||",
"command",
".",
"visibleWhen",
"(",
"item",
")",
")",
"{",
"commandItem",
".",
"invoc... | Creates a CommandInvocation for given commandItem.
@returns {orion.Promise} A promise resolving to: commandItem with its "invocation" field set, or undefined if we failed | [
"Creates",
"a",
"CommandInvocation",
"for",
"given",
"commandItem",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/globalCommands.js#L234-L254 | train |
eclipse/orion.client | bundles/org.eclipse.orion.client.editor/web/orion/editor/vi.js | StatusLineMode | function StatusLineMode(viMode) {
var view = viMode.getView();
this.viMode = viMode;
mKeyMode.KeyMode.call(this, view);
this._createActions(view);
} | javascript | function StatusLineMode(viMode) {
var view = viMode.getView();
this.viMode = viMode;
mKeyMode.KeyMode.call(this, view);
this._createActions(view);
} | [
"function",
"StatusLineMode",
"(",
"viMode",
")",
"{",
"var",
"view",
"=",
"viMode",
".",
"getView",
"(",
")",
";",
"this",
".",
"viMode",
"=",
"viMode",
";",
"mKeyMode",
".",
"KeyMode",
".",
"call",
"(",
"this",
",",
"view",
")",
";",
"this",
".",
... | Status Line Mode | [
"Status",
"Line",
"Mode"
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/vi.js#L482-L487 | train |
eclipse/orion.client | bundles/org.eclipse.orion.client.ui/web/plugins/samples/largeFileSearch/i18n.js | addPart | function addPart(locale, master, needed, toLoad, prefix, suffix) {
if (master[locale]) {
needed.push(locale);
if (master[locale] === true || master[locale] === 1) {
toLoad.push(prefix + locale + '/' + suffix);
}
}
} | javascript | function addPart(locale, master, needed, toLoad, prefix, suffix) {
if (master[locale]) {
needed.push(locale);
if (master[locale] === true || master[locale] === 1) {
toLoad.push(prefix + locale + '/' + suffix);
}
}
} | [
"function",
"addPart",
"(",
"locale",
",",
"master",
",",
"needed",
",",
"toLoad",
",",
"prefix",
",",
"suffix",
")",
"{",
"if",
"(",
"master",
"[",
"locale",
"]",
")",
"{",
"needed",
".",
"push",
"(",
"locale",
")",
";",
"if",
"(",
"master",
"[",
... | Helper function to avoid repeating code. Lots of arguments in the desire to stay functional and support RequireJS contexts without having to know about the RequireJS contexts. | [
"Helper",
"function",
"to",
"avoid",
"repeating",
"code",
".",
"Lots",
"of",
"arguments",
"in",
"the",
"desire",
"to",
"stay",
"functional",
"and",
"support",
"RequireJS",
"contexts",
"without",
"having",
"to",
"know",
"about",
"the",
"RequireJS",
"contexts",
... | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/plugins/samples/largeFileSearch/i18n.js#L51-L58 | train |
eclipse/orion.client | bundles/org.eclipse.orion.client.ui/web/gcli/util/l10n.js | getPluralRule | function getPluralRule() {
if (!pluralRule) {
var lang = navigator.language || navigator.userLanguage;
// Convert lang to a rule index
pluralRules.some(function(rule) {
if (rule.locales.indexOf(lang) !== -1) {
pluralRule = rule;
return true;
}
return false;
});
/... | javascript | function getPluralRule() {
if (!pluralRule) {
var lang = navigator.language || navigator.userLanguage;
// Convert lang to a rule index
pluralRules.some(function(rule) {
if (rule.locales.indexOf(lang) !== -1) {
pluralRule = rule;
return true;
}
return false;
});
/... | [
"function",
"getPluralRule",
"(",
")",
"{",
"if",
"(",
"!",
"pluralRule",
")",
"{",
"var",
"lang",
"=",
"navigator",
".",
"language",
"||",
"navigator",
".",
"userLanguage",
";",
"// Convert lang to a rule index",
"pluralRules",
".",
"some",
"(",
"function",
"... | Find the correct plural rule for the current locale
@return a plural rule with a 'get()' function | [
"Find",
"the",
"correct",
"plural",
"rule",
"for",
"the",
"current",
"locale"
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/gcli/util/l10n.js#L281-L301 | train |
eclipse/orion.client | bundles/org.eclipse.orion.client.ui/web/orion/explorers/navigationUtils.js | removeNavGrid | function removeNavGrid(domNodeWrapperList, domNode) {
if(!domNodeWrapperList){
return;
}
for(var i = 0; i < domNodeWrapperList.length ; i++){
if(domNodeWrapperList[i].domNode === domNode){
domNodeWrapperList.splice(i, 1);
return;
}
}
} | javascript | function removeNavGrid(domNodeWrapperList, domNode) {
if(!domNodeWrapperList){
return;
}
for(var i = 0; i < domNodeWrapperList.length ; i++){
if(domNodeWrapperList[i].domNode === domNode){
domNodeWrapperList.splice(i, 1);
return;
}
}
} | [
"function",
"removeNavGrid",
"(",
"domNodeWrapperList",
",",
"domNode",
")",
"{",
"if",
"(",
"!",
"domNodeWrapperList",
")",
"{",
"return",
";",
"}",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"domNodeWrapperList",
".",
"length",
";",
"i",
"++",
... | Remove a grid navigation item from a given array. A grid navigation item is presented by a wrapper object wrapping the domNode, widget and onClick properties.
@param {Array} domNodeWrapperList the array that holds the grid navigation item. Normally the .gridChildren property from a row model.
@param {DomNode} domNode ... | [
"Remove",
"a",
"grid",
"navigation",
"item",
"from",
"a",
"given",
"array",
".",
"A",
"grid",
"navigation",
"item",
"is",
"presented",
"by",
"a",
"wrapper",
"object",
"wrapping",
"the",
"domNode",
"widget",
"and",
"onClick",
"properties",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/explorers/navigationUtils.js#L65-L76 | train |
eclipse/orion.client | bundles/org.eclipse.orion.client.core/web/orion/projectClient.js | ProjectClient | function ProjectClient(serviceRegistry, fileClient) {
this.serviceRegistry = serviceRegistry;
this.fileClient = fileClient;
this.allProjectHandlersReferences = serviceRegistry.getServiceReferences("orion.project.handler"); //$NON-NLS-0$
this.allProjectDeployReferences = serviceRegistry.getServiceReferences("ori... | javascript | function ProjectClient(serviceRegistry, fileClient) {
this.serviceRegistry = serviceRegistry;
this.fileClient = fileClient;
this.allProjectHandlersReferences = serviceRegistry.getServiceReferences("orion.project.handler"); //$NON-NLS-0$
this.allProjectDeployReferences = serviceRegistry.getServiceReferences("ori... | [
"function",
"ProjectClient",
"(",
"serviceRegistry",
",",
"fileClient",
")",
"{",
"this",
".",
"serviceRegistry",
"=",
"serviceRegistry",
";",
"this",
".",
"fileClient",
"=",
"fileClient",
";",
"this",
".",
"allProjectHandlersReferences",
"=",
"serviceRegistry",
"."... | Creates a new project client.
@class Project client provides client-side API to handle projects based on given file client.
@name orion.projectClient.ProjectClient | [
"Creates",
"a",
"new",
"project",
"client",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.core/web/orion/projectClient.js#L43-L50 | train |
eclipse/orion.client | bundles/org.eclipse.orion.client.ui/web/orion/widgets/themes/ThemeImporter.js | xmlToJson | function xmlToJson(xml) {
// Create the return object
var obj = {};
if (xml.nodeType === 1) { // element
// do attributes
if (xml.attributes.length > 0) {
for (var j = 0; j < xml.attributes.length; j++) {
... | javascript | function xmlToJson(xml) {
// Create the return object
var obj = {};
if (xml.nodeType === 1) { // element
// do attributes
if (xml.attributes.length > 0) {
for (var j = 0; j < xml.attributes.length; j++) {
... | [
"function",
"xmlToJson",
"(",
"xml",
")",
"{",
"// Create the return object\r",
"var",
"obj",
"=",
"{",
"}",
";",
"if",
"(",
"xml",
".",
"nodeType",
"===",
"1",
")",
"{",
"// element\r",
"// do attributes\r",
"if",
"(",
"xml",
".",
"attributes",
".",
"leng... | Changes XML to JSON | [
"Changes",
"XML",
"to",
"JSON"
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/widgets/themes/ThemeImporter.js#L59-L95 | train |
eclipse/orion.client | bundles/org.eclipse.orion.client.ui/web/orion/widgets/projects/RunBar.js | RunBar | function RunBar(options) {
this._project = null;
this._parentNode = options.parentNode;
this._serviceRegistry = options.serviceRegistry;
this._commandRegistry = options.commandRegistry;
this._fileClient = options.fileClient;
this._progressService = options.progressService;
this._preferencesService = optio... | javascript | function RunBar(options) {
this._project = null;
this._parentNode = options.parentNode;
this._serviceRegistry = options.serviceRegistry;
this._commandRegistry = options.commandRegistry;
this._fileClient = options.fileClient;
this._progressService = options.progressService;
this._preferencesService = optio... | [
"function",
"RunBar",
"(",
"options",
")",
"{",
"this",
".",
"_project",
"=",
"null",
";",
"this",
".",
"_parentNode",
"=",
"options",
".",
"parentNode",
";",
"this",
".",
"_serviceRegistry",
"=",
"options",
".",
"serviceRegistry",
";",
"this",
".",
"_comm... | Creates a new RunBar.
@class RunBar
@name orion.projects.RunBar
@param options
@param options.parentNode
@param options.serviceRegistry
@param options.commandRegistry
@param options.fileClient
@param options.progressService
@param options.preferencesService
@param options.statusService
@param options.actionScopeId
@par... | [
"Creates",
"a",
"new",
"RunBar",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/widgets/projects/RunBar.js#L46-L65 | train |
eclipse/orion.client | bundles/org.eclipse.orion.client.ui/web/orion/widgets/projects/RunBar.js | function(launchConfiguration, checkStatus) {
var errorHandler = function (error) {
// stop the progress spinner in the launch config dropdown trigger
this.setStatus({
error: error || true //if no error was passed in we still want to ensure that the error state is recorded
});
}.bind(this);
... | javascript | function(launchConfiguration, checkStatus) {
var errorHandler = function (error) {
// stop the progress spinner in the launch config dropdown trigger
this.setStatus({
error: error || true //if no error was passed in we still want to ensure that the error state is recorded
});
}.bind(this);
... | [
"function",
"(",
"launchConfiguration",
",",
"checkStatus",
")",
"{",
"var",
"errorHandler",
"=",
"function",
"(",
"error",
")",
"{",
"// stop the progress spinner in the launch config dropdown trigger",
"this",
".",
"setStatus",
"(",
"{",
"error",
":",
"error",
"||",... | Selects the specified launch configuration
@param {Object} launchConfiguration The launch configuration to select
@param {Boolean} checkStatus Specifies whether or not the status of the launchConfiguration should be checked | [
"Selects",
"the",
"specified",
"launch",
"configuration"
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/widgets/projects/RunBar.js#L401-L436 | train | |
eclipse/orion.client | bundles/org.eclipse.orion.client.ui/web/orion/widgets/projects/RunBar.js | function (project) {
if (project) {
this._projectClient.getProjectLaunchConfigurations(project).then(function(launchConfigurations){
if (project !== this._project) return;
this._setLaunchConfigurations(launchConfigurations);
}.bind(this));
} else {
this._setLaunchConfigurations(null);
}
... | javascript | function (project) {
if (project) {
this._projectClient.getProjectLaunchConfigurations(project).then(function(launchConfigurations){
if (project !== this._project) return;
this._setLaunchConfigurations(launchConfigurations);
}.bind(this));
} else {
this._setLaunchConfigurations(null);
}
... | [
"function",
"(",
"project",
")",
"{",
"if",
"(",
"project",
")",
"{",
"this",
".",
"_projectClient",
".",
"getProjectLaunchConfigurations",
"(",
"project",
")",
".",
"then",
"(",
"function",
"(",
"launchConfigurations",
")",
"{",
"if",
"(",
"project",
"!==",... | Get launch configurations from the specified project and load them into this run bar.
@param[in] {Object} project The project from which to load the launch configurations | [
"Get",
"launch",
"configurations",
"from",
"the",
"specified",
"project",
"and",
"load",
"them",
"into",
"this",
"run",
"bar",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/widgets/projects/RunBar.js#L656-L665 | train | |
eclipse/orion.client | bundles/org.eclipse.orion.client.ui/web/orion/widgets/projects/RunBar.js | function(launchConfigurations) {
if (launchConfigurations) {
this._enableLaunchConfigurationsDropdown();
launchConfigurations.sort(function(launchConf1, launchConf2) {
return launchConf1.Name.localeCompare(launchConf2.Name);
});
} else {
this._disableLaunchConfigurationsDropdown();
}
... | javascript | function(launchConfigurations) {
if (launchConfigurations) {
this._enableLaunchConfigurationsDropdown();
launchConfigurations.sort(function(launchConf1, launchConf2) {
return launchConf1.Name.localeCompare(launchConf2.Name);
});
} else {
this._disableLaunchConfigurationsDropdown();
}
... | [
"function",
"(",
"launchConfigurations",
")",
"{",
"if",
"(",
"launchConfigurations",
")",
"{",
"this",
".",
"_enableLaunchConfigurationsDropdown",
"(",
")",
";",
"launchConfigurations",
".",
"sort",
"(",
"function",
"(",
"launchConf1",
",",
"launchConf2",
")",
"{... | Sets the list of launch configurations to be used by this run bar.
This method may be called more than once. Any previously cached
launch configurations will be replaced with the newly specified ones.
@param {Array} launchConfigurations An array of launch configurations | [
"Sets",
"the",
"list",
"of",
"launch",
"configurations",
"to",
"be",
"used",
"by",
"this",
"run",
"bar",
".",
"This",
"method",
"may",
"be",
"called",
"more",
"than",
"once",
".",
"Any",
"previously",
"cached",
"launch",
"configurations",
"will",
"be",
"re... | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/widgets/projects/RunBar.js#L674-L694 | train | |
eclipse/orion.client | bundles/org.eclipse.orion.client.ui/web/orion/widgets/projects/RunBar.js | function(command, evnt) {
var buttonNode = evnt.target;
var id = buttonNode.id;
var isEnabled = this._isEnabled(buttonNode);
var disabled = isEnabled ? "" : ".disabled"; //$NON-NLS-1$ //$NON-NLS-0$
mMetrics.logEvent("ui", "invoke", METRICS_LABEL_PREFIX + "." + id +".clicked" + disabled, evnt.which); ... | javascript | function(command, evnt) {
var buttonNode = evnt.target;
var id = buttonNode.id;
var isEnabled = this._isEnabled(buttonNode);
var disabled = isEnabled ? "" : ".disabled"; //$NON-NLS-1$ //$NON-NLS-0$
mMetrics.logEvent("ui", "invoke", METRICS_LABEL_PREFIX + "." + id +".clicked" + disabled, evnt.which); ... | [
"function",
"(",
"command",
",",
"evnt",
")",
"{",
"var",
"buttonNode",
"=",
"evnt",
".",
"target",
";",
"var",
"id",
"=",
"buttonNode",
".",
"id",
";",
"var",
"isEnabled",
"=",
"this",
".",
"_isEnabled",
"(",
"buttonNode",
")",
";",
"var",
"disabled",... | Implements a generic button listener which executes the specified
command when it is invoked and collects metrics
@param[in] {String | Function} command A String containing the id of the command to run or a Function to call
@param[in] {Event} event The event which triggered the listener | [
"Implements",
"a",
"generic",
"button",
"listener",
"which",
"executes",
"the",
"specified",
"command",
"when",
"it",
"is",
"invoked",
"and",
"collects",
"metrics"
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/widgets/projects/RunBar.js#L734-L749 | train | |
eclipse/orion.client | bundles/org.eclipse.orion.client.javascript/web/javascript/hover.js | _getNodeText | function _getNodeText(node) {
return node.sourceFile.text.substr(node.start, node.end - node.start);
} | javascript | function _getNodeText(node) {
return node.sourceFile.text.substr(node.start, node.end - node.start);
} | [
"function",
"_getNodeText",
"(",
"node",
")",
"{",
"return",
"node",
".",
"sourceFile",
".",
"text",
".",
"substr",
"(",
"node",
".",
"start",
",",
"node",
".",
"end",
"-",
"node",
".",
"start",
")",
";",
"}"
] | Get the plain text of a node.
@param {Node} node
@return {string} | [
"Get",
"the",
"plain",
"text",
"of",
"a",
"node",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/javascript/hover.js#L460-L462 | train |
eclipse/orion.client | bundles/org.eclipse.orion.client.ui/web/orion/sites/siteMappingsTable.js | function(item, fieldName) {
if (fieldName === "FriendlyPath") { //$NON-NLS-0$
// Just update the "is valid" column
var rowNode = document.getElementById(this.myTree._treeModel.getId(item));
var oldCell = lib.$(".isValidCell", rowNode); //$NON-NLS-0$
var col_no = lib.$$array("td", rowNode).indexOf(old... | javascript | function(item, fieldName) {
if (fieldName === "FriendlyPath") { //$NON-NLS-0$
// Just update the "is valid" column
var rowNode = document.getElementById(this.myTree._treeModel.getId(item));
var oldCell = lib.$(".isValidCell", rowNode); //$NON-NLS-0$
var col_no = lib.$$array("td", rowNode).indexOf(old... | [
"function",
"(",
"item",
",",
"fieldName",
")",
"{",
"if",
"(",
"fieldName",
"===",
"\"FriendlyPath\"",
")",
"{",
"//$NON-NLS-0$",
"// Just update the \"is valid\" column",
"var",
"rowNode",
"=",
"document",
".",
"getElementById",
"(",
"this",
".",
"myTree",
".",
... | Render the row of a single item, without rendering its siblings. | [
"Render",
"the",
"row",
"of",
"a",
"single",
"item",
"without",
"rendering",
"its",
"siblings",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/sites/siteMappingsTable.js#L231-L241 | train | |
eclipse/orion.client | bundles/org.eclipse.orion.client.ui/web/gcli/gcli/ui/inputter.js | Inputter | function Inputter(options, components) {
this.requisition = components.requisition;
this.focusManager = components.focusManager;
this.element = components.element;
this.element.classList.add('gcli-in-input');
this.element.spellcheck = false;
this.document = this.element.ownerDocument;
this.scratchpad =... | javascript | function Inputter(options, components) {
this.requisition = components.requisition;
this.focusManager = components.focusManager;
this.element = components.element;
this.element.classList.add('gcli-in-input');
this.element.spellcheck = false;
this.document = this.element.ownerDocument;
this.scratchpad =... | [
"function",
"Inputter",
"(",
"options",
",",
"components",
")",
"{",
"this",
".",
"requisition",
"=",
"components",
".",
"requisition",
";",
"this",
".",
"focusManager",
"=",
"components",
".",
"focusManager",
";",
"this",
".",
"element",
"=",
"components",
... | A wrapper to take care of the functions concerning an input element
@param options Object containing user customization properties, including:
- scratchpad (default=none)
- promptWidth (default=22px)
@param components Object that links to other UI components. GCLI provided:
- requisition
- focusManager
- element | [
"A",
"wrapper",
"to",
"take",
"care",
"of",
"the",
"functions",
"concerning",
"an",
"input",
"element"
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/gcli/gcli/ui/inputter.js#L43-L101 | train |
eclipse/orion.client | bundles/org.eclipse.orion.client.ui/web/orion/navoutliner.js | NavigationOutliner | function NavigationOutliner(options) {
var parent = lib.node(options.parent);
if (!parent) { throw "no parent"; } //$NON-NLS-0$
if (!options.serviceRegistry) {throw "no service registry"; } //$NON-NLS-0$
this._parent = parent;
this._registry = options.serviceRegistry;
this.commandService = options.commandSe... | javascript | function NavigationOutliner(options) {
var parent = lib.node(options.parent);
if (!parent) { throw "no parent"; } //$NON-NLS-0$
if (!options.serviceRegistry) {throw "no service registry"; } //$NON-NLS-0$
this._parent = parent;
this._registry = options.serviceRegistry;
this.commandService = options.commandSe... | [
"function",
"NavigationOutliner",
"(",
"options",
")",
"{",
"var",
"parent",
"=",
"lib",
".",
"node",
"(",
"options",
".",
"parent",
")",
";",
"if",
"(",
"!",
"parent",
")",
"{",
"throw",
"\"no parent\"",
";",
"}",
"//$NON-NLS-0$",
"if",
"(",
"!",
"opt... | Creates a new user interface element showing an outliner used for navigation
@name orion.navoutliner.NavigationOutliner
@class A user interface element showing a list of various navigation links.
@param {Object} options The service options
@param {Object} options.parent The parent of this outliner widget
@param {orion... | [
"Creates",
"a",
"new",
"user",
"interface",
"element",
"showing",
"an",
"outliner",
"used",
"for",
"navigation"
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/navoutliner.js#L78-L86 | train |
eclipse/orion.client | bundles/org.eclipse.orion.client.git/web/orion/git/gitClient.js | function(gitStashLocation, indexMessage, workingDirectoryMessage, includeUntracked){
var service = this;
var payload = {};
if(indexMessage != null) /* note that undefined == null */
payload.IndexMessage = indexMessage;
if(workingDirectoryMessage != null) /* note that undefined == null */
pay... | javascript | function(gitStashLocation, indexMessage, workingDirectoryMessage, includeUntracked){
var service = this;
var payload = {};
if(indexMessage != null) /* note that undefined == null */
payload.IndexMessage = indexMessage;
if(workingDirectoryMessage != null) /* note that undefined == null */
pay... | [
"function",
"(",
"gitStashLocation",
",",
"indexMessage",
",",
"workingDirectoryMessage",
",",
"includeUntracked",
")",
"{",
"var",
"service",
"=",
"this",
";",
"var",
"payload",
"=",
"{",
"}",
";",
"if",
"(",
"indexMessage",
"!=",
"null",
")",
"/* note that u... | Performs git stash create
@param gitStashLocation
@param indexMessage [optional)
@param workingDirectoryMessage [optional]
@param includeUntracked [optional]
@returns {Deferred} | [
"Performs",
"git",
"stash",
"create"
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.git/web/orion/git/gitClient.js#L918-L946 | train | |
eclipse/orion.client | bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer-table.js | FileModel | function FileModel(serviceRegistry, root, fileClient, idPrefix, excludeFiles, excludeFolders, filteredResources) {
this.registry = serviceRegistry;
this.root = root;
this.fileClient = fileClient;
this.idPrefix = idPrefix || "";
if (typeof this.idPrefix !== "string") {
this.idPrefix = this.idPrefix.id;
}
... | javascript | function FileModel(serviceRegistry, root, fileClient, idPrefix, excludeFiles, excludeFolders, filteredResources) {
this.registry = serviceRegistry;
this.root = root;
this.fileClient = fileClient;
this.idPrefix = idPrefix || "";
if (typeof this.idPrefix !== "string") {
this.idPrefix = this.idPrefix.id;
}
... | [
"function",
"FileModel",
"(",
"serviceRegistry",
",",
"root",
",",
"fileClient",
",",
"idPrefix",
",",
"excludeFiles",
",",
"excludeFolders",
",",
"filteredResources",
")",
"{",
"this",
".",
"registry",
"=",
"serviceRegistry",
";",
"this",
".",
"root",
"=",
"r... | Tree model used by the FileExplorer
@param {?} serviceRegistry The backing registry
@param {?} root The root item for the model
@param {FileClient} fileClient The backing FileClient instance
@param {string} idPrefix The prefix to use for the new model nodes
@param {boolean} excludeFiles The optional flag for if files ... | [
"Tree",
"model",
"used",
"by",
"the",
"FileExplorer"
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer-table.js#L41-L60 | train |
eclipse/orion.client | bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer-table.js | function(item, reroot) {
var deferred = new Deferred();
if (!item || !this.model || !this.myTree) {
return deferred.reject();
}
if (!this.myTree.showRoot && (item.Location === this.treeRoot.Location || item.Location === this.treeRoot.ContentLocation)) {
return deferred.resolve(this.treeRoot);
}
... | javascript | function(item, reroot) {
var deferred = new Deferred();
if (!item || !this.model || !this.myTree) {
return deferred.reject();
}
if (!this.myTree.showRoot && (item.Location === this.treeRoot.Location || item.Location === this.treeRoot.ContentLocation)) {
return deferred.resolve(this.treeRoot);
}
... | [
"function",
"(",
"item",
",",
"reroot",
")",
"{",
"var",
"deferred",
"=",
"new",
"Deferred",
"(",
")",
";",
"if",
"(",
"!",
"item",
"||",
"!",
"this",
".",
"model",
"||",
"!",
"this",
".",
"myTree",
")",
"{",
"return",
"deferred",
".",
"reject",
... | Shows the given item.
@param {Object} The item to be shown.
@param {Booelan} [reroot=true] whether the receiver should re-root the tree if the item is not displayable.
@returns {orion.Promise} | [
"Shows",
"the",
"given",
"item",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer-table.js#L1307-L1344 | train | |
eclipse/orion.client | bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer-table.js | function(item, reroot) {
return this.showItem(item, reroot).then(function(result) {
this.select(result);
}.bind(this));
} | javascript | function(item, reroot) {
return this.showItem(item, reroot).then(function(result) {
this.select(result);
}.bind(this));
} | [
"function",
"(",
"item",
",",
"reroot",
")",
"{",
"return",
"this",
".",
"showItem",
"(",
"item",
",",
"reroot",
")",
".",
"then",
"(",
"function",
"(",
"result",
")",
"{",
"this",
".",
"select",
"(",
"result",
")",
";",
"}",
".",
"bind",
"(",
"t... | Shows and selects the given item.
@param {Object} The item to be revealed.
@param {Booelan} [reroot=true] whether the receiver should re-root the tree if the item is not displayable.
@returns {orion.Promise} | [
"Shows",
"and",
"selects",
"the",
"given",
"item",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer-table.js#L1384-L1388 | train | |
eclipse/orion.client | bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer-table.js | function(path, force, postLoad) {
if (path && typeof path === "object") {
path = path.ChildrenLocation || path.ContentLocation;
}
path = mFileUtils.makeRelative(path);
var self = this;
if (force || path !== this.treeRoot.Path || path !== this._lastPath) {
this._lastPath = path;
return this.lo... | javascript | function(path, force, postLoad) {
if (path && typeof path === "object") {
path = path.ChildrenLocation || path.ContentLocation;
}
path = mFileUtils.makeRelative(path);
var self = this;
if (force || path !== this.treeRoot.Path || path !== this._lastPath) {
this._lastPath = path;
return this.lo... | [
"function",
"(",
"path",
",",
"force",
",",
"postLoad",
")",
"{",
"if",
"(",
"path",
"&&",
"typeof",
"path",
"===",
"\"object\"",
")",
"{",
"path",
"=",
"path",
".",
"ChildrenLocation",
"||",
"path",
".",
"ContentLocation",
";",
"}",
"path",
"=",
"mFil... | Load the resource at the given path.
@name orion.explorer.FileExplorer#loadResourceList
@function
@param {String|Object} path The path of the resource to load, or an object with a ChildrenLocation or ContentLocation field giving the path.
@param {Boolean} [force] If true, force reload even if the path is unchanged. Use... | [
"Load",
"the",
"resource",
"at",
"the",
"given",
"path",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer-table.js#L1452-L1469 | train | |
eclipse/orion.client | bundles/org.eclipse.orion.client.ui/web/orion/sites/siteCommands.js | createSiteServiceCommands | function createSiteServiceCommands(serviceRegistry, commandService, options) {
function getFileService(siteServiceRef) {
return mSiteClient.getFileClient(serviceRegistry, siteServiceRef.getProperty('filePattern')); //$NON-NLS-0$
}
options = options || {};
var createCommand = new mCommands.Command({
name :... | javascript | function createSiteServiceCommands(serviceRegistry, commandService, options) {
function getFileService(siteServiceRef) {
return mSiteClient.getFileClient(serviceRegistry, siteServiceRef.getProperty('filePattern')); //$NON-NLS-0$
}
options = options || {};
var createCommand = new mCommands.Command({
name :... | [
"function",
"createSiteServiceCommands",
"(",
"serviceRegistry",
",",
"commandService",
",",
"options",
")",
"{",
"function",
"getFileService",
"(",
"siteServiceRef",
")",
"{",
"return",
"mSiteClient",
".",
"getFileClient",
"(",
"serviceRegistry",
",",
"siteServiceRef",... | Creates & adds commands that act on an site service.
@param {orion.serviceregistry.ServiceRegistry} serviceRegistry
@param {Function} options.createCallback
@param {Function} options.errorCallback
@name orion.sites.siteCommands#createSiteServiceCommands | [
"Creates",
"&",
"adds",
"commands",
"that",
"act",
"on",
"an",
"site",
"service",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/sites/siteCommands.js#L25-L53 | train |
eclipse/orion.client | bundles/org.eclipse.orion.client.ui/web/gcli/gcli/types/command.js | ParamType | function ParamType(typeSpec) {
this.requisition = typeSpec.requisition;
this.isIncompleteName = typeSpec.isIncompleteName;
this.stringifyProperty = 'name';
this.neverForceAsync = true;
} | javascript | function ParamType(typeSpec) {
this.requisition = typeSpec.requisition;
this.isIncompleteName = typeSpec.isIncompleteName;
this.stringifyProperty = 'name';
this.neverForceAsync = true;
} | [
"function",
"ParamType",
"(",
"typeSpec",
")",
"{",
"this",
".",
"requisition",
"=",
"typeSpec",
".",
"requisition",
";",
"this",
".",
"isIncompleteName",
"=",
"typeSpec",
".",
"isIncompleteName",
";",
"this",
".",
"stringifyProperty",
"=",
"'name'",
";",
"thi... | Select from the available commands.
This is very similar to a SelectionType, however the level of hackery in
SelectionType to make it handle Commands correctly was to high, so we
simplified.
If you are making changes to this code, you should check there too. | [
"Select",
"from",
"the",
"available",
"commands",
".",
"This",
"is",
"very",
"similar",
"to",
"a",
"SelectionType",
"however",
"the",
"level",
"of",
"hackery",
"in",
"SelectionType",
"to",
"make",
"it",
"handle",
"Commands",
"correctly",
"was",
"to",
"high",
... | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/gcli/gcli/types/command.js#L57-L62 | train |
eclipse/orion.client | bundles/org.eclipse.orion.client.ui/web/orion/status.js | StatusReportingService | function StatusReportingService(serviceRegistry, operationsClient, domId, progressDomId, notificationContainerDomId) {
this._serviceRegistry = serviceRegistry;
this._serviceRegistration = serviceRegistry.registerService("orion.page.message", this); //$NON-NLS-0$
this._operationsClient = operationsClient;
th... | javascript | function StatusReportingService(serviceRegistry, operationsClient, domId, progressDomId, notificationContainerDomId) {
this._serviceRegistry = serviceRegistry;
this._serviceRegistration = serviceRegistry.registerService("orion.page.message", this); //$NON-NLS-0$
this._operationsClient = operationsClient;
th... | [
"function",
"StatusReportingService",
"(",
"serviceRegistry",
",",
"operationsClient",
",",
"domId",
",",
"progressDomId",
",",
"notificationContainerDomId",
")",
"{",
"this",
".",
"_serviceRegistry",
"=",
"serviceRegistry",
";",
"this",
".",
"_serviceRegistration",
"="... | Service for reporting status
@class Service for reporting status
@name orion.status.StatusReportingService
@param {orion.serviceregistry.ServiceRegistry} serviceRegistry
@param {orion.operationclient.OperationsClient} operationsClient
@param {String} domId ID of the DOM node under which status will be displayed.
@param... | [
"Service",
"for",
"reporting",
"status"
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/status.js#L43-L55 | train |
eclipse/orion.client | bundles/org.eclipse.orion.client.ui/web/orion/status.js | function(msg, timeout, isAccessible) {
this._init();
this.statusMessage = msg;
var node = lib.node(this.domId);
if(typeof isAccessible === "boolean") {
// this is kind of a hack; when there is good screen reader support for aria-busy,
// this should be done by toggling that instead
var re... | javascript | function(msg, timeout, isAccessible) {
this._init();
this.statusMessage = msg;
var node = lib.node(this.domId);
if(typeof isAccessible === "boolean") {
// this is kind of a hack; when there is good screen reader support for aria-busy,
// this should be done by toggling that instead
var re... | [
"function",
"(",
"msg",
",",
"timeout",
",",
"isAccessible",
")",
"{",
"this",
".",
"_init",
"(",
")",
";",
"this",
".",
"statusMessage",
"=",
"msg",
";",
"var",
"node",
"=",
"lib",
".",
"node",
"(",
"this",
".",
"domId",
")",
";",
"if",
"(",
"ty... | Displays a status message to the user.
@param {String} msg Message to display.
@param {Number} [timeout] Time to display the message before hiding it.
@param {Boolean} [isAccessible] If <code>true</code>, a screen reader will read this message.
Otherwise defaults to the domNode default. | [
"Displays",
"a",
"status",
"message",
"to",
"the",
"user",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/status.js#L120-L149 | train | |
eclipse/orion.client | bundles/org.eclipse.orion.client.ui/web/orion/status.js | function(st) {
this._clickToDisMiss = true;
this.statusMessage = st;
this._init();
//could be: responseText from xhrGet, deferred error object, or plain string
var _status = st.responseText || st.message || st;
//accept either a string or a JSON representation of an IStatus
if (typeof _statu... | javascript | function(st) {
this._clickToDisMiss = true;
this.statusMessage = st;
this._init();
//could be: responseText from xhrGet, deferred error object, or plain string
var _status = st.responseText || st.message || st;
//accept either a string or a JSON representation of an IStatus
if (typeof _statu... | [
"function",
"(",
"st",
")",
"{",
"this",
".",
"_clickToDisMiss",
"=",
"true",
";",
"this",
".",
"statusMessage",
"=",
"st",
";",
"this",
".",
"_init",
"(",
")",
";",
"//could be: responseText from xhrGet, deferred error object, or plain string\r",
"var",
"_status",
... | Displays an error message to the user.
@param {String|orionError} st The error to display. Can be a simple String,
or an error object from a XHR error callback, or the body of an error response
from the Orion server. | [
"Displays",
"an",
"error",
"message",
"to",
"the",
"user",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/status.js#L158-L195 | train | |
eclipse/orion.client | bundles/org.eclipse.orion.client.ui/web/orion/status.js | function(message) {
this._clickToDisMiss = false;
this._init();
this.progressMessage = message;
var pageLoader = getPageLoader();
if (pageLoader) {
var step = pageLoader.getStep();
if(step) {
if (typeof message === "object") {
step.message = message.message;
step.de... | javascript | function(message) {
this._clickToDisMiss = false;
this._init();
this.progressMessage = message;
var pageLoader = getPageLoader();
if (pageLoader) {
var step = pageLoader.getStep();
if(step) {
if (typeof message === "object") {
step.message = message.message;
step.de... | [
"function",
"(",
"message",
")",
"{",
"this",
".",
"_clickToDisMiss",
"=",
"false",
";",
"this",
".",
"_init",
"(",
")",
";",
"this",
".",
"progressMessage",
"=",
"message",
";",
"var",
"pageLoader",
"=",
"getPageLoader",
"(",
")",
";",
"if",
"(",
"pag... | Set a message that will be shown in the progress reporting area on the page.
@param {String} message The progress message to display. | [
"Set",
"a",
"message",
"that",
"will",
"be",
"shown",
"in",
"the",
"progress",
"reporting",
"area",
"on",
"the",
"page",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/status.js#L201-L238 | train | |
eclipse/orion.client | bundles/org.eclipse.orion.client.ui/web/orion/status.js | function(deferred, message) {
var that = this;
if(message){
that.setProgressMessage(message);
var finish = function(){
if(message === that.progressMessage){
that.setProgressMessage("");
}
};
deferred.then(finish, finish);
}
return deferred;
} | javascript | function(deferred, message) {
var that = this;
if(message){
that.setProgressMessage(message);
var finish = function(){
if(message === that.progressMessage){
that.setProgressMessage("");
}
};
deferred.then(finish, finish);
}
return deferred;
} | [
"function",
"(",
"deferred",
",",
"message",
")",
"{",
"var",
"that",
"=",
"this",
";",
"if",
"(",
"message",
")",
"{",
"that",
".",
"setProgressMessage",
"(",
"message",
")",
";",
"var",
"finish",
"=",
"function",
"(",
")",
"{",
"if",
"(",
"message"... | Shows a progress message in the progress area until the given deferred is resolved. | [
"Shows",
"a",
"progress",
"message",
"in",
"the",
"progress",
"area",
"until",
"the",
"given",
"deferred",
"is",
"resolved",
"."
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/status.js#L402-L414 | train | |
eclipse/orion.client | bundles/org.eclipse.orion.client.ui/web/gcli/gcli/types/spell.js | damerauLevenshteinDistance | function damerauLevenshteinDistance(wordi, wordj) {
var wordiLen = wordi.length;
var wordjLen = wordj.length;
// We only need to store three rows of our dynamic programming matrix.
// (Without swap, it would have been two.)
var row0 = new Array(wordiLen+1);
var row1 = new Array(wordiLen+1);
var row2 = ne... | javascript | function damerauLevenshteinDistance(wordi, wordj) {
var wordiLen = wordi.length;
var wordjLen = wordj.length;
// We only need to store three rows of our dynamic programming matrix.
// (Without swap, it would have been two.)
var row0 = new Array(wordiLen+1);
var row1 = new Array(wordiLen+1);
var row2 = ne... | [
"function",
"damerauLevenshteinDistance",
"(",
"wordi",
",",
"wordj",
")",
"{",
"var",
"wordiLen",
"=",
"wordi",
".",
"length",
";",
"var",
"wordjLen",
"=",
"wordj",
".",
"length",
";",
"// We only need to store three rows of our dynamic programming matrix.",
"// (Witho... | Compute Damerau-Levenshtein Distance
@see http://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance | [
"Compute",
"Damerau",
"-",
"Levenshtein",
"Distance"
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/gcli/gcli/types/spell.js#L35-L84 | train |
eclipse/orion.client | modules/orionode/lib/metastore/mongodb/store.js | findUser | function findUser(id, user, callback) {
if (typeof user.save === 'function') {
callback(null, user);
} else {
orionAccount.findByUsername(id, callback);
}
} | javascript | function findUser(id, user, callback) {
if (typeof user.save === 'function') {
callback(null, user);
} else {
orionAccount.findByUsername(id, callback);
}
} | [
"function",
"findUser",
"(",
"id",
",",
"user",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"user",
".",
"save",
"===",
"'function'",
")",
"{",
"callback",
"(",
"null",
",",
"user",
")",
";",
"}",
"else",
"{",
"orionAccount",
".",
"findByUsername",... | If `user` has already been fetched from DB, use it, otherwise obtain from findByUsername | [
"If",
"user",
"has",
"already",
"been",
"fetched",
"from",
"DB",
"use",
"it",
"otherwise",
"obtain",
"from",
"findByUsername"
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/metastore/mongodb/store.js#L118-L124 | train |
eclipse/orion.client | modules/orionode/lib/metastore/mongodb/store.js | function(oauth, callback) {
orionAccount.find({oauth: new RegExp("^" + oauth + "$", "m")}, function(err, user) {
if (err) {
return callback(err);
}
if (user && user.length) {
return callback(null, user[0]);
}
return callback(null, null);
});
} | javascript | function(oauth, callback) {
orionAccount.find({oauth: new RegExp("^" + oauth + "$", "m")}, function(err, user) {
if (err) {
return callback(err);
}
if (user && user.length) {
return callback(null, user[0]);
}
return callback(null, null);
});
} | [
"function",
"(",
"oauth",
",",
"callback",
")",
"{",
"orionAccount",
".",
"find",
"(",
"{",
"oauth",
":",
"new",
"RegExp",
"(",
"\"^\"",
"+",
"oauth",
"+",
"\"$\"",
",",
"\"m\"",
")",
"}",
",",
"function",
"(",
"err",
",",
"user",
")",
"{",
"if",
... | returns the user with the given oauth token | [
"returns",
"the",
"user",
"with",
"the",
"given",
"oauth",
"token"
] | eb2583100c662b5cfc1b461a978b31d3b8555ce1 | https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/metastore/mongodb/store.js#L266-L276 | train | |
nanw1103/otherlib | lib/index.js | delay | function delay(millis, obj) {
return new Promise((resolve, reject) => {
let resolveImpl = d => {
if (d === null || d === undefined) {
resolve(d)
} else if (d instanceof Promise || typeof d.then === 'function' && typeof d.catch === 'function') {
d.then(resolve).catch(reject)
} else if (typeof d === ... | javascript | function delay(millis, obj) {
return new Promise((resolve, reject) => {
let resolveImpl = d => {
if (d === null || d === undefined) {
resolve(d)
} else if (d instanceof Promise || typeof d.then === 'function' && typeof d.catch === 'function') {
d.then(resolve).catch(reject)
} else if (typeof d === ... | [
"function",
"delay",
"(",
"millis",
",",
"obj",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"let",
"resolveImpl",
"=",
"d",
"=>",
"{",
"if",
"(",
"d",
"===",
"null",
"||",
"d",
"===",
"undefined",
")",
... | Return a promise which resolves the provided data after specified delay.
@param {number} millis - Delay before resolving of the promise
@param {promise|function|object} obj - If promise, it will be resolved/rejected in a delayed manner; if function, it's return value will be resolved. Otherwise the obj is resolv... | [
"Return",
"a",
"promise",
"which",
"resolves",
"the",
"provided",
"data",
"after",
"specified",
"delay",
"."
] | 187315e12cd829ddf39a38fcbb38d36f8cd34819 | https://github.com/nanw1103/otherlib/blob/187315e12cd829ddf39a38fcbb38d36f8cd34819/lib/index.js#L11-L27 | train |
nanw1103/otherlib | lib/index.js | retry | async function retry(func, options) {
if (!options.timeoutMs && !options.retry)
throw new Error('Invalid argument: either options.timeoutMs or options.retry must be specified')
if (options.timeoutMs < 0)
throw new Error('Invalid argument: options.timeoutMs < 0')
if (options.retry < 0)
throw new Error('Invalid ... | javascript | async function retry(func, options) {
if (!options.timeoutMs && !options.retry)
throw new Error('Invalid argument: either options.timeoutMs or options.retry must be specified')
if (options.timeoutMs < 0)
throw new Error('Invalid argument: options.timeoutMs < 0')
if (options.retry < 0)
throw new Error('Invalid ... | [
"async",
"function",
"retry",
"(",
"func",
",",
"options",
")",
"{",
"if",
"(",
"!",
"options",
".",
"timeoutMs",
"&&",
"!",
"options",
".",
"retry",
")",
"throw",
"new",
"Error",
"(",
"'Invalid argument: either options.timeoutMs or options.retry must be specified'"... | Retry the specific task conditionally
@param {function} func
@param {object} options
@property {function} options.filter - A callback filter to control retry, based on result or error.
Retry on true return. The default filter is: (err, ret)=>err
@property {number} options.retry - max retry attempt. 0 indicates... | [
"Retry",
"the",
"specific",
"task",
"conditionally"
] | 187315e12cd829ddf39a38fcbb38d36f8cd34819 | https://github.com/nanw1103/otherlib/blob/187315e12cd829ddf39a38fcbb38d36f8cd34819/lib/index.js#L44-L126 | train |
nanw1103/otherlib | lib/index.js | deepMerge | function deepMerge(target, ...sources) {
let src
while (true) {
if (!sources.length)
return target
src = sources.shift()
if (src)
break
}
for (let k in src) {
let v = src[k]
let existing = target[k]
if (typeof v === 'object') {
if (v === null) {
target[k] = null
} else if (Array.isArr... | javascript | function deepMerge(target, ...sources) {
let src
while (true) {
if (!sources.length)
return target
src = sources.shift()
if (src)
break
}
for (let k in src) {
let v = src[k]
let existing = target[k]
if (typeof v === 'object') {
if (v === null) {
target[k] = null
} else if (Array.isArr... | [
"function",
"deepMerge",
"(",
"target",
",",
"...",
"sources",
")",
"{",
"let",
"src",
"while",
"(",
"true",
")",
"{",
"if",
"(",
"!",
"sources",
".",
"length",
")",
"return",
"target",
"src",
"=",
"sources",
".",
"shift",
"(",
")",
"if",
"(",
"src... | Like Object.assign, but works in a deep manner.
@param {object} target - Target object to be merged into
@param {object} sources - Source objects to be merged onto target
@return {object} The target object | [
"Like",
"Object",
".",
"assign",
"but",
"works",
"in",
"a",
"deep",
"manner",
"."
] | 187315e12cd829ddf39a38fcbb38d36f8cd34819 | https://github.com/nanw1103/otherlib/blob/187315e12cd829ddf39a38fcbb38d36f8cd34819/lib/index.js#L244-L277 | train |
urturn/urturn-expression-api | lib/expression-api/compat.js | restoreEventListenerImplementation | function restoreEventListenerImplementation() {
global.Element.prototype.addEventListener = nativeAddEventListener;
global.Element.prototype.removeEventListener = nativeRemoveEventListener;
global.document.addEventListener = nativeAddEventListener;
global.document.removeEventListener = nativeRemoveEvent... | javascript | function restoreEventListenerImplementation() {
global.Element.prototype.addEventListener = nativeAddEventListener;
global.Element.prototype.removeEventListener = nativeRemoveEventListener;
global.document.addEventListener = nativeAddEventListener;
global.document.removeEventListener = nativeRemoveEvent... | [
"function",
"restoreEventListenerImplementation",
"(",
")",
"{",
"global",
".",
"Element",
".",
"prototype",
".",
"addEventListener",
"=",
"nativeAddEventListener",
";",
"global",
".",
"Element",
".",
"prototype",
".",
"removeEventListener",
"=",
"nativeRemoveEventListe... | Not public for now | [
"Not",
"public",
"for",
"now"
] | 009a272ee670dbbe5eefb5c070ed827dd778bb07 | https://github.com/urturn/urturn-expression-api/blob/009a272ee670dbbe5eefb5c070ed827dd778bb07/lib/expression-api/compat.js#L130-L135 | train |
feedhenry/fh-component-metrics | lib/clients/base.js | BaseClient | function BaseClient(opts) {
this.opts = opts || {};
var self = this;
this.sendQConcurrency = opts.sendQueueConcurrency || 5;
this.sendQ = async.queue(function(data, cb) {
self.doSend(data, cb);
}, this.sendQConcurrency);
} | javascript | function BaseClient(opts) {
this.opts = opts || {};
var self = this;
this.sendQConcurrency = opts.sendQueueConcurrency || 5;
this.sendQ = async.queue(function(data, cb) {
self.doSend(data, cb);
}, this.sendQConcurrency);
} | [
"function",
"BaseClient",
"(",
"opts",
")",
"{",
"this",
".",
"opts",
"=",
"opts",
"||",
"{",
"}",
";",
"var",
"self",
"=",
"this",
";",
"this",
".",
"sendQConcurrency",
"=",
"opts",
".",
"sendQueueConcurrency",
"||",
"5",
";",
"this",
".",
"sendQ",
... | A base implementation for all the clients | [
"A",
"base",
"implementation",
"for",
"all",
"the",
"clients"
] | c97a1a82ff0144f2a7c2abecbc22084fade1cbc8 | https://github.com/feedhenry/fh-component-metrics/blob/c97a1a82ff0144f2a7c2abecbc22084fade1cbc8/lib/clients/base.js#L6-L13 | train |
bootprint/customize-write-files | lib/changed.js | compareString | async function compareString (filename, expectedContents) {
try {
const actualContents = await fs.readFile(filename, { encoding: 'utf8' })
return actualContents !== expectedContents
} catch (err) {
return handleError(err)
}
} | javascript | async function compareString (filename, expectedContents) {
try {
const actualContents = await fs.readFile(filename, { encoding: 'utf8' })
return actualContents !== expectedContents
} catch (err) {
return handleError(err)
}
} | [
"async",
"function",
"compareString",
"(",
"filename",
",",
"expectedContents",
")",
"{",
"try",
"{",
"const",
"actualContents",
"=",
"await",
"fs",
".",
"readFile",
"(",
"filename",
",",
"{",
"encoding",
":",
"'utf8'",
"}",
")",
"return",
"actualContents",
... | Compares a string with a file contents. Returns true, if they differ or the file does not exist.
@param {string} filename the file name
@param {string} expectedContents the file contents
@returns {Promise<boolean>|boolean}
@private | [
"Compares",
"a",
"string",
"with",
"a",
"file",
"contents",
".",
"Returns",
"true",
"if",
"they",
"differ",
"or",
"the",
"file",
"does",
"not",
"exist",
"."
] | af77ce78b5196f40ce90670bfdb6e1e7e496a415 | https://github.com/bootprint/customize-write-files/blob/af77ce78b5196f40ce90670bfdb6e1e7e496a415/lib/changed.js#L51-L58 | train |
bootprint/customize-write-files | lib/changed.js | compareBuffer | async function compareBuffer (filename, expectedContents) {
try {
const actualContents = await fs.readFile(filename)
return !expectedContents.equals(actualContents)
} catch (err) {
return handleError(err)
}
} | javascript | async function compareBuffer (filename, expectedContents) {
try {
const actualContents = await fs.readFile(filename)
return !expectedContents.equals(actualContents)
} catch (err) {
return handleError(err)
}
} | [
"async",
"function",
"compareBuffer",
"(",
"filename",
",",
"expectedContents",
")",
"{",
"try",
"{",
"const",
"actualContents",
"=",
"await",
"fs",
".",
"readFile",
"(",
"filename",
")",
"return",
"!",
"expectedContents",
".",
"equals",
"(",
"actualContents",
... | Compares a buffer with a file contents. Returns true, if they differ or the file does not exist.
@param {string} filename the file name
@param {Buffer} expectedContents the file contents
@returns {Promise<boolean>|boolean}
@private | [
"Compares",
"a",
"buffer",
"with",
"a",
"file",
"contents",
".",
"Returns",
"true",
"if",
"they",
"differ",
"or",
"the",
"file",
"does",
"not",
"exist",
"."
] | af77ce78b5196f40ce90670bfdb6e1e7e496a415 | https://github.com/bootprint/customize-write-files/blob/af77ce78b5196f40ce90670bfdb6e1e7e496a415/lib/changed.js#L68-L75 | train |
bootprint/customize-write-files | lib/changed.js | compareStream | async function compareStream (filename, expectedContents) {
try {
const actualStream = fs.createReadStream(filename)
const result = await streamCompare(expectedContents, actualStream, {
abortOnError: true,
compare: (a, b) => {
return Buffer.compare(a.data, b.data) !== 0
}
})
... | javascript | async function compareStream (filename, expectedContents) {
try {
const actualStream = fs.createReadStream(filename)
const result = await streamCompare(expectedContents, actualStream, {
abortOnError: true,
compare: (a, b) => {
return Buffer.compare(a.data, b.data) !== 0
}
})
... | [
"async",
"function",
"compareStream",
"(",
"filename",
",",
"expectedContents",
")",
"{",
"try",
"{",
"const",
"actualStream",
"=",
"fs",
".",
"createReadStream",
"(",
"filename",
")",
"const",
"result",
"=",
"await",
"streamCompare",
"(",
"expectedContents",
",... | Compares a readable stream with a file contents. Returns true, if they differ or the file does not exist.
@param {string} filename the file name
@param {Stream} expectedContents the file contents
@returns {Promise<boolean>|boolean}
@private | [
"Compares",
"a",
"readable",
"stream",
"with",
"a",
"file",
"contents",
".",
"Returns",
"true",
"if",
"they",
"differ",
"or",
"the",
"file",
"does",
"not",
"exist",
"."
] | af77ce78b5196f40ce90670bfdb6e1e7e496a415 | https://github.com/bootprint/customize-write-files/blob/af77ce78b5196f40ce90670bfdb6e1e7e496a415/lib/changed.js#L84-L97 | train |
unfoldingWord-dev/node-door43-client | lib/main.js | function(project) {
if(project.slug.toLowerCase() === 'obs'
|| project.slug.toLowerCase() === 'bible-obs'
|| project.slug.toLowerCase() === 'bible'
|| !project.chunks_url) return Promise.resolve();
return request.read(project.chunks_url)
.then(function(r... | javascript | function(project) {
if(project.slug.toLowerCase() === 'obs'
|| project.slug.toLowerCase() === 'bible-obs'
|| project.slug.toLowerCase() === 'bible'
|| !project.chunks_url) return Promise.resolve();
return request.read(project.chunks_url)
.then(function(r... | [
"function",
"(",
"project",
")",
"{",
"if",
"(",
"project",
".",
"slug",
".",
"toLowerCase",
"(",
")",
"===",
"'obs'",
"||",
"project",
".",
"slug",
".",
"toLowerCase",
"(",
")",
"===",
"'bible-obs'",
"||",
"project",
".",
"slug",
".",
"toLowerCase",
"... | Downloads the chunks for a project
@param project {{}} | [
"Downloads",
"the",
"chunks",
"for",
"a",
"project"
] | 18f518368ee89f4baf8943500a1c53ef5efcfb3e | https://github.com/unfoldingWord-dev/node-door43-client/blob/18f518368ee89f4baf8943500a1c53ef5efcfb3e/lib/main.js#L59-L105 | train | |
unfoldingWord-dev/node-door43-client | lib/main.js | function(project) {
return request.read(project.lang_catalog)
.then(function(response) {
// consume language data
if(response.status !== 200) return Promise.reject(response);
let data;
try {
data = JSON.parse(respon... | javascript | function(project) {
return request.read(project.lang_catalog)
.then(function(response) {
// consume language data
if(response.status !== 200) return Promise.reject(response);
let data;
try {
data = JSON.parse(respon... | [
"function",
"(",
"project",
")",
"{",
"return",
"request",
".",
"read",
"(",
"project",
".",
"lang_catalog",
")",
".",
"then",
"(",
"function",
"(",
"response",
")",
"{",
"// consume language data",
"if",
"(",
"response",
".",
"status",
"!==",
"200",
")",
... | Downloads the source languages for a project
@param project {{}}
@returns {Promise} | [
"Downloads",
"the",
"source",
"languages",
"for",
"a",
"project"
] | 18f518368ee89f4baf8943500a1c53ef5efcfb3e | https://github.com/unfoldingWord-dev/node-door43-client/blob/18f518368ee89f4baf8943500a1c53ef5efcfb3e/lib/main.js#L112-L168 | train | |
unfoldingWord-dev/node-door43-client | lib/main.js | function() {
library.addCatalog({
slug: 'langnames',
url: 'https://td.unfoldingword.org/exports/langnames.json',
modified_at: 0
});
library.addCatalog({
slug: 'new-language-questions',
url: 'https://td.unfoldingword.org/api/questionnair... | javascript | function() {
library.addCatalog({
slug: 'langnames',
url: 'https://td.unfoldingword.org/exports/langnames.json',
modified_at: 0
});
library.addCatalog({
slug: 'new-language-questions',
url: 'https://td.unfoldingword.org/api/questionnair... | [
"function",
"(",
")",
"{",
"library",
".",
"addCatalog",
"(",
"{",
"slug",
":",
"'langnames'",
",",
"url",
":",
"'https://td.unfoldingword.org/exports/langnames.json'",
",",
"modified_at",
":",
"0",
"}",
")",
";",
"library",
".",
"addCatalog",
"(",
"{",
"slug"... | Injects the global catalogs since they are missing from api v2.
@returns {Promise} | [
"Injects",
"the",
"global",
"catalogs",
"since",
"they",
"are",
"missing",
"from",
"api",
"v2",
"."
] | 18f518368ee89f4baf8943500a1c53ef5efcfb3e | https://github.com/unfoldingWord-dev/node-door43-client/blob/18f518368ee89f4baf8943500a1c53ef5efcfb3e/lib/main.js#L300-L323 | train | |
unfoldingWord-dev/node-door43-client | lib/main.js | function(url, onProgress) {
onProgress = onProgress || function(){};
return injectGlobalCatalogs()
.then(function() {
library.commit();
return request.read(url);
})
.then(function(response) {
// disable saves for better p... | javascript | function(url, onProgress) {
onProgress = onProgress || function(){};
return injectGlobalCatalogs()
.then(function() {
library.commit();
return request.read(url);
})
.then(function(response) {
// disable saves for better p... | [
"function",
"(",
"url",
",",
"onProgress",
")",
"{",
"onProgress",
"=",
"onProgress",
"||",
"function",
"(",
")",
"{",
"}",
";",
"return",
"injectGlobalCatalogs",
"(",
")",
".",
"then",
"(",
"function",
"(",
")",
"{",
"library",
".",
"commit",
"(",
")"... | Indexes the languages, projects, and resources from the api
@param url {string} the entry resource api catalog
@param onProgress {function} an optional progress listener. This should receive progress id, total, completed
@returns {Promise} | [
"Indexes",
"the",
"languages",
"projects",
"and",
"resources",
"from",
"the",
"api"
] | 18f518368ee89f4baf8943500a1c53ef5efcfb3e | https://github.com/unfoldingWord-dev/node-door43-client/blob/18f518368ee89f4baf8943500a1c53ef5efcfb3e/lib/main.js#L346-L402 | train | |
unfoldingWord-dev/node-door43-client | lib/main.js | function(onProgress) {
onProgress = onProgress || function() {};
let projects = library.public_getters.getProjects();
library.autosave(false);
return promiseUtils.chain(downloadChunks, function(err, data) {
if(err instanceof Error) return Promise.reject(err);
cons... | javascript | function(onProgress) {
onProgress = onProgress || function() {};
let projects = library.public_getters.getProjects();
library.autosave(false);
return promiseUtils.chain(downloadChunks, function(err, data) {
if(err instanceof Error) return Promise.reject(err);
cons... | [
"function",
"(",
"onProgress",
")",
"{",
"onProgress",
"=",
"onProgress",
"||",
"function",
"(",
")",
"{",
"}",
";",
"let",
"projects",
"=",
"library",
".",
"public_getters",
".",
"getProjects",
"(",
")",
";",
"library",
".",
"autosave",
"(",
"false",
")... | Downloads the chunks for all projects
@param onProgress
@returns {Promise.<>} | [
"Downloads",
"the",
"chunks",
"for",
"all",
"projects"
] | 18f518368ee89f4baf8943500a1c53ef5efcfb3e | https://github.com/unfoldingWord-dev/node-door43-client/blob/18f518368ee89f4baf8943500a1c53ef5efcfb3e/lib/main.js#L409-L427 | train | |
unfoldingWord-dev/node-door43-client | lib/main.js | function(onProgress) {
onProgress = onProgress || function() {};
library.autosave(false);
let modules_urls = [
'https://api.unfoldingword.org/ta/txt/1/en/audio_2.json',
'https://api.unfoldingword.org/ta/txt/1/en/checking_1.json',
'https://api.unfoldingword.org... | javascript | function(onProgress) {
onProgress = onProgress || function() {};
library.autosave(false);
let modules_urls = [
'https://api.unfoldingword.org/ta/txt/1/en/audio_2.json',
'https://api.unfoldingword.org/ta/txt/1/en/checking_1.json',
'https://api.unfoldingword.org... | [
"function",
"(",
"onProgress",
")",
"{",
"onProgress",
"=",
"onProgress",
"||",
"function",
"(",
")",
"{",
"}",
";",
"library",
".",
"autosave",
"(",
"false",
")",
";",
"let",
"modules_urls",
"=",
"[",
"'https://api.unfoldingword.org/ta/txt/1/en/audio_2.json'",
... | Downloads the tA projects
@param onProgress
@returns {Promise.<>} | [
"Downloads",
"the",
"tA",
"projects"
] | 18f518368ee89f4baf8943500a1c53ef5efcfb3e | https://github.com/unfoldingWord-dev/node-door43-client/blob/18f518368ee89f4baf8943500a1c53ef5efcfb3e/lib/main.js#L434-L461 | train | |
unfoldingWord-dev/node-door43-client | lib/main.js | function(onProgress) {
const errorHandler = function(err) {
if(err instanceof Error) {
return Promise.reject(err);
} else {
return Promise.resolve();
}
};
// TRICKY: the language catalogs are dependent so we must run them in or... | javascript | function(onProgress) {
const errorHandler = function(err) {
if(err instanceof Error) {
return Promise.reject(err);
} else {
return Promise.resolve();
}
};
// TRICKY: the language catalogs are dependent so we must run them in or... | [
"function",
"(",
"onProgress",
")",
"{",
"const",
"errorHandler",
"=",
"function",
"(",
"err",
")",
"{",
"if",
"(",
"err",
"instanceof",
"Error",
")",
"{",
"return",
"Promise",
".",
"reject",
"(",
"err",
")",
";",
"}",
"else",
"{",
"return",
"Promise",... | Updates all of the global catalogs
@param onProgress
@returns {Promise.<>} | [
"Updates",
"all",
"of",
"the",
"global",
"catalogs"
] | 18f518368ee89f4baf8943500a1c53ef5efcfb3e | https://github.com/unfoldingWord-dev/node-door43-client/blob/18f518368ee89f4baf8943500a1c53ef5efcfb3e/lib/main.js#L521-L548 | train | |
unfoldingWord-dev/node-door43-client | lib/main.js | function(data, onProgress) {
onProgress = onProgress || function() {};
return new Promise(function(resolve, reject) {
try {
let languages = JSON.parse(data);
_.forEach(languages, function (language, index) {
language.slug = language.lc;
... | javascript | function(data, onProgress) {
onProgress = onProgress || function() {};
return new Promise(function(resolve, reject) {
try {
let languages = JSON.parse(data);
_.forEach(languages, function (language, index) {
language.slug = language.lc;
... | [
"function",
"(",
"data",
",",
"onProgress",
")",
"{",
"onProgress",
"=",
"onProgress",
"||",
"function",
"(",
")",
"{",
"}",
";",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"try",
"{",
"let",
"languages",
"=",... | Parses the target language catalog and indexes it.
@param data {string}
@param onProgress {function} an optional progress listener. This should receive progress id, total, completed
@returns {Promise} | [
"Parses",
"the",
"target",
"language",
"catalog",
"and",
"indexes",
"it",
"."
] | 18f518368ee89f4baf8943500a1c53ef5efcfb3e | https://github.com/unfoldingWord-dev/node-door43-client/blob/18f518368ee89f4baf8943500a1c53ef5efcfb3e/lib/main.js#L622-L651 | train | |
unfoldingWord-dev/node-door43-client | lib/main.js | function(data, onProgress) {
onProgress = onProgress || function() {};
return new Promise(function(resolve, reject) {
try {
let obj = JSON.parse(data);
_.forEach(obj.languages, function (questionnaire, index) {
// format
... | javascript | function(data, onProgress) {
onProgress = onProgress || function() {};
return new Promise(function(resolve, reject) {
try {
let obj = JSON.parse(data);
_.forEach(obj.languages, function (questionnaire, index) {
// format
... | [
"function",
"(",
"data",
",",
"onProgress",
")",
"{",
"onProgress",
"=",
"onProgress",
"||",
"function",
"(",
")",
"{",
"}",
";",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"try",
"{",
"let",
"obj",
"=",
"JS... | Parses the new language questions catalog and indexes it.
@param data {string}
@param onProgress {function} an optional progress listener. This should receive progress id, total, completed
@returns {Promise} | [
"Parses",
"the",
"new",
"language",
"questions",
"catalog",
"and",
"indexes",
"it",
"."
] | 18f518368ee89f4baf8943500a1c53ef5efcfb3e | https://github.com/unfoldingWord-dev/node-door43-client/blob/18f518368ee89f4baf8943500a1c53ef5efcfb3e/lib/main.js#L660-L712 | train | |
unfoldingWord-dev/node-door43-client | lib/main.js | function(formats) {
for(let format of formats) {
// TODO: rather than hard coding the mime type use library.spec.base_mime_type
if(format.mime_type.match(/application\/tsrc\+.+/)) {
return format;
}
}
return null;
} | javascript | function(formats) {
for(let format of formats) {
// TODO: rather than hard coding the mime type use library.spec.base_mime_type
if(format.mime_type.match(/application\/tsrc\+.+/)) {
return format;
}
}
return null;
} | [
"function",
"(",
"formats",
")",
"{",
"for",
"(",
"let",
"format",
"of",
"formats",
")",
"{",
"// TODO: rather than hard coding the mime type use library.spec.base_mime_type",
"if",
"(",
"format",
".",
"mime_type",
".",
"match",
"(",
"/",
"application\\/tsrc\\+.+",
"/... | Returns the first resource container format found in the list.
E.g. the array may contain binary formats such as pdf, mp3, etc. This basically filters those.
@param formats {[]} an array of resource formats
@returns {{}} the resource container format | [
"Returns",
"the",
"first",
"resource",
"container",
"format",
"found",
"in",
"the",
"list",
".",
"E",
".",
"g",
".",
"the",
"array",
"may",
"contain",
"binary",
"formats",
"such",
"as",
"pdf",
"mp3",
"etc",
".",
"This",
"basically",
"filters",
"those",
"... | 18f518368ee89f4baf8943500a1c53ef5efcfb3e | https://github.com/unfoldingWord-dev/node-door43-client/blob/18f518368ee89f4baf8943500a1c53ef5efcfb3e/lib/main.js#L788-L796 | train | |
unfoldingWord-dev/node-door43-client | lib/main.js | function(languageSlug, projectSlug, resourceSlug, progressCallback) {
// support passing args as an object
if(languageSlug != null && typeof languageSlug == 'object') {
resourceSlug = languageSlug.resourceSlug;
projectSlug = languageSlug.projectSlug;
languageSlug = la... | javascript | function(languageSlug, projectSlug, resourceSlug, progressCallback) {
// support passing args as an object
if(languageSlug != null && typeof languageSlug == 'object') {
resourceSlug = languageSlug.resourceSlug;
projectSlug = languageSlug.projectSlug;
languageSlug = la... | [
"function",
"(",
"languageSlug",
",",
"projectSlug",
",",
"resourceSlug",
",",
"progressCallback",
")",
"{",
"// support passing args as an object",
"if",
"(",
"languageSlug",
"!=",
"null",
"&&",
"typeof",
"languageSlug",
"==",
"'object'",
")",
"{",
"resourceSlug",
... | Downloads a resource container.
This expects a correctly formatted resource container
and will download it directly to the disk
Note: You may provide a single object parameter if you prefer
once the api can deliver proper resource containers this method
should be renamed to downloadContainer
@param languageSlug {str... | [
"Downloads",
"a",
"resource",
"container",
".",
"This",
"expects",
"a",
"correctly",
"formatted",
"resource",
"container",
"and",
"will",
"download",
"it",
"directly",
"to",
"the",
"disk"
] | 18f518368ee89f4baf8943500a1c53ef5efcfb3e | https://github.com/unfoldingWord-dev/node-door43-client/blob/18f518368ee89f4baf8943500a1c53ef5efcfb3e/lib/main.js#L871-L921 | train | |
unfoldingWord-dev/node-door43-client | lib/main.js | function(languageSlug, projectSlug, resourceSlug) {
return new Promise(function(resolve, reject) {
try {
resolve(library.public_getters.getResource(languageSlug, projectSlug, resourceSlug));
} catch(err) {
reject(err);
}
... | javascript | function(languageSlug, projectSlug, resourceSlug) {
return new Promise(function(resolve, reject) {
try {
resolve(library.public_getters.getResource(languageSlug, projectSlug, resourceSlug));
} catch(err) {
reject(err);
}
... | [
"function",
"(",
"languageSlug",
",",
"projectSlug",
",",
"resourceSlug",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"try",
"{",
"resolve",
"(",
"library",
".",
"public_getters",
".",
"getResource",
"(",
... | Opens a resource container archive so it's contents can be read.
The index will be referenced to validate the resource and retrieve the container type.
@param languageSlug {string}
@param projectSlug {string}
@param resourceSlug {string}
@returns {Promise.<Container>} | [
"Opens",
"a",
"resource",
"container",
"archive",
"so",
"it",
"s",
"contents",
"can",
"be",
"read",
".",
"The",
"index",
"will",
"be",
"referenced",
"to",
"validate",
"the",
"resource",
"and",
"retrieve",
"the",
"container",
"type",
"."
] | 18f518368ee89f4baf8943500a1c53ef5efcfb3e | https://github.com/unfoldingWord-dev/node-door43-client/blob/18f518368ee89f4baf8943500a1c53ef5efcfb3e/lib/main.js#L1114-L1129 | train | |
unfoldingWord-dev/node-door43-client | lib/main.js | function(languageSlug, projectSlug, resourceSlug) {
return new Promise(function(resolve, reject) {
try {
resolve(library.public_getters.getResource(languageSlug, projectSlug, resourceSlug));
} catch(err) {
reject(err);
}
... | javascript | function(languageSlug, projectSlug, resourceSlug) {
return new Promise(function(resolve, reject) {
try {
resolve(library.public_getters.getResource(languageSlug, projectSlug, resourceSlug));
} catch(err) {
reject(err);
}
... | [
"function",
"(",
"languageSlug",
",",
"projectSlug",
",",
"resourceSlug",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"try",
"{",
"resolve",
"(",
"library",
".",
"public_getters",
".",
"getResource",
"(",
... | Closes a resource container archive.
@param languageSlug {string}
@param projectSlug {string}
@param resourceSlug {string}
@returns {Promise.<string>} the path to the closed container | [
"Closes",
"a",
"resource",
"container",
"archive",
"."
] | 18f518368ee89f4baf8943500a1c53ef5efcfb3e | https://github.com/unfoldingWord-dev/node-door43-client/blob/18f518368ee89f4baf8943500a1c53ef5efcfb3e/lib/main.js#L1139-L1154 | train | |
unfoldingWord-dev/node-door43-client | lib/main.js | function() {
return new Promise(function(resolve, reject) {
try {
let files;
if(fileUtils.fileExists(resourceDir)) {
files = fs.readdirSync(resourceDir);
files = _.uniqBy(files, function (f) {
return path... | javascript | function() {
return new Promise(function(resolve, reject) {
try {
let files;
if(fileUtils.fileExists(resourceDir)) {
files = fs.readdirSync(resourceDir);
files = _.uniqBy(files, function (f) {
return path... | [
"function",
"(",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"try",
"{",
"let",
"files",
";",
"if",
"(",
"fileUtils",
".",
"fileExists",
"(",
"resourceDir",
")",
")",
"{",
"files",
"=",
"fs",
".",
... | Returns a list of resource containers that have been downloaded
@returns {Promise.<[{}]>} an array of resource container info objects (package.json). | [
"Returns",
"a",
"list",
"of",
"resource",
"containers",
"that",
"have",
"been",
"downloaded"
] | 18f518368ee89f4baf8943500a1c53ef5efcfb3e | https://github.com/unfoldingWord-dev/node-door43-client/blob/18f518368ee89f4baf8943500a1c53ef5efcfb3e/lib/main.js#L1160-L1181 | train | |
unfoldingWord-dev/node-door43-client | lib/main.js | function() {
return new Promise(function(resolve, reject) {
try{
resolve(library.listSourceLanguagesLastModified());
} catch (err) {
reject(err);
}
}).then(function(languages) {
return listResourceContainers()
... | javascript | function() {
return new Promise(function(resolve, reject) {
try{
resolve(library.listSourceLanguagesLastModified());
} catch (err) {
reject(err);
}
}).then(function(languages) {
return listResourceContainers()
... | [
"function",
"(",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"try",
"{",
"resolve",
"(",
"library",
".",
"listSourceLanguagesLastModified",
"(",
")",
")",
";",
"}",
"catch",
"(",
"err",
")",
"{",
"rej... | Returns a list of source languages that are eligible for updates.
@returns {Promise.<Array>} An array of slugs | [
"Returns",
"a",
"list",
"of",
"source",
"languages",
"that",
"are",
"eligible",
"for",
"updates",
"."
] | 18f518368ee89f4baf8943500a1c53ef5efcfb3e | https://github.com/unfoldingWord-dev/node-door43-client/blob/18f518368ee89f4baf8943500a1c53ef5efcfb3e/lib/main.js#L1213-L1237 | train | |
unfoldingWord-dev/node-door43-client | lib/main.js | function(languageSlug) {
return new Promise(function(resolve, reject) {
try{
resolve(library.listProjectsLastModified(languageSlug));
} catch (err) {
reject(err);
}
}).then(function(projects) {
return listResourceContainers()... | javascript | function(languageSlug) {
return new Promise(function(resolve, reject) {
try{
resolve(library.listProjectsLastModified(languageSlug));
} catch (err) {
reject(err);
}
}).then(function(projects) {
return listResourceContainers()... | [
"function",
"(",
"languageSlug",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"try",
"{",
"resolve",
"(",
"library",
".",
"listProjectsLastModified",
"(",
"languageSlug",
")",
")",
";",
"}",
"catch",
"(",
... | Returns a list of projects that are eligible for updates.
If no language is given the results will include all projects in all languages. This is helpful if you need to view updates based on project first rather than source language first.
@param languageSlug {string|null} the slug of a source language who's projects ... | [
"Returns",
"a",
"list",
"of",
"projects",
"that",
"are",
"eligible",
"for",
"updates",
".",
"If",
"no",
"language",
"is",
"given",
"the",
"results",
"will",
"include",
"all",
"projects",
"in",
"all",
"languages",
".",
"This",
"is",
"helpful",
"if",
"you",
... | 18f518368ee89f4baf8943500a1c53ef5efcfb3e | https://github.com/unfoldingWord-dev/node-door43-client/blob/18f518368ee89f4baf8943500a1c53ef5efcfb3e/lib/main.js#L1246-L1271 | train | |
DFFR-NT/dffrnt.confs | lib/utils.js | FREEZE | function FREEZE(obj, all = false) {
if (UoN(obj)) return obj;
// ----------------------------------------------------------
let iss = ISS(obj), iEN = OoA.has(iss), dfl, res;
// ----------------------------------------------------------
if (!iEN||iss=='function') return obj;
if (!!obj.toJS) obj = obj.toJS(... | javascript | function FREEZE(obj, all = false) {
if (UoN(obj)) return obj;
// ----------------------------------------------------------
let iss = ISS(obj), iEN = OoA.has(iss), dfl, res;
// ----------------------------------------------------------
if (!iEN||iss=='function') return obj;
if (!!obj.toJS) obj = obj.toJS(... | [
"function",
"FREEZE",
"(",
"obj",
",",
"all",
"=",
"false",
")",
"{",
"if",
"(",
"UoN",
"(",
"obj",
")",
")",
"return",
"obj",
";",
"// ----------------------------------------------------------",
"let",
"iss",
"=",
"ISS",
"(",
"obj",
")",
",",
"iEN",
"=",... | Freeze an Object, if needed.
@param {*} obj The Object to Freeze
@param {Boolean} [all=false] `true`, if Freezing should be recursive
@returns {Object} The frozen Object
@private | [
"Freeze",
"an",
"Object",
"if",
"needed",
"."
] | 2175e20c0ed3405e8956dd9b59cd71e79bef6d16 | https://github.com/DFFR-NT/dffrnt.confs/blob/2175e20c0ed3405e8956dd9b59cd71e79bef6d16/lib/utils.js#L265-L282 | train |
DFFR-NT/dffrnt.confs | lib/utils.js | IDPTYPE | function IDPTYPE() {
let make = ()=>(Math.random().toString(36).slice(2)), rslt = make();
while (global.__PTYPES__.has(rslt)) { rslt = make(); }
return rslt;
} | javascript | function IDPTYPE() {
let make = ()=>(Math.random().toString(36).slice(2)), rslt = make();
while (global.__PTYPES__.has(rslt)) { rslt = make(); }
return rslt;
} | [
"function",
"IDPTYPE",
"(",
")",
"{",
"let",
"make",
"=",
"(",
")",
"=>",
"(",
"Math",
".",
"random",
"(",
")",
".",
"toString",
"(",
"36",
")",
".",
"slice",
"(",
"2",
")",
")",
",",
"rslt",
"=",
"make",
"(",
")",
";",
"while",
"(",
"global"... | Creates a unique ID for `PTypes`
@returns {string} A unique identifier
@private | [
"Creates",
"a",
"unique",
"ID",
"for",
"PTypes"
] | 2175e20c0ed3405e8956dd9b59cd71e79bef6d16 | https://github.com/DFFR-NT/dffrnt.confs/blob/2175e20c0ed3405e8956dd9b59cd71e79bef6d16/lib/utils.js#L312-L316 | train |
DFFR-NT/dffrnt.confs | lib/utils.js | GETCONFIG | function GETCONFIG(name) {
return {
GNConfig: GNConfig,
RouteGN: RouteGN,
RouteAU: RouteAU,
RouteDB: RouteDB,
GNHeaders: GNHeaders,
GNParam: GNParam,
GNDescr: GNDescr,
}[name];
} | javascript | function GETCONFIG(name) {
return {
GNConfig: GNConfig,
RouteGN: RouteGN,
RouteAU: RouteAU,
RouteDB: RouteDB,
GNHeaders: GNHeaders,
GNParam: GNParam,
GNDescr: GNDescr,
}[name];
} | [
"function",
"GETCONFIG",
"(",
"name",
")",
"{",
"return",
"{",
"GNConfig",
":",
"GNConfig",
",",
"RouteGN",
":",
"RouteGN",
",",
"RouteAU",
":",
"RouteAU",
",",
"RouteDB",
":",
"RouteDB",
",",
"GNHeaders",
":",
"GNHeaders",
",",
"GNParam",
":",
"GNParam",
... | Grabs a Config-Type Class
@param {string} name The name of the Config-Type Class
@returns {GNConfig|RouteGN|RouteAU|RouteDB|GNHeaders|GNParam|GNDescr}
@private | [
"Grabs",
"a",
"Config",
"-",
"Type",
"Class"
] | 2175e20c0ed3405e8956dd9b59cd71e79bef6d16 | https://github.com/DFFR-NT/dffrnt.confs/blob/2175e20c0ed3405e8956dd9b59cd71e79bef6d16/lib/utils.js#L325-L335 | train |
DFFR-NT/dffrnt.confs | lib/utils.js | MERGER | function MERGER(oldVal, newVal) {
let onme = CNAME(oldVal), ocon = ISCONFIG(oldVal), otyp = ISPTYPE(oldVal),
nnme = CNAME(newVal), ncon = ISCONFIG(newVal), ntyp = ISPTYPE(newVal);
if (otyp || ntyp) { return newVal; };
if (ocon && ncon && onme==nnme) {
return new GETCONFIG(onme)(Assign(oldVal, newVal));
};... | javascript | function MERGER(oldVal, newVal) {
let onme = CNAME(oldVal), ocon = ISCONFIG(oldVal), otyp = ISPTYPE(oldVal),
nnme = CNAME(newVal), ncon = ISCONFIG(newVal), ntyp = ISPTYPE(newVal);
if (otyp || ntyp) { return newVal; };
if (ocon && ncon && onme==nnme) {
return new GETCONFIG(onme)(Assign(oldVal, newVal));
};... | [
"function",
"MERGER",
"(",
"oldVal",
",",
"newVal",
")",
"{",
"let",
"onme",
"=",
"CNAME",
"(",
"oldVal",
")",
",",
"ocon",
"=",
"ISCONFIG",
"(",
"oldVal",
")",
",",
"otyp",
"=",
"ISPTYPE",
"(",
"oldVal",
")",
",",
"nnme",
"=",
"CNAME",
"(",
"newVa... | A `callback` used in `Immutable`.`mergeWith`
@param {*} oldVal The value of the original Object
@param {*} newVal The value of the merging Object
@returns {*} | [
"A",
"callback",
"used",
"in",
"Immutable",
".",
"mergeWith"
] | 2175e20c0ed3405e8956dd9b59cd71e79bef6d16 | https://github.com/DFFR-NT/dffrnt.confs/blob/2175e20c0ed3405e8956dd9b59cd71e79bef6d16/lib/utils.js#L344-L356 | train |
DFFR-NT/dffrnt.confs | lib/utils.js | ThrowType | function ThrowType(name, type, value, actual) {
console.log('THIS:', this)
let THS = this, pfx = (!!THS ? THS.Name||THS.Scheme : '');
throw new TypeError(
`${pfx} property, [${name}], must be one of the following, <${
type.join('> or <').toTitleCase()
}>. Got <${actual.toTitleCase()}> (${value}) instead... | javascript | function ThrowType(name, type, value, actual) {
console.log('THIS:', this)
let THS = this, pfx = (!!THS ? THS.Name||THS.Scheme : '');
throw new TypeError(
`${pfx} property, [${name}], must be one of the following, <${
type.join('> or <').toTitleCase()
}>. Got <${actual.toTitleCase()}> (${value}) instead... | [
"function",
"ThrowType",
"(",
"name",
",",
"type",
",",
"value",
",",
"actual",
")",
"{",
"console",
".",
"log",
"(",
"'THIS:'",
",",
"this",
")",
"let",
"THS",
"=",
"this",
",",
"pfx",
"=",
"(",
"!",
"!",
"THS",
"?",
"THS",
".",
"Name",
"||",
... | Throws a `TypeError` when a `type` requirement is not met
@param {String} name The `name` of the Property
@param {String} type The `type` the Property should have been
@param {any} value The failed `value`
@param {String} actual The `type` the Value actual is
@private | [
"Throws",
"a",
"TypeError",
"when",
"a",
"type",
"requirement",
"is",
"not",
"met"
] | 2175e20c0ed3405e8956dd9b59cd71e79bef6d16 | https://github.com/DFFR-NT/dffrnt.confs/blob/2175e20c0ed3405e8956dd9b59cd71e79bef6d16/lib/utils.js#L409-L417 | train |
bigpipe/predefine | index.js | descriptor | function descriptor(obj) {
if (!obj || 'object' !== typeof obj || Array.isArray(obj)) return false;
var keys = Object.keys(obj);
//
// A descriptor can only be a data or accessor descriptor, never both.
// An data descriptor can only specify:
//
// - configurable
// - enumerable
// - (optional) valu... | javascript | function descriptor(obj) {
if (!obj || 'object' !== typeof obj || Array.isArray(obj)) return false;
var keys = Object.keys(obj);
//
// A descriptor can only be a data or accessor descriptor, never both.
// An data descriptor can only specify:
//
// - configurable
// - enumerable
// - (optional) valu... | [
"function",
"descriptor",
"(",
"obj",
")",
"{",
"if",
"(",
"!",
"obj",
"||",
"'object'",
"!==",
"typeof",
"obj",
"||",
"Array",
".",
"isArray",
"(",
"obj",
")",
")",
"return",
"false",
";",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"obj",
")"... | Check if a given object is valid as an descriptor.
@param {Object} obj The object with a possible description.
@returns {Boolean}
@api public | [
"Check",
"if",
"a",
"given",
"object",
"is",
"valid",
"as",
"an",
"descriptor",
"."
] | 238137e3d1b8288ff5d7529c3cbcdd371888c26b | https://github.com/bigpipe/predefine/blob/238137e3d1b8288ff5d7529c3cbcdd371888c26b/index.js#L28-L60 | train |
bigpipe/predefine | index.js | predefine | function predefine(obj, pattern) {
pattern = pattern || predefine.READABLE;
return function predefined(method, description, clean) {
//
// If we are given a description compatible Object, use that instead of
// setting it as value. This allows easy creation of getters and setters.
//
if (
... | javascript | function predefine(obj, pattern) {
pattern = pattern || predefine.READABLE;
return function predefined(method, description, clean) {
//
// If we are given a description compatible Object, use that instead of
// setting it as value. This allows easy creation of getters and setters.
//
if (
... | [
"function",
"predefine",
"(",
"obj",
",",
"pattern",
")",
"{",
"pattern",
"=",
"pattern",
"||",
"predefine",
".",
"READABLE",
";",
"return",
"function",
"predefined",
"(",
"method",
",",
"description",
",",
"clean",
")",
"{",
"//",
"// If we are given a descri... | Predefine, preconfigure an Object.defineProperty.
@param {Object} obj The context, prototype or object we define on.
@param {Object} pattern The default description.
@param {Boolean} override Override the pattern.
@returns {Function} The function definition.
@api public | [
"Predefine",
"preconfigure",
"an",
"Object",
".",
"defineProperty",
"."
] | 238137e3d1b8288ff5d7529c3cbcdd371888c26b | https://github.com/bigpipe/predefine/blob/238137e3d1b8288ff5d7529c3cbcdd371888c26b/index.js#L83-L117 | train |
bigpipe/predefine | index.js | lazy | function lazy(obj, prop, fn) {
Object.defineProperty(obj, prop, {
configurable: true,
get: function get() {
return Object.defineProperty(this, prop, {
value: fn.call(this)
})[prop];
},
set: function set(value) {
return Object.defineProperty(this, prop, {
value: valu... | javascript | function lazy(obj, prop, fn) {
Object.defineProperty(obj, prop, {
configurable: true,
get: function get() {
return Object.defineProperty(this, prop, {
value: fn.call(this)
})[prop];
},
set: function set(value) {
return Object.defineProperty(this, prop, {
value: valu... | [
"function",
"lazy",
"(",
"obj",
",",
"prop",
",",
"fn",
")",
"{",
"Object",
".",
"defineProperty",
"(",
"obj",
",",
"prop",
",",
"{",
"configurable",
":",
"true",
",",
"get",
":",
"function",
"get",
"(",
")",
"{",
"return",
"Object",
".",
"defineProp... | Lazy initialization pattern.
@param {Object} obj The object where we need to add lazy loading prop.
@param {String} prop The name of the property that should lazy load.
@param {Function} fn The function that returns the lazy laoded value.
@api public | [
"Lazy",
"initialization",
"pattern",
"."
] | 238137e3d1b8288ff5d7529c3cbcdd371888c26b | https://github.com/bigpipe/predefine/blob/238137e3d1b8288ff5d7529c3cbcdd371888c26b/index.js#L127-L143 | train |
bigpipe/predefine | index.js | remove | function remove(obj, keep) {
if (!obj) return false;
keep = keep || [];
for (var prop in obj) {
if (has.call(obj, prop) && !~keep.indexOf(prop)) {
delete obj[prop];
}
}
return true;
} | javascript | function remove(obj, keep) {
if (!obj) return false;
keep = keep || [];
for (var prop in obj) {
if (has.call(obj, prop) && !~keep.indexOf(prop)) {
delete obj[prop];
}
}
return true;
} | [
"function",
"remove",
"(",
"obj",
",",
"keep",
")",
"{",
"if",
"(",
"!",
"obj",
")",
"return",
"false",
";",
"keep",
"=",
"keep",
"||",
"[",
"]",
";",
"for",
"(",
"var",
"prop",
"in",
"obj",
")",
"{",
"if",
"(",
"has",
".",
"call",
"(",
"obj"... | Remove all enumerable properties from an given object.
@param {Object} obj The object that needs cleaning.
@param {Array} keep Properties that should be kept.
@api public | [
"Remove",
"all",
"enumerable",
"properties",
"from",
"an",
"given",
"object",
"."
] | 238137e3d1b8288ff5d7529c3cbcdd371888c26b | https://github.com/bigpipe/predefine/blob/238137e3d1b8288ff5d7529c3cbcdd371888c26b/index.js#L162-L173 | train |
bigpipe/predefine | index.js | mixin | function mixin(target) {
Array.prototype.slice.call(arguments, 1).forEach(function forEach(o) {
Object.getOwnPropertyNames(o).forEach(function eachAttr(attr) {
Object.defineProperty(target, attr, Object.getOwnPropertyDescriptor(o, attr));
});
});
return target;
} | javascript | function mixin(target) {
Array.prototype.slice.call(arguments, 1).forEach(function forEach(o) {
Object.getOwnPropertyNames(o).forEach(function eachAttr(attr) {
Object.defineProperty(target, attr, Object.getOwnPropertyDescriptor(o, attr));
});
});
return target;
} | [
"function",
"mixin",
"(",
"target",
")",
"{",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
",",
"1",
")",
".",
"forEach",
"(",
"function",
"forEach",
"(",
"o",
")",
"{",
"Object",
".",
"getOwnPropertyNames",
"(",
"o",
")",
... | Mix multiple objects in to one single object that contains the properties of
all given objects. This assumes objects that are not nested deeply and it
correctly transfers objects that were created using `Object.defineProperty`.
@returns {Object} target
@api public | [
"Mix",
"multiple",
"objects",
"in",
"to",
"one",
"single",
"object",
"that",
"contains",
"the",
"properties",
"of",
"all",
"given",
"objects",
".",
"This",
"assumes",
"objects",
"that",
"are",
"not",
"nested",
"deeply",
"and",
"it",
"correctly",
"transfers",
... | 238137e3d1b8288ff5d7529c3cbcdd371888c26b | https://github.com/bigpipe/predefine/blob/238137e3d1b8288ff5d7529c3cbcdd371888c26b/index.js#L206-L214 | train |
bigpipe/predefine | index.js | each | function each(collection, iterator, context) {
if (arguments.length === 1) {
iterator = collection;
collection = this;
}
var isArray = Array.isArray(collection || this)
, length = collection.length
, i = 0
, value;
if (context) {
if (isArray) {
for (; i < length; i++) {
v... | javascript | function each(collection, iterator, context) {
if (arguments.length === 1) {
iterator = collection;
collection = this;
}
var isArray = Array.isArray(collection || this)
, length = collection.length
, i = 0
, value;
if (context) {
if (isArray) {
for (; i < length; i++) {
v... | [
"function",
"each",
"(",
"collection",
",",
"iterator",
",",
"context",
")",
"{",
"if",
"(",
"arguments",
".",
"length",
"===",
"1",
")",
"{",
"iterator",
"=",
"collection",
";",
"collection",
"=",
"this",
";",
"}",
"var",
"isArray",
"=",
"Array",
".",... | Iterate over a collection. When you return false, it will stop the iteration.
@param {Mixed} collection Either an Array or Object.
@param {Function} iterator Function to be called for each item.
@param {Mixed} context The context for the iterator.
@api public | [
"Iterate",
"over",
"a",
"collection",
".",
"When",
"you",
"return",
"false",
"it",
"will",
"stop",
"the",
"iteration",
"."
] | 238137e3d1b8288ff5d7529c3cbcdd371888c26b | https://github.com/bigpipe/predefine/blob/238137e3d1b8288ff5d7529c3cbcdd371888c26b/index.js#L223-L261 | train |
vigour-io/postcssify | lib/index.js | init | function init (file) {
if (!postcssify.entry) {
if (dest) {
log.info('output: %s', dest)
process.on('beforeExit', () => {
if (!postcssify.complete) {
postcssify.complete = true
bundle()
}
})
postcssify.entry = file
} else {
return
}
}
r... | javascript | function init (file) {
if (!postcssify.entry) {
if (dest) {
log.info('output: %s', dest)
process.on('beforeExit', () => {
if (!postcssify.complete) {
postcssify.complete = true
bundle()
}
})
postcssify.entry = file
} else {
return
}
}
r... | [
"function",
"init",
"(",
"file",
")",
"{",
"if",
"(",
"!",
"postcssify",
".",
"entry",
")",
"{",
"if",
"(",
"dest",
")",
"{",
"log",
".",
"info",
"(",
"'output: %s'",
",",
"dest",
")",
"process",
".",
"on",
"(",
"'beforeExit'",
",",
"(",
")",
"=>... | init => returns false if no dest is defined | [
"init",
"=",
">",
"returns",
"false",
"if",
"no",
"dest",
"is",
"defined"
] | f7b1c7fc31bba4d0bc9c59eba0caf6eccabc1a66 | https://github.com/vigour-io/postcssify/blob/f7b1c7fc31bba4d0bc9c59eba0caf6eccabc1a66/lib/index.js#L68-L84 | train |
vigour-io/postcssify | lib/index.js | bundle | function bundle () {
const ordered = order(deps[postcssify.entry], [], {})
const l = ordered.length
let ast
for (let i = 0; i < l; i++) {
const file = ordered[i]
const style = styles[file]
if (style === void 0) {
return
} else {
if (!ast) {
ast = style.clone()
} else {
... | javascript | function bundle () {
const ordered = order(deps[postcssify.entry], [], {})
const l = ordered.length
let ast
for (let i = 0; i < l; i++) {
const file = ordered[i]
const style = styles[file]
if (style === void 0) {
return
} else {
if (!ast) {
ast = style.clone()
} else {
... | [
"function",
"bundle",
"(",
")",
"{",
"const",
"ordered",
"=",
"order",
"(",
"deps",
"[",
"postcssify",
".",
"entry",
"]",
",",
"[",
"]",
",",
"{",
"}",
")",
"const",
"l",
"=",
"ordered",
".",
"length",
"let",
"ast",
"for",
"(",
"let",
"i",
"=",
... | concat and bundle css | [
"concat",
"and",
"bundle",
"css"
] | f7b1c7fc31bba4d0bc9c59eba0caf6eccabc1a66 | https://github.com/vigour-io/postcssify/blob/f7b1c7fc31bba4d0bc9c59eba0caf6eccabc1a66/lib/index.js#L301-L329 | train |
vigour-io/postcssify | lib/index.js | order | function order (d, arr, visited) {
for (let i in d) {
if (!visited[i]) {
let obj = d[i]
visited[i] = true
arr = arr.concat(order(obj, [], visited))
if (css(i)) {
arr.push(i)
}
}
}
return arr
} | javascript | function order (d, arr, visited) {
for (let i in d) {
if (!visited[i]) {
let obj = d[i]
visited[i] = true
arr = arr.concat(order(obj, [], visited))
if (css(i)) {
arr.push(i)
}
}
}
return arr
} | [
"function",
"order",
"(",
"d",
",",
"arr",
",",
"visited",
")",
"{",
"for",
"(",
"let",
"i",
"in",
"d",
")",
"{",
"if",
"(",
"!",
"visited",
"[",
"i",
"]",
")",
"{",
"let",
"obj",
"=",
"d",
"[",
"i",
"]",
"visited",
"[",
"i",
"]",
"=",
"t... | walk deps and return ordered array | [
"walk",
"deps",
"and",
"return",
"ordered",
"array"
] | f7b1c7fc31bba4d0bc9c59eba0caf6eccabc1a66 | https://github.com/vigour-io/postcssify/blob/f7b1c7fc31bba4d0bc9c59eba0caf6eccabc1a66/lib/index.js#L352-L364 | train |
MarkGriffiths/string | src/index.js | pad | function pad(str, length, char) {
return new BespokeString(str).pad(length, char).toString()
} | javascript | function pad(str, length, char) {
return new BespokeString(str).pad(length, char).toString()
} | [
"function",
"pad",
"(",
"str",
",",
"length",
",",
"char",
")",
"{",
"return",
"new",
"BespokeString",
"(",
"str",
")",
".",
"pad",
"(",
"length",
",",
"char",
")",
".",
"toString",
"(",
")",
"}"
] | Helper method for padding a string.
@param {String} str The string to pad.
@param {Number} length Target length.
@param {String} char Character to use for pad.
@return {String} The padded string. | [
"Helper",
"method",
"for",
"padding",
"a",
"string",
"."
] | 699a4404d53501c719c34e649a34376a66ff8c62 | https://github.com/MarkGriffiths/string/blob/699a4404d53501c719c34e649a34376a66ff8c62/src/index.js#L133-L135 | train |
LeisureLink/magicbus | lib/queue-machine.js | function(callback, options) {
return new Promise((resolve, reject) => {
let op = () => {
return this.channel.subscribe(callback, options)
.then(resolve, reject);
};
this.on('failed', function(err) {
reject(err);
}).once();
this.handle('subscr... | javascript | function(callback, options) {
return new Promise((resolve, reject) => {
let op = () => {
return this.channel.subscribe(callback, options)
.then(resolve, reject);
};
this.on('failed', function(err) {
reject(err);
}).once();
this.handle('subscr... | [
"function",
"(",
"callback",
",",
"options",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"let",
"op",
"=",
"(",
")",
"=>",
"{",
"return",
"this",
".",
"channel",
".",
"subscribe",
"(",
"callback",
",",
... | Subscribe to the queue
@public
@memberOf QueueMachine.prototype
@param {Function} callback - the function to be called with each message
@param {Object} options - details in consuming from the queue
@param {Number} options.limit - the channel prefetch limit
@param {bool} options.noBatch - if true, ack/nack/reject oper... | [
"Subscribe",
"to",
"the",
"queue"
] | 0370c38ebb8c7917cfd3894263d734aefc2d3d29 | https://github.com/LeisureLink/magicbus/blob/0370c38ebb8c7917cfd3894263d734aefc2d3d29/lib/queue-machine.js#L92-L103 | train | |
cronvel/kung-fig-expression | lib/Expression.js | parseFnKeyConst | function parseFnKeyConst( str_ , runtime ) {
var separatorIndex = nextSeparator( str_ , runtime ) ;
var str = str_.slice( runtime.i , separatorIndex ) ;
//console.log( 'str before:' , str_ ) ;
//console.log( 'str after:' , str ) ;
//var indexOf ;
//str = str.slice( runtime.i , runtime.iEndOfLine ) ;
//if ( ( i... | javascript | function parseFnKeyConst( str_ , runtime ) {
var separatorIndex = nextSeparator( str_ , runtime ) ;
var str = str_.slice( runtime.i , separatorIndex ) ;
//console.log( 'str before:' , str_ ) ;
//console.log( 'str after:' , str ) ;
//var indexOf ;
//str = str.slice( runtime.i , runtime.iEndOfLine ) ;
//if ( ( i... | [
"function",
"parseFnKeyConst",
"(",
"str_",
",",
"runtime",
")",
"{",
"var",
"separatorIndex",
"=",
"nextSeparator",
"(",
"str_",
",",
"runtime",
")",
";",
"var",
"str",
"=",
"str_",
".",
"slice",
"(",
"runtime",
".",
"i",
",",
"separatorIndex",
")",
";"... | An identifier that is a function, a key or a constant | [
"An",
"identifier",
"that",
"is",
"a",
"function",
"a",
"key",
"or",
"a",
"constant"
] | b9aae3aa2e3a5fdfc13fb6c76794526764485c5b | https://github.com/cronvel/kung-fig-expression/blob/b9aae3aa2e3a5fdfc13fb6c76794526764485c5b/lib/Expression.js#L668-L705 | train |
vamship/config | src/config.js | function(scope) {
if (!_argValidator.checkString(scope)) {
scope = _applicationScope;
}
let config = _configCache[scope];
if (!config) {
const data = _deepDefaults(
_deepDefaults({}, _config[scope]),
_config.default
);
... | javascript | function(scope) {
if (!_argValidator.checkString(scope)) {
scope = _applicationScope;
}
let config = _configCache[scope];
if (!config) {
const data = _deepDefaults(
_deepDefaults({}, _config[scope]),
_config.default
);
... | [
"function",
"(",
"scope",
")",
"{",
"if",
"(",
"!",
"_argValidator",
".",
"checkString",
"(",
"scope",
")",
")",
"{",
"scope",
"=",
"_applicationScope",
";",
"}",
"let",
"config",
"=",
"_configCache",
"[",
"scope",
"]",
";",
"if",
"(",
"!",
"config",
... | Returns a configuration object that is scoped to a specific environment.
This configuration object will return default application configuration
properties, overridden by environment speicific values.
@param {String} [scope=<default scope>] The name of the environment for
which the application configuration object wil... | [
"Returns",
"a",
"configuration",
"object",
"that",
"is",
"scoped",
"to",
"a",
"specific",
"environment",
".",
"This",
"configuration",
"object",
"will",
"return",
"default",
"application",
"configuration",
"properties",
"overridden",
"by",
"environment",
"speicific",
... | 4678290c4c272efcbc629c91031f867a85d92781 | https://github.com/vamship/config/blob/4678290c4c272efcbc629c91031f867a85d92781/src/config.js#L155-L173 | train | |
veo-labs/openveo-api | lib/multipart/MultipartParser.js | MultipartParser | function MultipartParser(request, fileFields, limits) {
Object.defineProperties(this, {
/**
* The HTTP request containing a multipart body.
*
* @property request
* @type Request
* @final
*/
request: {value: request},
/**
* The list of file field descriptors.
*
... | javascript | function MultipartParser(request, fileFields, limits) {
Object.defineProperties(this, {
/**
* The HTTP request containing a multipart body.
*
* @property request
* @type Request
* @final
*/
request: {value: request},
/**
* The list of file field descriptors.
*
... | [
"function",
"MultipartParser",
"(",
"request",
",",
"fileFields",
",",
"limits",
")",
"{",
"Object",
".",
"defineProperties",
"(",
"this",
",",
"{",
"/**\n * The HTTP request containing a multipart body.\n *\n * @property request\n * @type Request\n * @final\n ... | Defines a multipart parser to parse multipart requests.
Use MultipartParser to get fields from multipart requests (including files).
@example
// Get multipart parser
var MultipartParser = require('@openveo/api').multipart.MultipartParser;
// Create a request parser expecting several files: files in photos "field" a... | [
"Defines",
"a",
"multipart",
"parser",
"to",
"parse",
"multipart",
"requests",
"."
] | 493a811e9a5ba4d3e14910facaa7452caba1ab38 | https://github.com/veo-labs/openveo-api/blob/493a811e9a5ba4d3e14910facaa7452caba1ab38/lib/multipart/MultipartParser.js#L67-L110 | train |
Bartvds/ministyle | lib/common.js | plain | function plain() {
var mw = core.base();
mw.plain = function (str) {
return String(str);
};
mw.error = function (str) {
return mw.plain(str);
};
mw.warning = function (str) {
return mw.plain(str);
};
mw.success = function (str) {
return mw.plain(str);
};
mw.accent = function (str) {
... | javascript | function plain() {
var mw = core.base();
mw.plain = function (str) {
return String(str);
};
mw.error = function (str) {
return mw.plain(str);
};
mw.warning = function (str) {
return mw.plain(str);
};
mw.success = function (str) {
return mw.plain(str);
};
mw.accent = function (str) {
... | [
"function",
"plain",
"(",
")",
"{",
"var",
"mw",
"=",
"core",
".",
"base",
"(",
")",
";",
"mw",
".",
"plain",
"=",
"function",
"(",
"str",
")",
"{",
"return",
"String",
"(",
"str",
")",
";",
"}",
";",
"mw",
".",
"error",
"=",
"function",
"(",
... | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - plain text | [
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"... | 92681e81d4c93faddd4e5d1d6edf44990b3a9e68 | https://github.com/Bartvds/ministyle/blob/92681e81d4c93faddd4e5d1d6edf44990b3a9e68/lib/common.js#L50-L75 | train |
Bartvds/ministyle | lib/common.js | empty | function empty() {
var mw = plain();
mw.plain = function (str) {
str = String(str);
var ret = '';
for (var i = 0; i < str.length; i++) {
ret += ' ';
}
return ret;
};
mw.toString = function () {
return '<ministyle-empty>';
};
return mw;
} | javascript | function empty() {
var mw = plain();
mw.plain = function (str) {
str = String(str);
var ret = '';
for (var i = 0; i < str.length; i++) {
ret += ' ';
}
return ret;
};
mw.toString = function () {
return '<ministyle-empty>';
};
return mw;
} | [
"function",
"empty",
"(",
")",
"{",
"var",
"mw",
"=",
"plain",
"(",
")",
";",
"mw",
".",
"plain",
"=",
"function",
"(",
"str",
")",
"{",
"str",
"=",
"String",
"(",
"str",
")",
";",
"var",
"ret",
"=",
"''",
";",
"for",
"(",
"var",
"i",
"=",
... | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - return empty spaces | [
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"... | 92681e81d4c93faddd4e5d1d6edf44990b3a9e68 | https://github.com/Bartvds/ministyle/blob/92681e81d4c93faddd4e5d1d6edf44990b3a9e68/lib/common.js#L114-L129 | train |
feedhenry/fh-component-metrics | lib/clients/influxdb.js | influxUdp | function influxUdp(opts) {
BaseClient.apply(this, arguments);
opts = opts || {};
this.host = opts.host || '127.0.0.1';
this.port = opts.port || 4444;
this.socket = dgram.createSocket('udp4');
} | javascript | function influxUdp(opts) {
BaseClient.apply(this, arguments);
opts = opts || {};
this.host = opts.host || '127.0.0.1';
this.port = opts.port || 4444;
this.socket = dgram.createSocket('udp4');
} | [
"function",
"influxUdp",
"(",
"opts",
")",
"{",
"BaseClient",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"opts",
"=",
"opts",
"||",
"{",
"}",
";",
"this",
".",
"host",
"=",
"opts",
".",
"host",
"||",
"'127.0.0.1'",
";",
"this",
".",
"po... | A client that can send data to Influxdb backend via UDP
@param {Object} opts options about the influxdb backend
@param {String} opts.host the host of the influxdb. Default is 127.0.0.1
@param {Number} opts.port the port of the UDP port of influxdb. Default is 4444.
@param {Number} opts.sendQueueConcurrency specify the ... | [
"A",
"client",
"that",
"can",
"send",
"data",
"to",
"Influxdb",
"backend",
"via",
"UDP"
] | c97a1a82ff0144f2a7c2abecbc22084fade1cbc8 | https://github.com/feedhenry/fh-component-metrics/blob/c97a1a82ff0144f2a7c2abecbc22084fade1cbc8/lib/clients/influxdb.js#L13-L19 | train |
Mammut-FE/nejm | src/util/dispatcher/dispatcher.js | function(_url,_href){
if (!_url) return;
var _info = location.parse(_url);
this._$dispatchEvent('onbeforechange',_info);
var _umi = this.__doRewriteUMI(
_info.path,_href||_info.href
);
return this.__groups[this.__pbseed]._$hasUMI(_u... | javascript | function(_url,_href){
if (!_url) return;
var _info = location.parse(_url);
this._$dispatchEvent('onbeforechange',_info);
var _umi = this.__doRewriteUMI(
_info.path,_href||_info.href
);
return this.__groups[this.__pbseed]._$hasUMI(_u... | [
"function",
"(",
"_url",
",",
"_href",
")",
"{",
"if",
"(",
"!",
"_url",
")",
"return",
";",
"var",
"_info",
"=",
"location",
".",
"parse",
"(",
"_url",
")",
";",
"this",
".",
"_$dispatchEvent",
"(",
"'onbeforechange'",
",",
"_info",
")",
";",
"var",... | check event need delegated | [
"check",
"event",
"need",
"delegated"
] | dfc09ac66a8d67620a7aea65e34d8a179976b3fb | https://github.com/Mammut-FE/nejm/blob/dfc09ac66a8d67620a7aea65e34d8a179976b3fb/src/util/dispatcher/dispatcher.js#L538-L546 | train | |
Mammut-FE/nejm | src/util/dispatcher/dispatcher.js | function(_target,_message){
var _from = _message.from;
while(!!_target){
if (_target._$getPath()!=_from){
_doSendMessage(_target,_message);
}
_target = _target._$getParent();
}
... | javascript | function(_target,_message){
var _from = _message.from;
while(!!_target){
if (_target._$getPath()!=_from){
_doSendMessage(_target,_message);
}
_target = _target._$getParent();
}
... | [
"function",
"(",
"_target",
",",
"_message",
")",
"{",
"var",
"_from",
"=",
"_message",
".",
"from",
";",
"while",
"(",
"!",
"!",
"_target",
")",
"{",
"if",
"(",
"_target",
".",
"_$getPath",
"(",
")",
"!=",
"_from",
")",
"{",
"_doSendMessage",
"(",
... | send message to every node in target path | [
"send",
"message",
"to",
"every",
"node",
"in",
"target",
"path"
] | dfc09ac66a8d67620a7aea65e34d8a179976b3fb | https://github.com/Mammut-FE/nejm/blob/dfc09ac66a8d67620a7aea65e34d8a179976b3fb/src/util/dispatcher/dispatcher.js#L983-L991 | train | |
Mammut-FE/nejm | src/util/dispatcher/dispatcher.js | function(_target,_message){
var _from = _message.from;
_t3._$breadthFirstSearch(
_target,function(_node){
if (_node._$getPath()!=_from){
_doSendMessage(_node,_message);
}
}... | javascript | function(_target,_message){
var _from = _message.from;
_t3._$breadthFirstSearch(
_target,function(_node){
if (_node._$getPath()!=_from){
_doSendMessage(_node,_message);
}
}... | [
"function",
"(",
"_target",
",",
"_message",
")",
"{",
"var",
"_from",
"=",
"_message",
".",
"from",
";",
"_t3",
".",
"_$breadthFirstSearch",
"(",
"_target",
",",
"function",
"(",
"_node",
")",
"{",
"if",
"(",
"_node",
".",
"_$getPath",
"(",
")",
"!=",... | broadcast to all target descendants | [
"broadcast",
"to",
"all",
"target",
"descendants"
] | dfc09ac66a8d67620a7aea65e34d8a179976b3fb | https://github.com/Mammut-FE/nejm/blob/dfc09ac66a8d67620a7aea65e34d8a179976b3fb/src/util/dispatcher/dispatcher.js#L993-L1002 | train | |
ibm-bluemix-mobile-services/bms-mca-token-validation-strategy | lib/util/token-decoder.js | doTokenValidation | function doTokenValidation(token,publicKey,appId) {
var parts = token.split('.');
if (parts.length < 3) {
ibmlogger.getLogger().debug("The token decode failure details:", token);
return Q.reject(RejectionMessage("The token is malformed.", token,RejectionMessage.INVALID_TOKEN_ERROR));
}
... | javascript | function doTokenValidation(token,publicKey,appId) {
var parts = token.split('.');
if (parts.length < 3) {
ibmlogger.getLogger().debug("The token decode failure details:", token);
return Q.reject(RejectionMessage("The token is malformed.", token,RejectionMessage.INVALID_TOKEN_ERROR));
}
... | [
"function",
"doTokenValidation",
"(",
"token",
",",
"publicKey",
",",
"appId",
")",
"{",
"var",
"parts",
"=",
"token",
".",
"split",
"(",
"'.'",
")",
";",
"if",
"(",
"parts",
".",
"length",
"<",
"3",
")",
"{",
"ibmlogger",
".",
"getLogger",
"(",
")",... | Verify the token with the public key.
And validate the exp, iss and aud with the decoded token. | [
"Verify",
"the",
"token",
"with",
"the",
"public",
"key",
".",
"And",
"validate",
"the",
"exp",
"iss",
"and",
"aud",
"with",
"the",
"decoded",
"token",
"."
] | 56c2a7a6cb5a55b75eee3b4da6c5ac801b793a0f | https://github.com/ibm-bluemix-mobile-services/bms-mca-token-validation-strategy/blob/56c2a7a6cb5a55b75eee3b4da6c5ac801b793a0f/lib/util/token-decoder.js#L76-L132 | train |
Everyplay/serverbone | lib/errors/validation_error.js | getErrorMessage | function getErrorMessage(errors) {
if (_.isArray(errors)) {
return _.uniq(_.pluck(errors, 'stack')).join().replace(/instance./g, '');
} else if (errors) {
return errors.message;
}
} | javascript | function getErrorMessage(errors) {
if (_.isArray(errors)) {
return _.uniq(_.pluck(errors, 'stack')).join().replace(/instance./g, '');
} else if (errors) {
return errors.message;
}
} | [
"function",
"getErrorMessage",
"(",
"errors",
")",
"{",
"if",
"(",
"_",
".",
"isArray",
"(",
"errors",
")",
")",
"{",
"return",
"_",
".",
"uniq",
"(",
"_",
".",
"pluck",
"(",
"errors",
",",
"'stack'",
")",
")",
".",
"join",
"(",
")",
".",
"replac... | convert errors given by jsonschema | [
"convert",
"errors",
"given",
"by",
"jsonschema"
] | 214cf2a5b003c99d8c353f3a750f36309f0f19a2 | https://github.com/Everyplay/serverbone/blob/214cf2a5b003c99d8c353f3a750f36309f0f19a2/lib/errors/validation_error.js#L6-L12 | train |
cronvel/logfella | lib/messageFormatter.js | message | function message( data , color ) {
var k , messageString = '' ;
if ( data.mon ) {
messageString = '\n' ;
if ( color ) {
for ( k in data.mon ) {
messageString += string.ansi.green + k + string.ansi.reset + ': ' +
string.ansi.cyan + data.mon[ k ] + string.ansi.reset + '\n' ;
}
}
else {
for (... | javascript | function message( data , color ) {
var k , messageString = '' ;
if ( data.mon ) {
messageString = '\n' ;
if ( color ) {
for ( k in data.mon ) {
messageString += string.ansi.green + k + string.ansi.reset + ': ' +
string.ansi.cyan + data.mon[ k ] + string.ansi.reset + '\n' ;
}
}
else {
for (... | [
"function",
"message",
"(",
"data",
",",
"color",
")",
"{",
"var",
"k",
",",
"messageString",
"=",
"''",
";",
"if",
"(",
"data",
".",
"mon",
")",
"{",
"messageString",
"=",
"'\\n'",
";",
"if",
"(",
"color",
")",
"{",
"for",
"(",
"k",
"in",
"data"... | Turn style markup off | [
"Turn",
"style",
"markup",
"off"
] | 1b46d80a108d6ad51f9f1732619232de8ff0af53 | https://github.com/cronvel/logfella/blob/1b46d80a108d6ad51f9f1732619232de8ff0af53/lib/messageFormatter.js#L43-L78 | train |
cronvel/logfella | lib/messageFormatter.js | hashSymbol | function hashSymbol( value ) {
var i , iMax , hash = 0 , output , offset ;
value = '' + value ;
// At least 3 passes
offset = 3 * 16 / value.length ;
for ( i = 0 , iMax = value.length ; i < iMax ; i ++ ) {
hash ^= value.charCodeAt( i ) << ( ( i * offset ) % 16 ) ;
//hash += value.charCodeAt( i ) ;
//hash ... | javascript | function hashSymbol( value ) {
var i , iMax , hash = 0 , output , offset ;
value = '' + value ;
// At least 3 passes
offset = 3 * 16 / value.length ;
for ( i = 0 , iMax = value.length ; i < iMax ; i ++ ) {
hash ^= value.charCodeAt( i ) << ( ( i * offset ) % 16 ) ;
//hash += value.charCodeAt( i ) ;
//hash ... | [
"function",
"hashSymbol",
"(",
"value",
")",
"{",
"var",
"i",
",",
"iMax",
",",
"hash",
"=",
"0",
",",
"output",
",",
"offset",
";",
"value",
"=",
"''",
"+",
"value",
";",
"// At least 3 passes",
"offset",
"=",
"3",
"*",
"16",
"/",
"value",
".",
"l... | Naive CRC-like algorithm | [
"Naive",
"CRC",
"-",
"like",
"algorithm"
] | 1b46d80a108d6ad51f9f1732619232de8ff0af53 | https://github.com/cronvel/logfella/blob/1b46d80a108d6ad51f9f1732619232de8ff0af53/lib/messageFormatter.js#L95-L121 | train |
andrewscwei/gulp-prismic-mpa-builder | helpers/task-helpers.js | globExts | function globExts() {
let exts = _.flattenDeep(_.concat.apply(null, arguments));
return (exts.length <= 1) ? (exts[0] && `.${exts[0]}` || ``) : `.{${exts.join(`,`)}}`;
} | javascript | function globExts() {
let exts = _.flattenDeep(_.concat.apply(null, arguments));
return (exts.length <= 1) ? (exts[0] && `.${exts[0]}` || ``) : `.{${exts.join(`,`)}}`;
} | [
"function",
"globExts",
"(",
")",
"{",
"let",
"exts",
"=",
"_",
".",
"flattenDeep",
"(",
"_",
".",
"concat",
".",
"apply",
"(",
"null",
",",
"arguments",
")",
")",
";",
"return",
"(",
"exts",
".",
"length",
"<=",
"1",
")",
"?",
"(",
"exts",
"[",
... | Returns a wildcard glob pattern of the specified file extensions.
@param {...(string|string[])} extensions - Extensions to be included in the
wildcard pattern.
@return {string} - Wildcard glob pattern consisting of all specified
extensions. | [
"Returns",
"a",
"wildcard",
"glob",
"pattern",
"of",
"the",
"specified",
"file",
"extensions",
"."
] | c7fb9180de2aeca2657f0318c0befbd166a9bff5 | https://github.com/andrewscwei/gulp-prismic-mpa-builder/blob/c7fb9180de2aeca2657f0318c0befbd166a9bff5/helpers/task-helpers.js#L121-L124 | train |
LeisureLink/magicbus | lib/amqp/machine-factory.js | function() {
this.emit('acquiring');
const onAcquisitionError = (err) => {
logger.debug('Resource acquisition failed with error', err);
this.emit('failed', err);
this.handle('failed');
};
const onAcquired = (o) => {
this.item = o;
this.waitInterval = 0;
... | javascript | function() {
this.emit('acquiring');
const onAcquisitionError = (err) => {
logger.debug('Resource acquisition failed with error', err);
this.emit('failed', err);
this.handle('failed');
};
const onAcquired = (o) => {
this.item = o;
this.waitInterval = 0;
... | [
"function",
"(",
")",
"{",
"this",
".",
"emit",
"(",
"'acquiring'",
")",
";",
"const",
"onAcquisitionError",
"=",
"(",
"err",
")",
"=>",
"{",
"logger",
".",
"debug",
"(",
"'Resource acquisition failed with error'",
",",
"err",
")",
";",
"this",
".",
"emit"... | Does the work in acquiring a resource and sets up events for state transitions.
@private
@memberOf PromiseMachine.prototype | [
"Does",
"the",
"work",
"in",
"acquiring",
"a",
"resource",
"and",
"sets",
"up",
"events",
"for",
"state",
"transitions",
"."
] | 0370c38ebb8c7917cfd3894263d734aefc2d3d29 | https://github.com/LeisureLink/magicbus/blob/0370c38ebb8c7917cfd3894263d734aefc2d3d29/lib/amqp/machine-factory.js#L40-L74 | train | |
1stdibs/backbone-base-and-form-view | backbone-baseview.js | function (str) {
var arr = str.split('.');
var obj = root[arr.shift()];
while (arr.length && obj) {
obj = obj[arr.shift()];
}
return obj;
} | javascript | function (str) {
var arr = str.split('.');
var obj = root[arr.shift()];
while (arr.length && obj) {
obj = obj[arr.shift()];
}
return obj;
} | [
"function",
"(",
"str",
")",
"{",
"var",
"arr",
"=",
"str",
".",
"split",
"(",
"'.'",
")",
";",
"var",
"obj",
"=",
"root",
"[",
"arr",
".",
"shift",
"(",
")",
"]",
";",
"while",
"(",
"arr",
".",
"length",
"&&",
"obj",
")",
"{",
"obj",
"=",
... | Finds globally dot noted namespaced objects from a string | [
"Finds",
"globally",
"dot",
"noted",
"namespaced",
"objects",
"from",
"a",
"string"
] | 9c49f9ac059ba3177b61f7395151de78b506e8f7 | https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-baseview.js#L22-L30 | train | |
1stdibs/backbone-base-and-form-view | backbone-baseview.js | function (name, instance, singleton) {
var arr = (isArray(name)) ? name : (isArray(instance)) ? instance : undefined; // If its a simple array of subviews or configs
var map = (!arr && isObject(name) && name instanceof View === false) ? name : undefined; // If its a mapping of subviews
... | javascript | function (name, instance, singleton) {
var arr = (isArray(name)) ? name : (isArray(instance)) ? instance : undefined; // If its a simple array of subviews or configs
var map = (!arr && isObject(name) && name instanceof View === false) ? name : undefined; // If its a mapping of subviews
... | [
"function",
"(",
"name",
",",
"instance",
",",
"singleton",
")",
"{",
"var",
"arr",
"=",
"(",
"isArray",
"(",
"name",
")",
")",
"?",
"name",
":",
"(",
"isArray",
"(",
"instance",
")",
")",
"?",
"instance",
":",
"undefined",
";",
"// If its a simple arr... | Adds a subView or subViews to the View's list of subViews. Calling
function must provide instances of views or configurations.
@memberOf SubViewManager#
@class SubViewManager
@type {SubViewManager}
@method add
@param {Object} map
An object with key's to refer to subViews and values that
are View instances, options to p... | [
"Adds",
"a",
"subView",
"or",
"subViews",
"to",
"the",
"View",
"s",
"list",
"of",
"subViews",
".",
"Calling",
"function",
"must",
"provide",
"instances",
"of",
"views",
"or",
"configurations",
"."
] | 9c49f9ac059ba3177b61f7395151de78b506e8f7 | https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-baseview.js#L162-L218 | train | |
1stdibs/backbone-base-and-form-view | backbone-baseview.js | function (key, instance) {
if (key instanceof View) {
instance = key;
key = undefined;
}
this._addInstance(key, instance);
return this;
} | javascript | function (key, instance) {
if (key instanceof View) {
instance = key;
key = undefined;
}
this._addInstance(key, instance);
return this;
} | [
"function",
"(",
"key",
",",
"instance",
")",
"{",
"if",
"(",
"key",
"instanceof",
"View",
")",
"{",
"instance",
"=",
"key",
";",
"key",
"=",
"undefined",
";",
"}",
"this",
".",
"_addInstance",
"(",
"key",
",",
"instance",
")",
";",
"return",
"this",... | Add a subview instance. If is has a config,
the instance will be associated with that
config. If the config specifies that the
view is a singleton an a view for that
key already exists, it will not be added.
@param {string|number} key
@param {Backbone.View} instance
Add a subview instance, without a key.
Since it doe... | [
"Add",
"a",
"subview",
"instance",
".",
"If",
"is",
"has",
"a",
"config",
"the",
"instance",
"will",
"be",
"associated",
"with",
"that",
"config",
".",
"If",
"the",
"config",
"specifies",
"that",
"the",
"view",
"is",
"a",
"singleton",
"an",
"a",
"view",
... | 9c49f9ac059ba3177b61f7395151de78b506e8f7 | https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-baseview.js#L234-L241 | train | |
1stdibs/backbone-base-and-form-view | backbone-baseview.js | function (key, instances) {
if (isArray(key)) {
instances = key;
key = undefined;
}
var i = -1;
var len = instances.length;
while (++i < len) {
this._addInstance(key, instances[i]);
}
retu... | javascript | function (key, instances) {
if (isArray(key)) {
instances = key;
key = undefined;
}
var i = -1;
var len = instances.length;
while (++i < len) {
this._addInstance(key, instances[i]);
}
retu... | [
"function",
"(",
"key",
",",
"instances",
")",
"{",
"if",
"(",
"isArray",
"(",
"key",
")",
")",
"{",
"instances",
"=",
"key",
";",
"key",
"=",
"undefined",
";",
"}",
"var",
"i",
"=",
"-",
"1",
";",
"var",
"len",
"=",
"instances",
".",
"length",
... | Add a subview for each view instance in
an array for a particular key
@memberOf SubViewManager#
@param {string} key
@param {Backbone.View[]} instances
@return {SubViewManager}
Add a subview for each view instance in
an array. They will not be associated
with a key and will be only accessible
through the subViews arra... | [
"Add",
"a",
"subview",
"for",
"each",
"view",
"instance",
"in",
"an",
"array",
"for",
"a",
"particular",
"key"
] | 9c49f9ac059ba3177b61f7395151de78b506e8f7 | https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-baseview.js#L259-L270 | train | |
1stdibs/backbone-base-and-form-view | backbone-baseview.js | function (map) {
var key;
for (key in map) {
if (map.hasOwnProperty(key)) {
this.addInstance(key, map[key]);
}
}
return this;
} | javascript | function (map) {
var key;
for (key in map) {
if (map.hasOwnProperty(key)) {
this.addInstance(key, map[key]);
}
}
return this;
} | [
"function",
"(",
"map",
")",
"{",
"var",
"key",
";",
"for",
"(",
"key",
"in",
"map",
")",
"{",
"if",
"(",
"map",
".",
"hasOwnProperty",
"(",
"key",
")",
")",
"{",
"this",
".",
"addInstance",
"(",
"key",
",",
"map",
"[",
"key",
"]",
")",
";",
... | Add instances using an object that
maps subview keys to the instances
@param {object} map
@return {SubViewManager} | [
"Add",
"instances",
"using",
"an",
"object",
"that",
"maps",
"subview",
"keys",
"to",
"the",
"instances"
] | 9c49f9ac059ba3177b61f7395151de78b506e8f7 | https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-baseview.js#L277-L285 | train | |
1stdibs/backbone-base-and-form-view | backbone-baseview.js | function (keys, options) {
var views = [];
var len = keys.length;
var i = -1;
while (++i < len) {
views.push(this._init(keys[i], options));
}
return views;
} | javascript | function (keys, options) {
var views = [];
var len = keys.length;
var i = -1;
while (++i < len) {
views.push(this._init(keys[i], options));
}
return views;
} | [
"function",
"(",
"keys",
",",
"options",
")",
"{",
"var",
"views",
"=",
"[",
"]",
";",
"var",
"len",
"=",
"keys",
".",
"length",
";",
"var",
"i",
"=",
"-",
"1",
";",
"while",
"(",
"++",
"i",
"<",
"len",
")",
"{",
"views",
".",
"push",
"(",
... | Given an array of keys, a subview
will be instantiated for each key
based on the configuration for that
key. The options param will be
passed to each view on instantiation
as additional options.
@memberOf SubViewManager#
@param {String[]} keys
@param {Object} options
Additional options to pass
to each view on init
@re... | [
"Given",
"an",
"array",
"of",
"keys",
"a",
"subview",
"will",
"be",
"instantiated",
"for",
"each",
"key",
"based",
"on",
"the",
"configuration",
"for",
"that",
"key",
".",
"The",
"options",
"param",
"will",
"be",
"passed",
"to",
"each",
"view",
"on",
"in... | 9c49f9ac059ba3177b61f7395151de78b506e8f7 | https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-baseview.js#L314-L322 | train | |
1stdibs/backbone-base-and-form-view | backbone-baseview.js | function (options) {
var key;
for (key in this.config) {
if (this.config.hasOwnProperty(key) && this.config[key].singleton) {
this._init(key, options);
}
}
return this;
} | javascript | function (options) {
var key;
for (key in this.config) {
if (this.config.hasOwnProperty(key) && this.config[key].singleton) {
this._init(key, options);
}
}
return this;
} | [
"function",
"(",
"options",
")",
"{",
"var",
"key",
";",
"for",
"(",
"key",
"in",
"this",
".",
"config",
")",
"{",
"if",
"(",
"this",
".",
"config",
".",
"hasOwnProperty",
"(",
"key",
")",
"&&",
"this",
".",
"config",
"[",
"key",
"]",
".",
"singl... | Instantiate all singletons defined in the
config.
@param {object} options Additional options
@return {SubViewManager} | [
"Instantiate",
"all",
"singletons",
"defined",
"in",
"the",
"config",
"."
] | 9c49f9ac059ba3177b61f7395151de78b506e8f7 | https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-baseview.js#L329-L337 | train | |
1stdibs/backbone-base-and-form-view | backbone-baseview.js | function (map) {
var key;
for (key in map) {
if (map.hasOwnProperty(key)) {
this._init(key, map[key]);
}
}
return this;
} | javascript | function (map) {
var key;
for (key in map) {
if (map.hasOwnProperty(key)) {
this._init(key, map[key]);
}
}
return this;
} | [
"function",
"(",
"map",
")",
"{",
"var",
"key",
";",
"for",
"(",
"key",
"in",
"map",
")",
"{",
"if",
"(",
"map",
".",
"hasOwnProperty",
"(",
"key",
")",
")",
"{",
"this",
".",
"_init",
"(",
"key",
",",
"map",
"[",
"key",
"]",
")",
";",
"}",
... | Create subviews with a map of configured
subview keys to additional options.
@param {object} map
@return {SubViewManager} | [
"Create",
"subviews",
"with",
"a",
"map",
"of",
"configured",
"subview",
"keys",
"to",
"additional",
"options",
"."
] | 9c49f9ac059ba3177b61f7395151de78b506e8f7 | https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-baseview.js#L344-L352 | train | |
1stdibs/backbone-base-and-form-view | backbone-baseview.js | function (name, config) {
var map = (isObject(name) && !isArray(name)) ? name : false;
if (map) {
each(map, this._addConfig, this);
return this;
}
return this._addConfig(config, name);
} | javascript | function (name, config) {
var map = (isObject(name) && !isArray(name)) ? name : false;
if (map) {
each(map, this._addConfig, this);
return this;
}
return this._addConfig(config, name);
} | [
"function",
"(",
"name",
",",
"config",
")",
"{",
"var",
"map",
"=",
"(",
"isObject",
"(",
"name",
")",
"&&",
"!",
"isArray",
"(",
"name",
")",
")",
"?",
"name",
":",
"false",
";",
"if",
"(",
"map",
")",
"{",
"each",
"(",
"map",
",",
"this",
... | Add an configuration for a subview to the SubViewManager.
It can be instantiated later with the add function.
@memberOf SubViewManager#
@type {SubViewManager}
@class
@method addConfig
@param {String} name
The name or type that you would like use to refer to subViews
created with this config
@param {String|Function} con... | [
"Add",
"an",
"configuration",
"for",
"a",
"subview",
"to",
"the",
"SubViewManager",
".",
"It",
"can",
"be",
"instantiated",
"later",
"with",
"the",
"add",
"function",
"."
] | 9c49f9ac059ba3177b61f7395151de78b506e8f7 | https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-baseview.js#L436-L444 | train | |
1stdibs/backbone-base-and-form-view | backbone-baseview.js | function (key) {
var i = -1;
var len;
var subViews;
var subMgr = new SubViewManager(null, this.parent, this.options);
subMgr.config = this.config;
subViews = (isArray(key)) ? key : (isFunction(key)) ? this.filter(key) : this.getByType(key);
... | javascript | function (key) {
var i = -1;
var len;
var subViews;
var subMgr = new SubViewManager(null, this.parent, this.options);
subMgr.config = this.config;
subViews = (isArray(key)) ? key : (isFunction(key)) ? this.filter(key) : this.getByType(key);
... | [
"function",
"(",
"key",
")",
"{",
"var",
"i",
"=",
"-",
"1",
";",
"var",
"len",
";",
"var",
"subViews",
";",
"var",
"subMgr",
"=",
"new",
"SubViewManager",
"(",
"null",
",",
"this",
".",
"parent",
",",
"this",
".",
"options",
")",
";",
"subMgr",
... | Returns a new SubViewManager instance with filtered list of subviews.
@memberOf SubViewManager#
@type {SubViewManager}
@param {string|Backbone.View[]|function} key
The key or type used to refer to a subview or subviews, or a list
of subViews with a type found in this SubViewManager config, or a function
that will itera... | [
"Returns",
"a",
"new",
"SubViewManager",
"instance",
"with",
"filtered",
"list",
"of",
"subviews",
"."
] | 9c49f9ac059ba3177b61f7395151de78b506e8f7 | https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-baseview.js#L521-L533 | train | |
1stdibs/backbone-base-and-form-view | backbone-baseview.js | function (preserveElems, clearConfigs) {
if (!preserveElems) {
this.removeElems();
}
this.subViews = [];
if (this.parent && this.parent.subViews) {
this.parent.subViews = this.subViews;
}
this._subViewsByType = {};
... | javascript | function (preserveElems, clearConfigs) {
if (!preserveElems) {
this.removeElems();
}
this.subViews = [];
if (this.parent && this.parent.subViews) {
this.parent.subViews = this.subViews;
}
this._subViewsByType = {};
... | [
"function",
"(",
"preserveElems",
",",
"clearConfigs",
")",
"{",
"if",
"(",
"!",
"preserveElems",
")",
"{",
"this",
".",
"removeElems",
"(",
")",
";",
"}",
"this",
".",
"subViews",
"=",
"[",
"]",
";",
"if",
"(",
"this",
".",
"parent",
"&&",
"this",
... | Clears all subViews and subView data off of the SubViewManager instance
@memberOf SubViewManager#
@type {SubViewManager}
@param {Boolean} [preserveElems] If true, view $els are left on the DOM
@param {Boolean} [clearConfigs] If true, resets the subView configs as well
@return {SubViewManager} | [
"Clears",
"all",
"subViews",
"and",
"subView",
"data",
"off",
"of",
"the",
"SubViewManager",
"instance"
] | 9c49f9ac059ba3177b61f7395151de78b506e8f7 | https://github.com/1stdibs/backbone-base-and-form-view/blob/9c49f9ac059ba3177b61f7395151de78b506e8f7/backbone-baseview.js#L577-L593 | 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.