repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train |
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 | train |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train | |
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 | train | |
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 | train |
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 | train |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
KingSora/OverlayScrollbars | js/OverlayScrollbars.js | function(item, arr) {
for (var i = 0; i < arr[LEXICON.l]; i++)
//Sometiems in IE a "SCRIPT70" Permission denied error occurs if HTML elements in a iFrame are compared
try {
if (arr[i] === item)
return i;
... | javascript | function(item, arr) {
for (var i = 0; i < arr[LEXICON.l]; i++)
//Sometiems in IE a "SCRIPT70" Permission denied error occurs if HTML elements in a iFrame are compared
try {
if (arr[i] === item)
return i;
... | [
"function",
"(",
"item",
",",
"arr",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"arr",
"[",
"LEXICON",
".",
"l",
"]",
";",
"i",
"++",
")",
"//Sometiems in IE a \"SCRIPT70\" Permission denied error occurs if HTML elements in a iFrame are compared",
... | Checks whether a item is in the given array and returns its index.
@param item The item of which the position in the array shall be determined.
@param arr The array.
@returns {number} The zero based index of the item or -1 if the item isn't in the array. | [
"Checks",
"whether",
"a",
"item",
"is",
"in",
"the",
"given",
"array",
"and",
"returns",
"its",
"index",
"."
] | 8e658d46e2d034a2525269d7c873bbe844762307 | https://github.com/KingSora/OverlayScrollbars/blob/8e658d46e2d034a2525269d7c873bbe844762307/js/OverlayScrollbars.js#L249-L258 | train | |
KingSora/OverlayScrollbars | js/OverlayScrollbars.js | function(arr) {
var def = Array.isArray;
return def ? def(arr) : this.type(arr) == TYPES.a;
} | javascript | function(arr) {
var def = Array.isArray;
return def ? def(arr) : this.type(arr) == TYPES.a;
} | [
"function",
"(",
"arr",
")",
"{",
"var",
"def",
"=",
"Array",
".",
"isArray",
";",
"return",
"def",
"?",
"def",
"(",
"arr",
")",
":",
"this",
".",
"type",
"(",
"arr",
")",
"==",
"TYPES",
".",
"a",
";",
"}"
] | Returns true if the given value is a array.
@param arr The potential array.
@returns {boolean} True if the given value is a array, false otherwise. | [
"Returns",
"true",
"if",
"the",
"given",
"value",
"is",
"a",
"array",
"."
] | 8e658d46e2d034a2525269d7c873bbe844762307 | https://github.com/KingSora/OverlayScrollbars/blob/8e658d46e2d034a2525269d7c873bbe844762307/js/OverlayScrollbars.js#L265-L268 | train | |
KingSora/OverlayScrollbars | js/OverlayScrollbars.js | initOverlayScrollbarsStatics | function initOverlayScrollbarsStatics() {
if(!_pluginsGlobals)
_pluginsGlobals = new OverlayScrollbarsGlobals(_pluginsOptions._defaults);
if(!_pluginsAutoUpdateLoop)
_pluginsAutoUpdateLoop = new OverlayScrollbarsAutoUpdateLoop(_pluginsGlobals);
... | javascript | function initOverlayScrollbarsStatics() {
if(!_pluginsGlobals)
_pluginsGlobals = new OverlayScrollbarsGlobals(_pluginsOptions._defaults);
if(!_pluginsAutoUpdateLoop)
_pluginsAutoUpdateLoop = new OverlayScrollbarsAutoUpdateLoop(_pluginsGlobals);
... | [
"function",
"initOverlayScrollbarsStatics",
"(",
")",
"{",
"if",
"(",
"!",
"_pluginsGlobals",
")",
"_pluginsGlobals",
"=",
"new",
"OverlayScrollbarsGlobals",
"(",
"_pluginsOptions",
".",
"_defaults",
")",
";",
"if",
"(",
"!",
"_pluginsAutoUpdateLoop",
")",
"_plugins... | Initializes the object which contains global information about the plugin and each instance of it. | [
"Initializes",
"the",
"object",
"which",
"contains",
"global",
"information",
"about",
"the",
"plugin",
"and",
"each",
"instance",
"of",
"it",
"."
] | 8e658d46e2d034a2525269d7c873bbe844762307 | https://github.com/KingSora/OverlayScrollbars/blob/8e658d46e2d034a2525269d7c873bbe844762307/js/OverlayScrollbars.js#L1647-L1652 | train |
KingSora/OverlayScrollbars | js/OverlayScrollbars.js | function() {
if(_loopingInstances[_strLength] > 0 && _loopIsActive) {
_loopID = COMPATIBILITY.rAF()(function () {
loop();
});
var timeNew = COMPATIBILITY.now();
var timeDelta =... | javascript | function() {
if(_loopingInstances[_strLength] > 0 && _loopIsActive) {
_loopID = COMPATIBILITY.rAF()(function () {
loop();
});
var timeNew = COMPATIBILITY.now();
var timeDelta =... | [
"function",
"(",
")",
"{",
"if",
"(",
"_loopingInstances",
"[",
"_strLength",
"]",
">",
"0",
"&&",
"_loopIsActive",
")",
"{",
"_loopID",
"=",
"COMPATIBILITY",
".",
"rAF",
"(",
")",
"(",
"function",
"(",
")",
"{",
"loop",
"(",
")",
";",
"}",
")",
";... | The auto update loop which will run every 50 milliseconds or less if the update interval of a instance is lower than 50 milliseconds. | [
"The",
"auto",
"update",
"loop",
"which",
"will",
"run",
"every",
"50",
"milliseconds",
"or",
"less",
"if",
"the",
"update",
"interval",
"of",
"a",
"instance",
"is",
"lower",
"than",
"50",
"milliseconds",
"."
] | 8e658d46e2d034a2525269d7c873bbe844762307 | https://github.com/KingSora/OverlayScrollbars/blob/8e658d46e2d034a2525269d7c873bbe844762307/js/OverlayScrollbars.js#L1879-L1917 | train | |
KingSora/OverlayScrollbars | js/OverlayScrollbars.js | removePassiveEventListener | function removePassiveEventListener(element, eventNames, listener) {
var events = eventNames.split(_strSpace);
for (var i = 0; i < events.length; i++)
element[0].removeEventListener(events[i], listener, {passive: true});
} | javascript | function removePassiveEventListener(element, eventNames, listener) {
var events = eventNames.split(_strSpace);
for (var i = 0; i < events.length; i++)
element[0].removeEventListener(events[i], listener, {passive: true});
} | [
"function",
"removePassiveEventListener",
"(",
"element",
",",
"eventNames",
",",
"listener",
")",
"{",
"var",
"events",
"=",
"eventNames",
".",
"split",
"(",
"_strSpace",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"events",
".",
"length"... | Removes a passive event listener to the given element.
@param element The element from which the event listener shall be removed.
@param eventNames The name(s) of the event listener.
@param listener The listener method which shall be removed. | [
"Removes",
"a",
"passive",
"event",
"listener",
"to",
"the",
"given",
"element",
"."
] | 8e658d46e2d034a2525269d7c873bbe844762307 | https://github.com/KingSora/OverlayScrollbars/blob/8e658d46e2d034a2525269d7c873bbe844762307/js/OverlayScrollbars.js#L2257-L2261 | train |
KingSora/OverlayScrollbars | js/OverlayScrollbars.js | function () {
/*
var sizeResetWidth = observerElement[LEXICON.oW] + nativeScrollbarSize.x * factor + nativeScrollbarSize.y * factor + _overlayScrollbarDummySize.x + _overlayScrollbarDummySize.y;
var sizeResetHeight = obser... | javascript | function () {
/*
var sizeResetWidth = observerElement[LEXICON.oW] + nativeScrollbarSize.x * factor + nativeScrollbarSize.y * factor + _overlayScrollbarDummySize.x + _overlayScrollbarDummySize.y;
var sizeResetHeight = obser... | [
"function",
"(",
")",
"{",
"/*\n var sizeResetWidth = observerElement[LEXICON.oW] + nativeScrollbarSize.x * factor + nativeScrollbarSize.y * factor + _overlayScrollbarDummySize.x + _overlayScrollbarDummySize.y;\n var sizeResetHeight = observerE... | care don't make changes to this object!!! | [
"care",
"don",
"t",
"make",
"changes",
"to",
"this",
"object!!!"
] | 8e658d46e2d034a2525269d7c873bbe844762307 | https://github.com/KingSora/OverlayScrollbars/blob/8e658d46e2d034a2525269d7c873bbe844762307/js/OverlayScrollbars.js#L2312-L2327 | train | |
KingSora/OverlayScrollbars | js/OverlayScrollbars.js | removeResizeObserver | function removeResizeObserver(targetElement) {
if (_supportResizeObserver) {
var element = targetElement.contents()[0];
element[_strResizeObserverProperty].disconnect();
delete element[_strResizeObserverProperty];
... | javascript | function removeResizeObserver(targetElement) {
if (_supportResizeObserver) {
var element = targetElement.contents()[0];
element[_strResizeObserverProperty].disconnect();
delete element[_strResizeObserverProperty];
... | [
"function",
"removeResizeObserver",
"(",
"targetElement",
")",
"{",
"if",
"(",
"_supportResizeObserver",
")",
"{",
"var",
"element",
"=",
"targetElement",
".",
"contents",
"(",
")",
"[",
"0",
"]",
";",
"element",
"[",
"_strResizeObserverProperty",
"]",
".",
"d... | Removes a resize observer from the given element.
@param targetElement The element to which the target resize observer is applied. | [
"Removes",
"a",
"resize",
"observer",
"from",
"the",
"given",
"element",
"."
] | 8e658d46e2d034a2525269d7c873bbe844762307 | https://github.com/KingSora/OverlayScrollbars/blob/8e658d46e2d034a2525269d7c873bbe844762307/js/OverlayScrollbars.js#L2446-L2455 | train |
KingSora/OverlayScrollbars | js/OverlayScrollbars.js | connectMutationObservers | function connectMutationObservers() {
if (_supportMutationObserver && !_mutationObserversConnected) {
_mutationObserverHost.observe(_hostElementNative, {
attributes: true,
attributeOldValue: true,
... | javascript | function connectMutationObservers() {
if (_supportMutationObserver && !_mutationObserversConnected) {
_mutationObserverHost.observe(_hostElementNative, {
attributes: true,
attributeOldValue: true,
... | [
"function",
"connectMutationObservers",
"(",
")",
"{",
"if",
"(",
"_supportMutationObserver",
"&&",
"!",
"_mutationObserversConnected",
")",
"{",
"_mutationObserverHost",
".",
"observe",
"(",
"_hostElementNative",
",",
"{",
"attributes",
":",
"true",
",",
"attributeOl... | Connects the MutationObservers if they are supported. | [
"Connects",
"the",
"MutationObservers",
"if",
"they",
"are",
"supported",
"."
] | 8e658d46e2d034a2525269d7c873bbe844762307 | https://github.com/KingSora/OverlayScrollbars/blob/8e658d46e2d034a2525269d7c873bbe844762307/js/OverlayScrollbars.js#L2587-L2606 | train |
KingSora/OverlayScrollbars | js/OverlayScrollbars.js | hostOnMouseMove | function hostOnMouseMove() {
if (_scrollbarsAutoHideMove) {
refreshScrollbarsAutoHide(true);
clearTimeout(_scrollbarsAutoHideMoveTimeoutId);
_scrollbarsAutoHideMoveTimeoutId = setTimeout(function () {
... | javascript | function hostOnMouseMove() {
if (_scrollbarsAutoHideMove) {
refreshScrollbarsAutoHide(true);
clearTimeout(_scrollbarsAutoHideMoveTimeoutId);
_scrollbarsAutoHideMoveTimeoutId = setTimeout(function () {
... | [
"function",
"hostOnMouseMove",
"(",
")",
"{",
"if",
"(",
"_scrollbarsAutoHideMove",
")",
"{",
"refreshScrollbarsAutoHide",
"(",
"true",
")",
";",
"clearTimeout",
"(",
"_scrollbarsAutoHideMoveTimeoutId",
")",
";",
"_scrollbarsAutoHideMoveTimeoutId",
"=",
"setTimeout",
"(... | The mouse move event of the host element. This event is only needed for the autoHide "move" feature. | [
"The",
"mouse",
"move",
"event",
"of",
"the",
"host",
"element",
".",
"This",
"event",
"is",
"only",
"needed",
"for",
"the",
"autoHide",
"move",
"feature",
"."
] | 8e658d46e2d034a2525269d7c873bbe844762307 | https://github.com/KingSora/OverlayScrollbars/blob/8e658d46e2d034a2525269d7c873bbe844762307/js/OverlayScrollbars.js#L2668-L2677 | train |
KingSora/OverlayScrollbars | js/OverlayScrollbars.js | isUnknownMutation | function isUnknownMutation(mutation) {
var attributeName = mutation.attributeName;
var mutationTarget = mutation.target;
var mutationType = mutation.type;
var strClosest = 'closest';
if (mutationTarget === _contentEleme... | javascript | function isUnknownMutation(mutation) {
var attributeName = mutation.attributeName;
var mutationTarget = mutation.target;
var mutationType = mutation.type;
var strClosest = 'closest';
if (mutationTarget === _contentEleme... | [
"function",
"isUnknownMutation",
"(",
"mutation",
")",
"{",
"var",
"attributeName",
"=",
"mutation",
".",
"attributeName",
";",
"var",
"mutationTarget",
"=",
"mutation",
".",
"target",
";",
"var",
"mutationType",
"=",
"mutation",
".",
"type",
";",
"var",
"strC... | Returns true if the given mutation is not from a from the plugin generated element. If the target element is a textarea the mutation is always unknown.
@param mutation The mutation which shall be checked.
@returns {boolean} True if the mutation is from a unknown element, false otherwise. | [
"Returns",
"true",
"if",
"the",
"given",
"mutation",
"is",
"not",
"from",
"a",
"from",
"the",
"plugin",
"generated",
"element",
".",
"If",
"the",
"target",
"element",
"is",
"a",
"textarea",
"the",
"mutation",
"is",
"always",
"unknown",
"."
] | 8e658d46e2d034a2525269d7c873bbe844762307 | https://github.com/KingSora/OverlayScrollbars/blob/8e658d46e2d034a2525269d7c873bbe844762307/js/OverlayScrollbars.js#L2801-L2823 | train |
KingSora/OverlayScrollbars | js/OverlayScrollbars.js | updateAutoContentSizeChanged | function updateAutoContentSizeChanged() {
if (_isSleeping)
return false;
var float;
var textareaValueLength = _isTextarea && _widthAutoCache && !_textareaAutoWrappingCache ? _targetElement.val().length : 0;
var setC... | javascript | function updateAutoContentSizeChanged() {
if (_isSleeping)
return false;
var float;
var textareaValueLength = _isTextarea && _widthAutoCache && !_textareaAutoWrappingCache ? _targetElement.val().length : 0;
var setC... | [
"function",
"updateAutoContentSizeChanged",
"(",
")",
"{",
"if",
"(",
"_isSleeping",
")",
"return",
"false",
";",
"var",
"float",
";",
"var",
"textareaValueLength",
"=",
"_isTextarea",
"&&",
"_widthAutoCache",
"&&",
"!",
"_textareaAutoWrappingCache",
"?",
"_targetEl... | Returns true if the content size was changed since the last time this method was called.
@returns {boolean} True if the content size was changed, false otherwise. | [
"Returns",
"true",
"if",
"the",
"content",
"size",
"was",
"changed",
"since",
"the",
"last",
"time",
"this",
"method",
"was",
"called",
"."
] | 8e658d46e2d034a2525269d7c873bbe844762307 | https://github.com/KingSora/OverlayScrollbars/blob/8e658d46e2d034a2525269d7c873bbe844762307/js/OverlayScrollbars.js#L2829-L2874 | train |
KingSora/OverlayScrollbars | js/OverlayScrollbars.js | isSizeAffectingCSSProperty | function isSizeAffectingCSSProperty(propertyName) {
if (!_initialized)
return true;
var flexGrow = 'flex-grow';
var flexShrink = 'flex-shrink';
var flexBasis = 'flex-basis';
var affectingPropsX = ... | javascript | function isSizeAffectingCSSProperty(propertyName) {
if (!_initialized)
return true;
var flexGrow = 'flex-grow';
var flexShrink = 'flex-shrink';
var flexBasis = 'flex-basis';
var affectingPropsX = ... | [
"function",
"isSizeAffectingCSSProperty",
"(",
"propertyName",
")",
"{",
"if",
"(",
"!",
"_initialized",
")",
"return",
"true",
";",
"var",
"flexGrow",
"=",
"'flex-grow'",
";",
"var",
"flexShrink",
"=",
"'flex-shrink'",
";",
"var",
"flexBasis",
"=",
"'flex-basis... | Checks is a CSS Property of a child element is affecting the scroll size of the content.
@param propertyName The CSS property name.
@returns {boolean} True if the property is affecting the content scroll size, false otherwise. | [
"Checks",
"is",
"a",
"CSS",
"Property",
"of",
"a",
"child",
"element",
"is",
"affecting",
"the",
"scroll",
"size",
"of",
"the",
"content",
"."
] | 8e658d46e2d034a2525269d7c873bbe844762307 | https://github.com/KingSora/OverlayScrollbars/blob/8e658d46e2d034a2525269d7c873bbe844762307/js/OverlayScrollbars.js#L2917-L2986 | train |
KingSora/OverlayScrollbars | js/OverlayScrollbars.js | refreshScrollbarAppearance | function refreshScrollbarAppearance(isHorizontal, shallBeVisible, canScroll) {
var scrollbarClassName = isHorizontal ? _classNameHostScrollbarHorizontalHidden : _classNameHostScrollbarVerticalHidden;
var scrollbarElement = isHorizontal ? _scrollbarHorizontalElement : _scrollbarVe... | javascript | function refreshScrollbarAppearance(isHorizontal, shallBeVisible, canScroll) {
var scrollbarClassName = isHorizontal ? _classNameHostScrollbarHorizontalHidden : _classNameHostScrollbarVerticalHidden;
var scrollbarElement = isHorizontal ? _scrollbarHorizontalElement : _scrollbarVe... | [
"function",
"refreshScrollbarAppearance",
"(",
"isHorizontal",
",",
"shallBeVisible",
",",
"canScroll",
")",
"{",
"var",
"scrollbarClassName",
"=",
"isHorizontal",
"?",
"_classNameHostScrollbarHorizontalHidden",
":",
"_classNameHostScrollbarVerticalHidden",
";",
"var",
"scrol... | Shows or hides the given scrollbar and applied a class name which indicates if the scrollbar is scrollable or not.
@param isHorizontal True if the horizontal scrollbar is the target, false if the vertical scrollbar is the target.
@param shallBeVisible True if the scrollbar shall be shown, false if hidden.
@param canScr... | [
"Shows",
"or",
"hides",
"the",
"given",
"scrollbar",
"and",
"applied",
"a",
"class",
"name",
"which",
"indicates",
"if",
"the",
"scrollbar",
"is",
"scrollable",
"or",
"not",
"."
] | 8e658d46e2d034a2525269d7c873bbe844762307 | https://github.com/KingSora/OverlayScrollbars/blob/8e658d46e2d034a2525269d7c873bbe844762307/js/OverlayScrollbars.js#L4698-L4711 | train |
KingSora/OverlayScrollbars | js/OverlayScrollbars.js | refreshScrollbarHandleLength | function refreshScrollbarHandleLength(isHorizontal) {
var handleCSS = {};
var scrollbarVars = getScrollbarVars(isHorizontal);
var scrollbarVarsInfo = scrollbarVars._info;
var digit = 1000000;
//get and apply intended han... | javascript | function refreshScrollbarHandleLength(isHorizontal) {
var handleCSS = {};
var scrollbarVars = getScrollbarVars(isHorizontal);
var scrollbarVarsInfo = scrollbarVars._info;
var digit = 1000000;
//get and apply intended han... | [
"function",
"refreshScrollbarHandleLength",
"(",
"isHorizontal",
")",
"{",
"var",
"handleCSS",
"=",
"{",
"}",
";",
"var",
"scrollbarVars",
"=",
"getScrollbarVars",
"(",
"isHorizontal",
")",
";",
"var",
"scrollbarVarsInfo",
"=",
"scrollbarVars",
".",
"_info",
";",
... | Refreshes the handle length of the given scrollbar.
@param isHorizontal True if the horizontal scrollbar handle shall be refreshed, false if the vertical one shall be refreshed. | [
"Refreshes",
"the",
"handle",
"length",
"of",
"the",
"given",
"scrollbar",
"."
] | 8e658d46e2d034a2525269d7c873bbe844762307 | https://github.com/KingSora/OverlayScrollbars/blob/8e658d46e2d034a2525269d7c873bbe844762307/js/OverlayScrollbars.js#L4749-L4764 | train |
KingSora/OverlayScrollbars | js/OverlayScrollbars.js | refreshScrollbarsInteractive | function refreshScrollbarsInteractive(isTrack, value) {
var action = value ? 'removeClass' : 'addClass';
var element1 = isTrack ? _scrollbarHorizontalTrackElement : _scrollbarHorizontalHandleElement;
var element2 = isTrack ? _scrollbarVerticalTrackElement : _s... | javascript | function refreshScrollbarsInteractive(isTrack, value) {
var action = value ? 'removeClass' : 'addClass';
var element1 = isTrack ? _scrollbarHorizontalTrackElement : _scrollbarHorizontalHandleElement;
var element2 = isTrack ? _scrollbarVerticalTrackElement : _s... | [
"function",
"refreshScrollbarsInteractive",
"(",
"isTrack",
",",
"value",
")",
"{",
"var",
"action",
"=",
"value",
"?",
"'removeClass'",
":",
"'addClass'",
";",
"var",
"element1",
"=",
"isTrack",
"?",
"_scrollbarHorizontalTrackElement",
":",
"_scrollbarHorizontalHandl... | Refreshes the interactivity of the given scrollbar element.
@param isTrack True if the track element is the target, false if the handle element is the target.
@param value True for interactivity false for no interactivity. | [
"Refreshes",
"the",
"interactivity",
"of",
"the",
"given",
"scrollbar",
"element",
"."
] | 8e658d46e2d034a2525269d7c873bbe844762307 | https://github.com/KingSora/OverlayScrollbars/blob/8e658d46e2d034a2525269d7c873bbe844762307/js/OverlayScrollbars.js#L4852-L4860 | train |
KingSora/OverlayScrollbars | js/OverlayScrollbars.js | getScrollbarVars | function getScrollbarVars(isHorizontal) {
return {
_width_height: isHorizontal ? _strWidth : _strHeight,
_Width_Height: isHorizontal ? 'Width' : 'Height',
_left_top: isHorizontal ? _strLeft : _strTop,
_Le... | javascript | function getScrollbarVars(isHorizontal) {
return {
_width_height: isHorizontal ? _strWidth : _strHeight,
_Width_Height: isHorizontal ? 'Width' : 'Height',
_left_top: isHorizontal ? _strLeft : _strTop,
_Le... | [
"function",
"getScrollbarVars",
"(",
"isHorizontal",
")",
"{",
"return",
"{",
"_width_height",
":",
"isHorizontal",
"?",
"_strWidth",
":",
"_strHeight",
",",
"_Width_Height",
":",
"isHorizontal",
"?",
"'Width'",
":",
"'Height'",
",",
"_left_top",
":",
"isHorizonta... | Returns a object which is used for fast access for specific variables.
@param isHorizontal True if the horizontal scrollbar vars shall be accessed, false if the vertical scrollbar vars shall be accessed.
@returns {{wh: string, WH: string, lt: string, _wh: string, _lt: string, t: *, h: *, c: {}, s: *}} | [
"Returns",
"a",
"object",
"which",
"is",
"used",
"for",
"fast",
"access",
"for",
"specific",
"variables",
"."
] | 8e658d46e2d034a2525269d7c873bbe844762307 | https://github.com/KingSora/OverlayScrollbars/blob/8e658d46e2d034a2525269d7c873bbe844762307/js/OverlayScrollbars.js#L4867-L4882 | train |
KingSora/OverlayScrollbars | js/OverlayScrollbars.js | setupScrollbarCornerEvents | function setupScrollbarCornerEvents() {
var insideIFrame = _windowElementNative.top !== _windowElementNative;
var mouseDownPosition = { };
var mouseDownSize = { };
var mouseDownInvertedScale = { };
_resizeOnMouseTouchDo... | javascript | function setupScrollbarCornerEvents() {
var insideIFrame = _windowElementNative.top !== _windowElementNative;
var mouseDownPosition = { };
var mouseDownSize = { };
var mouseDownInvertedScale = { };
_resizeOnMouseTouchDo... | [
"function",
"setupScrollbarCornerEvents",
"(",
")",
"{",
"var",
"insideIFrame",
"=",
"_windowElementNative",
".",
"top",
"!==",
"_windowElementNative",
";",
"var",
"mouseDownPosition",
"=",
"{",
"}",
";",
"var",
"mouseDownSize",
"=",
"{",
"}",
";",
"var",
"mouse... | Initializes all scrollbar corner interactivity events. | [
"Initializes",
"all",
"scrollbar",
"corner",
"interactivity",
"events",
"."
] | 8e658d46e2d034a2525269d7c873bbe844762307 | https://github.com/KingSora/OverlayScrollbars/blob/8e658d46e2d034a2525269d7c873bbe844762307/js/OverlayScrollbars.js#L4904-L4976 | train |
KingSora/OverlayScrollbars | js/OverlayScrollbars.js | setTopRightBottomLeft | function setTopRightBottomLeft(targetCSSObject, prefix, values) {
if (values === undefined)
values = [_strEmpty, _strEmpty, _strEmpty, _strEmpty];
targetCSSObject[prefix + _strTop] = values[0];
targetCSSObject[prefix + _strRight] = val... | javascript | function setTopRightBottomLeft(targetCSSObject, prefix, values) {
if (values === undefined)
values = [_strEmpty, _strEmpty, _strEmpty, _strEmpty];
targetCSSObject[prefix + _strTop] = values[0];
targetCSSObject[prefix + _strRight] = val... | [
"function",
"setTopRightBottomLeft",
"(",
"targetCSSObject",
",",
"prefix",
",",
"values",
")",
"{",
"if",
"(",
"values",
"===",
"undefined",
")",
"values",
"=",
"[",
"_strEmpty",
",",
"_strEmpty",
",",
"_strEmpty",
",",
"_strEmpty",
"]",
";",
"targetCSSObject... | Sets the "top, right, bottom, left" properties, with a given prefix, of the given css object.
@param targetCSSObject The css object to which the values shall be applied.
@param prefix The prefix of the "top, right, bottom, left" css properties. (example: 'padding-' is a valid prefix)
@param values A array of values whi... | [
"Sets",
"the",
"top",
"right",
"bottom",
"left",
"properties",
"with",
"a",
"given",
"prefix",
"of",
"the",
"given",
"css",
"object",
"."
] | 8e658d46e2d034a2525269d7c873bbe844762307 | https://github.com/KingSora/OverlayScrollbars/blob/8e658d46e2d034a2525269d7c873bbe844762307/js/OverlayScrollbars.js#L5015-L5023 | train |
KingSora/OverlayScrollbars | js/OverlayScrollbars.js | getCSSTransitionString | function getCSSTransitionString(element) {
var transitionStr = VENDORS._cssProperty('transition');
var assembledValue = element.css(transitionStr);
if(assembledValue)
return assembledValue;
var regExpString = '\\s*('... | javascript | function getCSSTransitionString(element) {
var transitionStr = VENDORS._cssProperty('transition');
var assembledValue = element.css(transitionStr);
if(assembledValue)
return assembledValue;
var regExpString = '\\s*('... | [
"function",
"getCSSTransitionString",
"(",
"element",
")",
"{",
"var",
"transitionStr",
"=",
"VENDORS",
".",
"_cssProperty",
"(",
"'transition'",
")",
";",
"var",
"assembledValue",
"=",
"element",
".",
"css",
"(",
"transitionStr",
")",
";",
"if",
"(",
"assembl... | Returns the computed CSS transition string from the given element.
@param element The element from which the transition string shall be returned.
@returns {string} The CSS transition string from the given element. | [
"Returns",
"the",
"computed",
"CSS",
"transition",
"string",
"from",
"the",
"given",
"element",
"."
] | 8e658d46e2d034a2525269d7c873bbe844762307 | https://github.com/KingSora/OverlayScrollbars/blob/8e658d46e2d034a2525269d7c873bbe844762307/js/OverlayScrollbars.js#L5030-L5061 | train |
Subsets and Splits
SQL Console for semeru/code-text-javascript
Retrieves 20,000 non-null code samples labeled as JavaScript, providing a basic overview of the dataset.