_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q50400 | isBuiltinPlugin | train | function isBuiltinPlugin(name) {
var isNpmPluginName = /^(?:babel-plugin-)/;
var availablePlugins = babel.availablePlugins;
// if the full npm plugin name was set in `babelOptions.plugins`, use the
// shorthand to check whether the plugin is included in babel-standalone;
// shorthand plugin names are used interna... | javascript | {
"resource": ""
} |
q50401 | rebuild | train | function rebuild(moduleNames){
moduleName = moduleNames[0] || "";
moduleNames.forEach(function(moduleName){
graphStream.write(moduleName);
});
} | javascript | {
"resource": ""
} |
q50402 | flagCircularDependencies | train | function flagCircularDependencies(graph) {
var includes = require("lodash/includes");
var nodes = Array.isArray(graph) ? graph : require("lodash/values")(graph);
for (var i = 0; i < nodes.length; i += 1) {
var curr = nodes[i];
for (var j = i + 1; j < nodes.length; j += 1) {
var next = nodes[j];
if (
... | javascript | {
"resource": ""
} |
q50403 | getRelativeBundlePath | train | function getRelativeBundlePath(target, bundle) {
var baseUrl = options.baseUrl.replace("file:", "");
return target !== "web" ?
getBundleFileName(bundle) :
path.join(
path.relative(baseUrl, options.bundlesPath),
getBundleFileName(bundle)
);
} | javascript | {
"resource": ""
} |
q50404 | train | function(results) {
var value;
if (targets.length) {
value = {};
results.forEach(function(result, index) {
value[targets[index]] = result;
});
} else {
value = results[0];
}
slimDfd.resolve(value);
} | javascript | {
"resource": ""
} | |
q50405 | getUniqueName | train | function getUniqueName(dirName, shortened, buildTypeSuffix) {
if (!usedBundleNames[dirName + shortened + buildTypeSuffix]) {
return dirName + shortened + buildTypeSuffix + "";
}else {
return dirName + shortened + "-" + (bundleCounter++) + buildTypeSuffix + "";
}
} | javascript | {
"resource": ""
} |
q50406 | log | train | function log(message, level) {
var prefix = "[" + colors.cyan("gulp-tslint") + "]";
if (level === "error") {
fancyLog(prefix, colors.red("error"), message);
}
else {
fancyLog(prefix, message);
}
} | javascript | {
"resource": ""
} |
q50407 | train | function (pluginOptions) {
// If user options are undefined, set an empty options object
if (!pluginOptions) {
pluginOptions = {};
}
// Save off pluginOptions so we can get it in `report()`
tslintPlugin.pluginOptions = pluginOptions;
// TSLint default options
var options = {
... | javascript | {
"resource": ""
} | |
q50408 | train | function (file) {
if (file.tslint) {
// Version 5.0.0 of tslint no longer has a failureCount member
// It was renamed to errorCount. See tslint issue #2439
var failureCount = file.tslint.errorCount;
if (!options.allowWarnings) {
failureCount += fil... | javascript | {
"resource": ""
} | |
q50409 | train | function () {
// Throw error
if (options && errorFiles.length > 0) {
var failuresToOutput = allFailures;
var ignoreFailureCount = 0;
// If error count is limited, calculate number of errors not shown and slice reportLimit
// number of errors to be included... | javascript | {
"resource": ""
} | |
q50410 | touchend | train | function touchend(e) {
if (isDown) {
isDown = false;
var touch;
if (e.type == 'touchend') //Check for touch event or mousemove
touch = getTouch(e);
else
touch = e;
$(window).off('mousemove touchmove', mousemove); //... | javascript | {
"resource": ""
} |
q50411 | train | function (map) {
this._parts = [];
var startAngle = 0;
var stopAngle = 0;
this.addTo(map);
for (var i = 0; i < this.count(); i++) {
var normalized = this._normalize(this._data[i].num);
stopAngle = normalized * 360 + startAngl... | javascript | {
"resource": ""
} | |
q50412 | complete | train | function complete(e) {
clearTimeout(doneTimeout);
if (!done) { return; }
var d = done;
done = null;
if (e) {
// test failure
if (!(e instanceof Error)) {
e = new Error(e);
}
d(e);
} else {
// test passed
d();
}
} | javascript | {
"resource": ""
} |
q50413 | parseConnectAddress | train | function parseConnectAddress(address)
{
var url = address.trim();
if (!url.match('^https?://[A-Z0-9\.]*.*$'))
{
// Add protocol.
url = 'http://' + url;
}
if (url.match('^https?://[0-9\.]*$') &&
!url.match('^https?://[0-9\.]*:[0-9]*$'))
{
// Add port to numeric ip address.
url = url + ':404... | javascript | {
"resource": ""
} |
q50414 | helper_createTriggerObject | train | function helper_createTriggerObject(trigger)
{
var triggerObject = {};
triggerObject.triggerIdentifier = trigger.identifier;
triggerObject.rules = [];
for (var i = 0; i < trigger.rules.length; ++i)
{
var rule = trigger.rules[i];
triggerObject.rules.push({
ruleType: rule.ruleType,
ruleIdentifier: rule.r... | javascript | {
"resource": ""
} |
q50415 | helper_updateTriggerRule | train | function helper_updateTriggerRule(trigger, event)
{
var rule = trigger.ruleTable[event.ruleIdentifier];
if (rule && rule.ruleUpdateFunction)
{
rule.ruleUpdateFunction(rule, event.nearable, event);
helper_updateRuleState(
event.triggerIdentifier,
event.ruleIdentifier,
rule.state);
}
} | javascript | {
"resource": ""
} |
q50416 | helper_updateRuleState | train | function helper_updateRuleState(triggerIdentifier, ruleIdentifier, state)
{
exec(null,
null,
'EstimoteBeacons',
'triggers_updateRuleState',
[triggerIdentifier, ruleIdentifier, state]
);
} | javascript | {
"resource": ""
} |
q50417 | train | function(model, attrs) {
attrs = attrs || _.keys(_.result(model, 'validation') || {});
return _.reduce(attrs, function(memo, key) {
memo[key] = void 0;
return memo;
}, {});
} | javascript | {
"resource": ""
} | |
q50418 | train | function(attr, value) {
var self = this,
result = {},
error;
if(_.isObject(attr)){
_.each(attr, function(value, key) {
error = self.preValidate(key, value);
if(error){
result[key] = error;
}
... | javascript | {
"resource": ""
} | |
q50419 | train | function(view, model, options) {
if (model.associatedViews) {
model.associatedViews.push(view);
} else {
model.associatedViews = [view];
}
_.extend(model, mixin(view, options));
} | javascript | {
"resource": ""
} | |
q50420 | train | function(model, view) {
if (view && model.associatedViews && model.associatedViews.length > 1){
model.associatedViews = _.without(model.associatedViews, view);
} else {
delete model.validate;
delete model.preValidate;
delete model.isValid;
delete model.associatedViews... | javascript | {
"resource": ""
} | |
q50421 | train | function(view, options) {
options = _.extend({}, defaultOptions, defaultCallbacks, options);
var model = options.model || view.model,
collection = options.collection || view.collection;
if(typeof model === 'undefined' && typeof collection === 'undefined'){
throw 'Before y... | javascript | {
"resource": ""
} | |
q50422 | train | function(view, options) {
options = _.extend({}, options);
var model = options.model || view.model,
collection = options.collection || view.collection;
if(model) {
unbindModel(model, view);
}
else if(collection) {
collection.each(function(model){
... | javascript | {
"resource": ""
} | |
q50423 | train | function(view, attr, error, selector) {
view.$('[' + selector + '~="' + attr + '"]')
.addClass('invalid')
.attr('data-error', error);
} | javascript | {
"resource": ""
} | |
q50424 | train | function(attrName) {
return attrName.replace(/(?:^\w|[A-Z]|\b\w)/g, function(match, index) {
return index === 0 ? match.toUpperCase() : ' ' + match.toLowerCase();
}).replace(/_/g, ' ');
} | javascript | {
"resource": ""
} | |
q50425 | train | function(value){
return _.isNumber(value) || (_.isString(value) && value.match(defaultPatterns.number));
} | javascript | {
"resource": ""
} | |
q50426 | train | function(value, attr, fn, model, computed) {
if(_.isString(fn)){
fn = model[fn];
}
return fn.call(model, value, attr, computed);
} | javascript | {
"resource": ""
} | |
q50427 | train | function(value, attr, minValue, model) {
if (!isNumber(value) || value < minValue) {
return this.format(defaultMessages.min, this.formatLabel(attr, model), minValue);
}
} | javascript | {
"resource": ""
} | |
q50428 | train | function(value, attr, length, model) {
if (!_.isString(value) || value.length !== length) {
return this.format(defaultMessages.length, this.formatLabel(attr, model), length);
}
} | javascript | {
"resource": ""
} | |
q50429 | train | function(value, attr, values, model) {
if(!_.include(values, value)){
return this.format(defaultMessages.oneOf, this.formatLabel(attr, model), values.join(', '));
}
} | javascript | {
"resource": ""
} | |
q50430 | train | function(value, attr, equalTo, model, computed) {
if(value !== computed[equalTo]) {
return this.format(defaultMessages.equalTo, this.formatLabel(attr, model), this.formatLabel(equalTo, model));
}
} | javascript | {
"resource": ""
} | |
q50431 | MemcachedStore | train | function MemcachedStore(options) {
options = options || {};
Store.call(this, options);
this.prefix = options.prefix || "";
this.ttl = options.ttl;
if (!options.client) {
if (!options.hosts) {
options.hosts = "127.0.0.1:11211";
}
if (options.secret) {
(this.crypto =... | javascript | {
"resource": ""
} |
q50432 | consumeWord | train | function consumeWord (css, start) {
let next = start;
let code;
do {
code = css.charCodeAt(next);
if (wordDelimiters[code]) {
return next - 1;
} else if (code === t.backslash) {
next = consumeEscape(css, next) + 1;
} else {
// All other cha... | javascript | {
"resource": ""
} |
q50433 | consumeEscape | train | function consumeEscape (css, start) {
let next = start;
let code = css.charCodeAt(next + 1);
if (unescapable[code]) {
// just consume the escape char
} else if (hex[code]) {
let hexDigits = 0;
// consume up to 6 hex chars
do {
next++;
hexDigits++;
... | javascript | {
"resource": ""
} |
q50434 | findMatchingBucket | train | function findMatchingBucket(mod, ignore, bucketsContext) {
var match = null;
if (!mod.resource) {
return match;
}
var resourcePath = mod.resource;
for (var i in ignore) {
if (ignore[i].test(resourcePath)) {
return match;
}
}
bucketsContext.some(function (bucket) {
return bucket.pa... | javascript | {
"resource": ""
} |
q50435 | train | function () {
if (job.pull_requests < worker_count) {
return false;
}
for (var i = 0; i < worker_count; i++) {
if (!job.worker_complete[i]) {
return false;
}
}
return true;
} | javascript | {
"resource": ""
} | |
q50436 | train | function () {
//Check if any input was added dynamically
if (job.input.length > 0) {
job.is_complete = false;
return false;
}
//Wait for workers or instances that are still working
... | javascript | {
"resource": ""
} | |
q50437 | train | function (options, start_as_slave) {
isSlave = start_as_slave && !process.env._CHILD_ID_;
isMaster = !start_as_slave && !process.env._CHILD_ID_;
this.options = options || {};
this.jobs = {};
} | javascript | {
"resource": ""
} | |
q50438 | train | function (job_name, job_obj) {
//If we're capturing output, we need to explicitly override job.output()
if (isMaster && capture_output) {
var output = [];
job_obj.output = function (out) {
if (out instanceof Array && job_obj.options.flatten) {
... | javascript | {
"resource": ""
} | |
q50439 | train | function (path) {
if (path[path.length - 1] === '/') {
path = path.substr(0, path.length - 1);
}
return path;
} | javascript | {
"resource": ""
} | |
q50440 | train | function (msg, type) {
var cmd = type;
switch (type) {
case 'info':
msg = '\x1B[33mINFO\x1B[0m: ' + msg;
break;
case 'debug':
cmd = 'info';
msg = '\x1B[36mDEBUG\x1B[0m: ' + msg;
break;
case 'error':
case 'fatal':
cmd = 'erro... | javascript | {
"resource": ""
} | |
q50441 | train | function (output, options) {
this.output = output;
this.options = options;
// Set sane defaults for any options.
this.options.rootAssetPath = options.rootAssetPath || './';
this.options.ignorePaths = options.ignorePaths || [];
this.options.extensionsRegex = options.extensionsRegex || null;
... | javascript | {
"resource": ""
} | |
q50442 | createDeployTasks | train | function createDeployTasks(depolyConfs, files, flaten){
var tasks = flaten ? [] : {};
fis.util.map(files, function(subpath, file) {
fis.util.map(depolyConfs, function(name, depolyConf) {
var target = flaten? tasks : (tasks[name] = tasks[name] || []);
depolyCon... | javascript | {
"resource": ""
} |
q50443 | flattenList | train | function flattenList(list) {
// Make a copy, so the original tensor is not modified.
list = [].concat(list);
// Note that i must be checked against the length of the list each time through the loop, as the
// list is modified within the iterations.
for (let i = 0; i < list.length; i++) {
if (Array.isArra... | javascript | {
"resource": ""
} |
q50444 | upsertDocumentController | train | function upsertDocumentController(req, res) {
var modelName = req.params.modelName,
id = req.params.documentId,
user = req.admin_user,
data = _.extend({}, req.body, req.files),
modelConfig = registry.mode... | javascript | {
"resource": ""
} |
q50445 | train | function (pathOrRequestMatcher, type) {
if (type) {
var typeEnum = ['EXPECTATIONS', 'LOG', 'ALL'];
if (typeEnum.indexOf(type) === -1) {
throw new Error("\"" + (type || "undefined") + "\" is not a supported value for \"type\" parameter only " + typeEnum + "... | javascript | {
"resource": ""
} | |
q50446 | train | function (ports) {
if (!Array.isArray(ports)) {
throw new Error("ports parameter must be an array but found: " + JSON.stringify(ports));
}
return makeRequest(host, port, "/bind", {ports: ports});
} | javascript | {
"resource": ""
} | |
q50447 | train | function (data, legacy) {
if (!data) { return; }
var head,
headers = [],
statusValue = !legacy,
match = regexes.header.exec(data),
property = legacy ? 'enabled' : 'disabled';
data = data.toString().replace(regexes.fold, '$1');
while (mat... | javascript | {
"resource": ""
} | |
q50448 | train | function (collection, options, callback) {
if (!options.outputVersion || !semver.valid(options.outputVersion, true)) {
return callback(new Error('Output version not specified or invalid: ' + options.outputVersion));
}
if (!options.inputVersion || !semver.valid(options.inputVersion, t... | javascript | {
"resource": ""
} | |
q50449 | train | function (object, options, callback) {
if (!options.outputVersion || !semver.valid(options.outputVersion, true)) {
return callback(new Error('Output version not specified or invalid: ' + options.outputVersion));
}
if (!options.inputVersion || !semver.valid(options.inputVersion, true)... | javascript | {
"resource": ""
} | |
q50450 | train | function (entityV1, options) {
if (!entityV1) { return; }
var auth,
params,
mapper,
currentHelper,
helperAttributes,
prioritizeV2 = this.options.prioritizeV2;
// if prioritize v2 is true, use auth as the source of truth
if (ut... | javascript | {
"resource": ""
} | |
q50451 | train | function (requestV1) {
if (!requestV1) { return; }
var mode = requestV1.dataMode,
noDefaults = this.options.noDefaults,
retainEmptyValues = this.options.retainEmptyValues;
if ((!mode || mode === 'binary') && !noDefaults) {
return retainEmptyValues ? [] : und... | javascript | {
"resource": ""
} | |
q50452 | train | function (requestV1) {
if (!requestV1) { return; }
if (requestV1.headers && _.isEmpty(requestV1.headerData)) {
// this converts a newline concatenated string of headers to an array, so there are no descriptions
return v1Common.parseHeaders(requestV1.headers, true);
}
... | javascript | {
"resource": ""
} | |
q50453 | train | function (responseV1) {
var self = this;
// if noDefaults is true, do not replace the id
// else
// if id is falsy, replace the id
// if retainIds is false, replace the id
!((self.options.retainIds && responseV1.id) || self.options.noDefaults) && (responseV1.id = util.ui... | javascript | {
"resource": ""
} | |
q50454 | train | function (collectionV1) {
if (_.isEmpty(collectionV1 && collectionV1.folders)) { return; }
var auth,
events,
variables,
self = this,
order,
foldersOrder,
retainEmpty = self.options.retainEmptyValues,
varOpts = { noDefau... | javascript | {
"resource": ""
} | |
q50455 | train | function (request, options, callback) {
var err,
normalized,
builders = new Builders(options);
// At this stage, mutate will not be passed ordinarily. Hence, the falsy nature of options.mutate can be used
// to selectively clone the request.
options && !options.m... | javascript | {
"resource": ""
} | |
q50456 | train | function (inputVersion, outputVersion) {
var converter;
inputVersion = semver.clean(inputVersion);
outputVersion = semver.clean(outputVersion);
for (converter in this.converters) {
// eslint-disable-next-line no-prototype-builtins
converter = this.converters.has... | javascript | {
"resource": ""
} | |
q50457 | train | function (collection, options, callback) {
var chosenConverter = this.getConverter(options.inputVersion, options.outputVersion);
if (!chosenConverter) {
return callback(new Error('no conversion path found'));
}
return chosenConverter.convert(collection, options, callback);
... | javascript | {
"resource": ""
} | |
q50458 | train | function (object, options, callback) {
var chosenConverter = this.getConverter(options.inputVersion, options.outputVersion);
if (!chosenConverter) {
return callback(new Error('no conversion path found'));
}
return chosenConverter.convertSingle(object, options, callback);
... | javascript | {
"resource": ""
} | |
q50459 | train | function (options) {
var chosenConverter = this.getConverter(options.inputVersion, options.outputVersion);
return chosenConverter.create(options);
} | javascript | {
"resource": ""
} | |
q50460 | train | function (collection, options, callback) {
var version;
if (!options || !(version = semver.valid(options.normalizeVersion, true)) || !normalizers[version]) {
return callback(new Error('Version not specified or invalid: ' + options.normalizeVersion));
}
return normalizers[ve... | javascript | {
"resource": ""
} | |
q50461 | train | function (object, options, callback) {
var version;
if (!options || !(version = semver.valid(options.normalizeVersion, true)) || !normalizers[version]) {
return callback(new Error('Version not specified or invalid: ' + options.normalizeVersion));
}
return normalizers[versio... | javascript | {
"resource": ""
} | |
q50462 | train | function (response, options, callback) {
var version;
if (!options || !(version = semver.valid(options.normalizeVersion, true)) || !normalizers[version]) {
return callback(new Error('Version not specified or invalid: ' + options.normalizeVersion));
}
return normalizers[vers... | javascript | {
"resource": ""
} | |
q50463 | train | function () {
var n,
r,
E = '',
H = '-'; // r = result , n = numeric variable for positional checks
// if "n" is not 9 or 14 or 19 or 24 return a random number or 4
// if "n" is not 15 generate a random number from 0 to 15
// `(n ^ 20 ? 16 : 4)` := un... | javascript | {
"resource": ""
} | |
q50464 | train | function (entity, options, modifiers) {
!options && (options = {});
var self = this,
noDefaults = options.noDefaults,
isV1 = modifiers && modifiers.isV1,
retainEmpty = options.retainEmptyValues,
source = entity && (entity.variables || entity.variable || (... | javascript | {
"resource": ""
} | |
q50465 | train | function (entity, options) {
!options && (options = {});
var auth = entity && entity.auth;
if (auth === null) { return null; } // eslint-disable-line security/detect-possible-timing-attacks
if (!(auth && auth.type)) { return; }
if (auth.type === 'noauth') {
return o... | javascript | {
"resource": ""
} | |
q50466 | train | function (entity, options) {
var type,
result,
self = this,
auth = self.cleanAuth(entity, options);
if (!auth) { return auth; }
result = { type: (type = auth.type) };
if (type !== 'noauth') {
result[type] = _.transform(auth[type], functi... | javascript | {
"resource": ""
} | |
q50467 | train | function (entity, options) {
var type,
params,
result,
self = this,
auth = self.cleanAuth(entity, options);
if (!auth) { return auth; }
result = { type: (type = auth.type) };
if (type !== 'noauth') {
// @todo: Handle all non ... | javascript | {
"resource": ""
} | |
q50468 | train | function (entity, options) {
var type,
result,
self = this,
auth = self.cleanAuth(entity, options);
if (!auth) { return auth; }
result = { type: (type = auth.type) };
if (type !== 'noauth') {
result[type] = _.map(auth[type], function (pa... | javascript | {
"resource": ""
} | |
q50469 | train | function (entityV1, type) {
if (!entityV1) { return; }
switch (type) {
case 'event':
return !(entityV1.tests || entityV1.preRequestScript);
case 'auth':
return _.has(entityV1, 'auth') && !(_.has(entityV1, 'currentHelper') || entityV1.helperAttribu... | javascript | {
"resource": ""
} | |
q50470 | train | function (source, destination) {
var behavior = source && source.protocolProfileBehavior;
if (!(behavior && typeof behavior === 'object')) { return false; }
destination && (destination.protocolProfileBehavior = behavior);
return true;
} | javascript | {
"resource": ""
} | |
q50471 | train | function (collectionV1) {
var info = {
_postman_id: collectionV1.id || util.uid(),
name: collectionV1.name
};
if (collectionV1.description) { info.description = collectionV1.description; }
else if (this.options.retainEmptyValues) { info.description = null; }
... | javascript | {
"resource": ""
} | |
q50472 | train | function (requestV1) {
var queryParams = [],
pathVariables = [],
traversedVars = {},
queryParamAltered,
traversedQueryParams = {},
parsed = util.urlparse(requestV1.url),
retainEmpty = this.options.retainEmptyValues;
// Merge query ... | javascript | {
"resource": ""
} | |
q50473 | train | function (requestV1) {
if (_.isArray(requestV1.headers)) {
return requestV1.headers;
}
var headers = [],
traversed = {},
headerData = requestV1.headerData || [],
retainEmpty = this.options.retainEmptyValues;
_.forEach(headerData, function... | javascript | {
"resource": ""
} | |
q50474 | train | function (requestV1) {
var modes = {
urlencoded: 'urlencoded',
params: 'formdata',
raw: 'raw',
binary: 'file'
},
data = {},
rawModeData,
dataMode = modes[requestV1.dataMode],
retainEmpty =... | javascript | {
"resource": ""
} | |
q50475 | train | function (entityV1) {
if (!entityV1) { return; }
// if prioritizeV2 is true, events is used as the source of truth
if ((util.notLegacy(entityV1, 'event') || this.options.prioritizeV2) && !_.isEmpty(entityV1.events)) {
// in v1, `events` is regarded as the source of truth if it exist... | javascript | {
"resource": ""
} | |
q50476 | train | function (requestV1) {
var self = this,
request = {},
retainEmpty = self.options.retainEmptyValues,
units = ['auth', 'method', 'header', 'body', 'url'];
units.forEach(function (unit) {
request[unit] = self[unit](requestV1);
});
if (reques... | javascript | {
"resource": ""
} | |
q50477 | train | function (cookieV1) {
return {
expires: (new Date(cookieV1.expirationDate * 1000)).toString(),
hostOnly: cookieV1.hostOnly,
httpOnly: cookieV1.httpOnly,
domain: cookieV1.domain,
path: cookieV1.path,
secure: cookieV1.secure,
sess... | javascript | {
"resource": ""
} | |
q50478 | train | function (responseV1) {
var self = this,
associatedRequestId;
if (responseV1.requestObject) {
if (_.isString(responseV1.requestObject)) {
try {
return JSON.parse(responseV1.requestObject);
}
catch (e) {
... | javascript | {
"resource": ""
} | |
q50479 | train | function (responseV1) {
var response = {},
self = this,
originalRequest;
originalRequest = self.savedRequest(responseV1);
// add ids to the v2 result only if both: the id and retainIds are truthy.
// this prevents successive exports to v2 from being overwhelmed ... | javascript | {
"resource": ""
} | |
q50480 | train | function (requestV1) {
if (!requestV1) { return; }
var self = this,
units = ['request', 'response'],
variable = self.variable(requestV1),
item = {
name: requestV1.name || '', // Inline building to avoid additional function call
event: ... | javascript | {
"resource": ""
} | |
q50481 | train | function (collectionV1) {
var self = this,
items = [],
itemGroupCache = {},
retainEmpty = self.options.retainEmptyValues;
// Read all folder data, and prep it so that we can throw subfolders in the right places
itemGroupCache = _.reduce(collectionV1.folders, ... | javascript | {
"resource": ""
} | |
q50482 | train | function (collectionV1) {
var self = this,
requestsCache = _.keyBy(collectionV1.requests, 'id'),
allRequests = _.map(collectionV1.requests, 'id'),
result;
self.cache = requestsCache;
result = self.itemGroups(collectionV1);
_.forEach(_.intersection(co... | javascript | {
"resource": ""
} | |
q50483 | train | function (request, options, callback) {
var builders = new Builders(options),
converted,
err;
try {
converted = builders.singleItem(_.cloneDeep(request));
}
catch (e) {
err = e;
}
if (callback) {
return callbac... | javascript | {
"resource": ""
} | |
q50484 | train | function (response, options, callback) {
var builders = new Builders(options),
converted,
err;
try {
converted = builders.singleResponse(_.cloneDeep(response));
}
catch (e) {
err = e;
}
if (callback) {
return c... | javascript | {
"resource": ""
} | |
q50485 | train | function (collectionV1) {
var info = Builders.super_.prototype.info.call(this, collectionV1);
info.schema = constants.SCHEMA_V2_1_0_URL;
return info;
} | javascript | {
"resource": ""
} | |
q50486 | train | function (requestV1) {
var v21Url = Builders.super_.prototype.url.call(this, requestV1);
return _.isString(v21Url) ? url.parse(v21Url) : v21Url;
} | javascript | {
"resource": ""
} | |
q50487 | PingppResource | train | function PingppResource(pingpp, urlData) {
this._pingpp = pingpp;
this._urlData = urlData || {};
this.basePath = utils.makeURLInterpolator(pingpp.getApiField('basePath'));
this.path = utils.makeURLInterpolator(this.path);
if (this.includeBasic) {
this.includeBasic.forEach(function(methodName) {
th... | javascript | {
"resource": ""
} |
q50488 | merge | train | function merge (dest, src, redefine) {
if (!dest) {
throw new TypeError('argument dest is required')
}
if (!src) {
throw new TypeError('argument src is required')
}
if (redefine === undefined) {
// Default to true
redefine = true
}
Object.getOwnPropertyNames(src).forEach(function forEac... | javascript | {
"resource": ""
} |
q50489 | getTimings | train | function getTimings (eventTimes) {
return {
// There is no DNS lookup with IP address, can be null
dnsLookup: getHrTimeDurationInMs(
eventTimes.startAt,
eventTimes.dnsLookupAt
),
tcpConnection: getHrTimeDurationInMs(
eventTimes.dnsLookupAt || event... | javascript | {
"resource": ""
} |
q50490 | normalizeOptions | train | function normalizeOptions(options) {
var opts = {};
if (typeof options === 'string') {
opts = {
url: options
};
} else if (_.isPlainObject(options)) {
opts = _.clone(options);
}
return opts;
} | javascript | {
"resource": ""
} |
q50491 | clientReq | train | function clientReq(req) {
if (!req) {
return (req);
}
var host;
try {
host = req.host.split(':')[0];
} catch (e) {
host = false;
}
return ({
method: req ? req.method : false,
url: req ? req.path : false,
address: host,
port: req ? re... | javascript | {
"resource": ""
} |
q50492 | clientRes | train | function clientRes(res) {
if (!res || !res.statusCode) {
return (res);
}
return ({
statusCode: res.statusCode,
headers: res.headers
});
} | javascript | {
"resource": ""
} |
q50493 | createLogger | train | function createLogger(name) {
return (bunyan.createLogger({
name: name,
serializers: SERIALIZERS,
streams: [
{
level: 'warn',
stream: process.stderr
},
{
level: 'debug',
type: 'raw',
... | javascript | {
"resource": ""
} |
q50494 | isProxyForURL | train | function isProxyForURL(noProxy, address) {
// wildcard
if (noProxy === '*') {
return (null);
}
// otherwise, parse the noProxy value to see if it applies to the URL
if (noProxy !== null) {
var noProxyItem, hostname, port, noProxyItemParts,
noProxyHost, noProxyPort, noPro... | javascript | {
"resource": ""
} |
q50495 | createHttpErr | train | function createHttpErr(statusCode, opts, req) {
assert.number(statusCode, 'statusCode');
assert.object(opts, 'opts');
assert.object(req, 'req');
var errInfo = createErrInfo(opts, req);
return restifyErrors.makeErrFromCode(statusCode, {
info: errInfo
});
} | javascript | {
"resource": ""
} |
q50496 | createRequestTimeoutErr | train | function createRequestTimeoutErr(opts, req) {
assert.object(opts, 'opts');
assert.object(req, 'req');
var errInfo = createErrInfo(opts, req);
var errMsg = [
opts.method,
'request to',
errInfo.fullUrl,
'failed to complete within',
opts.requestTimeout + 'ms'
].... | javascript | {
"resource": ""
} |
q50497 | createTooManyRedirectsErr | train | function createTooManyRedirectsErr(opts, req) {
assert.object(opts, 'opts');
assert.object(req, 'req');
var errInfo = createErrInfo(opts, req);
var errMsg = [
'aborted',
opts.method,
'request to',
errInfo.fullUrl,
'after',
opts.redirects,
'redirec... | javascript | {
"resource": ""
} |
q50498 | createErrInfo | train | function createErrInfo(opts, req) {
assert.object(opts, 'opts');
assert.object(req, 'req');
return {
// port and address can both be unpopulated - fall back on null so
// that they can both be null (instead of req.remoteAddress
// defaulting to undefined)
address: req.remote... | javascript | {
"resource": ""
} |
q50499 | Writer | train | function Writer (props, current) {
var self = this
if (typeof props === 'string') {
props = { path: props }
}
// polymorphism.
// call fstream.Writer(dir) to get a DirWriter object, etc.
var type = getType(props)
var ClassType = Writer
switch (type) {
case 'Directory':
ClassType = DirWr... | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.