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
angusgibbs/statsjs
lib/stats.js
function(arr) { return new stats.init(arguments.length > 1 ? Array.prototype.slice.call(arguments, 0) : arr); }
javascript
function(arr) { return new stats.init(arguments.length > 1 ? Array.prototype.slice.call(arguments, 0) : arr); }
[ "function", "(", "arr", ")", "{", "return", "new", "stats", ".", "init", "(", "arguments", ".", "length", ">", "1", "?", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "arguments", ",", "0", ")", ":", "arr", ")", ";", "}" ]
Wrapper to create a chainable stats object. arr - The array to work with. Returns a new chainable object.
[ "Wrapper", "to", "create", "a", "chainable", "stats", "object", ".", "arr", "-", "The", "array", "to", "work", "with", ".", "Returns", "a", "new", "chainable", "object", "." ]
791d599bbc224999b7de1ae5fc3e9adeb8406861
https://github.com/angusgibbs/statsjs/blob/791d599bbc224999b7de1ae5fc3e9adeb8406861/lib/stats.js#L14-L18
train
angusgibbs/statsjs
lib/stats.js
function(fn) { var arr = this.arr; if (arr.length === undefined) { // The wrapped array is a JSON object for (var key in arr) { this.arr[key] = fn.call(arr[key], arr[key], key, arr); } } else { // The wrapped array is an array for (var i = 0, l = this.arr.length; i < l; i++)...
javascript
function(fn) { var arr = this.arr; if (arr.length === undefined) { // The wrapped array is a JSON object for (var key in arr) { this.arr[key] = fn.call(arr[key], arr[key], key, arr); } } else { // The wrapped array is an array for (var i = 0, l = this.arr.length; i < l; i++)...
[ "function", "(", "fn", ")", "{", "var", "arr", "=", "this", ".", "arr", ";", "if", "(", "arr", ".", "length", "===", "undefined", ")", "{", "// The wrapped array is a JSON object\r", "for", "(", "var", "key", "in", "arr", ")", "{", "this", ".", "arr", ...
Replaces each element in an array or JSON object with the result of the function that is called against each element. fn - The function to call on each element el - The array or object element index - The index or key of the array element Returns nothing.
[ "Replaces", "each", "element", "in", "an", "array", "or", "JSON", "object", "with", "the", "result", "of", "the", "function", "that", "is", "called", "against", "each", "element", ".", "fn", "-", "The", "function", "to", "call", "on", "each", "element", ...
791d599bbc224999b7de1ae5fc3e9adeb8406861
https://github.com/angusgibbs/statsjs/blob/791d599bbc224999b7de1ae5fc3e9adeb8406861/lib/stats.js#L64-L80
train
angusgibbs/statsjs
lib/stats.js
function(attr) { var newArr = []; if (this.arr.length === undefined) { // The wrapped array is a JSON object for (var key in arr) { newArr.push(this.arr[key][attr]); } } else { // The wrapped array is an array for (var i = 0, l = this.arr.length; i < l; i++) { newArr.p...
javascript
function(attr) { var newArr = []; if (this.arr.length === undefined) { // The wrapped array is a JSON object for (var key in arr) { newArr.push(this.arr[key][attr]); } } else { // The wrapped array is an array for (var i = 0, l = this.arr.length; i < l; i++) { newArr.p...
[ "function", "(", "attr", ")", "{", "var", "newArr", "=", "[", "]", ";", "if", "(", "this", ".", "arr", ".", "length", "===", "undefined", ")", "{", "// The wrapped array is a JSON object\r", "for", "(", "var", "key", "in", "arr", ")", "{", "newArr", "....
Replaces each element of the array with the attribute of that given element. attr - The attribute to pluck. Returns nothing.
[ "Replaces", "each", "element", "of", "the", "array", "with", "the", "attribute", "of", "that", "given", "element", ".", "attr", "-", "The", "attribute", "to", "pluck", ".", "Returns", "nothing", "." ]
791d599bbc224999b7de1ae5fc3e9adeb8406861
https://github.com/angusgibbs/statsjs/blob/791d599bbc224999b7de1ae5fc3e9adeb8406861/lib/stats.js#L88-L104
train
angusgibbs/statsjs
lib/stats.js
function(attr) { // Get the numbers var arr = this.arr; // Go through each of the numbers and find the minimum var minimum = attr == null ? arr[0] : arr[0][attr]; var minimumEl = attr == null ? arr[0] : arr[0]; stats(arr).each(function(num, index) { if ((attr == null ? num : num[attr]) ...
javascript
function(attr) { // Get the numbers var arr = this.arr; // Go through each of the numbers and find the minimum var minimum = attr == null ? arr[0] : arr[0][attr]; var minimumEl = attr == null ? arr[0] : arr[0]; stats(arr).each(function(num, index) { if ((attr == null ? num : num[attr]) ...
[ "function", "(", "attr", ")", "{", "// Get the numbers\r", "var", "arr", "=", "this", ".", "arr", ";", "// Go through each of the numbers and find the minimum\r", "var", "minimum", "=", "attr", "==", "null", "?", "arr", "[", "0", "]", ":", "arr", "[", "0", "...
Finds the smallest number. attr - Optional. If passed, the elemnt with the minimum value for the given attribute will be returned. Returns the minimum.
[ "Finds", "the", "smallest", "number", ".", "attr", "-", "Optional", ".", "If", "passed", "the", "elemnt", "with", "the", "minimum", "value", "for", "the", "given", "attribute", "will", "be", "returned", ".", "Returns", "the", "minimum", "." ]
791d599bbc224999b7de1ae5fc3e9adeb8406861
https://github.com/angusgibbs/statsjs/blob/791d599bbc224999b7de1ae5fc3e9adeb8406861/lib/stats.js#L112-L128
train
angusgibbs/statsjs
lib/stats.js
function(attr) { // Get the numbers var arr = this.arr; // Go through each of the numbers and find the maximum var maximum = attr == null ? arr[0] : arr[0][attr]; var maximumEl = attr == null ? arr[0] : arr[0]; stats(arr).each(function(num, index) { if ((attr == null ? num : num[attr]) ...
javascript
function(attr) { // Get the numbers var arr = this.arr; // Go through each of the numbers and find the maximum var maximum = attr == null ? arr[0] : arr[0][attr]; var maximumEl = attr == null ? arr[0] : arr[0]; stats(arr).each(function(num, index) { if ((attr == null ? num : num[attr]) ...
[ "function", "(", "attr", ")", "{", "// Get the numbers\r", "var", "arr", "=", "this", ".", "arr", ";", "// Go through each of the numbers and find the maximum\r", "var", "maximum", "=", "attr", "==", "null", "?", "arr", "[", "0", "]", ":", "arr", "[", "0", "...
Finds the largest number. attr - Optional. If passed, the elemnt with the maximum value for the given attribute will be returned. Returns the maximum.
[ "Finds", "the", "largest", "number", ".", "attr", "-", "Optional", ".", "If", "passed", "the", "elemnt", "with", "the", "maximum", "value", "for", "the", "given", "attribute", "will", "be", "returned", ".", "Returns", "the", "maximum", "." ]
791d599bbc224999b7de1ae5fc3e9adeb8406861
https://github.com/angusgibbs/statsjs/blob/791d599bbc224999b7de1ae5fc3e9adeb8406861/lib/stats.js#L136-L152
train
angusgibbs/statsjs
lib/stats.js
function() { // Sort the numbers var arr = this.clone().sort().toArray(); if (arr.length % 2 === 0) { // There are an even number of elements in the array; the median // is the average of the middle two return (arr[arr.length / 2 - 1] + arr[arr.length / 2]) / 2; } else { // There a...
javascript
function() { // Sort the numbers var arr = this.clone().sort().toArray(); if (arr.length % 2 === 0) { // There are an even number of elements in the array; the median // is the average of the middle two return (arr[arr.length / 2 - 1] + arr[arr.length / 2]) / 2; } else { // There a...
[ "function", "(", ")", "{", "// Sort the numbers\r", "var", "arr", "=", "this", ".", "clone", "(", ")", ".", "sort", "(", ")", ".", "toArray", "(", ")", ";", "if", "(", "arr", ".", "length", "%", "2", "===", "0", ")", "{", "// There are an even number...
Finds the median of the numbers. Returns the median.
[ "Finds", "the", "median", "of", "the", "numbers", ".", "Returns", "the", "median", "." ]
791d599bbc224999b7de1ae5fc3e9adeb8406861
https://github.com/angusgibbs/statsjs/blob/791d599bbc224999b7de1ae5fc3e9adeb8406861/lib/stats.js#L157-L170
train
angusgibbs/statsjs
lib/stats.js
function() { // Handle the single element case if (this.length == 1) { return this.arr[0]; } // Sort the numbers var nums = this.clone().sort(); // The third quartile is the median of the upper half of the numbers return nums.slice(Math.ceil(nums.size() / 2)).median(); }
javascript
function() { // Handle the single element case if (this.length == 1) { return this.arr[0]; } // Sort the numbers var nums = this.clone().sort(); // The third quartile is the median of the upper half of the numbers return nums.slice(Math.ceil(nums.size() / 2)).median(); }
[ "function", "(", ")", "{", "// Handle the single element case\r", "if", "(", "this", ".", "length", "==", "1", ")", "{", "return", "this", ".", "arr", "[", "0", "]", ";", "}", "// Sort the numbers\r", "var", "nums", "=", "this", ".", "clone", "(", ")", ...
Finds the third quartile of the numbers. Returns the third quartile.
[ "Finds", "the", "third", "quartile", "of", "the", "numbers", ".", "Returns", "the", "third", "quartile", "." ]
791d599bbc224999b7de1ae5fc3e9adeb8406861
https://github.com/angusgibbs/statsjs/blob/791d599bbc224999b7de1ae5fc3e9adeb8406861/lib/stats.js#L191-L202
train
angusgibbs/statsjs
lib/stats.js
function() { // Get the mean var mean = this.mean(); // Get a new stats object to work with var nums = this.clone(); // Map each element of nums to the square of the element minus the // mean nums.map(function(num) { return Math.pow(num - mean, 2); }); // Return the standa...
javascript
function() { // Get the mean var mean = this.mean(); // Get a new stats object to work with var nums = this.clone(); // Map each element of nums to the square of the element minus the // mean nums.map(function(num) { return Math.pow(num - mean, 2); }); // Return the standa...
[ "function", "(", ")", "{", "// Get the mean\r", "var", "mean", "=", "this", ".", "mean", "(", ")", ";", "// Get a new stats object to work with\r", "var", "nums", "=", "this", ".", "clone", "(", ")", ";", "// Map each element of nums to the square of the element minus...
Finds the standard deviation of the numbers. Returns the standard deviation.
[ "Finds", "the", "standard", "deviation", "of", "the", "numbers", ".", "Returns", "the", "standard", "deviation", "." ]
791d599bbc224999b7de1ae5fc3e9adeb8406861
https://github.com/angusgibbs/statsjs/blob/791d599bbc224999b7de1ae5fc3e9adeb8406861/lib/stats.js#L290-L305
train
angusgibbs/statsjs
lib/stats.js
function() { // Get the x and y coordinates var xCoords = this.pluck('x'); var yCoords = this.pluck('y'); // Get the means for the x and y coordinates var meanX = xCoords.mean(); var meanY = yCoords.mean(); // Get the standard deviations for the x and y coordinates var stdDevX = xCoo...
javascript
function() { // Get the x and y coordinates var xCoords = this.pluck('x'); var yCoords = this.pluck('y'); // Get the means for the x and y coordinates var meanX = xCoords.mean(); var meanY = yCoords.mean(); // Get the standard deviations for the x and y coordinates var stdDevX = xCoo...
[ "function", "(", ")", "{", "// Get the x and y coordinates\r", "var", "xCoords", "=", "this", ".", "pluck", "(", "'x'", ")", ";", "var", "yCoords", "=", "this", ".", "pluck", "(", "'y'", ")", ";", "// Get the means for the x and y coordinates\r", "var", "meanX",...
Calculates the correlation coefficient for the data set. Returns the value of r.
[ "Calculates", "the", "correlation", "coefficient", "for", "the", "data", "set", ".", "Returns", "the", "value", "of", "r", "." ]
791d599bbc224999b7de1ae5fc3e9adeb8406861
https://github.com/angusgibbs/statsjs/blob/791d599bbc224999b7de1ae5fc3e9adeb8406861/lib/stats.js#L310-L340
train
angusgibbs/statsjs
lib/stats.js
function() { // Get the x and y coordinates var xCoords = this.pluck('x'); var yCoords = this.pluck('y'); // Get the means for the x and y coordinates var meanX = xCoords.mean(); var meanY = yCoords.mean(); // Get the standard deviations for the x and y coordinates var stdDevX = xCoo...
javascript
function() { // Get the x and y coordinates var xCoords = this.pluck('x'); var yCoords = this.pluck('y'); // Get the means for the x and y coordinates var meanX = xCoords.mean(); var meanY = yCoords.mean(); // Get the standard deviations for the x and y coordinates var stdDevX = xCoo...
[ "function", "(", ")", "{", "// Get the x and y coordinates\r", "var", "xCoords", "=", "this", ".", "pluck", "(", "'x'", ")", ";", "var", "yCoords", "=", "this", ".", "pluck", "(", "'y'", ")", ";", "// Get the means for the x and y coordinates\r", "var", "meanX",...
Calculates the Least Squares Regression line for the data set. Returns an object with the slope and y intercept.
[ "Calculates", "the", "Least", "Squares", "Regression", "line", "for", "the", "data", "set", ".", "Returns", "an", "object", "with", "the", "slope", "and", "y", "intercept", "." ]
791d599bbc224999b7de1ae5fc3e9adeb8406861
https://github.com/angusgibbs/statsjs/blob/791d599bbc224999b7de1ae5fc3e9adeb8406861/lib/stats.js#L345-L372
train
angusgibbs/statsjs
lib/stats.js
function() { // Get y coordinates var yCoords = this.pluck('y'); // Do a semi-log transformation of the coordinates yCoords.map(function(num) { return Math.log(num); }); // Get a new stats object to work with that has the transformed data var nums = this.clone().map(function(coord, ...
javascript
function() { // Get y coordinates var yCoords = this.pluck('y'); // Do a semi-log transformation of the coordinates yCoords.map(function(num) { return Math.log(num); }); // Get a new stats object to work with that has the transformed data var nums = this.clone().map(function(coord, ...
[ "function", "(", ")", "{", "// Get y coordinates\r", "var", "yCoords", "=", "this", ".", "pluck", "(", "'y'", ")", ";", "// Do a semi-log transformation of the coordinates\r", "yCoords", ".", "map", "(", "function", "(", "num", ")", "{", "return", "Math", ".", ...
Calculates the exponential regression line for the data set. Returns an object with the coefficient, base, and correlation coefficient for the linearized data.
[ "Calculates", "the", "exponential", "regression", "line", "for", "the", "data", "set", ".", "Returns", "an", "object", "with", "the", "coefficient", "base", "and", "correlation", "coefficient", "for", "the", "linearized", "data", "." ]
791d599bbc224999b7de1ae5fc3e9adeb8406861
https://github.com/angusgibbs/statsjs/blob/791d599bbc224999b7de1ae5fc3e9adeb8406861/lib/stats.js#L378-L409
train
angusgibbs/statsjs
lib/stats.js
function() { // Get y coordinates var xCoords = this.pluck('x'); var yCoords = this.pluck('y'); // Do a log-log transformation of the coordinates xCoords.map(function(num) { return Math.log(num); }); yCoords.map(function(num) { return Math.log(num); }); // Get a new sta...
javascript
function() { // Get y coordinates var xCoords = this.pluck('x'); var yCoords = this.pluck('y'); // Do a log-log transformation of the coordinates xCoords.map(function(num) { return Math.log(num); }); yCoords.map(function(num) { return Math.log(num); }); // Get a new sta...
[ "function", "(", ")", "{", "// Get y coordinates\r", "var", "xCoords", "=", "this", ".", "pluck", "(", "'x'", ")", ";", "var", "yCoords", "=", "this", ".", "pluck", "(", "'y'", ")", ";", "// Do a log-log transformation of the coordinates\r", "xCoords", ".", "m...
Calculates the power regression line for the data set. Returns an object with the coefficient, base, and correlation coefficient for the linearized data.
[ "Calculates", "the", "power", "regression", "line", "for", "the", "data", "set", ".", "Returns", "an", "object", "with", "the", "coefficient", "base", "and", "correlation", "coefficient", "for", "the", "linearized", "data", "." ]
791d599bbc224999b7de1ae5fc3e9adeb8406861
https://github.com/angusgibbs/statsjs/blob/791d599bbc224999b7de1ae5fc3e9adeb8406861/lib/stats.js#L415-L450
train
angusgibbs/statsjs
lib/stats.js
function() { // Create a new stats object to work with var nums = this.clone(); // Go through each element and make the element the gcd of it // and the element to its left for (var i = 1; i < nums.size(); i++) { nums.set(i, gcd(nums.get(i - 1), nums.get(i))); } // The gcd of all th...
javascript
function() { // Create a new stats object to work with var nums = this.clone(); // Go through each element and make the element the gcd of it // and the element to its left for (var i = 1; i < nums.size(); i++) { nums.set(i, gcd(nums.get(i - 1), nums.get(i))); } // The gcd of all th...
[ "function", "(", ")", "{", "// Create a new stats object to work with\r", "var", "nums", "=", "this", ".", "clone", "(", ")", ";", "// Go through each element and make the element the gcd of it\r", "// and the element to its left\r", "for", "(", "var", "i", "=", "1", ";",...
Calculates the greatest common divisor of the set. Returns a Number, the gcd.
[ "Calculates", "the", "greatest", "common", "divisor", "of", "the", "set", ".", "Returns", "a", "Number", "the", "gcd", "." ]
791d599bbc224999b7de1ae5fc3e9adeb8406861
https://github.com/angusgibbs/statsjs/blob/791d599bbc224999b7de1ae5fc3e9adeb8406861/lib/stats.js#L520-L532
train
angusgibbs/statsjs
lib/stats.js
function() { // Create a new stats object to work with var nums = this.clone(); // Go through each element and make the element the lcm of it // and the element to its left for (var i = 1; i < nums.size(); i++) { nums.set(i, lcm(nums.get(i - 1), nums.get(i))); } // The lcm of all th...
javascript
function() { // Create a new stats object to work with var nums = this.clone(); // Go through each element and make the element the lcm of it // and the element to its left for (var i = 1; i < nums.size(); i++) { nums.set(i, lcm(nums.get(i - 1), nums.get(i))); } // The lcm of all th...
[ "function", "(", ")", "{", "// Create a new stats object to work with\r", "var", "nums", "=", "this", ".", "clone", "(", ")", ";", "// Go through each element and make the element the lcm of it\r", "// and the element to its left\r", "for", "(", "var", "i", "=", "1", ";",...
Calculates the least common multiple of the set. Returns a Number, the lcm.
[ "Calculates", "the", "least", "common", "multiple", "of", "the", "set", ".", "Returns", "a", "Number", "the", "lcm", "." ]
791d599bbc224999b7de1ae5fc3e9adeb8406861
https://github.com/angusgibbs/statsjs/blob/791d599bbc224999b7de1ae5fc3e9adeb8406861/lib/stats.js#L537-L549
train
angusgibbs/statsjs
lib/stats.js
gcd
function gcd(a, b) { if (b === 0) { return a; } return gcd(b, a - b * Math.floor(a / b)); }
javascript
function gcd(a, b) { if (b === 0) { return a; } return gcd(b, a - b * Math.floor(a / b)); }
[ "function", "gcd", "(", "a", ",", "b", ")", "{", "if", "(", "b", "===", "0", ")", "{", "return", "a", ";", "}", "return", "gcd", "(", "b", ",", "a", "-", "b", "*", "Math", ".", "floor", "(", "a", "/", "b", ")", ")", ";", "}" ]
Private. Calculates the gcd of two numbers using Euclid's method. Returns a Number.
[ "Private", ".", "Calculates", "the", "gcd", "of", "two", "numbers", "using", "Euclid", "s", "method", ".", "Returns", "a", "Number", "." ]
791d599bbc224999b7de1ae5fc3e9adeb8406861
https://github.com/angusgibbs/statsjs/blob/791d599bbc224999b7de1ae5fc3e9adeb8406861/lib/stats.js#L555-L561
train
angusgibbs/statsjs
lib/stats.js
lcm
function lcm(a, b) { // The least common multiple is the absolute value of the product of // the numbers divided by the greatest common denominator return Math.abs(a * b) / gcd(a, b); }
javascript
function lcm(a, b) { // The least common multiple is the absolute value of the product of // the numbers divided by the greatest common denominator return Math.abs(a * b) / gcd(a, b); }
[ "function", "lcm", "(", "a", ",", "b", ")", "{", "// The least common multiple is the absolute value of the product of\r", "// the numbers divided by the greatest common denominator\r", "return", "Math", ".", "abs", "(", "a", "*", "b", ")", "/", "gcd", "(", "a", ",", ...
Private. Calculates the lcm of two numbers. Returns a Number.
[ "Private", ".", "Calculates", "the", "lcm", "of", "two", "numbers", ".", "Returns", "a", "Number", "." ]
791d599bbc224999b7de1ae5fc3e9adeb8406861
https://github.com/angusgibbs/statsjs/blob/791d599bbc224999b7de1ae5fc3e9adeb8406861/lib/stats.js#L566-L570
train
marco-loche/saw
saw.js
function (win) { if (win == null) { return null; } while ((win.API == null) && (win.parent != null) && (win.parent != win)) { findAPITries++; if (findAPITries > 7) { return null; } win = win.parent; } return win.API; }
javascript
function (win) { if (win == null) { return null; } while ((win.API == null) && (win.parent != null) && (win.parent != win)) { findAPITries++; if (findAPITries > 7) { return null; } win = win.parent; } return win.API; }
[ "function", "(", "win", ")", "{", "if", "(", "win", "==", "null", ")", "{", "return", "null", ";", "}", "while", "(", "(", "win", ".", "API", "==", "null", ")", "&&", "(", "win", ".", "parent", "!=", "null", ")", "&&", "(", "win", ".", "paren...
The function charged to locate the API adapter object presented by the LMS. As described in section 3.3.6.1 of the documentation.
[ "The", "function", "charged", "to", "locate", "the", "API", "adapter", "object", "presented", "by", "the", "LMS", ".", "As", "described", "in", "section", "3", ".", "3", ".", "6", ".", "1", "of", "the", "documentation", "." ]
d6c0c9713b020ffa0eda1be73a37144b1451a41d
https://github.com/marco-loche/saw/blob/d6c0c9713b020ffa0eda1be73a37144b1451a41d/saw.js#L12-L25
train
mysticatea/appcache-manifest
lib/queue.js
dequeue
function dequeue(queue, item) { queue[SIZE] -= 1 let done = false item.action(() => { if (done) { return } done = true if (item.next) { dequeue(queue, item.next) } else { assert(queue[TAIL] === item, "BROKEN") ...
javascript
function dequeue(queue, item) { queue[SIZE] -= 1 let done = false item.action(() => { if (done) { return } done = true if (item.next) { dequeue(queue, item.next) } else { assert(queue[TAIL] === item, "BROKEN") ...
[ "function", "dequeue", "(", "queue", ",", "item", ")", "{", "queue", "[", "SIZE", "]", "-=", "1", "let", "done", "=", "false", "item", ".", "action", "(", "(", ")", "=>", "{", "if", "(", "done", ")", "{", "return", "}", "done", "=", "true", "if...
Execute actions in series. @param {Queue} queue - The queue instance. @param {object} item - The queued item to be executed. @returns {void}
[ "Execute", "actions", "in", "series", "." ]
c44f4d54096287212149a7cf5031bd3e4f5a1fbe
https://github.com/mysticatea/appcache-manifest/blob/c44f4d54096287212149a7cf5031bd3e4f5a1fbe/lib/queue.js#L28-L46
train
MattL922/greeks
greeks.js
_stdNormDensity
function _stdNormDensity(x) { return Math.pow(Math.E, -1 * Math.pow(x, 2) / 2) / Math.sqrt(2 * Math.PI); }
javascript
function _stdNormDensity(x) { return Math.pow(Math.E, -1 * Math.pow(x, 2) / 2) / Math.sqrt(2 * Math.PI); }
[ "function", "_stdNormDensity", "(", "x", ")", "{", "return", "Math", ".", "pow", "(", "Math", ".", "E", ",", "-", "1", "*", "Math", ".", "pow", "(", "x", ",", "2", ")", "/", "2", ")", "/", "Math", ".", "sqrt", "(", "2", "*", "Math", ".", "P...
Standard normal density function. @private @param {Number} x The value to calculate the standard normal density of @returns {Number} The value of the standard normal density function at x
[ "Standard", "normal", "density", "function", "." ]
f2369ba37de67d6f4ecddec55b647592d6580604
https://github.com/MattL922/greeks/blob/f2369ba37de67d6f4ecddec55b647592d6580604/greeks.js#L18-L21
train
MattL922/greeks
greeks.js
getDelta
function getDelta(s, k, t, v, r, callPut) { if(callPut === "call") { return _callDelta(s, k, t, v, r); } else // put { return _putDelta(s, k, t, v, r); } }
javascript
function getDelta(s, k, t, v, r, callPut) { if(callPut === "call") { return _callDelta(s, k, t, v, r); } else // put { return _putDelta(s, k, t, v, r); } }
[ "function", "getDelta", "(", "s", ",", "k", ",", "t", ",", "v", ",", "r", ",", "callPut", ")", "{", "if", "(", "callPut", "===", "\"call\"", ")", "{", "return", "_callDelta", "(", "s", ",", "k", ",", "t", ",", "v", ",", "r", ")", ";", "}", ...
Calculates the delta of an option. @param {Number} s Current price of the underlying @param {Number} k Strike price @param {Number} t Time to experiation in years @param {Number} v Volatility as a decimal @param {Number} r Anual risk-free interest rate as a decimal @param {String} callPut The type of option - "call" o...
[ "Calculates", "the", "delta", "of", "an", "option", "." ]
f2369ba37de67d6f4ecddec55b647592d6580604
https://github.com/MattL922/greeks/blob/f2369ba37de67d6f4ecddec55b647592d6580604/greeks.js#L34-L44
train
MattL922/greeks
greeks.js
_callDelta
function _callDelta(s, k, t, v, r) { var w = bs.getW(s, k, t, v, r); var delta = null; if(!isFinite(w)) { delta = (s > k) ? 1 : 0; } else { delta = bs.stdNormCDF(w); } return delta; }
javascript
function _callDelta(s, k, t, v, r) { var w = bs.getW(s, k, t, v, r); var delta = null; if(!isFinite(w)) { delta = (s > k) ? 1 : 0; } else { delta = bs.stdNormCDF(w); } return delta; }
[ "function", "_callDelta", "(", "s", ",", "k", ",", "t", ",", "v", ",", "r", ")", "{", "var", "w", "=", "bs", ".", "getW", "(", "s", ",", "k", ",", "t", ",", "v", ",", "r", ")", ";", "var", "delta", "=", "null", ";", "if", "(", "!", "isF...
Calculates the delta of a call option. @private @param {Number} s Current price of the underlying @param {Number} k Strike price @param {Number} t Time to experiation in years @param {Number} v Volatility as a decimal @param {Number} r Anual risk-free interest rate as a decimal @returns {Number} The delta of the call ...
[ "Calculates", "the", "delta", "of", "a", "call", "option", "." ]
f2369ba37de67d6f4ecddec55b647592d6580604
https://github.com/MattL922/greeks/blob/f2369ba37de67d6f4ecddec55b647592d6580604/greeks.js#L57-L70
train
MattL922/greeks
greeks.js
_putDelta
function _putDelta(s, k, t, v, r) { var delta = _callDelta(s, k, t, v, r) - 1; return (delta == -1 && k == s) ? 0 : delta; }
javascript
function _putDelta(s, k, t, v, r) { var delta = _callDelta(s, k, t, v, r) - 1; return (delta == -1 && k == s) ? 0 : delta; }
[ "function", "_putDelta", "(", "s", ",", "k", ",", "t", ",", "v", ",", "r", ")", "{", "var", "delta", "=", "_callDelta", "(", "s", ",", "k", ",", "t", ",", "v", ",", "r", ")", "-", "1", ";", "return", "(", "delta", "==", "-", "1", "&&", "k...
Calculates the delta of a put option. @private @param {Number} s Current price of the underlying @param {Number} k Strike price @param {Number} t Time to experiation in years @param {Number} v Volatility as a decimal @param {Number} r Anual risk-free interest rate as a decimal @returns {Number} The delta of the put op...
[ "Calculates", "the", "delta", "of", "a", "put", "option", "." ]
f2369ba37de67d6f4ecddec55b647592d6580604
https://github.com/MattL922/greeks/blob/f2369ba37de67d6f4ecddec55b647592d6580604/greeks.js#L83-L87
train
MattL922/greeks
greeks.js
getRho
function getRho(s, k, t, v, r, callPut, scale) { scale = scale || 100; if(callPut === "call") { return _callRho(s, k, t, v, r) / scale; } else // put { return _putRho(s, k, t, v, r) / scale; } }
javascript
function getRho(s, k, t, v, r, callPut, scale) { scale = scale || 100; if(callPut === "call") { return _callRho(s, k, t, v, r) / scale; } else // put { return _putRho(s, k, t, v, r) / scale; } }
[ "function", "getRho", "(", "s", ",", "k", ",", "t", ",", "v", ",", "r", ",", "callPut", ",", "scale", ")", "{", "scale", "=", "scale", "||", "100", ";", "if", "(", "callPut", "===", "\"call\"", ")", "{", "return", "_callRho", "(", "s", ",", "k"...
Calculates the rho of an option. @param {Number} s Current price of the underlying @param {Number} k Strike price @param {Number} t Time to experiation in years @param {Number} v Volatility as a decimal @param {Number} r Anual risk-free interest rate as a decimal @param {String} callPut The type of option - "call" or ...
[ "Calculates", "the", "rho", "of", "an", "option", "." ]
f2369ba37de67d6f4ecddec55b647592d6580604
https://github.com/MattL922/greeks/blob/f2369ba37de67d6f4ecddec55b647592d6580604/greeks.js#L101-L112
train
MattL922/greeks
greeks.js
_putRho
function _putRho(s, k, t, v, r) { var w = bs.getW(s, k, t, v, r); if(!isNaN(w)) { return -1 * k * t * Math.pow(Math.E, -1 * r * t) * bs.stdNormCDF(v * Math.sqrt(t) - w); } else { return 0; } }
javascript
function _putRho(s, k, t, v, r) { var w = bs.getW(s, k, t, v, r); if(!isNaN(w)) { return -1 * k * t * Math.pow(Math.E, -1 * r * t) * bs.stdNormCDF(v * Math.sqrt(t) - w); } else { return 0; } }
[ "function", "_putRho", "(", "s", ",", "k", ",", "t", ",", "v", ",", "r", ")", "{", "var", "w", "=", "bs", ".", "getW", "(", "s", ",", "k", ",", "t", ",", "v", ",", "r", ")", ";", "if", "(", "!", "isNaN", "(", "w", ")", ")", "{", "retu...
Calculates the rho of a put option. @private @param {Number} s Current price of the underlying @param {Number} k Strike price @param {Number} t Time to experiation in years @param {Number} v Volatility as a decimal @param {Number} r Anual risk-free interest rate as a decimal @returns {Number} The rho of the put option
[ "Calculates", "the", "rho", "of", "a", "put", "option", "." ]
f2369ba37de67d6f4ecddec55b647592d6580604
https://github.com/MattL922/greeks/blob/f2369ba37de67d6f4ecddec55b647592d6580604/greeks.js#L149-L160
train
MattL922/greeks
greeks.js
getVega
function getVega(s, k, t, v, r) { var w = bs.getW(s, k, t, v, r); return (isFinite(w)) ? (s * Math.sqrt(t) * _stdNormDensity(w) / 100) : 0; }
javascript
function getVega(s, k, t, v, r) { var w = bs.getW(s, k, t, v, r); return (isFinite(w)) ? (s * Math.sqrt(t) * _stdNormDensity(w) / 100) : 0; }
[ "function", "getVega", "(", "s", ",", "k", ",", "t", ",", "v", ",", "r", ")", "{", "var", "w", "=", "bs", ".", "getW", "(", "s", ",", "k", ",", "t", ",", "v", ",", "r", ")", ";", "return", "(", "isFinite", "(", "w", ")", ")", "?", "(", ...
Calculates the vega of a call and put option. @param {Number} s Current price of the underlying @param {Number} k Strike price @param {Number} t Time to experiation in years @param {Number} v Volatility as a decimal @param {Number} r Anual risk-free interest rate as a decimal @returns {Number} The vega of the option
[ "Calculates", "the", "vega", "of", "a", "call", "and", "put", "option", "." ]
f2369ba37de67d6f4ecddec55b647592d6580604
https://github.com/MattL922/greeks/blob/f2369ba37de67d6f4ecddec55b647592d6580604/greeks.js#L172-L176
train
MattL922/greeks
greeks.js
getTheta
function getTheta(s, k, t, v, r, callPut, scale) { scale = scale || 365; if(callPut === "call") { return _callTheta(s, k, t, v, r) / scale; } else // put { return _putTheta(s, k, t, v, r) / scale; } }
javascript
function getTheta(s, k, t, v, r, callPut, scale) { scale = scale || 365; if(callPut === "call") { return _callTheta(s, k, t, v, r) / scale; } else // put { return _putTheta(s, k, t, v, r) / scale; } }
[ "function", "getTheta", "(", "s", ",", "k", ",", "t", ",", "v", ",", "r", ",", "callPut", ",", "scale", ")", "{", "scale", "=", "scale", "||", "365", ";", "if", "(", "callPut", "===", "\"call\"", ")", "{", "return", "_callTheta", "(", "s", ",", ...
Calculates the theta of an option. @param {Number} s Current price of the underlying @param {Number} k Strike price @param {Number} t Time to experiation in years @param {Number} v Volatility as a decimal @param {Number} r Anual risk-free interest rate as a decimal @param {String} callPut The type of option - "call" o...
[ "Calculates", "the", "theta", "of", "an", "option", "." ]
f2369ba37de67d6f4ecddec55b647592d6580604
https://github.com/MattL922/greeks/blob/f2369ba37de67d6f4ecddec55b647592d6580604/greeks.js#L190-L201
train
MattL922/greeks
greeks.js
_callTheta
function _callTheta(s, k, t, v, r) { var w = bs.getW(s, k, t, v, r); if(isFinite(w)) { return -1 * v * s * _stdNormDensity(w) / (2 * Math.sqrt(t)) - k * r * Math.pow(Math.E, -1 * r * t) * bs.stdNormCDF(w - v * Math.sqrt(t)); } else { return 0; } }
javascript
function _callTheta(s, k, t, v, r) { var w = bs.getW(s, k, t, v, r); if(isFinite(w)) { return -1 * v * s * _stdNormDensity(w) / (2 * Math.sqrt(t)) - k * r * Math.pow(Math.E, -1 * r * t) * bs.stdNormCDF(w - v * Math.sqrt(t)); } else { return 0; } }
[ "function", "_callTheta", "(", "s", ",", "k", ",", "t", ",", "v", ",", "r", ")", "{", "var", "w", "=", "bs", ".", "getW", "(", "s", ",", "k", ",", "t", ",", "v", ",", "r", ")", ";", "if", "(", "isFinite", "(", "w", ")", ")", "{", "retur...
Calculates the theta of a call option. @private @param {Number} s Current price of the underlying @param {Number} k Strike price @param {Number} t Time to experiation in years @param {Number} v Volatility as a decimal @param {Number} r Anual risk-free interest rate as a decimal @returns {Number} The theta of the call ...
[ "Calculates", "the", "theta", "of", "a", "call", "option", "." ]
f2369ba37de67d6f4ecddec55b647592d6580604
https://github.com/MattL922/greeks/blob/f2369ba37de67d6f4ecddec55b647592d6580604/greeks.js#L214-L225
train
GitbookIO/plugin-sitemap
index.js
function() { var sitemap = sm.createSitemap({ cacheTime: 600000, hostname: url.resolve(this.config.get('pluginsConfig.sitemap.hostname'), '/'), urls: urls }); var xml = sitemap.toString(); return this.output.writeFile('sit...
javascript
function() { var sitemap = sm.createSitemap({ cacheTime: 600000, hostname: url.resolve(this.config.get('pluginsConfig.sitemap.hostname'), '/'), urls: urls }); var xml = sitemap.toString(); return this.output.writeFile('sit...
[ "function", "(", ")", "{", "var", "sitemap", "=", "sm", ".", "createSitemap", "(", "{", "cacheTime", ":", "600000", ",", "hostname", ":", "url", ".", "resolve", "(", "this", ".", "config", ".", "get", "(", "'pluginsConfig.sitemap.hostname'", ")", ",", "'...
Write sitemap.xml
[ "Write", "sitemap", ".", "xml" ]
dbffc38230dfd39d29002065b61e6fc7103e3db6
https://github.com/GitbookIO/plugin-sitemap/blob/dbffc38230dfd39d29002065b61e6fc7103e3db6/index.js#L25-L35
train
robinpowered/robin-js-sdk-public
lib/grid/connection.js
Connection
function Connection (gridModule) { try { Connection.super_.apply(this, arguments); RbnUtil.__copyProperties(this, gridModule); this.validate(); this.connectionStub = '/' + this.endpoint + '/' + this.identifier; } catch (err) { throw err; } }
javascript
function Connection (gridModule) { try { Connection.super_.apply(this, arguments); RbnUtil.__copyProperties(this, gridModule); this.validate(); this.connectionStub = '/' + this.endpoint + '/' + this.identifier; } catch (err) { throw err; } }
[ "function", "Connection", "(", "gridModule", ")", "{", "try", "{", "Connection", ".", "super_", ".", "apply", "(", "this", ",", "arguments", ")", ";", "RbnUtil", ".", "__copyProperties", "(", "this", ",", "gridModule", ")", ";", "this", ".", "validate", ...
This connection class is instantiated as an object when you call the `connect` method on a grid module. It sets up the connection to a specific point entity on the grid and emits messages as they come in. You can also sent messages of a specific type to this connection. @param {Object} gridModule A previously instantia...
[ "This", "connection", "class", "is", "instantiated", "as", "an", "object", "when", "you", "call", "the", "connect", "method", "on", "a", "grid", "module", ".", "It", "sets", "up", "the", "connection", "to", "a", "specific", "point", "entity", "on", "the", ...
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/grid/connection.js#L23-L32
train
robinpowered/robin-js-sdk-public
lib/api/modules/spaces.js
function (spaceIdentifier, params) { var path = this.constructPath(constants.SPACES, spaceIdentifier); return this.Core.GET(path, params); }
javascript
function (spaceIdentifier, params) { var path = this.constructPath(constants.SPACES, spaceIdentifier); return this.Core.GET(path, params); }
[ "function", "(", "spaceIdentifier", ",", "params", ")", "{", "var", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "SPACES", ",", "spaceIdentifier", ")", ";", "return", "this", ".", "Core", ".", "GET", "(", "path", ",", "params", ")", ...
Get all spaces or a particular space identified by `spaceIdentifier` @param {String|Integer} spaceIdentifier A Robin space identifier @param {Object|undefined} params A querystring object @return {Function} A promise
[ "Get", "all", "spaces", "or", "a", "particular", "space", "identified", "by", "spaceIdentifier" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/spaces.js#L20-L23
train
robinpowered/robin-js-sdk-public
lib/api/modules/spaces.js
function (spaceIdentifier, data) { var path; if (data) { path = this.constructPath(constants.SPACES, spaceIdentifier); return this.Core.PATCH(path, data); } else { return this.rejectRequest('Bad Request: Space data is required'); } }
javascript
function (spaceIdentifier, data) { var path; if (data) { path = this.constructPath(constants.SPACES, spaceIdentifier); return this.Core.PATCH(path, data); } else { return this.rejectRequest('Bad Request: Space data is required'); } }
[ "function", "(", "spaceIdentifier", ",", "data", ")", "{", "var", "path", ";", "if", "(", "data", ")", "{", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "SPACES", ",", "spaceIdentifier", ")", ";", "return", "this", ".", "Core", "."...
Update a space @param {String|Integer} spaceIdentifier A Robin space identifier @param {Object} data A data object @return {Function} A promise
[ "Update", "a", "space" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/spaces.js#L31-L39
train
robinpowered/robin-js-sdk-public
lib/api/modules/spaces.js
function (spaceIdentifier, deviceIdentifier, params) { var path; if (spaceIdentifier) { path = this.constructPath(constants.SPACES, spaceIdentifier, constants.DEVICES, deviceIdentifier); return this.Core.GET(path, params); } else { return this.rejectRequest('Bad Request: A spac...
javascript
function (spaceIdentifier, deviceIdentifier, params) { var path; if (spaceIdentifier) { path = this.constructPath(constants.SPACES, spaceIdentifier, constants.DEVICES, deviceIdentifier); return this.Core.GET(path, params); } else { return this.rejectRequest('Bad Request: A spac...
[ "function", "(", "spaceIdentifier", ",", "deviceIdentifier", ",", "params", ")", "{", "var", "path", ";", "if", "(", "spaceIdentifier", ")", "{", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "SPACES", ",", "spaceIdentifier", ",", "consta...
Get all the devices for a space or a particular device identified by `deviceIdentifier` @param {String|Integer} spaceIdentifier A Robin space identifier @param {String|Integer|undefined} deviceIdentifier A Robin device identifier @param {Object|undefined} params A querystring object @ret...
[ "Get", "all", "the", "devices", "for", "a", "space", "or", "a", "particular", "device", "identified", "by", "deviceIdentifier" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/spaces.js#L68-L76
train
robinpowered/robin-js-sdk-public
lib/api/modules/spaces.js
function (spaceIdentifier, data) { var path; if (spaceIdentifier && data) { path = this.constructPath(constants.SPACES, spaceIdentifier, constants.DEVICES); return this.Core.POST(path, data); } else { return this.rejectRequest('Bad Request: A space identifier and device data ar...
javascript
function (spaceIdentifier, data) { var path; if (spaceIdentifier && data) { path = this.constructPath(constants.SPACES, spaceIdentifier, constants.DEVICES); return this.Core.POST(path, data); } else { return this.rejectRequest('Bad Request: A space identifier and device data ar...
[ "function", "(", "spaceIdentifier", ",", "data", ")", "{", "var", "path", ";", "if", "(", "spaceIdentifier", "&&", "data", ")", "{", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "SPACES", ",", "spaceIdentifier", ",", "constants", ".", ...
Create a device in a space @param {String|Integer} spaceIdentifier A Robin space identifier @param {Object} data A data object @return {Function} A Promise
[ "Create", "a", "device", "in", "a", "space" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/spaces.js#L84-L92
train
robinpowered/robin-js-sdk-public
lib/api/modules/spaces.js
function (spaceIdentifier, params) { var path; if (spaceIdentifier) { path = this.constructPath(constants.SPACES, spaceIdentifier, constants.PRESENCE); return this.Core.GET(path, params); } else { return this.rejectRequest('Bad Request: A space identifier is required.'); ...
javascript
function (spaceIdentifier, params) { var path; if (spaceIdentifier) { path = this.constructPath(constants.SPACES, spaceIdentifier, constants.PRESENCE); return this.Core.GET(path, params); } else { return this.rejectRequest('Bad Request: A space identifier is required.'); ...
[ "function", "(", "spaceIdentifier", ",", "params", ")", "{", "var", "path", ";", "if", "(", "spaceIdentifier", ")", "{", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "SPACES", ",", "spaceIdentifier", ",", "constants", ".", "PRESENCE", ...
Get all the presence for a space @param {String|Integer} spaceIdentifier A Robin space identifier @param {Object|undefined} params A querystring object @return {Function} A Promise
[ "Get", "all", "the", "presence", "for", "a", "space" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/spaces.js#L138-L146
train
CoryG89/markedejs
index.js
function (html) { var sep = '----------------------------------------------------------'; console.log('\n' + sep); console.log('markedejs: HTML OUT (markedejs.DEBUG = false to silence)'); console.log(sep); console.log(html); console.log(sep + '\n'); }
javascript
function (html) { var sep = '----------------------------------------------------------'; console.log('\n' + sep); console.log('markedejs: HTML OUT (markedejs.DEBUG = false to silence)'); console.log(sep); console.log(html); console.log(sep + '\n'); }
[ "function", "(", "html", ")", "{", "var", "sep", "=", "'----------------------------------------------------------'", ";", "console", ".", "log", "(", "'\\n'", "+", "sep", ")", ";", "console", ".", "log", "(", "'markedejs: HTML OUT (markedejs.DEBUG = false to silence)'"...
Helper method to debug html output of marked engine
[ "Helper", "method", "to", "debug", "html", "output", "of", "marked", "engine" ]
1af6da328f7104b99caa8cd20601b9f45e24610b
https://github.com/CoryG89/markedejs/blob/1af6da328f7104b99caa8cd20601b9f45e24610b/index.js#L22-L29
train
mclaeysb/geojson-polygon-self-intersections
index.js
ifIsectAddToOutput
function ifIsectAddToOutput(ring0, edge0, ring1, edge1) { var start0 = coord[ring0][edge0]; var end0 = coord[ring0][edge0+1]; var start1 = coord[ring1][edge1]; var end1 = coord[ring1][edge1+1]; var isect = intersect(start0, end0, start1, end1); if (isect == null) return; // discard parallels a...
javascript
function ifIsectAddToOutput(ring0, edge0, ring1, edge1) { var start0 = coord[ring0][edge0]; var end0 = coord[ring0][edge0+1]; var start1 = coord[ring1][edge1]; var end1 = coord[ring1][edge1+1]; var isect = intersect(start0, end0, start1, end1); if (isect == null) return; // discard parallels a...
[ "function", "ifIsectAddToOutput", "(", "ring0", ",", "edge0", ",", "ring1", ",", "edge1", ")", "{", "var", "start0", "=", "coord", "[", "ring0", "]", "[", "edge0", "]", ";", "var", "end0", "=", "coord", "[", "ring0", "]", "[", "edge0", "+", "1", "]...
Function to check if two edges intersect and add the intersection to the output
[ "Function", "to", "check", "if", "two", "edges", "intersect", "and", "add", "the", "intersection", "to", "the", "output" ]
4a699e6042b1234034a97288a9ccdfde82d267f4
https://github.com/mclaeysb/geojson-polygon-self-intersections/blob/4a699e6042b1234034a97288a9ccdfde82d267f4/index.js#L82-L132
train
mclaeysb/geojson-polygon-self-intersections
index.js
rbushTreeItem
function rbushTreeItem(ring, edge) { var start = coord[ring][edge]; var end = coord[ring][edge+1]; if (start[0] < end[0]) { var minX = start[0], maxX = end[0]; } else { var minX = end[0], maxX = start[0]; }; if (start[1] < end[1]) { var minY = start[1], maxY = end[1]; } e...
javascript
function rbushTreeItem(ring, edge) { var start = coord[ring][edge]; var end = coord[ring][edge+1]; if (start[0] < end[0]) { var minX = start[0], maxX = end[0]; } else { var minX = end[0], maxX = start[0]; }; if (start[1] < end[1]) { var minY = start[1], maxY = end[1]; } e...
[ "function", "rbushTreeItem", "(", "ring", ",", "edge", ")", "{", "var", "start", "=", "coord", "[", "ring", "]", "[", "edge", "]", ";", "var", "end", "=", "coord", "[", "ring", "]", "[", "edge", "+", "1", "]", ";", "if", "(", "start", "[", "0",...
Function to return a rbush tree item given an ring and edge number
[ "Function", "to", "return", "a", "rbush", "tree", "item", "given", "an", "ring", "and", "edge", "number" ]
4a699e6042b1234034a97288a9ccdfde82d267f4
https://github.com/mclaeysb/geojson-polygon-self-intersections/blob/4a699e6042b1234034a97288a9ccdfde82d267f4/index.js#L135-L151
train
dsfields/radargun
lib/report.js
padEnd
function padEnd(str, length) { /* istanbul ignore next */ if (str.length >= length) return str; return str + ' '.repeat(length - str.length); }
javascript
function padEnd(str, length) { /* istanbul ignore next */ if (str.length >= length) return str; return str + ' '.repeat(length - str.length); }
[ "function", "padEnd", "(", "str", ",", "length", ")", "{", "/* istanbul ignore next */", "if", "(", "str", ".", "length", ">=", "length", ")", "return", "str", ";", "return", "str", "+", "' '", ".", "repeat", "(", "length", "-", "str", ".", "length", "...
TABLE HELPERS A String.prototype.padEnd shim. @param {string} str @param {number} length
[ "TABLE", "HELPERS", "A", "String", ".", "prototype", ".", "padEnd", "shim", "." ]
c0cf2730441e1e454355603c2fd7539b9d552f1a
https://github.com/dsfields/radargun/blob/c0cf2730441e1e454355603c2fd7539b9d552f1a/lib/report.js#L58-L62
train
dsfields/radargun
lib/report.js
tableDimensions
function tableDimensions(metrics) { const pointPad = UNIT.length + 2; let name = 6; let point = 5; for (let i = 0; i < metrics.length; i++) { const metric = metrics[i]; name = Math.max(name, metric.label.length + 2); point = Math.max( point, numDigits(metric.avg) + pointPad, numDi...
javascript
function tableDimensions(metrics) { const pointPad = UNIT.length + 2; let name = 6; let point = 5; for (let i = 0; i < metrics.length; i++) { const metric = metrics[i]; name = Math.max(name, metric.label.length + 2); point = Math.max( point, numDigits(metric.avg) + pointPad, numDi...
[ "function", "tableDimensions", "(", "metrics", ")", "{", "const", "pointPad", "=", "UNIT", ".", "length", "+", "2", ";", "let", "name", "=", "6", ";", "let", "point", "=", "5", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "metrics", ".",...
Calculates table cell dimensions. @param {@link FunctionMetrics[]} metrics @returns {Dimensions}
[ "Calculates", "table", "cell", "dimensions", "." ]
c0cf2730441e1e454355603c2fd7539b9d552f1a
https://github.com/dsfields/radargun/blob/c0cf2730441e1e454355603c2fd7539b9d552f1a/lib/report.js#L84-L106
train
dsfields/radargun
lib/report.js
divider
function divider(dimensions, type) { let left = BORDER_RUD; let right = BORDER_LUD; let line = BORDER_HORZ; let joint = BORDER_LRUD; switch (type) { case 'top': left = BORDER_RD; right = BORDER_LD; joint = BORDER_LRD; break; case 'bottom': left = BORDER_RU; right ...
javascript
function divider(dimensions, type) { let left = BORDER_RUD; let right = BORDER_LUD; let line = BORDER_HORZ; let joint = BORDER_LRUD; switch (type) { case 'top': left = BORDER_RD; right = BORDER_LD; joint = BORDER_LRD; break; case 'bottom': left = BORDER_RU; right ...
[ "function", "divider", "(", "dimensions", ",", "type", ")", "{", "let", "left", "=", "BORDER_RUD", ";", "let", "right", "=", "BORDER_LUD", ";", "let", "line", "=", "BORDER_HORZ", ";", "let", "joint", "=", "BORDER_LRUD", ";", "switch", "(", "type", ")", ...
Creates a row divider for the given dimensions of a specific type. @param {Dimensions} dimensions @param {('top'|'bottom'|'header'|'row')} type @returns {string}
[ "Creates", "a", "row", "divider", "for", "the", "given", "dimensions", "of", "a", "specific", "type", "." ]
c0cf2730441e1e454355603c2fd7539b9d552f1a
https://github.com/dsfields/radargun/blob/c0cf2730441e1e454355603c2fd7539b9d552f1a/lib/report.js#L117-L163
train
dsfields/radargun
lib/report.js
header
function header(dimensions) { return divider(dimensions, 'top') + BORDER_VERT + BOLD + padEnd(' NAME', dimensions.name) + RESET + BORDER_VERT + BOLD + padEnd(' AVG', dimensions.avg) + RESET + BORDER_VERT + BOLD + padEnd(' MIN', dimensions.min) + RESET + BORDER_VERT + BOLD + padEnd(' MA...
javascript
function header(dimensions) { return divider(dimensions, 'top') + BORDER_VERT + BOLD + padEnd(' NAME', dimensions.name) + RESET + BORDER_VERT + BOLD + padEnd(' AVG', dimensions.avg) + RESET + BORDER_VERT + BOLD + padEnd(' MIN', dimensions.min) + RESET + BORDER_VERT + BOLD + padEnd(' MA...
[ "function", "header", "(", "dimensions", ")", "{", "return", "divider", "(", "dimensions", ",", "'top'", ")", "+", "BORDER_VERT", "+", "BOLD", "+", "padEnd", "(", "' NAME'", ",", "dimensions", ".", "name", ")", "+", "RESET", "+", "BORDER_VERT", "+", "BOL...
Generates the header for a report table. @param {Dimensions} dimensions @returns {string}
[ "Generates", "the", "header", "for", "a", "report", "table", "." ]
c0cf2730441e1e454355603c2fd7539b9d552f1a
https://github.com/dsfields/radargun/blob/c0cf2730441e1e454355603c2fd7539b9d552f1a/lib/report.js#L173-L186
train
dsfields/radargun
lib/report.js
row
function row(metric, dimensions, isTarget) { let left = ''; let right = ''; if (isTarget) { left = HIGHLIGHT; right = RESET; } return BORDER_VERT + left + padEnd(' ' + metric.label, dimensions.name) + right + BORDER_VERT + left + padEnd(' ' + metric.avg + UNIT, dimensions.avg) + right ...
javascript
function row(metric, dimensions, isTarget) { let left = ''; let right = ''; if (isTarget) { left = HIGHLIGHT; right = RESET; } return BORDER_VERT + left + padEnd(' ' + metric.label, dimensions.name) + right + BORDER_VERT + left + padEnd(' ' + metric.avg + UNIT, dimensions.avg) + right ...
[ "function", "row", "(", "metric", ",", "dimensions", ",", "isTarget", ")", "{", "let", "left", "=", "''", ";", "let", "right", "=", "''", ";", "if", "(", "isTarget", ")", "{", "left", "=", "HIGHLIGHT", ";", "right", "=", "RESET", ";", "}", "return"...
Generates a report table row. @param {@link FunctionMetrics} metric @param {Dimensions} dimensions @param {boolean} isTarget @returns {string}
[ "Generates", "a", "report", "table", "row", "." ]
c0cf2730441e1e454355603c2fd7539b9d552f1a
https://github.com/dsfields/radargun/blob/c0cf2730441e1e454355603c2fd7539b9d552f1a/lib/report.js#L198-L217
train
dsfields/radargun
lib/report.js
report
function report(stream, metrics, thresholds) { const target = (!elv(thresholds)) ? -1 : thresholds.target; const dimensions = tableDimensions(metrics); const border = divider(dimensions); let value = header(dimensions); for (let i = 0; i < metrics.length; i++) { if (i > 0) value += border; const metr...
javascript
function report(stream, metrics, thresholds) { const target = (!elv(thresholds)) ? -1 : thresholds.target; const dimensions = tableDimensions(metrics); const border = divider(dimensions); let value = header(dimensions); for (let i = 0; i < metrics.length; i++) { if (i > 0) value += border; const metr...
[ "function", "report", "(", "stream", ",", "metrics", ",", "thresholds", ")", "{", "const", "target", "=", "(", "!", "elv", "(", "thresholds", ")", ")", "?", "-", "1", ":", "thresholds", ".", "target", ";", "const", "dimensions", "=", "tableDimensions", ...
REPORTER Generates a report table. @param {@link Stream} stream @param {@link FunctionMetrics[]} metrics @param {@link Thresholds} thresholds
[ "REPORTER", "Generates", "a", "report", "table", "." ]
c0cf2730441e1e454355603c2fd7539b9d552f1a
https://github.com/dsfields/radargun/blob/c0cf2730441e1e454355603c2fd7539b9d552f1a/lib/report.js#L232-L248
train
partyka95/graph-type-orm
dist/find-many.js
findMany
function findMany(repository, options) { const entityColumns = repository.metadata.columns.map((columnMetadata) => columnMetadata.propertyName); const entityManyToOneRelationColumns = repository .metadata .relations .filter((relationMetadata) => relationMetadata.relationType === 'many-to...
javascript
function findMany(repository, options) { const entityColumns = repository.metadata.columns.map((columnMetadata) => columnMetadata.propertyName); const entityManyToOneRelationColumns = repository .metadata .relations .filter((relationMetadata) => relationMetadata.relationType === 'many-to...
[ "function", "findMany", "(", "repository", ",", "options", ")", "{", "const", "entityColumns", "=", "repository", ".", "metadata", ".", "columns", ".", "map", "(", "(", "columnMetadata", ")", "=>", "columnMetadata", ".", "propertyName", ")", ";", "const", "e...
Method to find many entity records. @param {Repository<Entity>} repository @param {FindManyOptions} options @returns {(source, args, context, info) => Promise<Entity[]>}
[ "Method", "to", "find", "many", "entity", "records", "." ]
c2c1d93c091ad8fb5d3015cabe6edb20dccfa225
https://github.com/partyka95/graph-type-orm/blob/c2c1d93c091ad8fb5d3015cabe6edb20dccfa225/dist/find-many.js#L27-L72
train
robinpowered/robin-js-sdk-public
lib/api/modules/events.js
function (data) { var path; if (data) { path = this.constructPath(constants.EVENTS); return this.Places.POST(path, data); } else { return this.rejectRequest('Bad Request: A data object is required.'); } }
javascript
function (data) { var path; if (data) { path = this.constructPath(constants.EVENTS); return this.Places.POST(path, data); } else { return this.rejectRequest('Bad Request: A data object is required.'); } }
[ "function", "(", "data", ")", "{", "var", "path", ";", "if", "(", "data", ")", "{", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "EVENTS", ")", ";", "return", "this", ".", "Places", ".", "POST", "(", "path", ",", "data", ")", ...
Create an event @param {Object} data A data object @return {Function} A promise
[ "Create", "an", "event" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/events.js#L19-L27
train
jeffrose/emitter
dist/emitter.js
listenEmpty
function listenEmpty( handler, isFunction, emitter ){ const errors = []; if( isFunction ){ try { handler.call( emitter ); } catch( error ){ errors.push( error ); } } else { const length = handler.length, listeners = handler.slice(); ...
javascript
function listenEmpty( handler, isFunction, emitter ){ const errors = []; if( isFunction ){ try { handler.call( emitter ); } catch( error ){ errors.push( error ); } } else { const length = handler.length, listeners = handler.slice(); ...
[ "function", "listenEmpty", "(", "handler", ",", "isFunction", ",", "emitter", ")", "{", "const", "errors", "=", "[", "]", ";", "if", "(", "isFunction", ")", "{", "try", "{", "handler", ".", "call", "(", "emitter", ")", ";", "}", "catch", "(", "error"...
Execute a listener with no arguments. @function Emitter~listenEmpty @param {EventListener|Array<EventListener>} handler One or more {@link EventListener|listeners} that will be executed on the `emitter`. @param {external:boolean} isFunction Whether or not the `handler` is a {@link external:Function|function}. @param {E...
[ "Execute", "a", "listener", "with", "no", "arguments", "." ]
c6d8d1702ff60ca4f5100d13480914e4bd17183f
https://github.com/jeffrose/emitter/blob/c6d8d1702ff60ca4f5100d13480914e4bd17183f/dist/emitter.js#L450-L477
train
jeffrose/emitter
dist/emitter.js
toEmitter
function toEmitter( selection, target ){ // Apply the entire Emitter API if( selection === API ){ asEmitter.call( target ); // Apply only the selected API methods } else { let index, key, mapping, names, value; if( typeof selection === 'string' ){ n...
javascript
function toEmitter( selection, target ){ // Apply the entire Emitter API if( selection === API ){ asEmitter.call( target ); // Apply only the selected API methods } else { let index, key, mapping, names, value; if( typeof selection === 'string' ){ n...
[ "function", "toEmitter", "(", "selection", ",", "target", ")", "{", "// Apply the entire Emitter API", "if", "(", "selection", "===", "API", ")", "{", "asEmitter", ".", "call", "(", "target", ")", ";", "// Apply only the selected API methods", "}", "else", "{", ...
Applies a `selection` of the Emitter.js API to the `target`. @function Emitter~toEmitter @param {APIReference} [selection] A selection of the Emitter.js API. @param {external:Object} target The object on which the API will be applied.
[ "Applies", "a", "selection", "of", "the", "Emitter", ".", "js", "API", "to", "the", "target", "." ]
c6d8d1702ff60ca4f5100d13480914e4bd17183f
https://github.com/jeffrose/emitter/blob/c6d8d1702ff60ca4f5100d13480914e4bd17183f/dist/emitter.js#L731-L760
train
robinpowered/robin-js-sdk-public
lib/api/modules/devicemanifests.js
function (identifier, params) { var path = this.constructPath(constants.DEVICE_MANIFESTS, identifier); return this.Core.GET(path, params); }
javascript
function (identifier, params) { var path = this.constructPath(constants.DEVICE_MANIFESTS, identifier); return this.Core.GET(path, params); }
[ "function", "(", "identifier", ",", "params", ")", "{", "var", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "DEVICE_MANIFESTS", ",", "identifier", ")", ";", "return", "this", ".", "Core", ".", "GET", "(", "path", ",", "params", ")", ...
Get all the device manifests or a particular device manifest identified by the `identifier` parameter @param {String|Integer|undefined} identifier A Robin device manifest identifier @param {Object|undefined} params A querystring object @return {Function} A Promise
[ "Get", "all", "the", "device", "manifests", "or", "a", "particular", "device", "manifest", "identified", "by", "the", "identifier", "parameter" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/devicemanifests.js#L20-L23
train
robinpowered/robin-js-sdk-public
lib/api/modules/devicemanifests.js
function (data) { var path; if (data) { path = this.constructPath(constants.DEVICE_MANIFESTS); return this.Core.POST(path, data); } else { return this.rejectRequest('Bad Request: A data object is required'); } }
javascript
function (data) { var path; if (data) { path = this.constructPath(constants.DEVICE_MANIFESTS); return this.Core.POST(path, data); } else { return this.rejectRequest('Bad Request: A data object is required'); } }
[ "function", "(", "data", ")", "{", "var", "path", ";", "if", "(", "data", ")", "{", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "DEVICE_MANIFESTS", ")", ";", "return", "this", ".", "Core", ".", "POST", "(", "path", ",", "data", ...
Create a device manifest @param {Object} data A data object @return {Function} A Promise
[ "Create", "a", "device", "manifest" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/devicemanifests.js#L30-L38
train
robinpowered/robin-js-sdk-public
lib/api/modules/devicemanifests.js
function (identifier, data) { var path; if (identifier && data) { path = this.constructPath(constants.DEVICE_MANIFESTS, identifier); return this.Core.PATCH(path, data); } else { return this.rejectRequest('Bad Request: A device manifest identifier and a data object are required.'); } ...
javascript
function (identifier, data) { var path; if (identifier && data) { path = this.constructPath(constants.DEVICE_MANIFESTS, identifier); return this.Core.PATCH(path, data); } else { return this.rejectRequest('Bad Request: A device manifest identifier and a data object are required.'); } ...
[ "function", "(", "identifier", ",", "data", ")", "{", "var", "path", ";", "if", "(", "identifier", "&&", "data", ")", "{", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "DEVICE_MANIFESTS", ",", "identifier", ")", ";", "return", "this"...
Update a device manifest @param {String|Integer|undefined} identifier A Robin device manifest identifier @param {Object} data A data object @return {Function} A Promise
[ "Update", "a", "device", "manifest" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/devicemanifests.js#L46-L54
train
robinpowered/robin-js-sdk-public
lib/api/modules/devicemanifests.js
function (identifier) { var path; if (identifier) { path = this.constructPath(constants.DEVICE_MANIFESTS, identifier); return this.Core.DELETE(path); } else { return this.rejectRequest('Bad Request: A device manifest identifier is required.'); } }
javascript
function (identifier) { var path; if (identifier) { path = this.constructPath(constants.DEVICE_MANIFESTS, identifier); return this.Core.DELETE(path); } else { return this.rejectRequest('Bad Request: A device manifest identifier is required.'); } }
[ "function", "(", "identifier", ")", "{", "var", "path", ";", "if", "(", "identifier", ")", "{", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "DEVICE_MANIFESTS", ",", "identifier", ")", ";", "return", "this", ".", "Core", ".", "DELETE...
Delete a device manifest @param {String|Integer|undefined} identifier A Robin device manifest identifier @return {Function} A Promise
[ "Delete", "a", "device", "manifest" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/devicemanifests.js#L61-L69
train
robinpowered/robin-js-sdk-public
lib/api/modules/devicemanifests.js
function (deviceManifestIdentifier, feedIdentifier, params) { var path; if (deviceManifestIdentifier) { path = this.constructPath(constants.DEVICE_MANIFESTS, deviceManifestIdentifier, constants.FEEDS, feedIdentifier); return this.Core.GET(path, params); ...
javascript
function (deviceManifestIdentifier, feedIdentifier, params) { var path; if (deviceManifestIdentifier) { path = this.constructPath(constants.DEVICE_MANIFESTS, deviceManifestIdentifier, constants.FEEDS, feedIdentifier); return this.Core.GET(path, params); ...
[ "function", "(", "deviceManifestIdentifier", ",", "feedIdentifier", ",", "params", ")", "{", "var", "path", ";", "if", "(", "deviceManifestIdentifier", ")", "{", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "DEVICE_MANIFESTS", ",", "deviceMa...
Get all the feeds for a device manifest or a particular feed identified by `feedIdentifier` @param {String|Integer} deviceManifestIdentifier A Robin device manifest identifier @param {String|Integer|undefined} feedIdentifier A Robin feed identifier @param {Object|undefined} params ...
[ "Get", "all", "the", "feeds", "for", "a", "device", "manifest", "or", "a", "particular", "feed", "identified", "by", "feedIdentifier" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/devicemanifests.js#L83-L92
train
robinpowered/robin-js-sdk-public
lib/api/modules/devicemanifests.js
function (deviceManifestIdentifier, data) { var path; if (deviceManifestIdentifier) { path = this.constructPath(constants.DEVICE_MANIFESTS, deviceManifestIdentifier, constants.FEEDS); return this.Core.POST(path, data); } else { return this.rejectRequest('Bad Request: A device m...
javascript
function (deviceManifestIdentifier, data) { var path; if (deviceManifestIdentifier) { path = this.constructPath(constants.DEVICE_MANIFESTS, deviceManifestIdentifier, constants.FEEDS); return this.Core.POST(path, data); } else { return this.rejectRequest('Bad Request: A device m...
[ "function", "(", "deviceManifestIdentifier", ",", "data", ")", "{", "var", "path", ";", "if", "(", "deviceManifestIdentifier", ")", "{", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "DEVICE_MANIFESTS", ",", "deviceManifestIdentifier", ",", "...
Add a feed to a device manifest @param {String|Integer} deviceManifestIdentifier A Robin device manifest identifier @param {Object} data A querystring object @return {Function} A Promise
[ "Add", "a", "feed", "to", "a", "device", "manifest" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/devicemanifests.js#L100-L108
train
robinpowered/robin-js-sdk-public
lib/api/modules/devicemanifests.js
function (deviceManifestIdentifier, feedIdentifier, data) { var path, rejectMsg; if (deviceManifestIdentifier && feedIdentifier && data) { path = this.constructPath(constants.DEVICE_MANIFESTS, deviceManifestIdentifier, constants.FEEDS, feedIdentifier); ...
javascript
function (deviceManifestIdentifier, feedIdentifier, data) { var path, rejectMsg; if (deviceManifestIdentifier && feedIdentifier && data) { path = this.constructPath(constants.DEVICE_MANIFESTS, deviceManifestIdentifier, constants.FEEDS, feedIdentifier); ...
[ "function", "(", "deviceManifestIdentifier", ",", "feedIdentifier", ",", "data", ")", "{", "var", "path", ",", "rejectMsg", ";", "if", "(", "deviceManifestIdentifier", "&&", "feedIdentifier", "&&", "data", ")", "{", "path", "=", "this", ".", "constructPath", "...
Update a feed on a device manifest @param {String|Integer} deviceManifestIdentifier A Robin device manifest identifier @param {String|Integer} feedIdentifier A Robin feed identifier @param {Object} data A querystring object @return {Function} A Pro...
[ "Update", "a", "feed", "on", "a", "device", "manifest" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/devicemanifests.js#L117-L128
train
robinpowered/robin-js-sdk-public
lib/api/modules/devicemanifests.js
function (deviceManifestIdentifier, feedIdentifier) { var path; if (deviceManifestIdentifier && feedIdentifier) { path = this.constructPath(constants.DEVICE_MANIFESTS, deviceManifestIdentifier, constants.FEEDS, feedIdentifier); return this.Core.DELETE(path);...
javascript
function (deviceManifestIdentifier, feedIdentifier) { var path; if (deviceManifestIdentifier && feedIdentifier) { path = this.constructPath(constants.DEVICE_MANIFESTS, deviceManifestIdentifier, constants.FEEDS, feedIdentifier); return this.Core.DELETE(path);...
[ "function", "(", "deviceManifestIdentifier", ",", "feedIdentifier", ")", "{", "var", "path", ";", "if", "(", "deviceManifestIdentifier", "&&", "feedIdentifier", ")", "{", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "DEVICE_MANIFESTS", ",", ...
Delete a feed from a device manifest @param {String|Integer} deviceManifestIdentifier A Robin device manifest identifier @param {String|Integer} feedIdentifier A Robin feed identifier @return {Function} A Promise
[ "Delete", "a", "feed", "from", "a", "device", "manifest" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/devicemanifests.js#L136-L145
train
robinpowered/robin-js-sdk-public
lib/api/modules/devicemanifests.js
function (deviceManifestIdentifier, deviceIdentifier, params) { var path; if (deviceManifestIdentifier) { path = this.constructPath(constants.DEVICE_MANIFESTS, deviceManifestIdentifier, constants.DEVICES, deviceIdentifier); return this.Core.GET(path, params)...
javascript
function (deviceManifestIdentifier, deviceIdentifier, params) { var path; if (deviceManifestIdentifier) { path = this.constructPath(constants.DEVICE_MANIFESTS, deviceManifestIdentifier, constants.DEVICES, deviceIdentifier); return this.Core.GET(path, params)...
[ "function", "(", "deviceManifestIdentifier", ",", "deviceIdentifier", ",", "params", ")", "{", "var", "path", ";", "if", "(", "deviceManifestIdentifier", ")", "{", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "DEVICE_MANIFESTS", ",", "device...
Get all the devices for a device manifest or a particular device identified by `deviceIdentifier` @param {String|Integer} deviceManifestIdentifier A Robin device manifest identifier @param {String|Integer|undefined} deviceIdentifier A Robin device identifier @param {Object|undefined} params...
[ "Get", "all", "the", "devices", "for", "a", "device", "manifest", "or", "a", "particular", "device", "identified", "by", "deviceIdentifier" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/devicemanifests.js#L160-L169
train
robinpowered/robin-js-sdk-public
lib/api/modules/devices.js
function (identifier, params) { var path = this.constructPath(constants.DEVICES, identifier); return this.Core.GET(path, params); }
javascript
function (identifier, params) { var path = this.constructPath(constants.DEVICES, identifier); return this.Core.GET(path, params); }
[ "function", "(", "identifier", ",", "params", ")", "{", "var", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "DEVICES", ",", "identifier", ")", ";", "return", "this", ".", "Core", ".", "GET", "(", "path", ",", "params", ")", ";", ...
Get all the devices or a particular device identified by the `identifier` parameter @param {String|Integer|undefined} identifier A Robin device identifier @param {Object|undefined} params A querystring object @return {Function} A Promise
[ "Get", "all", "the", "devices", "or", "a", "particular", "device", "identified", "by", "the", "identifier", "parameter" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/devices.js#L20-L23
train
robinpowered/robin-js-sdk-public
lib/api/modules/devices.js
function (identifier) { var path; if (identifier) { path = this.constructPath(constants.DEVICES, identifier); return this.Core.DELETE(path); } else { return this.rejectRequest('Bad Request: A device identifier is required.'); } }
javascript
function (identifier) { var path; if (identifier) { path = this.constructPath(constants.DEVICES, identifier); return this.Core.DELETE(path); } else { return this.rejectRequest('Bad Request: A device identifier is required.'); } }
[ "function", "(", "identifier", ")", "{", "var", "path", ";", "if", "(", "identifier", ")", "{", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "DEVICES", ",", "identifier", ")", ";", "return", "this", ".", "Core", ".", "DELETE", "(",...
Delete a device @param {String|Integer} identifier A Robin device identifier @return {Function} A Promise
[ "Delete", "a", "device" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/devices.js#L61-L69
train
robinpowered/robin-js-sdk-public
lib/api/modules/devices.js
function (deviceIdentifier, identifierURN, params) { var path; if (deviceIdentifier) { path = this.constructPath(constants.DEVICES, deviceIdentifier, constants.IDENTIFIERS, identifierURN); return this.Core.GET(path, params); } else { return this.rejectRequest('Bad Request: A de...
javascript
function (deviceIdentifier, identifierURN, params) { var path; if (deviceIdentifier) { path = this.constructPath(constants.DEVICES, deviceIdentifier, constants.IDENTIFIERS, identifierURN); return this.Core.GET(path, params); } else { return this.rejectRequest('Bad Request: A de...
[ "function", "(", "deviceIdentifier", ",", "identifierURN", ",", "params", ")", "{", "var", "path", ";", "if", "(", "deviceIdentifier", ")", "{", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "DEVICES", ",", "deviceIdentifier", ",", "const...
Get all the identifiers for a device or a particular identifier identified by `identifierURN` @param {String|Integer} deviceIdentifier A Robin device identifier @param {String|Integer|undefined} identifierURN A Robin feed identifier @param {Object|undefined} params A querystring object...
[ "Get", "all", "the", "identifiers", "for", "a", "device", "or", "a", "particular", "identifier", "identified", "by", "identifierURN" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/devices.js#L83-L91
train
robinpowered/robin-js-sdk-public
lib/api/modules/devices.js
function (deviceIdentifier, data) { var path; if (deviceIdentifier) { path = this.constructPath(constants.DEVICES, deviceIdentifier, constants.IDENTIFIERS); return this.Core.POST(path, data); } else { return this.rejectRequest('Bad Request: A device identifier and a data object...
javascript
function (deviceIdentifier, data) { var path; if (deviceIdentifier) { path = this.constructPath(constants.DEVICES, deviceIdentifier, constants.IDENTIFIERS); return this.Core.POST(path, data); } else { return this.rejectRequest('Bad Request: A device identifier and a data object...
[ "function", "(", "deviceIdentifier", ",", "data", ")", "{", "var", "path", ";", "if", "(", "deviceIdentifier", ")", "{", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "DEVICES", ",", "deviceIdentifier", ",", "constants", ".", "IDENTIFIERS...
Create an identifier for a device @param {String|Integer} deviceIdentifier A Robin device identifier @param {Object} data A querystring object @return {Function} A Promise
[ "Create", "an", "identifier", "for", "a", "device" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/devices.js#L99-L107
train
robinpowered/robin-js-sdk-public
lib/api/modules/devices.js
function (deviceIdentifier, identifierUrn, data) { var path; if (deviceIdentifier) { path = this.constructPath(constants.DEVICES, deviceIdentifier, constants.IDENTIFIERS, identifierUrn); return this.Core.PATCH(path, data); } else { return this.rejectRequest('Bad Request: A devi...
javascript
function (deviceIdentifier, identifierUrn, data) { var path; if (deviceIdentifier) { path = this.constructPath(constants.DEVICES, deviceIdentifier, constants.IDENTIFIERS, identifierUrn); return this.Core.PATCH(path, data); } else { return this.rejectRequest('Bad Request: A devi...
[ "function", "(", "deviceIdentifier", ",", "identifierUrn", ",", "data", ")", "{", "var", "path", ";", "if", "(", "deviceIdentifier", ")", "{", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "DEVICES", ",", "deviceIdentifier", ",", "constan...
Add an identifier for a device @param {String|Integer} deviceIdentifier A Robin device identifier @param {String|Integer} identifierUrn A Robin identifier URN @param {Object} data A querystring object @return {Function} A Promise
[ "Add", "an", "identifier", "for", "a", "device" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/devices.js#L116-L124
train
robinpowered/robin-js-sdk-public
lib/api/modules/devices.js
function (deviceIdentifier, identifierUrn) { var path; if (deviceIdentifier && identifierUrn) { path = this.constructPath(constants.DEVICES, deviceIdentifier, constants.IDENTIFIERS, identifierUrn); return this.Core.DELETE(path); } else { return this.rejectRequest('Bad Request: ...
javascript
function (deviceIdentifier, identifierUrn) { var path; if (deviceIdentifier && identifierUrn) { path = this.constructPath(constants.DEVICES, deviceIdentifier, constants.IDENTIFIERS, identifierUrn); return this.Core.DELETE(path); } else { return this.rejectRequest('Bad Request: ...
[ "function", "(", "deviceIdentifier", ",", "identifierUrn", ")", "{", "var", "path", ";", "if", "(", "deviceIdentifier", "&&", "identifierUrn", ")", "{", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "DEVICES", ",", "deviceIdentifier", ",", ...
Delete an identifier from a device @param {String|Integer} deviceIdentifier A Robin device identifier @param {String|Integer} identifierUrn A Robin identifier URN @return {Function} A Promise
[ "Delete", "an", "identifier", "from", "a", "device" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/devices.js#L132-L140
train
robinpowered/robin-js-sdk-public
lib/api/modules/devices.js
function (deviceIdentifier, channelIdentifier, params) { var path; if (deviceIdentifier) { path = this.constructPath(constants.DEVICES, deviceIdentifier, constants.CHANNELS, channelIdentifier); return this.Core.GET(path, params); } else { return this.rejectRequest('Bad Request:...
javascript
function (deviceIdentifier, channelIdentifier, params) { var path; if (deviceIdentifier) { path = this.constructPath(constants.DEVICES, deviceIdentifier, constants.CHANNELS, channelIdentifier); return this.Core.GET(path, params); } else { return this.rejectRequest('Bad Request:...
[ "function", "(", "deviceIdentifier", ",", "channelIdentifier", ",", "params", ")", "{", "var", "path", ";", "if", "(", "deviceIdentifier", ")", "{", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "DEVICES", ",", "deviceIdentifier", ",", "c...
Get all the channels for a device or a particular channel identified by `channelIdentifier` @param {String|Integer} deviceIdentifier A Robin device identifier @param {String|Integer|undefined} channelIdentifier A Robin channel identifier @param {Object|undefined} params A querystring ob...
[ "Get", "all", "the", "channels", "for", "a", "device", "or", "a", "particular", "channel", "identified", "by", "channelIdentifier" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/devices.js#L155-L163
train
robinpowered/robin-js-sdk-public
lib/api/modules/devices.js
function (deviceIdentifier, channelIdentifier, data) { var path, rejectMsg; if (deviceIdentifier && channelIdentifier && data) { path = this.constructPath(constants.DEVICES, deviceIdentifier, constants.CHANNELS, channelIdentifier); return this.Core.PATCH(path, data); } else {...
javascript
function (deviceIdentifier, channelIdentifier, data) { var path, rejectMsg; if (deviceIdentifier && channelIdentifier && data) { path = this.constructPath(constants.DEVICES, deviceIdentifier, constants.CHANNELS, channelIdentifier); return this.Core.PATCH(path, data); } else {...
[ "function", "(", "deviceIdentifier", ",", "channelIdentifier", ",", "data", ")", "{", "var", "path", ",", "rejectMsg", ";", "if", "(", "deviceIdentifier", "&&", "channelIdentifier", "&&", "data", ")", "{", "path", "=", "this", ".", "constructPath", "(", "con...
Update a feed on a channel @param {String|Integer} deviceIdentifier A Robin device identifier @param {String|Integer} channelIdentifier A Robin channel identifier @param {Object} data A querystring object @return {Function} A promise
[ "Update", "a", "feed", "on", "a", "channel" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/devices.js#L188-L198
train
robinpowered/robin-js-sdk-public
lib/api/modules/devices.js
function (deviceIdentifier, channelIdentifier) { var path; if (deviceIdentifier && channelIdentifier) { path = this.constructPath(constants.DEVICES, deviceIdentifier, constants.CHANNELS, channelIdentifier); return this.Core.DELETE(path); } else { return this.rejectRequest('Bad ...
javascript
function (deviceIdentifier, channelIdentifier) { var path; if (deviceIdentifier && channelIdentifier) { path = this.constructPath(constants.DEVICES, deviceIdentifier, constants.CHANNELS, channelIdentifier); return this.Core.DELETE(path); } else { return this.rejectRequest('Bad ...
[ "function", "(", "deviceIdentifier", ",", "channelIdentifier", ")", "{", "var", "path", ";", "if", "(", "deviceIdentifier", "&&", "channelIdentifier", ")", "{", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "DEVICES", ",", "deviceIdentifier",...
Delete a channel from a device @param {String|Integer} deviceIdentifier A Robin device identifier @param {String|Integer} channelIdentifier A Robin channel identifier @return {Function} A Promise
[ "Delete", "a", "channel", "from", "a", "device" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/devices.js#L206-L214
train
robinpowered/robin-js-sdk-public
lib/api/modules/channels.js
function (identifier, params) { var path = this.constructPath(constants.CHANNELS, identifier); return this.Core.GET(path, params); }
javascript
function (identifier, params) { var path = this.constructPath(constants.CHANNELS, identifier); return this.Core.GET(path, params); }
[ "function", "(", "identifier", ",", "params", ")", "{", "var", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "CHANNELS", ",", "identifier", ")", ";", "return", "this", ".", "Core", ".", "GET", "(", "path", ",", "params", ")", ";", ...
Get all the channels or a particular channel identified by the `identifier` parameter @param {String|Integer|undefined} identifier A Robin channel identifier @param {Object|undefined} params A querystring object @return {Function} A Promise
[ "Get", "all", "the", "channels", "or", "a", "particular", "channel", "identified", "by", "the", "identifier", "parameter" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/channels.js#L20-L23
train
robinpowered/robin-js-sdk-public
lib/api/modules/channels.js
function (data) { var path; if (data) { path = this.constructPath(constants.CHANNELS); return this.Core.POST(path, data); } else { return this.rejectRequest('Bad Request: A data object is required.'); } }
javascript
function (data) { var path; if (data) { path = this.constructPath(constants.CHANNELS); return this.Core.POST(path, data); } else { return this.rejectRequest('Bad Request: A data object is required.'); } }
[ "function", "(", "data", ")", "{", "var", "path", ";", "if", "(", "data", ")", "{", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "CHANNELS", ")", ";", "return", "this", ".", "Core", ".", "POST", "(", "path", ",", "data", ")", ...
Create a channel @param {Object} data A data object @return {Function} A Promise
[ "Create", "a", "channel" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/channels.js#L30-L38
train
robinpowered/robin-js-sdk-public
lib/api/modules/channels.js
function (identifier) { var path; if (identifier) { path = this.constructPath(constants.CHANNELS, identifier); return this.Core.DELETE(path); } else { return this.rejectRequest('Bad Request: A channel identifier is required.'); } }
javascript
function (identifier) { var path; if (identifier) { path = this.constructPath(constants.CHANNELS, identifier); return this.Core.DELETE(path); } else { return this.rejectRequest('Bad Request: A channel identifier is required.'); } }
[ "function", "(", "identifier", ")", "{", "var", "path", ";", "if", "(", "identifier", ")", "{", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "CHANNELS", ",", "identifier", ")", ";", "return", "this", ".", "Core", ".", "DELETE", "("...
Delete a channel @param {String|Integer} identifier A Robin channel identifier @return {Function} A Promise
[ "Delete", "a", "channel" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/channels.js#L61-L69
train
robinpowered/robin-js-sdk-public
lib/api/modules/channels.js
function (channelIdentifier, dataIdentifier, params) { var path; if (channelIdentifier) { path = this.constructPath(constants.CHANNELS, channelIdentifier, constants.DATA, dataIdentifier); return this.Core.GET(path, params); } else { return this.rejectRequest('Bad Request: A cha...
javascript
function (channelIdentifier, dataIdentifier, params) { var path; if (channelIdentifier) { path = this.constructPath(constants.CHANNELS, channelIdentifier, constants.DATA, dataIdentifier); return this.Core.GET(path, params); } else { return this.rejectRequest('Bad Request: A cha...
[ "function", "(", "channelIdentifier", ",", "dataIdentifier", ",", "params", ")", "{", "var", "path", ";", "if", "(", "channelIdentifier", ")", "{", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "CHANNELS", ",", "channelIdentifier", ",", "...
Get all the data from a channel or a particular channel data point identified by `dataIdentifier` @param {String|Integer} channelIdentifier A Robin channel identifier @param {String|Integer|undefined} dataIdentifier A Robin channel data point identifier @param {Object|undefined} params ...
[ "Get", "all", "the", "data", "from", "a", "channel", "or", "a", "particular", "channel", "data", "point", "identified", "by", "dataIdentifier" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/channels.js#L83-L91
train
robinpowered/robin-js-sdk-public
lib/api/modules/channels.js
function (channelIdentifier, dataIdentifier) { var path; if (channelIdentifier && dataIdentifier) { path = this.constructPath(constants.CHANNELS, channelIdentifier, constants.DATA, dataIdentifier); return this.Core.DELETE(path); } else { return this.rejectRequest('Bad Request: ...
javascript
function (channelIdentifier, dataIdentifier) { var path; if (channelIdentifier && dataIdentifier) { path = this.constructPath(constants.CHANNELS, channelIdentifier, constants.DATA, dataIdentifier); return this.Core.DELETE(path); } else { return this.rejectRequest('Bad Request: ...
[ "function", "(", "channelIdentifier", ",", "dataIdentifier", ")", "{", "var", "path", ";", "if", "(", "channelIdentifier", "&&", "dataIdentifier", ")", "{", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "CHANNELS", ",", "channelIdentifier", ...
Delete a data point from a channel @param {String|Integer} channelIdentifier A Robin channel identifier @param {String|Integer} dataIdentifier A Robin channel data point identifier @return {Function} A Promise
[ "Delete", "a", "data", "point", "from", "a", "channel" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/channels.js#L115-L123
train
robinpowered/robin-js-sdk-public
lib/api/modules/channels.js
function (channelIdentifier, triggerIdentifier, params) { var path; if (channelIdentifier) { path = this.constructPath(constants.CHANNELS, channelIdentifier, constants.TRIGGERS, triggerIdentifier); return this.Core.GET(path, params); } else { return this.rejectRequest('Bad Requ...
javascript
function (channelIdentifier, triggerIdentifier, params) { var path; if (channelIdentifier) { path = this.constructPath(constants.CHANNELS, channelIdentifier, constants.TRIGGERS, triggerIdentifier); return this.Core.GET(path, params); } else { return this.rejectRequest('Bad Requ...
[ "function", "(", "channelIdentifier", ",", "triggerIdentifier", ",", "params", ")", "{", "var", "path", ";", "if", "(", "channelIdentifier", ")", "{", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "CHANNELS", ",", "channelIdentifier", ",", ...
Get all the triggers on a channel or a particular channel trigger identified by `triggerIdentifier` @param {String|Integer} channelIdentifier A Robin channel identifier @param {String|Integer|undefined} triggerIdentifier A Robin channel trigger identifier @param {Object|undefined} params ...
[ "Get", "all", "the", "triggers", "on", "a", "channel", "or", "a", "particular", "channel", "trigger", "identified", "by", "triggerIdentifier" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/channels.js#L138-L146
train
robinpowered/robin-js-sdk-public
lib/api/modules/channels.js
function (channelIdentifier, data) { var path; if (channelIdentifier) { path = this.constructPath(constants.CHANNELS, channelIdentifier, constants.TRIGGERS); return this.Core.POST(path, data); } else { return this.rejectRequest('Bad Request: A channel identifier and a data obje...
javascript
function (channelIdentifier, data) { var path; if (channelIdentifier) { path = this.constructPath(constants.CHANNELS, channelIdentifier, constants.TRIGGERS); return this.Core.POST(path, data); } else { return this.rejectRequest('Bad Request: A channel identifier and a data obje...
[ "function", "(", "channelIdentifier", ",", "data", ")", "{", "var", "path", ";", "if", "(", "channelIdentifier", ")", "{", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "CHANNELS", ",", "channelIdentifier", ",", "constants", ".", "TRIGGER...
Add a trigger to a channel @param {String|Integer} channelIdentifier A Robin channel identifier @param {Object} data A querystring object @return {Function} A Promise
[ "Add", "a", "trigger", "to", "a", "channel" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/channels.js#L154-L162
train
robinpowered/robin-js-sdk-public
lib/api/modules/channels.js
function (channelIdentifier, triggerIdentifier, data) { var path, rejectMsg; if (channelIdentifier && triggerIdentifier && data) { path = this.constructPath(constants.CHANNELS, channelIdentifier, constants.TRIGGERS, triggerIdentifier); return this.Core.PATCH(path, data); } el...
javascript
function (channelIdentifier, triggerIdentifier, data) { var path, rejectMsg; if (channelIdentifier && triggerIdentifier && data) { path = this.constructPath(constants.CHANNELS, channelIdentifier, constants.TRIGGERS, triggerIdentifier); return this.Core.PATCH(path, data); } el...
[ "function", "(", "channelIdentifier", ",", "triggerIdentifier", ",", "data", ")", "{", "var", "path", ",", "rejectMsg", ";", "if", "(", "channelIdentifier", "&&", "triggerIdentifier", "&&", "data", ")", "{", "path", "=", "this", ".", "constructPath", "(", "c...
Update a trigger on a channel @param {String|Integer} channelIdentifier A Robin channel identifier @param {String|Integer} triggerIdentifier A Robin channel trigger identifier @param {Object} data A querystring object @return {Function} A Promise
[ "Update", "a", "trigger", "on", "a", "channel" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/channels.js#L171-L181
train
robinpowered/robin-js-sdk-public
lib/api/modules/channels.js
function (channelIdentifier, triggerIdentifier) { var path; if (channelIdentifier && triggerIdentifier) { path = this.constructPath(constants.CHANNELS, channelIdentifier, constants.TRIGGERS, triggerIdentifier); return this.Core.DELETE(path); } else { return this.rejectRequest('...
javascript
function (channelIdentifier, triggerIdentifier) { var path; if (channelIdentifier && triggerIdentifier) { path = this.constructPath(constants.CHANNELS, channelIdentifier, constants.TRIGGERS, triggerIdentifier); return this.Core.DELETE(path); } else { return this.rejectRequest('...
[ "function", "(", "channelIdentifier", ",", "triggerIdentifier", ")", "{", "var", "path", ";", "if", "(", "channelIdentifier", "&&", "triggerIdentifier", ")", "{", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "CHANNELS", ",", "channelIdentifi...
Delete a trigger from a channel @param {String|Integer} channelIdentifier A Robin channel identifier @param {String|Integer} triggerIdentifier A Robin channel data point identifier @return {Function} A Promise
[ "Delete", "a", "trigger", "from", "a", "channel" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/channels.js#L189-L197
train
robinpowered/robin-js-sdk-public
lib/api/modules/organizations.js
function (orgIdOrSlug, params) { var path = this.constructPath(constants.ORGANIZATIONS, orgIdOrSlug); return this.Core.GET(path, params); }
javascript
function (orgIdOrSlug, params) { var path = this.constructPath(constants.ORGANIZATIONS, orgIdOrSlug); return this.Core.GET(path, params); }
[ "function", "(", "orgIdOrSlug", ",", "params", ")", "{", "var", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "ORGANIZATIONS", ",", "orgIdOrSlug", ")", ";", "return", "this", ".", "Core", ".", "GET", "(", "path", ",", "params", ")", ...
Get all the organizations or a particular organization identified by the `orgIdOrSlug` parameter @param {String|Integer|undefined} orgIdOrSlug A Robin organization id or slug @param {Object|undefined} params A querystring object @return {Function} A Promise
[ "Get", "all", "the", "organizations", "or", "a", "particular", "organization", "identified", "by", "the", "orgIdOrSlug", "parameter" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/organizations.js#L20-L23
train
robinpowered/robin-js-sdk-public
lib/api/modules/organizations.js
function (orgIdOrSlug, data) { var path; if (orgIdOrSlug && data) { path = this.constructPath(constants.ORGANIZATIONS, orgIdOrSlug); return this.Core.PATCH(path, data); } else { return this.rejectRequest('Bad Request: An organization id or slug and a data object are required.'); } }
javascript
function (orgIdOrSlug, data) { var path; if (orgIdOrSlug && data) { path = this.constructPath(constants.ORGANIZATIONS, orgIdOrSlug); return this.Core.PATCH(path, data); } else { return this.rejectRequest('Bad Request: An organization id or slug and a data object are required.'); } }
[ "function", "(", "orgIdOrSlug", ",", "data", ")", "{", "var", "path", ";", "if", "(", "orgIdOrSlug", "&&", "data", ")", "{", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "ORGANIZATIONS", ",", "orgIdOrSlug", ")", ";", "return", "this"...
Update an organization @param {String|Integer|undefined} orgIdOrSlug A Robin organization id or slug @param {Object} data A data object @return {Function} A Promise
[ "Update", "an", "organization" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/organizations.js#L46-L54
train
robinpowered/robin-js-sdk-public
lib/api/modules/organizations.js
function (orgIdOrSlug) { var path; if (orgIdOrSlug) { path = this.constructPath(constants.ORGANIZATIONS, orgIdOrSlug); return this.Core.DELETE(path); } else { return this.rejectRequest('Bad Request: An organization id or slug is required.'); } }
javascript
function (orgIdOrSlug) { var path; if (orgIdOrSlug) { path = this.constructPath(constants.ORGANIZATIONS, orgIdOrSlug); return this.Core.DELETE(path); } else { return this.rejectRequest('Bad Request: An organization id or slug is required.'); } }
[ "function", "(", "orgIdOrSlug", ")", "{", "var", "path", ";", "if", "(", "orgIdOrSlug", ")", "{", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "ORGANIZATIONS", ",", "orgIdOrSlug", ")", ";", "return", "this", ".", "Core", ".", "DELETE...
Delete an organization @param {String|Integer} orgIdOrSlug A Robin organization id or slug @return {Function} A Promise
[ "Delete", "an", "organization" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/organizations.js#L61-L69
train
robinpowered/robin-js-sdk-public
lib/api/modules/organizations.js
function (orgIdOrSlug, userId, params) { var path; if (orgIdOrSlug) { path = this.constructPath(constants.ORGANIZATIONS, orgIdOrSlug, constants.USERS, userId); return this.Core.GET(path); } else { return this.rejectRequest('Bad Request: An organization id or slug is required.')...
javascript
function (orgIdOrSlug, userId, params) { var path; if (orgIdOrSlug) { path = this.constructPath(constants.ORGANIZATIONS, orgIdOrSlug, constants.USERS, userId); return this.Core.GET(path); } else { return this.rejectRequest('Bad Request: An organization id or slug is required.')...
[ "function", "(", "orgIdOrSlug", ",", "userId", ",", "params", ")", "{", "var", "path", ";", "if", "(", "orgIdOrSlug", ")", "{", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "ORGANIZATIONS", ",", "orgIdOrSlug", ",", "constants", ".", ...
Get an organizations users or a particular user identified by `userId` @param {String|Integer} orgIdOrSlug A Robin organization id or slug @param {String|Integer|undefined} userId A Robin user id @param {Object|undefined} params A querystring object @return {Function} ...
[ "Get", "an", "organizations", "users", "or", "a", "particular", "user", "identified", "by", "userId" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/organizations.js#L83-L91
train
robinpowered/robin-js-sdk-public
lib/api/modules/organizations.js
function (orgIdOrSlug, userId, data) { var path, rejectMsg; if (orgIdOrSlug && userId && data) { path = this.constructPath(constants.ORGANIZATIONS, orgIdOrSlug, constants.USERS, userId); return this.Core.PATCH(path, data); } else { rejectMsg = 'Bad Request: An organiz...
javascript
function (orgIdOrSlug, userId, data) { var path, rejectMsg; if (orgIdOrSlug && userId && data) { path = this.constructPath(constants.ORGANIZATIONS, orgIdOrSlug, constants.USERS, userId); return this.Core.PATCH(path, data); } else { rejectMsg = 'Bad Request: An organiz...
[ "function", "(", "orgIdOrSlug", ",", "userId", ",", "data", ")", "{", "var", "path", ",", "rejectMsg", ";", "if", "(", "orgIdOrSlug", "&&", "userId", "&&", "data", ")", "{", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "ORGANIZATIONS...
Update a user in an organization @param {String|Integer} orgIdOrSlug A Robin organization id or slug @param {String|Integer} userId A Robin user id @param {Object} data A data object @return {Function} A promise
[ "Update", "a", "user", "in", "an", "organization" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/organizations.js#L116-L126
train
robinpowered/robin-js-sdk-public
lib/api/modules/organizations.js
function (orgIdOrSlug, data) { var path, rejectMsg; if (orgIdOrSlug && data) { path = this.constructPath(constants.ORGANIZATIONS, orgIdOrSlug, constants.USERS); return this.Core.POST(path, data); } else { rejectMsg = 'Bad Request: An organization id or slug and data i...
javascript
function (orgIdOrSlug, data) { var path, rejectMsg; if (orgIdOrSlug && data) { path = this.constructPath(constants.ORGANIZATIONS, orgIdOrSlug, constants.USERS); return this.Core.POST(path, data); } else { rejectMsg = 'Bad Request: An organization id or slug and data i...
[ "function", "(", "orgIdOrSlug", ",", "data", ")", "{", "var", "path", ",", "rejectMsg", ";", "if", "(", "orgIdOrSlug", "&&", "data", ")", "{", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "ORGANIZATIONS", ",", "orgIdOrSlug", ",", "co...
Create a channel in an organization @param {String|Integer} orgIdOrSlug A Robin organization id or slug @param {Object} data A data object @return {Function} A promise
[ "Create", "a", "channel", "in", "an", "organization" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/organizations.js#L324-L334
train
TooTallNate/node-stream-parser
index.js
_bytes
function _bytes (n, fn) { assert(!this._parserCallback, 'there is already a "callback" set!'); assert(isFinite(n) && n > 0, 'can only buffer a finite number of bytes > 0, got "' + n + '"'); if (!this._parserInit) init(this); debug('buffering %o bytes', n); this._parserBytesLeft = n; this._parserCallback = f...
javascript
function _bytes (n, fn) { assert(!this._parserCallback, 'there is already a "callback" set!'); assert(isFinite(n) && n > 0, 'can only buffer a finite number of bytes > 0, got "' + n + '"'); if (!this._parserInit) init(this); debug('buffering %o bytes', n); this._parserBytesLeft = n; this._parserCallback = f...
[ "function", "_bytes", "(", "n", ",", "fn", ")", "{", "assert", "(", "!", "this", ".", "_parserCallback", ",", "'there is already a \"callback\" set!'", ")", ";", "assert", "(", "isFinite", "(", "n", ")", "&&", "n", ">", "0", ",", "'can only buffer a finite n...
Buffers `n` bytes and then invokes `fn` once that amount has been collected. @param {Number} n the number of bytes to buffer @param {Function} fn callback function to invoke when `n` bytes are buffered @api public
[ "Buffers", "n", "bytes", "and", "then", "invokes", "fn", "once", "that", "amount", "has", "been", "collected", "." ]
b829e8a8d85f2504ed9092e7aa20e2e3855c2ee9
https://github.com/TooTallNate/node-stream-parser/blob/b829e8a8d85f2504ed9092e7aa20e2e3855c2ee9/index.js#L96-L104
train
TooTallNate/node-stream-parser
index.js
_skipBytes
function _skipBytes (n, fn) { assert(!this._parserCallback, 'there is already a "callback" set!'); assert(n > 0, 'can only skip > 0 bytes, got "' + n + '"'); if (!this._parserInit) init(this); debug('skipping %o bytes', n); this._parserBytesLeft = n; this._parserCallback = fn; this._parserState = SKIPPING...
javascript
function _skipBytes (n, fn) { assert(!this._parserCallback, 'there is already a "callback" set!'); assert(n > 0, 'can only skip > 0 bytes, got "' + n + '"'); if (!this._parserInit) init(this); debug('skipping %o bytes', n); this._parserBytesLeft = n; this._parserCallback = fn; this._parserState = SKIPPING...
[ "function", "_skipBytes", "(", "n", ",", "fn", ")", "{", "assert", "(", "!", "this", ".", "_parserCallback", ",", "'there is already a \"callback\" set!'", ")", ";", "assert", "(", "n", ">", "0", ",", "'can only skip > 0 bytes, got \"'", "+", "n", "+", "'\"'",...
Skips over the next `n` bytes, then invokes `fn` once that amount has been discarded. @param {Number} n the number of bytes to discard @param {Function} fn callback function to invoke when `n` bytes have been skipped @api public
[ "Skips", "over", "the", "next", "n", "bytes", "then", "invokes", "fn", "once", "that", "amount", "has", "been", "discarded", "." ]
b829e8a8d85f2504ed9092e7aa20e2e3855c2ee9
https://github.com/TooTallNate/node-stream-parser/blob/b829e8a8d85f2504ed9092e7aa20e2e3855c2ee9/index.js#L115-L123
train
TooTallNate/node-stream-parser
index.js
_passthrough
function _passthrough (n, fn) { assert(!this._parserCallback, 'There is already a "callback" set!'); assert(n > 0, 'can only pass through > 0 bytes, got "' + n + '"'); if (!this._parserInit) init(this); debug('passing through %o bytes', n); this._parserBytesLeft = n; this._parserCallback = fn; this._parse...
javascript
function _passthrough (n, fn) { assert(!this._parserCallback, 'There is already a "callback" set!'); assert(n > 0, 'can only pass through > 0 bytes, got "' + n + '"'); if (!this._parserInit) init(this); debug('passing through %o bytes', n); this._parserBytesLeft = n; this._parserCallback = fn; this._parse...
[ "function", "_passthrough", "(", "n", ",", "fn", ")", "{", "assert", "(", "!", "this", ".", "_parserCallback", ",", "'There is already a \"callback\" set!'", ")", ";", "assert", "(", "n", ">", "0", ",", "'can only pass through > 0 bytes, got \"'", "+", "n", "+",...
Passes through `n` bytes to the readable side of this stream untouched, then invokes `fn` once that amount has been passed through. @param {Number} n the number of bytes to pass through @param {Function} fn callback function to invoke when `n` bytes have passed through @api public
[ "Passes", "through", "n", "bytes", "to", "the", "readable", "side", "of", "this", "stream", "untouched", "then", "invokes", "fn", "once", "that", "amount", "has", "been", "passed", "through", "." ]
b829e8a8d85f2504ed9092e7aa20e2e3855c2ee9
https://github.com/TooTallNate/node-stream-parser/blob/b829e8a8d85f2504ed9092e7aa20e2e3855c2ee9/index.js#L134-L142
train
TooTallNate/node-stream-parser
index.js
process
function process (stream, chunk, output, fn) { stream._parserBytesLeft -= chunk.length; debug('%o bytes left for stream piece', stream._parserBytesLeft); if (stream._parserState === BUFFERING) { // buffer stream._parserBuffers.push(chunk); stream._parserBuffered += chunk.length; } else if (stream._...
javascript
function process (stream, chunk, output, fn) { stream._parserBytesLeft -= chunk.length; debug('%o bytes left for stream piece', stream._parserBytesLeft); if (stream._parserState === BUFFERING) { // buffer stream._parserBuffers.push(chunk); stream._parserBuffered += chunk.length; } else if (stream._...
[ "function", "process", "(", "stream", ",", "chunk", ",", "output", ",", "fn", ")", "{", "stream", ".", "_parserBytesLeft", "-=", "chunk", ".", "length", ";", "debug", "(", "'%o bytes left for stream piece'", ",", "stream", ".", "_parserBytesLeft", ")", ";", ...
The internal `process` function gets called by the `data` function when something "interesting" happens. This function takes care of buffering the bytes when buffering, passing through the bytes when doing that, and invoking the user callback when the number of bytes has been reached. @api private
[ "The", "internal", "process", "function", "gets", "called", "by", "the", "data", "function", "when", "something", "interesting", "happens", ".", "This", "function", "takes", "care", "of", "buffering", "the", "bytes", "when", "buffering", "passing", "through", "t...
b829e8a8d85f2504ed9092e7aa20e2e3855c2ee9
https://github.com/TooTallNate/node-stream-parser/blob/b829e8a8d85f2504ed9092e7aa20e2e3855c2ee9/index.js#L225-L277
train
TooTallNate/node-stream-parser
index.js
trampoline
function trampoline (fn) { return function () { var result = fn.apply(this, arguments); while ('function' == typeof result) { result = result(); } return result; }; }
javascript
function trampoline (fn) { return function () { var result = fn.apply(this, arguments); while ('function' == typeof result) { result = result(); } return result; }; }
[ "function", "trampoline", "(", "fn", ")", "{", "return", "function", "(", ")", "{", "var", "result", "=", "fn", ".", "apply", "(", "this", ",", "arguments", ")", ";", "while", "(", "'function'", "==", "typeof", "result", ")", "{", "result", "=", "res...
Generic thunk-based "trampoline" helper function. @param {Function} input function @return {Function} "trampolined" function @api private
[ "Generic", "thunk", "-", "based", "trampoline", "helper", "function", "." ]
b829e8a8d85f2504ed9092e7aa20e2e3855c2ee9
https://github.com/TooTallNate/node-stream-parser/blob/b829e8a8d85f2504ed9092e7aa20e2e3855c2ee9/index.js#L289-L299
train
robinpowered/robin-js-sdk-public
lib/api/api.js
RobinApi
function RobinApi (accessToken, coreUrl, placesUrl) { if (accessToken) { RobinApi.super_.apply(this, arguments); this.setAccessToken(accessToken); this.setupCore(coreUrl); this.setupPlaces(placesUrl); this.loadApiModules(); } else { throw new TypeError('The access token is mi...
javascript
function RobinApi (accessToken, coreUrl, placesUrl) { if (accessToken) { RobinApi.super_.apply(this, arguments); this.setAccessToken(accessToken); this.setupCore(coreUrl); this.setupPlaces(placesUrl); this.loadApiModules(); } else { throw new TypeError('The access token is mi...
[ "function", "RobinApi", "(", "accessToken", ",", "coreUrl", ",", "placesUrl", ")", "{", "if", "(", "accessToken", ")", "{", "RobinApi", ".", "super_", ".", "apply", "(", "this", ",", "arguments", ")", ";", "this", ".", "setAccessToken", "(", "accessToken",...
The Robin API constructor @param {String} accessToken A Robin Access Token @param {String} coreUrl The Base URL for the Core API. @param {String} placesUrl The Base URL for the Places API
[ "The", "Robin", "API", "constructor" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/api.js#L40-L50
train
robinpowered/robin-js-sdk-public
lib/api/modules/apps.js
function (appIdOrSlug, params) { var path = this.constructPath(constants.APPS, appIdOrSlug); return this.Core.GET(path, params); }
javascript
function (appIdOrSlug, params) { var path = this.constructPath(constants.APPS, appIdOrSlug); return this.Core.GET(path, params); }
[ "function", "(", "appIdOrSlug", ",", "params", ")", "{", "var", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "APPS", ",", "appIdOrSlug", ")", ";", "return", "this", ".", "Core", ".", "GET", "(", "path", ",", "params", ")", ";", "...
Get an app @param {String|Integer|undefined} appIdOrSlug A Robin app identifier or slug @param {Object|undefnied} params A querystring object @return {Function} A Promise
[ "Get", "an", "app" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/apps.js#L20-L23
train
robinpowered/robin-js-sdk-public
lib/api/modules/apps.js
function (appIdOrSlug, data) { var path; if (appIdOrSlug && data) { path = this.constructPath(constants.APPS, appIdOrSlug); return this.Core.POST(path, data); } else { return this.rejectRequest('Bad Request: An app id or slug and a data object are required.'); } }
javascript
function (appIdOrSlug, data) { var path; if (appIdOrSlug && data) { path = this.constructPath(constants.APPS, appIdOrSlug); return this.Core.POST(path, data); } else { return this.rejectRequest('Bad Request: An app id or slug and a data object are required.'); } }
[ "function", "(", "appIdOrSlug", ",", "data", ")", "{", "var", "path", ";", "if", "(", "appIdOrSlug", "&&", "data", ")", "{", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "APPS", ",", "appIdOrSlug", ")", ";", "return", "this", ".", ...
Update an app @param {String|Integer} appIdOrSlug A Robin app identifier or slug @param {Object} data A data object @return {Function} A Promise
[ "Update", "an", "app" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/apps.js#L31-L39
train
robinpowered/robin-js-sdk-public
lib/api/modules/apps.js
function (appIdOrSlug) { var path; if (appIdOrSlug) { path = this.constructPath(constants.APPS, appIdOrSlug); return this.Core.DELETE(path); } else { return this.rejectRequest('Bad Request: An app id or slug is required.'); } }
javascript
function (appIdOrSlug) { var path; if (appIdOrSlug) { path = this.constructPath(constants.APPS, appIdOrSlug); return this.Core.DELETE(path); } else { return this.rejectRequest('Bad Request: An app id or slug is required.'); } }
[ "function", "(", "appIdOrSlug", ")", "{", "var", "path", ";", "if", "(", "appIdOrSlug", ")", "{", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "APPS", ",", "appIdOrSlug", ")", ";", "return", "this", ".", "Core", ".", "DELETE", "(",...
Delete an app @param {String|Integer} appIdOrSlug A Robin app identifier or slug @return {Function} A Promise
[ "Delete", "an", "app" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/apps.js#L46-L54
train
jimf/jasmine-diff
index.js
getType
function getType (val) { if (val === null) { return 'null' } else if (val === void 0) { return 'undefined' } return Object.prototype.toString.call(val) .replace(/^\[.+\s(.+?)]$/, '$1') .toLowerCase() }
javascript
function getType (val) { if (val === null) { return 'null' } else if (val === void 0) { return 'undefined' } return Object.prototype.toString.call(val) .replace(/^\[.+\s(.+?)]$/, '$1') .toLowerCase() }
[ "function", "getType", "(", "val", ")", "{", "if", "(", "val", "===", "null", ")", "{", "return", "'null'", "}", "else", "if", "(", "val", "===", "void", "0", ")", "{", "return", "'undefined'", "}", "return", "Object", ".", "prototype", ".", "toStrin...
Return type of given value. @param {*} val Value to identify @return {string}
[ "Return", "type", "of", "given", "value", "." ]
3e9095d00bd6a87fcd6f52eab6b9afcc9c993d82
https://github.com/jimf/jasmine-diff/blob/3e9095d00bd6a87fcd6f52eab6b9afcc9c993d82/index.js#L9-L18
train
jimf/jasmine-diff
index.js
Value
function Value (val, parent, opts) { var obj = Object.create(Value.prototype) opts = opts || {} obj.value = val obj.parent = parent obj.type = getType(val) obj.key = opts.key obj.length = opts.length !== undefined ? opts.length : (val && val.length) return obj }
javascript
function Value (val, parent, opts) { var obj = Object.create(Value.prototype) opts = opts || {} obj.value = val obj.parent = parent obj.type = getType(val) obj.key = opts.key obj.length = opts.length !== undefined ? opts.length : (val && val.length) return obj }
[ "function", "Value", "(", "val", ",", "parent", ",", "opts", ")", "{", "var", "obj", "=", "Object", ".", "create", "(", "Value", ".", "prototype", ")", "opts", "=", "opts", "||", "{", "}", "obj", ".", "value", "=", "val", "obj", ".", "parent", "=...
Value wrapper to contain state. @param {*} val Value to wrap @param {Value|null} parent Parent value @param {object} [opts] Options @param {string|number} [opts.key] Key/index if value is contained in an object/array @param {number} [opts.length] Length if value is an object/array @return {Value}
[ "Value", "wrapper", "to", "contain", "state", "." ]
3e9095d00bd6a87fcd6f52eab6b9afcc9c993d82
https://github.com/jimf/jasmine-diff/blob/3e9095d00bd6a87fcd6f52eab6b9afcc9c993d82/index.js#L30-L39
train
jimf/jasmine-diff
index.js
traverse
function traverse (value, v) { var state = {} var visitor = v.visitor var seen = [] /** * Recursively walk the value, dispatching visitor methods as values are encountered. * * @param {*} val Value * @param {Value|null} parent Parent value * @param {object} [opts] Additional options */ func...
javascript
function traverse (value, v) { var state = {} var visitor = v.visitor var seen = [] /** * Recursively walk the value, dispatching visitor methods as values are encountered. * * @param {*} val Value * @param {Value|null} parent Parent value * @param {object} [opts] Additional options */ func...
[ "function", "traverse", "(", "value", ",", "v", ")", "{", "var", "state", "=", "{", "}", "var", "visitor", "=", "v", ".", "visitor", "var", "seen", "=", "[", "]", "/**\n * Recursively walk the value, dispatching visitor methods as values are encountered.\n *\n *...
Traverse a value with a visitor object. @param {*} value Value to traverse @param {Visitor} visitor Visitor instance
[ "Traverse", "a", "value", "with", "a", "visitor", "object", "." ]
3e9095d00bd6a87fcd6f52eab6b9afcc9c993d82
https://github.com/jimf/jasmine-diff/blob/3e9095d00bd6a87fcd6f52eab6b9afcc9c993d82/index.js#L47-L117
train
jimf/jasmine-diff
index.js
prettyPrintVisitor
function prettyPrintVisitor (pp, spaces) { var visitor = {} visitor.pre = function (state) { state.result = '' state.depth = 0 } visitor.visitor = { arrayEnter: function (val, state) { if (val.key !== undefined) { state.result += repeat(state.depth * spaces, ' ') if (val.parent...
javascript
function prettyPrintVisitor (pp, spaces) { var visitor = {} visitor.pre = function (state) { state.result = '' state.depth = 0 } visitor.visitor = { arrayEnter: function (val, state) { if (val.key !== undefined) { state.result += repeat(state.depth * spaces, ' ') if (val.parent...
[ "function", "prettyPrintVisitor", "(", "pp", ",", "spaces", ")", "{", "var", "visitor", "=", "{", "}", "visitor", ".", "pre", "=", "function", "(", "state", ")", "{", "state", ".", "result", "=", "''", "state", ".", "depth", "=", "0", "}", "visitor",...
Visitor factory for pretty printing a JavaScript value. @param {function} pp Fallback pretty printer @param {number} spaces Number of spaces for indentation @return {object} Visitor instance
[ "Visitor", "factory", "for", "pretty", "printing", "a", "JavaScript", "value", "." ]
3e9095d00bd6a87fcd6f52eab6b9afcc9c993d82
https://github.com/jimf/jasmine-diff/blob/3e9095d00bd6a87fcd6f52eab6b9afcc9c993d82/index.js#L142-L216
train
jimf/jasmine-diff
index.js
createStringifier
function createStringifier (pp, spaces) { return function stringify (value) { var visitor = prettyPrintVisitor(pp, spaces) traverse(value, visitor) return visitor.result } }
javascript
function createStringifier (pp, spaces) { return function stringify (value) { var visitor = prettyPrintVisitor(pp, spaces) traverse(value, visitor) return visitor.result } }
[ "function", "createStringifier", "(", "pp", ",", "spaces", ")", "{", "return", "function", "stringify", "(", "value", ")", "{", "var", "visitor", "=", "prettyPrintVisitor", "(", "pp", ",", "spaces", ")", "traverse", "(", "value", ",", "visitor", ")", "retu...
Stringifier factory. @param {function} pp Fallback pretty printer @param {number} spaces Number of spaces for indentation @return {function}
[ "Stringifier", "factory", "." ]
3e9095d00bd6a87fcd6f52eab6b9afcc9c993d82
https://github.com/jimf/jasmine-diff/blob/3e9095d00bd6a87fcd6f52eab6b9afcc9c993d82/index.js#L225-L231
train
jimf/jasmine-diff
index.js
isDiffable
function isDiffable (val) { switch (getType(val)) { case 'array': case 'object': return true case 'string': return val.length >= 40 || (val.trim().match(/\n/g) || []).length >= 1 default: return false } }
javascript
function isDiffable (val) { switch (getType(val)) { case 'array': case 'object': return true case 'string': return val.length >= 40 || (val.trim().match(/\n/g) || []).length >= 1 default: return false } }
[ "function", "isDiffable", "(", "val", ")", "{", "switch", "(", "getType", "(", "val", ")", ")", "{", "case", "'array'", ":", "case", "'object'", ":", "return", "true", "case", "'string'", ":", "return", "val", ".", "length", ">=", "40", "||", "(", "v...
Return whether value should be diffed. @param {*} val Value to test @return {boolean}
[ "Return", "whether", "value", "should", "be", "diffed", "." ]
3e9095d00bd6a87fcd6f52eab6b9afcc9c993d82
https://github.com/jimf/jasmine-diff/blob/3e9095d00bd6a87fcd6f52eab6b9afcc9c993d82/index.js#L239-L251
train
jimf/jasmine-diff
index.js
lpad
function lpad (str, width) { while (String(str).length < width) { str = ' ' + str } return str }
javascript
function lpad (str, width) { while (String(str).length < width) { str = ' ' + str } return str }
[ "function", "lpad", "(", "str", ",", "width", ")", "{", "while", "(", "String", "(", "str", ")", ".", "length", "<", "width", ")", "{", "str", "=", "' '", "+", "str", "}", "return", "str", "}" ]
Left-pad utility. @param {string} str String to pad @param {number} width Total desired width of string @return {string}
[ "Left", "-", "pad", "utility", "." ]
3e9095d00bd6a87fcd6f52eab6b9afcc9c993d82
https://github.com/jimf/jasmine-diff/blob/3e9095d00bd6a87fcd6f52eab6b9afcc9c993d82/index.js#L260-L265
train
jimf/jasmine-diff
index.js
unifiedDiff
function unifiedDiff (actual, expected, formatAdd, formatRem) { return [ formatAdd('+ expected'), formatRem('- actual'), '' ] .concat( diff.createPatch('string', actual, expected) .split('\n') .slice(4) .filter(function (line) { return line[0] === '+' || line[...
javascript
function unifiedDiff (actual, expected, formatAdd, formatRem) { return [ formatAdd('+ expected'), formatRem('- actual'), '' ] .concat( diff.createPatch('string', actual, expected) .split('\n') .slice(4) .filter(function (line) { return line[0] === '+' || line[...
[ "function", "unifiedDiff", "(", "actual", ",", "expected", ",", "formatAdd", ",", "formatRem", ")", "{", "return", "[", "formatAdd", "(", "'+ expected'", ")", ",", "formatRem", "(", "'- actual'", ")", ",", "''", "]", ".", "concat", "(", "diff", ".", "cre...
Return unified diff of actual vs expected. @param {*} actual Actual value @param {*} expected Expected value @param {function} formatAdd Addition formatter @param {function} formatRem Removal formatter @return {string}
[ "Return", "unified", "diff", "of", "actual", "vs", "expected", "." ]
3e9095d00bd6a87fcd6f52eab6b9afcc9c993d82
https://github.com/jimf/jasmine-diff/blob/3e9095d00bd6a87fcd6f52eab6b9afcc9c993d82/index.js#L318-L336
train
jimf/jasmine-diff
index.js
formatLinesWith
function formatLinesWith (formatter, str) { return str .split('\n') .map(function (line) { return line.length ? formatter(line) : '' }) .join('\n') }
javascript
function formatLinesWith (formatter, str) { return str .split('\n') .map(function (line) { return line.length ? formatter(line) : '' }) .join('\n') }
[ "function", "formatLinesWith", "(", "formatter", ",", "str", ")", "{", "return", "str", ".", "split", "(", "'\\n'", ")", ".", "map", "(", "function", "(", "line", ")", "{", "return", "line", ".", "length", "?", "formatter", "(", "line", ")", ":", "''...
Run a transformation function over the lines within a string and return the result. @param {function} formatter Formatter function @param {string} str String to format @return {string}
[ "Run", "a", "transformation", "function", "over", "the", "lines", "within", "a", "string", "and", "return", "the", "result", "." ]
3e9095d00bd6a87fcd6f52eab6b9afcc9c993d82
https://github.com/jimf/jasmine-diff/blob/3e9095d00bd6a87fcd6f52eab6b9afcc9c993d82/index.js#L346-L353
train
jimf/jasmine-diff
index.js
inlineDiff
function inlineDiff (actual, expected, formatAdd, formatRem) { var result = diff.diffWordsWithSpace(actual, expected) .map(function (line, idx) { if (line.added) { return formatLinesWith(formatAdd, line.value) } return line.removed ? formatLinesWith(formatRem, line.value) : line.value ...
javascript
function inlineDiff (actual, expected, formatAdd, formatRem) { var result = diff.diffWordsWithSpace(actual, expected) .map(function (line, idx) { if (line.added) { return formatLinesWith(formatAdd, line.value) } return line.removed ? formatLinesWith(formatRem, line.value) : line.value ...
[ "function", "inlineDiff", "(", "actual", ",", "expected", ",", "formatAdd", ",", "formatRem", ")", "{", "var", "result", "=", "diff", ".", "diffWordsWithSpace", "(", "actual", ",", "expected", ")", ".", "map", "(", "function", "(", "line", ",", "idx", ")...
Return inline diff of actual vs expected. @param {*} actual Actual value @param {*} expected Expected value @param {function} formatAdd Addition formatter @param {function} formatRem Removal formatter @return {string}
[ "Return", "inline", "diff", "of", "actual", "vs", "expected", "." ]
3e9095d00bd6a87fcd6f52eab6b9afcc9c993d82
https://github.com/jimf/jasmine-diff/blob/3e9095d00bd6a87fcd6f52eab6b9afcc9c993d82/index.js#L364-L384
train
iceddev/matchmedia
index.js
Mql
function Mql(query, values){ var self = this; if(dynamicMatch){ var mql = dynamicMatch.call(window, query); this.matches = mql.matches; this.media = mql.media; // TODO: is there a time it makes sense to remove this listener? mql.addListener(update); } else { this.matches = staticMatch(quer...
javascript
function Mql(query, values){ var self = this; if(dynamicMatch){ var mql = dynamicMatch.call(window, query); this.matches = mql.matches; this.media = mql.media; // TODO: is there a time it makes sense to remove this listener? mql.addListener(update); } else { this.matches = staticMatch(quer...
[ "function", "Mql", "(", "query", ",", "values", ")", "{", "var", "self", "=", "this", ";", "if", "(", "dynamicMatch", ")", "{", "var", "mql", "=", "dynamicMatch", ".", "call", "(", "window", ",", "query", ")", ";", "this", ".", "matches", "=", "mql...
our fake MediaQueryList
[ "our", "fake", "MediaQueryList" ]
96eee43707a7414dca326c6527a75a78b1c71010
https://github.com/iceddev/matchmedia/blob/96eee43707a7414dca326c6527a75a78b1c71010/index.js#L7-L45
train