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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
googlearchive/node-big-rig | lib/third_party/tracing/model/process_base.js | ProcessBase | function ProcessBase(model) {
if (!model)
throw new Error('Must provide a model');
tr.model.EventContainer.call(this);
this.model = model;
this.threads = {};
this.counters = {};
this.objects = new tr.model.ObjectCollection(this);
this.sortIndex = 0;
} | javascript | function ProcessBase(model) {
if (!model)
throw new Error('Must provide a model');
tr.model.EventContainer.call(this);
this.model = model;
this.threads = {};
this.counters = {};
this.objects = new tr.model.ObjectCollection(this);
this.sortIndex = 0;
} | [
"function",
"ProcessBase",
"(",
"model",
")",
"{",
"if",
"(",
"!",
"model",
")",
"throw",
"new",
"Error",
"(",
"'Must provide a model'",
")",
";",
"tr",
".",
"model",
".",
"EventContainer",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"model",
"=",... | The ProcessBase is a partial base class, upon which Kernel
and Process are built.
@constructor
@extends {tr.model.EventContainer} | [
"The",
"ProcessBase",
"is",
"a",
"partial",
"base",
"class",
"upon",
"which",
"Kernel",
"and",
"Process",
"are",
"built",
"."
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/process_base.js#L31-L40 | train |
googlearchive/node-big-rig | lib/third_party/tracing/model/process_base.js | function() {
var threadsToKeep = {};
for (var tid in this.threads) {
var thread = this.threads[tid];
if (!thread.isEmpty)
threadsToKeep[tid] = thread;
}
this.threads = threadsToKeep;
} | javascript | function() {
var threadsToKeep = {};
for (var tid in this.threads) {
var thread = this.threads[tid];
if (!thread.isEmpty)
threadsToKeep[tid] = thread;
}
this.threads = threadsToKeep;
} | [
"function",
"(",
")",
"{",
"var",
"threadsToKeep",
"=",
"{",
"}",
";",
"for",
"(",
"var",
"tid",
"in",
"this",
".",
"threads",
")",
"{",
"var",
"thread",
"=",
"this",
".",
"threads",
"[",
"tid",
"]",
";",
"if",
"(",
"!",
"thread",
".",
"isEmpty",... | Removes threads from the process that are fully empty. | [
"Removes",
"threads",
"from",
"the",
"process",
"that",
"are",
"fully",
"empty",
"."
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/process_base.js#L188-L196 | train | |
googlearchive/node-big-rig | lib/third_party/tracing/model/thread.js | Thread | function Thread(parent, tid) {
if (!parent)
throw new Error('Parent must be provided.');
tr.model.EventContainer.call(this);
this.parent = parent;
this.sortIndex = 0;
this.tid = tid;
this.name = undefined;
this.samples_ = undefined; // Set during createSubSlices
var that = this;
... | javascript | function Thread(parent, tid) {
if (!parent)
throw new Error('Parent must be provided.');
tr.model.EventContainer.call(this);
this.parent = parent;
this.sortIndex = 0;
this.tid = tid;
this.name = undefined;
this.samples_ = undefined; // Set during createSubSlices
var that = this;
... | [
"function",
"Thread",
"(",
"parent",
",",
"tid",
")",
"{",
"if",
"(",
"!",
"parent",
")",
"throw",
"new",
"Error",
"(",
"'Parent must be provided.'",
")",
";",
"tr",
".",
"model",
".",
"EventContainer",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
... | A Thread stores all the trace events collected for a particular
thread. We organize the synchronous slices on a thread by "subrows," where
subrow 0 has all the root slices, subrow 1 those nested 1 deep, and so on.
The asynchronous slices are stored in an AsyncSliceGroup object.
The slices stored on a Thread should be ... | [
"A",
"Thread",
"stores",
"all",
"the",
"trace",
"events",
"collected",
"for",
"a",
"particular",
"thread",
".",
"We",
"organize",
"the",
"synchronous",
"slices",
"on",
"a",
"thread",
"by",
"subrows",
"where",
"subrow",
"0",
"has",
"all",
"the",
"root",
"sl... | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/thread.js#L39-L57 | train |
googlearchive/node-big-rig | lib/third_party/tracing/model/thread.js | function(amount) {
this.sliceGroup.shiftTimestampsForward(amount);
if (this.timeSlices) {
for (var i = 0; i < this.timeSlices.length; i++) {
var slice = this.timeSlices[i];
slice.start += amount;
}
}
this.kernelSliceGroup.shiftTimestampsForward(amount);
... | javascript | function(amount) {
this.sliceGroup.shiftTimestampsForward(amount);
if (this.timeSlices) {
for (var i = 0; i < this.timeSlices.length; i++) {
var slice = this.timeSlices[i];
slice.start += amount;
}
}
this.kernelSliceGroup.shiftTimestampsForward(amount);
... | [
"function",
"(",
"amount",
")",
"{",
"this",
".",
"sliceGroup",
".",
"shiftTimestampsForward",
"(",
"amount",
")",
";",
"if",
"(",
"this",
".",
"timeSlices",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"timeSlices",
".",
... | Shifts all the timestamps inside this thread forward by the amount
specified. | [
"Shifts",
"all",
"the",
"timestamps",
"inside",
"this",
"thread",
"forward",
"by",
"the",
"amount",
"specified",
"."
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/thread.js#L102-L114 | train | |
googlearchive/node-big-rig | lib/third_party/tracing/model/thread.js | function() {
this.bounds.reset();
this.sliceGroup.updateBounds();
this.bounds.addRange(this.sliceGroup.bounds);
this.kernelSliceGroup.updateBounds();
this.bounds.addRange(this.kernelSliceGroup.bounds);
this.asyncSliceGroup.updateBounds();
this.bounds.addRange(this.asyncSlice... | javascript | function() {
this.bounds.reset();
this.sliceGroup.updateBounds();
this.bounds.addRange(this.sliceGroup.bounds);
this.kernelSliceGroup.updateBounds();
this.bounds.addRange(this.kernelSliceGroup.bounds);
this.asyncSliceGroup.updateBounds();
this.bounds.addRange(this.asyncSlice... | [
"function",
"(",
")",
"{",
"this",
".",
"bounds",
".",
"reset",
"(",
")",
";",
"this",
".",
"sliceGroup",
".",
"updateBounds",
"(",
")",
";",
"this",
".",
"bounds",
".",
"addRange",
"(",
"this",
".",
"sliceGroup",
".",
"bounds",
")",
";",
"this",
"... | Updates the bounds based on the
current objects associated with the thread. | [
"Updates",
"the",
"bounds",
"based",
"on",
"the",
"current",
"objects",
"associated",
"with",
"the",
"thread",
"."
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/thread.js#L140-L163 | train | |
googlearchive/node-big-rig | lib/third_party/tracing/extras/importer/v8/codemap.js | CodeMap | function CodeMap() {
/**
* Dynamic code entries. Used for JIT compiled code.
*/
this.dynamics_ = new tr.e.importer.v8.SplayTree();
/**
* Name generator for entries having duplicate names.
*/
this.dynamicsNameGen_ = new tr.e.importer.v8.CodeMap.NameGenerator();
/**
* Static... | javascript | function CodeMap() {
/**
* Dynamic code entries. Used for JIT compiled code.
*/
this.dynamics_ = new tr.e.importer.v8.SplayTree();
/**
* Name generator for entries having duplicate names.
*/
this.dynamicsNameGen_ = new tr.e.importer.v8.CodeMap.NameGenerator();
/**
* Static... | [
"function",
"CodeMap",
"(",
")",
"{",
"/**\n * Dynamic code entries. Used for JIT compiled code.\n */",
"this",
".",
"dynamics_",
"=",
"new",
"tr",
".",
"e",
".",
"importer",
".",
"v8",
".",
"SplayTree",
"(",
")",
";",
"/**\n * Name generator for entries hav... | Constructs a mapper that maps addresses into code entries.
@constructor | [
"Constructs",
"a",
"mapper",
"that",
"maps",
"addresses",
"into",
"code",
"entries",
"."
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/v8/codemap.js#L20-L45 | train |
googlearchive/node-big-rig | lib/third_party/tracing/model/counter_sample.js | CounterSample | function CounterSample(series, timestamp, value) {
tr.model.Event.call(this);
this.series_ = series;
this.timestamp_ = timestamp;
this.value_ = value;
} | javascript | function CounterSample(series, timestamp, value) {
tr.model.Event.call(this);
this.series_ = series;
this.timestamp_ = timestamp;
this.value_ = value;
} | [
"function",
"CounterSample",
"(",
"series",
",",
"timestamp",
",",
"value",
")",
"{",
"tr",
".",
"model",
".",
"Event",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"series_",
"=",
"series",
";",
"this",
".",
"timestamp_",
"=",
"timestamp",
";",
... | The value of a given measurement at a given time.
As an example, if we're measuring the throughput of data sent over a USB
connection, each counter sample might represent the instantaneous
throughput of the connection at a given time.
@constructor
@extends {Event} | [
"The",
"value",
"of",
"a",
"given",
"measurement",
"at",
"a",
"given",
"time",
"."
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/model/counter_sample.js#L26-L31 | train |
googlearchive/node-big-rig | lib/third_party/tracing/base/sorted_array_utils.js | findIndexInSortedIntervals | function findIndexInSortedIntervals(ary, mapLoFn, mapWidthFn, loVal) {
var first = findLowIndexInSortedArray(ary, mapLoFn, loVal);
if (first == 0) {
if (loVal >= mapLoFn(ary[0]) &&
loVal < mapLoFn(ary[0]) + mapWidthFn(ary[0], 0)) {
return 0;
} else {
return -1;
}
... | javascript | function findIndexInSortedIntervals(ary, mapLoFn, mapWidthFn, loVal) {
var first = findLowIndexInSortedArray(ary, mapLoFn, loVal);
if (first == 0) {
if (loVal >= mapLoFn(ary[0]) &&
loVal < mapLoFn(ary[0]) + mapWidthFn(ary[0], 0)) {
return 0;
} else {
return -1;
}
... | [
"function",
"findIndexInSortedIntervals",
"(",
"ary",
",",
"mapLoFn",
",",
"mapWidthFn",
",",
"loVal",
")",
"{",
"var",
"first",
"=",
"findLowIndexInSortedArray",
"(",
"ary",
",",
"mapLoFn",
",",
"loVal",
")",
";",
"if",
"(",
"first",
"==",
"0",
")",
"{",
... | Finds an index in an array of intervals that either intersects
the provided loVal, or if no intersection is found, -1 or ary.length.
The array of intervals is defined implicitly via two mapping functions
over the provided ary. mapLoFn determines the lower value of the interval,
mapWidthFn the width. Intersection is lo... | [
"Finds",
"an",
"index",
"in",
"an",
"array",
"of",
"intervals",
"that",
"either",
"intersects",
"the",
"provided",
"loVal",
"or",
"if",
"no",
"intersection",
"is",
"found",
"-",
"1",
"or",
"ary",
".",
"length",
"."
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/base/sorted_array_utils.js#L92-L123 | train |
googlearchive/node-big-rig | lib/third_party/tracing/base/sorted_array_utils.js | findIndexInSortedClosedIntervals | function findIndexInSortedClosedIntervals(ary, mapLoFn, mapHiFn, val) {
var i = findLowIndexInSortedArray(ary, mapLoFn, val);
if (i === 0) {
if (val >= mapLoFn(ary[0], 0) &&
val <= mapHiFn(ary[0], 0)) {
return 0;
} else {
return -1;
}
} else if (i < ary.length) {
... | javascript | function findIndexInSortedClosedIntervals(ary, mapLoFn, mapHiFn, val) {
var i = findLowIndexInSortedArray(ary, mapLoFn, val);
if (i === 0) {
if (val >= mapLoFn(ary[0], 0) &&
val <= mapHiFn(ary[0], 0)) {
return 0;
} else {
return -1;
}
} else if (i < ary.length) {
... | [
"function",
"findIndexInSortedClosedIntervals",
"(",
"ary",
",",
"mapLoFn",
",",
"mapHiFn",
",",
"val",
")",
"{",
"var",
"i",
"=",
"findLowIndexInSortedArray",
"(",
"ary",
",",
"mapLoFn",
",",
"val",
")",
";",
"if",
"(",
"i",
"===",
"0",
")",
"{",
"if",
... | Finds an index in an array of sorted closed intervals that either
intersects the provided val, or if no intersection is found, -1 or
ary.length.
The array of intervals is defined implicitly via two mapping functions
over the provided ary. mapLoFn determines the lower value of the interval,
mapHiFn the high. Intersecti... | [
"Finds",
"an",
"index",
"in",
"an",
"array",
"of",
"sorted",
"closed",
"intervals",
"that",
"either",
"intersects",
"the",
"provided",
"val",
"or",
"if",
"no",
"intersection",
"is",
"found",
"-",
"1",
"or",
"ary",
".",
"length",
"."
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/base/sorted_array_utils.js#L149-L178 | train |
googlearchive/node-big-rig | lib/third_party/tracing/base/sorted_array_utils.js | iterateOverIntersectingIntervals | function iterateOverIntersectingIntervals(ary, mapLoFn, mapWidthFn, loVal,
hiVal, cb) {
if (ary.length == 0)
return;
if (loVal > hiVal) return;
var i = findLowIndexInSortedArray(ary, mapLoFn, loVal);
if (i == -1) {
return;
}
if (i > 0) {
... | javascript | function iterateOverIntersectingIntervals(ary, mapLoFn, mapWidthFn, loVal,
hiVal, cb) {
if (ary.length == 0)
return;
if (loVal > hiVal) return;
var i = findLowIndexInSortedArray(ary, mapLoFn, loVal);
if (i == -1) {
return;
}
if (i > 0) {
... | [
"function",
"iterateOverIntersectingIntervals",
"(",
"ary",
",",
"mapLoFn",
",",
"mapWidthFn",
",",
"loVal",
",",
"hiVal",
",",
"cb",
")",
"{",
"if",
"(",
"ary",
".",
"length",
"==",
"0",
")",
"return",
";",
"if",
"(",
"loVal",
">",
"hiVal",
")",
"retu... | Calls cb for all intervals in the implicit array of intervals
defnied by ary, mapLoFn and mapHiFn that intersect the range
[loVal,hiVal)
This function uses the same scheme as findLowIndexInSortedArray
to define the intervals. The same restrictions on sortedness and
non-overlappingness apply.
@param {Array} ary An arr... | [
"Calls",
"cb",
"for",
"all",
"intervals",
"in",
"the",
"implicit",
"array",
"of",
"intervals",
"defnied",
"by",
"ary",
"mapLoFn",
"and",
"mapHiFn",
"that",
"intersect",
"the",
"range",
"[",
"loVal",
"hiVal",
")"
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/base/sorted_array_utils.js#L199-L226 | train |
googlearchive/node-big-rig | lib/third_party/tracing/base/sorted_array_utils.js | getIntersectingIntervals | function getIntersectingIntervals(ary, mapLoFn, mapWidthFn, loVal, hiVal) {
var tmp = [];
iterateOverIntersectingIntervals(ary, mapLoFn, mapWidthFn, loVal, hiVal,
function(d) {
tmp.push(d);
});
r... | javascript | function getIntersectingIntervals(ary, mapLoFn, mapWidthFn, loVal, hiVal) {
var tmp = [];
iterateOverIntersectingIntervals(ary, mapLoFn, mapWidthFn, loVal, hiVal,
function(d) {
tmp.push(d);
});
r... | [
"function",
"getIntersectingIntervals",
"(",
"ary",
",",
"mapLoFn",
",",
"mapWidthFn",
",",
"loVal",
",",
"hiVal",
")",
"{",
"var",
"tmp",
"=",
"[",
"]",
";",
"iterateOverIntersectingIntervals",
"(",
"ary",
",",
"mapLoFn",
",",
"mapWidthFn",
",",
"loVal",
",... | Non iterative version of iterateOverIntersectingIntervals.
@return {Array} Array of elements in ary that intersect loVal, hiVal. | [
"Non",
"iterative",
"version",
"of",
"iterateOverIntersectingIntervals",
"."
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/base/sorted_array_utils.js#L233-L240 | train |
googlearchive/node-big-rig | lib/third_party/tracing/base/sorted_array_utils.js | findClosestElementInSortedArray | function findClosestElementInSortedArray(ary, mapFn, val, maxDiff) {
if (ary.length === 0)
return null;
var aftIdx = findLowIndexInSortedArray(ary, mapFn, val);
var befIdx = aftIdx > 0 ? aftIdx - 1 : 0;
if (aftIdx === ary.length)
aftIdx -= 1;
var befDiff = Math.abs(val - mapFn(ary[bef... | javascript | function findClosestElementInSortedArray(ary, mapFn, val, maxDiff) {
if (ary.length === 0)
return null;
var aftIdx = findLowIndexInSortedArray(ary, mapFn, val);
var befIdx = aftIdx > 0 ? aftIdx - 1 : 0;
if (aftIdx === ary.length)
aftIdx -= 1;
var befDiff = Math.abs(val - mapFn(ary[bef... | [
"function",
"findClosestElementInSortedArray",
"(",
"ary",
",",
"mapFn",
",",
"val",
",",
"maxDiff",
")",
"{",
"if",
"(",
"ary",
".",
"length",
"===",
"0",
")",
"return",
"null",
";",
"var",
"aftIdx",
"=",
"findLowIndexInSortedArray",
"(",
"ary",
",",
"map... | Finds the element in the array whose value is closest to |val|.
The same restrictions on sortedness as for findLowIndexInSortedArray apply.
@param {Array} ary An array of arbitrary objects.
@param {function():*} mapFn Callback that produces a key value
from an element in ary.
@param {number} val Value for which to se... | [
"Finds",
"the",
"element",
"in",
"the",
"array",
"whose",
"value",
"is",
"closest",
"to",
"|val|",
"."
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/base/sorted_array_utils.js#L256-L274 | train |
googlearchive/node-big-rig | lib/third_party/tracing/base/sorted_array_utils.js | findClosestIntervalInSortedIntervals | function findClosestIntervalInSortedIntervals(ary, mapLoFn, mapHiFn, val,
maxDiff) {
if (ary.length === 0)
return null;
var idx = findLowIndexInSortedArray(ary, mapLoFn, val);
if (idx > 0)
idx -= 1;
var hiInt = ary[idx];
var loInt = hiInt... | javascript | function findClosestIntervalInSortedIntervals(ary, mapLoFn, mapHiFn, val,
maxDiff) {
if (ary.length === 0)
return null;
var idx = findLowIndexInSortedArray(ary, mapLoFn, val);
if (idx > 0)
idx -= 1;
var hiInt = ary[idx];
var loInt = hiInt... | [
"function",
"findClosestIntervalInSortedIntervals",
"(",
"ary",
",",
"mapLoFn",
",",
"mapHiFn",
",",
"val",
",",
"maxDiff",
")",
"{",
"if",
"(",
"ary",
".",
"length",
"===",
"0",
")",
"return",
"null",
";",
"var",
"idx",
"=",
"findLowIndexInSortedArray",
"("... | Finds the closest interval in the implicit array of intervals
defined by ary, mapLoFn and mapHiFn.
This function uses the same scheme as findLowIndexInSortedArray
to define the intervals. The same restrictions on sortedness and
non-overlappingness apply.
@param {Array} ary An array of objects that can be converted in... | [
"Finds",
"the",
"closest",
"interval",
"in",
"the",
"implicit",
"array",
"of",
"intervals",
"defined",
"by",
"ary",
"mapLoFn",
"and",
"mapHiFn",
"."
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/base/sorted_array_utils.js#L296-L321 | train |
googlearchive/node-big-rig | lib/third_party/tracing/extras/rail/rail_ir_finder.js | function(rirs) {
var vacuumIRs = [];
rirs.forEach(function(ir) {
if (ir instanceof tr.e.rail.LoadInteractionRecord ||
ir instanceof tr.e.rail.IdleInteractionRecord)
vacuumIRs.push(ir);
});
if (vacuumIRs.length === 0)
return;
var allAssociatedEvents = ... | javascript | function(rirs) {
var vacuumIRs = [];
rirs.forEach(function(ir) {
if (ir instanceof tr.e.rail.LoadInteractionRecord ||
ir instanceof tr.e.rail.IdleInteractionRecord)
vacuumIRs.push(ir);
});
if (vacuumIRs.length === 0)
return;
var allAssociatedEvents = ... | [
"function",
"(",
"rirs",
")",
"{",
"var",
"vacuumIRs",
"=",
"[",
"]",
";",
"rirs",
".",
"forEach",
"(",
"function",
"(",
"ir",
")",
"{",
"if",
"(",
"ir",
"instanceof",
"tr",
".",
"e",
".",
"rail",
".",
"LoadInteractionRecord",
"||",
"ir",
"instanceof... | Find all unassociated top-level ThreadSlices. If they start during an Idle or Load IR, then add their entire hierarchy to that IR. | [
"Find",
"all",
"unassociated",
"top",
"-",
"level",
"ThreadSlices",
".",
"If",
"they",
"start",
"during",
"an",
"Idle",
"or",
"Load",
"IR",
"then",
"add",
"their",
"entire",
"hierarchy",
"to",
"that",
"IR",
"."
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/rail/rail_ir_finder.js#L184-L215 | train | |
googlearchive/node-big-rig | lib/third_party/tracing/extras/rail/rail_ir_finder.js | function(otherIRs) {
if (this.model.bounds.isEmpty)
return;
var emptyRanges = tr.b.findEmptyRangesBetweenRanges(
tr.b.convertEventsToRanges(otherIRs),
this.model.bounds);
var irs = [];
var model = this.model;
emptyRanges.forEach(function(range) {
// Igno... | javascript | function(otherIRs) {
if (this.model.bounds.isEmpty)
return;
var emptyRanges = tr.b.findEmptyRangesBetweenRanges(
tr.b.convertEventsToRanges(otherIRs),
this.model.bounds);
var irs = [];
var model = this.model;
emptyRanges.forEach(function(range) {
// Igno... | [
"function",
"(",
"otherIRs",
")",
"{",
"if",
"(",
"this",
".",
"model",
".",
"bounds",
".",
"isEmpty",
")",
"return",
";",
"var",
"emptyRanges",
"=",
"tr",
".",
"b",
".",
"findEmptyRangesBetweenRanges",
"(",
"tr",
".",
"b",
".",
"convertEventsToRanges",
... | Fill in the empty space between IRs with IdleIRs. | [
"Fill",
"in",
"the",
"empty",
"space",
"between",
"IRs",
"with",
"IdleIRs",
"."
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/rail/rail_ir_finder.js#L218-L234 | train | |
googlearchive/node-big-rig | lib/third_party/tracing/extras/rail/rail_ir_finder.js | function() {
function isStartupSlice(slice) {
return slice.title === 'BrowserMainLoop::CreateThreads';
}
var events = this.modelHelper.browserHelper.getAllAsyncSlicesMatching(
isStartupSlice);
var deduper = new tr.model.EventSet();
events.forEach(function(event) {
... | javascript | function() {
function isStartupSlice(slice) {
return slice.title === 'BrowserMainLoop::CreateThreads';
}
var events = this.modelHelper.browserHelper.getAllAsyncSlicesMatching(
isStartupSlice);
var deduper = new tr.model.EventSet();
events.forEach(function(event) {
... | [
"function",
"(",
")",
"{",
"function",
"isStartupSlice",
"(",
"slice",
")",
"{",
"return",
"slice",
".",
"title",
"===",
"'BrowserMainLoop::CreateThreads'",
";",
"}",
"var",
"events",
"=",
"this",
".",
"modelHelper",
".",
"browserHelper",
".",
"getAllAsyncSlices... | If a thread contains a typical initialization slice, then the first event on that thread is a startup event. | [
"If",
"a",
"thread",
"contains",
"a",
"typical",
"initialization",
"slice",
"then",
"the",
"first",
"event",
"on",
"that",
"thread",
"is",
"a",
"startup",
"event",
"."
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/rail/rail_ir_finder.js#L267-L281 | train | |
googlearchive/node-big-rig | lib/third_party/tracing/extras/rail/rail_ir_finder.js | function(lir) {
var createChildEvent = undefined;
lir.renderMainThread.iterateAllEvents(function(event) {
if (event.title !== CREATE_CHILD_TITLE)
return;
if (event.args.child !== lir.routingId)
return;
createChildEvent = event;
});
if (!createChildE... | javascript | function(lir) {
var createChildEvent = undefined;
lir.renderMainThread.iterateAllEvents(function(event) {
if (event.title !== CREATE_CHILD_TITLE)
return;
if (event.args.child !== lir.routingId)
return;
createChildEvent = event;
});
if (!createChildE... | [
"function",
"(",
"lir",
")",
"{",
"var",
"createChildEvent",
"=",
"undefined",
";",
"lir",
".",
"renderMainThread",
".",
"iterateAllEvents",
"(",
"function",
"(",
"event",
")",
"{",
"if",
"(",
"event",
".",
"title",
"!==",
"CREATE_CHILD_TITLE",
")",
"return"... | Find the routingId of the createChildFrame event that created the Load IR's RenderFrame. | [
"Find",
"the",
"routingId",
"of",
"the",
"createChildFrame",
"event",
"that",
"created",
"the",
"Load",
"IR",
"s",
"RenderFrame",
"."
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/rail/rail_ir_finder.js#L337-L353 | train | |
googlearchive/node-big-rig | lib/third_party/tracing/extras/rail/rail_ir_finder.js | function() {
var startupEvents = this.getStartupEvents();
var commitLoadEvents =
this.modelHelper.browserHelper.getCommitProvisionalLoadEventsInRange(
this.model.bounds);
var frameEvents = this.getAllFrameEvents();
var startLoadEvents = this.getStartLoadEvents();
va... | javascript | function() {
var startupEvents = this.getStartupEvents();
var commitLoadEvents =
this.modelHelper.browserHelper.getCommitProvisionalLoadEventsInRange(
this.model.bounds);
var frameEvents = this.getAllFrameEvents();
var startLoadEvents = this.getStartLoadEvents();
va... | [
"function",
"(",
")",
"{",
"var",
"startupEvents",
"=",
"this",
".",
"getStartupEvents",
"(",
")",
";",
"var",
"commitLoadEvents",
"=",
"this",
".",
"modelHelper",
".",
"browserHelper",
".",
"getCommitProvisionalLoadEventsInRange",
"(",
"this",
".",
"model",
"."... | Match up RenderFrameImpl events with frame render events. | [
"Match",
"up",
"RenderFrameImpl",
"events",
"with",
"frame",
"render",
"events",
"."
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/rail/rail_ir_finder.js#L402-L442 | train | |
googlearchive/node-big-rig | lib/third_party/tracing/extras/rail/rail_ir_finder.js | function() {
var sortedInputEvents = this.getSortedInputEvents();
var protoIRs = this.findProtoIRs(sortedInputEvents);
protoIRs = this.postProcessProtoIRs(protoIRs);
this.checkAllInputEventsHandled(sortedInputEvents, protoIRs);
var irs = [];
var model = this.model;
protoIRs.fo... | javascript | function() {
var sortedInputEvents = this.getSortedInputEvents();
var protoIRs = this.findProtoIRs(sortedInputEvents);
protoIRs = this.postProcessProtoIRs(protoIRs);
this.checkAllInputEventsHandled(sortedInputEvents, protoIRs);
var irs = [];
var model = this.model;
protoIRs.fo... | [
"function",
"(",
")",
"{",
"var",
"sortedInputEvents",
"=",
"this",
".",
"getSortedInputEvents",
"(",
")",
";",
"var",
"protoIRs",
"=",
"this",
".",
"findProtoIRs",
"(",
"sortedInputEvents",
")",
";",
"protoIRs",
"=",
"this",
".",
"postProcessProtoIRs",
"(",
... | Find ProtoIRs, post-process them, convert them to real IRs. | [
"Find",
"ProtoIRs",
"post",
"-",
"process",
"them",
"convert",
"them",
"to",
"real",
"IRs",
"."
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/rail/rail_ir_finder.js#L445-L459 | train | |
googlearchive/node-big-rig | lib/third_party/tracing/extras/rail/rail_ir_finder.js | function(sortedInputEvents) {
var protoIRs = [];
forEventTypesIn(sortedInputEvents, KEYBOARD_TYPE_NAMES, function(event) {
var pir = new ProtoIR(ProtoIR.RESPONSE_TYPE, KEYBOARD_IR_NAME);
pir.pushEvent(event);
protoIRs.push(pir);
});
return protoIRs;
} | javascript | function(sortedInputEvents) {
var protoIRs = [];
forEventTypesIn(sortedInputEvents, KEYBOARD_TYPE_NAMES, function(event) {
var pir = new ProtoIR(ProtoIR.RESPONSE_TYPE, KEYBOARD_IR_NAME);
pir.pushEvent(event);
protoIRs.push(pir);
});
return protoIRs;
} | [
"function",
"(",
"sortedInputEvents",
")",
"{",
"var",
"protoIRs",
"=",
"[",
"]",
";",
"forEventTypesIn",
"(",
"sortedInputEvents",
",",
"KEYBOARD_TYPE_NAMES",
",",
"function",
"(",
"event",
")",
"{",
"var",
"pir",
"=",
"new",
"ProtoIR",
"(",
"ProtoIR",
".",... | Every keyboard event is a Response. | [
"Every",
"keyboard",
"event",
"is",
"a",
"Response",
"."
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/rail/rail_ir_finder.js#L510-L518 | train | |
googlearchive/node-big-rig | lib/third_party/tracing/extras/rail/rail_ir_finder.js | function(sortedInputEvents) {
var protoIRs = [];
forEventTypesIn(
sortedInputEvents, MOUSE_RESPONSE_TYPE_NAMES, function(event) {
var pir = new ProtoIR(ProtoIR.RESPONSE_TYPE, MOUSE_IR_NAME);
pir.pushEvent(event);
protoIRs.push(pir);
});
return protoIRs;
} | javascript | function(sortedInputEvents) {
var protoIRs = [];
forEventTypesIn(
sortedInputEvents, MOUSE_RESPONSE_TYPE_NAMES, function(event) {
var pir = new ProtoIR(ProtoIR.RESPONSE_TYPE, MOUSE_IR_NAME);
pir.pushEvent(event);
protoIRs.push(pir);
});
return protoIRs;
} | [
"function",
"(",
"sortedInputEvents",
")",
"{",
"var",
"protoIRs",
"=",
"[",
"]",
";",
"forEventTypesIn",
"(",
"sortedInputEvents",
",",
"MOUSE_RESPONSE_TYPE_NAMES",
",",
"function",
"(",
"event",
")",
"{",
"var",
"pir",
"=",
"new",
"ProtoIR",
"(",
"ProtoIR",
... | Some mouse events can be translated directly into Responses. | [
"Some",
"mouse",
"events",
"can",
"be",
"translated",
"directly",
"into",
"Responses",
"."
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/rail/rail_ir_finder.js#L521-L530 | train | |
googlearchive/node-big-rig | lib/third_party/tracing/extras/rail/rail_ir_finder.js | function(sortedInputEvents) {
var protoIRs = [];
var currentPIR = undefined;
var prevEvent_ = undefined;
forEventTypesIn(
sortedInputEvents, MOUSE_WHEEL_TYPE_NAMES, function(event) {
// Switch prevEvent in one place so that we can early-return later.
var prevEvent = pre... | javascript | function(sortedInputEvents) {
var protoIRs = [];
var currentPIR = undefined;
var prevEvent_ = undefined;
forEventTypesIn(
sortedInputEvents, MOUSE_WHEEL_TYPE_NAMES, function(event) {
// Switch prevEvent in one place so that we can early-return later.
var prevEvent = pre... | [
"function",
"(",
"sortedInputEvents",
")",
"{",
"var",
"protoIRs",
"=",
"[",
"]",
";",
"var",
"currentPIR",
"=",
"undefined",
";",
"var",
"prevEvent_",
"=",
"undefined",
";",
"forEventTypesIn",
"(",
"sortedInputEvents",
",",
"MOUSE_WHEEL_TYPE_NAMES",
",",
"funct... | MouseWheel events are caused either by a physical wheel on a physical mouse, or by a touch-drag gesture on a track-pad. The physical wheel causes MouseWheel events that are much more spaced out, and have no chance of hitting 60fps, so they are each turned into separate Response IRs. The track-pad causes MouseWheel even... | [
"MouseWheel",
"events",
"are",
"caused",
"either",
"by",
"a",
"physical",
"wheel",
"on",
"a",
"physical",
"mouse",
"or",
"by",
"a",
"touch",
"-",
"drag",
"gesture",
"on",
"a",
"track",
"-",
"pad",
".",
"The",
"physical",
"wheel",
"causes",
"MouseWheel",
... | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/rail/rail_ir_finder.js#L542-L569 | train | |
googlearchive/node-big-rig | lib/third_party/tracing/extras/rail/rail_ir_finder.js | function(sortedInputEvents) {
var protoIRs = [];
var currentPIR = undefined;
var sawFirstUpdate = false;
var modelBounds = this.model.bounds;
forEventTypesIn(sortedInputEvents, PINCH_TYPE_NAMES, function(event) {
switch (event.typeName) {
case INPUT_TYPE.PINCH_BEGIN:
... | javascript | function(sortedInputEvents) {
var protoIRs = [];
var currentPIR = undefined;
var sawFirstUpdate = false;
var modelBounds = this.model.bounds;
forEventTypesIn(sortedInputEvents, PINCH_TYPE_NAMES, function(event) {
switch (event.typeName) {
case INPUT_TYPE.PINCH_BEGIN:
... | [
"function",
"(",
"sortedInputEvents",
")",
"{",
"var",
"protoIRs",
"=",
"[",
"]",
";",
"var",
"currentPIR",
"=",
"undefined",
";",
"var",
"sawFirstUpdate",
"=",
"false",
";",
"var",
"modelBounds",
"=",
"this",
".",
"model",
".",
"bounds",
";",
"forEventTyp... | The PinchBegin and the first PinchUpdate comprise a Response, then the rest of the PinchUpdates comprise an Animation. RRRRRRRAAAAAAAAAAAAAAAAAAAA BBB UUU UUU UUU UUU UUU EEE | [
"The",
"PinchBegin",
"and",
"the",
"first",
"PinchUpdate",
"comprise",
"a",
"Response",
"then",
"the",
"rest",
"of",
"the",
"PinchUpdates",
"comprise",
"an",
"Animation",
".",
"RRRRRRRAAAAAAAAAAAAAAAAAAAA",
"BBB",
"UUU",
"UUU",
"UUU",
"UUU",
"UUU",
"EEE"
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/rail/rail_ir_finder.js#L745-L796 | train | |
googlearchive/node-big-rig | lib/third_party/tracing/extras/rail/rail_ir_finder.js | function(sortedInputEvents) {
var protoIRs = [];
var currentPIR = undefined;
var sawFirstMove = false;
forEventTypesIn(sortedInputEvents, TOUCH_TYPE_NAMES, function(event) {
switch (event.typeName) {
case INPUT_TYPE.TOUCH_START:
if (currentPIR) {
// NB... | javascript | function(sortedInputEvents) {
var protoIRs = [];
var currentPIR = undefined;
var sawFirstMove = false;
forEventTypesIn(sortedInputEvents, TOUCH_TYPE_NAMES, function(event) {
switch (event.typeName) {
case INPUT_TYPE.TOUCH_START:
if (currentPIR) {
// NB... | [
"function",
"(",
"sortedInputEvents",
")",
"{",
"var",
"protoIRs",
"=",
"[",
"]",
";",
"var",
"currentPIR",
"=",
"undefined",
";",
"var",
"sawFirstMove",
"=",
"false",
";",
"forEventTypesIn",
"(",
"sortedInputEvents",
",",
"TOUCH_TYPE_NAMES",
",",
"function",
... | The TouchStart and the first TouchMove comprise a Response, then the rest of the TouchMoves comprise an Animation. RRRRRRRAAAAAAAAAAAAAAAAAAAA SSS MMM MMM MMM MMM MMM EEE If there are no TouchMove events in between a TouchStart and a TouchEnd, then it's just a Response. RRRRRRR SSS EEE | [
"The",
"TouchStart",
"and",
"the",
"first",
"TouchMove",
"comprise",
"a",
"Response",
"then",
"the",
"rest",
"of",
"the",
"TouchMoves",
"comprise",
"an",
"Animation",
".",
"RRRRRRRAAAAAAAAAAAAAAAAAAAA",
"SSS",
"MMM",
"MMM",
"MMM",
"MMM",
"MMM",
"EEE",
"If",
"t... | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/rail/rail_ir_finder.js#L894-L963 | train | |
googlearchive/node-big-rig | lib/third_party/tracing/extras/rail/rail_ir_finder.js | function(sortedInputEvents) {
var protoIRs = [];
var currentPIR = undefined;
var sawFirstUpdate = false;
forEventTypesIn(sortedInputEvents, SCROLL_TYPE_NAMES, function(event) {
switch (event.typeName) {
case INPUT_TYPE.SCROLL_BEGIN:
// Always begin a new PIR even if... | javascript | function(sortedInputEvents) {
var protoIRs = [];
var currentPIR = undefined;
var sawFirstUpdate = false;
forEventTypesIn(sortedInputEvents, SCROLL_TYPE_NAMES, function(event) {
switch (event.typeName) {
case INPUT_TYPE.SCROLL_BEGIN:
// Always begin a new PIR even if... | [
"function",
"(",
"sortedInputEvents",
")",
"{",
"var",
"protoIRs",
"=",
"[",
"]",
";",
"var",
"currentPIR",
"=",
"undefined",
";",
"var",
"sawFirstUpdate",
"=",
"false",
";",
"forEventTypesIn",
"(",
"sortedInputEvents",
",",
"SCROLL_TYPE_NAMES",
",",
"function",... | The first ScrollBegin and the first ScrollUpdate comprise a Response, then the rest comprise an Animation. RRRRRRRAAAAAAAAAAAAAAAAAAAA BBB UUU UUU UUU UUU UUU EEE | [
"The",
"first",
"ScrollBegin",
"and",
"the",
"first",
"ScrollUpdate",
"comprise",
"a",
"Response",
"then",
"the",
"rest",
"comprise",
"an",
"Animation",
".",
"RRRRRRRAAAAAAAAAAAAAAAAAAAA",
"BBB",
"UUU",
"UUU",
"UUU",
"UUU",
"UUU",
"EEE"
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/rail/rail_ir_finder.js#L971-L1021 | train | |
googlearchive/node-big-rig | lib/third_party/tracing/extras/rail/rail_ir_finder.js | function(sortedInputEvents) {
var animationEvents = this.modelHelper.browserHelper.
getAllAsyncSlicesMatching(function(event) {
return ((event.title === CSS_ANIMATION_TITLE) &&
(event.duration > 0));
});
var animationRanges = [];
animationEvents.forEach... | javascript | function(sortedInputEvents) {
var animationEvents = this.modelHelper.browserHelper.
getAllAsyncSlicesMatching(function(event) {
return ((event.title === CSS_ANIMATION_TITLE) &&
(event.duration > 0));
});
var animationRanges = [];
animationEvents.forEach... | [
"function",
"(",
"sortedInputEvents",
")",
"{",
"var",
"animationEvents",
"=",
"this",
".",
"modelHelper",
".",
"browserHelper",
".",
"getAllAsyncSlicesMatching",
"(",
"function",
"(",
"event",
")",
"{",
"return",
"(",
"(",
"event",
".",
"title",
"===",
"CSS_A... | CSS Animations are merged into Animations when they intersect. | [
"CSS",
"Animations",
"are",
"merged",
"into",
"Animations",
"when",
"they",
"intersect",
"."
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/rail/rail_ir_finder.js#L1024-L1051 | train | |
googlearchive/node-big-rig | lib/third_party/tracing/extras/rail/rail_ir_finder.js | function(sortedInputEvents, protoIRs) {
var handledEvents = [];
protoIRs.forEach(function(protoIR) {
protoIR.associatedEvents.forEach(function(event) {
if (handledEvents.indexOf(event) >= 0) {
console.error('double-handled event', event.typeName,
parseInt(event.... | javascript | function(sortedInputEvents, protoIRs) {
var handledEvents = [];
protoIRs.forEach(function(protoIR) {
protoIR.associatedEvents.forEach(function(event) {
if (handledEvents.indexOf(event) >= 0) {
console.error('double-handled event', event.typeName,
parseInt(event.... | [
"function",
"(",
"sortedInputEvents",
",",
"protoIRs",
")",
"{",
"var",
"handledEvents",
"=",
"[",
"]",
";",
"protoIRs",
".",
"forEach",
"(",
"function",
"(",
"protoIR",
")",
"{",
"protoIR",
".",
"associatedEvents",
".",
"forEach",
"(",
"function",
"(",
"e... | Check that none of the handlers accidentally ignored an input event. | [
"Check",
"that",
"none",
"of",
"the",
"handlers",
"accidentally",
"ignored",
"an",
"input",
"event",
"."
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/rail/rail_ir_finder.js#L1248-L1267 | train | |
googlearchive/node-big-rig | lib/third_party/tracing/extras/importer/linux_perf/memreclaim_parser.js | MemReclaimParser | function MemReclaimParser(importer) {
Parser.call(this, importer);
importer.registerEventHandler('mm_vmscan_kswapd_wake',
MemReclaimParser.prototype.kswapdWake.bind(this));
importer.registerEventHandler('mm_vmscan_kswapd_sleep',
MemReclaimParser.prototype.kswapdSleep.bind(this));
import... | javascript | function MemReclaimParser(importer) {
Parser.call(this, importer);
importer.registerEventHandler('mm_vmscan_kswapd_wake',
MemReclaimParser.prototype.kswapdWake.bind(this));
importer.registerEventHandler('mm_vmscan_kswapd_sleep',
MemReclaimParser.prototype.kswapdSleep.bind(this));
import... | [
"function",
"MemReclaimParser",
"(",
"importer",
")",
"{",
"Parser",
".",
"call",
"(",
"this",
",",
"importer",
")",
";",
"importer",
".",
"registerEventHandler",
"(",
"'mm_vmscan_kswapd_wake'",
",",
"MemReclaimParser",
".",
"prototype",
".",
"kswapdWake",
".",
... | Parses linux vmscan trace events.
@constructor | [
"Parses",
"linux",
"vmscan",
"trace",
"events",
"."
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/linux_perf/memreclaim_parser.js#L21-L32 | train |
googlearchive/node-big-rig | lib/third_party/tracing/extras/importer/linux_perf/memreclaim_parser.js | function(eventName, cpuNumber, pid, ts, eventBase) {
var event = kswapdWakeRE.exec(eventBase.details);
if (!event)
return false;
var tgid = parseInt(eventBase.tgid);
var nid = parseInt(event[1]);
var order = parseInt(event[2]);
var kthread = this.importer.getOrCreateKernel... | javascript | function(eventName, cpuNumber, pid, ts, eventBase) {
var event = kswapdWakeRE.exec(eventBase.details);
if (!event)
return false;
var tgid = parseInt(eventBase.tgid);
var nid = parseInt(event[1]);
var order = parseInt(event[2]);
var kthread = this.importer.getOrCreateKernel... | [
"function",
"(",
"eventName",
",",
"cpuNumber",
",",
"pid",
",",
"ts",
",",
"eventBase",
")",
"{",
"var",
"event",
"=",
"kswapdWakeRE",
".",
"exec",
"(",
"eventBase",
".",
"details",
")",
";",
"if",
"(",
"!",
"event",
")",
"return",
"false",
";",
"va... | Parses memreclaim events and sets up state in the importer. | [
"Parses",
"memreclaim",
"events",
"and",
"sets",
"up",
"state",
"in",
"the",
"importer",
"."
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/linux_perf/memreclaim_parser.js#L56-L78 | train | |
googlearchive/node-big-rig | lib/third_party/tracing/extras/importer/linux_perf/sync_parser.js | SyncParser | function SyncParser(importer) {
Parser.call(this, importer);
importer.registerEventHandler(
'sync_timeline',
SyncParser.prototype.timelineEvent.bind(this));
importer.registerEventHandler(
'sync_wait',
SyncParser.prototype.syncWaitEvent.bind(this));
importer.registerEvent... | javascript | function SyncParser(importer) {
Parser.call(this, importer);
importer.registerEventHandler(
'sync_timeline',
SyncParser.prototype.timelineEvent.bind(this));
importer.registerEventHandler(
'sync_wait',
SyncParser.prototype.syncWaitEvent.bind(this));
importer.registerEvent... | [
"function",
"SyncParser",
"(",
"importer",
")",
"{",
"Parser",
".",
"call",
"(",
"this",
",",
"importer",
")",
";",
"importer",
".",
"registerEventHandler",
"(",
"'sync_timeline'",
",",
"SyncParser",
".",
"prototype",
".",
"timelineEvent",
".",
"bind",
"(",
... | Parses linux sync trace events.
@constructor | [
"Parses",
"linux",
"sync",
"trace",
"events",
"."
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/linux_perf/sync_parser.js#L23-L36 | train |
googlearchive/node-big-rig | lib/third_party/tracing/extras/importer/linux_perf/sync_parser.js | function(eventName, cpuNumber, pid,
ts, eventBase) {
var event = syncTimelineRE.exec(eventBase.details);
if (!event)
return false;
var thread = this.importer.getOrCreatePseudoThread(event[1]);
if (thread.lastActiveTs !== undefined) {
var duration = t... | javascript | function(eventName, cpuNumber, pid,
ts, eventBase) {
var event = syncTimelineRE.exec(eventBase.details);
if (!event)
return false;
var thread = this.importer.getOrCreatePseudoThread(event[1]);
if (thread.lastActiveTs !== undefined) {
var duration = t... | [
"function",
"(",
"eventName",
",",
"cpuNumber",
",",
"pid",
",",
"ts",
",",
"eventBase",
")",
"{",
"var",
"event",
"=",
"syncTimelineRE",
".",
"exec",
"(",
"eventBase",
".",
"details",
")",
";",
"if",
"(",
"!",
"event",
")",
"return",
"false",
";",
"... | Parses sync events and sets up state in the importer. | [
"Parses",
"sync",
"events",
"and",
"sets",
"up",
"state",
"in",
"the",
"importer",
"."
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/linux_perf/sync_parser.js#L48-L71 | train | |
googlearchive/node-big-rig | lib/third_party/tracing/extras/importer/linux_perf/i915_parser.js | I915Parser | function I915Parser(importer) {
Parser.call(this, importer);
importer.registerEventHandler('i915_gem_object_create',
I915Parser.prototype.gemObjectCreateEvent.bind(this));
importer.registerEventHandler('i915_gem_object_bind',
I915Parser.prototype.gemObjectBindEvent.bind(this));
importer... | javascript | function I915Parser(importer) {
Parser.call(this, importer);
importer.registerEventHandler('i915_gem_object_create',
I915Parser.prototype.gemObjectCreateEvent.bind(this));
importer.registerEventHandler('i915_gem_object_bind',
I915Parser.prototype.gemObjectBindEvent.bind(this));
importer... | [
"function",
"I915Parser",
"(",
"importer",
")",
"{",
"Parser",
".",
"call",
"(",
"this",
",",
"importer",
")",
";",
"importer",
".",
"registerEventHandler",
"(",
"'i915_gem_object_create'",
",",
"I915Parser",
".",
"prototype",
".",
"gemObjectCreateEvent",
".",
"... | Parses linux i915 trace events.
@constructor | [
"Parses",
"linux",
"i915",
"trace",
"events",
"."
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/linux_perf/i915_parser.js#L22-L72 | train |
googlearchive/node-big-rig | lib/third_party/tracing/extras/importer/linux_perf/i915_parser.js | function(eventName, cpuNumber, pid, ts, eventBase) {
var event = /obj=(\w+), size=(\d+)/.exec(eventBase.details);
if (!event)
return false;
var obj = event[1];
var size = parseInt(event[2]);
this.i915GemObjectSlice(ts, eventName, obj,
{
obj: obj,
... | javascript | function(eventName, cpuNumber, pid, ts, eventBase) {
var event = /obj=(\w+), size=(\d+)/.exec(eventBase.details);
if (!event)
return false;
var obj = event[1];
var size = parseInt(event[2]);
this.i915GemObjectSlice(ts, eventName, obj,
{
obj: obj,
... | [
"function",
"(",
"eventName",
",",
"cpuNumber",
",",
"pid",
",",
"ts",
",",
"eventBase",
")",
"{",
"var",
"event",
"=",
"/",
"obj=(\\w+), size=(\\d+)",
"/",
".",
"exec",
"(",
"eventBase",
".",
"details",
")",
";",
"if",
"(",
"!",
"event",
")",
"return"... | Parses i915 driver events and sets up state in the importer. | [
"Parses",
"i915",
"driver",
"events",
"and",
"sets",
"up",
"state",
"in",
"the",
"importer",
"."
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/linux_perf/i915_parser.js#L141-L154 | train | |
googlearchive/node-big-rig | lib/third_party/tracing/extras/importer/linux_perf/exynos_parser.js | ExynosParser | function ExynosParser(importer) {
Parser.call(this, importer);
importer.registerEventHandler('exynos_busfreq_target_int',
ExynosParser.prototype.busfreqTargetIntEvent.bind(this));
importer.registerEventHandler('exynos_busfreq_target_mif',
ExynosParser.prototype.busfreqTargetMifEvent.bind(th... | javascript | function ExynosParser(importer) {
Parser.call(this, importer);
importer.registerEventHandler('exynos_busfreq_target_int',
ExynosParser.prototype.busfreqTargetIntEvent.bind(this));
importer.registerEventHandler('exynos_busfreq_target_mif',
ExynosParser.prototype.busfreqTargetMifEvent.bind(th... | [
"function",
"ExynosParser",
"(",
"importer",
")",
"{",
"Parser",
".",
"call",
"(",
"this",
",",
"importer",
")",
";",
"importer",
".",
"registerEventHandler",
"(",
"'exynos_busfreq_target_int'",
",",
"ExynosParser",
".",
"prototype",
".",
"busfreqTargetIntEvent",
... | Parses linux exynos trace events.
@constructor | [
"Parses",
"linux",
"exynos",
"trace",
"events",
"."
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/linux_perf/exynos_parser.js#L23-L33 | train |
googlearchive/node-big-rig | lib/third_party/tracing/extras/importer/linux_perf/exynos_parser.js | function(eventName, cpuNumber, pid, ts, eventBase) {
var event = /frequency=(\d+)/.exec(eventBase.details);
if (!event)
return false;
this.exynosBusfreqSample('INT Frequency', ts, parseInt(event[1]));
return true;
} | javascript | function(eventName, cpuNumber, pid, ts, eventBase) {
var event = /frequency=(\d+)/.exec(eventBase.details);
if (!event)
return false;
this.exynosBusfreqSample('INT Frequency', ts, parseInt(event[1]));
return true;
} | [
"function",
"(",
"eventName",
",",
"cpuNumber",
",",
"pid",
",",
"ts",
",",
"eventBase",
")",
"{",
"var",
"event",
"=",
"/",
"frequency=(\\d+)",
"/",
".",
"exec",
"(",
"eventBase",
".",
"details",
")",
";",
"if",
"(",
"!",
"event",
")",
"return",
"fa... | Parses exynos_busfreq_target_int events and sets up state. | [
"Parses",
"exynos_busfreq_target_int",
"events",
"and",
"sets",
"up",
"state",
"."
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/linux_perf/exynos_parser.js#L54-L61 | train | |
googlearchive/node-big-rig | lib/third_party/tracing/extras/importer/linux_perf/exynos_parser.js | function(eventName, cpuNumber, pid, ts, eventBase) {
var event = /pipe=(\d+), fb=(\d+), state=(.*)/.exec(eventBase.details);
if (!event)
return false;
var pipe = parseInt(event[1]);
var fb = parseInt(event[2]);
var state = event[3];
this.exynosPageFlipStateCloseSlice(ts, pi... | javascript | function(eventName, cpuNumber, pid, ts, eventBase) {
var event = /pipe=(\d+), fb=(\d+), state=(.*)/.exec(eventBase.details);
if (!event)
return false;
var pipe = parseInt(event[1]);
var fb = parseInt(event[2]);
var state = event[3];
this.exynosPageFlipStateCloseSlice(ts, pi... | [
"function",
"(",
"eventName",
",",
"cpuNumber",
",",
"pid",
",",
"ts",
",",
"eventBase",
")",
"{",
"var",
"event",
"=",
"/",
"pipe=(\\d+), fb=(\\d+), state=(.*)",
"/",
".",
"exec",
"(",
"eventBase",
".",
"details",
")",
";",
"if",
"(",
"!",
"event",
")",... | Parses page_flip_state events and sets up state in the importer. | [
"Parses",
"page_flip_state",
"events",
"and",
"sets",
"up",
"state",
"in",
"the",
"importer",
"."
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/linux_perf/exynos_parser.js#L99-L116 | train | |
googlearchive/node-big-rig | lib/third_party/tracing/extras/importer/linux_perf/irq_parser.js | IrqParser | function IrqParser(importer) {
Parser.call(this, importer);
importer.registerEventHandler('irq_handler_entry',
IrqParser.prototype.irqHandlerEntryEvent.bind(this));
importer.registerEventHandler('irq_handler_exit',
IrqParser.prototype.irqHandlerExitEvent.bind(this));
importer.registerEv... | javascript | function IrqParser(importer) {
Parser.call(this, importer);
importer.registerEventHandler('irq_handler_entry',
IrqParser.prototype.irqHandlerEntryEvent.bind(this));
importer.registerEventHandler('irq_handler_exit',
IrqParser.prototype.irqHandlerExitEvent.bind(this));
importer.registerEv... | [
"function",
"IrqParser",
"(",
"importer",
")",
"{",
"Parser",
".",
"call",
"(",
"this",
",",
"importer",
")",
";",
"importer",
".",
"registerEventHandler",
"(",
"'irq_handler_entry'",
",",
"IrqParser",
".",
"prototype",
".",
"irqHandlerEntryEvent",
".",
"bind",
... | Parses linux irq trace events.
@constructor | [
"Parses",
"linux",
"irq",
"trace",
"events",
"."
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/linux_perf/irq_parser.js#L23-L40 | train |
googlearchive/node-big-rig | lib/third_party/tracing/extras/importer/linux_perf/irq_parser.js | function(eventName, cpuNumber, pid, ts, eventBase) {
var event = irqHandlerEntryRE.exec(eventBase.details);
if (!event)
return false;
var irq = parseInt(event[1]);
var name = event[2];
var thread = this.importer.getOrCreatePseudoThread(
'irqs cpu ' + cpuNumber);
t... | javascript | function(eventName, cpuNumber, pid, ts, eventBase) {
var event = irqHandlerEntryRE.exec(eventBase.details);
if (!event)
return false;
var irq = parseInt(event[1]);
var name = event[2];
var thread = this.importer.getOrCreatePseudoThread(
'irqs cpu ' + cpuNumber);
t... | [
"function",
"(",
"eventName",
",",
"cpuNumber",
",",
"pid",
",",
"ts",
",",
"eventBase",
")",
"{",
"var",
"event",
"=",
"irqHandlerEntryRE",
".",
"exec",
"(",
"eventBase",
".",
"details",
")",
";",
"if",
"(",
"!",
"event",
")",
"return",
"false",
";",
... | Parses irq events and sets up state in the mporter. | [
"Parses",
"irq",
"events",
"and",
"sets",
"up",
"state",
"in",
"the",
"mporter",
"."
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/linux_perf/irq_parser.js#L60-L74 | train | |
googlearchive/node-big-rig | lib/third_party/tracing/extras/importer/linux_perf/irq_parser.js | function(eventName, cpuNumber, pid, ts, eventBase) {
var thread = this.importer.getOrCreatePseudoThread(
'irqs cpu ' + cpuNumber);
thread.lastEntryTs = ts;
return true;
} | javascript | function(eventName, cpuNumber, pid, ts, eventBase) {
var thread = this.importer.getOrCreatePseudoThread(
'irqs cpu ' + cpuNumber);
thread.lastEntryTs = ts;
return true;
} | [
"function",
"(",
"eventName",
",",
"cpuNumber",
",",
"pid",
",",
"ts",
",",
"eventBase",
")",
"{",
"var",
"thread",
"=",
"this",
".",
"importer",
".",
"getOrCreatePseudoThread",
"(",
"'irqs cpu '",
"+",
"cpuNumber",
")",
";",
"thread",
".",
"lastEntryTs",
... | Parses ipi events and sets up state in the mporter. | [
"Parses",
"ipi",
"events",
"and",
"sets",
"up",
"state",
"in",
"the",
"mporter",
"."
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/linux_perf/irq_parser.js#L143-L149 | train | |
googlearchive/node-big-rig | lib/third_party/tracing/base/base.js | initialize | function initialize() {
if (global.isVinn) {
tr.isVinn = true;
} else if (global.process && global.process.versions.node) {
tr.isNode = true;
} else {
tr.isVinn = false;
tr.isNode = false;
tr.doc = document;
tr.isMac = /Mac/.test(navigator.platform);
tr.isWindows =... | javascript | function initialize() {
if (global.isVinn) {
tr.isVinn = true;
} else if (global.process && global.process.versions.node) {
tr.isNode = true;
} else {
tr.isVinn = false;
tr.isNode = false;
tr.doc = document;
tr.isMac = /Mac/.test(navigator.platform);
tr.isWindows =... | [
"function",
"initialize",
"(",
")",
"{",
"if",
"(",
"global",
".",
"isVinn",
")",
"{",
"tr",
".",
"isVinn",
"=",
"true",
";",
"}",
"else",
"if",
"(",
"global",
".",
"process",
"&&",
"global",
".",
"process",
".",
"versions",
".",
"node",
")",
"{",
... | Initialization which must be deferred until run-time. | [
"Initialization",
"which",
"must",
"be",
"deferred",
"until",
"run",
"-",
"time",
"."
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/base/base.js#L161-L177 | train |
googlearchive/node-big-rig | lib/third_party/tracing/base/event_target.js | function(type, handler) {
if (!this.listeners_)
this.listeners_ = Object.create(null);
if (!(type in this.listeners_)) {
this.listeners_[type] = [handler];
} else {
var handlers = this.listeners_[type];
if (handlers.indexOf(handler) < 0)
handlers.push(handler)... | javascript | function(type, handler) {
if (!this.listeners_)
this.listeners_ = Object.create(null);
if (!(type in this.listeners_)) {
this.listeners_[type] = [handler];
} else {
var handlers = this.listeners_[type];
if (handlers.indexOf(handler) < 0)
handlers.push(handler)... | [
"function",
"(",
"type",
",",
"handler",
")",
"{",
"if",
"(",
"!",
"this",
".",
"listeners_",
")",
"this",
".",
"listeners_",
"=",
"Object",
".",
"create",
"(",
"null",
")",
";",
"if",
"(",
"!",
"(",
"type",
"in",
"this",
".",
"listeners_",
")",
... | Adds an event listener to the target.
@param {string} type The name of the event.
@param {!Function|{handleEvent:Function}} handler The handler for the
event. This is called when the event is dispatched. | [
"Adds",
"an",
"event",
"listener",
"to",
"the",
"target",
"."
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/base/event_target.js#L43-L53 | train | |
googlearchive/node-big-rig | lib/third_party/tracing/base/event_target.js | function(type, handler) {
if (!this.listeners_)
return;
if (type in this.listeners_) {
var handlers = this.listeners_[type];
var index = handlers.indexOf(handler);
if (index >= 0) {
// Clean up if this was the last listener.
if (handlers.length == 1)
... | javascript | function(type, handler) {
if (!this.listeners_)
return;
if (type in this.listeners_) {
var handlers = this.listeners_[type];
var index = handlers.indexOf(handler);
if (index >= 0) {
// Clean up if this was the last listener.
if (handlers.length == 1)
... | [
"function",
"(",
"type",
",",
"handler",
")",
"{",
"if",
"(",
"!",
"this",
".",
"listeners_",
")",
"return",
";",
"if",
"(",
"type",
"in",
"this",
".",
"listeners_",
")",
"{",
"var",
"handlers",
"=",
"this",
".",
"listeners_",
"[",
"type",
"]",
";"... | Removes an event listener from the target.
@param {string} type The name of the event.
@param {!Function|{handleEvent:Function}} handler The handler for the
event. | [
"Removes",
"an",
"event",
"listener",
"from",
"the",
"target",
"."
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/base/event_target.js#L61-L75 | train | |
googlearchive/node-big-rig | lib/third_party/tracing/base/event_target.js | function(event) {
if (!this.listeners_)
return true;
// Since we are using DOM Event objects we need to override some of the
// properties and methods so that we can emulate this correctly.
var self = this;
event.__defineGetter__('target', function() {
return self;
}... | javascript | function(event) {
if (!this.listeners_)
return true;
// Since we are using DOM Event objects we need to override some of the
// properties and methods so that we can emulate this correctly.
var self = this;
event.__defineGetter__('target', function() {
return self;
}... | [
"function",
"(",
"event",
")",
"{",
"if",
"(",
"!",
"this",
".",
"listeners_",
")",
"return",
"true",
";",
"// Since we are using DOM Event objects we need to override some of the",
"// properties and methods so that we can emulate this correctly.",
"var",
"self",
"=",
"this"... | Dispatches an event and calls all the listeners that are listening to
the type of the event.
@param {!cr.event.Event} event The event to dispatch.
@return {boolean} Whether the default action was prevented. If someone
calls preventDefault on the event object then this returns false. | [
"Dispatches",
"an",
"event",
"and",
"calls",
"all",
"the",
"listeners",
"that",
"are",
"listening",
"to",
"the",
"type",
"of",
"the",
"event",
"."
] | 71748aab8ea166726356c6578a6a1c82e314ca33 | https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/base/event_target.js#L84-L114 | train | |
gaaiatinc/hapi-openid-connect | lib/authorization/index.js | __verify_client_registration_entries | function __verify_client_registration_entries(authorize_request) {
return new Promise(async (resolve, reject) => {
let error_object = {
error: "unauthorized_client",
error_description: ""
};
try {
if (!authorize_request.client_id || !authorize_request.re... | javascript | function __verify_client_registration_entries(authorize_request) {
return new Promise(async (resolve, reject) => {
let error_object = {
error: "unauthorized_client",
error_description: ""
};
try {
if (!authorize_request.client_id || !authorize_request.re... | [
"function",
"__verify_client_registration_entries",
"(",
"authorize_request",
")",
"{",
"return",
"new",
"Promise",
"(",
"async",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"let",
"error_object",
"=",
"{",
"error",
":",
"\"unauthorized_client\"",
",",
"error_d... | This method verifies that the client ID and the redirect URI in the request
match the respective ones in the client registry. If the client ID and
redirect URI do not match the ones in the client registry, then no redirect
is sent at all, this is necessary to prevent reflected attacks. In this
case only an error is re... | [
"This",
"method",
"verifies",
"that",
"the",
"client",
"ID",
"and",
"the",
"redirect",
"URI",
"in",
"the",
"request",
"match",
"the",
"respective",
"ones",
"in",
"the",
"client",
"registry",
".",
"If",
"the",
"client",
"ID",
"and",
"redirect",
"URI",
"do",... | 3f4752323f4043e12311d4a9adb673e1f6952223 | https://github.com/gaaiatinc/hapi-openid-connect/blob/3f4752323f4043e12311d4a9adb673e1f6952223/lib/authorization/index.js#L106-L145 | train |
gaaiatinc/hapi-openid-connect | lib/authorization/index.js | __validate_authorization_request | function __validate_authorization_request(authorize_request) {
return new Promise((resolve, reject) => {
let error_object = {
error: "invlalid_request",
error_description: ""
};
if (authorize_request.state) {
error_object.state = authorize_request.state;
... | javascript | function __validate_authorization_request(authorize_request) {
return new Promise((resolve, reject) => {
let error_object = {
error: "invlalid_request",
error_description: ""
};
if (authorize_request.state) {
error_object.state = authorize_request.state;
... | [
"function",
"__validate_authorization_request",
"(",
"authorize_request",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"let",
"error_object",
"=",
"{",
"error",
":",
"\"invlalid_request\"",
",",
"error_description",
":"... | Returns an error descriptor object with the error code if validation fails.
@param {[type]} authorize_request
@return {[type]} | [
"Returns",
"an",
"error",
"descriptor",
"object",
"with",
"the",
"error",
"code",
"if",
"validation",
"fails",
"."
] | 3f4752323f4043e12311d4a9adb673e1f6952223 | https://github.com/gaaiatinc/hapi-openid-connect/blob/3f4752323f4043e12311d4a9adb673e1f6952223/lib/authorization/index.js#L153-L191 | train |
gaaiatinc/hapi-openid-connect | sample_app/lib/token_registrar_module/index.js | post_token | function post_token(oidc_token) {
return new Promise((resolve, reject) => {
dbMgr
.updateOne("oidc_token", {
id_token: {
$eq: null
}
}, {
$currentDate: {
expire_on: true
},
... | javascript | function post_token(oidc_token) {
return new Promise((resolve, reject) => {
dbMgr
.updateOne("oidc_token", {
id_token: {
$eq: null
}
}, {
$currentDate: {
expire_on: true
},
... | [
"function",
"post_token",
"(",
"oidc_token",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"dbMgr",
".",
"updateOne",
"(",
"\"oidc_token\"",
",",
"{",
"id_token",
":",
"{",
"$eq",
":",
"null",
"}",
"}",
",",
... | This function must return a promise, which persists the oidc_token
object, and resolve with the ID for the persisted oidc_token. The
ID can be used later to retrieve the persisted oidc_token.
@param oidc_token
@return oidc_token_id | [
"This",
"function",
"must",
"return",
"a",
"promise",
"which",
"persists",
"the",
"oidc_token",
"object",
"and",
"resolve",
"with",
"the",
"ID",
"for",
"the",
"persisted",
"oidc_token",
".",
"The",
"ID",
"can",
"be",
"used",
"later",
"to",
"retrieve",
"the",... | 3f4752323f4043e12311d4a9adb673e1f6952223 | https://github.com/gaaiatinc/hapi-openid-connect/blob/3f4752323f4043e12311d4a9adb673e1f6952223/sample_app/lib/token_registrar_module/index.js#L41-L64 | train |
gaaiatinc/hapi-openid-connect | sample_app/lib/authorization_request_registrar_module/index.js | post_authorization_request | function post_authorization_request(authorization_request) {
return new Promise((resolve, reject) => {
dbMgr
.updateOne("authorization_request", {
client_id: {
$eq: null
}
}, {
$set: authorization_request
... | javascript | function post_authorization_request(authorization_request) {
return new Promise((resolve, reject) => {
dbMgr
.updateOne("authorization_request", {
client_id: {
$eq: null
}
}, {
$set: authorization_request
... | [
"function",
"post_authorization_request",
"(",
"authorization_request",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"dbMgr",
".",
"updateOne",
"(",
"\"authorization_request\"",
",",
"{",
"client_id",
":",
"{",
"$eq",... | This function must return a promise, which persists the authorization_request
object, and resolve with the ID for the persisted authorization_request. The
ID can be used later to retrieve the persisted authorization_request.
@param authorization_request
@return authorization_request_id | [
"This",
"function",
"must",
"return",
"a",
"promise",
"which",
"persists",
"the",
"authorization_request",
"object",
"and",
"resolve",
"with",
"the",
"ID",
"for",
"the",
"persisted",
"authorization_request",
".",
"The",
"ID",
"can",
"be",
"used",
"later",
"to",
... | 3f4752323f4043e12311d4a9adb673e1f6952223 | https://github.com/gaaiatinc/hapi-openid-connect/blob/3f4752323f4043e12311d4a9adb673e1f6952223/sample_app/lib/authorization_request_registrar_module/index.js#L41-L61 | train |
gaaiatinc/hapi-openid-connect | sample_app/lib/authorization_request_registrar_module/index.js | get_authorization_request | function get_authorization_request(authorization_request_id) {
return new Promise((resolve, reject) => {
dbMgr
.find("authorization_request", {
_id: {
$eq: authorization_request_id
}
}, {limit: 1})
.then((authorize_reque... | javascript | function get_authorization_request(authorization_request_id) {
return new Promise((resolve, reject) => {
dbMgr
.find("authorization_request", {
_id: {
$eq: authorization_request_id
}
}, {limit: 1})
.then((authorize_reque... | [
"function",
"get_authorization_request",
"(",
"authorization_request_id",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"dbMgr",
".",
"find",
"(",
"\"authorization_request\"",
",",
"{",
"_id",
":",
"{",
"$eq",
":",
... | This function must return a promise, which resolves with the
authorization_request associated with the authorization_request_id argument.
Also, the implementation must check for the time the respective
authorization_request was granted, and reject the promise if the persisted
and/or granted authorizeRequest is older t... | [
"This",
"function",
"must",
"return",
"a",
"promise",
"which",
"resolves",
"with",
"the",
"authorization_request",
"associated",
"with",
"the",
"authorization_request_id",
"argument",
"."
] | 3f4752323f4043e12311d4a9adb673e1f6952223 | https://github.com/gaaiatinc/hapi-openid-connect/blob/3f4752323f4043e12311d4a9adb673e1f6952223/sample_app/lib/authorization_request_registrar_module/index.js#L106-L122 | train |
gaaiatinc/hapi-openid-connect | lib/token/index.js | __send_token_for_authorization_code | async function __send_token_for_authorization_code(request_params, request, h) {
function __process_authorization_code(request_params) {
return authorization_endpoint
.authorization_request_registrar_module
.get_authorization_request(request_params.code);
}
try {
co... | javascript | async function __send_token_for_authorization_code(request_params, request, h) {
function __process_authorization_code(request_params) {
return authorization_endpoint
.authorization_request_registrar_module
.get_authorization_request(request_params.code);
}
try {
co... | [
"async",
"function",
"__send_token_for_authorization_code",
"(",
"request_params",
",",
"request",
",",
"h",
")",
"{",
"function",
"__process_authorization_code",
"(",
"request_params",
")",
"{",
"return",
"authorization_endpoint",
".",
"authorization_request_registrar_module... | 5.1. Successful Response
The authorization server issues an access token and optional refresh
token, and constructs the response by adding the following parameters
to the entity-body of the HTTP response with a 200 (OK) status code:
access_token
REQUIRED. The access token issued by the authorization server.
token_... | [
"5",
".",
"1",
".",
"Successful",
"Response"
] | 3f4752323f4043e12311d4a9adb673e1f6952223 | https://github.com/gaaiatinc/hapi-openid-connect/blob/3f4752323f4043e12311d4a9adb673e1f6952223/lib/token/index.js#L245-L289 | train |
gaaiatinc/hapi-openid-connect | lib/token/index.js | __process_authorization_header_for_client | function __process_authorization_header_for_client(request_params) {
return new Promise(async (resolve, reject) => {
try {
const client_account_id = await client_endpoint
.client_registrar_module
.get_client_account_id_for_credentials(request_params.authorization_... | javascript | function __process_authorization_header_for_client(request_params) {
return new Promise(async (resolve, reject) => {
try {
const client_account_id = await client_endpoint
.client_registrar_module
.get_client_account_id_for_credentials(request_params.authorization_... | [
"function",
"__process_authorization_header_for_client",
"(",
"request_params",
")",
"{",
"return",
"new",
"Promise",
"(",
"async",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"try",
"{",
"const",
"client_account_id",
"=",
"await",
"client_endpoint",
".",
"clie... | The authorization header credentials will be checked with the clien_registrar.
@param {[type]} request_params [description]
@return {[type]} [description] | [
"The",
"authorization",
"header",
"credentials",
"will",
"be",
"checked",
"with",
"the",
"clien_registrar",
"."
] | 3f4752323f4043e12311d4a9adb673e1f6952223 | https://github.com/gaaiatinc/hapi-openid-connect/blob/3f4752323f4043e12311d4a9adb673e1f6952223/lib/token/index.js#L309-L321 | train |
gaaiatinc/hapi-openid-connect | lib/token/index.js | __process_authorization_header_for_user | function __process_authorization_header_for_user(request_params) {
return new Promise(async (resolve, reject) => {
try {
const user_account_id = await user_info_endpoint
.user_account_registrar_module
.get_user_account_id_for_credentials(request_params.authorizati... | javascript | function __process_authorization_header_for_user(request_params) {
return new Promise(async (resolve, reject) => {
try {
const user_account_id = await user_info_endpoint
.user_account_registrar_module
.get_user_account_id_for_credentials(request_params.authorizati... | [
"function",
"__process_authorization_header_for_user",
"(",
"request_params",
")",
"{",
"return",
"new",
"Promise",
"(",
"async",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"try",
"{",
"const",
"user_account_id",
"=",
"await",
"user_info_endpoint",
".",
"user_... | The credentials will be checked with the user_registrar.
If no user account matches the credentials, then, the
request is denied.
@param {[type]} request_params [description]
@return {[type]} [description] | [
"The",
"credentials",
"will",
"be",
"checked",
"with",
"the",
"user_registrar",
"."
] | 3f4752323f4043e12311d4a9adb673e1f6952223 | https://github.com/gaaiatinc/hapi-openid-connect/blob/3f4752323f4043e12311d4a9adb673e1f6952223/lib/token/index.js#L332-L343 | train |
reindexio/reindex-js | src/ReindexRelayNetworkLayer.js | formatRequestErrors | function formatRequestErrors(request, errors) {
const CONTEXT_BEFORE = 20;
const CONTEXT_LENGTH = 60;
const queryLines = request.getQueryString().split('\n');
return errors.map(({locations = [], message}, ii) => {
const prefix = (ii + 1) + '. ';
const indent = ' '.repeat(prefix.length);
return (
... | javascript | function formatRequestErrors(request, errors) {
const CONTEXT_BEFORE = 20;
const CONTEXT_LENGTH = 60;
const queryLines = request.getQueryString().split('\n');
return errors.map(({locations = [], message}, ii) => {
const prefix = (ii + 1) + '. ';
const indent = ' '.repeat(prefix.length);
return (
... | [
"function",
"formatRequestErrors",
"(",
"request",
",",
"errors",
")",
"{",
"const",
"CONTEXT_BEFORE",
"=",
"20",
";",
"const",
"CONTEXT_LENGTH",
"=",
"60",
";",
"const",
"queryLines",
"=",
"request",
".",
"getQueryString",
"(",
")",
".",
"split",
"(",
"'\\n... | Formats an error response from GraphQL server request. | [
"Formats",
"an",
"error",
"response",
"from",
"GraphQL",
"server",
"request",
"."
] | aa33c9d45239be6e0924aa495844e1d3026eae15 | https://github.com/reindexio/reindex-js/blob/aa33c9d45239be6e0924aa495844e1d3026eae15/src/ReindexRelayNetworkLayer.js#L139-L159 | train |
pillarsjs/pillars | middleware/bodyReader.js | jsonEncoded | function jsonEncoded(gw, callback){
var buffer = '';
var readlength = 0;
var $error = false;
gw.req.on('data', function (chunk) {
if (readlength > gw.content.length){$error = true;}
if (!$error) {
readlength += chunk.length;
buffer += chunk.toString('ascii');
}
});
gw.req.on('end', f... | javascript | function jsonEncoded(gw, callback){
var buffer = '';
var readlength = 0;
var $error = false;
gw.req.on('data', function (chunk) {
if (readlength > gw.content.length){$error = true;}
if (!$error) {
readlength += chunk.length;
buffer += chunk.toString('ascii');
}
});
gw.req.on('end', f... | [
"function",
"jsonEncoded",
"(",
"gw",
",",
"callback",
")",
"{",
"var",
"buffer",
"=",
"''",
";",
"var",
"readlength",
"=",
"0",
";",
"var",
"$error",
"=",
"false",
";",
"gw",
".",
"req",
".",
"on",
"(",
"'data'",
",",
"function",
"(",
"chunk",
")"... | JSON-encoded parser. | [
"JSON",
"-",
"encoded",
"parser",
"."
] | 7702fd42d3c07fd0e5605a377b1b51c88d0bdd58 | https://github.com/pillarsjs/pillars/blob/7702fd42d3c07fd0e5605a377b1b51c88d0bdd58/middleware/bodyReader.js#L61-L88 | train |
pillarsjs/pillars | middleware/bodyReader.js | urlEncoded | function urlEncoded(gw, callback){
var buffer = '';
var readlength = 0;
var $error = false;
gw.req.on('data', function (chunk) {
if (readlength > gw.content.length) {$error = true;}
if (!$error) {
readlength += chunk.length;
buffer += chunk.toString('ascii');
}
});
gw.req.on('end', f... | javascript | function urlEncoded(gw, callback){
var buffer = '';
var readlength = 0;
var $error = false;
gw.req.on('data', function (chunk) {
if (readlength > gw.content.length) {$error = true;}
if (!$error) {
readlength += chunk.length;
buffer += chunk.toString('ascii');
}
});
gw.req.on('end', f... | [
"function",
"urlEncoded",
"(",
"gw",
",",
"callback",
")",
"{",
"var",
"buffer",
"=",
"''",
";",
"var",
"readlength",
"=",
"0",
";",
"var",
"$error",
"=",
"false",
";",
"gw",
".",
"req",
".",
"on",
"(",
"'data'",
",",
"function",
"(",
"chunk",
")",... | url-enconded parser. | [
"url",
"-",
"enconded",
"parser",
"."
] | 7702fd42d3c07fd0e5605a377b1b51c88d0bdd58 | https://github.com/pillarsjs/pillars/blob/7702fd42d3c07fd0e5605a377b1b51c88d0bdd58/middleware/bodyReader.js#L92-L115 | train |
pillarsjs/pillars | middleware/bodyReader.js | multipartEncoded | function multipartEncoded(gw, callback){
var upload = new formidable.IncomingForm();
var files = {};
var fields = {};
gw.eventium.on('end',cleanTemp);
upload.uploadDir = tempDirectory;
upload.keepExtensions = true;
upload.onPart = function(part) {
if (part.filename!="") {
upload.handlePart... | javascript | function multipartEncoded(gw, callback){
var upload = new formidable.IncomingForm();
var files = {};
var fields = {};
gw.eventium.on('end',cleanTemp);
upload.uploadDir = tempDirectory;
upload.keepExtensions = true;
upload.onPart = function(part) {
if (part.filename!="") {
upload.handlePart... | [
"function",
"multipartEncoded",
"(",
"gw",
",",
"callback",
")",
"{",
"var",
"upload",
"=",
"new",
"formidable",
".",
"IncomingForm",
"(",
")",
";",
"var",
"files",
"=",
"{",
"}",
";",
"var",
"fields",
"=",
"{",
"}",
";",
"gw",
".",
"eventium",
".",
... | Multipart parser. | [
"Multipart",
"parser",
"."
] | 7702fd42d3c07fd0e5605a377b1b51c88d0bdd58 | https://github.com/pillarsjs/pillars/blob/7702fd42d3c07fd0e5605a377b1b51c88d0bdd58/middleware/bodyReader.js#L119-L172 | train |
mikolalysenko/simplicial-complex | topology.js | dimension | function dimension(cells) {
var d = 0
, max = Math.max
for(var i=0, il=cells.length; i<il; ++i) {
d = max(d, cells[i].length)
}
return d-1
} | javascript | function dimension(cells) {
var d = 0
, max = Math.max
for(var i=0, il=cells.length; i<il; ++i) {
d = max(d, cells[i].length)
}
return d-1
} | [
"function",
"dimension",
"(",
"cells",
")",
"{",
"var",
"d",
"=",
"0",
",",
"max",
"=",
"Math",
".",
"max",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"il",
"=",
"cells",
".",
"length",
";",
"i",
"<",
"il",
";",
"++",
"i",
")",
"{",
"d",
"=",
... | Returns the dimension of a cell complex | [
"Returns",
"the",
"dimension",
"of",
"a",
"cell",
"complex"
] | 68ae05a629616d5c737a36d8075ec1b77f5f2935 | https://github.com/mikolalysenko/simplicial-complex/blob/68ae05a629616d5c737a36d8075ec1b77f5f2935/topology.js#L7-L14 | train |
mikolalysenko/simplicial-complex | topology.js | countVertices | function countVertices(cells) {
var vc = -1
, max = Math.max
for(var i=0, il=cells.length; i<il; ++i) {
var c = cells[i]
for(var j=0, jl=c.length; j<jl; ++j) {
vc = max(vc, c[j])
}
}
return vc+1
} | javascript | function countVertices(cells) {
var vc = -1
, max = Math.max
for(var i=0, il=cells.length; i<il; ++i) {
var c = cells[i]
for(var j=0, jl=c.length; j<jl; ++j) {
vc = max(vc, c[j])
}
}
return vc+1
} | [
"function",
"countVertices",
"(",
"cells",
")",
"{",
"var",
"vc",
"=",
"-",
"1",
",",
"max",
"=",
"Math",
".",
"max",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"il",
"=",
"cells",
".",
"length",
";",
"i",
"<",
"il",
";",
"++",
"i",
")",
"{",
"... | Counts the number of vertices in faces | [
"Counts",
"the",
"number",
"of",
"vertices",
"in",
"faces"
] | 68ae05a629616d5c737a36d8075ec1b77f5f2935 | https://github.com/mikolalysenko/simplicial-complex/blob/68ae05a629616d5c737a36d8075ec1b77f5f2935/topology.js#L18-L28 | train |
mikolalysenko/simplicial-complex | topology.js | cloneCells | function cloneCells(cells) {
var ncells = new Array(cells.length)
for(var i=0, il=cells.length; i<il; ++i) {
ncells[i] = cells[i].slice(0)
}
return ncells
} | javascript | function cloneCells(cells) {
var ncells = new Array(cells.length)
for(var i=0, il=cells.length; i<il; ++i) {
ncells[i] = cells[i].slice(0)
}
return ncells
} | [
"function",
"cloneCells",
"(",
"cells",
")",
"{",
"var",
"ncells",
"=",
"new",
"Array",
"(",
"cells",
".",
"length",
")",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"il",
"=",
"cells",
".",
"length",
";",
"i",
"<",
"il",
";",
"++",
"i",
")",
"{",
... | Returns a deep copy of cells | [
"Returns",
"a",
"deep",
"copy",
"of",
"cells"
] | 68ae05a629616d5c737a36d8075ec1b77f5f2935 | https://github.com/mikolalysenko/simplicial-complex/blob/68ae05a629616d5c737a36d8075ec1b77f5f2935/topology.js#L32-L38 | train |
mikolalysenko/simplicial-complex | topology.js | compareCells | function compareCells(a, b) {
var n = a.length
, t = a.length - b.length
, min = Math.min
if(t) {
return t
}
switch(n) {
case 0:
return 0;
case 1:
return a[0] - b[0];
case 2:
var d = a[0]+a[1]-b[0]-b[1]
if(d) {
return d
}
return min(a[0],a[1]) ... | javascript | function compareCells(a, b) {
var n = a.length
, t = a.length - b.length
, min = Math.min
if(t) {
return t
}
switch(n) {
case 0:
return 0;
case 1:
return a[0] - b[0];
case 2:
var d = a[0]+a[1]-b[0]-b[1]
if(d) {
return d
}
return min(a[0],a[1]) ... | [
"function",
"compareCells",
"(",
"a",
",",
"b",
")",
"{",
"var",
"n",
"=",
"a",
".",
"length",
",",
"t",
"=",
"a",
".",
"length",
"-",
"b",
".",
"length",
",",
"min",
"=",
"Math",
".",
"min",
"if",
"(",
"t",
")",
"{",
"return",
"t",
"}",
"s... | Ranks a pair of cells up to permutation | [
"Ranks",
"a",
"pair",
"of",
"cells",
"up",
"to",
"permutation"
] | 68ae05a629616d5c737a36d8075ec1b77f5f2935 | https://github.com/mikolalysenko/simplicial-complex/blob/68ae05a629616d5c737a36d8075ec1b77f5f2935/topology.js#L42-L90 | train |
mikolalysenko/simplicial-complex | topology.js | normalize | function normalize(cells, attr) {
if(attr) {
var len = cells.length
var zipped = new Array(len)
for(var i=0; i<len; ++i) {
zipped[i] = [cells[i], attr[i]]
}
zipped.sort(compareZipped)
for(var i=0; i<len; ++i) {
cells[i] = zipped[i][0]
attr[i] = zipped[i][1]
}
return c... | javascript | function normalize(cells, attr) {
if(attr) {
var len = cells.length
var zipped = new Array(len)
for(var i=0; i<len; ++i) {
zipped[i] = [cells[i], attr[i]]
}
zipped.sort(compareZipped)
for(var i=0; i<len; ++i) {
cells[i] = zipped[i][0]
attr[i] = zipped[i][1]
}
return c... | [
"function",
"normalize",
"(",
"cells",
",",
"attr",
")",
"{",
"if",
"(",
"attr",
")",
"{",
"var",
"len",
"=",
"cells",
".",
"length",
"var",
"zipped",
"=",
"new",
"Array",
"(",
"len",
")",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"len",... | Puts a cell complex into normal order for the purposes of findCell queries | [
"Puts",
"a",
"cell",
"complex",
"into",
"normal",
"order",
"for",
"the",
"purposes",
"of",
"findCell",
"queries"
] | 68ae05a629616d5c737a36d8075ec1b77f5f2935 | https://github.com/mikolalysenko/simplicial-complex/blob/68ae05a629616d5c737a36d8075ec1b77f5f2935/topology.js#L98-L115 | train |
mikolalysenko/simplicial-complex | topology.js | unique | function unique(cells) {
if(cells.length === 0) {
return []
}
var ptr = 1
, len = cells.length
for(var i=1; i<len; ++i) {
var a = cells[i]
if(compareCells(a, cells[i-1])) {
if(i === ptr) {
ptr++
continue
}
cells[ptr++] = a
}
}
cells.length = ptr
return... | javascript | function unique(cells) {
if(cells.length === 0) {
return []
}
var ptr = 1
, len = cells.length
for(var i=1; i<len; ++i) {
var a = cells[i]
if(compareCells(a, cells[i-1])) {
if(i === ptr) {
ptr++
continue
}
cells[ptr++] = a
}
}
cells.length = ptr
return... | [
"function",
"unique",
"(",
"cells",
")",
"{",
"if",
"(",
"cells",
".",
"length",
"===",
"0",
")",
"{",
"return",
"[",
"]",
"}",
"var",
"ptr",
"=",
"1",
",",
"len",
"=",
"cells",
".",
"length",
"for",
"(",
"var",
"i",
"=",
"1",
";",
"i",
"<",
... | Removes all duplicate cells in the complex | [
"Removes",
"all",
"duplicate",
"cells",
"in",
"the",
"complex"
] | 68ae05a629616d5c737a36d8075ec1b77f5f2935 | https://github.com/mikolalysenko/simplicial-complex/blob/68ae05a629616d5c737a36d8075ec1b77f5f2935/topology.js#L119-L137 | train |
mikolalysenko/simplicial-complex | topology.js | findCell | function findCell(cells, c) {
var lo = 0
, hi = cells.length-1
, r = -1
while (lo <= hi) {
var mid = (lo + hi) >> 1
, s = compareCells(cells[mid], c)
if(s <= 0) {
if(s === 0) {
r = mid
}
lo = mid + 1
} else if(s > 0) {
hi = mid - 1
}
}
return r
} | javascript | function findCell(cells, c) {
var lo = 0
, hi = cells.length-1
, r = -1
while (lo <= hi) {
var mid = (lo + hi) >> 1
, s = compareCells(cells[mid], c)
if(s <= 0) {
if(s === 0) {
r = mid
}
lo = mid + 1
} else if(s > 0) {
hi = mid - 1
}
}
return r
} | [
"function",
"findCell",
"(",
"cells",
",",
"c",
")",
"{",
"var",
"lo",
"=",
"0",
",",
"hi",
"=",
"cells",
".",
"length",
"-",
"1",
",",
"r",
"=",
"-",
"1",
"while",
"(",
"lo",
"<=",
"hi",
")",
"{",
"var",
"mid",
"=",
"(",
"lo",
"+",
"hi",
... | Finds a cell in a normalized cell complex | [
"Finds",
"a",
"cell",
"in",
"a",
"normalized",
"cell",
"complex"
] | 68ae05a629616d5c737a36d8075ec1b77f5f2935 | https://github.com/mikolalysenko/simplicial-complex/blob/68ae05a629616d5c737a36d8075ec1b77f5f2935/topology.js#L141-L158 | train |
mikolalysenko/simplicial-complex | topology.js | incidence | function incidence(from_cells, to_cells) {
var index = new Array(from_cells.length)
for(var i=0, il=index.length; i<il; ++i) {
index[i] = []
}
var b = []
for(var i=0, n=to_cells.length; i<n; ++i) {
var c = to_cells[i]
var cl = c.length
for(var k=1, kn=(1<<cl); k<kn; ++k) {
b.length = bit... | javascript | function incidence(from_cells, to_cells) {
var index = new Array(from_cells.length)
for(var i=0, il=index.length; i<il; ++i) {
index[i] = []
}
var b = []
for(var i=0, n=to_cells.length; i<n; ++i) {
var c = to_cells[i]
var cl = c.length
for(var k=1, kn=(1<<cl); k<kn; ++k) {
b.length = bit... | [
"function",
"incidence",
"(",
"from_cells",
",",
"to_cells",
")",
"{",
"var",
"index",
"=",
"new",
"Array",
"(",
"from_cells",
".",
"length",
")",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"il",
"=",
"index",
".",
"length",
";",
"i",
"<",
"il",
";",
... | Builds an index for an n-cell. This is more general than dual, but less efficient | [
"Builds",
"an",
"index",
"for",
"an",
"n",
"-",
"cell",
".",
"This",
"is",
"more",
"general",
"than",
"dual",
"but",
"less",
"efficient"
] | 68ae05a629616d5c737a36d8075ec1b77f5f2935 | https://github.com/mikolalysenko/simplicial-complex/blob/68ae05a629616d5c737a36d8075ec1b77f5f2935/topology.js#L162-L192 | train |
mikolalysenko/simplicial-complex | topology.js | dual | function dual(cells, vertex_count) {
if(!vertex_count) {
return incidence(unique(skeleton(cells, 0)), cells, 0)
}
var res = new Array(vertex_count)
for(var i=0; i<vertex_count; ++i) {
res[i] = []
}
for(var i=0, len=cells.length; i<len; ++i) {
var c = cells[i]
for(var j=0, cl=c.length; j<cl; ... | javascript | function dual(cells, vertex_count) {
if(!vertex_count) {
return incidence(unique(skeleton(cells, 0)), cells, 0)
}
var res = new Array(vertex_count)
for(var i=0; i<vertex_count; ++i) {
res[i] = []
}
for(var i=0, len=cells.length; i<len; ++i) {
var c = cells[i]
for(var j=0, cl=c.length; j<cl; ... | [
"function",
"dual",
"(",
"cells",
",",
"vertex_count",
")",
"{",
"if",
"(",
"!",
"vertex_count",
")",
"{",
"return",
"incidence",
"(",
"unique",
"(",
"skeleton",
"(",
"cells",
",",
"0",
")",
")",
",",
"cells",
",",
"0",
")",
"}",
"var",
"res",
"=",... | Computes the dual of the mesh. This is basically an optimized version of buildIndex for the situation where from_cells is just the list of vertices | [
"Computes",
"the",
"dual",
"of",
"the",
"mesh",
".",
"This",
"is",
"basically",
"an",
"optimized",
"version",
"of",
"buildIndex",
"for",
"the",
"situation",
"where",
"from_cells",
"is",
"just",
"the",
"list",
"of",
"vertices"
] | 68ae05a629616d5c737a36d8075ec1b77f5f2935 | https://github.com/mikolalysenko/simplicial-complex/blob/68ae05a629616d5c737a36d8075ec1b77f5f2935/topology.js#L196-L211 | train |
mikolalysenko/simplicial-complex | topology.js | explode | function explode(cells) {
var result = []
for(var i=0, il=cells.length; i<il; ++i) {
var c = cells[i]
, cl = c.length|0
for(var j=1, jl=(1<<cl); j<jl; ++j) {
var b = []
for(var k=0; k<cl; ++k) {
if((j >>> k) & 1) {
b.push(c[k])
}
}
result.push(b)
}... | javascript | function explode(cells) {
var result = []
for(var i=0, il=cells.length; i<il; ++i) {
var c = cells[i]
, cl = c.length|0
for(var j=1, jl=(1<<cl); j<jl; ++j) {
var b = []
for(var k=0; k<cl; ++k) {
if((j >>> k) & 1) {
b.push(c[k])
}
}
result.push(b)
}... | [
"function",
"explode",
"(",
"cells",
")",
"{",
"var",
"result",
"=",
"[",
"]",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"il",
"=",
"cells",
".",
"length",
";",
"i",
"<",
"il",
";",
"++",
"i",
")",
"{",
"var",
"c",
"=",
"cells",
"[",
"i",
"]",... | Enumerates all cells in the complex | [
"Enumerates",
"all",
"cells",
"in",
"the",
"complex"
] | 68ae05a629616d5c737a36d8075ec1b77f5f2935 | https://github.com/mikolalysenko/simplicial-complex/blob/68ae05a629616d5c737a36d8075ec1b77f5f2935/topology.js#L215-L231 | train |
mikolalysenko/simplicial-complex | topology.js | skeleton | function skeleton(cells, n) {
if(n < 0) {
return []
}
var result = []
, k0 = (1<<(n+1))-1
for(var i=0; i<cells.length; ++i) {
var c = cells[i]
for(var k=k0; k<(1<<c.length); k=bits.nextCombination(k)) {
var b = new Array(n+1)
, l = 0
for(var j=0; j<c.length; ++j) {
... | javascript | function skeleton(cells, n) {
if(n < 0) {
return []
}
var result = []
, k0 = (1<<(n+1))-1
for(var i=0; i<cells.length; ++i) {
var c = cells[i]
for(var k=k0; k<(1<<c.length); k=bits.nextCombination(k)) {
var b = new Array(n+1)
, l = 0
for(var j=0; j<c.length; ++j) {
... | [
"function",
"skeleton",
"(",
"cells",
",",
"n",
")",
"{",
"if",
"(",
"n",
"<",
"0",
")",
"{",
"return",
"[",
"]",
"}",
"var",
"result",
"=",
"[",
"]",
",",
"k0",
"=",
"(",
"1",
"<<",
"(",
"n",
"+",
"1",
")",
")",
"-",
"1",
"for",
"(",
"... | Enumerates all of the n-cells of a cell complex | [
"Enumerates",
"all",
"of",
"the",
"n",
"-",
"cells",
"of",
"a",
"cell",
"complex"
] | 68ae05a629616d5c737a36d8075ec1b77f5f2935 | https://github.com/mikolalysenko/simplicial-complex/blob/68ae05a629616d5c737a36d8075ec1b77f5f2935/topology.js#L235-L255 | train |
mikolalysenko/simplicial-complex | topology.js | boundary | function boundary(cells) {
var res = []
for(var i=0,il=cells.length; i<il; ++i) {
var c = cells[i]
for(var j=0,cl=c.length; j<cl; ++j) {
var b = new Array(c.length-1)
for(var k=0, l=0; k<cl; ++k) {
if(k !== j) {
b[l++] = c[k]
}
}
res.push(b)
}
}
retu... | javascript | function boundary(cells) {
var res = []
for(var i=0,il=cells.length; i<il; ++i) {
var c = cells[i]
for(var j=0,cl=c.length; j<cl; ++j) {
var b = new Array(c.length-1)
for(var k=0, l=0; k<cl; ++k) {
if(k !== j) {
b[l++] = c[k]
}
}
res.push(b)
}
}
retu... | [
"function",
"boundary",
"(",
"cells",
")",
"{",
"var",
"res",
"=",
"[",
"]",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"il",
"=",
"cells",
".",
"length",
";",
"i",
"<",
"il",
";",
"++",
"i",
")",
"{",
"var",
"c",
"=",
"cells",
"[",
"i",
"]",
... | Computes the boundary of all cells, does not remove duplicates | [
"Computes",
"the",
"boundary",
"of",
"all",
"cells",
"does",
"not",
"remove",
"duplicates"
] | 68ae05a629616d5c737a36d8075ec1b77f5f2935 | https://github.com/mikolalysenko/simplicial-complex/blob/68ae05a629616d5c737a36d8075ec1b77f5f2935/topology.js#L259-L274 | train |
mikolalysenko/simplicial-complex | topology.js | connectedComponents_dense | function connectedComponents_dense(cells, vertex_count) {
var labels = new UnionFind(vertex_count)
for(var i=0; i<cells.length; ++i) {
var c = cells[i]
for(var j=0; j<c.length; ++j) {
for(var k=j+1; k<c.length; ++k) {
labels.link(c[j], c[k])
}
}
}
var components = []
, compon... | javascript | function connectedComponents_dense(cells, vertex_count) {
var labels = new UnionFind(vertex_count)
for(var i=0; i<cells.length; ++i) {
var c = cells[i]
for(var j=0; j<c.length; ++j) {
for(var k=j+1; k<c.length; ++k) {
labels.link(c[j], c[k])
}
}
}
var components = []
, compon... | [
"function",
"connectedComponents_dense",
"(",
"cells",
",",
"vertex_count",
")",
"{",
"var",
"labels",
"=",
"new",
"UnionFind",
"(",
"vertex_count",
")",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"cells",
".",
"length",
";",
"++",
"i",
")",
"{",... | Computes connected components for a dense cell complex | [
"Computes",
"connected",
"components",
"for",
"a",
"dense",
"cell",
"complex"
] | 68ae05a629616d5c737a36d8075ec1b77f5f2935 | https://github.com/mikolalysenko/simplicial-complex/blob/68ae05a629616d5c737a36d8075ec1b77f5f2935/topology.js#L278-L303 | train |
mikolalysenko/simplicial-complex | topology.js | connectedComponents_sparse | function connectedComponents_sparse(cells) {
var vertices = unique(normalize(skeleton(cells, 0)))
, labels = new UnionFind(vertices.length)
for(var i=0; i<cells.length; ++i) {
var c = cells[i]
for(var j=0; j<c.length; ++j) {
var vj = findCell(vertices, [c[j]])
for(var k=j+1; k<c.length; ... | javascript | function connectedComponents_sparse(cells) {
var vertices = unique(normalize(skeleton(cells, 0)))
, labels = new UnionFind(vertices.length)
for(var i=0; i<cells.length; ++i) {
var c = cells[i]
for(var j=0; j<c.length; ++j) {
var vj = findCell(vertices, [c[j]])
for(var k=j+1; k<c.length; ... | [
"function",
"connectedComponents_sparse",
"(",
"cells",
")",
"{",
"var",
"vertices",
"=",
"unique",
"(",
"normalize",
"(",
"skeleton",
"(",
"cells",
",",
"0",
")",
")",
")",
",",
"labels",
"=",
"new",
"UnionFind",
"(",
"vertices",
".",
"length",
")",
"fo... | Computes connected components for a sparse graph | [
"Computes",
"connected",
"components",
"for",
"a",
"sparse",
"graph"
] | 68ae05a629616d5c737a36d8075ec1b77f5f2935 | https://github.com/mikolalysenko/simplicial-complex/blob/68ae05a629616d5c737a36d8075ec1b77f5f2935/topology.js#L306-L333 | train |
rwaldron/temporal | lib/temporal.js | Task | function Task(entry) {
if (!(this instanceof Task)) {
return new Task(entry);
}
this.called = 0;
this.now = this.calledAt = hrTime();
if (resolutionDivisor !== DEFAULT_RESOLUTION) {
entry.time = ~~(entry.time * (DEFAULT_RESOLUTION / resolutionDivisor));
}
// Side table property definitions
th... | javascript | function Task(entry) {
if (!(this instanceof Task)) {
return new Task(entry);
}
this.called = 0;
this.now = this.calledAt = hrTime();
if (resolutionDivisor !== DEFAULT_RESOLUTION) {
entry.time = ~~(entry.time * (DEFAULT_RESOLUTION / resolutionDivisor));
}
// Side table property definitions
th... | [
"function",
"Task",
"(",
"entry",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Task",
")",
")",
"{",
"return",
"new",
"Task",
"(",
"entry",
")",
";",
"}",
"this",
".",
"called",
"=",
"0",
";",
"this",
".",
"now",
"=",
"this",
".",
"cal... | Task create a temporal task item
@param {Object} entry Options for entry {time, task} | [
"Task",
"create",
"a",
"temporal",
"task",
"item"
] | b87f4975f6db4521a0ea84dcda9dd52091b2f733 | https://github.com/rwaldron/temporal/blob/b87f4975f6db4521a0ea84dcda9dd52091b2f733/lib/temporal.js#L32-L60 | train |
nolanlawson/vdom-as-json | lib/toJson.js | cloneObj | function cloneObj(a,b) {
Object.keys(b).forEach(function(k) {
a[k] = b[k];
});
return a;
} | javascript | function cloneObj(a,b) {
Object.keys(b).forEach(function(k) {
a[k] = b[k];
});
return a;
} | [
"function",
"cloneObj",
"(",
"a",
",",
"b",
")",
"{",
"Object",
".",
"keys",
"(",
"b",
")",
".",
"forEach",
"(",
"function",
"(",
"k",
")",
"{",
"a",
"[",
"k",
"]",
"=",
"b",
"[",
"k",
"]",
";",
"}",
")",
";",
"return",
"a",
";",
"}"
] | PhantomJS doesn't support Object.assigns, so just implement a clone method here. | [
"PhantomJS",
"doesn",
"t",
"support",
"Object",
".",
"assigns",
"so",
"just",
"implement",
"a",
"clone",
"method",
"here",
"."
] | 8bae1d2c6c30af011bcf1843b32408c410caabd8 | https://github.com/nolanlawson/vdom-as-json/blob/8bae1d2c6c30af011bcf1843b32408c410caabd8/lib/toJson.js#L159-L164 | train |
dvla/dvla_internal_frontend_toolkit | app/assets/javascripts/styleguide/prism-line-numbers.js | function (element) {
var codeStyles = getStyles(element);
var whiteSpace = codeStyles['white-space'];
if (whiteSpace === 'pre-wrap' || whiteSpace === 'pre-line') {
var codeElement = element.querySelector('code');
var lineNumbersWrapper = element.querySelector('.line-numbers-rows');
var lineNumberSizer =... | javascript | function (element) {
var codeStyles = getStyles(element);
var whiteSpace = codeStyles['white-space'];
if (whiteSpace === 'pre-wrap' || whiteSpace === 'pre-line') {
var codeElement = element.querySelector('code');
var lineNumbersWrapper = element.querySelector('.line-numbers-rows');
var lineNumberSizer =... | [
"function",
"(",
"element",
")",
"{",
"var",
"codeStyles",
"=",
"getStyles",
"(",
"element",
")",
";",
"var",
"whiteSpace",
"=",
"codeStyles",
"[",
"'white-space'",
"]",
";",
"if",
"(",
"whiteSpace",
"===",
"'pre-wrap'",
"||",
"whiteSpace",
"===",
"'pre-line... | Resizes line numbers spans according to height of line of code
@param {Element} element <pre> element | [
"Resizes",
"line",
"numbers",
"spans",
"according",
"to",
"height",
"of",
"line",
"of",
"code"
] | ce3609613281dbb6c07f23c095c13d827eafb4ad | https://github.com/dvla/dvla_internal_frontend_toolkit/blob/ce3609613281dbb6c07f23c095c13d827eafb4ad/app/assets/javascripts/styleguide/prism-line-numbers.js#L17-L45 | train | |
Happy0/ssb-chess | ctrl/validMovesFinder.js | listenForWorkerResults | function listenForWorkerResults() {
chessWorker.addEventListener('message', (event) => {
const gameId = event.data.reqid.gameRootMessage;
const { ply } = event.data.reqid;
if (event.data.topic === 'dests') {
const destsMapKey = getDestsKey(gameId, ply);
const awaitingDestsObs = ge... | javascript | function listenForWorkerResults() {
chessWorker.addEventListener('message', (event) => {
const gameId = event.data.reqid.gameRootMessage;
const { ply } = event.data.reqid;
if (event.data.topic === 'dests') {
const destsMapKey = getDestsKey(gameId, ply);
const awaitingDestsObs = ge... | [
"function",
"listenForWorkerResults",
"(",
")",
"{",
"chessWorker",
".",
"addEventListener",
"(",
"'message'",
",",
"(",
"event",
")",
"=>",
"{",
"const",
"gameId",
"=",
"event",
".",
"data",
".",
"reqid",
".",
"gameRootMessage",
";",
"const",
"{",
"ply",
... | Listens for respones from the chess webworker and updates observables awaiting the response | [
"Listens",
"for",
"respones",
"from",
"the",
"chess",
"webworker",
"and",
"updates",
"observables",
"awaiting",
"the",
"response"
] | 585763cc6c36147f94b73d1715daaf7c05f1c40b | https://github.com/Happy0/ssb-chess/blob/585763cc6c36147f94b73d1715daaf7c05f1c40b/ctrl/validMovesFinder.js#L70-L96 | train |
krasimir/kuker-emitters | lib/__build__/counter.js | wrap | function wrap(set) {
return function (fn, time /* , ...args */) {
var boundArgs = arguments.length > 2;
var args = boundArgs ? slice.call(arguments, 2) : false;
return set(boundArgs ? function () {
// eslint-disable-next-line no-new-func
(typeof fn == 'function' ? fn : Function(fn)... | javascript | function wrap(set) {
return function (fn, time /* , ...args */) {
var boundArgs = arguments.length > 2;
var args = boundArgs ? slice.call(arguments, 2) : false;
return set(boundArgs ? function () {
// eslint-disable-next-line no-new-func
(typeof fn == 'function' ? fn : Function(fn)... | [
"function",
"wrap",
"(",
"set",
")",
"{",
"return",
"function",
"(",
"fn",
",",
"time",
"/* , ...args */",
")",
"{",
"var",
"boundArgs",
"=",
"arguments",
".",
"length",
">",
"2",
";",
"var",
"args",
"=",
"boundArgs",
"?",
"slice",
".",
"call",
"(",
... | <- dirty ie9- check | [
"<",
"-",
"dirty",
"ie9",
"-",
"check"
] | dea5f638a043e53c5ffb1c5db8d72f4d0bef7f4f | https://github.com/krasimir/kuker-emitters/blob/dea5f638a043e53c5ffb1c5db8d72f4d0bef7f4f/lib/__build__/counter.js#L8184-L8193 | train |
cs01/stator | src/statorgfc.js | function(key_or_new_store, value) {
if (arguments.length === 1) {
// replace the whole store
let new_store = key_or_new_store
for (let k in new_store) {
store.set(k, new_store[k])
}
return
}
let key = key_or_new_store
if (!store._store.hasOwnProperty(key)) {
... | javascript | function(key_or_new_store, value) {
if (arguments.length === 1) {
// replace the whole store
let new_store = key_or_new_store
for (let k in new_store) {
store.set(k, new_store[k])
}
return
}
let key = key_or_new_store
if (!store._store.hasOwnProperty(key)) {
... | [
"function",
"(",
"key_or_new_store",
",",
"value",
")",
"{",
"if",
"(",
"arguments",
".",
"length",
"===",
"1",
")",
"{",
"// replace the whole store",
"let",
"new_store",
"=",
"key_or_new_store",
"for",
"(",
"let",
"k",
"in",
"new_store",
")",
"{",
"store",... | set key or keys of store object
@param {str/obj} key_or_new_store: if str, this key is replaced. If obj, all keys of the obj replace store's keys.
@param {any} value: If key was provided, the associated value. The type of the value for this key cannot change. Exceptions to this rule
are to/from null or undefined. Other... | [
"set",
"key",
"or",
"keys",
"of",
"store",
"object"
] | 51dbdcc97aacc80d07ebdeb6c13a06e12880b9a1 | https://github.com/cs01/stator/blob/51dbdcc97aacc80d07ebdeb6c13a06e12880b9a1/src/statorgfc.js#L164-L189 | train | |
cs01/stator | src/statorgfc.js | function(key, oldval, value) {
if (store._changed_keys.indexOf(key) === -1) {
store._changed_keys.push(key)
}
// suppress active timeout (if any)
if (store._debounce_timeout) {
store._clearDebounceTimeout()
}
if (store.options.debounce_ms) {
// delay event emission and set ne... | javascript | function(key, oldval, value) {
if (store._changed_keys.indexOf(key) === -1) {
store._changed_keys.push(key)
}
// suppress active timeout (if any)
if (store._debounce_timeout) {
store._clearDebounceTimeout()
}
if (store.options.debounce_ms) {
// delay event emission and set ne... | [
"function",
"(",
"key",
",",
"oldval",
",",
"value",
")",
"{",
"if",
"(",
"store",
".",
"_changed_keys",
".",
"indexOf",
"(",
"key",
")",
"===",
"-",
"1",
")",
"{",
"store",
".",
"_changed_keys",
".",
"push",
"(",
"key",
")",
"}",
"// suppress active... | Emit event to subscribers based on timeout rules
@param key key to change
@param oldval original value (for logging purposes)
@param value new value to assign | [
"Emit",
"event",
"to",
"subscribers",
"based",
"on",
"timeout",
"rules"
] | 51dbdcc97aacc80d07ebdeb6c13a06e12880b9a1 | https://github.com/cs01/stator/blob/51dbdcc97aacc80d07ebdeb6c13a06e12880b9a1/src/statorgfc.js#L218-L235 | train | |
cs01/stator | src/statorgfc.js | function(key) {
if (!store._store_created) {
throw 'cannot get store because is has not been created'
}
if (arguments.length === 0) {
// return the whole store
if (store.options.immutable) {
return Object.assign({}, store._store) // copy entire store by value
} else {
... | javascript | function(key) {
if (!store._store_created) {
throw 'cannot get store because is has not been created'
}
if (arguments.length === 0) {
// return the whole store
if (store.options.immutable) {
return Object.assign({}, store._store) // copy entire store by value
} else {
... | [
"function",
"(",
"key",
")",
"{",
"if",
"(",
"!",
"store",
".",
"_store_created",
")",
"{",
"throw",
"'cannot get store because is has not been created'",
"}",
"if",
"(",
"arguments",
".",
"length",
"===",
"0",
")",
"{",
"// return the whole store",
"if",
"(",
... | Get reference or value to one of the keys in the current store.
@param key of the store object to get a reference to
@return reference or new object (depending on `immutable` option)
NOTE: The store should *only* be update by calling `store.set(...)`
Throws error if key does not exist in store. | [
"Get",
"reference",
"or",
"value",
"to",
"one",
"of",
"the",
"keys",
"in",
"the",
"current",
"store",
"."
] | 51dbdcc97aacc80d07ebdeb6c13a06e12880b9a1 | https://github.com/cs01/stator/blob/51dbdcc97aacc80d07ebdeb6c13a06e12880b9a1/src/statorgfc.js#L243-L270 | train | |
cs01/stator | src/statorgfc.js | function() {
const changed_keys = store._changed_keys
if (changed_keys.length === 0) {
console.error('no keys were changed, yet we are trying to publish a store change')
return
}
// make sure _changed_keys is reset before executing callbacks
// (if callbacks modify state, the list of ke... | javascript | function() {
const changed_keys = store._changed_keys
if (changed_keys.length === 0) {
console.error('no keys were changed, yet we are trying to publish a store change')
return
}
// make sure _changed_keys is reset before executing callbacks
// (if callbacks modify state, the list of ke... | [
"function",
"(",
")",
"{",
"const",
"changed_keys",
"=",
"store",
".",
"_changed_keys",
"if",
"(",
"changed_keys",
".",
"length",
"===",
"0",
")",
"{",
"console",
".",
"error",
"(",
"'no keys were changed, yet we are trying to publish a store change'",
")",
"return"... | Run subscribers' callback functions. An array of the changed keys is passed to the callback function.
Be careful how often this is called, since re-rendering components can become expensive. | [
"Run",
"subscribers",
"callback",
"functions",
".",
"An",
"array",
"of",
"the",
"changed",
"keys",
"is",
"passed",
"to",
"the",
"callback",
"function",
".",
"Be",
"careful",
"how",
"often",
"this",
"is",
"called",
"since",
"re",
"-",
"rendering",
"components... | 51dbdcc97aacc80d07ebdeb6c13a06e12880b9a1 | https://github.com/cs01/stator/blob/51dbdcc97aacc80d07ebdeb6c13a06e12880b9a1/src/statorgfc.js#L275-L287 | train | |
Happy0/ssb-chess-mithril | ui/viewer_perspective/user_location.js | chessAppIsVisible | function chessAppIsVisible() {
const topLevelElementArr = document.getElementsByClassName('ssb-chess-container');
if (!topLevelElementArr || topLevelElementArr.length <= 0) {
return false;
}
const element = topLevelElementArr[0];
return document.hasFocus() && isVisible(element);
} | javascript | function chessAppIsVisible() {
const topLevelElementArr = document.getElementsByClassName('ssb-chess-container');
if (!topLevelElementArr || topLevelElementArr.length <= 0) {
return false;
}
const element = topLevelElementArr[0];
return document.hasFocus() && isVisible(element);
} | [
"function",
"chessAppIsVisible",
"(",
")",
"{",
"const",
"topLevelElementArr",
"=",
"document",
".",
"getElementsByClassName",
"(",
"'ssb-chess-container'",
")",
";",
"if",
"(",
"!",
"topLevelElementArr",
"||",
"topLevelElementArr",
".",
"length",
"<=",
"0",
")",
... | Returns true if the user can currently see the chess app, and false otherwise.
The user might be in a different tab in the containing application, for example. | [
"Returns",
"true",
"if",
"the",
"user",
"can",
"currently",
"see",
"the",
"chess",
"app",
"and",
"false",
"otherwise",
".",
"The",
"user",
"might",
"be",
"in",
"a",
"different",
"tab",
"in",
"the",
"containing",
"application",
"for",
"example",
"."
] | 5d44624ca7e2109ece84445566ac44ca0d6d168d | https://github.com/Happy0/ssb-chess-mithril/blob/5d44624ca7e2109ece84445566ac44ca0d6d168d/ui/viewer_perspective/user_location.js#L13-L22 | train |
cs01/stator | build/statorgfc.js | _callback | function _callback(changed_keys) {
if (intersection(keys_to_watch_for_changes, changed_keys).length) {
// only update the state if a key we care about has changed
var state_update_obj = {};
keys_to_watch_for_changes.forEach(function (k) {
return state_update_obj[k] = store._store... | javascript | function _callback(changed_keys) {
if (intersection(keys_to_watch_for_changes, changed_keys).length) {
// only update the state if a key we care about has changed
var state_update_obj = {};
keys_to_watch_for_changes.forEach(function (k) {
return state_update_obj[k] = store._store... | [
"function",
"_callback",
"(",
"changed_keys",
")",
"{",
"if",
"(",
"intersection",
"(",
"keys_to_watch_for_changes",
",",
"changed_keys",
")",
".",
"length",
")",
"{",
"// only update the state if a key we care about has changed",
"var",
"state_update_obj",
"=",
"{",
"}... | initialize if not set call this function whenever the store changes | [
"initialize",
"if",
"not",
"set",
"call",
"this",
"function",
"whenever",
"the",
"store",
"changes"
] | 51dbdcc97aacc80d07ebdeb6c13a06e12880b9a1 | https://github.com/cs01/stator/blob/51dbdcc97aacc80d07ebdeb6c13a06e12880b9a1/build/statorgfc.js#L53-L68 | train |
cs01/stator | build/statorgfc.js | getUnwatchedKeys | function getUnwatchedKeys() {
var arr1 = Object.keys(store._store),
arr2 = Object.keys(store._key_to_watcher_subscriptions);
return arr1.filter(function (i) {
return arr2.indexOf(i) === -1;
});
} | javascript | function getUnwatchedKeys() {
var arr1 = Object.keys(store._store),
arr2 = Object.keys(store._key_to_watcher_subscriptions);
return arr1.filter(function (i) {
return arr2.indexOf(i) === -1;
});
} | [
"function",
"getUnwatchedKeys",
"(",
")",
"{",
"var",
"arr1",
"=",
"Object",
".",
"keys",
"(",
"store",
".",
"_store",
")",
",",
"arr2",
"=",
"Object",
".",
"keys",
"(",
"store",
".",
"_key_to_watcher_subscriptions",
")",
";",
"return",
"arr1",
".",
"fil... | return an array of keys that do not trigger any callbacks when changed, and therefore
probably don't need to be included in the global store | [
"return",
"an",
"array",
"of",
"keys",
"that",
"do",
"not",
"trigger",
"any",
"callbacks",
"when",
"changed",
"and",
"therefore",
"probably",
"don",
"t",
"need",
"to",
"be",
"included",
"in",
"the",
"global",
"store"
] | 51dbdcc97aacc80d07ebdeb6c13a06e12880b9a1 | https://github.com/cs01/stator/blob/51dbdcc97aacc80d07ebdeb6c13a06e12880b9a1/build/statorgfc.js#L203-L209 | train |
nicjansma/resourcetiming-compression.js | src/resourcetiming-compression.js | collectResources | function collectResources(a, obj, tagName) {
Array.prototype
.forEach
.call(a.ownerDocument.getElementsByTagName(tagName), function(r) {
// Get canonical URL
a.href = r.currentSrc || r.src || r.getAttribute("xlink:href") || r.href;
// only... | javascript | function collectResources(a, obj, tagName) {
Array.prototype
.forEach
.call(a.ownerDocument.getElementsByTagName(tagName), function(r) {
// Get canonical URL
a.href = r.currentSrc || r.src || r.getAttribute("xlink:href") || r.href;
// only... | [
"function",
"collectResources",
"(",
"a",
",",
"obj",
",",
"tagName",
")",
"{",
"Array",
".",
"prototype",
".",
"forEach",
".",
"call",
"(",
"a",
".",
"ownerDocument",
".",
"getElementsByTagName",
"(",
"tagName",
")",
",",
"function",
"(",
"r",
")",
"{",... | Collect external resources by tagName
@param {Element} a an anchor element
@param {Object} obj object of resources where the key is the url
@param {string} tagName tag name to collect | [
"Collect",
"external",
"resources",
"by",
"tagName"
] | 623c88b62b06624d0ec7d6e857f7743cbad59996 | https://github.com/nicjansma/resourcetiming-compression.js/blob/623c88b62b06624d0ec7d6e857f7743cbad59996/src/resourcetiming-compression.js#L588-L600 | train |
Happy0/ssb-chess-mithril | index.js | cssFilesToStyleTag | function cssFilesToStyleTag(dom) {
const rootDir = `${__dirname}/`;
const styles = m('div', {}, cssFiles.map(file => m('link', { rel: 'stylesheet', href: rootDir + file })));
m.render(dom, styles);
} | javascript | function cssFilesToStyleTag(dom) {
const rootDir = `${__dirname}/`;
const styles = m('div', {}, cssFiles.map(file => m('link', { rel: 'stylesheet', href: rootDir + file })));
m.render(dom, styles);
} | [
"function",
"cssFilesToStyleTag",
"(",
"dom",
")",
"{",
"const",
"rootDir",
"=",
"`",
"${",
"__dirname",
"}",
"`",
";",
"const",
"styles",
"=",
"m",
"(",
"'div'",
",",
"{",
"}",
",",
"cssFiles",
".",
"map",
"(",
"file",
"=>",
"m",
"(",
"'link'",
",... | h4cky0 strikes again? mebbe there's a better way? ;x | [
"h4cky0",
"strikes",
"again?",
"mebbe",
"there",
"s",
"a",
"better",
"way?",
";",
"x"
] | 5d44624ca7e2109ece84445566ac44ca0d6d168d | https://github.com/Happy0/ssb-chess-mithril/blob/5d44624ca7e2109ece84445566ac44ca0d6d168d/index.js#L38-L44 | train |
baoshan/wx | demo/public/vendor/smooth-scroll.js | function ( type, time ) {
if ( type == 'easeInQuad' ) return time * time; // accelerating from zero velocity
if ( type == 'easeOutQuad' ) return time * (2 - time); // decelerating to zero velocity
if ( type == 'easeInOutQuad' ) return time < 0.5 ? 2 * time * time : -1 + (4 - 2 * time) * time; // acceleration unti... | javascript | function ( type, time ) {
if ( type == 'easeInQuad' ) return time * time; // accelerating from zero velocity
if ( type == 'easeOutQuad' ) return time * (2 - time); // decelerating to zero velocity
if ( type == 'easeInOutQuad' ) return time < 0.5 ? 2 * time * time : -1 + (4 - 2 * time) * time; // acceleration unti... | [
"function",
"(",
"type",
",",
"time",
")",
"{",
"if",
"(",
"type",
"==",
"'easeInQuad'",
")",
"return",
"time",
"*",
"time",
";",
"// accelerating from zero velocity",
"if",
"(",
"type",
"==",
"'easeOutQuad'",
")",
"return",
"time",
"*",
"(",
"2",
"-",
"... | Calculate the easing pattern Private method Returns a decimal number | [
"Calculate",
"the",
"easing",
"pattern",
"Private",
"method",
"Returns",
"a",
"decimal",
"number"
] | 80478b48d3c940d40551a9a6928d0fa6d7883fde | https://github.com/baoshan/wx/blob/80478b48d3c940d40551a9a6928d0fa6d7883fde/demo/public/vendor/smooth-scroll.js#L43-L57 | train | |
baoshan/wx | demo/public/vendor/smooth-scroll.js | function ( anchor, headerHeight, offset ) {
var location = 0;
if (anchor.offsetParent) {
do {
location += anchor.offsetTop;
anchor = anchor.offsetParent;
} while (anchor);
}
location = location - headerHeight - offset;
if ( location >= 0 ) {
return location;
} else {
return 0;
}
} | javascript | function ( anchor, headerHeight, offset ) {
var location = 0;
if (anchor.offsetParent) {
do {
location += anchor.offsetTop;
anchor = anchor.offsetParent;
} while (anchor);
}
location = location - headerHeight - offset;
if ( location >= 0 ) {
return location;
} else {
return 0;
}
} | [
"function",
"(",
"anchor",
",",
"headerHeight",
",",
"offset",
")",
"{",
"var",
"location",
"=",
"0",
";",
"if",
"(",
"anchor",
".",
"offsetParent",
")",
"{",
"do",
"{",
"location",
"+=",
"anchor",
".",
"offsetTop",
";",
"anchor",
"=",
"anchor",
".",
... | Calculate how far to scroll Private method Returns an integer | [
"Calculate",
"how",
"far",
"to",
"scroll",
"Private",
"method",
"Returns",
"an",
"integer"
] | 80478b48d3c940d40551a9a6928d0fa6d7883fde | https://github.com/baoshan/wx/blob/80478b48d3c940d40551a9a6928d0fa6d7883fde/demo/public/vendor/smooth-scroll.js#L62-L76 | train | |
baoshan/wx | demo/public/vendor/smooth-scroll.js | function () {
return Math.max(
document.body.scrollHeight, document.documentElement.scrollHeight,
document.body.offsetHeight, document.documentElement.offsetHeight,
document.body.clientHeight, document.documentElement.clientHeight
);
} | javascript | function () {
return Math.max(
document.body.scrollHeight, document.documentElement.scrollHeight,
document.body.offsetHeight, document.documentElement.offsetHeight,
document.body.clientHeight, document.documentElement.clientHeight
);
} | [
"function",
"(",
")",
"{",
"return",
"Math",
".",
"max",
"(",
"document",
".",
"body",
".",
"scrollHeight",
",",
"document",
".",
"documentElement",
".",
"scrollHeight",
",",
"document",
".",
"body",
".",
"offsetHeight",
",",
"document",
".",
"documentElemen... | Determine the document's height Private method Returns an integer | [
"Determine",
"the",
"document",
"s",
"height",
"Private",
"method",
"Returns",
"an",
"integer"
] | 80478b48d3c940d40551a9a6928d0fa6d7883fde | https://github.com/baoshan/wx/blob/80478b48d3c940d40551a9a6928d0fa6d7883fde/demo/public/vendor/smooth-scroll.js#L81-L87 | train | |
baoshan/wx | demo/public/vendor/smooth-scroll.js | function ( anchor, url ) {
if ( (url === true || url === 'true') && history.pushState ) {
history.pushState( {pos:anchor.id}, '', anchor );
}
} | javascript | function ( anchor, url ) {
if ( (url === true || url === 'true') && history.pushState ) {
history.pushState( {pos:anchor.id}, '', anchor );
}
} | [
"function",
"(",
"anchor",
",",
"url",
")",
"{",
"if",
"(",
"(",
"url",
"===",
"true",
"||",
"url",
"===",
"'true'",
")",
"&&",
"history",
".",
"pushState",
")",
"{",
"history",
".",
"pushState",
"(",
"{",
"pos",
":",
"anchor",
".",
"id",
"}",
",... | Update the URL Private method Runs functions | [
"Update",
"the",
"URL",
"Private",
"method",
"Runs",
"functions"
] | 80478b48d3c940d40551a9a6928d0fa6d7883fde | https://github.com/baoshan/wx/blob/80478b48d3c940d40551a9a6928d0fa6d7883fde/demo/public/vendor/smooth-scroll.js#L117-L121 | train | |
baoshan/wx | demo/public/vendor/smooth-scroll.js | function () {
timeLapsed += 16;
percentage = ( timeLapsed / speed );
percentage = ( percentage > 1 ) ? 1 : percentage;
position = startLocation + ( distance * _easingPattern(easing, percentage) );
window.scrollTo( 0, Math.floor(position) );
_stopAnimateScroll(position, endLocation, animationInterval);... | javascript | function () {
timeLapsed += 16;
percentage = ( timeLapsed / speed );
percentage = ( percentage > 1 ) ? 1 : percentage;
position = startLocation + ( distance * _easingPattern(easing, percentage) );
window.scrollTo( 0, Math.floor(position) );
_stopAnimateScroll(position, endLocation, animationInterval);... | [
"function",
"(",
")",
"{",
"timeLapsed",
"+=",
"16",
";",
"percentage",
"=",
"(",
"timeLapsed",
"/",
"speed",
")",
";",
"percentage",
"=",
"(",
"percentage",
">",
"1",
")",
"?",
"1",
":",
"percentage",
";",
"position",
"=",
"startLocation",
"+",
"(",
... | Loop scrolling animation Private method Runs functions | [
"Loop",
"scrolling",
"animation",
"Private",
"method",
"Runs",
"functions"
] | 80478b48d3c940d40551a9a6928d0fa6d7883fde | https://github.com/baoshan/wx/blob/80478b48d3c940d40551a9a6928d0fa6d7883fde/demo/public/vendor/smooth-scroll.js#L169-L176 | train | |
baoshan/wx | demo/public/vendor/smooth-scroll.js | function ( options ) {
// Feature test before initializing
if ( 'querySelector' in document && 'addEventListener' in window && Array.prototype.forEach ) {
// Selectors and variables
options = _mergeObjects( _defaults, options || {} ); // Merge user options with defaults
var toggles = document.querySelect... | javascript | function ( options ) {
// Feature test before initializing
if ( 'querySelector' in document && 'addEventListener' in window && Array.prototype.forEach ) {
// Selectors and variables
options = _mergeObjects( _defaults, options || {} ); // Merge user options with defaults
var toggles = document.querySelect... | [
"function",
"(",
"options",
")",
"{",
"// Feature test before initializing",
"if",
"(",
"'querySelector'",
"in",
"document",
"&&",
"'addEventListener'",
"in",
"window",
"&&",
"Array",
".",
"prototype",
".",
"forEach",
")",
"{",
"// Selectors and variables",
"options",... | Initialize Smooth Scroll Public method Runs functions | [
"Initialize",
"Smooth",
"Scroll",
"Public",
"method",
"Runs",
"functions"
] | 80478b48d3c940d40551a9a6928d0fa6d7883fde | https://github.com/baoshan/wx/blob/80478b48d3c940d40551a9a6928d0fa6d7883fde/demo/public/vendor/smooth-scroll.js#L200-L216 | train | |
ota-meshi/eslint-plugin-lodash-template | lib/rules/no-duplicate-attributes.js | report | function report(node) {
const name = node.key
context.report({
node,
loc: node.loc,
messageId: "duplicate",
data: { name },
})
} | javascript | function report(node) {
const name = node.key
context.report({
node,
loc: node.loc,
messageId: "duplicate",
data: { name },
})
} | [
"function",
"report",
"(",
"node",
")",
"{",
"const",
"name",
"=",
"node",
".",
"key",
"context",
".",
"report",
"(",
"{",
"node",
",",
"loc",
":",
"node",
".",
"loc",
",",
"messageId",
":",
"\"duplicate\"",
",",
"data",
":",
"{",
"name",
"}",
",",... | Report warning the given attribute node.
@param {Node} node The attribute node
@returns {void} | [
"Report",
"warning",
"the",
"given",
"attribute",
"node",
"."
] | 9ff820d58da1eea47f12a87939e62a23cc07561d | https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/no-duplicate-attributes.js#L33-L41 | train |
ota-meshi/eslint-plugin-lodash-template | lib/rules/no-duplicate-attributes.js | groupByName | function groupByName(attrs) {
const attributes = new Map()
for (const node of attrs) {
const name = node.key
const list =
attributes.get(name) ||
(() => {
const a = []
attribut... | javascript | function groupByName(attrs) {
const attributes = new Map()
for (const node of attrs) {
const name = node.key
const list =
attributes.get(name) ||
(() => {
const a = []
attribut... | [
"function",
"groupByName",
"(",
"attrs",
")",
"{",
"const",
"attributes",
"=",
"new",
"Map",
"(",
")",
"for",
"(",
"const",
"node",
"of",
"attrs",
")",
"{",
"const",
"name",
"=",
"node",
".",
"key",
"const",
"list",
"=",
"attributes",
".",
"get",
"("... | Group by attribute name
@param {Array} attrs The attribute nodes
@returns {Map} The grouping Map | [
"Group",
"by",
"attribute",
"name"
] | 9ff820d58da1eea47f12a87939e62a23cc07561d | https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/no-duplicate-attributes.js#L48-L62 | train |
ota-meshi/eslint-plugin-lodash-template | lib/rules/no-duplicate-attributes.js | equalNode | function equalNode(n1, n2) {
return (
n1.type === n2.type &&
n1.range[0] === n2.range[0] &&
n1.range[1] === n2.range[1]
)
} | javascript | function equalNode(n1, n2) {
return (
n1.type === n2.type &&
n1.range[0] === n2.range[0] &&
n1.range[1] === n2.range[1]
)
} | [
"function",
"equalNode",
"(",
"n1",
",",
"n2",
")",
"{",
"return",
"(",
"n1",
".",
"type",
"===",
"n2",
".",
"type",
"&&",
"n1",
".",
"range",
"[",
"0",
"]",
"===",
"n2",
".",
"range",
"[",
"0",
"]",
"&&",
"n1",
".",
"range",
"[",
"1",
"]",
... | Check if the nodes equals.
@param {Node} n1 The node
@param {Node} n2 The node
@returns {boolean} `true` if the nodes equals. | [
"Check",
"if",
"the",
"nodes",
"equals",
"."
] | 9ff820d58da1eea47f12a87939e62a23cc07561d | https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/no-duplicate-attributes.js#L70-L76 | train |
ota-meshi/eslint-plugin-lodash-template | lib/rules/no-duplicate-attributes.js | validateNameGroup | function validateNameGroup(nodes, _name) {
if (nodes.length <= 1) {
return
}
for (const target of nodes) {
const node =
microTemplateService.getBranchProcessedHtmlNode(
target,
sourceC... | javascript | function validateNameGroup(nodes, _name) {
if (nodes.length <= 1) {
return
}
for (const target of nodes) {
const node =
microTemplateService.getBranchProcessedHtmlNode(
target,
sourceC... | [
"function",
"validateNameGroup",
"(",
"nodes",
",",
"_name",
")",
"{",
"if",
"(",
"nodes",
".",
"length",
"<=",
"1",
")",
"{",
"return",
"}",
"for",
"(",
"const",
"target",
"of",
"nodes",
")",
"{",
"const",
"node",
"=",
"microTemplateService",
".",
"ge... | Validation by attribute name
@param {Array} nodes The attribute nodes
@param {string} _name The attribut name
@returns {void} | [
"Validation",
"by",
"attribute",
"name"
] | 9ff820d58da1eea47f12a87939e62a23cc07561d | https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/no-duplicate-attributes.js#L84-L111 | train |
ota-meshi/eslint-plugin-lodash-template | lib/rules/no-duplicate-attributes.js | validateAttrs | function validateAttrs(attrs) {
const attributes = groupByName(attrs)
attributes.forEach((nodes, name) => {
validateNameGroup(nodes, name)
})
} | javascript | function validateAttrs(attrs) {
const attributes = groupByName(attrs)
attributes.forEach((nodes, name) => {
validateNameGroup(nodes, name)
})
} | [
"function",
"validateAttrs",
"(",
"attrs",
")",
"{",
"const",
"attributes",
"=",
"groupByName",
"(",
"attrs",
")",
"attributes",
".",
"forEach",
"(",
"(",
"nodes",
",",
"name",
")",
"=>",
"{",
"validateNameGroup",
"(",
"nodes",
",",
"name",
")",
"}",
")"... | Validate attribute nodes
@param {Array} attrs The attribute nodes
@returns {void} | [
"Validate",
"attribute",
"nodes"
] | 9ff820d58da1eea47f12a87939e62a23cc07561d | https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/no-duplicate-attributes.js#L118-L123 | train |
ota-meshi/eslint-plugin-lodash-template | tools/lib/load-configs.js | readConfigs | function readConfigs() {
const configsRoot = path.resolve(__dirname, "../../lib/configs")
const result = fs.readdirSync(configsRoot)
const configs = []
for (const name of result) {
const configName = name.replace(/\.js$/u, "")
const configId = `plugin:lodash-template/${configName}`
... | javascript | function readConfigs() {
const configsRoot = path.resolve(__dirname, "../../lib/configs")
const result = fs.readdirSync(configsRoot)
const configs = []
for (const name of result) {
const configName = name.replace(/\.js$/u, "")
const configId = `plugin:lodash-template/${configName}`
... | [
"function",
"readConfigs",
"(",
")",
"{",
"const",
"configsRoot",
"=",
"path",
".",
"resolve",
"(",
"__dirname",
",",
"\"../../lib/configs\"",
")",
"const",
"result",
"=",
"fs",
".",
"readdirSync",
"(",
"configsRoot",
")",
"const",
"configs",
"=",
"[",
"]",
... | Get the all configs
@returns {Array} The all configs | [
"Get",
"the",
"all",
"configs"
] | 9ff820d58da1eea47f12a87939e62a23cc07561d | https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/tools/lib/load-configs.js#L10-L28 | train |
ota-meshi/eslint-plugin-lodash-template | lib/rules/script-indent.js | getActualLineIndentText | function getActualLineIndentText(line) {
let actualText = actualLineIndentTexts.get(line)
if (actualText === undefined) {
const lineText = getLineText(line)
const index = lineText.search(/\S/u)
if (index >= 0) {
actualText = lin... | javascript | function getActualLineIndentText(line) {
let actualText = actualLineIndentTexts.get(line)
if (actualText === undefined) {
const lineText = getLineText(line)
const index = lineText.search(/\S/u)
if (index >= 0) {
actualText = lin... | [
"function",
"getActualLineIndentText",
"(",
"line",
")",
"{",
"let",
"actualText",
"=",
"actualLineIndentTexts",
".",
"get",
"(",
"line",
")",
"if",
"(",
"actualText",
"===",
"undefined",
")",
"{",
"const",
"lineText",
"=",
"getLineText",
"(",
"line",
")",
"... | Get the actual indent text of the line which the given line is on.
@param {number} line The line no.
@returns {string} The text of actual indent. | [
"Get",
"the",
"actual",
"indent",
"text",
"of",
"the",
"line",
"which",
"the",
"given",
"line",
"is",
"on",
"."
] | 9ff820d58da1eea47f12a87939e62a23cc07561d | https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/script-indent.js#L209-L222 | train |
ota-meshi/eslint-plugin-lodash-template | lib/rules/script-indent.js | getTopLevelIndentByTemplateTag | function getTopLevelIndentByTemplateTag(templateTag) {
const baseIndentText = getActualLineIndentText(
templateTag.loc.start.line
)
return new ExpectedIndent(
baseIndentText,
options.indentSize * options.startIndent
)
... | javascript | function getTopLevelIndentByTemplateTag(templateTag) {
const baseIndentText = getActualLineIndentText(
templateTag.loc.start.line
)
return new ExpectedIndent(
baseIndentText,
options.indentSize * options.startIndent
)
... | [
"function",
"getTopLevelIndentByTemplateTag",
"(",
"templateTag",
")",
"{",
"const",
"baseIndentText",
"=",
"getActualLineIndentText",
"(",
"templateTag",
".",
"loc",
".",
"start",
".",
"line",
")",
"return",
"new",
"ExpectedIndent",
"(",
"baseIndentText",
",",
"opt... | Calculate correct indentation of the top level in the given template tag.
@param {Token} templateTag The template tag.
@returns {ExpectedIndent} Correct indentation. | [
"Calculate",
"correct",
"indentation",
"of",
"the",
"top",
"level",
"in",
"the",
"given",
"template",
"tag",
"."
] | 9ff820d58da1eea47f12a87939e62a23cc07561d | https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/script-indent.js#L299-L307 | train |
ota-meshi/eslint-plugin-lodash-template | lib/rules/script-indent.js | setOffsetToNodeList | function setOffsetToNodeList(nodeList, leftToken, offset, baseToken) {
for (const t of genCollectNodeList(nodeList, leftToken, null)) {
setOffsetToToken(t, offset, baseToken)
}
} | javascript | function setOffsetToNodeList(nodeList, leftToken, offset, baseToken) {
for (const t of genCollectNodeList(nodeList, leftToken, null)) {
setOffsetToToken(t, offset, baseToken)
}
} | [
"function",
"setOffsetToNodeList",
"(",
"nodeList",
",",
"leftToken",
",",
"offset",
",",
"baseToken",
")",
"{",
"for",
"(",
"const",
"t",
"of",
"genCollectNodeList",
"(",
"nodeList",
",",
"leftToken",
",",
"null",
")",
")",
"{",
"setOffsetToToken",
"(",
"t"... | Set offset the given node list.
@param {Node[]} nodeList The node to process.
@param {Node|null} leftToken The left parenthesis token.
@param {number} offset The offset to set.
@param {Token} baseToken The token of the base offset.
@returns {void} | [
"Set",
"offset",
"the",
"given",
"node",
"list",
"."
] | 9ff820d58da1eea47f12a87939e62a23cc07561d | https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/script-indent.js#L560-L564 | train |
ota-meshi/eslint-plugin-lodash-template | lib/rules/script-indent.js | inTemplateTag | function inTemplateTag(line) {
if (line <= 1) {
return false
}
const lineStartIndex = sourceCode.getIndexFromLoc({
line,
column: 0,
})
return microTemplateService.inTemplateTag(lin... | javascript | function inTemplateTag(line) {
if (line <= 1) {
return false
}
const lineStartIndex = sourceCode.getIndexFromLoc({
line,
column: 0,
})
return microTemplateService.inTemplateTag(lin... | [
"function",
"inTemplateTag",
"(",
"line",
")",
"{",
"if",
"(",
"line",
"<=",
"1",
")",
"{",
"return",
"false",
"}",
"const",
"lineStartIndex",
"=",
"sourceCode",
".",
"getIndexFromLoc",
"(",
"{",
"line",
",",
"column",
":",
"0",
",",
"}",
")",
"return"... | Check whether the line start is in template tag.
@param {number} line The line.
@returns {boolean} `true` if the line start is in template tag. | [
"Check",
"whether",
"the",
"line",
"start",
"is",
"in",
"template",
"tag",
"."
] | 9ff820d58da1eea47f12a87939e62a23cc07561d | https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/script-indent.js#L611-L620 | train |
ota-meshi/eslint-plugin-lodash-template | lib/rules/script-indent.js | validateBaseIndent | function validateBaseIndent(line, actualText, expectedIndent) {
const expectedBaseIndentText = expectedIndent.baseIndentText
if (
expectedBaseIndentText &&
(actualText.length < expectedBaseIndentText.length ||
!actualText.st... | javascript | function validateBaseIndent(line, actualText, expectedIndent) {
const expectedBaseIndentText = expectedIndent.baseIndentText
if (
expectedBaseIndentText &&
(actualText.length < expectedBaseIndentText.length ||
!actualText.st... | [
"function",
"validateBaseIndent",
"(",
"line",
",",
"actualText",
",",
"expectedIndent",
")",
"{",
"const",
"expectedBaseIndentText",
"=",
"expectedIndent",
".",
"baseIndentText",
"if",
"(",
"expectedBaseIndentText",
"&&",
"(",
"actualText",
".",
"length",
"<",
"exp... | Validate base point indentation.
@param {number} line The number of line.
@param {string} actualText The actual indentation text.
@param {ExpectedIndent} expectedIndent The expected indent.
@returns {void} | [
"Validate",
"base",
"point",
"indentation",
"."
] | 9ff820d58da1eea47f12a87939e62a23cc07561d | https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/script-indent.js#L650-L684 | 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.