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
vibhor1997a/nodejs-open-file-explorer
lib/linux.js
openExplorerinLinux
function openExplorerinLinux(path, callback) { path = path || '/'; let p = spawn('xdg-open', [path]); p.on('error', (err) => { p.kill(); return callback(err); }); }
javascript
function openExplorerinLinux(path, callback) { path = path || '/'; let p = spawn('xdg-open', [path]); p.on('error', (err) => { p.kill(); return callback(err); }); }
[ "function", "openExplorerinLinux", "(", "path", ",", "callback", ")", "{", "path", "=", "path", "||", "'/'", ";", "let", "p", "=", "spawn", "(", "'xdg-open'", ",", "[", "path", "]", ")", ";", "p", ".", "on", "(", "'error'", ",", "(", "err", ")", ...
Opens the Explorer and executes the callback function in ubuntu like os @param {string} path The path string to be opened in the explorer @param {Function} callback Callback function to which error is passed if some error occurs
[ "Opens", "the", "Explorer", "and", "executes", "the", "callback", "function", "in", "ubuntu", "like", "os" ]
ea86151dfb85251be2f07dbbaa73eb4dce36ddb8
https://github.com/vibhor1997a/nodejs-open-file-explorer/blob/ea86151dfb85251be2f07dbbaa73eb4dce36ddb8/lib/linux.js#L8-L15
train
vibhor1997a/nodejs-open-file-explorer
index.js
openExplorer
function openExplorer(path, callback) { if (osType == 'Windows_NT') { openExplorerinWindows(path, callback); } else if (osType == 'Darwin') { openExplorerinMac(path, callback); } else { openExplorerinLinux(path, callback); } }
javascript
function openExplorer(path, callback) { if (osType == 'Windows_NT') { openExplorerinWindows(path, callback); } else if (osType == 'Darwin') { openExplorerinMac(path, callback); } else { openExplorerinLinux(path, callback); } }
[ "function", "openExplorer", "(", "path", ",", "callback", ")", "{", "if", "(", "osType", "==", "'Windows_NT'", ")", "{", "openExplorerinWindows", "(", "path", ",", "callback", ")", ";", "}", "else", "if", "(", "osType", "==", "'Darwin'", ")", "{", "openE...
Opens the Explorer and executes the callback function @param {string} path The path string to be opened in the explorer @param {Function} callback Callback function to which error is passed if some error occurs
[ "Opens", "the", "Explorer", "and", "executes", "the", "callback", "function" ]
ea86151dfb85251be2f07dbbaa73eb4dce36ddb8
https://github.com/vibhor1997a/nodejs-open-file-explorer/blob/ea86151dfb85251be2f07dbbaa73eb4dce36ddb8/index.js#L12-L22
train
vibhor1997a/nodejs-open-file-explorer
lib/mac.js
openExplorerinMac
function openExplorerinMac(path, callback) { path = path || '/'; let p = spawn('open', [path]); p.on('error', (err) => { p.kill(); return callback(err); }); }
javascript
function openExplorerinMac(path, callback) { path = path || '/'; let p = spawn('open', [path]); p.on('error', (err) => { p.kill(); return callback(err); }); }
[ "function", "openExplorerinMac", "(", "path", ",", "callback", ")", "{", "path", "=", "path", "||", "'/'", ";", "let", "p", "=", "spawn", "(", "'open'", ",", "[", "path", "]", ")", ";", "p", ".", "on", "(", "'error'", ",", "(", "err", ")", "=>", ...
Opens the Explorer and executes the callback function in osX @param {string} path The path string to be opened in the explorer @param {Function} callback Callback function to which error is passed if some error occurs
[ "Opens", "the", "Explorer", "and", "executes", "the", "callback", "function", "in", "osX" ]
ea86151dfb85251be2f07dbbaa73eb4dce36ddb8
https://github.com/vibhor1997a/nodejs-open-file-explorer/blob/ea86151dfb85251be2f07dbbaa73eb4dce36ddb8/lib/mac.js#L8-L15
train
vibhor1997a/nodejs-open-file-explorer
lib/win.js
openExplorerinWindows
function openExplorerinWindows(path, callback) { path = path || '='; let p = spawn('explorer', [path]); p.on('error', (err) => { p.kill(); return callback(err); }); }
javascript
function openExplorerinWindows(path, callback) { path = path || '='; let p = spawn('explorer', [path]); p.on('error', (err) => { p.kill(); return callback(err); }); }
[ "function", "openExplorerinWindows", "(", "path", ",", "callback", ")", "{", "path", "=", "path", "||", "'='", ";", "let", "p", "=", "spawn", "(", "'explorer'", ",", "[", "path", "]", ")", ";", "p", ".", "on", "(", "'error'", ",", "(", "err", ")", ...
Opens the Explorer and executes the callback function in windows os @param {string} path The path string to be opened in the explorer @param {Function} callback Callback function to which error is passed if some error occurs
[ "Opens", "the", "Explorer", "and", "executes", "the", "callback", "function", "in", "windows", "os" ]
ea86151dfb85251be2f07dbbaa73eb4dce36ddb8
https://github.com/vibhor1997a/nodejs-open-file-explorer/blob/ea86151dfb85251be2f07dbbaa73eb4dce36ddb8/lib/win.js#L8-L15
train
johnwebbcole/jscad-utils
dist/index.js
function(p1, p2) { var r = { c: 90, A: Math.abs(p2.x - p1.x), B: Math.abs(p2.y - p1.y) }; var brad = Math.atan2(r.B, r.A); r.b = this.toDegrees(brad); // r.C = Math.sqrt(Math.pow(r.B, 2) + Math.pow(r.A, 2)); r.C = r.B / Math.sin(brad); r.a = 90 - r.b; return r; }
javascript
function(p1, p2) { var r = { c: 90, A: Math.abs(p2.x - p1.x), B: Math.abs(p2.y - p1.y) }; var brad = Math.atan2(r.B, r.A); r.b = this.toDegrees(brad); // r.C = Math.sqrt(Math.pow(r.B, 2) + Math.pow(r.A, 2)); r.C = r.B / Math.sin(brad); r.a = 90 - r.b; return r; }
[ "function", "(", "p1", ",", "p2", ")", "{", "var", "r", "=", "{", "c", ":", "90", ",", "A", ":", "Math", ".", "abs", "(", "p2", ".", "x", "-", "p1", ".", "x", ")", ",", "B", ":", "Math", ".", "abs", "(", "p2", ".", "y", "-", "p1", "."...
Solve a 90 degree triangle from two points. @param {Number} p1.x Point 1 x coordinate @param {Number} p1.y Point 1 y coordinate @param {Number} p2.x Point 2 x coordinate @param {Number} p2.y Point 2 y coordinate @return {Object} A triangle object {A,B,C,a,b,c}
[ "Solve", "a", "90", "degree", "triangle", "from", "two", "points", "." ]
7c52e446aa5c001ccbb0a867a69b160da20a13e7
https://github.com/johnwebbcole/jscad-utils/blob/7c52e446aa5c001ccbb0a867a69b160da20a13e7/dist/index.js#L36-L49
train
johnwebbcole/jscad-utils
dist/index.js
function(r) { r = Object.assign(r, { C: 90 }); r.A = r.A || 90 - r.B; r.B = r.B || 90 - r.A; var arad = toRadians(r.A); // sinA = a/c // a = c * sinA // tanA = a/b // a = b * tanA r.a = r.a || (r.c ? r.c * Math.sin(arad) : r.b * Math.tan(arad)); // sinA = a/c ...
javascript
function(r) { r = Object.assign(r, { C: 90 }); r.A = r.A || 90 - r.B; r.B = r.B || 90 - r.A; var arad = toRadians(r.A); // sinA = a/c // a = c * sinA // tanA = a/b // a = b * tanA r.a = r.a || (r.c ? r.c * Math.sin(arad) : r.b * Math.tan(arad)); // sinA = a/c ...
[ "function", "(", "r", ")", "{", "r", "=", "Object", ".", "assign", "(", "r", ",", "{", "C", ":", "90", "}", ")", ";", "r", ".", "A", "=", "r", ".", "A", "||", "90", "-", "r", ".", "B", ";", "r", ".", "B", "=", "r", ".", "B", "||", "...
Solve a partial triangle object. Angles are in degrees. Angle `C` is set to 90 degrees. @param {Number} r.a Length of side `a` @param {Number} r.A Angle `A` in degrees @param {Number} r.b Length of side `b` @param {Number} r.B Angle `B` in degrees @param {Number} r.c Length of side `c` @return {Object} A solved ...
[ "Solve", "a", "partial", "triangle", "object", ".", "Angles", "are", "in", "degrees", ".", "Angle", "C", "is", "set", "to", "90", "degrees", "." ]
7c52e446aa5c001ccbb0a867a69b160da20a13e7
https://github.com/johnwebbcole/jscad-utils/blob/7c52e446aa5c001ccbb0a867a69b160da20a13e7/dist/index.js#L61-L84
train
johnwebbcole/jscad-utils
dist/index.js
function(object) { return Array.isArray(object) ? object : [object.x, object.y, object.z]; }
javascript
function(object) { return Array.isArray(object) ? object : [object.x, object.y, object.z]; }
[ "function", "(", "object", ")", "{", "return", "Array", ".", "isArray", "(", "object", ")", "?", "object", ":", "[", "object", ".", "x", ",", "object", ".", "y", ",", "object", ".", "z", "]", ";", "}" ]
Converts an object with x, y, and z properties into an array, or an array if passed an array. @param {Object|Array} object
[ "Converts", "an", "object", "with", "x", "y", "and", "z", "properties", "into", "an", "array", "or", "an", "array", "if", "passed", "an", "array", "." ]
7c52e446aa5c001ccbb0a867a69b160da20a13e7
https://github.com/johnwebbcole/jscad-utils/blob/7c52e446aa5c001ccbb0a867a69b160da20a13e7/dist/index.js#L132-L134
train
johnwebbcole/jscad-utils
dist/index.js
function(desired, nozzel = NOZZEL_SIZE, nozzie = 0) { return (Math.floor(desired / nozzel) + nozzie) * nozzel; }
javascript
function(desired, nozzel = NOZZEL_SIZE, nozzie = 0) { return (Math.floor(desired / nozzel) + nozzie) * nozzel; }
[ "function", "(", "desired", ",", "nozzel", "=", "NOZZEL_SIZE", ",", "nozzie", "=", "0", ")", "{", "return", "(", "Math", ".", "floor", "(", "desired", "/", "nozzel", ")", "+", "nozzie", ")", "*", "nozzel", ";", "}" ]
Return the largest number that is a multiple of the nozzel size. @param {Number} desired Desired value @param {Number} [nozzel=NOZZEL_SIZE] Nozel size, defaults to `NOZZEL_SIZE` @param {Number} [nozzie=0] Number of nozzel sizes to add to the value @return {Number} ...
[ "Return", "the", "largest", "number", "that", "is", "a", "multiple", "of", "the", "nozzel", "size", "." ]
7c52e446aa5c001ccbb0a867a69b160da20a13e7
https://github.com/johnwebbcole/jscad-utils/blob/7c52e446aa5c001ccbb0a867a69b160da20a13e7/dist/index.js#L194-L196
train
johnwebbcole/jscad-utils
dist/index.js
function(desired, nozzel = NOZZEL_SIZE, nozzie = 0) { return (Math.ceil(desired / nozzel) + nozzie) * nozzel; }
javascript
function(desired, nozzel = NOZZEL_SIZE, nozzie = 0) { return (Math.ceil(desired / nozzel) + nozzie) * nozzel; }
[ "function", "(", "desired", ",", "nozzel", "=", "NOZZEL_SIZE", ",", "nozzie", "=", "0", ")", "{", "return", "(", "Math", ".", "ceil", "(", "desired", "/", "nozzel", ")", "+", "nozzie", ")", "*", "nozzel", ";", "}" ]
Returns the largest number that is a multipel of the nozzel size, just over the desired value. @param {Number} desired Desired value @param {Number} [nozzel=NOZZEL_SIZE] Nozel size, defaults to `NOZZEL_SIZE` @param {Number} [nozzie=0] Number of nozzel sizes to add to the value @retur...
[ "Returns", "the", "largest", "number", "that", "is", "a", "multipel", "of", "the", "nozzel", "size", "just", "over", "the", "desired", "value", "." ]
7c52e446aa5c001ccbb0a867a69b160da20a13e7
https://github.com/johnwebbcole/jscad-utils/blob/7c52e446aa5c001ccbb0a867a69b160da20a13e7/dist/index.js#L205-L207
train
johnwebbcole/jscad-utils
dist/index.js
function(msg, o) { echo( msg, JSON.stringify(o.getBounds()), JSON.stringify(this.size(o.getBounds())) ); }
javascript
function(msg, o) { echo( msg, JSON.stringify(o.getBounds()), JSON.stringify(this.size(o.getBounds())) ); }
[ "function", "(", "msg", ",", "o", ")", "{", "echo", "(", "msg", ",", "JSON", ".", "stringify", "(", "o", ".", "getBounds", "(", ")", ")", ",", "JSON", ".", "stringify", "(", "this", ".", "size", "(", "o", ".", "getBounds", "(", ")", ")", ")", ...
Print a message and CSG object bounds and size to the conosle. @param {String} msg Message to print @param {CSG} o A CSG object to print the bounds and size of.
[ "Print", "a", "message", "and", "CSG", "object", "bounds", "and", "size", "to", "the", "conosle", "." ]
7c52e446aa5c001ccbb0a867a69b160da20a13e7
https://github.com/johnwebbcole/jscad-utils/blob/7c52e446aa5c001ccbb0a867a69b160da20a13e7/dist/index.js#L263-L269
train
johnwebbcole/jscad-utils
dist/index.js
function(object, segments, axis) { var size = object.size()[axis]; var width = size / segments; var result = []; for (var i = width; i < size; i += width) { result.push(i); } return result; }
javascript
function(object, segments, axis) { var size = object.size()[axis]; var width = size / segments; var result = []; for (var i = width; i < size; i += width) { result.push(i); } return result; }
[ "function", "(", "object", ",", "segments", ",", "axis", ")", "{", "var", "size", "=", "object", ".", "size", "(", ")", "[", "axis", "]", ";", "var", "width", "=", "size", "/", "segments", ";", "var", "result", "=", "[", "]", ";", "for", "(", "...
Returns an array of positions along an object on a given axis. @param {CSG} object The object to calculate the segments on. @param {number} segments The number of segments to create. @param {string} axis Axis to create the sgements on. @return {Array} An array of segment positions.
[ "Returns", "an", "array", "of", "positions", "along", "an", "object", "on", "a", "given", "axis", "." ]
7c52e446aa5c001ccbb0a867a69b160da20a13e7
https://github.com/johnwebbcole/jscad-utils/blob/7c52e446aa5c001ccbb0a867a69b160da20a13e7/dist/index.js#L366-L374
train
johnwebbcole/jscad-utils
dist/index.js
size
function size(o) { var bbox = o.getBounds ? o.getBounds() : o; var foo = bbox[1].minus(bbox[0]); return foo; }
javascript
function size(o) { var bbox = o.getBounds ? o.getBounds() : o; var foo = bbox[1].minus(bbox[0]); return foo; }
[ "function", "size", "(", "o", ")", "{", "var", "bbox", "=", "o", ".", "getBounds", "?", "o", ".", "getBounds", "(", ")", ":", "o", ";", "var", "foo", "=", "bbox", "[", "1", "]", ".", "minus", "(", "bbox", "[", "0", "]", ")", ";", "return", ...
Returns a `Vector3D` with the size of the object. @param {CSG} o A `CSG` like object or an array of `CSG.Vector3D` objects (the result of getBounds()). @return {CSG.Vector3D} Vector3d with the size of the object
[ "Returns", "a", "Vector3D", "with", "the", "size", "of", "the", "object", "." ]
7c52e446aa5c001ccbb0a867a69b160da20a13e7
https://github.com/johnwebbcole/jscad-utils/blob/7c52e446aa5c001ccbb0a867a69b160da20a13e7/dist/index.js#L475-L480
train
johnwebbcole/jscad-utils
dist/index.js
fit
function fit(object, x, y, z, keep_aspect_ratio) { var a; if (Array.isArray(x)) { a = x; keep_aspect_ratio = y; x = a[0]; y = a[1]; z = a[2]; } else { a = [x, y, z]; } // var c = util.centroid(object); var size = this.size(object.getBounds()); function scale(size, value) { if...
javascript
function fit(object, x, y, z, keep_aspect_ratio) { var a; if (Array.isArray(x)) { a = x; keep_aspect_ratio = y; x = a[0]; y = a[1]; z = a[2]; } else { a = [x, y, z]; } // var c = util.centroid(object); var size = this.size(object.getBounds()); function scale(size, value) { if...
[ "function", "fit", "(", "object", ",", "x", ",", "y", ",", "z", ",", "keep_aspect_ratio", ")", "{", "var", "a", ";", "if", "(", "Array", ".", "isArray", "(", "x", ")", ")", "{", "a", "=", "x", ";", "keep_aspect_ratio", "=", "y", ";", "x", "=", ...
Fit an object inside a bounding box. Often used with text labels. @param {CSG} object [description] @param {number | array} x [description] @param {number} y [description] @param {number} z [description] @param {boolean} keep_aspect_ratio [description] @r...
[ "Fit", "an", "object", "inside", "a", "bounding", "box", ".", "Often", "used", "with", "text", "labels", "." ]
7c52e446aa5c001ccbb0a867a69b160da20a13e7
https://github.com/johnwebbcole/jscad-utils/blob/7c52e446aa5c001ccbb0a867a69b160da20a13e7/dist/index.js#L557-L589
train
johnwebbcole/jscad-utils
dist/index.js
flush
function flush(moveobj, withobj, axis, mside, wside) { return moveobj.translate( util.calcFlush(moveobj, withobj, axis, mside, wside) ); }
javascript
function flush(moveobj, withobj, axis, mside, wside) { return moveobj.translate( util.calcFlush(moveobj, withobj, axis, mside, wside) ); }
[ "function", "flush", "(", "moveobj", ",", "withobj", ",", "axis", ",", "mside", ",", "wside", ")", "{", "return", "moveobj", ".", "translate", "(", "util", ".", "calcFlush", "(", "moveobj", ",", "withobj", ",", "axis", ",", "mside", ",", "wside", ")", ...
Moves an object flush with another object @param {CSG} moveobj Object to move @param {CSG} withobj Object to make flush with @param {String} axis Which axis: 'x', 'y', 'z' @param {Number} mside 0 or 1 @param {Number} wside 0 or 1 @return {CSG} [description]
[ "Moves", "an", "object", "flush", "with", "another", "object" ]
7c52e446aa5c001ccbb0a867a69b160da20a13e7
https://github.com/johnwebbcole/jscad-utils/blob/7c52e446aa5c001ccbb0a867a69b160da20a13e7/dist/index.js#L702-L706
train
johnwebbcole/jscad-utils
dist/index.js
getDelta
function getDelta(size, bounds, axis, offset, nonzero) { if (!util.isEmpty(offset) && nonzero) { if (Math.abs(offset) < 1e-4) { offset = 1e-4 * (util.isNegative(offset) ? -1 : 1); } } // if the offset is negative, then it's an offset from // the positive side of the axis var dist = util.isNegati...
javascript
function getDelta(size, bounds, axis, offset, nonzero) { if (!util.isEmpty(offset) && nonzero) { if (Math.abs(offset) < 1e-4) { offset = 1e-4 * (util.isNegative(offset) ? -1 : 1); } } // if the offset is negative, then it's an offset from // the positive side of the axis var dist = util.isNegati...
[ "function", "getDelta", "(", "size", ",", "bounds", ",", "axis", ",", "offset", ",", "nonzero", ")", "{", "if", "(", "!", "util", ".", "isEmpty", "(", "offset", ")", "&&", "nonzero", ")", "{", "if", "(", "Math", ".", "abs", "(", "offset", ")", "<...
Given an size, bounds and an axis, a Point along the axis will be returned. If no `offset` is given, then the midway point on the axis is returned. When the `offset` is positive, a point `offset` from the mininum axis is returned. When the `offset` is negative, the `offset` is subtracted from the axis maximum. @param...
[ "Given", "an", "size", "bounds", "and", "an", "axis", "a", "Point", "along", "the", "axis", "will", "be", "returned", ".", "If", "no", "offset", "is", "given", "then", "the", "midway", "point", "on", "the", "axis", "is", "returned", ".", "When", "the",...
7c52e446aa5c001ccbb0a867a69b160da20a13e7
https://github.com/johnwebbcole/jscad-utils/blob/7c52e446aa5c001ccbb0a867a69b160da20a13e7/dist/index.js#L801-L813
train
johnwebbcole/jscad-utils
dist/index.js
bisect
function bisect( object, axis, offset, angle, rotateaxis, rotateoffset, options ) { options = util.defaults(options, { addRotationCenter: false }); angle = angle || 0; var info = util.normalVector(axis); var bounds = object.getBounds(); var size = util.size(object); rotateaxis = rot...
javascript
function bisect( object, axis, offset, angle, rotateaxis, rotateoffset, options ) { options = util.defaults(options, { addRotationCenter: false }); angle = angle || 0; var info = util.normalVector(axis); var bounds = object.getBounds(); var size = util.size(object); rotateaxis = rot...
[ "function", "bisect", "(", "object", ",", "axis", ",", "offset", ",", "angle", ",", "rotateaxis", ",", "rotateoffset", ",", "options", ")", "{", "options", "=", "util", ".", "defaults", "(", "options", ",", "{", "addRotationCenter", ":", "false", "}", ")...
Cut an object into two pieces, along a given axis. The offset allows you to move the cut plane along the cut axis. For example, a 10mm cube with an offset of 2, will create a 2mm side and an 8mm side. Negative offsets operate off of the larger side of the axes. In the previous example, an offset of -2 creates a 8mm ...
[ "Cut", "an", "object", "into", "two", "pieces", "along", "a", "given", "axis", ".", "The", "offset", "allows", "you", "to", "move", "the", "cut", "plane", "along", "the", "cut", "axis", ".", "For", "example", "a", "10mm", "cube", "with", "an", "offset"...
7c52e446aa5c001ccbb0a867a69b160da20a13e7
https://github.com/johnwebbcole/jscad-utils/blob/7c52e446aa5c001ccbb0a867a69b160da20a13e7/dist/index.js#L831-L904
train
johnwebbcole/jscad-utils
dist/index.js
stretch
function stretch(object, axis, distance, offset) { var normal = { x: [1, 0, 0], y: [0, 1, 0], z: [0, 0, 1] }; var bounds = object.getBounds(); var size = util.size(object); var cutDelta = util.getDelta(size, bounds, axis, offset, true); // console.log('stretch.cutDelta', cutDelta, normal[axis]);...
javascript
function stretch(object, axis, distance, offset) { var normal = { x: [1, 0, 0], y: [0, 1, 0], z: [0, 0, 1] }; var bounds = object.getBounds(); var size = util.size(object); var cutDelta = util.getDelta(size, bounds, axis, offset, true); // console.log('stretch.cutDelta', cutDelta, normal[axis]);...
[ "function", "stretch", "(", "object", ",", "axis", ",", "distance", ",", "offset", ")", "{", "var", "normal", "=", "{", "x", ":", "[", "1", ",", "0", ",", "0", "]", ",", "y", ":", "[", "0", ",", "1", ",", "0", "]", ",", "z", ":", "[", "0"...
Wraps the `stretchAtPlane` call using the same logic as `bisect`. @param {CSG} object Object to stretch @param {String} axis Axis to streatch along @param {Number} distance Distance to stretch @param {Number} offset Offset along the axis to cut the object @return {CSG} The stretched object.
[ "Wraps", "the", "stretchAtPlane", "call", "using", "the", "same", "logic", "as", "bisect", "." ]
7c52e446aa5c001ccbb0a867a69b160da20a13e7
https://github.com/johnwebbcole/jscad-utils/blob/7c52e446aa5c001ccbb0a867a69b160da20a13e7/dist/index.js#L915-L926
train
johnwebbcole/jscad-utils
dist/index.js
poly2solid
function poly2solid(top, bottom, height) { if (top.sides.length == 0) { // empty! return new CSG$1(); } // var offsetVector = CSG.parseOptionAs3DVector(options, "offset", [0, 0, 10]); var offsetVector = CSG$1.Vector3D.Create(0, 0, height); var normalVector = CSG$1.Vector3D.Create(0, 1, 0); var poly...
javascript
function poly2solid(top, bottom, height) { if (top.sides.length == 0) { // empty! return new CSG$1(); } // var offsetVector = CSG.parseOptionAs3DVector(options, "offset", [0, 0, 10]); var offsetVector = CSG$1.Vector3D.Create(0, 0, height); var normalVector = CSG$1.Vector3D.Create(0, 1, 0); var poly...
[ "function", "poly2solid", "(", "top", ",", "bottom", ",", "height", ")", "{", "if", "(", "top", ".", "sides", ".", "length", "==", "0", ")", "{", "// empty!", "return", "new", "CSG$1", "(", ")", ";", "}", "// var offsetVector = CSG.parseOptionAs3DVector(opti...
Takes two CSG polygons and createds a solid of `height`. Similar to `CSG.extrude`, excdept you can resize either polygon. @param {CAG} top Top polygon @param {CAG} bottom Bottom polygon @param {number} height heigth of solid @return {CSG} generated solid
[ "Takes", "two", "CSG", "polygons", "and", "createds", "a", "solid", "of", "height", ".", "Similar", "to", "CSG", ".", "extrude", "excdept", "you", "can", "resize", "either", "polygon", "." ]
7c52e446aa5c001ccbb0a867a69b160da20a13e7
https://github.com/johnwebbcole/jscad-utils/blob/7c52e446aa5c001ccbb0a867a69b160da20a13e7/dist/index.js#L937-L983
train
johnwebbcole/jscad-utils
dist/index.js
Hexagon
function Hexagon(diameter, height) { var radius = diameter / 2; var sqrt3 = Math.sqrt(3) / 2; var hex = CAG.fromPoints([ [radius, 0], [radius / 2, radius * sqrt3], [-radius / 2, radius * sqrt3], [-radius, 0], [-radius / 2, -radius * sqrt3], [radius / 2, -radius * sqrt3] ]); return hex...
javascript
function Hexagon(diameter, height) { var radius = diameter / 2; var sqrt3 = Math.sqrt(3) / 2; var hex = CAG.fromPoints([ [radius, 0], [radius / 2, radius * sqrt3], [-radius / 2, radius * sqrt3], [-radius, 0], [-radius / 2, -radius * sqrt3], [radius / 2, -radius * sqrt3] ]); return hex...
[ "function", "Hexagon", "(", "diameter", ",", "height", ")", "{", "var", "radius", "=", "diameter", "/", "2", ";", "var", "sqrt3", "=", "Math", ".", "sqrt", "(", "3", ")", "/", "2", ";", "var", "hex", "=", "CAG", ".", "fromPoints", "(", "[", "[", ...
Crate a hexagon. @param {number} diameter Outside diameter of the hexagon @param {number} height height of the hexagon
[ "Crate", "a", "hexagon", "." ]
7c52e446aa5c001ccbb0a867a69b160da20a13e7
https://github.com/johnwebbcole/jscad-utils/blob/7c52e446aa5c001ccbb0a867a69b160da20a13e7/dist/index.js#L1848-L1863
train
johnwebbcole/jscad-utils
dist/index.js
Tube
function Tube( outsideDiameter, insideDiameter, height, outsideOptions, insideOptions ) { return Parts.Cylinder(outsideDiameter, height, outsideOptions).subtract( Parts.Cylinder(insideDiameter, height, insideOptions || outsideOptions) ); }
javascript
function Tube( outsideDiameter, insideDiameter, height, outsideOptions, insideOptions ) { return Parts.Cylinder(outsideDiameter, height, outsideOptions).subtract( Parts.Cylinder(insideDiameter, height, insideOptions || outsideOptions) ); }
[ "function", "Tube", "(", "outsideDiameter", ",", "insideDiameter", ",", "height", ",", "outsideOptions", ",", "insideOptions", ")", "{", "return", "Parts", ".", "Cylinder", "(", "outsideDiameter", ",", "height", ",", "outsideOptions", ")", ".", "subtract", "(", ...
Create a tube @param {Number} outsideDiameter Outside diameter of the tube @param {Number} insideDiameter Inside diameter of the tube @param {Number} height Height of the tube @param {Object} outsideOptions Options passed to the outside cylinder @param {Object} insideOptions Options passed to the inside cy...
[ "Create", "a", "tube" ]
7c52e446aa5c001ccbb0a867a69b160da20a13e7
https://github.com/johnwebbcole/jscad-utils/blob/7c52e446aa5c001ccbb0a867a69b160da20a13e7/dist/index.js#L1887-L1897
train
johnwebbcole/jscad-utils
dist/index.js
function( headDiameter, headLength, diameter, length, clearLength, options ) { var head = Parts.Hexagon(headDiameter, headLength); var thread = Parts.Cylinder(diameter, length); if (clearLength) { var headClearSpace = Parts.Hexagon(headDiameter, clearLength); } retu...
javascript
function( headDiameter, headLength, diameter, length, clearLength, options ) { var head = Parts.Hexagon(headDiameter, headLength); var thread = Parts.Cylinder(diameter, length); if (clearLength) { var headClearSpace = Parts.Hexagon(headDiameter, clearLength); } retu...
[ "function", "(", "headDiameter", ",", "headLength", ",", "diameter", ",", "length", ",", "clearLength", ",", "options", ")", "{", "var", "head", "=", "Parts", ".", "Hexagon", "(", "headDiameter", ",", "headLength", ")", ";", "var", "thread", "=", "Parts", ...
Creates a `Group` object with a Hex Head Screw. @param {number} headDiameter Diameter of the head of the screw @param {number} headLength Length of the head @param {number} diameter Diameter of the threaded shaft @param {number} length Length of the threaded shaft @param {number} clearLength Length of the ...
[ "Creates", "a", "Group", "object", "with", "a", "Hex", "Head", "Screw", "." ]
7c52e446aa5c001ccbb0a867a69b160da20a13e7
https://github.com/johnwebbcole/jscad-utils/blob/7c52e446aa5c001ccbb0a867a69b160da20a13e7/dist/index.js#L1986-L2002
train
Clarence-pan/format-webpack-stats-errors-warnings
src/format-webpack-stats-errors-warnings.js
_formatErrorsWarnings
function _formatErrorsWarnings(level, list, projectRoot){ return list.map(x => { let file, line, col, endLine, endCol, message try{ // resolve the relative path let fullFilePath = data_get(x, 'module.resource') file = fullFilePath && projectRoot ? path.relative(...
javascript
function _formatErrorsWarnings(level, list, projectRoot){ return list.map(x => { let file, line, col, endLine, endCol, message try{ // resolve the relative path let fullFilePath = data_get(x, 'module.resource') file = fullFilePath && projectRoot ? path.relative(...
[ "function", "_formatErrorsWarnings", "(", "level", ",", "list", ",", "projectRoot", ")", "{", "return", "list", ".", "map", "(", "x", "=>", "{", "let", "file", ",", "line", ",", "col", ",", "endLine", ",", "endCol", ",", "message", "try", "{", "// reso...
Format errors or warnings @param {string} level @param {Array<Error>} list @param {String|null} projectRoot
[ "Format", "errors", "or", "warnings" ]
35211ed18023e9e060d56f1227ae7483ac40fc23
https://github.com/Clarence-pan/format-webpack-stats-errors-warnings/blob/35211ed18023e9e060d56f1227ae7483ac40fc23/src/format-webpack-stats-errors-warnings.js#L30-L83
train
Clarence-pan/format-webpack-stats-errors-warnings
src/format-webpack-stats-errors-warnings.js
_resolveLineColNumInFile
function _resolveLineColNumInFile(file, message, options={}){ if (!message){ return {line: 0, col: 0} } let fileContent = fs.readFileSync(file, 'utf8') let beyondPos = 0 switch (typeof options.after){ case 'string': beyondPos = fileContent.indexOf(options.after) ...
javascript
function _resolveLineColNumInFile(file, message, options={}){ if (!message){ return {line: 0, col: 0} } let fileContent = fs.readFileSync(file, 'utf8') let beyondPos = 0 switch (typeof options.after){ case 'string': beyondPos = fileContent.indexOf(options.after) ...
[ "function", "_resolveLineColNumInFile", "(", "file", ",", "message", ",", "options", "=", "{", "}", ")", "{", "if", "(", "!", "message", ")", "{", "return", "{", "line", ":", "0", ",", "col", ":", "0", "}", "}", "let", "fileContent", "=", "fs", "."...
Resolve the line num of a message in a file
[ "Resolve", "the", "line", "num", "of", "a", "message", "in", "a", "file" ]
35211ed18023e9e060d56f1227ae7483ac40fc23
https://github.com/Clarence-pan/format-webpack-stats-errors-warnings/blob/35211ed18023e9e060d56f1227ae7483ac40fc23/src/format-webpack-stats-errors-warnings.js#L88-L123
train
Mogztter/opal-node-compiler
src/opal-builder.js
qpdecode
function qpdecode(callback) { return function(data) { var string = callback(data); return string .replace(/[\t\x20]$/gm, '') .replace(/=(?:\r\n?|\n|$)/g, '') .replace(/=([a-fA-F0-9]{2})/g, function($0, $1) { var codePoint = parseInt($1, 16); r...
javascript
function qpdecode(callback) { return function(data) { var string = callback(data); return string .replace(/[\t\x20]$/gm, '') .replace(/=(?:\r\n?|\n|$)/g, '') .replace(/=([a-fA-F0-9]{2})/g, function($0, $1) { var codePoint = parseInt($1, 16); r...
[ "function", "qpdecode", "(", "callback", ")", "{", "return", "function", "(", "data", ")", "{", "var", "string", "=", "callback", "(", "data", ")", ";", "return", "string", ".", "replace", "(", "/", "[\\t\\x20]$", "/", "gm", ",", "''", ")", ".", "rep...
quoted-printable decode
[ "quoted", "-", "printable", "decode" ]
9eae6daef84f9ebfeb9b1ac50fc04455622cc22c
https://github.com/Mogztter/opal-node-compiler/blob/9eae6daef84f9ebfeb9b1ac50fc04455622cc22c/src/opal-builder.js#L33378-L33390
train
saebekassebil/piu
lib/name.js
order
function order(type, name) { if (type === '' || type === 'M') return name; if (type === 'm') return type + name; if (type === 'aug') return name + '#5'; if (type === 'm#5') return 'm' + name + '#5'; if (type === 'dim') return name === 'b7' ? 'dim7' : 'm' + name + 'b5'; if (type === 'Mb5') return name + 'b5'...
javascript
function order(type, name) { if (type === '' || type === 'M') return name; if (type === 'm') return type + name; if (type === 'aug') return name + '#5'; if (type === 'm#5') return 'm' + name + '#5'; if (type === 'dim') return name === 'b7' ? 'dim7' : 'm' + name + 'b5'; if (type === 'Mb5') return name + 'b5'...
[ "function", "order", "(", "type", ",", "name", ")", "{", "if", "(", "type", "===", "''", "||", "type", "===", "'M'", ")", "return", "name", ";", "if", "(", "type", "===", "'m'", ")", "return", "type", "+", "name", ";", "if", "(", "type", "===", ...
Return chord type and extensions in the correct order
[ "Return", "chord", "type", "and", "extensions", "in", "the", "correct", "order" ]
e3aca0c4f5e0556a5e36e233801b8e8e34aa89db
https://github.com/saebekassebil/piu/blob/e3aca0c4f5e0556a5e36e233801b8e8e34aa89db/lib/name.js#L11-L19
train
Yomguithereal/obliterator
combinations.js
indicesToItems
function indicesToItems(target, items, indices, r) { for (var i = 0; i < r; i++) target[i] = items[indices[i]]; }
javascript
function indicesToItems(target, items, indices, r) { for (var i = 0; i < r; i++) target[i] = items[indices[i]]; }
[ "function", "indicesToItems", "(", "target", ",", "items", ",", "indices", ",", "r", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "r", ";", "i", "++", ")", "target", "[", "i", "]", "=", "items", "[", "indices", "[", "i", "]", "]...
Helper mapping indices to items.
[ "Helper", "mapping", "indices", "to", "items", "." ]
e28692aadd3c1c8be686c5c4b4d7bb988924a97a
https://github.com/Yomguithereal/obliterator/blob/e28692aadd3c1c8be686c5c4b4d7bb988924a97a/combinations.js#L12-L15
train
Yomguithereal/obliterator
split.js
makeGlobal
function makeGlobal(pattern) { var flags = 'g'; if (pattern.multiline) flags += 'm'; if (pattern.ignoreCase) flags += 'i'; if (pattern.sticky) flags += 'y'; if (pattern.unicode) flags += 'u'; return new RegExp(pattern.source, flags); }
javascript
function makeGlobal(pattern) { var flags = 'g'; if (pattern.multiline) flags += 'm'; if (pattern.ignoreCase) flags += 'i'; if (pattern.sticky) flags += 'y'; if (pattern.unicode) flags += 'u'; return new RegExp(pattern.source, flags); }
[ "function", "makeGlobal", "(", "pattern", ")", "{", "var", "flags", "=", "'g'", ";", "if", "(", "pattern", ".", "multiline", ")", "flags", "+=", "'m'", ";", "if", "(", "pattern", ".", "ignoreCase", ")", "flags", "+=", "'i'", ";", "if", "(", "pattern"...
Function used to make the given pattern global. @param {RegExp} pattern - Regular expression to make global. @return {RegExp}
[ "Function", "used", "to", "make", "the", "given", "pattern", "global", "." ]
e28692aadd3c1c8be686c5c4b4d7bb988924a97a
https://github.com/Yomguithereal/obliterator/blob/e28692aadd3c1c8be686c5c4b4d7bb988924a97a/split.js#L15-L24
train
Yomguithereal/obliterator
foreach.js
forEach
function forEach(iterable, callback) { var iterator, k, i, l, s; if (!iterable) throw new Error('obliterator/forEach: invalid iterable.'); if (typeof callback !== 'function') throw new Error('obliterator/forEach: expecting a callback.'); // The target is an array or a string or function arguments i...
javascript
function forEach(iterable, callback) { var iterator, k, i, l, s; if (!iterable) throw new Error('obliterator/forEach: invalid iterable.'); if (typeof callback !== 'function') throw new Error('obliterator/forEach: expecting a callback.'); // The target is an array or a string or function arguments i...
[ "function", "forEach", "(", "iterable", ",", "callback", ")", "{", "var", "iterator", ",", "k", ",", "i", ",", "l", ",", "s", ";", "if", "(", "!", "iterable", ")", "throw", "new", "Error", "(", "'obliterator/forEach: invalid iterable.'", ")", ";", "if", ...
Function able to iterate over almost any iterable JS value. @param {any} iterable - Iterable value. @param {function} callback - Callback function.
[ "Function", "able", "to", "iterate", "over", "almost", "any", "iterable", "JS", "value", "." ]
e28692aadd3c1c8be686c5c4b4d7bb988924a97a
https://github.com/Yomguithereal/obliterator/blob/e28692aadd3c1c8be686c5c4b4d7bb988924a97a/foreach.js#L20-L77
train
thlorenz/docme
lib/init-tmp-dir.js
initTmpDir
function initTmpDir (dirname, cb) { var dir = path.join(os.tmpDir(), dirname); rmrf(dir, function (err) { if (err) return cb(err); mkdir(dir, function (err) { if (err) return cb(err); cb(null, dir); }); }); }
javascript
function initTmpDir (dirname, cb) { var dir = path.join(os.tmpDir(), dirname); rmrf(dir, function (err) { if (err) return cb(err); mkdir(dir, function (err) { if (err) return cb(err); cb(null, dir); }); }); }
[ "function", "initTmpDir", "(", "dirname", ",", "cb", ")", "{", "var", "dir", "=", "path", ".", "join", "(", "os", ".", "tmpDir", "(", ")", ",", "dirname", ")", ";", "rmrf", "(", "dir", ",", "function", "(", "err", ")", "{", "if", "(", "err", ")...
Initializes a tmp dir into which to place intermediate files @name initTmpDir @private @function @param {String} dirname @param {Function(Error, String)} cb called back with the full path to the initialized tmp dir
[ "Initializes", "a", "tmp", "dir", "into", "which", "to", "place", "intermediate", "files" ]
4dcd56a961dfe0393653c1d3f7d6744584199e79
https://github.com/thlorenz/docme/blob/4dcd56a961dfe0393653c1d3f7d6744584199e79/lib/init-tmp-dir.js#L19-L29
train
kengz/lomath
chart/plot.js
p
function p() { // global promise object to wait for all plot options to be completed before writing this.promises = []; // global array for options to plot this.optArray = []; // simple plot this.plot = function(seriesArr, title, yLabel, xLabel) { // console.log("plotting") var...
javascript
function p() { // global promise object to wait for all plot options to be completed before writing this.promises = []; // global array for options to plot this.optArray = []; // simple plot this.plot = function(seriesArr, title, yLabel, xLabel) { // console.log("plotting") var...
[ "function", "p", "(", ")", "{", "// global promise object to wait for all plot options to be completed before writing", "this", ".", "promises", "=", "[", "]", ";", "// global array for options to plot", "this", ".", "optArray", "=", "[", "]", ";", "// simple plot", "this...
definition of plot package, uses highcharts
[ "definition", "of", "plot", "package", "uses", "highcharts" ]
6b0454843816da515e8c30b8e0eb571899e6b085
https://github.com/kengz/lomath/blob/6b0454843816da515e8c30b8e0eb571899e6b085/chart/plot.js#L18-L96
train
kengz/lomath
chart/src/js/render.js
localExport
function localExport(opt) { var ind = _.reGet(/\d/)(opt.chart.renderTo); _.assign(opt, { 'exporting': { 'buttons': { 'contextButton': { 'y': -10, 'menuItems': [{ 'text': 'Save as PNG', onclick: function() { this.createCa...
javascript
function localExport(opt) { var ind = _.reGet(/\d/)(opt.chart.renderTo); _.assign(opt, { 'exporting': { 'buttons': { 'contextButton': { 'y': -10, 'menuItems': [{ 'text': 'Save as PNG', onclick: function() { this.createCa...
[ "function", "localExport", "(", "opt", ")", "{", "var", "ind", "=", "_", ".", "reGet", "(", "/", "\\d", "/", ")", "(", "opt", ".", "chart", ".", "renderTo", ")", ";", "_", ".", "assign", "(", "opt", ",", "{", "'exporting'", ":", "{", "'buttons'",...
extending exporting properties for local save
[ "extending", "exporting", "properties", "for", "local", "save" ]
6b0454843816da515e8c30b8e0eb571899e6b085
https://github.com/kengz/lomath/blob/6b0454843816da515e8c30b8e0eb571899e6b085/chart/src/js/render.js#L34-L59
train
thlorenz/docme
index.js
docme
function docme(readme, args, jsdocargs, cb) { args = args || {}; jsdocargs = jsdocargs || []; log.level = args.loglevel || 'info'; var projectRoot = args.projectRoot || process.cwd() , projectName = path.basename(projectRoot) resolveReadme(readme, function (err, fullPath) { if (err) return cb(e...
javascript
function docme(readme, args, jsdocargs, cb) { args = args || {}; jsdocargs = jsdocargs || []; log.level = args.loglevel || 'info'; var projectRoot = args.projectRoot || process.cwd() , projectName = path.basename(projectRoot) resolveReadme(readme, function (err, fullPath) { if (err) return cb(e...
[ "function", "docme", "(", "readme", ",", "args", ",", "jsdocargs", ",", "cb", ")", "{", "args", "=", "args", "||", "{", "}", ";", "jsdocargs", "=", "jsdocargs", "||", "[", "]", ";", "log", ".", "level", "=", "args", ".", "loglevel", "||", "'info'",...
Generates jsdocs for non-private members of the project in the current folder. It then updates the given README with the githubified version of the generated API docs. @name docme @function @param {String} readme path to readme in which the API docs should be updated @param {Array.<String>} args consumed by docme @par...
[ "Generates", "jsdocs", "for", "non", "-", "private", "members", "of", "the", "project", "in", "the", "current", "folder", ".", "It", "then", "updates", "the", "given", "README", "with", "the", "githubified", "version", "of", "the", "generated", "API", "docs"...
4dcd56a961dfe0393653c1d3f7d6744584199e79
https://github.com/thlorenz/docme/blob/4dcd56a961dfe0393653c1d3f7d6744584199e79/index.js#L66-L80
train
hiddentao/sjv
index.js
function(schema) { if (!schema) { throw new Error('Schema is empty'); } this._defaultLimitTypes = [String,Boolean,Number,Date,Array,Object] this.schema = schema; }
javascript
function(schema) { if (!schema) { throw new Error('Schema is empty'); } this._defaultLimitTypes = [String,Boolean,Number,Date,Array,Object] this.schema = schema; }
[ "function", "(", "schema", ")", "{", "if", "(", "!", "schema", ")", "{", "throw", "new", "Error", "(", "'Schema is empty'", ")", ";", "}", "this", ".", "_defaultLimitTypes", "=", "[", "String", ",", "Boolean", ",", "Number", ",", "Date", ",", "Array", ...
A schema.
[ "A", "schema", "." ]
e09f30baab43aaf1864dcdea2d6096c5bdd6550d
https://github.com/hiddentao/sjv/blob/e09f30baab43aaf1864dcdea2d6096c5bdd6550d/index.js#L13-L20
train
boggan/unrar.js
lib/Unrar.js
unrar
function unrar(arrayBuffer) { RarEventMgr.emitStart(); var bstream = new BitStream(arrayBuffer, false /* rtl */ ); var header = new RarVolumeHeader(bstream); if (header.crc == 0x6152 && header.headType == 0x72 && header.flags.value == 0x1A21 && header.headSize == 7) { R...
javascript
function unrar(arrayBuffer) { RarEventMgr.emitStart(); var bstream = new BitStream(arrayBuffer, false /* rtl */ ); var header = new RarVolumeHeader(bstream); if (header.crc == 0x6152 && header.headType == 0x72 && header.flags.value == 0x1A21 && header.headSize == 7) { R...
[ "function", "unrar", "(", "arrayBuffer", ")", "{", "RarEventMgr", ".", "emitStart", "(", ")", ";", "var", "bstream", "=", "new", "BitStream", "(", "arrayBuffer", ",", "false", "/* rtl */", ")", ";", "var", "header", "=", "new", "RarVolumeHeader", "(", "bst...
make sure we flush all tracking variables
[ "make", "sure", "we", "flush", "all", "tracking", "variables" ]
88f56ee9ef9d133a24119b8f6e456b8f55a294d4
https://github.com/boggan/unrar.js/blob/88f56ee9ef9d133a24119b8f6e456b8f55a294d4/lib/Unrar.js#L40-L115
train
boggan/unrar.js
lib/BitStream.js
BitStream
function BitStream(ab, rtl, opt_offset, opt_length) { // if (!ab || !ab.toString || ab.toString() !== "[object ArrayBuffer]") { // throw "Error! BitArray constructed with an invalid ArrayBuffer object"; // } var offset = opt_offset || 0; var length = opt_length || ab.byteLength; this.bytes ...
javascript
function BitStream(ab, rtl, opt_offset, opt_length) { // if (!ab || !ab.toString || ab.toString() !== "[object ArrayBuffer]") { // throw "Error! BitArray constructed with an invalid ArrayBuffer object"; // } var offset = opt_offset || 0; var length = opt_length || ab.byteLength; this.bytes ...
[ "function", "BitStream", "(", "ab", ",", "rtl", ",", "opt_offset", ",", "opt_length", ")", "{", "// if (!ab || !ab.toString || ab.toString() !== \"[object ArrayBuffer]\") {", "// throw \"Error! BitArray constructed with an invalid ArrayBuffer object\";", "// }", "var", "offset", ...
This bit stream peeks and consumes bits out of a binary stream. @param {ArrayBuffer} ab An ArrayBuffer object or a Uint8Array. @param {boolean} rtl Whether the stream reads bits from the byte starting from bit 7 to 0 (true) or bit 0 to 7 (false). @param {Number} opt_offset The offset into the ArrayBuffer @param {Numbe...
[ "This", "bit", "stream", "peeks", "and", "consumes", "bits", "out", "of", "a", "binary", "stream", "." ]
88f56ee9ef9d133a24119b8f6e456b8f55a294d4
https://github.com/boggan/unrar.js/blob/88f56ee9ef9d133a24119b8f6e456b8f55a294d4/lib/BitStream.js#L14-L25
train
senecajs/seneca-web
web.js
mapRoutes
function mapRoutes(msg, done) { var seneca = this var adapter = msg.adapter || locals.adapter var context = msg.context || locals.context var options = msg.options || locals.options var routes = Mapper(msg.routes) var auth = msg.auth || locals.auth // Call the adaptor with the mapped routes, context to a...
javascript
function mapRoutes(msg, done) { var seneca = this var adapter = msg.adapter || locals.adapter var context = msg.context || locals.context var options = msg.options || locals.options var routes = Mapper(msg.routes) var auth = msg.auth || locals.auth // Call the adaptor with the mapped routes, context to a...
[ "function", "mapRoutes", "(", "msg", ",", "done", ")", "{", "var", "seneca", "=", "this", "var", "adapter", "=", "msg", ".", "adapter", "||", "locals", ".", "adapter", "var", "context", "=", "msg", ".", "context", "||", "locals", ".", "context", "var",...
Creates a route-map and passes it to a given adapter. The msg can optionally contain a custom adapter or context for once off routing.
[ "Creates", "a", "route", "-", "map", "and", "passes", "it", "to", "a", "given", "adapter", ".", "The", "msg", "can", "optionally", "contain", "a", "custom", "adapter", "or", "context", "for", "once", "off", "routing", "." ]
e990cc8f8fcfa70b984ffe0aa7aab57a64e8c6cb
https://github.com/senecajs/seneca-web/blob/e990cc8f8fcfa70b984ffe0aa7aab57a64e8c6cb/web.js#L58-L69
train
senecajs/seneca-web
web.js
setServer
function setServer(msg, done) { var seneca = this var context = msg.context || locals.context var adapter = msg.adapter || locals.adapter var options = msg.options || locals.options var auth = msg.auth || locals.auth var routes = msg.routes // If the adapter is a string, we look up the // adapters coll...
javascript
function setServer(msg, done) { var seneca = this var context = msg.context || locals.context var adapter = msg.adapter || locals.adapter var options = msg.options || locals.options var auth = msg.auth || locals.auth var routes = msg.routes // If the adapter is a string, we look up the // adapters coll...
[ "function", "setServer", "(", "msg", ",", "done", ")", "{", "var", "seneca", "=", "this", "var", "context", "=", "msg", ".", "context", "||", "locals", ".", "context", "var", "adapter", "=", "msg", ".", "adapter", "||", "locals", ".", "adapter", "var",...
Sets the 'default' server context. Any call to mapRoutes will use this server as it's context if none is provided. This is the server returned by getServer.
[ "Sets", "the", "default", "server", "context", ".", "Any", "call", "to", "mapRoutes", "will", "use", "this", "server", "as", "it", "s", "context", "if", "none", "is", "provided", ".", "This", "is", "the", "server", "returned", "by", "getServer", "." ]
e990cc8f8fcfa70b984ffe0aa7aab57a64e8c6cb
https://github.com/senecajs/seneca-web/blob/e990cc8f8fcfa70b984ffe0aa7aab57a64e8c6cb/web.js#L73-L105
train
sidorares/nodejs-mysql-native
lib/mysql-native/command.js
cmd
function cmd(handlers) { this.fieldindex = 0; this.state = "start"; this.stmt = "" this.params = [] // mixin all handlers for (var h in handlers) { this[h] = handlers[h]; } // save command name to display in debug output this.command_name = cmd.caller.command_name; this.args = Array.prototype...
javascript
function cmd(handlers) { this.fieldindex = 0; this.state = "start"; this.stmt = "" this.params = [] // mixin all handlers for (var h in handlers) { this[h] = handlers[h]; } // save command name to display in debug output this.command_name = cmd.caller.command_name; this.args = Array.prototype...
[ "function", "cmd", "(", "handlers", ")", "{", "this", ".", "fieldindex", "=", "0", ";", "this", ".", "state", "=", "\"start\"", ";", "this", ".", "stmt", "=", "\"\"", "this", ".", "params", "=", "[", "]", "// mixin all handlers", "for", "(", "var", "...
base for all commands initialises EventEmitter and implemets state mashine
[ "base", "for", "all", "commands", "initialises", "EventEmitter", "and", "implemets", "state", "mashine" ]
a7bb1356c8722b99e75e1eecf0af960fdc3c56c3
https://github.com/sidorares/nodejs-mysql-native/blob/a7bb1356c8722b99e75e1eecf0af960fdc3c56c3/lib/mysql-native/command.js#L8-L23
train
thaliproject/Thali_CordovaPlugin
thali/install/cordova-hooks/ios/before_plugin_install.js
updateJXcoreExtensionImport
function updateJXcoreExtensionImport(context) { var cordovaUtil = context.requireCordovaModule('cordova-lib/src/cordova/util'); var ConfigParser = context.requireCordovaModule('cordova-lib').configparser; var projectRoot = cordovaUtil.isCordova(); var xml = cordovaUtil.projectConfig(projectRoot); var cfg ...
javascript
function updateJXcoreExtensionImport(context) { var cordovaUtil = context.requireCordovaModule('cordova-lib/src/cordova/util'); var ConfigParser = context.requireCordovaModule('cordova-lib').configparser; var projectRoot = cordovaUtil.isCordova(); var xml = cordovaUtil.projectConfig(projectRoot); var cfg ...
[ "function", "updateJXcoreExtensionImport", "(", "context", ")", "{", "var", "cordovaUtil", "=", "context", ".", "requireCordovaModule", "(", "'cordova-lib/src/cordova/util'", ")", ";", "var", "ConfigParser", "=", "context", ".", "requireCordovaModule", "(", "'cordova-li...
Replaces PROJECT_NAME pattern with actual Cordova's project name
[ "Replaces", "PROJECT_NAME", "pattern", "with", "actual", "Cordova", "s", "project", "name" ]
0496da88a125a871d2ebff39359fbbf8ba01fd8f
https://github.com/thaliproject/Thali_CordovaPlugin/blob/0496da88a125a871d2ebff39359fbbf8ba01fd8f/thali/install/cordova-hooks/ios/before_plugin_install.js#L13-L41
train
thaliproject/Thali_CordovaPlugin
thali/NextGeneration/thaliMobileNativeWrapper.js
function (methodName, callback) { Mobile(methodName).registerToNative(callback); Mobile('didRegisterToNative').callNative(methodName, function () { logger.debug('Method %s registered to native', methodName); }); }
javascript
function (methodName, callback) { Mobile(methodName).registerToNative(callback); Mobile('didRegisterToNative').callNative(methodName, function () { logger.debug('Method %s registered to native', methodName); }); }
[ "function", "(", "methodName", ",", "callback", ")", "{", "Mobile", "(", "methodName", ")", ".", "registerToNative", "(", "callback", ")", ";", "Mobile", "(", "'didRegisterToNative'", ")", ".", "callNative", "(", "methodName", ",", "function", "(", ")", "{",...
Function to register a method to the native side and inform that the registration was done.
[ "Function", "to", "register", "a", "method", "to", "the", "native", "side", "and", "inform", "that", "the", "registration", "was", "done", "." ]
0496da88a125a871d2ebff39359fbbf8ba01fd8f
https://github.com/thaliproject/Thali_CordovaPlugin/blob/0496da88a125a871d2ebff39359fbbf8ba01fd8f/thali/NextGeneration/thaliMobileNativeWrapper.js#L1224-L1229
train
thaliproject/Thali_CordovaPlugin
thali/NextGeneration/replication/utilities.js
compareBufferArrays
function compareBufferArrays(buffArray1, buffArray2) { assert(Array.isArray(buffArray1), 'We only accept arrays.'); assert(Array.isArray(buffArray2), 'We only accept arrays.'); if (buffArray1.length !== buffArray2.length) { return false; } for (var i = 0; i < buffArray1.length; ++i) { var buff1 = buff...
javascript
function compareBufferArrays(buffArray1, buffArray2) { assert(Array.isArray(buffArray1), 'We only accept arrays.'); assert(Array.isArray(buffArray2), 'We only accept arrays.'); if (buffArray1.length !== buffArray2.length) { return false; } for (var i = 0; i < buffArray1.length; ++i) { var buff1 = buff...
[ "function", "compareBufferArrays", "(", "buffArray1", ",", "buffArray2", ")", "{", "assert", "(", "Array", ".", "isArray", "(", "buffArray1", ")", ",", "'We only accept arrays.'", ")", ";", "assert", "(", "Array", ".", "isArray", "(", "buffArray2", ")", ",", ...
Compares if two buffer arrays contain the same buffers in the same order. @param {Buffer[]} buffArray1 @param {Buffer[]} buffArray2 @returns {boolean}
[ "Compares", "if", "two", "buffer", "arrays", "contain", "the", "same", "buffers", "in", "the", "same", "order", "." ]
0496da88a125a871d2ebff39359fbbf8ba01fd8f
https://github.com/thaliproject/Thali_CordovaPlugin/blob/0496da88a125a871d2ebff39359fbbf8ba01fd8f/thali/NextGeneration/replication/utilities.js#L11-L27
train
thaliproject/Thali_CordovaPlugin
thali/NextGeneration/mux/createPeerListener.js
closeOldestServer
function closeOldestServer() { var oldest = null; Object.keys(self._peerServers).forEach(function (k) { if (oldest == null) { oldest = k; } else { if (self._peerServers[k].lastActive < self._peerServers[oldest].lastActive) { ...
javascript
function closeOldestServer() { var oldest = null; Object.keys(self._peerServers).forEach(function (k) { if (oldest == null) { oldest = k; } else { if (self._peerServers[k].lastActive < self._peerServers[oldest].lastActive) { ...
[ "function", "closeOldestServer", "(", ")", "{", "var", "oldest", "=", "null", ";", "Object", ".", "keys", "(", "self", ".", "_peerServers", ")", ".", "forEach", "(", "function", "(", "k", ")", "{", "if", "(", "oldest", "==", "null", ")", "{", "oldest...
This is the server that will listen for connection coming from the application
[ "This", "is", "the", "server", "that", "will", "listen", "for", "connection", "coming", "from", "the", "application" ]
0496da88a125a871d2ebff39359fbbf8ba01fd8f
https://github.com/thaliproject/Thali_CordovaPlugin/blob/0496da88a125a871d2ebff39359fbbf8ba01fd8f/thali/NextGeneration/mux/createPeerListener.js#L466-L482
train
thaliproject/Thali_CordovaPlugin
thali/install/install.js
httpRequestPromise
function httpRequestPromise(method, urlObject) { if (method !== 'GET' && method !== 'HEAD') { return Promise.reject(new Error('We only support GET or HEAD requests')); } return new Promise(function (resolve, reject) { var httpsRequestOptions = { host: urlObject.host, method: method, pat...
javascript
function httpRequestPromise(method, urlObject) { if (method !== 'GET' && method !== 'HEAD') { return Promise.reject(new Error('We only support GET or HEAD requests')); } return new Promise(function (resolve, reject) { var httpsRequestOptions = { host: urlObject.host, method: method, pat...
[ "function", "httpRequestPromise", "(", "method", ",", "urlObject", ")", "{", "if", "(", "method", "!==", "'GET'", "&&", "method", "!==", "'HEAD'", ")", "{", "return", "Promise", ".", "reject", "(", "new", "Error", "(", "'We only support GET or HEAD requests'", ...
Unfortunately the obvious library, request-promise, doesn't handle streams well so it would take the multi-megabyte ZIP response file and turn it into an in-memory string. So we use this instead.
[ "Unfortunately", "the", "obvious", "library", "request", "-", "promise", "doesn", "t", "handle", "streams", "well", "so", "it", "would", "take", "the", "multi", "-", "megabyte", "ZIP", "response", "file", "and", "turn", "it", "into", "an", "in", "-", "memo...
0496da88a125a871d2ebff39359fbbf8ba01fd8f
https://github.com/thaliproject/Thali_CordovaPlugin/blob/0496da88a125a871d2ebff39359fbbf8ba01fd8f/thali/install/install.js#L26-L53
train
thaliproject/Thali_CordovaPlugin
thali/install/install.js
getReleaseConfig
function getReleaseConfig() { var configFileName = path.join(__dirname, '..', 'package.json'); return fs.readFileAsync(configFileName, 'utf-8') .then(function (data) { var conf; try { conf = JSON.parse(data); if (conf && conf.thaliInstall) { return conf.thaliInstall; ...
javascript
function getReleaseConfig() { var configFileName = path.join(__dirname, '..', 'package.json'); return fs.readFileAsync(configFileName, 'utf-8') .then(function (data) { var conf; try { conf = JSON.parse(data); if (conf && conf.thaliInstall) { return conf.thaliInstall; ...
[ "function", "getReleaseConfig", "(", ")", "{", "var", "configFileName", "=", "path", ".", "join", "(", "__dirname", ",", "'..'", ",", "'package.json'", ")", ";", "return", "fs", ".", "readFileAsync", "(", "configFileName", ",", "'utf-8'", ")", ".", "then", ...
This method is used to retrieve the release configuration data stored in the releaseConfig.json. @returns {Promise} Returns release config
[ "This", "method", "is", "used", "to", "retrieve", "the", "release", "configuration", "data", "stored", "in", "the", "releaseConfig", ".", "json", "." ]
0496da88a125a871d2ebff39359fbbf8ba01fd8f
https://github.com/thaliproject/Thali_CordovaPlugin/blob/0496da88a125a871d2ebff39359fbbf8ba01fd8f/thali/install/install.js#L79-L96
train
thaliproject/Thali_CordovaPlugin
thali/install/install.js
doGitHubEtagsMatch
function doGitHubEtagsMatch(projectName, depotName, branchName, directoryToInstallIn) { return getEtagFromEtagFile(depotName, branchName, directoryToInstallIn) .then(function (etagFromFile) { if (!etagFromFile) { return false; } return httpRequestPromise('HEA...
javascript
function doGitHubEtagsMatch(projectName, depotName, branchName, directoryToInstallIn) { return getEtagFromEtagFile(depotName, branchName, directoryToInstallIn) .then(function (etagFromFile) { if (!etagFromFile) { return false; } return httpRequestPromise('HEA...
[ "function", "doGitHubEtagsMatch", "(", "projectName", ",", "depotName", ",", "branchName", ",", "directoryToInstallIn", ")", "{", "return", "getEtagFromEtagFile", "(", "depotName", ",", "branchName", ",", "directoryToInstallIn", ")", ".", "then", "(", "function", "(...
This method is a hack because I'm having trouble getting GitHub to respect if-none-match headers. So instead I'm doing a HEAD request and manually checking if the etags match. @param {string} projectName The project name @param {string} depotName The depot name @param {string} branchName The branch name @param {string...
[ "This", "method", "is", "a", "hack", "because", "I", "m", "having", "trouble", "getting", "GitHub", "to", "respect", "if", "-", "none", "-", "match", "headers", ".", "So", "instead", "I", "m", "doing", "a", "HEAD", "request", "and", "manually", "checking...
0496da88a125a871d2ebff39359fbbf8ba01fd8f
https://github.com/thaliproject/Thali_CordovaPlugin/blob/0496da88a125a871d2ebff39359fbbf8ba01fd8f/thali/install/install.js#L137-L152
train
thaliproject/Thali_CordovaPlugin
thali/install/install.js
copyDevelopmentThaliCordovaPluginToProject
function copyDevelopmentThaliCordovaPluginToProject(appRootDirectory, thaliDontCheckIn, depotName, branchName) { var targetDirectory = createUnzippedDirectoryPath...
javascript
function copyDevelopmentThaliCordovaPluginToProject(appRootDirectory, thaliDontCheckIn, depotName, branchName) { var targetDirectory = createUnzippedDirectoryPath...
[ "function", "copyDevelopmentThaliCordovaPluginToProject", "(", "appRootDirectory", ",", "thaliDontCheckIn", ",", "depotName", ",", "branchName", ")", "{", "var", "targetDirectory", "=", "createUnzippedDirectoryPath", "(", "depotName", ",", "branchName", ",", "thaliDontCheck...
This will copy the contents of a Thali_CordovaPlugin local depot to the right directory in the current Cordova project so it will be installed. This is used for local development only. @param {string} appRootDirectory @param {string} thaliDontCheckIn @param {string} depotName @param {string} branchName @returns {Promi...
[ "This", "will", "copy", "the", "contents", "of", "a", "Thali_CordovaPlugin", "local", "depot", "to", "the", "right", "directory", "in", "the", "current", "Cordova", "project", "so", "it", "will", "be", "installed", ".", "This", "is", "used", "for", "local", ...
0496da88a125a871d2ebff39359fbbf8ba01fd8f
https://github.com/thaliproject/Thali_CordovaPlugin/blob/0496da88a125a871d2ebff39359fbbf8ba01fd8f/thali/install/install.js#L245-L275
train
thaliproject/Thali_CordovaPlugin
thali/install/validateBuildEnvironment.js
checkVersion
function checkVersion(objectName, versionNumber) { const desiredVersion = versionNumber ? versionNumber : versions[objectName]; const commandAndResult = commandsAndResults[objectName]; if (!commandAndResult) { return Promise.reject( new Error('Unrecognized objectName in commandsAndResults')); } if (...
javascript
function checkVersion(objectName, versionNumber) { const desiredVersion = versionNumber ? versionNumber : versions[objectName]; const commandAndResult = commandsAndResults[objectName]; if (!commandAndResult) { return Promise.reject( new Error('Unrecognized objectName in commandsAndResults')); } if (...
[ "function", "checkVersion", "(", "objectName", ",", "versionNumber", ")", "{", "const", "desiredVersion", "=", "versionNumber", "?", "versionNumber", ":", "versions", "[", "objectName", "]", ";", "const", "commandAndResult", "=", "commandsAndResults", "[", "objectNa...
Checks if the named object is installed with the named version, if any. If versionNumber isn't given then we default to checking the versions global object. @param {string} objectName Name of the object to validate @param {string} [versionNumber] An optional string specifying the desired version. If omitted we will che...
[ "Checks", "if", "the", "named", "object", "is", "installed", "with", "the", "named", "version", "if", "any", ".", "If", "versionNumber", "isn", "t", "given", "then", "we", "default", "to", "checking", "the", "versions", "global", "object", "." ]
0496da88a125a871d2ebff39359fbbf8ba01fd8f
https://github.com/thaliproject/Thali_CordovaPlugin/blob/0496da88a125a871d2ebff39359fbbf8ba01fd8f/thali/install/validateBuildEnvironment.js#L266-L296
train
thaliproject/Thali_CordovaPlugin
thali/install/SSDPReplacer/hook.js
findFirstFile
function findFirstFile (name, rootDir) { return new Promise(function (resolve, reject) { var resultPath; function end() { if (resultPath) { resolve(resultPath); } else { reject(new Error( format('file is not found, name: \'%s\'', name) )); } } var ...
javascript
function findFirstFile (name, rootDir) { return new Promise(function (resolve, reject) { var resultPath; function end() { if (resultPath) { resolve(resultPath); } else { reject(new Error( format('file is not found, name: \'%s\'', name) )); } } var ...
[ "function", "findFirstFile", "(", "name", ",", "rootDir", ")", "{", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "var", "resultPath", ";", "function", "end", "(", ")", "{", "if", "(", "resultPath", ")", "{", "re...
We want to find the first path that ends with 'name'.
[ "We", "want", "to", "find", "the", "first", "path", "that", "ends", "with", "name", "." ]
0496da88a125a871d2ebff39359fbbf8ba01fd8f
https://github.com/thaliproject/Thali_CordovaPlugin/blob/0496da88a125a871d2ebff39359fbbf8ba01fd8f/thali/install/SSDPReplacer/hook.js#L28-L65
train
thaliproject/Thali_CordovaPlugin
thali/NextGeneration/identityExchange/connectionTable.js
ConnectionTable
function ConnectionTable(thaliReplicationManager) { EventEmitter.call(this); var self = this; this.thaliReplicationManager = thaliReplicationManager; this.connectionTable = {}; this.connectionSuccessListener = function (successObject) { self.connectionTable[successObject.peerIdentifier] = { muxPort:...
javascript
function ConnectionTable(thaliReplicationManager) { EventEmitter.call(this); var self = this; this.thaliReplicationManager = thaliReplicationManager; this.connectionTable = {}; this.connectionSuccessListener = function (successObject) { self.connectionTable[successObject.peerIdentifier] = { muxPort:...
[ "function", "ConnectionTable", "(", "thaliReplicationManager", ")", "{", "EventEmitter", ".", "call", "(", "this", ")", ";", "var", "self", "=", "this", ";", "this", ".", "thaliReplicationManager", "=", "thaliReplicationManager", ";", "this", ".", "connectionTable...
A temporary hack to collect connectionSuccess events. Once we put in ACLs we won't need this hack anymore. @param thaliReplicationManager @constructor
[ "A", "temporary", "hack", "to", "collect", "connectionSuccess", "events", ".", "Once", "we", "put", "in", "ACLs", "we", "won", "t", "need", "this", "hack", "anymore", "." ]
0496da88a125a871d2ebff39359fbbf8ba01fd8f
https://github.com/thaliproject/Thali_CordovaPlugin/blob/0496da88a125a871d2ebff39359fbbf8ba01fd8f/thali/NextGeneration/identityExchange/connectionTable.js#L43-L57
train
thaliproject/Thali_CordovaPlugin
thali/NextGeneration/thaliMobile.js
start
function start (router, pskIdToSecret, networkType) { if (thaliMobileStates.started === true) { return Promise.reject(new Error('Call Stop!')); } thaliMobileStates.started = true; thaliMobileStates.networkType = networkType || global.NETWORK_TYPE || thaliMobileStates.networkType; return getWifiOrNati...
javascript
function start (router, pskIdToSecret, networkType) { if (thaliMobileStates.started === true) { return Promise.reject(new Error('Call Stop!')); } thaliMobileStates.started = true; thaliMobileStates.networkType = networkType || global.NETWORK_TYPE || thaliMobileStates.networkType; return getWifiOrNati...
[ "function", "start", "(", "router", ",", "pskIdToSecret", ",", "networkType", ")", "{", "if", "(", "thaliMobileStates", ".", "started", "===", "true", ")", "{", "return", "Promise", ".", "reject", "(", "new", "Error", "(", "'Call Stop!'", ")", ")", ";", ...
This object is our generic status wrapper that lets us return information about both WiFi and Native. @public @typedef {Object} combinedResult @property {?Error} wifiResult @property {?Error} nativeResult
[ "This", "object", "is", "our", "generic", "status", "wrapper", "that", "lets", "us", "return", "information", "about", "both", "WiFi", "and", "Native", "." ]
0496da88a125a871d2ebff39359fbbf8ba01fd8f
https://github.com/thaliproject/Thali_CordovaPlugin/blob/0496da88a125a871d2ebff39359fbbf8ba01fd8f/thali/NextGeneration/thaliMobile.js#L182-L198
train
thaliproject/Thali_CordovaPlugin
thali/install/cordova-hooks/android/after_plugin_install.js
function (appRoot) { var filePath = path.join(appRoot, 'platforms/android/src/io/jxcore/node/JXcoreExtension.java'); var content = fs.readFileSync(filePath, 'utf-8'); content = content.replace('lifeCycleMonitor.start();', 'lifeCycleMonitor.start();\n\t\tRegisterExecuteUT.Register();'); content = conten...
javascript
function (appRoot) { var filePath = path.join(appRoot, 'platforms/android/src/io/jxcore/node/JXcoreExtension.java'); var content = fs.readFileSync(filePath, 'utf-8'); content = content.replace('lifeCycleMonitor.start();', 'lifeCycleMonitor.start();\n\t\tRegisterExecuteUT.Register();'); content = conten...
[ "function", "(", "appRoot", ")", "{", "var", "filePath", "=", "path", ".", "join", "(", "appRoot", ",", "'platforms/android/src/io/jxcore/node/JXcoreExtension.java'", ")", ";", "var", "content", "=", "fs", ".", "readFileSync", "(", "filePath", ",", "'utf-8'", ")...
Updates JXcoreExtension with a method which is used to register the native UT executor. We are doing it because we don't want to mess our production code with our test code so we create a function that dynamically adds method executing tests only when we are actually testing. @param {Object} appRoot
[ "Updates", "JXcoreExtension", "with", "a", "method", "which", "is", "used", "to", "register", "the", "native", "UT", "executor", ".", "We", "are", "doing", "it", "because", "we", "don", "t", "want", "to", "mess", "our", "production", "code", "with", "our",...
0496da88a125a871d2ebff39359fbbf8ba01fd8f
https://github.com/thaliproject/Thali_CordovaPlugin/blob/0496da88a125a871d2ebff39359fbbf8ba01fd8f/thali/install/cordova-hooks/android/after_plugin_install.js#L178-L188
train
thaliproject/Thali_CordovaPlugin
thali/NextGeneration/security/hkdf.js
HKDF
function HKDF(hashAlg, salt, ikm) { if (!(this instanceof HKDF)) { return new HKDF(hashAlg, salt, ikm); } this.hashAlg = hashAlg; // create the hash alg to see if it exists and get its length var hash = crypto.createHash(this.hashAlg); this.hashLength = hash.digest().length; this.salt = salt || zeros(thi...
javascript
function HKDF(hashAlg, salt, ikm) { if (!(this instanceof HKDF)) { return new HKDF(hashAlg, salt, ikm); } this.hashAlg = hashAlg; // create the hash alg to see if it exists and get its length var hash = crypto.createHash(this.hashAlg); this.hashLength = hash.digest().length; this.salt = salt || zeros(thi...
[ "function", "HKDF", "(", "hashAlg", ",", "salt", ",", "ikm", ")", "{", "if", "(", "!", "(", "this", "instanceof", "HKDF", ")", ")", "{", "return", "new", "HKDF", "(", "hashAlg", ",", "salt", ",", "ikm", ")", ";", "}", "this", ".", "hashAlg", "=",...
ikm is initial keying material
[ "ikm", "is", "initial", "keying", "material" ]
0496da88a125a871d2ebff39359fbbf8ba01fd8f
https://github.com/thaliproject/Thali_CordovaPlugin/blob/0496da88a125a871d2ebff39359fbbf8ba01fd8f/thali/NextGeneration/security/hkdf.js#L32-L48
train
thaliproject/Thali_CordovaPlugin
thali/NextGeneration/notification/thaliNotificationBeacons.js
createPublicKeyHash
function createPublicKeyHash (ecdhPublicKey) { return crypto.createHash(module.exports.SHA256) .update(ecdhPublicKey) .digest() .slice(0, 16); }
javascript
function createPublicKeyHash (ecdhPublicKey) { return crypto.createHash(module.exports.SHA256) .update(ecdhPublicKey) .digest() .slice(0, 16); }
[ "function", "createPublicKeyHash", "(", "ecdhPublicKey", ")", "{", "return", "crypto", ".", "createHash", "(", "module", ".", "exports", ".", "SHA256", ")", ".", "update", "(", "ecdhPublicKey", ")", ".", "digest", "(", ")", ".", "slice", "(", "0", ",", "...
Creates a 16 byte hash of a public key. We choose 16 bytes as large enough to prevent accidentally collisions but small enough not to eat up excess space in a beacon. @param {Buffer} ecdhPublicKey The buffer representing the ECDH's public key. @returns {Buffer}
[ "Creates", "a", "16", "byte", "hash", "of", "a", "public", "key", "." ]
0496da88a125a871d2ebff39359fbbf8ba01fd8f
https://github.com/thaliproject/Thali_CordovaPlugin/blob/0496da88a125a871d2ebff39359fbbf8ba01fd8f/thali/NextGeneration/notification/thaliNotificationBeacons.js#L121-L126
train
thaliproject/Thali_CordovaPlugin
thali/NextGeneration/notification/thaliNotificationBeacons.js
generatePreambleAndBeacons
function generatePreambleAndBeacons (publicKeysToNotify, ecdhForLocalDevice, millisecondsUntilExpiration) { if (publicKeysToNotify == null) { throw new Error('publicKeysToNotify cannot be null'); } if (ecdhForLocalDevice == null) { ...
javascript
function generatePreambleAndBeacons (publicKeysToNotify, ecdhForLocalDevice, millisecondsUntilExpiration) { if (publicKeysToNotify == null) { throw new Error('publicKeysToNotify cannot be null'); } if (ecdhForLocalDevice == null) { ...
[ "function", "generatePreambleAndBeacons", "(", "publicKeysToNotify", ",", "ecdhForLocalDevice", ",", "millisecondsUntilExpiration", ")", "{", "if", "(", "publicKeysToNotify", "==", "null", ")", "{", "throw", "new", "Error", "(", "'publicKeysToNotify cannot be null'", ")",...
This function will generate a buffer containing the notification preamble and beacons for the given set of public keys using the supplied private key and set to the specified seconds until expiration. @param {Buffer[]} publicKeysToNotify - An array of buffers holding ECDH public keys. @param {ECDH} ecdhForLocalDevice -...
[ "This", "function", "will", "generate", "a", "buffer", "containing", "the", "notification", "preamble", "and", "beacons", "for", "the", "given", "set", "of", "public", "keys", "using", "the", "supplied", "private", "key", "and", "set", "to", "the", "specified"...
0496da88a125a871d2ebff39359fbbf8ba01fd8f
https://github.com/thaliproject/Thali_CordovaPlugin/blob/0496da88a125a871d2ebff39359fbbf8ba01fd8f/thali/NextGeneration/notification/thaliNotificationBeacons.js#L144-L216
train
thaliproject/Thali_CordovaPlugin
thali/NextGeneration/notification/thaliNotificationBeacons.js
generatePskSecret
function generatePskSecret(ecdhForLocalDevice, remotePeerPublicKey, pskIdentityField) { var sxy = ecdhForLocalDevice.computeSecret(remotePeerPublicKey); return HKDF(module.exports.SHA256, sxy, pskIdentityField) .derive('', module.exports.AES_256_KEY_SIZE); }
javascript
function generatePskSecret(ecdhForLocalDevice, remotePeerPublicKey, pskIdentityField) { var sxy = ecdhForLocalDevice.computeSecret(remotePeerPublicKey); return HKDF(module.exports.SHA256, sxy, pskIdentityField) .derive('', module.exports.AES_256_KEY_SIZE); }
[ "function", "generatePskSecret", "(", "ecdhForLocalDevice", ",", "remotePeerPublicKey", ",", "pskIdentityField", ")", "{", "var", "sxy", "=", "ecdhForLocalDevice", ".", "computeSecret", "(", "remotePeerPublicKey", ")", ";", "return", "HKDF", "(", "module", ".", "exp...
Generates a PSK secret between the local device and a remote peer. @param {ECDH} ecdhForLocalDevice @param {Buffer} remotePeerPublicKey @param {string} pskIdentityField @returns {Buffer}
[ "Generates", "a", "PSK", "secret", "between", "the", "local", "device", "and", "a", "remote", "peer", "." ]
0496da88a125a871d2ebff39359fbbf8ba01fd8f
https://github.com/thaliproject/Thali_CordovaPlugin/blob/0496da88a125a871d2ebff39359fbbf8ba01fd8f/thali/NextGeneration/notification/thaliNotificationBeacons.js#L406-L411
train
thaliproject/Thali_CordovaPlugin
thali/NextGeneration/notification/thaliNotificationBeacons.js
generatePskSecrets
function generatePskSecrets(publicKeysToNotify, ecdhForLocalDevice, beaconStreamWithPreAmble) { var preAmbleSizeInBytes = module.exports.PUBLIC_KEY_SIZE + module.exports.EXPIRATION_SIZE; var preAmble = beaconStreamWithPreAmble.slice(0, preAmbleSizeInBytes...
javascript
function generatePskSecrets(publicKeysToNotify, ecdhForLocalDevice, beaconStreamWithPreAmble) { var preAmbleSizeInBytes = module.exports.PUBLIC_KEY_SIZE + module.exports.EXPIRATION_SIZE; var preAmble = beaconStreamWithPreAmble.slice(0, preAmbleSizeInBytes...
[ "function", "generatePskSecrets", "(", "publicKeysToNotify", ",", "ecdhForLocalDevice", ",", "beaconStreamWithPreAmble", ")", "{", "var", "preAmbleSizeInBytes", "=", "module", ".", "exports", ".", "PUBLIC_KEY_SIZE", "+", "module", ".", "exports", ".", "EXPIRATION_SIZE",...
A dictionary whose key is the identity string sent over TLS and whose value is a keyAndSecret specifying what publicKey this identity is associated with and what secret it needs to provide. @public @typedef {Object.<string, keyAndSecret>} pskMap This function takes a list of public keys and the device's ECDH private...
[ "A", "dictionary", "whose", "key", "is", "the", "identity", "string", "sent", "over", "TLS", "and", "whose", "value", "is", "a", "keyAndSecret", "specifying", "what", "publicKey", "this", "identity", "is", "associated", "with", "and", "what", "secret", "it", ...
0496da88a125a871d2ebff39359fbbf8ba01fd8f
https://github.com/thaliproject/Thali_CordovaPlugin/blob/0496da88a125a871d2ebff39359fbbf8ba01fd8f/thali/NextGeneration/notification/thaliNotificationBeacons.js#L461-L492
train
thaliproject/Thali_CordovaPlugin
thali/NextGeneration/thaliPeerPool/thaliPeerAction.js
PeerAction
function PeerAction (peerIdentifier, connectionType, actionType, pskIdentity, pskKey) { EventEmitter.call(this); this._peerIdentifier = peerIdentifier; this._connectionType = connectionType; this._actionType = actionType; this._pskIdentity = pskIdentity; this._pskKey = pskKey; this._a...
javascript
function PeerAction (peerIdentifier, connectionType, actionType, pskIdentity, pskKey) { EventEmitter.call(this); this._peerIdentifier = peerIdentifier; this._connectionType = connectionType; this._actionType = actionType; this._pskIdentity = pskIdentity; this._pskKey = pskKey; this._a...
[ "function", "PeerAction", "(", "peerIdentifier", ",", "connectionType", ",", "actionType", ",", "pskIdentity", ",", "pskKey", ")", "{", "EventEmitter", ".", "call", "(", "this", ")", ";", "this", ".", "_peerIdentifier", "=", "peerIdentifier", ";", "this", ".",...
This event is emitted synchronously when action state is changed to KILLED. @event killed @public An action that has been given to the pool to manage. When an action is created its state MUST be CREATED. BugBug: In a sane world we would have limits on how long an action can run and we would even set up those limit...
[ "This", "event", "is", "emitted", "synchronously", "when", "action", "state", "is", "changed", "to", "KILLED", "." ]
0496da88a125a871d2ebff39359fbbf8ba01fd8f
https://github.com/thaliproject/Thali_CordovaPlugin/blob/0496da88a125a871d2ebff39359fbbf8ba01fd8f/thali/NextGeneration/thaliPeerPool/thaliPeerAction.js#L55-L67
train
PeculiarVentures/xadesjs
examples/html/src/helper.js
BrowserInfo
function BrowserInfo() { var res = { name: "", version: "" }; var userAgent = self.navigator.userAgent; var reg; if (reg = /edge\/([\d\.]+)/i.exec(userAgent)) { res.name = Browser.Edge; res.version = reg[1]; } else if (/msie/i.test(userAgent)) { res.na...
javascript
function BrowserInfo() { var res = { name: "", version: "" }; var userAgent = self.navigator.userAgent; var reg; if (reg = /edge\/([\d\.]+)/i.exec(userAgent)) { res.name = Browser.Edge; res.version = reg[1]; } else if (/msie/i.test(userAgent)) { res.na...
[ "function", "BrowserInfo", "(", ")", "{", "var", "res", "=", "{", "name", ":", "\"\"", ",", "version", ":", "\"\"", "}", ";", "var", "userAgent", "=", "self", ".", "navigator", ".", "userAgent", ";", "var", "reg", ";", "if", "(", "reg", "=", "/", ...
Returns info about browser
[ "Returns", "info", "about", "browser" ]
c35e3895868bdcfb52e2b29685efc50c877cd1f1
https://github.com/PeculiarVentures/xadesjs/blob/c35e3895868bdcfb52e2b29685efc50c877cd1f1/examples/html/src/helper.js#L11-L43
train
freeCodeCamp/curriculum
unpack.js
createUnpackedBundle
function createUnpackedBundle() { fs.mkdirp(unpackedDir, err => { if (err && err.code !== 'EEXIST') { console.log(err); throw err; } let unpackedFile = path.join(__dirname, 'unpacked.js'); let b = browserify(unpackedFile).bundle(); b.on('error', console.error); let unpackedBundleF...
javascript
function createUnpackedBundle() { fs.mkdirp(unpackedDir, err => { if (err && err.code !== 'EEXIST') { console.log(err); throw err; } let unpackedFile = path.join(__dirname, 'unpacked.js'); let b = browserify(unpackedFile).bundle(); b.on('error', console.error); let unpackedBundleF...
[ "function", "createUnpackedBundle", "(", ")", "{", "fs", ".", "mkdirp", "(", "unpackedDir", ",", "err", "=>", "{", "if", "(", "err", "&&", "err", ".", "code", "!==", "'EEXIST'", ")", "{", "console", ".", "log", "(", "err", ")", ";", "throw", "err", ...
bundle up the test-running JS
[ "bundle", "up", "the", "test", "-", "running", "JS" ]
9c5686cbb700fb7c1443aee81592096f3c61b944
https://github.com/freeCodeCamp/curriculum/blob/9c5686cbb700fb7c1443aee81592096f3c61b944/unpack.js#L20-L42
train
jorgebay/node-cassandra-cql
lib/types.js
function (query, params, stringifier) { if (!query || !query.length || !params) { return query; } if (!stringifier) { stringifier = function (a) {return a.toString()}; } var parts = []; var isLiteral = false; var lastIndex = 0; var paramsCounter = 0; for (var i = 0; i < q...
javascript
function (query, params, stringifier) { if (!query || !query.length || !params) { return query; } if (!stringifier) { stringifier = function (a) {return a.toString()}; } var parts = []; var isLiteral = false; var lastIndex = 0; var paramsCounter = 0; for (var i = 0; i < q...
[ "function", "(", "query", ",", "params", ",", "stringifier", ")", "{", "if", "(", "!", "query", "||", "!", "query", ".", "length", "||", "!", "params", ")", "{", "return", "query", ";", "}", "if", "(", "!", "stringifier", ")", "{", "stringifier", "...
Replaced the query place holders with the stringified value @param {String} query @param {Array} params @param {Function} stringifier
[ "Replaced", "the", "query", "place", "holders", "with", "the", "stringified", "value" ]
2136de4cdde4219f9b4ba754a8f0c043077a83f2
https://github.com/jorgebay/node-cassandra-cql/blob/2136de4cdde4219f9b4ba754a8f0c043077a83f2/lib/types.js#L105-L131
train
jorgebay/node-cassandra-cql
lib/types.js
FrameHeader
function FrameHeader(values) { if (values) { if (values instanceof Buffer) { this.fromBuffer(values); } else { for (var prop in values) { this[prop] = values[prop]; } } } }
javascript
function FrameHeader(values) { if (values) { if (values instanceof Buffer) { this.fromBuffer(values); } else { for (var prop in values) { this[prop] = values[prop]; } } } }
[ "function", "FrameHeader", "(", "values", ")", "{", "if", "(", "values", ")", "{", "if", "(", "values", "instanceof", "Buffer", ")", "{", "this", ".", "fromBuffer", "(", "values", ")", ";", "}", "else", "{", "for", "(", "var", "prop", "in", "values",...
classes Represents a frame header that could be used to read from a Buffer or to write to a Buffer
[ "classes", "Represents", "a", "frame", "header", "that", "could", "be", "used", "to", "read", "from", "a", "Buffer", "or", "to", "write", "to", "a", "Buffer" ]
2136de4cdde4219f9b4ba754a8f0c043077a83f2
https://github.com/jorgebay/node-cassandra-cql/blob/2136de4cdde4219f9b4ba754a8f0c043077a83f2/lib/types.js#L187-L198
train
jorgebay/node-cassandra-cql
lib/types.js
QueueWhile
function QueueWhile(test, delayRetry) { this.queue = async.queue(function (task, queueCallback) { async.whilst( test, function(cb) { //Retry in a while if (delayRetry) { setTimeout(cb, delayRetry); } else { setImmediate(cb); } }, ...
javascript
function QueueWhile(test, delayRetry) { this.queue = async.queue(function (task, queueCallback) { async.whilst( test, function(cb) { //Retry in a while if (delayRetry) { setTimeout(cb, delayRetry); } else { setImmediate(cb); } }, ...
[ "function", "QueueWhile", "(", "test", ",", "delayRetry", ")", "{", "this", ".", "queue", "=", "async", ".", "queue", "(", "function", "(", "task", ",", "queueCallback", ")", "{", "async", ".", "whilst", "(", "test", ",", "function", "(", "cb", ")", ...
Queues callbacks while the condition tests true. Similar behaviour as async.whilst.
[ "Queues", "callbacks", "while", "the", "condition", "tests", "true", ".", "Similar", "behaviour", "as", "async", ".", "whilst", "." ]
2136de4cdde4219f9b4ba754a8f0c043077a83f2
https://github.com/jorgebay/node-cassandra-cql/blob/2136de4cdde4219f9b4ba754a8f0c043077a83f2/lib/types.js#L277-L295
train
jorgebay/node-cassandra-cql
lib/types.js
DriverError
function DriverError (message, constructor) { if (constructor) { Error.captureStackTrace(this, constructor); this.name = constructor.name; } this.message = message || 'Error'; this.info = 'Cassandra Driver Error'; }
javascript
function DriverError (message, constructor) { if (constructor) { Error.captureStackTrace(this, constructor); this.name = constructor.name; } this.message = message || 'Error'; this.info = 'Cassandra Driver Error'; }
[ "function", "DriverError", "(", "message", ",", "constructor", ")", "{", "if", "(", "constructor", ")", "{", "Error", ".", "captureStackTrace", "(", "this", ",", "constructor", ")", ";", "this", ".", "name", "=", "constructor", ".", "name", ";", "}", "th...
error classes Base Error
[ "error", "classes", "Base", "Error" ]
2136de4cdde4219f9b4ba754a8f0c043077a83f2
https://github.com/jorgebay/node-cassandra-cql/blob/2136de4cdde4219f9b4ba754a8f0c043077a83f2/lib/types.js#L356-L363
train
jorgebay/node-cassandra-cql
lib/utils.js
copyBuffer
function copyBuffer(buf) { var targetBuffer = new Buffer(buf.length); buf.copy(targetBuffer); return targetBuffer; }
javascript
function copyBuffer(buf) { var targetBuffer = new Buffer(buf.length); buf.copy(targetBuffer); return targetBuffer; }
[ "function", "copyBuffer", "(", "buf", ")", "{", "var", "targetBuffer", "=", "new", "Buffer", "(", "buf", ".", "length", ")", ";", "buf", ".", "copy", "(", "targetBuffer", ")", ";", "return", "targetBuffer", ";", "}" ]
Creates a copy of a buffer
[ "Creates", "a", "copy", "of", "a", "buffer" ]
2136de4cdde4219f9b4ba754a8f0c043077a83f2
https://github.com/jorgebay/node-cassandra-cql/blob/2136de4cdde4219f9b4ba754a8f0c043077a83f2/lib/utils.js#L5-L9
train
jorgebay/node-cassandra-cql
lib/utils.js
totalLength
function totalLength (arr) { if (!arr) { return 0; } var total = 0; arr.forEach(function (item) { var length = item.length; length = length ? length : 0; total += length; }); return total; }
javascript
function totalLength (arr) { if (!arr) { return 0; } var total = 0; arr.forEach(function (item) { var length = item.length; length = length ? length : 0; total += length; }); return total; }
[ "function", "totalLength", "(", "arr", ")", "{", "if", "(", "!", "arr", ")", "{", "return", "0", ";", "}", "var", "total", "=", "0", ";", "arr", ".", "forEach", "(", "function", "(", "item", ")", "{", "var", "length", "=", "item", ".", "length", ...
Gets the sum of the length of the items of an array
[ "Gets", "the", "sum", "of", "the", "length", "of", "the", "items", "of", "an", "array" ]
2136de4cdde4219f9b4ba754a8f0c043077a83f2
https://github.com/jorgebay/node-cassandra-cql/blob/2136de4cdde4219f9b4ba754a8f0c043077a83f2/lib/utils.js#L22-L33
train
jorgebay/node-cassandra-cql
index.js
Client
function Client(options) { events.EventEmitter.call(this); //Unlimited amount of listeners for internal event queues by default this.setMaxListeners(0); this.options = utils.extend({}, optionsDefault, options); //current connection index this.connectionIndex = 0; //current connection index for prepared qu...
javascript
function Client(options) { events.EventEmitter.call(this); //Unlimited amount of listeners for internal event queues by default this.setMaxListeners(0); this.options = utils.extend({}, optionsDefault, options); //current connection index this.connectionIndex = 0; //current connection index for prepared qu...
[ "function", "Client", "(", "options", ")", "{", "events", ".", "EventEmitter", ".", "call", "(", "this", ")", ";", "//Unlimited amount of listeners for internal event queues by default", "this", ".", "setMaxListeners", "(", "0", ")", ";", "this", ".", "options", "...
Represents a pool of connection to multiple hosts
[ "Represents", "a", "pool", "of", "connection", "to", "multiple", "hosts" ]
2136de4cdde4219f9b4ba754a8f0c043077a83f2
https://github.com/jorgebay/node-cassandra-cql/blob/2136de4cdde4219f9b4ba754a8f0c043077a83f2/index.js#L24-L36
train
jorgebay/node-cassandra-cql
lib/writers.js
BatchWriter
function BatchWriter(queries, consistency, options) { this.queries = queries; options = utils.extend({atomic: true}, options); this.type = options.atomic ? 0 : 1; this.type = options.counter ? 2 : this.type; this.consistency = consistency; this.streamId = null; if (consistency === null || typeof consisten...
javascript
function BatchWriter(queries, consistency, options) { this.queries = queries; options = utils.extend({atomic: true}, options); this.type = options.atomic ? 0 : 1; this.type = options.counter ? 2 : this.type; this.consistency = consistency; this.streamId = null; if (consistency === null || typeof consisten...
[ "function", "BatchWriter", "(", "queries", ",", "consistency", ",", "options", ")", "{", "this", ".", "queries", "=", "queries", ";", "options", "=", "utils", ".", "extend", "(", "{", "atomic", ":", "true", "}", ",", "options", ")", ";", "this", ".", ...
Writes a batch request @param {Array} queries Array of objects with the properties query and params @constructor
[ "Writes", "a", "batch", "request" ]
2136de4cdde4219f9b4ba754a8f0c043077a83f2
https://github.com/jorgebay/node-cassandra-cql/blob/2136de4cdde4219f9b4ba754a8f0c043077a83f2/lib/writers.js#L266-L276
train
silvermine/videojs-quality-selector
src/js/components/QualitySelector.js
function(source) { var src = (source ? source.src : undefined); if (this.selectedSrc !== src) { this.selectedSrc = src; this.update(); } }
javascript
function(source) { var src = (source ? source.src : undefined); if (this.selectedSrc !== src) { this.selectedSrc = src; this.update(); } }
[ "function", "(", "source", ")", "{", "var", "src", "=", "(", "source", "?", "source", ".", "src", ":", "undefined", ")", ";", "if", "(", "this", ".", "selectedSrc", "!==", "src", ")", "{", "this", ".", "selectedSrc", "=", "src", ";", "this", ".", ...
Updates the source that is selected in the menu @param source {object} player source to display as selected
[ "Updates", "the", "source", "that", "is", "selected", "in", "the", "menu" ]
57ab38e9118c6a4661835fe9fa38c2ee03efebb2
https://github.com/silvermine/videojs-quality-selector/blob/57ab38e9118c6a4661835fe9fa38c2ee03efebb2/src/js/components/QualitySelector.js#L57-L64
train
Hypercubed/svgsaver
lib/svgsaver.js
cloneSvg
function cloneSvg(src, attrs, styles) { var clonedSvg = src.cloneNode(true); domWalk(src, clonedSvg, function (src, tgt) { if (tgt.style) { (0, _computedStyles2['default'])(src, tgt.style, styles); } }, function (src, tgt) { if (tgt.style && tgt.parentNode) { cleanStyle(tgt); } if...
javascript
function cloneSvg(src, attrs, styles) { var clonedSvg = src.cloneNode(true); domWalk(src, clonedSvg, function (src, tgt) { if (tgt.style) { (0, _computedStyles2['default'])(src, tgt.style, styles); } }, function (src, tgt) { if (tgt.style && tgt.parentNode) { cleanStyle(tgt); } if...
[ "function", "cloneSvg", "(", "src", ",", "attrs", ",", "styles", ")", "{", "var", "clonedSvg", "=", "src", ".", "cloneNode", "(", "true", ")", ";", "domWalk", "(", "src", ",", "clonedSvg", ",", "function", "(", "src", ",", "tgt", ")", "{", "if", "(...
Clones an SVGElement, copies approprate atttributes and styles.
[ "Clones", "an", "SVGElement", "copies", "approprate", "atttributes", "and", "styles", "." ]
aa4a9f270629acdba35cd1b4fea57122c7dba45f
https://github.com/Hypercubed/svgsaver/blob/aa4a9f270629acdba35cd1b4fea57122c7dba45f/lib/svgsaver.js#L163-L180
train
Hypercubed/svgsaver
src/clonesvg.js
cleanAttrs
function cleanAttrs (el, attrs, styles) { // attrs === false - remove all, attrs === true - allow all if (attrs === true) { return; } Array.prototype.slice.call(el.attributes) .forEach(function (attr) { // remove if it is not style nor on attrs whitelist // keeping attributes that are also styles...
javascript
function cleanAttrs (el, attrs, styles) { // attrs === false - remove all, attrs === true - allow all if (attrs === true) { return; } Array.prototype.slice.call(el.attributes) .forEach(function (attr) { // remove if it is not style nor on attrs whitelist // keeping attributes that are also styles...
[ "function", "cleanAttrs", "(", "el", ",", "attrs", ",", "styles", ")", "{", "// attrs === false - remove all, attrs === true - allow all", "if", "(", "attrs", "===", "true", ")", "{", "return", ";", "}", "Array", ".", "prototype", ".", "slice", ".", "call", "(...
Removes attributes that are not valid for SVGs
[ "Removes", "attributes", "that", "are", "not", "valid", "for", "SVGs" ]
aa4a9f270629acdba35cd1b4fea57122c7dba45f
https://github.com/Hypercubed/svgsaver/blob/aa4a9f270629acdba35cd1b4fea57122c7dba45f/src/clonesvg.js#L7-L20
train
custom-select/custom-select
src/index.js
setFocusedElement
function setFocusedElement(cstOption) { if (focusedElement) { focusedElement.classList.remove(builderParams.hasFocusClass); } if (typeof cstOption !== 'undefined') { focusedElement = cstOption; focusedElement.classList.add(builderParams.hasFocusClass); // Offset update: checks if the...
javascript
function setFocusedElement(cstOption) { if (focusedElement) { focusedElement.classList.remove(builderParams.hasFocusClass); } if (typeof cstOption !== 'undefined') { focusedElement = cstOption; focusedElement.classList.add(builderParams.hasFocusClass); // Offset update: checks if the...
[ "function", "setFocusedElement", "(", "cstOption", ")", "{", "if", "(", "focusedElement", ")", "{", "focusedElement", ".", "classList", ".", "remove", "(", "builderParams", ".", "hasFocusClass", ")", ";", "}", "if", "(", "typeof", "cstOption", "!==", "'undefin...
Inner Functions Sets the focused element with the neccessary classes substitutions
[ "Inner", "Functions", "Sets", "the", "focused", "element", "with", "the", "neccessary", "classes", "substitutions" ]
388f40c79355eb38fea64dfc7834970edf020cb4
https://github.com/custom-select/custom-select/blob/388f40c79355eb38fea64dfc7834970edf020cb4/src/index.js#L47-L67
train
Azure/azure-mobile-apps-js-client
sdk/src/Platform/cordova/storeHelper.js
validateTableDefinition
function validateTableDefinition(tableDefinition) { // Do basic table name validation and leave the rest to the store Validate.notNull(tableDefinition, 'tableDefinition'); Validate.isObject(tableDefinition, 'tableDefinition'); Validate.isString(tableDefinition.name, 'tableDefinition.name'); Validat...
javascript
function validateTableDefinition(tableDefinition) { // Do basic table name validation and leave the rest to the store Validate.notNull(tableDefinition, 'tableDefinition'); Validate.isObject(tableDefinition, 'tableDefinition'); Validate.isString(tableDefinition.name, 'tableDefinition.name'); Validat...
[ "function", "validateTableDefinition", "(", "tableDefinition", ")", "{", "// Do basic table name validation and leave the rest to the store", "Validate", ".", "notNull", "(", "tableDefinition", ",", "'tableDefinition'", ")", ";", "Validate", ".", "isObject", "(", "tableDefini...
Validates the table definition @private
[ "Validates", "the", "table", "definition" ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/Platform/cordova/storeHelper.js#L17-L43
train
Azure/azure-mobile-apps-js-client
sdk/src/Platform/cordova/storeHelper.js
addTableDefinition
function addTableDefinition(tableDefinitions, tableDefinition) { Validate.isObject(tableDefinitions); Validate.notNull(tableDefinitions); validateTableDefinition(tableDefinition); tableDefinitions[tableDefinition.name.toLowerCase()] = tableDefinition; }
javascript
function addTableDefinition(tableDefinitions, tableDefinition) { Validate.isObject(tableDefinitions); Validate.notNull(tableDefinitions); validateTableDefinition(tableDefinition); tableDefinitions[tableDefinition.name.toLowerCase()] = tableDefinition; }
[ "function", "addTableDefinition", "(", "tableDefinitions", ",", "tableDefinition", ")", "{", "Validate", ".", "isObject", "(", "tableDefinitions", ")", ";", "Validate", ".", "notNull", "(", "tableDefinitions", ")", ";", "validateTableDefinition", "(", "tableDefinition...
Adds a tableDefinition to the tableDefinitions object @private
[ "Adds", "a", "tableDefinition", "to", "the", "tableDefinitions", "object" ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/Platform/cordova/storeHelper.js#L49-L55
train
Azure/azure-mobile-apps-js-client
sdk/src/Platform/cordova/storeHelper.js
getTableDefinition
function getTableDefinition(tableDefinitions, tableName) { Validate.isObject(tableDefinitions); Validate.notNull(tableDefinitions); Validate.isString(tableName); Validate.notNullOrEmpty(tableName); return tableDefinitions[tableName.toLowerCase()]; }
javascript
function getTableDefinition(tableDefinitions, tableName) { Validate.isObject(tableDefinitions); Validate.notNull(tableDefinitions); Validate.isString(tableName); Validate.notNullOrEmpty(tableName); return tableDefinitions[tableName.toLowerCase()]; }
[ "function", "getTableDefinition", "(", "tableDefinitions", ",", "tableName", ")", "{", "Validate", ".", "isObject", "(", "tableDefinitions", ")", ";", "Validate", ".", "notNull", "(", "tableDefinitions", ")", ";", "Validate", ".", "isString", "(", "tableName", "...
Gets the table definition for the specified table name from the tableDefinitions object @private
[ "Gets", "the", "table", "definition", "for", "the", "specified", "table", "name", "from", "the", "tableDefinitions", "object" ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/Platform/cordova/storeHelper.js#L61-L68
train
Azure/azure-mobile-apps-js-client
sdk/src/Platform/cordova/storeHelper.js
getColumnType
function getColumnType(columnDefinitions, columnName) { Validate.isObject(columnDefinitions); Validate.notNull(columnDefinitions); Validate.isString(columnName); Validate.notNullOrEmpty(columnName); for (var column in columnDefinitions) { if (column.toLowerCase() === columnName.toLowerCase(...
javascript
function getColumnType(columnDefinitions, columnName) { Validate.isObject(columnDefinitions); Validate.notNull(columnDefinitions); Validate.isString(columnName); Validate.notNullOrEmpty(columnName); for (var column in columnDefinitions) { if (column.toLowerCase() === columnName.toLowerCase(...
[ "function", "getColumnType", "(", "columnDefinitions", ",", "columnName", ")", "{", "Validate", ".", "isObject", "(", "columnDefinitions", ")", ";", "Validate", ".", "notNull", "(", "columnDefinitions", ")", ";", "Validate", ".", "isString", "(", "columnName", "...
Gets the type of the specified column @private
[ "Gets", "the", "type", "of", "the", "specified", "column" ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/Platform/cordova/storeHelper.js#L74-L85
train
Azure/azure-mobile-apps-js-client
sdk/src/Platform/cordova/storeHelper.js
getColumnName
function getColumnName(columnDefinitions, property) { Validate.isObject(columnDefinitions); Validate.notNull(columnDefinitions); Validate.isString(property); Validate.notNullOrEmpty(property); for (var column in columnDefinitions) { if (column.toLowerCase() === property.toLowerCase()) { ...
javascript
function getColumnName(columnDefinitions, property) { Validate.isObject(columnDefinitions); Validate.notNull(columnDefinitions); Validate.isString(property); Validate.notNullOrEmpty(property); for (var column in columnDefinitions) { if (column.toLowerCase() === property.toLowerCase()) { ...
[ "function", "getColumnName", "(", "columnDefinitions", ",", "property", ")", "{", "Validate", ".", "isObject", "(", "columnDefinitions", ")", ";", "Validate", ".", "notNull", "(", "columnDefinitions", ")", ";", "Validate", ".", "isString", "(", "property", ")", ...
Returns the column name in the column definitions that matches the specified property @private
[ "Returns", "the", "column", "name", "in", "the", "column", "definitions", "that", "matches", "the", "specified", "property" ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/Platform/cordova/storeHelper.js#L91-L104
train
Azure/azure-mobile-apps-js-client
sdk/src/Platform/cordova/storeHelper.js
getId
function getId(record) { Validate.isObject(record); Validate.notNull(record); for (var property in record) { if (property.toLowerCase() === idPropertyName.toLowerCase()) { return record[property]; } } }
javascript
function getId(record) { Validate.isObject(record); Validate.notNull(record); for (var property in record) { if (property.toLowerCase() === idPropertyName.toLowerCase()) { return record[property]; } } }
[ "function", "getId", "(", "record", ")", "{", "Validate", ".", "isObject", "(", "record", ")", ";", "Validate", ".", "notNull", "(", "record", ")", ";", "for", "(", "var", "property", "in", "record", ")", "{", "if", "(", "property", ".", "toLowerCase",...
Returns the Id property value OR undefined if none exists @private
[ "Returns", "the", "Id", "property", "value", "OR", "undefined", "if", "none", "exists" ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/Platform/cordova/storeHelper.js#L110-L119
train
Azure/azure-mobile-apps-js-client
sdk/src/Platform/cordova/storeHelper.js
isId
function isId(property) { Validate.isString(property); Validate.notNullOrEmpty(property); return property.toLowerCase() === idPropertyName.toLowerCase(); }
javascript
function isId(property) { Validate.isString(property); Validate.notNullOrEmpty(property); return property.toLowerCase() === idPropertyName.toLowerCase(); }
[ "function", "isId", "(", "property", ")", "{", "Validate", ".", "isString", "(", "property", ")", ";", "Validate", ".", "notNullOrEmpty", "(", "property", ")", ";", "return", "property", ".", "toLowerCase", "(", ")", "===", "idPropertyName", ".", "toLowerCas...
Checks if property is an ID property. @private
[ "Checks", "if", "property", "is", "an", "ID", "property", "." ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/Platform/cordova/storeHelper.js#L125-L130
train
Azure/azure-mobile-apps-js-client
sdk/src/sync/MobileServiceSyncContext.js
upsertWithLogging
function upsertWithLogging(tableName, instance, action, shouldOverwrite) { Validate.isString(tableName, 'tableName'); Validate.notNullOrEmpty(tableName, 'tableName'); Validate.notNull(instance, 'instance'); Validate.isValidId(instance.id, 'instance.id'); if (!store) { ...
javascript
function upsertWithLogging(tableName, instance, action, shouldOverwrite) { Validate.isString(tableName, 'tableName'); Validate.notNullOrEmpty(tableName, 'tableName'); Validate.notNull(instance, 'instance'); Validate.isValidId(instance.id, 'instance.id'); if (!store) { ...
[ "function", "upsertWithLogging", "(", "tableName", ",", "instance", ",", "action", ",", "shouldOverwrite", ")", "{", "Validate", ".", "isString", "(", "tableName", ",", "'tableName'", ")", ";", "Validate", ".", "notNullOrEmpty", "(", "tableName", ",", "'tableNam...
Performs upsert and logs the action in the operation table Validates parameters. Callers can skip validation
[ "Performs", "upsert", "and", "logs", "the", "action", "in", "the", "operation", "table", "Validates", "parameters", ".", "Callers", "can", "skip", "validation" ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/sync/MobileServiceSyncContext.js#L332-L361
train
Azure/azure-mobile-apps-js-client
sdk/src/Platform/cordova/sqliteSerializer.js
getSqliteType
function getSqliteType (columnType) { var sqliteType; switch (columnType) { case ColumnType.Object: case ColumnType.Array: case ColumnType.String: case ColumnType.Text: sqliteType = "TEXT"; break; case ColumnType.Integer: case ColumnType.I...
javascript
function getSqliteType (columnType) { var sqliteType; switch (columnType) { case ColumnType.Object: case ColumnType.Array: case ColumnType.String: case ColumnType.Text: sqliteType = "TEXT"; break; case ColumnType.Integer: case ColumnType.I...
[ "function", "getSqliteType", "(", "columnType", ")", "{", "var", "sqliteType", ";", "switch", "(", "columnType", ")", "{", "case", "ColumnType", ".", "Object", ":", "case", "ColumnType", ".", "Array", ":", "case", "ColumnType", ".", "String", ":", "case", ...
Gets the SQLite type that matches the specified ColumnType. @private @param columnType - The type of values that will be stored in the SQLite table @throw Will throw an error if columnType is not supported
[ "Gets", "the", "SQLite", "type", "that", "matches", "the", "specified", "ColumnType", "." ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/Platform/cordova/sqliteSerializer.js#L26-L52
train
Azure/azure-mobile-apps-js-client
sdk/src/Platform/cordova/sqliteSerializer.js
serialize
function serialize (value, columnDefinitions) { var serializedValue = {}; try { Validate.notNull(columnDefinitions, 'columnDefinitions'); Validate.isObject(columnDefinitions); Validate.notNull(value); Validate.isObject(value); for (var property in value) { ...
javascript
function serialize (value, columnDefinitions) { var serializedValue = {}; try { Validate.notNull(columnDefinitions, 'columnDefinitions'); Validate.isObject(columnDefinitions); Validate.notNull(value); Validate.isObject(value); for (var property in value) { ...
[ "function", "serialize", "(", "value", ",", "columnDefinitions", ")", "{", "var", "serializedValue", "=", "{", "}", ";", "try", "{", "Validate", ".", "notNull", "(", "columnDefinitions", ",", "'columnDefinitions'", ")", ";", "Validate", ".", "isObject", "(", ...
Serializes an object into an object that can be stored in a SQLite table, as defined by columnDefinitions. @private
[ "Serializes", "an", "object", "into", "an", "object", "that", "can", "be", "stored", "in", "a", "SQLite", "table", "as", "defined", "by", "columnDefinitions", "." ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/Platform/cordova/sqliteSerializer.js#L145-L170
train
Azure/azure-mobile-apps-js-client
sdk/src/Platform/cordova/sqliteSerializer.js
deserialize
function deserialize (value, columnDefinitions) { var deserializedValue = {}; try { Validate.notNull(columnDefinitions, 'columnDefinitions'); Validate.isObject(columnDefinitions); Validate.notNull(value); Validate.isObject(value); for (var property in value) { ...
javascript
function deserialize (value, columnDefinitions) { var deserializedValue = {}; try { Validate.notNull(columnDefinitions, 'columnDefinitions'); Validate.isObject(columnDefinitions); Validate.notNull(value); Validate.isObject(value); for (var property in value) { ...
[ "function", "deserialize", "(", "value", ",", "columnDefinitions", ")", "{", "var", "deserializedValue", "=", "{", "}", ";", "try", "{", "Validate", ".", "notNull", "(", "columnDefinitions", ",", "'columnDefinitions'", ")", ";", "Validate", ".", "isObject", "(...
Deserializes a row read from a SQLite table into a Javascript object, as defined by columnDefinitions. @private
[ "Deserializes", "a", "row", "read", "from", "a", "SQLite", "table", "into", "a", "Javascript", "object", "as", "defined", "by", "columnDefinitions", "." ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/Platform/cordova/sqliteSerializer.js#L176-L197
train
Azure/azure-mobile-apps-js-client
sdk/src/Platform/cordova/sqliteSerializer.js
serializeMember
function serializeMember(value, columnType) { // Start by checking if the specified column type is valid if (!isColumnTypeValid(columnType)) { throw new Error('Column type ' + columnType + ' is not supported'); } // Now check if the specified value can be stored in a column of type columnT...
javascript
function serializeMember(value, columnType) { // Start by checking if the specified column type is valid if (!isColumnTypeValid(columnType)) { throw new Error('Column type ' + columnType + ' is not supported'); } // Now check if the specified value can be stored in a column of type columnT...
[ "function", "serializeMember", "(", "value", ",", "columnType", ")", "{", "// Start by checking if the specified column type is valid", "if", "(", "!", "isColumnTypeValid", "(", "columnType", ")", ")", "{", "throw", "new", "Error", "(", "'Column type '", "+", "columnT...
Serializes a property of an object into a value which can be stored in a SQLite column of type columnType. @private
[ "Serializes", "a", "property", "of", "an", "object", "into", "a", "value", "which", "can", "be", "stored", "in", "a", "SQLite", "column", "of", "type", "columnType", "." ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/Platform/cordova/sqliteSerializer.js#L203-L235
train
Azure/azure-mobile-apps-js-client
sdk/src/Platform/cordova/sqliteSerializer.js
deserializeMember
function deserializeMember(value, columnType) { // Handle this special case first. // Simply return 'value' if a corresponding columnType is not defined. if (!columnType) { return value; } // Start by checking if the specified column type is valid. if (!isColumnTypeValid(columnT...
javascript
function deserializeMember(value, columnType) { // Handle this special case first. // Simply return 'value' if a corresponding columnType is not defined. if (!columnType) { return value; } // Start by checking if the specified column type is valid. if (!isColumnTypeValid(columnT...
[ "function", "deserializeMember", "(", "value", ",", "columnType", ")", "{", "// Handle this special case first.", "// Simply return 'value' if a corresponding columnType is not defined. ", "if", "(", "!", "columnType", ")", "{", "return", "value", ";", "}", "// Start by che...
Deserializes a property of an object read from SQLite into a value of type columnType
[ "Deserializes", "a", "property", "of", "an", "object", "read", "from", "SQLite", "into", "a", "value", "of", "type", "columnType" ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/Platform/cordova/sqliteSerializer.js#L238-L292
train
Azure/azure-mobile-apps-js-client
sdk/src/Platform/cordova/sqliteSerializer.js
serializeValue
function serializeValue(value) { var type; if ( _.isNull(value) ) { type = ColumnType.Object; } else if ( _.isNumber(value) ) { type = ColumnType.Real; } else if ( _.isDate(value) ) { type = ColumnType.Date; } else if ( _.isBool(value) ) { type = ColumnType.Boolean; ...
javascript
function serializeValue(value) { var type; if ( _.isNull(value) ) { type = ColumnType.Object; } else if ( _.isNumber(value) ) { type = ColumnType.Real; } else if ( _.isDate(value) ) { type = ColumnType.Date; } else if ( _.isBool(value) ) { type = ColumnType.Boolean; ...
[ "function", "serializeValue", "(", "value", ")", "{", "var", "type", ";", "if", "(", "_", ".", "isNull", "(", "value", ")", ")", "{", "type", "=", "ColumnType", ".", "Object", ";", "}", "else", "if", "(", "_", ".", "isNumber", "(", "value", ")", ...
Serializes a JS value to its equivalent that will be stored in the store. This method is useful while querying to convert values to their store representations. @private
[ "Serializes", "a", "JS", "value", "to", "its", "equivalent", "that", "will", "be", "stored", "in", "the", "store", ".", "This", "method", "is", "useful", "while", "querying", "to", "convert", "values", "to", "their", "store", "representations", "." ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/Platform/cordova/sqliteSerializer.js#L299-L321
train
Azure/azure-mobile-apps-js-client
sdk/src/Utilities/taskRunner.js
run
function run(task) { return Platform.async(function(callback) { // parameter validation Validate.isFunction(task); Validate.isFunction(callback); // Add the task to the queue of pending tasks and trigger task processing queue.push({ ...
javascript
function run(task) { return Platform.async(function(callback) { // parameter validation Validate.isFunction(task); Validate.isFunction(callback); // Add the task to the queue of pending tasks and trigger task processing queue.push({ ...
[ "function", "run", "(", "task", ")", "{", "return", "Platform", ".", "async", "(", "function", "(", "callback", ")", "{", "// parameter validation", "Validate", ".", "isFunction", "(", "task", ")", ";", "Validate", ".", "isFunction", "(", "callback", ")", ...
Runs the specified task asynchronously after all the earlier tasks have completed @param task Function / task to be executed. The task can either be a synchronous function or can return a promise. @returns A promise that is resolved with the value returned by the task. If the task fails the promise is rejected.
[ "Runs", "the", "specified", "task", "asynchronously", "after", "all", "the", "earlier", "tasks", "have", "completed" ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/Utilities/taskRunner.js#L27-L40
train
Azure/azure-mobile-apps-js-client
sdk/src/Utilities/taskRunner.js
processTask
function processTask() { setTimeout(function() { if (isBusy || queue.length === 0) { return; } isBusy = true; var next = queue.shift(), result, error; Platform.async(function(callback) { // Start a pro...
javascript
function processTask() { setTimeout(function() { if (isBusy || queue.length === 0) { return; } isBusy = true; var next = queue.shift(), result, error; Platform.async(function(callback) { // Start a pro...
[ "function", "processTask", "(", ")", "{", "setTimeout", "(", "function", "(", ")", "{", "if", "(", "isBusy", "||", "queue", ".", "length", "===", "0", ")", "{", "return", ";", "}", "isBusy", "=", "true", ";", "var", "next", "=", "queue", ".", "shif...
Asynchronously executes the first pending task
[ "Asynchronously", "executes", "the", "first", "pending", "task" ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/Utilities/taskRunner.js#L45-L71
train
Azure/azure-mobile-apps-js-client
sdk/src/sync/pull.js
initialize
function initialize () { return pullTaskRunner.run(function() { return store.defineTable({ name: pulltimeTableName, columnDefinitions: { id: 'string', // column for storing queryId tableName: 'string', // column for storing tabl...
javascript
function initialize () { return pullTaskRunner.run(function() { return store.defineTable({ name: pulltimeTableName, columnDefinitions: { id: 'string', // column for storing queryId tableName: 'string', // column for storing tabl...
[ "function", "initialize", "(", ")", "{", "return", "pullTaskRunner", ".", "run", "(", "function", "(", ")", "{", "return", "store", ".", "defineTable", "(", "{", "name", ":", "pulltimeTableName", ",", "columnDefinitions", ":", "{", "id", ":", "'string'", "...
Creates and initializes the table used to store the state for performing incremental pull
[ "Creates", "and", "initializes", "the", "table", "used", "to", "store", "the", "state", "for", "performing", "incremental", "pull" ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/sync/pull.js#L42-L53
train
Azure/azure-mobile-apps-js-client
sdk/src/sync/pull.js
pull
function pull(query, queryId, settings) { //TODO: support pullQueryId //TODO: page size should be configurable return pullTaskRunner.run(function() { validateQuery(query, 'query'); Validate.isString(queryId, 'queryId'); // non-null string or null - both are valid...
javascript
function pull(query, queryId, settings) { //TODO: support pullQueryId //TODO: page size should be configurable return pullTaskRunner.run(function() { validateQuery(query, 'query'); Validate.isString(queryId, 'queryId'); // non-null string or null - both are valid...
[ "function", "pull", "(", "query", ",", "queryId", ",", "settings", ")", "{", "//TODO: support pullQueryId", "//TODO: page size should be configurable", "return", "pullTaskRunner", ".", "run", "(", "function", "(", ")", "{", "validateQuery", "(", "query", ",", "'quer...
Pulls changes from the server tables into the local store. @param query Query specifying which records to pull @param pullQueryId A unique string ID for an incremental pull query OR null for a vanilla pull query. @param [settings] An object that defines the various pull settings - currently only pageSize @returns A p...
[ "Pulls", "changes", "from", "the", "server", "tables", "into", "the", "local", "store", "." ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/sync/pull.js#L64-L94
train
Azure/azure-mobile-apps-js-client
sdk/src/sync/pull.js
pullAllPages
function pullAllPages() { // 1. Pull one page // 2. Check if Pull is complete // 3. If it is complete, go to 5. If not, update the query to fetch the next page. // 4. Go to 1 // 5. DONE return pullPage().then(function(pulledRecords) { if (!isPullComplete(pulle...
javascript
function pullAllPages() { // 1. Pull one page // 2. Check if Pull is complete // 3. If it is complete, go to 5. If not, update the query to fetch the next page. // 4. Go to 1 // 5. DONE return pullPage().then(function(pulledRecords) { if (!isPullComplete(pulle...
[ "function", "pullAllPages", "(", ")", "{", "// 1. Pull one page", "// 2. Check if Pull is complete", "// 3. If it is complete, go to 5. If not, update the query to fetch the next page.", "// 4. Go to 1", "// 5. DONE", "return", "pullPage", "(", ")", ".", "then", "(", "function", ...
Pulls all pages from the server table, one page at a time.
[ "Pulls", "all", "pages", "from", "the", "server", "table", "one", "page", "at", "a", "time", "." ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/sync/pull.js#L104-L118
train
Azure/azure-mobile-apps-js-client
sdk/src/sync/pull.js
pullPage
function pullPage() { // Define appropriate parameter to enable fetching of deleted records from the server. // Assumption is that soft delete is enabled on the server table. var params = {}; params[tableConstants.includeDeletedFlag] = true; var pulledRecords; ...
javascript
function pullPage() { // Define appropriate parameter to enable fetching of deleted records from the server. // Assumption is that soft delete is enabled on the server table. var params = {}; params[tableConstants.includeDeletedFlag] = true; var pulledRecords; ...
[ "function", "pullPage", "(", ")", "{", "// Define appropriate parameter to enable fetching of deleted records from the server.", "// Assumption is that soft delete is enabled on the server table.", "var", "params", "=", "{", "}", ";", "params", "[", "tableConstants", ".", "includeD...
Pull the page as described by the query
[ "Pull", "the", "page", "as", "described", "by", "the", "query" ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/sync/pull.js#L129-L162
train
Azure/azure-mobile-apps-js-client
sdk/src/sync/pull.js
updateQueryForNextPage
function updateQueryForNextPage(pulledRecords) { return Platform.async(function(callback) { callback(); })().then(function() { if (!pulledRecords) { throw new Error('Something is wrong. pulledRecords cannot be null at this point'); } var ...
javascript
function updateQueryForNextPage(pulledRecords) { return Platform.async(function(callback) { callback(); })().then(function() { if (!pulledRecords) { throw new Error('Something is wrong. pulledRecords cannot be null at this point'); } var ...
[ "function", "updateQueryForNextPage", "(", "pulledRecords", ")", "{", "return", "Platform", ".", "async", "(", "function", "(", "callback", ")", "{", "callback", "(", ")", ";", "}", ")", "(", ")", ".", "then", "(", "function", "(", ")", "{", "if", "(",...
update the query to pull the next page
[ "update", "the", "query", "to", "pull", "the", "next", "page" ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/sync/pull.js#L217-L244
train
Azure/azure-mobile-apps-js-client
sdk/src/sync/pull.js
buildQueryFromLastKnownUpdateAt
function buildQueryFromLastKnownUpdateAt(updatedAt) { lastKnownUpdatedAt = updatedAt; // Make a copy of the table query and tweak it to fetch the next first page pagePullQuery = copyQuery(tablePullQuery); pagePullQuery = pagePullQuery.where(function(lastKnownUpdatedAt) { //...
javascript
function buildQueryFromLastKnownUpdateAt(updatedAt) { lastKnownUpdatedAt = updatedAt; // Make a copy of the table query and tweak it to fetch the next first page pagePullQuery = copyQuery(tablePullQuery); pagePullQuery = pagePullQuery.where(function(lastKnownUpdatedAt) { //...
[ "function", "buildQueryFromLastKnownUpdateAt", "(", "updatedAt", ")", "{", "lastKnownUpdatedAt", "=", "updatedAt", ";", "// Make a copy of the table query and tweak it to fetch the next first page", "pagePullQuery", "=", "copyQuery", "(", "tablePullQuery", ")", ";", "pagePullQuer...
Builds a query to fetch one page Records with updatedAt values >= updatedAt will be fetched
[ "Builds", "a", "query", "to", "fetch", "one", "page", "Records", "with", "updatedAt", "values", ">", "=", "updatedAt", "will", "be", "fetched" ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/sync/pull.js#L248-L262
train
Azure/azure-mobile-apps-js-client
sdk/src/sync/pull.js
onPagePulled
function onPagePulled() { // For incremental pull, make a note of the lastKnownUpdatedAt in the store if (pullQueryId) { return store.upsert(pulltimeTableName, { id: pullQueryId, tableName: pagePullQuery.getComponents().table, value: lastKnown...
javascript
function onPagePulled() { // For incremental pull, make a note of the lastKnownUpdatedAt in the store if (pullQueryId) { return store.upsert(pulltimeTableName, { id: pullQueryId, tableName: pagePullQuery.getComponents().table, value: lastKnown...
[ "function", "onPagePulled", "(", ")", "{", "// For incremental pull, make a note of the lastKnownUpdatedAt in the store", "if", "(", "pullQueryId", ")", "{", "return", "store", ".", "upsert", "(", "pulltimeTableName", ",", "{", "id", ":", "pullQueryId", ",", "tableName"...
Called after a page is pulled and processed
[ "Called", "after", "a", "page", "is", "pulled", "and", "processed" ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/sync/pull.js#L265-L275
train
Azure/azure-mobile-apps-js-client
sdk/src/sync/pull.js
validateQuery
function validateQuery(query) { Validate.isObject(query); Validate.notNull(query); var components = query.getComponents(); for (var i in components.ordering) { throw new Error('orderBy and orderByDescending clauses are not supported in the pull query'); ...
javascript
function validateQuery(query) { Validate.isObject(query); Validate.notNull(query); var components = query.getComponents(); for (var i in components.ordering) { throw new Error('orderBy and orderByDescending clauses are not supported in the pull query'); ...
[ "function", "validateQuery", "(", "query", ")", "{", "Validate", ".", "isObject", "(", "query", ")", ";", "Validate", ".", "notNull", "(", "query", ")", ";", "var", "components", "=", "query", ".", "getComponents", "(", ")", ";", "for", "(", "var", "i"...
Not all query operations are allowed while pulling. This function validates that the query does not perform unsupported operations.
[ "Not", "all", "query", "operations", "are", "allowed", "while", "pulling", ".", "This", "function", "validates", "that", "the", "query", "does", "not", "perform", "unsupported", "operations", "." ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/sync/pull.js#L279-L304
train
Azure/azure-mobile-apps-js-client
sdk/src/sync/pull.js
copyQuery
function copyQuery(query) { var components = query.getComponents(); var queryCopy = new Query(components.table); queryCopy.setComponents(components); return queryCopy; }
javascript
function copyQuery(query) { var components = query.getComponents(); var queryCopy = new Query(components.table); queryCopy.setComponents(components); return queryCopy; }
[ "function", "copyQuery", "(", "query", ")", "{", "var", "components", "=", "query", ".", "getComponents", "(", ")", ";", "var", "queryCopy", "=", "new", "Query", "(", "components", ".", "table", ")", ";", "queryCopy", ".", "setComponents", "(", "components...
Makes a copy of the QueryJS object
[ "Makes", "a", "copy", "of", "the", "QueryJS", "object" ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/sync/pull.js#L307-L313
train
Azure/azure-mobile-apps-js-client
sdk/src/sync/purge.js
purge
function purge(query, forcePurge) { return storeTaskRunner.run(function() { Validate.isObject(query, 'query'); Validate.notNull(query, 'query'); if (!_.isNull(forcePurge)) { Validate.isBool(forcePurge, 'forcePurge'); } // Query for pen...
javascript
function purge(query, forcePurge) { return storeTaskRunner.run(function() { Validate.isObject(query, 'query'); Validate.notNull(query, 'query'); if (!_.isNull(forcePurge)) { Validate.isBool(forcePurge, 'forcePurge'); } // Query for pen...
[ "function", "purge", "(", "query", ",", "forcePurge", ")", "{", "return", "storeTaskRunner", ".", "run", "(", "function", "(", ")", "{", "Validate", ".", "isObject", "(", "query", ",", "'query'", ")", ";", "Validate", ".", "notNull", "(", "query", ",", ...
Purges data, pending operations and incremental sync state associated with a local table A regular purge, would fail if there are any pending operations for the table being purged. A forced purge will proceed even if pending operations for the table being purged exist in the operation table. In addition, it will also d...
[ "Purges", "data", "pending", "operations", "and", "incremental", "sync", "state", "associated", "with", "a", "local", "table", "A", "regular", "purge", "would", "fail", "if", "there", "are", "any", "pending", "operations", "for", "the", "table", "being", "purg...
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/sync/purge.js#L35-L84
train
Azure/azure-mobile-apps-js-client
sdk/src/sync/operations.js
lockOperation
function lockOperation(id) { return runner.run(function() { // Locking a locked operation should have no effect if (lockedOperationId === id) { return; } if (!lockedOperationId) { lockedOperationId = id; ...
javascript
function lockOperation(id) { return runner.run(function() { // Locking a locked operation should have no effect if (lockedOperationId === id) { return; } if (!lockedOperationId) { lockedOperationId = id; ...
[ "function", "lockOperation", "(", "id", ")", "{", "return", "runner", ".", "run", "(", "function", "(", ")", "{", "// Locking a locked operation should have no effect", "if", "(", "lockedOperationId", "===", "id", ")", "{", "return", ";", "}", "if", "(", "!", ...
Locks the operation with the specified id. TODO: Lock state and the value of the locked operation should be persisted. That way we can handle the following scenario: insert -> initiate push -> connection failure after item inserted in server table -> client crashes or cancels push -> client app starts again -> delete ...
[ "Locks", "the", "operation", "with", "the", "specified", "id", "." ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/sync/operations.js#L86-L100
train
Azure/azure-mobile-apps-js-client
sdk/src/sync/operations.js
getCondenseAction
function getCondenseAction(pendingOperation, newAction) { var pendingAction = pendingOperation.action, condenseAction; if (pendingAction === 'insert' && newAction === 'update') { condenseAction = 'nop'; } else if (pendingAction === 'insert' && newAction === 'dele...
javascript
function getCondenseAction(pendingOperation, newAction) { var pendingAction = pendingOperation.action, condenseAction; if (pendingAction === 'insert' && newAction === 'update') { condenseAction = 'nop'; } else if (pendingAction === 'insert' && newAction === 'dele...
[ "function", "getCondenseAction", "(", "pendingOperation", ",", "newAction", ")", "{", "var", "pendingAction", "=", "pendingOperation", ".", "action", ",", "condenseAction", ";", "if", "(", "pendingAction", "===", "'insert'", "&&", "newAction", "===", "'update'", "...
Determines how to condense the new action into the pending operation @returns 'nop' - if no action is needed 'remove' - if the pending operation should be removed 'modify' - if the pending action should be modified to be the new action 'add' - if a new operation should be added
[ "Determines", "how", "to", "condense", "the", "new", "action", "into", "the", "pending", "operation" ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/sync/operations.js#L289-L314
train
Azure/azure-mobile-apps-js-client
sdk/src/sync/operations.js
getOperationForInsertingLog
function getOperationForInsertingLog(tableName, action, item) { return api.getMetadata(tableName, action, item).then(function(metadata) { return { tableName: operationTableName, action: 'upsert', data: { id: ++maxId, ...
javascript
function getOperationForInsertingLog(tableName, action, item) { return api.getMetadata(tableName, action, item).then(function(metadata) { return { tableName: operationTableName, action: 'upsert', data: { id: ++maxId, ...
[ "function", "getOperationForInsertingLog", "(", "tableName", ",", "action", ",", "item", ")", "{", "return", "api", ".", "getMetadata", "(", "tableName", ",", "action", ",", "item", ")", ".", "then", "(", "function", "(", "metadata", ")", "{", "return", "{...
Gets the operation that will insert a new record in the operation table.
[ "Gets", "the", "operation", "that", "will", "insert", "a", "new", "record", "in", "the", "operation", "table", "." ]
bd4f9ba795527fbb95eca0f4ab53eb798934beba
https://github.com/Azure/azure-mobile-apps-js-client/blob/bd4f9ba795527fbb95eca0f4ab53eb798934beba/sdk/src/sync/operations.js#L319-L333
train