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
sealice/koa2-ueditor
example/public/ueditor/third-party/highcharts/modules/data.src.js
function () { var self = this, options = this.options, csv = options.csv, columns = this.columns, startRow = options.startRow || 0, endRow = options.endRow || Number.MAX_VALUE, startColumn = options.startColumn || 0, endColumn = options.endColumn || Number.MAX_VALUE, lines, activeRowNo = 0;...
javascript
function () { var self = this, options = this.options, csv = options.csv, columns = this.columns, startRow = options.startRow || 0, endRow = options.endRow || Number.MAX_VALUE, startColumn = options.startColumn || 0, endColumn = options.endColumn || Number.MAX_VALUE, lines, activeRowNo = 0;...
[ "function", "(", ")", "{", "var", "self", "=", "this", ",", "options", "=", "this", ".", "options", ",", "csv", "=", "options", ".", "csv", ",", "columns", "=", "this", ".", "columns", ",", "startRow", "=", "options", ".", "startRow", "||", "0", ",...
Parse a CSV input string
[ "Parse", "a", "CSV", "input", "string" ]
89fa1cc70f0375fafe023c88692fc27c83f2cd98
https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/modules/data.src.js#L166-L208
train
sealice/koa2-ueditor
example/public/ueditor/third-party/highcharts/modules/data.src.js
function () { var options = this.options, table = options.table, columns = this.columns, startRow = options.startRow || 0, endRow = options.endRow || Number.MAX_VALUE, startColumn = options.startColumn || 0, endColumn = options.endColumn || Number.MAX_VALUE, colNo; if (table) { if (t...
javascript
function () { var options = this.options, table = options.table, columns = this.columns, startRow = options.startRow || 0, endRow = options.endRow || Number.MAX_VALUE, startColumn = options.startColumn || 0, endColumn = options.endColumn || Number.MAX_VALUE, colNo; if (table) { if (t...
[ "function", "(", ")", "{", "var", "options", "=", "this", ".", "options", ",", "table", "=", "options", ".", "table", ",", "columns", "=", "this", ".", "columns", ",", "startRow", "=", "options", ".", "startRow", "||", "0", ",", "endRow", "=", "optio...
Parse a HTML table
[ "Parse", "a", "HTML", "table" ]
89fa1cc70f0375fafe023c88692fc27c83f2cd98
https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/modules/data.src.js#L213-L247
train
sealice/koa2-ueditor
example/public/ueditor/third-party/highcharts/modules/data.src.js
function (rows) { var row, rowsLength, col, colsLength, columns; if (rows) { columns = []; rowsLength = rows.length; for (row = 0; row < rowsLength; row++) { colsLength = rows[row].length; for (col = 0; col < colsLength; col++) { if (!columns[col]) { columns[col] = []; ...
javascript
function (rows) { var row, rowsLength, col, colsLength, columns; if (rows) { columns = []; rowsLength = rows.length; for (row = 0; row < rowsLength; row++) { colsLength = rows[row].length; for (col = 0; col < colsLength; col++) { if (!columns[col]) { columns[col] = []; ...
[ "function", "(", "rows", ")", "{", "var", "row", ",", "rowsLength", ",", "col", ",", "colsLength", ",", "columns", ";", "if", "(", "rows", ")", "{", "columns", "=", "[", "]", ";", "rowsLength", "=", "rows", ".", "length", ";", "for", "(", "row", ...
Reorganize rows into columns
[ "Reorganize", "rows", "into", "columns" ]
89fa1cc70f0375fafe023c88692fc27c83f2cd98
https://github.com/sealice/koa2-ueditor/blob/89fa1cc70f0375fafe023c88692fc27c83f2cd98/example/public/ueditor/third-party/highcharts/modules/data.src.js#L425-L446
train
anvaka/ngraph.centrality
src/closeness.js
closeness
function closeness(graph, oriented) { var Q = []; // list of predecessors on shortest paths from source // distance from source var dist = Object.create(null); var currentNode; var centrality = Object.create(null); graph.forEachNode(setCentralityToZero); graph.forEachNode(calculateCentrality...
javascript
function closeness(graph, oriented) { var Q = []; // list of predecessors on shortest paths from source // distance from source var dist = Object.create(null); var currentNode; var centrality = Object.create(null); graph.forEachNode(setCentralityToZero); graph.forEachNode(calculateCentrality...
[ "function", "closeness", "(", "graph", ",", "oriented", ")", "{", "var", "Q", "=", "[", "]", ";", "// list of predecessors on shortest paths from source\r", "// distance from source\r", "var", "dist", "=", "Object", ".", "create", "(", "null", ")", ";", "var", "...
In a connected graph, the normalized closeness centrality of a node is the average length of the shortest path between the node and all other nodes in the graph. Thus the more central a node is, the closer it is to all other nodes.
[ "In", "a", "connected", "graph", "the", "normalized", "closeness", "centrality", "of", "a", "node", "is", "the", "average", "length", "of", "the", "shortest", "path", "between", "the", "node", "and", "all", "other", "nodes", "in", "the", "graph", ".", "Thu...
bfec9eb729e5f819490a4421486f6e1ae2232ba0
https://github.com/anvaka/ngraph.centrality/blob/bfec9eb729e5f819490a4421486f6e1ae2232ba0/src/closeness.js#L8-L70
train
anvaka/ngraph.centrality
src/eccentricity.js
eccentricity
function eccentricity(graph, oriented) { var Q = []; // distance from source var dist = Object.create(null); var currentNode; var centrality = Object.create(null); graph.forEachNode(setCentralityToZero); graph.forEachNode(calculateCentrality); return centrality; function setCentrality...
javascript
function eccentricity(graph, oriented) { var Q = []; // distance from source var dist = Object.create(null); var currentNode; var centrality = Object.create(null); graph.forEachNode(setCentralityToZero); graph.forEachNode(calculateCentrality); return centrality; function setCentrality...
[ "function", "eccentricity", "(", "graph", ",", "oriented", ")", "{", "var", "Q", "=", "[", "]", ";", "// distance from source\r", "var", "dist", "=", "Object", ".", "create", "(", "null", ")", ";", "var", "currentNode", ";", "var", "centrality", "=", "Ob...
The eccentricity centrality of a node is the greatest distance between that node and any other node in the network.
[ "The", "eccentricity", "centrality", "of", "a", "node", "is", "the", "greatest", "distance", "between", "that", "node", "and", "any", "other", "node", "in", "the", "network", "." ]
bfec9eb729e5f819490a4421486f6e1ae2232ba0
https://github.com/anvaka/ngraph.centrality/blob/bfec9eb729e5f819490a4421486f6e1ae2232ba0/src/eccentricity.js#L7-L64
train
anywhichway/tlx
benchmarks/dbmon/lib/monitor.js
initPerfMonitor
function initPerfMonitor(options) { if (!initialized) { if (options.container) { container = options.container; } initialized = true; } }
javascript
function initPerfMonitor(options) { if (!initialized) { if (options.container) { container = options.container; } initialized = true; } }
[ "function", "initPerfMonitor", "(", "options", ")", "{", "if", "(", "!", "initialized", ")", "{", "if", "(", "options", ".", "container", ")", "{", "container", "=", "options", ".", "container", ";", "}", "initialized", "=", "true", ";", "}", "}" ]
Initialize Performance Monitor
[ "Initialize", "Performance", "Monitor" ]
732bc3828d2333ea757b8772e8e6b7a6b4070637
https://github.com/anywhichway/tlx/blob/732bc3828d2333ea757b8772e8e6b7a6b4070637/benchmarks/dbmon/lib/monitor.js#L41-L48
train
anywhichway/tlx
benchmarks/dbmon/lib/monitor.js
checkInit
function checkInit() { if (!container) { container = document.createElement("div"); container.style.cssText = "position: fixed;" + "opacity: 0.9;" + "right: 0;" + "bottom: 0"; document.body.appendChild(container); } initialized = true; }
javascript
function checkInit() { if (!container) { container = document.createElement("div"); container.style.cssText = "position: fixed;" + "opacity: 0.9;" + "right: 0;" + "bottom: 0"; document.body.appendChild(container); } initialized = true; }
[ "function", "checkInit", "(", ")", "{", "if", "(", "!", "container", ")", "{", "container", "=", "document", ".", "createElement", "(", "\"div\"", ")", ";", "container", ".", "style", ".", "cssText", "=", "\"position: fixed;\"", "+", "\"opacity: 0.9;\"", "+"...
Check that everything is properly initialized
[ "Check", "that", "everything", "is", "properly", "initialized" ]
732bc3828d2333ea757b8772e8e6b7a6b4070637
https://github.com/anywhichway/tlx/blob/732bc3828d2333ea757b8772e8e6b7a6b4070637/benchmarks/dbmon/lib/monitor.js#L52-L59
train
anywhichway/tlx
benchmarks/dbmon/lib/monitor.js
scheduleTask
function scheduleTask(task) { frameTasks.push(task); if (rafId === -1) { requestAnimationFrame(function (t) { rafId = -1; var tasks = frameTasks; frameTasks = []; for (var i = 0; i < tasks.length; i++) { task...
javascript
function scheduleTask(task) { frameTasks.push(task); if (rafId === -1) { requestAnimationFrame(function (t) { rafId = -1; var tasks = frameTasks; frameTasks = []; for (var i = 0; i < tasks.length; i++) { task...
[ "function", "scheduleTask", "(", "task", ")", "{", "frameTasks", ".", "push", "(", "task", ")", ";", "if", "(", "rafId", "===", "-", "1", ")", "{", "requestAnimationFrame", "(", "function", "(", "t", ")", "{", "rafId", "=", "-", "1", ";", "var", "t...
Schedule new task that will be executed on the next frame
[ "Schedule", "new", "task", "that", "will", "be", "executed", "on", "the", "next", "frame" ]
732bc3828d2333ea757b8772e8e6b7a6b4070637
https://github.com/anywhichway/tlx/blob/732bc3828d2333ea757b8772e8e6b7a6b4070637/benchmarks/dbmon/lib/monitor.js#L63-L75
train
anywhichway/tlx
benchmarks/dbmon/lib/monitor.js
startFPSMonitor
function startFPSMonitor() { checkInit(); var data = new Data(); var w = new MonitorWidget("FPS", "", 2 /* HideMax */ | 1 /* HideMin */ | 4 /* HideMean */ | 32 /* RoundValues */); container.appendChild(w.element); var samples = []; var last = 0; function update(no...
javascript
function startFPSMonitor() { checkInit(); var data = new Data(); var w = new MonitorWidget("FPS", "", 2 /* HideMax */ | 1 /* HideMin */ | 4 /* HideMean */ | 32 /* RoundValues */); container.appendChild(w.element); var samples = []; var last = 0; function update(no...
[ "function", "startFPSMonitor", "(", ")", "{", "checkInit", "(", ")", ";", "var", "data", "=", "new", "Data", "(", ")", ";", "var", "w", "=", "new", "MonitorWidget", "(", "\"FPS\"", ",", "\"\"", ",", "2", "/* HideMax */", "|", "1", "/* HideMin */", "|",...
Start FPS monitor
[ "Start", "FPS", "monitor" ]
732bc3828d2333ea757b8772e8e6b7a6b4070637
https://github.com/anywhichway/tlx/blob/732bc3828d2333ea757b8772e8e6b7a6b4070637/benchmarks/dbmon/lib/monitor.js#L206-L233
train
anywhichway/tlx
benchmarks/dbmon/lib/monitor.js
startMemMonitor
function startMemMonitor() { checkInit(); if (performance.memory !== void 0) { (function () { var update = function update() { data.addSample(Math.round(mem.usedJSHeapSize / (1024 * 1024))); w.addResult(data.calc()); ...
javascript
function startMemMonitor() { checkInit(); if (performance.memory !== void 0) { (function () { var update = function update() { data.addSample(Math.round(mem.usedJSHeapSize / (1024 * 1024))); w.addResult(data.calc()); ...
[ "function", "startMemMonitor", "(", ")", "{", "checkInit", "(", ")", ";", "if", "(", "performance", ".", "memory", "!==", "void", "0", ")", "{", "(", "function", "(", ")", "{", "var", "update", "=", "function", "update", "(", ")", "{", "data", ".", ...
Start Memory Monitor
[ "Start", "Memory", "Monitor" ]
732bc3828d2333ea757b8772e8e6b7a6b4070637
https://github.com/anywhichway/tlx/blob/732bc3828d2333ea757b8772e8e6b7a6b4070637/benchmarks/dbmon/lib/monitor.js#L237-L255
train
anywhichway/tlx
benchmarks/dbmon/lib/monitor.js
initProfiler
function initProfiler(name) { checkInit(); var profiler = profilerInstances[name]; if (profiler === void 0) { profilerInstances[name] = profiler = new Profiler(name, "ms"); container.appendChild(profiler.widget.element); } }
javascript
function initProfiler(name) { checkInit(); var profiler = profilerInstances[name]; if (profiler === void 0) { profilerInstances[name] = profiler = new Profiler(name, "ms"); container.appendChild(profiler.widget.element); } }
[ "function", "initProfiler", "(", "name", ")", "{", "checkInit", "(", ")", ";", "var", "profiler", "=", "profilerInstances", "[", "name", "]", ";", "if", "(", "profiler", "===", "void", "0", ")", "{", "profilerInstances", "[", "name", "]", "=", "profiler"...
Initialize profiler and insert into container
[ "Initialize", "profiler", "and", "insert", "into", "container" ]
732bc3828d2333ea757b8772e8e6b7a6b4070637
https://github.com/anywhichway/tlx/blob/732bc3828d2333ea757b8772e8e6b7a6b4070637/benchmarks/dbmon/lib/monitor.js#L283-L290
train
caseyyee/aframe-ui-widgets
src/button.js
function (evt) { var threshold = 30; if (!this.pressed) { this.pressed = true; this.emit('touchdown'); var self = this; this.interval = setInterval(function() { var delta = performance.now() - self.lastTime; if (delta > threshold) { self.pressed = false; ...
javascript
function (evt) { var threshold = 30; if (!this.pressed) { this.pressed = true; this.emit('touchdown'); var self = this; this.interval = setInterval(function() { var delta = performance.now() - self.lastTime; if (delta > threshold) { self.pressed = false; ...
[ "function", "(", "evt", ")", "{", "var", "threshold", "=", "30", ";", "if", "(", "!", "this", ".", "pressed", ")", "{", "this", ".", "pressed", "=", "true", ";", "this", ".", "emit", "(", "'touchdown'", ")", ";", "var", "self", "=", "this", ";", ...
handles hand controller collisions
[ "handles", "hand", "controller", "collisions" ]
44f3538ceee79fa4d5adc381400053b3354a9618
https://github.com/caseyyee/aframe-ui-widgets/blob/44f3538ceee79fa4d5adc381400053b3354a9618/src/button.js#L125-L142
train
mfix22/gest
src/util.js
readDir
function readDir (dir, regex = /^(?:)$/) { return new Promise((resolve, reject) => fs.readdir(dir, (err, files) => err ? reject(err) : resolve(Promise.all(files.map(checkFileName.bind(null, dir, regex)))))) .then(values => [].concat(...values) .filter(i => i)) }
javascript
function readDir (dir, regex = /^(?:)$/) { return new Promise((resolve, reject) => fs.readdir(dir, (err, files) => err ? reject(err) : resolve(Promise.all(files.map(checkFileName.bind(null, dir, regex)))))) .then(values => [].concat(...values) .filter(i => i)) }
[ "function", "readDir", "(", "dir", ",", "regex", "=", "/", "^(?:)$", "/", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "fs", ".", "readdir", "(", "dir", ",", "(", "err", ",", "files", ")", "=>", "err", "?",...
regex defaults to empty
[ "regex", "defaults", "to", "empty" ]
c15dd6208b97109a73cada617484988c1844241b
https://github.com/mfix22/gest/blob/c15dd6208b97109a73cada617484988c1844241b/src/util.js#L101-L109
train
yuanchuan/markdown-preview
lib/check.js
check
function check(filename) { this.filename = filename && path.resolve(filename) || ''; this.types = []; this.valid = null; }
javascript
function check(filename) { this.filename = filename && path.resolve(filename) || ''; this.types = []; this.valid = null; }
[ "function", "check", "(", "filename", ")", "{", "this", ".", "filename", "=", "filename", "&&", "path", ".", "resolve", "(", "filename", ")", "||", "''", ";", "this", ".", "types", "=", "[", "]", ";", "this", ".", "valid", "=", "null", ";", "}" ]
Initialize a new `check` with the given filename. @param {String} filename @api private
[ "Initialize", "a", "new", "check", "with", "the", "given", "filename", "." ]
173c44f7cea1f579fa2d54773579ad80863ea8b9
https://github.com/yuanchuan/markdown-preview/blob/173c44f7cea1f579fa2d54773579ad80863ea8b9/lib/check.js#L26-L30
train
yuanchuan/markdown-preview
lib/server.js
handler
function handler(req, res) { var parsedUrl = url.parse(req.url) var callback = qs.parse(parsedUrl.query).callback var filename = decodeURI(parsedUrl.path.substr(1).split('?')[0]) var basename = path.basename(filename.split('?')[0]) var extname = path.extname(basename) var response = reswrap(res); var not...
javascript
function handler(req, res) { var parsedUrl = url.parse(req.url) var callback = qs.parse(parsedUrl.query).callback var filename = decodeURI(parsedUrl.path.substr(1).split('?')[0]) var basename = path.basename(filename.split('?')[0]) var extname = path.extname(basename) var response = reswrap(res); var not...
[ "function", "handler", "(", "req", ",", "res", ")", "{", "var", "parsedUrl", "=", "url", ".", "parse", "(", "req", ".", "url", ")", "var", "callback", "=", "qs", ".", "parse", "(", "parsedUrl", ".", "query", ")", ".", "callback", "var", "filename", ...
Http handler for the web server
[ "Http", "handler", "for", "the", "web", "server" ]
173c44f7cea1f579fa2d54773579ad80863ea8b9
https://github.com/yuanchuan/markdown-preview/blob/173c44f7cea1f579fa2d54773579ad80863ea8b9/lib/server.js#L56-L121
train
shannonmoeller/handlebars-wax
index.js
compileFile
function compileFile(module, filename) { const templateString = fs.readFileSync(filename, 'utf8'); module.exports = handlebars.compile(templateString); }
javascript
function compileFile(module, filename) { const templateString = fs.readFileSync(filename, 'utf8'); module.exports = handlebars.compile(templateString); }
[ "function", "compileFile", "(", "module", ",", "filename", ")", "{", "const", "templateString", "=", "fs", ".", "readFileSync", "(", "filename", ",", "'utf8'", ")", ";", "module", ".", "exports", "=", "handlebars", ".", "compile", "(", "templateString", ")",...
eslint-disable-line prefer-const
[ "eslint", "-", "disable", "-", "line", "prefer", "-", "const" ]
cbc6d9d7c6ee5f529b97c942ec3ff2e321a6854c
https://github.com/shannonmoeller/handlebars-wax/blob/cbc6d9d7c6ee5f529b97c942ec3ff2e321a6854c/index.js#L37-L41
train
thlorenz/cpuprofilify
example/fibonacci.js
cal_arrayPush
function cal_arrayPush(n) { function toFib(x, y, z) { x.push((z < 2) ? z : x[z - 1] + x[z - 2]) return x } var arr = Array.apply(null, new Array(n)).reduce(toFib, []) var len = arr.length return arr[len - 1] + arr[len - 2] }
javascript
function cal_arrayPush(n) { function toFib(x, y, z) { x.push((z < 2) ? z : x[z - 1] + x[z - 2]) return x } var arr = Array.apply(null, new Array(n)).reduce(toFib, []) var len = arr.length return arr[len - 1] + arr[len - 2] }
[ "function", "cal_arrayPush", "(", "n", ")", "{", "function", "toFib", "(", "x", ",", "y", ",", "z", ")", "{", "x", ".", "push", "(", "(", "z", "<", "2", ")", "?", "z", ":", "x", "[", "z", "-", "1", "]", "+", "x", "[", "z", "-", "2", "]"...
Calculate Fibonacci Array Push
[ "Calculate", "Fibonacci", "Array", "Push" ]
ef7a59ecf05b512c398281d45dc84208009bc1ed
https://github.com/thlorenz/cpuprofilify/blob/ef7a59ecf05b512c398281d45dc84208009bc1ed/example/fibonacci.js#L51-L60
train
thlorenz/cpuprofilify
index.js
convert
function convert(trace, opts) { opts = opts || {} this._map = opts.map this._opts = xtend({ v8gc: true }, opts, { map: this._map ? 'was supplied' : 'was not supplied' }) this.emit('info', 'Options: %j', this._opts) this._trace = trace this._traceLen = trace.length if (!this._traceLen) { this.emit('...
javascript
function convert(trace, opts) { opts = opts || {} this._map = opts.map this._opts = xtend({ v8gc: true }, opts, { map: this._map ? 'was supplied' : 'was not supplied' }) this.emit('info', 'Options: %j', this._opts) this._trace = trace this._traceLen = trace.length if (!this._traceLen) { this.emit('...
[ "function", "convert", "(", "trace", ",", "opts", ")", "{", "opts", "=", "opts", "||", "{", "}", "this", ".", "_map", "=", "opts", ".", "map", "this", ".", "_opts", "=", "xtend", "(", "{", "v8gc", ":", "true", "}", ",", "opts", ",", "{", "map",...
Converts the given trace taking according to the given opts. ``` var cpuprofilifier = require('cpuprofilifier') var cpuprofile = cpuprofilifier().convert(trace) fs.writeFileSync('/tmp/my.cpuprofile', JSON.stringify(cpuprofile)) ``` @name CpuProfilifier::convert @function @param {Array.<String>} trace a trace generate...
[ "Converts", "the", "given", "trace", "taking", "according", "to", "the", "given", "opts", "." ]
ef7a59ecf05b512c398281d45dc84208009bc1ed
https://github.com/thlorenz/cpuprofilify/blob/ef7a59ecf05b512c398281d45dc84208009bc1ed/index.js#L53-L84
train
enmasseio/evejs
lib/transport/local/LocalTransport.js
LocalTransport
function LocalTransport(config) { this.id = config && config.id || null; this.networkId = this.id || null; this['default'] = config && config['default'] || false; this.agents = {}; }
javascript
function LocalTransport(config) { this.id = config && config.id || null; this.networkId = this.id || null; this['default'] = config && config['default'] || false; this.agents = {}; }
[ "function", "LocalTransport", "(", "config", ")", "{", "this", ".", "id", "=", "config", "&&", "config", ".", "id", "||", "null", ";", "this", ".", "networkId", "=", "this", ".", "id", "||", "null", ";", "this", "[", "'default'", "]", "=", "config", ...
Create a local transport. @param {Object} config Config can contain the following properties: - `id: string`. Optional @constructor
[ "Create", "a", "local", "transport", "." ]
f330edd3b637d3b1b5b086d9dd730b13e61a0cc0
https://github.com/enmasseio/evejs/blob/f330edd3b637d3b1b5b086d9dd730b13e61a0cc0/lib/transport/local/LocalTransport.js#L12-L17
train
enmasseio/evejs
lib/transport/pubnub/PubNubConnection.js
PubNubConnection
function PubNubConnection(transport, id, receive) { this.id = id; this.transport = transport; // ready state var me = this; this.ready = new Promise(function (resolve, reject) { transport.pubnub.subscribe({ channel: id, message: function (message) { receive(message.from, message.messa...
javascript
function PubNubConnection(transport, id, receive) { this.id = id; this.transport = transport; // ready state var me = this; this.ready = new Promise(function (resolve, reject) { transport.pubnub.subscribe({ channel: id, message: function (message) { receive(message.from, message.messa...
[ "function", "PubNubConnection", "(", "transport", ",", "id", ",", "receive", ")", "{", "this", ".", "id", "=", "id", ";", "this", ".", "transport", "=", "transport", ";", "// ready state", "var", "me", "=", "this", ";", "this", ".", "ready", "=", "new"...
A connection. The connection is ready when the property .ready resolves. @param {PubNubTransport} transport @param {string | number} id @param {function} receive @constructor
[ "A", "connection", ".", "The", "connection", "is", "ready", "when", "the", "property", ".", "ready", "resolves", "." ]
f330edd3b637d3b1b5b086d9dd730b13e61a0cc0
https://github.com/enmasseio/evejs/blob/f330edd3b637d3b1b5b086d9dd730b13e61a0cc0/lib/transport/pubnub/PubNubConnection.js#L13-L30
train
enmasseio/evejs
lib/transport/pubnub/PubNubTransport.js
PubNubTransport
function PubNubTransport(config) { this.id = config.id || null; this.networkId = config.publish_key || null; this['default'] = config['default'] || false; this.pubnub = PUBNUB().init(config); }
javascript
function PubNubTransport(config) { this.id = config.id || null; this.networkId = config.publish_key || null; this['default'] = config['default'] || false; this.pubnub = PUBNUB().init(config); }
[ "function", "PubNubTransport", "(", "config", ")", "{", "this", ".", "id", "=", "config", ".", "id", "||", "null", ";", "this", ".", "networkId", "=", "config", ".", "publish_key", "||", "null", ";", "this", "[", "'default'", "]", "=", "config", "[", ...
Use pubnub as transport @param {Object} config Config can contain the following properties: - `id: string`. Optional - `publish_key: string`. Required - `subscribe_key: string`. Required @constructor
[ "Use", "pubnub", "as", "transport" ]
f330edd3b637d3b1b5b086d9dd730b13e61a0cc0
https://github.com/enmasseio/evejs/blob/f330edd3b637d3b1b5b086d9dd730b13e61a0cc0/lib/transport/pubnub/PubNubTransport.js#L14-L19
train
enmasseio/evejs
lib/transport/distribus/DistribusTransport.js
DistribusTransport
function DistribusTransport(config) { this.id = config && config.id || null; this['default'] = config && config['default'] || false; this.host = config && config.host || new distribus.Host(config); this.networkId = this.host.networkId; // FIXME: networkId can change when host connects to another host. }
javascript
function DistribusTransport(config) { this.id = config && config.id || null; this['default'] = config && config['default'] || false; this.host = config && config.host || new distribus.Host(config); this.networkId = this.host.networkId; // FIXME: networkId can change when host connects to another host. }
[ "function", "DistribusTransport", "(", "config", ")", "{", "this", ".", "id", "=", "config", "&&", "config", ".", "id", "||", "null", ";", "this", "[", "'default'", "]", "=", "config", "&&", "config", "[", "'default'", "]", "||", "false", ";", "this", ...
Use distribus as transport @param {Object} config Config can contain the following properties: - `id: string`. Optional - `host: distribus.Host`. Optional If `host` is not provided, a new local distribus Host is created. @constructor
[ "Use", "distribus", "as", "transport" ]
f330edd3b637d3b1b5b086d9dd730b13e61a0cc0
https://github.com/enmasseio/evejs/blob/f330edd3b637d3b1b5b086d9dd730b13e61a0cc0/lib/transport/distribus/DistribusTransport.js#L16-L22
train
enmasseio/evejs
lib/module/PatternModule.js
PatternModule
function PatternModule(agent, options) { this.agent = agent; this.stopPropagation = options && options.stopPropagation || false; this.receiveOriginal = agent._receive; this.listeners = []; }
javascript
function PatternModule(agent, options) { this.agent = agent; this.stopPropagation = options && options.stopPropagation || false; this.receiveOriginal = agent._receive; this.listeners = []; }
[ "function", "PatternModule", "(", "agent", ",", "options", ")", "{", "this", ".", "agent", "=", "agent", ";", "this", ".", "stopPropagation", "=", "options", "&&", "options", ".", "stopPropagation", "||", "false", ";", "this", ".", "receiveOriginal", "=", ...
Create a pattern listener onto an Agent. A new handler is added to the agents _receiver function. Creates a Pattern instance with functions `listen` and `unlisten`. @param {Agent} agent @param {Object} [options] Optional parameters. Can contain properties: - stopPropagation: boolean When false (default), a message wi...
[ "Create", "a", "pattern", "listener", "onto", "an", "Agent", ".", "A", "new", "handler", "is", "added", "to", "the", "agents", "_receiver", "function", ".", "Creates", "a", "Pattern", "instance", "with", "functions", "listen", "and", "unlisten", "." ]
f330edd3b637d3b1b5b086d9dd730b13e61a0cc0
https://github.com/enmasseio/evejs/blob/f330edd3b637d3b1b5b086d9dd730b13e61a0cc0/lib/module/PatternModule.js#L17-L22
train
enmasseio/evejs
lib/Agent.js
_getModuleConstructor
function _getModuleConstructor(name) { var constructor = Agent.modules[name]; if (!constructor) { throw new Error('Unknown module "' + name + '". ' + 'Choose from: ' + Object.keys(Agent.modules).map(JSON.stringify).join(', ')); } return constructor; }
javascript
function _getModuleConstructor(name) { var constructor = Agent.modules[name]; if (!constructor) { throw new Error('Unknown module "' + name + '". ' + 'Choose from: ' + Object.keys(Agent.modules).map(JSON.stringify).join(', ')); } return constructor; }
[ "function", "_getModuleConstructor", "(", "name", ")", "{", "var", "constructor", "=", "Agent", ".", "modules", "[", "name", "]", ";", "if", "(", "!", "constructor", ")", "{", "throw", "new", "Error", "(", "'Unknown module \"'", "+", "name", "+", "'\". '",...
Get a module constructor by it's name. Throws an error when the module is not found. @param {string} name @return {function} Returns the modules constructor function @private
[ "Get", "a", "module", "constructor", "by", "it", "s", "name", ".", "Throws", "an", "error", "when", "the", "module", "is", "not", "found", "." ]
f330edd3b637d3b1b5b086d9dd730b13e61a0cc0
https://github.com/enmasseio/evejs/blob/f330edd3b637d3b1b5b086d9dd730b13e61a0cc0/lib/Agent.js#L138-L145
train
enmasseio/evejs
lib/transport/Transport.js
Transport
function Transport(config) { this.id = config && config.id || null; this['default'] = config && config['default'] || false; }
javascript
function Transport(config) { this.id = config && config.id || null; this['default'] = config && config['default'] || false; }
[ "function", "Transport", "(", "config", ")", "{", "this", ".", "id", "=", "config", "&&", "config", ".", "id", "||", "null", ";", "this", "[", "'default'", "]", "=", "config", "&&", "config", "[", "'default'", "]", "||", "false", ";", "}" ]
Abstract prototype of a transport @param {Object} [config] @constructor
[ "Abstract", "prototype", "of", "a", "transport" ]
f330edd3b637d3b1b5b086d9dd730b13e61a0cc0
https://github.com/enmasseio/evejs/blob/f330edd3b637d3b1b5b086d9dd730b13e61a0cc0/lib/transport/Transport.js#L8-L11
train
enmasseio/evejs
lib/module/RequestModule.js
RequestModule
function RequestModule(agent, options) { this.agent = agent; this.receiveOriginal = agent._receive; this.timeout = options && options.timeout || TIMEOUT; this.queue = []; }
javascript
function RequestModule(agent, options) { this.agent = agent; this.receiveOriginal = agent._receive; this.timeout = options && options.timeout || TIMEOUT; this.queue = []; }
[ "function", "RequestModule", "(", "agent", ",", "options", ")", "{", "this", ".", "agent", "=", "agent", ";", "this", ".", "receiveOriginal", "=", "agent", ".", "_receive", ";", "this", ".", "timeout", "=", "options", "&&", "options", ".", "timeout", "||...
ms Create a Request module. The module attaches a handler to the agents _receive function. Creates a Request instance with function `request`. @param {Agent} agent @param {Object} [options] Optional parameters. Can contain properties: - timeout: number A timeout for responses in milliseconds. 60000 ms by default.
[ "ms", "Create", "a", "Request", "module", ".", "The", "module", "attaches", "a", "handler", "to", "the", "agents", "_receive", "function", ".", "Creates", "a", "Request", "instance", "with", "function", "request", "." ]
f330edd3b637d3b1b5b086d9dd730b13e61a0cc0
https://github.com/enmasseio/evejs/blob/f330edd3b637d3b1b5b086d9dd730b13e61a0cc0/lib/module/RequestModule.js#L19-L24
train
enmasseio/evejs
lib/transport/websocket/WebSocketConnection.js
WebSocketConnection
function WebSocketConnection(transport, url, receive) { this.transport = transport; this.url = url ? util.normalizeURL(url) : uuid(); this.receive = receive; this.sockets = {}; this.closed = false; this.reconnectTimers = {}; // ready state this.ready = Promise.resolve(this); }
javascript
function WebSocketConnection(transport, url, receive) { this.transport = transport; this.url = url ? util.normalizeURL(url) : uuid(); this.receive = receive; this.sockets = {}; this.closed = false; this.reconnectTimers = {}; // ready state this.ready = Promise.resolve(this); }
[ "function", "WebSocketConnection", "(", "transport", ",", "url", ",", "receive", ")", "{", "this", ".", "transport", "=", "transport", ";", "this", ".", "url", "=", "url", "?", "util", ".", "normalizeURL", "(", "url", ")", ":", "uuid", "(", ")", ";", ...
A websocket connection. @param {WebSocketTransport} transport @param {string | number | null} url The url of the agent. The url must match the url of the WebSocket server. If url is null, a UUID id is generated as url. @param {function} receive @constructor
[ "A", "websocket", "connection", "." ]
f330edd3b637d3b1b5b086d9dd730b13e61a0cc0
https://github.com/enmasseio/evejs/blob/f330edd3b637d3b1b5b086d9dd730b13e61a0cc0/lib/transport/websocket/WebSocketConnection.js#L21-L32
train
enmasseio/evejs
lib/module/BabbleModule.js
BabbleModule
function BabbleModule(agent, options) { // create a new babbler var babbler = babble.babbler(agent.id); babbler.connect({ connect: function (params) {}, disconnect: function(token) {}, send: function (to, message) { agent.send(to, message); } }); this.babbler = babbler; // create a re...
javascript
function BabbleModule(agent, options) { // create a new babbler var babbler = babble.babbler(agent.id); babbler.connect({ connect: function (params) {}, disconnect: function(token) {}, send: function (to, message) { agent.send(to, message); } }); this.babbler = babbler; // create a re...
[ "function", "BabbleModule", "(", "agent", ",", "options", ")", "{", "// create a new babbler", "var", "babbler", "=", "babble", ".", "babbler", "(", "agent", ".", "id", ")", ";", "babbler", ".", "connect", "(", "{", "connect", ":", "function", "(", "params...
Create a Babble module for an agent. The agents _receive function is wrapped into a new handler. Creates a Babble instance with function `ask`, `tell`, `listen`, `listenOnce` @param {Agent} agent @param {Object} [options] Optional parameters. Not applicable for BabbleModule @constructor
[ "Create", "a", "Babble", "module", "for", "an", "agent", ".", "The", "agents", "_receive", "function", "is", "wrapped", "into", "a", "new", "handler", ".", "Creates", "a", "Babble", "instance", "with", "function", "ask", "tell", "listen", "listenOnce" ]
f330edd3b637d3b1b5b086d9dd730b13e61a0cc0
https://github.com/enmasseio/evejs/blob/f330edd3b637d3b1b5b086d9dd730b13e61a0cc0/lib/module/BabbleModule.js#L13-L32
train
enmasseio/evejs
lib/transport/websocket/WebSocketTransport.js
WebSocketTransport
function WebSocketTransport(config) { this.id = config && config.id || null; this.networkId = this.id || null; this['default'] = config && config['default'] || false; this.localShortcut = (config && config.localShortcut === false) ? false : true; this.reconnectDelay = config && config.reconnectDelay || 10000;...
javascript
function WebSocketTransport(config) { this.id = config && config.id || null; this.networkId = this.id || null; this['default'] = config && config['default'] || false; this.localShortcut = (config && config.localShortcut === false) ? false : true; this.reconnectDelay = config && config.reconnectDelay || 10000;...
[ "function", "WebSocketTransport", "(", "config", ")", "{", "this", ".", "id", "=", "config", "&&", "config", ".", "id", "||", "null", ";", "this", ".", "networkId", "=", "this", ".", "id", "||", "null", ";", "this", "[", "'default'", "]", "=", "confi...
Create a web socket transport. @param {Object} config Config can contain the following properties: - `id: string`. Optional - `default: boolean`. Optional - `url: string`. Optional. If provided, A WebSocket server is started on given url. - `localShortcut: boolean`. Optional. If true (default), messages to loca...
[ "Create", "a", "web", "socket", "transport", "." ]
f330edd3b637d3b1b5b086d9dd730b13e61a0cc0
https://github.com/enmasseio/evejs/blob/f330edd3b637d3b1b5b086d9dd730b13e61a0cc0/lib/transport/websocket/WebSocketTransport.js#L29-L56
train
enmasseio/evejs
examples/agents/DelayedAgent.js
PlanningAgent
function PlanningAgent(id) { // execute super constructor eve.Agent.call(this, id); // connect to all transports configured by the system this.connect(eve.system.transports.getAll()); }
javascript
function PlanningAgent(id) { // execute super constructor eve.Agent.call(this, id); // connect to all transports configured by the system this.connect(eve.system.transports.getAll()); }
[ "function", "PlanningAgent", "(", "id", ")", "{", "// execute super constructor", "eve", ".", "Agent", ".", "call", "(", "this", ",", "id", ")", ";", "// connect to all transports configured by the system", "this", ".", "connect", "(", "eve", ".", "system", ".", ...
DelayedAgent prototype. This agent uses the eve.system.timer. This timer can be configured to run in real time, discrete time, or hyper time. @param {String} id @constructor @extend eve.Agent
[ "DelayedAgent", "prototype", ".", "This", "agent", "uses", "the", "eve", ".", "system", ".", "timer", ".", "This", "timer", "can", "be", "configured", "to", "run", "in", "real", "time", "discrete", "time", "or", "hyper", "time", "." ]
f330edd3b637d3b1b5b086d9dd730b13e61a0cc0
https://github.com/enmasseio/evejs/blob/f330edd3b637d3b1b5b086d9dd730b13e61a0cc0/examples/agents/DelayedAgent.js#L11-L17
train
enmasseio/evejs
lib/transport/amqp/AMQPTransport.js
AMQPTransport
function AMQPTransport(config) { this.id = config.id || null; this.url = config.url || (config.host && "amqp://" + config.host) || null; this['default'] = config['default'] || false; this.networkId = this.url; this.connection = null; this.config = config; }
javascript
function AMQPTransport(config) { this.id = config.id || null; this.url = config.url || (config.host && "amqp://" + config.host) || null; this['default'] = config['default'] || false; this.networkId = this.url; this.connection = null; this.config = config; }
[ "function", "AMQPTransport", "(", "config", ")", "{", "this", ".", "id", "=", "config", ".", "id", "||", "null", ";", "this", ".", "url", "=", "config", ".", "url", "||", "(", "config", ".", "host", "&&", "\"amqp://\"", "+", "config", ".", "host", ...
Use AMQP as transport @param {Object} config Config can contain the following properties: - `id: string` - `url: string` - `host: string` The config must contain either `url` or `host`. For example: {url: 'amqp://localhost'} or {host: 'dev.rabbitmq.com'} @constructor
[ "Use", "AMQP", "as", "transport" ]
f330edd3b637d3b1b5b086d9dd730b13e61a0cc0
https://github.com/enmasseio/evejs/blob/f330edd3b637d3b1b5b086d9dd730b13e61a0cc0/lib/transport/amqp/AMQPTransport.js#L18-L26
train
krampstudio/aja.js
src/aja.js
function(name, data){ var self = this; var eventCalls = function eventCalls(name, data){ if(events[name] instanceof Array){ events[name].forEach(function(event){ event.call(self, data); }); ...
javascript
function(name, data){ var self = this; var eventCalls = function eventCalls(name, data){ if(events[name] instanceof Array){ events[name].forEach(function(event){ event.call(self, data); }); ...
[ "function", "(", "name", ",", "data", ")", "{", "var", "self", "=", "this", ";", "var", "eventCalls", "=", "function", "eventCalls", "(", "name", ",", "data", ")", "{", "if", "(", "events", "[", "name", "]", "instanceof", "Array", ")", "{", "events",...
Trigger an event. This method will be called hardly ever outside Aja itself, but there is edge cases where it can be useful. @example aja().trigger('error', new Error('Emergency alert')); @param {String} name - the name of the event to trigger @param {*} data - arguments given to the handlers @returns {Aja} chains
[ "Trigger", "an", "event", ".", "This", "method", "will", "be", "called", "hardly", "ever", "outside", "Aja", "itself", "but", "there", "is", "edge", "cases", "where", "it", "can", "be", "useful", "." ]
127aa6d39c73c8b6455ec3de009e1c5da4aa003e
https://github.com/krampstudio/aja.js/blob/127aa6d39c73c8b6455ec3de009e1c5da4aa003e/src/aja.js#L334-L366
train
krampstudio/aja.js
src/aja.js
function(){ var type = data.type || (data.into ? 'html' : 'json'); var url = _buildQuery(); //delegates to ajaGo if(typeof ajaGo[type] === 'function'){ return ajaGo[type].call(this, url); } }
javascript
function(){ var type = data.type || (data.into ? 'html' : 'json'); var url = _buildQuery(); //delegates to ajaGo if(typeof ajaGo[type] === 'function'){ return ajaGo[type].call(this, url); } }
[ "function", "(", ")", "{", "var", "type", "=", "data", ".", "type", "||", "(", "data", ".", "into", "?", "'html'", ":", "'json'", ")", ";", "var", "url", "=", "_buildQuery", "(", ")", ";", "//delegates to ajaGo", "if", "(", "typeof", "ajaGo", "[", ...
Trigger the call. This is the end of your chain loop. @example aja() .url('data.json') .on('200', function(res){ //Yeah ! }) .go();
[ "Trigger", "the", "call", ".", "This", "is", "the", "end", "of", "your", "chain", "loop", "." ]
127aa6d39c73c8b6455ec3de009e1c5da4aa003e
https://github.com/krampstudio/aja.js/blob/127aa6d39c73c8b6455ec3de009e1c5da4aa003e/src/aja.js#L379-L388
train
krampstudio/aja.js
src/aja.js
function(url){ var self = this; ajaGo._xhr.call(this, url, function processRes(res){ if(res){ try { res = JSON.parse(res); } catch(e){ self.trigger('error', e); ...
javascript
function(url){ var self = this; ajaGo._xhr.call(this, url, function processRes(res){ if(res){ try { res = JSON.parse(res); } catch(e){ self.trigger('error', e); ...
[ "function", "(", "url", ")", "{", "var", "self", "=", "this", ";", "ajaGo", ".", "_xhr", ".", "call", "(", "this", ",", "url", ",", "function", "processRes", "(", "res", ")", "{", "if", "(", "res", ")", "{", "try", "{", "res", "=", "JSON", ".",...
XHR call to url to retrieve JSON @param {String} url - the url
[ "XHR", "call", "to", "url", "to", "retrieve", "JSON" ]
127aa6d39c73c8b6455ec3de009e1c5da4aa003e
https://github.com/krampstudio/aja.js/blob/127aa6d39c73c8b6455ec3de009e1c5da4aa003e/src/aja.js#L405-L419
train
krampstudio/aja.js
src/aja.js
function(url){ ajaGo._xhr.call(this, url, function processRes(res){ if(data.into && data.into.length){ [].forEach.call(data.into, function(elt){ elt.innerHTML = res; }); } ...
javascript
function(url){ ajaGo._xhr.call(this, url, function processRes(res){ if(data.into && data.into.length){ [].forEach.call(data.into, function(elt){ elt.innerHTML = res; }); } ...
[ "function", "(", "url", ")", "{", "ajaGo", ".", "_xhr", ".", "call", "(", "this", ",", "url", ",", "function", "processRes", "(", "res", ")", "{", "if", "(", "data", ".", "into", "&&", "data", ".", "into", ".", "length", ")", "{", "[", "]", "."...
XHR call to url to retrieve HTML and add it to a container if set. @param {String} url - the url
[ "XHR", "call", "to", "url", "to", "retrieve", "HTML", "and", "add", "it", "to", "a", "container", "if", "set", "." ]
127aa6d39c73c8b6455ec3de009e1c5da4aa003e
https://github.com/krampstudio/aja.js/blob/127aa6d39c73c8b6455ec3de009e1c5da4aa003e/src/aja.js#L425-L434
train
krampstudio/aja.js
src/aja.js
function(url, processRes){ var self = this; //iterators var key, header; var method = data.method || 'get'; var async = data.sync !== true; var request = new XMLHttpRequest(); var _data ...
javascript
function(url, processRes){ var self = this; //iterators var key, header; var method = data.method || 'get'; var async = data.sync !== true; var request = new XMLHttpRequest(); var _data ...
[ "function", "(", "url", ",", "processRes", ")", "{", "var", "self", "=", "this", ";", "//iterators", "var", "key", ",", "header", ";", "var", "method", "=", "data", ".", "method", "||", "'get'", ";", "var", "async", "=", "data", ".", "sync", "!==", ...
Create and send an XHR query. @param {String} url - the url @param {Function} processRes - to modify / process the response before sent to events.
[ "Create", "and", "send", "an", "XHR", "query", "." ]
127aa6d39c73c8b6455ec3de009e1c5da4aa003e
https://github.com/krampstudio/aja.js/blob/127aa6d39c73c8b6455ec3de009e1c5da4aa003e/src/aja.js#L441-L546
train
krampstudio/aja.js
src/aja.js
function(url){ var self = this; var head = document.querySelector('head') || document.querySelector('body'); var async = data.sync !== true; var script; if(!head){ throw new Error('Ok, wait a second, you want t...
javascript
function(url){ var self = this; var head = document.querySelector('head') || document.querySelector('body'); var async = data.sync !== true; var script; if(!head){ throw new Error('Ok, wait a second, you want t...
[ "function", "(", "url", ")", "{", "var", "self", "=", "this", ";", "var", "head", "=", "document", ".", "querySelector", "(", "'head'", ")", "||", "document", ".", "querySelector", "(", "'body'", ")", ";", "var", "async", "=", "data", ".", "sync", "!...
Loads a script. This kind of ugly script loading is sometimes used by 3rd part libraries to load a configured script. For example, to embed google analytics or a twitter button. @this {Aja} call bound to the Aja context @param {String} url - the url
[ "Loads", "a", "script", "." ]
127aa6d39c73c8b6455ec3de009e1c5da4aa003e
https://github.com/krampstudio/aja.js/blob/127aa6d39c73c8b6455ec3de009e1c5da4aa003e/src/aja.js#L599-L622
train
krampstudio/aja.js
src/aja.js
_buildQuery
function _buildQuery(){ var url = data.url; var cache = typeof data.cache !== 'undefined' ? !!data.cache : true; var queryString = data.queryString || ''; var _data = data.data; //add a cache buster if(cache === false){ ...
javascript
function _buildQuery(){ var url = data.url; var cache = typeof data.cache !== 'undefined' ? !!data.cache : true; var queryString = data.queryString || ''; var _data = data.data; //add a cache buster if(cache === false){ ...
[ "function", "_buildQuery", "(", ")", "{", "var", "url", "=", "data", ".", "url", ";", "var", "cache", "=", "typeof", "data", ".", "cache", "!==", "'undefined'", "?", "!", "!", "data", ".", "cache", ":", "true", ";", "var", "queryString", "=", "data",...
Build the URL to run the request against. @private @memberof aja @returns {String} the URL
[ "Build", "the", "URL", "to", "run", "the", "request", "against", "." ]
127aa6d39c73c8b6455ec3de009e1c5da4aa003e
https://github.com/krampstudio/aja.js/blob/127aa6d39c73c8b6455ec3de009e1c5da4aa003e/src/aja.js#L672-L690
train
krampstudio/aja.js
src/aja.js
function(params){ var object = {}; if(typeof params === 'string'){ params.replace('?', '').split('&').forEach(function(kv){ var pair = kv.split('='); if(pair.length === 2){ object[decodeURIComponent(pair[0])] = deco...
javascript
function(params){ var object = {}; if(typeof params === 'string'){ params.replace('?', '').split('&').forEach(function(kv){ var pair = kv.split('='); if(pair.length === 2){ object[decodeURIComponent(pair[0])] = deco...
[ "function", "(", "params", ")", "{", "var", "object", "=", "{", "}", ";", "if", "(", "typeof", "params", "===", "'string'", ")", "{", "params", ".", "replace", "(", "'?'", ",", "''", ")", ".", "split", "(", "'&'", ")", ".", "forEach", "(", "funct...
Check the queryString, and create an object if a string is given. @param {String|Object} params @returns {Object} key/value based queryString @throws {TypeError} if wrong params type or if the string isn't parseable
[ "Check", "the", "queryString", "and", "create", "an", "object", "if", "a", "string", "is", "given", "." ]
127aa6d39c73c8b6455ec3de009e1c5da4aa003e
https://github.com/krampstudio/aja.js/blob/127aa6d39c73c8b6455ec3de009e1c5da4aa003e/src/aja.js#L786-L800
train
krampstudio/aja.js
src/aja.js
function(functionName){ functionName = this.string(functionName); if(!/^([a-zA-Z_])([a-zA-Z0-9_\-])+$/.test(functionName)){ throw new TypeError('a valid function name is expected, ' + functionName + ' [' + (typeof functionName) + '] given'); } return funct...
javascript
function(functionName){ functionName = this.string(functionName); if(!/^([a-zA-Z_])([a-zA-Z0-9_\-])+$/.test(functionName)){ throw new TypeError('a valid function name is expected, ' + functionName + ' [' + (typeof functionName) + '] given'); } return funct...
[ "function", "(", "functionName", ")", "{", "functionName", "=", "this", ".", "string", "(", "functionName", ")", ";", "if", "(", "!", "/", "^([a-zA-Z_])([a-zA-Z0-9_\\-])+$", "/", ".", "test", "(", "functionName", ")", ")", "{", "throw", "new", "TypeError", ...
Check if the parameter is a valid JavaScript function name. @param {String} functionName @returns {String} same as input if valid @throws {TypeError} check it's a string and a valid name against the pattern inside.
[ "Check", "if", "the", "parameter", "is", "a", "valid", "JavaScript", "function", "name", "." ]
127aa6d39c73c8b6455ec3de009e1c5da4aa003e
https://github.com/krampstudio/aja.js/blob/127aa6d39c73c8b6455ec3de009e1c5da4aa003e/src/aja.js#L823-L829
train
krampstudio/aja.js
Gruntfile.js
function(req, res, next) { if (/aja\.js$/.test(req.url)) { return res.end(grunt.file.read(coverageDir + '/instrument/src/aja.js')); } return next(); }
javascript
function(req, res, next) { if (/aja\.js$/.test(req.url)) { return res.end(grunt.file.read(coverageDir + '/instrument/src/aja.js')); } return next(); }
[ "function", "(", "req", ",", "res", ",", "next", ")", "{", "if", "(", "/", "aja\\.js$", "/", ".", "test", "(", "req", ".", "url", ")", ")", "{", "return", "res", ".", "end", "(", "grunt", ".", "file", ".", "read", "(", "coverageDir", "+", "'/in...
to serve instrumented code to the tests runners
[ "to", "serve", "instrumented", "code", "to", "the", "tests", "runners" ]
127aa6d39c73c8b6455ec3de009e1c5da4aa003e
https://github.com/krampstudio/aja.js/blob/127aa6d39c73c8b6455ec3de009e1c5da4aa003e/Gruntfile.js#L61-L66
train
NightfallAlicorn/urban-dictionary
urban-dictionary.js
get
function get (url, callback) { // https://nodejs.org/dist/latest-v8.x/docs/api/http.html#http_http_get_options_callback http.get(url, (result) => { const contentType = result.headers['content-type'] const statusCode = result.statusCode let error if (statusCode !== 200) { error = new Error(`U...
javascript
function get (url, callback) { // https://nodejs.org/dist/latest-v8.x/docs/api/http.html#http_http_get_options_callback http.get(url, (result) => { const contentType = result.headers['content-type'] const statusCode = result.statusCode let error if (statusCode !== 200) { error = new Error(`U...
[ "function", "get", "(", "url", ",", "callback", ")", "{", "// https://nodejs.org/dist/latest-v8.x/docs/api/http.html#http_http_get_options_callback", "http", ".", "get", "(", "url", ",", "(", "result", ")", "=>", "{", "const", "contentType", "=", "result", ".", "hea...
Retrieves a JSON parsed object. @param {string} url The full URL to retrieve from. @param {function(error, object):void} callback * argument[0] {error} error * argument[1] {object} Parsed JSON result.
[ "Retrieves", "a", "JSON", "parsed", "object", "." ]
bede6af15644c22841e22c03445e0a697f0fd32f
https://github.com/NightfallAlicorn/urban-dictionary/blob/bede6af15644c22841e22c03445e0a697f0fd32f/urban-dictionary.js#L30-L77
train
torifat/flowtype-loader
lib/flowResult.js
difference
function difference(a, b) { var oldHashes = {}; var errors = []; var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = b.errors[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorN...
javascript
function difference(a, b) { var oldHashes = {}; var errors = []; var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = b.errors[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorN...
[ "function", "difference", "(", "a", ",", "b", ")", "{", "var", "oldHashes", "=", "{", "}", ";", "var", "errors", "=", "[", "]", ";", "var", "_iteratorNormalCompletion", "=", "true", ";", "var", "_didIteratorError", "=", "false", ";", "var", "_iteratorErr...
Returns a result that is a - b
[ "Returns", "a", "result", "that", "is", "a", "-", "b" ]
7334a152e215dbd43cd86f7ea18e5cf1d9c5d714
https://github.com/torifat/flowtype-loader/blob/7334a152e215dbd43cd86f7ea18e5cf1d9c5d714/lib/flowResult.js#L28-L91
train
wdamien/node-easel
src/easeljs/filters/ColorFilter.js
function(redMultiplier, greenMultiplier, blueMultiplier, alphaMultiplier, redOffset, greenOffset, blueOffset, alphaOffset) { this.initialize(redMultiplier, greenMultiplier, blueMultiplier, alphaMultiplier, redOffset, greenOffset, blueOffset, alphaOffset); }
javascript
function(redMultiplier, greenMultiplier, blueMultiplier, alphaMultiplier, redOffset, greenOffset, blueOffset, alphaOffset) { this.initialize(redMultiplier, greenMultiplier, blueMultiplier, alphaMultiplier, redOffset, greenOffset, blueOffset, alphaOffset); }
[ "function", "(", "redMultiplier", ",", "greenMultiplier", ",", "blueMultiplier", ",", "alphaMultiplier", ",", "redOffset", ",", "greenOffset", ",", "blueOffset", ",", "alphaOffset", ")", "{", "this", ".", "initialize", "(", "redMultiplier", ",", "greenMultiplier", ...
Applies a color transform to DisplayObjects. <h4>Example</h4> This example draws a red circle, and then transforms it to Blue. This is accomplished by multiplying all the channels to 0 (except alpha, which is set to 1), and then adding 255 to the blue channel. var shape = new createjs.Shape().set({x:100,y:100}); shap...
[ "Applies", "a", "color", "transform", "to", "DisplayObjects", "." ]
51a06f359f52f539c97219e4528340ae5d5bae1c
https://github.com/wdamien/node-easel/blob/51a06f359f52f539c97219e4528340ae5d5bae1c/src/easeljs/filters/ColorFilter.js#L71-L73
train
bluejava/zousan
src/zousan.js
resolveClient
function resolveClient(c,arg) { if(typeof c.y === "function") { try { var yret = c.y.call(_undefined,arg); c.p.resolve(yret); } catch(err) { c.p.reject(err) } } else c.p.resolve(arg); // pass this along... }
javascript
function resolveClient(c,arg) { if(typeof c.y === "function") { try { var yret = c.y.call(_undefined,arg); c.p.resolve(yret); } catch(err) { c.p.reject(err) } } else c.p.resolve(arg); // pass this along... }
[ "function", "resolveClient", "(", "c", ",", "arg", ")", "{", "if", "(", "typeof", "c", ".", "y", "===", "\"function\"", ")", "{", "try", "{", "var", "yret", "=", "c", ".", "y", ".", "call", "(", "_undefined", ",", "arg", ")", ";", "c", ".", "p"...
END of prototype function list
[ "END", "of", "prototype", "function", "list" ]
f295935672f91ac46cf681414491143c0ae4390f
https://github.com/bluejava/zousan/blob/f295935672f91ac46cf681414491143c0ae4390f/src/zousan.js#L246-L258
train
bluejava/zousan
src/zousan.js
rp
function rp(p,i) { if(!p || typeof p.then !== "function") p = Zousan.resolve(p); p.then( function(yv) { results[i] = yv; rc++; if(rc == pa.length) retP.resolve(results); }, function(nv) { retP.reject(nv); } ); }
javascript
function rp(p,i) { if(!p || typeof p.then !== "function") p = Zousan.resolve(p); p.then( function(yv) { results[i] = yv; rc++; if(rc == pa.length) retP.resolve(results); }, function(nv) { retP.reject(nv); } ); }
[ "function", "rp", "(", "p", ",", "i", ")", "{", "if", "(", "!", "p", "||", "typeof", "p", ".", "then", "!==", "\"function\"", ")", "p", "=", "Zousan", ".", "resolve", "(", "p", ")", ";", "p", ".", "then", "(", "function", "(", "yv", ")", "{",...
results and resolved count
[ "results", "and", "resolved", "count" ]
f295935672f91ac46cf681414491143c0ae4390f
https://github.com/bluejava/zousan/blob/f295935672f91ac46cf681414491143c0ae4390f/src/zousan.js#L290-L298
train
eeue56/elm-static-html
index.js
function(workingDir, elmPackage){ elmPackage['native-modules'] = true; var sources = elmPackage['source-directories'].map(function(dir){ return path.join(workingDir, dir); }); sources.push('.'); elmPackage['source-directories'] = sources; elmPackage['dependencies']["eeue56/elm-html-in-e...
javascript
function(workingDir, elmPackage){ elmPackage['native-modules'] = true; var sources = elmPackage['source-directories'].map(function(dir){ return path.join(workingDir, dir); }); sources.push('.'); elmPackage['source-directories'] = sources; elmPackage['dependencies']["eeue56/elm-html-in-e...
[ "function", "(", "workingDir", ",", "elmPackage", ")", "{", "elmPackage", "[", "'native-modules'", "]", "=", "true", ";", "var", "sources", "=", "elmPackage", "[", "'source-directories'", "]", ".", "map", "(", "function", "(", "dir", ")", "{", "return", "p...
fix an elm package file so that it will work with our project and install our deps
[ "fix", "an", "elm", "package", "file", "so", "that", "it", "will", "work", "with", "our", "project", "and", "install", "our", "deps" ]
e3ad85b0d06c0baabf9c7de38bf98a53e2fb0fae
https://github.com/eeue56/elm-static-html/blob/e3ad85b0d06c0baabf9c7de38bf98a53e2fb0fae/index.js#L152-L163
train
jonschlinkert/object-copy
index.js
has
function has(obj, val) { val = arrayify(val); var len = val.length; if (isObject(obj)) { for (var key in obj) { if (val.indexOf(key) > -1) { return true; } } var keys = nativeKeys(obj); return has(keys, val); } if (Array.isArray(obj)) { var arr = obj; while (len-...
javascript
function has(obj, val) { val = arrayify(val); var len = val.length; if (isObject(obj)) { for (var key in obj) { if (val.indexOf(key) > -1) { return true; } } var keys = nativeKeys(obj); return has(keys, val); } if (Array.isArray(obj)) { var arr = obj; while (len-...
[ "function", "has", "(", "obj", ",", "val", ")", "{", "val", "=", "arrayify", "(", "val", ")", ";", "var", "len", "=", "val", ".", "length", ";", "if", "(", "isObject", "(", "obj", ")", ")", "{", "for", "(", "var", "key", "in", "obj", ")", "{"...
Returns true if an array has any of the given elements, or an object has any of the given keys. ```js has(['a', 'b', 'c'], 'c'); //=> true has(['a', 'b', 'c'], ['c', 'z']); //=> true has({a: 'b', c: 'd'}, ['c', 'z']); //=> true ``` @param {Object} `obj` @param {String|Array} `val` @return {Boolean}
[ "Returns", "true", "if", "an", "array", "has", "any", "of", "the", "given", "elements", "or", "an", "object", "has", "any", "of", "the", "given", "keys", "." ]
45c79022e7b56e2f6456cac9ff44d6876fc7738b
https://github.com/jonschlinkert/object-copy/blob/45c79022e7b56e2f6456cac9ff44d6876fc7738b/index.js#L91-L117
train
rictorres/node-rpm-builder
index.js
setupTempDir
function setupTempDir(tmpDir) { var rpmStructure = ['BUILD', 'BUILDROOT', 'RPMS', 'SOURCES', 'SPECS', 'SRPMS']; // If the tmpDir exists (probably from previous build), delete it first if (fsx.existsSync(tmpDir)) { logger(chalk.cyan('Removing old temporary directory.')); fsx.removeSync(tmpDir); } // ...
javascript
function setupTempDir(tmpDir) { var rpmStructure = ['BUILD', 'BUILDROOT', 'RPMS', 'SOURCES', 'SPECS', 'SRPMS']; // If the tmpDir exists (probably from previous build), delete it first if (fsx.existsSync(tmpDir)) { logger(chalk.cyan('Removing old temporary directory.')); fsx.removeSync(tmpDir); } // ...
[ "function", "setupTempDir", "(", "tmpDir", ")", "{", "var", "rpmStructure", "=", "[", "'BUILD'", ",", "'BUILDROOT'", ",", "'RPMS'", ",", "'SOURCES'", ",", "'SPECS'", ",", "'SRPMS'", "]", ";", "// If the tmpDir exists (probably from previous build), delete it first", "...
Creates the folder structure needed to create the RPM package. @param {String} tmpDir the path where the folder structure will reside
[ "Creates", "the", "folder", "structure", "needed", "to", "create", "the", "RPM", "package", "." ]
883b04cab50640b17332d9f51cfb1f2d32c96996
https://github.com/rictorres/node-rpm-builder/blob/883b04cab50640b17332d9f51cfb1f2d32c96996/index.js#L21-L35
train
rictorres/node-rpm-builder
index.js
buildRpm
function buildRpm(buildRoot, specFile, rpmDest, execOpts, cb) { // Build the RPM package. var cmd = [ 'rpmbuild', '-bb', '-vv', '--buildroot', buildRoot, specFile ].join(' '); logger(chalk.cyan('Executing:'), cmd); execOpts = execOpts || {}; exec(cmd, execOpts, function rpmbuild(e...
javascript
function buildRpm(buildRoot, specFile, rpmDest, execOpts, cb) { // Build the RPM package. var cmd = [ 'rpmbuild', '-bb', '-vv', '--buildroot', buildRoot, specFile ].join(' '); logger(chalk.cyan('Executing:'), cmd); execOpts = execOpts || {}; exec(cmd, execOpts, function rpmbuild(e...
[ "function", "buildRpm", "(", "buildRoot", ",", "specFile", ",", "rpmDest", ",", "execOpts", ",", "cb", ")", "{", "// Build the RPM package.", "var", "cmd", "=", "[", "'rpmbuild'", ",", "'-bb'", ",", "'-vv'", ",", "'--buildroot'", ",", "buildRoot", ",", "spec...
Runs the rpmbuild tool in a child process. @param {String} buildRoot where all included files reside @param {String} specFile path to the file from which the RPM package will be created @param {String} rpmDest where the .rpm file should be copied to @param {Function} cb callback function to be ...
[ "Runs", "the", "rpmbuild", "tool", "in", "a", "child", "process", "." ]
883b04cab50640b17332d9f51cfb1f2d32c96996
https://github.com/rictorres/node-rpm-builder/blob/883b04cab50640b17332d9f51cfb1f2d32c96996/index.js#L117-L154
train
inikulin/dmn
lib/gen.js
parseIgnoreFile
function parseIgnoreFile(ignoreFile) { // At first we'll try to determine line endings for ignore file. // For this we will count \n and \r\n occurrences and choose the one // which dominates. If we don't have line endings at all we will keep // default OS line endings. var lfCount = countOccurrence...
javascript
function parseIgnoreFile(ignoreFile) { // At first we'll try to determine line endings for ignore file. // For this we will count \n and \r\n occurrences and choose the one // which dominates. If we don't have line endings at all we will keep // default OS line endings. var lfCount = countOccurrence...
[ "function", "parseIgnoreFile", "(", "ignoreFile", ")", "{", "// At first we'll try to determine line endings for ignore file.", "// For this we will count \\n and \\r\\n occurrences and choose the one", "// which dominates. If we don't have line endings at all we will keep", "// default OS line en...
Extract .npmignore file patterns
[ "Extract", ".", "npmignore", "file", "patterns" ]
eda5cadfc5f83aa45062073f2a1ae8e6edc2cb9b
https://github.com/inikulin/dmn/blob/eda5cadfc5f83aa45062073f2a1ae8e6edc2cb9b/lib/gen.js#L43-L72
train
inikulin/dmn
lib/clean.js
getCleanTargets
function getCleanTargets() { var directDeps = targets.map(function (pattern) { return '*/' + pattern; }), indirectDeps = targets.map(function (pattern) { return '**/node_modules/*/' + pattern; }); return directDeps.concat(indirectDeps); }
javascript
function getCleanTargets() { var directDeps = targets.map(function (pattern) { return '*/' + pattern; }), indirectDeps = targets.map(function (pattern) { return '**/node_modules/*/' + pattern; }); return directDeps.concat(indirectDeps); }
[ "function", "getCleanTargets", "(", ")", "{", "var", "directDeps", "=", "targets", ".", "map", "(", "function", "(", "pattern", ")", "{", "return", "'*/'", "+", "pattern", ";", "}", ")", ",", "indirectDeps", "=", "targets", ".", "map", "(", "function", ...
Create array of patterns which will be used for cleaning
[ "Create", "array", "of", "patterns", "which", "will", "be", "used", "for", "cleaning" ]
eda5cadfc5f83aa45062073f2a1ae8e6edc2cb9b
https://github.com/inikulin/dmn/blob/eda5cadfc5f83aa45062073f2a1ae8e6edc2cb9b/lib/clean.js#L45-L55
train
la-haute-societe/ssh-deploy-release
dist/logger.js
logFatal
function logFatal(message) { console.log(os.EOL + chalk.red.bold('Fatal error : ' + message)); process.exit(1); }
javascript
function logFatal(message) { console.log(os.EOL + chalk.red.bold('Fatal error : ' + message)); process.exit(1); }
[ "function", "logFatal", "(", "message", ")", "{", "console", ".", "log", "(", "os", ".", "EOL", "+", "chalk", ".", "red", ".", "bold", "(", "'Fatal error : '", "+", "message", ")", ")", ";", "process", ".", "exit", "(", "1", ")", ";", "}" ]
Log fatal error and exit process @param message
[ "Log", "fatal", "error", "and", "exit", "process" ]
d0e8683f7bd474ba59b3af06b5cefb5e5ff7d669
https://github.com/la-haute-societe/ssh-deploy-release/blob/d0e8683f7bd474ba59b3af06b5cefb5e5ff7d669/dist/logger.js#L34-L37
train
la-haute-societe/ssh-deploy-release
dist/logger.js
logDebug
function logDebug(message) { if (!debug) { return; } if (!enabled) return; console.log(os.EOL + chalk.cyan(message)); }
javascript
function logDebug(message) { if (!debug) { return; } if (!enabled) return; console.log(os.EOL + chalk.cyan(message)); }
[ "function", "logDebug", "(", "message", ")", "{", "if", "(", "!", "debug", ")", "{", "return", ";", "}", "if", "(", "!", "enabled", ")", "return", ";", "console", ".", "log", "(", "os", ".", "EOL", "+", "chalk", ".", "cyan", "(", "message", ")", ...
Log only if debug is enabled @param message
[ "Log", "only", "if", "debug", "is", "enabled" ]
d0e8683f7bd474ba59b3af06b5cefb5e5ff7d669
https://github.com/la-haute-societe/ssh-deploy-release/blob/d0e8683f7bd474ba59b3af06b5cefb5e5ff7d669/dist/logger.js#L74-L81
train
mikolalysenko/bit-twiddle
twiddle.js
countTrailingZeros
function countTrailingZeros(v) { var c = 32; v &= -v; if (v) c--; if (v & 0x0000FFFF) c -= 16; if (v & 0x00FF00FF) c -= 8; if (v & 0x0F0F0F0F) c -= 4; if (v & 0x33333333) c -= 2; if (v & 0x55555555) c -= 1; return c; }
javascript
function countTrailingZeros(v) { var c = 32; v &= -v; if (v) c--; if (v & 0x0000FFFF) c -= 16; if (v & 0x00FF00FF) c -= 8; if (v & 0x0F0F0F0F) c -= 4; if (v & 0x33333333) c -= 2; if (v & 0x55555555) c -= 1; return c; }
[ "function", "countTrailingZeros", "(", "v", ")", "{", "var", "c", "=", "32", ";", "v", "&=", "-", "v", ";", "if", "(", "v", ")", "c", "--", ";", "if", "(", "v", "&", "0x0000FFFF", ")", "c", "-=", "16", ";", "if", "(", "v", "&", "0x00FF00FF", ...
Counts number of trailing zeros
[ "Counts", "number", "of", "trailing", "zeros" ]
0c4c32db753108c5ec7e3779d35eb103be8e7ee1
https://github.com/mikolalysenko/bit-twiddle/blob/0c4c32db753108c5ec7e3779d35eb103be8e7ee1/twiddle.js#L71-L81
train
therne/instauuid
index.js
generate
function generate(options) { options = options || {}; if (typeof options === 'string') options = { type: options }; var type = paramDefault(options.type, 'base64'); var additional = paramDefault(options.additional, 0); var count = paramDefault(options.countNumber, parseInt(Math.ra...
javascript
function generate(options) { options = options || {}; if (typeof options === 'string') options = { type: options }; var type = paramDefault(options.type, 'base64'); var additional = paramDefault(options.additional, 0); var count = paramDefault(options.countNumber, parseInt(Math.ra...
[ "function", "generate", "(", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "if", "(", "typeof", "options", "===", "'string'", ")", "options", "=", "{", "type", ":", "options", "}", ";", "var", "type", "=", "paramDefault", "(", ...
Generate Insta-UUID.
[ "Generate", "Insta", "-", "UUID", "." ]
cbdd586d38a1fff66520c6c814ab0c2d737536d4
https://github.com/therne/instauuid/blob/cbdd586d38a1fff66520c6c814ab0c2d737536d4/index.js#L29-L69
train
guness/node-xcs
google/Message.js
Message
function Message(messageId) { if (util.isNullOrUndefined(messageId) || "string" !== typeof(messageId)) { throw new IllegalArgumentException(); } /** * This parameter uniquely identifies a message in an XMPP connection. */ this.mMessageId = messageId; this.mCollapseKey =...
javascript
function Message(messageId) { if (util.isNullOrUndefined(messageId) || "string" !== typeof(messageId)) { throw new IllegalArgumentException(); } /** * This parameter uniquely identifies a message in an XMPP connection. */ this.mMessageId = messageId; this.mCollapseKey =...
[ "function", "Message", "(", "messageId", ")", "{", "if", "(", "util", ".", "isNullOrUndefined", "(", "messageId", ")", "||", "\"string\"", "!==", "typeof", "(", "messageId", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "/*...
FCM message. <p> Instances of this class should be immutable. In order to accomplish, build method must be called lastly {@link #build}. Examples: <pre><code> var Message = require('node-xcs').Message; </pre></code> <strong>Simplest message:</strong> <pre><code> var message = new Message("<messageId>").build(); </pr...
[ "FCM", "message", "." ]
667316e8822275e70c3329ca0553b6e1292eee78
https://github.com/guness/node-xcs/blob/667316e8822275e70c3329ca0553b6e1292eee78/google/Message.js#L49-L71
train
bitgamma/tlv
lib/tlv.js
getTagLength
function getTagLength(tag) { var lenTag = 4; while(lenTag > 1) { var tmpTag = tag >>> ((lenTag - 1) * 8); if ((tmpTag & 0xFF) != 0x00) { break; } lenTag--; } return lenTag; }
javascript
function getTagLength(tag) { var lenTag = 4; while(lenTag > 1) { var tmpTag = tag >>> ((lenTag - 1) * 8); if ((tmpTag & 0xFF) != 0x00) { break; } lenTag--; } return lenTag; }
[ "function", "getTagLength", "(", "tag", ")", "{", "var", "lenTag", "=", "4", ";", "while", "(", "lenTag", ">", "1", ")", "{", "var", "tmpTag", "=", "tag", ">>>", "(", "(", "lenTag", "-", "1", ")", "*", "8", ")", ";", "if", "(", "(", "tmpTag", ...
Returns the byte length of the given tag. @param {number} tag @return {number}
[ "Returns", "the", "byte", "length", "of", "the", "given", "tag", "." ]
81fe19496fa9614caa3d8e53853116c6233d31dc
https://github.com/bitgamma/tlv/blob/81fe19496fa9614caa3d8e53853116c6233d31dc/lib/tlv.js#L314-L328
train
bitgamma/tlv
lib/tlv.js
getValueLength
function getValueLength(value, constructed) { var lenValue = 0; if (constructed) { for (var i = 0; i < value.length; i++) { lenValue = lenValue + value[i].byteLength; } } else { lenValue = value.length; } return lenValue; }
javascript
function getValueLength(value, constructed) { var lenValue = 0; if (constructed) { for (var i = 0; i < value.length; i++) { lenValue = lenValue + value[i].byteLength; } } else { lenValue = value.length; } return lenValue; }
[ "function", "getValueLength", "(", "value", ",", "constructed", ")", "{", "var", "lenValue", "=", "0", ";", "if", "(", "constructed", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "value", ".", "length", ";", "i", "++", ")", "{", "le...
Returns the byte length of the given value. Value can be either a Buffer or an array of TLVs. @param {object} value @param {boolean} constructed @return {number}
[ "Returns", "the", "byte", "length", "of", "the", "given", "value", ".", "Value", "can", "be", "either", "a", "Buffer", "or", "an", "array", "of", "TLVs", "." ]
81fe19496fa9614caa3d8e53853116c6233d31dc
https://github.com/bitgamma/tlv/blob/81fe19496fa9614caa3d8e53853116c6233d31dc/lib/tlv.js#L338-L350
train
bitgamma/tlv
lib/tlv.js
getLengthOfLength
function getLengthOfLength(lenValue, indefiniteLength) { var lenOfLen; if (indefiniteLength) { lenOfLen = 3; } else if (lenValue > 0x00FFFFFF) { lenOfLen = 5; } else if (lenValue > 0x0000FFFF) { lenOfLen = 4; } else if (lenValue > 0x000000FF) { lenOfLen = 3; } else if (lenValue > 0x000000...
javascript
function getLengthOfLength(lenValue, indefiniteLength) { var lenOfLen; if (indefiniteLength) { lenOfLen = 3; } else if (lenValue > 0x00FFFFFF) { lenOfLen = 5; } else if (lenValue > 0x0000FFFF) { lenOfLen = 4; } else if (lenValue > 0x000000FF) { lenOfLen = 3; } else if (lenValue > 0x000000...
[ "function", "getLengthOfLength", "(", "lenValue", ",", "indefiniteLength", ")", "{", "var", "lenOfLen", ";", "if", "(", "indefiniteLength", ")", "{", "lenOfLen", "=", "3", ";", "}", "else", "if", "(", "lenValue", ">", "0x00FFFFFF", ")", "{", "lenOfLen", "=...
Returns the number of bytes needed to encode the given length. If the length is indefinite, this value takes in account the bytes needed to encode the EOC tag. @param {number} lenValue @param {boolean} indefiniteLength @return {number}
[ "Returns", "the", "number", "of", "bytes", "needed", "to", "encode", "the", "given", "length", ".", "If", "the", "length", "is", "indefinite", "this", "value", "takes", "in", "account", "the", "bytes", "needed", "to", "encode", "the", "EOC", "tag", "." ]
81fe19496fa9614caa3d8e53853116c6233d31dc
https://github.com/bitgamma/tlv/blob/81fe19496fa9614caa3d8e53853116c6233d31dc/lib/tlv.js#L360-L378
train
bitgamma/tlv
lib/tlv.js
encodeNumber
function encodeNumber(buf, value, len) { var index = 0; while (len > 0) { var tmpValue = value >>> ((len - 1) * 8); buf[index++] = tmpValue & 0xFF; len--; } }
javascript
function encodeNumber(buf, value, len) { var index = 0; while (len > 0) { var tmpValue = value >>> ((len - 1) * 8); buf[index++] = tmpValue & 0xFF; len--; } }
[ "function", "encodeNumber", "(", "buf", ",", "value", ",", "len", ")", "{", "var", "index", "=", "0", ";", "while", "(", "len", ">", "0", ")", "{", "var", "tmpValue", "=", "value", ">>>", "(", "(", "len", "-", "1", ")", "*", "8", ")", ";", "b...
Encodes the given numeric value in the given Buffer, using the specified number of bytes. @param {Buffer} buf @param {number} value @param {number} len
[ "Encodes", "the", "given", "numeric", "value", "in", "the", "given", "Buffer", "using", "the", "specified", "number", "of", "bytes", "." ]
81fe19496fa9614caa3d8e53853116c6233d31dc
https://github.com/bitgamma/tlv/blob/81fe19496fa9614caa3d8e53853116c6233d31dc/lib/tlv.js#L387-L395
train
bitgamma/tlv
lib/tlv.js
parseTag
function parseTag(buf) { var index = 0; var tag = buf[index++]; var constructed = (tag & 0x20) == 0x20; if ((tag & 0x1F) == 0x1F) { do { tag = tag << 8; tag = tag | buf[index++]; } while((tag & 0x80) == 0x80); if (index > 4) { throw new RangeError("The length of the tag c...
javascript
function parseTag(buf) { var index = 0; var tag = buf[index++]; var constructed = (tag & 0x20) == 0x20; if ((tag & 0x1F) == 0x1F) { do { tag = tag << 8; tag = tag | buf[index++]; } while((tag & 0x80) == 0x80); if (index > 4) { throw new RangeError("The length of the tag c...
[ "function", "parseTag", "(", "buf", ")", "{", "var", "index", "=", "0", ";", "var", "tag", "=", "buf", "[", "index", "++", "]", ";", "var", "constructed", "=", "(", "tag", "&", "0x20", ")", "==", "0x20", ";", "if", "(", "(", "tag", "&", "0x1F",...
Parses the first bytes of the given Buffer as a TLV tag. The tag is returned as an object containing the tag, its length in bytes and whether it is constructed or not. @param {Buffer} buf @return {object}
[ "Parses", "the", "first", "bytes", "of", "the", "given", "Buffer", "as", "a", "TLV", "tag", ".", "The", "tag", "is", "returned", "as", "an", "object", "containing", "the", "tag", "its", "length", "in", "bytes", "and", "whether", "it", "is", "constructed"...
81fe19496fa9614caa3d8e53853116c6233d31dc
https://github.com/bitgamma/tlv/blob/81fe19496fa9614caa3d8e53853116c6233d31dc/lib/tlv.js#L404-L420
train
bitgamma/tlv
lib/tlv.js
parseAllTags
function parseAllTags(buf) { var result = []; var element; while (buf.length > 0) { element = parseTag(buf); buf = buf.slice(element.length); result.push(element.tag); } return result; }
javascript
function parseAllTags(buf) { var result = []; var element; while (buf.length > 0) { element = parseTag(buf); buf = buf.slice(element.length); result.push(element.tag); } return result; }
[ "function", "parseAllTags", "(", "buf", ")", "{", "var", "result", "=", "[", "]", ";", "var", "element", ";", "while", "(", "buf", ".", "length", ">", "0", ")", "{", "element", "=", "parseTag", "(", "buf", ")", ";", "buf", "=", "buf", ".", "slice...
Parses the entire Buffer as a sequence of TLV tags. The tags are returned in an array, containing their numeric values. @param {Buffer} buf @return {Array}
[ "Parses", "the", "entire", "Buffer", "as", "a", "sequence", "of", "TLV", "tags", ".", "The", "tags", "are", "returned", "in", "an", "array", "containing", "their", "numeric", "values", "." ]
81fe19496fa9614caa3d8e53853116c6233d31dc
https://github.com/bitgamma/tlv/blob/81fe19496fa9614caa3d8e53853116c6233d31dc/lib/tlv.js#L429-L440
train
bitgamma/tlv
lib/tlv.js
encodeTags
function encodeTags(tags) { var bufLength = 0; var tagLengths = [] for (var i = 0; i < tags.length; i++) { var tagLength = getTagLength(tags[i]); tagLengths.push(tagLength); bufLength += tagLength; } var buf = new Buffer(bufLength); var slicedBuf = buf; for (var i = 0; i < tags.length...
javascript
function encodeTags(tags) { var bufLength = 0; var tagLengths = [] for (var i = 0; i < tags.length; i++) { var tagLength = getTagLength(tags[i]); tagLengths.push(tagLength); bufLength += tagLength; } var buf = new Buffer(bufLength); var slicedBuf = buf; for (var i = 0; i < tags.length...
[ "function", "encodeTags", "(", "tags", ")", "{", "var", "bufLength", "=", "0", ";", "var", "tagLengths", "=", "[", "]", "for", "(", "var", "i", "=", "0", ";", "i", "<", "tags", ".", "length", ";", "i", "++", ")", "{", "var", "tagLength", "=", "...
Encodes an array of tags in a new Buffer. @param {Array} tags @return {Buffer}
[ "Encodes", "an", "array", "of", "tags", "in", "a", "new", "Buffer", "." ]
81fe19496fa9614caa3d8e53853116c6233d31dc
https://github.com/bitgamma/tlv/blob/81fe19496fa9614caa3d8e53853116c6233d31dc/lib/tlv.js#L448-L467
train
guness/node-xcs
google/Notification.js
Notification
function Notification(icon) { if (util.isNullOrUndefined(icon)) { throw new IllegalArgumentException(); } this.mTitle = null; this.mBody = null; this.mIcon = icon; this.mSound = "default"; // the only currently supported value this.mBadge = null; this.mTag = null; ...
javascript
function Notification(icon) { if (util.isNullOrUndefined(icon)) { throw new IllegalArgumentException(); } this.mTitle = null; this.mBody = null; this.mIcon = icon; this.mSound = "default"; // the only currently supported value this.mBadge = null; this.mTag = null; ...
[ "function", "Notification", "(", "icon", ")", "{", "if", "(", "util", ".", "isNullOrUndefined", "(", "icon", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "this", ".", "mTitle", "=", "null", ";", "this", ".", "mBody", "...
FCM message notification part. <p> Instances of this class should be immutable. In order to accomplish, build method must be called lastly. {@link #build}. Examples: <pre><code> var Notification = require('node-xcs').Notification; </pre></code> <strong>Simplest notification:</strong> <pre><code> var notification = n...
[ "FCM", "message", "notification", "part", "." ]
667316e8822275e70c3329ca0553b6e1292eee78
https://github.com/guness/node-xcs/blob/667316e8822275e70c3329ca0553b6e1292eee78/google/Notification.js#L31-L51
train
ngokevin/angle
lib/initcomponent.js
run
function run (answers) { ls(['LICENSE', 'package.json', 'README.md', 'index.js', 'index.html', 'examples/basic/index.html', 'tests/index.test.js']).forEach(function (file) { answers.aframeVersion = aframeVersion; answers.npmName = `aframe-${answers.shortName}-component`; fs.writeFileSync(file, nun...
javascript
function run (answers) { ls(['LICENSE', 'package.json', 'README.md', 'index.js', 'index.html', 'examples/basic/index.html', 'tests/index.test.js']).forEach(function (file) { answers.aframeVersion = aframeVersion; answers.npmName = `aframe-${answers.shortName}-component`; fs.writeFileSync(file, nun...
[ "function", "run", "(", "answers", ")", "{", "ls", "(", "[", "'LICENSE'", ",", "'package.json'", ",", "'README.md'", ",", "'index.js'", ",", "'index.html'", ",", "'examples/basic/index.html'", ",", "'tests/index.test.js'", "]", ")", ".", "forEach", "(", "functio...
Do all the string replacements.
[ "Do", "all", "the", "string", "replacements", "." ]
8421f1ca242fe448fd01f2c883489d6178b5b20a
https://github.com/ngokevin/angle/blob/8421f1ca242fe448fd01f2c883489d6178b5b20a/lib/initcomponent.js#L91-L97
train
icemobilelab/minosse
lib/parsers.js
loadFileData
function loadFileData(fileName) { var testConfig = this.testConfig; if (!testConfig) { throw new Error('No test configuration found.\n' + 'You can add one by adding a property called `testConfig` to the word object.'); } var testDataRoot = testConfig.testDataRoot; if (!testDataRo...
javascript
function loadFileData(fileName) { var testConfig = this.testConfig; if (!testConfig) { throw new Error('No test configuration found.\n' + 'You can add one by adding a property called `testConfig` to the word object.'); } var testDataRoot = testConfig.testDataRoot; if (!testDataRo...
[ "function", "loadFileData", "(", "fileName", ")", "{", "var", "testConfig", "=", "this", ".", "testConfig", ";", "if", "(", "!", "testConfig", ")", "{", "throw", "new", "Error", "(", "'No test configuration found.\\n'", "+", "'You can add one by adding a property ca...
This function expects a full fileName with extension included!
[ "This", "function", "expects", "a", "full", "fileName", "with", "extension", "included!" ]
05065b6cfefd14198d20f4a87d6dd9bcb75a38d3
https://github.com/icemobilelab/minosse/blob/05065b6cfefd14198d20f4a87d6dd9bcb75a38d3/lib/parsers.js#L104-L122
train
googlearchive/node-big-rig
lib/third_party/tracing/base/units/time_stamp.js
TimeStamp
function TimeStamp(timestamp) { tr.b.u.Scalar.call(this, timestamp, tr.b.u.Units.timeStampInMs); }
javascript
function TimeStamp(timestamp) { tr.b.u.Scalar.call(this, timestamp, tr.b.u.Units.timeStampInMs); }
[ "function", "TimeStamp", "(", "timestamp", ")", "{", "tr", ".", "b", ".", "u", ".", "Scalar", ".", "call", "(", "this", ",", "timestamp", ",", "tr", ".", "b", ".", "u", ".", "Units", ".", "timeStampInMs", ")", ";", "}" ]
Float wrapper, representing a time stamp, capable of pretty-printing.
[ "Float", "wrapper", "representing", "a", "time", "stamp", "capable", "of", "pretty", "-", "printing", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/base/units/time_stamp.js#L16-L18
train
googlearchive/node-big-rig
lib/third_party/tracing/extras/chrome/cc/input_latency_async_slice.js
function(slice, flowEvents) { var fromOtherInputs = false; slice.iterateEntireHierarchy(function(subsequentSlice) { if (fromOtherInputs) return; subsequentSlice.inFlowEvents.forEach(function(inflow) { if (fromOtherInputs) return; if (inflow.catego...
javascript
function(slice, flowEvents) { var fromOtherInputs = false; slice.iterateEntireHierarchy(function(subsequentSlice) { if (fromOtherInputs) return; subsequentSlice.inFlowEvents.forEach(function(inflow) { if (fromOtherInputs) return; if (inflow.catego...
[ "function", "(", "slice", ",", "flowEvents", ")", "{", "var", "fromOtherInputs", "=", "false", ";", "slice", ".", "iterateEntireHierarchy", "(", "function", "(", "subsequentSlice", ")", "{", "if", "(", "fromOtherInputs", ")", "return", ";", "subsequentSlice", ...
Return true if the slice hierarchy is tracked by LatencyInfo of other input latency events. If the slice hierarchy is tracked by both, this function still returns true.
[ "Return", "true", "if", "the", "slice", "hierarchy", "is", "tracked", "by", "LatencyInfo", "of", "other", "input", "latency", "events", ".", "If", "the", "slice", "hierarchy", "is", "tracked", "by", "both", "this", "function", "still", "returns", "true", "."...
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/chrome/cc/input_latency_async_slice.js#L267-L286
train
googlearchive/node-big-rig
lib/third_party/tracing/extras/chrome/cc/input_latency_async_slice.js
function(event, flowEvents) { if (event.outFlowEvents === undefined || event.outFlowEvents.length === 0) return false; // Once we fix the bug of flow event binding, there should exist one and // only one outgoing flow (PostTask) from ScheduleBeginImplFrameDeadline // and PostC...
javascript
function(event, flowEvents) { if (event.outFlowEvents === undefined || event.outFlowEvents.length === 0) return false; // Once we fix the bug of flow event binding, there should exist one and // only one outgoing flow (PostTask) from ScheduleBeginImplFrameDeadline // and PostC...
[ "function", "(", "event", ",", "flowEvents", ")", "{", "if", "(", "event", ".", "outFlowEvents", "===", "undefined", "||", "event", ".", "outFlowEvents", ".", "length", "===", "0", ")", "return", "false", ";", "// Once we fix the bug of flow event binding, there s...
Return true if |event| triggers slices of other inputs.
[ "Return", "true", "if", "|event|", "triggers", "slices", "of", "other", "inputs", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/chrome/cc/input_latency_async_slice.js#L289-L308
train
googlearchive/node-big-rig
lib/third_party/tracing/extras/chrome/cc/input_latency_async_slice.js
function(event, queue, visited, flowEvents) { var stopFollowing = false; var inputAck = false; event.iterateAllSubsequentSlices(function(slice) { if (stopFollowing) return; // Do not follow TaskQueueManager::RunTask because it causes // many false events to be inclu...
javascript
function(event, queue, visited, flowEvents) { var stopFollowing = false; var inputAck = false; event.iterateAllSubsequentSlices(function(slice) { if (stopFollowing) return; // Do not follow TaskQueueManager::RunTask because it causes // many false events to be inclu...
[ "function", "(", "event", ",", "queue", ",", "visited", ",", "flowEvents", ")", "{", "var", "stopFollowing", "=", "false", ";", "var", "inputAck", "=", "false", ";", "event", ".", "iterateAllSubsequentSlices", "(", "function", "(", "slice", ")", "{", "if",...
Follow outgoing flow of subsequentSlices in the current hierarchy. We also handle cases where different inputs interfere with each other.
[ "Follow", "outgoing", "flow", "of", "subsequentSlices", "in", "the", "current", "hierarchy", ".", "We", "also", "handle", "cases", "where", "different", "inputs", "interfere", "with", "each", "other", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/chrome/cc/input_latency_async_slice.js#L312-L354
train
googlearchive/node-big-rig
lib/third_party/tracing/extras/chrome/cc/input_latency_async_slice.js
function(event, queue, visited) { event.outFlowEvents.forEach(function(outflow) { if ((outflow.category === POSTTASK_FLOW_EVENT || outflow.category === IPC_FLOW_EVENT) && outflow.endSlice) { this.associatedEvents_.push(outflow); var nextEvent = outflow.endSlice...
javascript
function(event, queue, visited) { event.outFlowEvents.forEach(function(outflow) { if ((outflow.category === POSTTASK_FLOW_EVENT || outflow.category === IPC_FLOW_EVENT) && outflow.endSlice) { this.associatedEvents_.push(outflow); var nextEvent = outflow.endSlice...
[ "function", "(", "event", ",", "queue", ",", "visited", ")", "{", "event", ".", "outFlowEvents", ".", "forEach", "(", "function", "(", "outflow", ")", "{", "if", "(", "(", "outflow", ".", "category", "===", "POSTTASK_FLOW_EVENT", "||", "outflow", ".", "c...
Follow outgoing flow events of the current slice.
[ "Follow", "outgoing", "flow", "events", "of", "the", "current", "slice", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/chrome/cc/input_latency_async_slice.js#L357-L371
train
googlearchive/node-big-rig
lib/third_party/tracing/extras/importer/linux_perf/sched_parser.js
SchedParser
function SchedParser(importer) { Parser.call(this, importer); importer.registerEventHandler('sched_switch', SchedParser.prototype.schedSwitchEvent.bind(this)); importer.registerEventHandler('sched_wakeup', SchedParser.prototype.schedWakeupEvent.bind(this)); importer.registerEventHandler...
javascript
function SchedParser(importer) { Parser.call(this, importer); importer.registerEventHandler('sched_switch', SchedParser.prototype.schedSwitchEvent.bind(this)); importer.registerEventHandler('sched_wakeup', SchedParser.prototype.schedWakeupEvent.bind(this)); importer.registerEventHandler...
[ "function", "SchedParser", "(", "importer", ")", "{", "Parser", ".", "call", "(", "this", ",", "importer", ")", ";", "importer", ".", "registerEventHandler", "(", "'sched_switch'", ",", "SchedParser", ".", "prototype", ".", "schedSwitchEvent", ".", "bind", "("...
Parses linux sched trace events. @constructor
[ "Parses", "linux", "sched", "trace", "events", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/linux_perf/sched_parser.js#L22-L31
train
googlearchive/node-big-rig
lib/third_party/tracing/extras/importer/linux_perf/sched_parser.js
function(eventName, cpuNumber, pid, ts, eventBase) { var event = schedSwitchRE.exec(eventBase.details); if (!event) return false; var prevState = event[4]; var nextComm = event[5]; var nextPid = parseInt(event[6]); var nextPrio = parseInt(event[7]); var nextThread = t...
javascript
function(eventName, cpuNumber, pid, ts, eventBase) { var event = schedSwitchRE.exec(eventBase.details); if (!event) return false; var prevState = event[4]; var nextComm = event[5]; var nextPid = parseInt(event[6]); var nextPrio = parseInt(event[7]); var nextThread = t...
[ "function", "(", "eventName", ",", "cpuNumber", ",", "pid", ",", "ts", ",", "eventBase", ")", "{", "var", "event", "=", "schedSwitchRE", ".", "exec", "(", "eventBase", ".", "details", ")", ";", "if", "(", "!", "event", ")", "return", "false", ";", "v...
Parses scheduler events and sets up state in the CPUs of the importer.
[ "Parses", "scheduler", "events", "and", "sets", "up", "state", "in", "the", "CPUs", "of", "the", "importer", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/linux_perf/sched_parser.js#L56-L86
train
googlearchive/node-big-rig
lib/third_party/tracing/base/range.js
function(array, opt_keyFunc, opt_this) { if (this.isEmpty_) return []; // Binary search. |test| is a function that should return true when we // need to explore the left branch and false to explore the right branch. function binSearch(test) { var i0 = 0; var i1 = array.le...
javascript
function(array, opt_keyFunc, opt_this) { if (this.isEmpty_) return []; // Binary search. |test| is a function that should return true when we // need to explore the left branch and false to explore the right branch. function binSearch(test) { var i0 = 0; var i1 = array.le...
[ "function", "(", "array", ",", "opt_keyFunc", ",", "opt_this", ")", "{", "if", "(", "this", ".", "isEmpty_", ")", "return", "[", "]", ";", "// Binary search. |test| is a function that should return true when we", "// need to explore the left branch and false to explore the ri...
Returns a slice of the input array that intersects with this range. If the range does not have a min, it is treated as unbounded from below. Similarly, if max is undefined, the range is unbounded from above. @param {Array} array The array of elements to be filtered. @param {Funcation=} opt_keyFunc A function that extr...
[ "Returns", "a", "slice", "of", "the", "input", "array", "that", "intersects", "with", "this", "range", ".", "If", "the", "range", "does", "not", "have", "a", "min", "it", "is", "treated", "as", "unbounded", "from", "below", ".", "Similarly", "if", "max",...
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/base/range.js#L184-L214
train
googlearchive/node-big-rig
lib/third_party/tracing/base/range.js
binSearch
function binSearch(test) { var i0 = 0; var i1 = array.length; while (i0 < i1 - 1) { var i = Math.trunc((i0 + i1) / 2); if (test(i)) i1 = i; // Explore the left branch. else i0 = i; // Explore the right branch. } return i1; ...
javascript
function binSearch(test) { var i0 = 0; var i1 = array.length; while (i0 < i1 - 1) { var i = Math.trunc((i0 + i1) / 2); if (test(i)) i1 = i; // Explore the left branch. else i0 = i; // Explore the right branch. } return i1; ...
[ "function", "binSearch", "(", "test", ")", "{", "var", "i0", "=", "0", ";", "var", "i1", "=", "array", ".", "length", ";", "while", "(", "i0", "<", "i1", "-", "1", ")", "{", "var", "i", "=", "Math", ".", "trunc", "(", "(", "i0", "+", "i1", ...
Binary search. |test| is a function that should return true when we need to explore the left branch and false to explore the right branch.
[ "Binary", "search", ".", "|test|", "is", "a", "function", "that", "should", "return", "true", "when", "we", "need", "to", "explore", "the", "left", "branch", "and", "false", "to", "explore", "the", "right", "branch", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/base/range.js#L189-L200
train
googlearchive/node-big-rig
lib/third_party/tracing/extras/importer/linux_perf/drm_parser.js
DrmParser
function DrmParser(importer) { Parser.call(this, importer); importer.registerEventHandler('drm_vblank_event', DrmParser.prototype.vblankEvent.bind(this)); }
javascript
function DrmParser(importer) { Parser.call(this, importer); importer.registerEventHandler('drm_vblank_event', DrmParser.prototype.vblankEvent.bind(this)); }
[ "function", "DrmParser", "(", "importer", ")", "{", "Parser", ".", "call", "(", "this", ",", "importer", ")", ";", "importer", ".", "registerEventHandler", "(", "'drm_vblank_event'", ",", "DrmParser", ".", "prototype", ".", "vblankEvent", ".", "bind", "(", "...
Parses linux drm trace events. @constructor
[ "Parses", "linux", "drm", "trace", "events", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/linux_perf/drm_parser.js#L23-L28
train
googlearchive/node-big-rig
lib/third_party/tracing/extras/importer/linux_perf/drm_parser.js
function(eventName, cpuNumber, pid, ts, eventBase) { var event = /crtc=(\d+), seq=(\d+)/.exec(eventBase.details); if (!event) return false; var crtc = parseInt(event[1]); var seq = parseInt(event[2]); this.drmVblankSlice(ts, 'vblank:' + crtc, { crtc: crtc, ...
javascript
function(eventName, cpuNumber, pid, ts, eventBase) { var event = /crtc=(\d+), seq=(\d+)/.exec(eventBase.details); if (!event) return false; var crtc = parseInt(event[1]); var seq = parseInt(event[2]); this.drmVblankSlice(ts, 'vblank:' + crtc, { crtc: crtc, ...
[ "function", "(", "eventName", ",", "cpuNumber", ",", "pid", ",", "ts", ",", "eventBase", ")", "{", "var", "event", "=", "/", "crtc=(\\d+), seq=(\\d+)", "/", ".", "exec", "(", "eventBase", ".", "details", ")", ";", "if", "(", "!", "event", ")", "return"...
Parses drm driver events and sets up state in the importer.
[ "Parses", "drm", "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/drm_parser.js#L46-L59
train
googlearchive/node-big-rig
lib/third_party/tracing/extras/importer/linux_perf/cpufreq_parser.js
CpufreqParser
function CpufreqParser(importer) { Parser.call(this, importer); importer.registerEventHandler('cpufreq_interactive_up', CpufreqParser.prototype.cpufreqUpDownEvent.bind(this)); importer.registerEventHandler('cpufreq_interactive_down', CpufreqParser.prototype.cpufreqUpDownEvent.bind(this)); ...
javascript
function CpufreqParser(importer) { Parser.call(this, importer); importer.registerEventHandler('cpufreq_interactive_up', CpufreqParser.prototype.cpufreqUpDownEvent.bind(this)); importer.registerEventHandler('cpufreq_interactive_down', CpufreqParser.prototype.cpufreqUpDownEvent.bind(this)); ...
[ "function", "CpufreqParser", "(", "importer", ")", "{", "Parser", ".", "call", "(", "this", ",", "importer", ")", ";", "importer", ".", "registerEventHandler", "(", "'cpufreq_interactive_up'", ",", "CpufreqParser", ".", "prototype", ".", "cpufreqUpDownEvent", ".",...
Parses linux cpufreq trace events. @constructor
[ "Parses", "linux", "cpufreq", "trace", "events", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/linux_perf/cpufreq_parser.js#L23-L42
train
googlearchive/node-big-rig
lib/third_party/tracing/extras/importer/linux_perf/cpufreq_parser.js
function(eventName, cpuNumber, pid, ts, eventBase) { var data = splitData(eventBase.details); this.cpufreqSlice(ts, eventName, data.cpu, data); return true; }
javascript
function(eventName, cpuNumber, pid, ts, eventBase) { var data = splitData(eventBase.details); this.cpufreqSlice(ts, eventName, data.cpu, data); return true; }
[ "function", "(", "eventName", ",", "cpuNumber", ",", "pid", ",", "ts", ",", "eventBase", ")", "{", "var", "data", "=", "splitData", "(", "eventBase", ".", "details", ")", ";", "this", ".", "cpufreqSlice", "(", "ts", ",", "eventName", ",", "data", ".", ...
Parses cpufreq events and sets up state in the importer.
[ "Parses", "cpufreq", "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/cpufreq_parser.js#L83-L87
train
googlearchive/node-big-rig
lib/third_party/tracing/extras/importer/linux_perf/power_parser.js
PowerParser
function PowerParser(importer) { Parser.call(this, importer); // NB: old-style power events, deprecated importer.registerEventHandler('power_start', PowerParser.prototype.powerStartEvent.bind(this)); importer.registerEventHandler('power_frequency', PowerParser.prototype.powerFrequencyEv...
javascript
function PowerParser(importer) { Parser.call(this, importer); // NB: old-style power events, deprecated importer.registerEventHandler('power_start', PowerParser.prototype.powerStartEvent.bind(this)); importer.registerEventHandler('power_frequency', PowerParser.prototype.powerFrequencyEv...
[ "function", "PowerParser", "(", "importer", ")", "{", "Parser", ".", "call", "(", "this", ",", "importer", ")", ";", "// NB: old-style power events, deprecated", "importer", ".", "registerEventHandler", "(", "'power_start'", ",", "PowerParser", ".", "prototype", "."...
Parses linux power trace events. @constructor
[ "Parses", "linux", "power", "trace", "events", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/linux_perf/power_parser.js#L24-L37
train
googlearchive/node-big-rig
lib/third_party/tracing/extras/importer/linux_perf/power_parser.js
function(eventName, cpuNumber, pid, ts, eventBase) { var event = /type=(\d+) state=(\d) cpu_id=(\d+)/.exec(eventBase.details); if (!event) return false; var targetCpuNumber = parseInt(event[3]); var cpuState = parseInt(event[2]); this.cpuStateSlice(ts, targetCpuNumber, event[1], c...
javascript
function(eventName, cpuNumber, pid, ts, eventBase) { var event = /type=(\d+) state=(\d) cpu_id=(\d+)/.exec(eventBase.details); if (!event) return false; var targetCpuNumber = parseInt(event[3]); var cpuState = parseInt(event[2]); this.cpuStateSlice(ts, targetCpuNumber, event[1], c...
[ "function", "(", "eventName", ",", "cpuNumber", ",", "pid", ",", "ts", ",", "eventBase", ")", "{", "var", "event", "=", "/", "type=(\\d+) state=(\\d) cpu_id=(\\d+)", "/", ".", "exec", "(", "eventBase", ".", "details", ")", ";", "if", "(", "!", "event", "...
Parses power events and sets up state in the importer.
[ "Parses", "power", "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/power_parser.js#L95-L104
train
googlearchive/node-big-rig
lib/third_party/tracing/extras/importer/linux_perf/disk_parser.js
DiskParser
function DiskParser(importer) { Parser.call(this, importer); importer.registerEventHandler('f2fs_write_begin', DiskParser.prototype.f2fsWriteBeginEvent.bind(this)); importer.registerEventHandler('f2fs_write_end', DiskParser.prototype.f2fsWriteEndEvent.bind(this)); importer.registerEvent...
javascript
function DiskParser(importer) { Parser.call(this, importer); importer.registerEventHandler('f2fs_write_begin', DiskParser.prototype.f2fsWriteBeginEvent.bind(this)); importer.registerEventHandler('f2fs_write_end', DiskParser.prototype.f2fsWriteEndEvent.bind(this)); importer.registerEvent...
[ "function", "DiskParser", "(", "importer", ")", "{", "Parser", ".", "call", "(", "this", ",", "importer", ")", ";", "importer", ".", "registerEventHandler", "(", "'f2fs_write_begin'", ",", "DiskParser", ".", "prototype", ".", "f2fsWriteBeginEvent", ".", "bind", ...
Parses linux filesystem and block device trace events. @constructor
[ "Parses", "linux", "filesystem", "and", "block", "device", "trace", "events", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/linux_perf/disk_parser.js#L24-L47
train
googlearchive/node-big-rig
lib/third_party/tracing/base/interval_tree.js
function(datum) { var startPosition = this.beginPositionCb_(datum); var endPosition = this.endPositionCb_(datum); var node = new IntervalTreeNode(datum, startPosition, endPosition); this.size_++; this.root_ = this.insertNode_(this.root_, node); ...
javascript
function(datum) { var startPosition = this.beginPositionCb_(datum); var endPosition = this.endPositionCb_(datum); var node = new IntervalTreeNode(datum, startPosition, endPosition); this.size_++; this.root_ = this.insertNode_(this.root_, node); ...
[ "function", "(", "datum", ")", "{", "var", "startPosition", "=", "this", ".", "beginPositionCb_", "(", "datum", ")", ";", "var", "endPosition", "=", "this", ".", "endPositionCb_", "(", "datum", ")", ";", "var", "node", "=", "new", "IntervalTreeNode", "(", ...
Insert events into the interval tree. @param {Object} datum The object to insert.
[ "Insert", "events", "into", "the", "interval", "tree", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/base/interval_tree.js#L47-L58
train
googlearchive/node-big-rig
lib/third_party/tracing/base/interval_tree.js
function(queryLow, queryHigh) { this.validateFindArguments_(queryLow, queryHigh); if (this.root_ === undefined) return []; var ret = []; this.root_.appendIntersectionsInto_(ret, queryLow, queryHigh); return ret; }
javascript
function(queryLow, queryHigh) { this.validateFindArguments_(queryLow, queryHigh); if (this.root_ === undefined) return []; var ret = []; this.root_.appendIntersectionsInto_(ret, queryLow, queryHigh); return ret; }
[ "function", "(", "queryLow", ",", "queryHigh", ")", "{", "this", ".", "validateFindArguments_", "(", "queryLow", ",", "queryHigh", ")", ";", "if", "(", "this", ".", "root_", "===", "undefined", ")", "return", "[", "]", ";", "var", "ret", "=", "[", "]",...
Retrieve all overlapping intervals. @param {number} queryLow The low value for the intersection interval. @param {number} queryHigh The high value for the intersection interval. @return {Array} All [begin, end] pairs inside intersecting intervals.
[ "Retrieve", "all", "overlapping", "intervals", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/base/interval_tree.js#L147-L155
train
googlearchive/node-big-rig
lib/third_party/tracing/ui/base/overlay.js
function() { this.classList.add('overlay'); this.parentEl_ = this.ownerDocument.body; this.visible_ = false; this.userCanClose_ = true; this.onKeyDown_ = this.onKeyDown_.bind(this); this.onClick_ = this.onClick_.bind(this); this.onFocusIn_ = this.onFocusIn_.bind(this); ...
javascript
function() { this.classList.add('overlay'); this.parentEl_ = this.ownerDocument.body; this.visible_ = false; this.userCanClose_ = true; this.onKeyDown_ = this.onKeyDown_.bind(this); this.onClick_ = this.onClick_.bind(this); this.onFocusIn_ = this.onFocusIn_.bind(this); ...
[ "function", "(", ")", "{", "this", ".", "classList", ".", "add", "(", "'overlay'", ")", ";", "this", ".", "parentEl_", "=", "this", ".", "ownerDocument", ".", "body", ";", "this", ".", "visible_", "=", "false", ";", "this", ".", "userCanClose_", "=", ...
Initializes the overlay element.
[ "Initializes", "the", "overlay", "element", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/ui/base/overlay.js#L42-L89
train
googlearchive/node-big-rig
lib/third_party/tracing/extras/rail/rail_interaction_record.js
userFriendlyRailTypeName
function userFriendlyRailTypeName(railTypeName) { if (railTypeName.length < 6 || railTypeName.indexOf('rail_') != 0) return railTypeName; return railTypeName[5].toUpperCase() + railTypeName.slice(6); }
javascript
function userFriendlyRailTypeName(railTypeName) { if (railTypeName.length < 6 || railTypeName.indexOf('rail_') != 0) return railTypeName; return railTypeName[5].toUpperCase() + railTypeName.slice(6); }
[ "function", "userFriendlyRailTypeName", "(", "railTypeName", ")", "{", "if", "(", "railTypeName", ".", "length", "<", "6", "||", "railTypeName", ".", "indexOf", "(", "'rail_'", ")", "!=", "0", ")", "return", "railTypeName", ";", "return", "railTypeName", "[", ...
A user friendly name is currently formed by dropping the rail_ prefix and capitalizing.
[ "A", "user", "friendly", "name", "is", "currently", "formed", "by", "dropping", "the", "rail_", "prefix", "and", "capitalizing", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/rail/rail_interaction_record.js#L196-L200
train
googlearchive/node-big-rig
lib/third_party/tracing/extras/rail/rail_interaction_record.js
railCompare
function railCompare(name1, name2) { var i1 = RAIL_ORDER.indexOf(name1.toUpperCase()); var i2 = RAIL_ORDER.indexOf(name2.toUpperCase()); if (i1 == -1 && i2 == -1) return name1.localeCompare(name2); if (i1 == -1) return 1; // i2 is a RAIL name but not i1. if (i2 == -1) return -1; ...
javascript
function railCompare(name1, name2) { var i1 = RAIL_ORDER.indexOf(name1.toUpperCase()); var i2 = RAIL_ORDER.indexOf(name2.toUpperCase()); if (i1 == -1 && i2 == -1) return name1.localeCompare(name2); if (i1 == -1) return 1; // i2 is a RAIL name but not i1. if (i2 == -1) return -1; ...
[ "function", "railCompare", "(", "name1", ",", "name2", ")", "{", "var", "i1", "=", "RAIL_ORDER", ".", "indexOf", "(", "name1", ".", "toUpperCase", "(", ")", ")", ";", "var", "i2", "=", "RAIL_ORDER", ".", "indexOf", "(", "name2", ".", "toUpperCase", "("...
Compare two rail type names or rail user-friendly names so they are sorted in R,A,I,L order. Capitalization is ignore. Non rail names are sorted lexicographically after rail names.
[ "Compare", "two", "rail", "type", "names", "or", "rail", "user", "-", "friendly", "names", "so", "they", "are", "sorted", "in", "R", "A", "I", "L", "order", ".", "Capitalization", "is", "ignore", ".", "Non", "rail", "names", "are", "sorted", "lexicograph...
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/rail/rail_interaction_record.js#L205-L216
train
googlearchive/node-big-rig
lib/third_party/tracing/extras/importer/linux_perf/workqueue_parser.js
WorkqueueParser
function WorkqueueParser(importer) { Parser.call(this, importer); importer.registerEventHandler('workqueue_execute_start', WorkqueueParser.prototype.executeStartEvent.bind(this)); importer.registerEventHandler('workqueue_execute_end', WorkqueueParser.prototype.executeEndEvent.bind(this)); ...
javascript
function WorkqueueParser(importer) { Parser.call(this, importer); importer.registerEventHandler('workqueue_execute_start', WorkqueueParser.prototype.executeStartEvent.bind(this)); importer.registerEventHandler('workqueue_execute_end', WorkqueueParser.prototype.executeEndEvent.bind(this)); ...
[ "function", "WorkqueueParser", "(", "importer", ")", "{", "Parser", ".", "call", "(", "this", ",", "importer", ")", ";", "importer", ".", "registerEventHandler", "(", "'workqueue_execute_start'", ",", "WorkqueueParser", ".", "prototype", ".", "executeStartEvent", ...
Parses linux workqueue trace events. @constructor
[ "Parses", "linux", "workqueue", "trace", "events", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/linux_perf/workqueue_parser.js#L23-L34
train
googlearchive/node-big-rig
lib/third_party/tracing/extras/importer/linux_perf/workqueue_parser.js
function(eventName, cpuNumber, pid, ts, eventBase) { var event = workqueueExecuteStartRE.exec(eventBase.details); if (!event) return false; var kthread = this.importer.getOrCreateKernelThread(eventBase.threadName, pid, pid); kthread.openSliceTS = ts; kthread.openSlice = ...
javascript
function(eventName, cpuNumber, pid, ts, eventBase) { var event = workqueueExecuteStartRE.exec(eventBase.details); if (!event) return false; var kthread = this.importer.getOrCreateKernelThread(eventBase.threadName, pid, pid); kthread.openSliceTS = ts; kthread.openSlice = ...
[ "function", "(", "eventName", ",", "cpuNumber", ",", "pid", ",", "ts", ",", "eventBase", ")", "{", "var", "event", "=", "workqueueExecuteStartRE", ".", "exec", "(", "eventBase", ".", "details", ")", ";", "if", "(", "!", "event", ")", "return", "false", ...
Parses workqueue events and sets up state in the importer.
[ "Parses", "workqueue", "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/workqueue_parser.js#L50-L60
train
googlearchive/node-big-rig
lib/third_party/tracing/extras/importer/linux_perf/ftrace_importer.js
LinuxPerfImporter
function LinuxPerfImporter(model, events) { this.importPriority = 2; this.model_ = model; this.events_ = events; this.newlyAddedClockSyncRecords_ = []; this.wakeups_ = []; this.blocked_reasons_ = []; this.kernelThreadStates_ = {}; this.buildMapFromLinuxPidsToThreads(); this.lines_ = ...
javascript
function LinuxPerfImporter(model, events) { this.importPriority = 2; this.model_ = model; this.events_ = events; this.newlyAddedClockSyncRecords_ = []; this.wakeups_ = []; this.blocked_reasons_ = []; this.kernelThreadStates_ = {}; this.buildMapFromLinuxPidsToThreads(); this.lines_ = ...
[ "function", "LinuxPerfImporter", "(", "model", ",", "events", ")", "{", "this", ".", "importPriority", "=", "2", ";", "this", ".", "model_", "=", "model", ";", "this", ".", "events_", "=", "events", ";", "this", ".", "newlyAddedClockSyncRecords_", "=", "["...
Imports linux perf events into a specified model. @constructor
[ "Imports", "linux", "perf", "events", "into", "a", "specified", "model", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/linux_perf/ftrace_importer.js#L53-L66
train
googlearchive/node-big-rig
lib/third_party/tracing/extras/importer/linux_perf/ftrace_importer.js
function() { this.threadsByLinuxPid = {}; this.model_.getAllThreads().forEach( function(thread) { this.threadsByLinuxPid[thread.tid] = thread; }.bind(this)); }
javascript
function() { this.threadsByLinuxPid = {}; this.model_.getAllThreads().forEach( function(thread) { this.threadsByLinuxPid[thread.tid] = thread; }.bind(this)); }
[ "function", "(", ")", "{", "this", ".", "threadsByLinuxPid", "=", "{", "}", ";", "this", ".", "model_", ".", "getAllThreads", "(", ")", ".", "forEach", "(", "function", "(", "thread", ")", "{", "this", ".", "threadsByLinuxPid", "[", "thread", ".", "tid...
Precomputes a lookup table from linux pids back to existing Threads. This is used during importing to add information to each thread about whether it was running, descheduled, sleeping, et cetera.
[ "Precomputes", "a", "lookup", "table", "from", "linux", "pids", "back", "to", "existing", "Threads", ".", "This", "is", "used", "during", "importing", "to", "add", "information", "to", "each", "thread", "about", "whether", "it", "was", "running", "descheduled"...
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/linux_perf/ftrace_importer.js#L326-L332
train
googlearchive/node-big-rig
lib/third_party/tracing/extras/importer/linux_perf/ftrace_importer.js
function(isSecondaryImport) { this.parsers_ = this.createParsers_(); this.registerDefaultHandlers_(); this.parseLines(); this.importClockSyncRecords(); var timeShift = this.computeTimeTransform(); if (timeShift === undefined) { this.model_.importWarning({ type: 'clo...
javascript
function(isSecondaryImport) { this.parsers_ = this.createParsers_(); this.registerDefaultHandlers_(); this.parseLines(); this.importClockSyncRecords(); var timeShift = this.computeTimeTransform(); if (timeShift === undefined) { this.model_.importWarning({ type: 'clo...
[ "function", "(", "isSecondaryImport", ")", "{", "this", ".", "parsers_", "=", "this", ".", "createParsers_", "(", ")", ";", "this", ".", "registerDefaultHandlers_", "(", ")", ";", "this", ".", "parseLines", "(", ")", ";", "this", ".", "importClockSyncRecords...
Imports the data in this.events_ into model_.
[ "Imports", "the", "data", "in", "this", ".", "events_", "into", "model_", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/linux_perf/ftrace_importer.js#L400-L418
train
googlearchive/node-big-rig
lib/third_party/tracing/extras/importer/linux_perf/ftrace_importer.js
function(state) { if (wakeup !== undefined) { midDuration = wakeup.ts - prevSlice.end; } if (blocked_reason !== undefined) { var args = { 'kernel callsite when blocked:' : blocked_reason.caller }; if (blocked_re...
javascript
function(state) { if (wakeup !== undefined) { midDuration = wakeup.ts - prevSlice.end; } if (blocked_reason !== undefined) { var args = { 'kernel callsite when blocked:' : blocked_reason.caller }; if (blocked_re...
[ "function", "(", "state", ")", "{", "if", "(", "wakeup", "!==", "undefined", ")", "{", "midDuration", "=", "wakeup", ".", "ts", "-", "prevSlice", ".", "end", ";", "}", "if", "(", "blocked_reason", "!==", "undefined", ")", "{", "var", "args", "=", "{"...
Push a sleep slice onto the slices list, interrupting it with a wakeup if appropriate.
[ "Push", "a", "sleep", "slice", "onto", "the", "slices", "list", "interrupting", "it", "with", "a", "wakeup", "if", "appropriate", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/linux_perf/ftrace_importer.js#L534-L573
train
googlearchive/node-big-rig
lib/third_party/tracing/extras/importer/linux_perf/ftrace_importer.js
function() { var isSecondaryImport = this.model.getClockSyncRecordsNamed( 'ftrace_importer').length !== 0; var mSyncs = this.model_.getClockSyncRecordsNamed('monotonic'); // If this is a secondary import, and no clock syncing records were // found, then abort the import. Otherwise, ju...
javascript
function() { var isSecondaryImport = this.model.getClockSyncRecordsNamed( 'ftrace_importer').length !== 0; var mSyncs = this.model_.getClockSyncRecordsNamed('monotonic'); // If this is a secondary import, and no clock syncing records were // found, then abort the import. Otherwise, ju...
[ "function", "(", ")", "{", "var", "isSecondaryImport", "=", "this", ".", "model", ".", "getClockSyncRecordsNamed", "(", "'ftrace_importer'", ")", ".", "length", "!==", "0", ";", "var", "mSyncs", "=", "this", ".", "model_", ".", "getClockSyncRecordsNamed", "(",...
Computes a time transform from perf time to parent time based on the imported clock sync records. @return {number} offset from perf time to parent time or undefined if the necessary sync records were not found.
[ "Computes", "a", "time", "transform", "from", "perf", "time", "to", "parent", "time", "based", "on", "the", "imported", "clock", "sync", "records", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/linux_perf/ftrace_importer.js#L648-L667
train
googlearchive/node-big-rig
lib/third_party/tracing/extras/importer/linux_perf/ftrace_importer.js
function(ts, pid, comm, prio, fromPid) { // The the pids that get passed in to this function are Linux kernel // pids, which identify threads. The rest of trace-viewer refers to // these as tids, so the change of nomenclature happens in the following // construction of the wakeup object. ...
javascript
function(ts, pid, comm, prio, fromPid) { // The the pids that get passed in to this function are Linux kernel // pids, which identify threads. The rest of trace-viewer refers to // these as tids, so the change of nomenclature happens in the following // construction of the wakeup object. ...
[ "function", "(", "ts", ",", "pid", ",", "comm", ",", "prio", ",", "fromPid", ")", "{", "// The the pids that get passed in to this function are Linux kernel", "// pids, which identify threads. The rest of trace-viewer refers to", "// these as tids, so the change of nomenclature happen...
Records the fact that a pid has become runnable. This data will eventually get used to derive each thread's timeSlices array.
[ "Records", "the", "fact", "that", "a", "pid", "has", "become", "runnable", ".", "This", "data", "will", "eventually", "get", "used", "to", "derive", "each", "thread", "s", "timeSlices", "array", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/linux_perf/ftrace_importer.js#L712-L718
train
googlearchive/node-big-rig
lib/third_party/tracing/extras/importer/linux_perf/ftrace_importer.js
function(ts, pid, iowait, caller) { // The the pids that get passed in to this function are Linux kernel // pids, which identify threads. The rest of trace-viewer refers to // these as tids, so the change of nomenclature happens in the following // construction of the wakeup object. this....
javascript
function(ts, pid, iowait, caller) { // The the pids that get passed in to this function are Linux kernel // pids, which identify threads. The rest of trace-viewer refers to // these as tids, so the change of nomenclature happens in the following // construction of the wakeup object. this....
[ "function", "(", "ts", ",", "pid", ",", "iowait", ",", "caller", ")", "{", "// The the pids that get passed in to this function are Linux kernel", "// pids, which identify threads. The rest of trace-viewer refers to", "// these as tids, so the change of nomenclature happens in the followi...
Records the reason why a pid has gone into uninterruptible sleep.
[ "Records", "the", "reason", "why", "a", "pid", "has", "gone", "into", "uninterruptible", "sleep", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/linux_perf/ftrace_importer.js#L723-L730
train
googlearchive/node-big-rig
lib/third_party/tracing/extras/importer/linux_perf/ftrace_importer.js
function(eventName, cpuNumber, pid, ts, eventBase) { // Check for new-style clock sync records. var event = /name=(\w+?)\s(.+)/.exec(eventBase.details); if (event) { var name = event[1]; var pieces = event[2].split(' '); var args = { perfTS: ts }; for ...
javascript
function(eventName, cpuNumber, pid, ts, eventBase) { // Check for new-style clock sync records. var event = /name=(\w+?)\s(.+)/.exec(eventBase.details); if (event) { var name = event[1]; var pieces = event[2].split(' '); var args = { perfTS: ts }; for ...
[ "function", "(", "eventName", ",", "cpuNumber", ",", "pid", ",", "ts", ",", "eventBase", ")", "{", "// Check for new-style clock sync records.", "var", "event", "=", "/", "name=(\\w+?)\\s(.+)", "/", ".", "exec", "(", "eventBase", ".", "details", ")", ";", "if"...
Processes a trace_event_clock_sync event.
[ "Processes", "a", "trace_event_clock_sync", "event", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/linux_perf/ftrace_importer.js#L735-L764
train
googlearchive/node-big-rig
lib/third_party/tracing/extras/importer/linux_perf/ftrace_importer.js
function(eventName, cpuNumber, pid, ts, eventBase, threadName) { // Some profiles end up with a \n\ on the end of each line. Strip it // before we do the comparisons. eventBase.details = eventBase.details.replace(/\\n.*$/, ''); var event = /^\s*(\w+):\s*(.*...
javascript
function(eventName, cpuNumber, pid, ts, eventBase, threadName) { // Some profiles end up with a \n\ on the end of each line. Strip it // before we do the comparisons. eventBase.details = eventBase.details.replace(/\\n.*$/, ''); var event = /^\s*(\w+):\s*(.*...
[ "function", "(", "eventName", ",", "cpuNumber", ",", "pid", ",", "ts", ",", "eventBase", ",", "threadName", ")", "{", "// Some profiles end up with a \\n\\ on the end of each line. Strip it", "// before we do the comparisons.", "eventBase", ".", "details", "=", "eventBase",...
Processes a trace_marking_write event.
[ "Processes", "a", "trace_marking_write", "event", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/linux_perf/ftrace_importer.js#L769-L801
train
googlearchive/node-big-rig
lib/third_party/tracing/extras/importer/linux_perf/ftrace_importer.js
function() { this.forEachLine(function(text, eventBase, cpuNumber, pid, ts) { var eventName = eventBase.eventName; if (eventName !== 'tracing_mark_write' && eventName !== '0') return; if (traceEventClockSyncRE.exec(eventBase.details)) this.traceClockSyncEvent(eventName,...
javascript
function() { this.forEachLine(function(text, eventBase, cpuNumber, pid, ts) { var eventName = eventBase.eventName; if (eventName !== 'tracing_mark_write' && eventName !== '0') return; if (traceEventClockSyncRE.exec(eventBase.details)) this.traceClockSyncEvent(eventName,...
[ "function", "(", ")", "{", "this", ".", "forEachLine", "(", "function", "(", "text", ",", "eventBase", ",", "cpuNumber", ",", "pid", ",", "ts", ")", "{", "var", "eventName", "=", "eventBase", ".", "eventName", ";", "if", "(", "eventName", "!==", "'trac...
Populates model clockSyncRecords with found clock sync markers.
[ "Populates", "model", "clockSyncRecords", "with", "found", "clock", "sync", "markers", "." ]
71748aab8ea166726356c6578a6a1c82e314ca33
https://github.com/googlearchive/node-big-rig/blob/71748aab8ea166726356c6578a6a1c82e314ca33/lib/third_party/tracing/extras/importer/linux_perf/ftrace_importer.js#L806-L823
train