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
googleapis/nodejs-firestore
dev/protos/firestore_proto_api.js
OperationInfo
function OperationInfo(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; }
javascript
function OperationInfo(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; }
[ "function", "OperationInfo", "(", "properties", ")", "{", "if", "(", "properties", ")", "for", "(", "var", "keys", "=", "Object", ".", "keys", "(", "properties", ")", ",", "i", "=", "0", ";", "i", "<", "keys", ".", "length", ";", "++", "i", ")", ...
Properties of an OperationInfo. @memberof google.longrunning @interface IOperationInfo @property {string|null} [responseType] OperationInfo responseType @property {string|null} [metadataType] OperationInfo metadataType Constructs a new OperationInfo. @memberof google.longrunning @classdesc Represents an OperationInfo...
[ "Properties", "of", "an", "OperationInfo", "." ]
c1192504e2d2ebe505aaf952227f377017f43bdc
https://github.com/googleapis/nodejs-firestore/blob/c1192504e2d2ebe505aaf952227f377017f43bdc/dev/protos/firestore_proto_api.js#L7152-L7157
train
mapbox/mapbox-gl-leaflet
leaflet-mapbox-gl.js
function (fn, time, context) { var lock, args, wrapperFn, later; later = function () { // reset lock and call if queued lock = false; if (args) { wrapperFn.apply(context, args); a...
javascript
function (fn, time, context) { var lock, args, wrapperFn, later; later = function () { // reset lock and call if queued lock = false; if (args) { wrapperFn.apply(context, args); a...
[ "function", "(", "fn", ",", "time", ",", "context", ")", "{", "var", "lock", ",", "args", ",", "wrapperFn", ",", "later", ";", "later", "=", "function", "(", ")", "{", "// reset lock and call if queued", "lock", "=", "false", ";", "if", "(", "args", ")...
Create a version of `fn` that only fires once every `time` millseconds. @param {Function} fn the function to be throttled @param {number} time millseconds required between function calls @param {*} context the value of `this` with which the function is called @returns {Function} debounced function @private
[ "Create", "a", "version", "of", "fn", "that", "only", "fires", "once", "every", "time", "millseconds", "." ]
8920b4b7c30682bec372581b878e21ec4edd4d33
https://github.com/mapbox/mapbox-gl-leaflet/blob/8920b4b7c30682bec372581b878e21ec4edd4d33/leaflet-mapbox-gl.js#L36-L62
train
kelvinhokk/cordova-plugin-localization-strings
scripts/create_android_strings.js
processResult
function processResult(context, lang, langJson, stringXmlJson) { var path = require('path'); var q = require('q'); var deferred = q.defer(); var mapObj = {}; // create a map to the actual string _.forEach(stringXmlJson.resources.string, function (val) { if (_.has(val, "$") && _.has(val[...
javascript
function processResult(context, lang, langJson, stringXmlJson) { var path = require('path'); var q = require('q'); var deferred = q.defer(); var mapObj = {}; // create a map to the actual string _.forEach(stringXmlJson.resources.string, function (val) { if (_.has(val, "$") && _.has(val[...
[ "function", "processResult", "(", "context", ",", "lang", ",", "langJson", ",", "stringXmlJson", ")", "{", "var", "path", "=", "require", "(", "'path'", ")", ";", "var", "q", "=", "require", "(", "'q'", ")", ";", "var", "deferred", "=", "q", ".", "de...
process the modified xml and put write to file
[ "process", "the", "modified", "xml", "and", "put", "write", "to", "file" ]
c545daf8142e871fbcb311fdf2ad27ce5c94aadf
https://github.com/kelvinhokk/cordova-plugin-localization-strings/blob/c545daf8142e871fbcb311fdf2ad27ce5c94aadf/scripts/create_android_strings.js#L202-L260
train
99xt/serverless-dynamodb-local
src/seeder.js
writeSeedBatch
function writeSeedBatch(dynamodbWriteFunction, tableName, seeds) { const params = { RequestItems: { [tableName]: seeds.map((seed) => ({ PutRequest: { Item: seed, }, })), }, }; return new BbPromise((resolve, reject) => { // interval lets us know how much time we ha...
javascript
function writeSeedBatch(dynamodbWriteFunction, tableName, seeds) { const params = { RequestItems: { [tableName]: seeds.map((seed) => ({ PutRequest: { Item: seed, }, })), }, }; return new BbPromise((resolve, reject) => { // interval lets us know how much time we ha...
[ "function", "writeSeedBatch", "(", "dynamodbWriteFunction", ",", "tableName", ",", "seeds", ")", "{", "const", "params", "=", "{", "RequestItems", ":", "{", "[", "tableName", "]", ":", "seeds", ".", "map", "(", "(", "seed", ")", "=>", "(", "{", "PutReque...
Writes a batch chunk of migration seeds to DynamoDB. DynamoDB has a limit on the number of items that may be written in a batch operation. @param {function} dynamodbWriteFunction The DynamoDB DocumentClient.batchWrite or DynamoDB.batchWriteItem function @param {string} tableName The table name being written to @param {...
[ "Writes", "a", "batch", "chunk", "of", "migration", "seeds", "to", "DynamoDB", ".", "DynamoDB", "has", "a", "limit", "on", "the", "number", "of", "items", "that", "may", "be", "written", "in", "a", "batch", "operation", "." ]
8278a7ea86d809bdc9857194269bf0747b27a956
https://github.com/99xt/serverless-dynamodb-local/blob/8278a7ea86d809bdc9857194269bf0747b27a956/src/seeder.js#L22-L51
train
99xt/serverless-dynamodb-local
src/seeder.js
writeSeeds
function writeSeeds(dynamodbWriteFunction, tableName, seeds) { if (!dynamodbWriteFunction) { throw new Error("dynamodbWriteFunction argument must be provided"); } if (!tableName) { throw new Error("table name argument must be provided"); } if (!seeds) { throw new Error("seeds argument must be prov...
javascript
function writeSeeds(dynamodbWriteFunction, tableName, seeds) { if (!dynamodbWriteFunction) { throw new Error("dynamodbWriteFunction argument must be provided"); } if (!tableName) { throw new Error("table name argument must be provided"); } if (!seeds) { throw new Error("seeds argument must be prov...
[ "function", "writeSeeds", "(", "dynamodbWriteFunction", ",", "tableName", ",", "seeds", ")", "{", "if", "(", "!", "dynamodbWriteFunction", ")", "{", "throw", "new", "Error", "(", "\"dynamodbWriteFunction argument must be provided\"", ")", ";", "}", "if", "(", "!",...
Writes a seed corpus to the given database table @param {function} dynamodbWriteFunction The DynamoDB DocumentClient.batchWrite or DynamoDB.batchWriteItem function @param {string} tableName The table name @param {any[]} seeds The seed values
[ "Writes", "a", "seed", "corpus", "to", "the", "given", "database", "table" ]
8278a7ea86d809bdc9857194269bf0747b27a956
https://github.com/99xt/serverless-dynamodb-local/blob/8278a7ea86d809bdc9857194269bf0747b27a956/src/seeder.js#L59-L79
train
99xt/serverless-dynamodb-local
src/seeder.js
fileExists
function fileExists(fileName) { return new BbPromise((resolve) => { fs.exists(fileName, (exists) => resolve(exists)); }); }
javascript
function fileExists(fileName) { return new BbPromise((resolve) => { fs.exists(fileName, (exists) => resolve(exists)); }); }
[ "function", "fileExists", "(", "fileName", ")", "{", "return", "new", "BbPromise", "(", "(", "resolve", ")", "=>", "{", "fs", ".", "exists", "(", "fileName", ",", "(", "exists", ")", "=>", "resolve", "(", "exists", ")", ")", ";", "}", ")", ";", "}"...
A promise-based function that determines if a file exists @param {string} fileName The path to the file
[ "A", "promise", "-", "based", "function", "that", "determines", "if", "a", "file", "exists" ]
8278a7ea86d809bdc9857194269bf0747b27a956
https://github.com/99xt/serverless-dynamodb-local/blob/8278a7ea86d809bdc9857194269bf0747b27a956/src/seeder.js#L85-L89
train
99xt/serverless-dynamodb-local
src/seeder.js
unmarshalBuffer
function unmarshalBuffer(json) { _.forEach(json, function(value, key) { // Null check to prevent creation of Buffer when value is null if (value !== null && value.type==="Buffer") { json[key]= new Buffer(value.data); } }); return json; }
javascript
function unmarshalBuffer(json) { _.forEach(json, function(value, key) { // Null check to prevent creation of Buffer when value is null if (value !== null && value.type==="Buffer") { json[key]= new Buffer(value.data); } }); return json; }
[ "function", "unmarshalBuffer", "(", "json", ")", "{", "_", ".", "forEach", "(", "json", ",", "function", "(", "value", ",", "key", ")", "{", "// Null check to prevent creation of Buffer when value is null", "if", "(", "value", "!==", "null", "&&", "value", ".", ...
Transform all selerialized Buffer value in a Buffer value inside a json object @param {json} json with serialized Buffer value. @return {json} json with Buffer object.
[ "Transform", "all", "selerialized", "Buffer", "value", "in", "a", "Buffer", "value", "inside", "a", "json", "object" ]
8278a7ea86d809bdc9857194269bf0747b27a956
https://github.com/99xt/serverless-dynamodb-local/blob/8278a7ea86d809bdc9857194269bf0747b27a956/src/seeder.js#L97-L105
train
99xt/serverless-dynamodb-local
src/seeder.js
getSeedsAtLocation
function getSeedsAtLocation(location) { // load the file as JSON const result = require(location); // Ensure the output is an array if (Array.isArray(result)) { return _.forEach(result, unmarshalBuffer); } else { return [ unmarshalBuffer(result) ]; } }
javascript
function getSeedsAtLocation(location) { // load the file as JSON const result = require(location); // Ensure the output is an array if (Array.isArray(result)) { return _.forEach(result, unmarshalBuffer); } else { return [ unmarshalBuffer(result) ]; } }
[ "function", "getSeedsAtLocation", "(", "location", ")", "{", "// load the file as JSON", "const", "result", "=", "require", "(", "location", ")", ";", "// Ensure the output is an array", "if", "(", "Array", ".", "isArray", "(", "result", ")", ")", "{", "return", ...
Scrapes seed files out of a given location. This file may contain either a simple json object, or an array of simple json objects. An array of json objects is returned. @param {any} location the filename to read seeds from.
[ "Scrapes", "seed", "files", "out", "of", "a", "given", "location", ".", "This", "file", "may", "contain", "either", "a", "simple", "json", "object", "or", "an", "array", "of", "simple", "json", "objects", ".", "An", "array", "of", "json", "objects", "is"...
8278a7ea86d809bdc9857194269bf0747b27a956
https://github.com/99xt/serverless-dynamodb-local/blob/8278a7ea86d809bdc9857194269bf0747b27a956/src/seeder.js#L114-L124
train
99xt/serverless-dynamodb-local
src/seeder.js
locateSeeds
function locateSeeds(sources, cwd) { sources = sources || []; cwd = cwd || process.cwd(); const locations = sources.map((source) => path.join(cwd, source)); return BbPromise.map(locations, (location) => { return fileExists(location).then((exists) => { if(!exists) { throw new Error("source fil...
javascript
function locateSeeds(sources, cwd) { sources = sources || []; cwd = cwd || process.cwd(); const locations = sources.map((source) => path.join(cwd, source)); return BbPromise.map(locations, (location) => { return fileExists(location).then((exists) => { if(!exists) { throw new Error("source fil...
[ "function", "locateSeeds", "(", "sources", ",", "cwd", ")", "{", "sources", "=", "sources", "||", "[", "]", ";", "cwd", "=", "cwd", "||", "process", ".", "cwd", "(", ")", ";", "const", "locations", "=", "sources", ".", "map", "(", "(", "source", ")...
Locates seeds given a set of files to scrape @param {string[]} sources The filenames to scrape for seeds
[ "Locates", "seeds", "given", "a", "set", "of", "files", "to", "scrape" ]
8278a7ea86d809bdc9857194269bf0747b27a956
https://github.com/99xt/serverless-dynamodb-local/blob/8278a7ea86d809bdc9857194269bf0747b27a956/src/seeder.js#L130-L144
train
ipfs/interface-js-ipfs-core
src/utils/spawn.js
spawnNodeWithId
function spawnNodeWithId (factory, callback) { waterfall([(cb) => factory.spawnNode(cb), identify], callback) }
javascript
function spawnNodeWithId (factory, callback) { waterfall([(cb) => factory.spawnNode(cb), identify], callback) }
[ "function", "spawnNodeWithId", "(", "factory", ",", "callback", ")", "{", "waterfall", "(", "[", "(", "cb", ")", "=>", "factory", ".", "spawnNode", "(", "cb", ")", ",", "identify", "]", ",", "callback", ")", "}" ]
Spawn a node, get it's id and set it as `peerId` on the node
[ "Spawn", "a", "node", "get", "it", "s", "id", "and", "set", "it", "as", "peerId", "on", "the", "node" ]
b90d6352ad88ea7c388f2b2c32e8ff562724f14f
https://github.com/ipfs/interface-js-ipfs-core/blob/b90d6352ad88ea7c388f2b2c32e8ff562724f14f/src/utils/spawn.js#L16-L18
train
ipfs/interface-js-ipfs-core
src/utils/spawn.js
spawnNodes
function spawnNodes (n, factory, callback) { timesSeries(n, (_, cb) => factory.spawnNode(cb), callback) }
javascript
function spawnNodes (n, factory, callback) { timesSeries(n, (_, cb) => factory.spawnNode(cb), callback) }
[ "function", "spawnNodes", "(", "n", ",", "factory", ",", "callback", ")", "{", "timesSeries", "(", "n", ",", "(", "_", ",", "cb", ")", "=>", "factory", ".", "spawnNode", "(", "cb", ")", ",", "callback", ")", "}" ]
Spawn n nodes
[ "Spawn", "n", "nodes" ]
b90d6352ad88ea7c388f2b2c32e8ff562724f14f
https://github.com/ipfs/interface-js-ipfs-core/blob/b90d6352ad88ea7c388f2b2c32e8ff562724f14f/src/utils/spawn.js#L23-L25
train
ipfs/interface-js-ipfs-core
src/utils/spawn.js
spawnNodesWithId
function spawnNodesWithId (n, factory, callback) { spawnNodes(n, factory, (err, nodes) => { if (err) return callback(err) map(nodes, identify, callback) }) }
javascript
function spawnNodesWithId (n, factory, callback) { spawnNodes(n, factory, (err, nodes) => { if (err) return callback(err) map(nodes, identify, callback) }) }
[ "function", "spawnNodesWithId", "(", "n", ",", "factory", ",", "callback", ")", "{", "spawnNodes", "(", "n", ",", "factory", ",", "(", "err", ",", "nodes", ")", "=>", "{", "if", "(", "err", ")", "return", "callback", "(", "err", ")", "map", "(", "n...
Spawn n nodes, getting their id's and setting them as `peerId` on the nodes
[ "Spawn", "n", "nodes", "getting", "their", "id", "s", "and", "setting", "them", "as", "peerId", "on", "the", "nodes" ]
b90d6352ad88ea7c388f2b2c32e8ff562724f14f
https://github.com/ipfs/interface-js-ipfs-core/blob/b90d6352ad88ea7c388f2b2c32e8ff562724f14f/src/utils/spawn.js#L30-L35
train
mourner/rbush
index.js
function (insertPath, level) { var node = insertPath[level], M = node.children.length, m = this._minEntries; this._chooseSplitAxis(node, m, M); var splitIndex = this._chooseSplitIndex(node, m, M); var newNode = createNode(node.children.splice(splitIndex, node....
javascript
function (insertPath, level) { var node = insertPath[level], M = node.children.length, m = this._minEntries; this._chooseSplitAxis(node, m, M); var splitIndex = this._chooseSplitIndex(node, m, M); var newNode = createNode(node.children.splice(splitIndex, node....
[ "function", "(", "insertPath", ",", "level", ")", "{", "var", "node", "=", "insertPath", "[", "level", "]", ",", "M", "=", "node", ".", "children", ".", "length", ",", "m", "=", "this", ".", "_minEntries", ";", "this", ".", "_chooseSplitAxis", "(", "...
split overflowed node into two
[ "split", "overflowed", "node", "into", "two" ]
175cb6a0201eda595d485d2ce38a3199a1b9ed7b
https://github.com/mourner/rbush/blob/175cb6a0201eda595d485d2ce38a3199a1b9ed7b/index.js#L318-L337
train
mourner/rbush
index.js
function (node, m, M) { var compareMinX = node.leaf ? this.compareMinX : compareNodeMinX, compareMinY = node.leaf ? this.compareMinY : compareNodeMinY, xMargin = this._allDistMargin(node, m, M, compareMinX), yMargin = this._allDistMargin(node, m, M, compareMinY); //...
javascript
function (node, m, M) { var compareMinX = node.leaf ? this.compareMinX : compareNodeMinX, compareMinY = node.leaf ? this.compareMinY : compareNodeMinY, xMargin = this._allDistMargin(node, m, M, compareMinX), yMargin = this._allDistMargin(node, m, M, compareMinY); //...
[ "function", "(", "node", ",", "m", ",", "M", ")", "{", "var", "compareMinX", "=", "node", ".", "leaf", "?", "this", ".", "compareMinX", ":", "compareNodeMinX", ",", "compareMinY", "=", "node", ".", "leaf", "?", "this", ".", "compareMinY", ":", "compare...
sorts node children by the best axis for split
[ "sorts", "node", "children", "by", "the", "best", "axis", "for", "split" ]
175cb6a0201eda595d485d2ce38a3199a1b9ed7b
https://github.com/mourner/rbush/blob/175cb6a0201eda595d485d2ce38a3199a1b9ed7b/index.js#L380-L390
train
mourner/rbush
index.js
function (node, m, M, compare) { node.children.sort(compare); var toBBox = this.toBBox, leftBBox = distBBox(node, 0, m, toBBox), rightBBox = distBBox(node, M - m, M, toBBox), margin = bboxMargin(leftBBox) + bboxMargin(rightBBox), i, child; for (...
javascript
function (node, m, M, compare) { node.children.sort(compare); var toBBox = this.toBBox, leftBBox = distBBox(node, 0, m, toBBox), rightBBox = distBBox(node, M - m, M, toBBox), margin = bboxMargin(leftBBox) + bboxMargin(rightBBox), i, child; for (...
[ "function", "(", "node", ",", "m", ",", "M", ",", "compare", ")", "{", "node", ".", "children", ".", "sort", "(", "compare", ")", ";", "var", "toBBox", "=", "this", ".", "toBBox", ",", "leftBBox", "=", "distBBox", "(", "node", ",", "0", ",", "m",...
total margin of all possible split distributions where each node is at least m full
[ "total", "margin", "of", "all", "possible", "split", "distributions", "where", "each", "node", "is", "at", "least", "m", "full" ]
175cb6a0201eda595d485d2ce38a3199a1b9ed7b
https://github.com/mourner/rbush/blob/175cb6a0201eda595d485d2ce38a3199a1b9ed7b/index.js#L393-L416
train
mourner/rbush
index.js
calcBBox
function calcBBox(node, toBBox) { distBBox(node, 0, node.children.length, toBBox, node); }
javascript
function calcBBox(node, toBBox) { distBBox(node, 0, node.children.length, toBBox, node); }
[ "function", "calcBBox", "(", "node", ",", "toBBox", ")", "{", "distBBox", "(", "node", ",", "0", ",", "node", ".", "children", ".", "length", ",", "toBBox", ",", "node", ")", ";", "}" ]
calculate node's bbox from bboxes of its children
[ "calculate", "node", "s", "bbox", "from", "bboxes", "of", "its", "children" ]
175cb6a0201eda595d485d2ce38a3199a1b9ed7b
https://github.com/mourner/rbush/blob/175cb6a0201eda595d485d2ce38a3199a1b9ed7b/index.js#L469-L471
train
mourner/rbush
index.js
distBBox
function distBBox(node, k, p, toBBox, destNode) { if (!destNode) destNode = createNode(null); destNode.minX = Infinity; destNode.minY = Infinity; destNode.maxX = -Infinity; destNode.maxY = -Infinity; for (var i = k, child; i < p; i++) { child = node.children[i]; extend(destNode,...
javascript
function distBBox(node, k, p, toBBox, destNode) { if (!destNode) destNode = createNode(null); destNode.minX = Infinity; destNode.minY = Infinity; destNode.maxX = -Infinity; destNode.maxY = -Infinity; for (var i = k, child; i < p; i++) { child = node.children[i]; extend(destNode,...
[ "function", "distBBox", "(", "node", ",", "k", ",", "p", ",", "toBBox", ",", "destNode", ")", "{", "if", "(", "!", "destNode", ")", "destNode", "=", "createNode", "(", "null", ")", ";", "destNode", ".", "minX", "=", "Infinity", ";", "destNode", ".", ...
min bounding rectangle of node children from k to p-1
[ "min", "bounding", "rectangle", "of", "node", "children", "from", "k", "to", "p", "-", "1" ]
175cb6a0201eda595d485d2ce38a3199a1b9ed7b
https://github.com/mourner/rbush/blob/175cb6a0201eda595d485d2ce38a3199a1b9ed7b/index.js#L474-L487
train
mourner/rbush
index.js
multiSelect
function multiSelect(arr, left, right, n, compare) { var stack = [left, right], mid; while (stack.length) { right = stack.pop(); left = stack.pop(); if (right - left <= n) continue; mid = left + Math.ceil((right - left) / n / 2) * n; quickselect(arr, mid, left,...
javascript
function multiSelect(arr, left, right, n, compare) { var stack = [left, right], mid; while (stack.length) { right = stack.pop(); left = stack.pop(); if (right - left <= n) continue; mid = left + Math.ceil((right - left) / n / 2) * n; quickselect(arr, mid, left,...
[ "function", "multiSelect", "(", "arr", ",", "left", ",", "right", ",", "n", ",", "compare", ")", "{", "var", "stack", "=", "[", "left", ",", "right", "]", ",", "mid", ";", "while", "(", "stack", ".", "length", ")", "{", "right", "=", "stack", "."...
sort an array so that items come in groups of n unsorted items, with groups sorted between each other; combines selection algorithm with binary divide & conquer approach
[ "sort", "an", "array", "so", "that", "items", "come", "in", "groups", "of", "n", "unsorted", "items", "with", "groups", "sorted", "between", "each", "other", ";", "combines", "selection", "algorithm", "with", "binary", "divide", "&", "conquer", "approach" ]
175cb6a0201eda595d485d2ce38a3199a1b9ed7b
https://github.com/mourner/rbush/blob/175cb6a0201eda595d485d2ce38a3199a1b9ed7b/index.js#L547-L562
train
davidmarkclements/0x
visualizer/actions.js
jumpToState
function jumpToState () { return ({ merged, nodeId, excludeTypes }) => { state.focusedNodeId = nodeId state.control.merged = merged state.typeFilters.enableInlinable = !merged state.key.enableOptUnopt = !merged // Diff type exclude state to reach the one described by the entry c...
javascript
function jumpToState () { return ({ merged, nodeId, excludeTypes }) => { state.focusedNodeId = nodeId state.control.merged = merged state.typeFilters.enableInlinable = !merged state.key.enableOptUnopt = !merged // Diff type exclude state to reach the one described by the entry c...
[ "function", "jumpToState", "(", ")", "{", "return", "(", "{", "merged", ",", "nodeId", ",", "excludeTypes", "}", ")", "=>", "{", "state", ".", "focusedNodeId", "=", "nodeId", "state", ".", "control", ".", "merged", "=", "merged", "state", ".", "typeFilte...
Jump to a state based on a history entry.
[ "Jump", "to", "a", "state", "based", "on", "a", "history", "entry", "." ]
9863309871a805536c86d7027c7345bb2e9ac40b
https://github.com/davidmarkclements/0x/blob/9863309871a805536c86d7027c7345bb2e9ac40b/visualizer/actions.js#L143-L174
train
davidmarkclements/0x
visualizer/actions.js
tagNodesWithIds
function tagNodesWithIds (data) { let id = 0 const idsToNodes = new Map() const nodesToIds = new Map() tagNodes(data) return { idsToNodes, nodesToIds } function tag (node) { idsToNodes.set(id, node) nodesToIds.set(node, id) id++ } function tagNodes (node) { tag(node) if (...
javascript
function tagNodesWithIds (data) { let id = 0 const idsToNodes = new Map() const nodesToIds = new Map() tagNodes(data) return { idsToNodes, nodesToIds } function tag (node) { idsToNodes.set(id, node) nodesToIds.set(node, id) id++ } function tagNodes (node) { tag(node) if (...
[ "function", "tagNodesWithIds", "(", "data", ")", "{", "let", "id", "=", "0", "const", "idsToNodes", "=", "new", "Map", "(", ")", "const", "nodesToIds", "=", "new", "Map", "(", ")", "tagNodes", "(", "data", ")", "return", "{", "idsToNodes", ",", "nodesT...
This just uses incrementing IDs but it will only be used for a single dataset, and it's deterministic enough for that
[ "This", "just", "uses", "incrementing", "IDs", "but", "it", "will", "only", "be", "used", "for", "a", "single", "dataset", "and", "it", "s", "deterministic", "enough", "for", "that" ]
9863309871a805536c86d7027c7345bb2e9ac40b
https://github.com/davidmarkclements/0x/blob/9863309871a805536c86d7027c7345bb2e9ac40b/visualizer/actions.js#L179-L199
train
davidmarkclements/0x
lib/v8-log-to-ticks.js
fixLines
function fixLines (line) { // Node 11+ are fine if (nodeMajorV > 10) return line // Work around a bug in Node 10's V8 --preprocess -j that breaks strings containing \\ if (nodeMajorV === 10) { // Look for backslashes that aren't escaping a unicode character code, like \\u01a2 // Small risk of false pos...
javascript
function fixLines (line) { // Node 11+ are fine if (nodeMajorV > 10) return line // Work around a bug in Node 10's V8 --preprocess -j that breaks strings containing \\ if (nodeMajorV === 10) { // Look for backslashes that aren't escaping a unicode character code, like \\u01a2 // Small risk of false pos...
[ "function", "fixLines", "(", "line", ")", "{", "// Node 11+ are fine", "if", "(", "nodeMajorV", ">", "10", ")", "return", "line", "// Work around a bug in Node 10's V8 --preprocess -j that breaks strings containing \\\\", "if", "(", "nodeMajorV", "===", "10", ")", "{", ...
Fixes node-version-specific issues with isolate log text
[ "Fixes", "node", "-", "version", "-", "specific", "issues", "with", "isolate", "log", "text" ]
9863309871a805536c86d7027c7345bb2e9ac40b
https://github.com/davidmarkclements/0x/blob/9863309871a805536c86d7027c7345bb2e9ac40b/lib/v8-log-to-ticks.js#L37-L68
train
harc/ohm
src/util.js
padNumbersToEqualLength
function padNumbersToEqualLength(arr) { var maxLen = 0; var strings = arr.map(function(n) { var str = n.toString(); maxLen = Math.max(maxLen, str.length); return str; }); return strings.map(function(s) { return common.padLeft(s, maxLen); }); }
javascript
function padNumbersToEqualLength(arr) { var maxLen = 0; var strings = arr.map(function(n) { var str = n.toString(); maxLen = Math.max(maxLen, str.length); return str; }); return strings.map(function(s) { return common.padLeft(s, maxLen); }); }
[ "function", "padNumbersToEqualLength", "(", "arr", ")", "{", "var", "maxLen", "=", "0", ";", "var", "strings", "=", "arr", ".", "map", "(", "function", "(", "n", ")", "{", "var", "str", "=", "n", ".", "toString", "(", ")", ";", "maxLen", "=", "Math...
Given an array of numbers `arr`, return an array of the numbers as strings, right-justified and padded to the same length.
[ "Given", "an", "array", "of", "numbers", "arr", "return", "an", "array", "of", "the", "numbers", "as", "strings", "right", "-", "justified", "and", "padded", "to", "the", "same", "length", "." ]
9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f
https://github.com/harc/ohm/blob/9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f/src/util.js#L15-L23
train
harc/ohm
src/util.js
strcpy
function strcpy(dest, src, offset) { var origDestLen = dest.length; var start = dest.slice(0, offset); var end = dest.slice(offset + src.length); return (start + src + end).substr(0, origDestLen); }
javascript
function strcpy(dest, src, offset) { var origDestLen = dest.length; var start = dest.slice(0, offset); var end = dest.slice(offset + src.length); return (start + src + end).substr(0, origDestLen); }
[ "function", "strcpy", "(", "dest", ",", "src", ",", "offset", ")", "{", "var", "origDestLen", "=", "dest", ".", "length", ";", "var", "start", "=", "dest", ".", "slice", "(", "0", ",", "offset", ")", ";", "var", "end", "=", "dest", ".", "slice", ...
Produce a new string that would be the result of copying the contents of the string `src` onto `dest` at offset `offest`.
[ "Produce", "a", "new", "string", "that", "would", "be", "the", "result", "of", "copying", "the", "contents", "of", "the", "string", "src", "onto", "dest", "at", "offset", "offest", "." ]
9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f
https://github.com/harc/ohm/blob/9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f/src/util.js#L27-L32
train
harc/ohm
src/util.js
appendLine
function appendLine(num, content, prefix) { sb.append(prefix + lineNumbers[num] + ' | ' + content + '\n'); }
javascript
function appendLine(num, content, prefix) { sb.append(prefix + lineNumbers[num] + ' | ' + content + '\n'); }
[ "function", "appendLine", "(", "num", ",", "content", ",", "prefix", ")", "{", "sb", ".", "append", "(", "prefix", "+", "lineNumbers", "[", "num", "]", "+", "' | '", "+", "content", "+", "'\\n'", ")", ";", "}" ]
Helper for appending formatting input lines to the buffer.
[ "Helper", "for", "appending", "formatting", "input", "lines", "to", "the", "buffer", "." ]
9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f
https://github.com/harc/ohm/blob/9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f/src/util.js#L127-L129
train
harc/ohm
src/pexprs.js
Extend
function Extend(superGrammar, name, body) { this.superGrammar = superGrammar; this.name = name; this.body = body; var origBody = superGrammar.rules[name].body; this.terms = [body, origBody]; }
javascript
function Extend(superGrammar, name, body) { this.superGrammar = superGrammar; this.name = name; this.body = body; var origBody = superGrammar.rules[name].body; this.terms = [body, origBody]; }
[ "function", "Extend", "(", "superGrammar", ",", "name", ",", "body", ")", "{", "this", ".", "superGrammar", "=", "superGrammar", ";", "this", ".", "name", "=", "name", ";", "this", ".", "body", "=", "body", ";", "var", "origBody", "=", "superGrammar", ...
Extend is an implementation detail of rule extension
[ "Extend", "is", "an", "implementation", "detail", "of", "rule", "extension" ]
9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f
https://github.com/harc/ohm/blob/9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f/src/pexprs.js#L68-L74
train
harc/ohm
src/Semantics.js
ASemantics
function ASemantics(matchResult) { if (!(matchResult instanceof MatchResult)) { throw new TypeError( 'Semantics expected a MatchResult, but got ' + common.unexpectedObjToString(matchResult)); } if (matchResult.failed()) { throw new TypeError('cannot apply Semantics to ' + matchResult.t...
javascript
function ASemantics(matchResult) { if (!(matchResult instanceof MatchResult)) { throw new TypeError( 'Semantics expected a MatchResult, but got ' + common.unexpectedObjToString(matchResult)); } if (matchResult.failed()) { throw new TypeError('cannot apply Semantics to ' + matchResult.t...
[ "function", "ASemantics", "(", "matchResult", ")", "{", "if", "(", "!", "(", "matchResult", "instanceof", "MatchResult", ")", ")", "{", "throw", "new", "TypeError", "(", "'Semantics expected a MatchResult, but got '", "+", "common", ".", "unexpectedObjToString", "("...
To enable clients to invoke a semantics like a function, return a function that acts as a proxy for `s`, which is the real `Semantics` instance.
[ "To", "enable", "clients", "to", "invoke", "a", "semantics", "like", "a", "function", "return", "a", "function", "that", "acts", "as", "a", "proxy", "for", "s", "which", "is", "the", "real", "Semantics", "instance", "." ]
9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f
https://github.com/harc/ohm/blob/9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f/src/Semantics.js#L514-L531
train
harc/ohm
src/Semantics.js
Attribute
function Attribute(name, actionDict, builtInDefault) { this.name = name; this.formals = []; this.actionDict = actionDict; this.builtInDefault = builtInDefault; }
javascript
function Attribute(name, actionDict, builtInDefault) { this.name = name; this.formals = []; this.actionDict = actionDict; this.builtInDefault = builtInDefault; }
[ "function", "Attribute", "(", "name", ",", "actionDict", ",", "builtInDefault", ")", "{", "this", ".", "name", "=", "name", ";", "this", ".", "formals", "=", "[", "]", ";", "this", ".", "actionDict", "=", "actionDict", ";", "this", ".", "builtInDefault",...
Attributes are Operations whose results are memoized. This means that, for any given semantics, the semantic action for a CST node will be invoked no more than once.
[ "Attributes", "are", "Operations", "whose", "results", "are", "memoized", ".", "This", "means", "that", "for", "any", "given", "semantics", "the", "semantic", "action", "for", "a", "CST", "node", "will", "be", "invoked", "no", "more", "than", "once", "." ]
9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f
https://github.com/harc/ohm/blob/9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f/src/Semantics.js#L666-L671
train
harc/ohm
src/Grammar.js
function(what, name, actionDict) { function isSpecialAction(a) { return a === '_iter' || a === '_terminal' || a === '_nonterminal' || a === '_default'; } var problems = []; for (var k in actionDict) { var v = actionDict[k]; if (!isSpecialAction(k) && !(k in this.rules)) { prob...
javascript
function(what, name, actionDict) { function isSpecialAction(a) { return a === '_iter' || a === '_terminal' || a === '_nonterminal' || a === '_default'; } var problems = []; for (var k in actionDict) { var v = actionDict[k]; if (!isSpecialAction(k) && !(k in this.rules)) { prob...
[ "function", "(", "what", ",", "name", ",", "actionDict", ")", "{", "function", "isSpecialAction", "(", "a", ")", "{", "return", "a", "===", "'_iter'", "||", "a", "===", "'_terminal'", "||", "a", "===", "'_nonterminal'", "||", "a", "===", "'_default'", ";...
Check that every key in `actionDict` corresponds to a semantic action, and that it maps to a function of the correct arity. If not, throw an exception.
[ "Check", "that", "every", "key", "in", "actionDict", "corresponds", "to", "a", "semantic", "action", "and", "that", "it", "maps", "to", "a", "function", "of", "the", "correct", "arity", ".", "If", "not", "throw", "an", "exception", "." ]
9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f
https://github.com/harc/ohm/blob/9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f/src/Grammar.js#L106-L137
train
harc/ohm
src/Grammar.js
function(str) { var app; if (str.indexOf('<') === -1) { // simple application app = new pexprs.Apply(str); } else { // parameterized application var cst = ohmGrammar.match(str, 'Base_application'); app = buildGrammar(cst, {}); } // Ensure that the application is valid....
javascript
function(str) { var app; if (str.indexOf('<') === -1) { // simple application app = new pexprs.Apply(str); } else { // parameterized application var cst = ohmGrammar.match(str, 'Base_application'); app = buildGrammar(cst, {}); } // Ensure that the application is valid....
[ "function", "(", "str", ")", "{", "var", "app", ";", "if", "(", "str", ".", "indexOf", "(", "'<'", ")", "===", "-", "1", ")", "{", "// simple application", "app", "=", "new", "pexprs", ".", "Apply", "(", "str", ")", ";", "}", "else", "{", "// par...
Parse a string which expresses a rule application in this grammar, and return the resulting Apply node.
[ "Parse", "a", "string", "which", "expresses", "a", "rule", "application", "in", "this", "grammar", "and", "return", "the", "resulting", "Apply", "node", "." ]
9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f
https://github.com/harc/ohm/blob/9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f/src/Grammar.js#L264-L285
train
harc/ohm
src/MatchState.js
function(pos, expr) { var posInfo = this.memoTable[pos]; if (posInfo && expr.ruleName) { var memoRec = posInfo.memo[expr.toMemoKey()]; if (memoRec && memoRec.traceEntry) { var entry = memoRec.traceEntry.cloneWithExpr(expr); entry.isMemoized = true; return entry; } }...
javascript
function(pos, expr) { var posInfo = this.memoTable[pos]; if (posInfo && expr.ruleName) { var memoRec = posInfo.memo[expr.toMemoKey()]; if (memoRec && memoRec.traceEntry) { var entry = memoRec.traceEntry.cloneWithExpr(expr); entry.isMemoized = true; return entry; } }...
[ "function", "(", "pos", ",", "expr", ")", "{", "var", "posInfo", "=", "this", ".", "memoTable", "[", "pos", "]", ";", "if", "(", "posInfo", "&&", "expr", ".", "ruleName", ")", "{", "var", "memoRec", "=", "posInfo", ".", "memo", "[", "expr", ".", ...
Returns the memoized trace entry for `expr` at `pos`, if one exists, `null` otherwise.
[ "Returns", "the", "memoized", "trace", "entry", "for", "expr", "at", "pos", "if", "one", "exists", "null", "otherwise", "." ]
9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f
https://github.com/harc/ohm/blob/9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f/src/MatchState.js#L220-L231
train
harc/ohm
src/MatchState.js
function(pos, expr, succeeded, bindings) { if (expr instanceof pexprs.Apply) { var app = this.currentApplication(); var actuals = app ? app.args : []; expr = expr.substituteParams(actuals); } return this.getMemoizedTraceEntry(pos, expr) || new Trace(this.input, pos, this.inputSt...
javascript
function(pos, expr, succeeded, bindings) { if (expr instanceof pexprs.Apply) { var app = this.currentApplication(); var actuals = app ? app.args : []; expr = expr.substituteParams(actuals); } return this.getMemoizedTraceEntry(pos, expr) || new Trace(this.input, pos, this.inputSt...
[ "function", "(", "pos", ",", "expr", ",", "succeeded", ",", "bindings", ")", "{", "if", "(", "expr", "instanceof", "pexprs", ".", "Apply", ")", "{", "var", "app", "=", "this", ".", "currentApplication", "(", ")", ";", "var", "actuals", "=", "app", "?...
Returns a new trace entry, with the currently active trace array as its children.
[ "Returns", "a", "new", "trace", "entry", "with", "the", "currently", "active", "trace", "array", "as", "its", "children", "." ]
9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f
https://github.com/harc/ohm/blob/9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f/src/MatchState.js#L234-L242
train
harc/ohm
examples/operators/operator-example.js
binaryExpression
function binaryExpression(first, ops, rest) { if (associativity[ops[0]] === 'L') { const applyLeft = (x, y) => new BinaryExpression(x, ops.shift(), y); return [first].concat(rest).reduce(applyLeft); } else { const applyRight = (x, y) => new BinaryExpression(y, ops.pop(), x); return [first].concat(re...
javascript
function binaryExpression(first, ops, rest) { if (associativity[ops[0]] === 'L') { const applyLeft = (x, y) => new BinaryExpression(x, ops.shift(), y); return [first].concat(rest).reduce(applyLeft); } else { const applyRight = (x, y) => new BinaryExpression(y, ops.pop(), x); return [first].concat(re...
[ "function", "binaryExpression", "(", "first", ",", "ops", ",", "rest", ")", "{", "if", "(", "associativity", "[", "ops", "[", "0", "]", "]", "===", "'L'", ")", "{", "const", "applyLeft", "=", "(", "x", ",", "y", ")", "=>", "new", "BinaryExpression", ...
We know that all lists will have ops at the same precedence levels.
[ "We", "know", "that", "all", "lists", "will", "have", "ops", "at", "the", "same", "precedence", "levels", "." ]
9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f
https://github.com/harc/ohm/blob/9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f/examples/operators/operator-example.js#L127-L135
train
harc/ohm
examples/operators/operator-example.js
makeTree
function makeTree(left, ops, rights, minPrecedence = 0) { while (ops.length > 0 && precedence[ops[0]] >= minPrecedence) { let op = ops.shift(); let right = rights.shift(); while (ops.length > 0 && (precedence[ops[0]] > precedence[op] || associativity[ops[0]] === 'R' && precedence[ops[0]] === prece...
javascript
function makeTree(left, ops, rights, minPrecedence = 0) { while (ops.length > 0 && precedence[ops[0]] >= minPrecedence) { let op = ops.shift(); let right = rights.shift(); while (ops.length > 0 && (precedence[ops[0]] > precedence[op] || associativity[ops[0]] === 'R' && precedence[ops[0]] === prece...
[ "function", "makeTree", "(", "left", ",", "ops", ",", "rights", ",", "minPrecedence", "=", "0", ")", "{", "while", "(", "ops", ".", "length", ">", "0", "&&", "precedence", "[", "ops", "[", "0", "]", "]", ">=", "minPrecedence", ")", "{", "let", "op"...
Modified Richards and Whitby-Stevens precedence climbing method.
[ "Modified", "Richards", "and", "Whitby", "-", "Stevens", "precedence", "climbing", "method", "." ]
9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f
https://github.com/harc/ohm/blob/9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f/examples/operators/operator-example.js#L207-L218
train
harc/ohm
src/Trace.js
getInputExcerpt
function getInputExcerpt(input, pos, len) { var excerpt = asEscapedString(input.slice(pos, pos + len)); // Pad the output if necessary. if (excerpt.length < len) { return excerpt + common.repeat(' ', len - excerpt.length).join(''); } return excerpt; }
javascript
function getInputExcerpt(input, pos, len) { var excerpt = asEscapedString(input.slice(pos, pos + len)); // Pad the output if necessary. if (excerpt.length < len) { return excerpt + common.repeat(' ', len - excerpt.length).join(''); } return excerpt; }
[ "function", "getInputExcerpt", "(", "input", ",", "pos", ",", "len", ")", "{", "var", "excerpt", "=", "asEscapedString", "(", "input", ".", "slice", "(", "pos", ",", "pos", "+", "len", ")", ")", ";", "// Pad the output if necessary.", "if", "(", "excerpt",...
Return a string representation of a portion of `input` at offset `pos`. The result will contain exactly `len` characters.
[ "Return", "a", "string", "representation", "of", "a", "portion", "of", "input", "at", "offset", "pos", ".", "The", "result", "will", "contain", "exactly", "len", "characters", "." ]
9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f
https://github.com/harc/ohm/blob/9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f/src/Trace.js#L38-L46
train
harc/ohm
src/main.js
getScriptElementContents
function getScriptElementContents(el) { if (!isElement(el)) { throw new TypeError('Expected a DOM Node, got ' + common.unexpectedObjToString(el)); } if (el.type !== 'text/ohm-js') { throw new Error('Expected a script tag with type="text/ohm-js", got ' + el); } return el.getAttribute('src') ? load(el.g...
javascript
function getScriptElementContents(el) { if (!isElement(el)) { throw new TypeError('Expected a DOM Node, got ' + common.unexpectedObjToString(el)); } if (el.type !== 'text/ohm-js') { throw new Error('Expected a script tag with type="text/ohm-js", got ' + el); } return el.getAttribute('src') ? load(el.g...
[ "function", "getScriptElementContents", "(", "el", ")", "{", "if", "(", "!", "isElement", "(", "el", ")", ")", "{", "throw", "new", "TypeError", "(", "'Expected a DOM Node, got '", "+", "common", ".", "unexpectedObjToString", "(", "el", ")", ")", ";", "}", ...
Return the contents of a script element, fetching it via XHR if necessary.
[ "Return", "the", "contents", "of", "a", "script", "element", "fetching", "it", "via", "XHR", "if", "necessary", "." ]
9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f
https://github.com/harc/ohm/blob/9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f/src/main.js#L264-L272
train
harc/ohm
src/Interval.js
function(that) { if (this.sourceString !== that.sourceString) { throw errors.intervalSourcesDontMatch(); } else if (this.startIdx === that.startIdx && this.endIdx === that.endIdx) { // `this` and `that` are the same interval! return [ ]; } else if (this.startIdx < that.startIdx && th...
javascript
function(that) { if (this.sourceString !== that.sourceString) { throw errors.intervalSourcesDontMatch(); } else if (this.startIdx === that.startIdx && this.endIdx === that.endIdx) { // `this` and `that` are the same interval! return [ ]; } else if (this.startIdx < that.startIdx && th...
[ "function", "(", "that", ")", "{", "if", "(", "this", ".", "sourceString", "!==", "that", ".", "sourceString", ")", "{", "throw", "errors", ".", "intervalSourcesDontMatch", "(", ")", ";", "}", "else", "if", "(", "this", ".", "startIdx", "===", "that", ...
Returns an array of 0, 1, or 2 intervals that represents the result of the interval difference operation.
[ "Returns", "an", "array", "of", "0", "1", "or", "2", "intervals", "that", "represents", "the", "result", "of", "the", "interval", "difference", "operation", "." ]
9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f
https://github.com/harc/ohm/blob/9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f/src/Interval.js#L59-L88
train
harc/ohm
src/Interval.js
function(that) { if (this.sourceString !== that.sourceString) { throw errors.intervalSourcesDontMatch(); } assert(this.startIdx >= that.startIdx && this.endIdx <= that.endIdx, 'other interval does not cover this one'); return new Interval(this.sourceString, this....
javascript
function(that) { if (this.sourceString !== that.sourceString) { throw errors.intervalSourcesDontMatch(); } assert(this.startIdx >= that.startIdx && this.endIdx <= that.endIdx, 'other interval does not cover this one'); return new Interval(this.sourceString, this....
[ "function", "(", "that", ")", "{", "if", "(", "this", ".", "sourceString", "!==", "that", ".", "sourceString", ")", "{", "throw", "errors", ".", "intervalSourcesDontMatch", "(", ")", ";", "}", "assert", "(", "this", ".", "startIdx", ">=", "that", ".", ...
Returns a new Interval that has the same extent as this one, but which is relative to `that`, an Interval that fully covers this one.
[ "Returns", "a", "new", "Interval", "that", "has", "the", "same", "extent", "as", "this", "one", "but", "which", "is", "relative", "to", "that", "an", "Interval", "that", "fully", "covers", "this", "one", "." ]
9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f
https://github.com/harc/ohm/blob/9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f/src/Interval.js#L92-L101
train
harc/ohm
examples/ecmascript/es5.js
flattenIterNodes
function flattenIterNodes(nodes) { var result = []; for (var i = 0; i < nodes.length; ++i) { if (nodes[i]._node.ctorName === '_iter') { result.push.apply(result, flattenIterNodes(nodes[i].children)); } else { result.push(nodes[i]); } } return result; }
javascript
function flattenIterNodes(nodes) { var result = []; for (var i = 0; i < nodes.length; ++i) { if (nodes[i]._node.ctorName === '_iter') { result.push.apply(result, flattenIterNodes(nodes[i].children)); } else { result.push(nodes[i]); } } return result; }
[ "function", "flattenIterNodes", "(", "nodes", ")", "{", "var", "result", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "nodes", ".", "length", ";", "++", "i", ")", "{", "if", "(", "nodes", "[", "i", "]", ".", "_node", "...
Take an Array of nodes, and whenever an _iter node is encountered, splice in its recursively-flattened children instead.
[ "Take", "an", "Array", "of", "nodes", "and", "whenever", "an", "_iter", "node", "is", "encountered", "splice", "in", "its", "recursively", "-", "flattened", "children", "instead", "." ]
9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f
https://github.com/harc/ohm/blob/9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f/examples/ecmascript/es5.js#L20-L30
train
harc/ohm
src/errors.js
duplicateRuleDeclaration
function duplicateRuleDeclaration(ruleName, grammarName, declGrammarName, optSource) { var message = "Duplicate declaration for rule '" + ruleName + "' in grammar '" + grammarName + "'"; if (grammarName !== declGrammarName) { message += " (originally declared in '" + declGrammarName + "')"; } return c...
javascript
function duplicateRuleDeclaration(ruleName, grammarName, declGrammarName, optSource) { var message = "Duplicate declaration for rule '" + ruleName + "' in grammar '" + grammarName + "'"; if (grammarName !== declGrammarName) { message += " (originally declared in '" + declGrammarName + "')"; } return c...
[ "function", "duplicateRuleDeclaration", "(", "ruleName", ",", "grammarName", ",", "declGrammarName", ",", "optSource", ")", "{", "var", "message", "=", "\"Duplicate declaration for rule '\"", "+", "ruleName", "+", "\"' in grammar '\"", "+", "grammarName", "+", "\"'\"", ...
Duplicate rule declaration
[ "Duplicate", "rule", "declaration" ]
9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f
https://github.com/harc/ohm/blob/9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f/src/errors.js#L90-L97
train
harc/ohm
src/errors.js
wrongNumberOfParameters
function wrongNumberOfParameters(ruleName, expected, actual, source) { return createError( 'Wrong number of parameters for rule ' + ruleName + ' (expected ' + expected + ', got ' + actual + ')', source); }
javascript
function wrongNumberOfParameters(ruleName, expected, actual, source) { return createError( 'Wrong number of parameters for rule ' + ruleName + ' (expected ' + expected + ', got ' + actual + ')', source); }
[ "function", "wrongNumberOfParameters", "(", "ruleName", ",", "expected", ",", "actual", ",", "source", ")", "{", "return", "createError", "(", "'Wrong number of parameters for rule '", "+", "ruleName", "+", "' (expected '", "+", "expected", "+", "', got '", "+", "ac...
Wrong number of parameters
[ "Wrong", "number", "of", "parameters" ]
9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f
https://github.com/harc/ohm/blob/9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f/src/errors.js#L101-L106
train
harc/ohm
src/errors.js
wrongNumberOfArguments
function wrongNumberOfArguments(ruleName, expected, actual, expr) { return createError( 'Wrong number of arguments for rule ' + ruleName + ' (expected ' + expected + ', got ' + actual + ')', expr.source); }
javascript
function wrongNumberOfArguments(ruleName, expected, actual, expr) { return createError( 'Wrong number of arguments for rule ' + ruleName + ' (expected ' + expected + ', got ' + actual + ')', expr.source); }
[ "function", "wrongNumberOfArguments", "(", "ruleName", ",", "expected", ",", "actual", ",", "expr", ")", "{", "return", "createError", "(", "'Wrong number of arguments for rule '", "+", "ruleName", "+", "' (expected '", "+", "expected", "+", "', got '", "+", "actual...
Wrong number of arguments
[ "Wrong", "number", "of", "arguments" ]
9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f
https://github.com/harc/ohm/blob/9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f/src/errors.js#L110-L115
train
harc/ohm
src/errors.js
invalidParameter
function invalidParameter(ruleName, expr) { return createError( 'Invalid parameter to rule ' + ruleName + ': ' + expr + ' has arity ' + expr.getArity() + ', but parameter expressions must have arity 1', expr.source); }
javascript
function invalidParameter(ruleName, expr) { return createError( 'Invalid parameter to rule ' + ruleName + ': ' + expr + ' has arity ' + expr.getArity() + ', but parameter expressions must have arity 1', expr.source); }
[ "function", "invalidParameter", "(", "ruleName", ",", "expr", ")", "{", "return", "createError", "(", "'Invalid parameter to rule '", "+", "ruleName", "+", "': '", "+", "expr", "+", "' has arity '", "+", "expr", ".", "getArity", "(", ")", "+", "', but parameter ...
Invalid parameter expression
[ "Invalid", "parameter", "expression" ]
9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f
https://github.com/harc/ohm/blob/9fd4fabc135c1303b9a8cb5ed47d2eb5fa1aef8f/src/errors.js#L127-L132
train
senecajs/seneca
lib/logging.js
log_level_plus
function log_level_plus(logLevel) { let index = log_levels.indexOf(logLevel) if (index < 0) { return [] } else { return log_levels.slice(index, log_levels.length) } }
javascript
function log_level_plus(logLevel) { let index = log_levels.indexOf(logLevel) if (index < 0) { return [] } else { return log_levels.slice(index, log_levels.length) } }
[ "function", "log_level_plus", "(", "logLevel", ")", "{", "let", "index", "=", "log_levels", ".", "indexOf", "(", "logLevel", ")", "if", "(", "index", "<", "0", ")", "{", "return", "[", "]", "}", "else", "{", "return", "log_levels", ".", "slice", "(", ...
It returns the levels above the argument @param {String} logLevel the log level to calculate @return {Array} the list of logs above the argument
[ "It", "returns", "the", "levels", "above", "the", "argument" ]
98af1536196d4461e050ab6b71ca7563ea79ed8f
https://github.com/senecajs/seneca/blob/98af1536196d4461e050ab6b71ca7563ea79ed8f/lib/logging.js#L242-L249
train
senecajs/seneca
seneca.js
api_act
function api_act() { var argsarr = new Array(arguments.length) for (var l = 0; l < argsarr.length; ++l) { argsarr[l] = arguments[l] } var self = this var spec = Common.build_message(self, argsarr, 'reply:f?', self.fixedargs) var msg = spec.msg var reply = spec.reply if (opts.$.de...
javascript
function api_act() { var argsarr = new Array(arguments.length) for (var l = 0; l < argsarr.length; ++l) { argsarr[l] = arguments[l] } var self = this var spec = Common.build_message(self, argsarr, 'reply:f?', self.fixedargs) var msg = spec.msg var reply = spec.reply if (opts.$.de...
[ "function", "api_act", "(", ")", "{", "var", "argsarr", "=", "new", "Array", "(", "arguments", ".", "length", ")", "for", "(", "var", "l", "=", "0", ";", "l", "<", "argsarr", ".", "length", ";", "++", "l", ")", "{", "argsarr", "[", "l", "]", "=...
Perform an action. The properties of the first argument are matched against known patterns, and the most specific one wins.
[ "Perform", "an", "action", ".", "The", "properties", "of", "the", "first", "argument", "are", "matched", "against", "known", "patterns", "and", "the", "most", "specific", "one", "wins", "." ]
98af1536196d4461e050ab6b71ca7563ea79ed8f
https://github.com/senecajs/seneca/blob/98af1536196d4461e050ab6b71ca7563ea79ed8f/seneca.js#L755-L778
train
senecajs/seneca
seneca.js
api_close
function api_close(done) { var seneca = this var safe_done = _.once(function(err) { if (_.isFunction(done)) { return done.call(seneca, err) } }) // don't try to close twice if (seneca.flags.closed) { return safe_done() } seneca.ready(do_close) var close_timeo...
javascript
function api_close(done) { var seneca = this var safe_done = _.once(function(err) { if (_.isFunction(done)) { return done.call(seneca, err) } }) // don't try to close twice if (seneca.flags.closed) { return safe_done() } seneca.ready(do_close) var close_timeo...
[ "function", "api_close", "(", "done", ")", "{", "var", "seneca", "=", "this", "var", "safe_done", "=", "_", ".", "once", "(", "function", "(", "err", ")", "{", "if", "(", "_", ".", "isFunction", "(", "done", ")", ")", "{", "return", "done", ".", ...
close seneca instance sets public seneca.closed property
[ "close", "seneca", "instance", "sets", "public", "seneca", ".", "closed", "property" ]
98af1536196d4461e050ab6b71ca7563ea79ed8f
https://github.com/senecajs/seneca/blob/98af1536196d4461e050ab6b71ca7563ea79ed8f/seneca.js#L808-L871
train
senecajs/seneca
seneca.js
make_private
function make_private() { return { stats: { start: Date.now(), act: { calls: 0, done: 0, fails: 0, cache: 0 }, actmap: {} }, actdef: {}, transport: { register: [] }, plugins: {}, ignore_plugins: {} } }
javascript
function make_private() { return { stats: { start: Date.now(), act: { calls: 0, done: 0, fails: 0, cache: 0 }, actmap: {} }, actdef: {}, transport: { register: [] }, plugins: {}, ignore_plugins: {} } }
[ "function", "make_private", "(", ")", "{", "return", "{", "stats", ":", "{", "start", ":", "Date", ".", "now", "(", ")", ",", "act", ":", "{", "calls", ":", "0", ",", "done", ":", "0", ",", "fails", ":", "0", ",", "cache", ":", "0", "}", ",",...
Private member variables of Seneca object.
[ "Private", "member", "variables", "of", "Seneca", "object", "." ]
98af1536196d4461e050ab6b71ca7563ea79ed8f
https://github.com/senecajs/seneca/blob/98af1536196d4461e050ab6b71ca7563ea79ed8f/seneca.js#L1091-L1110
train
senecajs/seneca
docs/examples/custom-logger.js
adapter
function adapter (context, payload) { var when = payload.when.toString() var kind = pad(payload.kind || '-', 8).toUpperCase() var type = pad(payload.case || '-', 8).toUpperCase() var text = payload.pattern || payload.notice || '-' console.log(when, kind, type, text) }
javascript
function adapter (context, payload) { var when = payload.when.toString() var kind = pad(payload.kind || '-', 8).toUpperCase() var type = pad(payload.case || '-', 8).toUpperCase() var text = payload.pattern || payload.notice || '-' console.log(when, kind, type, text) }
[ "function", "adapter", "(", "context", ",", "payload", ")", "{", "var", "when", "=", "payload", ".", "when", ".", "toString", "(", ")", "var", "kind", "=", "pad", "(", "payload", ".", "kind", "||", "'-'", ",", "8", ")", ".", "toUpperCase", "(", ")"...
Everything something is logged it calls whatever custom adapter is set. Adapters are passed the current instance of Seneca plus the raw payload.
[ "Everything", "something", "is", "logged", "it", "calls", "whatever", "custom", "adapter", "is", "set", ".", "Adapters", "are", "passed", "the", "current", "instance", "of", "Seneca", "plus", "the", "raw", "payload", "." ]
98af1536196d4461e050ab6b71ca7563ea79ed8f
https://github.com/senecajs/seneca/blob/98af1536196d4461e050ab6b71ca7563ea79ed8f/docs/examples/custom-logger.js#L30-L37
train
senecajs/seneca
lib/inward.js
inward_act_cache
function inward_act_cache(ctxt, data) { var so = ctxt.options var meta = data.meta var actid = meta.id var private$ = ctxt.seneca.private$ if (actid != null && so.history.active) { var actdetails = private$.history.get(actid) if (actdetails) { private$.stats.act.cache++ var latest = ac...
javascript
function inward_act_cache(ctxt, data) { var so = ctxt.options var meta = data.meta var actid = meta.id var private$ = ctxt.seneca.private$ if (actid != null && so.history.active) { var actdetails = private$.history.get(actid) if (actdetails) { private$.stats.act.cache++ var latest = ac...
[ "function", "inward_act_cache", "(", "ctxt", ",", "data", ")", "{", "var", "so", "=", "ctxt", ".", "options", "var", "meta", "=", "data", ".", "meta", "var", "actid", "=", "meta", ".", "id", "var", "private$", "=", "ctxt", ".", "seneca", ".", "privat...
Check if actid has already been seen, and if action cache is active, then provide cached result, if any. Return true in this case.
[ "Check", "if", "actid", "has", "already", "been", "seen", "and", "if", "action", "cache", "is", "active", "then", "provide", "cached", "result", "if", "any", ".", "Return", "true", "in", "this", "case", "." ]
98af1536196d4461e050ab6b71ca7563ea79ed8f
https://github.com/senecajs/seneca/blob/98af1536196d4461e050ab6b71ca7563ea79ed8f/lib/inward.js#L199-L233
train
mourner/simplify-js
simplify.js
getSqSegDist
function getSqSegDist(p, p1, p2) { var x = p1.x, y = p1.y, dx = p2.x - x, dy = p2.y - y; if (dx !== 0 || dy !== 0) { var t = ((p.x - x) * dx + (p.y - y) * dy) / (dx * dx + dy * dy); if (t > 1) { x = p2.x; y = p2.y; } else if (t > 0) { ...
javascript
function getSqSegDist(p, p1, p2) { var x = p1.x, y = p1.y, dx = p2.x - x, dy = p2.y - y; if (dx !== 0 || dy !== 0) { var t = ((p.x - x) * dx + (p.y - y) * dy) / (dx * dx + dy * dy); if (t > 1) { x = p2.x; y = p2.y; } else if (t > 0) { ...
[ "function", "getSqSegDist", "(", "p", ",", "p1", ",", "p2", ")", "{", "var", "x", "=", "p1", ".", "x", ",", "y", "=", "p1", ".", "y", ",", "dx", "=", "p2", ".", "x", "-", "x", ",", "dy", "=", "p2", ".", "y", "-", "y", ";", "if", "(", ...
square distance from a point to a segment
[ "square", "distance", "from", "a", "point", "to", "a", "segment" ]
d5aae2be69835719d33eca21c229a286559c1664
https://github.com/mourner/simplify-js/blob/d5aae2be69835719d33eca21c229a286559c1664/simplify.js#L22-L47
train
mourner/simplify-js
simplify.js
simplifyRadialDist
function simplifyRadialDist(points, sqTolerance) { var prevPoint = points[0], newPoints = [prevPoint], point; for (var i = 1, len = points.length; i < len; i++) { point = points[i]; if (getSqDist(point, prevPoint) > sqTolerance) { newPoints.push(point); ...
javascript
function simplifyRadialDist(points, sqTolerance) { var prevPoint = points[0], newPoints = [prevPoint], point; for (var i = 1, len = points.length; i < len; i++) { point = points[i]; if (getSqDist(point, prevPoint) > sqTolerance) { newPoints.push(point); ...
[ "function", "simplifyRadialDist", "(", "points", ",", "sqTolerance", ")", "{", "var", "prevPoint", "=", "points", "[", "0", "]", ",", "newPoints", "=", "[", "prevPoint", "]", ",", "point", ";", "for", "(", "var", "i", "=", "1", ",", "len", "=", "poin...
rest of the code doesn't care about point format basic distance-based simplification
[ "rest", "of", "the", "code", "doesn", "t", "care", "about", "point", "format", "basic", "distance", "-", "based", "simplification" ]
d5aae2be69835719d33eca21c229a286559c1664
https://github.com/mourner/simplify-js/blob/d5aae2be69835719d33eca21c229a286559c1664/simplify.js#L51-L69
train
mourner/simplify-js
simplify.js
simplifyDouglasPeucker
function simplifyDouglasPeucker(points, sqTolerance) { var last = points.length - 1; var simplified = [points[0]]; simplifyDPStep(points, 0, last, sqTolerance, simplified); simplified.push(points[last]); return simplified; }
javascript
function simplifyDouglasPeucker(points, sqTolerance) { var last = points.length - 1; var simplified = [points[0]]; simplifyDPStep(points, 0, last, sqTolerance, simplified); simplified.push(points[last]); return simplified; }
[ "function", "simplifyDouglasPeucker", "(", "points", ",", "sqTolerance", ")", "{", "var", "last", "=", "points", ".", "length", "-", "1", ";", "var", "simplified", "=", "[", "points", "[", "0", "]", "]", ";", "simplifyDPStep", "(", "points", ",", "0", ...
simplification using Ramer-Douglas-Peucker algorithm
[ "simplification", "using", "Ramer", "-", "Douglas", "-", "Peucker", "algorithm" ]
d5aae2be69835719d33eca21c229a286559c1664
https://github.com/mourner/simplify-js/blob/d5aae2be69835719d33eca21c229a286559c1664/simplify.js#L92-L100
train
estools/escodegen
benchmark/old.js
isExpression
function isExpression(node) { switch (node.type) { case Syntax.AssignmentExpression: case Syntax.ArrayExpression: case Syntax.ArrayPattern: case Syntax.BinaryExpression: case Syntax.CallExpression: case Syntax.ConditionalExpression: case Syntax.ClassExpres...
javascript
function isExpression(node) { switch (node.type) { case Syntax.AssignmentExpression: case Syntax.ArrayExpression: case Syntax.ArrayPattern: case Syntax.BinaryExpression: case Syntax.CallExpression: case Syntax.ConditionalExpression: case Syntax.ClassExpres...
[ "function", "isExpression", "(", "node", ")", "{", "switch", "(", "node", ".", "type", ")", "{", "case", "Syntax", ".", "AssignmentExpression", ":", "case", "Syntax", ".", "ArrayExpression", ":", "case", "Syntax", ".", "ArrayPattern", ":", "case", "Syntax", ...
Generation is done by generateExpression.
[ "Generation", "is", "done", "by", "generateExpression", "." ]
4a93ffc24378722dbfd8859d633746ef5916ce86
https://github.com/estools/escodegen/blob/4a93ffc24378722dbfd8859d633746ef5916ce86/benchmark/old.js#L136-L169
train
estools/escodegen
benchmark/old.js
isStatement
function isStatement(node) { switch (node.type) { case Syntax.BlockStatement: case Syntax.BreakStatement: case Syntax.CatchClause: case Syntax.ContinueStatement: case Syntax.ClassDeclaration: case Syntax.ClassBody: case Syntax.DirectiveStatement: c...
javascript
function isStatement(node) { switch (node.type) { case Syntax.BlockStatement: case Syntax.BreakStatement: case Syntax.CatchClause: case Syntax.ContinueStatement: case Syntax.ClassDeclaration: case Syntax.ClassBody: case Syntax.DirectiveStatement: c...
[ "function", "isStatement", "(", "node", ")", "{", "switch", "(", "node", ".", "type", ")", "{", "case", "Syntax", ".", "BlockStatement", ":", "case", "Syntax", ".", "BreakStatement", ":", "case", "Syntax", ".", "CatchClause", ":", "case", "Syntax", ".", ...
Generation is done by generateStatement.
[ "Generation", "is", "done", "by", "generateStatement", "." ]
4a93ffc24378722dbfd8859d633746ef5916ce86
https://github.com/estools/escodegen/blob/4a93ffc24378722dbfd8859d633746ef5916ce86/benchmark/old.js#L172-L204
train
estools/escodegen
benchmark/old.js
flattenToString
function flattenToString(arr) { var i, iz, elem, result = ''; for (i = 0, iz = arr.length; i < iz; ++i) { elem = arr[i]; result += isArray(elem) ? flattenToString(elem) : elem; } return result; }
javascript
function flattenToString(arr) { var i, iz, elem, result = ''; for (i = 0, iz = arr.length; i < iz; ++i) { elem = arr[i]; result += isArray(elem) ? flattenToString(elem) : elem; } return result; }
[ "function", "flattenToString", "(", "arr", ")", "{", "var", "i", ",", "iz", ",", "elem", ",", "result", "=", "''", ";", "for", "(", "i", "=", "0", ",", "iz", "=", "arr", ".", "length", ";", "i", "<", "iz", ";", "++", "i", ")", "{", "elem", ...
flatten an array to a string, where the array can contain either strings or nested arrays
[ "flatten", "an", "array", "to", "a", "string", "where", "the", "array", "can", "contain", "either", "strings", "or", "nested", "arrays" ]
4a93ffc24378722dbfd8859d633746ef5916ce86
https://github.com/estools/escodegen/blob/4a93ffc24378722dbfd8859d633746ef5916ce86/benchmark/old.js#L586-L593
train
estools/escodegen
benchmark/old.js
toSourceNodeWhenNeeded
function toSourceNodeWhenNeeded(generated, node) { if (!sourceMap) { // with no source maps, generated is either an // array or a string. if an array, flatten it. // if a string, just return it if (isArray(generated)) { return flattenToString(gene...
javascript
function toSourceNodeWhenNeeded(generated, node) { if (!sourceMap) { // with no source maps, generated is either an // array or a string. if an array, flatten it. // if a string, just return it if (isArray(generated)) { return flattenToString(gene...
[ "function", "toSourceNodeWhenNeeded", "(", "generated", ",", "node", ")", "{", "if", "(", "!", "sourceMap", ")", "{", "// with no source maps, generated is either an", "// array or a string. if an array, flatten it.", "// if a string, just return it", "if", "(", "isArray", "...
convert generated to a SourceNode when source maps are enabled.
[ "convert", "generated", "to", "a", "SourceNode", "when", "source", "maps", "are", "enabled", "." ]
4a93ffc24378722dbfd8859d633746ef5916ce86
https://github.com/estools/escodegen/blob/4a93ffc24378722dbfd8859d633746ef5916ce86/benchmark/old.js#L598-L620
train
TonyGermaneri/canvas-datagrid
lib/draw.js
fillArray
function fillArray(low, high, step, def) { step = step || 1; var i = [], x; for (x = low; x <= high; x += step) { i[x] = def === undefined ? x : (typeof def === 'function' ? def(x) : def); } return i; }
javascript
function fillArray(low, high, step, def) { step = step || 1; var i = [], x; for (x = low; x <= high; x += step) { i[x] = def === undefined ? x : (typeof def === 'function' ? def(x) : def); } return i; }
[ "function", "fillArray", "(", "low", ",", "high", ",", "step", ",", "def", ")", "{", "step", "=", "step", "||", "1", ";", "var", "i", "=", "[", "]", ",", "x", ";", "for", "(", "x", "=", "low", ";", "x", "<=", "high", ";", "x", "+=", "step",...
more heavyweight version than fillArray defined in intf.js
[ "more", "heavyweight", "version", "than", "fillArray", "defined", "in", "intf", ".", "js" ]
71217ae00f26cadbbfa884bc94617435762d24d3
https://github.com/TonyGermaneri/canvas-datagrid/blob/71217ae00f26cadbbfa884bc94617435762d24d3/lib/draw.js#L16-L23
train
TonyGermaneri/canvas-datagrid
tutorials/tutorials.js
createData
function createData() { var x, y, d = []; for (x = 0; x < 100; x += 1) { d[x] = {}; for (y = 0; y < 20; y += 1) { d[x][y] = y * x; } } return d; }
javascript
function createData() { var x, y, d = []; for (x = 0; x < 100; x += 1) { d[x] = {}; for (y = 0; y < 20; y += 1) { d[x][y] = y * x; } } return d; }
[ "function", "createData", "(", ")", "{", "var", "x", ",", "y", ",", "d", "=", "[", "]", ";", "for", "(", "x", "=", "0", ";", "x", "<", "100", ";", "x", "+=", "1", ")", "{", "d", "[", "x", "]", "=", "{", "}", ";", "for", "(", "y", "=",...
this is not a real mode, just for fun you'll probably have to refresh the page to get rid of this timer
[ "this", "is", "not", "a", "real", "mode", "just", "for", "fun", "you", "ll", "probably", "have", "to", "refresh", "the", "page", "to", "get", "rid", "of", "this", "timer" ]
71217ae00f26cadbbfa884bc94617435762d24d3
https://github.com/TonyGermaneri/canvas-datagrid/blob/71217ae00f26cadbbfa884bc94617435762d24d3/tutorials/tutorials.js#L1017-L1026
train
TonyGermaneri/canvas-datagrid
lib/events.js
checkScrollBoxVisibility
function checkScrollBoxVisibility() { self.scrollBox.horizontalBarVisible = (self.style.width !== 'auto' && dataWidth > self.scrollBox.width && self.style.overflowX !== 'hidden') || self.style.overflowX === 'scroll'; self.scrollBox.horizontalBoxVisible = dataWidth > s...
javascript
function checkScrollBoxVisibility() { self.scrollBox.horizontalBarVisible = (self.style.width !== 'auto' && dataWidth > self.scrollBox.width && self.style.overflowX !== 'hidden') || self.style.overflowX === 'scroll'; self.scrollBox.horizontalBoxVisible = dataWidth > s...
[ "function", "checkScrollBoxVisibility", "(", ")", "{", "self", ".", "scrollBox", ".", "horizontalBarVisible", "=", "(", "self", ".", "style", ".", "width", "!==", "'auto'", "&&", "dataWidth", ">", "self", ".", "scrollBox", ".", "width", "&&", "self", ".", ...
sets actual DOM canvas element
[ "sets", "actual", "DOM", "canvas", "element" ]
71217ae00f26cadbbfa884bc94617435762d24d3
https://github.com/TonyGermaneri/canvas-datagrid/blob/71217ae00f26cadbbfa884bc94617435762d24d3/lib/events.js#L123-L130
train
architect/architect
src/create/aws/create-events/index.js
createTopic
function createTopic(env, callback) { sns.createTopic({ Name: `${params.app}-${env}-${params.event}`, }, function _createTopic(err) { if (err) { console.log(err) } setTimeout(callback, 0) }) }
javascript
function createTopic(env, callback) { sns.createTopic({ Name: `${params.app}-${env}-${params.event}`, }, function _createTopic(err) { if (err) { console.log(err) } setTimeout(callback, 0) }) }
[ "function", "createTopic", "(", "env", ",", "callback", ")", "{", "sns", ".", "createTopic", "(", "{", "Name", ":", "`", "${", "params", ".", "app", "}", "${", "env", "}", "${", "params", ".", "event", "}", "`", ",", "}", ",", "function", "_createT...
creates an sns topic
[ "creates", "an", "sns", "topic" ]
c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd
https://github.com/architect/architect/blob/c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd/src/create/aws/create-events/index.js#L22-L32
train
architect/architect
src/deploy/lambda-all/00-read.js
filter
function filter(p) { if (filters.length === 0) return true let predicate = false filters.forEach(section=> { let current = path.join('src', section) if (p.startsWith(current)) { predicate = true } }) return p...
javascript
function filter(p) { if (filters.length === 0) return true let predicate = false filters.forEach(section=> { let current = path.join('src', section) if (p.startsWith(current)) { predicate = true } }) return p...
[ "function", "filter", "(", "p", ")", "{", "if", "(", "filters", ".", "length", "===", "0", ")", "return", "true", "let", "predicate", "=", "false", "filters", ".", "forEach", "(", "section", "=>", "{", "let", "current", "=", "path", ".", "join", "(",...
if filters exist only deploy functions of that type
[ "if", "filters", "exist", "only", "deploy", "functions", "of", "that", "type" ]
c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd
https://github.com/architect/architect/blob/c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd/src/deploy/lambda-all/00-read.js#L11-L22
train
architect/architect
src/sandbox/db/index.js
start
function start(callback) { let handle = {close(){server.close()}} check(function _check(err, inUse) { if (err) throw err if (inUse) { server = {close(){}} init(callback) } else { server = dynalite({ createTableMs: 0 }).listen(5000, function _server(err) { if (...
javascript
function start(callback) { let handle = {close(){server.close()}} check(function _check(err, inUse) { if (err) throw err if (inUse) { server = {close(){}} init(callback) } else { server = dynalite({ createTableMs: 0 }).listen(5000, function _server(err) { if (...
[ "function", "start", "(", "callback", ")", "{", "let", "handle", "=", "{", "close", "(", ")", "{", "server", ".", "close", "(", ")", "}", "}", "check", "(", "function", "_check", "(", "err", ",", "inUse", ")", "{", "if", "(", "err", ")", "throw",...
starts an in-memory dynalite dynamodb server - automatically creates any tables or indexes defined by the arcfile - also creates a local session table
[ "starts", "an", "in", "-", "memory", "dynalite", "dynamodb", "server" ]
c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd
https://github.com/architect/architect/blob/c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd/src/sandbox/db/index.js#L12-L34
train
architect/architect
src/sandbox/events/index.js
start
function start(callback) { let {arc} = readArc() let close = x=> !x // if .arc has events and we're not clobbering with ARC_LOCAL flag if (arc.events || arc.queues) { // start a little web server let server = http.createServer(function listener(req, res) { let body = '' req.on('data', chun...
javascript
function start(callback) { let {arc} = readArc() let close = x=> !x // if .arc has events and we're not clobbering with ARC_LOCAL flag if (arc.events || arc.queues) { // start a little web server let server = http.createServer(function listener(req, res) { let body = '' req.on('data', chun...
[ "function", "start", "(", "callback", ")", "{", "let", "{", "arc", "}", "=", "readArc", "(", ")", "let", "close", "=", "x", "=>", "!", "x", "// if .arc has events and we're not clobbering with ARC_LOCAL flag", "if", "(", "arc", ".", "events", "||", "arc", "....
creates a little web server that listens for events on 3334
[ "creates", "a", "little", "web", "server", "that", "listens", "for", "events", "on", "3334" ]
c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd
https://github.com/architect/architect/blob/c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd/src/sandbox/events/index.js#L12-L64
train
architect/architect
src/sandbox/env/index.js
_readArc
function _readArc(callback) { let parsed = readArc() arc = parsed.arc inventory(arc, null, function _arc(err, result) { if (err) callback(err) else { pathToCode = result.localPaths callback() } }) }
javascript
function _readArc(callback) { let parsed = readArc() arc = parsed.arc inventory(arc, null, function _arc(err, result) { if (err) callback(err) else { pathToCode = result.localPaths callback() } }) }
[ "function", "_readArc", "(", "callback", ")", "{", "let", "parsed", "=", "readArc", "(", ")", "arc", "=", "parsed", ".", "arc", "inventory", "(", "arc", ",", "null", ",", "function", "_arc", "(", "err", ",", "result", ")", "{", "if", "(", "err", ")...
Shared copier and env need Arc inventory
[ "Shared", "copier", "and", "env", "need", "Arc", "inventory" ]
c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd
https://github.com/architect/architect/blob/c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd/src/sandbox/env/index.js#L12-L22
train
architect/architect
src/hydrate/shared/_arc.js
copy
function copy(source, destination, callback) { cp(source, destination, {overwrite: true}, function done(err) { if (err) callback(err) else callback() }) }
javascript
function copy(source, destination, callback) { cp(source, destination, {overwrite: true}, function done(err) { if (err) callback(err) else callback() }) }
[ "function", "copy", "(", "source", ",", "destination", ",", "callback", ")", "{", "cp", "(", "source", ",", "destination", ",", "{", "overwrite", ":", "true", "}", ",", "function", "done", "(", "err", ")", "{", "if", "(", "err", ")", "callback", "(",...
Reusable copier, always overwrites
[ "Reusable", "copier", "always", "overwrites" ]
c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd
https://github.com/architect/architect/blob/c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd/src/hydrate/shared/_arc.js#L47-L52
train
architect/architect
src/create/aws/create-event-lambda-deployments/_get-sns-topic-arn.js
listTopics
function listTopics(next, done) { let params = next? {NextToken:next} : {} sns.listTopics(params, function _listTopics(err, result) { if (err) { done(err) } else { // keep track of our current iteration let index = 0 let tidy = t=> t.TopicArn.split(':').reverse(...
javascript
function listTopics(next, done) { let params = next? {NextToken:next} : {} sns.listTopics(params, function _listTopics(err, result) { if (err) { done(err) } else { // keep track of our current iteration let index = 0 let tidy = t=> t.TopicArn.split(':').reverse(...
[ "function", "listTopics", "(", "next", ",", "done", ")", "{", "let", "params", "=", "next", "?", "{", "NextToken", ":", "next", "}", ":", "{", "}", "sns", ".", "listTopics", "(", "params", ",", "function", "_listTopics", "(", "err", ",", "result", ")...
aws-sdk isn't the friendliest api we need to recurse thru topics searching for the arn
[ "aws", "-", "sdk", "isn", "t", "the", "friendliest", "api", "we", "need", "to", "recurse", "thru", "topics", "searching", "for", "the", "arn" ]
c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd
https://github.com/architect/architect/blob/c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd/src/create/aws/create-event-lambda-deployments/_get-sns-topic-arn.js#L10-L38
train
architect/architect
src/audit/_sync-role.js
read
function read(callback) { let raw = fs.readFileSync(thing.path).toString() //let json = thing.path.split('.').reverse()[0] === 'json' // TODO add support for role.yaml let policies = JSON.parse(raw).policies callback(null, policies || []) }
javascript
function read(callback) { let raw = fs.readFileSync(thing.path).toString() //let json = thing.path.split('.').reverse()[0] === 'json' // TODO add support for role.yaml let policies = JSON.parse(raw).policies callback(null, policies || []) }
[ "function", "read", "(", "callback", ")", "{", "let", "raw", "=", "fs", ".", "readFileSync", "(", "thing", ".", "path", ")", ".", "toString", "(", ")", "//let json = thing.path.split('.').reverse()[0] === 'json'", "// TODO add support for role.yaml", "let", "policies"...
read the managed policies
[ "read", "the", "managed", "policies" ]
c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd
https://github.com/architect/architect/blob/c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd/src/audit/_sync-role.js#L20-L26
train
architect/architect
src/audit/_sync-role.js
removes
function removes(result, callback) { let fns = result.AttachedPolicies.map(p=> { return function maybeRemove(callback) { let PolicyArn = p.PolicyArn if (policies.includes(PolicyArn)) { callback() } ...
javascript
function removes(result, callback) { let fns = result.AttachedPolicies.map(p=> { return function maybeRemove(callback) { let PolicyArn = p.PolicyArn if (policies.includes(PolicyArn)) { callback() } ...
[ "function", "removes", "(", "result", ",", "callback", ")", "{", "let", "fns", "=", "result", ".", "AttachedPolicies", ".", "map", "(", "p", "=>", "{", "return", "function", "maybeRemove", "(", "callback", ")", "{", "let", "PolicyArn", "=", "p", ".", "...
if not in the list remove it
[ "if", "not", "in", "the", "list", "remove", "it" ]
c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd
https://github.com/architect/architect/blob/c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd/src/audit/_sync-role.js#L63-L79
train
architect/architect
src/audit/_sync-role.js
adds
function adds(result, callback) { let fns = policies.map(PolicyArn=> { return function maybeAdd(callback) { iam.attachRolePolicy({ RoleName, PolicyArn }, callback) } })...
javascript
function adds(result, callback) { let fns = policies.map(PolicyArn=> { return function maybeAdd(callback) { iam.attachRolePolicy({ RoleName, PolicyArn }, callback) } })...
[ "function", "adds", "(", "result", ",", "callback", ")", "{", "let", "fns", "=", "policies", ".", "map", "(", "PolicyArn", "=>", "{", "return", "function", "maybeAdd", "(", "callback", ")", "{", "iam", ".", "attachRolePolicy", "(", "{", "RoleName", ",", ...
attaches policies from role.json
[ "attaches", "policies", "from", "role", ".", "json" ]
c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd
https://github.com/architect/architect/blob/c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd/src/audit/_sync-role.js#L81-L91
train
architect/architect
src/deploy/lambda-one/_zip-impl.js
_read
function _read(callback) { glob(path.join(process.cwd(), pathToCode, '/*'), {dot:true}, callback) }
javascript
function _read(callback) { glob(path.join(process.cwd(), pathToCode, '/*'), {dot:true}, callback) }
[ "function", "_read", "(", "callback", ")", "{", "glob", "(", "path", ".", "join", "(", "process", ".", "cwd", "(", ")", ",", "pathToCode", ",", "'/*'", ")", ",", "{", "dot", ":", "true", "}", ",", "callback", ")", "}" ]
get a handle on the files to zip
[ "get", "a", "handle", "on", "the", "files", "to", "zip" ]
c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd
https://github.com/architect/architect/blob/c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd/src/deploy/lambda-one/_zip-impl.js#L19-L21
train
architect/architect
src/create/aws/create-ws-router/create/route.js
createIntegration
function createIntegration(callback) { setTimeout(function throttle() { let uri = `arn:aws:apigateway:${region}:lambda:path/2015-03-31/functions/${arn}/invocations` // console.log(api) gateway.createIntegration({ ApiId: api.ApiId, IntegrationMethod: 'POST', In...
javascript
function createIntegration(callback) { setTimeout(function throttle() { let uri = `arn:aws:apigateway:${region}:lambda:path/2015-03-31/functions/${arn}/invocations` // console.log(api) gateway.createIntegration({ ApiId: api.ApiId, IntegrationMethod: 'POST', In...
[ "function", "createIntegration", "(", "callback", ")", "{", "setTimeout", "(", "function", "throttle", "(", ")", "{", "let", "uri", "=", "`", "${", "region", "}", "${", "arn", "}", "`", "// console.log(api)", "gateway", ".", "createIntegration", "(", "{", ...
setup the integration
[ "setup", "the", "integration" ]
c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd
https://github.com/architect/architect/blob/c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd/src/create/aws/create-ws-router/create/route.js#L18-L29
train
architect/architect
src/create/aws/create-ws-router/create/route.js
createRoute
function createRoute(result, callback) { setTimeout(function throttle() { gateway.createRoute({ ApiId: api.ApiId, RouteKey, Target: `integrations/${integrationId}` }, callback) }, 1000) }
javascript
function createRoute(result, callback) { setTimeout(function throttle() { gateway.createRoute({ ApiId: api.ApiId, RouteKey, Target: `integrations/${integrationId}` }, callback) }, 1000) }
[ "function", "createRoute", "(", "result", ",", "callback", ")", "{", "setTimeout", "(", "function", "throttle", "(", ")", "{", "gateway", ".", "createRoute", "(", "{", "ApiId", ":", "api", ".", "ApiId", ",", "RouteKey", ",", "Target", ":", "`", "${", "...
create the route
[ "create", "the", "route" ]
c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd
https://github.com/architect/architect/blob/c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd/src/create/aws/create-ws-router/create/route.js#L50-L58
train
architect/architect
src/create/aws/create-http-static-proxy/read.js
getBucket
function getBucket(env, static) { let staging let production static.forEach(thing=> { if (thing[0] === 'staging') { staging = thing[1] } if (thing[0] === 'production') { production = thing[1] } }) if (env === 'staging') return staging if (env === 'production') return prod...
javascript
function getBucket(env, static) { let staging let production static.forEach(thing=> { if (thing[0] === 'staging') { staging = thing[1] } if (thing[0] === 'production') { production = thing[1] } }) if (env === 'staging') return staging if (env === 'production') return prod...
[ "function", "getBucket", "(", "env", ",", "static", ")", "{", "let", "staging", "let", "production", "static", ".", "forEach", "(", "thing", "=>", "{", "if", "(", "thing", "[", "0", "]", "===", "'staging'", ")", "{", "staging", "=", "thing", "[", "1"...
helper returns the @static value for the current NODE_ENV
[ "helper", "returns", "the" ]
c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd
https://github.com/architect/architect/blob/c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd/src/create/aws/create-http-static-proxy/read.js#L36-L51
train
architect/architect
src/dns/basic/_domains-create.js
reads
function reads(callback) { parallel({ cert(callback) { acm.listCertificates({}, callback) }, apis(callback) { gw.getRestApis({ limit: 500, }, callback) } }, callback) }
javascript
function reads(callback) { parallel({ cert(callback) { acm.listCertificates({}, callback) }, apis(callback) { gw.getRestApis({ limit: 500, }, callback) } }, callback) }
[ "function", "reads", "(", "callback", ")", "{", "parallel", "(", "{", "cert", "(", "callback", ")", "{", "acm", ".", "listCertificates", "(", "{", "}", ",", "callback", ")", "}", ",", "apis", "(", "callback", ")", "{", "gw", ".", "getRestApis", "(", ...
get the cert and the restapiid
[ "get", "the", "cert", "and", "the", "restapiid" ]
c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd
https://github.com/architect/architect/blob/c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd/src/dns/basic/_domains-create.js#L17-L28
train
architect/architect
src/dns/route53/03-alias.js
getRecordSetsAndDomains
function getRecordSetsAndDomains(result, callback) { HostedZoneId = result.HostedZones.find(i=>i.Name === `${domain}.`).Id parallel({ apis(callback) { gateway.getDomainNames({ limit: 500, }, callback) }, records(callback) { route53.listResour...
javascript
function getRecordSetsAndDomains(result, callback) { HostedZoneId = result.HostedZones.find(i=>i.Name === `${domain}.`).Id parallel({ apis(callback) { gateway.getDomainNames({ limit: 500, }, callback) }, records(callback) { route53.listResour...
[ "function", "getRecordSetsAndDomains", "(", "result", ",", "callback", ")", "{", "HostedZoneId", "=", "result", ".", "HostedZones", ".", "find", "(", "i", "=>", "i", ".", "Name", "===", "`", "${", "domain", "}", "`", ")", ".", "Id", "parallel", "(", "{...
read route53 recordsets and apigateway domains
[ "read", "route53", "recordsets", "and", "apigateway", "domains" ]
c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd
https://github.com/architect/architect/blob/c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd/src/dns/route53/03-alias.js#L22-L36
train
architect/architect
src/deploy/helpers/delta.js
stringify
function stringify(arc) { let fmtTbl = obj=> { let name = Object.keys(obj)[0] let keys = Object.keys(obj[name]) let result = `${name}\n` keys.forEach(key=> { let val = obj[name][key] result += ` ${key} ${val}\n` }) return result } let str = `@app\n${arc.app[0]}\n` //////////...
javascript
function stringify(arc) { let fmtTbl = obj=> { let name = Object.keys(obj)[0] let keys = Object.keys(obj[name]) let result = `${name}\n` keys.forEach(key=> { let val = obj[name][key] result += ` ${key} ${val}\n` }) return result } let str = `@app\n${arc.app[0]}\n` //////////...
[ "function", "stringify", "(", "arc", ")", "{", "let", "fmtTbl", "=", "obj", "=>", "{", "let", "name", "=", "Object", ".", "keys", "(", "obj", ")", "[", "0", "]", "let", "keys", "=", "Object", ".", "keys", "(", "obj", "[", "name", "]", ")", "let...
create a .arc string from arc object
[ "create", "a", ".", "arc", "string", "from", "arc", "object" ]
c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd
https://github.com/architect/architect/blob/c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd/src/deploy/helpers/delta.js#L103-L135
train
architect/architect
src/create/aws/_get-iam-role.js
_createRole
function _createRole(callback) { var iam = new aws.IAM iam.createRole({ AssumeRolePolicyDocument: JSON.stringify({ Version: '2012-10-17', Statement: [{ Sid: '', Effect: 'Allow', Principal: { Service: 'lambda.amazonaws.com' }, Action: 'sts:AssumeRole'...
javascript
function _createRole(callback) { var iam = new aws.IAM iam.createRole({ AssumeRolePolicyDocument: JSON.stringify({ Version: '2012-10-17', Statement: [{ Sid: '', Effect: 'Allow', Principal: { Service: 'lambda.amazonaws.com' }, Action: 'sts:AssumeRole'...
[ "function", "_createRole", "(", "callback", ")", "{", "var", "iam", "=", "new", "aws", ".", "IAM", "iam", ".", "createRole", "(", "{", "AssumeRolePolicyDocument", ":", "JSON", ".", "stringify", "(", "{", "Version", ":", "'2012-10-17'", ",", "Statement", ":...
create arc-role
[ "create", "arc", "-", "role" ]
c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd
https://github.com/architect/architect/blob/c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd/src/create/aws/_get-iam-role.js#L34-L98
train
architect/architect
src/inventory/index.js
getName
function getName(tuple) { if (Array.isArray(tuple)) { var verb = tuple[0] var path = getLambdaName(tuple[1]) return [`${app}-production-${verb}${path}`, `${app}-staging-${verb}${path}`] } else { var path = getLambdaName(tuple) return [`${app}-production-get${path}`, `${app}-sta...
javascript
function getName(tuple) { if (Array.isArray(tuple)) { var verb = tuple[0] var path = getLambdaName(tuple[1]) return [`${app}-production-${verb}${path}`, `${app}-staging-${verb}${path}`] } else { var path = getLambdaName(tuple) return [`${app}-production-get${path}`, `${app}-sta...
[ "function", "getName", "(", "tuple", ")", "{", "if", "(", "Array", ".", "isArray", "(", "tuple", ")", ")", "{", "var", "verb", "=", "tuple", "[", "0", "]", "var", "path", "=", "getLambdaName", "(", "tuple", "[", "1", "]", ")", "return", "[", "`",...
gets an http lambda name
[ "gets", "an", "http", "lambda", "name" ]
c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd
https://github.com/architect/architect/blob/c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd/src/inventory/index.js#L56-L66
train
architect/architect
src/inventory/index.js
getSystemName
function getSystemName(tuple) { if (Array.isArray(tuple)) { var verb = tuple[0] var path = getLambdaName(tuple[1]) return `${verb}${path}` } else { var path = getLambdaName(tuple) return `get${path}` } }
javascript
function getSystemName(tuple) { if (Array.isArray(tuple)) { var verb = tuple[0] var path = getLambdaName(tuple[1]) return `${verb}${path}` } else { var path = getLambdaName(tuple) return `get${path}` } }
[ "function", "getSystemName", "(", "tuple", ")", "{", "if", "(", "Array", ".", "isArray", "(", "tuple", ")", ")", "{", "var", "verb", "=", "tuple", "[", "0", "]", "var", "path", "=", "getLambdaName", "(", "tuple", "[", "1", "]", ")", "return", "`", ...
gets an http filesystem name
[ "gets", "an", "http", "filesystem", "name" ]
c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd
https://github.com/architect/architect/blob/c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd/src/inventory/index.js#L83-L93
train
architect/architect
src/inventory/index.js
getLegacyName
function getLegacyName(tuple) { if (Array.isArray(tuple)) { var verb = tuple[0] var path = getLegacyLambdaName(tuple[1]) return [`${app}-production-${verb}${path}`, `${app}-staging-${verb}${path}`] } else { var path = getLegacyLambdaName(tuple) return [`${app}-production-get${p...
javascript
function getLegacyName(tuple) { if (Array.isArray(tuple)) { var verb = tuple[0] var path = getLegacyLambdaName(tuple[1]) return [`${app}-production-${verb}${path}`, `${app}-staging-${verb}${path}`] } else { var path = getLegacyLambdaName(tuple) return [`${app}-production-get${p...
[ "function", "getLegacyName", "(", "tuple", ")", "{", "if", "(", "Array", ".", "isArray", "(", "tuple", ")", ")", "{", "var", "verb", "=", "tuple", "[", "0", "]", "var", "path", "=", "getLegacyLambdaName", "(", "tuple", "[", "1", "]", ")", "return", ...
gets an legacy lambda name
[ "gets", "an", "legacy", "lambda", "name" ]
c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd
https://github.com/architect/architect/blob/c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd/src/inventory/index.js#L96-L106
train
architect/architect
src/inventory/index.js
getLegacySystemName
function getLegacySystemName(tuple) { if (Array.isArray(tuple)) { var verb = tuple[0] var path = getLegacyLambdaName(tuple[1]) return `${verb}${path}` } else { var path = getLegacyLambdaName(tuple) return `get${path}` } }
javascript
function getLegacySystemName(tuple) { if (Array.isArray(tuple)) { var verb = tuple[0] var path = getLegacyLambdaName(tuple[1]) return `${verb}${path}` } else { var path = getLegacyLambdaName(tuple) return `get${path}` } }
[ "function", "getLegacySystemName", "(", "tuple", ")", "{", "if", "(", "Array", ".", "isArray", "(", "tuple", ")", ")", "{", "var", "verb", "=", "tuple", "[", "0", "]", "var", "path", "=", "getLegacyLambdaName", "(", "tuple", "[", "1", "]", ")", "retu...
gets an legacy filesystem name
[ "gets", "an", "legacy", "filesystem", "name" ]
c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd
https://github.com/architect/architect/blob/c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd/src/inventory/index.js#L109-L119
train
architect/architect
src/inventory/index.js
getScheduledName
function getScheduledName(arr) { var name = arr.slice(0).shift() return [`${app}-production-${name}`, `${app}-staging-${name}`] }
javascript
function getScheduledName(arr) { var name = arr.slice(0).shift() return [`${app}-production-${name}`, `${app}-staging-${name}`] }
[ "function", "getScheduledName", "(", "arr", ")", "{", "var", "name", "=", "arr", ".", "slice", "(", "0", ")", ".", "shift", "(", ")", "return", "[", "`", "${", "app", "}", "${", "name", "}", "`", ",", "`", "${", "app", "}", "${", "name", "}", ...
get a scheduled lambda name
[ "get", "a", "scheduled", "lambda", "name" ]
c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd
https://github.com/architect/architect/blob/c5fd0b9b73ce57f2a34cf854ff8e49cc671468dd/src/inventory/index.js#L127-L130
train
jagenjo/litegraph.js
build/litegraph.js
function(type, base_class) { if (!base_class.prototype) { throw "Cannot register a simple object, it must be a class with a prototype"; } base_class.type = type; if (LiteGraph.debug) { console.log("Node registered: " + type); }...
javascript
function(type, base_class) { if (!base_class.prototype) { throw "Cannot register a simple object, it must be a class with a prototype"; } base_class.type = type; if (LiteGraph.debug) { console.log("Node registered: " + type); }...
[ "function", "(", "type", ",", "base_class", ")", "{", "if", "(", "!", "base_class", ".", "prototype", ")", "{", "throw", "\"Cannot register a simple object, it must be a class with a prototype\"", ";", "}", "base_class", ".", "type", "=", "type", ";", "if", "(", ...
used to add extra features to the search box Register a node class so it can be listed when the user wants to create a new one @method registerNodeType @param {String} type name of the node and path @param {Class} base_class class containing the structure of a node
[ "used", "to", "add", "extra", "features", "to", "the", "search", "box", "Register", "a", "node", "class", "so", "it", "can", "be", "listed", "when", "the", "user", "wants", "to", "create", "a", "new", "one" ]
b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2
https://github.com/jagenjo/litegraph.js/blob/b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2/build/litegraph.js#L101-L188
train
jagenjo/litegraph.js
build/litegraph.js
function( name, func, param_types, return_type, properties ) { var params = Array(func.length); var code = ""; var names = LiteGraph.getParameterNames(func); for (var i = 0; i < names.length; ++i) { ...
javascript
function( name, func, param_types, return_type, properties ) { var params = Array(func.length); var code = ""; var names = LiteGraph.getParameterNames(func); for (var i = 0; i < names.length; ++i) { ...
[ "function", "(", "name", ",", "func", ",", "param_types", ",", "return_type", ",", "properties", ")", "{", "var", "params", "=", "Array", "(", "func", ".", "length", ")", ";", "var", "code", "=", "\"\"", ";", "var", "names", "=", "LiteGraph", ".", "g...
Create a new nodetype by passing a function, it wraps it with a proper class and generates inputs according to the parameters of the function. Useful to wrap simple methods that do not require properties, and that only process some input to generate an output. @method wrapFunctionAsNode @param {String} name node name w...
[ "Create", "a", "new", "nodetype", "by", "passing", "a", "function", "it", "wraps", "it", "with", "a", "proper", "class", "and", "generates", "inputs", "according", "to", "the", "parameters", "of", "the", "function", ".", "Useful", "to", "wrap", "simple", "...
b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2
https://github.com/jagenjo/litegraph.js/blob/b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2/build/litegraph.js#L200-L239
train
jagenjo/litegraph.js
build/litegraph.js
function(type, title, options) { var base_class = this.registered_node_types[type]; if (!base_class) { if (LiteGraph.debug) { console.log( 'GraphNode type "' + type + '" not registered.' ); } ...
javascript
function(type, title, options) { var base_class = this.registered_node_types[type]; if (!base_class) { if (LiteGraph.debug) { console.log( 'GraphNode type "' + type + '" not registered.' ); } ...
[ "function", "(", "type", ",", "title", ",", "options", ")", "{", "var", "base_class", "=", "this", ".", "registered_node_types", "[", "type", "]", ";", "if", "(", "!", "base_class", ")", "{", "if", "(", "LiteGraph", ".", "debug", ")", "{", "console", ...
Create a node of a given type with a name. The node is not attached to any graph yet. @method createNode @param {String} type full name of the node class. p.e. "math/sin" @param {String} name a name to distinguish from other nodes @param {Object} options to set options
[ "Create", "a", "node", "of", "a", "given", "type", "with", "a", "name", ".", "The", "node", "is", "not", "attached", "to", "any", "graph", "yet", "." ]
b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2
https://github.com/jagenjo/litegraph.js/blob/b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2/build/litegraph.js#L266-L326
train
jagenjo/litegraph.js
build/litegraph.js
function(category, filter) { var r = []; for (var i in this.registered_node_types) { var type = this.registered_node_types[i]; if (filter && type.filter && type.filter != filter) { continue; } if (category == ""...
javascript
function(category, filter) { var r = []; for (var i in this.registered_node_types) { var type = this.registered_node_types[i]; if (filter && type.filter && type.filter != filter) { continue; } if (category == ""...
[ "function", "(", "category", ",", "filter", ")", "{", "var", "r", "=", "[", "]", ";", "for", "(", "var", "i", "in", "this", ".", "registered_node_types", ")", "{", "var", "type", "=", "this", ".", "registered_node_types", "[", "i", "]", ";", "if", ...
Returns a list of node types matching one category @method getNodeType @param {String} category category name @return {Array} array with all the node classes
[ "Returns", "a", "list", "of", "node", "types", "matching", "one", "category" ]
b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2
https://github.com/jagenjo/litegraph.js/blob/b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2/build/litegraph.js#L345-L363
train
jagenjo/litegraph.js
build/litegraph.js
function() { var categories = { "": 1 }; for (var i in this.registered_node_types) { if ( this.registered_node_types[i].category && !this.registered_node_types[i].skip_list ) { categories[this.registered_...
javascript
function() { var categories = { "": 1 }; for (var i in this.registered_node_types) { if ( this.registered_node_types[i].category && !this.registered_node_types[i].skip_list ) { categories[this.registered_...
[ "function", "(", ")", "{", "var", "categories", "=", "{", "\"\"", ":", "1", "}", ";", "for", "(", "var", "i", "in", "this", ".", "registered_node_types", ")", "{", "if", "(", "this", ".", "registered_node_types", "[", "i", "]", ".", "category", "&&",...
Returns a list with all the node type categories @method getNodeTypesCategories @return {Array} array with all the names of the categories
[ "Returns", "a", "list", "with", "all", "the", "node", "type", "categories" ]
b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2
https://github.com/jagenjo/litegraph.js/blob/b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2/build/litegraph.js#L371-L386
train
jagenjo/litegraph.js
build/litegraph.js
function(obj, target) { if (obj == null) { return null; } var r = JSON.parse(JSON.stringify(obj)); if (!target) { return r; } for (var i in r) { target[i] = r[i]; } return tar...
javascript
function(obj, target) { if (obj == null) { return null; } var r = JSON.parse(JSON.stringify(obj)); if (!target) { return r; } for (var i in r) { target[i] = r[i]; } return tar...
[ "function", "(", "obj", ",", "target", ")", "{", "if", "(", "obj", "==", "null", ")", "{", "return", "null", ";", "}", "var", "r", "=", "JSON", ".", "parse", "(", "JSON", ".", "stringify", "(", "obj", ")", ")", ";", "if", "(", "!", "target", ...
separated just to improve if it doesn't work
[ "separated", "just", "to", "improve", "if", "it", "doesn", "t", "work" ]
b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2
https://github.com/jagenjo/litegraph.js/blob/b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2/build/litegraph.js#L434-L447
train
jagenjo/litegraph.js
build/litegraph.js
LLink
function LLink(id, type, origin_id, origin_slot, target_id, target_slot) { this.id = id; this.type = type; this.origin_id = origin_id; this.origin_slot = origin_slot; this.target_id = target_id; this.target_slot = target_slot; this._data = null; this._pos...
javascript
function LLink(id, type, origin_id, origin_slot, target_id, target_slot) { this.id = id; this.type = type; this.origin_id = origin_id; this.origin_slot = origin_slot; this.target_id = target_id; this.target_slot = target_slot; this._data = null; this._pos...
[ "function", "LLink", "(", "id", ",", "type", ",", "origin_id", ",", "origin_slot", ",", "target_id", ",", "target_slot", ")", "{", "this", ".", "id", "=", "id", ";", "this", ".", "type", "=", "type", ";", "this", ".", "origin_id", "=", "origin_id", "...
this is the class in charge of storing link information
[ "this", "is", "the", "class", "in", "charge", "of", "storing", "link", "information" ]
b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2
https://github.com/jagenjo/litegraph.js/blob/b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2/build/litegraph.js#L1954-L1964
train
jagenjo/litegraph.js
build/litegraph.js
isInsideBounding
function isInsideBounding(p, bb) { if ( p[0] < bb[0][0] || p[1] < bb[0][1] || p[0] > bb[1][0] || p[1] > bb[1][1] ) { return false; } return true; }
javascript
function isInsideBounding(p, bb) { if ( p[0] < bb[0][0] || p[1] < bb[0][1] || p[0] > bb[1][0] || p[1] > bb[1][1] ) { return false; } return true; }
[ "function", "isInsideBounding", "(", "p", ",", "bb", ")", "{", "if", "(", "p", "[", "0", "]", "<", "bb", "[", "0", "]", "[", "0", "]", "||", "p", "[", "1", "]", "<", "bb", "[", "0", "]", "[", "1", "]", "||", "p", "[", "0", "]", ">", "...
point inside bounding box
[ "point", "inside", "bounding", "box" ]
b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2
https://github.com/jagenjo/litegraph.js/blob/b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2/build/litegraph.js#L9994-L10004
train
jagenjo/litegraph.js
build/litegraph.js
hex2num
function hex2num(hex) { if (hex.charAt(0) == "#") { hex = hex.slice(1); } //Remove the '#' char - if there is one. hex = hex.toUpperCase(); var hex_alphabets = "0123456789ABCDEF"; var value = new Array(3); var k = 0; var int1, int2; for (var i ...
javascript
function hex2num(hex) { if (hex.charAt(0) == "#") { hex = hex.slice(1); } //Remove the '#' char - if there is one. hex = hex.toUpperCase(); var hex_alphabets = "0123456789ABCDEF"; var value = new Array(3); var k = 0; var int1, int2; for (var i ...
[ "function", "hex2num", "(", "hex", ")", "{", "if", "(", "hex", ".", "charAt", "(", "0", ")", "==", "\"#\"", ")", "{", "hex", "=", "hex", ".", "slice", "(", "1", ")", ";", "}", "//Remove the '#' char - if there is one.", "hex", "=", "hex", ".", "toUpp...
Convert a hex value to its decimal value - the inputted hex must be in the format of a hex triplet - the kind we use for HTML colours. The function will return an array with three values.
[ "Convert", "a", "hex", "value", "to", "its", "decimal", "value", "-", "the", "inputted", "hex", "must", "be", "in", "the", "format", "of", "a", "hex", "triplet", "-", "the", "kind", "we", "use", "for", "HTML", "colours", ".", "The", "function", "will",...
b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2
https://github.com/jagenjo/litegraph.js/blob/b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2/build/litegraph.js#L10029-L10045
train
jagenjo/litegraph.js
build/litegraph.js
num2hex
function num2hex(triplet) { var hex_alphabets = "0123456789ABCDEF"; var hex = "#"; var int1, int2; for (var i = 0; i < 3; i++) { int1 = triplet[i] / 16; int2 = triplet[i] % 16; hex += hex_alphabets.charAt(int1) + hex_alphabets.charAt(int2); } ...
javascript
function num2hex(triplet) { var hex_alphabets = "0123456789ABCDEF"; var hex = "#"; var int1, int2; for (var i = 0; i < 3; i++) { int1 = triplet[i] / 16; int2 = triplet[i] % 16; hex += hex_alphabets.charAt(int1) + hex_alphabets.charAt(int2); } ...
[ "function", "num2hex", "(", "triplet", ")", "{", "var", "hex_alphabets", "=", "\"0123456789ABCDEF\"", ";", "var", "hex", "=", "\"#\"", ";", "var", "int1", ",", "int2", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "3", ";", "i", "++", ")", ...
Give a array with three values as the argument and the function will return the corresponding hex triplet.
[ "Give", "a", "array", "with", "three", "values", "as", "the", "argument", "and", "the", "function", "will", "return", "the", "corresponding", "hex", "triplet", "." ]
b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2
https://github.com/jagenjo/litegraph.js/blob/b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2/build/litegraph.js#L10051-L10062
train
jagenjo/litegraph.js
build/litegraph.js
inner_onclick
function inner_onclick(e) { var value = this.value; var close_parent = true; if (that.current_submenu) { that.current_submenu.close(e); } //global callback if (options.callback) { var r = options.callback.call( ...
javascript
function inner_onclick(e) { var value = this.value; var close_parent = true; if (that.current_submenu) { that.current_submenu.close(e); } //global callback if (options.callback) { var r = options.callback.call( ...
[ "function", "inner_onclick", "(", "e", ")", "{", "var", "value", "=", "this", ".", "value", ";", "var", "close_parent", "=", "true", ";", "if", "(", "that", ".", "current_submenu", ")", "{", "that", ".", "current_submenu", ".", "close", "(", "e", ")", ...
menu option clicked
[ "menu", "option", "clicked" ]
b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2
https://github.com/jagenjo/litegraph.js/blob/b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2/build/litegraph.js#L10313-L10377
train
jagenjo/litegraph.js
build/litegraph.js
GraphInput
function GraphInput() { this.addOutput("", ""); this.name_in_graph = ""; this.properties = {}; var that = this; Object.defineProperty(this.properties, "name", { get: function() { return that.name_in_graph; }, set: function(v) ...
javascript
function GraphInput() { this.addOutput("", ""); this.name_in_graph = ""; this.properties = {}; var that = this; Object.defineProperty(this.properties, "name", { get: function() { return that.name_in_graph; }, set: function(v) ...
[ "function", "GraphInput", "(", ")", "{", "this", ".", "addOutput", "(", "\"\"", ",", "\"\"", ")", ";", "this", ".", "name_in_graph", "=", "\"\"", ";", "this", ".", "properties", "=", "{", "}", ";", "var", "that", "=", "this", ";", "Object", ".", "d...
Input for a subgraph
[ "Input", "for", "a", "subgraph" ]
b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2
https://github.com/jagenjo/litegraph.js/blob/b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2/build/litegraph.js#L10798-L10869
train
jagenjo/litegraph.js
build/litegraph.js
GraphOutput
function GraphOutput() { this.addInput("", ""); this.name_in_graph = ""; this.properties = {}; var that = this; Object.defineProperty(this.properties, "name", { get: function() { return that.name_in_graph; }, set: function(v) ...
javascript
function GraphOutput() { this.addInput("", ""); this.name_in_graph = ""; this.properties = {}; var that = this; Object.defineProperty(this.properties, "name", { get: function() { return that.name_in_graph; }, set: function(v) ...
[ "function", "GraphOutput", "(", ")", "{", "this", ".", "addInput", "(", "\"\"", ",", "\"\"", ")", ";", "this", ".", "name_in_graph", "=", "\"\"", ";", "this", ".", "properties", "=", "{", "}", ";", "var", "that", "=", "this", ";", "Object", ".", "d...
Output for a subgraph
[ "Output", "for", "a", "subgraph" ]
b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2
https://github.com/jagenjo/litegraph.js/blob/b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2/build/litegraph.js#L10910-L10981
train
jagenjo/litegraph.js
build/litegraph.js
Sequencer
function Sequencer() { this.addInput("", LiteGraph.ACTION); this.addInput("", LiteGraph.ACTION); this.addInput("", LiteGraph.ACTION); this.addInput("", LiteGraph.ACTION); this.addInput("", LiteGraph.ACTION); this.addInput("", LiteGraph.ACTION); this.addOutp...
javascript
function Sequencer() { this.addInput("", LiteGraph.ACTION); this.addInput("", LiteGraph.ACTION); this.addInput("", LiteGraph.ACTION); this.addInput("", LiteGraph.ACTION); this.addInput("", LiteGraph.ACTION); this.addInput("", LiteGraph.ACTION); this.addOutp...
[ "function", "Sequencer", "(", ")", "{", "this", ".", "addInput", "(", "\"\"", ",", "LiteGraph", ".", "ACTION", ")", ";", "this", ".", "addInput", "(", "\"\"", ",", "LiteGraph", ".", "ACTION", ")", ";", "this", ".", "addInput", "(", "\"\"", ",", "Lite...
Sequencer for events
[ "Sequencer", "for", "events" ]
b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2
https://github.com/jagenjo/litegraph.js/blob/b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2/build/litegraph.js#L11397-L11412
train
jagenjo/litegraph.js
build/litegraph.js
MathFormula
function MathFormula() { this.addInput("x", "number"); this.addInput("y", "number"); this.addOutput("", "number"); this.properties = { x: 1.0, y: 1.0, formula: "x+y" }; this.code_widget = this.addWidget( "text", "F(x,y)", this.propertie...
javascript
function MathFormula() { this.addInput("x", "number"); this.addInput("y", "number"); this.addOutput("", "number"); this.properties = { x: 1.0, y: 1.0, formula: "x+y" }; this.code_widget = this.addWidget( "text", "F(x,y)", this.propertie...
[ "function", "MathFormula", "(", ")", "{", "this", ".", "addInput", "(", "\"x\"", ",", "\"number\"", ")", ";", "this", ".", "addInput", "(", "\"y\"", ",", "\"number\"", ")", ";", "this", ".", "addOutput", "(", "\"\"", ",", "\"number\"", ")", ";", "this"...
math library for safe math operations without eval
[ "math", "library", "for", "safe", "math", "operations", "without", "eval" ]
b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2
https://github.com/jagenjo/litegraph.js/blob/b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2/build/litegraph.js#L13717-L13734
train
jagenjo/litegraph.js
build/litegraph.js
LGraphTextureScaleOffset
function LGraphTextureScaleOffset() { this.addInput("in", "Texture"); this.addInput("scale", "vec2"); this.addInput("offset", "vec2"); this.addOutput("out", "Texture"); this.properties = { offset: vec2.fromValues(0, 0), scale: v...
javascript
function LGraphTextureScaleOffset() { this.addInput("in", "Texture"); this.addInput("scale", "vec2"); this.addInput("offset", "vec2"); this.addOutput("out", "Texture"); this.properties = { offset: vec2.fromValues(0, 0), scale: v...
[ "function", "LGraphTextureScaleOffset", "(", ")", "{", "this", ".", "addInput", "(", "\"in\"", ",", "\"Texture\"", ")", ";", "this", ".", "addInput", "(", "\"scale\"", ",", "\"vec2\"", ")", ";", "this", ".", "addInput", "(", "\"offset\"", ",", "\"vec2\"", ...
Texture Scale Offset
[ "Texture", "Scale", "Offset" ]
b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2
https://github.com/jagenjo/litegraph.js/blob/b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2/build/litegraph.js#L16540-L16550
train
jagenjo/litegraph.js
build/litegraph.js
LGraphExposition
function LGraphExposition() { this.addInput("in", "Texture"); this.addInput("exp", "number"); this.addOutput("out", "Texture"); this.properties = { exposition: 1, precision: LGraphTexture.LOW }; this._uniforms = { u_texture: 0, u_exposition: 1 }; }
javascript
function LGraphExposition() { this.addInput("in", "Texture"); this.addInput("exp", "number"); this.addOutput("out", "Texture"); this.properties = { exposition: 1, precision: LGraphTexture.LOW }; this._uniforms = { u_texture: 0, u_exposition: 1 }; }
[ "function", "LGraphExposition", "(", ")", "{", "this", ".", "addInput", "(", "\"in\"", ",", "\"Texture\"", ")", ";", "this", ".", "addInput", "(", "\"exp\"", ",", "\"number\"", ")", ";", "this", ".", "addOutput", "(", "\"out\"", ",", "\"Texture\"", ")", ...
simple exposition, but plan to expand it to support different gamma curves
[ "simple", "exposition", "but", "plan", "to", "expand", "it", "to", "support", "different", "gamma", "curves" ]
b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2
https://github.com/jagenjo/litegraph.js/blob/b6ca97f2b1f6c3ec0be919070850a2f0df81f0b2/build/litegraph.js#L19476-L19482
train
rstudio/shiny-server
lib/router/directory-router.js
onDirectory
function onDirectory() { var this_SendStream = this; if (!/\/$/.test(reqUrl.pathname)) { // No trailing slash? Redirect to add one res.writeHead(301, { 'Location': reqUrl.pathname + '/' + (reqUrl.search || '') }); res.end(); deferred.resolve(true); r...
javascript
function onDirectory() { var this_SendStream = this; if (!/\/$/.test(reqUrl.pathname)) { // No trailing slash? Redirect to add one res.writeHead(301, { 'Location': reqUrl.pathname + '/' + (reqUrl.search || '') }); res.end(); deferred.resolve(true); r...
[ "function", "onDirectory", "(", ")", "{", "var", "this_SendStream", "=", "this", ";", "if", "(", "!", "/", "\\/$", "/", ".", "test", "(", "reqUrl", ".", "pathname", ")", ")", "{", "// No trailing slash? Redirect to add one", "res", ".", "writeHead", "(", "...
Called when the URL requested is a directory
[ "Called", "when", "the", "URL", "requested", "is", "a", "directory" ]
0227ff5e5ce0182921446e45295873932507b36f
https://github.com/rstudio/shiny-server/blob/0227ff5e5ce0182921446e45295873932507b36f/lib/router/directory-router.js#L152-L188
train
rstudio/shiny-server
lib/proxy/http.js
error500
function error500(req, res, errorText, detail, templateDir, consoleLogFile, appSpec) { fsutil.safeTail_p(consoleLogFile, 8192) .fail(function(consoleLog) { return; }) .then(function(consoleLog) { render.sendPage(res, 500, 'An error has occurred', { template: 'error-500', templateDir: templat...
javascript
function error500(req, res, errorText, detail, templateDir, consoleLogFile, appSpec) { fsutil.safeTail_p(consoleLogFile, 8192) .fail(function(consoleLog) { return; }) .then(function(consoleLog) { render.sendPage(res, 500, 'An error has occurred', { template: 'error-500', templateDir: templat...
[ "function", "error500", "(", "req", ",", "res", ",", "errorText", ",", "detail", ",", "templateDir", ",", "consoleLogFile", ",", "appSpec", ")", "{", "fsutil", ".", "safeTail_p", "(", "consoleLogFile", ",", "8192", ")", ".", "fail", "(", "function", "(", ...
Send a 500 error response
[ "Send", "a", "500", "error", "response" ]
0227ff5e5ce0182921446e45295873932507b36f
https://github.com/rstudio/shiny-server/blob/0227ff5e5ce0182921446e45295873932507b36f/lib/proxy/http.js#L30-L57
train