id int32 0 58k | repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 |
|---|---|---|---|---|---|---|---|---|---|---|---|
9,900 | optimizely/javascript-sdk | packages/optimizely-sdk/lib/core/event_builder/index.js | function(options) {
var impressionEvent = {
httpVerb: HTTP_VERB
};
var commonParams = getCommonEventParams(options);
impressionEvent.url = ENDPOINT;
var impressionEventParams = getImpressionEventParams(options.configObj, options.experimentId, options.variationId);
// combine Event params... | javascript | function(options) {
var impressionEvent = {
httpVerb: HTTP_VERB
};
var commonParams = getCommonEventParams(options);
impressionEvent.url = ENDPOINT;
var impressionEventParams = getImpressionEventParams(options.configObj, options.experimentId, options.variationId);
// combine Event params... | [
"function",
"(",
"options",
")",
"{",
"var",
"impressionEvent",
"=",
"{",
"httpVerb",
":",
"HTTP_VERB",
"}",
";",
"var",
"commonParams",
"=",
"getCommonEventParams",
"(",
"options",
")",
";",
"impressionEvent",
".",
"url",
"=",
"ENDPOINT",
";",
"var",
"impre... | Create impression event params to be sent to the logging endpoint
@param {Object} options Object containing values needed to build impression event
@param {Object} options.attributes Object representing user attributes and values which need to be recorded
@param {string} options.clientEngine The cl... | [
"Create",
"impression",
"event",
"params",
"to",
"be",
"sent",
"to",
"the",
"logging",
"endpoint"
] | 39c3b2d97388100abd1c25d355a71c72b17363be | https://github.com/optimizely/javascript-sdk/blob/39c3b2d97388100abd1c25d355a71c72b17363be/packages/optimizely-sdk/lib/core/event_builder/index.js#L165-L180 | |
9,901 | optimizely/javascript-sdk | packages/optimizely-sdk/lib/core/event_builder/index.js | function(options) {
var conversionEvent = {
httpVerb: HTTP_VERB,
};
var commonParams = getCommonEventParams(options);
conversionEvent.url = ENDPOINT;
var snapshot = getVisitorSnapshot(options.configObj,
options.eventKey,
... | javascript | function(options) {
var conversionEvent = {
httpVerb: HTTP_VERB,
};
var commonParams = getCommonEventParams(options);
conversionEvent.url = ENDPOINT;
var snapshot = getVisitorSnapshot(options.configObj,
options.eventKey,
... | [
"function",
"(",
"options",
")",
"{",
"var",
"conversionEvent",
"=",
"{",
"httpVerb",
":",
"HTTP_VERB",
",",
"}",
";",
"var",
"commonParams",
"=",
"getCommonEventParams",
"(",
"options",
")",
";",
"conversionEvent",
".",
"url",
"=",
"ENDPOINT",
";",
"var",
... | Create conversion event params to be sent to the logging endpoint
@param {Object} options Object containing values needed to build conversion event
@param {Object} options.attributes Object representing user attributes and values which need to be recorded
@param {string} opti... | [
"Create",
"conversion",
"event",
"params",
"to",
"be",
"sent",
"to",
"the",
"logging",
"endpoint"
] | 39c3b2d97388100abd1c25d355a71c72b17363be | https://github.com/optimizely/javascript-sdk/blob/39c3b2d97388100abd1c25d355a71c72b17363be/packages/optimizely-sdk/lib/core/event_builder/index.js#L195-L212 | |
9,902 | optimizely/javascript-sdk | packages/optimizely-sdk/lib/core/custom_attribute_condition_evaluator/index.js | evaluate | function evaluate(condition, userAttributes, logger) {
if (condition.type !== CUSTOM_ATTRIBUTE_CONDITION_TYPE) {
logger.log(LOG_LEVEL.WARNING, sprintf(LOG_MESSAGES.UNKNOWN_CONDITION_TYPE, MODULE_NAME, JSON.stringify(condition)));
return null;
}
var conditionMatch = condition.match;
if (typeof condition... | javascript | function evaluate(condition, userAttributes, logger) {
if (condition.type !== CUSTOM_ATTRIBUTE_CONDITION_TYPE) {
logger.log(LOG_LEVEL.WARNING, sprintf(LOG_MESSAGES.UNKNOWN_CONDITION_TYPE, MODULE_NAME, JSON.stringify(condition)));
return null;
}
var conditionMatch = condition.match;
if (typeof condition... | [
"function",
"evaluate",
"(",
"condition",
",",
"userAttributes",
",",
"logger",
")",
"{",
"if",
"(",
"condition",
".",
"type",
"!==",
"CUSTOM_ATTRIBUTE_CONDITION_TYPE",
")",
"{",
"logger",
".",
"log",
"(",
"LOG_LEVEL",
".",
"WARNING",
",",
"sprintf",
"(",
"L... | Given a custom attribute audience condition and user attributes, evaluate the
condition against the attributes.
@param {Object} condition
@param {Object} userAttributes
@param {Object} logger
@return {?Boolean} true/false if the given user attributes match/don't match the given condition,
null if the g... | [
"Given",
"a",
"custom",
"attribute",
"audience",
"condition",
"and",
"user",
"attributes",
"evaluate",
"the",
"condition",
"against",
"the",
"attributes",
"."
] | 39c3b2d97388100abd1c25d355a71c72b17363be | https://github.com/optimizely/javascript-sdk/blob/39c3b2d97388100abd1c25d355a71c72b17363be/packages/optimizely-sdk/lib/core/custom_attribute_condition_evaluator/index.js#L57-L77 |
9,903 | optimizely/javascript-sdk | packages/optimizely-sdk/lib/core/custom_attribute_condition_evaluator/index.js | existsEvaluator | function existsEvaluator(condition, userAttributes) {
var userValue = userAttributes[condition.name];
return typeof userValue !== 'undefined' && userValue !== null;
} | javascript | function existsEvaluator(condition, userAttributes) {
var userValue = userAttributes[condition.name];
return typeof userValue !== 'undefined' && userValue !== null;
} | [
"function",
"existsEvaluator",
"(",
"condition",
",",
"userAttributes",
")",
"{",
"var",
"userValue",
"=",
"userAttributes",
"[",
"condition",
".",
"name",
"]",
";",
"return",
"typeof",
"userValue",
"!==",
"'undefined'",
"&&",
"userValue",
"!==",
"null",
";",
... | Evaluate the given exists match condition for the given user attributes
@param {Object} condition
@param {Object} userAttributes
@returns {Boolean} true if both:
1) the user attributes have a value for the given condition, and
2) the user attribute value is neither null nor undefined
Returns false otherwise | [
"Evaluate",
"the",
"given",
"exists",
"match",
"condition",
"for",
"the",
"given",
"user",
"attributes"
] | 39c3b2d97388100abd1c25d355a71c72b17363be | https://github.com/optimizely/javascript-sdk/blob/39c3b2d97388100abd1c25d355a71c72b17363be/packages/optimizely-sdk/lib/core/custom_attribute_condition_evaluator/index.js#L140-L143 |
9,904 | optimizely/javascript-sdk | packages/optimizely-sdk/lib/core/custom_attribute_condition_evaluator/index.js | greaterThanEvaluator | function greaterThanEvaluator(condition, userAttributes, logger) {
var conditionName = condition.name;
var userValue = userAttributes[conditionName];
var userValueType = typeof userValue;
var conditionValue = condition.value;
if (!fns.isFinite(conditionValue)) {
logger.log(LOG_LEVEL.WARNING, sprintf(LOG_... | javascript | function greaterThanEvaluator(condition, userAttributes, logger) {
var conditionName = condition.name;
var userValue = userAttributes[conditionName];
var userValueType = typeof userValue;
var conditionValue = condition.value;
if (!fns.isFinite(conditionValue)) {
logger.log(LOG_LEVEL.WARNING, sprintf(LOG_... | [
"function",
"greaterThanEvaluator",
"(",
"condition",
",",
"userAttributes",
",",
"logger",
")",
"{",
"var",
"conditionName",
"=",
"condition",
".",
"name",
";",
"var",
"userValue",
"=",
"userAttributes",
"[",
"conditionName",
"]",
";",
"var",
"userValueType",
"... | Evaluate the given greater than match condition for the given user attributes
@param {Object} condition
@param {Object} userAttributes
@param {Object} logger
@returns {?Boolean} true if the user attribute value is greater than the condition value,
false if the user attribute value is less than or equal ... | [
"Evaluate",
"the",
"given",
"greater",
"than",
"match",
"condition",
"for",
"the",
"given",
"user",
"attributes"
] | 39c3b2d97388100abd1c25d355a71c72b17363be | https://github.com/optimizely/javascript-sdk/blob/39c3b2d97388100abd1c25d355a71c72b17363be/packages/optimizely-sdk/lib/core/custom_attribute_condition_evaluator/index.js#L155-L182 |
9,905 | optimizely/javascript-sdk | packages/optimizely-sdk/lib/core/custom_attribute_condition_evaluator/index.js | substringEvaluator | function substringEvaluator(condition, userAttributes, logger) {
var conditionName = condition.name;
var userValue = userAttributes[condition.name];
var userValueType = typeof userValue;
var conditionValue = condition.value;
if (typeof conditionValue !== 'string') {
logger.log(LOG_LEVEL.WARNING, sprintf(... | javascript | function substringEvaluator(condition, userAttributes, logger) {
var conditionName = condition.name;
var userValue = userAttributes[condition.name];
var userValueType = typeof userValue;
var conditionValue = condition.value;
if (typeof conditionValue !== 'string') {
logger.log(LOG_LEVEL.WARNING, sprintf(... | [
"function",
"substringEvaluator",
"(",
"condition",
",",
"userAttributes",
",",
"logger",
")",
"{",
"var",
"conditionName",
"=",
"condition",
".",
"name",
";",
"var",
"userValue",
"=",
"userAttributes",
"[",
"condition",
".",
"name",
"]",
";",
"var",
"userValu... | Evaluate the given substring match condition for the given user attributes
@param {Object} condition
@param {Object} userAttributes
@param {Object} logger
@returns {?Boolean} true if the condition value is a substring of the user attribute value,
false if the condition value is not a substring of the us... | [
"Evaluate",
"the",
"given",
"substring",
"match",
"condition",
"for",
"the",
"given",
"user",
"attributes"
] | 39c3b2d97388100abd1c25d355a71c72b17363be | https://github.com/optimizely/javascript-sdk/blob/39c3b2d97388100abd1c25d355a71c72b17363be/packages/optimizely-sdk/lib/core/custom_attribute_condition_evaluator/index.js#L233-L255 |
9,906 | optimizely/javascript-sdk | packages/optimizely-sdk/lib/core/condition_tree_evaluator/index.js | evaluate | function evaluate(conditions, leafEvaluator) {
if (Array.isArray(conditions)) {
var firstOperator = conditions[0];
var restOfConditions = conditions.slice(1);
if (DEFAULT_OPERATOR_TYPES.indexOf(firstOperator) === -1) {
// Operator to apply is not explicit - assume 'or'
firstOperator = OR_COND... | javascript | function evaluate(conditions, leafEvaluator) {
if (Array.isArray(conditions)) {
var firstOperator = conditions[0];
var restOfConditions = conditions.slice(1);
if (DEFAULT_OPERATOR_TYPES.indexOf(firstOperator) === -1) {
// Operator to apply is not explicit - assume 'or'
firstOperator = OR_COND... | [
"function",
"evaluate",
"(",
"conditions",
",",
"leafEvaluator",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"conditions",
")",
")",
"{",
"var",
"firstOperator",
"=",
"conditions",
"[",
"0",
"]",
";",
"var",
"restOfConditions",
"=",
"conditions",
".... | Top level method to evaluate conditions
@param {Array|*} conditions Nested array of and/or conditions, or a single leaf
condition value of any type
Example: ['and', '0', ['or', '1', '2']]
@param {Function} leafEvaluator Function which will be called to evaluate leaf condition
values
@return {?Boolean} ... | [
"Top",
"level",
"method",
"to",
"evaluate",
"conditions"
] | 39c3b2d97388100abd1c25d355a71c72b17363be | https://github.com/optimizely/javascript-sdk/blob/39c3b2d97388100abd1c25d355a71c72b17363be/packages/optimizely-sdk/lib/core/condition_tree_evaluator/index.js#L35-L58 |
9,907 | optimizely/javascript-sdk | packages/optimizely-sdk/lib/core/condition_tree_evaluator/index.js | andEvaluator | function andEvaluator(conditions, leafEvaluator) {
var sawNullResult = false;
for (var i = 0; i < conditions.length; i++) {
var conditionResult = evaluate(conditions[i], leafEvaluator);
if (conditionResult === false) {
return false;
}
if (conditionResult === null) {
sawNullResult = true;... | javascript | function andEvaluator(conditions, leafEvaluator) {
var sawNullResult = false;
for (var i = 0; i < conditions.length; i++) {
var conditionResult = evaluate(conditions[i], leafEvaluator);
if (conditionResult === false) {
return false;
}
if (conditionResult === null) {
sawNullResult = true;... | [
"function",
"andEvaluator",
"(",
"conditions",
",",
"leafEvaluator",
")",
"{",
"var",
"sawNullResult",
"=",
"false",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"conditions",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"conditionResult",
... | Evaluates an array of conditions as if the evaluator had been applied
to each entry and the results AND-ed together.
@param {Array} conditions Array of conditions ex: [operand_1, operand_2]
@param {Function} leafEvaluator Function which will be called to evaluate leaf condition values
@return {?Boolean}... | [
"Evaluates",
"an",
"array",
"of",
"conditions",
"as",
"if",
"the",
"evaluator",
"had",
"been",
"applied",
"to",
"each",
"entry",
"and",
"the",
"results",
"AND",
"-",
"ed",
"together",
"."
] | 39c3b2d97388100abd1c25d355a71c72b17363be | https://github.com/optimizely/javascript-sdk/blob/39c3b2d97388100abd1c25d355a71c72b17363be/packages/optimizely-sdk/lib/core/condition_tree_evaluator/index.js#L69-L81 |
9,908 | optimizely/javascript-sdk | packages/optimizely-sdk/lib/core/condition_tree_evaluator/index.js | notEvaluator | function notEvaluator(conditions, leafEvaluator) {
if (conditions.length > 0) {
var result = evaluate(conditions[0], leafEvaluator);
return result === null ? null : !result;
}
return null;
} | javascript | function notEvaluator(conditions, leafEvaluator) {
if (conditions.length > 0) {
var result = evaluate(conditions[0], leafEvaluator);
return result === null ? null : !result;
}
return null;
} | [
"function",
"notEvaluator",
"(",
"conditions",
",",
"leafEvaluator",
")",
"{",
"if",
"(",
"conditions",
".",
"length",
">",
"0",
")",
"{",
"var",
"result",
"=",
"evaluate",
"(",
"conditions",
"[",
"0",
"]",
",",
"leafEvaluator",
")",
";",
"return",
"resu... | Evaluates an array of conditions as if the evaluator had been applied
to a single entry and NOT was applied to the result.
@param {Array} conditions Array of conditions ex: [operand_1]
@param {Function} leafEvaluator Function which will be called to evaluate leaf condition values
@return {?Boolean} ... | [
"Evaluates",
"an",
"array",
"of",
"conditions",
"as",
"if",
"the",
"evaluator",
"had",
"been",
"applied",
"to",
"a",
"single",
"entry",
"and",
"NOT",
"was",
"applied",
"to",
"the",
"result",
"."
] | 39c3b2d97388100abd1c25d355a71c72b17363be | https://github.com/optimizely/javascript-sdk/blob/39c3b2d97388100abd1c25d355a71c72b17363be/packages/optimizely-sdk/lib/core/condition_tree_evaluator/index.js#L92-L98 |
9,909 | optimizely/javascript-sdk | packages/optimizely-sdk/lib/optimizely/index.js | Optimizely | function Optimizely(config) {
var clientEngine = config.clientEngine;
if (clientEngine !== enums.NODE_CLIENT_ENGINE && clientEngine !== enums.JAVASCRIPT_CLIENT_ENGINE) {
config.logger.log(LOG_LEVEL.INFO, sprintf(LOG_MESSAGES.INVALID_CLIENT_ENGINE, MODULE_NAME, clientEngine));
clientEngine = enums.NODE_CLIEN... | javascript | function Optimizely(config) {
var clientEngine = config.clientEngine;
if (clientEngine !== enums.NODE_CLIENT_ENGINE && clientEngine !== enums.JAVASCRIPT_CLIENT_ENGINE) {
config.logger.log(LOG_LEVEL.INFO, sprintf(LOG_MESSAGES.INVALID_CLIENT_ENGINE, MODULE_NAME, clientEngine));
clientEngine = enums.NODE_CLIEN... | [
"function",
"Optimizely",
"(",
"config",
")",
"{",
"var",
"clientEngine",
"=",
"config",
".",
"clientEngine",
";",
"if",
"(",
"clientEngine",
"!==",
"enums",
".",
"NODE_CLIENT_ENGINE",
"&&",
"clientEngine",
"!==",
"enums",
".",
"JAVASCRIPT_CLIENT_ENGINE",
")",
"... | The Optimizely class
@param {Object} config
@param {string} config.clientEngine
@param {string} config.clientVersion
@param {Object} config.datafile
@param {Object} config.errorHandler
@param {Object} config.eventDispatcher
@param {Object} config.logger
@param {Object} config.skipJSONValidation
@param {Object} config.u... | [
"The",
"Optimizely",
"class"
] | 39c3b2d97388100abd1c25d355a71c72b17363be | https://github.com/optimizely/javascript-sdk/blob/39c3b2d97388100abd1c25d355a71c72b17363be/packages/optimizely-sdk/lib/optimizely/index.js#L59-L119 |
9,910 | optimizely/javascript-sdk | packages/optimizely-sdk/lib/utils/user_profile_service_validator/index.js | function(userProfileServiceInstance) {
if (typeof userProfileServiceInstance.lookup !== 'function') {
throw new Error(sprintf(ERROR_MESSAGES.INVALID_USER_PROFILE_SERVICE, MODULE_NAME, 'Missing function \'lookup\''));
} else if (typeof userProfileServiceInstance.save !== 'function') {
throw new Error... | javascript | function(userProfileServiceInstance) {
if (typeof userProfileServiceInstance.lookup !== 'function') {
throw new Error(sprintf(ERROR_MESSAGES.INVALID_USER_PROFILE_SERVICE, MODULE_NAME, 'Missing function \'lookup\''));
} else if (typeof userProfileServiceInstance.save !== 'function') {
throw new Error... | [
"function",
"(",
"userProfileServiceInstance",
")",
"{",
"if",
"(",
"typeof",
"userProfileServiceInstance",
".",
"lookup",
"!==",
"'function'",
")",
"{",
"throw",
"new",
"Error",
"(",
"sprintf",
"(",
"ERROR_MESSAGES",
".",
"INVALID_USER_PROFILE_SERVICE",
",",
"MODUL... | Validates user's provided user profile service instance
@param {Object} userProfileServiceInstance
@return {boolean} True if the instance is valid
@throws If the instance is not valid | [
"Validates",
"user",
"s",
"provided",
"user",
"profile",
"service",
"instance"
] | 39c3b2d97388100abd1c25d355a71c72b17363be | https://github.com/optimizely/javascript-sdk/blob/39c3b2d97388100abd1c25d355a71c72b17363be/packages/optimizely-sdk/lib/utils/user_profile_service_validator/index.js#L33-L40 | |
9,911 | optimizely/javascript-sdk | packages/optimizely-sdk/lib/core/project_config/project_config_manager.js | ProjectConfigManager | function ProjectConfigManager(config) {
try {
this.__initialize(config);
} catch (ex) {
logger.error(ex);
this.__updateListeners = [];
this.__configObj = null;
this.__readyPromise = Promise.resolve({
success: false,
reason: getErrorMessage(ex, 'Error in initialize'),
});
}
} | javascript | function ProjectConfigManager(config) {
try {
this.__initialize(config);
} catch (ex) {
logger.error(ex);
this.__updateListeners = [];
this.__configObj = null;
this.__readyPromise = Promise.resolve({
success: false,
reason: getErrorMessage(ex, 'Error in initialize'),
});
}
} | [
"function",
"ProjectConfigManager",
"(",
"config",
")",
"{",
"try",
"{",
"this",
".",
"__initialize",
"(",
"config",
")",
";",
"}",
"catch",
"(",
"ex",
")",
"{",
"logger",
".",
"error",
"(",
"ex",
")",
";",
"this",
".",
"__updateListeners",
"=",
"[",
... | ProjectConfigManager provides project config objects via its methods
getConfig and onUpdate. It uses a DatafileManager to fetch datafiles. It is
responsible for parsing and validating datafiles, and converting datafile
JSON objects into project config objects.
@param {Object} config
@param {Object|string=} conf... | [
"ProjectConfigManager",
"provides",
"project",
"config",
"objects",
"via",
"its",
"methods",
"getConfig",
"and",
"onUpdate",
".",
"It",
"uses",
"a",
"DatafileManager",
"to",
"fetch",
"datafiles",
".",
"It",
"is",
"responsible",
"for",
"parsing",
"and",
"validating... | 39c3b2d97388100abd1c25d355a71c72b17363be | https://github.com/optimizely/javascript-sdk/blob/39c3b2d97388100abd1c25d355a71c72b17363be/packages/optimizely-sdk/lib/core/project_config/project_config_manager.js#L58-L70 |
9,912 | optimizely/javascript-sdk | packages/optimizely-sdk/lib/utils/json_schema_validator/index.js | function(jsonSchema, jsonObject) {
if (!jsonSchema) {
throw new Error(sprintf(ERROR_MESSAGES.JSON_SCHEMA_EXPECTED, MODULE_NAME));
}
if (!jsonObject) {
throw new Error(sprintf(ERROR_MESSAGES.NO_JSON_PROVIDED, MODULE_NAME));
}
var result = validate(jsonObject, jsonSchema);
if (result... | javascript | function(jsonSchema, jsonObject) {
if (!jsonSchema) {
throw new Error(sprintf(ERROR_MESSAGES.JSON_SCHEMA_EXPECTED, MODULE_NAME));
}
if (!jsonObject) {
throw new Error(sprintf(ERROR_MESSAGES.NO_JSON_PROVIDED, MODULE_NAME));
}
var result = validate(jsonObject, jsonSchema);
if (result... | [
"function",
"(",
"jsonSchema",
",",
"jsonObject",
")",
"{",
"if",
"(",
"!",
"jsonSchema",
")",
"{",
"throw",
"new",
"Error",
"(",
"sprintf",
"(",
"ERROR_MESSAGES",
".",
"JSON_SCHEMA_EXPECTED",
",",
"MODULE_NAME",
")",
")",
";",
"}",
"if",
"(",
"!",
"json... | Validate the given json object against the specified schema
@param {Object} jsonSchema The json schema to validate against
@param {Object} jsonObject The object to validate against the schema
@return {Boolean} True if the given object is valid | [
"Validate",
"the",
"given",
"json",
"object",
"against",
"the",
"specified",
"schema"
] | 39c3b2d97388100abd1c25d355a71c72b17363be | https://github.com/optimizely/javascript-sdk/blob/39c3b2d97388100abd1c25d355a71c72b17363be/packages/optimizely-sdk/lib/utils/json_schema_validator/index.js#L30-L48 | |
9,913 | optimizely/javascript-sdk | packages/optimizely-sdk/lib/utils/event_tag_utils/index.js | function(eventTags, logger) {
if (eventTags && eventTags.hasOwnProperty(REVENUE_EVENT_METRIC_NAME)) {
var rawValue = eventTags[REVENUE_EVENT_METRIC_NAME];
var parsedRevenueValue = parseInt(rawValue, 10);
if (isNaN(parsedRevenueValue)) {
logger.log(LOG_LEVEL.INFO, sprintf(LOG_MESSAGES.FAILE... | javascript | function(eventTags, logger) {
if (eventTags && eventTags.hasOwnProperty(REVENUE_EVENT_METRIC_NAME)) {
var rawValue = eventTags[REVENUE_EVENT_METRIC_NAME];
var parsedRevenueValue = parseInt(rawValue, 10);
if (isNaN(parsedRevenueValue)) {
logger.log(LOG_LEVEL.INFO, sprintf(LOG_MESSAGES.FAILE... | [
"function",
"(",
"eventTags",
",",
"logger",
")",
"{",
"if",
"(",
"eventTags",
"&&",
"eventTags",
".",
"hasOwnProperty",
"(",
"REVENUE_EVENT_METRIC_NAME",
")",
")",
"{",
"var",
"rawValue",
"=",
"eventTags",
"[",
"REVENUE_EVENT_METRIC_NAME",
"]",
";",
"var",
"p... | Grab the revenue value from the event tags. "revenue" is a reserved keyword.
@param {Object} eventTags
@param {Object} logger
@return {Integer|null} | [
"Grab",
"the",
"revenue",
"value",
"from",
"the",
"event",
"tags",
".",
"revenue",
"is",
"a",
"reserved",
"keyword",
"."
] | 39c3b2d97388100abd1c25d355a71c72b17363be | https://github.com/optimizely/javascript-sdk/blob/39c3b2d97388100abd1c25d355a71c72b17363be/packages/optimizely-sdk/lib/utils/event_tag_utils/index.js#L36-L48 | |
9,914 | optimizely/javascript-sdk | packages/optimizely-sdk/lib/utils/event_tag_utils/index.js | function(eventTags, logger) {
if (eventTags && eventTags.hasOwnProperty(VALUE_EVENT_METRIC_NAME)) {
var rawValue = eventTags[VALUE_EVENT_METRIC_NAME];
var parsedEventValue = parseFloat(rawValue);
if (isNaN(parsedEventValue)) {
logger.log(LOG_LEVEL.INFO, sprintf(LOG_MESSAGES.FAILED_TO_PARSE... | javascript | function(eventTags, logger) {
if (eventTags && eventTags.hasOwnProperty(VALUE_EVENT_METRIC_NAME)) {
var rawValue = eventTags[VALUE_EVENT_METRIC_NAME];
var parsedEventValue = parseFloat(rawValue);
if (isNaN(parsedEventValue)) {
logger.log(LOG_LEVEL.INFO, sprintf(LOG_MESSAGES.FAILED_TO_PARSE... | [
"function",
"(",
"eventTags",
",",
"logger",
")",
"{",
"if",
"(",
"eventTags",
"&&",
"eventTags",
".",
"hasOwnProperty",
"(",
"VALUE_EVENT_METRIC_NAME",
")",
")",
"{",
"var",
"rawValue",
"=",
"eventTags",
"[",
"VALUE_EVENT_METRIC_NAME",
"]",
";",
"var",
"parse... | Grab the event value from the event tags. "value" is a reserved keyword.
@param {Object} eventTags
@param {Object} logger
@return {Number|null} | [
"Grab",
"the",
"event",
"value",
"from",
"the",
"event",
"tags",
".",
"value",
"is",
"a",
"reserved",
"keyword",
"."
] | 39c3b2d97388100abd1c25d355a71c72b17363be | https://github.com/optimizely/javascript-sdk/blob/39c3b2d97388100abd1c25d355a71c72b17363be/packages/optimizely-sdk/lib/utils/event_tag_utils/index.js#L56-L68 | |
9,915 | optimizely/javascript-sdk | packages/optimizely-sdk/lib/utils/attributes_validator/index.js | function(attributes) {
if (typeof attributes === 'object' && !Array.isArray(attributes) && attributes !== null) {
lodashForOwn(attributes, function(value, key) {
if (typeof value === 'undefined') {
throw new Error(sprintf(ERROR_MESSAGES.UNDEFINED_ATTRIBUTE, MODULE_NAME, key));
}
... | javascript | function(attributes) {
if (typeof attributes === 'object' && !Array.isArray(attributes) && attributes !== null) {
lodashForOwn(attributes, function(value, key) {
if (typeof value === 'undefined') {
throw new Error(sprintf(ERROR_MESSAGES.UNDEFINED_ATTRIBUTE, MODULE_NAME, key));
}
... | [
"function",
"(",
"attributes",
")",
"{",
"if",
"(",
"typeof",
"attributes",
"===",
"'object'",
"&&",
"!",
"Array",
".",
"isArray",
"(",
"attributes",
")",
"&&",
"attributes",
"!==",
"null",
")",
"{",
"lodashForOwn",
"(",
"attributes",
",",
"function",
"(",... | Validates user's provided attributes
@param {Object} attributes
@return {boolean} True if the attributes are valid
@throws If the attributes are not valid | [
"Validates",
"user",
"s",
"provided",
"attributes"
] | 39c3b2d97388100abd1c25d355a71c72b17363be | https://github.com/optimizely/javascript-sdk/blob/39c3b2d97388100abd1c25d355a71c72b17363be/packages/optimizely-sdk/lib/utils/attributes_validator/index.js#L35-L46 | |
9,916 | qTip2/qTip2 | src/tips/tips.js | function(corner, size, scale) {
scale = scale || 1;
size = size || this.size;
var width = size[0] * scale,
height = size[1] * scale,
width2 = Math.ceil(width / 2), height2 = Math.ceil(height / 2),
// Define tip coordinates in terms of height and width values
tips = {
br: [0,0, width,height, width,... | javascript | function(corner, size, scale) {
scale = scale || 1;
size = size || this.size;
var width = size[0] * scale,
height = size[1] * scale,
width2 = Math.ceil(width / 2), height2 = Math.ceil(height / 2),
// Define tip coordinates in terms of height and width values
tips = {
br: [0,0, width,height, width,... | [
"function",
"(",
"corner",
",",
"size",
",",
"scale",
")",
"{",
"scale",
"=",
"scale",
"||",
"1",
";",
"size",
"=",
"size",
"||",
"this",
".",
"size",
";",
"var",
"width",
"=",
"size",
"[",
"0",
"]",
"*",
"scale",
",",
"height",
"=",
"size",
"[... | Tip coordinates calculator | [
"Tip",
"coordinates",
"calculator"
] | eeffdbaa2340de54f8fb9f0dd0d17532f907be55 | https://github.com/qTip2/qTip2/blob/eeffdbaa2340de54f8fb9f0dd0d17532f907be55/src/tips/tips.js#L222-L247 | |
9,917 | qTip2/qTip2 | dist/jquery.qtip.js | function() {
if(!this.rendered) { return; }
// Set tracking flag
var posOptions = this.options.position;
this.tooltip.attr('tracking', posOptions.target === 'mouse' && posOptions.adjust.mouse);
// Reassign events
this._unassignEvents();
this._assignEvents();
} | javascript | function() {
if(!this.rendered) { return; }
// Set tracking flag
var posOptions = this.options.position;
this.tooltip.attr('tracking', posOptions.target === 'mouse' && posOptions.adjust.mouse);
// Reassign events
this._unassignEvents();
this._assignEvents();
} | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"rendered",
")",
"{",
"return",
";",
"}",
"// Set tracking flag",
"var",
"posOptions",
"=",
"this",
".",
"options",
".",
"position",
";",
"this",
".",
"tooltip",
".",
"attr",
"(",
"'tracking'",
",... | Properties which require event reassignment | [
"Properties",
"which",
"require",
"event",
"reassignment"
] | eeffdbaa2340de54f8fb9f0dd0d17532f907be55 | https://github.com/qTip2/qTip2/blob/eeffdbaa2340de54f8fb9f0dd0d17532f907be55/dist/jquery.qtip.js#L483-L493 | |
9,918 | qTip2/qTip2 | dist/jquery.qtip.js | convertNotation | function convertNotation(options, notation) {
var i = 0, obj, option = options,
// Split notation into array
levels = notation.split('.');
// Loop through
while(option = option[ levels[i++] ]) {
if(i < levels.length) { obj = option; }
}
return [obj || options, levels.pop()];
} | javascript | function convertNotation(options, notation) {
var i = 0, obj, option = options,
// Split notation into array
levels = notation.split('.');
// Loop through
while(option = option[ levels[i++] ]) {
if(i < levels.length) { obj = option; }
}
return [obj || options, levels.pop()];
} | [
"function",
"convertNotation",
"(",
"options",
",",
"notation",
")",
"{",
"var",
"i",
"=",
"0",
",",
"obj",
",",
"option",
"=",
"options",
",",
"// Split notation into array",
"levels",
"=",
"notation",
".",
"split",
"(",
"'.'",
")",
";",
"// Loop through",
... | Dot notation converter | [
"Dot",
"notation",
"converter"
] | eeffdbaa2340de54f8fb9f0dd0d17532f907be55 | https://github.com/qTip2/qTip2/blob/eeffdbaa2340de54f8fb9f0dd0d17532f907be55/dist/jquery.qtip.js#L498-L510 |
9,919 | qTip2/qTip2 | dist/jquery.qtip.js | delegate | function delegate(selector, events, method) {
$(document.body).delegate(selector,
(events.split ? events : events.join('.'+NAMESPACE + ' ')) + '.'+NAMESPACE,
function() {
var api = QTIP.api[ $.attr(this, ATTR_ID) ];
api && !api.disabled && method.apply(api, arguments);
}
);
} | javascript | function delegate(selector, events, method) {
$(document.body).delegate(selector,
(events.split ? events : events.join('.'+NAMESPACE + ' ')) + '.'+NAMESPACE,
function() {
var api = QTIP.api[ $.attr(this, ATTR_ID) ];
api && !api.disabled && method.apply(api, arguments);
}
);
} | [
"function",
"delegate",
"(",
"selector",
",",
"events",
",",
"method",
")",
"{",
"$",
"(",
"document",
".",
"body",
")",
".",
"delegate",
"(",
"selector",
",",
"(",
"events",
".",
"split",
"?",
"events",
":",
"events",
".",
"join",
"(",
"'.'",
"+",
... | Global delegation helper | [
"Global",
"delegation",
"helper"
] | eeffdbaa2340de54f8fb9f0dd0d17532f907be55 | https://github.com/qTip2/qTip2/blob/eeffdbaa2340de54f8fb9f0dd0d17532f907be55/dist/jquery.qtip.js#L1399-L1407 |
9,920 | qTip2/qTip2 | dist/jquery.qtip.js | hoverIntent | function hoverIntent(hoverEvent) {
// Only continue if tooltip isn't disabled
if(this.disabled || this.destroyed) { return FALSE; }
// Cache the event data
this.cache.event = hoverEvent && $.event.fix(hoverEvent);
this.cache.target = hoverEvent && $(hoverEvent.target);
// Start the event sequence
clearT... | javascript | function hoverIntent(hoverEvent) {
// Only continue if tooltip isn't disabled
if(this.disabled || this.destroyed) { return FALSE; }
// Cache the event data
this.cache.event = hoverEvent && $.event.fix(hoverEvent);
this.cache.target = hoverEvent && $(hoverEvent.target);
// Start the event sequence
clearT... | [
"function",
"hoverIntent",
"(",
"hoverEvent",
")",
"{",
"// Only continue if tooltip isn't disabled",
"if",
"(",
"this",
".",
"disabled",
"||",
"this",
".",
"destroyed",
")",
"{",
"return",
"FALSE",
";",
"}",
"// Cache the event data",
"this",
".",
"cache",
".",
... | Define hoverIntent function | [
"Define",
"hoverIntent",
"function"
] | eeffdbaa2340de54f8fb9f0dd0d17532f907be55 | https://github.com/qTip2/qTip2/blob/eeffdbaa2340de54f8fb9f0dd0d17532f907be55/dist/jquery.qtip.js#L1487-L1501 |
9,921 | qTip2/qTip2 | dist/jquery.qtip.js | stealFocus | function stealFocus(event) {
if(!elem.is(':visible')) { return; }
var target = $(event.target),
tooltip = current.tooltip,
container = target.closest(SELECTOR),
targetOnTop;
// Determine if input container target is above this
targetOnTop = container.length < 1 ? FALSE :
parseInt(container[0].styl... | javascript | function stealFocus(event) {
if(!elem.is(':visible')) { return; }
var target = $(event.target),
tooltip = current.tooltip,
container = target.closest(SELECTOR),
targetOnTop;
// Determine if input container target is above this
targetOnTop = container.length < 1 ? FALSE :
parseInt(container[0].styl... | [
"function",
"stealFocus",
"(",
"event",
")",
"{",
"if",
"(",
"!",
"elem",
".",
"is",
"(",
"':visible'",
")",
")",
"{",
"return",
";",
"}",
"var",
"target",
"=",
"$",
"(",
"event",
".",
"target",
")",
",",
"tooltip",
"=",
"current",
".",
"tooltip",
... | Steal focus from elements outside tooltip | [
"Steal",
"focus",
"from",
"elements",
"outside",
"tooltip"
] | eeffdbaa2340de54f8fb9f0dd0d17532f907be55 | https://github.com/qTip2/qTip2/blob/eeffdbaa2340de54f8fb9f0dd0d17532f907be55/dist/jquery.qtip.js#L2701-L2719 |
9,922 | qTip2/qTip2 | dist/jquery.qtip.js | calculate | function calculate(side, otherSide, type, adjustment, side1, side2, lengthName, targetLength, elemLength) {
var initialPos = position[side1],
mySide = my[side],
atSide = at[side],
isShift = type === SHIFT,
myLength = mySide === side1 ? elemLength : mySide === side2 ? -elemLength : -elemLength / 2,
atLe... | javascript | function calculate(side, otherSide, type, adjustment, side1, side2, lengthName, targetLength, elemLength) {
var initialPos = position[side1],
mySide = my[side],
atSide = at[side],
isShift = type === SHIFT,
myLength = mySide === side1 ? elemLength : mySide === side2 ? -elemLength : -elemLength / 2,
atLe... | [
"function",
"calculate",
"(",
"side",
",",
"otherSide",
",",
"type",
",",
"adjustment",
",",
"side1",
",",
"side2",
",",
"lengthName",
",",
"targetLength",
",",
"elemLength",
")",
"{",
"var",
"initialPos",
"=",
"position",
"[",
"side1",
"]",
",",
"mySide",... | Generic calculation method | [
"Generic",
"calculation",
"method"
] | eeffdbaa2340de54f8fb9f0dd0d17532f907be55 | https://github.com/qTip2/qTip2/blob/eeffdbaa2340de54f8fb9f0dd0d17532f907be55/dist/jquery.qtip.js#L3022-L3081 |
9,923 | mozilla/node-client-sessions | lib/client-sessions.js | zeroBuffer | function zeroBuffer(buf) {
for (var i = 0; i < buf.length; i++) {
buf[i] = 0;
}
return buf;
} | javascript | function zeroBuffer(buf) {
for (var i = 0; i < buf.length; i++) {
buf[i] = 0;
}
return buf;
} | [
"function",
"zeroBuffer",
"(",
"buf",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"buf",
".",
"length",
";",
"i",
"++",
")",
"{",
"buf",
"[",
"i",
"]",
"=",
"0",
";",
"}",
"return",
"buf",
";",
"}"
] | it's good cryptographic pracitice to not leave buffers with sensitive contents hanging around. | [
"it",
"s",
"good",
"cryptographic",
"pracitice",
"to",
"not",
"leave",
"buffers",
"with",
"sensitive",
"contents",
"hanging",
"around",
"."
] | b621a4ad49cf517ae43d6060f4ceb8306ac22506 | https://github.com/mozilla/node-client-sessions/blob/b621a4ad49cf517ae43d6060f4ceb8306ac22506/lib/client-sessions.js#L148-L153 |
9,924 | GetStream/stream-js | src/lib/errors.js | ErrorAbstract | function ErrorAbstract(msg, constructor) {
this.message = msg;
Error.call(this, this.message);
/* istanbul ignore else */
if (canCapture) {
Error.captureStackTrace(this, constructor);
} else if (canStack) {
this.stack = new Error().stack;
} else {
this.stack = '';
}
} | javascript | function ErrorAbstract(msg, constructor) {
this.message = msg;
Error.call(this, this.message);
/* istanbul ignore else */
if (canCapture) {
Error.captureStackTrace(this, constructor);
} else if (canStack) {
this.stack = new Error().stack;
} else {
this.stack = '';
}
} | [
"function",
"ErrorAbstract",
"(",
"msg",
",",
"constructor",
")",
"{",
"this",
".",
"message",
"=",
"msg",
";",
"Error",
".",
"call",
"(",
"this",
",",
"this",
".",
"message",
")",
";",
"/* istanbul ignore else */",
"if",
"(",
"canCapture",
")",
"{",
"Er... | Abstract error object
@class ErrorAbstract
@access private
@param {string} [msg] Error message
@param {function} constructor | [
"Abstract",
"error",
"object"
] | f418a0aea5a2db8806280e682b5084533b8410f1 | https://github.com/GetStream/stream-js/blob/f418a0aea5a2db8806280e682b5084533b8410f1/src/lib/errors.js#L13-L26 |
9,925 | higlass/higlass | app/scripts/PixiTrack.js | formatResolutionText | function formatResolutionText(resolution, maxResolutionSize) {
const pp = precisionPrefix(maxResolutionSize, resolution);
const f = formatPrefix(`.${pp}`, resolution);
const formattedResolution = f(resolution);
return formattedResolution;
} | javascript | function formatResolutionText(resolution, maxResolutionSize) {
const pp = precisionPrefix(maxResolutionSize, resolution);
const f = formatPrefix(`.${pp}`, resolution);
const formattedResolution = f(resolution);
return formattedResolution;
} | [
"function",
"formatResolutionText",
"(",
"resolution",
",",
"maxResolutionSize",
")",
"{",
"const",
"pp",
"=",
"precisionPrefix",
"(",
"maxResolutionSize",
",",
"resolution",
")",
";",
"const",
"f",
"=",
"formatPrefix",
"(",
"`",
"${",
"pp",
"}",
"`",
",",
"... | Format a resolution relative to the highest possible resolution.
The highest possible resolution determines the granularity of the
formatting (e.g. 20K vs 20000)
@param {int} resolution The resolution to format (e.g. 30000)
@param {int} maxResolutionSize The maximum possible resolution (e.g. 1000)
@returns {string} A... | [
"Format",
"a",
"resolution",
"relative",
"to",
"the",
"highest",
"possible",
"resolution",
"."
] | a1df80c6c24b66a1e66710dbe562184a1b6d8de8 | https://github.com/higlass/higlass/blob/a1df80c6c24b66a1e66710dbe562184a1b6d8de8/app/scripts/PixiTrack.js#L19-L25 |
9,926 | higlass/higlass | app/scripts/PixiTrack.js | getResolutionBasedResolutionText | function getResolutionBasedResolutionText(resolutions, zoomLevel) {
const sortedResolutions = resolutions.map(x => +x).sort((a, b) => b - a);
const resolution = sortedResolutions[zoomLevel];
const maxResolutionSize = sortedResolutions[sortedResolutions.length - 1];
return formatResolutionText(resolution, maxRe... | javascript | function getResolutionBasedResolutionText(resolutions, zoomLevel) {
const sortedResolutions = resolutions.map(x => +x).sort((a, b) => b - a);
const resolution = sortedResolutions[zoomLevel];
const maxResolutionSize = sortedResolutions[sortedResolutions.length - 1];
return formatResolutionText(resolution, maxRe... | [
"function",
"getResolutionBasedResolutionText",
"(",
"resolutions",
",",
"zoomLevel",
")",
"{",
"const",
"sortedResolutions",
"=",
"resolutions",
".",
"map",
"(",
"x",
"=>",
"+",
"x",
")",
".",
"sort",
"(",
"(",
"a",
",",
"b",
")",
"=>",
"b",
"-",
"a",
... | Get a text description of a resolution based on a zoom level
and a list of resolutions
@param {list} resolutions: A list of resolutions (e.g. [1000,2000,3000])
@param {int} zoomLevel: The current zoom level (e.g. 4)
@returns {string} A formatted string representation of the zoom level
(e.g. "30K") | [
"Get",
"a",
"text",
"description",
"of",
"a",
"resolution",
"based",
"on",
"a",
"zoom",
"level",
"and",
"a",
"list",
"of",
"resolutions"
] | a1df80c6c24b66a1e66710dbe562184a1b6d8de8 | https://github.com/higlass/higlass/blob/a1df80c6c24b66a1e66710dbe562184a1b6d8de8/app/scripts/PixiTrack.js#L37-L43 |
9,927 | higlass/higlass | app/scripts/PixiTrack.js | getWidthBasedResolutionText | function getWidthBasedResolutionText(
zoomLevel, maxWidth, binsPerDimension, maxZoom
) {
const resolution = maxWidth / ((2 ** zoomLevel) * binsPerDimension);
// we can't display a NaN resolution
if (!Number.isNaN(resolution)) {
// what is the maximum possible resolution?
// this will determine how we f... | javascript | function getWidthBasedResolutionText(
zoomLevel, maxWidth, binsPerDimension, maxZoom
) {
const resolution = maxWidth / ((2 ** zoomLevel) * binsPerDimension);
// we can't display a NaN resolution
if (!Number.isNaN(resolution)) {
// what is the maximum possible resolution?
// this will determine how we f... | [
"function",
"getWidthBasedResolutionText",
"(",
"zoomLevel",
",",
"maxWidth",
",",
"binsPerDimension",
",",
"maxZoom",
")",
"{",
"const",
"resolution",
"=",
"maxWidth",
"/",
"(",
"(",
"2",
"**",
"zoomLevel",
")",
"*",
"binsPerDimension",
")",
";",
"// we can't d... | Get a text description of the resolution based on the zoom level
max width of the dataset, the bins per dimension and the maximum
zoom.
@param {int} zoomLevel The current zoomLevel (e.g. 0)
@param {int} max_width The max width
(e.g. 2 ** maxZoom * highestResolution * binsPerDimension)
@param {int} bins_per_dimension T... | [
"Get",
"a",
"text",
"description",
"of",
"the",
"resolution",
"based",
"on",
"the",
"zoom",
"level",
"max",
"width",
"of",
"the",
"dataset",
"the",
"bins",
"per",
"dimension",
"and",
"the",
"maximum",
"zoom",
"."
] | a1df80c6c24b66a1e66710dbe562184a1b6d8de8 | https://github.com/higlass/higlass/blob/a1df80c6c24b66a1e66710dbe562184a1b6d8de8/app/scripts/PixiTrack.js#L60-L83 |
9,928 | higlass/higlass | app/scripts/services/tile-proxy.js | json | async function json(url, callback, pubSub) {
// Fritz: What is going on here? Can someone explain?
if (url.indexOf('hg19') >= 0) {
await sleep(1);
}
// console.log('url:', url);
return fetchEither(url, callback, 'json', pubSub);
} | javascript | async function json(url, callback, pubSub) {
// Fritz: What is going on here? Can someone explain?
if (url.indexOf('hg19') >= 0) {
await sleep(1);
}
// console.log('url:', url);
return fetchEither(url, callback, 'json', pubSub);
} | [
"async",
"function",
"json",
"(",
"url",
",",
"callback",
",",
"pubSub",
")",
"{",
"// Fritz: What is going on here? Can someone explain?",
"if",
"(",
"url",
".",
"indexOf",
"(",
"'hg19'",
")",
">=",
"0",
")",
"{",
"await",
"sleep",
"(",
"1",
")",
";",
"}"... | Send a JSON request and mark it so that we can tell how many are in flight
@param url: URL to fetch
@param callback: Callback to execute with content from fetch | [
"Send",
"a",
"JSON",
"request",
"and",
"mark",
"it",
"so",
"that",
"we",
"can",
"tell",
"how",
"many",
"are",
"in",
"flight"
] | a1df80c6c24b66a1e66710dbe562184a1b6d8de8 | https://github.com/higlass/higlass/blob/a1df80c6c24b66a1e66710dbe562184a1b6d8de8/app/scripts/services/tile-proxy.js#L606-L613 |
9,929 | postmanlabs/postman-runtime | lib/authorizer/oauth1.js | function (params) {
var url = params.url,
method = params.method,
helperParams = params.helperParams,
queryParams = params.queryParams,
bodyParams = params.bodyParams,
signatureParams,
message,
accessor = {},
allPara... | javascript | function (params) {
var url = params.url,
method = params.method,
helperParams = params.helperParams,
queryParams = params.queryParams,
bodyParams = params.bodyParams,
signatureParams,
message,
accessor = {},
allPara... | [
"function",
"(",
"params",
")",
"{",
"var",
"url",
"=",
"params",
".",
"url",
",",
"method",
"=",
"params",
".",
"method",
",",
"helperParams",
"=",
"params",
".",
"helperParams",
",",
"queryParams",
"=",
"params",
".",
"queryParams",
",",
"bodyParams",
... | Generates a oAuth1.
@param {Object} params
@param {String} params.url OAuth 1.0 Base URL
@param {String} params.method Request method
@param {Object[]} params.helperParams The auth parameters stored with the `Request`
@param {Object[]} params.queryParams An array of query parameters
@param {Object[]} params.bodyParams... | [
"Generates",
"a",
"oAuth1",
"."
] | 2d4fa9aca39ce4a3e3edecb153381fc2d59d2622 | https://github.com/postmanlabs/postman-runtime/blob/2d4fa9aca39ce4a3e3edecb153381fc2d59d2622/lib/authorizer/oauth1.js#L170-L214 | |
9,930 | postmanlabs/postman-runtime | lib/requester/core.js | function (headers, headerKey, defaultValue) {
var headerName = _.findKey(headers, function (value, key) {
return key.toLowerCase() === headerKey.toLowerCase();
});
if (!headerName) {
headers[headerKey] = defaultValue;
}
} | javascript | function (headers, headerKey, defaultValue) {
var headerName = _.findKey(headers, function (value, key) {
return key.toLowerCase() === headerKey.toLowerCase();
});
if (!headerName) {
headers[headerKey] = defaultValue;
}
} | [
"function",
"(",
"headers",
",",
"headerKey",
",",
"defaultValue",
")",
"{",
"var",
"headerName",
"=",
"_",
".",
"findKey",
"(",
"headers",
",",
"function",
"(",
"value",
",",
"key",
")",
"{",
"return",
"key",
".",
"toLowerCase",
"(",
")",
"===",
"head... | Checks if a header already exists. If it does not, sets the value to whatever is passed as
`defaultValue`
@param {object} headers
@param {String} headerKey
@param {String} defaultValue | [
"Checks",
"if",
"a",
"header",
"already",
"exists",
".",
"If",
"it",
"does",
"not",
"sets",
"the",
"value",
"to",
"whatever",
"is",
"passed",
"as",
"defaultValue"
] | 2d4fa9aca39ce4a3e3edecb153381fc2d59d2622 | https://github.com/postmanlabs/postman-runtime/blob/2d4fa9aca39ce4a3e3edecb153381fc2d59d2622/lib/requester/core.js#L331-L339 | |
9,931 | postmanlabs/postman-runtime | lib/requester/core.js | function (request, protocolProfileBehavior) {
if (!(request && request.body)) {
return;
}
var requestBody = request.body,
requestBodyType = requestBody.mode,
requestMethod = (typeof request.method === 'string') ? request.method.toLowerCase() : undefined,
... | javascript | function (request, protocolProfileBehavior) {
if (!(request && request.body)) {
return;
}
var requestBody = request.body,
requestBodyType = requestBody.mode,
requestMethod = (typeof request.method === 'string') ? request.method.toLowerCase() : undefined,
... | [
"function",
"(",
"request",
",",
"protocolProfileBehavior",
")",
"{",
"if",
"(",
"!",
"(",
"request",
"&&",
"request",
".",
"body",
")",
")",
"{",
"return",
";",
"}",
"var",
"requestBody",
"=",
"request",
".",
"body",
",",
"requestBodyType",
"=",
"reques... | Processes a request body and puts it in a format compatible with
the "request" library.
@todo: Move this to the SDK.
@param request - Request object
@param protocolProfileBehavior - Protocol profile behaviors
@returns {Object} | [
"Processes",
"a",
"request",
"body",
"and",
"puts",
"it",
"in",
"a",
"format",
"compatible",
"with",
"the",
"request",
"library",
"."
] | 2d4fa9aca39ce4a3e3edecb153381fc2d59d2622 | https://github.com/postmanlabs/postman-runtime/blob/2d4fa9aca39ce4a3e3edecb153381fc2d59d2622/lib/requester/core.js#L351-L386 | |
9,932 | postmanlabs/postman-runtime | lib/requester/core.js | function (buffer) {
var str = '',
uArrayVal = new Uint8Array(buffer),
i,
ii;
for (i = 0, ii = uArrayVal.length; i < ii; i++) {
str += String.fromCharCode(uArrayVal[i]);
}
return str;
} | javascript | function (buffer) {
var str = '',
uArrayVal = new Uint8Array(buffer),
i,
ii;
for (i = 0, ii = uArrayVal.length; i < ii; i++) {
str += String.fromCharCode(uArrayVal[i]);
}
return str;
} | [
"function",
"(",
"buffer",
")",
"{",
"var",
"str",
"=",
"''",
",",
"uArrayVal",
"=",
"new",
"Uint8Array",
"(",
"buffer",
")",
",",
"i",
",",
"ii",
";",
"for",
"(",
"i",
"=",
"0",
",",
"ii",
"=",
"uArrayVal",
".",
"length",
";",
"i",
"<",
"ii",
... | ArrayBuffer to String
@param {ArrayBuffer} buffer
@returns {String} | [
"ArrayBuffer",
"to",
"String"
] | 2d4fa9aca39ce4a3e3edecb153381fc2d59d2622 | https://github.com/postmanlabs/postman-runtime/blob/2d4fa9aca39ce4a3e3edecb153381fc2d59d2622/lib/requester/core.js#L446-L458 | |
9,933 | postmanlabs/postman-runtime | lib/requester/core.js | function (arr) {
if (!_.isArray(arr)) {
return;
}
var obj = {},
key,
val,
i,
ii;
for (i = 0, ii = arr.length; i < ii; i += 2) {
key = arr[i];
val = arr[i + 1];
if (_.has(obj, key)) {
... | javascript | function (arr) {
if (!_.isArray(arr)) {
return;
}
var obj = {},
key,
val,
i,
ii;
for (i = 0, ii = arr.length; i < ii; i += 2) {
key = arr[i];
val = arr[i + 1];
if (_.has(obj, key)) {
... | [
"function",
"(",
"arr",
")",
"{",
"if",
"(",
"!",
"_",
".",
"isArray",
"(",
"arr",
")",
")",
"{",
"return",
";",
"}",
"var",
"obj",
"=",
"{",
"}",
",",
"key",
",",
"val",
",",
"i",
",",
"ii",
";",
"for",
"(",
"i",
"=",
"0",
",",
"ii",
"... | Converts an array of sequential pairs to an object.
@param arr
@returns {{}}
@example
['a', 'b', 'c', 'd'] ====> {a: 'b', c: 'd' } | [
"Converts",
"an",
"array",
"of",
"sequential",
"pairs",
"to",
"an",
"object",
"."
] | 2d4fa9aca39ce4a3e3edecb153381fc2d59d2622 | https://github.com/postmanlabs/postman-runtime/blob/2d4fa9aca39ce4a3e3edecb153381fc2d59d2622/lib/requester/core.js#L469-L494 | |
9,934 | postmanlabs/postman-runtime | lib/authorizer/index.js | function (Handler, name) {
if (!_.isFunction(Handler.init)) {
throw new Error('The handler for "' + name + '" does not have an "init" function, which is necessary');
}
if (!_.isFunction(Handler.pre)) {
throw new Error('The handler for "' + name + '" does not have a "pre"... | javascript | function (Handler, name) {
if (!_.isFunction(Handler.init)) {
throw new Error('The handler for "' + name + '" does not have an "init" function, which is necessary');
}
if (!_.isFunction(Handler.pre)) {
throw new Error('The handler for "' + name + '" does not have a "pre"... | [
"function",
"(",
"Handler",
",",
"name",
")",
"{",
"if",
"(",
"!",
"_",
".",
"isFunction",
"(",
"Handler",
".",
"init",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"'The handler for \"'",
"+",
"name",
"+",
"'\" does not have an \"init\" function, which is nec... | Adds a Handler for use with given Auth type.
@param Handler
@param name | [
"Adds",
"a",
"Handler",
"for",
"use",
"with",
"given",
"Auth",
"type",
"."
] | 2d4fa9aca39ce4a3e3edecb153381fc2d59d2622 | https://github.com/postmanlabs/postman-runtime/blob/2d4fa9aca39ce4a3e3edecb153381fc2d59d2622/lib/authorizer/index.js#L41-L66 | |
9,935 | postmanlabs/postman-runtime | lib/runner/request-helpers-postsend.js | function (context, run, done) {
// if no response is provided, there's nothing to do, and probably means that the request errored out
// let the actual request command handle whatever needs to be done.
if (!context.response) { return done(); }
// bail out if there is no auth
if ... | javascript | function (context, run, done) {
// if no response is provided, there's nothing to do, and probably means that the request errored out
// let the actual request command handle whatever needs to be done.
if (!context.response) { return done(); }
// bail out if there is no auth
if ... | [
"function",
"(",
"context",
",",
"run",
",",
"done",
")",
"{",
"// if no response is provided, there's nothing to do, and probably means that the request errored out",
"// let the actual request command handle whatever needs to be done.",
"if",
"(",
"!",
"context",
".",
"response",
... | Post authorization. | [
"Post",
"authorization",
"."
] | 2d4fa9aca39ce4a3e3edecb153381fc2d59d2622 | https://github.com/postmanlabs/postman-runtime/blob/2d4fa9aca39ce4a3e3edecb153381fc2d59d2622/lib/runner/request-helpers-postsend.js#L10-L60 | |
9,936 | postmanlabs/postman-runtime | lib/authorizer/hawk.js | function (auth, done) {
!auth.get('nonce') && auth.set('nonce', randomString(6));
!_.parseInt(auth.get('timestamp')) && auth.set('timestamp', Math.floor(Date.now() / 1e3));
done(null, true);
} | javascript | function (auth, done) {
!auth.get('nonce') && auth.set('nonce', randomString(6));
!_.parseInt(auth.get('timestamp')) && auth.set('timestamp', Math.floor(Date.now() / 1e3));
done(null, true);
} | [
"function",
"(",
"auth",
",",
"done",
")",
"{",
"!",
"auth",
".",
"get",
"(",
"'nonce'",
")",
"&&",
"auth",
".",
"set",
"(",
"'nonce'",
",",
"randomString",
"(",
"6",
")",
")",
";",
"!",
"_",
".",
"parseInt",
"(",
"auth",
".",
"get",
"(",
"'tim... | Checks the item, and fetches any parameters that are not already provided.
Sanitizes the auth parameters if needed.
@param {AuthInterface} auth
@param {AuthHandlerInterface~authPreHookCallback} done | [
"Checks",
"the",
"item",
"and",
"fetches",
"any",
"parameters",
"that",
"are",
"not",
"already",
"provided",
".",
"Sanitizes",
"the",
"auth",
"parameters",
"if",
"needed",
"."
] | 2d4fa9aca39ce4a3e3edecb153381fc2d59d2622 | https://github.com/postmanlabs/postman-runtime/blob/2d4fa9aca39ce4a3e3edecb153381fc2d59d2622/lib/authorizer/hawk.js#L159-L163 | |
9,937 | postmanlabs/postman-runtime | lib/authorizer/hawk.js | function (params) {
return Hawk.header(url.parse(params.url), params.method, params);
} | javascript | function (params) {
return Hawk.header(url.parse(params.url), params.method, params);
} | [
"function",
"(",
"params",
")",
"{",
"return",
"Hawk",
".",
"header",
"(",
"url",
".",
"parse",
"(",
"params",
".",
"url",
")",
",",
"params",
".",
"method",
",",
"params",
")",
";",
"}"
] | Computes signature and Auth header for a request.
@param {Object} params
@param {Object} params.credentials Contains hawk auth credentials, "id", "key" and "algorithm"
@param {String} params.nonce
@param {String} params.ext Extra data that may be associated with the request.
@param {String} params.app Application ID u... | [
"Computes",
"signature",
"and",
"Auth",
"header",
"for",
"a",
"request",
"."
] | 2d4fa9aca39ce4a3e3edecb153381fc2d59d2622 | https://github.com/postmanlabs/postman-runtime/blob/2d4fa9aca39ce4a3e3edecb153381fc2d59d2622/lib/authorizer/hawk.js#L191-L193 | |
9,938 | postmanlabs/postman-runtime | lib/runner/replay-controller.js | function (context, item, desiredPayload, success, failure) {
// max retries exceeded
if (this.count >= MAX_REPLAY_COUNT) {
return failure(new Error('runtime: maximum intermediate request limit exceeded'));
}
// update replay count state
this.count++;
// upda... | javascript | function (context, item, desiredPayload, success, failure) {
// max retries exceeded
if (this.count >= MAX_REPLAY_COUNT) {
return failure(new Error('runtime: maximum intermediate request limit exceeded'));
}
// update replay count state
this.count++;
// upda... | [
"function",
"(",
"context",
",",
"item",
",",
"desiredPayload",
",",
"success",
",",
"failure",
")",
"{",
"// max retries exceeded",
"if",
"(",
"this",
".",
"count",
">=",
"MAX_REPLAY_COUNT",
")",
"{",
"return",
"failure",
"(",
"new",
"Error",
"(",
"'runtime... | Sends a request in the item. This takes care of limiting the total number of replays for a request.
@param {Object} context
@param {Request} item
@param {Object} desiredPayload a partial payload to use for the replay request
@param {Function} success this callback is invoked when replay controller sent the request
@pa... | [
"Sends",
"a",
"request",
"in",
"the",
"item",
".",
"This",
"takes",
"care",
"of",
"limiting",
"the",
"total",
"number",
"of",
"replays",
"for",
"a",
"request",
"."
] | 2d4fa9aca39ce4a3e3edecb153381fc2d59d2622 | https://github.com/postmanlabs/postman-runtime/blob/2d4fa9aca39ce4a3e3edecb153381fc2d59d2622/lib/runner/replay-controller.js#L34-L62 | |
9,939 | postmanlabs/postman-runtime | lib/runner/request-helpers-presend.js | function () {
try {
authHandler.sign(authInterface, context.item.request, function (err) {
// handle all types of errors in one place, see catch block
if (err) { throw err; }
done();
});
... | javascript | function () {
try {
authHandler.sign(authInterface, context.item.request, function (err) {
// handle all types of errors in one place, see catch block
if (err) { throw err; }
done();
});
... | [
"function",
"(",
")",
"{",
"try",
"{",
"authHandler",
".",
"sign",
"(",
"authInterface",
",",
"context",
".",
"item",
".",
"request",
",",
"function",
"(",
"err",
")",
"{",
"// handle all types of errors in one place, see catch block",
"if",
"(",
"err",
")",
"... | get auth handler | [
"get",
"auth",
"handler"
] | 2d4fa9aca39ce4a3e3edecb153381fc2d59d2622 | https://github.com/postmanlabs/postman-runtime/blob/2d4fa9aca39ce4a3e3edecb153381fc2d59d2622/lib/runner/request-helpers-presend.js#L164-L184 | |
9,940 | postmanlabs/postman-runtime | lib/runner/request-helpers-presend.js | function (cb) {
if (_.isFunction(_.get(proxies, 'resolve'))) {
return cb(null, proxies.resolve(url));
}
return cb(null, undefined);
} | javascript | function (cb) {
if (_.isFunction(_.get(proxies, 'resolve'))) {
return cb(null, proxies.resolve(url));
}
return cb(null, undefined);
} | [
"function",
"(",
"cb",
")",
"{",
"if",
"(",
"_",
".",
"isFunction",
"(",
"_",
".",
"get",
"(",
"proxies",
",",
"'resolve'",
")",
")",
")",
"{",
"return",
"cb",
"(",
"null",
",",
"proxies",
".",
"resolve",
"(",
"url",
")",
")",
";",
"}",
"return... | try resolving custom proxies before falling-back to system proxy | [
"try",
"resolving",
"custom",
"proxies",
"before",
"falling",
"-",
"back",
"to",
"system",
"proxy"
] | 2d4fa9aca39ce4a3e3edecb153381fc2d59d2622 | https://github.com/postmanlabs/postman-runtime/blob/2d4fa9aca39ce4a3e3edecb153381fc2d59d2622/lib/runner/request-helpers-presend.js#L293-L299 | |
9,941 | postmanlabs/postman-runtime | lib/runner/request-helpers-presend.js | function (config, cb) {
if (config) {
return cb(null, config);
}
return _.isFunction(run.options.systemProxy) ? run.options.systemProxy(url, cb) : cb(null, undefined);
} | javascript | function (config, cb) {
if (config) {
return cb(null, config);
}
return _.isFunction(run.options.systemProxy) ? run.options.systemProxy(url, cb) : cb(null, undefined);
} | [
"function",
"(",
"config",
",",
"cb",
")",
"{",
"if",
"(",
"config",
")",
"{",
"return",
"cb",
"(",
"null",
",",
"config",
")",
";",
"}",
"return",
"_",
".",
"isFunction",
"(",
"run",
".",
"options",
".",
"systemProxy",
")",
"?",
"run",
".",
"opt... | fallback to system proxy | [
"fallback",
"to",
"system",
"proxy"
] | 2d4fa9aca39ce4a3e3edecb153381fc2d59d2622 | https://github.com/postmanlabs/postman-runtime/blob/2d4fa9aca39ce4a3e3edecb153381fc2d59d2622/lib/runner/request-helpers-presend.js#L301-L307 | |
9,942 | postmanlabs/postman-runtime | lib/runner/request-helpers-presend.js | function (context, run, done) {
var request,
pfxPath,
keyPath,
certPath,
fileResolver,
certificate;
// A. Check if we have the file resolver
fileResolver = run.options.fileResolver;
if (!fileResolver) { return done(); } // No... | javascript | function (context, run, done) {
var request,
pfxPath,
keyPath,
certPath,
fileResolver,
certificate;
// A. Check if we have the file resolver
fileResolver = run.options.fileResolver;
if (!fileResolver) { return done(); } // No... | [
"function",
"(",
"context",
",",
"run",
",",
"done",
")",
"{",
"var",
"request",
",",
"pfxPath",
",",
"keyPath",
",",
"certPath",
",",
"fileResolver",
",",
"certificate",
";",
"// A. Check if we have the file resolver",
"fileResolver",
"=",
"run",
".",
"options"... | Certificate lookup + reading from whichever file resolver is provided | [
"Certificate",
"lookup",
"+",
"reading",
"from",
"whichever",
"file",
"resolver",
"is",
"provided"
] | 2d4fa9aca39ce4a3e3edecb153381fc2d59d2622 | https://github.com/postmanlabs/postman-runtime/blob/2d4fa9aca39ce4a3e3edecb153381fc2d59d2622/lib/runner/request-helpers-presend.js#L319-L382 | |
9,943 | postmanlabs/postman-runtime | lib/backpack/index.js | function (cb, expect) {
if (_.isFunction(cb) && cb.__normalised) {
return meetExpectations(cb, expect);
}
var userback, // this var will be populated and returned
// keep a reference of all initial callbacks sent by user
callback = (_.isFunction(cb) && cb) ||... | javascript | function (cb, expect) {
if (_.isFunction(cb) && cb.__normalised) {
return meetExpectations(cb, expect);
}
var userback, // this var will be populated and returned
// keep a reference of all initial callbacks sent by user
callback = (_.isFunction(cb) && cb) ||... | [
"function",
"(",
"cb",
",",
"expect",
")",
"{",
"if",
"(",
"_",
".",
"isFunction",
"(",
"cb",
")",
"&&",
"cb",
".",
"__normalised",
")",
"{",
"return",
"meetExpectations",
"(",
"cb",
",",
"expect",
")",
";",
"}",
"var",
"userback",
",",
"// this var ... | accept the callback parameter and convert it into a consistent object interface
@param {Function|Object} cb
@param {Array} [expect=]
@returns {Object}
@todo - write tests | [
"accept",
"the",
"callback",
"parameter",
"and",
"convert",
"it",
"into",
"a",
"consistent",
"object",
"interface"
] | 2d4fa9aca39ce4a3e3edecb153381fc2d59d2622 | https://github.com/postmanlabs/postman-runtime/blob/2d4fa9aca39ce4a3e3edecb153381fc2d59d2622/lib/backpack/index.js#L44-L83 | |
9,944 | postmanlabs/postman-runtime | lib/backpack/index.js | function (flags, callback, args, ms) {
var status = {},
sealed;
// ensure that the callback times out after a while
callback = backpack.timeback(callback, ms, null, function () {
sealed = true;
});
return function (err, flag, value) {
if (sea... | javascript | function (flags, callback, args, ms) {
var status = {},
sealed;
// ensure that the callback times out after a while
callback = backpack.timeback(callback, ms, null, function () {
sealed = true;
});
return function (err, flag, value) {
if (sea... | [
"function",
"(",
"flags",
",",
"callback",
",",
"args",
",",
"ms",
")",
"{",
"var",
"status",
"=",
"{",
"}",
",",
"sealed",
";",
"// ensure that the callback times out after a while",
"callback",
"=",
"backpack",
".",
"timeback",
"(",
"callback",
",",
"ms",
... | Convert a callback into a function that is called multiple times and the callback is actually called when a set
of flags are set to true
@param {Array} flags
@param {Function} callback
@param {Array} args
@param {Number} ms
@returns {Function} | [
"Convert",
"a",
"callback",
"into",
"a",
"function",
"that",
"is",
"called",
"multiple",
"times",
"and",
"the",
"callback",
"is",
"actually",
"called",
"when",
"a",
"set",
"of",
"flags",
"are",
"set",
"to",
"true"
] | 2d4fa9aca39ce4a3e3edecb153381fc2d59d2622 | https://github.com/postmanlabs/postman-runtime/blob/2d4fa9aca39ce4a3e3edecb153381fc2d59d2622/lib/backpack/index.js#L95-L126 | |
9,945 | postmanlabs/postman-runtime | lib/backpack/index.js | function (callback, ms, scope, when) {
ms = Number(ms);
// if np callback time is specified, just return the callback function and exit. this is because we do need to
// track timeout in 0ms
if (!ms) {
return callback;
}
var sealed = false,
irq =... | javascript | function (callback, ms, scope, when) {
ms = Number(ms);
// if np callback time is specified, just return the callback function and exit. this is because we do need to
// track timeout in 0ms
if (!ms) {
return callback;
}
var sealed = false,
irq =... | [
"function",
"(",
"callback",
",",
"ms",
",",
"scope",
",",
"when",
")",
"{",
"ms",
"=",
"Number",
"(",
"ms",
")",
";",
"// if np callback time is specified, just return the callback function and exit. this is because we do need to",
"// track timeout in 0ms",
"if",
"(",
"... | Ensures that a callback is executed within a specific time.
@param {Function} callback
@param {Number=} [ms]
@param {Object=} [scope]
@param {Function=} [when] - function executed right before callback is called with timeout. one can do cleanup
stuff here
@returns {Function} | [
"Ensures",
"that",
"a",
"callback",
"is",
"executed",
"within",
"a",
"specific",
"time",
"."
] | 2d4fa9aca39ce4a3e3edecb153381fc2d59d2622 | https://github.com/postmanlabs/postman-runtime/blob/2d4fa9aca39ce4a3e3edecb153381fc2d59d2622/lib/backpack/index.js#L138-L165 | |
9,946 | postmanlabs/postman-runtime | lib/runner/index.js | function (options) {
// combine runner config and make a copy
var runOptions = _.merge(_.omit(options, ['environment', 'globals', 'data']), this.options.run) || {};
// start timeout sanitization
!runOptions.timeout && (runOptions.timeout = {});
_.mergeWith(runOptions.timeout, d... | javascript | function (options) {
// combine runner config and make a copy
var runOptions = _.merge(_.omit(options, ['environment', 'globals', 'data']), this.options.run) || {};
// start timeout sanitization
!runOptions.timeout && (runOptions.timeout = {});
_.mergeWith(runOptions.timeout, d... | [
"function",
"(",
"options",
")",
"{",
"// combine runner config and make a copy",
"var",
"runOptions",
"=",
"_",
".",
"merge",
"(",
"_",
".",
"omit",
"(",
"options",
",",
"[",
"'environment'",
",",
"'globals'",
",",
"'data'",
"]",
")",
",",
"this",
".",
"o... | Prepares `run` config by combining `runner` config with given run options.
@param {Object} [options]
@param {Object} [options.timeout]
@param {Object} [options.timeout.global]
@param {Object} [options.timeout.request]
@param {Object} [options.timeout.script] | [
"Prepares",
"run",
"config",
"by",
"combining",
"runner",
"config",
"with",
"given",
"run",
"options",
"."
] | 2d4fa9aca39ce4a3e3edecb153381fc2d59d2622 | https://github.com/postmanlabs/postman-runtime/blob/2d4fa9aca39ce4a3e3edecb153381fc2d59d2622/lib/runner/index.js#L40-L56 | |
9,947 | postmanlabs/postman-runtime | lib/runner/index.js | function (collection, options, callback) {
var self = this,
runOptions = this.prepareRunConfig(options);
callback = backpack.normalise(callback);
!_.isObject(options) && (options = {});
// @todo make the extract runnables interface better defined and documented
// -... | javascript | function (collection, options, callback) {
var self = this,
runOptions = this.prepareRunConfig(options);
callback = backpack.normalise(callback);
!_.isObject(options) && (options = {});
// @todo make the extract runnables interface better defined and documented
// -... | [
"function",
"(",
"collection",
",",
"options",
",",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
",",
"runOptions",
"=",
"this",
".",
"prepareRunConfig",
"(",
"options",
")",
";",
"callback",
"=",
"backpack",
".",
"normalise",
"(",
"callback",
")",
... | Runs a collection or a folder.
@param {Collection} collection
@param {Object} [options]
@param {Array.<Item>} options.items
@param {Array.<Object>} [options.data]
@param {Object} [options.globals]
@param {Object} [options.environment]
@param {Number} [options.iterationCount]
@param {CertificateList} [options.certific... | [
"Runs",
"a",
"collection",
"or",
"a",
"folder",
"."
] | 2d4fa9aca39ce4a3e3edecb153381fc2d59d2622 | https://github.com/postmanlabs/postman-runtime/blob/2d4fa9aca39ce4a3e3edecb153381fc2d59d2622/lib/runner/index.js#L80-L116 | |
9,948 | postmanlabs/postman-runtime | lib/runner/extensions/control.command.js | function (callback) {
callback = backpack.ensure(callback, this);
if (this.paused) { return callback && callback(new Error('run: already paused')); }
// schedule the pause command as an interrupt and flag that the run is pausing
this.paused = true;
this.inte... | javascript | function (callback) {
callback = backpack.ensure(callback, this);
if (this.paused) { return callback && callback(new Error('run: already paused')); }
// schedule the pause command as an interrupt and flag that the run is pausing
this.paused = true;
this.inte... | [
"function",
"(",
"callback",
")",
"{",
"callback",
"=",
"backpack",
".",
"ensure",
"(",
"callback",
",",
"this",
")",
";",
"if",
"(",
"this",
".",
"paused",
")",
"{",
"return",
"callback",
"&&",
"callback",
"(",
"new",
"Error",
"(",
"'run: already paused... | Pause a run
@param {Function} callback | [
"Pause",
"a",
"run"
] | 2d4fa9aca39ce4a3e3edecb153381fc2d59d2622 | https://github.com/postmanlabs/postman-runtime/blob/2d4fa9aca39ce4a3e3edecb153381fc2d59d2622/lib/runner/extensions/control.command.js#L18-L26 | |
9,949 | postmanlabs/postman-runtime | lib/runner/extensions/control.command.js | function (callback) {
callback = backpack.ensure(callback, this);
if (!this.paused) { return callback && callback(new Error('run: not paused')); }
// set flag that it is no longer paused and fire the stored callback for the command when it was paused
this.paused = false... | javascript | function (callback) {
callback = backpack.ensure(callback, this);
if (!this.paused) { return callback && callback(new Error('run: not paused')); }
// set flag that it is no longer paused and fire the stored callback for the command when it was paused
this.paused = false... | [
"function",
"(",
"callback",
")",
"{",
"callback",
"=",
"backpack",
".",
"ensure",
"(",
"callback",
",",
"this",
")",
";",
"if",
"(",
"!",
"this",
".",
"paused",
")",
"{",
"return",
"callback",
"&&",
"callback",
"(",
"new",
"Error",
"(",
"'run: not pau... | Resume a paused a run
@param {Function} callback | [
"Resume",
"a",
"paused",
"a",
"run"
] | 2d4fa9aca39ce4a3e3edecb153381fc2d59d2622 | https://github.com/postmanlabs/postman-runtime/blob/2d4fa9aca39ce4a3e3edecb153381fc2d59d2622/lib/runner/extensions/control.command.js#L33-L47 | |
9,950 | postmanlabs/postman-runtime | lib/runner/extensions/control.command.js | function (summarise, callback) {
if (_.isFunction(summarise) && !callback) {
callback = summarise;
summarise = true;
}
this.interrupt('abort', {
summarise: summarise
}, callback);
_.isFunction(this.__resume) &&... | javascript | function (summarise, callback) {
if (_.isFunction(summarise) && !callback) {
callback = summarise;
summarise = true;
}
this.interrupt('abort', {
summarise: summarise
}, callback);
_.isFunction(this.__resume) &&... | [
"function",
"(",
"summarise",
",",
"callback",
")",
"{",
"if",
"(",
"_",
".",
"isFunction",
"(",
"summarise",
")",
"&&",
"!",
"callback",
")",
"{",
"callback",
"=",
"summarise",
";",
"summarise",
"=",
"true",
";",
"}",
"this",
".",
"interrupt",
"(",
... | Aborts a run
@param {boolean} [summarise=true]
@param {function} callback | [
"Aborts",
"a",
"run"
] | 2d4fa9aca39ce4a3e3edecb153381fc2d59d2622 | https://github.com/postmanlabs/postman-runtime/blob/2d4fa9aca39ce4a3e3edecb153381fc2d59d2622/lib/runner/extensions/control.command.js#L55-L66 | |
9,951 | postmanlabs/postman-runtime | lib/runner/cursor.js | function (callback, scope) {
var coords = _.isFunction(callback) && this.current();
this.position = 0;
this.iteration = 0;
// send before and after values to the callback
return coords && callback.call(scope || this, null, this.current(), coords);
} | javascript | function (callback, scope) {
var coords = _.isFunction(callback) && this.current();
this.position = 0;
this.iteration = 0;
// send before and after values to the callback
return coords && callback.call(scope || this, null, this.current(), coords);
} | [
"function",
"(",
"callback",
",",
"scope",
")",
"{",
"var",
"coords",
"=",
"_",
".",
"isFunction",
"(",
"callback",
")",
"&&",
"this",
".",
"current",
"(",
")",
";",
"this",
".",
"position",
"=",
"0",
";",
"this",
".",
"iteration",
"=",
"0",
";",
... | Set everything to minimum dimension
@param {Function} [callback] - receives `(err:Error, coords:Object, previous:Object)`
@param {Object} [scope] | [
"Set",
"everything",
"to",
"minimum",
"dimension"
] | 2d4fa9aca39ce4a3e3edecb153381fc2d59d2622 | https://github.com/postmanlabs/postman-runtime/blob/2d4fa9aca39ce4a3e3edecb153381fc2d59d2622/lib/runner/cursor.js#L98-L106 | |
9,952 | postmanlabs/postman-runtime | lib/runner/cursor.js | function (position, iteration, callback, scope) {
var coords = _.isFunction(callback) && this.current();
// if null or undefined implies use existing seek position
_.isNil(position) && (position = this.position);
_.isNil(iteration) && (iteration = this.iteration);
// make the p... | javascript | function (position, iteration, callback, scope) {
var coords = _.isFunction(callback) && this.current();
// if null or undefined implies use existing seek position
_.isNil(position) && (position = this.position);
_.isNil(iteration) && (iteration = this.iteration);
// make the p... | [
"function",
"(",
"position",
",",
"iteration",
",",
"callback",
",",
"scope",
")",
"{",
"var",
"coords",
"=",
"_",
".",
"isFunction",
"(",
"callback",
")",
"&&",
"this",
".",
"current",
"(",
")",
";",
"// if null or undefined implies use existing seek position",... | Seek to a specified Cursor
@param {Number} [position]
@param {Number} [iteration]
@param {Function} [callback] - receives `(err:Error, changed:Boolean, coords:Object, previous:Object)`
@param {Object} [scope] | [
"Seek",
"to",
"a",
"specified",
"Cursor"
] | 2d4fa9aca39ce4a3e3edecb153381fc2d59d2622 | https://github.com/postmanlabs/postman-runtime/blob/2d4fa9aca39ce4a3e3edecb153381fc2d59d2622/lib/runner/cursor.js#L133-L157 | |
9,953 | postmanlabs/postman-runtime | lib/runner/cursor.js | function (callback, scope) {
var position = this.position,
iteration = this.iteration,
coords;
// increment position
position += 1;
// check if we need to increment cycle
if (position >= this.length) {
// set position to 0 and increment iter... | javascript | function (callback, scope) {
var position = this.position,
iteration = this.iteration,
coords;
// increment position
position += 1;
// check if we need to increment cycle
if (position >= this.length) {
// set position to 0 and increment iter... | [
"function",
"(",
"callback",
",",
"scope",
")",
"{",
"var",
"position",
"=",
"this",
".",
"position",
",",
"iteration",
"=",
"this",
".",
"iteration",
",",
"coords",
";",
"// increment position",
"position",
"+=",
"1",
";",
"// check if we need to increment cycl... | Seek one forward
@param {Function} [callback] - receives `(err:Error, changed:Boolean, coords:Object, previous:Object)`
@param {Object} [scope] | [
"Seek",
"one",
"forward"
] | 2d4fa9aca39ce4a3e3edecb153381fc2d59d2622 | https://github.com/postmanlabs/postman-runtime/blob/2d4fa9aca39ce4a3e3edecb153381fc2d59d2622/lib/runner/cursor.js#L165-L192 | |
9,954 | postmanlabs/postman-runtime | lib/runner/cursor.js | function (coords) {
return _.isObject(coords) && !((this.position === coords.position) && (this.iteration === coords.iteration));
} | javascript | function (coords) {
return _.isObject(coords) && !((this.position === coords.position) && (this.iteration === coords.iteration));
} | [
"function",
"(",
"coords",
")",
"{",
"return",
"_",
".",
"isObject",
"(",
"coords",
")",
"&&",
"!",
"(",
"(",
"this",
".",
"position",
"===",
"coords",
".",
"position",
")",
"&&",
"(",
"this",
".",
"iteration",
"===",
"coords",
".",
"iteration",
")",... | Check whether current position and iteration is not as the same specified
@param {Object} coords
@returns {Boolean} | [
"Check",
"whether",
"current",
"position",
"and",
"iteration",
"is",
"not",
"as",
"the",
"same",
"specified"
] | 2d4fa9aca39ce4a3e3edecb153381fc2d59d2622 | https://github.com/postmanlabs/postman-runtime/blob/2d4fa9aca39ce4a3e3edecb153381fc2d59d2622/lib/runner/cursor.js#L253-L255 | |
9,955 | postmanlabs/postman-runtime | lib/runner/cursor.js | function () {
return {
position: this.position,
iteration: this.iteration,
length: this.length,
cycles: this.cycles,
empty: this.empty(),
eof: this.eof(),
bof: this.bof(),
cr: this.cr(),
ref: this.ref
... | javascript | function () {
return {
position: this.position,
iteration: this.iteration,
length: this.length,
cycles: this.cycles,
empty: this.empty(),
eof: this.eof(),
bof: this.bof(),
cr: this.cr(),
ref: this.ref
... | [
"function",
"(",
")",
"{",
"return",
"{",
"position",
":",
"this",
".",
"position",
",",
"iteration",
":",
"this",
".",
"iteration",
",",
"length",
":",
"this",
".",
"length",
",",
"cycles",
":",
"this",
".",
"cycles",
",",
"empty",
":",
"this",
".",... | Current Cursor state
@returns {Object} | [
"Current",
"Cursor",
"state"
] | 2d4fa9aca39ce4a3e3edecb153381fc2d59d2622 | https://github.com/postmanlabs/postman-runtime/blob/2d4fa9aca39ce4a3e3edecb153381fc2d59d2622/lib/runner/cursor.js#L262-L274 | |
9,956 | postmanlabs/postman-runtime | lib/runner/instruction.js | function (name, payload, args) {
var processor = processors[name];
if (!_.isString(name) || !_.isFunction(processor)) {
throw new Error('run-instruction: invalid construction');
}
// ensure that payload is an object so that data storage can be done. also ensure arguments is... | javascript | function (name, payload, args) {
var processor = processors[name];
if (!_.isString(name) || !_.isFunction(processor)) {
throw new Error('run-instruction: invalid construction');
}
// ensure that payload is an object so that data storage can be done. also ensure arguments is... | [
"function",
"(",
"name",
",",
"payload",
",",
"args",
")",
"{",
"var",
"processor",
"=",
"processors",
"[",
"name",
"]",
";",
"if",
"(",
"!",
"_",
".",
"isString",
"(",
"name",
")",
"||",
"!",
"_",
".",
"isFunction",
"(",
"processor",
")",
")",
"... | Create a new instruction to be executed later
@constructor
@param {String} name - name of the instruction. this is useful for later lookup of the `processor` function when
deserialising this object
@param {Object} [payload] - a **JSON compatible** object that will be forwarded as the 2nd last parameter to the
process... | [
"Create",
"a",
"new",
"instruction",
"to",
"be",
"executed",
"later"
] | 2d4fa9aca39ce4a3e3edecb153381fc2d59d2622 | https://github.com/postmanlabs/postman-runtime/blob/2d4fa9aca39ce4a3e3edecb153381fc2d59d2622/lib/runner/instruction.js#L49-L90 | |
9,957 | postmanlabs/postman-runtime | lib/requester/browser/request.js | is_crossDomain | function is_crossDomain(url) {
var rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/
// jQuery #8138, IE may throw an exception when accessing
// a field from window.location if document.domain has been set
var ajaxLocation
try { ajaxLocation = location.href }
catch (e) {
// Use t... | javascript | function is_crossDomain(url) {
var rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/
// jQuery #8138, IE may throw an exception when accessing
// a field from window.location if document.domain has been set
var ajaxLocation
try { ajaxLocation = location.href }
catch (e) {
// Use t... | [
"function",
"is_crossDomain",
"(",
"url",
")",
"{",
"var",
"rurl",
"=",
"/",
"^([\\w\\+\\.\\-]+:)(?:\\/\\/([^\\/?#:]*)(?::(\\d+))?)?",
"/",
"// jQuery #8138, IE may throw an exception when accessing",
"// a field from window.location if document.domain has been set",
"var",
"ajaxLocati... | Return whether a URL is a cross-domain request. | [
"Return",
"whether",
"a",
"URL",
"is",
"a",
"cross",
"-",
"domain",
"request",
"."
] | 2d4fa9aca39ce4a3e3edecb153381fc2d59d2622 | https://github.com/postmanlabs/postman-runtime/blob/2d4fa9aca39ce4a3e3edecb153381fc2d59d2622/lib/requester/browser/request.js#L456-L483 |
9,958 | postmanlabs/postman-runtime | lib/authorizer/digest.js | _getDigestAuthHeader | function _getDigestAuthHeader (headers) {
return headers.find(function (property) {
return (property.key.toLowerCase() === WWW_AUTHENTICATE) && (_.startsWith(property.value, DIGEST_PREFIX));
});
} | javascript | function _getDigestAuthHeader (headers) {
return headers.find(function (property) {
return (property.key.toLowerCase() === WWW_AUTHENTICATE) && (_.startsWith(property.value, DIGEST_PREFIX));
});
} | [
"function",
"_getDigestAuthHeader",
"(",
"headers",
")",
"{",
"return",
"headers",
".",
"find",
"(",
"function",
"(",
"property",
")",
"{",
"return",
"(",
"property",
".",
"key",
".",
"toLowerCase",
"(",
")",
"===",
"WWW_AUTHENTICATE",
")",
"&&",
"(",
"_",... | Returns the 'www-authenticate' header for Digest auth. Since a server can suport more than more auth-scheme,
there can be more than one header with the same key. So need to loop over and check each one.
@param {VariableList} headers
@private | [
"Returns",
"the",
"www",
"-",
"authenticate",
"header",
"for",
"Digest",
"auth",
".",
"Since",
"a",
"server",
"can",
"suport",
"more",
"than",
"more",
"auth",
"-",
"scheme",
"there",
"can",
"be",
"more",
"than",
"one",
"header",
"with",
"the",
"same",
"k... | 2d4fa9aca39ce4a3e3edecb153381fc2d59d2622 | https://github.com/postmanlabs/postman-runtime/blob/2d4fa9aca39ce4a3e3edecb153381fc2d59d2622/lib/authorizer/digest.js#L89-L93 |
9,959 | postmanlabs/postman-runtime | lib/authorizer/digest.js | function (auth, response, done) {
if (auth.get(DISABLE_RETRY_REQUEST) || !response) {
return done(null, true);
}
var code,
realm,
nonce,
qop,
opaque,
authHeader,
authParams = {};
code = response.code;
... | javascript | function (auth, response, done) {
if (auth.get(DISABLE_RETRY_REQUEST) || !response) {
return done(null, true);
}
var code,
realm,
nonce,
qop,
opaque,
authHeader,
authParams = {};
code = response.code;
... | [
"function",
"(",
"auth",
",",
"response",
",",
"done",
")",
"{",
"if",
"(",
"auth",
".",
"get",
"(",
"DISABLE_RETRY_REQUEST",
")",
"||",
"!",
"response",
")",
"{",
"return",
"done",
"(",
"null",
",",
"true",
")",
";",
"}",
"var",
"code",
",",
"real... | Verifies whether the request was successfully authorized after being sent.
@param {AuthInterface} auth
@param {Response} response
@param {AuthHandlerInterface~authPostHookCallback} done | [
"Verifies",
"whether",
"the",
"request",
"was",
"successfully",
"authorized",
"after",
"being",
"sent",
"."
] | 2d4fa9aca39ce4a3e3edecb153381fc2d59d2622 | https://github.com/postmanlabs/postman-runtime/blob/2d4fa9aca39ce4a3e3edecb153381fc2d59d2622/lib/authorizer/digest.js#L161-L207 | |
9,960 | postmanlabs/postman-runtime | lib/authorizer/digest.js | function (params) {
var algorithm = params.algorithm,
username = params.username,
realm = params.realm,
password = params.password,
method = params.method,
nonce = params.nonce,
nonceCount = params.nonceCount,
clientNonce = para... | javascript | function (params) {
var algorithm = params.algorithm,
username = params.username,
realm = params.realm,
password = params.password,
method = params.method,
nonce = params.nonce,
nonceCount = params.nonceCount,
clientNonce = para... | [
"function",
"(",
"params",
")",
"{",
"var",
"algorithm",
"=",
"params",
".",
"algorithm",
",",
"username",
"=",
"params",
".",
"username",
",",
"realm",
"=",
"params",
".",
"realm",
",",
"password",
"=",
"params",
".",
"password",
",",
"method",
"=",
"... | Computes the Digest Authentication header from the given parameters.
@param {Object} params
@param {String} params.algorithm
@param {String} params.username
@param {String} params.realm
@param {String} params.password
@param {String} params.method
@param {String} params.nonce
@param {String} params.nonceCount
@param {... | [
"Computes",
"the",
"Digest",
"Authentication",
"header",
"from",
"the",
"given",
"parameters",
"."
] | 2d4fa9aca39ce4a3e3edecb153381fc2d59d2622 | https://github.com/postmanlabs/postman-runtime/blob/2d4fa9aca39ce4a3e3edecb153381fc2d59d2622/lib/authorizer/digest.js#L226-L294 | |
9,961 | postmanlabs/postman-runtime | lib/runner/util.js | function (fn, ctx) {
// extract the arguments that are to be forwarded to the function to be called
var args = Array.prototype.slice.call(arguments, 2);
try {
(typeof fn === FUNCTION) && fn.apply(ctx || global, args);
}
catch (err) {
return err;
}... | javascript | function (fn, ctx) {
// extract the arguments that are to be forwarded to the function to be called
var args = Array.prototype.slice.call(arguments, 2);
try {
(typeof fn === FUNCTION) && fn.apply(ctx || global, args);
}
catch (err) {
return err;
}... | [
"function",
"(",
"fn",
",",
"ctx",
")",
"{",
"// extract the arguments that are to be forwarded to the function to be called",
"var",
"args",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
",",
"2",
")",
";",
"try",
"{",
"(",
"typeo... | This function allows one to call another function by wrapping it within a try-catch block.
The first parameter is the function itself, followed by the scope in which this function is to be executed.
The third parameter onwards are blindly forwarded to the function being called
@param {Function} fn
@param {*} ctx
@ret... | [
"This",
"function",
"allows",
"one",
"to",
"call",
"another",
"function",
"by",
"wrapping",
"it",
"within",
"a",
"try",
"-",
"catch",
"block",
".",
"The",
"first",
"parameter",
"is",
"the",
"function",
"itself",
"followed",
"by",
"the",
"scope",
"in",
"whi... | 2d4fa9aca39ce4a3e3edecb153381fc2d59d2622 | https://github.com/postmanlabs/postman-runtime/blob/2d4fa9aca39ce4a3e3edecb153381fc2d59d2622/lib/runner/util.js#L92-L102 | |
9,962 | postmanlabs/postman-runtime | lib/runner/util.js | function (dest, src) {
var prop;
// update or add values from src
for (prop in src) {
if (src.hasOwnProperty(prop)) {
dest[prop] = src[prop];
}
}
// remove values that no longer exist
for (prop in dest) {
if (dest.hasO... | javascript | function (dest, src) {
var prop;
// update or add values from src
for (prop in src) {
if (src.hasOwnProperty(prop)) {
dest[prop] = src[prop];
}
}
// remove values that no longer exist
for (prop in dest) {
if (dest.hasO... | [
"function",
"(",
"dest",
",",
"src",
")",
"{",
"var",
"prop",
";",
"// update or add values from src",
"for",
"(",
"prop",
"in",
"src",
")",
"{",
"if",
"(",
"src",
".",
"hasOwnProperty",
"(",
"prop",
")",
")",
"{",
"dest",
"[",
"prop",
"]",
"=",
"src... | Copies attributes from source object to destination object.
@param dest
@param src
@return {Object} | [
"Copies",
"attributes",
"from",
"source",
"object",
"to",
"destination",
"object",
"."
] | 2d4fa9aca39ce4a3e3edecb153381fc2d59d2622 | https://github.com/postmanlabs/postman-runtime/blob/2d4fa9aca39ce4a3e3edecb153381fc2d59d2622/lib/runner/util.js#L112-L130 | |
9,963 | postmanlabs/postman-runtime | lib/runner/util.js | function (resolver, fileSrc, callback) {
// bail out if resolver not found.
if (!resolver) {
return callback(new Error('file resolver not supported'));
}
// bail out if resolver is not supported.
if (typeof resolver.stat !== FUNCTION || typeof resolver.createReadStre... | javascript | function (resolver, fileSrc, callback) {
// bail out if resolver not found.
if (!resolver) {
return callback(new Error('file resolver not supported'));
}
// bail out if resolver is not supported.
if (typeof resolver.stat !== FUNCTION || typeof resolver.createReadStre... | [
"function",
"(",
"resolver",
",",
"fileSrc",
",",
"callback",
")",
"{",
"// bail out if resolver not found.",
"if",
"(",
"!",
"resolver",
")",
"{",
"return",
"callback",
"(",
"new",
"Error",
"(",
"'file resolver not supported'",
")",
")",
";",
"}",
"// bail out ... | Create readable stream for given file as well as detect possible file
read issues. The resolver also attaches a clone function to the stream
so that the stream can be restarted any time.
@param {Object} resolver - External file resolver module
@param {Function} resolver.stat - Resolver method to check for existence an... | [
"Create",
"readable",
"stream",
"for",
"given",
"file",
"as",
"well",
"as",
"detect",
"possible",
"file",
"read",
"issues",
".",
"The",
"resolver",
"also",
"attaches",
"a",
"clone",
"function",
"to",
"the",
"stream",
"so",
"that",
"the",
"stream",
"can",
"... | 2d4fa9aca39ce4a3e3edecb153381fc2d59d2622 | https://github.com/postmanlabs/postman-runtime/blob/2d4fa9aca39ce4a3e3edecb153381fc2d59d2622/lib/runner/util.js#L144-L164 | |
9,964 | craftzdog/react-native-sqlite-2 | src/SQLiteDatabase.js | escapeForIOSAndAndroid | function escapeForIOSAndAndroid(args) {
if (Platform.OS === 'android' || Platform.OS === 'ios') {
return map(args, escapeBlob)
} else {
return args
}
} | javascript | function escapeForIOSAndAndroid(args) {
if (Platform.OS === 'android' || Platform.OS === 'ios') {
return map(args, escapeBlob)
} else {
return args
}
} | [
"function",
"escapeForIOSAndAndroid",
"(",
"args",
")",
"{",
"if",
"(",
"Platform",
".",
"OS",
"===",
"'android'",
"||",
"Platform",
".",
"OS",
"===",
"'ios'",
")",
"{",
"return",
"map",
"(",
"args",
",",
"escapeBlob",
")",
"}",
"else",
"{",
"return",
... | for avoiding strings truncated with '\u0000' | [
"for",
"avoiding",
"strings",
"truncated",
"with",
"\\",
"u0000"
] | 48b2f1ce401f40b6fa42a4e3e0a1009993c3b5ac | https://github.com/craftzdog/react-native-sqlite-2/blob/48b2f1ce401f40b6fa42a4e3e0a1009993c3b5ac/src/SQLiteDatabase.js#L44-L50 |
9,965 | TheBrainFamily/chimpy | src/lib/session-factory.js | SessionManagerFactory | function SessionManagerFactory(options) {
log.debug('[chimp][session-manager-factory] options are', options);
if (!options) {
throw new Error('options is required');
}
if (!options.port) {
throw new Error('options.port is required');
}
if (!options.browser && !options.deviceName) {
throw n... | javascript | function SessionManagerFactory(options) {
log.debug('[chimp][session-manager-factory] options are', options);
if (!options) {
throw new Error('options is required');
}
if (!options.port) {
throw new Error('options.port is required');
}
if (!options.browser && !options.deviceName) {
throw n... | [
"function",
"SessionManagerFactory",
"(",
"options",
")",
"{",
"log",
".",
"debug",
"(",
"'[chimp][session-manager-factory] options are'",
",",
"options",
")",
";",
"if",
"(",
"!",
"options",
")",
"{",
"throw",
"new",
"Error",
"(",
"'options is required'",
")",
... | Wraps creation of different Session Managers depending on host value.
@param {Object} options
@api public | [
"Wraps",
"creation",
"of",
"different",
"Session",
"Managers",
"depending",
"on",
"host",
"value",
"."
] | d859c610d247c4199945b280b0f3a14c076153c7 | https://github.com/TheBrainFamily/chimpy/blob/d859c610d247c4199945b280b0f3a14c076153c7/src/lib/session-factory.js#L15-L49 |
9,966 | silas/node-jenkins | lib/jenkins.js | Jenkins | function Jenkins(opts) {
if (!(this instanceof Jenkins)) {
return new Jenkins(opts);
}
if (typeof opts === 'string') {
opts = { baseUrl: opts };
} else {
opts = opts || {};
}
opts = Object.assign({}, opts);
if (!opts.baseUrl) {
if (opts.url) {
opts.baseUrl = opts.url;
delete... | javascript | function Jenkins(opts) {
if (!(this instanceof Jenkins)) {
return new Jenkins(opts);
}
if (typeof opts === 'string') {
opts = { baseUrl: opts };
} else {
opts = opts || {};
}
opts = Object.assign({}, opts);
if (!opts.baseUrl) {
if (opts.url) {
opts.baseUrl = opts.url;
delete... | [
"function",
"Jenkins",
"(",
"opts",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Jenkins",
")",
")",
"{",
"return",
"new",
"Jenkins",
"(",
"opts",
")",
";",
"}",
"if",
"(",
"typeof",
"opts",
"===",
"'string'",
")",
"{",
"opts",
"=",
"{",
... | Initialize a new `Jenkins` client. | [
"Initialize",
"a",
"new",
"Jenkins",
"client",
"."
] | d734afcf2469e3dbe262f1036d1061b52894151f | https://github.com/silas/node-jenkins/blob/d734afcf2469e3dbe262f1036d1061b52894151f/lib/jenkins.js#L28-L103 |
9,967 | silas/node-jenkins | lib/middleware.js | ignoreErrorForStatusCodes | function ignoreErrorForStatusCodes() {
var statusCodes = Array.prototype.slice.call(arguments);
return function(ctx, next) {
if (ctx.err && ctx.res && statusCodes.indexOf(ctx.res.statusCode) !== -1) {
delete ctx.err;
}
next();
};
} | javascript | function ignoreErrorForStatusCodes() {
var statusCodes = Array.prototype.slice.call(arguments);
return function(ctx, next) {
if (ctx.err && ctx.res && statusCodes.indexOf(ctx.res.statusCode) !== -1) {
delete ctx.err;
}
next();
};
} | [
"function",
"ignoreErrorForStatusCodes",
"(",
")",
"{",
"var",
"statusCodes",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
")",
";",
"return",
"function",
"(",
"ctx",
",",
"next",
")",
"{",
"if",
"(",
"ctx",
".",
"err",
... | Ignore errors for provided status codes | [
"Ignore",
"errors",
"for",
"provided",
"status",
"codes"
] | d734afcf2469e3dbe262f1036d1061b52894151f | https://github.com/silas/node-jenkins/blob/d734afcf2469e3dbe262f1036d1061b52894151f/lib/middleware.js#L57-L67 |
9,968 | silas/node-jenkins | lib/middleware.js | require302 | function require302(message) {
return function(ctx, next) {
if (ctx.res && ctx.res.statusCode === 302) {
return next(false);
} else if (ctx.res) {
if (ctx.err) {
if (!ctx.res.headers['x-error']) ctx.err.message = message;
} else {
ctx.err = new Error(message);
}
... | javascript | function require302(message) {
return function(ctx, next) {
if (ctx.res && ctx.res.statusCode === 302) {
return next(false);
} else if (ctx.res) {
if (ctx.err) {
if (!ctx.res.headers['x-error']) ctx.err.message = message;
} else {
ctx.err = new Error(message);
}
... | [
"function",
"require302",
"(",
"message",
")",
"{",
"return",
"function",
"(",
"ctx",
",",
"next",
")",
"{",
"if",
"(",
"ctx",
".",
"res",
"&&",
"ctx",
".",
"res",
".",
"statusCode",
"===",
"302",
")",
"{",
"return",
"next",
"(",
"false",
")",
";",... | Require 302 or error | [
"Require",
"302",
"or",
"error"
] | d734afcf2469e3dbe262f1036d1061b52894151f | https://github.com/silas/node-jenkins/blob/d734afcf2469e3dbe262f1036d1061b52894151f/lib/middleware.js#L73-L89 |
9,969 | silas/node-jenkins | lib/utils.js | parseName | function parseName(value) {
var jobParts = [];
var pathParts = (urlParse(value).pathname || '').split('/').filter(Boolean);
var state = 0;
var part;
// iterate until we find our first job, then collect the continuous job parts
// ['foo', 'job', 'a', 'job', 'b', 'bar', 'job', 'c'] => ['a', 'b']
loop:
... | javascript | function parseName(value) {
var jobParts = [];
var pathParts = (urlParse(value).pathname || '').split('/').filter(Boolean);
var state = 0;
var part;
// iterate until we find our first job, then collect the continuous job parts
// ['foo', 'job', 'a', 'job', 'b', 'bar', 'job', 'c'] => ['a', 'b']
loop:
... | [
"function",
"parseName",
"(",
"value",
")",
"{",
"var",
"jobParts",
"=",
"[",
"]",
";",
"var",
"pathParts",
"=",
"(",
"urlParse",
"(",
"value",
")",
".",
"pathname",
"||",
"''",
")",
".",
"split",
"(",
"'/'",
")",
".",
"filter",
"(",
"Boolean",
")"... | Parse job name from URL | [
"Parse",
"job",
"name",
"from",
"URL"
] | d734afcf2469e3dbe262f1036d1061b52894151f | https://github.com/silas/node-jenkins/blob/d734afcf2469e3dbe262f1036d1061b52894151f/lib/utils.js#L48-L77 |
9,970 | silas/node-jenkins | lib/utils.js | FolderPath | function FolderPath(value) {
if (!(this instanceof FolderPath)) {
return new FolderPath(value);
}
if (Array.isArray(value)) {
this.value = value;
} else if (typeof value === 'string') {
if (value.match('^https?:\/\/')) {
this.value = parseName(value);
} else {
this.value = value.spli... | javascript | function FolderPath(value) {
if (!(this instanceof FolderPath)) {
return new FolderPath(value);
}
if (Array.isArray(value)) {
this.value = value;
} else if (typeof value === 'string') {
if (value.match('^https?:\/\/')) {
this.value = parseName(value);
} else {
this.value = value.spli... | [
"function",
"FolderPath",
"(",
"value",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"FolderPath",
")",
")",
"{",
"return",
"new",
"FolderPath",
"(",
"value",
")",
";",
"}",
"if",
"(",
"Array",
".",
"isArray",
"(",
"value",
")",
")",
"{",
"... | Path for folder plugin | [
"Path",
"for",
"folder",
"plugin"
] | d734afcf2469e3dbe262f1036d1061b52894151f | https://github.com/silas/node-jenkins/blob/d734afcf2469e3dbe262f1036d1061b52894151f/lib/utils.js#L83-L98 |
9,971 | silas/node-jenkins | lib/utils.js | crumbIssuer | function crumbIssuer(jenkins, callback) {
jenkins.crumbIssuer.get(function(err, data) {
if (err) return callback(err);
if (!data || !data.crumbRequestField || !data.crumb) {
return callback(new Error('Failed to get crumb'));
}
callback(null, {
headerName: data.crumbRequestField,
hea... | javascript | function crumbIssuer(jenkins, callback) {
jenkins.crumbIssuer.get(function(err, data) {
if (err) return callback(err);
if (!data || !data.crumbRequestField || !data.crumb) {
return callback(new Error('Failed to get crumb'));
}
callback(null, {
headerName: data.crumbRequestField,
hea... | [
"function",
"crumbIssuer",
"(",
"jenkins",
",",
"callback",
")",
"{",
"jenkins",
".",
"crumbIssuer",
".",
"get",
"(",
"function",
"(",
"err",
",",
"data",
")",
"{",
"if",
"(",
"err",
")",
"return",
"callback",
"(",
"err",
")",
";",
"if",
"(",
"!",
... | Default crumb issuser | [
"Default",
"crumb",
"issuser"
] | d734afcf2469e3dbe262f1036d1061b52894151f | https://github.com/silas/node-jenkins/blob/d734afcf2469e3dbe262f1036d1061b52894151f/lib/utils.js#L127-L139 |
9,972 | silas/node-jenkins | lib/utils.js | isFileLike | function isFileLike(v) {
return Buffer.isBuffer(v) ||
typeof v === 'object' &&
typeof v.pipe === 'function' &&
v.readable !== false;
} | javascript | function isFileLike(v) {
return Buffer.isBuffer(v) ||
typeof v === 'object' &&
typeof v.pipe === 'function' &&
v.readable !== false;
} | [
"function",
"isFileLike",
"(",
"v",
")",
"{",
"return",
"Buffer",
".",
"isBuffer",
"(",
"v",
")",
"||",
"typeof",
"v",
"===",
"'object'",
"&&",
"typeof",
"v",
".",
"pipe",
"===",
"'function'",
"&&",
"v",
".",
"readable",
"!==",
"false",
";",
"}"
] | Check if object is file like | [
"Check",
"if",
"object",
"is",
"file",
"like"
] | d734afcf2469e3dbe262f1036d1061b52894151f | https://github.com/silas/node-jenkins/blob/d734afcf2469e3dbe262f1036d1061b52894151f/lib/utils.js#L145-L150 |
9,973 | silas/node-jenkins | lib/log_stream.js | LogStream | function LogStream(jenkins, opts) {
var self = this;
events.EventEmitter.call(self);
self._jenkins = jenkins;
opts = opts || {};
self._delay = opts.delay || 1000;
delete opts.delay;
self._opts = {};
for (var key in opts) {
if (opts.hasOwnProperty(key)) {
self._opts[key] = opts[key];
}... | javascript | function LogStream(jenkins, opts) {
var self = this;
events.EventEmitter.call(self);
self._jenkins = jenkins;
opts = opts || {};
self._delay = opts.delay || 1000;
delete opts.delay;
self._opts = {};
for (var key in opts) {
if (opts.hasOwnProperty(key)) {
self._opts[key] = opts[key];
}... | [
"function",
"LogStream",
"(",
"jenkins",
",",
"opts",
")",
"{",
"var",
"self",
"=",
"this",
";",
"events",
".",
"EventEmitter",
".",
"call",
"(",
"self",
")",
";",
"self",
".",
"_jenkins",
"=",
"jenkins",
";",
"opts",
"=",
"opts",
"||",
"{",
"}",
"... | Initialize a new `LogStream` instance. | [
"Initialize",
"a",
"new",
"LogStream",
"instance",
"."
] | d734afcf2469e3dbe262f1036d1061b52894151f | https://github.com/silas/node-jenkins/blob/d734afcf2469e3dbe262f1036d1061b52894151f/lib/log_stream.js#L18-L39 |
9,974 | JamesBarwell/rpi-gpio.js | rpi-gpio.js | setRaspberryVersion | function setRaspberryVersion() {
if (currentPins) {
return Promise.resolve();
}
return new Promise(function(resolve, reject) {
fs.readFile('/proc/cpuinfo', 'utf8', function(err, data) {
if (err) {
return reject(err);
}
... | javascript | function setRaspberryVersion() {
if (currentPins) {
return Promise.resolve();
}
return new Promise(function(resolve, reject) {
fs.readFile('/proc/cpuinfo', 'utf8', function(err, data) {
if (err) {
return reject(err);
}
... | [
"function",
"setRaspberryVersion",
"(",
")",
"{",
"if",
"(",
"currentPins",
")",
"{",
"return",
"Promise",
".",
"resolve",
"(",
")",
";",
"}",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"fs",
".",
"readFile",
... | Private functions requring access to state | [
"Private",
"functions",
"requring",
"access",
"to",
"state"
] | 8cdbec5a7fb6dd1ee095e9f9109adda19372da3b | https://github.com/JamesBarwell/rpi-gpio.js/blob/8cdbec5a7fb6dd1ee095e9f9109adda19372da3b/rpi-gpio.js#L353-L396 |
9,975 | JamesBarwell/rpi-gpio.js | rpi-gpio.js | listen | function listen(channel, onChange) {
var pin = getPinForCurrentMode(channel);
if (!exportedInputPins[pin] && !exportedOutputPins[pin]) {
throw new Error('Channel %d has not been exported', channel);
}
debug('listen for pin %d', pin);
var poller = new Epoll(function(... | javascript | function listen(channel, onChange) {
var pin = getPinForCurrentMode(channel);
if (!exportedInputPins[pin] && !exportedOutputPins[pin]) {
throw new Error('Channel %d has not been exported', channel);
}
debug('listen for pin %d', pin);
var poller = new Epoll(function(... | [
"function",
"listen",
"(",
"channel",
",",
"onChange",
")",
"{",
"var",
"pin",
"=",
"getPinForCurrentMode",
"(",
"channel",
")",
";",
"if",
"(",
"!",
"exportedInputPins",
"[",
"pin",
"]",
"&&",
"!",
"exportedOutputPins",
"[",
"pin",
"]",
")",
"{",
"throw... | Listen for interrupts on a channel
@param {number} channel The channel to watch
@param {function} cb Callback which receives the channel's err | [
"Listen",
"for",
"interrupts",
"on",
"a",
"channel"
] | 8cdbec5a7fb6dd1ee095e9f9109adda19372da3b | https://github.com/JamesBarwell/rpi-gpio.js/blob/8cdbec5a7fb6dd1ee095e9f9109adda19372da3b/rpi-gpio.js#L413-L434 |
9,976 | treasure-data/td-js-sdk | lib/utils/toBase64.js | encode | function encode (n) {
var o = ''
var i = 0
var i1, i2, i3, e1, e2, e3, e4
n = utf8Encode(n)
while (i < n.length) {
i1 = n.charCodeAt(i++)
i2 = n.charCodeAt(i++)
i3 = n.charCodeAt(i++)
e1 = (i1 >> 2)
e2 = (((i1 & 3) << 4) | (i2 >> 4))
e3 = (isNaN(i2) ? 64 : ((i2 & 15) << 2) | (i3 >> 6))... | javascript | function encode (n) {
var o = ''
var i = 0
var i1, i2, i3, e1, e2, e3, e4
n = utf8Encode(n)
while (i < n.length) {
i1 = n.charCodeAt(i++)
i2 = n.charCodeAt(i++)
i3 = n.charCodeAt(i++)
e1 = (i1 >> 2)
e2 = (((i1 & 3) << 4) | (i2 >> 4))
e3 = (isNaN(i2) ? 64 : ((i2 & 15) << 2) | (i3 >> 6))... | [
"function",
"encode",
"(",
"n",
")",
"{",
"var",
"o",
"=",
"''",
"var",
"i",
"=",
"0",
"var",
"i1",
",",
"i2",
",",
"i3",
",",
"e1",
",",
"e2",
",",
"e3",
",",
"e4",
"n",
"=",
"utf8Encode",
"(",
"n",
")",
"while",
"(",
"i",
"<",
"n",
".",... | base64 encode a string
@param {string} n
@return {string} | [
"base64",
"encode",
"a",
"string"
] | dc817573ba487388845170f915ffeceaa24cc887 | https://github.com/treasure-data/td-js-sdk/blob/dc817573ba487388845170f915ffeceaa24cc887/lib/utils/toBase64.js#L12-L28 |
9,977 | treasure-data/td-js-sdk | lib/record.js | validateRecord | function validateRecord (table, record) {
invariant(
_.isString(table),
'Must provide a table'
)
invariant(
/^[a-z0-9_]{3,255}$/.test(table),
'Table must be between 3 and 255 characters and must ' +
'consist only of lower case letters, numbers, and _'
)
invariant(
_.isObject(record),... | javascript | function validateRecord (table, record) {
invariant(
_.isString(table),
'Must provide a table'
)
invariant(
/^[a-z0-9_]{3,255}$/.test(table),
'Table must be between 3 and 255 characters and must ' +
'consist only of lower case letters, numbers, and _'
)
invariant(
_.isObject(record),... | [
"function",
"validateRecord",
"(",
"table",
",",
"record",
")",
"{",
"invariant",
"(",
"_",
".",
"isString",
"(",
"table",
")",
",",
"'Must provide a table'",
")",
"invariant",
"(",
"/",
"^[a-z0-9_]{3,255}$",
"/",
".",
"test",
"(",
"table",
")",
",",
"'Tab... | Helpers
Validate record | [
"Helpers",
"Validate",
"record"
] | dc817573ba487388845170f915ffeceaa24cc887 | https://github.com/treasure-data/td-js-sdk/blob/dc817573ba487388845170f915ffeceaa24cc887/lib/record.js#L20-L36 |
9,978 | Jam3/preloader | lib/loaders/FileMeta.js | function (header) {
/**
* This property is the mimetype for the file
*
* @property mime
* @type {String}
*/
this.mime = null;
/**
* This is the file size in bytes
*
* @type {Number}
*/
this.size = null;
/**
* This is a Date object which represents the last time this file was mo... | javascript | function (header) {
/**
* This property is the mimetype for the file
*
* @property mime
* @type {String}
*/
this.mime = null;
/**
* This is the file size in bytes
*
* @type {Number}
*/
this.size = null;
/**
* This is a Date object which represents the last time this file was mo... | [
"function",
"(",
"header",
")",
"{",
"/**\n * This property is the mimetype for the file\n *\n * @property mime\n * @type {String}\n */",
"this",
".",
"mime",
"=",
"null",
";",
"/**\n * This is the file size in bytes\n *\n * @type {Number}\n */",
"this",
".",
"size",
... | FileMeta is a class which will hold file meta data. Each LoaderBase contains a FileMeta object
that you can use to query.
@class FileMeta
@constructor
@param {String} header HTTP Header sent when loading this file | [
"FileMeta",
"is",
"a",
"class",
"which",
"will",
"hold",
"file",
"meta",
"data",
".",
"Each",
"LoaderBase",
"contains",
"a",
"FileMeta",
"object",
"that",
"you",
"can",
"use",
"to",
"query",
"."
] | f094e19a423245f50def5fa37b3702d5eb4852ea | https://github.com/Jam3/preloader/blob/f094e19a423245f50def5fa37b3702d5eb4852ea/lib/loaders/FileMeta.js#L11-L42 | |
9,979 | Jam3/preloader | lib/loaders/FileMeta.js | function (header) {
this.httpHeader = parseHTTPHeader(header);
if (this.httpHeader[ 'content-length' ]) this.size = this.httpHeader[ 'content-length' ];
if (this.httpHeader[ 'content-type' ]) this.mime = this.httpHeader[ 'content-type' ];
if (this.httpHeader[ 'last-modified' ]) this.lastModified = ne... | javascript | function (header) {
this.httpHeader = parseHTTPHeader(header);
if (this.httpHeader[ 'content-length' ]) this.size = this.httpHeader[ 'content-length' ];
if (this.httpHeader[ 'content-type' ]) this.mime = this.httpHeader[ 'content-type' ];
if (this.httpHeader[ 'last-modified' ]) this.lastModified = ne... | [
"function",
"(",
"header",
")",
"{",
"this",
".",
"httpHeader",
"=",
"parseHTTPHeader",
"(",
"header",
")",
";",
"if",
"(",
"this",
".",
"httpHeader",
"[",
"'content-length'",
"]",
")",
"this",
".",
"size",
"=",
"this",
".",
"httpHeader",
"[",
"'content-... | This function will be called in the constructor of FileMeta. It will parse the HTTP
headers returned by a server and save useful information for development.
@method setFromHTTPHeader
@param {String} header HTTP header returned by the server | [
"This",
"function",
"will",
"be",
"called",
"in",
"the",
"constructor",
"of",
"FileMeta",
".",
"It",
"will",
"parse",
"the",
"HTTP",
"headers",
"returned",
"by",
"a",
"server",
"and",
"save",
"useful",
"information",
"for",
"development",
"."
] | f094e19a423245f50def5fa37b3702d5eb4852ea | https://github.com/Jam3/preloader/blob/f094e19a423245f50def5fa37b3702d5eb4852ea/lib/loaders/FileMeta.js#L53-L61 | |
9,980 | Jam3/preloader | lib/loaders/LoaderBase.js | function (url) {
this.url = url;
if (this.canLoadUsingXHR()) {
this.xhr = new XMLHttpRequest();
this.xhr.open('GET', url, true);
this.xhr.onreadystatechange = this._onStateChange;
this.xhr.onprogress !== undefined && (this.xhr.onprogress = this._onProgress);
if (this.loadType !=... | javascript | function (url) {
this.url = url;
if (this.canLoadUsingXHR()) {
this.xhr = new XMLHttpRequest();
this.xhr.open('GET', url, true);
this.xhr.onreadystatechange = this._onStateChange;
this.xhr.onprogress !== undefined && (this.xhr.onprogress = this._onProgress);
if (this.loadType !=... | [
"function",
"(",
"url",
")",
"{",
"this",
".",
"url",
"=",
"url",
";",
"if",
"(",
"this",
".",
"canLoadUsingXHR",
"(",
")",
")",
"{",
"this",
".",
"xhr",
"=",
"new",
"XMLHttpRequest",
"(",
")",
";",
"this",
".",
"xhr",
".",
"open",
"(",
"'GET'",
... | The load function should be called to start preloading data.
The first parameter passed to the load function is the url to the data to be loaded.
It should be noted that mimetype for binary Blob data is read from
the file extension. EG. jpg will use the mimetype "image/jpeg".
@method load
@param {String} url This ... | [
"The",
"load",
"function",
"should",
"be",
"called",
"to",
"start",
"preloading",
"data",
"."
] | f094e19a423245f50def5fa37b3702d5eb4852ea | https://github.com/Jam3/preloader/blob/f094e19a423245f50def5fa37b3702d5eb4852ea/lib/loaders/LoaderBase.js#L74-L103 | |
9,981 | Jam3/preloader | lib/loaders/LoaderBase.js | function (ev) {
var loaded = ev.loaded || ev.position;
var totalSize = ev.total || ev.totalSize;
if (totalSize) {
this._dispatchProgress(loaded / totalSize);
} else {
this._dispatchProgress(0);
}
} | javascript | function (ev) {
var loaded = ev.loaded || ev.position;
var totalSize = ev.total || ev.totalSize;
if (totalSize) {
this._dispatchProgress(loaded / totalSize);
} else {
this._dispatchProgress(0);
}
} | [
"function",
"(",
"ev",
")",
"{",
"var",
"loaded",
"=",
"ev",
".",
"loaded",
"||",
"ev",
".",
"position",
";",
"var",
"totalSize",
"=",
"ev",
".",
"total",
"||",
"ev",
".",
"totalSize",
";",
"if",
"(",
"totalSize",
")",
"{",
"this",
".",
"_dispatchP... | This callback will be called when the XHR progresses in its load.
@method _onProgress
@protected
@param {XMLHttpRequestProgressEvent} ev This event contains data for the progress of the load | [
"This",
"callback",
"will",
"be",
"called",
"when",
"the",
"XHR",
"progresses",
"in",
"its",
"load",
"."
] | f094e19a423245f50def5fa37b3702d5eb4852ea | https://github.com/Jam3/preloader/blob/f094e19a423245f50def5fa37b3702d5eb4852ea/lib/loaders/LoaderBase.js#L167-L176 | |
9,982 | Jam3/preloader | lib/loaders/LoaderBase.js | function () {
if (this.xhr.readyState > 1) {
var status;
var waiting = false;
// Fix error in IE8 where status isn't available until readyState=4
try { status = this.xhr.status; } catch (e) { waiting = true; }
if (status === 200) {
switch (this.xhr.readyState) {
// ... | javascript | function () {
if (this.xhr.readyState > 1) {
var status;
var waiting = false;
// Fix error in IE8 where status isn't available until readyState=4
try { status = this.xhr.status; } catch (e) { waiting = true; }
if (status === 200) {
switch (this.xhr.readyState) {
// ... | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"xhr",
".",
"readyState",
">",
"1",
")",
"{",
"var",
"status",
";",
"var",
"waiting",
"=",
"false",
";",
"// Fix error in IE8 where status isn't available until readyState=4",
"try",
"{",
"status",
"=",
"this"... | This function is called whenever the readyState of the XHR object changes.
this.xhr.readyState == 2 //send() has been called, and headers and status are available
this.xhr.readyState == 3 //Downloading; responseText holds partial data.
this.xhr.readyState == 4 //Done
You should also handle HTTP error status codes:
t... | [
"This",
"function",
"is",
"called",
"whenever",
"the",
"readyState",
"of",
"the",
"XHR",
"object",
"changes",
"."
] | f094e19a423245f50def5fa37b3702d5eb4852ea | https://github.com/Jam3/preloader/blob/f094e19a423245f50def5fa37b3702d5eb4852ea/lib/loaders/LoaderBase.js#L192-L230 | |
9,983 | Jam3/preloader | lib/loaders/LoaderBase.js | function () {
if (this.loadTypeSet || this.loadType === LoaderBase.typeText) {
this.content = this.xhr.response || this.xhr.responseText;
} else {
switch (this.loadType) {
case LoaderBase.typeArraybuffer:
if (ArrayBuffer) {
this.content = stringToArrayBuffer(this.xhr.... | javascript | function () {
if (this.loadTypeSet || this.loadType === LoaderBase.typeText) {
this.content = this.xhr.response || this.xhr.responseText;
} else {
switch (this.loadType) {
case LoaderBase.typeArraybuffer:
if (ArrayBuffer) {
this.content = stringToArrayBuffer(this.xhr.... | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"loadTypeSet",
"||",
"this",
".",
"loadType",
"===",
"LoaderBase",
".",
"typeText",
")",
"{",
"this",
".",
"content",
"=",
"this",
".",
"xhr",
".",
"response",
"||",
"this",
".",
"xhr",
".",
"respons... | This function will grab the response from the content loaded and parse it out
@method _parseContent
@protected | [
"This",
"function",
"will",
"grab",
"the",
"response",
"from",
"the",
"content",
"loaded",
"and",
"parse",
"it",
"out"
] | f094e19a423245f50def5fa37b3702d5eb4852ea | https://github.com/Jam3/preloader/blob/f094e19a423245f50def5fa37b3702d5eb4852ea/lib/loaders/LoaderBase.js#L238-L285 | |
9,984 | vizabi/vizabi | src/base/events.js | freezeAll | function freezeAll(exceptions) {
_freezeAllEvents = true;
if (!exceptions) {
return;
}
if (!utils.isArray(exceptions)) {
exceptions = [exceptions];
}
utils.forEach(exceptions, e => {
_freezeAllExceptions[e] = true;
});
} | javascript | function freezeAll(exceptions) {
_freezeAllEvents = true;
if (!exceptions) {
return;
}
if (!utils.isArray(exceptions)) {
exceptions = [exceptions];
}
utils.forEach(exceptions, e => {
_freezeAllExceptions[e] = true;
});
} | [
"function",
"freezeAll",
"(",
"exceptions",
")",
"{",
"_freezeAllEvents",
"=",
"true",
";",
"if",
"(",
"!",
"exceptions",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"utils",
".",
"isArray",
"(",
"exceptions",
")",
")",
"{",
"exceptions",
"=",
"[",
... | generic event functions
freezes all events | [
"generic",
"event",
"functions",
"freezes",
"all",
"events"
] | cc2a44d7bb25f356189d5a3d241a205a15324540 | https://github.com/vizabi/vizabi/blob/cc2a44d7bb25f356189d5a3d241a205a15324540/src/base/events.js#L323-L334 |
9,985 | vizabi/vizabi | src/base/events.js | unfreezeAll | function unfreezeAll() {
_freezeAllEvents = false;
_freezeAllExceptions = {};
//unfreeze all instances
const keys = Object.keys(_frozenEventInstances);
for (let i = 0; i < keys.length; i++) {
const instance = _frozenEventInstances[keys[i]];
if (!instance) {
continue;
}
instance.unfreeze(... | javascript | function unfreezeAll() {
_freezeAllEvents = false;
_freezeAllExceptions = {};
//unfreeze all instances
const keys = Object.keys(_frozenEventInstances);
for (let i = 0; i < keys.length; i++) {
const instance = _frozenEventInstances[keys[i]];
if (!instance) {
continue;
}
instance.unfreeze(... | [
"function",
"unfreezeAll",
"(",
")",
"{",
"_freezeAllEvents",
"=",
"false",
";",
"_freezeAllExceptions",
"=",
"{",
"}",
";",
"//unfreeze all instances",
"const",
"keys",
"=",
"Object",
".",
"keys",
"(",
"_frozenEventInstances",
")",
";",
"for",
"(",
"let",
"i"... | triggers all frozen events form all instances | [
"triggers",
"all",
"frozen",
"events",
"form",
"all",
"instances"
] | cc2a44d7bb25f356189d5a3d241a205a15324540 | https://github.com/vizabi/vizabi/blob/cc2a44d7bb25f356189d5a3d241a205a15324540/src/base/events.js#L339-L352 |
9,986 | vizabi/vizabi | src/base/component.js | _mapOne | function _mapOne(name) {
const parts = name.split(".");
let current = _this.parent.model;
let current_name = "";
while (parts.length) {
current_name = parts.shift();
current = current[current_name];
}
return {
name,
model: current,
type: curren... | javascript | function _mapOne(name) {
const parts = name.split(".");
let current = _this.parent.model;
let current_name = "";
while (parts.length) {
current_name = parts.shift();
current = current[current_name];
}
return {
name,
model: current,
type: curren... | [
"function",
"_mapOne",
"(",
"name",
")",
"{",
"const",
"parts",
"=",
"name",
".",
"split",
"(",
"\".\"",
")",
";",
"let",
"current",
"=",
"_this",
".",
"parent",
".",
"model",
";",
"let",
"current_name",
"=",
"\"\"",
";",
"while",
"(",
"parts",
".",
... | Maps one model name to current submodel and returns info
@param {String} name Full model path. E.g.: "state.marker.color"
@returns {Object} the model info, with name and the actual model | [
"Maps",
"one",
"model",
"name",
"to",
"current",
"submodel",
"and",
"returns",
"info"
] | cc2a44d7bb25f356189d5a3d241a205a15324540 | https://github.com/vizabi/vizabi/blob/cc2a44d7bb25f356189d5a3d241a205a15324540/src/base/component.js#L439-L452 |
9,987 | vizabi/vizabi | src/base/component.js | templateFunc | function templateFunc(str, data) {
const func = function(obj) {
return str.replace(/<%=([^%]*)%>/g, match => {
//match t("...")
let s = match.match(/t\s*\(([^)]+)\)/g);
//replace with translation
if (s.length) {
s = obj.t(s[0].match(/"([^"]+)"/g)[0].split('"').join(""));
}
... | javascript | function templateFunc(str, data) {
const func = function(obj) {
return str.replace(/<%=([^%]*)%>/g, match => {
//match t("...")
let s = match.match(/t\s*\(([^)]+)\)/g);
//replace with translation
if (s.length) {
s = obj.t(s[0].match(/"([^"]+)"/g)[0].split('"').join(""));
}
... | [
"function",
"templateFunc",
"(",
"str",
",",
"data",
")",
"{",
"const",
"func",
"=",
"function",
"(",
"obj",
")",
"{",
"return",
"str",
".",
"replace",
"(",
"/",
"<%=([^%]*)%>",
"/",
"g",
",",
"match",
"=>",
"{",
"//match t(\"...\")",
"let",
"s",
"=",
... | Based on Simple JavaScript Templating by John Resig generic templating function | [
"Based",
"on",
"Simple",
"JavaScript",
"Templating",
"by",
"John",
"Resig",
"generic",
"templating",
"function"
] | cc2a44d7bb25f356189d5a3d241a205a15324540 | https://github.com/vizabi/vizabi/blob/cc2a44d7bb25f356189d5a3d241a205a15324540/src/base/component.js#L549-L573 |
9,988 | vizabi/vizabi | src/base/model.js | initSubmodel | function initSubmodel(attr, val, ctx, persistent) {
let submodel;
// if value is a value -> leaf
if (!utils.isPlainObject(val) || utils.isArray(val) || ctx.isObjectLeaf(attr)) {
const binds = {
//the submodel has changed (multiple times)
"change": onChange
};
submodel = new ModelLeaf(at... | javascript | function initSubmodel(attr, val, ctx, persistent) {
let submodel;
// if value is a value -> leaf
if (!utils.isPlainObject(val) || utils.isArray(val) || ctx.isObjectLeaf(attr)) {
const binds = {
//the submodel has changed (multiple times)
"change": onChange
};
submodel = new ModelLeaf(at... | [
"function",
"initSubmodel",
"(",
"attr",
",",
"val",
",",
"ctx",
",",
"persistent",
")",
"{",
"let",
"submodel",
";",
"// if value is a value -> leaf",
"if",
"(",
"!",
"utils",
".",
"isPlainObject",
"(",
"val",
")",
"||",
"utils",
".",
"isArray",
"(",
"val... | Loads a submodel, when necessaary
@param {String} attr Name of submodel
@param {Object} val Initial values
@param {Object} ctx context / parent model
@param {Boolean} persistent true if the change is a persistent change
@returns {Object} model new submodel | [
"Loads",
"a",
"submodel",
"when",
"necessaary"
] | cc2a44d7bb25f356189d5a3d241a205a15324540 | https://github.com/vizabi/vizabi/blob/cc2a44d7bb25f356189d5a3d241a205a15324540/src/base/model.js#L707-L784 |
9,989 | vizabi/vizabi | src/base/model.js | onChange | function onChange(evt, path) {
if (!ctx._ready) return; //block change propagation if model isnt ready
path = ctx._name + "." + path;
ctx.trigger(evt, path);
} | javascript | function onChange(evt, path) {
if (!ctx._ready) return; //block change propagation if model isnt ready
path = ctx._name + "." + path;
ctx.trigger(evt, path);
} | [
"function",
"onChange",
"(",
"evt",
",",
"path",
")",
"{",
"if",
"(",
"!",
"ctx",
".",
"_ready",
")",
"return",
";",
"//block change propagation if model isnt ready",
"path",
"=",
"ctx",
".",
"_name",
"+",
"\".\"",
"+",
"path",
";",
"ctx",
".",
"trigger",
... | Default event handlers for models | [
"Default",
"event",
"handlers",
"for",
"models"
] | cc2a44d7bb25f356189d5a3d241a205a15324540 | https://github.com/vizabi/vizabi/blob/cc2a44d7bb25f356189d5a3d241a205a15324540/src/base/model.js#L767-L771 |
9,990 | vizabi/vizabi | src/base/model.js | getIntervals | function getIntervals(ctx) {
return ctx._intervals || (ctx._parent ? getIntervals(ctx._parent) : new Intervals());
} | javascript | function getIntervals(ctx) {
return ctx._intervals || (ctx._parent ? getIntervals(ctx._parent) : new Intervals());
} | [
"function",
"getIntervals",
"(",
"ctx",
")",
"{",
"return",
"ctx",
".",
"_intervals",
"||",
"(",
"ctx",
".",
"_parent",
"?",
"getIntervals",
"(",
"ctx",
".",
"_parent",
")",
":",
"new",
"Intervals",
"(",
")",
")",
";",
"}"
] | gets closest interval from this model or parent
@returns {Object} Intervals object | [
"gets",
"closest",
"interval",
"from",
"this",
"model",
"or",
"parent"
] | cc2a44d7bb25f356189d5a3d241a205a15324540 | https://github.com/vizabi/vizabi/blob/cc2a44d7bb25f356189d5a3d241a205a15324540/src/base/model.js#L790-L792 |
9,991 | vizabi/vizabi | src/base/utils.js | function(val) {
if (val === undefined) {
return "undefined";
}
if (val === null) {
return "null";
}
let type = typeof val;
if (type === "object") {
type = getClass(val).toLowerCase();
}
if (type === "number") {
return val.toString().indexOf(".") > 0 ?
... | javascript | function(val) {
if (val === undefined) {
return "undefined";
}
if (val === null) {
return "null";
}
let type = typeof val;
if (type === "object") {
type = getClass(val).toLowerCase();
}
if (type === "number") {
return val.toString().indexOf(".") > 0 ?
... | [
"function",
"(",
"val",
")",
"{",
"if",
"(",
"val",
"===",
"undefined",
")",
"{",
"return",
"\"undefined\"",
";",
"}",
"if",
"(",
"val",
"===",
"null",
")",
"{",
"return",
"\"null\"",
";",
"}",
"let",
"type",
"=",
"typeof",
"val",
";",
"if",
"(",
... | Defines the type of the value, extended typeof | [
"Defines",
"the",
"type",
"of",
"the",
"value",
"extended",
"typeof"
] | cc2a44d7bb25f356189d5a3d241a205a15324540 | https://github.com/vizabi/vizabi/blob/cc2a44d7bb25f356189d5a3d241a205a15324540/src/base/utils.js#L187-L209 | |
9,992 | vizabi/vizabi | src/base/utils.js | function(a, b) {
if (a !== b) {
const atype = whatis(a);
const btype = whatis(b);
if (atype === btype) {
return _equal.hasOwnProperty(atype) ? _equal[atype](a, b) : a == b;
}
return false;
}
return true;
} | javascript | function(a, b) {
if (a !== b) {
const atype = whatis(a);
const btype = whatis(b);
if (atype === btype) {
return _equal.hasOwnProperty(atype) ? _equal[atype](a, b) : a == b;
}
return false;
}
return true;
} | [
"function",
"(",
"a",
",",
"b",
")",
"{",
"if",
"(",
"a",
"!==",
"b",
")",
"{",
"const",
"atype",
"=",
"whatis",
"(",
"a",
")",
";",
"const",
"btype",
"=",
"whatis",
"(",
"b",
")",
";",
"if",
"(",
"atype",
"===",
"btype",
")",
"{",
"return",
... | Are two values equal, deep compare for objects and arrays.
@param a {any}
@param b {any}
@return {boolean} Are equal? | [
"Are",
"two",
"values",
"equal",
"deep",
"compare",
"for",
"objects",
"and",
"arrays",
"."
] | cc2a44d7bb25f356189d5a3d241a205a15324540 | https://github.com/vizabi/vizabi/blob/cc2a44d7bb25f356189d5a3d241a205a15324540/src/base/utils.js#L264-L277 | |
9,993 | vizabi/vizabi | src/base/utils.js | deepCloneArray | function deepCloneArray(arr) {
const clone = [];
forEach(arr, (item, index) => {
if (typeof item === "object" && item !== null) {
if (isArray(item)) {
clone[index] = deepCloneArray(item);
} else if (isSpecificValue(item)) {
clone[index] = cloneSpecificValue(item);
} else {
... | javascript | function deepCloneArray(arr) {
const clone = [];
forEach(arr, (item, index) => {
if (typeof item === "object" && item !== null) {
if (isArray(item)) {
clone[index] = deepCloneArray(item);
} else if (isSpecificValue(item)) {
clone[index] = cloneSpecificValue(item);
} else {
... | [
"function",
"deepCloneArray",
"(",
"arr",
")",
"{",
"const",
"clone",
"=",
"[",
"]",
";",
"forEach",
"(",
"arr",
",",
"(",
"item",
",",
"index",
")",
"=>",
"{",
"if",
"(",
"typeof",
"item",
"===",
"\"object\"",
"&&",
"item",
"!==",
"null",
")",
"{"... | Recursive cloning array. | [
"Recursive",
"cloning",
"array",
"."
] | cc2a44d7bb25f356189d5a3d241a205a15324540 | https://github.com/vizabi/vizabi/blob/cc2a44d7bb25f356189d5a3d241a205a15324540/src/base/utils.js#L396-L412 |
9,994 | GoogleCloudPlatform/nodejs-repo-tools | src/utils/index.js | finish | function finish(err) {
if (!calledDone) {
calledDone = true;
exports.finalize(err, resolve, reject);
}
} | javascript | function finish(err) {
if (!calledDone) {
calledDone = true;
exports.finalize(err, resolve, reject);
}
} | [
"function",
"finish",
"(",
"err",
")",
"{",
"if",
"(",
"!",
"calledDone",
")",
"{",
"calledDone",
"=",
"true",
";",
"exports",
".",
"finalize",
"(",
"err",
",",
"resolve",
",",
"reject",
")",
";",
"}",
"}"
] | Exit helper so we don't call "cb" more than once | [
"Exit",
"helper",
"so",
"we",
"don",
"t",
"call",
"cb",
"more",
"than",
"once"
] | 703d1011302de7be376d2c5da0b3410b68538414 | https://github.com/GoogleCloudPlatform/nodejs-repo-tools/blob/703d1011302de7be376d2c5da0b3410b68538414/src/utils/index.js#L394-L399 |
9,995 | KingSora/OverlayScrollbars | js/OverlayScrollbars.js | function() {
return window.innerWidth || document.documentElement[LEXICON.cW] || document.body[LEXICON.cW];
} | javascript | function() {
return window.innerWidth || document.documentElement[LEXICON.cW] || document.body[LEXICON.cW];
} | [
"function",
"(",
")",
"{",
"return",
"window",
".",
"innerWidth",
"||",
"document",
".",
"documentElement",
"[",
"LEXICON",
".",
"cW",
"]",
"||",
"document",
".",
"body",
"[",
"LEXICON",
".",
"cW",
"]",
";",
"}"
] | Gets the current window width.
@returns {Number|number} The current window width in pixel. | [
"Gets",
"the",
"current",
"window",
"width",
"."
] | 8e658d46e2d034a2525269d7c873bbe844762307 | https://github.com/KingSora/OverlayScrollbars/blob/8e658d46e2d034a2525269d7c873bbe844762307/js/OverlayScrollbars.js#L112-L114 | |
9,996 | KingSora/OverlayScrollbars | js/OverlayScrollbars.js | function() {
return window.innerHeight || document.documentElement[LEXICON.cH] || document.body[LEXICON.cH];
} | javascript | function() {
return window.innerHeight || document.documentElement[LEXICON.cH] || document.body[LEXICON.cH];
} | [
"function",
"(",
")",
"{",
"return",
"window",
".",
"innerHeight",
"||",
"document",
".",
"documentElement",
"[",
"LEXICON",
".",
"cH",
"]",
"||",
"document",
".",
"body",
"[",
"LEXICON",
".",
"cH",
"]",
";",
"}"
] | Gets the current window height.
@returns {Number|number} The current window height in pixel. | [
"Gets",
"the",
"current",
"window",
"height",
"."
] | 8e658d46e2d034a2525269d7c873bbe844762307 | https://github.com/KingSora/OverlayScrollbars/blob/8e658d46e2d034a2525269d7c873bbe844762307/js/OverlayScrollbars.js#L120-L122 | |
9,997 | KingSora/OverlayScrollbars | js/OverlayScrollbars.js | function(event) {
if(event.preventDefault && event.cancelable)
event.preventDefault();
else
event.returnValue = false;
} | javascript | function(event) {
if(event.preventDefault && event.cancelable)
event.preventDefault();
else
event.returnValue = false;
} | [
"function",
"(",
"event",
")",
"{",
"if",
"(",
"event",
".",
"preventDefault",
"&&",
"event",
".",
"cancelable",
")",
"event",
".",
"preventDefault",
"(",
")",
";",
"else",
"event",
".",
"returnValue",
"=",
"false",
";",
"}"
] | Prevents the default action of the given event.
@param event The event of which the default action shall be prevented. | [
"Prevents",
"the",
"default",
"action",
"of",
"the",
"given",
"event",
"."
] | 8e658d46e2d034a2525269d7c873bbe844762307 | https://github.com/KingSora/OverlayScrollbars/blob/8e658d46e2d034a2525269d7c873bbe844762307/js/OverlayScrollbars.js#L179-L184 | |
9,998 | KingSora/OverlayScrollbars | js/OverlayScrollbars.js | function(event) {
event = event.originalEvent || event;
var strPage = 'page';
var strClient = 'client';
var strX = 'X';
var strY = 'Y';
var target = event.target || event.srcElement || document;
var eventDoc... | javascript | function(event) {
event = event.originalEvent || event;
var strPage = 'page';
var strClient = 'client';
var strX = 'X';
var strY = 'Y';
var target = event.target || event.srcElement || document;
var eventDoc... | [
"function",
"(",
"event",
")",
"{",
"event",
"=",
"event",
".",
"originalEvent",
"||",
"event",
";",
"var",
"strPage",
"=",
"'page'",
";",
"var",
"strClient",
"=",
"'client'",
";",
"var",
"strX",
"=",
"'X'",
";",
"var",
"strY",
"=",
"'Y'",
";",
"var"... | Gets the pageX and pageY values of the given mouse event.
@param event The mouse event of which the pageX and pageX shall be got.
@returns {{x: number, y: number}} x = pageX value, y = pageY value. | [
"Gets",
"the",
"pageX",
"and",
"pageY",
"values",
"of",
"the",
"given",
"mouse",
"event",
"."
] | 8e658d46e2d034a2525269d7c873bbe844762307 | https://github.com/KingSora/OverlayScrollbars/blob/8e658d46e2d034a2525269d7c873bbe844762307/js/OverlayScrollbars.js#L191-L228 | |
9,999 | KingSora/OverlayScrollbars | js/OverlayScrollbars.js | function(event) {
var button = event.button;
if (!event.which && button !== undefined)
return (button & 1 ? 1 : (button & 2 ? 3 : (button & 4 ? 2 : 0)));
else
return event.which;
} | javascript | function(event) {
var button = event.button;
if (!event.which && button !== undefined)
return (button & 1 ? 1 : (button & 2 ? 3 : (button & 4 ? 2 : 0)));
else
return event.which;
} | [
"function",
"(",
"event",
")",
"{",
"var",
"button",
"=",
"event",
".",
"button",
";",
"if",
"(",
"!",
"event",
".",
"which",
"&&",
"button",
"!==",
"undefined",
")",
"return",
"(",
"button",
"&",
"1",
"?",
"1",
":",
"(",
"button",
"&",
"2",
"?",... | Gets the clicked mouse button of the given mouse event.
@param event The mouse event of which the clicked button shal be got.
@returns {number} The number of the clicked mouse button. (0 : none | 1 : leftButton | 2 : middleButton | 3 : rightButton) | [
"Gets",
"the",
"clicked",
"mouse",
"button",
"of",
"the",
"given",
"mouse",
"event",
"."
] | 8e658d46e2d034a2525269d7c873bbe844762307 | https://github.com/KingSora/OverlayScrollbars/blob/8e658d46e2d034a2525269d7c873bbe844762307/js/OverlayScrollbars.js#L235-L241 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.