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
bjorn2404/jQuery-Store-Locator-Plugin
dist/assets/js/plugins/storeLocator/jquery.storelocator.js
function(map, origin) { this.writeDebug('inlineDirections',arguments); if (this.settings.inlineDirections !== true || typeof origin === 'undefined') { return; } var _this = this; // Open directions $(document).on('click.'+pluginName, '.' + _this.settings.locationList + ' li .loc-directions a', ...
javascript
function(map, origin) { this.writeDebug('inlineDirections',arguments); if (this.settings.inlineDirections !== true || typeof origin === 'undefined') { return; } var _this = this; // Open directions $(document).on('click.'+pluginName, '.' + _this.settings.locationList + ' li .loc-directions a', ...
[ "function", "(", "map", ",", "origin", ")", "{", "this", ".", "writeDebug", "(", "'inlineDirections'", ",", "arguments", ")", ";", "if", "(", "this", ".", "settings", ".", "inlineDirections", "!==", "true", "||", "typeof", "origin", "===", "'undefined'", "...
Inline directions setup @param map {Object} Google map @param origin {string} Origin address
[ "Inline", "directions", "setup" ]
1145d04f7988e06e00f7b6014f8a7eca26fe4eb6
https://github.com/bjorn2404/jQuery-Store-Locator-Plugin/blob/1145d04f7988e06e00f7b6014f8a7eca26fe4eb6/dist/assets/js/plugins/storeLocator/jquery.storelocator.js#L2516-L2536
train
bjorn2404/jQuery-Store-Locator-Plugin
dist/assets/js/plugins/storeLocator/jquery.storelocator.js
function(map, markers) { this.writeDebug('visibleMarkersList',arguments); if (this.settings.visibleMarkersList !== true) { return; } var _this = this; // Add event listener to filter the list when the map is fully loaded google.maps.event.addListenerOnce(map, 'idle', function(){ _this.check...
javascript
function(map, markers) { this.writeDebug('visibleMarkersList',arguments); if (this.settings.visibleMarkersList !== true) { return; } var _this = this; // Add event listener to filter the list when the map is fully loaded google.maps.event.addListenerOnce(map, 'idle', function(){ _this.check...
[ "function", "(", "map", ",", "markers", ")", "{", "this", ".", "writeDebug", "(", "'visibleMarkersList'", ",", "arguments", ")", ";", "if", "(", "this", ".", "settings", ".", "visibleMarkersList", "!==", "true", ")", "{", "return", ";", "}", "var", "_thi...
Visible markers list setup @param map {Object} Google map @param markers {Object} Map markers
[ "Visible", "markers", "list", "setup" ]
1145d04f7988e06e00f7b6014f8a7eca26fe4eb6
https://github.com/bjorn2404/jQuery-Store-Locator-Plugin/blob/1145d04f7988e06e00f7b6014f8a7eca26fe4eb6/dist/assets/js/plugins/storeLocator/jquery.storelocator.js#L2544-L2567
train
bjorn2404/jQuery-Store-Locator-Plugin
dist/assets/js/plugins/storeLocator/jquery.storelocator.js
function (mappingObject) { this.writeDebug('mapping',arguments); var _this = this; var orig_lat, orig_lng, geocodeData, origin, originPoint, page; if (!this.isEmptyObject(mappingObject)) { orig_lat = mappingObject.lat; orig_lng = mappingObject.lng; geocodeData = mappingObject.geocodeResult; ...
javascript
function (mappingObject) { this.writeDebug('mapping',arguments); var _this = this; var orig_lat, orig_lng, geocodeData, origin, originPoint, page; if (!this.isEmptyObject(mappingObject)) { orig_lat = mappingObject.lat; orig_lng = mappingObject.lng; geocodeData = mappingObject.geocodeResult; ...
[ "function", "(", "mappingObject", ")", "{", "this", ".", "writeDebug", "(", "'mapping'", ",", "arguments", ")", ";", "var", "_this", "=", "this", ";", "var", "orig_lat", ",", "orig_lng", ",", "geocodeData", ",", "origin", ",", "originPoint", ",", "page", ...
The primary mapping function that runs everything @param mappingObject {Object} all the potential mapping properties - latitude, longitude, origin, name, max distance, page
[ "The", "primary", "mapping", "function", "that", "runs", "everything" ]
1145d04f7988e06e00f7b6014f8a7eca26fe4eb6
https://github.com/bjorn2404/jQuery-Store-Locator-Plugin/blob/1145d04f7988e06e00f7b6014f8a7eca26fe4eb6/dist/assets/js/plugins/storeLocator/jquery.storelocator.js#L2574-L2629
train
cibernox/ember-basic-dropdown
addon/utils/scroll-helpers.js
calculateScrollDistribution
function calculateScrollDistribution(deltaX, deltaY, element, container, accumulator = []) { const scrollInformation = { element, scrollLeft: 0, scrollTop: 0 }; const scrollLeftMax = element.scrollWidth - element.clientWidth; const scrollTopMax = element.scrollHeight - element.clientHeight; const...
javascript
function calculateScrollDistribution(deltaX, deltaY, element, container, accumulator = []) { const scrollInformation = { element, scrollLeft: 0, scrollTop: 0 }; const scrollLeftMax = element.scrollWidth - element.clientWidth; const scrollTopMax = element.scrollHeight - element.clientHeight; const...
[ "function", "calculateScrollDistribution", "(", "deltaX", ",", "deltaY", ",", "element", ",", "container", ",", "accumulator", "=", "[", "]", ")", "{", "const", "scrollInformation", "=", "{", "element", ",", "scrollLeft", ":", "0", ",", "scrollTop", ":", "0"...
Calculates the scroll distribution for `element` inside` container. @param {Number} deltaX @param {Number} deltaY @param {Element} element @param {Element} container @param {ScrollInformation[]} accumulator @return {ScrollInforamtion}
[ "Calculates", "the", "scroll", "distribution", "for", "element", "inside", "container", "." ]
799c2c52120f0f518c655437ad6d17716788b5b7
https://github.com/cibernox/ember-basic-dropdown/blob/799c2c52120f0f518c655437ad6d17716788b5b7/addon/utils/scroll-helpers.js#L113-L162
train
cibernox/ember-basic-dropdown
addon/components/basic-dropdown-content.js
dropdownIsValidParent
function dropdownIsValidParent(el, dropdownId) { let closestDropdown = closestContent(el); if (closestDropdown) { let trigger = document.querySelector(`[aria-owns=${closestDropdown.attributes.id.value}]`); let parentDropdown = closestContent(trigger); return parentDropdown && parentDropdown.attributes.i...
javascript
function dropdownIsValidParent(el, dropdownId) { let closestDropdown = closestContent(el); if (closestDropdown) { let trigger = document.querySelector(`[aria-owns=${closestDropdown.attributes.id.value}]`); let parentDropdown = closestContent(trigger); return parentDropdown && parentDropdown.attributes.i...
[ "function", "dropdownIsValidParent", "(", "el", ",", "dropdownId", ")", "{", "let", "closestDropdown", "=", "closestContent", "(", "el", ")", ";", "if", "(", "closestDropdown", ")", "{", "let", "trigger", "=", "document", ".", "querySelector", "(", "`", "${"...
Evaluates if the given element is in a dropdown or any of its parent dropdowns. @param {HTMLElement} el @param {String} dropdownId
[ "Evaluates", "if", "the", "given", "element", "is", "in", "a", "dropdown", "or", "any", "of", "its", "parent", "dropdowns", "." ]
799c2c52120f0f518c655437ad6d17716788b5b7
https://github.com/cibernox/ember-basic-dropdown/blob/799c2c52120f0f518c655437ad6d17716788b5b7/addon/components/basic-dropdown-content.js#L43-L52
train
jshttp/content-disposition
index.js
contentDisposition
function contentDisposition (filename, options) { var opts = options || {} // get type var type = opts.type || 'attachment' // get parameters var params = createparams(filename, opts.fallback) // format into string return format(new ContentDisposition(type, params)) }
javascript
function contentDisposition (filename, options) { var opts = options || {} // get type var type = opts.type || 'attachment' // get parameters var params = createparams(filename, opts.fallback) // format into string return format(new ContentDisposition(type, params)) }
[ "function", "contentDisposition", "(", "filename", ",", "options", ")", "{", "var", "opts", "=", "options", "||", "{", "}", "// get type", "var", "type", "=", "opts", ".", "type", "||", "'attachment'", "// get parameters", "var", "params", "=", "createparams",...
Create an attachment Content-Disposition header. @param {string} [filename] @param {object} [options] @param {string} [options.type=attachment] @param {string|boolean} [options.fallback=true] @return {string} @public
[ "Create", "an", "attachment", "Content", "-", "Disposition", "header", "." ]
f6d7cba7ea09dfea1492d5ffe438fe2f2e3cc3bb
https://github.com/jshttp/content-disposition/blob/f6d7cba7ea09dfea1492d5ffe438fe2f2e3cc3bb/index.js#L144-L155
train
FVANCOP/ChartNew.js
ChartNew.js
getCSSText
function getCSSText(className) { if (typeof document.styleSheets != "object") return ""; if (document.styleSheets.length <= 0) return ""; var classes = document.styleSheets[0].rules || document.styleSheets[0].cssRules; for (var x = 0; x < classes.length; x++) { if (classes[x].selectorText == "." + class...
javascript
function getCSSText(className) { if (typeof document.styleSheets != "object") return ""; if (document.styleSheets.length <= 0) return ""; var classes = document.styleSheets[0].rules || document.styleSheets[0].cssRules; for (var x = 0; x < classes.length; x++) { if (classes[x].selectorText == "." + class...
[ "function", "getCSSText", "(", "className", ")", "{", "if", "(", "typeof", "document", ".", "styleSheets", "!=", "\"object\"", ")", "return", "\"\"", ";", "if", "(", "document", ".", "styleSheets", ".", "length", "<=", "0", ")", "return", "\"\"", ";", "v...
First Time entered;
[ "First", "Time", "entered", ";" ]
08681cadc1c1b6ea334c11d48b2ae43d2267d611
https://github.com/FVANCOP/ChartNew.js/blob/08681cadc1c1b6ea334c11d48b2ae43d2267d611/ChartNew.js#L569-L579
train
FVANCOP/ChartNew.js
ChartNew.js
checkBrowser
function checkBrowser() { this.ver = navigator.appVersion this.dom = document.getElementById ? 1 : 0 this.ie5 = (this.ver.indexOf("MSIE 5") > -1 && this.dom) ? 1 : 0; this.ie4 = (document.all && !this.dom) ? 1 : 0; this.ns5 = (this.dom && parseInt(this.ver) >= 5) ? 1 : 0; this.ns4 = (document.layers && !this.dom)...
javascript
function checkBrowser() { this.ver = navigator.appVersion this.dom = document.getElementById ? 1 : 0 this.ie5 = (this.ver.indexOf("MSIE 5") > -1 && this.dom) ? 1 : 0; this.ie4 = (document.all && !this.dom) ? 1 : 0; this.ns5 = (this.dom && parseInt(this.ver) >= 5) ? 1 : 0; this.ns4 = (document.layers && !this.dom)...
[ "function", "checkBrowser", "(", ")", "{", "this", ".", "ver", "=", "navigator", ".", "appVersion", "this", ".", "dom", "=", "document", ".", "getElementById", "?", "1", ":", "0", "this", ".", "ie5", "=", "(", "this", ".", "ver", ".", "indexOf", "(",...
Default browsercheck, added to all scripts!
[ "Default", "browsercheck", "added", "to", "all", "scripts!" ]
08681cadc1c1b6ea334c11d48b2ae43d2267d611
https://github.com/FVANCOP/ChartNew.js/blob/08681cadc1c1b6ea334c11d48b2ae43d2267d611/ChartNew.js#L793-L802
train
FVANCOP/ChartNew.js
ChartNew.js
reverseData
function reverseData(data) { data.labels = data.labels.reverse(); for (var i = 0; i < data.datasets.length; i++) { for (var key in data.datasets[i]) { if (Array.isArray(data.datasets[i][key])) { data.datasets[i][key] = data.datasets[i][key].reverse(); } } } return data; }
javascript
function reverseData(data) { data.labels = data.labels.reverse(); for (var i = 0; i < data.datasets.length; i++) { for (var key in data.datasets[i]) { if (Array.isArray(data.datasets[i][key])) { data.datasets[i][key] = data.datasets[i][key].reverse(); } } } return data; }
[ "function", "reverseData", "(", "data", ")", "{", "data", ".", "labels", "=", "data", ".", "labels", ".", "reverse", "(", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "data", ".", "datasets", ".", "length", ";", "i", "++", ")", "{...
Reverse the data structure for horizontal charts - reverse labels and every array inside datasets @param {object} data datasets and labels for the chart @return return the reversed data
[ "Reverse", "the", "data", "structure", "for", "horizontal", "charts", "-", "reverse", "labels", "and", "every", "array", "inside", "datasets" ]
08681cadc1c1b6ea334c11d48b2ae43d2267d611
https://github.com/FVANCOP/ChartNew.js/blob/08681cadc1c1b6ea334c11d48b2ae43d2267d611/ChartNew.js#L4290-L4300
train
FVANCOP/ChartNew.js
mathFunctions.js
drawMathLine
function drawMathLine(i,lineFct) { var line = 0; // check if the math function exists if (typeof eval(lineFct) == "function") { var parameter = {data:data,datasetNr: i}; line = window[lineFct](parameter); } if (!(typeof(line)=='undefined')) { ctx.strokeStyle= data.datasets[i].mathLineStrokeColor ? d...
javascript
function drawMathLine(i,lineFct) { var line = 0; // check if the math function exists if (typeof eval(lineFct) == "function") { var parameter = {data:data,datasetNr: i}; line = window[lineFct](parameter); } if (!(typeof(line)=='undefined')) { ctx.strokeStyle= data.datasets[i].mathLineStrokeColor ? d...
[ "function", "drawMathLine", "(", "i", ",", "lineFct", ")", "{", "var", "line", "=", "0", ";", "// check if the math function exists", "if", "(", "typeof", "eval", "(", "lineFct", ")", "==", "\"function\"", ")", "{", "var", "parameter", "=", "{", "data", ":...
Draw a horizontal line @param i {integer} numer of dataset @param lineFct {string} name of the mathfunctions => compute height
[ "Draw", "a", "horizontal", "line" ]
08681cadc1c1b6ea334c11d48b2ae43d2267d611
https://github.com/FVANCOP/ChartNew.js/blob/08681cadc1c1b6ea334c11d48b2ae43d2267d611/mathFunctions.js#L135-L151
train
FVANCOP/ChartNew.js
mathFunctions.js
yPos
function yPos(dataSet, iteration, add,value) { value = value ? 1*data.datasets[dataSet].data[iteration] : 0; return xAxisPosY - calculateOffset(config.logarithmic, value+add, calculatedScale, scaleHop); }
javascript
function yPos(dataSet, iteration, add,value) { value = value ? 1*data.datasets[dataSet].data[iteration] : 0; return xAxisPosY - calculateOffset(config.logarithmic, value+add, calculatedScale, scaleHop); }
[ "function", "yPos", "(", "dataSet", ",", "iteration", ",", "add", ",", "value", ")", "{", "value", "=", "value", "?", "1", "*", "data", ".", "datasets", "[", "dataSet", "]", ".", "data", "[", "iteration", "]", ":", "0", ";", "return", "xAxisPosY", ...
Get a y position depending on the current values @param dataset {integer} number of dataset @param iteration {integer} number of value inside dataset.data @param add {float} add a value to the current value if value is true @param value {bool} true => value+add, false=>add @returns {float} position (px)
[ "Get", "a", "y", "position", "depending", "on", "the", "current", "values" ]
08681cadc1c1b6ea334c11d48b2ae43d2267d611
https://github.com/FVANCOP/ChartNew.js/blob/08681cadc1c1b6ea334c11d48b2ae43d2267d611/mathFunctions.js#L161-L164
train
FVANCOP/ChartNew.js
previous_versions/ChartNew_V1.js
populateLabels
function populateLabels(axis, config, labelTemplateString, labels, numberOfSteps, graphMin, graphMax, stepValue) { var logarithmic; if (axis == 2) { logarithmic = config.logarithmic2; fmtYLabel = config.fmtYLabel2; } else { logarithmic = config.logarithmic; fmtYLabel = config.fmtYLabel; } if (labe...
javascript
function populateLabels(axis, config, labelTemplateString, labels, numberOfSteps, graphMin, graphMax, stepValue) { var logarithmic; if (axis == 2) { logarithmic = config.logarithmic2; fmtYLabel = config.fmtYLabel2; } else { logarithmic = config.logarithmic; fmtYLabel = config.fmtYLabel; } if (labe...
[ "function", "populateLabels", "(", "axis", ",", "config", ",", "labelTemplateString", ",", "labels", ",", "numberOfSteps", ",", "graphMin", ",", "graphMax", ",", "stepValue", ")", "{", "var", "logarithmic", ";", "if", "(", "axis", "==", "2", ")", "{", "log...
Populate an array of all the labels by interpolating the string.
[ "Populate", "an", "array", "of", "all", "the", "labels", "by", "interpolating", "the", "string", "." ]
08681cadc1c1b6ea334c11d48b2ae43d2267d611
https://github.com/FVANCOP/ChartNew.js/blob/08681cadc1c1b6ea334c11d48b2ae43d2267d611/previous_versions/ChartNew_V1.js#L5159-L5186
train
broofa/node-int64
Int64.js
function(allowImprecise) { var b = this.buffer, o = this.offset; // Running sum of octets, doing a 2's complement var negate = b[o] & 0x80, x = 0, carry = 1; for (var i = 7, m = 1; i >= 0; i--, m *= 256) { var v = b[o+i]; // 2's complement for negative numbers if (negate) { v...
javascript
function(allowImprecise) { var b = this.buffer, o = this.offset; // Running sum of octets, doing a 2's complement var negate = b[o] & 0x80, x = 0, carry = 1; for (var i = 7, m = 1; i >= 0; i--, m *= 256) { var v = b[o+i]; // 2's complement for negative numbers if (negate) { v...
[ "function", "(", "allowImprecise", ")", "{", "var", "b", "=", "this", ".", "buffer", ",", "o", "=", "this", ".", "offset", ";", "// Running sum of octets, doing a 2's complement", "var", "negate", "=", "b", "[", "o", "]", "&", "0x80", ",", "x", "=", "0",...
Convert to a native JS number. WARNING: Do not expect this value to be accurate to integer precision for large (positive or negative) numbers! @param allowImprecise If true, no check is performed to verify the returned value is accurate to integer precision. If false, imprecise numbers (very large positive or negati...
[ "Convert", "to", "a", "native", "JS", "number", "." ]
ea76fbc55f6d0e11719c1cb38126fc93e8c9e257
https://github.com/broofa/node-int64/blob/ea76fbc55f6d0e11719c1cb38126fc93e8c9e257/Int64.js#L150-L174
train
broofa/node-int64
Int64.js
function(sep) { var out = new Array(8); var b = this.buffer, o = this.offset; for (var i = 0; i < 8; i++) { out[i] = _HEX[b[o+i]]; } return out.join(sep || ''); }
javascript
function(sep) { var out = new Array(8); var b = this.buffer, o = this.offset; for (var i = 0; i < 8; i++) { out[i] = _HEX[b[o+i]]; } return out.join(sep || ''); }
[ "function", "(", "sep", ")", "{", "var", "out", "=", "new", "Array", "(", "8", ")", ";", "var", "b", "=", "this", ".", "buffer", ",", "o", "=", "this", ".", "offset", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "8", ";", "i", "+...
Return a string showing the buffer octets, with MSB on the left. @param sep separator string. default is '' (empty string)
[ "Return", "a", "string", "showing", "the", "buffer", "octets", "with", "MSB", "on", "the", "left", "." ]
ea76fbc55f6d0e11719c1cb38126fc93e8c9e257
https://github.com/broofa/node-int64/blob/ea76fbc55f6d0e11719c1cb38126fc93e8c9e257/Int64.js#L198-L205
train
broofa/node-int64
Int64.js
function(rawBuffer) { if (rawBuffer && this.offset === 0) return this.buffer; var out = new Buffer(8); this.buffer.copy(out, 0, this.offset, this.offset + 8); return out; }
javascript
function(rawBuffer) { if (rawBuffer && this.offset === 0) return this.buffer; var out = new Buffer(8); this.buffer.copy(out, 0, this.offset, this.offset + 8); return out; }
[ "function", "(", "rawBuffer", ")", "{", "if", "(", "rawBuffer", "&&", "this", ".", "offset", "===", "0", ")", "return", "this", ".", "buffer", ";", "var", "out", "=", "new", "Buffer", "(", "8", ")", ";", "this", ".", "buffer", ".", "copy", "(", "...
Returns the int64's 8 bytes in a buffer. @param {bool} [rawBuffer=false] If no offset and this is true, return the internal buffer. Should only be used if you're discarding the Int64 afterwards, as it breaks encapsulation.
[ "Returns", "the", "int64", "s", "8", "bytes", "in", "a", "buffer", "." ]
ea76fbc55f6d0e11719c1cb38126fc93e8c9e257
https://github.com/broofa/node-int64/blob/ea76fbc55f6d0e11719c1cb38126fc93e8c9e257/Int64.js#L213-L219
train
broofa/node-int64
Int64.js
function(other) { // If sign bits differ ... if ((this.buffer[this.offset] & 0x80) != (other.buffer[other.offset] & 0x80)) { return other.buffer[other.offset] - this.buffer[this.offset]; } // otherwise, compare bytes lexicographically for (var i = 0; i < 8; i++) { if (this.buffer[this....
javascript
function(other) { // If sign bits differ ... if ((this.buffer[this.offset] & 0x80) != (other.buffer[other.offset] & 0x80)) { return other.buffer[other.offset] - this.buffer[this.offset]; } // otherwise, compare bytes lexicographically for (var i = 0; i < 8; i++) { if (this.buffer[this....
[ "function", "(", "other", ")", "{", "// If sign bits differ ...", "if", "(", "(", "this", ".", "buffer", "[", "this", ".", "offset", "]", "&", "0x80", ")", "!=", "(", "other", ".", "buffer", "[", "other", ".", "offset", "]", "&", "0x80", ")", ")", ...
Returns a number indicating whether this comes before or after or is the same as the other in sort order. @param {Int64} other Other Int64 to compare.
[ "Returns", "a", "number", "indicating", "whether", "this", "comes", "before", "or", "after", "or", "is", "the", "same", "as", "the", "other", "in", "sort", "order", "." ]
ea76fbc55f6d0e11719c1cb38126fc93e8c9e257
https://github.com/broofa/node-int64/blob/ea76fbc55f6d0e11719c1cb38126fc93e8c9e257/Int64.js#L237-L251
train
chainpoint/chainpoint-client-js
index.js
_isValidCoreURI
function _isValidCoreURI(coreURI) { if (_isEmpty(coreURI) || !_isString(coreURI)) return false try { return isURL(coreURI, { protocols: ['https'], require_protocol: true, host_whitelist: [/^[a-z]\.chainpoint\.org$/] }) } catch (error) { return false } }
javascript
function _isValidCoreURI(coreURI) { if (_isEmpty(coreURI) || !_isString(coreURI)) return false try { return isURL(coreURI, { protocols: ['https'], require_protocol: true, host_whitelist: [/^[a-z]\.chainpoint\.org$/] }) } catch (error) { return false } }
[ "function", "_isValidCoreURI", "(", "coreURI", ")", "{", "if", "(", "_isEmpty", "(", "coreURI", ")", "||", "!", "_isString", "(", "coreURI", ")", ")", "return", "false", "try", "{", "return", "isURL", "(", "coreURI", ",", "{", "protocols", ":", "[", "'...
Check if valid Core URI @param {string} coreURI - The Core URI to test for validity @returns {bool} true if coreURI is a valid Core URI, otherwise false
[ "Check", "if", "valid", "Core", "URI" ]
1c7541db69b0c78ee4b7fb475e644d65601cb8a5
https://github.com/chainpoint/chainpoint-client-js/blob/1c7541db69b0c78ee4b7fb475e644d65601cb8a5/index.js#L97-L109
train
chainpoint/chainpoint-client-js
index.js
_isValidNodeURI
function _isValidNodeURI(nodeURI) { if (!_isString(nodeURI)) return false try { let isValidURI = isURL(nodeURI, { protocols: ['http', 'https'], require_protocol: true, host_blacklist: ['0.0.0.0'] }) let parsedURI = url.parse(nodeURI).hostname // Valid URI w/ IPv4 address? re...
javascript
function _isValidNodeURI(nodeURI) { if (!_isString(nodeURI)) return false try { let isValidURI = isURL(nodeURI, { protocols: ['http', 'https'], require_protocol: true, host_blacklist: ['0.0.0.0'] }) let parsedURI = url.parse(nodeURI).hostname // Valid URI w/ IPv4 address? re...
[ "function", "_isValidNodeURI", "(", "nodeURI", ")", "{", "if", "(", "!", "_isString", "(", "nodeURI", ")", ")", "return", "false", "try", "{", "let", "isValidURI", "=", "isURL", "(", "nodeURI", ",", "{", "protocols", ":", "[", "'http'", ",", "'https'", ...
Check if valid Node URI @param {string} nodeURI - The value to check @returns {bool} true if value is a valid Node URI, otherwise false
[ "Check", "if", "valid", "Node", "URI" ]
1c7541db69b0c78ee4b7fb475e644d65601cb8a5
https://github.com/chainpoint/chainpoint-client-js/blob/1c7541db69b0c78ee4b7fb475e644d65601cb8a5/index.js#L176-L193
train
chainpoint/chainpoint-client-js
index.js
_isHex
function _isHex(value) { var hexRegex = /^[0-9a-f]{2,}$/i var isHex = hexRegex.test(value) && !(value.length % 2) return isHex }
javascript
function _isHex(value) { var hexRegex = /^[0-9a-f]{2,}$/i var isHex = hexRegex.test(value) && !(value.length % 2) return isHex }
[ "function", "_isHex", "(", "value", ")", "{", "var", "hexRegex", "=", "/", "^[0-9a-f]{2,}$", "/", "i", "var", "isHex", "=", "hexRegex", ".", "test", "(", "value", ")", "&&", "!", "(", "value", ".", "length", "%", "2", ")", "return", "isHex", "}" ]
Checks if value is a hexadecimal string @param {string} value - The value to check @returns {bool} true if value is a hexadecimal string, otherwise false
[ "Checks", "if", "value", "is", "a", "hexadecimal", "string" ]
1c7541db69b0c78ee4b7fb475e644d65601cb8a5
https://github.com/chainpoint/chainpoint-client-js/blob/1c7541db69b0c78ee4b7fb475e644d65601cb8a5/index.js#L258-L262
train
chainpoint/chainpoint-client-js
index.js
_isValidProofHandle
function _isValidProofHandle(handle) { if ( !_isEmpty(handle) && _isObject(handle) && _has(handle, 'uri') && _has(handle, 'hashIdNode') ) { return true } }
javascript
function _isValidProofHandle(handle) { if ( !_isEmpty(handle) && _isObject(handle) && _has(handle, 'uri') && _has(handle, 'hashIdNode') ) { return true } }
[ "function", "_isValidProofHandle", "(", "handle", ")", "{", "if", "(", "!", "_isEmpty", "(", "handle", ")", "&&", "_isObject", "(", "handle", ")", "&&", "_has", "(", "handle", ",", "'uri'", ")", "&&", "_has", "(", "handle", ",", "'hashIdNode'", ")", ")...
Checks if a proof handle Object has valid params. @param {Object} handle - The proof handle to check @returns {bool} true if handle is valid Object with expected params, otherwise false
[ "Checks", "if", "a", "proof", "handle", "Object", "has", "valid", "params", "." ]
1c7541db69b0c78ee4b7fb475e644d65601cb8a5
https://github.com/chainpoint/chainpoint-client-js/blob/1c7541db69b0c78ee4b7fb475e644d65601cb8a5/index.js#L270-L279
train
chainpoint/chainpoint-client-js
index.js
_mapSubmitHashesRespToProofHandles
function _mapSubmitHashesRespToProofHandles(respArray) { if (!_isArray(respArray) && !respArray.length) throw new Error('_mapSubmitHashesRespToProofHandles arg must be an Array') let proofHandles = [] let groupIdList = [] if (respArray[0] && respArray[0].hashes) { _forEach(respArray[0].hashes, () => { ...
javascript
function _mapSubmitHashesRespToProofHandles(respArray) { if (!_isArray(respArray) && !respArray.length) throw new Error('_mapSubmitHashesRespToProofHandles arg must be an Array') let proofHandles = [] let groupIdList = [] if (respArray[0] && respArray[0].hashes) { _forEach(respArray[0].hashes, () => { ...
[ "function", "_mapSubmitHashesRespToProofHandles", "(", "respArray", ")", "{", "if", "(", "!", "_isArray", "(", "respArray", ")", "&&", "!", "respArray", ".", "length", ")", "throw", "new", "Error", "(", "'_mapSubmitHashesRespToProofHandles arg must be an Array'", ")",...
Map the JSON API response from submitting a hash to a Node to a more accessible form that can also be used as the input arg to getProofs function. @param {Array} respArray - An Array of responses, one for each Node submitted to @returns {Array<{uri: String, hash: String, hashIdNode: String}>} An Array of proofHandles
[ "Map", "the", "JSON", "API", "response", "from", "submitting", "a", "hash", "to", "a", "Node", "to", "a", "more", "accessible", "form", "that", "can", "also", "be", "used", "as", "the", "input", "arg", "to", "getProofs", "function", "." ]
1c7541db69b0c78ee4b7fb475e644d65601cb8a5
https://github.com/chainpoint/chainpoint-client-js/blob/1c7541db69b0c78ee4b7fb475e644d65601cb8a5/index.js#L301-L326
train
chainpoint/chainpoint-client-js
index.js
_parseProofs
function _parseProofs(proofs) { if (!_isArray(proofs)) throw new Error('proofs arg must be an Array') if (_isEmpty(proofs)) throw new Error('proofs arg must be a non-empty Array') let parsedProofs = [] _forEach(proofs, proof => { if (_isObject(proof)) { // OBJECT parsedProofs.push(cpp.parse(pr...
javascript
function _parseProofs(proofs) { if (!_isArray(proofs)) throw new Error('proofs arg must be an Array') if (_isEmpty(proofs)) throw new Error('proofs arg must be a non-empty Array') let parsedProofs = [] _forEach(proofs, proof => { if (_isObject(proof)) { // OBJECT parsedProofs.push(cpp.parse(pr...
[ "function", "_parseProofs", "(", "proofs", ")", "{", "if", "(", "!", "_isArray", "(", "proofs", ")", ")", "throw", "new", "Error", "(", "'proofs arg must be an Array'", ")", "if", "(", "_isEmpty", "(", "proofs", ")", ")", "throw", "new", "Error", "(", "'...
Parse an Array of proofs, each of which can be in any supported format. @param {Array} proofs - An Array of proofs in any supported form @returns {Array} An Array of parsed proofs
[ "Parse", "an", "Array", "of", "proofs", "each", "of", "which", "can", "be", "in", "any", "supported", "format", "." ]
1c7541db69b0c78ee4b7fb475e644d65601cb8a5
https://github.com/chainpoint/chainpoint-client-js/blob/1c7541db69b0c78ee4b7fb475e644d65601cb8a5/index.js#L334-L356
train
chainpoint/chainpoint-client-js
index.js
_flattenProofs
function _flattenProofs(parsedProofs) { if (!_isArray(parsedProofs)) throw new Error('parsedProofs arg must be an Array') if (_isEmpty(parsedProofs)) throw new Error('parsedProofs arg must be a non-empty Array') let flatProofAnchors = [] _forEach(parsedProofs, parsedProof => { let proofAnchors = _...
javascript
function _flattenProofs(parsedProofs) { if (!_isArray(parsedProofs)) throw new Error('parsedProofs arg must be an Array') if (_isEmpty(parsedProofs)) throw new Error('parsedProofs arg must be a non-empty Array') let flatProofAnchors = [] _forEach(parsedProofs, parsedProof => { let proofAnchors = _...
[ "function", "_flattenProofs", "(", "parsedProofs", ")", "{", "if", "(", "!", "_isArray", "(", "parsedProofs", ")", ")", "throw", "new", "Error", "(", "'parsedProofs arg must be an Array'", ")", "if", "(", "_isEmpty", "(", "parsedProofs", ")", ")", "throw", "ne...
Flatten an Array of parsed proofs where each proof anchor is represented as an Object with all relevant proof data. @param {Array} parsedProofs - An Array of previously parsed proofs @returns {Array} An Array of flattened proof objects
[ "Flatten", "an", "Array", "of", "parsed", "proofs", "where", "each", "proof", "anchor", "is", "represented", "as", "an", "Object", "with", "all", "relevant", "proof", "data", "." ]
1c7541db69b0c78ee4b7fb475e644d65601cb8a5
https://github.com/chainpoint/chainpoint-client-js/blob/1c7541db69b0c78ee4b7fb475e644d65601cb8a5/index.js#L365-L394
train
chainpoint/chainpoint-client-js
index.js
_flattenProofBranches
function _flattenProofBranches(proofBranchArray) { let flatProofAnchors = [] _forEach(proofBranchArray, proofBranch => { let anchors = proofBranch.anchors _forEach(anchors, anchor => { let flatAnchor = {} flatAnchor.branch = proofBranch.label || undefined flatAnchor.uri = anchor.uris[0] ...
javascript
function _flattenProofBranches(proofBranchArray) { let flatProofAnchors = [] _forEach(proofBranchArray, proofBranch => { let anchors = proofBranch.anchors _forEach(anchors, anchor => { let flatAnchor = {} flatAnchor.branch = proofBranch.label || undefined flatAnchor.uri = anchor.uris[0] ...
[ "function", "_flattenProofBranches", "(", "proofBranchArray", ")", "{", "let", "flatProofAnchors", "=", "[", "]", "_forEach", "(", "proofBranchArray", ",", "proofBranch", "=>", "{", "let", "anchors", "=", "proofBranch", ".", "anchors", "_forEach", "(", "anchors", ...
Flatten an Array of proof branches where each proof anchor in each branch is represented as an Object with all relevant data for that anchor. @param {Array} proofBranchArray - An Array of branches for a given level in a proof @returns {Array} An Array of flattened proof anchor objects for each branch
[ "Flatten", "an", "Array", "of", "proof", "branches", "where", "each", "proof", "anchor", "in", "each", "branch", "is", "represented", "as", "an", "Object", "with", "all", "relevant", "data", "for", "that", "anchor", "." ]
1c7541db69b0c78ee4b7fb475e644d65601cb8a5
https://github.com/chainpoint/chainpoint-client-js/blob/1c7541db69b0c78ee4b7fb475e644d65601cb8a5/index.js#L403-L424
train
chainpoint/chainpoint-client-js
index.js
_flattenBtcBranches
function _flattenBtcBranches(proofs) { let flattenedBranches = [] _forEach(proofs, proof => { let btcAnchor = {} btcAnchor.hash_id_node = proof.hash_id_node if (proof.branches) { _forEach(proof.branches, branch => { // sub branches indicate other anchors // we want to find the su...
javascript
function _flattenBtcBranches(proofs) { let flattenedBranches = [] _forEach(proofs, proof => { let btcAnchor = {} btcAnchor.hash_id_node = proof.hash_id_node if (proof.branches) { _forEach(proof.branches, branch => { // sub branches indicate other anchors // we want to find the su...
[ "function", "_flattenBtcBranches", "(", "proofs", ")", "{", "let", "flattenedBranches", "=", "[", "]", "_forEach", "(", "proofs", ",", "proof", "=>", "{", "let", "btcAnchor", "=", "{", "}", "btcAnchor", ".", "hash_id_node", "=", "proof", ".", "hash_id_node",...
Get raw btc transactions for each hash_id_node @param {Array} proofs - array of previously parsed proofs @return {Obect[]} - an array of objects with hash_id_node and raw btc tx
[ "Get", "raw", "btc", "transactions", "for", "each", "hash_id_node" ]
1c7541db69b0c78ee4b7fb475e644d65601cb8a5
https://github.com/chainpoint/chainpoint-client-js/blob/1c7541db69b0c78ee4b7fb475e644d65601cb8a5/index.js#L431-L462
train
chainpoint/chainpoint-client-js
index.js
_normalizeProofs
function _normalizeProofs(proofs) { // Validate proofs arg if (!_isArray(proofs)) throw new Error('proofs arg must be an Array') if (_isEmpty(proofs)) throw new Error('proofs arg must be a non-empty Array') // If any entry in the proofs Array is an Object, process // it assuming the same form as the output o...
javascript
function _normalizeProofs(proofs) { // Validate proofs arg if (!_isArray(proofs)) throw new Error('proofs arg must be an Array') if (_isEmpty(proofs)) throw new Error('proofs arg must be a non-empty Array') // If any entry in the proofs Array is an Object, process // it assuming the same form as the output o...
[ "function", "_normalizeProofs", "(", "proofs", ")", "{", "// Validate proofs arg", "if", "(", "!", "_isArray", "(", "proofs", ")", ")", "throw", "new", "Error", "(", "'proofs arg must be an Array'", ")", "if", "(", "_isEmpty", "(", "proofs", ")", ")", "throw",...
validate and normalize proofs for actions such as parsing @param {Array} proofs - An Array of String, or Object proofs from getProofs(), to be verified. Proofs can be in any of the supported JSON-LD or Binary formats. @return {Array<Object>} - An Array of Objects, one for each proof submitted.
[ "validate", "and", "normalize", "proofs", "for", "actions", "such", "as", "parsing" ]
1c7541db69b0c78ee4b7fb475e644d65601cb8a5
https://github.com/chainpoint/chainpoint-client-js/blob/1c7541db69b0c78ee4b7fb475e644d65601cb8a5/index.js#L469-L496
train
biasmv/pv
js/foundation-5.4.7.min.js
function () { var sheet = Foundation.stylesheet; if (typeof this.rule_idx !== 'undefined') { sheet.deleteRule(this.rule_idx); sheet.deleteRule(this.rule_idx); delete this.rule_idx; } }
javascript
function () { var sheet = Foundation.stylesheet; if (typeof this.rule_idx !== 'undefined') { sheet.deleteRule(this.rule_idx); sheet.deleteRule(this.rule_idx); delete this.rule_idx; } }
[ "function", "(", ")", "{", "var", "sheet", "=", "Foundation", ".", "stylesheet", ";", "if", "(", "typeof", "this", ".", "rule_idx", "!==", "'undefined'", ")", "{", "sheet", ".", "deleteRule", "(", "this", ".", "rule_idx", ")", ";", "sheet", ".", "delet...
Remove old dropdown rule index
[ "Remove", "old", "dropdown", "rule", "index" ]
ed561cb63210e7662a568c55f9501961f011dfe8
https://github.com/biasmv/pv/blob/ed561cb63210e7662a568c55f9501961f011dfe8/js/foundation-5.4.7.min.js#L2157-L2165
train
biasmv/pv
src/io.js
guessAtomElementFromName
function guessAtomElementFromName(fourLetterName) { if (fourLetterName[0] !== ' ') { var trimmed = fourLetterName.trim(); if (trimmed.length === 4) { // look for first character in range A-Z or a-z and use that // for the element. var i = 0; var charCode = trimmed.charCodeAt(i); ...
javascript
function guessAtomElementFromName(fourLetterName) { if (fourLetterName[0] !== ' ') { var trimmed = fourLetterName.trim(); if (trimmed.length === 4) { // look for first character in range A-Z or a-z and use that // for the element. var i = 0; var charCode = trimmed.charCodeAt(i); ...
[ "function", "guessAtomElementFromName", "(", "fourLetterName", ")", "{", "if", "(", "fourLetterName", "[", "0", "]", "!==", "' '", ")", "{", "var", "trimmed", "=", "fourLetterName", ".", "trim", "(", ")", ";", "if", "(", "trimmed", ".", "length", "===", ...
Very simple heuristic to determine the element from the atom name. This at the very least assume that people have the decency to follow the standard naming conventions for atom names when they are too lazy to write down elements
[ "Very", "simple", "heuristic", "to", "determine", "the", "element", "from", "the", "atom", "name", ".", "This", "at", "the", "very", "least", "assume", "that", "people", "have", "the", "decency", "to", "follow", "the", "standard", "naming", "conventions", "f...
ed561cb63210e7662a568c55f9501961f011dfe8
https://github.com/biasmv/pv/blob/ed561cb63210e7662a568c55f9501961f011dfe8/src/io.js#L116-L142
train
biasmv/pv
src/mol/chain.js
function(fromNumAndIns, toNumAndIns, ss) { // FIXME: when the chain numbers are completely ordered, perform binary // search to identify range of residues to assign secondary structure to. var from = rnumInsCodeHash(fromNumAndIns[0], fromNumAndIns[1]); var to = rnumInsCodeHash(toNumAndIns[0], toNumAndI...
javascript
function(fromNumAndIns, toNumAndIns, ss) { // FIXME: when the chain numbers are completely ordered, perform binary // search to identify range of residues to assign secondary structure to. var from = rnumInsCodeHash(fromNumAndIns[0], fromNumAndIns[1]); var to = rnumInsCodeHash(toNumAndIns[0], toNumAndI...
[ "function", "(", "fromNumAndIns", ",", "toNumAndIns", ",", "ss", ")", "{", "// FIXME: when the chain numbers are completely ordered, perform binary ", "// search to identify range of residues to assign secondary structure to.", "var", "from", "=", "rnumInsCodeHash", "(", "fromNumAndI...
assigns secondary structure to residues in range from_num to to_num.
[ "assigns", "secondary", "structure", "to", "residues", "in", "range", "from_num", "to", "to_num", "." ]
ed561cb63210e7662a568c55f9501961f011dfe8
https://github.com/biasmv/pv/blob/ed561cb63210e7662a568c55f9501961f011dfe8/src/mol/chain.js#L231-L248
train
biasmv/pv
src/gfx/base-geom.js
function(chains) { var vertArrays = this.vertArrays(); var selectedArrays = []; var set = {}; for (var ci = 0; ci < chains.length; ++ci) { set[chains[ci]] = true; } for (var i = 0; i < vertArrays.length; ++i) { if (set[vertArrays[i].chain()] === true) { selectedArrays.push(ve...
javascript
function(chains) { var vertArrays = this.vertArrays(); var selectedArrays = []; var set = {}; for (var ci = 0; ci < chains.length; ++ci) { set[chains[ci]] = true; } for (var i = 0; i < vertArrays.length; ++i) { if (set[vertArrays[i].chain()] === true) { selectedArrays.push(ve...
[ "function", "(", "chains", ")", "{", "var", "vertArrays", "=", "this", ".", "vertArrays", "(", ")", ";", "var", "selectedArrays", "=", "[", "]", ";", "var", "set", "=", "{", "}", ";", "for", "(", "var", "ci", "=", "0", ";", "ci", "<", "chains", ...
returns all vertex arrays that contain geometry for one of the specified chain names. Typically, there will only be one array for a given chain, but for larger chains with mesh geometries a single chain may be split across multiple vertex arrays.
[ "returns", "all", "vertex", "arrays", "that", "contain", "geometry", "for", "one", "of", "the", "specified", "chain", "names", ".", "Typically", "there", "will", "only", "be", "one", "array", "for", "a", "given", "chain", "but", "for", "larger", "chains", ...
ed561cb63210e7662a568c55f9501961f011dfe8
https://github.com/biasmv/pv/blob/ed561cb63210e7662a568c55f9501961f011dfe8/src/gfx/base-geom.js#L158-L171
train
biasmv/pv
src/gfx/base-geom.js
function(cam, shader, assembly) { var gens = assembly.generators(); for (var i = 0; i < gens.length; ++i) { var gen = gens[i]; var affectedVAs = this._vertArraysInvolving(gen.chains()); this._drawVertArrays(cam, shader, affectedVAs, gen.matrices()); } }
javascript
function(cam, shader, assembly) { var gens = assembly.generators(); for (var i = 0; i < gens.length; ++i) { var gen = gens[i]; var affectedVAs = this._vertArraysInvolving(gen.chains()); this._drawVertArrays(cam, shader, affectedVAs, gen.matrices()); } }
[ "function", "(", "cam", ",", "shader", ",", "assembly", ")", "{", "var", "gens", "=", "assembly", ".", "generators", "(", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "gens", ".", "length", ";", "++", "i", ")", "{", "var", "gen", ...
draws vertex arrays by using the symmetry generators contained in assembly
[ "draws", "vertex", "arrays", "by", "using", "the", "symmetry", "generators", "contained", "in", "assembly" ]
ed561cb63210e7662a568c55f9501961f011dfe8
https://github.com/biasmv/pv/blob/ed561cb63210e7662a568c55f9501961f011dfe8/src/gfx/base-geom.js#L175-L182
train
biasmv/pv
src/mol/bond.js
function(out) { if (!out) { out = vec3.create(); } vec3.add(out, self.atom_one.pos(), self.atom_two.pos()); vec3.scale(out, out, 0.5); return out; }
javascript
function(out) { if (!out) { out = vec3.create(); } vec3.add(out, self.atom_one.pos(), self.atom_two.pos()); vec3.scale(out, out, 0.5); return out; }
[ "function", "(", "out", ")", "{", "if", "(", "!", "out", ")", "{", "out", "=", "vec3", ".", "create", "(", ")", ";", "}", "vec3", ".", "add", "(", "out", ",", "self", ".", "atom_one", ".", "pos", "(", ")", ",", "self", ".", "atom_two", ".", ...
calculates the mid-point between the two atom positions
[ "calculates", "the", "mid", "-", "point", "between", "the", "two", "atom", "positions" ]
ed561cb63210e7662a568c55f9501961f011dfe8
https://github.com/biasmv/pv/blob/ed561cb63210e7662a568c55f9501961f011dfe8/src/mol/bond.js#L37-L44
train
biasmv/pv
src/gfx/cam.js
Cam
function Cam(gl) { this._projection = mat4.create(); this._camModelView = mat4.create(); this._modelView = mat4.create(); this._rotation = mat4.create(); this._translation = mat4.create(); this._near = 0.10; this._onCameraChangedListeners = []; this._far = 4000.0; this._fogNear = -5; this._fogFar = ...
javascript
function Cam(gl) { this._projection = mat4.create(); this._camModelView = mat4.create(); this._modelView = mat4.create(); this._rotation = mat4.create(); this._translation = mat4.create(); this._near = 0.10; this._onCameraChangedListeners = []; this._far = 4000.0; this._fogNear = -5; this._fogFar = ...
[ "function", "Cam", "(", "gl", ")", "{", "this", ".", "_projection", "=", "mat4", ".", "create", "(", ")", ";", "this", ".", "_camModelView", "=", "mat4", ".", "create", "(", ")", ";", "this", ".", "_modelView", "=", "mat4", ".", "create", "(", ")",...
A camera, providing us with a view into the 3D worlds. Handles projection, and modelview matrices and controls the global render parameters such as shader and fog.
[ "A", "camera", "providing", "us", "with", "a", "view", "into", "the", "3D", "worlds", ".", "Handles", "projection", "and", "modelview", "matrices", "and", "controls", "the", "global", "render", "parameters", "such", "as", "shader", "and", "fog", "." ]
ed561cb63210e7662a568c55f9501961f011dfe8
https://github.com/biasmv/pv/blob/ed561cb63210e7662a568c55f9501961f011dfe8/src/gfx/cam.js#L49-L77
train
biasmv/pv
src/gfx/cam.js
function() { return[ vec3.fromValues(this._rotation[0], this._rotation[4], this._rotation[8]), vec3.fromValues(this._rotation[1], this._rotation[5], this._rotation[9]), vec3.fromValues(this._rotation[2], this._rotation[6], this._rotation[10]) ]; }
javascript
function() { return[ vec3.fromValues(this._rotation[0], this._rotation[4], this._rotation[8]), vec3.fromValues(this._rotation[1], this._rotation[5], this._rotation[9]), vec3.fromValues(this._rotation[2], this._rotation[6], this._rotation[10]) ]; }
[ "function", "(", ")", "{", "return", "[", "vec3", ".", "fromValues", "(", "this", ".", "_rotation", "[", "0", "]", ",", "this", ".", "_rotation", "[", "4", "]", ",", "this", ".", "_rotation", "[", "8", "]", ")", ",", "vec3", ".", "fromValues", "(...
returns the 3 main axes of the current camera rotation
[ "returns", "the", "3", "main", "axes", "of", "the", "current", "camera", "rotation" ]
ed561cb63210e7662a568c55f9501961f011dfe8
https://github.com/biasmv/pv/blob/ed561cb63210e7662a568c55f9501961f011dfe8/src/gfx/cam.js#L140-L146
train
biasmv/pv
src/gfx/render.js
function(traces, vertsPerSlice, splineDetail) { var numVerts = 0; for (var i = 0; i < traces.length; ++i) { var traceVerts = ((traces[i].length() - 1) * splineDetail + 1) * vertsPerSlice; // in case there are more than 2^16 vertices for a single trace, we // need to manually split the trace in tw...
javascript
function(traces, vertsPerSlice, splineDetail) { var numVerts = 0; for (var i = 0; i < traces.length; ++i) { var traceVerts = ((traces[i].length() - 1) * splineDetail + 1) * vertsPerSlice; // in case there are more than 2^16 vertices for a single trace, we // need to manually split the trace in tw...
[ "function", "(", "traces", ",", "vertsPerSlice", ",", "splineDetail", ")", "{", "var", "numVerts", "=", "0", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "traces", ".", "length", ";", "++", "i", ")", "{", "var", "traceVerts", "=", "(", "...
calculates the number of vertices required for the cartoon and tube render styles
[ "calculates", "the", "number", "of", "vertices", "required", "for", "the", "cartoon", "and", "tube", "render", "styles" ]
ed561cb63210e7662a568c55f9501961f011dfe8
https://github.com/biasmv/pv/blob/ed561cb63210e7662a568c55f9501961f011dfe8/src/gfx/render.js#L668-L682
train
biasmv/pv
src/geom.js
function(out, axis, angle) { var sa = Math.sin(angle), ca = Math.cos(angle), x = axis[0], y = axis[1], z = axis[2], xx = x * x, xy = x * y, xz = x * z, yy = y * y, yz = y * z, zz = z * z; out[0] = xx + ca - xx * ca; out[1] = xy - ca * xy - sa * z; out[2] = xz - ca * xz + sa * y; out[3] = xy - ca ...
javascript
function(out, axis, angle) { var sa = Math.sin(angle), ca = Math.cos(angle), x = axis[0], y = axis[1], z = axis[2], xx = x * x, xy = x * y, xz = x * z, yy = y * y, yz = y * z, zz = z * z; out[0] = xx + ca - xx * ca; out[1] = xy - ca * xy - sa * z; out[2] = xz - ca * xz + sa * y; out[3] = xy - ca ...
[ "function", "(", "out", ",", "axis", ",", "angle", ")", "{", "var", "sa", "=", "Math", ".", "sin", "(", "angle", ")", ",", "ca", "=", "Math", ".", "cos", "(", "angle", ")", ",", "x", "=", "axis", "[", "0", "]", ",", "y", "=", "axis", "[", ...
assumes that axis is normalized. don't expect to get meaningful results when it's not
[ "assumes", "that", "axis", "is", "normalized", ".", "don", "t", "expect", "to", "get", "meaningful", "results", "when", "it", "s", "not" ]
ed561cb63210e7662a568c55f9501961f011dfe8
https://github.com/biasmv/pv/blob/ed561cb63210e7662a568c55f9501961f011dfe8/src/geom.js#L63-L78
train
biasmv/pv
src/geom.js
interpolateScalars
function interpolateScalars(values, num) { var out = new Float32Array(num*(values.length-1) + 1); var index = 0; var bf = 0.0, af = 0.0; var delta = 1/num; for (var i = 0; i < values.length-1; ++i) { bf = values[i]; af = values[i + 1]; for (var j = 0; j < num; ++j) { var t = delta * j; ...
javascript
function interpolateScalars(values, num) { var out = new Float32Array(num*(values.length-1) + 1); var index = 0; var bf = 0.0, af = 0.0; var delta = 1/num; for (var i = 0; i < values.length-1; ++i) { bf = values[i]; af = values[i + 1]; for (var j = 0; j < num; ++j) { var t = delta * j; ...
[ "function", "interpolateScalars", "(", "values", ",", "num", ")", "{", "var", "out", "=", "new", "Float32Array", "(", "num", "*", "(", "values", ".", "length", "-", "1", ")", "+", "1", ")", ";", "var", "index", "=", "0", ";", "var", "bf", "=", "0...
linearly interpolates the array of values and returns it as an Float32Array
[ "linearly", "interpolates", "the", "array", "of", "values", "and", "returns", "it", "as", "an", "Float32Array" ]
ed561cb63210e7662a568c55f9501961f011dfe8
https://github.com/biasmv/pv/blob/ed561cb63210e7662a568c55f9501961f011dfe8/src/geom.js#L284-L300
train
biasmv/pv
src/unique-object-id-pool.js
ContinuousIdRange
function ContinuousIdRange(pool, start, end) { this._pool = pool; this._start = start; this._next = start; this._end = end; }
javascript
function ContinuousIdRange(pool, start, end) { this._pool = pool; this._start = start; this._next = start; this._end = end; }
[ "function", "ContinuousIdRange", "(", "pool", ",", "start", ",", "end", ")", "{", "this", ".", "_pool", "=", "pool", ";", "this", ".", "_start", "=", "start", ";", "this", ".", "_next", "=", "start", ";", "this", ".", "_end", "=", "end", ";", "}" ]
A continous range of object identifiers.
[ "A", "continous", "range", "of", "object", "identifiers", "." ]
ed561cb63210e7662a568c55f9501961f011dfe8
https://github.com/biasmv/pv/blob/ed561cb63210e7662a568c55f9501961f011dfe8/src/unique-object-id-pool.js#L26-L31
train
biasmv/pv
src/viewer.js
function() { if (!this._resize) { return; } this._resize = false; this._cam.setViewportSize(this._canvas.viewportWidth(), this._canvas.viewportHeight()); this._pickBuffer.resize(this._options.width, this._options.height); }
javascript
function() { if (!this._resize) { return; } this._resize = false; this._cam.setViewportSize(this._canvas.viewportWidth(), this._canvas.viewportHeight()); this._pickBuffer.resize(this._options.width, this._options.height); }
[ "function", "(", ")", "{", "if", "(", "!", "this", ".", "_resize", ")", "{", "return", ";", "}", "this", ".", "_resize", "=", "false", ";", "this", ".", "_cam", ".", "setViewportSize", "(", "this", ".", "_canvas", ".", "viewportWidth", "(", ")", ",...
with rendering to avoid flickering.
[ "with", "rendering", "to", "avoid", "flickering", "." ]
ed561cb63210e7662a568c55f9501961f011dfe8
https://github.com/biasmv/pv/blob/ed561cb63210e7662a568c55f9501961f011dfe8/src/viewer.js#L295-L303
train
biasmv/pv
src/viewer.js
function(name, structure, opts) { opts = opts || {}; opts.forceTube = true; return this.cartoon(name, structure, opts); }
javascript
function(name, structure, opts) { opts = opts || {}; opts.forceTube = true; return this.cartoon(name, structure, opts); }
[ "function", "(", "name", ",", "structure", ",", "opts", ")", "{", "opts", "=", "opts", "||", "{", "}", ";", "opts", ".", "forceTube", "=", "true", ";", "return", "this", ".", "cartoon", "(", "name", ",", "structure", ",", "opts", ")", ";", "}" ]
renders the protein using a smoothly interpolated tube, essentially identical to the cartoon render mode, but without special treatment for helices and strands.
[ "renders", "the", "protein", "using", "a", "smoothly", "interpolated", "tube", "essentially", "identical", "to", "the", "cartoon", "render", "mode", "but", "without", "special", "treatment", "for", "helices", "and", "strands", "." ]
ed561cb63210e7662a568c55f9501961f011dfe8
https://github.com/biasmv/pv/blob/ed561cb63210e7662a568c55f9501961f011dfe8/src/viewer.js#L833-L837
train
biasmv/pv
src/viewer.js
function(ms) { var axes = this._cam.mainAxes(); var intervals = [ new utils.Range(), new utils.Range(), new utils.Range() ]; this.forEach(function(obj) { if (!obj.visible()) { return; } obj.updateProjectionIntervals(axes[0], axes[1], axes[2], intervals[0], ...
javascript
function(ms) { var axes = this._cam.mainAxes(); var intervals = [ new utils.Range(), new utils.Range(), new utils.Range() ]; this.forEach(function(obj) { if (!obj.visible()) { return; } obj.updateProjectionIntervals(axes[0], axes[1], axes[2], intervals[0], ...
[ "function", "(", "ms", ")", "{", "var", "axes", "=", "this", ".", "_cam", ".", "mainAxes", "(", ")", ";", "var", "intervals", "=", "[", "new", "utils", ".", "Range", "(", ")", ",", "new", "utils", ".", "Range", "(", ")", ",", "new", "utils", "....
adapt the zoom level to fit the viewport to all visible objects.
[ "adapt", "the", "zoom", "level", "to", "fit", "the", "viewport", "to", "all", "visible", "objects", "." ]
ed561cb63210e7662a568c55f9501961f011dfe8
https://github.com/biasmv/pv/blob/ed561cb63210e7662a568c55f9501961f011dfe8/src/viewer.js#L939-L950
train
biasmv/pv
src/viewer.js
function(enable) { if (enable === undefined) { return this._rockAndRoll !== null; } if (!!enable) { if (this._rockAndRoll === null) { this._rockAndRoll = anim.rockAndRoll(); this._animControl.add(this._rockAndRoll); this.requestRedraw(); } return true; } ...
javascript
function(enable) { if (enable === undefined) { return this._rockAndRoll !== null; } if (!!enable) { if (this._rockAndRoll === null) { this._rockAndRoll = anim.rockAndRoll(); this._animControl.add(this._rockAndRoll); this.requestRedraw(); } return true; } ...
[ "function", "(", "enable", ")", "{", "if", "(", "enable", "===", "undefined", ")", "{", "return", "this", ".", "_rockAndRoll", "!==", "null", ";", "}", "if", "(", "!", "!", "enable", ")", "{", "if", "(", "this", ".", "_rockAndRoll", "===", "null", ...
enable disable rock and rolling of camera
[ "enable", "disable", "rock", "and", "rolling", "of", "camera" ]
ed561cb63210e7662a568c55f9501961f011dfe8
https://github.com/biasmv/pv/blob/ed561cb63210e7662a568c55f9501961f011dfe8/src/viewer.js#L964-L980
train
biasmv/pv
src/viewer.js
function(glob) { var newObjects = []; var regex = this._globToRegex(glob); for (var i = 0; i < this._objects.length; ++i) { var obj = this._objects[i]; if (!regex.test(obj.name())) { newObjects.push(obj); } else { obj.destroy(); } } this._objects = newObjects;...
javascript
function(glob) { var newObjects = []; var regex = this._globToRegex(glob); for (var i = 0; i < this._objects.length; ++i) { var obj = this._objects[i]; if (!regex.test(obj.name())) { newObjects.push(obj); } else { obj.destroy(); } } this._objects = newObjects;...
[ "function", "(", "glob", ")", "{", "var", "newObjects", "=", "[", "]", ";", "var", "regex", "=", "this", ".", "_globToRegex", "(", "glob", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "this", ".", "_objects", ".", "length", ";", "...
remove all objects whose names match the provided glob pattern from the viewer.
[ "remove", "all", "objects", "whose", "names", "match", "the", "provided", "glob", "pattern", "from", "the", "viewer", "." ]
ed561cb63210e7662a568c55f9501961f011dfe8
https://github.com/biasmv/pv/blob/ed561cb63210e7662a568c55f9501961f011dfe8/src/viewer.js#L1154-L1166
train
biasmv/pv
src/gfx/chain-data.js
LineChainData
function LineChainData(chain, gl, numVerts, float32Allocator) { VertexArray.call(this, gl, numVerts, float32Allocator); this._chain = chain; }
javascript
function LineChainData(chain, gl, numVerts, float32Allocator) { VertexArray.call(this, gl, numVerts, float32Allocator); this._chain = chain; }
[ "function", "LineChainData", "(", "chain", ",", "gl", ",", "numVerts", ",", "float32Allocator", ")", "{", "VertexArray", ".", "call", "(", "this", ",", "gl", ",", "numVerts", ",", "float32Allocator", ")", ";", "this", ".", "_chain", "=", "chain", ";", "}...
LineChainData and MeshChainData are two internal classes that add molecule- specific attributes and functionality to the IndexedVertexArray and VertexArray classes.
[ "LineChainData", "and", "MeshChainData", "are", "two", "internal", "classes", "that", "add", "molecule", "-", "specific", "attributes", "and", "functionality", "to", "the", "IndexedVertexArray", "and", "VertexArray", "classes", "." ]
ed561cb63210e7662a568c55f9501961f011dfe8
https://github.com/biasmv/pv/blob/ed561cb63210e7662a568c55f9501961f011dfe8/src/gfx/chain-data.js#L37-L40
train
biasmv/pv
src/gfx/animation.js
function(camera) { var time = Date.now(); this._animations = this._animations.filter(function(anim) { return !anim.step(camera, time); }); return this._animations.length > 0; }
javascript
function(camera) { var time = Date.now(); this._animations = this._animations.filter(function(anim) { return !anim.step(camera, time); }); return this._animations.length > 0; }
[ "function", "(", "camera", ")", "{", "var", "time", "=", "Date", ".", "now", "(", ")", ";", "this", ".", "_animations", "=", "this", ".", "_animations", ".", "filter", "(", "function", "(", "anim", ")", "{", "return", "!", "anim", ".", "step", "(",...
apply all currently active animations to the camera returns true if there are pending animations.
[ "apply", "all", "currently", "active", "animations", "to", "the", "camera", "returns", "true", "if", "there", "are", "pending", "animations", "." ]
ed561cb63210e7662a568c55f9501961f011dfe8
https://github.com/biasmv/pv/blob/ed561cb63210e7662a568c55f9501961f011dfe8/src/gfx/animation.js#L186-L192
train
biasmv/pv
src/gfx/canvas.js
function(width, height) { if (width === this._width && height === this._height) { return; } this._resize = true; this._width = width; this._height = height; }
javascript
function(width, height) { if (width === this._width && height === this._height) { return; } this._resize = true; this._width = width; this._height = height; }
[ "function", "(", "width", ",", "height", ")", "{", "if", "(", "width", "===", "this", ".", "_width", "&&", "height", "===", "this", ".", "_height", ")", "{", "return", ";", "}", "this", ".", "_resize", "=", "true", ";", "this", ".", "_width", "=", ...
tells the canvas to resize. The resize does not happen immediately but is delayed until the next redraw. This avoids flickering
[ "tells", "the", "canvas", "to", "resize", ".", "The", "resize", "does", "not", "happen", "immediately", "but", "is", "delayed", "until", "the", "next", "redraw", ".", "This", "avoids", "flickering" ]
ed561cb63210e7662a568c55f9501961f011dfe8
https://github.com/biasmv/pv/blob/ed561cb63210e7662a568c55f9501961f011dfe8/src/gfx/canvas.js#L84-L91
train
biasmv/pv
src/gfx/line-geom.js
LineGeom
function LineGeom(gl, float32Allocator) { BaseGeom.call(this, gl); this._vertArrays = []; this._float32Allocator = float32Allocator; this._lineWidth = 0.5; this._pointSize = 1.0; }
javascript
function LineGeom(gl, float32Allocator) { BaseGeom.call(this, gl); this._vertArrays = []; this._float32Allocator = float32Allocator; this._lineWidth = 0.5; this._pointSize = 1.0; }
[ "function", "LineGeom", "(", "gl", ",", "float32Allocator", ")", "{", "BaseGeom", ".", "call", "(", "this", ",", "gl", ")", ";", "this", ".", "_vertArrays", "=", "[", "]", ";", "this", ".", "_float32Allocator", "=", "float32Allocator", ";", "this", ".", ...
Holds geometrical data for objects rendered as lines. For each vertex, the color and position is stored in an interleaved format.
[ "Holds", "geometrical", "data", "for", "objects", "rendered", "as", "lines", ".", "For", "each", "vertex", "the", "color", "and", "position", "is", "stored", "in", "an", "interleaved", "format", "." ]
ed561cb63210e7662a568c55f9501961f011dfe8
https://github.com/biasmv/pv/blob/ed561cb63210e7662a568c55f9501961f011dfe8/src/gfx/line-geom.js#L38-L44
train
biasmv/pv
src/gfx/vert-assoc.js
TraceVertexAssoc
function TraceVertexAssoc(structure, interpolation, callColoringBeginEnd) { this._structure = structure; this._assocs = []; this._callBeginEnd = callColoringBeginEnd; this._interpolation = interpolation || 1; this._perResidueColors = {}; }
javascript
function TraceVertexAssoc(structure, interpolation, callColoringBeginEnd) { this._structure = structure; this._assocs = []; this._callBeginEnd = callColoringBeginEnd; this._interpolation = interpolation || 1; this._perResidueColors = {}; }
[ "function", "TraceVertexAssoc", "(", "structure", ",", "interpolation", ",", "callColoringBeginEnd", ")", "{", "this", ".", "_structure", "=", "structure", ";", "this", ".", "_assocs", "=", "[", "]", ";", "this", ".", "_callBeginEnd", "=", "callColoringBeginEnd"...
handles the association between a trace element, and sets of vertices.
[ "handles", "the", "association", "between", "a", "trace", "element", "and", "sets", "of", "vertices", "." ]
ed561cb63210e7662a568c55f9501961f011dfe8
https://github.com/biasmv/pv/blob/ed561cb63210e7662a568c55f9501961f011dfe8/src/gfx/vert-assoc.js#L135-L141
train
biasmv/pv
src/mol/mol.js
function() { var center = this.center(); var radiusSquare = 0.0; this.eachAtom(function(atom) { radiusSquare = Math.max(radiusSquare, vec3.sqrDist(center, atom.pos())); }); return new geom.Sphere(center, Math.sqrt(radiusSquare)); }
javascript
function() { var center = this.center(); var radiusSquare = 0.0; this.eachAtom(function(atom) { radiusSquare = Math.max(radiusSquare, vec3.sqrDist(center, atom.pos())); }); return new geom.Sphere(center, Math.sqrt(radiusSquare)); }
[ "function", "(", ")", "{", "var", "center", "=", "this", ".", "center", "(", ")", ";", "var", "radiusSquare", "=", "0.0", ";", "this", ".", "eachAtom", "(", "function", "(", "atom", ")", "{", "radiusSquare", "=", "Math", ".", "max", "(", "radiusSquar...
returns a sphere containing all atoms part of this structure. This will not calculate the minimal bounding sphere, just a good-enough approximation.
[ "returns", "a", "sphere", "containing", "all", "atoms", "part", "of", "this", "structure", ".", "This", "will", "not", "calculate", "the", "minimal", "bounding", "sphere", "just", "a", "good", "-", "enough", "approximation", "." ]
ed561cb63210e7662a568c55f9501961f011dfe8
https://github.com/biasmv/pv/blob/ed561cb63210e7662a568c55f9501961f011dfe8/src/mol/mol.js#L166-L173
train
biasmv/pv
src/mol/mol.js
function() { var chains = this.chains(); var traces = []; for (var i = 0; i < chains.length; ++i) { Array.prototype.push.apply(traces, chains[i].backboneTraces()); } return traces; }
javascript
function() { var chains = this.chains(); var traces = []; for (var i = 0; i < chains.length; ++i) { Array.prototype.push.apply(traces, chains[i].backboneTraces()); } return traces; }
[ "function", "(", ")", "{", "var", "chains", "=", "this", ".", "chains", "(", ")", ";", "var", "traces", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "chains", ".", "length", ";", "++", "i", ")", "{", "Array", ".", "p...
returns all backbone traces of all chains of this structure
[ "returns", "all", "backbone", "traces", "of", "all", "chains", "of", "this", "structure" ]
ed561cb63210e7662a568c55f9501961f011dfe8
https://github.com/biasmv/pv/blob/ed561cb63210e7662a568c55f9501961f011dfe8/src/mol/mol.js#L176-L183
train
biasmv/pv
src/mol/mol.js
function() { console.time('Mol.deriveConnectivity'); var thisStructure = this; var prevResidue = null; this.eachResidue(function(res) { var sqrDist; var atoms = res.atoms(); var numAtoms = atoms.length; for (var i = 0; i < numAtoms; i+=1) { var atomI = atoms[i]; v...
javascript
function() { console.time('Mol.deriveConnectivity'); var thisStructure = this; var prevResidue = null; this.eachResidue(function(res) { var sqrDist; var atoms = res.atoms(); var numAtoms = atoms.length; for (var i = 0; i < numAtoms; i+=1) { var atomI = atoms[i]; v...
[ "function", "(", ")", "{", "console", ".", "time", "(", "'Mol.deriveConnectivity'", ")", ";", "var", "thisStructure", "=", "this", ";", "var", "prevResidue", "=", "null", ";", "this", ".", "eachResidue", "(", "function", "(", "res", ")", "{", "var", "sqr...
determine connectivity structure. for simplicity only connects atoms of the same residue, peptide bonds and nucleotides
[ "determine", "connectivity", "structure", ".", "for", "simplicity", "only", "connects", "atoms", "of", "the", "same", "residue", "peptide", "bonds", "and", "nucleotides" ]
ed561cb63210e7662a568c55f9501961f011dfe8
https://github.com/biasmv/pv/blob/ed561cb63210e7662a568c55f9501961f011dfe8/src/mol/mol.js#L408-L443
train
biasmv/pv
src/mol/mol.js
function(chain, recurse) { var chainView = new ChainView(this, chain.full()); this._chains.push(chainView); if (recurse) { var residues = chain.residues(); for (var i = 0; i< residues.length; ++i) { chainView.addResidue(residues[i], true); } } return chainView; }
javascript
function(chain, recurse) { var chainView = new ChainView(this, chain.full()); this._chains.push(chainView); if (recurse) { var residues = chain.residues(); for (var i = 0; i< residues.length; ++i) { chainView.addResidue(residues[i], true); } } return chainView; }
[ "function", "(", "chain", ",", "recurse", ")", "{", "var", "chainView", "=", "new", "ChainView", "(", "this", ",", "chain", ".", "full", "(", ")", ")", ";", "this", ".", "_chains", ".", "push", "(", "chainView", ")", ";", "if", "(", "recurse", ")",...
add chain to view
[ "add", "chain", "to", "view" ]
ed561cb63210e7662a568c55f9501961f011dfe8
https://github.com/biasmv/pv/blob/ed561cb63210e7662a568c55f9501961f011dfe8/src/mol/mol.js#L459-L469
train
biasmv/pv
src/mol/select.js
_residuePredicates
function _residuePredicates(dict) { var predicates = []; if (dict.rname !== undefined) { predicates.push(function(r) { return r.name() === dict.rname; }); } if (dict.rnames !== undefined) { predicates.push(function(r) { var n = r.name(); for (var k = 0; k < dict.rnames.length; ++k) { if (...
javascript
function _residuePredicates(dict) { var predicates = []; if (dict.rname !== undefined) { predicates.push(function(r) { return r.name() === dict.rname; }); } if (dict.rnames !== undefined) { predicates.push(function(r) { var n = r.name(); for (var k = 0; k < dict.rnames.length; ++k) { if (...
[ "function", "_residuePredicates", "(", "dict", ")", "{", "var", "predicates", "=", "[", "]", ";", "if", "(", "dict", ".", "rname", "!==", "undefined", ")", "{", "predicates", ".", "push", "(", "function", "(", "r", ")", "{", "return", "r", ".", "name...
extracts the residue predicates from the dictionary. ignores rindices, rindexRange because they are handled separately.
[ "extracts", "the", "residue", "predicates", "from", "the", "dictionary", ".", "ignores", "rindices", "rindexRange", "because", "they", "are", "handled", "separately", "." ]
ed561cb63210e7662a568c55f9501961f011dfe8
https://github.com/biasmv/pv/blob/ed561cb63210e7662a568c55f9501961f011dfe8/src/mol/select.js#L36-L73
train
biasmv/pv
src/mol/select.js
_filterResidues
function _filterResidues(chain, dict) { var residues = chain.residues(); if (dict.rnumRange) { residues = chain.residuesInRnumRange(dict.rnumRange[0], dict.rnumRange[1]); } var selResidues = [], i, e; if (dict.rindexRange !== undefined) { for (i = dict.rindexRange[0], e = Math.min(resi...
javascript
function _filterResidues(chain, dict) { var residues = chain.residues(); if (dict.rnumRange) { residues = chain.residuesInRnumRange(dict.rnumRange[0], dict.rnumRange[1]); } var selResidues = [], i, e; if (dict.rindexRange !== undefined) { for (i = dict.rindexRange[0], e = Math.min(resi...
[ "function", "_filterResidues", "(", "chain", ",", "dict", ")", "{", "var", "residues", "=", "chain", ".", "residues", "(", ")", ";", "if", "(", "dict", ".", "rnumRange", ")", "{", "residues", "=", "chain", ".", "residuesInRnumRange", "(", "dict", ".", ...
handles all residue predicates that can be done through either index- based lookups, or optimized searches of some sorts.
[ "handles", "all", "residue", "predicates", "that", "can", "be", "done", "through", "either", "index", "-", "based", "lookups", "or", "optimized", "searches", "of", "some", "sorts", "." ]
ed561cb63210e7662a568c55f9501961f011dfe8
https://github.com/biasmv/pv/blob/ed561cb63210e7662a568c55f9501961f011dfe8/src/mol/select.js#L103-L128
train
biasmv/pv
src/mol/select.js
dictSelect
function dictSelect(structure, view, dict) { var residuePredicates = _residuePredicates(dict); var atomPredicates = _atomPredicates(dict); var chainPredicates = _chainPredicates(dict); if (dict.rindex) { dict.rindices = [dict.rindex]; } for (var ci = 0; ci < structure._chains.length; ++ci) { var ch...
javascript
function dictSelect(structure, view, dict) { var residuePredicates = _residuePredicates(dict); var atomPredicates = _atomPredicates(dict); var chainPredicates = _chainPredicates(dict); if (dict.rindex) { dict.rindices = [dict.rindex]; } for (var ci = 0; ci < structure._chains.length; ++ci) { var ch...
[ "function", "dictSelect", "(", "structure", ",", "view", ",", "dict", ")", "{", "var", "residuePredicates", "=", "_residuePredicates", "(", "dict", ")", ";", "var", "atomPredicates", "=", "_atomPredicates", "(", "dict", ")", ";", "var", "chainPredicates", "=",...
helper function to perform selection by predicates
[ "helper", "function", "to", "perform", "selection", "by", "predicates" ]
ed561cb63210e7662a568c55f9501961f011dfe8
https://github.com/biasmv/pv/blob/ed561cb63210e7662a568c55f9501961f011dfe8/src/mol/select.js#L131-L167
train
sapegin/grunt-webfont
tasks/webfont.js
completeTask
function completeTask() { if (o && _.isFunction(o.callback)) { o.callback(o.fontName, o.types, o.glyphs, o.hash); } allDone(); }
javascript
function completeTask() { if (o && _.isFunction(o.callback)) { o.callback(o.fontName, o.types, o.glyphs, o.hash); } allDone(); }
[ "function", "completeTask", "(", ")", "{", "if", "(", "o", "&&", "_", ".", "isFunction", "(", "o", ".", "callback", ")", ")", "{", "o", ".", "callback", "(", "o", ".", "fontName", ",", "o", ".", "types", ",", "o", ".", "glyphs", ",", "o", ".", ...
Call callback function if it was specified in the options.
[ "Call", "callback", "function", "if", "it", "was", "specified", "in", "the", "options", "." ]
55114cc5c3625ec34dc82d7a844abc94d79411b8
https://github.com/sapegin/grunt-webfont/blob/55114cc5c3625ec34dc82d7a844abc94d79411b8/tasks/webfont.js#L211-L216
train
sapegin/grunt-webfont
tasks/webfont.js
getHash
function getHash() { // Source SVG files contents o.files.forEach(function(file) { md5.update(fs.readFileSync(file, 'utf8')); }); // Options md5.update(JSON.stringify(o)); // grunt-webfont version var packageJson = require('../package.json'); md5.update(packageJson.version); // Templat...
javascript
function getHash() { // Source SVG files contents o.files.forEach(function(file) { md5.update(fs.readFileSync(file, 'utf8')); }); // Options md5.update(JSON.stringify(o)); // grunt-webfont version var packageJson = require('../package.json'); md5.update(packageJson.version); // Templat...
[ "function", "getHash", "(", ")", "{", "// Source SVG files contents", "o", ".", "files", ".", "forEach", "(", "function", "(", "file", ")", "{", "md5", ".", "update", "(", "fs", ".", "readFileSync", "(", "file", ",", "'utf8'", ")", ")", ";", "}", ")", ...
Calculate hash to flush browser cache. Hash is based on source SVG files contents, task options and grunt-webfont version. @return {String}
[ "Calculate", "hash", "to", "flush", "browser", "cache", ".", "Hash", "is", "based", "on", "source", "SVG", "files", "contents", "task", "options", "and", "grunt", "-", "webfont", "version", "." ]
55114cc5c3625ec34dc82d7a844abc94d79411b8
https://github.com/sapegin/grunt-webfont/blob/55114cc5c3625ec34dc82d7a844abc94d79411b8/tasks/webfont.js#L224-L246
train
sapegin/grunt-webfont
tasks/webfont.js
cleanOutputDir
function cleanOutputDir(done) { var htmlDemoFileMask = path.join(o.destCss, o.fontBaseName + '*.{css,html}'); var files = glob.sync(htmlDemoFileMask).concat(wf.generatedFontFiles(o)); async.forEach(files, function(file, next) { fs.unlink(file, next); }, done); }
javascript
function cleanOutputDir(done) { var htmlDemoFileMask = path.join(o.destCss, o.fontBaseName + '*.{css,html}'); var files = glob.sync(htmlDemoFileMask).concat(wf.generatedFontFiles(o)); async.forEach(files, function(file, next) { fs.unlink(file, next); }, done); }
[ "function", "cleanOutputDir", "(", "done", ")", "{", "var", "htmlDemoFileMask", "=", "path", ".", "join", "(", "o", ".", "destCss", ",", "o", ".", "fontBaseName", "+", "'*.{css,html}'", ")", ";", "var", "files", "=", "glob", ".", "sync", "(", "htmlDemoFi...
Clean output directory @param {Function} done
[ "Clean", "output", "directory" ]
55114cc5c3625ec34dc82d7a844abc94d79411b8
https://github.com/sapegin/grunt-webfont/blob/55114cc5c3625ec34dc82d7a844abc94d79411b8/tasks/webfont.js#L266-L272
train
sapegin/grunt-webfont
tasks/webfont.js
generateFont
function generateFont(done) { var engine = require('./engines/' + o.engine); engine(o, function(result) { if (result === false) { // Font was not created, exit completeTask(); return; } if (result) { o = _.extend(o, result); } done(); }); }
javascript
function generateFont(done) { var engine = require('./engines/' + o.engine); engine(o, function(result) { if (result === false) { // Font was not created, exit completeTask(); return; } if (result) { o = _.extend(o, result); } done(); }); }
[ "function", "generateFont", "(", "done", ")", "{", "var", "engine", "=", "require", "(", "'./engines/'", "+", "o", ".", "engine", ")", ";", "engine", "(", "o", ",", "function", "(", "result", ")", "{", "if", "(", "result", "===", "false", ")", "{", ...
Generate font using selected engine @param {Function} done
[ "Generate", "font", "using", "selected", "engine" ]
55114cc5c3625ec34dc82d7a844abc94d79411b8
https://github.com/sapegin/grunt-webfont/blob/55114cc5c3625ec34dc82d7a844abc94d79411b8/tasks/webfont.js#L279-L294
train
sapegin/grunt-webfont
tasks/webfont.js
generateWoff2Font
function generateWoff2Font(done) { if (!has(o.types, 'woff2')) { done(); return; } // Read TTF font var ttfFontPath = wf.getFontPath(o, 'ttf'); var ttfFont = fs.readFileSync(ttfFontPath); // Remove TTF font if not needed if (!has(o.types, 'ttf')) { fs.unlinkSync(ttfFontPath); } ...
javascript
function generateWoff2Font(done) { if (!has(o.types, 'woff2')) { done(); return; } // Read TTF font var ttfFontPath = wf.getFontPath(o, 'ttf'); var ttfFont = fs.readFileSync(ttfFontPath); // Remove TTF font if not needed if (!has(o.types, 'ttf')) { fs.unlinkSync(ttfFontPath); } ...
[ "function", "generateWoff2Font", "(", "done", ")", "{", "if", "(", "!", "has", "(", "o", ".", "types", ",", "'woff2'", ")", ")", "{", "done", "(", ")", ";", "return", ";", "}", "// Read TTF font", "var", "ttfFontPath", "=", "wf", ".", "getFontPath", ...
Converts TTF font to WOFF2. @param {Function} done
[ "Converts", "TTF", "font", "to", "WOFF2", "." ]
55114cc5c3625ec34dc82d7a844abc94d79411b8
https://github.com/sapegin/grunt-webfont/blob/55114cc5c3625ec34dc82d7a844abc94d79411b8/tasks/webfont.js#L301-L322
train
sapegin/grunt-webfont
tasks/webfont.js
readCodepointsFromFile
function readCodepointsFromFile(){ if (!o.codepointsFile) return {}; if (!fs.existsSync(o.codepointsFile)){ logger.verbose('Codepoints file not found'); return {}; } var buffer = fs.readFileSync(o.codepointsFile); return JSON.parse(buffer.toString()); }
javascript
function readCodepointsFromFile(){ if (!o.codepointsFile) return {}; if (!fs.existsSync(o.codepointsFile)){ logger.verbose('Codepoints file not found'); return {}; } var buffer = fs.readFileSync(o.codepointsFile); return JSON.parse(buffer.toString()); }
[ "function", "readCodepointsFromFile", "(", ")", "{", "if", "(", "!", "o", ".", "codepointsFile", ")", "return", "{", "}", ";", "if", "(", "!", "fs", ".", "existsSync", "(", "o", ".", "codepointsFile", ")", ")", "{", "logger", ".", "verbose", "(", "'C...
Gets the codepoints from the set filepath in o.codepointsFile
[ "Gets", "the", "codepoints", "from", "the", "set", "filepath", "in", "o", ".", "codepointsFile" ]
55114cc5c3625ec34dc82d7a844abc94d79411b8
https://github.com/sapegin/grunt-webfont/blob/55114cc5c3625ec34dc82d7a844abc94d79411b8/tasks/webfont.js#L403-L412
train
sapegin/grunt-webfont
tasks/webfont.js
saveCodepointsToFile
function saveCodepointsToFile(){ if (!o.codepointsFile) return; var codepointsToString = JSON.stringify(o.codepoints, null, 4); try { fs.writeFileSync(o.codepointsFile, codepointsToString); logger.verbose('Codepoints saved to file "' + o.codepointsFile + '".'); } catch (err) { logger.error(err.m...
javascript
function saveCodepointsToFile(){ if (!o.codepointsFile) return; var codepointsToString = JSON.stringify(o.codepoints, null, 4); try { fs.writeFileSync(o.codepointsFile, codepointsToString); logger.verbose('Codepoints saved to file "' + o.codepointsFile + '".'); } catch (err) { logger.error(err.m...
[ "function", "saveCodepointsToFile", "(", ")", "{", "if", "(", "!", "o", ".", "codepointsFile", ")", "return", ";", "var", "codepointsToString", "=", "JSON", ".", "stringify", "(", "o", ".", "codepoints", ",", "null", ",", "4", ")", ";", "try", "{", "fs...
Saves the codespoints to the set file
[ "Saves", "the", "codespoints", "to", "the", "set", "file" ]
55114cc5c3625ec34dc82d7a844abc94d79411b8
https://github.com/sapegin/grunt-webfont/blob/55114cc5c3625ec34dc82d7a844abc94d79411b8/tasks/webfont.js#L417-L426
train
sapegin/grunt-webfont
tasks/webfont.js
generateDemoHtml
function generateDemoHtml(done) { if (!o.htmlDemo) { done(); return; } var context = prepareHtmlTemplateContext(); // Generate HTML var demoTemplate = readTemplate(o.htmlDemoTemplate, 'demo', '.html'); var demo = renderTemplate(demoTemplate, context); mkdirp(getDemoPath(), function(err) ...
javascript
function generateDemoHtml(done) { if (!o.htmlDemo) { done(); return; } var context = prepareHtmlTemplateContext(); // Generate HTML var demoTemplate = readTemplate(o.htmlDemoTemplate, 'demo', '.html'); var demo = renderTemplate(demoTemplate, context); mkdirp(getDemoPath(), function(err) ...
[ "function", "generateDemoHtml", "(", "done", ")", "{", "if", "(", "!", "o", ".", "htmlDemo", ")", "{", "done", "(", ")", ";", "return", ";", "}", "var", "context", "=", "prepareHtmlTemplateContext", "(", ")", ";", "// Generate HTML", "var", "demoTemplate",...
Generate HTML demo page @param {Function} done
[ "Generate", "HTML", "demo", "page" ]
55114cc5c3625ec34dc82d7a844abc94d79411b8
https://github.com/sapegin/grunt-webfont/blob/55114cc5c3625ec34dc82d7a844abc94d79411b8/tasks/webfont.js#L535-L557
train
sapegin/grunt-webfont
tasks/webfont.js
optionToArray
function optionToArray(val, defVal) { if (val === undefined) { val = defVal; } if (!val) { return []; } if (typeof val !== 'string') { return val; } return val.split(',').map(_.trim); }
javascript
function optionToArray(val, defVal) { if (val === undefined) { val = defVal; } if (!val) { return []; } if (typeof val !== 'string') { return val; } return val.split(',').map(_.trim); }
[ "function", "optionToArray", "(", "val", ",", "defVal", ")", "{", "if", "(", "val", "===", "undefined", ")", "{", "val", "=", "defVal", ";", "}", "if", "(", "!", "val", ")", "{", "return", "[", "]", ";", "}", "if", "(", "typeof", "val", "!==", ...
Helpers Convert a string of comma separated words into an array @param {String} val Input string @param {String} defVal Default value @return {Array}
[ "Helpers", "Convert", "a", "string", "of", "comma", "separated", "words", "into", "an", "array" ]
55114cc5c3625ec34dc82d7a844abc94d79411b8
https://github.com/sapegin/grunt-webfont/blob/55114cc5c3625ec34dc82d7a844abc94d79411b8/tasks/webfont.js#L581-L592
train
sapegin/grunt-webfont
tasks/webfont.js
normalizePath
function normalizePath(filepath) { if (!filepath.length) return filepath; // Make all slashes forward filepath = filepath.replace(/\\/g, '/'); // Make sure path ends with a slash if (!_s.endsWith(filepath, '/')) { filepath += '/'; } return filepath; }
javascript
function normalizePath(filepath) { if (!filepath.length) return filepath; // Make all slashes forward filepath = filepath.replace(/\\/g, '/'); // Make sure path ends with a slash if (!_s.endsWith(filepath, '/')) { filepath += '/'; } return filepath; }
[ "function", "normalizePath", "(", "filepath", ")", "{", "if", "(", "!", "filepath", ".", "length", ")", "return", "filepath", ";", "// Make all slashes forward", "filepath", "=", "filepath", ".", "replace", "(", "/", "\\\\", "/", "g", ",", "'/'", ")", ";",...
Append a slash to end of a filepath if it not exists and make all slashes forward @param {String} filepath File path @return {String}
[ "Append", "a", "slash", "to", "end", "of", "a", "filepath", "if", "it", "not", "exists", "and", "make", "all", "slashes", "forward" ]
55114cc5c3625ec34dc82d7a844abc94d79411b8
https://github.com/sapegin/grunt-webfont/blob/55114cc5c3625ec34dc82d7a844abc94d79411b8/tasks/webfont.js#L667-L679
train
sapegin/grunt-webfont
tasks/webfont.js
readTemplate
function readTemplate(template, syntax, ext, optional) { var filename = template ? path.resolve(template.replace(path.extname(template), ext)) : path.join(__dirname, 'templates/' + syntax + ext) ; if (fs.existsSync(filename)) { return { filename: filename, template: fs.readFileSync(filena...
javascript
function readTemplate(template, syntax, ext, optional) { var filename = template ? path.resolve(template.replace(path.extname(template), ext)) : path.join(__dirname, 'templates/' + syntax + ext) ; if (fs.existsSync(filename)) { return { filename: filename, template: fs.readFileSync(filena...
[ "function", "readTemplate", "(", "template", ",", "syntax", ",", "ext", ",", "optional", ")", "{", "var", "filename", "=", "template", "?", "path", ".", "resolve", "(", "template", ".", "replace", "(", "path", ".", "extname", "(", "template", ")", ",", ...
Reat the template file @param {String} template Template file path @param {String} syntax Syntax (bem, bootstrap, etc.) @param {String} ext Extention of the template @return {Object} {filename: 'Template filename', template: 'Template code'}
[ "Reat", "the", "template", "file" ]
55114cc5c3625ec34dc82d7a844abc94d79411b8
https://github.com/sapegin/grunt-webfont/blob/55114cc5c3625ec34dc82d7a844abc94d79411b8/tasks/webfont.js#L746-L760
train
sapegin/grunt-webfont
tasks/webfont.js
renderTemplate
function renderTemplate(template, context) { try { var func = _.template(template.template); return func(context); } catch (e) { grunt.fail.fatal('Error while rendering template ' + template.filename + ': ' + e.message); } }
javascript
function renderTemplate(template, context) { try { var func = _.template(template.template); return func(context); } catch (e) { grunt.fail.fatal('Error while rendering template ' + template.filename + ': ' + e.message); } }
[ "function", "renderTemplate", "(", "template", ",", "context", ")", "{", "try", "{", "var", "func", "=", "_", ".", "template", "(", "template", ".", "template", ")", ";", "return", "func", "(", "context", ")", ";", "}", "catch", "(", "e", ")", "{", ...
Render template with error reporting @param {Object} template {filename: 'Template filename', template: 'Template code'} @param {Object} context Template context @return {String}
[ "Render", "template", "with", "error", "reporting" ]
55114cc5c3625ec34dc82d7a844abc94d79411b8
https://github.com/sapegin/grunt-webfont/blob/55114cc5c3625ec34dc82d7a844abc94d79411b8/tasks/webfont.js#L769-L777
train
sapegin/grunt-webfont
tasks/webfont.js
getCssFilePath
function getCssFilePath(stylesheet) { var cssFilePrefix = option(wf.cssFilePrefixes, stylesheet); return path.join(option(o.destCssPaths, stylesheet), cssFilePrefix + o.fontBaseName + '.' + stylesheet); }
javascript
function getCssFilePath(stylesheet) { var cssFilePrefix = option(wf.cssFilePrefixes, stylesheet); return path.join(option(o.destCssPaths, stylesheet), cssFilePrefix + o.fontBaseName + '.' + stylesheet); }
[ "function", "getCssFilePath", "(", "stylesheet", ")", "{", "var", "cssFilePrefix", "=", "option", "(", "wf", ".", "cssFilePrefixes", ",", "stylesheet", ")", ";", "return", "path", ".", "join", "(", "option", "(", "o", ".", "destCssPaths", ",", "stylesheet", ...
Return path of CSS file. @param {String} stylesheet (css, scss, ...) @return {String}
[ "Return", "path", "of", "CSS", "file", "." ]
55114cc5c3625ec34dc82d7a844abc94d79411b8
https://github.com/sapegin/grunt-webfont/blob/55114cc5c3625ec34dc82d7a844abc94d79411b8/tasks/webfont.js#L808-L811
train
sapegin/grunt-webfont
tasks/webfont.js
getDemoFilePath
function getDemoFilePath() { if (!o.htmlDemo) return null; var name = o.htmlDemoFilename || o.fontBaseName; return path.join(o.destHtml, name + '.html'); }
javascript
function getDemoFilePath() { if (!o.htmlDemo) return null; var name = o.htmlDemoFilename || o.fontBaseName; return path.join(o.destHtml, name + '.html'); }
[ "function", "getDemoFilePath", "(", ")", "{", "if", "(", "!", "o", ".", "htmlDemo", ")", "return", "null", ";", "var", "name", "=", "o", ".", "htmlDemoFilename", "||", "o", ".", "fontBaseName", ";", "return", "path", ".", "join", "(", "o", ".", "dest...
Return path of HTML demo file or `null` if its generation was disabled. @return {String}
[ "Return", "path", "of", "HTML", "demo", "file", "or", "null", "if", "its", "generation", "was", "disabled", "." ]
55114cc5c3625ec34dc82d7a844abc94d79411b8
https://github.com/sapegin/grunt-webfont/blob/55114cc5c3625ec34dc82d7a844abc94d79411b8/tasks/webfont.js#L818-L822
train
sapegin/grunt-webfont
tasks/webfont.js
saveHash
function saveHash(name, target, hash) { var filepath = getHashPath(name, target); mkdirp.sync(path.dirname(filepath)); fs.writeFileSync(filepath, hash); }
javascript
function saveHash(name, target, hash) { var filepath = getHashPath(name, target); mkdirp.sync(path.dirname(filepath)); fs.writeFileSync(filepath, hash); }
[ "function", "saveHash", "(", "name", ",", "target", ",", "hash", ")", "{", "var", "filepath", "=", "getHashPath", "(", "name", ",", "target", ")", ";", "mkdirp", ".", "sync", "(", "path", ".", "dirname", "(", "filepath", ")", ")", ";", "fs", ".", "...
Save hash to cache file. @param {String} name Task name (webfont). @param {String} target Task target name. @param {String} hash Hash.
[ "Save", "hash", "to", "cache", "file", "." ]
55114cc5c3625ec34dc82d7a844abc94d79411b8
https://github.com/sapegin/grunt-webfont/blob/55114cc5c3625ec34dc82d7a844abc94d79411b8/tasks/webfont.js#L839-L843
train
kyma-project/luigi
client/src/luigi-client.js
_callAllFns
function _callAllFns(objWithFns, payload) { for (var id in objWithFns) { if (objWithFns.hasOwnProperty(id) && isFunction(objWithFns[id])) { objWithFns[id](payload); } } }
javascript
function _callAllFns(objWithFns, payload) { for (var id in objWithFns) { if (objWithFns.hasOwnProperty(id) && isFunction(objWithFns[id])) { objWithFns[id](payload); } } }
[ "function", "_callAllFns", "(", "objWithFns", ",", "payload", ")", "{", "for", "(", "var", "id", "in", "objWithFns", ")", "{", "if", "(", "objWithFns", ".", "hasOwnProperty", "(", "id", ")", "&&", "isFunction", "(", "objWithFns", "[", "id", "]", ")", "...
Iterates over an object and executes all top-level functions with a given payload. @private
[ "Iterates", "over", "an", "object", "and", "executes", "all", "top", "-", "level", "functions", "with", "a", "given", "payload", "." ]
901cfeef1b4c126f08d55257f559bbd1a6f6b0e4
https://github.com/kyma-project/luigi/blob/901cfeef1b4c126f08d55257f559bbd1a6f6b0e4/client/src/luigi-client.js#L40-L46
train
kyma-project/luigi
client/src/luigi-client.js
luigiClientInit
function luigiClientInit() { /** * Save context data every time navigation to a different node happens * @private */ function setContext(rawData) { for (var index = 0; index < defaultContextKeys.length; index++) { var key = defaultContextKeys[index]; try { if (typeof rawData[key] ==...
javascript
function luigiClientInit() { /** * Save context data every time navigation to a different node happens * @private */ function setContext(rawData) { for (var index = 0; index < defaultContextKeys.length; index++) { var key = defaultContextKeys[index]; try { if (typeof rawData[key] ==...
[ "function", "luigiClientInit", "(", ")", "{", "/**\n * Save context data every time navigation to a different node happens\n * @private\n */", "function", "setContext", "(", "rawData", ")", "{", "for", "(", "var", "index", "=", "0", ";", "index", "<", "defaultContextK...
Adds event listener for communication with Luigi Core and starts communication @private
[ "Adds", "event", "listener", "for", "communication", "with", "Luigi", "Core", "and", "starts", "communication" ]
901cfeef1b4c126f08d55257f559bbd1a6f6b0e4
https://github.com/kyma-project/luigi/blob/901cfeef1b4c126f08d55257f559bbd1a6f6b0e4/client/src/luigi-client.js#L52-L137
train
kyma-project/luigi
client/src/luigi-client.js
setContext
function setContext(rawData) { for (var index = 0; index < defaultContextKeys.length; index++) { var key = defaultContextKeys[index]; try { if (typeof rawData[key] === 'string') { rawData[key] = JSON.parse(rawData[key]); } } catch (e) { console.info( 'un...
javascript
function setContext(rawData) { for (var index = 0; index < defaultContextKeys.length; index++) { var key = defaultContextKeys[index]; try { if (typeof rawData[key] === 'string') { rawData[key] = JSON.parse(rawData[key]); } } catch (e) { console.info( 'un...
[ "function", "setContext", "(", "rawData", ")", "{", "for", "(", "var", "index", "=", "0", ";", "index", "<", "defaultContextKeys", ".", "length", ";", "index", "++", ")", "{", "var", "key", "=", "defaultContextKeys", "[", "index", "]", ";", "try", "{",...
Save context data every time navigation to a different node happens @private
[ "Save", "context", "data", "every", "time", "navigation", "to", "a", "different", "node", "happens" ]
901cfeef1b4c126f08d55257f559bbd1a6f6b0e4
https://github.com/kyma-project/luigi/blob/901cfeef1b4c126f08d55257f559bbd1a6f6b0e4/client/src/luigi-client.js#L57-L74
train
kyma-project/luigi
client/src/luigi-client.js
addInitListener
function addInitListener(initFn) { var id = _getRandomId(); _onInitFns[id] = initFn; if (luigiInitialized && isFunction(initFn)) { initFn(currentContext.context); } return id; }
javascript
function addInitListener(initFn) { var id = _getRandomId(); _onInitFns[id] = initFn; if (luigiInitialized && isFunction(initFn)) { initFn(currentContext.context); } return id; }
[ "function", "addInitListener", "(", "initFn", ")", "{", "var", "id", "=", "_getRandomId", "(", ")", ";", "_onInitFns", "[", "id", "]", "=", "initFn", ";", "if", "(", "luigiInitialized", "&&", "isFunction", "(", "initFn", ")", ")", "{", "initFn", "(", "...
Use the functions and parameters to define the lifecycle of listeners, navigation nodes, and Event data. @name lifecycle Registers a listener called with the context object as soon as Luigi is instantiated. Defer your application bootstrap if you depend on authentication data coming from Luigi. @param {function} init...
[ "Use", "the", "functions", "and", "parameters", "to", "define", "the", "lifecycle", "of", "listeners", "navigation", "nodes", "and", "Event", "data", "." ]
901cfeef1b4c126f08d55257f559bbd1a6f6b0e4
https://github.com/kyma-project/luigi/blob/901cfeef1b4c126f08d55257f559bbd1a6f6b0e4/client/src/luigi-client.js#L152-L159
train
kyma-project/luigi
client/src/luigi-client.js
addContextUpdateListener
function addContextUpdateListener( contextUpdatedFn ) { var id = _getRandomId(); _onContextUpdatedFns[id] = contextUpdatedFn; if (luigiInitialized && isFunction(contextUpdatedFn)) { contextUpdatedFn(currentContext.context); } return id; }
javascript
function addContextUpdateListener( contextUpdatedFn ) { var id = _getRandomId(); _onContextUpdatedFns[id] = contextUpdatedFn; if (luigiInitialized && isFunction(contextUpdatedFn)) { contextUpdatedFn(currentContext.context); } return id; }
[ "function", "addContextUpdateListener", "(", "contextUpdatedFn", ")", "{", "var", "id", "=", "_getRandomId", "(", ")", ";", "_onContextUpdatedFns", "[", "id", "]", "=", "contextUpdatedFn", ";", "if", "(", "luigiInitialized", "&&", "isFunction", "(", "contextUpdate...
Registers a listener called with the context object upon any navigation change. @param {function} contextUpdatedFn the listener function called each time Luigi context changes @memberof lifecycle
[ "Registers", "a", "listener", "called", "with", "the", "context", "object", "upon", "any", "navigation", "change", "." ]
901cfeef1b4c126f08d55257f559bbd1a6f6b0e4
https://github.com/kyma-project/luigi/blob/901cfeef1b4c126f08d55257f559bbd1a6f6b0e4/client/src/luigi-client.js#L177-L186
train
kyma-project/luigi
client/src/luigi-client.js
fromClosestContext
function fromClosestContext() { var hasParentNavigationContext = currentContext.context.parentNavigationContexts.length > 0; if (hasParentNavigationContext) { options.fromContext = null; options.fromClosestContext = true; } else { console.error( ...
javascript
function fromClosestContext() { var hasParentNavigationContext = currentContext.context.parentNavigationContexts.length > 0; if (hasParentNavigationContext) { options.fromContext = null; options.fromClosestContext = true; } else { console.error( ...
[ "function", "fromClosestContext", "(", ")", "{", "var", "hasParentNavigationContext", "=", "currentContext", ".", "context", ".", "parentNavigationContexts", ".", "length", ">", "0", ";", "if", "(", "hasParentNavigationContext", ")", "{", "options", ".", "fromContex...
Sets the current navigation context which is then used by the `navigate` function. This has to be a parent navigation context, it is not possible to use the child navigation contexts. @returns {linkManager} link manager instance @example LuigiClient.linkManager().fromClosestContext().navigate('/users/groups/stakeholder...
[ "Sets", "the", "current", "navigation", "context", "which", "is", "then", "used", "by", "the", "navigate", "function", ".", "This", "has", "to", "be", "a", "parent", "navigation", "context", "it", "is", "not", "possible", "to", "use", "the", "child", "navi...
901cfeef1b4c126f08d55257f559bbd1a6f6b0e4
https://github.com/kyma-project/luigi/blob/901cfeef1b4c126f08d55257f559bbd1a6f6b0e4/client/src/luigi-client.js#L330-L342
train
kyma-project/luigi
client/src/luigi-client.js
uxManager
function uxManager() { return { /** @lends uxManager */ /** * Adds a backdrop with a loading indicator for the micro front-end frame. This overrides the {@link navigation-configuration.md#nodes loadingIndicator.enabled} setting. */ showLoadingIndicator: function showLoadingIndicator(...
javascript
function uxManager() { return { /** @lends uxManager */ /** * Adds a backdrop with a loading indicator for the micro front-end frame. This overrides the {@link navigation-configuration.md#nodes loadingIndicator.enabled} setting. */ showLoadingIndicator: function showLoadingIndicator(...
[ "function", "uxManager", "(", ")", "{", "return", "{", "/** @lends uxManager */", "/**\n * Adds a backdrop with a loading indicator for the micro front-end frame. This overrides the {@link navigation-configuration.md#nodes loadingIndicator.enabled} setting.\n */", "showLoadingIndicator...
Use the UX Manager to manage the appearance features in Luigi. @name uxManager
[ "Use", "the", "UX", "Manager", "to", "manage", "the", "appearance", "features", "in", "Luigi", "." ]
901cfeef1b4c126f08d55257f559bbd1a6f6b0e4
https://github.com/kyma-project/luigi/blob/901cfeef1b4c126f08d55257f559bbd1a6f6b0e4/client/src/luigi-client.js#L430-L578
train
kyma-project/luigi
client/src/luigi-client.js
showConfirmationModal
function showConfirmationModal(settings) { window.parent.postMessage( { msg: 'luigi.ux.confirmationModal.show', data: { settings } }, '*' ); promises.confirmationModal = {}; promises.confirmationModal.promise...
javascript
function showConfirmationModal(settings) { window.parent.postMessage( { msg: 'luigi.ux.confirmationModal.show', data: { settings } }, '*' ); promises.confirmationModal = {}; promises.confirmationModal.promise...
[ "function", "showConfirmationModal", "(", "settings", ")", "{", "window", ".", "parent", ".", "postMessage", "(", "{", "msg", ":", "'luigi.ux.confirmationModal.show'", ",", "data", ":", "{", "settings", "}", "}", ",", "'*'", ")", ";", "promises", ".", "confi...
Shows a confirmation modal. @param {Object} [settings] the settings the confirmation modal. If no value is provided for any of the fields, a default value is set for it @param {string} [settings.header="Confirmation"] the content of the modal header @param {string} [settings.body="Are you sure you want to do this?"] th...
[ "Shows", "a", "confirmation", "modal", "." ]
901cfeef1b4c126f08d55257f559bbd1a6f6b0e4
https://github.com/kyma-project/luigi/blob/901cfeef1b4c126f08d55257f559bbd1a6f6b0e4/client/src/luigi-client.js#L499-L515
train
kategengler/ember-cli-code-coverage
index.js
function(startOptions) { if (!this._isCoverageEnabled()) { return; } attachMiddleware.serverMiddleware(startOptions.app, { configPath: this.project.configPath(), root: this.project.root, fileLookup: fileLookup }); }
javascript
function(startOptions) { if (!this._isCoverageEnabled()) { return; } attachMiddleware.serverMiddleware(startOptions.app, { configPath: this.project.configPath(), root: this.project.root, fileLookup: fileLookup }); }
[ "function", "(", "startOptions", ")", "{", "if", "(", "!", "this", ".", "_isCoverageEnabled", "(", ")", ")", "{", "return", ";", "}", "attachMiddleware", ".", "serverMiddleware", "(", "startOptions", ".", "app", ",", "{", "configPath", ":", "this", ".", ...
If coverage is enabled attach coverage middleware to the express server run by ember-cli @param {Object} startOptions - Express server start options
[ "If", "coverage", "is", "enabled", "attach", "coverage", "middleware", "to", "the", "express", "server", "run", "by", "ember", "-", "cli" ]
2cefa0477d6e14be8b7c812367ceddcc51f45303
https://github.com/kategengler/ember-cli-code-coverage/blob/2cefa0477d6e14be8b7c812367ceddcc51f45303/index.js#L100-L109
train
kategengler/ember-cli-code-coverage
index.js
function() { const dir = path.join(this.project.root, 'app'); let prefix = this.parent.isEmberCLIAddon() ? 'dummy' : this.parent.name(); return this._getIncludesForDir(dir, prefix); }
javascript
function() { const dir = path.join(this.project.root, 'app'); let prefix = this.parent.isEmberCLIAddon() ? 'dummy' : this.parent.name(); return this._getIncludesForDir(dir, prefix); }
[ "function", "(", ")", "{", "const", "dir", "=", "path", ".", "join", "(", "this", ".", "project", ".", "root", ",", "'app'", ")", ";", "let", "prefix", "=", "this", ".", "parent", ".", "isEmberCLIAddon", "(", ")", "?", "'dummy'", ":", "this", ".", ...
Get paths to include for covering the "app" directory. @returns {Array<String>} include paths
[ "Get", "paths", "to", "include", "for", "covering", "the", "app", "directory", "." ]
2cefa0477d6e14be8b7c812367ceddcc51f45303
https://github.com/kategengler/ember-cli-code-coverage/blob/2cefa0477d6e14be8b7c812367ceddcc51f45303/index.js#L151-L155
train
kategengler/ember-cli-code-coverage
index.js
function() { let addon = this._findCoveredAddon(); if (addon) { const addonDir = path.join(this.project.root, 'addon'); const addonTestSupportDir = path.join(this.project.root, 'addon-test-support'); return concat( this._getIncludesForDir(addonDir, addon.name), this._getInclude...
javascript
function() { let addon = this._findCoveredAddon(); if (addon) { const addonDir = path.join(this.project.root, 'addon'); const addonTestSupportDir = path.join(this.project.root, 'addon-test-support'); return concat( this._getIncludesForDir(addonDir, addon.name), this._getInclude...
[ "function", "(", ")", "{", "let", "addon", "=", "this", ".", "_findCoveredAddon", "(", ")", ";", "if", "(", "addon", ")", "{", "const", "addonDir", "=", "path", ".", "join", "(", "this", ".", "project", ".", "root", ",", "'addon'", ")", ";", "const...
Get paths to include for covering the "addon" directory. @returns {Array<String>} include paths
[ "Get", "paths", "to", "include", "for", "covering", "the", "addon", "directory", "." ]
2cefa0477d6e14be8b7c812367ceddcc51f45303
https://github.com/kategengler/ember-cli-code-coverage/blob/2cefa0477d6e14be8b7c812367ceddcc51f45303/index.js#L161-L171
train
kategengler/ember-cli-code-coverage
index.js
function(dir, prefix) { if (fs.existsSync(dir)) { let dirname = path.relative(this.project.root, dir); let globs = this.parentRegistry.extensionsForType('js').map((extension) => `**/*.${extension}`); return walkSync(dir, { directories: false, globs }).map(file => { let module = prefix + '...
javascript
function(dir, prefix) { if (fs.existsSync(dir)) { let dirname = path.relative(this.project.root, dir); let globs = this.parentRegistry.extensionsForType('js').map((extension) => `**/*.${extension}`); return walkSync(dir, { directories: false, globs }).map(file => { let module = prefix + '...
[ "function", "(", "dir", ",", "prefix", ")", "{", "if", "(", "fs", ".", "existsSync", "(", "dir", ")", ")", "{", "let", "dirname", "=", "path", ".", "relative", "(", "this", ".", "project", ".", "root", ",", "dir", ")", ";", "let", "globs", "=", ...
Get paths to include for coverage @param {String} dir Include all js files under this directory. @param {String} prefix The prefix to the ember module ('app', 'dummy' or the name of the addon). @returns {Array<String>} include paths
[ "Get", "paths", "to", "include", "for", "coverage" ]
2cefa0477d6e14be8b7c812367ceddcc51f45303
https://github.com/kategengler/ember-cli-code-coverage/blob/2cefa0477d6e14be8b7c812367ceddcc51f45303/index.js#L198-L211
train
kategengler/ember-cli-code-coverage
index.js
function() { var value = process.env[this._getConfig().coverageEnvVar] || false; if (value.toLowerCase) { value = value.toLowerCase(); } return ['true', true].indexOf(value) !== -1; }
javascript
function() { var value = process.env[this._getConfig().coverageEnvVar] || false; if (value.toLowerCase) { value = value.toLowerCase(); } return ['true', true].indexOf(value) !== -1; }
[ "function", "(", ")", "{", "var", "value", "=", "process", ".", "env", "[", "this", ".", "_getConfig", "(", ")", ".", "coverageEnvVar", "]", "||", "false", ";", "if", "(", "value", ".", "toLowerCase", ")", "{", "value", "=", "value", ".", "toLowerCas...
Determine whether or not coverage is enabled @returns {Boolean} whether or not coverage is enabled
[ "Determine", "whether", "or", "not", "coverage", "is", "enabled" ]
2cefa0477d6e14be8b7c812367ceddcc51f45303
https://github.com/kategengler/ember-cli-code-coverage/blob/2cefa0477d6e14be8b7c812367ceddcc51f45303/index.js#L225-L233
train
kategengler/ember-cli-code-coverage
lib/config.js
config
function config(configPath) { var configDirName = path.dirname(configPath); var configFile = path.resolve(path.join(configDirName, 'coverage.js')); var defaultConfig = getDefaultConfig(); if (fs.existsSync(configFile)) { var projectConfig = require(configFile); return extend({}, defaultConfig, projectC...
javascript
function config(configPath) { var configDirName = path.dirname(configPath); var configFile = path.resolve(path.join(configDirName, 'coverage.js')); var defaultConfig = getDefaultConfig(); if (fs.existsSync(configFile)) { var projectConfig = require(configFile); return extend({}, defaultConfig, projectC...
[ "function", "config", "(", "configPath", ")", "{", "var", "configDirName", "=", "path", ".", "dirname", "(", "configPath", ")", ";", "var", "configFile", "=", "path", ".", "resolve", "(", "path", ".", "join", "(", "configDirName", ",", "'coverage.js'", ")"...
Get configuration for a project, falling back to default configuration if project does not provide a configuration of its own @param {String} configPath - The path for the configuration of the project @returns {Configuration} configuration to use for project
[ "Get", "configuration", "for", "a", "project", "falling", "back", "to", "default", "configuration", "if", "project", "does", "not", "provide", "a", "configuration", "of", "its", "own" ]
2cefa0477d6e14be8b7c812367ceddcc51f45303
https://github.com/kategengler/ember-cli-code-coverage/blob/2cefa0477d6e14be8b7c812367ceddcc51f45303/lib/config.js#L21-L32
train
bpmn-io/moddle-xml
lib/read.js
resolveReferences
function resolveReferences() { var elementsById = context.elementsById; var references = context.references; var i, r; for (i = 0; (r = references[i]); i++) { var element = r.element; var reference = elementsById[r.id]; var property = getModdleDescriptor(element).propertiesByName[r....
javascript
function resolveReferences() { var elementsById = context.elementsById; var references = context.references; var i, r; for (i = 0; (r = references[i]); i++) { var element = r.element; var reference = elementsById[r.id]; var property = getModdleDescriptor(element).propertiesByName[r....
[ "function", "resolveReferences", "(", ")", "{", "var", "elementsById", "=", "context", ".", "elementsById", ";", "var", "references", "=", "context", ".", "references", ";", "var", "i", ",", "r", ";", "for", "(", "i", "=", "0", ";", "(", "r", "=", "r...
Resolve collected references on parse end.
[ "Resolve", "collected", "references", "on", "parse", "end", "." ]
5b66184b6128b399be20951130e0cdf2571f0939
https://github.com/bpmn-io/moddle-xml/blob/5b66184b6128b399be20951130e0cdf2571f0939/lib/read.js#L697-L739
train
lwille/node-gphoto2
examples/public/js/dat.gui.js
function() { if (common.isUndefined(SAVE_DIALOGUE)) { SAVE_DIALOGUE = new CenteredDiv(); SAVE_DIALOGUE.domElement.innerHTML = saveDialogueContents; } if (this.parent) { throw new Error("You can only call remember on a top level GUI."); } ...
javascript
function() { if (common.isUndefined(SAVE_DIALOGUE)) { SAVE_DIALOGUE = new CenteredDiv(); SAVE_DIALOGUE.domElement.innerHTML = saveDialogueContents; } if (this.parent) { throw new Error("You can only call remember on a top level GUI."); } ...
[ "function", "(", ")", "{", "if", "(", "common", ".", "isUndefined", "(", "SAVE_DIALOGUE", ")", ")", "{", "SAVE_DIALOGUE", "=", "new", "CenteredDiv", "(", ")", ";", "SAVE_DIALOGUE", ".", "domElement", ".", "innerHTML", "=", "saveDialogueContents", ";", "}", ...
Mark objects for saving. The order of these objects cannot change as the GUI grows. When remembering new objects, append them to the end of the list. @param {Object...} objects @throws {Error} if not called on a top level GUI. @instance
[ "Mark", "objects", "for", "saving", ".", "The", "order", "of", "these", "objects", "cannot", "change", "as", "the", "GUI", "grows", ".", "When", "remembering", "new", "objects", "append", "them", "to", "the", "end", "of", "the", "list", "." ]
99bef4a5575437a4f6a987c7e34a99c6ac667236
https://github.com/lwille/node-gphoto2/blob/99bef4a5575437a4f6a987c7e34a99c6ac667236/examples/public/js/dat.gui.js#L2147-L2174
train
lwille/node-gphoto2
examples/public/js/dat.gui.js
addRow
function addRow(gui, dom, liBefore) { var li = document.createElement('li'); if (dom) li.appendChild(dom); if (liBefore) { gui.__ul.insertBefore(li, params.before); } else { gui.__ul.appendChild(li); } gui.onResize(); return li; }
javascript
function addRow(gui, dom, liBefore) { var li = document.createElement('li'); if (dom) li.appendChild(dom); if (liBefore) { gui.__ul.insertBefore(li, params.before); } else { gui.__ul.appendChild(li); } gui.onResize(); return li; }
[ "function", "addRow", "(", "gui", ",", "dom", ",", "liBefore", ")", "{", "var", "li", "=", "document", ".", "createElement", "(", "'li'", ")", ";", "if", "(", "dom", ")", "li", ".", "appendChild", "(", "dom", ")", ";", "if", "(", "liBefore", ")", ...
Add a row to the end of the GUI or before another row. @param gui @param [dom] If specified, inserts the dom content in the new row @param [liBefore] If specified, places the new row before another row
[ "Add", "a", "row", "to", "the", "end", "of", "the", "GUI", "or", "before", "another", "row", "." ]
99bef4a5575437a4f6a987c7e34a99c6ac667236
https://github.com/lwille/node-gphoto2/blob/99bef4a5575437a4f6a987c7e34a99c6ac667236/examples/public/js/dat.gui.js#L2337-L2347
train
aeternity/aepp-sdk-js
es/channel/index.js
update
function update (from, to, amount, sign) { return new Promise((resolve, reject) => { enqueueAction( this, (channel, state) => state.handler === handlers.channelOpen, (channel, state) => { send(channel, { jsonrpc: '2.0', method: 'channels.update.new', params:...
javascript
function update (from, to, amount, sign) { return new Promise((resolve, reject) => { enqueueAction( this, (channel, state) => state.handler === handlers.channelOpen, (channel, state) => { send(channel, { jsonrpc: '2.0', method: 'channels.update.new', params:...
[ "function", "update", "(", "from", ",", "to", ",", "amount", ",", "sign", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "enqueueAction", "(", "this", ",", "(", "channel", ",", "state", ")", "=>", "state", ...
Trigger a transfer update The transfer update is moving tokens from one channel account to another. The update is a change to be applied on top of the latest state. Sender and receiver are the channel parties. Both the initiator and responder can take those roles. Any public key outside of the channel is considered i...
[ "Trigger", "a", "transfer", "update" ]
1ad86b72235e88d357a03d6ae4dd4ce1a4158ca6
https://github.com/aeternity/aepp-sdk-js/blob/1ad86b72235e88d357a03d6ae4dd4ce1a4158ca6/es/channel/index.js#L125-L147
train
aeternity/aepp-sdk-js
es/channel/index.js
shutdown
function shutdown (sign) { return new Promise((resolve, reject) => { enqueueAction( this, (channel, state) => state.handler === handlers.channelOpen, (channel, state) => { send(channel, { jsonrpc: '2.0', method: 'channels.shutdown', params: {} }) return { handler: handl...
javascript
function shutdown (sign) { return new Promise((resolve, reject) => { enqueueAction( this, (channel, state) => state.handler === handlers.channelOpen, (channel, state) => { send(channel, { jsonrpc: '2.0', method: 'channels.shutdown', params: {} }) return { handler: handl...
[ "function", "shutdown", "(", "sign", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "enqueueAction", "(", "this", ",", "(", "channel", ",", "state", ")", "=>", "state", ".", "handler", "===", "handlers", ".", ...
Trigger mutual close At any moment after the channel is opened, a closing procedure can be triggered. This can be done by either of the parties. The process is similar to the off-chain updates. @param {Function} sign - Function which verifies and signs mutual close transaction @return {Promise<String>} @example chann...
[ "Trigger", "mutual", "close" ]
1ad86b72235e88d357a03d6ae4dd4ce1a4158ca6
https://github.com/aeternity/aepp-sdk-js/blob/1ad86b72235e88d357a03d6ae4dd4ce1a4158ca6/es/channel/index.js#L242-L260
train
aeternity/aepp-sdk-js
es/channel/index.js
withdraw
function withdraw (amount, sign, { onOnChainTx, onOwnWithdrawLocked, onWithdrawLocked } = {}) { return new Promise((resolve, reject) => { enqueueAction( this, (channel, state) => state.handler === handlers.channelOpen, (channel, state) => { send(channel, { jsonrpc: '2.0', method: 'channe...
javascript
function withdraw (amount, sign, { onOnChainTx, onOwnWithdrawLocked, onWithdrawLocked } = {}) { return new Promise((resolve, reject) => { enqueueAction( this, (channel, state) => state.handler === handlers.channelOpen, (channel, state) => { send(channel, { jsonrpc: '2.0', method: 'channe...
[ "function", "withdraw", "(", "amount", ",", "sign", ",", "{", "onOnChainTx", ",", "onOwnWithdrawLocked", ",", "onWithdrawLocked", "}", "=", "{", "}", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "enqueueAction",...
Withdraw tokens from the channel After the channel had been opened any of the participants can initiate a withdrawal. The process closely resembles the update. The most notable difference is that the transaction has been co-signed: it is channel_withdraw_tx and after the procedure is finished - it is being posted on-c...
[ "Withdraw", "tokens", "from", "the", "channel" ]
1ad86b72235e88d357a03d6ae4dd4ce1a4158ca6
https://github.com/aeternity/aepp-sdk-js/blob/1ad86b72235e88d357a03d6ae4dd4ce1a4158ca6/es/channel/index.js#L308-L329
train
aeternity/aepp-sdk-js
es/channel/index.js
deposit
function deposit (amount, sign, { onOnChainTx, onOwnDepositLocked, onDepositLocked } = {}) { return new Promise((resolve, reject) => { enqueueAction( this, (channel, state) => state.handler === handlers.channelOpen, (channel, state) => { send(channel, { jsonrpc: '2.0', method: 'channels....
javascript
function deposit (amount, sign, { onOnChainTx, onOwnDepositLocked, onDepositLocked } = {}) { return new Promise((resolve, reject) => { enqueueAction( this, (channel, state) => state.handler === handlers.channelOpen, (channel, state) => { send(channel, { jsonrpc: '2.0', method: 'channels....
[ "function", "deposit", "(", "amount", ",", "sign", ",", "{", "onOnChainTx", ",", "onOwnDepositLocked", ",", "onDepositLocked", "}", "=", "{", "}", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "enqueueAction", ...
Deposit tokens into the channel After the channel had been opened any of the participants can initiate a deposit. The process closely resembles the update. The most notable difference is that the transaction has been co-signed: it is channel_deposit_tx and after the procedure is finished - it is being posted on-chain....
[ "Deposit", "tokens", "into", "the", "channel" ]
1ad86b72235e88d357a03d6ae4dd4ce1a4158ca6
https://github.com/aeternity/aepp-sdk-js/blob/1ad86b72235e88d357a03d6ae4dd4ce1a4158ca6/es/channel/index.js#L378-L399
train
aeternity/aepp-sdk-js
es/channel/index.js
createContract
function createContract ({ code, callData, deposit, vmVersion, abiVersion }, sign) { return new Promise((resolve, reject) => { enqueueAction( this, (channel, state) => state.handler === handlers.channelOpen, (channel, state) => { send(channel, { jsonrpc: '2.0', method...
javascript
function createContract ({ code, callData, deposit, vmVersion, abiVersion }, sign) { return new Promise((resolve, reject) => { enqueueAction( this, (channel, state) => state.handler === handlers.channelOpen, (channel, state) => { send(channel, { jsonrpc: '2.0', method...
[ "function", "createContract", "(", "{", "code", ",", "callData", ",", "deposit", ",", "vmVersion", ",", "abiVersion", "}", ",", "sign", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "enqueueAction", "(", "this"...
Trigger create contract update The create contract update is creating a contract inside the channel's internal state tree. The update is a change to be applied on top of the latest state. That would create a contract with the poster being the owner of it. Poster commits initially a deposit amount of tokens to the new...
[ "Trigger", "create", "contract", "update" ]
1ad86b72235e88d357a03d6ae4dd4ce1a4158ca6
https://github.com/aeternity/aepp-sdk-js/blob/1ad86b72235e88d357a03d6ae4dd4ce1a4158ca6/es/channel/index.js#L433-L461
train
aeternity/aepp-sdk-js
es/channel/index.js
callContract
function callContract ({ amount, callData, contract, abiVersion }, sign) { return new Promise((resolve, reject) => { enqueueAction( this, (channel, state) => state.handler === handlers.channelOpen, (channel, state) => { send(channel, { jsonrpc: '2.0', method: 'channel...
javascript
function callContract ({ amount, callData, contract, abiVersion }, sign) { return new Promise((resolve, reject) => { enqueueAction( this, (channel, state) => state.handler === handlers.channelOpen, (channel, state) => { send(channel, { jsonrpc: '2.0', method: 'channel...
[ "function", "callContract", "(", "{", "amount", ",", "callData", ",", "contract", ",", "abiVersion", "}", ",", "sign", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "enqueueAction", "(", "this", ",", "(", "ch...
Trigger call a contract update The call contract update is calling a preexisting contract inside the channel's internal state tree. The update is a change to be applied on top of the latest state. That would call a contract with the poster being the caller of it. Poster commits an amount of tokens to the contract. T...
[ "Trigger", "call", "a", "contract", "update" ]
1ad86b72235e88d357a03d6ae4dd4ce1a4158ca6
https://github.com/aeternity/aepp-sdk-js/blob/1ad86b72235e88d357a03d6ae4dd4ce1a4158ca6/es/channel/index.js#L499-L522
train
aeternity/aepp-sdk-js
es/channel/index.js
callContractStatic
async function callContractStatic ({ amount, callData, contract, abiVersion }) { return snakeToPascalObjKeys(await call(this, 'channels.dry_run.call_contract', { amount, call_data: callData, contract, abi_version: abiVersion })) }
javascript
async function callContractStatic ({ amount, callData, contract, abiVersion }) { return snakeToPascalObjKeys(await call(this, 'channels.dry_run.call_contract', { amount, call_data: callData, contract, abi_version: abiVersion })) }
[ "async", "function", "callContractStatic", "(", "{", "amount", ",", "callData", ",", "contract", ",", "abiVersion", "}", ")", "{", "return", "snakeToPascalObjKeys", "(", "await", "call", "(", "this", ",", "'channels.dry_run.call_contract'", ",", "{", "amount", "...
Call contract using dry-run In order to get the result of a potential contract call, one might need to dry-run a contract call. It takes the exact same arguments as a call would and returns the call object. The call is executed in the channel's state but it does not impact the state whatsoever. It uses as an environm...
[ "Call", "contract", "using", "dry", "-", "run" ]
1ad86b72235e88d357a03d6ae4dd4ce1a4158ca6
https://github.com/aeternity/aepp-sdk-js/blob/1ad86b72235e88d357a03d6ae4dd4ce1a4158ca6/es/channel/index.js#L551-L558
train
aeternity/aepp-sdk-js
es/channel/index.js
getContractCall
async function getContractCall ({ caller, contract, round }) { return snakeToPascalObjKeys(await call(this, 'channels.get.contract_call', { caller, contract, round })) }
javascript
async function getContractCall ({ caller, contract, round }) { return snakeToPascalObjKeys(await call(this, 'channels.get.contract_call', { caller, contract, round })) }
[ "async", "function", "getContractCall", "(", "{", "caller", ",", "contract", ",", "round", "}", ")", "{", "return", "snakeToPascalObjKeys", "(", "await", "call", "(", "this", ",", "'channels.get.contract_call'", ",", "{", "caller", ",", "contract", ",", "round...
Get contract call result The combination of a caller, contract and a round of execution determines the contract call. Providing an incorrect set of those results in an error response. @param {Object} options @param {String} [options.caller] - Address of contract caller @param {String} [options.contract] - Address of ...
[ "Get", "contract", "call", "result" ]
1ad86b72235e88d357a03d6ae4dd4ce1a4158ca6
https://github.com/aeternity/aepp-sdk-js/blob/1ad86b72235e88d357a03d6ae4dd4ce1a4158ca6/es/channel/index.js#L579-L581
train
aeternity/aepp-sdk-js
es/channel/index.js
getContractState
async function getContractState (contract) { const result = await call(this, 'channels.get.contract', { pubkey: contract }) return snakeToPascalObjKeys({ ...result, contract: snakeToPascalObjKeys(result.contract) }) }
javascript
async function getContractState (contract) { const result = await call(this, 'channels.get.contract', { pubkey: contract }) return snakeToPascalObjKeys({ ...result, contract: snakeToPascalObjKeys(result.contract) }) }
[ "async", "function", "getContractState", "(", "contract", ")", "{", "const", "result", "=", "await", "call", "(", "this", ",", "'channels.get.contract'", ",", "{", "pubkey", ":", "contract", "}", ")", "return", "snakeToPascalObjKeys", "(", "{", "...", "result"...
Get contract latest state @param {String} contract - Address of the contract @return {Promise<Object>} @example channel.getContractState( 'ct_9sRA9AVE4BYTAkh5RNfJYmwQe1NZ4MErasQLXZkFWG43TPBqa' ).then(({ contract }) => { console.log('deposit:', contract.deposit) })
[ "Get", "contract", "latest", "state" ]
1ad86b72235e88d357a03d6ae4dd4ce1a4158ca6
https://github.com/aeternity/aepp-sdk-js/blob/1ad86b72235e88d357a03d6ae4dd4ce1a4158ca6/es/channel/index.js#L594-L600
train
aeternity/aepp-sdk-js
es/channel/index.js
cleanContractCalls
function cleanContractCalls () { return new Promise((resolve, reject) => { enqueueAction( this, (channel, state) => state.handler === handlers.channelOpen, (channel, state) => { send(channel, { jsonrpc: '2.0', method: 'channels.clean_contract_calls', params:...
javascript
function cleanContractCalls () { return new Promise((resolve, reject) => { enqueueAction( this, (channel, state) => state.handler === handlers.channelOpen, (channel, state) => { send(channel, { jsonrpc: '2.0', method: 'channels.clean_contract_calls', params:...
[ "function", "cleanContractCalls", "(", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "enqueueAction", "(", "this", ",", "(", "channel", ",", "state", ")", "=>", "state", ".", "handler", "===", "handlers", ".", ...
Clean up all locally stored contract calls Contract calls are kept locally in order for the participant to be able to look them up. They consume memory and in order for the participant to free it - one can prune all messages. This cleans up all locally stored contract calls and those will no longer be available for fe...
[ "Clean", "up", "all", "locally", "stored", "contract", "calls" ]
1ad86b72235e88d357a03d6ae4dd4ce1a4158ca6
https://github.com/aeternity/aepp-sdk-js/blob/1ad86b72235e88d357a03d6ae4dd4ce1a4158ca6/es/channel/index.js#L612-L630
train
aeternity/aepp-sdk-js
es/channel/index.js
sendMessage
function sendMessage (message, recipient) { let info = message if (typeof message === 'object') { info = JSON.stringify(message) } enqueueAction( this, (channel, state) => state.handler === handlers.channelOpen, (channel, state) => { send(channel, { jsonrpc: '2.0', method: 'channels.messag...
javascript
function sendMessage (message, recipient) { let info = message if (typeof message === 'object') { info = JSON.stringify(message) } enqueueAction( this, (channel, state) => state.handler === handlers.channelOpen, (channel, state) => { send(channel, { jsonrpc: '2.0', method: 'channels.messag...
[ "function", "sendMessage", "(", "message", ",", "recipient", ")", "{", "let", "info", "=", "message", "if", "(", "typeof", "message", "===", "'object'", ")", "{", "info", "=", "JSON", ".", "stringify", "(", "message", ")", "}", "enqueueAction", "(", "thi...
Send generic message If message is an object it will be serialized into JSON string before sending. If there is ongoing update that has not yet been finished the message will be sent after that update is finalized. @param {String|Object} message @param {String} recipient - Address of the recipient @example channel.s...
[ "Send", "generic", "message" ]
1ad86b72235e88d357a03d6ae4dd4ce1a4158ca6
https://github.com/aeternity/aepp-sdk-js/blob/1ad86b72235e88d357a03d6ae4dd4ce1a4158ca6/es/channel/index.js#L648-L661
train
aeternity/aepp-sdk-js
es/utils/swagger.js
expandPath
function expandPath (path, replacements) { return R.toPairs(replacements).reduce((path, [key, value]) => path.replace(`{${key}}`, value), path) }
javascript
function expandPath (path, replacements) { return R.toPairs(replacements).reduce((path, [key, value]) => path.replace(`{${key}}`, value), path) }
[ "function", "expandPath", "(", "path", ",", "replacements", ")", "{", "return", "R", ".", "toPairs", "(", "replacements", ")", ".", "reduce", "(", "(", "path", ",", "[", "key", ",", "value", "]", ")", "=>", "path", ".", "replace", "(", "`", "${", "...
Perform path string interpolation @static @rtype (path: String, replacements: Object) => String @param {String} s - String to convert @return {String} Converted string
[ "Perform", "path", "string", "interpolation" ]
1ad86b72235e88d357a03d6ae4dd4ce1a4158ca6
https://github.com/aeternity/aepp-sdk-js/blob/1ad86b72235e88d357a03d6ae4dd4ce1a4158ca6/es/utils/swagger.js#L39-L41
train
aeternity/aepp-sdk-js
es/utils/swagger.js
conform
function conform (value, spec, types) { return (conformTypes[conformDispatch(spec)] || (() => { throw Object.assign(Error('Unsupported type'), { spec }) }))(value, spec, types) }
javascript
function conform (value, spec, types) { return (conformTypes[conformDispatch(spec)] || (() => { throw Object.assign(Error('Unsupported type'), { spec }) }))(value, spec, types) }
[ "function", "conform", "(", "value", ",", "spec", ",", "types", ")", "{", "return", "(", "conformTypes", "[", "conformDispatch", "(", "spec", ")", "]", "||", "(", "(", ")", "=>", "{", "throw", "Object", ".", "assign", "(", "Error", "(", "'Unsupported t...
Conform `value` against its `spec` @static @rtype (value: Any, spec: Object, types: Object) => Any, throws: Error @param {Object} value - Value to conform (validate and transform) @param {Object} spec - Specification object @param {Object} types - Types specification @return {Object} Conformed value
[ "Conform", "value", "against", "its", "spec" ]
1ad86b72235e88d357a03d6ae4dd4ce1a4158ca6
https://github.com/aeternity/aepp-sdk-js/blob/1ad86b72235e88d357a03d6ae4dd4ce1a4158ca6/es/utils/swagger.js#L187-L191
train