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
dsfields/radargun
lib/bench.js
assertThresholds
function assertThresholds(thresholds) { if (!elv(thresholds)) return null; if (typeof thresholds !== 'object') { throw new TypeError(msg.argThresholds); } const avg = elv.coalesce(thresholds.avg, false); const max = elv.coalesce(thresholds.max, false); const min = elv.coalesce(thresholds.min, false); ...
javascript
function assertThresholds(thresholds) { if (!elv(thresholds)) return null; if (typeof thresholds !== 'object') { throw new TypeError(msg.argThresholds); } const avg = elv.coalesce(thresholds.avg, false); const max = elv.coalesce(thresholds.max, false); const min = elv.coalesce(thresholds.min, false); ...
[ "function", "assertThresholds", "(", "thresholds", ")", "{", "if", "(", "!", "elv", "(", "thresholds", ")", ")", "return", "null", ";", "if", "(", "typeof", "thresholds", "!==", "'object'", ")", "{", "throw", "new", "TypeError", "(", "msg", ".", "argThre...
Validates threshold options. If it is invalid a TypeError is thrown. Otherwise, a normalized thresholds object or null is returned. @param {object} thresholds @returns {object}
[ "Validates", "threshold", "options", ".", "If", "it", "is", "invalid", "a", "TypeError", "is", "thrown", ".", "Otherwise", "a", "normalized", "thresholds", "object", "or", "null", "is", "returned", "." ]
c0cf2730441e1e454355603c2fd7539b9d552f1a
https://github.com/dsfields/radargun/blob/c0cf2730441e1e454355603c2fd7539b9d552f1a/lib/bench.js#L172-L206
train
dsfields/radargun
lib/bench.js
assertThreshold
function assertThreshold(value, other, threshold) { if (!threshold && value > other) throw new ThresholdError(); const ratio = 1 - (value / other); if (ratio < threshold) throw new ThresholdError(); }
javascript
function assertThreshold(value, other, threshold) { if (!threshold && value > other) throw new ThresholdError(); const ratio = 1 - (value / other); if (ratio < threshold) throw new ThresholdError(); }
[ "function", "assertThreshold", "(", "value", ",", "other", ",", "threshold", ")", "{", "if", "(", "!", "threshold", "&&", "value", ">", "other", ")", "throw", "new", "ThresholdError", "(", ")", ";", "const", "ratio", "=", "1", "-", "(", "value", "/", ...
CHECK THRESHOLDS Throws if a given threshold ratio is not met. @param {number} value @param {number} other @param {?number} threshold
[ "CHECK", "THRESHOLDS", "Throws", "if", "a", "given", "threshold", "ratio", "is", "not", "met", "." ]
c0cf2730441e1e454355603c2fd7539b9d552f1a
https://github.com/dsfields/radargun/blob/c0cf2730441e1e454355603c2fd7539b9d552f1a/lib/bench.js#L271-L275
train
dsfields/radargun
lib/bench.js
checkThresholds
function checkThresholds(metrics, thresholds) { if (!elv(thresholds)) return; const target = metrics[thresholds.target]; for (let i = 0; i < metrics.length; i++) { if (i === thresholds.target) continue; const other = metrics[i]; assertThreshold(target.avg, other.avg, thresholds.avg); assertThre...
javascript
function checkThresholds(metrics, thresholds) { if (!elv(thresholds)) return; const target = metrics[thresholds.target]; for (let i = 0; i < metrics.length; i++) { if (i === thresholds.target) continue; const other = metrics[i]; assertThreshold(target.avg, other.avg, thresholds.avg); assertThre...
[ "function", "checkThresholds", "(", "metrics", ",", "thresholds", ")", "{", "if", "(", "!", "elv", "(", "thresholds", ")", ")", "return", ";", "const", "target", "=", "metrics", "[", "thresholds", ".", "target", "]", ";", "for", "(", "let", "i", "=", ...
Validates results of a benchmarking run against a given set of thresholds. If the target function's metrics are outside of the given thresholds, an error is thrown. @param {FunctionMetrics[]} metrics @param {Thresholds} thresholds
[ "Validates", "results", "of", "a", "benchmarking", "run", "against", "a", "given", "set", "of", "thresholds", ".", "If", "the", "target", "function", "s", "metrics", "are", "outside", "of", "the", "given", "thresholds", "an", "error", "is", "thrown", "." ]
c0cf2730441e1e454355603c2fd7539b9d552f1a
https://github.com/dsfields/radargun/blob/c0cf2730441e1e454355603c2fd7539b9d552f1a/lib/bench.js#L286-L299
train
dsfields/radargun
lib/bench.js
bench
function bench(functions, options) { const funcs = assertFunctions(functions); const opts = assertOptions(options); const metrics = []; const totalRuns = funcs.length * opts.runs; let runCount = 0; for (let i = 0; i < funcs.length; i++) { const func = funcs[i]; const totals = [0, 0]; let max = ...
javascript
function bench(functions, options) { const funcs = assertFunctions(functions); const opts = assertOptions(options); const metrics = []; const totalRuns = funcs.length * opts.runs; let runCount = 0; for (let i = 0; i < funcs.length; i++) { const func = funcs[i]; const totals = [0, 0]; let max = ...
[ "function", "bench", "(", "functions", ",", "options", ")", "{", "const", "funcs", "=", "assertFunctions", "(", "functions", ")", ";", "const", "opts", "=", "assertOptions", "(", "options", ")", ";", "const", "metrics", "=", "[", "]", ";", "const", "tota...
BENCHMARKING Runs a benchmark analysis for a given array of functions, and generates a report. @param {(function|FunctionConfiguration)[]} functions @param {BenchOptions} options @returns {FunctionMetrics[]}
[ "BENCHMARKING", "Runs", "a", "benchmark", "analysis", "for", "a", "given", "array", "of", "functions", "and", "generates", "a", "report", "." ]
c0cf2730441e1e454355603c2fd7539b9d552f1a
https://github.com/dsfields/radargun/blob/c0cf2730441e1e454355603c2fd7539b9d552f1a/lib/bench.js#L316-L360
train
robinpowered/robin-js-sdk-public
lib/api/modules/accounts.js
function (accountIdOrSlug, params) { var path; if (accountIdOrSlug) { path = this.constructPath(constants.ACCOUNTS, accountIdOrSlug); return this.Core.GET(path, params); } else { return this.rejectRequest('Bad Request: An account id or slug must be supplied for this operation'); } }
javascript
function (accountIdOrSlug, params) { var path; if (accountIdOrSlug) { path = this.constructPath(constants.ACCOUNTS, accountIdOrSlug); return this.Core.GET(path, params); } else { return this.rejectRequest('Bad Request: An account id or slug must be supplied for this operation'); } }
[ "function", "(", "accountIdOrSlug", ",", "params", ")", "{", "var", "path", ";", "if", "(", "accountIdOrSlug", ")", "{", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "ACCOUNTS", ",", "accountIdOrSlug", ")", ";", "return", "this", ".", ...
Get an account @param {String|Integer} accountIdOrSlug A Robin account identifier or slug @param {Object} params A querystring object @return {Function} A Promise
[ "Get", "an", "account" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/accounts.js#L20-L28
train
Beh01der/node-docker-monitor
lib/index.js
updateContainers
function updateContainers(next) { monitor.docker.listContainers(function(err, list) { if (err) { console.log('Error listing running containers: %s', err.message, err); return next(err); } if (!monitor.started) { if (handler.onMonitorStarted) { handler.onMonitorSt...
javascript
function updateContainers(next) { monitor.docker.listContainers(function(err, list) { if (err) { console.log('Error listing running containers: %s', err.message, err); return next(err); } if (!monitor.started) { if (handler.onMonitorStarted) { handler.onMonitorSt...
[ "function", "updateContainers", "(", "next", ")", "{", "monitor", ".", "docker", ".", "listContainers", "(", "function", "(", "err", ",", "list", ")", "{", "if", "(", "err", ")", "{", "console", ".", "log", "(", "'Error listing running containers: %s'", ",",...
initially populate container map
[ "initially", "populate", "container", "map" ]
4e81eb12081c1fb91b5b91e0683e4cc1c0b05a43
https://github.com/Beh01der/node-docker-monitor/blob/4e81eb12081c1fb91b5b91e0683e4cc1c0b05a43/lib/index.js#L136-L159
train
Beh01der/node-docker-monitor
lib/index.js
processDockerEvent
function processDockerEvent(event, stop) { if (trackedEvents.indexOf(event.status) !== -1) { var container = containerById.get(event.id); if (container) { if (positiveEvents.indexOf(event.status) !== -1) { updateContainer(container); } else { removeContainer(container...
javascript
function processDockerEvent(event, stop) { if (trackedEvents.indexOf(event.status) !== -1) { var container = containerById.get(event.id); if (container) { if (positiveEvents.indexOf(event.status) !== -1) { updateContainer(container); } else { removeContainer(container...
[ "function", "processDockerEvent", "(", "event", ",", "stop", ")", "{", "if", "(", "trackedEvents", ".", "indexOf", "(", "event", ".", "status", ")", "!==", "-", "1", ")", "{", "var", "container", "=", "containerById", ".", "get", "(", "event", ".", "id...
start monitoring docker events
[ "start", "monitoring", "docker", "events" ]
4e81eb12081c1fb91b5b91e0683e4cc1c0b05a43
https://github.com/Beh01der/node-docker-monitor/blob/4e81eb12081c1fb91b5b91e0683e4cc1c0b05a43/lib/index.js#L162-L182
train
mwild1/xmppjs
lib/xmpp.js
function (attr) { this.debug("STREAM: opened."); this._setStatus(xmpp.Status.AUTHENTICATING); var handshake = sha1.hex(attr.id + this.password); this.debug("Calculated authentication token " + handshake + " from stream id '" + attr.id + "' and password '" + this.password + "'"); this.debug("Sending auth...
javascript
function (attr) { this.debug("STREAM: opened."); this._setStatus(xmpp.Status.AUTHENTICATING); var handshake = sha1.hex(attr.id + this.password); this.debug("Calculated authentication token " + handshake + " from stream id '" + attr.id + "' and password '" + this.password + "'"); this.debug("Sending auth...
[ "function", "(", "attr", ")", "{", "this", ".", "debug", "(", "\"STREAM: opened.\"", ")", ";", "this", ".", "_setStatus", "(", "xmpp", ".", "Status", ".", "AUTHENTICATING", ")", ";", "var", "handshake", "=", "sha1", ".", "hex", "(", "attr", ".", "id", ...
Stream listeners, called on XMPP-level events
[ "Stream", "listeners", "called", "on", "XMPP", "-", "level", "events" ]
35cfa5b004058942d9c91d3df0afd81a4c987a02
https://github.com/mwild1/xmppjs/blob/35cfa5b004058942d9c91d3df0afd81a4c987a02/lib/xmpp.js#L206-L215
train
jeffrose/emitter
dist/emitter-umd.js
addConditionalEventListener
function addConditionalEventListener(emitter, type, listener) { function conditionalListener() { var done = listener.apply(emitter, arguments); if (done === true) { removeEventListener(emitter, type, conditionalListener); } } // TODO Check be...
javascript
function addConditionalEventListener(emitter, type, listener) { function conditionalListener() { var done = listener.apply(emitter, arguments); if (done === true) { removeEventListener(emitter, type, conditionalListener); } } // TODO Check be...
[ "function", "addConditionalEventListener", "(", "emitter", ",", "type", ",", "listener", ")", "{", "function", "conditionalListener", "(", ")", "{", "var", "done", "=", "listener", ".", "apply", "(", "emitter", ",", "arguments", ")", ";", "if", "(", "done", ...
Many of these functions are broken out from the prototype for the sake of optimization. The functions on the protoytype take a variable number of arguments and can be deoptimized as a result. These functions have a fixed number of arguments and therefore do not get deoptimized. @function Emitter~addConditionalEventLis...
[ "Many", "of", "these", "functions", "are", "broken", "out", "from", "the", "prototype", "for", "the", "sake", "of", "optimization", ".", "The", "functions", "on", "the", "protoytype", "take", "a", "variable", "number", "of", "arguments", "and", "can", "be", ...
c6d8d1702ff60ca4f5100d13480914e4bd17183f
https://github.com/jeffrose/emitter/blob/c6d8d1702ff60ca4f5100d13480914e4bd17183f/dist/emitter-umd.js#L172-L185
train
jeffrose/emitter
dist/emitter-umd.js
listenMany
function listenMany(handler, isFunction, emitter, args) { var errors = []; if (isFunction) { try { handler.apply(emitter, args); } catch (error) { errors.push(error); } } else { var length = handler.length, ...
javascript
function listenMany(handler, isFunction, emitter, args) { var errors = []; if (isFunction) { try { handler.apply(emitter, args); } catch (error) { errors.push(error); } } else { var length = handler.length, ...
[ "function", "listenMany", "(", "handler", ",", "isFunction", ",", "emitter", ",", "args", ")", "{", "var", "errors", "=", "[", "]", ";", "if", "(", "isFunction", ")", "{", "try", "{", "handler", ".", "apply", "(", "emitter", ",", "args", ")", ";", ...
Execute a listener with four or more arguments. @function Emitter~listenMany @param {EventListener|Array<EventListener>} handler One or more {@link EventListener|listeners} that will be executed on the `emitter`. @param {external:boolean} isFunction Whether or not the `handler` is a {@link external:Function|function}. ...
[ "Execute", "a", "listener", "with", "four", "or", "more", "arguments", "." ]
c6d8d1702ff60ca4f5100d13480914e4bd17183f
https://github.com/jeffrose/emitter/blob/c6d8d1702ff60ca4f5100d13480914e4bd17183f/dist/emitter-umd.js#L621-L648
train
jeffrose/emitter
dist/emitter-umd.js
spliceList
function spliceList(list, index) { for (var i = index, j = i + 1, length = list.length; j < length; i += 1, j += 1) { list[i] = list[j]; } list.pop(); }
javascript
function spliceList(list, index) { for (var i = index, j = i + 1, length = list.length; j < length; i += 1, j += 1) { list[i] = list[j]; } list.pop(); }
[ "function", "spliceList", "(", "list", ",", "index", ")", "{", "for", "(", "var", "i", "=", "index", ",", "j", "=", "i", "+", "1", ",", "length", "=", "list", ".", "length", ";", "j", "<", "length", ";", "i", "+=", "1", ",", "j", "+=", "1", ...
Faster than `Array.prototype.splice` @function Emitter~spliceList @param {external:Array} list @param {external:number} index
[ "Faster", "than", "Array", ".", "prototype", ".", "splice" ]
c6d8d1702ff60ca4f5100d13480914e4bd17183f
https://github.com/jeffrose/emitter/blob/c6d8d1702ff60ca4f5100d13480914e4bd17183f/dist/emitter-umd.js#L713-L719
train
brochington/Akkad
lib/Oimo.js
function(){ this.randX=65535; while(this.joints!==null){ this.removeJoint(this.joints); } while(this.contacts!==null){ this.removeContact(this.contacts); } while(this.rigidBodies!==null){ this.removeRigidBody(this.rigidBodies); ...
javascript
function(){ this.randX=65535; while(this.joints!==null){ this.removeJoint(this.joints); } while(this.contacts!==null){ this.removeContact(this.contacts); } while(this.rigidBodies!==null){ this.removeRigidBody(this.rigidBodies); ...
[ "function", "(", ")", "{", "this", ".", "randX", "=", "65535", ";", "while", "(", "this", ".", "joints", "!==", "null", ")", "{", "this", ".", "removeJoint", "(", "this", ".", "joints", ")", ";", "}", "while", "(", "this", ".", "contacts", "!==", ...
Reset the randomizer and remove all rigid bodies, shapes, joints and any object from the world.
[ "Reset", "the", "randomizer", "and", "remove", "all", "rigid", "bodies", "shapes", "joints", "and", "any", "object", "from", "the", "world", "." ]
ccc3bb33f27e4c922a559320461fe3d21bc53f4a
https://github.com/brochington/Akkad/blob/ccc3bb33f27e4c922a559320461fe3d21bc53f4a/lib/Oimo.js#L110-L122
train
brochington/Akkad
lib/Oimo.js
function(rigidBody){ if(rigidBody.parent){ throw new Error("It is not possible to be added to more than one world one of the rigid body"); } rigidBody.parent=this; rigidBody.awake(); for(var shape=rigidBody.shapes; shape!==null; shape=shape.next){ this.add...
javascript
function(rigidBody){ if(rigidBody.parent){ throw new Error("It is not possible to be added to more than one world one of the rigid body"); } rigidBody.parent=this; rigidBody.awake(); for(var shape=rigidBody.shapes; shape!==null; shape=shape.next){ this.add...
[ "function", "(", "rigidBody", ")", "{", "if", "(", "rigidBody", ".", "parent", ")", "{", "throw", "new", "Error", "(", "\"It is not possible to be added to more than one world one of the rigid body\"", ")", ";", "}", "rigidBody", ".", "parent", "=", "this", ";", "...
I'll add a rigid body to the world. Rigid body that has been added will be the operands of each step. @param rigidBody Rigid body that you want to add
[ "I", "ll", "add", "a", "rigid", "body", "to", "the", "world", ".", "Rigid", "body", "that", "has", "been", "added", "will", "be", "the", "operands", "of", "each", "step", "." ]
ccc3bb33f27e4c922a559320461fe3d21bc53f4a
https://github.com/brochington/Akkad/blob/ccc3bb33f27e4c922a559320461fe3d21bc53f4a/lib/Oimo.js#L128-L140
train
brochington/Akkad
lib/Oimo.js
function(rigidBody){ var remove=rigidBody; if(remove.parent!==this)return; remove.awake(); var js=remove.jointLink; while(js!=null){ var joint=js.joint; js=js.next; this.removeJoint(joint); } for(var shape=rigidBody.shapes; shape!==null;...
javascript
function(rigidBody){ var remove=rigidBody; if(remove.parent!==this)return; remove.awake(); var js=remove.jointLink; while(js!=null){ var joint=js.joint; js=js.next; this.removeJoint(joint); } for(var shape=rigidBody.shapes; shape!==null;...
[ "function", "(", "rigidBody", ")", "{", "var", "remove", "=", "rigidBody", ";", "if", "(", "remove", ".", "parent", "!==", "this", ")", "return", ";", "remove", ".", "awake", "(", ")", ";", "var", "js", "=", "remove", ".", "jointLink", ";", "while", ...
I will remove the rigid body from the world. Rigid body that has been deleted is excluded from the calculation on a step-by-step basis. @param rigidBody Rigid body to be removed
[ "I", "will", "remove", "the", "rigid", "body", "from", "the", "world", ".", "Rigid", "body", "that", "has", "been", "deleted", "is", "excluded", "from", "the", "calculation", "on", "a", "step", "-", "by", "-", "step", "basis", "." ]
ccc3bb33f27e4c922a559320461fe3d21bc53f4a
https://github.com/brochington/Akkad/blob/ccc3bb33f27e4c922a559320461fe3d21bc53f4a/lib/Oimo.js#L146-L168
train
brochington/Akkad
lib/Oimo.js
function(shape){ if(!shape.parent || !shape.parent.parent){ throw new Error("It is not possible to be added alone to shape world"); } shape.proxy = this.broadPhase.createProxy(shape); shape.updateProxy(); this.broadPhase.addProxy(shape.proxy); }
javascript
function(shape){ if(!shape.parent || !shape.parent.parent){ throw new Error("It is not possible to be added alone to shape world"); } shape.proxy = this.broadPhase.createProxy(shape); shape.updateProxy(); this.broadPhase.addProxy(shape.proxy); }
[ "function", "(", "shape", ")", "{", "if", "(", "!", "shape", ".", "parent", "||", "!", "shape", ".", "parent", ".", "parent", ")", "{", "throw", "new", "Error", "(", "\"It is not possible to be added alone to shape world\"", ")", ";", "}", "shape", ".", "p...
I'll add a shape to the world.. Add to the rigid world, and if you add a shape to a rigid body that has been added to the world, Shape will be added to the world automatically, please do not call from outside this method. @param shape Shape you want to add
[ "I", "ll", "add", "a", "shape", "to", "the", "world", "..", "Add", "to", "the", "rigid", "world", "and", "if", "you", "add", "a", "shape", "to", "a", "rigid", "body", "that", "has", "been", "added", "to", "the", "world", "Shape", "will", "be", "add...
ccc3bb33f27e4c922a559320461fe3d21bc53f4a
https://github.com/brochington/Akkad/blob/ccc3bb33f27e4c922a559320461fe3d21bc53f4a/lib/Oimo.js#L190-L197
train
brochington/Akkad
lib/Oimo.js
function(joint){ if(joint.parent){ throw new Error("It is not possible to be added to more than one world one of the joint"); } if(this.joints!=null)(this.joints.prev=joint).next=this.joints; this.joints=joint; joint.parent=this; this.numJoints++; join...
javascript
function(joint){ if(joint.parent){ throw new Error("It is not possible to be added to more than one world one of the joint"); } if(this.joints!=null)(this.joints.prev=joint).next=this.joints; this.joints=joint; joint.parent=this; this.numJoints++; join...
[ "function", "(", "joint", ")", "{", "if", "(", "joint", ".", "parent", ")", "{", "throw", "new", "Error", "(", "\"It is not possible to be added to more than one world one of the joint\"", ")", ";", "}", "if", "(", "this", ".", "joints", "!=", "null", ")", "("...
I'll add a joint to the world. Joint that has been added will be the operands of each step. @param shape Joint to be added
[ "I", "ll", "add", "a", "joint", "to", "the", "world", ".", "Joint", "that", "has", "been", "added", "will", "be", "the", "operands", "of", "each", "step", "." ]
ccc3bb33f27e4c922a559320461fe3d21bc53f4a
https://github.com/brochington/Akkad/blob/ccc3bb33f27e4c922a559320461fe3d21bc53f4a/lib/Oimo.js#L215-L225
train
brochington/Akkad
lib/Oimo.js
function(joint){ var remove=joint; var prev=remove.prev; var next=remove.next; if(prev!==null)prev.next=next; if(next!==null)next.prev=prev; if(this.joints==remove)this.joints=next; remove.prev=null; remove.next=null; this.numJoints--; remo...
javascript
function(joint){ var remove=joint; var prev=remove.prev; var next=remove.next; if(prev!==null)prev.next=next; if(next!==null)next.prev=prev; if(this.joints==remove)this.joints=next; remove.prev=null; remove.next=null; this.numJoints--; remo...
[ "function", "(", "joint", ")", "{", "var", "remove", "=", "joint", ";", "var", "prev", "=", "remove", ".", "prev", ";", "var", "next", "=", "remove", ".", "next", ";", "if", "(", "prev", "!==", "null", ")", "prev", ".", "next", "=", "next", ";", ...
I will remove the joint from the world. Joint that has been added will be the operands of each step. @param shape Joint to be deleted
[ "I", "will", "remove", "the", "joint", "from", "the", "world", ".", "Joint", "that", "has", "been", "added", "will", "be", "the", "operands", "of", "each", "step", "." ]
ccc3bb33f27e4c922a559320461fe3d21bc53f4a
https://github.com/brochington/Akkad/blob/ccc3bb33f27e4c922a559320461fe3d21bc53f4a/lib/Oimo.js#L232-L245
train
brochington/Akkad
lib/Oimo.js
function(shape){ if(shape.parent){ throw new Error("It is not possible that you add to the multi-rigid body the shape of one"); } if(this.shapes!=null)(this.shapes.prev=shape).next=this.shapes; this.shapes=shape; shape.parent=this; if(this.parent)this.parent.a...
javascript
function(shape){ if(shape.parent){ throw new Error("It is not possible that you add to the multi-rigid body the shape of one"); } if(this.shapes!=null)(this.shapes.prev=shape).next=this.shapes; this.shapes=shape; shape.parent=this; if(this.parent)this.parent.a...
[ "function", "(", "shape", ")", "{", "if", "(", "shape", ".", "parent", ")", "{", "throw", "new", "Error", "(", "\"It is not possible that you add to the multi-rigid body the shape of one\"", ")", ";", "}", "if", "(", "this", ".", "shapes", "!=", "null", ")", "...
I'll add a shape to rigid body. If you add a shape, please call the setupMass method to step up to the start of the next. @param shape shape to Add
[ "I", "ll", "add", "a", "shape", "to", "rigid", "body", ".", "If", "you", "add", "a", "shape", "please", "call", "the", "setupMass", "method", "to", "step", "up", "to", "the", "start", "of", "the", "next", "." ]
ccc3bb33f27e4c922a559320461fe3d21bc53f4a
https://github.com/brochington/Akkad/blob/ccc3bb33f27e4c922a559320461fe3d21bc53f4a/lib/Oimo.js#L759-L768
train
brochington/Akkad
lib/Oimo.js
function(shape){ var remove=shape; if(remove.parent!=this)return; var prev=remove.prev; var next=remove.next; if(prev!=null)prev.next=next; if(next!=null)next.prev=prev; if(this.shapes==remove)this.shapes=next; remove.prev=null; remove.next=null; ...
javascript
function(shape){ var remove=shape; if(remove.parent!=this)return; var prev=remove.prev; var next=remove.next; if(prev!=null)prev.next=next; if(next!=null)next.prev=prev; if(this.shapes==remove)this.shapes=next; remove.prev=null; remove.next=null; ...
[ "function", "(", "shape", ")", "{", "var", "remove", "=", "shape", ";", "if", "(", "remove", ".", "parent", "!=", "this", ")", "return", ";", "var", "prev", "=", "remove", ".", "prev", ";", "var", "next", "=", "remove", ".", "next", ";", "if", "(...
I will delete the shape from the rigid body. If you delete a shape, please call the setupMass method to step up to the start of the next. @param shape shape to Delete
[ "I", "will", "delete", "the", "shape", "from", "the", "rigid", "body", ".", "If", "you", "delete", "a", "shape", "please", "call", "the", "setupMass", "method", "to", "step", "up", "to", "the", "start", "of", "the", "next", "." ]
ccc3bb33f27e4c922a559320461fe3d21bc53f4a
https://github.com/brochington/Akkad/blob/ccc3bb33f27e4c922a559320461fe3d21bc53f4a/lib/Oimo.js#L774-L787
train
brochington/Akkad
lib/Oimo.js
function(){ if(!this.allowSleep||!this.sleeping)return; this.sleeping=false; this.sleepTime=0; // awake connected constraints var cs=this.contactLink; while(cs!=null){ cs.body.sleepTime=0; cs.body.sleeping=false; cs=cs.next; } ...
javascript
function(){ if(!this.allowSleep||!this.sleeping)return; this.sleeping=false; this.sleepTime=0; // awake connected constraints var cs=this.contactLink; while(cs!=null){ cs.body.sleepTime=0; cs.body.sleeping=false; cs=cs.next; } ...
[ "function", "(", ")", "{", "if", "(", "!", "this", ".", "allowSleep", "||", "!", "this", ".", "sleeping", ")", "return", ";", "this", ".", "sleeping", "=", "false", ";", "this", ".", "sleepTime", "=", "0", ";", "// awake connected constraints", "var", ...
Awake the rigid body.
[ "Awake", "the", "rigid", "body", "." ]
ccc3bb33f27e4c922a559320461fe3d21bc53f4a
https://github.com/brochington/Akkad/blob/ccc3bb33f27e4c922a559320461fe3d21bc53f4a/lib/Oimo.js#L873-L893
train
brochington/Akkad
lib/Oimo.js
function(){ if(!this.allowSleep||this.sleeping)return; this.linearVelocity.init(); this.angularVelocity.init(); this.sleepPosition.copy(this.position); this.sleepOrientation.copy(this.orientation); /*this.linearVelocity.x=0; this.linearVelocity.y=0; this.l...
javascript
function(){ if(!this.allowSleep||this.sleeping)return; this.linearVelocity.init(); this.angularVelocity.init(); this.sleepPosition.copy(this.position); this.sleepOrientation.copy(this.orientation); /*this.linearVelocity.x=0; this.linearVelocity.y=0; this.l...
[ "function", "(", ")", "{", "if", "(", "!", "this", ".", "allowSleep", "||", "this", ".", "sleeping", ")", "return", ";", "this", ".", "linearVelocity", ".", "init", "(", ")", ";", "this", ".", "angularVelocity", ".", "init", "(", ")", ";", "this", ...
Sleep the rigid body.
[ "Sleep", "the", "rigid", "body", "." ]
ccc3bb33f27e4c922a559320461fe3d21bc53f4a
https://github.com/brochington/Akkad/blob/ccc3bb33f27e4c922a559320461fe3d21bc53f4a/lib/Oimo.js#L897-L922
train
brochington/Akkad
lib/Oimo.js
function(timeStep){ switch(this.type){ case this.BODY_STATIC: this.linearVelocity.init(); this.angularVelocity.init(); // ONLY FOR TEST if(this.controlPos){ this.position.copy(this.newPosition); t...
javascript
function(timeStep){ switch(this.type){ case this.BODY_STATIC: this.linearVelocity.init(); this.angularVelocity.init(); // ONLY FOR TEST if(this.controlPos){ this.position.copy(this.newPosition); t...
[ "function", "(", "timeStep", ")", "{", "switch", "(", "this", ".", "type", ")", "{", "case", "this", ".", "BODY_STATIC", ":", "this", ".", "linearVelocity", ".", "init", "(", ")", ";", "this", ".", "angularVelocity", ".", "init", "(", ")", ";", "// O...
The time integration of the motion of a rigid body, you can update the information such as the shape. This method is invoked automatically when calling the step of the World, There is no need to call from outside usually. @param timeStep time
[ "The", "time", "integration", "of", "the", "motion", "of", "a", "rigid", "body", "you", "can", "update", "the", "information", "such", "as", "the", "shape", ".", "This", "method", "is", "invoked", "automatically", "when", "calling", "the", "step", "of", "t...
ccc3bb33f27e4c922a559320461fe3d21bc53f4a
https://github.com/brochington/Akkad/blob/ccc3bb33f27e4c922a559320461fe3d21bc53f4a/lib/Oimo.js#L938-L998
train
brochington/Akkad
lib/Oimo.js
function(){ var prev=this.s1Link.prev; var next=this.s1Link.next; if(prev!==null)prev.next=next; if(next!==null)next.prev=prev; if(this.shape1.contactLink==this.s1Link)this.shape1.contactLink=next; this.s1Link.prev=null; this.s1Link.next=null; this.s1Link....
javascript
function(){ var prev=this.s1Link.prev; var next=this.s1Link.next; if(prev!==null)prev.next=next; if(next!==null)next.prev=prev; if(this.shape1.contactLink==this.s1Link)this.shape1.contactLink=next; this.s1Link.prev=null; this.s1Link.next=null; this.s1Link....
[ "function", "(", ")", "{", "var", "prev", "=", "this", ".", "s1Link", ".", "prev", ";", "var", "next", "=", "this", ".", "s1Link", ".", "next", ";", "if", "(", "prev", "!==", "null", ")", "prev", ".", "next", "=", "next", ";", "if", "(", "next"...
Detach the contact from the shapes.
[ "Detach", "the", "contact", "from", "the", "shapes", "." ]
ccc3bb33f27e4c922a559320461fe3d21bc53f4a
https://github.com/brochington/Akkad/blob/ccc3bb33f27e4c922a559320461fe3d21bc53f4a/lib/Oimo.js#L5804-L5859
train
brochington/Akkad
lib/Oimo.js
function(x,y,z,normalX,normalY,normalZ,penetration,flip){ var p=this.points[this.numPoints++]; p.position.x=x; p.position.y=y; p.position.z=z; var r=this.body1.rotation; var rx=x-this.body1.position.x; var ry=y-this.body1.position.y; var rz=z-this.body1.po...
javascript
function(x,y,z,normalX,normalY,normalZ,penetration,flip){ var p=this.points[this.numPoints++]; p.position.x=x; p.position.y=y; p.position.z=z; var r=this.body1.rotation; var rx=x-this.body1.position.x; var ry=y-this.body1.position.y; var rz=z-this.body1.po...
[ "function", "(", "x", ",", "y", ",", "z", ",", "normalX", ",", "normalY", ",", "normalZ", ",", "penetration", ",", "flip", ")", "{", "var", "p", "=", "this", ".", "points", "[", "this", ".", "numPoints", "++", "]", ";", "p", ".", "position", ".",...
Add a point into this manifold. @param x @param y @param z @param normalX @param normalY @param normalZ @param penetration @param flip
[ "Add", "a", "point", "into", "this", "manifold", "." ]
ccc3bb33f27e4c922a559320461fe3d21bc53f4a
https://github.com/brochington/Akkad/blob/ccc3bb33f27e4c922a559320461fe3d21bc53f4a/lib/Oimo.js#L6390-L6424
train
brochington/Akkad
lib/Oimo.js
function(aabb1,aabb2){ this.minX = (aabb1.minX<aabb2.minX) ? aabb1.minX : aabb2.minX; this.maxX = (aabb1.maxX>aabb2.maxX) ? aabb1.maxX : aabb2.maxX; this.minY = (aabb1.minY<aabb2.minY) ? aabb1.minY : aabb2.minY; this.maxY = (aabb1.maxY>aabb2.maxY) ? aabb1.maxY : aabb2.maxY; this....
javascript
function(aabb1,aabb2){ this.minX = (aabb1.minX<aabb2.minX) ? aabb1.minX : aabb2.minX; this.maxX = (aabb1.maxX>aabb2.maxX) ? aabb1.maxX : aabb2.maxX; this.minY = (aabb1.minY<aabb2.minY) ? aabb1.minY : aabb2.minY; this.maxY = (aabb1.maxY>aabb2.maxY) ? aabb1.maxY : aabb2.maxY; this....
[ "function", "(", "aabb1", ",", "aabb2", ")", "{", "this", ".", "minX", "=", "(", "aabb1", ".", "minX", "<", "aabb2", ".", "minX", ")", "?", "aabb1", ".", "minX", ":", "aabb2", ".", "minX", ";", "this", ".", "maxX", "=", "(", "aabb1", ".", "maxX...
Set this AABB to the combined AABB of aabb1 and aabb2. @param aabb1 @param aabb2
[ "Set", "this", "AABB", "to", "the", "combined", "AABB", "of", "aabb1", "and", "aabb2", "." ]
ccc3bb33f27e4c922a559320461fe3d21bc53f4a
https://github.com/brochington/Akkad/blob/ccc3bb33f27e4c922a559320461fe3d21bc53f4a/lib/Oimo.js#L8435-L8451
train
brochington/Akkad
lib/Oimo.js
function(){ var h=this.maxY-this.minY; var d=this.maxZ-this.minZ; return 2*((this.maxX-this.minX)*(h+d)+h*d); }
javascript
function(){ var h=this.maxY-this.minY; var d=this.maxZ-this.minZ; return 2*((this.maxX-this.minX)*(h+d)+h*d); }
[ "function", "(", ")", "{", "var", "h", "=", "this", ".", "maxY", "-", "this", ".", "minY", ";", "var", "d", "=", "this", ".", "maxZ", "-", "this", ".", "minZ", ";", "return", "2", "*", "(", "(", "this", ".", "maxX", "-", "this", ".", "minX", ...
Get the surface area. @return
[ "Get", "the", "surface", "area", "." ]
ccc3bb33f27e4c922a559320461fe3d21bc53f4a
https://github.com/brochington/Akkad/blob/ccc3bb33f27e4c922a559320461fe3d21bc53f4a/lib/Oimo.js#L8456-L8460
train
brochington/Akkad
lib/Oimo.js
function(x,y,z){ return x>=this.minX&&x<=this.maxX&&y>=this.minY&&y<=this.maxY&&z>=this.minZ&&z<=this.maxZ; }
javascript
function(x,y,z){ return x>=this.minX&&x<=this.maxX&&y>=this.minY&&y<=this.maxY&&z>=this.minZ&&z<=this.maxZ; }
[ "function", "(", "x", ",", "y", ",", "z", ")", "{", "return", "x", ">=", "this", ".", "minX", "&&", "x", "<=", "this", ".", "maxX", "&&", "y", ">=", "this", ".", "minY", "&&", "y", "<=", "this", ".", "maxY", "&&", "z", ">=", "this", ".", "m...
Get whether the AABB intersects with the point or not. @param x @param y @param z @return
[ "Get", "whether", "the", "AABB", "intersects", "with", "the", "point", "or", "not", "." ]
ccc3bb33f27e4c922a559320461fe3d21bc53f4a
https://github.com/brochington/Akkad/blob/ccc3bb33f27e4c922a559320461fe3d21bc53f4a/lib/Oimo.js#L8468-L8470
train
brochington/Akkad
lib/Oimo.js
function(s1,s2){ var b1=s1.parent; var b2=s2.parent; if( b1==b2 || // same parents (!b1.isDynamic&&!b2.isDynamic) || // static or kinematic object (s1.belongsTo&s2.collidesWith)==0 || (s2.belongsTo&s1.collidesWith)==0 // collision filtering ){ return ...
javascript
function(s1,s2){ var b1=s1.parent; var b2=s2.parent; if( b1==b2 || // same parents (!b1.isDynamic&&!b2.isDynamic) || // static or kinematic object (s1.belongsTo&s2.collidesWith)==0 || (s2.belongsTo&s1.collidesWith)==0 // collision filtering ){ return ...
[ "function", "(", "s1", ",", "s2", ")", "{", "var", "b1", "=", "s1", ".", "parent", ";", "var", "b2", "=", "s2", ".", "parent", ";", "if", "(", "b1", "==", "b2", "||", "// same parents", "(", "!", "b1", ".", "isDynamic", "&&", "!", "b2", ".", ...
Returns whether the pair is available or not. @param s1 @param s2 @return
[ "Returns", "whether", "the", "pair", "is", "available", "or", "not", "." ]
ccc3bb33f27e4c922a559320461fe3d21bc53f4a
https://github.com/brochington/Akkad/blob/ccc3bb33f27e4c922a559320461fe3d21bc53f4a/lib/Oimo.js#L8552-L8569
train
brochington/Akkad
lib/Oimo.js
function(){ while(this.numPairs>0){ var pair=this.pairs[--this.numPairs]; pair.shape1=null; pair.shape2=null; } this.numPairChecks=0; this.collectPairs(); }
javascript
function(){ while(this.numPairs>0){ var pair=this.pairs[--this.numPairs]; pair.shape1=null; pair.shape2=null; } this.numPairChecks=0; this.collectPairs(); }
[ "function", "(", ")", "{", "while", "(", "this", ".", "numPairs", ">", "0", ")", "{", "var", "pair", "=", "this", ".", "pairs", "[", "--", "this", ".", "numPairs", "]", ";", "pair", ".", "shape1", "=", "null", ";", "pair", ".", "shape2", "=", "...
Detect overlapping pairs.
[ "Detect", "overlapping", "pairs", "." ]
ccc3bb33f27e4c922a559320461fe3d21bc53f4a
https://github.com/brochington/Akkad/blob/ccc3bb33f27e4c922a559320461fe3d21bc53f4a/lib/Oimo.js#L8571-L8579
train
brochington/Akkad
lib/Oimo.js
function(leaf){ if(this.root==null){ this.root=leaf; return; } var lb=leaf.aabb; var sibling=this.root; var oldArea; var newArea; while(sibling.proxy==null){ // descend the node to search the best pair var c1=sibling.child1; ...
javascript
function(leaf){ if(this.root==null){ this.root=leaf; return; } var lb=leaf.aabb; var sibling=this.root; var oldArea; var newArea; while(sibling.proxy==null){ // descend the node to search the best pair var c1=sibling.child1; ...
[ "function", "(", "leaf", ")", "{", "if", "(", "this", ".", "root", "==", "null", ")", "{", "this", ".", "root", "=", "leaf", ";", "return", ";", "}", "var", "lb", "=", "leaf", ".", "aabb", ";", "var", "sibling", "=", "this", ".", "root", ";", ...
Insert a leaf to the tree. @param node
[ "Insert", "a", "leaf", "to", "the", "tree", "." ]
ccc3bb33f27e4c922a559320461fe3d21bc53f4a
https://github.com/brochington/Akkad/blob/ccc3bb33f27e4c922a559320461fe3d21bc53f4a/lib/Oimo.js#L9112-L9195
train
brochington/Akkad
lib/Oimo.js
function(leaf){ if(leaf==this.root){ this.root=null; return; } var parent=leaf.parent; var sibling; if(parent.child1==leaf){ sibling=parent.child2; }else{ sibling=parent.child1; } if(parent==this.root){ ...
javascript
function(leaf){ if(leaf==this.root){ this.root=null; return; } var parent=leaf.parent; var sibling; if(parent.child1==leaf){ sibling=parent.child2; }else{ sibling=parent.child1; } if(parent==this.root){ ...
[ "function", "(", "leaf", ")", "{", "if", "(", "leaf", "==", "this", ".", "root", ")", "{", "this", ".", "root", "=", "null", ";", "return", ";", "}", "var", "parent", "=", "leaf", ".", "parent", ";", "var", "sibling", ";", "if", "(", "parent", ...
Delete a leaf from the tree. @param node
[ "Delete", "a", "leaf", "from", "the", "tree", "." ]
ccc3bb33f27e4c922a559320461fe3d21bc53f4a
https://github.com/brochington/Akkad/blob/ccc3bb33f27e4c922a559320461fe3d21bc53f4a/lib/Oimo.js#L9214-L9246
train
evansiroky/gtfs-sequelize
lib/gtfsLoader.js
function (timeString) { if (!timeString) { return null } var timeArr = timeString.split(':') return parseInt(timeArr[0], 10) * 3600 + parseInt(timeArr[1], 10) * 60 + parseInt(timeArr[2]) }
javascript
function (timeString) { if (!timeString) { return null } var timeArr = timeString.split(':') return parseInt(timeArr[0], 10) * 3600 + parseInt(timeArr[1], 10) * 60 + parseInt(timeArr[2]) }
[ "function", "(", "timeString", ")", "{", "if", "(", "!", "timeString", ")", "{", "return", "null", "}", "var", "timeArr", "=", "timeString", ".", "split", "(", "':'", ")", "return", "parseInt", "(", "timeArr", "[", "0", "]", ",", "10", ")", "*", "3...
convert timeString to int of seconds past midnight
[ "convert", "timeString", "to", "int", "of", "seconds", "past", "midnight" ]
ba101fa82e730694c536c43e615ff38fd264a65b
https://github.com/evansiroky/gtfs-sequelize/blob/ba101fa82e730694c536c43e615ff38fd264a65b/lib/gtfsLoader.js#L25-L33
train
evansiroky/gtfs-sequelize
lib/gtfsLoader.js
function () { insertCfg.model.sync({force: true}).then(function () { var streamInserterCfg = util.makeStreamerConfig(insertCfg.model) var inserter = dbStreamer.getInserter(streamInserterCfg) inserter.connect(function (err) { if (err) return callback(err) csv() .fromFile(...
javascript
function () { insertCfg.model.sync({force: true}).then(function () { var streamInserterCfg = util.makeStreamerConfig(insertCfg.model) var inserter = dbStreamer.getInserter(streamInserterCfg) inserter.connect(function (err) { if (err) return callback(err) csv() .fromFile(...
[ "function", "(", ")", "{", "insertCfg", ".", "model", ".", "sync", "(", "{", "force", ":", "true", "}", ")", ".", "then", "(", "function", "(", ")", "{", "var", "streamInserterCfg", "=", "util", ".", "makeStreamerConfig", "(", "insertCfg", ".", "model"...
prepare processing function, but don't run it until file existance is confirmed
[ "prepare", "processing", "function", "but", "don", "t", "run", "it", "until", "file", "existance", "is", "confirmed" ]
ba101fa82e730694c536c43e615ff38fd264a65b
https://github.com/evansiroky/gtfs-sequelize/blob/ba101fa82e730694c536c43e615ff38fd264a65b/lib/gtfsLoader.js#L329-L348
train
kgryte/github-create-issue
lib/create.js
done
function done( error, data, info ) { error = error || null; data = data || null; info = info || null; clbk( error, data, info ); }
javascript
function done( error, data, info ) { error = error || null; data = data || null; info = info || null; clbk( error, data, info ); }
[ "function", "done", "(", "error", ",", "data", ",", "info", ")", "{", "error", "=", "error", "||", "null", ";", "data", "=", "data", "||", "null", ";", "info", "=", "info", "||", "null", ";", "clbk", "(", "error", ",", "data", ",", "info", ")", ...
Callback invoked after receiving an API response. @private @param {(Error|null)} error - error object @param {Object} data - query data @param {Object} info - response info
[ "Callback", "invoked", "after", "receiving", "an", "API", "response", "." ]
40612361f618ac0d0b52b23f641d78ca6342b19a
https://github.com/kgryte/github-create-issue/blob/40612361f618ac0d0b52b23f641d78ca6342b19a/lib/create.js#L68-L73
train
robinpowered/robin-js-sdk-public
lib/api/modules/identifiers.js
function (identifierUrn, params) { var path = this.constructPath(constants.IDENTIFIERS, identifierUrn); return this.Core.GET(path, params); }
javascript
function (identifierUrn, params) { var path = this.constructPath(constants.IDENTIFIERS, identifierUrn); return this.Core.GET(path, params); }
[ "function", "(", "identifierUrn", ",", "params", ")", "{", "var", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "IDENTIFIERS", ",", "identifierUrn", ")", ";", "return", "this", ".", "Core", ".", "GET", "(", "path", ",", "params", ")",...
Get all the identifiers or a particular identifier identified by the `identifierUrn` parameter @param {String|Integer|undefined} identifierUrn A Robin identifier URN @param {Object|undefined} params A querystring object @return {Function} A Promise
[ "Get", "all", "the", "identifiers", "or", "a", "particular", "identifier", "identified", "by", "the", "identifierUrn", "parameter" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/identifiers.js#L20-L23
train
robinpowered/robin-js-sdk-public
lib/api/modules/identifiers.js
function (identifierUrn) { if (identifierUrn) { var path = this.constructPath(constants.IDENTIFIERS, identifierUrn); return this.Core.DELETE(path); } else { return this.rejectRequest('Bad request: An identifier URN is required.'); } }
javascript
function (identifierUrn) { if (identifierUrn) { var path = this.constructPath(constants.IDENTIFIERS, identifierUrn); return this.Core.DELETE(path); } else { return this.rejectRequest('Bad request: An identifier URN is required.'); } }
[ "function", "(", "identifierUrn", ")", "{", "if", "(", "identifierUrn", ")", "{", "var", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "IDENTIFIERS", ",", "identifierUrn", ")", ";", "return", "this", ".", "Core", ".", "DELETE", "(", "...
Delete an identifier @param {String|Integer} identifierUrn A Robin identifier URN @return {Function} A Promise
[ "Delete", "an", "identifier" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/identifiers.js#L30-L37
train
partyka95/graph-type-orm
dist/find-one.js
findOne
function findOne(repository, options) { const entityPrimaryKeyColumn = lodash_1.find(repository.metadata.columns, (columnMetadata) => columnMetadata.isPrimary).propertyName; const entityColumns = repository.metadata.columns.map((columnMetadata) => columnMetadata.propertyName); const entityManyToOneOrOneToOn...
javascript
function findOne(repository, options) { const entityPrimaryKeyColumn = lodash_1.find(repository.metadata.columns, (columnMetadata) => columnMetadata.isPrimary).propertyName; const entityColumns = repository.metadata.columns.map((columnMetadata) => columnMetadata.propertyName); const entityManyToOneOrOneToOn...
[ "function", "findOne", "(", "repository", ",", "options", ")", "{", "const", "entityPrimaryKeyColumn", "=", "lodash_1", ".", "find", "(", "repository", ".", "metadata", ".", "columns", ",", "(", "columnMetadata", ")", "=>", "columnMetadata", ".", "isPrimary", ...
Method to find the entity record. @param {Repository<Entity>} repository @param {FindOneOptions<Entity>} options @returns {(source, args, context, info) => Promise<Entity>}
[ "Method", "to", "find", "the", "entity", "record", "." ]
c2c1d93c091ad8fb5d3015cabe6edb20dccfa225
https://github.com/partyka95/graph-type-orm/blob/c2c1d93c091ad8fb5d3015cabe6edb20dccfa225/dist/find-one.js#L25-L75
train
dsfields/radargun
lib/update-status.js
updateStatus
function updateStatus(runCount, totalRuns, stream) { if (runCount % 10 !== 0) return; const percent = Math.floor((runCount / totalRuns) * 100); const blocks = Math.floor(percent / 2); const empty = 50 - blocks; const value = '|' + '\u2588'.repeat(blocks) + '\u2591'.repeat(empty) + '| ' + ...
javascript
function updateStatus(runCount, totalRuns, stream) { if (runCount % 10 !== 0) return; const percent = Math.floor((runCount / totalRuns) * 100); const blocks = Math.floor(percent / 2); const empty = 50 - blocks; const value = '|' + '\u2588'.repeat(blocks) + '\u2591'.repeat(empty) + '| ' + ...
[ "function", "updateStatus", "(", "runCount", ",", "totalRuns", ",", "stream", ")", "{", "if", "(", "runCount", "%", "10", "!==", "0", ")", "return", ";", "const", "percent", "=", "Math", ".", "floor", "(", "(", "runCount", "/", "totalRuns", ")", "*", ...
Renders the progress bar. @param {number} runCount @param {number} totalRuns
[ "Renders", "the", "progress", "bar", "." ]
c0cf2730441e1e454355603c2fd7539b9d552f1a
https://github.com/dsfields/radargun/blob/c0cf2730441e1e454355603c2fd7539b9d552f1a/lib/update-status.js#L12-L33
train
robinpowered/robin-js-sdk-public
lib/api/modules/locations.js
function (identifier, params) { var path = this.constructPath(constants.LOCATIONS, identifier); return this.Core.GET(path, params); }
javascript
function (identifier, params) { var path = this.constructPath(constants.LOCATIONS, identifier); return this.Core.GET(path, params); }
[ "function", "(", "identifier", ",", "params", ")", "{", "var", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "LOCATIONS", ",", "identifier", ")", ";", "return", "this", ".", "Core", ".", "GET", "(", "path", ",", "params", ")", ";", ...
Get all the locations or a particular location identified by `identifier` @param {String|Integer|undefined} identifier A location identifier @param {Object} params A querystring object @return {Function} A promise
[ "Get", "all", "the", "locations", "or", "a", "particular", "location", "identified", "by", "identifier" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/locations.js#L20-L23
train
robinpowered/robin-js-sdk-public
lib/api/modules/locations.js
function (identifier) { var path; if (identifier) { path = this.constructPath(constants.LOCATIONS, identifier); return this.Core.DELETE(path); } else { return this.rejectRequest('Bad Request: A location identifier is required.'); } }
javascript
function (identifier) { var path; if (identifier) { path = this.constructPath(constants.LOCATIONS, identifier); return this.Core.DELETE(path); } else { return this.rejectRequest('Bad Request: A location identifier is required.'); } }
[ "function", "(", "identifier", ")", "{", "var", "path", ";", "if", "(", "identifier", ")", "{", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "LOCATIONS", ",", "identifier", ")", ";", "return", "this", ".", "Core", ".", "DELETE", "(...
Delete a location @param {String|Integer} identifier A Robin location identifier @return {Function} A Promise
[ "Delete", "a", "location" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/locations.js#L46-L54
train
robinpowered/robin-js-sdk-public
lib/api/modules/locations.js
function (locationIdentifier, spaceIdentifier, params) { var path; if (locationIdentifier) { path = this.constructPath(constants.LOCATIONS, locationIdentifier, constants.SPACES, spaceIdentifier); return this.Core.GET(path, params); } else { return this.rejectRequest('Bad Reques...
javascript
function (locationIdentifier, spaceIdentifier, params) { var path; if (locationIdentifier) { path = this.constructPath(constants.LOCATIONS, locationIdentifier, constants.SPACES, spaceIdentifier); return this.Core.GET(path, params); } else { return this.rejectRequest('Bad Reques...
[ "function", "(", "locationIdentifier", ",", "spaceIdentifier", ",", "params", ")", "{", "var", "path", ";", "if", "(", "locationIdentifier", ")", "{", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "LOCATIONS", ",", "locationIdentifier", ","...
Get all the spaces in a location or a particular space in a location identified by `spaceIdentifier` @param {String|Integer} locationIdentifier A Robin channel identifier @param {String|Integer|undefined} spaceIdentifier A Robin channel data point identifier @param {Object|undefined} params ...
[ "Get", "all", "the", "spaces", "in", "a", "location", "or", "a", "particular", "space", "in", "a", "location", "identified", "by", "spaceIdentifier" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/locations.js#L68-L76
train
robinpowered/robin-js-sdk-public
lib/api/modules/locations.js
function (locationIdentifier, data) { var path; if (locationIdentifier) { path = this.constructPath(constants.LOCATIONS, locationIdentifier, constants.SPACES); return this.Core.POST(path, data); } else { return this.rejectRequest('Bad Request: A location identifier is required....
javascript
function (locationIdentifier, data) { var path; if (locationIdentifier) { path = this.constructPath(constants.LOCATIONS, locationIdentifier, constants.SPACES); return this.Core.POST(path, data); } else { return this.rejectRequest('Bad Request: A location identifier is required....
[ "function", "(", "locationIdentifier", ",", "data", ")", "{", "var", "path", ";", "if", "(", "locationIdentifier", ")", "{", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "LOCATIONS", ",", "locationIdentifier", ",", "constants", ".", "SPA...
Add space to a location @param {String|Integer} locationIdentifier A Robin location identifier @param {Object} data A querystring object @return {Function} A Promise
[ "Add", "space", "to", "a", "location" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/locations.js#L84-L92
train
robinpowered/robin-js-sdk-public
lib/api/modules/locations.js
function (locationIdentifier, params) { var path; if (locationIdentifier) { path = this.constructPath(constants.LOCATIONS, locationIdentifier, constants.PRESENCE); return this.Core.GET(path, params); } else { return this.rejectRequest('Bad Request: A location identifier is requ...
javascript
function (locationIdentifier, params) { var path; if (locationIdentifier) { path = this.constructPath(constants.LOCATIONS, locationIdentifier, constants.PRESENCE); return this.Core.GET(path, params); } else { return this.rejectRequest('Bad Request: A location identifier is requ...
[ "function", "(", "locationIdentifier", ",", "params", ")", "{", "var", "path", ";", "if", "(", "locationIdentifier", ")", "{", "path", "=", "this", ".", "constructPath", "(", "constants", ".", "LOCATIONS", ",", "locationIdentifier", ",", "constants", ".", "P...
Get all the current presence for all the spaces in a location @param {String|Integer} locationIdentifier A Robin channel identifier @param {Object|undefined} params A querystring object @return {Function} A Promise
[ "Get", "all", "the", "current", "presence", "for", "all", "the", "spaces", "in", "a", "location" ]
c3119f8340a728a2fba607c353893559376dd490
https://github.com/robinpowered/robin-js-sdk-public/blob/c3119f8340a728a2fba607c353893559376dd490/lib/api/modules/locations.js#L106-L114
train
evansiroky/gtfs-sequelize
lib/operations.js
updateInterpolatedTimes
function updateInterpolatedTimes (cfg, callback) { const db = cfg.db const lastTimepoint = cfg.lastTimepoint const nextTimepoint = cfg.nextTimepoint const timeDiff = nextTimepoint.arrival_time - lastTimepoint.departure_time let literal // sqlite null is a string if (nextTimepoint.shape_dist_traveled && ne...
javascript
function updateInterpolatedTimes (cfg, callback) { const db = cfg.db const lastTimepoint = cfg.lastTimepoint const nextTimepoint = cfg.nextTimepoint const timeDiff = nextTimepoint.arrival_time - lastTimepoint.departure_time let literal // sqlite null is a string if (nextTimepoint.shape_dist_traveled && ne...
[ "function", "updateInterpolatedTimes", "(", "cfg", ",", "callback", ")", "{", "const", "db", "=", "cfg", ".", "db", "const", "lastTimepoint", "=", "cfg", ".", "lastTimepoint", "const", "nextTimepoint", "=", "cfg", ".", "nextTimepoint", "const", "timeDiff", "="...
Make an update query to the db to set the interpolated times in a particular range of a particular trip
[ "Make", "an", "update", "query", "to", "the", "db", "to", "set", "the", "interpolated", "times", "in", "a", "particular", "range", "of", "a", "particular", "trip" ]
ba101fa82e730694c536c43e615ff38fd264a65b
https://github.com/evansiroky/gtfs-sequelize/blob/ba101fa82e730694c536c43e615ff38fd264a65b/lib/operations.js#L10-L53
train
evansiroky/gtfs-sequelize
lib/operations.js
interpolateStopTimes
function interpolateStopTimes (db, callback) { console.log('interpolating stop times') const streamerConfig = util.makeStreamerConfig(db.trip) const querier = dbStreamer.getQuerier(streamerConfig) const maxUpdateConcurrency = db.trip.sequelize.getDialect() === 'sqlite' ? 1 : 100 const updateQueue = async.queu...
javascript
function interpolateStopTimes (db, callback) { console.log('interpolating stop times') const streamerConfig = util.makeStreamerConfig(db.trip) const querier = dbStreamer.getQuerier(streamerConfig) const maxUpdateConcurrency = db.trip.sequelize.getDialect() === 'sqlite' ? 1 : 100 const updateQueue = async.queu...
[ "function", "interpolateStopTimes", "(", "db", ",", "callback", ")", "{", "console", ".", "log", "(", "'interpolating stop times'", ")", "const", "streamerConfig", "=", "util", ".", "makeStreamerConfig", "(", "db", ".", "trip", ")", "const", "querier", "=", "d...
Calculate and assign an approximate arrival and departure time at all stop_times that have an undefined arrival and departure time
[ "Calculate", "and", "assign", "an", "approximate", "arrival", "and", "departure", "time", "at", "all", "stop_times", "that", "have", "an", "undefined", "arrival", "and", "departure", "time" ]
ba101fa82e730694c536c43e615ff38fd264a65b
https://github.com/evansiroky/gtfs-sequelize/blob/ba101fa82e730694c536c43e615ff38fd264a65b/lib/operations.js#L59-L159
train
evansiroky/gtfs-sequelize
lib/operations.js
onComplete
function onComplete (err) { if (err) { console.log('interpolation encountered an error: ', err) return callback(err) } // set is complete and create a queue drain function // however, a feed may not have any interpolated times, so // `isComplete` is set in case nothing is pushed to the q...
javascript
function onComplete (err) { if (err) { console.log('interpolation encountered an error: ', err) return callback(err) } // set is complete and create a queue drain function // however, a feed may not have any interpolated times, so // `isComplete` is set in case nothing is pushed to the q...
[ "function", "onComplete", "(", "err", ")", "{", "if", "(", "err", ")", "{", "console", ".", "log", "(", "'interpolation encountered an error: '", ",", "err", ")", "return", "callback", "(", "err", ")", "}", "// set is complete and create a queue drain function", "...
Helper function to call upon completion of interpolation
[ "Helper", "function", "to", "call", "upon", "completion", "of", "interpolation" ]
ba101fa82e730694c536c43e615ff38fd264a65b
https://github.com/evansiroky/gtfs-sequelize/blob/ba101fa82e730694c536c43e615ff38fd264a65b/lib/operations.js#L71-L84
train
evansiroky/gtfs-sequelize
lib/operations.js
onRowComplete
function onRowComplete () { if (rowTimeout) { clearTimeout(rowTimeout) } if (isComplete && numUpdates === 0) { rowTimeout = setTimeout(() => { // check yet again, because interpolated times could've appeared since setting timeout if (numUpdates === 0) { console.log('int...
javascript
function onRowComplete () { if (rowTimeout) { clearTimeout(rowTimeout) } if (isComplete && numUpdates === 0) { rowTimeout = setTimeout(() => { // check yet again, because interpolated times could've appeared since setting timeout if (numUpdates === 0) { console.log('int...
[ "function", "onRowComplete", "(", ")", "{", "if", "(", "rowTimeout", ")", "{", "clearTimeout", "(", "rowTimeout", ")", "}", "if", "(", "isComplete", "&&", "numUpdates", "===", "0", ")", "{", "rowTimeout", "=", "setTimeout", "(", "(", ")", "=>", "{", "/...
Helper function to account for stop_times that are completely interpolated
[ "Helper", "function", "to", "account", "for", "stop_times", "that", "are", "completely", "interpolated" ]
ba101fa82e730694c536c43e615ff38fd264a65b
https://github.com/evansiroky/gtfs-sequelize/blob/ba101fa82e730694c536c43e615ff38fd264a65b/lib/operations.js#L91-L104
train
hello-js/hello
lib/middleware/request-id.js
requestId
function requestId (ctx, next) { let requestId = uuid.v4() ctx.id = requestId ctx.request.id = requestId ctx.state.requestId = requestId ctx.set('X-Request-Id', requestId) return next() }
javascript
function requestId (ctx, next) { let requestId = uuid.v4() ctx.id = requestId ctx.request.id = requestId ctx.state.requestId = requestId ctx.set('X-Request-Id', requestId) return next() }
[ "function", "requestId", "(", "ctx", ",", "next", ")", "{", "let", "requestId", "=", "uuid", ".", "v4", "(", ")", "ctx", ".", "id", "=", "requestId", "ctx", ".", "request", ".", "id", "=", "requestId", "ctx", ".", "state", ".", "requestId", "=", "r...
Generates a unique request ID for all requests, setting it as `ctx.id`, `ctx.request.id` and `ctx.state.requestId`. It will also set the `X-Request-Id` header to aid clients with debugging. @example ctx.headers // { `x-request-id`: '72243aca-e4bb-4a3a-a2e7-ed380c256826' } ctx.state // { requestId: '72243aca-e4bb-4a3a...
[ "Generates", "a", "unique", "request", "ID", "for", "all", "requests", "setting", "it", "as", "ctx", ".", "id", "ctx", ".", "request", ".", "id", "and", "ctx", ".", "state", ".", "requestId", ".", "It", "will", "also", "set", "the", "X", "-", "Reques...
72a0d2c87817921fba15c2d2567b8f0abc62c3e5
https://github.com/hello-js/hello/blob/72a0d2c87817921fba15c2d2567b8f0abc62c3e5/lib/middleware/request-id.js#L18-L27
train
aurelia/ssr-engine
dist/commonjs/cleanup.js
rdelete
function rdelete(m, key) { if (m.parent && m.parent.filename === require.resolve(key)) { delete m.parent; } for (var i = m.children.length - 1; i >= 0; i--) { if (m.children[i].filename === require.resolve(key)) { m.children.splice(i, 1); } else { rdel...
javascript
function rdelete(m, key) { if (m.parent && m.parent.filename === require.resolve(key)) { delete m.parent; } for (var i = m.children.length - 1; i >= 0; i--) { if (m.children[i].filename === require.resolve(key)) { m.children.splice(i, 1); } else { rdel...
[ "function", "rdelete", "(", "m", ",", "key", ")", "{", "if", "(", "m", ".", "parent", "&&", "m", ".", "parent", ".", "filename", "===", "require", ".", "resolve", "(", "key", ")", ")", "{", "delete", "m", ".", "parent", ";", "}", "for", "(", "v...
Recursively go over all node modules and delete a specific module so it can be garbage collected @param m @param key
[ "Recursively", "go", "over", "all", "node", "modules", "and", "delete", "a", "specific", "module", "so", "it", "can", "be", "garbage", "collected" ]
5394083a067136364d58650a78f9200b18033bd8
https://github.com/aurelia/ssr-engine/blob/5394083a067136364d58650a78f9200b18033bd8/dist/commonjs/cleanup.js#L34-L46
train
dbtek/bootswatch-dist
build.js
getNewVersions
function getNewVersions() { return getTags() .then(tags => { var newVersions = [] for(tag of tags) { if (semver.gt(tag.name, update.latest) || ( semver.eq(tag.name, update.latest) && (semver(tag.name).build[0] || 0) > (semver(update.latest).build[0] || 0) )) { n...
javascript
function getNewVersions() { return getTags() .then(tags => { var newVersions = [] for(tag of tags) { if (semver.gt(tag.name, update.latest) || ( semver.eq(tag.name, update.latest) && (semver(tag.name).build[0] || 0) > (semver(update.latest).build[0] || 0) )) { n...
[ "function", "getNewVersions", "(", ")", "{", "return", "getTags", "(", ")", ".", "then", "(", "tags", "=>", "{", "var", "newVersions", "=", "[", "]", "for", "(", "tag", "of", "tags", ")", "{", "if", "(", "semver", ".", "gt", "(", "tag", ".", "nam...
Filters bootswatch versions greater than latest update defined in update.json. @return {Promise} Promise to be resolved with new versions.
[ "Filters", "bootswatch", "versions", "greater", "than", "latest", "update", "defined", "in", "update", ".", "json", "." ]
c087ae53cf83ff7714dff7d470c12d2da1e44fd1
https://github.com/dbtek/bootswatch-dist/blob/c087ae53cf83ff7714dff7d470c12d2da1e44fd1/build.js#L60-L77
train
dbtek/bootswatch-dist
build.js
cloneRepo
function cloneRepo() { return new Promise((resolve, reject) => { git.clone(`https://${GH_TOKEN}@github.com/dbtek/bootswatch-dist.git`, '.tmp/repo', (err, result) => { if (err) { return reject(err) } resolve(result) }) }) }
javascript
function cloneRepo() { return new Promise((resolve, reject) => { git.clone(`https://${GH_TOKEN}@github.com/dbtek/bootswatch-dist.git`, '.tmp/repo', (err, result) => { if (err) { return reject(err) } resolve(result) }) }) }
[ "function", "cloneRepo", "(", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "git", ".", "clone", "(", "`", "${", "GH_TOKEN", "}", "`", ",", "'.tmp/repo'", ",", "(", "err", ",", "result", ")", "=>", "{", ...
Clones release repository @return {Promise}
[ "Clones", "release", "repository" ]
c087ae53cf83ff7714dff7d470c12d2da1e44fd1
https://github.com/dbtek/bootswatch-dist/blob/c087ae53cf83ff7714dff7d470c12d2da1e44fd1/build.js#L97-L106
train
dbtek/bootswatch-dist
build.js
copyRepo
function copyRepo(dest) { return new Promise((resolve, reject) => { ncp('.tmp/repo', dest, (err) => { if (err) { reject(err) return } resolve() }) }) }
javascript
function copyRepo(dest) { return new Promise((resolve, reject) => { ncp('.tmp/repo', dest, (err) => { if (err) { reject(err) return } resolve() }) }) }
[ "function", "copyRepo", "(", "dest", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "ncp", "(", "'.tmp/repo'", ",", "dest", ",", "(", "err", ")", "=>", "{", "if", "(", "err", ")", "{", "reject", "(", "er...
Copies repository folder to given destination @param {String} dest @return {Promise}
[ "Copies", "repository", "folder", "to", "given", "destination" ]
c087ae53cf83ff7714dff7d470c12d2da1e44fd1
https://github.com/dbtek/bootswatch-dist/blob/c087ae53cf83ff7714dff7d470c12d2da1e44fd1/build.js#L113-L123
train
dbtek/bootswatch-dist
build.js
downloadBootstrapAssets
function downloadBootstrapAssets(version, path) { console.log(chalk.blue((`Downloading Bootstrap assets to ${path}`))) version = semver.clean(version) const url = 'https://maxcdn.bootstrapcdn.com/bootstrap' var proms = [ 'fonts/glyphicons-halflings-regular.eot', 'fonts/glyphicons-halflings-regular.woff'...
javascript
function downloadBootstrapAssets(version, path) { console.log(chalk.blue((`Downloading Bootstrap assets to ${path}`))) version = semver.clean(version) const url = 'https://maxcdn.bootstrapcdn.com/bootstrap' var proms = [ 'fonts/glyphicons-halflings-regular.eot', 'fonts/glyphicons-halflings-regular.woff'...
[ "function", "downloadBootstrapAssets", "(", "version", ",", "path", ")", "{", "console", ".", "log", "(", "chalk", ".", "blue", "(", "(", "`", "${", "path", "}", "`", ")", ")", ")", "version", "=", "semver", ".", "clean", "(", "version", ")", "const"...
Downloads bootstrap js and font files by given version to destination path. @param {String} version Semver @param {String} path Save destination @return {Promise}
[ "Downloads", "bootstrap", "js", "and", "font", "files", "by", "given", "version", "to", "destination", "path", "." ]
c087ae53cf83ff7714dff7d470c12d2da1e44fd1
https://github.com/dbtek/bootswatch-dist/blob/c087ae53cf83ff7714dff7d470c12d2da1e44fd1/build.js#L131-L161
train
dbtek/bootswatch-dist
build.js
updatePackageInfo
function updatePackageInfo(theme, version) { const cwd = `.tmp/${version}/${theme}/publish` bower.version = `${version}-${theme}` pkg.version = `${version}-${theme}` return Promise.all([ fs.writeFile(`${cwd}/bower.json`, JSON.stringify(bower, null, 4)), fs.writeFile(`${cwd}/package.json`, JSON.stringify...
javascript
function updatePackageInfo(theme, version) { const cwd = `.tmp/${version}/${theme}/publish` bower.version = `${version}-${theme}` pkg.version = `${version}-${theme}` return Promise.all([ fs.writeFile(`${cwd}/bower.json`, JSON.stringify(bower, null, 4)), fs.writeFile(`${cwd}/package.json`, JSON.stringify...
[ "function", "updatePackageInfo", "(", "theme", ",", "version", ")", "{", "const", "cwd", "=", "`", "${", "version", "}", "${", "theme", "}", "`", "bower", ".", "version", "=", "`", "${", "version", "}", "${", "theme", "}", "`", "pkg", ".", "version",...
Creates bower.json and package.json with content relevant to theme. @param {String} theme Theme name @param {String} version Semver @return {Promise}
[ "Creates", "bower", ".", "json", "and", "package", ".", "json", "with", "content", "relevant", "to", "theme", "." ]
c087ae53cf83ff7714dff7d470c12d2da1e44fd1
https://github.com/dbtek/bootswatch-dist/blob/c087ae53cf83ff7714dff7d470c12d2da1e44fd1/build.js#L211-L219
train
dbtek/bootswatch-dist
build.js
releaseTheme
function releaseTheme(theme, version) { const repoPath = `.tmp/${version}/${theme}/publish` return setupThemeRepo(theme, version) .then(() => { console.log(chalk.blue('Committing changes...')) return new Promise((resolve, reject) => { // commit changes git.add(['css', 'js', 'fonts', ...
javascript
function releaseTheme(theme, version) { const repoPath = `.tmp/${version}/${theme}/publish` return setupThemeRepo(theme, version) .then(() => { console.log(chalk.blue('Committing changes...')) return new Promise((resolve, reject) => { // commit changes git.add(['css', 'js', 'fonts', ...
[ "function", "releaseTheme", "(", "theme", ",", "version", ")", "{", "const", "repoPath", "=", "`", "${", "version", "}", "${", "theme", "}", "`", "return", "setupThemeRepo", "(", "theme", ",", "version", ")", ".", "then", "(", "(", ")", "=>", "{", "c...
Releases new theme version @param {String} theme Theme name @param {String} version Semver @return {Promise}
[ "Releases", "new", "theme", "version" ]
c087ae53cf83ff7714dff7d470c12d2da1e44fd1
https://github.com/dbtek/bootswatch-dist/blob/c087ae53cf83ff7714dff7d470c12d2da1e44fd1/build.js#L227-L258
train
happilymarrieddad/puglatizer
puglatizer.js
function(callback) { fs.stat(outputFile,function(err,stat) { if (err) { return callback(null) } console.log('Found old ' + outputFile + ' so now removing') fs.unlinkSync(outputFile) return callback(null) }) }
javascript
function(callback) { fs.stat(outputFile,function(err,stat) { if (err) { return callback(null) } console.log('Found old ' + outputFile + ' so now removing') fs.unlinkSync(outputFile) return callback(null) }) }
[ "function", "(", "callback", ")", "{", "fs", ".", "stat", "(", "outputFile", ",", "function", "(", "err", ",", "stat", ")", "{", "if", "(", "err", ")", "{", "return", "callback", "(", "null", ")", "}", "console", ".", "log", "(", "'Found old '", "+...
Unbuild old template file if exists
[ "Unbuild", "old", "template", "file", "if", "exists" ]
59678b13021c697b822bb45f9eb3ffc6a071c2ad
https://github.com/happilymarrieddad/puglatizer/blob/59678b13021c697b822bb45f9eb3ffc6a071c2ad/puglatizer.js#L46-L53
train
happilymarrieddad/puglatizer
puglatizer.js
function(callback) { fs.appendFileSync(outputFile,";(function(root,factory){\r\n") fs.appendFileSync(outputFile," if (typeof define === 'function' && define.amd) {\r\n") fs.appendFileSync(outputFile," define([], factory);\r\n") fs.appendFileSync(outputFile," } else if (typeof exports === 'objec...
javascript
function(callback) { fs.appendFileSync(outputFile,";(function(root,factory){\r\n") fs.appendFileSync(outputFile," if (typeof define === 'function' && define.amd) {\r\n") fs.appendFileSync(outputFile," define([], factory);\r\n") fs.appendFileSync(outputFile," } else if (typeof exports === 'objec...
[ "function", "(", "callback", ")", "{", "fs", ".", "appendFileSync", "(", "outputFile", ",", "\";(function(root,factory){\\r\\n\"", ")", "fs", ".", "appendFileSync", "(", "outputFile", ",", "\" if (typeof define === 'function' && define.amd) {\\r\\n\"", ")", "fs", ".", ...
Create the initial file
[ "Create", "the", "initial", "file" ]
59678b13021c697b822bb45f9eb3ffc6a071c2ad
https://github.com/happilymarrieddad/puglatizer/blob/59678b13021c697b822bb45f9eb3ffc6a071c2ad/puglatizer.js#L55-L90
train
happilymarrieddad/puglatizer
puglatizer.js
function(callback) { var fileLoop = function(currentDir,templateDirectories,cb) { var callback_has_been_called = false fs.readdir(currentDir,function(err,files) { if (err) { return console.log('Unable to find files in path',currentDir) } var num = files.length var finishFile = fun...
javascript
function(callback) { var fileLoop = function(currentDir,templateDirectories,cb) { var callback_has_been_called = false fs.readdir(currentDir,function(err,files) { if (err) { return console.log('Unable to find files in path',currentDir) } var num = files.length var finishFile = fun...
[ "function", "(", "callback", ")", "{", "var", "fileLoop", "=", "function", "(", "currentDir", ",", "templateDirectories", ",", "cb", ")", "{", "var", "callback_has_been_called", "=", "false", "fs", ".", "readdir", "(", "currentDir", ",", "function", "(", "er...
Here we build all the pug functions
[ "Here", "we", "build", "all", "the", "pug", "functions" ]
59678b13021c697b822bb45f9eb3ffc6a071c2ad
https://github.com/happilymarrieddad/puglatizer/blob/59678b13021c697b822bb45f9eb3ffc6a071c2ad/puglatizer.js#L92-L161
train
happilymarrieddad/puglatizer
puglatizer.js
function(callback) { fs.appendFileSync(outputFile,"\r\n") fs.appendFileSync(outputFile," return puglatizer;\r\n") fs.appendFileSync(outputFile,"}));\r\n") return callback() }
javascript
function(callback) { fs.appendFileSync(outputFile,"\r\n") fs.appendFileSync(outputFile," return puglatizer;\r\n") fs.appendFileSync(outputFile,"}));\r\n") return callback() }
[ "function", "(", "callback", ")", "{", "fs", ".", "appendFileSync", "(", "outputFile", ",", "\"\\r\\n\"", ")", "fs", ".", "appendFileSync", "(", "outputFile", ",", "\" return puglatizer;\\r\\n\"", ")", "fs", ".", "appendFileSync", "(", "outputFile", ",", "\"}...
Finalize the file
[ "Finalize", "the", "file" ]
59678b13021c697b822bb45f9eb3ffc6a071c2ad
https://github.com/happilymarrieddad/puglatizer/blob/59678b13021c697b822bb45f9eb3ffc6a071c2ad/puglatizer.js#L163-L169
train
jasonslyvia/redux-composable-fetch
lib/index.js
resolveHandler
function resolveHandler(_ref4) { var action = _ref4.action; var type = _ref4.type; var payload = _ref4.payload; var error = _ref4.error; return _extends({}, action, { type: type, payload: payload, error: error }); }
javascript
function resolveHandler(_ref4) { var action = _ref4.action; var type = _ref4.type; var payload = _ref4.payload; var error = _ref4.error; return _extends({}, action, { type: type, payload: payload, error: error }); }
[ "function", "resolveHandler", "(", "_ref4", ")", "{", "var", "action", "=", "_ref4", ".", "action", ";", "var", "type", "=", "_ref4", ".", "type", ";", "var", "payload", "=", "_ref4", ".", "payload", ";", "var", "error", "=", "_ref4", ".", "error", "...
For unify the action being dispatched, you might NOT need it! `result` might be the payload or the error, depending how the request end up
[ "For", "unify", "the", "action", "being", "dispatched", "you", "might", "NOT", "need", "it!", "result", "might", "be", "the", "payload", "or", "the", "error", "depending", "how", "the", "request", "end", "up" ]
eb4676077747692092d7ee1d2d63be16e455e662
https://github.com/jasonslyvia/redux-composable-fetch/blob/eb4676077747692092d7ee1d2d63be16e455e662/lib/index.js#L49-L55
train
jasonslyvia/redux-composable-fetch
lib/index.js
createFetchMiddleware
function createFetchMiddleware() { var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; var config = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; var finalConfig = _extends({}, config); // Be compatible with previous API if (typeof config === 'boo...
javascript
function createFetchMiddleware() { var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; var config = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; var finalConfig = _extends({}, config); // Be compatible with previous API if (typeof config === 'boo...
[ "function", "createFetchMiddleware", "(", ")", "{", "var", "options", "=", "arguments", ".", "length", "<=", "0", "||", "arguments", "[", "0", "]", "===", "undefined", "?", "{", "}", ":", "arguments", "[", "0", "]", ";", "var", "config", "=", "argument...
Create a fetch middleware @param {object} options Options for creating fetch middleware @param {function} beforeFetch Injection point before sending request, it should return a Promise @param {function} afterFetch Injection point after receive response, it should return a Promise @param {function} onReject ...
[ "Create", "a", "fetch", "middleware" ]
eb4676077747692092d7ee1d2d63be16e455e662
https://github.com/jasonslyvia/redux-composable-fetch/blob/eb4676077747692092d7ee1d2d63be16e455e662/lib/index.js#L79-L252
train
Robert-W/react-prerender
samples/amd/js/utils/params.js
getUrlParams
function getUrlParams(path) { if (!path) { return {}; } var bits = path.split('?'); var querystring = bits.length > 1 ? bits[1] : ''; return toObject(querystring); }
javascript
function getUrlParams(path) { if (!path) { return {}; } var bits = path.split('?'); var querystring = bits.length > 1 ? bits[1] : ''; return toObject(querystring); }
[ "function", "getUrlParams", "(", "path", ")", "{", "if", "(", "!", "path", ")", "{", "return", "{", "}", ";", "}", "var", "bits", "=", "path", ".", "split", "(", "'?'", ")", ";", "var", "querystring", "=", "bits", ".", "length", ">", "1", "?", ...
Return the query parameters from the provided string @param {string} path - Path to pull querystring from, should be location.href @return {object} - Dictionary containiner the url parameters
[ "Return", "the", "query", "parameters", "from", "the", "provided", "string" ]
0499603b0fa56679abaea323d92ac7be530921f0
https://github.com/Robert-W/react-prerender/blob/0499603b0fa56679abaea323d92ac7be530921f0/samples/amd/js/utils/params.js#L63-L70
train
hello-js/hello
lib/app.js
_defaults
function _defaults (config) { let values = require('./defaults/default') try { values = merge(values, require(`./defaults/${process.env.NODE_ENV}`)) } catch (e) { } return defaultsDeep(config, values) }
javascript
function _defaults (config) { let values = require('./defaults/default') try { values = merge(values, require(`./defaults/${process.env.NODE_ENV}`)) } catch (e) { } return defaultsDeep(config, values) }
[ "function", "_defaults", "(", "config", ")", "{", "let", "values", "=", "require", "(", "'./defaults/default'", ")", "try", "{", "values", "=", "merge", "(", "values", ",", "require", "(", "`", "${", "process", ".", "env", ".", "NODE_ENV", "}", "`", ")...
Set default values for the `config` param if not set @private @param {Object} [config] - The config to use (optional) @returns {Object} - The config object with default values
[ "Set", "default", "values", "for", "the", "config", "param", "if", "not", "set" ]
72a0d2c87817921fba15c2d2567b8f0abc62c3e5
https://github.com/hello-js/hello/blob/72a0d2c87817921fba15c2d2567b8f0abc62c3e5/lib/app.js#L154-L162
train
PunchThrough/bean-sdk-node
src/util/intelhex.js
extractDataFromIntelHexLine
function extractDataFromIntelHexLine(intelHexLine) { if (!intelHexLine.startsWith(':')) { throw new Error(`Intel hex lines need to start with ':'`) } let asciiHex = intelHexLine.slice(1, intelHexLine.length) if (asciiHex.length === 0) { throw new Error(`Length of ascii hex string needs to be greater t...
javascript
function extractDataFromIntelHexLine(intelHexLine) { if (!intelHexLine.startsWith(':')) { throw new Error(`Intel hex lines need to start with ':'`) } let asciiHex = intelHexLine.slice(1, intelHexLine.length) if (asciiHex.length === 0) { throw new Error(`Length of ascii hex string needs to be greater t...
[ "function", "extractDataFromIntelHexLine", "(", "intelHexLine", ")", "{", "if", "(", "!", "intelHexLine", ".", "startsWith", "(", "':'", ")", ")", "{", "throw", "new", "Error", "(", "`", "`", ")", "}", "let", "asciiHex", "=", "intelHexLine", ".", "slice", ...
Extract the "data" from an Intel hex line An Intel hex line looks like this :100000005CC000000C9450080C947D087EC0000079 Once the ':' character is removed, each set of two characters represent a Hexadecimal octet, or byte. However, not every byte in the string is considered data, here is what the bytes mean: Byte(s)...
[ "Extract", "the", "data", "from", "an", "Intel", "hex", "line" ]
b58342043c832f2e3b12cfb55a0fec603aab38d8
https://github.com/PunchThrough/bean-sdk-node/blob/b58342043c832f2e3b12cfb55a0fec603aab38d8/src/util/intelhex.js#L31-L64
train
jhermsmeier/node-mbr
lib/mbr.js
function() { var i = 0 var part = null for( var i = 0; i < this.partitions.length; i++ ) { part = this.partitions[i] if( part.type === 0xEE || part.type === 0xEF ) { return part } } return null }
javascript
function() { var i = 0 var part = null for( var i = 0; i < this.partitions.length; i++ ) { part = this.partitions[i] if( part.type === 0xEE || part.type === 0xEF ) { return part } } return null }
[ "function", "(", ")", "{", "var", "i", "=", "0", "var", "part", "=", "null", "for", "(", "var", "i", "=", "0", ";", "i", "<", "this", ".", "partitions", ".", "length", ";", "i", "++", ")", "{", "part", "=", "this", ".", "partitions", "[", "i"...
Get the EFI system partition if available @returns {MBR.Partition|null}
[ "Get", "the", "EFI", "system", "partition", "if", "available" ]
a3ebdeb56fc3ce12a89e965c7127f6fe9547470a
https://github.com/jhermsmeier/node-mbr/blob/a3ebdeb56fc3ce12a89e965c7127f6fe9547470a/lib/mbr.js#L179-L193
train
sapegin/proselint
src/worker.js
replaceCodeBlocks
function replaceCodeBlocks(contents) { function processCode() { return ast => { visit(ast, 'code', node => { const start = node.position.start.line; const end = node.position.end.line; for (let line = start; line < end - 1; line++) { lines[line] = ''; } }); }; } const lines = splitLin...
javascript
function replaceCodeBlocks(contents) { function processCode() { return ast => { visit(ast, 'code', node => { const start = node.position.start.line; const end = node.position.end.line; for (let line = start; line < end - 1; line++) { lines[line] = ''; } }); }; } const lines = splitLin...
[ "function", "replaceCodeBlocks", "(", "contents", ")", "{", "function", "processCode", "(", ")", "{", "return", "ast", "=>", "{", "visit", "(", "ast", ",", "'code'", ",", "node", "=>", "{", "const", "start", "=", "node", ".", "position", ".", "start", ...
Replace all lines inside code blocks with empty lines becase proselint validates code by default. We use empty lines instead of just code removal to keep correct line numbers. Work with the original document because Remark changes formatting which makes error positions incorrect
[ "Replace", "all", "lines", "inside", "code", "blocks", "with", "empty", "lines", "becase", "proselint", "validates", "code", "by", "default", ".", "We", "use", "empty", "lines", "instead", "of", "just", "code", "removal", "to", "keep", "correct", "line", "nu...
2564fbbf493dc0660045fc01c357383699d3722f
https://github.com/sapegin/proselint/blob/2564fbbf493dc0660045fc01c357383699d3722f/src/worker.js#L98-L117
train
hello-js/hello
lib/router.js
controllerMethod
function controllerMethod (controller, method) { if (controller && controller[method]) { return controller[method] } // Handle hello-based Controller classes if (isClass(controller) && controller.action) { return controller.action(method) } return notImplemented }
javascript
function controllerMethod (controller, method) { if (controller && controller[method]) { return controller[method] } // Handle hello-based Controller classes if (isClass(controller) && controller.action) { return controller.action(method) } return notImplemented }
[ "function", "controllerMethod", "(", "controller", ",", "method", ")", "{", "if", "(", "controller", "&&", "controller", "[", "method", "]", ")", "{", "return", "controller", "[", "method", "]", "}", "// Handle hello-based Controller classes", "if", "(", "isClas...
Returns a wrapper to be used in the router for calling a given controller method. @param {Object|Controller} controller - The controller @param {String} method - The method on the controller to call @returns {Function} The controller method to call
[ "Returns", "a", "wrapper", "to", "be", "used", "in", "the", "router", "for", "calling", "a", "given", "controller", "method", "." ]
72a0d2c87817921fba15c2d2567b8f0abc62c3e5
https://github.com/hello-js/hello/blob/72a0d2c87817921fba15c2d2567b8f0abc62c3e5/lib/router.js#L177-L188
train
jasonslyvia/redux-composable-fetch
lib/applyFetchMiddleware.js
applyFetchMiddleware
function applyFetchMiddleware() { for (var _len = arguments.length, middlewares = Array(_len), _key = 0; _key < _len; _key++) { middlewares[_key] = arguments[_key]; } var middlewaresWithOnResolve = middlewares.filter(function (m) { return typeof m.onResolve === 'function'; }); if (middlewaresWithOnRe...
javascript
function applyFetchMiddleware() { for (var _len = arguments.length, middlewares = Array(_len), _key = 0; _key < _len; _key++) { middlewares[_key] = arguments[_key]; } var middlewaresWithOnResolve = middlewares.filter(function (m) { return typeof m.onResolve === 'function'; }); if (middlewaresWithOnRe...
[ "function", "applyFetchMiddleware", "(", ")", "{", "for", "(", "var", "_len", "=", "arguments", ".", "length", ",", "middlewares", "=", "Array", "(", "_len", ")", ",", "_key", "=", "0", ";", "_key", "<", "_len", ";", "_key", "++", ")", "{", "middlewa...
Utility function, chain multiple middlewares of `redux-composable-fetch` into one @param {...object} middlewares @return {object}
[ "Utility", "function", "chain", "multiple", "middlewares", "of", "redux", "-", "composable", "-", "fetch", "into", "one" ]
eb4676077747692092d7ee1d2d63be16e455e662
https://github.com/jasonslyvia/redux-composable-fetch/blob/eb4676077747692092d7ee1d2d63be16e455e662/lib/applyFetchMiddleware.js#L12-L72
train
hello-js/hello
cli/index.js
run
function run (action, command, name, flags) { switch (action) { case 'new': case 'generate': case 'g': generate(command, name, flags) break case 'migrate': migrate(command || 'up') break case 'up': migrate('up') break case 'down': case 'rollback': ...
javascript
function run (action, command, name, flags) { switch (action) { case 'new': case 'generate': case 'g': generate(command, name, flags) break case 'migrate': migrate(command || 'up') break case 'up': migrate('up') break case 'down': case 'rollback': ...
[ "function", "run", "(", "action", ",", "command", ",", "name", ",", "flags", ")", "{", "switch", "(", "action", ")", "{", "case", "'new'", ":", "case", "'generate'", ":", "case", "'g'", ":", "generate", "(", "command", ",", "name", ",", "flags", ")",...
Handle the cli input @param {String} action - The action to perform (new, generate) @param {String} command - The command to pass to the generator or migrator @param {String} name - The name of the item to create, if any @param {Object} flags - The flags/options passed to the command line
[ "Handle", "the", "cli", "input" ]
72a0d2c87817921fba15c2d2567b8f0abc62c3e5
https://github.com/hello-js/hello/blob/72a0d2c87817921fba15c2d2567b8f0abc62c3e5/cli/index.js#L44-L64
train
hello-js/hello
cli/index.js
generate
function generate (generatorName, name, flags) { let generator switch (generatorName) { case 'app': generator = new generators.App(name) break case 'controller': generator = new generators.Controller(name, flags) break case 'model': generator = new generators.Model(name, f...
javascript
function generate (generatorName, name, flags) { let generator switch (generatorName) { case 'app': generator = new generators.App(name) break case 'controller': generator = new generators.Controller(name, flags) break case 'model': generator = new generators.Model(name, f...
[ "function", "generate", "(", "generatorName", ",", "name", ",", "flags", ")", "{", "let", "generator", "switch", "(", "generatorName", ")", "{", "case", "'app'", ":", "generator", "=", "new", "generators", ".", "App", "(", "name", ")", "break", "case", "...
Run a given generator @param {String} generatorName - The name of the generator to run @param {String} name - The name of the generated item @param {Object} flags - The flags passed to the generator
[ "Run", "a", "given", "generator" ]
72a0d2c87817921fba15c2d2567b8f0abc62c3e5
https://github.com/hello-js/hello/blob/72a0d2c87817921fba15c2d2567b8f0abc62c3e5/cli/index.js#L73-L112
train
hello-js/hello
cli/index.js
migrate
async function migrate (direction) { let config = require(path.join(process.cwd(), '.', 'config')) let db = require(path.join(process.cwd(), '.', 'db')) if (direction === 'up') { await db.migrate.latest(config.db) } else if (direction === 'down') { await db.migrate.rollback(config.db) } else { cl...
javascript
async function migrate (direction) { let config = require(path.join(process.cwd(), '.', 'config')) let db = require(path.join(process.cwd(), '.', 'db')) if (direction === 'up') { await db.migrate.latest(config.db) } else if (direction === 'down') { await db.migrate.rollback(config.db) } else { cl...
[ "async", "function", "migrate", "(", "direction", ")", "{", "let", "config", "=", "require", "(", "path", ".", "join", "(", "process", ".", "cwd", "(", ")", ",", "'.'", ",", "'config'", ")", ")", "let", "db", "=", "require", "(", "path", ".", "join...
Run the migrations in a given direction. @param {String} direction - The direcation to run, can be 'up' or 'down'
[ "Run", "the", "migrations", "in", "a", "given", "direction", "." ]
72a0d2c87817921fba15c2d2567b8f0abc62c3e5
https://github.com/hello-js/hello/blob/72a0d2c87817921fba15c2d2567b8f0abc62c3e5/cli/index.js#L119-L132
train
Robert-W/react-prerender
lib/utils.js
function (options) { return options.mount && options.target && options.component && type(options.component) === TYPES.STRING && type(options.target) === TYPES.STRING && type(options.mount) === TYPES.STRING; }
javascript
function (options) { return options.mount && options.target && options.component && type(options.component) === TYPES.STRING && type(options.target) === TYPES.STRING && type(options.mount) === TYPES.STRING; }
[ "function", "(", "options", ")", "{", "return", "options", ".", "mount", "&&", "options", ".", "target", "&&", "options", ".", "component", "&&", "type", "(", "options", ".", "component", ")", "===", "TYPES", ".", "STRING", "&&", "type", "(", "options", ...
Checks for mount, target, and component since they are the minimum required options Also checks to make sure they are the correct type @param {object} options @return {bool}
[ "Checks", "for", "mount", "target", "and", "component", "since", "they", "are", "the", "minimum", "required", "options", "Also", "checks", "to", "make", "sure", "they", "are", "the", "correct", "type" ]
0499603b0fa56679abaea323d92ac7be530921f0
https://github.com/Robert-W/react-prerender/blob/0499603b0fa56679abaea323d92ac7be530921f0/lib/utils.js#L34-L39
train
Robert-W/react-prerender
lib/utils.js
function (options) { return ( options.paths && options.baseUrl && type(options.paths) === TYPES.OBJECT && type(options.baseUrl) === TYPES.STRING ) || ( options.buildProfile && type(options.buildProfile) === TYPES.STRING ); }
javascript
function (options) { return ( options.paths && options.baseUrl && type(options.paths) === TYPES.OBJECT && type(options.baseUrl) === TYPES.STRING ) || ( options.buildProfile && type(options.buildProfile) === TYPES.STRING ); }
[ "function", "(", "options", ")", "{", "return", "(", "options", ".", "paths", "&&", "options", ".", "baseUrl", "&&", "type", "(", "options", ".", "paths", ")", "===", "TYPES", ".", "OBJECT", "&&", "type", "(", "options", ".", "baseUrl", ")", "===", "...
Checks for baseUrl and paths or a build profile at minimum Also checks to make sure they are the correct type @param {object} options @return {bool}
[ "Checks", "for", "baseUrl", "and", "paths", "or", "a", "build", "profile", "at", "minimum", "Also", "checks", "to", "make", "sure", "they", "are", "the", "correct", "type" ]
0499603b0fa56679abaea323d92ac7be530921f0
https://github.com/Robert-W/react-prerender/blob/0499603b0fa56679abaea323d92ac7be530921f0/lib/utils.js#L47-L57
train
Robert-W/react-prerender
lib/utils.js
function (options) { return options.moduleRoot && options.remapModule && options.ignorePatterns && type(options.moduleRoot) === TYPES.STRING && type(options.remapModule) === TYPES.STRING && ( (type(options.ignorePatterns) === TYPES.STRING || type(options.ignorePatterns) === TYPES.REGEXP) ...
javascript
function (options) { return options.moduleRoot && options.remapModule && options.ignorePatterns && type(options.moduleRoot) === TYPES.STRING && type(options.remapModule) === TYPES.STRING && ( (type(options.ignorePatterns) === TYPES.STRING || type(options.ignorePatterns) === TYPES.REGEXP) ...
[ "function", "(", "options", ")", "{", "return", "options", ".", "moduleRoot", "&&", "options", ".", "remapModule", "&&", "options", ".", "ignorePatterns", "&&", "type", "(", "options", ".", "moduleRoot", ")", "===", "TYPES", ".", "STRING", "&&", "type", "(...
Checks for moduleRoot, remapModule, and ignorePatterns at minimum Also checks to make sure they are the correct type @param {object} options @return {bool}
[ "Checks", "for", "moduleRoot", "remapModule", "and", "ignorePatterns", "at", "minimum", "Also", "checks", "to", "make", "sure", "they", "are", "the", "correct", "type" ]
0499603b0fa56679abaea323d92ac7be530921f0
https://github.com/Robert-W/react-prerender/blob/0499603b0fa56679abaea323d92ac7be530921f0/lib/utils.js#L65-L79
train
Robert-W/react-prerender
lib/utils.js
function (path) { var profile; try { profile = eval(fs.readFileSync(path, 'utf-8')); } catch (err) { // set profile to empty, check in prerender will throw an error // if no path or baseUrl is present profile = {}; } return profile; }
javascript
function (path) { var profile; try { profile = eval(fs.readFileSync(path, 'utf-8')); } catch (err) { // set profile to empty, check in prerender will throw an error // if no path or baseUrl is present profile = {}; } return profile; }
[ "function", "(", "path", ")", "{", "var", "profile", ";", "try", "{", "profile", "=", "eval", "(", "fs", ".", "readFileSync", "(", "path", ",", "'utf-8'", ")", ")", ";", "}", "catch", "(", "err", ")", "{", "// set profile to empty, check in prerender will ...
Load and attempt to evaluate a requirejs build profile @param {string} path path to a requirejs build profile @return {object} requirejsConfig
[ "Load", "and", "attempt", "to", "evaluate", "a", "requirejs", "build", "profile" ]
0499603b0fa56679abaea323d92ac7be530921f0
https://github.com/Robert-W/react-prerender/blob/0499603b0fa56679abaea323d92ac7be530921f0/lib/utils.js#L86-L96
train
Robert-W/react-prerender
lib/utils.js
function (moduleRoot, remapModule, ignores) { var tree = madge(moduleRoot, { format: 'amd' }).tree, paths = [], map = {}; /** * Filter function to test module paths, ignores can be array[string|regexp]|string|regexp * @param {string} path - module path */ var matches = function ...
javascript
function (moduleRoot, remapModule, ignores) { var tree = madge(moduleRoot, { format: 'amd' }).tree, paths = [], map = {}; /** * Filter function to test module paths, ignores can be array[string|regexp]|string|regexp * @param {string} path - module path */ var matches = function ...
[ "function", "(", "moduleRoot", ",", "remapModule", ",", "ignores", ")", "{", "var", "tree", "=", "madge", "(", "moduleRoot", ",", "{", "format", ":", "'amd'", "}", ")", ".", "tree", ",", "paths", "=", "[", "]", ",", "map", "=", "{", "}", ";", "/*...
Generate a map object that maps all modules matching the ignores pattern to the emptyModule @param {string} moduleRoot - base dir of your modules @param {string} remapModule - path to empty module (by empty module I mean a dependency free module) @param {string|array} ignores - RegEx patterns or basic strings to includ...
[ "Generate", "a", "map", "object", "that", "maps", "all", "modules", "matching", "the", "ignores", "pattern", "to", "the", "emptyModule" ]
0499603b0fa56679abaea323d92ac7be530921f0
https://github.com/Robert-W/react-prerender/blob/0499603b0fa56679abaea323d92ac7be530921f0/lib/utils.js#L105-L141
train
Robert-W/react-prerender
lib/utils.js
function (component, props) { var Component = React.createFactory(component); return ReactDomServer.renderToString(Component(props)); }
javascript
function (component, props) { var Component = React.createFactory(component); return ReactDomServer.renderToString(Component(props)); }
[ "function", "(", "component", ",", "props", ")", "{", "var", "Component", "=", "React", ".", "createFactory", "(", "component", ")", ";", "return", "ReactDomServer", ".", "renderToString", "(", "Component", "(", "props", ")", ")", ";", "}" ]
Generate a string representation of a react component @param {function} component - react component @param {object} props - default props to pass in to the component @return {string} string representation of your component
[ "Generate", "a", "string", "representation", "of", "a", "react", "component" ]
0499603b0fa56679abaea323d92ac7be530921f0
https://github.com/Robert-W/react-prerender/blob/0499603b0fa56679abaea323d92ac7be530921f0/lib/utils.js#L149-L152
train
Robert-W/react-prerender
lib/utils.js
function (target, mount, component) { var file = fs.readFileSync(target, 'utf-8'); var $ = cheerio.load(file); //- returns true if any of the elements match mount, so throw if false if (!$(mount).is(mount)) { throw messages.errors.domNodeNotFound(mount); } //- write to html $(mount).append(compo...
javascript
function (target, mount, component) { var file = fs.readFileSync(target, 'utf-8'); var $ = cheerio.load(file); //- returns true if any of the elements match mount, so throw if false if (!$(mount).is(mount)) { throw messages.errors.domNodeNotFound(mount); } //- write to html $(mount).append(compo...
[ "function", "(", "target", ",", "mount", ",", "component", ")", "{", "var", "file", "=", "fs", ".", "readFileSync", "(", "target", ",", "'utf-8'", ")", ";", "var", "$", "=", "cheerio", ".", "load", "(", "file", ")", ";", "//- returns true if any of the e...
Insert the string into the target html file at the mount point @param {string} target - path to html file @param {string} mount - query for a dom node that the component will be injected into @param {string} component - string representation of a react component
[ "Insert", "the", "string", "into", "the", "target", "html", "file", "at", "the", "mount", "point" ]
0499603b0fa56679abaea323d92ac7be530921f0
https://github.com/Robert-W/react-prerender/blob/0499603b0fa56679abaea323d92ac7be530921f0/lib/utils.js#L160-L168
train
ahomu/rx.observable.combinetemplate
index.js
collectTargetObservablesAndContext
function collectTargetObservablesAndContext(templateObject) { var targets = []; var contexts = []; /** * * ``` * // context index sample (`x` == Observable) * { * foo: x, // => ['foo'] * bar: { * foo: x, // => ['bar', 'foo'] * bar: [_, _, x] // => ['bar', 'bar', 2...
javascript
function collectTargetObservablesAndContext(templateObject) { var targets = []; var contexts = []; /** * * ``` * // context index sample (`x` == Observable) * { * foo: x, // => ['foo'] * bar: { * foo: x, // => ['bar', 'foo'] * bar: [_, _, x] // => ['bar', 'bar', 2...
[ "function", "collectTargetObservablesAndContext", "(", "templateObject", ")", "{", "var", "targets", "=", "[", "]", ";", "var", "contexts", "=", "[", "]", ";", "/**\n *\n * ```\n * // context index sample (`x` == Observable)\n * {\n * foo: x, // => ['foo']\n *...
Log target observable & context that indicates the position in the object. @param {Object} templateObject @returns {{targets: Array, contexts: Array}}
[ "Log", "target", "observable", "&", "context", "that", "indicates", "the", "position", "in", "the", "object", "." ]
1c2204b6b26fb2c1ea0452c18191cb3c248522d5
https://github.com/ahomu/rx.observable.combinetemplate/blob/1c2204b6b26fb2c1ea0452c18191cb3c248522d5/index.js#L92-L150
train
jhermsmeier/node-mbr
lib/code.js
Code
function Code( buffer, start, end ) { if( !(this instanceof Code) ) return new Code( buffer, start, end ) this.offset = start || 0x00 if( Buffer.isBuffer( buffer ) ) { this.data = buffer.slice( start, end ) } else { this.data = Buffer.alloc( 446 ) } }
javascript
function Code( buffer, start, end ) { if( !(this instanceof Code) ) return new Code( buffer, start, end ) this.offset = start || 0x00 if( Buffer.isBuffer( buffer ) ) { this.data = buffer.slice( start, end ) } else { this.data = Buffer.alloc( 446 ) } }
[ "function", "Code", "(", "buffer", ",", "start", ",", "end", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Code", ")", ")", "return", "new", "Code", "(", "buffer", ",", "start", ",", "end", ")", "this", ".", "offset", "=", "start", "||", ...
Code section structure @class @memberOf MBR @param {Buffer} buffer @param {Number} [start] @param {Number} [end]
[ "Code", "section", "structure" ]
a3ebdeb56fc3ce12a89e965c7127f6fe9547470a
https://github.com/jhermsmeier/node-mbr/blob/a3ebdeb56fc3ce12a89e965c7127f6fe9547470a/lib/code.js#L9-L22
train
mjohnsullivan/axiscam
lib/axis.js
function(options) { var that = this this.name = options.name // Record the url and protocol, ignore SSL certs this.url = url.parse(options.url) if (this.url.protocol.indexOf('https') === 0) { this.protocol = https this.url.rejectUnauthorized = false } else this.proto...
javascript
function(options) { var that = this this.name = options.name // Record the url and protocol, ignore SSL certs this.url = url.parse(options.url) if (this.url.protocol.indexOf('https') === 0) { this.protocol = https this.url.rejectUnauthorized = false } else this.proto...
[ "function", "(", "options", ")", "{", "var", "that", "=", "this", "this", ".", "name", "=", "options", ".", "name", "// Record the url and protocol, ignore SSL certs", "this", ".", "url", "=", "url", ".", "parse", "(", "options", ".", "url", ")", "if", "("...
Wrapper for Axis camera VAPIX API url: the base URL for the camera name: a name that's associated with the camera
[ "Wrapper", "for", "Axis", "camera", "VAPIX", "API" ]
1bbdedb3a41a8caa0d748392bfecf9d15ce42ef1
https://github.com/mjohnsullivan/axiscam/blob/1bbdedb3a41a8caa0d748392bfecf9d15ce42ef1/lib/axis.js#L22-L43
train
francejs/effroi
src/utils.js
function(element) { var c={}; try { var rect = element.getBoundingClientRect(); c.x = Math.floor((rect.left + rect.right) / 2); c.y = Math.floor((rect.top + rect.bottom) / 2); } catch(e) { c.x = 1; c.y = 1; } return c; }
javascript
function(element) { var c={}; try { var rect = element.getBoundingClientRect(); c.x = Math.floor((rect.left + rect.right) / 2); c.y = Math.floor((rect.top + rect.bottom) / 2); } catch(e) { c.x = 1; c.y = 1; } return c; }
[ "function", "(", "element", ")", "{", "var", "c", "=", "{", "}", ";", "try", "{", "var", "rect", "=", "element", ".", "getBoundingClientRect", "(", ")", ";", "c", ".", "x", "=", "Math", ".", "floor", "(", "(", "rect", ".", "left", "+", "rect", ...
Find the center of an element
[ "Find", "the", "center", "of", "an", "element" ]
4313d8597cb31df8e7fa002a4abbd73e7f722640
https://github.com/francejs/effroi/blob/4313d8597cb31df8e7fa002a4abbd73e7f722640/src/utils.js#L11-L22
train
francejs/effroi
src/utils.js
function(event, property, value) { try { Object.defineProperty(event, property, { get : function() { return value; } }); } catch(e) { event[property] = value; } }
javascript
function(event, property, value) { try { Object.defineProperty(event, property, { get : function() { return value; } }); } catch(e) { event[property] = value; } }
[ "function", "(", "event", ",", "property", ",", "value", ")", "{", "try", "{", "Object", ".", "defineProperty", "(", "event", ",", "property", ",", "{", "get", ":", "function", "(", ")", "{", "return", "value", ";", "}", "}", ")", ";", "}", "catch"...
Set event property with a Chromium specific hack
[ "Set", "event", "property", "with", "a", "Chromium", "specific", "hack" ]
4313d8597cb31df8e7fa002a4abbd73e7f722640
https://github.com/francejs/effroi/blob/4313d8597cb31df8e7fa002a4abbd73e7f722640/src/utils.js#L49-L59
train
francejs/effroi
src/utils.js
function(element, content) { var nodeName = element.nodeName.toLowerCase(), type = element.hasAttribute('type') ? element.getAttribute('type') : null; if (nodeName === 'textarea') { return true; } if (nodeName === 'input' && ['text', 'password', 'number', 'date'].indexOf(type) !== ...
javascript
function(element, content) { var nodeName = element.nodeName.toLowerCase(), type = element.hasAttribute('type') ? element.getAttribute('type') : null; if (nodeName === 'textarea') { return true; } if (nodeName === 'input' && ['text', 'password', 'number', 'date'].indexOf(type) !== ...
[ "function", "(", "element", ",", "content", ")", "{", "var", "nodeName", "=", "element", ".", "nodeName", ".", "toLowerCase", "(", ")", ",", "type", "=", "element", ".", "hasAttribute", "(", "'type'", ")", "?", "element", ".", "getAttribute", "(", "'type...
Tell if the element can accept the given content
[ "Tell", "if", "the", "element", "can", "accept", "the", "given", "content" ]
4313d8597cb31df8e7fa002a4abbd73e7f722640
https://github.com/francejs/effroi/blob/4313d8597cb31df8e7fa002a4abbd73e7f722640/src/utils.js#L62-L74
train
francejs/effroi
src/utils.js
function(element) { if('TEXTAREA'===element.nodeName ||('INPUT'===element.nodeName&&element.hasAttribute('type') &&('text'===element.getAttribute('type') ||'number'===element.getAttribute('type')) ) ) { return true; } return false; }
javascript
function(element) { if('TEXTAREA'===element.nodeName ||('INPUT'===element.nodeName&&element.hasAttribute('type') &&('text'===element.getAttribute('type') ||'number'===element.getAttribute('type')) ) ) { return true; } return false; }
[ "function", "(", "element", ")", "{", "if", "(", "'TEXTAREA'", "===", "element", ".", "nodeName", "||", "(", "'INPUT'", "===", "element", ".", "nodeName", "&&", "element", ".", "hasAttribute", "(", "'type'", ")", "&&", "(", "'text'", "===", "element", "....
Tell if the element content can be partially selected
[ "Tell", "if", "the", "element", "content", "can", "be", "partially", "selected" ]
4313d8597cb31df8e7fa002a4abbd73e7f722640
https://github.com/francejs/effroi/blob/4313d8597cb31df8e7fa002a4abbd73e7f722640/src/utils.js#L77-L87
train
francejs/effroi
src/utils.js
function(element) { if('TEXTAREA'===element.nodeName || 'SELECT'===element.nodeName || ('INPUT'===element.nodeName&&element.hasAttribute('type') &&('text'===element.getAttribute('type') || 'number'===element.getAttribute('type') || 'password'===element.getAttribute('type') ...
javascript
function(element) { if('TEXTAREA'===element.nodeName || 'SELECT'===element.nodeName || ('INPUT'===element.nodeName&&element.hasAttribute('type') &&('text'===element.getAttribute('type') || 'number'===element.getAttribute('type') || 'password'===element.getAttribute('type') ...
[ "function", "(", "element", ")", "{", "if", "(", "'TEXTAREA'", "===", "element", ".", "nodeName", "||", "'SELECT'", "===", "element", ".", "nodeName", "||", "(", "'INPUT'", "===", "element", ".", "nodeName", "&&", "element", ".", "hasAttribute", "(", "'typ...
Tell if the element is a form element that can contain a value
[ "Tell", "if", "the", "element", "is", "a", "form", "element", "that", "can", "contain", "a", "value" ]
4313d8597cb31df8e7fa002a4abbd73e7f722640
https://github.com/francejs/effroi/blob/4313d8597cb31df8e7fa002a4abbd73e7f722640/src/utils.js#L90-L103
train
jasonslyvia/redux-composable-fetch
lib/jsonpFetch.js
removeElement
function removeElement(elem) { var parent = elem.parentNode; if (parent && parent.nodeType !== 11) { parent.removeChild(elem); } }
javascript
function removeElement(elem) { var parent = elem.parentNode; if (parent && parent.nodeType !== 11) { parent.removeChild(elem); } }
[ "function", "removeElement", "(", "elem", ")", "{", "var", "parent", "=", "elem", ".", "parentNode", ";", "if", "(", "parent", "&&", "parent", ".", "nodeType", "!==", "11", ")", "{", "parent", ".", "removeChild", "(", "elem", ")", ";", "}", "}" ]
remove dom node
[ "remove", "dom", "node" ]
eb4676077747692092d7ee1d2d63be16e455e662
https://github.com/jasonslyvia/redux-composable-fetch/blob/eb4676077747692092d7ee1d2d63be16e455e662/lib/jsonpFetch.js#L18-L24
train
jasonslyvia/redux-composable-fetch
lib/jsonpFetch.js
parseUrl
function parseUrl(url, params) { var paramsStr = ''; if (typeof params === 'string') { paramsStr = params; } else if ((typeof params === 'undefined' ? 'undefined' : _typeof(params)) === 'object') { Object.keys(params).forEach(function (key) { if (url.indexOf(key + '=') < 0) { paramsStr += '...
javascript
function parseUrl(url, params) { var paramsStr = ''; if (typeof params === 'string') { paramsStr = params; } else if ((typeof params === 'undefined' ? 'undefined' : _typeof(params)) === 'object') { Object.keys(params).forEach(function (key) { if (url.indexOf(key + '=') < 0) { paramsStr += '...
[ "function", "parseUrl", "(", "url", ",", "params", ")", "{", "var", "paramsStr", "=", "''", ";", "if", "(", "typeof", "params", "===", "'string'", ")", "{", "paramsStr", "=", "params", ";", "}", "else", "if", "(", "(", "typeof", "params", "===", "'un...
parse the final url of request
[ "parse", "the", "final", "url", "of", "request" ]
eb4676077747692092d7ee1d2d63be16e455e662
https://github.com/jasonslyvia/redux-composable-fetch/blob/eb4676077747692092d7ee1d2d63be16e455e662/lib/jsonpFetch.js#L26-L46
train
Robert-W/react-prerender
samples/amd/js/actions/MapActions.js
createMap
function createMap(mapConfig) { app.debug('MapActions >>> createMap'); var basemap = (0, _jsUtilsParams.getUrlParams)(location.href)[_jsConstantsAppConstants.MAP.basemap]; if (basemap) { mapConfig.options.basemap = basemap; } var deferred = new Promise(function (resolve) { ...
javascript
function createMap(mapConfig) { app.debug('MapActions >>> createMap'); var basemap = (0, _jsUtilsParams.getUrlParams)(location.href)[_jsConstantsAppConstants.MAP.basemap]; if (basemap) { mapConfig.options.basemap = basemap; } var deferred = new Promise(function (resolve) { ...
[ "function", "createMap", "(", "mapConfig", ")", "{", "app", ".", "debug", "(", "'MapActions >>> createMap'", ")", ";", "var", "basemap", "=", "(", "0", ",", "_jsUtilsParams", ".", "getUrlParams", ")", "(", "location", ".", "href", ")", "[", "_jsConstantsAppC...
Simple method to create a new Map @param {object} mapConfig - config object containing id and options @return {Promise} deferred - Promise that resolves on map load event
[ "Simple", "method", "to", "create", "a", "new", "Map" ]
0499603b0fa56679abaea323d92ac7be530921f0
https://github.com/Robert-W/react-prerender/blob/0499603b0fa56679abaea323d92ac7be530921f0/samples/amd/js/actions/MapActions.js#L18-L32
train
Robert-W/react-prerender
samples/amd/js/actions/MapActions.js
setBasemap
function setBasemap(basemap) { app.debug('MapActions >>> setBasemap'); app.map.setBasemap(basemap); _jsDispatcher.Dispatcher.dispatch({ actionType: _jsConstantsAppConstants.MAP.basemap, data: basemap }); }
javascript
function setBasemap(basemap) { app.debug('MapActions >>> setBasemap'); app.map.setBasemap(basemap); _jsDispatcher.Dispatcher.dispatch({ actionType: _jsConstantsAppConstants.MAP.basemap, data: basemap }); }
[ "function", "setBasemap", "(", "basemap", ")", "{", "app", ".", "debug", "(", "'MapActions >>> setBasemap'", ")", ";", "app", ".", "map", ".", "setBasemap", "(", "basemap", ")", ";", "_jsDispatcher", ".", "Dispatcher", ".", "dispatch", "(", "{", "actionType"...
Method to update the basemap @param {string} basemap - the value of the basemap to be updated, should come from config.js basemaps
[ "Method", "to", "update", "the", "basemap" ]
0499603b0fa56679abaea323d92ac7be530921f0
https://github.com/Robert-W/react-prerender/blob/0499603b0fa56679abaea323d92ac7be530921f0/samples/amd/js/actions/MapActions.js#L38-L45
train
francejs/effroi
src/devices/keyboard.js
_charIsPrintable
function _charIsPrintable(charCode) { // C0 control characters if((charCode >=0 && charCode <= 0x1F) || 0x7F === charCode) { return false; } // C1 control characters if(charCode >= 0x80 && charCode <= 0x9F) { return false; } if(-1 !== _downKeys.indexOf(this.CTRL)) { return ...
javascript
function _charIsPrintable(charCode) { // C0 control characters if((charCode >=0 && charCode <= 0x1F) || 0x7F === charCode) { return false; } // C1 control characters if(charCode >= 0x80 && charCode <= 0x9F) { return false; } if(-1 !== _downKeys.indexOf(this.CTRL)) { return ...
[ "function", "_charIsPrintable", "(", "charCode", ")", "{", "// C0 control characters", "if", "(", "(", "charCode", ">=", "0", "&&", "charCode", "<=", "0x1F", ")", "||", "0x7F", "===", "charCode", ")", "{", "return", "false", ";", "}", "// C1 control characters...
Private functions Return the char corresponding to the key if any
[ "Private", "functions", "Return", "the", "char", "corresponding", "to", "the", "key", "if", "any" ]
4313d8597cb31df8e7fa002a4abbd73e7f722640
https://github.com/francejs/effroi/blob/4313d8597cb31df8e7fa002a4abbd73e7f722640/src/devices/keyboard.js#L176-L189
train
francejs/effroi
src/devices/keyboard.js
_inputChar
function _inputChar(char) { if(_charIsPrintable(char.charCodeAt(0)) &&utils.isSelectable(document.activeElement)) { // add the char // FIXME: put at caretPosition/replace selected content document.activeElement.value += char; // fire an input event utils.dispatch(document.activeE...
javascript
function _inputChar(char) { if(_charIsPrintable(char.charCodeAt(0)) &&utils.isSelectable(document.activeElement)) { // add the char // FIXME: put at caretPosition/replace selected content document.activeElement.value += char; // fire an input event utils.dispatch(document.activeE...
[ "function", "_inputChar", "(", "char", ")", "{", "if", "(", "_charIsPrintable", "(", "char", ".", "charCodeAt", "(", "0", ")", ")", "&&", "utils", ".", "isSelectable", "(", "document", ".", "activeElement", ")", ")", "{", "// add the char", "// FIXME: put at...
Try to add the char corresponding to the key to the activeElement
[ "Try", "to", "add", "the", "char", "corresponding", "to", "the", "key", "to", "the", "activeElement" ]
4313d8597cb31df8e7fa002a4abbd73e7f722640
https://github.com/francejs/effroi/blob/4313d8597cb31df8e7fa002a4abbd73e7f722640/src/devices/keyboard.js#L192-L201
train
francejs/effroi
src/devices/keyboard.js
_getModifiers
function _getModifiers() { var modifiers = ''; if(_downKeys.length) { for(var i=_downKeys.length-1; i>=0; i--) { if(-1 !== _that.MODIFIERS.indexOf(_downKeys[i])) { modifiers += (modifiers ? ' ' : '') + _downKeys[i]; } } } return modifiers; }
javascript
function _getModifiers() { var modifiers = ''; if(_downKeys.length) { for(var i=_downKeys.length-1; i>=0; i--) { if(-1 !== _that.MODIFIERS.indexOf(_downKeys[i])) { modifiers += (modifiers ? ' ' : '') + _downKeys[i]; } } } return modifiers; }
[ "function", "_getModifiers", "(", ")", "{", "var", "modifiers", "=", "''", ";", "if", "(", "_downKeys", ".", "length", ")", "{", "for", "(", "var", "i", "=", "_downKeys", ".", "length", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "...
Compute current modifiers
[ "Compute", "current", "modifiers" ]
4313d8597cb31df8e7fa002a4abbd73e7f722640
https://github.com/francejs/effroi/blob/4313d8597cb31df8e7fa002a4abbd73e7f722640/src/devices/keyboard.js#L204-L214
train
john-doherty/jsdoc-to-json-schema
lib/jsdoc-to-json-schema.js
getInputAsStream
function getInputAsStream(input) { return new Promise(function(resolve, reject) { if (input.write) { // already a stream resolve(input); } else { // read from file fs.readFileAsync(input, 'utf-8').then(function(data) { // c...
javascript
function getInputAsStream(input) { return new Promise(function(resolve, reject) { if (input.write) { // already a stream resolve(input); } else { // read from file fs.readFileAsync(input, 'utf-8').then(function(data) { // c...
[ "function", "getInputAsStream", "(", "input", ")", "{", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "if", "(", "input", ".", "write", ")", "{", "// already a stream", "resolve", "(", "input", ")", ";", "}", "else...
Returns a file as a stream @param {string} input - path to json/js file containing JSDoc comments @returns {Promise} promise to return a stream if the file exists
[ "Returns", "a", "file", "as", "a", "stream" ]
be44c57c6b820b2f1133bd0d900df308e462de23
https://github.com/john-doherty/jsdoc-to-json-schema/blob/be44c57c6b820b2f1133bd0d900df308e462de23/lib/jsdoc-to-json-schema.js#L56-L83
train
john-doherty/jsdoc-to-json-schema
lib/jsdoc-to-json-schema.js
buildJsonSchema
function buildJsonSchema(comments) { // skeleton schema object var schema = { properties: { } }; // go through each comment block (comments || []).forEach(function(block) { // we're only interested in customTags (none standard jsDoc comments i.e. @schema.) (block.c...
javascript
function buildJsonSchema(comments) { // skeleton schema object var schema = { properties: { } }; // go through each comment block (comments || []).forEach(function(block) { // we're only interested in customTags (none standard jsDoc comments i.e. @schema.) (block.c...
[ "function", "buildJsonSchema", "(", "comments", ")", "{", "// skeleton schema object", "var", "schema", "=", "{", "properties", ":", "{", "}", "}", ";", "// go through each comment block", "(", "comments", "||", "[", "]", ")", ".", "forEach", "(", "function", ...
Builds a JSON v3 schema based on schema tags found @param {array} comments - array of jsdoc comment blocks with scope information @returns {object} JSON Schema object
[ "Builds", "a", "JSON", "v3", "schema", "based", "on", "schema", "tags", "found" ]
be44c57c6b820b2f1133bd0d900df308e462de23
https://github.com/john-doherty/jsdoc-to-json-schema/blob/be44c57c6b820b2f1133bd0d900df308e462de23/lib/jsdoc-to-json-schema.js#L90-L190
train
blueapron/grunt-phantomjs-basil
phantomjs/main.js
function(arg) { var args = Array.isArray(arg) ? arg : Array.apply(null, arguments); lastMsgDate = new Date(); fs.write(tempFile, JSON.stringify(args) + '\n', 'a'); }
javascript
function(arg) { var args = Array.isArray(arg) ? arg : Array.apply(null, arguments); lastMsgDate = new Date(); fs.write(tempFile, JSON.stringify(args) + '\n', 'a'); }
[ "function", "(", "arg", ")", "{", "var", "args", "=", "Array", ".", "isArray", "(", "arg", ")", "?", "arg", ":", "Array", ".", "apply", "(", "null", ",", "arguments", ")", ";", "lastMsgDate", "=", "new", "Date", "(", ")", ";", "fs", ".", "write",...
Send messages to the parent by appending to temp file
[ "Send", "messages", "to", "the", "parent", "by", "appending", "to", "temp", "file" ]
ecb547ff4063bc04c992ecb1e996f2ad33a9f6ec
https://github.com/blueapron/grunt-phantomjs-basil/blob/ecb547ff4063bc04c992ecb1e996f2ad33a9f6ec/phantomjs/main.js#L49-L53
train
blueapron/grunt-phantomjs-basil
phantomjs/main.js
function(option) { var opt = { name: option.name || Date.now().toString(), path: option.path ? option.path + '/' : '', rect: option.rect || webpage.viewportSize }; // use clipRect to capture only the area of the specified position webpage.clipRect = opt.rect; webpage.render([options.screenshotPa...
javascript
function(option) { var opt = { name: option.name || Date.now().toString(), path: option.path ? option.path + '/' : '', rect: option.rect || webpage.viewportSize }; // use clipRect to capture only the area of the specified position webpage.clipRect = opt.rect; webpage.render([options.screenshotPa...
[ "function", "(", "option", ")", "{", "var", "opt", "=", "{", "name", ":", "option", ".", "name", "||", "Date", ".", "now", "(", ")", ".", "toString", "(", ")", ",", "path", ":", "option", ".", "path", "?", "option", ".", "path", "+", "'/'", ":"...
Take screenshot of current page
[ "Take", "screenshot", "of", "current", "page" ]
ecb547ff4063bc04c992ecb1e996f2ad33a9f6ec
https://github.com/blueapron/grunt-phantomjs-basil/blob/ecb547ff4063bc04c992ecb1e996f2ad33a9f6ec/phantomjs/main.js#L97-L109
train
CarbonLighthouse/svc-client
lib/fetchUtil.js
defaultExtractor
function defaultExtractor(response) { // 204 NO CONTENT if (response.status === 204) { return undefined; } const contentTypeHeader = response.headers.get('Content-Type'); if (!contentTypeHeader) { // This is the correct thing to do based on my interpretation of the HTTP specification: // https:/...
javascript
function defaultExtractor(response) { // 204 NO CONTENT if (response.status === 204) { return undefined; } const contentTypeHeader = response.headers.get('Content-Type'); if (!contentTypeHeader) { // This is the correct thing to do based on my interpretation of the HTTP specification: // https:/...
[ "function", "defaultExtractor", "(", "response", ")", "{", "// 204 NO CONTENT", "if", "(", "response", ".", "status", "===", "204", ")", "{", "return", "undefined", ";", "}", "const", "contentTypeHeader", "=", "response", ".", "headers", ".", "get", "(", "'C...
I am covering some basics, but honestly there's like a billion mime-types I don't know what the rules are for when to use which extraction method. It should be up to people to use the exported extractors themselves, or provide their own custom extractors in their method description.
[ "I", "am", "covering", "some", "basics", "but", "honestly", "there", "s", "like", "a", "billion", "mime", "-", "types", "I", "don", "t", "know", "what", "the", "rules", "are", "for", "when", "to", "use", "which", "extraction", "method", ".", "It", "sho...
8efa97046c25eee2bc0f959ae98fb44acbcb6c54
https://github.com/CarbonLighthouse/svc-client/blob/8efa97046c25eee2bc0f959ae98fb44acbcb6c54/lib/fetchUtil.js#L13-L41
train
CarbonLighthouse/svc-client
lib/fetchUtil.js
handleErrors
function handleErrors(errorFormatter, response) { if (!response.ok) { if (errorFormatter) { return errorFormatter(response); } return defaultErrorFormatter(response); } return response; }
javascript
function handleErrors(errorFormatter, response) { if (!response.ok) { if (errorFormatter) { return errorFormatter(response); } return defaultErrorFormatter(response); } return response; }
[ "function", "handleErrors", "(", "errorFormatter", ",", "response", ")", "{", "if", "(", "!", "response", ".", "ok", ")", "{", "if", "(", "errorFormatter", ")", "{", "return", "errorFormatter", "(", "response", ")", ";", "}", "return", "defaultErrorFormatter...
If there is a custom errorFormatter use it, otherwise use the default @param errorFormatter @param response @returns {*}
[ "If", "there", "is", "a", "custom", "errorFormatter", "use", "it", "otherwise", "use", "the", "default" ]
8efa97046c25eee2bc0f959ae98fb44acbcb6c54
https://github.com/CarbonLighthouse/svc-client/blob/8efa97046c25eee2bc0f959ae98fb44acbcb6c54/lib/fetchUtil.js#L61-L70
train
blueapron/grunt-qunit-kimchi
qunit/phantom_screenshot.js
getOffset
function getOffset(selector) { var rect, doc, docElem; var elem = document.querySelector(selector); if(!elem) { return false; } if(!elem.getClientRects().length) { return { top: 0, left: 0, width: 0, height: 0}; } rect = elem.getBoundingClientRect(); if(rect.width ||...
javascript
function getOffset(selector) { var rect, doc, docElem; var elem = document.querySelector(selector); if(!elem) { return false; } if(!elem.getClientRects().length) { return { top: 0, left: 0, width: 0, height: 0}; } rect = elem.getBoundingClientRect(); if(rect.width ||...
[ "function", "getOffset", "(", "selector", ")", "{", "var", "rect", ",", "doc", ",", "docElem", ";", "var", "elem", "=", "document", ".", "querySelector", "(", "selector", ")", ";", "if", "(", "!", "elem", ")", "{", "return", "false", ";", "}", "if", ...
Get offset information with native methods Because not everyone uses jQuery and QUnit does not depend on jQuery @param {String} selector (.test, #test) @return {Object} position of the selector dom
[ "Get", "offset", "information", "with", "native", "methods", "Because", "not", "everyone", "uses", "jQuery", "and", "QUnit", "does", "not", "depend", "on", "jQuery" ]
594450211b0de3175501e39836cf63e7a12f6504
https://github.com/blueapron/grunt-qunit-kimchi/blob/594450211b0de3175501e39836cf63e7a12f6504/qunit/phantom_screenshot.js#L53-L75
train