_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q29300 | train | 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 | {
"resource": ""
} | |
q29301 | train | 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 | {
"resource": ""
} | |
q29302 | generateUserInfo | train | 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 | {
"resource": ""
} |
q29303 | setInvocation | train | 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 | {
"resource": ""
} |
q29304 | StatusLineMode | train | function StatusLineMode(viMode) {
var view = viMode.getView();
this.viMode = viMode;
mKeyMode.KeyMode.call(this, view);
this._createActions(view);
} | javascript | {
"resource": ""
} |
q29305 | addPart | train | 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 | {
"resource": ""
} |
q29306 | getPluralRule | train | 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 | {
"resource": ""
} |
q29307 | removeNavGrid | train | 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 | {
"resource": ""
} |
q29308 | ProjectClient | train | 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 | {
"resource": ""
} |
q29309 | xmlToJson | train | 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 | {
"resource": ""
} |
q29310 | RunBar | train | 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 | {
"resource": ""
} |
q29311 | train | 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 | {
"resource": ""
} | |
q29312 | train | 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 | {
"resource": ""
} | |
q29313 | train | function(launchConfigurations) {
if (launchConfigurations) {
this._enableLaunchConfigurationsDropdown();
launchConfigurations.sort(function(launchConf1, launchConf2) {
return launchConf1.Name.localeCompare(launchConf2.Name);
});
} else {
this._disableLaunchConfigurationsDropdown();
}
... | javascript | {
"resource": ""
} | |
q29314 | train | 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 | {
"resource": ""
} | |
q29315 | _getNodeText | train | function _getNodeText(node) {
return node.sourceFile.text.substr(node.start, node.end - node.start);
} | javascript | {
"resource": ""
} |
q29316 | train | 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 | {
"resource": ""
} | |
q29317 | Inputter | train | 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 | {
"resource": ""
} |
q29318 | NavigationOutliner | train | 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 | {
"resource": ""
} |
q29319 | train | 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 | {
"resource": ""
} | |
q29320 | FileModel | train | 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 | {
"resource": ""
} |
q29321 | train | 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 | {
"resource": ""
} | |
q29322 | train | function(item, reroot) {
return this.showItem(item, reroot).then(function(result) {
this.select(result);
}.bind(this));
} | javascript | {
"resource": ""
} | |
q29323 | train | 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 | {
"resource": ""
} | |
q29324 | createSiteServiceCommands | train | 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 | {
"resource": ""
} |
q29325 | ParamType | train | function ParamType(typeSpec) {
this.requisition = typeSpec.requisition;
this.isIncompleteName = typeSpec.isIncompleteName;
this.stringifyProperty = 'name';
this.neverForceAsync = true;
} | javascript | {
"resource": ""
} |
q29326 | StatusReportingService | train | 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 | {
"resource": ""
} |
q29327 | train | 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 | {
"resource": ""
} | |
q29328 | train | 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 | {
"resource": ""
} | |
q29329 | train | 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 | {
"resource": ""
} | |
q29330 | train | 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 | {
"resource": ""
} | |
q29331 | damerauLevenshteinDistance | train | 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 | {
"resource": ""
} |
q29332 | findUser | train | function findUser(id, user, callback) {
if (typeof user.save === 'function') {
callback(null, user);
} else {
orionAccount.findByUsername(id, callback);
}
} | javascript | {
"resource": ""
} |
q29333 | train | 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 | {
"resource": ""
} | |
q29334 | delay | train | 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 | {
"resource": ""
} |
q29335 | retry | train | 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 | {
"resource": ""
} |
q29336 | deepMerge | train | 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 | {
"resource": ""
} |
q29337 | restoreEventListenerImplementation | train | function restoreEventListenerImplementation() {
global.Element.prototype.addEventListener = nativeAddEventListener;
global.Element.prototype.removeEventListener = nativeRemoveEventListener;
global.document.addEventListener = nativeAddEventListener;
global.document.removeEventListener = nativeRemoveEvent... | javascript | {
"resource": ""
} |
q29338 | BaseClient | train | 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 | {
"resource": ""
} |
q29339 | compareString | train | async function compareString (filename, expectedContents) {
try {
const actualContents = await fs.readFile(filename, { encoding: 'utf8' })
return actualContents !== expectedContents
} catch (err) {
return handleError(err)
}
} | javascript | {
"resource": ""
} |
q29340 | compareBuffer | train | async function compareBuffer (filename, expectedContents) {
try {
const actualContents = await fs.readFile(filename)
return !expectedContents.equals(actualContents)
} catch (err) {
return handleError(err)
}
} | javascript | {
"resource": ""
} |
q29341 | compareStream | train | 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 | {
"resource": ""
} |
q29342 | train | 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 | {
"resource": ""
} | |
q29343 | train | 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 | {
"resource": ""
} | |
q29344 | train | 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 | {
"resource": ""
} | |
q29345 | train | 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 | {
"resource": ""
} | |
q29346 | train | 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 | {
"resource": ""
} | |
q29347 | train | 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 | {
"resource": ""
} | |
q29348 | train | 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 | {
"resource": ""
} | |
q29349 | train | 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 | {
"resource": ""
} | |
q29350 | train | 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 | {
"resource": ""
} | |
q29351 | train | 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 | {
"resource": ""
} | |
q29352 | train | 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 | {
"resource": ""
} | |
q29353 | train | function(languageSlug, projectSlug, resourceSlug) {
return new Promise(function(resolve, reject) {
try {
resolve(library.public_getters.getResource(languageSlug, projectSlug, resourceSlug));
} catch(err) {
reject(err);
}
... | javascript | {
"resource": ""
} | |
q29354 | train | function(languageSlug, projectSlug, resourceSlug) {
return new Promise(function(resolve, reject) {
try {
resolve(library.public_getters.getResource(languageSlug, projectSlug, resourceSlug));
} catch(err) {
reject(err);
}
... | javascript | {
"resource": ""
} | |
q29355 | train | 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 | {
"resource": ""
} | |
q29356 | train | function() {
return new Promise(function(resolve, reject) {
try{
resolve(library.listSourceLanguagesLastModified());
} catch (err) {
reject(err);
}
}).then(function(languages) {
return listResourceContainers()
... | javascript | {
"resource": ""
} | |
q29357 | train | function(languageSlug) {
return new Promise(function(resolve, reject) {
try{
resolve(library.listProjectsLastModified(languageSlug));
} catch (err) {
reject(err);
}
}).then(function(projects) {
return listResourceContainers()... | javascript | {
"resource": ""
} | |
q29358 | FREEZE | train | 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 | {
"resource": ""
} |
q29359 | IDPTYPE | train | function IDPTYPE() {
let make = ()=>(Math.random().toString(36).slice(2)), rslt = make();
while (global.__PTYPES__.has(rslt)) { rslt = make(); }
return rslt;
} | javascript | {
"resource": ""
} |
q29360 | GETCONFIG | train | function GETCONFIG(name) {
return {
GNConfig: GNConfig,
RouteGN: RouteGN,
RouteAU: RouteAU,
RouteDB: RouteDB,
GNHeaders: GNHeaders,
GNParam: GNParam,
GNDescr: GNDescr,
}[name];
} | javascript | {
"resource": ""
} |
q29361 | MERGER | train | 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 | {
"resource": ""
} |
q29362 | ThrowType | train | 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 | {
"resource": ""
} |
q29363 | descriptor | train | 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 | {
"resource": ""
} |
q29364 | predefine | train | 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 | {
"resource": ""
} |
q29365 | lazy | train | 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 | {
"resource": ""
} |
q29366 | remove | train | 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 | {
"resource": ""
} |
q29367 | mixin | train | 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 | {
"resource": ""
} |
q29368 | each | train | 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 | {
"resource": ""
} |
q29369 | init | train | 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 | {
"resource": ""
} |
q29370 | bundle | train | 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 | {
"resource": ""
} |
q29371 | order | train | 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 | {
"resource": ""
} |
q29372 | pad | train | function pad(str, length, char) {
return new BespokeString(str).pad(length, char).toString()
} | javascript | {
"resource": ""
} |
q29373 | train | 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 | {
"resource": ""
} | |
q29374 | parseFnKeyConst | train | 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 | {
"resource": ""
} |
q29375 | train | function(scope) {
if (!_argValidator.checkString(scope)) {
scope = _applicationScope;
}
let config = _configCache[scope];
if (!config) {
const data = _deepDefaults(
_deepDefaults({}, _config[scope]),
_config.default
);
... | javascript | {
"resource": ""
} | |
q29376 | MultipartParser | train | 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 | {
"resource": ""
} |
q29377 | plain | train | 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 | {
"resource": ""
} |
q29378 | empty | train | 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 | {
"resource": ""
} |
q29379 | influxUdp | train | 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 | {
"resource": ""
} |
q29380 | train | 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 | {
"resource": ""
} | |
q29381 | train | function(_target,_message){
var _from = _message.from;
while(!!_target){
if (_target._$getPath()!=_from){
_doSendMessage(_target,_message);
}
_target = _target._$getParent();
}
... | javascript | {
"resource": ""
} | |
q29382 | train | function(_target,_message){
var _from = _message.from;
_t3._$breadthFirstSearch(
_target,function(_node){
if (_node._$getPath()!=_from){
_doSendMessage(_node,_message);
}
}... | javascript | {
"resource": ""
} | |
q29383 | doTokenValidation | train | 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 | {
"resource": ""
} |
q29384 | getErrorMessage | train | function getErrorMessage(errors) {
if (_.isArray(errors)) {
return _.uniq(_.pluck(errors, 'stack')).join().replace(/instance./g, '');
} else if (errors) {
return errors.message;
}
} | javascript | {
"resource": ""
} |
q29385 | message | train | 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 | {
"resource": ""
} |
q29386 | hashSymbol | train | 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 | {
"resource": ""
} |
q29387 | globExts | train | function globExts() {
let exts = _.flattenDeep(_.concat.apply(null, arguments));
return (exts.length <= 1) ? (exts[0] && `.${exts[0]}` || ``) : `.{${exts.join(`,`)}}`;
} | javascript | {
"resource": ""
} |
q29388 | train | 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 | {
"resource": ""
} | |
q29389 | train | function (str) {
var arr = str.split('.');
var obj = root[arr.shift()];
while (arr.length && obj) {
obj = obj[arr.shift()];
}
return obj;
} | javascript | {
"resource": ""
} | |
q29390 | train | 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 | {
"resource": ""
} | |
q29391 | train | function (key, instance) {
if (key instanceof View) {
instance = key;
key = undefined;
}
this._addInstance(key, instance);
return this;
} | javascript | {
"resource": ""
} | |
q29392 | train | 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 | {
"resource": ""
} | |
q29393 | train | function (map) {
var key;
for (key in map) {
if (map.hasOwnProperty(key)) {
this.addInstance(key, map[key]);
}
}
return this;
} | javascript | {
"resource": ""
} | |
q29394 | train | 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 | {
"resource": ""
} | |
q29395 | train | 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 | {
"resource": ""
} | |
q29396 | train | function (map) {
var key;
for (key in map) {
if (map.hasOwnProperty(key)) {
this._init(key, map[key]);
}
}
return this;
} | javascript | {
"resource": ""
} | |
q29397 | train | 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 | {
"resource": ""
} | |
q29398 | train | 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 | {
"resource": ""
} | |
q29399 | train | function (preserveElems, clearConfigs) {
if (!preserveElems) {
this.removeElems();
}
this.subViews = [];
if (this.parent && this.parent.subViews) {
this.parent.subViews = this.subViews;
}
this._subViewsByType = {};
... | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.