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
MakerCollider/node-red-contrib-smartnode-hook
html/scripts/highchart/modules/exporting.src.js
function (e) { var chart = e.target, i, elem; // Destroy the extra buttons added for (i = 0; i < chart.exportSVGElements.length; i++) { elem = chart.exportSVGElements[i]; // Destroy and null the svg/vml elements if (elem) { // #1822 elem.onclick = elem.ontouchstart = null; chart.exportSVG...
javascript
function (e) { var chart = e.target, i, elem; // Destroy the extra buttons added for (i = 0; i < chart.exportSVGElements.length; i++) { elem = chart.exportSVGElements[i]; // Destroy and null the svg/vml elements if (elem) { // #1822 elem.onclick = elem.ontouchstart = null; chart.exportSVG...
[ "function", "(", "e", ")", "{", "var", "chart", "=", "e", ".", "target", ",", "i", ",", "elem", ";", "// Destroy the extra buttons added", "for", "(", "i", "=", "0", ";", "i", "<", "chart", ".", "exportSVGElements", ".", "length", ";", "i", "++", ")"...
Destroy the buttons.
[ "Destroy", "the", "buttons", "." ]
245c267e832968bad880ca009929043e82c7bc25
https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/modules/exporting.src.js#L682-L711
train
vincentpeyrouse/passport-supinfo
lib/passport-supinfo/errors/internalopeniderror.js
InternalOpenIDError
function InternalOpenIDError(message, err) { Error.call(this); Error.captureStackTrace(this, arguments.callee); this.name = 'InternalOpenIDError'; this.message = message; this.openidError = err; }
javascript
function InternalOpenIDError(message, err) { Error.call(this); Error.captureStackTrace(this, arguments.callee); this.name = 'InternalOpenIDError'; this.message = message; this.openidError = err; }
[ "function", "InternalOpenIDError", "(", "message", ",", "err", ")", "{", "Error", ".", "call", "(", "this", ")", ";", "Error", ".", "captureStackTrace", "(", "this", ",", "arguments", ".", "callee", ")", ";", "this", ".", "name", "=", "'InternalOpenIDError...
`InternalOpenIDError` error. InternalOpenIDError wraps errors generated by node-openid. By wrapping these objects, error messages can be formatted in a manner that aids in debugging OpenID issues. @api public
[ "InternalOpenIDError", "error", "." ]
1d02da38251710a1a2528eb1c27d23fc43565928
https://github.com/vincentpeyrouse/passport-supinfo/blob/1d02da38251710a1a2528eb1c27d23fc43565928/lib/passport-supinfo/errors/internalopeniderror.js#L10-L16
train
chrisJohn404/ljswitchboard-device_scanner
lib/temp_files/oa_managed_device.js
printCollectedDeviceData
function printCollectedDeviceData(results) { var dataToKeep = { 'AIN0': 'val', 'FIRMWARE_VERSION': 'val', 'WIFI_IP': 'str', 'ETHERNET_IP': 'str', 'WIFI_RSSI': 'str', 'WIFI_VERSION': 'val', 'SERIAL_NUMBER': 'val', 'HA...
javascript
function printCollectedDeviceData(results) { var dataToKeep = { 'AIN0': 'val', 'FIRMWARE_VERSION': 'val', 'WIFI_IP': 'str', 'ETHERNET_IP': 'str', 'WIFI_RSSI': 'str', 'WIFI_VERSION': 'val', 'SERIAL_NUMBER': 'val', 'HA...
[ "function", "printCollectedDeviceData", "(", "results", ")", "{", "var", "dataToKeep", "=", "{", "'AIN0'", ":", "'val'", ",", "'FIRMWARE_VERSION'", ":", "'val'", ",", "'WIFI_IP'", ":", "'str'", ",", "'ETHERNET_IP'", ":", "'str'", ",", "'WIFI_RSSI'", ":", "'str...
This is a "debugging" function that prints out the important attributes of the data being queried from a device.
[ "This", "is", "a", "debugging", "function", "that", "prints", "out", "the", "important", "attributes", "of", "the", "data", "being", "queried", "from", "a", "device", "." ]
9a8f0936387bfedc09ab1b2d655cecf79ad15a6b
https://github.com/chrisJohn404/ljswitchboard-device_scanner/blob/9a8f0936387bfedc09ab1b2d655cecf79ad15a6b/lib/temp_files/oa_managed_device.js#L50-L82
train
chrisJohn404/ljswitchboard-device_scanner
lib/temp_files/oa_managed_device.js
curatedDeviceDisconnected
function curatedDeviceDisconnected(eventData) { self.log(' *** Handle', self.handle, 'triggered event: DEVICE_DISCONNECTED', eventData.name, eventData.operation); }
javascript
function curatedDeviceDisconnected(eventData) { self.log(' *** Handle', self.handle, 'triggered event: DEVICE_DISCONNECTED', eventData.name, eventData.operation); }
[ "function", "curatedDeviceDisconnected", "(", "eventData", ")", "{", "self", ".", "log", "(", "' *** Handle'", ",", "self", ".", "handle", ",", "'triggered event: DEVICE_DISCONNECTED'", ",", "eventData", ".", "name", ",", "eventData", ".", "operation", ")", ";", ...
Define various functions to be used as curated device event listeners.
[ "Define", "various", "functions", "to", "be", "used", "as", "curated", "device", "event", "listeners", "." ]
9a8f0936387bfedc09ab1b2d655cecf79ad15a6b
https://github.com/chrisJohn404/ljswitchboard-device_scanner/blob/9a8f0936387bfedc09ab1b2d655cecf79ad15a6b/lib/temp_files/oa_managed_device.js#L98-L100
train
chrisJohn404/ljswitchboard-device_scanner
lib/temp_files/oa_managed_device.js
linkToCuratedDeviceEvents
function linkToCuratedDeviceEvents() { self.curatedDevice.on( 'DEVICE_DISCONNECTED', curatedDeviceDisconnected ); self.curatedDevice.on( 'DEVICE_RECONNECTED', curatedDeviceReconnected ); self.curatedDevice.on( 'DEVICE_ER...
javascript
function linkToCuratedDeviceEvents() { self.curatedDevice.on( 'DEVICE_DISCONNECTED', curatedDeviceDisconnected ); self.curatedDevice.on( 'DEVICE_RECONNECTED', curatedDeviceReconnected ); self.curatedDevice.on( 'DEVICE_ER...
[ "function", "linkToCuratedDeviceEvents", "(", ")", "{", "self", ".", "curatedDevice", ".", "on", "(", "'DEVICE_DISCONNECTED'", ",", "curatedDeviceDisconnected", ")", ";", "self", ".", "curatedDevice", ".", "on", "(", "'DEVICE_RECONNECTED'", ",", "curatedDeviceReconnec...
Define a function that links the device manager to several of the curated device's events.
[ "Define", "a", "function", "that", "links", "the", "device", "manager", "to", "several", "of", "the", "curated", "device", "s", "events", "." ]
9a8f0936387bfedc09ab1b2d655cecf79ad15a6b
https://github.com/chrisJohn404/ljswitchboard-device_scanner/blob/9a8f0936387bfedc09ab1b2d655cecf79ad15a6b/lib/temp_files/oa_managed_device.js#L118-L139
train
chrisJohn404/ljswitchboard-device_scanner
lib/temp_files/oa_managed_device.js
unlinkFromCuratedDeviceEvents
function unlinkFromCuratedDeviceEvents() { self.curatedDevice.removeListener( 'DEVICE_DISCONNECTED', curatedDeviceDisconnected ); self.curatedDevice.removeListener( 'DEVICE_RECONNECTED', curatedDeviceReconnected ); self.curatedDevic...
javascript
function unlinkFromCuratedDeviceEvents() { self.curatedDevice.removeListener( 'DEVICE_DISCONNECTED', curatedDeviceDisconnected ); self.curatedDevice.removeListener( 'DEVICE_RECONNECTED', curatedDeviceReconnected ); self.curatedDevic...
[ "function", "unlinkFromCuratedDeviceEvents", "(", ")", "{", "self", ".", "curatedDevice", ".", "removeListener", "(", "'DEVICE_DISCONNECTED'", ",", "curatedDeviceDisconnected", ")", ";", "self", ".", "curatedDevice", ".", "removeListener", "(", "'DEVICE_RECONNECTED'", "...
Define a function that unlinks the device manager from several of the curated device's events.
[ "Define", "a", "function", "that", "unlinks", "the", "device", "manager", "from", "several", "of", "the", "curated", "device", "s", "events", "." ]
9a8f0936387bfedc09ab1b2d655cecf79ad15a6b
https://github.com/chrisJohn404/ljswitchboard-device_scanner/blob/9a8f0936387bfedc09ab1b2d655cecf79ad15a6b/lib/temp_files/oa_managed_device.js#L143-L164
train
chrisJohn404/ljswitchboard-device_scanner
lib/temp_files/oa_managed_device.js
saveCollectedDeviceData
function saveCollectedDeviceData(results) { self.log('Finished Collecting Data from Device:', self.handle); // Loop through each of the results. results.forEach(function(result) { // De-reference the actual data var data = result.data; // Determine what regi...
javascript
function saveCollectedDeviceData(results) { self.log('Finished Collecting Data from Device:', self.handle); // Loop through each of the results. results.forEach(function(result) { // De-reference the actual data var data = result.data; // Determine what regi...
[ "function", "saveCollectedDeviceData", "(", "results", ")", "{", "self", ".", "log", "(", "'Finished Collecting Data from Device:'", ",", "self", ".", "handle", ")", ";", "// Loop through each of the results.", "results", ".", "forEach", "(", "function", "(", "result"...
Save Data to the cached device results object...
[ "Save", "Data", "to", "the", "cached", "device", "results", "object", "..." ]
9a8f0936387bfedc09ab1b2d655cecf79ad15a6b
https://github.com/chrisJohn404/ljswitchboard-device_scanner/blob/9a8f0936387bfedc09ab1b2d655cecf79ad15a6b/lib/temp_files/oa_managed_device.js#L167-L181
train
chrisJohn404/ljswitchboard-device_scanner
lib/temp_files/oa_managed_device.js
innerCollectDeviceData
function innerCollectDeviceData(infoToCache) { var defered = q.defer(); self.dataCollectionDefered = defered; self.log('Collecting Data from a handle', self.handle); // Indicate that this device was opened by the device scanner. self.openedByScanner = true; var...
javascript
function innerCollectDeviceData(infoToCache) { var defered = q.defer(); self.dataCollectionDefered = defered; self.log('Collecting Data from a handle', self.handle); // Indicate that this device was opened by the device scanner. self.openedByScanner = true; var...
[ "function", "innerCollectDeviceData", "(", "infoToCache", ")", "{", "var", "defered", "=", "q", ".", "defer", "(", ")", ";", "self", ".", "dataCollectionDefered", "=", "defered", ";", "self", ".", "log", "(", "'Collecting Data from a handle'", ",", "self", "."...
Link supplied device handle to the curated device object and collect the required information from the device.
[ "Link", "supplied", "device", "handle", "to", "the", "curated", "device", "object", "and", "collect", "the", "required", "information", "from", "the", "device", "." ]
9a8f0936387bfedc09ab1b2d655cecf79ad15a6b
https://github.com/chrisJohn404/ljswitchboard-device_scanner/blob/9a8f0936387bfedc09ab1b2d655cecf79ad15a6b/lib/temp_files/oa_managed_device.js#L193-L251
train
Whitebolt/lodash-provider
index.js
lodashRequire
function lodashRequire(functionName) { var moduleId = getLodashId(functionName); try { var method = localRequire(moduleId); method.toString = lodashFunctionToString(functionName); return method; } catch (err) { throw new ReferenceError('Could not find '+functionName+', did you forget to install '+moduleId);...
javascript
function lodashRequire(functionName) { var moduleId = getLodashId(functionName); try { var method = localRequire(moduleId); method.toString = lodashFunctionToString(functionName); return method; } catch (err) { throw new ReferenceError('Could not find '+functionName+', did you forget to install '+moduleId);...
[ "function", "lodashRequire", "(", "functionName", ")", "{", "var", "moduleId", "=", "getLodashId", "(", "functionName", ")", ";", "try", "{", "var", "method", "=", "localRequire", "(", "moduleId", ")", ";", "method", ".", "toString", "=", "lodashFunctionToStri...
Get the given function from lodash. Given a function name try to load the corresponding module. @throws {ReferenceError} If function not found then throw error. @param {string} functionName The function name to find (this will be lower-cased). @returns {Function} The lodash function.
[ "Get", "the", "given", "function", "from", "lodash", ".", "Given", "a", "function", "name", "try", "to", "load", "the", "corresponding", "module", "." ]
d8e34737346e370f1d4e4cf5595ed4040d1521e8
https://github.com/Whitebolt/lodash-provider/blob/d8e34737346e370f1d4e4cf5595ed4040d1521e8/index.js#L46-L56
train
Whitebolt/lodash-provider
index.js
getPathStack
function getPathStack() { return (module.parent || module).paths.map(function(path) { return lop(path) }).filter(function(path) { return (path !== ''); }); }
javascript
function getPathStack() { return (module.parent || module).paths.map(function(path) { return lop(path) }).filter(function(path) { return (path !== ''); }); }
[ "function", "getPathStack", "(", ")", "{", "return", "(", "module", ".", "parent", "||", "module", ")", ".", "paths", ".", "map", "(", "function", "(", "path", ")", "{", "return", "lop", "(", "path", ")", "}", ")", ".", "filter", "(", "function", "...
Find all possible local directories for node_modules loading. @returns {Array.<string>} Load paths.
[ "Find", "all", "possible", "local", "directories", "for", "node_modules", "loading", "." ]
d8e34737346e370f1d4e4cf5595ed4040d1521e8
https://github.com/Whitebolt/lodash-provider/blob/d8e34737346e370f1d4e4cf5595ed4040d1521e8/index.js#L155-L161
train
Whitebolt/lodash-provider
index.js
loadPackageModules
function loadPackageModules(packages, packageData, modType) { Object.keys(packageData[modType] || {}).forEach(function(packageName) { if (lodashTest.test(packageName)) packages.push(tryModule(packageName)); }); }
javascript
function loadPackageModules(packages, packageData, modType) { Object.keys(packageData[modType] || {}).forEach(function(packageName) { if (lodashTest.test(packageName)) packages.push(tryModule(packageName)); }); }
[ "function", "loadPackageModules", "(", "packages", ",", "packageData", ",", "modType", ")", "{", "Object", ".", "keys", "(", "packageData", "[", "modType", "]", "||", "{", "}", ")", ".", "forEach", "(", "function", "(", "packageName", ")", "{", "if", "("...
Load all the lodash methods from given packages array. @param {Array.<Object>} packages Packages array to load into. @param {Array.<Object>} packageData Package data array. @param {string} modType Section of package data to load from (eg. 'dependencies').
[ "Load", "all", "the", "lodash", "methods", "from", "given", "packages", "array", "." ]
d8e34737346e370f1d4e4cf5595ed4040d1521e8
https://github.com/Whitebolt/lodash-provider/blob/d8e34737346e370f1d4e4cf5595ed4040d1521e8/index.js#L203-L207
train
derdesign/protos
engines/jade.js
Jade
function Jade() { var opts = (app.config.engines && app.config.engines.jade) || {}; this.options = protos.extend({ pretty: true }, opts); this.module = jade; this.multiPart = false; this.extensions = ['jade', 'jade.html']; }
javascript
function Jade() { var opts = (app.config.engines && app.config.engines.jade) || {}; this.options = protos.extend({ pretty: true }, opts); this.module = jade; this.multiPart = false; this.extensions = ['jade', 'jade.html']; }
[ "function", "Jade", "(", ")", "{", "var", "opts", "=", "(", "app", ".", "config", ".", "engines", "&&", "app", ".", "config", ".", "engines", ".", "jade", ")", "||", "{", "}", ";", "this", ".", "options", "=", "protos", ".", "extend", "(", "{", ...
Jade engine class https://github.com/visionmedia/jade
[ "Jade", "engine", "class" ]
0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9
https://github.com/derdesign/protos/blob/0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9/engines/jade.js#L15-L27
train
IonicaBizau/node-w-json
lib/index.js
wJson
function wJson(path, data, options, callback) { if (typeof options === "function") { callback = options; options = {}; } else if (typeof options === "number") { options = { space: options }; } else if (typeof options === "boolean") { options = { ...
javascript
function wJson(path, data, options, callback) { if (typeof options === "function") { callback = options; options = {}; } else if (typeof options === "number") { options = { space: options }; } else if (typeof options === "boolean") { options = { ...
[ "function", "wJson", "(", "path", ",", "data", ",", "options", ",", "callback", ")", "{", "if", "(", "typeof", "options", "===", "\"function\"", ")", "{", "callback", "=", "options", ";", "options", "=", "{", "}", ";", "}", "else", "if", "(", "typeof...
wJson Writes a JSON file. @name wJson @function @param {String} path The JSON file path. @param {Object} data The JSON data to write in the provided file. @param {Object|Number|Boolean} options An object containing the fields below. If boolean, it will be handled as `new_line`, if number it will be handled as `space`....
[ "wJson", "Writes", "a", "JSON", "file", "." ]
7f709f84325d86d4bee548abac16dfe84b3d94af
https://github.com/IonicaBizau/node-w-json/blob/7f709f84325d86d4bee548abac16dfe84b3d94af/lib/index.js#L20-L45
train
sendanor/nor-nopg
src/schema/v0022.js
function(db) { function merge(a_, b_, plv8, ERROR) { function copy_properties(o, a) { Object.keys(a).forEach(function(k) { o[k] = a[k]; }); return o; } function copy(a, b) { return copy_properties(copy_properties({}, a), b); } try { return copy(a_, b_); } catch (e) { ...
javascript
function(db) { function merge(a_, b_, plv8, ERROR) { function copy_properties(o, a) { Object.keys(a).forEach(function(k) { o[k] = a[k]; }); return o; } function copy(a, b) { return copy_properties(copy_properties({}, a), b); } try { return copy(a_, b_); } catch (e) { ...
[ "function", "(", "db", ")", "{", "function", "merge", "(", "a_", ",", "b_", ",", "plv8", ",", "ERROR", ")", "{", "function", "copy_properties", "(", "o", ",", "a", ")", "{", "Object", ".", "keys", "(", "a", ")", ".", "forEach", "(", "function", "...
Implement merge function to merge two objects for use in UPDATE
[ "Implement", "merge", "function", "to", "merge", "two", "objects", "for", "use", "in", "UPDATE" ]
0d99b86c1a1996b5828b56de8de23700df8bbc0c
https://github.com/sendanor/nor-nopg/blob/0d99b86c1a1996b5828b56de8de23700df8bbc0c/src/schema/v0022.js#L7-L31
train
byron-dupreez/aws-stream-consumer-core
taskdef-settings.js
describeMessage
function describeMessage(message, batch, context) { const b = batch || context.batch; const state = b && b.states.get(message); return message ? `Message (${state && state.msgDesc})` : ''; }
javascript
function describeMessage(message, batch, context) { const b = batch || context.batch; const state = b && b.states.get(message); return message ? `Message (${state && state.msgDesc})` : ''; }
[ "function", "describeMessage", "(", "message", ",", "batch", ",", "context", ")", "{", "const", "b", "=", "batch", "||", "context", ".", "batch", ";", "const", "state", "=", "b", "&&", "b", ".", "states", ".", "get", "(", "message", ")", ";", "return...
A `describeItem` implementation that accepts and describes the arguments passed to a "process one message at a time" function. @param {Message} message - the message being processed @param {Batch} batch - the current batch @param {StreamConsumerContext} context - the context to use @returns {string} a short description...
[ "A", "describeItem", "implementation", "that", "accepts", "and", "describes", "the", "arguments", "passed", "to", "a", "process", "one", "message", "at", "a", "time", "function", "." ]
9b256084297f80d373bcf483aaf68a9da176b3d7
https://github.com/byron-dupreez/aws-stream-consumer-core/blob/9b256084297f80d373bcf483aaf68a9da176b3d7/taskdef-settings.js#L58-L62
train
byron-dupreez/aws-stream-consumer-core
taskdef-settings.js
describeUnusableRecord
function describeUnusableRecord(unusableRecord, batch, context) { const b = batch || context.batch; const state = b && b.states.get(unusableRecord); return `Unusable record (${state && state.recDesc})`; }
javascript
function describeUnusableRecord(unusableRecord, batch, context) { const b = batch || context.batch; const state = b && b.states.get(unusableRecord); return `Unusable record (${state && state.recDesc})`; }
[ "function", "describeUnusableRecord", "(", "unusableRecord", ",", "batch", ",", "context", ")", "{", "const", "b", "=", "batch", "||", "context", ".", "batch", ";", "const", "state", "=", "b", "&&", "b", ".", "states", ".", "get", "(", "unusableRecord", ...
A `describeItem` implementation that accepts and describes the arguments passed to a `discardUnusableRecord` function. @param {UnusableRecord} unusableRecord - the unusable record to be discarded @param {Batch} batch - the batch being processed @param {StreamConsumerContext} context - the context to use @returns {strin...
[ "A", "describeItem", "implementation", "that", "accepts", "and", "describes", "the", "arguments", "passed", "to", "a", "discardUnusableRecord", "function", "." ]
9b256084297f80d373bcf483aaf68a9da176b3d7
https://github.com/byron-dupreez/aws-stream-consumer-core/blob/9b256084297f80d373bcf483aaf68a9da176b3d7/taskdef-settings.js#L94-L98
train
byron-dupreez/aws-stream-consumer-core
taskdef-settings.js
describeRejectedMessage
function describeRejectedMessage(rejectedMessage, batch, context) { const b = batch || context.batch; const state = b && b.states.get(rejectedMessage); return `Rejected message (${state && (state.msgDesc || state.recDesc)})`; }
javascript
function describeRejectedMessage(rejectedMessage, batch, context) { const b = batch || context.batch; const state = b && b.states.get(rejectedMessage); return `Rejected message (${state && (state.msgDesc || state.recDesc)})`; }
[ "function", "describeRejectedMessage", "(", "rejectedMessage", ",", "batch", ",", "context", ")", "{", "const", "b", "=", "batch", "||", "context", ".", "batch", ";", "const", "state", "=", "b", "&&", "b", ".", "states", ".", "get", "(", "rejectedMessage",...
A `describeItem` implementation that accepts and describes the arguments passed to a `discardRejectedMessage` function. @param {Message} rejectedMessage - the rejected message to be discarded @param {Batch} batch - the batch being processed @param {StreamConsumerContext} context - the context to use @returns {string} a...
[ "A", "describeItem", "implementation", "that", "accepts", "and", "describes", "the", "arguments", "passed", "to", "a", "discardRejectedMessage", "function", "." ]
9b256084297f80d373bcf483aaf68a9da176b3d7
https://github.com/byron-dupreez/aws-stream-consumer-core/blob/9b256084297f80d373bcf483aaf68a9da176b3d7/taskdef-settings.js#L107-L111
train
tjunghans/stylus-deps-to-css
lib/stylus-deps-to-css.js
readStylusFile
function readStylusFile(file, callback) { fs.readFile(file, function (err, data) { if (err) { throw err; } stylus.render(data.toString(), function (err, css) { if (err) { throw err; } callback(css); }); }); }
javascript
function readStylusFile(file, callback) { fs.readFile(file, function (err, data) { if (err) { throw err; } stylus.render(data.toString(), function (err, css) { if (err) { throw err; } callback(css); }); }); }
[ "function", "readStylusFile", "(", "file", ",", "callback", ")", "{", "fs", ".", "readFile", "(", "file", ",", "function", "(", "err", ",", "data", ")", "{", "if", "(", "err", ")", "{", "throw", "err", ";", "}", "stylus", ".", "render", "(", "data"...
Yields callback with css
[ "Yields", "callback", "with", "css" ]
0957237c993f19339ea89011d4af73c644e75364
https://github.com/tjunghans/stylus-deps-to-css/blob/0957237c993f19339ea89011d4af73c644e75364/lib/stylus-deps-to-css.js#L38-L50
train
kevinoid/promised-read
lib/eof-error.js
EOFError
function EOFError(message) { // Like http://www.ecma-international.org/ecma-262/6.0/#sec-error-message if (!(this instanceof EOFError)) { return new EOFError(message); } Error.captureStackTrace(this, EOFError); if (message !== undefined) { Object.defineProperty(this, 'message', { value: String(message...
javascript
function EOFError(message) { // Like http://www.ecma-international.org/ecma-262/6.0/#sec-error-message if (!(this instanceof EOFError)) { return new EOFError(message); } Error.captureStackTrace(this, EOFError); if (message !== undefined) { Object.defineProperty(this, 'message', { value: String(message...
[ "function", "EOFError", "(", "message", ")", "{", "// Like http://www.ecma-international.org/ecma-262/6.0/#sec-error-message", "if", "(", "!", "(", "this", "instanceof", "EOFError", ")", ")", "{", "return", "new", "EOFError", "(", "message", ")", ";", "}", "Error", ...
Constructs an EOFError. @class Represents an error caused by reaching the end-of-file (or, more generally, end-of-input). @constructor @param {string=} message Human-readable description of the error.
[ "Constructs", "an", "EOFError", "." ]
c6adf477f4a64d5142363d84f7f83f5f07b8f682
https://github.com/kevinoid/promised-read/blob/c6adf477f4a64d5142363d84f7f83f5f07b8f682/lib/eof-error.js#L17-L28
train
dickhardt/node-a2p3
lib/jwt.js
jws
function jws ( details ) { if (!details.header) throw new Error('No header for JWS token') if (!details.header.alg) throw new Error('No JWS signing algorithm specified') if (!signAlg[details.header.alg]) throw new Error('Unsupported JWS signing algorithm:"'+details.header.alg+'"') if (!details.paylo...
javascript
function jws ( details ) { if (!details.header) throw new Error('No header for JWS token') if (!details.header.alg) throw new Error('No JWS signing algorithm specified') if (!signAlg[details.header.alg]) throw new Error('Unsupported JWS signing algorithm:"'+details.header.alg+'"') if (!details.paylo...
[ "function", "jws", "(", "details", ")", "{", "if", "(", "!", "details", ".", "header", ")", "throw", "new", "Error", "(", "'No header for JWS token'", ")", "if", "(", "!", "details", ".", "header", ".", "alg", ")", "throw", "new", "Error", "(", "'No JW...
make a JWS
[ "make", "a", "JWS" ]
ca9dd8802d7ed2e90f6754bfced0ac9014c230a3
https://github.com/dickhardt/node-a2p3/blob/ca9dd8802d7ed2e90f6754bfced0ac9014c230a3/lib/jwt.js#L278-L294
train
dickhardt/node-a2p3
lib/jwt.js
keygen
function keygen (alg) { var algs = { 'HS256': 256/8 , 'HS512': 512/8 , 'A128CBC+HS256': 256/8 , 'A256CBC+HS512': 512/8 }; if (!algs[alg]) return null; return (b64url.encode(crypto.randomBytes(algs[alg]))) }
javascript
function keygen (alg) { var algs = { 'HS256': 256/8 , 'HS512': 512/8 , 'A128CBC+HS256': 256/8 , 'A256CBC+HS512': 512/8 }; if (!algs[alg]) return null; return (b64url.encode(crypto.randomBytes(algs[alg]))) }
[ "function", "keygen", "(", "alg", ")", "{", "var", "algs", "=", "{", "'HS256'", ":", "256", "/", "8", ",", "'HS512'", ":", "512", "/", "8", ",", "'A128CBC+HS256'", ":", "256", "/", "8", ",", "'A256CBC+HS512'", ":", "512", "/", "8", "}", ";", "if"...
generates a key for the passed algorithm
[ "generates", "a", "key", "for", "the", "passed", "algorithm" ]
ca9dd8802d7ed2e90f6754bfced0ac9014c230a3
https://github.com/dickhardt/node-a2p3/blob/ca9dd8802d7ed2e90f6754bfced0ac9014c230a3/lib/jwt.js#L369-L378
train
acos-server/acos-jsparsons
static/js-parsons/parsons.js
builtinRead
function builtinRead(x) { if (Sk.builtinFiles === undefined || Sk.builtinFiles["files"][x] === undefined) throw "File not found: '" + x + "'"; return Sk.builtinFiles["files"][x]; }
javascript
function builtinRead(x) { if (Sk.builtinFiles === undefined || Sk.builtinFiles["files"][x] === undefined) throw "File not found: '" + x + "'"; return Sk.builtinFiles["files"][x]; }
[ "function", "builtinRead", "(", "x", ")", "{", "if", "(", "Sk", ".", "builtinFiles", "===", "undefined", "||", "Sk", ".", "builtinFiles", "[", "\"files\"", "]", "[", "x", "]", "===", "undefined", ")", "throw", "\"File not found: '\"", "+", "x", "+", "\"'...
function for reading python imports with skulpt
[ "function", "for", "reading", "python", "imports", "with", "skulpt" ]
8c504c261137b0bedf1939a60dd76cfe21d01d7f
https://github.com/acos-server/acos-jsparsons/blob/8c504c261137b0bedf1939a60dd76cfe21d01d7f/static/js-parsons/parsons.js#L110-L114
train
acos-server/acos-jsparsons
static/js-parsons/parsons.js
function(options) { // Contains line objects of the user-draggable code. // The order is not meaningful (unchanged from the initial state) but // indent property for each line object is updated as the user moves // codelines around. (see parseCode for line object description) this.modified_lines = []; ...
javascript
function(options) { // Contains line objects of the user-draggable code. // The order is not meaningful (unchanged from the initial state) but // indent property for each line object is updated as the user moves // codelines around. (see parseCode for line object description) this.modified_lines = []; ...
[ "function", "(", "options", ")", "{", "// Contains line objects of the user-draggable code.", "// The order is not meaningful (unchanged from the initial state) but", "// indent property for each line object is updated as the user moves", "// codelines around. (see parseCode for line object descript...
Creates a parsons widget. Init must be called after creating an object.
[ "Creates", "a", "parsons", "widget", ".", "Init", "must", "be", "called", "after", "creating", "an", "object", "." ]
8c504c261137b0bedf1939a60dd76cfe21d01d7f
https://github.com/acos-server/acos-jsparsons/blob/8c504c261137b0bedf1939a60dd76cfe21d01d7f/static/js-parsons/parsons.js#L860-L923
train
Maultasche/BaconNodeAutoPauseLineStream
src/index.js
createAutoPauseLineStream
function createAutoPauseLineStream(readStream) { //Use readline to read the lines of text const lineReader = readline.createInterface({ input: readStream }); //Create a line queue for the lines that are emitted from the line reader. //Once the line reader has read a chunk from the read stream, it will //contin...
javascript
function createAutoPauseLineStream(readStream) { //Use readline to read the lines of text const lineReader = readline.createInterface({ input: readStream }); //Create a line queue for the lines that are emitted from the line reader. //Once the line reader has read a chunk from the read stream, it will //contin...
[ "function", "createAutoPauseLineStream", "(", "readStream", ")", "{", "//Use readline to read the lines of text", "const", "lineReader", "=", "readline", ".", "createInterface", "(", "{", "input", ":", "readStream", "}", ")", ";", "//Create a line queue for the lines that a...
Creates a Bacon stream that emits lines of text read from a readable stream. The stream pauses itself every time a line is emitted and can be unpaused by calling the unpause function the is emitted along with the line of text @param readStream - A readable stream @returns a Bacon stream that emits objects containing a...
[ "Creates", "a", "Bacon", "stream", "that", "emits", "lines", "of", "text", "read", "from", "a", "readable", "stream", ".", "The", "stream", "pauses", "itself", "every", "time", "a", "line", "is", "emitted", "and", "can", "be", "unpaused", "by", "calling", ...
587684a7e807bb1c0fff4bfda8cf70e96adeafaf
https://github.com/Maultasche/BaconNodeAutoPauseLineStream/blob/587684a7e807bb1c0fff4bfda8cf70e96adeafaf/src/index.js#L15-L99
train
Maultasche/BaconNodeAutoPauseLineStream
src/index.js
emitLine
function emitLine() { if(lineQueue.size() > 0) { pause(); sink({line: lineQueue.deq(), resume}); } else if(streamEnd) { sink(new Bacon.End()); } else { //If we've run out of lines to emit readStream.resume(); } }
javascript
function emitLine() { if(lineQueue.size() > 0) { pause(); sink({line: lineQueue.deq(), resume}); } else if(streamEnd) { sink(new Bacon.End()); } else { //If we've run out of lines to emit readStream.resume(); } }
[ "function", "emitLine", "(", ")", "{", "if", "(", "lineQueue", ".", "size", "(", ")", ">", "0", ")", "{", "pause", "(", ")", ";", "sink", "(", "{", "line", ":", "lineQueue", ".", "deq", "(", ")", ",", "resume", "}", ")", ";", "}", "else", "if...
Emits a line if possible
[ "Emits", "a", "line", "if", "possible" ]
587684a7e807bb1c0fff4bfda8cf70e96adeafaf
https://github.com/Maultasche/BaconNodeAutoPauseLineStream/blob/587684a7e807bb1c0fff4bfda8cf70e96adeafaf/src/index.js#L67-L81
train
mitchallen/connection-grid-square
modules/index.js
function(x, y, dir) { if(!this.isCell(x, y)) { return null; } // dir must be string and in dirmap if(!this.isDir(dir)) { return null; } let _DX = { "E": 1, "W": -1, "N": 0, "S": 0 }; let _DY = { "E": 0, "W": 0, "N": -1, "S": 1 }; var nx = x + _DX[d...
javascript
function(x, y, dir) { if(!this.isCell(x, y)) { return null; } // dir must be string and in dirmap if(!this.isDir(dir)) { return null; } let _DX = { "E": 1, "W": -1, "N": 0, "S": 0 }; let _DY = { "E": 0, "W": 0, "N": -1, "S": 1 }; var nx = x + _DX[d...
[ "function", "(", "x", ",", "y", ",", "dir", ")", "{", "if", "(", "!", "this", ".", "isCell", "(", "x", ",", "y", ")", ")", "{", "return", "null", ";", "}", "// dir must be string and in dirmap", "if", "(", "!", "this", ".", "isDir", "(", "dir", "...
Returns neighbor for direction @param {string} dir A string representing a direction @function @instance @memberof module:connection-grid-square @returns {string} @example <caption>usage</caption> var cell = grid.getNeighbor(1,1,"S");
[ "Returns", "neighbor", "for", "direction" ]
88cea02e210e9814b4c74f6a4c355b7695da6271
https://github.com/mitchallen/connection-grid-square/blob/88cea02e210e9814b4c74f6a4c355b7695da6271/modules/index.js#L84-L96
train
novemberborn/legendary
lib/fn.js
compose
function compose() { var funcs = slice.call(arguments); return function() { var thisArg = this; var boundFuncs = funcs.map(function(func) { return function() { return promise.Promise.from(func.apply(thisArg, arguments)); }; }); var args = slice.call(arguments); args.unshift...
javascript
function compose() { var funcs = slice.call(arguments); return function() { var thisArg = this; var boundFuncs = funcs.map(function(func) { return function() { return promise.Promise.from(func.apply(thisArg, arguments)); }; }); var args = slice.call(arguments); args.unshift...
[ "function", "compose", "(", ")", "{", "var", "funcs", "=", "slice", ".", "call", "(", "arguments", ")", ";", "return", "function", "(", ")", "{", "var", "thisArg", "=", "this", ";", "var", "boundFuncs", "=", "funcs", ".", "map", "(", "function", "(",...
The first `func` will be invoked with the other arguments that are passed. These arguments may also be promises, however instead of invoking `func` with the promises, it'll be invoked with the fulfillment values. If an argument promise is rejected, the returned promise will be rejected with the same reason.
[ "The", "first", "func", "will", "be", "invoked", "with", "the", "other", "arguments", "that", "are", "passed", ".", "These", "arguments", "may", "also", "be", "promises", "however", "instead", "of", "invoking", "func", "with", "the", "promises", "it", "ll", ...
8420f2dd20e2e3eaced51385fb6b0dc65b81a9fc
https://github.com/novemberborn/legendary/blob/8420f2dd20e2e3eaced51385fb6b0dc65b81a9fc/lib/fn.js#L159-L175
train
ForgeRock/node-openam-agent-cache-memcached
lib/memcached-cache.js
MemcachedCache
function MemcachedCache(options) { options = options || {}; this.client = memjs.Client.create(options.url || 'localhost/11211'); this.expireAfterSeconds = options.expireAfterSeconds || 60; }
javascript
function MemcachedCache(options) { options = options || {}; this.client = memjs.Client.create(options.url || 'localhost/11211'); this.expireAfterSeconds = options.expireAfterSeconds || 60; }
[ "function", "MemcachedCache", "(", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "this", ".", "client", "=", "memjs", ".", "Client", ".", "create", "(", "options", ".", "url", "||", "'localhost/11211'", ")", ";", "this", ".", "ex...
Cache implementation for memcached @extends Cache @param {object} [options] Options @param {string} [options.url=http://localhost/11211] memcached URL @param {number} [options.expireAfterSeconds=60] Expiration time in seconds @example var memcachedCache = new MemcachedCache({ url: 'cache.example.com:11211', expireAf...
[ "Cache", "implementation", "for", "memcached" ]
3705fca89a5c4ef251e70944dcd2d6df81e9aa92
https://github.com/ForgeRock/node-openam-agent-cache-memcached/blob/3705fca89a5c4ef251e70944dcd2d6df81e9aa92/lib/memcached-cache.js#L26-L31
train
espadrine/queread
learn.js
function() { this.links.forEach(link => { link.labelCount.forEach((count, label) => { link.labelWeight.set(label, count / this.numExamples.get(label)) }) }) this.weightsNeedBuilding = false }
javascript
function() { this.links.forEach(link => { link.labelCount.forEach((count, label) => { link.labelWeight.set(label, count / this.numExamples.get(label)) }) }) this.weightsNeedBuilding = false }
[ "function", "(", ")", "{", "this", ".", "links", ".", "forEach", "(", "link", "=>", "{", "link", ".", "labelCount", ".", "forEach", "(", "(", "count", ",", "label", ")", "=>", "{", "link", ".", "labelWeight", ".", "set", "(", "label", ",", "count",...
Build link.labelWeight.
[ "Build", "link", ".", "labelWeight", "." ]
5a0d5017ee1d1911983cc5252a27e160438837f7
https://github.com/espadrine/queread/blob/5a0d5017ee1d1911983cc5252a27e160438837f7/learn.js#L44-L51
train
smbape/node-fs-explorer
index.js
_explore
function _explore(start, callfile, calldir, options, done) { const {fs, followSymlink, resolve} = options; let count = 0; function take() { ++count; } function give(err) { if (--count === 0 || err) { done(err); } } // Start process take(); fs.l...
javascript
function _explore(start, callfile, calldir, options, done) { const {fs, followSymlink, resolve} = options; let count = 0; function take() { ++count; } function give(err) { if (--count === 0 || err) { done(err); } } // Start process take(); fs.l...
[ "function", "_explore", "(", "start", ",", "callfile", ",", "calldir", ",", "options", ",", "done", ")", "{", "const", "{", "fs", ",", "followSymlink", ",", "resolve", "}", "=", "options", ";", "let", "count", "=", "0", ";", "function", "take", "(", ...
Explore a file or a directory with no checking of paramters correctness Calling next with err cancels the reading Not calling next will make the process hang forever If you want fast reading, call next before processing the file or folder If you want listing control, call next after you processed the file or folder @p...
[ "Explore", "a", "file", "or", "a", "directory", "with", "no", "checking", "of", "paramters", "correctness" ]
e502aecfbe193506750d2a24680859ae03ca4c1e
https://github.com/smbape/node-fs-explorer/blob/e502aecfbe193506750d2a24680859ae03ca4c1e/index.js#L97-L143
train
vorg/fit-rect
index.js
fitRect
function fitRect(rect, target, mode) { mode = mode || 'contain'; var sw = target[2]/rect[2]; var sh = target[3]/rect[3]; var scale = 1; if (mode == 'contain') { scale = Math.min(sw, sh); } else if (mode == 'cover') { scale = Math.max(sw, sh); } return [ tar...
javascript
function fitRect(rect, target, mode) { mode = mode || 'contain'; var sw = target[2]/rect[2]; var sh = target[3]/rect[3]; var scale = 1; if (mode == 'contain') { scale = Math.min(sw, sh); } else if (mode == 'cover') { scale = Math.max(sw, sh); } return [ tar...
[ "function", "fitRect", "(", "rect", ",", "target", ",", "mode", ")", "{", "mode", "=", "mode", "||", "'contain'", ";", "var", "sw", "=", "target", "[", "2", "]", "/", "rect", "[", "2", "]", ";", "var", "sh", "=", "target", "[", "3", "]", "/", ...
Fits one rectangle into another @param {Array} rect [x,y,w,h] @param {Array} target [x,y,w,h] @param {String} mode ['contain' (default) or 'cover'] @return {Array} [x,y,w,h]
[ "Fits", "one", "rectangle", "into", "another" ]
cfd54e8f6d413b90e790bd43290e61e326c33abe
https://github.com/vorg/fit-rect/blob/cfd54e8f6d413b90e790bd43290e61e326c33abe/index.js#L8-L28
train
azendal/argon
argon/utility/field_encoder.js
encode
function encode(params) { var data, property, className; if(params === null){ return params; } className = Object.prototype.toString.call(params).replace('[object ', '').replace(']', ''); if ( className == 'Object' ) { data = {}; Object.key...
javascript
function encode(params) { var data, property, className; if(params === null){ return params; } className = Object.prototype.toString.call(params).replace('[object ', '').replace(']', ''); if ( className == 'Object' ) { data = {}; Object.key...
[ "function", "encode", "(", "params", ")", "{", "var", "data", ",", "property", ",", "className", ";", "if", "(", "params", "===", "null", ")", "{", "return", "params", ";", "}", "className", "=", "Object", ".", "prototype", ".", "toString", ".", "call"...
encondes the properties of the object with snake case style in a recursive strategy @property encode [Function] @param params [Object] any JavaScript @return object* [Object] the modified object
[ "encondes", "the", "properties", "of", "the", "object", "with", "snake", "case", "style", "in", "a", "recursive", "strategy" ]
0cfd3a3b3731b69abca55c956c757476779ec1bd
https://github.com/azendal/argon/blob/0cfd3a3b3731b69abca55c956c757476779ec1bd/argon/utility/field_encoder.js#L12-L41
train
aledbf/deis-api
lib/config.js
list
function list(appName, callback) { var uri = format('/%s/apps/%s/config/', deis.version, appName); commons.get(uri, function onListResponse(err, result) { callback(err, result ? result.values : null); }); }
javascript
function list(appName, callback) { var uri = format('/%s/apps/%s/config/', deis.version, appName); commons.get(uri, function onListResponse(err, result) { callback(err, result ? result.values : null); }); }
[ "function", "list", "(", "appName", ",", "callback", ")", "{", "var", "uri", "=", "format", "(", "'/%s/apps/%s/config/'", ",", "deis", ".", "version", ",", "appName", ")", ";", "commons", ".", "get", "(", "uri", ",", "function", "onListResponse", "(", "e...
List environment variables for an app
[ "List", "environment", "variables", "for", "an", "app" ]
f0833789998032b11221a3a617bb566ade1fcc13
https://github.com/aledbf/deis-api/blob/f0833789998032b11221a3a617bb566ade1fcc13/lib/config.js#L12-L17
train
aledbf/deis-api
lib/config.js
set
function set(appName, keyValues, keyLimits, callback) { var config = {}; if (!isObject(keyValues)) { return callback(new Error('To set a variable pass an object')); } config.values = keyValues; if (isObject(keyLimits)) { if (keyLimits.hasOwnProperty('memory')) { config.memory ...
javascript
function set(appName, keyValues, keyLimits, callback) { var config = {}; if (!isObject(keyValues)) { return callback(new Error('To set a variable pass an object')); } config.values = keyValues; if (isObject(keyLimits)) { if (keyLimits.hasOwnProperty('memory')) { config.memory ...
[ "function", "set", "(", "appName", ",", "keyValues", ",", "keyLimits", ",", "callback", ")", "{", "var", "config", "=", "{", "}", ";", "if", "(", "!", "isObject", "(", "keyValues", ")", ")", "{", "return", "callback", "(", "new", "Error", "(", "'To s...
Set environment variables for an application
[ "Set", "environment", "variables", "for", "an", "application" ]
f0833789998032b11221a3a617bb566ade1fcc13
https://github.com/aledbf/deis-api/blob/f0833789998032b11221a3a617bb566ade1fcc13/lib/config.js#L22-L46
train
aledbf/deis-api
lib/config.js
unset
function unset(appName, variableNames, callback) { if (!util.isArray(variableNames)) { return callback(new Error('To unset a variable pass an array of names')); } var keyValues = {}; variableNames.forEach(function onUnsetResponse(variableName) { keyValues[variableName] = null; }); ...
javascript
function unset(appName, variableNames, callback) { if (!util.isArray(variableNames)) { return callback(new Error('To unset a variable pass an array of names')); } var keyValues = {}; variableNames.forEach(function onUnsetResponse(variableName) { keyValues[variableName] = null; }); ...
[ "function", "unset", "(", "appName", ",", "variableNames", ",", "callback", ")", "{", "if", "(", "!", "util", ".", "isArray", "(", "variableNames", ")", ")", "{", "return", "callback", "(", "new", "Error", "(", "'To unset a variable pass an array of names'", "...
Unset environment variables for an app
[ "Unset", "environment", "variables", "for", "an", "app" ]
f0833789998032b11221a3a617bb566ade1fcc13
https://github.com/aledbf/deis-api/blob/f0833789998032b11221a3a617bb566ade1fcc13/lib/config.js#L51-L62
train
glennschler/spotspec
lib/logger.js
LogWrapper
function LogWrapper (isLogging) { if (this.constructor.name === 'Function') { throw new Error('Missing object context') } if (!isLogging) { // stub the logger out this.logger = {} this.logger.info = function () {} this.logger.error = function () {} this.logger.warn = function () {} r...
javascript
function LogWrapper (isLogging) { if (this.constructor.name === 'Function') { throw new Error('Missing object context') } if (!isLogging) { // stub the logger out this.logger = {} this.logger.info = function () {} this.logger.error = function () {} this.logger.warn = function () {} r...
[ "function", "LogWrapper", "(", "isLogging", ")", "{", "if", "(", "this", ".", "constructor", ".", "name", "===", "'Function'", ")", "{", "throw", "new", "Error", "(", "'Missing object context'", ")", "}", "if", "(", "!", "isLogging", ")", "{", "// stub the...
Function to be assigned to an objects logger method @private @function LogWrapper
[ "Function", "to", "be", "assigned", "to", "an", "objects", "logger", "method" ]
ca6f5b17b84b3536b6b2ce9a472d5ae91c8cd727
https://github.com/glennschler/spotspec/blob/ca6f5b17b84b3536b6b2ce9a472d5ae91c8cd727/lib/logger.js#L8-L34
train
unkhz/almost-static-site
main/index.js
function(suffix) { if ( suffix.match(/^([a-z]*:?\d*)\/\//) ) { return suffix; } var base = this.enablePushState ? this.baseUrl : '#/'; return base + suffix.replace(/^\//,''); }
javascript
function(suffix) { if ( suffix.match(/^([a-z]*:?\d*)\/\//) ) { return suffix; } var base = this.enablePushState ? this.baseUrl : '#/'; return base + suffix.replace(/^\//,''); }
[ "function", "(", "suffix", ")", "{", "if", "(", "suffix", ".", "match", "(", "/", "^([a-z]*:?\\d*)\\/\\/", "/", ")", ")", "{", "return", "suffix", ";", "}", "var", "base", "=", "this", ".", "enablePushState", "?", "this", ".", "baseUrl", ":", "'#/'", ...
Generate url for navigation link href
[ "Generate", "url", "for", "navigation", "link", "href" ]
cd09f02ffec06ee2c7494a76ef9a545dbdb58653
https://github.com/unkhz/almost-static-site/blob/cd09f02ffec06ee2c7494a76ef9a545dbdb58653/main/index.js#L20-L24
train
carrascoMDD/protractor-relaunchable
lib/protractor.js
function(to, from, fnName, setupFn) { to[fnName] = function() { if (setupFn) { setupFn(); } return from[fnName].apply(from, arguments); }; }
javascript
function(to, from, fnName, setupFn) { to[fnName] = function() { if (setupFn) { setupFn(); } return from[fnName].apply(from, arguments); }; }
[ "function", "(", "to", ",", "from", ",", "fnName", ",", "setupFn", ")", "{", "to", "[", "fnName", "]", "=", "function", "(", ")", "{", "if", "(", "setupFn", ")", "{", "setupFn", "(", ")", ";", "}", "return", "from", "[", "fnName", "]", ".", "ap...
Mix a function from one object onto another. The function will still be called in the context of the original object. @private @param {Object} to @param {Object} from @param {string} fnName @param {function=} setupFn
[ "Mix", "a", "function", "from", "one", "object", "onto", "another", ".", "The", "function", "will", "still", "be", "called", "in", "the", "context", "of", "the", "original", "object", "." ]
c18e17ecd8b5b036217f87680800c6e14b47361f
https://github.com/carrascoMDD/protractor-relaunchable/blob/c18e17ecd8b5b036217f87680800c6e14b47361f/lib/protractor.js#L53-L60
train
carrascoMDD/protractor-relaunchable
lib/protractor.js
function() { return elementArrayFinder.getWebElements().then(function(webElements) { if (webElements.length === 0) { throw new webdriver.error.Error( webdriver.error.ErrorCode.NO_SUCH_ELEMENT, 'No element found using locator: ' + elementArrayFinder.l...
javascript
function() { return elementArrayFinder.getWebElements().then(function(webElements) { if (webElements.length === 0) { throw new webdriver.error.Error( webdriver.error.ErrorCode.NO_SUCH_ELEMENT, 'No element found using locator: ' + elementArrayFinder.l...
[ "function", "(", ")", "{", "return", "elementArrayFinder", ".", "getWebElements", "(", ")", ".", "then", "(", "function", "(", "webElements", ")", "{", "if", "(", "webElements", ".", "length", "===", "0", ")", "{", "throw", "new", "webdriver", ".", "erro...
This filter verifies that there is only 1 element returned by the elementArrayFinder. It will warn if there are more than 1 element and throw an error if there are no elements.
[ "This", "filter", "verifies", "that", "there", "is", "only", "1", "element", "returned", "by", "the", "elementArrayFinder", ".", "It", "will", "warn", "if", "there", "are", "more", "than", "1", "element", "and", "throw", "an", "error", "if", "there", "are"...
c18e17ecd8b5b036217f87680800c6e14b47361f
https://github.com/carrascoMDD/protractor-relaunchable/blob/c18e17ecd8b5b036217f87680800c6e14b47361f/lib/protractor.js#L689-L705
train
jonschlinkert/conflicts
lib/diff.js
diffFile
function diffFile(existing, proposed, options) { let { ensureContents, exists, readChunk } = utils; let opts = options || {}; let contentsA = existing.contents; let contentsB = proposed.contents; if (!contentsA && exists(existing)) { contentsA = readChunk(existing.path, 0, 4 + 4096); } if (!content...
javascript
function diffFile(existing, proposed, options) { let { ensureContents, exists, readChunk } = utils; let opts = options || {}; let contentsA = existing.contents; let contentsB = proposed.contents; if (!contentsA && exists(existing)) { contentsA = readChunk(existing.path, 0, 4 + 4096); } if (!content...
[ "function", "diffFile", "(", "existing", ",", "proposed", ",", "options", ")", "{", "let", "{", "ensureContents", ",", "exists", ",", "readChunk", "}", "=", "utils", ";", "let", "opts", "=", "options", "||", "{", "}", ";", "let", "contentsA", "=", "exi...
Returns a formatted diff for binary or text files
[ "Returns", "a", "formatted", "diff", "for", "binary", "or", "text", "files" ]
0f45ab63f6cc24a03ce381b3d2159283923bc20d
https://github.com/jonschlinkert/conflicts/blob/0f45ab63f6cc24a03ce381b3d2159283923bc20d/lib/diff.js#L10-L35
train
jonschlinkert/conflicts
lib/diff.js
diffImage
function diffImage(existing, proposed, options) { let { bytes, dateformat, imageSize, Table, toFile, colors } = utils; existing = toFile(existing, options); proposed = toFile(proposed, options); let table = new Table({ head: ['Attribute', 'Existing', 'Replacement', 'Diff'] }); let dimensionsA = imageSize(ex...
javascript
function diffImage(existing, proposed, options) { let { bytes, dateformat, imageSize, Table, toFile, colors } = utils; existing = toFile(existing, options); proposed = toFile(proposed, options); let table = new Table({ head: ['Attribute', 'Existing', 'Replacement', 'Diff'] }); let dimensionsA = imageSize(ex...
[ "function", "diffImage", "(", "existing", ",", "proposed", ",", "options", ")", "{", "let", "{", "bytes", ",", "dateformat", ",", "imageSize", ",", "Table", ",", "toFile", ",", "colors", "}", "=", "utils", ";", "existing", "=", "toFile", "(", "existing",...
Shows table of the differences in stats between two binary files. @param {String} `filepath` File path of the existing (old) file. @param {Buffer} `contents` Buffered contents of the proposed (new) file.
[ "Shows", "table", "of", "the", "differences", "in", "stats", "between", "two", "binary", "files", "." ]
0f45ab63f6cc24a03ce381b3d2159283923bc20d
https://github.com/jonschlinkert/conflicts/blob/0f45ab63f6cc24a03ce381b3d2159283923bc20d/lib/diff.js#L114-L167
train
moxystudio/react-redata
src/composition/compose.js
defaultShouldReload
function defaultShouldReload(items, params) { // Go through all and check if any redata shouldReload. for (const key in items) { if (items[key].shouldReload(params)) { return true; } } return false; }
javascript
function defaultShouldReload(items, params) { // Go through all and check if any redata shouldReload. for (const key in items) { if (items[key].shouldReload(params)) { return true; } } return false; }
[ "function", "defaultShouldReload", "(", "items", ",", "params", ")", "{", "// Go through all and check if any redata shouldReload.", "for", "(", "const", "key", "in", "items", ")", "{", "if", "(", "items", "[", "key", "]", ".", "shouldReload", "(", "params", ")"...
Default shouldReload that goes through each item redata and asks if the reload is necessary. If any says that it is, a redata happens.
[ "Default", "shouldReload", "that", "goes", "through", "each", "item", "redata", "and", "asks", "if", "the", "reload", "is", "necessary", ".", "If", "any", "says", "that", "it", "is", "a", "redata", "happens", "." ]
19f5c548b8dbc3f71fb14077e9740f9dd62bb10a
https://github.com/moxystudio/react-redata/blob/19f5c548b8dbc3f71fb14077e9740f9dd62bb10a/src/composition/compose.js#L14-L23
train
derikb/rpg-table-randomizer
src/random_name.js
function (number, name_type, create) { const names = { male: [], female: [] }; if (typeof create === 'undefined') { create = false; } if (typeof number === 'undefined') { number = 10; } if (typeof name_type === 'undefined' || name_type === '') { name_type = 'random'; } for (let i = 1; i <= number; i++...
javascript
function (number, name_type, create) { const names = { male: [], female: [] }; if (typeof create === 'undefined') { create = false; } if (typeof number === 'undefined') { number = 10; } if (typeof name_type === 'undefined' || name_type === '') { name_type = 'random'; } for (let i = 1; i <= number; i++...
[ "function", "(", "number", ",", "name_type", ",", "create", ")", "{", "const", "names", "=", "{", "male", ":", "[", "]", ",", "female", ":", "[", "]", "}", ";", "if", "(", "typeof", "create", "===", "'undefined'", ")", "{", "create", "=", "false", ...
Generate a bunch of names, half male, half female @param {Number} [number=10] number of names in the list (half will be male, half will be female) @param {String} [name_type] type of name or else it will randomly select @param {Bool} [create=false] new names or just pick from list @return {Object} arrays of names insid...
[ "Generate", "a", "bunch", "of", "names", "half", "male", "half", "female" ]
988814794b1ee26c24c2a979646e4d13fdd2b7be
https://github.com/derikb/rpg-table-randomizer/blob/988814794b1ee26c24c2a979646e4d13fdd2b7be/src/random_name.js#L23-L40
train
derikb/rpg-table-randomizer
src/random_name.js
function (name_type, gender, style) { let name = ''; if (typeof name_type === 'undefined' || name_type === '' || name_type === 'random') { // randomize a type... name_type = randomizer.rollRandom(Object.keys(namedata.options)); } if (typeof gender === 'undefined' || gender === 'random') { // randomi...
javascript
function (name_type, gender, style) { let name = ''; if (typeof name_type === 'undefined' || name_type === '' || name_type === 'random') { // randomize a type... name_type = randomizer.rollRandom(Object.keys(namedata.options)); } if (typeof gender === 'undefined' || gender === 'random') { // randomi...
[ "function", "(", "name_type", ",", "gender", ",", "style", ")", "{", "let", "name", "=", "''", ";", "if", "(", "typeof", "name_type", "===", "'undefined'", "||", "name_type", "===", "''", "||", "name_type", "===", "'random'", ")", "{", "// randomize a type...
Select a name from one of the lists @param {String} name_type What name list/process to use else random @param {String} gender male, female, random, '' @param {String} style first=first name only, else full name @returns {String} a name
[ "Select", "a", "name", "from", "one", "of", "the", "lists" ]
988814794b1ee26c24c2a979646e4d13fdd2b7be
https://github.com/derikb/rpg-table-randomizer/blob/988814794b1ee26c24c2a979646e4d13fdd2b7be/src/random_name.js#L48-L83
train
derikb/rpg-table-randomizer
src/random_name.js
function (name_type, gender, style) { if (typeof name_type === 'undefined' || name_type === '' || name_type === 'random') { // randomize a type... name_type = randomizer.rollRandom(Object.keys(namedata.options)); } if (typeof style === 'undefined') { style = ''; } if (!namedata[name_type]) { return ''; } ...
javascript
function (name_type, gender, style) { if (typeof name_type === 'undefined' || name_type === '' || name_type === 'random') { // randomize a type... name_type = randomizer.rollRandom(Object.keys(namedata.options)); } if (typeof style === 'undefined') { style = ''; } if (!namedata[name_type]) { return ''; } ...
[ "function", "(", "name_type", ",", "gender", ",", "style", ")", "{", "if", "(", "typeof", "name_type", "===", "'undefined'", "||", "name_type", "===", "''", "||", "name_type", "===", "'random'", ")", "{", "// randomize a type...", "name_type", "=", "randomizer...
Create a name using Markov chains @param {String} [name_type=random] what list/process to use @param {String} [gender=random] male or female or both @param {String} style first=first name only, else full name @returns {String} a name
[ "Create", "a", "name", "using", "Markov", "chains" ]
988814794b1ee26c24c2a979646e4d13fdd2b7be
https://github.com/derikb/rpg-table-randomizer/blob/988814794b1ee26c24c2a979646e4d13fdd2b7be/src/random_name.js#L120-L165
train
derikb/rpg-table-randomizer
src/random_name.js
function (name) { const leave_lower = ['of', 'the', 'from', 'de', 'le', 'la']; // need to find spaces in name and capitalize letter after space const parts = name.split(' '); const upper_parts = parts.map((w) => { return (leave_lower.indexOf(w) >= 0) ? w : `${r_helpers.capitalize(w)}`; }); return upper_p...
javascript
function (name) { const leave_lower = ['of', 'the', 'from', 'de', 'le', 'la']; // need to find spaces in name and capitalize letter after space const parts = name.split(' '); const upper_parts = parts.map((w) => { return (leave_lower.indexOf(w) >= 0) ? w : `${r_helpers.capitalize(w)}`; }); return upper_p...
[ "function", "(", "name", ")", "{", "const", "leave_lower", "=", "[", "'of'", ",", "'the'", ",", "'from'", ",", "'de'", ",", "'le'", ",", "'la'", "]", ";", "// need to find spaces in name and capitalize letter after space", "const", "parts", "=", "name", ".", "...
Capitalize names, account for multiword lastnames like "Van Hausen" @param {String} name a name @return {String} name capitalized
[ "Capitalize", "names", "account", "for", "multiword", "lastnames", "like", "Van", "Hausen" ]
988814794b1ee26c24c2a979646e4d13fdd2b7be
https://github.com/derikb/rpg-table-randomizer/blob/988814794b1ee26c24c2a979646e4d13fdd2b7be/src/random_name.js#L171-L179
train
derikb/rpg-table-randomizer
src/random_name.js
function () { let name = ''; const scount = randomizer.getWeightedRandom(namedata.holmesian_scount.values, namedata.holmesian_scount.weights); for (let i = 1; i <= scount; i++) { name += randomizer.rollRandom(namedata.holmesian_syllables); // array if (i < scount) { name += randomizer.getWeightedRando...
javascript
function () { let name = ''; const scount = randomizer.getWeightedRandom(namedata.holmesian_scount.values, namedata.holmesian_scount.weights); for (let i = 1; i <= scount; i++) { name += randomizer.rollRandom(namedata.holmesian_syllables); // array if (i < scount) { name += randomizer.getWeightedRando...
[ "function", "(", ")", "{", "let", "name", "=", "''", ";", "const", "scount", "=", "randomizer", ".", "getWeightedRandom", "(", "namedata", ".", "holmesian_scount", ".", "values", ",", "namedata", ".", "holmesian_scount", ".", "weights", ")", ";", "for", "(...
Generate a Holmes name @returns {String} name
[ "Generate", "a", "Holmes", "name" ]
988814794b1ee26c24c2a979646e4d13fdd2b7be
https://github.com/derikb/rpg-table-randomizer/blob/988814794b1ee26c24c2a979646e4d13fdd2b7be/src/random_name.js#L184-L202
train
spacemaus/postvox
vox-common/chain.js
isPromise
function isPromise(v) { return v && v.isFulfilled && v.then && v.catch && v.value; }
javascript
function isPromise(v) { return v && v.isFulfilled && v.then && v.catch && v.value; }
[ "function", "isPromise", "(", "v", ")", "{", "return", "v", "&&", "v", ".", "isFulfilled", "&&", "v", ".", "then", "&&", "v", ".", "catch", "&&", "v", ".", "value", ";", "}" ]
instanceof doesn't seem to work across modules.
[ "instanceof", "doesn", "t", "seem", "to", "work", "across", "modules", "." ]
de98e5ed37edaee1b1edadf93e15eb8f8d21f457
https://github.com/spacemaus/postvox/blob/de98e5ed37edaee1b1edadf93e15eb8f8d21f457/vox-common/chain.js#L98-L100
train
nodejitsu/npm-documentation-pagelet
npm.js
Help
function Help(filename, path, github, preprocess) { if (!(this instanceof Help)) return new Help(filename, path, preprocess); this.html = ''; this.path = path; this.github = github; this.filename = filename; this.preprocess = preprocess; this.url = filename.slice(0, -3); this.title = filename.slice(0, ...
javascript
function Help(filename, path, github, preprocess) { if (!(this instanceof Help)) return new Help(filename, path, preprocess); this.html = ''; this.path = path; this.github = github; this.filename = filename; this.preprocess = preprocess; this.url = filename.slice(0, -3); this.title = filename.slice(0, ...
[ "function", "Help", "(", "filename", ",", "path", ",", "github", ",", "preprocess", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Help", ")", ")", "return", "new", "Help", "(", "filename", ",", "path", ",", "preprocess", ")", ";", "this", "."...
Representation of a single HELP document. @constructor @param {String} filename The name of the help file. @param {String} path The absolute location of the file. @param {Object} github Github user/repo of the help files. @param {Function} preprocess Optional content pre-processor. @api public
[ "Representation", "of", "a", "single", "HELP", "document", "." ]
d45006c68cad8f14c63fd86b6be6f8569d5a1a09
https://github.com/nodejitsu/npm-documentation-pagelet/blob/d45006c68cad8f14c63fd86b6be6f8569d5a1a09/npm.js#L19-L33
train
ericmorand/generator-ahead
lib/util/prompt-suggestion.js
function (question, defaultValue) { // For simplicity we uncheck all boxes and // use .default to set the active ones. _.each(question.choices, function (choice) { if (typeof choice === 'object') { choice.checked = false; } }); return defaultValue; }
javascript
function (question, defaultValue) { // For simplicity we uncheck all boxes and // use .default to set the active ones. _.each(question.choices, function (choice) { if (typeof choice === 'object') { choice.checked = false; } }); return defaultValue; }
[ "function", "(", "question", ",", "defaultValue", ")", "{", "// For simplicity we uncheck all boxes and", "// use .default to set the active ones.", "_", ".", "each", "(", "question", ".", "choices", ",", "function", "(", "choice", ")", "{", "if", "(", "typeof", "ch...
Returns the default value for a checkbox. @param {Object} question Inquirer prompt item @param {*} defaultValue The stored default value @return {*} Default value to set @private
[ "Returns", "the", "default", "value", "for", "a", "checkbox", "." ]
7d9d67e5996881c2b47333f9ae57db7cd4e3cb42
https://github.com/ericmorand/generator-ahead/blob/7d9d67e5996881c2b47333f9ae57db7cd4e3cb42/lib/util/prompt-suggestion.js#L19-L29
train
ericmorand/generator-ahead
lib/util/prompt-suggestion.js
function (question, defaultValue) { var choiceValues = _.map(question.choices, function (choice) { if (typeof choice === 'object') { return choice.value; } else { return choice; } }); return choiceValues.indexOf(defaultValue); }
javascript
function (question, defaultValue) { var choiceValues = _.map(question.choices, function (choice) { if (typeof choice === 'object') { return choice.value; } else { return choice; } }); return choiceValues.indexOf(defaultValue); }
[ "function", "(", "question", ",", "defaultValue", ")", "{", "var", "choiceValues", "=", "_", ".", "map", "(", "question", ".", "choices", ",", "function", "(", "choice", ")", "{", "if", "(", "typeof", "choice", "===", "'object'", ")", "{", "return", "c...
Returns the default value for a list. @param {Object} question Inquirer prompt item @param {*} defaultValue The stored default value @return {*} Default value to set @private
[ "Returns", "the", "default", "value", "for", "a", "list", "." ]
7d9d67e5996881c2b47333f9ae57db7cd4e3cb42
https://github.com/ericmorand/generator-ahead/blob/7d9d67e5996881c2b47333f9ae57db7cd4e3cb42/lib/util/prompt-suggestion.js#L39-L49
train
ericmorand/generator-ahead
lib/util/prompt-suggestion.js
function (question, answer) { var choiceValues = _.map(question.choices, 'value'); var choiceIndex = choiceValues.indexOf(answer); // Check if answer is not equal to default value if (question.default !== choiceIndex) { return true; } return false; }
javascript
function (question, answer) { var choiceValues = _.map(question.choices, 'value'); var choiceIndex = choiceValues.indexOf(answer); // Check if answer is not equal to default value if (question.default !== choiceIndex) { return true; } return false; }
[ "function", "(", "question", ",", "answer", ")", "{", "var", "choiceValues", "=", "_", ".", "map", "(", "question", ".", "choices", ",", "'value'", ")", ";", "var", "choiceIndex", "=", "choiceValues", ".", "indexOf", "(", "answer", ")", ";", "// Check if...
Return true if the answer should be store in the global store, otherwise false. @param {Object} question Inquirer prompt item @param {String|Array} answer The inquirer answer @return {Boolean} Answer to be stored @private
[ "Return", "true", "if", "the", "answer", "should", "be", "store", "in", "the", "global", "store", "otherwise", "false", "." ]
7d9d67e5996881c2b47333f9ae57db7cd4e3cb42
https://github.com/ericmorand/generator-ahead/blob/7d9d67e5996881c2b47333f9ae57db7cd4e3cb42/lib/util/prompt-suggestion.js#L60-L70
train
aledbf/deis-api
lib/ps.js
scale
function scale(appName, configuration, callback) { if (!isObject(configuration)) { return callback(new Error('To scale pass an object with the type as key')); } var url = format('/%s/apps/%s/scale/', deis.version, appName); commons.post(url, configuration, 204, callback); }
javascript
function scale(appName, configuration, callback) { if (!isObject(configuration)) { return callback(new Error('To scale pass an object with the type as key')); } var url = format('/%s/apps/%s/scale/', deis.version, appName); commons.post(url, configuration, 204, callback); }
[ "function", "scale", "(", "appName", ",", "configuration", ",", "callback", ")", "{", "if", "(", "!", "isObject", "(", "configuration", ")", ")", "{", "return", "callback", "(", "new", "Error", "(", "'To scale pass an object with the type as key'", ")", ")", "...
scale an application
[ "scale", "an", "application" ]
f0833789998032b11221a3a617bb566ade1fcc13
https://github.com/aledbf/deis-api/blob/f0833789998032b11221a3a617bb566ade1fcc13/lib/ps.js#L11-L18
train
aledbf/deis-api
lib/ps.js
byType
function byType(appName, type, callback) { var url = format('/%s/apps/%s/containers/%s/', deis.version, appName, type); commons.get(url, callback); }
javascript
function byType(appName, type, callback) { var url = format('/%s/apps/%s/containers/%s/', deis.version, appName, type); commons.get(url, callback); }
[ "function", "byType", "(", "appName", ",", "type", ",", "callback", ")", "{", "var", "url", "=", "format", "(", "'/%s/apps/%s/containers/%s/'", ",", "deis", ".", "version", ",", "appName", ",", "type", ")", ";", "commons", ".", "get", "(", "url", ",", ...
list application containers and their status
[ "list", "application", "containers", "and", "their", "status" ]
f0833789998032b11221a3a617bb566ade1fcc13
https://github.com/aledbf/deis-api/blob/f0833789998032b11221a3a617bb566ade1fcc13/lib/ps.js#L30-L33
train
lesx/lesx-jsx
lib/babel-core/src/config/index.js
loadConfig
function loadConfig(opts) { if (opts != null && (typeof opts === "undefined" ? "undefined" : (0, _typeof3.default)(opts)) !== "object") { throw new Error("Babel options must be an object, null, or undefined"); } return (0, _optionManager2.default)(opts || {}); }
javascript
function loadConfig(opts) { if (opts != null && (typeof opts === "undefined" ? "undefined" : (0, _typeof3.default)(opts)) !== "object") { throw new Error("Babel options must be an object, null, or undefined"); } return (0, _optionManager2.default)(opts || {}); }
[ "function", "loadConfig", "(", "opts", ")", "{", "if", "(", "opts", "!=", "null", "&&", "(", "typeof", "opts", "===", "\"undefined\"", "?", "\"undefined\"", ":", "(", "0", ",", "_typeof3", ".", "default", ")", "(", "opts", ")", ")", "!==", "\"object\""...
Standard API for loading Babel configuration data. Not for public consumption.
[ "Standard", "API", "for", "loading", "Babel", "configuration", "data", ".", "Not", "for", "public", "consumption", "." ]
6b82f5ee115add3fb61b83c8e22e83fad66ad437
https://github.com/lesx/lesx-jsx/blob/6b82f5ee115add3fb61b83c8e22e83fad66ad437/lib/babel-core/src/config/index.js#L24-L30
train
davidfig/dom-ease
docs/code.js
createVelocity
function createVelocity() { const duration = 2000 const easing = 'easeInOutSine' Velocity(box('scaleX'), { scaleX: 2 }, { duration, easing, loop: true }) Velocity(box('scaleY'), { scaleY: 2 }, { duration, easing, loop: true }) Velocity(box('top/left'), { left: window.innerWidth / 2, top: windo...
javascript
function createVelocity() { const duration = 2000 const easing = 'easeInOutSine' Velocity(box('scaleX'), { scaleX: 2 }, { duration, easing, loop: true }) Velocity(box('scaleY'), { scaleY: 2 }, { duration, easing, loop: true }) Velocity(box('top/left'), { left: window.innerWidth / 2, top: windo...
[ "function", "createVelocity", "(", ")", "{", "const", "duration", "=", "2000", "const", "easing", "=", "'easeInOutSine'", "Velocity", "(", "box", "(", "'scaleX'", ")", ",", "{", "scaleX", ":", "2", "}", ",", "{", "duration", ",", "easing", ",", "loop", ...
compare speed with velocity-animate
[ "compare", "speed", "with", "velocity", "-", "animate" ]
4abc692d968593dd41546bb4d2fc7d9d861e8007
https://github.com/davidfig/dom-ease/blob/4abc692d968593dd41546bb4d2fc7d9d861e8007/docs/code.js#L49-L62
train
thlorenz/node-traceur
src/node/inline-module.js
wrapProgram
function wrapProgram(tree, url, commonPath) { var name = generateNameForUrl(url, commonPath); return new Program(null, [new ModuleDefinition(null, createIdentifierToken(name), tree.programElements)]); }
javascript
function wrapProgram(tree, url, commonPath) { var name = generateNameForUrl(url, commonPath); return new Program(null, [new ModuleDefinition(null, createIdentifierToken(name), tree.programElements)]); }
[ "function", "wrapProgram", "(", "tree", ",", "url", ",", "commonPath", ")", "{", "var", "name", "=", "generateNameForUrl", "(", "url", ",", "commonPath", ")", ";", "return", "new", "Program", "(", "null", ",", "[", "new", "ModuleDefinition", "(", "null", ...
Wraps a program in a module definition. @param {ProgramTree} tree The original program tree. @param {string} url The relative URL of the module that the program represents. @param {string} commonPath The base path of all the files. This is passed along to |generateNameForUrl|. @return {[ProgramTree} A new program tre...
[ "Wraps", "a", "program", "in", "a", "module", "definition", "." ]
79a21ad03831ba36df504988b05022404ad8f9c3
https://github.com/thlorenz/node-traceur/blob/79a21ad03831ba36df504988b05022404ad8f9c3/src/node/inline-module.js#L51-L56
train
thlorenz/node-traceur
src/node/inline-module.js
inlineAndCompile
function inlineAndCompile(filenames, options, reporter, callback, errback) { // The caller needs to do a chdir. var basePath = './'; var depTarget = options && options.depTarget; var loadCount = 0; var elements = []; var project = new Project(basePath); var loader = new InlineCodeLoader(reporter, projec...
javascript
function inlineAndCompile(filenames, options, reporter, callback, errback) { // The caller needs to do a chdir. var basePath = './'; var depTarget = options && options.depTarget; var loadCount = 0; var elements = []; var project = new Project(basePath); var loader = new InlineCodeLoader(reporter, projec...
[ "function", "inlineAndCompile", "(", "filenames", ",", "options", ",", "reporter", ",", "callback", ",", "errback", ")", "{", "// The caller needs to do a chdir.", "var", "basePath", "=", "'./'", ";", "var", "depTarget", "=", "options", "&&", "options", ".", "de...
Compiles the files in "filenames" along with any associated modules, into a single js file, in proper module dependency order. @param {Array.<string>} filenames The list of files to compile and concat. @param {Object} options A container for misc options. 'depTarget' is the only currently available option, which resul...
[ "Compiles", "the", "files", "in", "filenames", "along", "with", "any", "associated", "modules", "into", "a", "single", "js", "file", "in", "proper", "module", "dependency", "order", "." ]
79a21ad03831ba36df504988b05022404ad8f9c3
https://github.com/thlorenz/node-traceur/blob/79a21ad03831ba36df504988b05022404ad8f9c3/src/node/inline-module.js#L181-L213
train
SolarNetwork/solarnetwork-d3
solarnetwork-d3.js
sn_util_copyAll
function sn_util_copyAll(obj1, obj2) { var keys = Object.getOwnPropertyNames(obj1), i, len, key, desc; if (obj2 === undefined) { obj2 = {}; } for (i = 0, len = keys.length; i < len; i += 1) { key = keys[i]; desc = Object.getOwnPropertyDescriptor(obj1, key); if (desc) { Ob...
javascript
function sn_util_copyAll(obj1, obj2) { var keys = Object.getOwnPropertyNames(obj1), i, len, key, desc; if (obj2 === undefined) { obj2 = {}; } for (i = 0, len = keys.length; i < len; i += 1) { key = keys[i]; desc = Object.getOwnPropertyDescriptor(obj1, key); if (desc) { Ob...
[ "function", "sn_util_copyAll", "(", "obj1", ",", "obj2", ")", "{", "var", "keys", "=", "Object", ".", "getOwnPropertyNames", "(", "obj1", ")", ",", "i", ",", "len", ",", "key", ",", "desc", ";", "if", "(", "obj2", "===", "undefined", ")", "{", "obj2"...
Copy the enumerable and non-enumerable own properties of `obj` onto `obj2` and return `obj2`. @param {Object} obj1 - The object to copy enumerable properties from. @param {Object} [obj2] - The optional object to copy the properties to. If not provided a new object will be created. @returns {Object} The object whose pr...
[ "Copy", "the", "enumerable", "and", "non", "-", "enumerable", "own", "properties", "of", "obj", "onto", "obj2", "and", "return", "obj2", "." ]
26848b1c303b98b7c0ddeefb8c68c5f5bf78927e
https://github.com/SolarNetwork/solarnetwork-d3/blob/26848b1c303b98b7c0ddeefb8c68c5f5bf78927e/solarnetwork-d3.js#L86-L101
train
SolarNetwork/solarnetwork-d3
solarnetwork-d3.js
sn_util_merge
function sn_util_merge(obj1, obj2) { var prop, desc; if (obj2 === undefined) { obj2 = {}; } for (prop in obj1) { if (obj1.hasOwnProperty(prop) && obj2[prop] === undefined) { desc = Object.getOwnPropertyDescriptor(obj1, prop); if (desc) { Object.defineProperty(obj2, ...
javascript
function sn_util_merge(obj1, obj2) { var prop, desc; if (obj2 === undefined) { obj2 = {}; } for (prop in obj1) { if (obj1.hasOwnProperty(prop) && obj2[prop] === undefined) { desc = Object.getOwnPropertyDescriptor(obj1, prop); if (desc) { Object.defineProperty(obj2, ...
[ "function", "sn_util_merge", "(", "obj1", ",", "obj2", ")", "{", "var", "prop", ",", "desc", ";", "if", "(", "obj2", "===", "undefined", ")", "{", "obj2", "=", "{", "}", ";", "}", "for", "(", "prop", "in", "obj1", ")", "{", "if", "(", "obj1", "...
Copy the enumerable own properties of `obj1` that don't already exist on `obj2` into `obj2` and return `obj2`. @param {Object} obj1 - The object to copy enumerable properties from. @param {Object} [obj2] - The optional object to copy the properties to. If not provided a new object will be created. @returns {Object} Th...
[ "Copy", "the", "enumerable", "own", "properties", "of", "obj1", "that", "don", "t", "already", "exist", "on", "obj2", "into", "obj2", "and", "return", "obj2", "." ]
26848b1c303b98b7c0ddeefb8c68c5f5bf78927e
https://github.com/SolarNetwork/solarnetwork-d3/blob/26848b1c303b98b7c0ddeefb8c68c5f5bf78927e/solarnetwork-d3.js#L112-L128
train
SolarNetwork/solarnetwork-d3
solarnetwork-d3.js
sn_util_arraysAreEqual
function sn_util_arraysAreEqual(a1, a2) { var i, len; if (!(Array.isArray(a1) && Array.isArray(a2))) { return false; } if (a1.length !== a2.length) { return false; } for (i = 0, len = a1.length; i < len; i += 1) { if (Array.isArray(a1[i]) && Array.isArray(a2[i]) && arraysAreEqu...
javascript
function sn_util_arraysAreEqual(a1, a2) { var i, len; if (!(Array.isArray(a1) && Array.isArray(a2))) { return false; } if (a1.length !== a2.length) { return false; } for (i = 0, len = a1.length; i < len; i += 1) { if (Array.isArray(a1[i]) && Array.isArray(a2[i]) && arraysAreEqu...
[ "function", "sn_util_arraysAreEqual", "(", "a1", ",", "a2", ")", "{", "var", "i", ",", "len", ";", "if", "(", "!", "(", "Array", ".", "isArray", "(", "a1", ")", "&&", "Array", ".", "isArray", "(", "a2", ")", ")", ")", "{", "return", "false", ";",...
Compare two arrays for equality, that is they have the same length and same values using strict quality. @param {Array} a1 The first array to compare. @param {Array} a2 The second array to compare. @return {Boolean} True if the arrays are equal. @since 0.2.0 @preserve
[ "Compare", "two", "arrays", "for", "equality", "that", "is", "they", "have", "the", "same", "length", "and", "same", "values", "using", "strict", "quality", "." ]
26848b1c303b98b7c0ddeefb8c68c5f5bf78927e
https://github.com/SolarNetwork/solarnetwork-d3/blob/26848b1c303b98b7c0ddeefb8c68c5f5bf78927e/solarnetwork-d3.js#L139-L155
train
SolarNetwork/solarnetwork-d3
solarnetwork-d3.js
sn_util_superMethod
function sn_util_superMethod(name) { var that = this, method = that[name]; return function() { return method.apply(that, arguments); }; }
javascript
function sn_util_superMethod(name) { var that = this, method = that[name]; return function() { return method.apply(that, arguments); }; }
[ "function", "sn_util_superMethod", "(", "name", ")", "{", "var", "that", "=", "this", ",", "method", "=", "that", "[", "name", "]", ";", "return", "function", "(", ")", "{", "return", "method", ".", "apply", "(", "that", ",", "arguments", ")", ";", "...
Get a proxy method for a "super" class' method on the `this` objct. @param {String} name - The name of the method to get a proxy for. @returns {Function} A function that calls the `name` function of the `this` object. @since 0.0.4 @preserve
[ "Get", "a", "proxy", "method", "for", "a", "super", "class", "method", "on", "the", "this", "objct", "." ]
26848b1c303b98b7c0ddeefb8c68c5f5bf78927e
https://github.com/SolarNetwork/solarnetwork-d3/blob/26848b1c303b98b7c0ddeefb8c68c5f5bf78927e/solarnetwork-d3.js#L164-L169
train
SolarNetwork/solarnetwork-d3
solarnetwork-d3.js
sn_api_user_queueInstructionURL
function sn_api_user_queueInstructionURL(topic, parameters) { var url = sn_api_user_baseURL(this) + "/instr/add?nodeId=" + this.nodeId + "&topic=" + encodeURIComponent(topic); if (Array.isArray(parameters)) { var i, len; for (i = 0, len = parameters.length; i < len; i++) { url += "&" + encod...
javascript
function sn_api_user_queueInstructionURL(topic, parameters) { var url = sn_api_user_baseURL(this) + "/instr/add?nodeId=" + this.nodeId + "&topic=" + encodeURIComponent(topic); if (Array.isArray(parameters)) { var i, len; for (i = 0, len = parameters.length; i < len; i++) { url += "&" + encod...
[ "function", "sn_api_user_queueInstructionURL", "(", "topic", ",", "parameters", ")", "{", "var", "url", "=", "sn_api_user_baseURL", "(", "this", ")", "+", "\"/instr/add?nodeId=\"", "+", "this", ".", "nodeId", "+", "\"&topic=\"", "+", "encodeURIComponent", "(", "to...
Generate a URL for posting an instruction request. @param {String} topic - The instruction topic. @param {Array} parameters - An array of parameter objects in the form <code>{name:n1, value:v1}</code>. @preserve
[ "Generate", "a", "URL", "for", "posting", "an", "instruction", "request", "." ]
26848b1c303b98b7c0ddeefb8c68c5f5bf78927e
https://github.com/SolarNetwork/solarnetwork-d3/blob/26848b1c303b98b7c0ddeefb8c68c5f5bf78927e/solarnetwork-d3.js#L458-L467
train
SolarNetwork/solarnetwork-d3
solarnetwork-d3.js
function(key, enabled) { var val = enabled; if (key === undefined) { return this; } if (val === undefined) { val = this.map[key] === undefined; } return this.value(key, val === true ? true : null); }
javascript
function(key, enabled) { var val = enabled; if (key === undefined) { return this; } if (val === undefined) { val = this.map[key] === undefined; } return this.value(key, val === true ? true : null); }
[ "function", "(", "key", ",", "enabled", ")", "{", "var", "val", "=", "enabled", ";", "if", "(", "key", "===", "undefined", ")", "{", "return", "this", ";", "}", "if", "(", "val", "===", "undefined", ")", "{", "val", "=", "this", ".", "map", "[", ...
Set or toggle the enabled status of a given key. <p>If the <em>enabled</em> parameter is not passed, then the enabled status will be toggled to its opposite value.</p> @param {String} key they key to set @param {Boolean} enabled the optional enabled value to set @returns {sn.Configuration} this object to allow method...
[ "Set", "or", "toggle", "the", "enabled", "status", "of", "a", "given", "key", "." ]
26848b1c303b98b7c0ddeefb8c68c5f5bf78927e
https://github.com/SolarNetwork/solarnetwork-d3/blob/26848b1c303b98b7c0ddeefb8c68c5f5bf78927e/solarnetwork-d3.js#L1765-L1774
train
SolarNetwork/solarnetwork-d3
solarnetwork-d3.js
function(key, newValue) { var me = this; if (arguments.length === 1) { return this.map[key]; } if (newValue === null) { delete this.map[key]; if (this.hasOwnProperty(key)) { delete this[key]; } } else { this.map[key] = newValue; if ...
javascript
function(key, newValue) { var me = this; if (arguments.length === 1) { return this.map[key]; } if (newValue === null) { delete this.map[key]; if (this.hasOwnProperty(key)) { delete this[key]; } } else { this.map[key] = newValue; if ...
[ "function", "(", "key", ",", "newValue", ")", "{", "var", "me", "=", "this", ";", "if", "(", "arguments", ".", "length", "===", "1", ")", "{", "return", "this", ".", "map", "[", "key", "]", ";", "}", "if", "(", "newValue", "===", "null", ")", "...
Get or set a configuration value. @param {String} key The key to get or set the value for @param [newValue] If defined, the new value to set for the given {@code key}. If {@code null} then the value will be removed. @returns If called as a getter, the associated value for the given {@code key}, otherwise this object. ...
[ "Get", "or", "set", "a", "configuration", "value", "." ]
26848b1c303b98b7c0ddeefb8c68c5f5bf78927e
https://github.com/SolarNetwork/solarnetwork-d3/blob/26848b1c303b98b7c0ddeefb8c68c5f5bf78927e/solarnetwork-d3.js#L1785-L1811
train
SolarNetwork/solarnetwork-d3
solarnetwork-d3.js
sn_net_encodeURLQueryTerms
function sn_net_encodeURLQueryTerms(parameters) { var result = "", prop, val, i, len; function handleValue(k, v) { if (result.length) { result += "&"; } result += encodeURIComponent(k) + "=" + encodeURIComponent(v); } if (parameters) { for (prop in parameters) { i...
javascript
function sn_net_encodeURLQueryTerms(parameters) { var result = "", prop, val, i, len; function handleValue(k, v) { if (result.length) { result += "&"; } result += encodeURIComponent(k) + "=" + encodeURIComponent(v); } if (parameters) { for (prop in parameters) { i...
[ "function", "sn_net_encodeURLQueryTerms", "(", "parameters", ")", "{", "var", "result", "=", "\"\"", ",", "prop", ",", "val", ",", "i", ",", "len", ";", "function", "handleValue", "(", "k", ",", "v", ")", "{", "if", "(", "result", ".", "length", ")", ...
Encode the properties of an object as a URL query string. <p>If an object property has an array value, multiple URL parameters will be encoded for that property.</p> @param {Object} an object to encode as URL parameters @return {String} the encoded query parameters @preserve
[ "Encode", "the", "properties", "of", "an", "object", "as", "a", "URL", "query", "string", "." ]
26848b1c303b98b7c0ddeefb8c68c5f5bf78927e
https://github.com/SolarNetwork/solarnetwork-d3/blob/26848b1c303b98b7c0ddeefb8c68c5f5bf78927e/solarnetwork-d3.js#L6232-L6255
train
SolarNetwork/solarnetwork-d3
solarnetwork-d3.js
generateCanonicalRequestMessage
function generateCanonicalRequestMessage(params) { var msg = (params.method === undefined ? "GET" : params.method.toUpperCase()) + "\n" + params.uri.path + "\n" + (params.queryParams ? params.queryParams : "") + "\n"; params.headers.headerNames.forEach(function(name) { msg += name + ":" + params.hea...
javascript
function generateCanonicalRequestMessage(params) { var msg = (params.method === undefined ? "GET" : params.method.toUpperCase()) + "\n" + params.uri.path + "\n" + (params.queryParams ? params.queryParams : "") + "\n"; params.headers.headerNames.forEach(function(name) { msg += name + ":" + params.hea...
[ "function", "generateCanonicalRequestMessage", "(", "params", ")", "{", "var", "msg", "=", "(", "params", ".", "method", "===", "undefined", "?", "\"GET\"", ":", "params", ".", "method", ".", "toUpperCase", "(", ")", ")", "+", "\"\\n\"", "+", "params", "."...
Generate the canonical request message for a set of request parameters. @param {Object} params the request parameters @param {String} params.method the HTTP request method @param {Object} params.uri a parsed URI object for the request @param {String} params.queryParams the canonical query parameters string @param {Obj...
[ "Generate", "the", "canonical", "request", "message", "for", "a", "set", "of", "request", "parameters", "." ]
26848b1c303b98b7c0ddeefb8c68c5f5bf78927e
https://github.com/SolarNetwork/solarnetwork-d3/blob/26848b1c303b98b7c0ddeefb8c68c5f5bf78927e/solarnetwork-d3.js#L6381-L6389
train
SolarNetwork/solarnetwork-d3
solarnetwork-d3.js
function(location) { return Math.sqrt(Math.pow(location.x - this.matrix[4], 2), Math.pow(location.y - this.matrix[5], 2)); }
javascript
function(location) { return Math.sqrt(Math.pow(location.x - this.matrix[4], 2), Math.pow(location.y - this.matrix[5], 2)); }
[ "function", "(", "location", ")", "{", "return", "Math", ".", "sqrt", "(", "Math", ".", "pow", "(", "location", ".", "x", "-", "this", ".", "matrix", "[", "4", "]", ",", "2", ")", ",", "Math", ".", "pow", "(", "location", ".", "y", "-", "this",...
Get the 2D distance between a location and this matrix's translation. @param location a location object, with x,y Number properties @returns {Number} the calculated distance @preserve
[ "Get", "the", "2D", "distance", "between", "a", "location", "and", "this", "matrix", "s", "translation", "." ]
26848b1c303b98b7c0ddeefb8c68c5f5bf78927e
https://github.com/SolarNetwork/solarnetwork-d3/blob/26848b1c303b98b7c0ddeefb8c68c5f5bf78927e/solarnetwork-d3.js#L6911-L6913
train
SolarNetwork/solarnetwork-d3
solarnetwork-d3.js
function(elm) { var m = this.support.use3d === true ? this.toMatrix3D() : this.toMatrix2D(); elm.style[this.support.tProp] = m; }
javascript
function(elm) { var m = this.support.use3d === true ? this.toMatrix3D() : this.toMatrix2D(); elm.style[this.support.tProp] = m; }
[ "function", "(", "elm", ")", "{", "var", "m", "=", "this", ".", "support", ".", "use3d", "===", "true", "?", "this", ".", "toMatrix3D", "(", ")", ":", "this", ".", "toMatrix2D", "(", ")", ";", "elm", ".", "style", "[", "this", ".", "support", "."...
Apply the matrix transform to an element. <p>If {@code support.use3d} is <em>true</em>, the {@link #toMatrix3D()} transform is used, otherwise {@link #toMatrix2D()} is used. Found that legibility of text was too blurry on older displays when 3D transform was applied, but 3D transform provide better performance on hi-r...
[ "Apply", "the", "matrix", "transform", "to", "an", "element", "." ]
26848b1c303b98b7c0ddeefb8c68c5f5bf78927e
https://github.com/SolarNetwork/solarnetwork-d3/blob/26848b1c303b98b7c0ddeefb8c68c5f5bf78927e/solarnetwork-d3.js#L6925-L6928
train
SolarNetwork/solarnetwork-d3
solarnetwork-d3.js
function(elm, finished) { var listener = undefined; var self = this; listener = function(event) { if (event.target === elm) { elm.removeEventListener(self.support.trEndEvent, listener, false); finished.apply(elm); } }; elm.addEventListener(self.support.t...
javascript
function(elm, finished) { var listener = undefined; var self = this; listener = function(event) { if (event.target === elm) { elm.removeEventListener(self.support.trEndEvent, listener, false); finished.apply(elm); } }; elm.addEventListener(self.support.t...
[ "function", "(", "elm", ",", "finished", ")", "{", "var", "listener", "=", "undefined", ";", "var", "self", "=", "this", ";", "listener", "=", "function", "(", "event", ")", "{", "if", "(", "event", ".", "target", "===", "elm", ")", "{", "elm", "."...
Apply a one-time animation callback listener. @param elm the element to add the one-time listener to @param finished @preserve
[ "Apply", "a", "one", "-", "time", "animation", "callback", "listener", "." ]
26848b1c303b98b7c0ddeefb8c68c5f5bf78927e
https://github.com/SolarNetwork/solarnetwork-d3/blob/26848b1c303b98b7c0ddeefb8c68c5f5bf78927e/solarnetwork-d3.js#L6936-L6946
train
SolarNetwork/solarnetwork-d3
solarnetwork-d3.js
function(elm, timing, duration, finished) { var self = this; this.animateListen(elm, function() { elm.style[self.support.trProp] = ""; if (finished !== undefined) { finished.apply(elm); } }); var cssValue = this.support.trTransform + " " + (duration !== undefine...
javascript
function(elm, timing, duration, finished) { var self = this; this.animateListen(elm, function() { elm.style[self.support.trProp] = ""; if (finished !== undefined) { finished.apply(elm); } }); var cssValue = this.support.trTransform + " " + (duration !== undefine...
[ "function", "(", "elm", ",", "timing", ",", "duration", ",", "finished", ")", "{", "var", "self", "=", "this", ";", "this", ".", "animateListen", "(", "elm", ",", "function", "(", ")", "{", "elm", ".", "style", "[", "self", ".", "support", ".", "tr...
Apply the matrix transform to an element, with an "ease out" transition. <p>Calls {@link #apply(elm)} internally.</p> @param {Element} elm the element to apply the transform to @param {String} timing the CSS timing function to use @param {String} duration the CSS duration to use @param {Function} finished an optional...
[ "Apply", "the", "matrix", "transform", "to", "an", "element", "with", "an", "ease", "out", "transition", "." ]
26848b1c303b98b7c0ddeefb8c68c5f5bf78927e
https://github.com/SolarNetwork/solarnetwork-d3/blob/26848b1c303b98b7c0ddeefb8c68c5f5bf78927e/solarnetwork-d3.js#L6959-L6970
train
gyandeeps/load-perf
lib/index.js
check
function check(suppliedOptions){ var options = assign(Object.create(defaultOptions), suppliedOptions || {}); var packageJson = require(path.resolve(process.cwd(), options.package)); var checkDevDependencies = !!options.checkDevDependencies; var checkDependencies = !!options.checkDependencies; var mo...
javascript
function check(suppliedOptions){ var options = assign(Object.create(defaultOptions), suppliedOptions || {}); var packageJson = require(path.resolve(process.cwd(), options.package)); var checkDevDependencies = !!options.checkDevDependencies; var checkDependencies = !!options.checkDependencies; var mo...
[ "function", "check", "(", "suppliedOptions", ")", "{", "var", "options", "=", "assign", "(", "Object", ".", "create", "(", "defaultOptions", ")", ",", "suppliedOptions", "||", "{", "}", ")", ";", "var", "packageJson", "=", "require", "(", "path", ".", "r...
Main function which calculates the times for each modules @param {object} suppliedOptions - Options to be passed in. @return {{moduleTimes: {dependencies: {}, devDependencies: {}}, loadTime: int}}
[ "Main", "function", "which", "calculates", "the", "times", "for", "each", "modules" ]
045eb27e79699db621f57175db7e62e3857c10c0
https://github.com/gyandeeps/load-perf/blob/045eb27e79699db621f57175db7e62e3857c10c0/lib/index.js#L24-L65
train
purtuga/observables
src/objectWatchProp.js
setCallbackAsWatcherOf
function setCallbackAsWatcherOf(callback, watchersSet) { if (!callback[WATCHER_IDENTIFIER]) { defineProperty(callback, WATCHER_IDENTIFIER, { watching: new Set() }); defineProperty(callback, "stopWatchingAll", function(){ callback[WATCHER_IDENTIFIER].watching.forEach(watcherList => ...
javascript
function setCallbackAsWatcherOf(callback, watchersSet) { if (!callback[WATCHER_IDENTIFIER]) { defineProperty(callback, WATCHER_IDENTIFIER, { watching: new Set() }); defineProperty(callback, "stopWatchingAll", function(){ callback[WATCHER_IDENTIFIER].watching.forEach(watcherList => ...
[ "function", "setCallbackAsWatcherOf", "(", "callback", ",", "watchersSet", ")", "{", "if", "(", "!", "callback", "[", "WATCHER_IDENTIFIER", "]", ")", "{", "defineProperty", "(", "callback", ",", "WATCHER_IDENTIFIER", ",", "{", "watching", ":", "new", "Set", "(...
Store a reference to the Set instance provided on input, on the callback. @private @param {Function} callback @param {Set} watchersSet
[ "Store", "a", "reference", "to", "the", "Set", "instance", "provided", "on", "input", "on", "the", "callback", "." ]
68847b1294734c4cd50b26e5f6156a8b460f77a2
https://github.com/purtuga/observables/blob/68847b1294734c4cd50b26e5f6156a8b460f77a2/src/objectWatchProp.js#L428-L441
train
bobmonteverde/d3-simple-tooltip
src/tooltip.js
offsetTop
function offsetTop (elem) { let top = 0 do { if (!isNaN(elem.offsetTop)) top += elem.offsetTop } while (elem = elem.offsetParent) return top }
javascript
function offsetTop (elem) { let top = 0 do { if (!isNaN(elem.offsetTop)) top += elem.offsetTop } while (elem = elem.offsetParent) return top }
[ "function", "offsetTop", "(", "elem", ")", "{", "let", "top", "=", "0", "do", "{", "if", "(", "!", "isNaN", "(", "elem", ".", "offsetTop", ")", ")", "top", "+=", "elem", ".", "offsetTop", "}", "while", "(", "elem", "=", "elem", ".", "offsetParent",...
Recursively calculate top offset of an element from the body
[ "Recursively", "calculate", "top", "offset", "of", "an", "element", "from", "the", "body" ]
19994f5bc61cea303b7a855d1aebfccd3220abf6
https://github.com/bobmonteverde/d3-simple-tooltip/blob/19994f5bc61cea303b7a855d1aebfccd3220abf6/src/tooltip.js#L23-L31
train
bobmonteverde/d3-simple-tooltip
src/tooltip.js
offsetLeft
function offsetLeft (elem) { let left = 0 do { if (!isNaN(elem.offsetLeft)) left += elem.offsetLeft } while (elem = elem.offsetParent ) return left }
javascript
function offsetLeft (elem) { let left = 0 do { if (!isNaN(elem.offsetLeft)) left += elem.offsetLeft } while (elem = elem.offsetParent ) return left }
[ "function", "offsetLeft", "(", "elem", ")", "{", "let", "left", "=", "0", "do", "{", "if", "(", "!", "isNaN", "(", "elem", ".", "offsetLeft", ")", ")", "left", "+=", "elem", ".", "offsetLeft", "}", "while", "(", "elem", "=", "elem", ".", "offsetPar...
Recursively calculate left offset of an element from the body
[ "Recursively", "calculate", "left", "offset", "of", "an", "element", "from", "the", "body" ]
19994f5bc61cea303b7a855d1aebfccd3220abf6
https://github.com/bobmonteverde/d3-simple-tooltip/blob/19994f5bc61cea303b7a855d1aebfccd3220abf6/src/tooltip.js#L34-L42
train
cirocosta/yaspm
src/spm.js
enhanceSpm
function enhanceSpm (comName, checkSignature, fn) { var sp = new SerialPort(comName) , open = false; sp.writable = true; sp.on('open', function() { open = true; if (checkSignature) getSignature(sp, function(e, sig) { fn(e, sp, sig); }); else fn(null, sp, null); }); ...
javascript
function enhanceSpm (comName, checkSignature, fn) { var sp = new SerialPort(comName) , open = false; sp.writable = true; sp.on('open', function() { open = true; if (checkSignature) getSignature(sp, function(e, sig) { fn(e, sp, sig); }); else fn(null, sp, null); }); ...
[ "function", "enhanceSpm", "(", "comName", ",", "checkSignature", ",", "fn", ")", "{", "var", "sp", "=", "new", "SerialPort", "(", "comName", ")", ",", "open", "=", "false", ";", "sp", ".", "writable", "=", "true", ";", "sp", ".", "on", "(", "'open'",...
Main function to be exported. It exposes a better serialport. @param {[type]} comName the comName returned from the port listing @param {Function} fn callback function to be called with (err|sp|signature)
[ "Main", "function", "to", "be", "exported", ".", "It", "exposes", "a", "better", "serialport", "." ]
676524906425ba99b1e6f95a75ce4a82501a0ee9
https://github.com/cirocosta/yaspm/blob/676524906425ba99b1e6f95a75ce4a82501a0ee9/src/spm.js#L15-L35
train
cirocosta/yaspm
src/spm.js
getSignature
function getSignature (sp, fn) { var start = null , sig = '' , timer; var handleSignature = function(data) { if (data) sig += data.toString() || ''; clearTimeout(timer); if (!start && data) { start = Date.now(); } else if (Date.now() - start > 100) { sp.removeListener('d...
javascript
function getSignature (sp, fn) { var start = null , sig = '' , timer; var handleSignature = function(data) { if (data) sig += data.toString() || ''; clearTimeout(timer); if (!start && data) { start = Date.now(); } else if (Date.now() - start > 100) { sp.removeListener('d...
[ "function", "getSignature", "(", "sp", ",", "fn", ")", "{", "var", "start", "=", "null", ",", "sig", "=", "''", ",", "timer", ";", "var", "handleSignature", "=", "function", "(", "data", ")", "{", "if", "(", "data", ")", "sig", "+=", "data", ".", ...
Given a SerialPort obj, tries to get the signature emitted from the device. @param {Object} sp sp @param {Function} fn callback fn. Resolves with (err | serialport | signature) when ready.
[ "Given", "a", "SerialPort", "obj", "tries", "to", "get", "the", "signature", "emitted", "from", "the", "device", "." ]
676524906425ba99b1e6f95a75ce4a82501a0ee9
https://github.com/cirocosta/yaspm/blob/676524906425ba99b1e6f95a75ce4a82501a0ee9/src/spm.js#L45-L67
train
BladeRunnerJS/emitr
src/Emitter.js
listen
function listen(eventIdentifier, callback, context) { if (typeof callback !== 'function') { throw new TypeError('on: Illegal Argument: callback must be a function, was ' + (typeof callback)); } // This allows us to work even if the constructor hasn't been called. Useful for mixins. if (this._emitterListeners ==...
javascript
function listen(eventIdentifier, callback, context) { if (typeof callback !== 'function') { throw new TypeError('on: Illegal Argument: callback must be a function, was ' + (typeof callback)); } // This allows us to work even if the constructor hasn't been called. Useful for mixins. if (this._emitterListeners ==...
[ "function", "listen", "(", "eventIdentifier", ",", "callback", ",", "context", ")", "{", "if", "(", "typeof", "callback", "!==", "'function'", ")", "{", "throw", "new", "TypeError", "(", "'on: Illegal Argument: callback must be a function, was '", "+", "(", "typeof"...
Registers a listener for an event. If context is provided, then the <code>this</code> pointer will refer to it inside the callback. @param {*} eventIdentifier The identifier of the event that the callback should listen to. @param {function} callback The function that should be called whenever the event is triggered. ...
[ "Registers", "a", "listener", "for", "an", "event", "." ]
66ec84c3db3ff0f83a6ced87b805b2d3934d5613
https://github.com/BladeRunnerJS/emitr/blob/66ec84c3db3ff0f83a6ced87b805b2d3934d5613/src/Emitter.js#L70-L105
train
BladeRunnerJS/emitr
src/Emitter.js
function(eventIdentifier, callback, context) { if (typeof callback !== 'function') { throw new TypeError('once: Illegal Argument: callback must be a function, was ' + (typeof callback)); } var off = this.off.bind(this), hasFired = false; function onceEventHandler() { if (hasFired === false) { hasFired = ...
javascript
function(eventIdentifier, callback, context) { if (typeof callback !== 'function') { throw new TypeError('once: Illegal Argument: callback must be a function, was ' + (typeof callback)); } var off = this.off.bind(this), hasFired = false; function onceEventHandler() { if (hasFired === false) { hasFired = ...
[ "function", "(", "eventIdentifier", ",", "callback", ",", "context", ")", "{", "if", "(", "typeof", "callback", "!==", "'function'", ")", "{", "throw", "new", "TypeError", "(", "'once: Illegal Argument: callback must be a function, was '", "+", "(", "typeof", "callb...
Registers a listener to receive an event only once. If context is provided, then the <code>this</code> pointer will refer to it inside the callback. @param {*} eventIdentifier The identifier of the event that the callback should listen to. @param {function} callback The function that should be called the first time t...
[ "Registers", "a", "listener", "to", "receive", "an", "event", "only", "once", "." ]
66ec84c3db3ff0f83a6ced87b805b2d3934d5613
https://github.com/BladeRunnerJS/emitr/blob/66ec84c3db3ff0f83a6ced87b805b2d3934d5613/src/Emitter.js#L117-L135
train
BladeRunnerJS/emitr
src/Emitter.js
off
function off(eventIdentifier, callback, context) { // not initialised - so no listeners of any kind if (this._emitterListeners == null) { return false; } if (arguments.length === 0) { // clear all listeners. if (this._emitterMetaEventsOn === true) { var allListeners = this._emitterListeners.getValues()...
javascript
function off(eventIdentifier, callback, context) { // not initialised - so no listeners of any kind if (this._emitterListeners == null) { return false; } if (arguments.length === 0) { // clear all listeners. if (this._emitterMetaEventsOn === true) { var allListeners = this._emitterListeners.getValues()...
[ "function", "off", "(", "eventIdentifier", ",", "callback", ",", "context", ")", "{", "// not initialised - so no listeners of any kind", "if", "(", "this", ".", "_emitterListeners", "==", "null", ")", "{", "return", "false", ";", "}", "if", "(", "arguments", "....
Clear previously registered listeners. With no arguments, this clears all listeners from this Emitter. With one argument, this clears all listeners registered to a particular event. With two or three arguments, this clears a specific listener. @param {?*} eventIdentifier The identifier of the event to clear. If nul...
[ "Clear", "previously", "registered", "listeners", "." ]
66ec84c3db3ff0f83a6ced87b805b2d3934d5613
https://github.com/BladeRunnerJS/emitr/blob/66ec84c3db3ff0f83a6ced87b805b2d3934d5613/src/Emitter.js#L151-L193
train
BladeRunnerJS/emitr
src/Emitter.js
trigger
function trigger(event) { var args; var anyListeners = false; if (this._emitterListeners != null) { args = slice.call(arguments, 1); if (this._emitterListeners.hasAny(event)) { anyListeners = true; notify(this._emitterListeners.getValues(event), Emitter.suppressErrors, args); } // navigate up...
javascript
function trigger(event) { var args; var anyListeners = false; if (this._emitterListeners != null) { args = slice.call(arguments, 1); if (this._emitterListeners.hasAny(event)) { anyListeners = true; notify(this._emitterListeners.getValues(event), Emitter.suppressErrors, args); } // navigate up...
[ "function", "trigger", "(", "event", ")", "{", "var", "args", ";", "var", "anyListeners", "=", "false", ";", "if", "(", "this", ".", "_emitterListeners", "!=", "null", ")", "{", "args", "=", "slice", ".", "call", "(", "arguments", ",", "1", ")", ";",...
Fires an event, causing all the listeners registered for this event to be called. If the event is an object, this will also call any listeners registered for its class or any superclasses will also fire. @param {*} event The event to fire. @param {...*} [args] Optional arguments to pass to the listeners. @returns {bo...
[ "Fires", "an", "event", "causing", "all", "the", "listeners", "registered", "for", "this", "event", "to", "be", "called", "." ]
66ec84c3db3ff0f83a6ced87b805b2d3934d5613
https://github.com/BladeRunnerJS/emitr/blob/66ec84c3db3ff0f83a6ced87b805b2d3934d5613/src/Emitter.js#L205-L232
train
BladeRunnerJS/emitr
src/Emitter.js
clearListeners
function clearListeners(context) { if (context == null) { throw new Error('clearListeners: context must be provided.'); } // notify for every listener we throw out. var removedListeners, trackRemovals = false; if (this._emitterMetaEventsOn === true) { trackRemovals = true; removedListeners = []; } thi...
javascript
function clearListeners(context) { if (context == null) { throw new Error('clearListeners: context must be provided.'); } // notify for every listener we throw out. var removedListeners, trackRemovals = false; if (this._emitterMetaEventsOn === true) { trackRemovals = true; removedListeners = []; } thi...
[ "function", "clearListeners", "(", "context", ")", "{", "if", "(", "context", "==", "null", ")", "{", "throw", "new", "Error", "(", "'clearListeners: context must be provided.'", ")", ";", "}", "// notify for every listener we throw out.", "var", "removedListeners", "...
Clears all listeners registered for a particular context. @param {Object} context The context that all listeners should be removed for. May not be null.
[ "Clears", "all", "listeners", "registered", "for", "a", "particular", "context", "." ]
66ec84c3db3ff0f83a6ced87b805b2d3934d5613
https://github.com/BladeRunnerJS/emitr/blob/66ec84c3db3ff0f83a6ced87b805b2d3934d5613/src/Emitter.js#L239-L257
train
highly-attractive-people/jsonapi-relate
index.js
getIncluded
function getIncluded(payload, type, id) { for (var i = payload.included.length - 1; i >= 0; i--) { if (payload.included[i].id === id && payload.included[i].type === type) { return payload.included[i]; } } }
javascript
function getIncluded(payload, type, id) { for (var i = payload.included.length - 1; i >= 0; i--) { if (payload.included[i].id === id && payload.included[i].type === type) { return payload.included[i]; } } }
[ "function", "getIncluded", "(", "payload", ",", "type", ",", "id", ")", "{", "for", "(", "var", "i", "=", "payload", ".", "included", ".", "length", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "if", "(", "payload", ".", "included", ...
Fetches an included object from a payload by its id @param {Object} payload The payload encapsulating the included data @param {String} type The entity type to retrieve @param {String} id The id of the desired included data @return {Object} The found included data
[ "Fetches", "an", "included", "object", "from", "a", "payload", "by", "its", "id" ]
60da29962ea0fc2767b6d87d0bf8b25669eb996d
https://github.com/highly-attractive-people/jsonapi-relate/blob/60da29962ea0fc2767b6d87d0bf8b25669eb996d/index.js#L14-L20
train
highly-attractive-people/jsonapi-relate
index.js
getDeepRelationship
function getDeepRelationship(payload, parentResource, deepKey) { var path = deepKey.split('.'); var subResources = parentResource; for (var i = 0; i < path.length; i++) { if (Array.isArray(subResources)) { subResources = subResources.reduce(function (results, subResource) { return results.concat...
javascript
function getDeepRelationship(payload, parentResource, deepKey) { var path = deepKey.split('.'); var subResources = parentResource; for (var i = 0; i < path.length; i++) { if (Array.isArray(subResources)) { subResources = subResources.reduce(function (results, subResource) { return results.concat...
[ "function", "getDeepRelationship", "(", "payload", ",", "parentResource", ",", "deepKey", ")", "{", "var", "path", "=", "deepKey", ".", "split", "(", "'.'", ")", ";", "var", "subResources", "=", "parentResource", ";", "for", "(", "var", "i", "=", "0", ";...
Fetches specified related data associated to a resource, and related data assocociated to that included resource... @param {Object} payload The payload encapsulating the included data @param {Object} parentResource The first resource to find included data for @param {String} deepKey The relationship to included data t...
[ "Fetches", "specified", "related", "data", "associated", "to", "a", "resource", "and", "related", "data", "assocociated", "to", "that", "included", "resource", "..." ]
60da29962ea0fc2767b6d87d0bf8b25669eb996d
https://github.com/highly-attractive-people/jsonapi-relate/blob/60da29962ea0fc2767b6d87d0bf8b25669eb996d/index.js#L86-L102
train
rkaw92/esdf
EventSourcedAggregate.js
AggregateTypeMismatch
function AggregateTypeMismatch(expected, got){ this.name = 'AggregateTypeMismatch'; this.message = 'Aggregate type mismatch: expected (' + typeof(expected) + ')' + expected + ', got (' + typeof(got) + ')' + got; this.labels = { expected: expected, got: got, critical: true // This error precludes retry attempts...
javascript
function AggregateTypeMismatch(expected, got){ this.name = 'AggregateTypeMismatch'; this.message = 'Aggregate type mismatch: expected (' + typeof(expected) + ')' + expected + ', got (' + typeof(got) + ')' + got; this.labels = { expected: expected, got: got, critical: true // This error precludes retry attempts...
[ "function", "AggregateTypeMismatch", "(", "expected", ",", "got", ")", "{", "this", ".", "name", "=", "'AggregateTypeMismatch'", ";", "this", ".", "message", "=", "'Aggregate type mismatch: expected ('", "+", "typeof", "(", "expected", ")", "+", "')'", "+", "exp...
Aggregate-event type mismatch. Generated when a commit labelled with another AggregateType is applied to an aggregate. Also occurs when a snapshot type mismatch takes place. This prevents loading an aggregateID as another, unrelated aggregate type and trashing the database or bypassing logic restrictions. @constructor ...
[ "Aggregate", "-", "event", "type", "mismatch", ".", "Generated", "when", "a", "commit", "labelled", "with", "another", "AggregateType", "is", "applied", "to", "an", "aggregate", ".", "Also", "occurs", "when", "a", "snapshot", "type", "mismatch", "takes", "plac...
9c6bd2c278428096cb8c1ceeca62a5493d19613e
https://github.com/rkaw92/esdf/blob/9c6bd2c278428096cb8c1ceeca62a5493d19613e/EventSourcedAggregate.js#L21-L29
train
four43/admiral-cli
lib/error/abstract-error.js
AbstractCliError
function AbstractCliError(message, statusCode) { Error.call(this, message, statusCode); Error.captureStackTrace(this, AbstractCliError); this.message = message || this.message }
javascript
function AbstractCliError(message, statusCode) { Error.call(this, message, statusCode); Error.captureStackTrace(this, AbstractCliError); this.message = message || this.message }
[ "function", "AbstractCliError", "(", "message", ",", "statusCode", ")", "{", "Error", ".", "call", "(", "this", ",", "message", ",", "statusCode", ")", ";", "Error", ".", "captureStackTrace", "(", "this", ",", "AbstractCliError", ")", ";", "this", ".", "me...
Abstract CLI Error General error for CLI, all errors are children of this. @param message @param statusCode @constructor
[ "Abstract", "CLI", "Error" ]
f6049dbb783a2c85c601c09ba7abc7dd87bd11fe
https://github.com/four43/admiral-cli/blob/f6049dbb783a2c85c601c09ba7abc7dd87bd11fe/lib/error/abstract-error.js#L10-L15
train
leoasis/makery.js
makery.js
createInstanceOf
function createInstanceOf(ctor, args) { var tempCtor = function() { // This will return the instance or the explicit return of the ctor // accordingly. // Remember that if you return a primitive type, the constructor will // still return the object instance. return ctor.apply(this, arg...
javascript
function createInstanceOf(ctor, args) { var tempCtor = function() { // This will return the instance or the explicit return of the ctor // accordingly. // Remember that if you return a primitive type, the constructor will // still return the object instance. return ctor.apply(this, arg...
[ "function", "createInstanceOf", "(", "ctor", ",", "args", ")", "{", "var", "tempCtor", "=", "function", "(", ")", "{", "// This will return the instance or the explicit return of the ctor", "// accordingly.", "// Remember that if you return a primitive type, the constructor will", ...
We need a custom creation of an instance because we cannot pass a dynamic amount of args into a constructor when calling them with "new", so we must first call it with a fake constructor with the same prototype and then apply the real one with the correct args.
[ "We", "need", "a", "custom", "creation", "of", "an", "instance", "because", "we", "cannot", "pass", "a", "dynamic", "amount", "of", "args", "into", "a", "constructor", "when", "calling", "them", "with", "new", "so", "we", "must", "first", "call", "it", "...
f50201fa2054eb9b8f66f48a1126c4872a569483
https://github.com/leoasis/makery.js/blob/f50201fa2054eb9b8f66f48a1126c4872a569483/makery.js#L87-L98
train
scisco/yaml-files
bin/cli.js
merge
function merge(input, output) { const text = fs.readFileSync(input, 'utf8'); const loaded = yaml.safeLoad(text.toString(), { schema: yamlfiles.YAML_FILES_SCHEMA }); // write to output fs.writeFileSync(output, yaml.safeDump(loaded)); return output; }
javascript
function merge(input, output) { const text = fs.readFileSync(input, 'utf8'); const loaded = yaml.safeLoad(text.toString(), { schema: yamlfiles.YAML_FILES_SCHEMA }); // write to output fs.writeFileSync(output, yaml.safeDump(loaded)); return output; }
[ "function", "merge", "(", "input", ",", "output", ")", "{", "const", "text", "=", "fs", ".", "readFileSync", "(", "input", ",", "'utf8'", ")", ";", "const", "loaded", "=", "yaml", ".", "safeLoad", "(", "text", ".", "toString", "(", ")", ",", "{", "...
parse-merge a given yaml file and save it to a given output @param {string} input - input yaml file path @param {string} output - output yaml file path @returns {string} the output path
[ "parse", "-", "merge", "a", "given", "yaml", "file", "and", "save", "it", "to", "a", "given", "output" ]
71de1364800a24a5cf86b12264fb6345eaf8f283
https://github.com/scisco/yaml-files/blob/71de1364800a24a5cf86b12264fb6345eaf8f283/bin/cli.js#L17-L24
train
aleclarson/quest
index.js
concat
function concat(res, done) { const chunks = [] res .on('data', chunk => { chunks.push(chunk) }) .on('end', () => { done(Buffer.concat(chunks)) }) }
javascript
function concat(res, done) { const chunks = [] res .on('data', chunk => { chunks.push(chunk) }) .on('end', () => { done(Buffer.concat(chunks)) }) }
[ "function", "concat", "(", "res", ",", "done", ")", "{", "const", "chunks", "=", "[", "]", "res", ".", "on", "(", "'data'", ",", "chunk", "=>", "{", "chunks", ".", "push", "(", "chunk", ")", "}", ")", ".", "on", "(", "'end'", ",", "(", ")", "...
Buffer the entire stream into memory.
[ "Buffer", "the", "entire", "stream", "into", "memory", "." ]
c8f9e1729304aebe6ed6a805f4798f2945eebd2a
https://github.com/aleclarson/quest/blob/c8f9e1729304aebe6ed6a805f4798f2945eebd2a/index.js#L194-L203
train
linyngfly/omelo
lib/util/appUtil.js
function(app, args) { let serverType = args.serverType || Constants.RESERVED.MASTER; let serverId = args.id || app.getMaster().id; let mode = args.mode || Constants.RESERVED.CLUSTER; let masterha = args.masterha || 'false'; let type = args.type || Constants.RESERVED.ALL; let startId = args.startId; app.s...
javascript
function(app, args) { let serverType = args.serverType || Constants.RESERVED.MASTER; let serverId = args.id || app.getMaster().id; let mode = args.mode || Constants.RESERVED.CLUSTER; let masterha = args.masterha || 'false'; let type = args.type || Constants.RESERVED.ALL; let startId = args.startId; app.s...
[ "function", "(", "app", ",", "args", ")", "{", "let", "serverType", "=", "args", ".", "serverType", "||", "Constants", ".", "RESERVED", ".", "MASTER", ";", "let", "serverId", "=", "args", ".", "id", "||", "app", ".", "getMaster", "(", ")", ".", "id",...
Process server start command
[ "Process", "server", "start", "command" ]
fb5f79fa31c69de36bd1c370bad5edfa753ca601
https://github.com/linyngfly/omelo/blob/fb5f79fa31c69de36bd1c370bad5edfa753ca601/lib/util/appUtil.js#L163-L188
train
yanatan16/node-redis-eval
index.js
onerror
function onerror(cb) { return function (err) { if (err) { shas = {} arguments[0] = err instanceof Error ? err : new Error(err.toString()) } cb.apply(null, arguments) } }
javascript
function onerror(cb) { return function (err) { if (err) { shas = {} arguments[0] = err instanceof Error ? err : new Error(err.toString()) } cb.apply(null, arguments) } }
[ "function", "onerror", "(", "cb", ")", "{", "return", "function", "(", "err", ")", "{", "if", "(", "err", ")", "{", "shas", "=", "{", "}", "arguments", "[", "0", "]", "=", "err", "instanceof", "Error", "?", "err", ":", "new", "Error", "(", "err",...
If an error occurs, we must be prudent and assume data was lost. We clean the shas cache.
[ "If", "an", "error", "occurs", "we", "must", "be", "prudent", "and", "assume", "data", "was", "lost", ".", "We", "clean", "the", "shas", "cache", "." ]
8ce7fda84a8246e8e8f9d39ab3caca506a4960f7
https://github.com/yanatan16/node-redis-eval/blob/8ce7fda84a8246e8e8f9d39ab3caca506a4960f7/index.js#L51-L59
train
yanatan16/node-redis-eval
index.js
evalSha
function evalSha(redis, sha, keys, args, callback) { if (sha) { return redis.evalsha.apply(redis, _.flatten([sha, keys.length, keys, args, callback])); } return callback(new Error('evalsha called for not loaded script')); }
javascript
function evalSha(redis, sha, keys, args, callback) { if (sha) { return redis.evalsha.apply(redis, _.flatten([sha, keys.length, keys, args, callback])); } return callback(new Error('evalsha called for not loaded script')); }
[ "function", "evalSha", "(", "redis", ",", "sha", ",", "keys", ",", "args", ",", "callback", ")", "{", "if", "(", "sha", ")", "{", "return", "redis", ".", "evalsha", ".", "apply", "(", "redis", ",", "_", ".", "flatten", "(", "[", "sha", ",", "keys...
Evaluate a script that is already loaded
[ "Evaluate", "a", "script", "that", "is", "already", "loaded" ]
8ce7fda84a8246e8e8f9d39ab3caca506a4960f7
https://github.com/yanatan16/node-redis-eval/blob/8ce7fda84a8246e8e8f9d39ab3caca506a4960f7/index.js#L84-L89
train
yanatan16/node-redis-eval
index.js
loadScript
function loadScript(redis, script_name, script, callback) { redis.multi() .script('load', script) .exec(function (err, sha1) { if (err) { return callback(err); } shas[script_name] = sha1 && sha1.length && sha1[0]; callback(null, sha1); }); }
javascript
function loadScript(redis, script_name, script, callback) { redis.multi() .script('load', script) .exec(function (err, sha1) { if (err) { return callback(err); } shas[script_name] = sha1 && sha1.length && sha1[0]; callback(null, sha1); }); }
[ "function", "loadScript", "(", "redis", ",", "script_name", ",", "script", ",", "callback", ")", "{", "redis", ".", "multi", "(", ")", ".", "script", "(", "'load'", ",", "script", ")", ".", "exec", "(", "function", "(", "err", ",", "sha1", ")", "{", ...
Load a script into the script cache
[ "Load", "a", "script", "into", "the", "script", "cache" ]
8ce7fda84a8246e8e8f9d39ab3caca506a4960f7
https://github.com/yanatan16/node-redis-eval/blob/8ce7fda84a8246e8e8f9d39ab3caca506a4960f7/index.js#L92-L102
train
linyngfly/omelo
lib/master/starter.js
function(command, host, options, cb) { let child = null; if(env === Constants.RESERVED.ENV_DEV) { child = cp.spawn(command, options); let prefix = command === Constants.COMMAND.SSH ? '[' + host + '] ' : ''; child.stderr.on('data', function (chunk) { let msg = chunk.toString(); process.stde...
javascript
function(command, host, options, cb) { let child = null; if(env === Constants.RESERVED.ENV_DEV) { child = cp.spawn(command, options); let prefix = command === Constants.COMMAND.SSH ? '[' + host + '] ' : ''; child.stderr.on('data', function (chunk) { let msg = chunk.toString(); process.stde...
[ "function", "(", "command", ",", "host", ",", "options", ",", "cb", ")", "{", "let", "child", "=", "null", ";", "if", "(", "env", "===", "Constants", ".", "RESERVED", ".", "ENV_DEV", ")", "{", "child", "=", "cp", ".", "spawn", "(", "command", ",", ...
Fork child process to run command. @param {String} command @param {Object} options @param {Callback} callback
[ "Fork", "child", "process", "to", "run", "command", "." ]
fb5f79fa31c69de36bd1c370bad5edfa753ca601
https://github.com/linyngfly/omelo/blob/fb5f79fa31c69de36bd1c370bad5edfa753ca601/lib/master/starter.js#L188-L220
train
tmpfs/ttycolor
lib/parse.js
opt
function opt(argv, arg, index, key) { var value = argv[index + 1], equals = arg.indexOf('='); if(equals > -1) { value = arg.substr(equals + 1); } if(value && ~keys.indexOf(value)) { return value; } if(arg === option[key]) { return modes[key]; } }
javascript
function opt(argv, arg, index, key) { var value = argv[index + 1], equals = arg.indexOf('='); if(equals > -1) { value = arg.substr(equals + 1); } if(value && ~keys.indexOf(value)) { return value; } if(arg === option[key]) { return modes[key]; } }
[ "function", "opt", "(", "argv", ",", "arg", ",", "index", ",", "key", ")", "{", "var", "value", "=", "argv", "[", "index", "+", "1", "]", ",", "equals", "=", "arg", ".", "indexOf", "(", "'='", ")", ";", "if", "(", "equals", ">", "-", "1", ")"...
parse long options
[ "parse", "long", "options" ]
4b72de7f61bfd922f227f3f4e7c61fb95ff9c023
https://github.com/tmpfs/ttycolor/blob/4b72de7f61bfd922f227f3f4e7c61fb95ff9c023/lib/parse.js#L33-L44
train
twolfson/fs-memory-store
lib/fs-memory-store.js
Store
function Store(dir, options) { // Specify the directory and its options assert(dir, '`Store` expected a `dir` (directory) to be passed in but it was not defined'); this.dir = dir; this.memoryCache = {}; // Fallback options options = options || {}; this.ext = options.ext || Store.ext; this.stringify = o...
javascript
function Store(dir, options) { // Specify the directory and its options assert(dir, '`Store` expected a `dir` (directory) to be passed in but it was not defined'); this.dir = dir; this.memoryCache = {}; // Fallback options options = options || {}; this.ext = options.ext || Store.ext; this.stringify = o...
[ "function", "Store", "(", "dir", ",", "options", ")", "{", "// Specify the directory and its options", "assert", "(", "dir", ",", "'`Store` expected a `dir` (directory) to be passed in but it was not defined'", ")", ";", "this", ".", "dir", "=", "dir", ";", "this", ".",...
Filesystem storage system with in-memory cache @param dir {String} Directory to generate our store inside of @param options {Object} Container for options/flags @param [options.ext='.json'] {String} Optional extension to save values under @param [options.stringify=JSON.stringify] {Function} Optional stringifier to pass...
[ "Filesystem", "storage", "system", "with", "in", "-", "memory", "cache" ]
2f3b6e336097ec1d5f1a29c4ecbed70fbece1032
https://github.com/twolfson/fs-memory-store/blob/2f3b6e336097ec1d5f1a29c4ecbed70fbece1032/lib/fs-memory-store.js#L16-L27
train
soldair/node-repipe
index.js
resumeable
function resumeable(last,source,s){ source.last = last; source.on('data',function(data){ source.last = data; s.write(data); }) var onPause = function(){ source.pause(); }; var onDrain = function(){ source.resume(); }; var onEnd = function(){ source.end(); }; var cleanup = fun...
javascript
function resumeable(last,source,s){ source.last = last; source.on('data',function(data){ source.last = data; s.write(data); }) var onPause = function(){ source.pause(); }; var onDrain = function(){ source.resume(); }; var onEnd = function(){ source.end(); }; var cleanup = fun...
[ "function", "resumeable", "(", "last", ",", "source", ",", "s", ")", "{", "source", ".", "last", "=", "last", ";", "source", ".", "on", "(", "'data'", ",", "function", "(", "data", ")", "{", "source", ".", "last", "=", "data", ";", "s", ".", "wri...
its kinda like pipe except everythig bubbles.
[ "its", "kinda", "like", "pipe", "except", "everythig", "bubbles", "." ]
b7e67005a4c49e2820eb08f036b2d441dbf31091
https://github.com/soldair/node-repipe/blob/b7e67005a4c49e2820eb08f036b2d441dbf31091/index.js#L34-L74
train
bvalosek/grunt-infusionsoft
tasks/generator/Scraper.js
function() { var url = this.docsUrl; var _this = this; var d = Q.defer(); // Need to create an array of promises for all the pages and their hash Q.nfcall(request, url + '/api-docs').then(function(data) { var $ = cheerio.load(data); var list...
javascript
function() { var url = this.docsUrl; var _this = this; var d = Q.defer(); // Need to create an array of promises for all the pages and their hash Q.nfcall(request, url + '/api-docs').then(function(data) { var $ = cheerio.load(data); var list...
[ "function", "(", ")", "{", "var", "url", "=", "this", ".", "docsUrl", ";", "var", "_this", "=", "this", ";", "var", "d", "=", "Q", ".", "defer", "(", ")", ";", "// Need to create an array of promises for all the pages and their hash", "Q", ".", "nfcall", "("...
Get a promise representing an eventua lhash for all the infusionsoft API service calls
[ "Get", "a", "promise", "representing", "an", "eventua", "lhash", "for", "all", "the", "infusionsoft", "API", "service", "calls" ]
847dfde26021cb228ea4004c6a6d148d56e95703
https://github.com/bvalosek/grunt-infusionsoft/blob/847dfde26021cb228ea4004c6a6d148d56e95703/tasks/generator/Scraper.js#L29-L63
train
bvalosek/grunt-infusionsoft
tasks/generator/Scraper.js
function() { var url = this.tableUrl; var _this = this; var d = new Q.defer(); var tableInfo; this.getTableInfo() .then(function(info) { tableInfo = info; return Q.nfcall(request, url + '/index.html'); }) .the...
javascript
function() { var url = this.tableUrl; var _this = this; var d = new Q.defer(); var tableInfo; this.getTableInfo() .then(function(info) { tableInfo = info; return Q.nfcall(request, url + '/index.html'); }) .the...
[ "function", "(", ")", "{", "var", "url", "=", "this", ".", "tableUrl", ";", "var", "_this", "=", "this", ";", "var", "d", "=", "new", "Q", ".", "defer", "(", ")", ";", "var", "tableInfo", ";", "this", ".", "getTableInfo", "(", ")", ".", "then", ...
Load all the tables up
[ "Load", "all", "the", "tables", "up" ]
847dfde26021cb228ea4004c6a6d148d56e95703
https://github.com/bvalosek/grunt-infusionsoft/blob/847dfde26021cb228ea4004c6a6d148d56e95703/tasks/generator/Scraper.js#L66-L103
train
bvalosek/grunt-infusionsoft
tasks/generator/Scraper.js
function(tableUrl) { var _this = this; return Q.nfcall(request, tableUrl).then(function(data) { var $ = cheerio.load(data); var title = $('h2').first().text(); var $rows = $('table tr'); _this.tables.push(title); var ret = { ...
javascript
function(tableUrl) { var _this = this; return Q.nfcall(request, tableUrl).then(function(data) { var $ = cheerio.load(data); var title = $('h2').first().text(); var $rows = $('table tr'); _this.tables.push(title); var ret = { ...
[ "function", "(", "tableUrl", ")", "{", "var", "_this", "=", "this", ";", "return", "Q", ".", "nfcall", "(", "request", ",", "tableUrl", ")", ".", "then", "(", "function", "(", "data", ")", "{", "var", "$", "=", "cheerio", ".", "load", "(", "data", ...
Scrape the actual table page to get the individiual fields
[ "Scrape", "the", "actual", "table", "page", "to", "get", "the", "individiual", "fields" ]
847dfde26021cb228ea4004c6a6d148d56e95703
https://github.com/bvalosek/grunt-infusionsoft/blob/847dfde26021cb228ea4004c6a6d148d56e95703/tasks/generator/Scraper.js#L127-L162
train