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
layerhq/node-layer-webhooks
lib/webhooks.js
function(webhookId, callback) { utils.debug('Webhooks get: ' + webhookId); request.get({ path: '/webhooks/' + utils.toUUID(webhookId), }, callback); }
javascript
function(webhookId, callback) { utils.debug('Webhooks get: ' + webhookId); request.get({ path: '/webhooks/' + utils.toUUID(webhookId), }, callback); }
[ "function", "(", "webhookId", ",", "callback", ")", "{", "utils", ".", "debug", "(", "'Webhooks get: '", "+", "webhookId", ")", ";", "request", ".", "get", "(", "{", "path", ":", "'/webhooks/'", "+", "utils", ".", "toUUID", "(", "webhookId", ")", ",", ...
Get a webhook @param {String} webhookId @param {Function} callback Callback function
[ "Get", "a", "webhook" ]
9bfbee048c03d3ba4474a3490085626cd8a7a0df
https://github.com/layerhq/node-layer-webhooks/blob/9bfbee048c03d3ba4474a3490085626cd8a7a0df/lib/webhooks.js#L101-L106
train
SolarNetwork/solarnetwork-d3
src/chart/baseGroupedStackTimeBarChart.js
xBarPadding
function xBarPadding() { var domain = xBar.domain(); var barSpacing = (domain.length > 1 ? (xBar(domain[1]) - xBar(domain[0])) : xBar.rangeBand()); var barPadding = (barSpacing - xBar.rangeBand()); return barPadding; }
javascript
function xBarPadding() { var domain = xBar.domain(); var barSpacing = (domain.length > 1 ? (xBar(domain[1]) - xBar(domain[0])) : xBar.rangeBand()); var barPadding = (barSpacing - xBar.rangeBand()); return barPadding; }
[ "function", "xBarPadding", "(", ")", "{", "var", "domain", "=", "xBar", ".", "domain", "(", ")", ";", "var", "barSpacing", "=", "(", "domain", ".", "length", ">", "1", "?", "(", "xBar", "(", "domain", "[", "1", "]", ")", "-", "xBar", "(", "domain...
Get the number of pixels used for padding between bars. @returns {Number} the number of pixels padding between each bar
[ "Get", "the", "number", "of", "pixels", "used", "for", "padding", "between", "bars", "." ]
26848b1c303b98b7c0ddeefb8c68c5f5bf78927e
https://github.com/SolarNetwork/solarnetwork-d3/blob/26848b1c303b98b7c0ddeefb8c68c5f5bf78927e/src/chart/baseGroupedStackTimeBarChart.js#L146-L153
train
SolarNetwork/solarnetwork-d3
src/chart/baseGroupedStackTimeBarChart.js
trimToXDomain
function trimToXDomain(array) { var start = 0, len = array.length, xDomainStart = parent.x.domain()[0]; // remove any data earlier than first full range while ( start < len ) { if ( array[start].date.getTime() >= xDomainStart.getTime() ) { break; } start += 1; } return (start === 0 ? arr...
javascript
function trimToXDomain(array) { var start = 0, len = array.length, xDomainStart = parent.x.domain()[0]; // remove any data earlier than first full range while ( start < len ) { if ( array[start].date.getTime() >= xDomainStart.getTime() ) { break; } start += 1; } return (start === 0 ? arr...
[ "function", "trimToXDomain", "(", "array", ")", "{", "var", "start", "=", "0", ",", "len", "=", "array", ".", "length", ",", "xDomainStart", "=", "parent", ".", "x", ".", "domain", "(", ")", "[", "0", "]", ";", "// remove any data earlier than first full r...
Remove data self falls outside the X domain. @param {Array} array The array to inspect. @returns {Array} Either a copy of the array with some elements removed, or the original array if nothing needed to be removed.
[ "Remove", "data", "self", "falls", "outside", "the", "X", "domain", "." ]
26848b1c303b98b7c0ddeefb8c68c5f5bf78927e
https://github.com/SolarNetwork/solarnetwork-d3/blob/26848b1c303b98b7c0ddeefb8c68c5f5bf78927e/src/chart/baseGroupedStackTimeBarChart.js#L162-L175
train
SolarNetwork/solarnetwork-d3
src/chart/baseGroupedStackTimeBarChart.js
drawHoverHighlightBars
function drawHoverHighlightBars(dataArray) { var hoverBar = parent.svgHoverRoot.selectAll('rect.highlightbar').data(dataArray); hoverBar.attr('x', valueX) .attr('width', xBar.rangeBand()); hoverBar.enter().append('rect') .attr('x', valueX) .attr('y', 0) .attr('height', parent.height) .attr('wi...
javascript
function drawHoverHighlightBars(dataArray) { var hoverBar = parent.svgHoverRoot.selectAll('rect.highlightbar').data(dataArray); hoverBar.attr('x', valueX) .attr('width', xBar.rangeBand()); hoverBar.enter().append('rect') .attr('x', valueX) .attr('y', 0) .attr('height', parent.height) .attr('wi...
[ "function", "drawHoverHighlightBars", "(", "dataArray", ")", "{", "var", "hoverBar", "=", "parent", ".", "svgHoverRoot", ".", "selectAll", "(", "'rect.highlightbar'", ")", ".", "data", "(", "dataArray", ")", ";", "hoverBar", ".", "attr", "(", "'x'", ",", "va...
Render a "highlight bar" over a set of bars. @param {array} dataArray An array of data elements for which to render highlight bars over. Pass an empty array to remove all bars.
[ "Render", "a", "highlight", "bar", "over", "a", "set", "of", "bars", "." ]
26848b1c303b98b7c0ddeefb8c68c5f5bf78927e
https://github.com/SolarNetwork/solarnetwork-d3/blob/26848b1c303b98b7c0ddeefb8c68c5f5bf78927e/src/chart/baseGroupedStackTimeBarChart.js#L291-L302
train
SolarNetwork/solarnetwork-d3
src/chart/baseGroupedStackTimeBarChart.js
drawSelection
function drawSelection(dataArray) { var firstItem = (dataArray && dataArray.length > 0 ? dataArray.slice(0, 1) : []), firstItemX = (dataArray && dataArray.length > 0 ? valueX(dataArray[0]) : 0), lastItemX = (dataArray && dataArray.length > 0 ? valueX(dataArray[dataArray.length - 1]) : 0), width = (lastItemX ...
javascript
function drawSelection(dataArray) { var firstItem = (dataArray && dataArray.length > 0 ? dataArray.slice(0, 1) : []), firstItemX = (dataArray && dataArray.length > 0 ? valueX(dataArray[0]) : 0), lastItemX = (dataArray && dataArray.length > 0 ? valueX(dataArray[dataArray.length - 1]) : 0), width = (lastItemX ...
[ "function", "drawSelection", "(", "dataArray", ")", "{", "var", "firstItem", "=", "(", "dataArray", "&&", "dataArray", ".", "length", ">", "0", "?", "dataArray", ".", "slice", "(", "0", ",", "1", ")", ":", "[", "]", ")", ",", "firstItemX", "=", "(", ...
Render a "selection" rect over a set of bars. @param {array} dataArray An array of data elements for which to render a selection over. Pass an empty array to remove the selection.
[ "Render", "a", "selection", "rect", "over", "a", "set", "of", "bars", "." ]
26848b1c303b98b7c0ddeefb8c68c5f5bf78927e
https://github.com/SolarNetwork/solarnetwork-d3/blob/26848b1c303b98b7c0ddeefb8c68c5f5bf78927e/src/chart/baseGroupedStackTimeBarChart.js#L310-L325
train
pagespace/pagespace
spec/unit/helpers/spies.js
mongooseify
function mongooseify(obj, returnValues) { applyMethods(obj); traverse(obj, (key, value) => { applyMethods(value); }); function applyMethods(value) { if(value && value.hasOwnProperty('_id')) { value.toObject = jasmine.createSpy('toObject'); ...
javascript
function mongooseify(obj, returnValues) { applyMethods(obj); traverse(obj, (key, value) => { applyMethods(value); }); function applyMethods(value) { if(value && value.hasOwnProperty('_id')) { value.toObject = jasmine.createSpy('toObject'); ...
[ "function", "mongooseify", "(", "obj", ",", "returnValues", ")", "{", "applyMethods", "(", "obj", ")", ";", "traverse", "(", "obj", ",", "(", "key", ",", "value", ")", "=>", "{", "applyMethods", "(", "value", ")", ";", "}", ")", ";", "function", "app...
called with every property and it's value
[ "called", "with", "every", "property", "and", "it", "s", "value" ]
943c45ddd9aaa4f3136e1ba4c2593aa0289daf43
https://github.com/pagespace/pagespace/blob/943c45ddd9aaa4f3136e1ba4c2593aa0289daf43/spec/unit/helpers/spies.js#L48-L64
train
BoogeeDoo/jockeyjs-bower
jockey.js
function(type, envelope, complete) { // We send the message by navigating the browser to a special URL. // The iOS library will catch the navigation, prevent the UIWebView // from continuing, and use the data in the URL to execute code // within the iOS app. ...
javascript
function(type, envelope, complete) { // We send the message by navigating the browser to a special URL. // The iOS library will catch the navigation, prevent the UIWebView // from continuing, and use the data in the URL to execute code // within the iOS app. ...
[ "function", "(", "type", ",", "envelope", ",", "complete", ")", "{", "// We send the message by navigating the browser to a special URL.", "// The iOS library will catch the navigation, prevent the UIWebView", "// from continuing, and use the data in the URL to execute code", "// within the ...
`type` can either be "event" or "callback"
[ "type", "can", "either", "be", "event", "or", "callback" ]
614788cb2eb843d56009fe0c8e5940b02170d74c
https://github.com/BoogeeDoo/jockeyjs-bower/blob/614788cb2eb843d56009fe0c8e5940b02170d74c/jockey.js#L55-L75
train
BoogeeDoo/jockeyjs-bower
jockey.js
function(type, messageId, json) { var self = this; var listenerList = this.listeners[type] || []; var executedCount = 0; var complete = function() { executedCount += 1; if (executedCount >= listenerList.length) { sel...
javascript
function(type, messageId, json) { var self = this; var listenerList = this.listeners[type] || []; var executedCount = 0; var complete = function() { executedCount += 1; if (executedCount >= listenerList.length) { sel...
[ "function", "(", "type", ",", "messageId", ",", "json", ")", "{", "var", "self", "=", "this", ";", "var", "listenerList", "=", "this", ".", "listeners", "[", "type", "]", "||", "[", "]", ";", "var", "executedCount", "=", "0", ";", "var", "complete", ...
Called by the native application when events are sent to JS from the app. Will execute every function, FIFO order, that was attached to this event type.
[ "Called", "by", "the", "native", "application", "when", "events", "are", "sent", "to", "JS", "from", "the", "app", ".", "Will", "execute", "every", "function", "FIFO", "order", "that", "was", "attached", "to", "this", "event", "type", "." ]
614788cb2eb843d56009fe0c8e5940b02170d74c
https://github.com/BoogeeDoo/jockeyjs-bower/blob/614788cb2eb843d56009fe0c8e5940b02170d74c/jockey.js#L119-L147
train
flegall/haste-map-webpack-resolver
packages/haste-map-provider/index.js
buildHasteMap
function buildHasteMap(rootPath, prefix) { var prefix = prefix || 'haste-map-provider'; return new HasteMapBuilder({ "extensions": [ "snap", "js", "json", "jsx", "node" ], "ignorePattern": /SOME_COMPLEX_IGNORE_PATTERN_UNLIKELY_TO_HAPPEN/,...
javascript
function buildHasteMap(rootPath, prefix) { var prefix = prefix || 'haste-map-provider'; return new HasteMapBuilder({ "extensions": [ "snap", "js", "json", "jsx", "node" ], "ignorePattern": /SOME_COMPLEX_IGNORE_PATTERN_UNLIKELY_TO_HAPPEN/,...
[ "function", "buildHasteMap", "(", "rootPath", ",", "prefix", ")", "{", "var", "prefix", "=", "prefix", "||", "'haste-map-provider'", ";", "return", "new", "HasteMapBuilder", "(", "{", "\"extensions\"", ":", "[", "\"snap\"", ",", "\"js\"", ",", "\"json\"", ",",...
Builds a Haste Map @param {string} rootPath - The rootPath to search sources for @param {string} prefix - The prefix for the haste map file (optional) @returns {Promise} A promise of the Haste Map
[ "Builds", "a", "Haste", "Map" ]
4ba928291c518b24596c3384b61b75fb14f433b7
https://github.com/flegall/haste-map-webpack-resolver/blob/4ba928291c518b24596c3384b61b75fb14f433b7/packages/haste-map-provider/index.js#L10-L35
train
pulsecat/cexio
cexio.js
function(to_clean) { _.map(to_clean, function(value, key, to_clean) { if (value === undefined) { delete to_clean[key]; } }); return to_clean; }
javascript
function(to_clean) { _.map(to_clean, function(value, key, to_clean) { if (value === undefined) { delete to_clean[key]; } }); return to_clean; }
[ "function", "(", "to_clean", ")", "{", "_", ".", "map", "(", "to_clean", ",", "function", "(", "value", ",", "key", ",", "to_clean", ")", "{", "if", "(", "value", "===", "undefined", ")", "{", "delete", "to_clean", "[", "key", "]", ";", "}", "}", ...
compact for objects
[ "compact", "for", "objects" ]
24207a71779775574405dfd332b9a09f2d9d2bc8
https://github.com/pulsecat/cexio/blob/24207a71779775574405dfd332b9a09f2d9d2bc8/cexio.js#L8-L15
train
aledbf/deis-api
lib/apps.js
create
function create(appName, callback) { commons.post(format('/%s/apps/', deis.version), { id: appName }, callback); }
javascript
function create(appName, callback) { commons.post(format('/%s/apps/', deis.version), { id: appName }, callback); }
[ "function", "create", "(", "appName", ",", "callback", ")", "{", "commons", ".", "post", "(", "format", "(", "'/%s/apps/'", ",", "deis", ".", "version", ")", ",", "{", "id", ":", "appName", "}", ",", "callback", ")", ";", "}" ]
Create a new application
[ "Create", "a", "new", "application" ]
f0833789998032b11221a3a617bb566ade1fcc13
https://github.com/aledbf/deis-api/blob/f0833789998032b11221a3a617bb566ade1fcc13/lib/apps.js#L11-L15
train
aledbf/deis-api
lib/apps.js
list
function list(pageSize, callback) { var limit = 100; if (!isFunction(pageSize)) { limit = pageSize; }else { callback = pageSize; } commons.get(format('/%s/apps?limit=%s', deis.version, limit), callback); }
javascript
function list(pageSize, callback) { var limit = 100; if (!isFunction(pageSize)) { limit = pageSize; }else { callback = pageSize; } commons.get(format('/%s/apps?limit=%s', deis.version, limit), callback); }
[ "function", "list", "(", "pageSize", ",", "callback", ")", "{", "var", "limit", "=", "100", ";", "if", "(", "!", "isFunction", "(", "pageSize", ")", ")", "{", "limit", "=", "pageSize", ";", "}", "else", "{", "callback", "=", "pageSize", ";", "}", "...
List accessible applications
[ "List", "accessible", "applications" ]
f0833789998032b11221a3a617bb566ade1fcc13
https://github.com/aledbf/deis-api/blob/f0833789998032b11221a3a617bb566ade1fcc13/lib/apps.js#L20-L28
train
aledbf/deis-api
lib/apps.js
info
function info(appName, callback) { commons.get(format('/%s/apps/%s/', deis.version, appName), callback); }
javascript
function info(appName, callback) { commons.get(format('/%s/apps/%s/', deis.version, appName), callback); }
[ "function", "info", "(", "appName", ",", "callback", ")", "{", "commons", ".", "get", "(", "format", "(", "'/%s/apps/%s/'", ",", "deis", ".", "version", ",", "appName", ")", ",", "callback", ")", ";", "}" ]
View info about an application
[ "View", "info", "about", "an", "application" ]
f0833789998032b11221a3a617bb566ade1fcc13
https://github.com/aledbf/deis-api/blob/f0833789998032b11221a3a617bb566ade1fcc13/lib/apps.js#L33-L35
train
aledbf/deis-api
lib/apps.js
logs
function logs(appName, callback) { commons.get(format('/%s/apps/%s/logs/', deis.version, appName), callback); }
javascript
function logs(appName, callback) { commons.get(format('/%s/apps/%s/logs/', deis.version, appName), callback); }
[ "function", "logs", "(", "appName", ",", "callback", ")", "{", "commons", ".", "get", "(", "format", "(", "'/%s/apps/%s/logs/'", ",", "deis", ".", "version", ",", "appName", ")", ",", "callback", ")", ";", "}" ]
View aggregated application logs
[ "View", "aggregated", "application", "logs" ]
f0833789998032b11221a3a617bb566ade1fcc13
https://github.com/aledbf/deis-api/blob/f0833789998032b11221a3a617bb566ade1fcc13/lib/apps.js#L40-L42
train
aledbf/deis-api
lib/apps.js
run
function run(appName, command, callback) { commons.get(format('/%s/apps/%s/run/', deis.version, appName), callback); }
javascript
function run(appName, command, callback) { commons.get(format('/%s/apps/%s/run/', deis.version, appName), callback); }
[ "function", "run", "(", "appName", ",", "command", ",", "callback", ")", "{", "commons", ".", "get", "(", "format", "(", "'/%s/apps/%s/run/'", ",", "deis", ".", "version", ",", "appName", ")", ",", "callback", ")", ";", "}" ]
Run a command in an ephemeral app container
[ "Run", "a", "command", "in", "an", "ephemeral", "app", "container" ]
f0833789998032b11221a3a617bb566ade1fcc13
https://github.com/aledbf/deis-api/blob/f0833789998032b11221a3a617bb566ade1fcc13/lib/apps.js#L47-L49
train
aledbf/deis-api
lib/apps.js
destroy
function destroy(appName, callback) { commons.del(format('/%s/apps/%s/', deis.version, appName), callback); }
javascript
function destroy(appName, callback) { commons.del(format('/%s/apps/%s/', deis.version, appName), callback); }
[ "function", "destroy", "(", "appName", ",", "callback", ")", "{", "commons", ".", "del", "(", "format", "(", "'/%s/apps/%s/'", ",", "deis", ".", "version", ",", "appName", ")", ",", "callback", ")", ";", "}" ]
Destroy an application
[ "Destroy", "an", "application" ]
f0833789998032b11221a3a617bb566ade1fcc13
https://github.com/aledbf/deis-api/blob/f0833789998032b11221a3a617bb566ade1fcc13/lib/apps.js#L54-L56
train
chrishayesmu/DubBotBase
main.js
start
function start(basedir, connectionCompleteCallback) { var defaultConfig = require("./config/defaults.json"); var config = Config.create(basedir, defaultConfig); var globalObject = { config: config }; var loginCompleteCallback = function(bot) { globalObject.bot = bot; bot.connect(config...
javascript
function start(basedir, connectionCompleteCallback) { var defaultConfig = require("./config/defaults.json"); var config = Config.create(basedir, defaultConfig); var globalObject = { config: config }; var loginCompleteCallback = function(bot) { globalObject.bot = bot; bot.connect(config...
[ "function", "start", "(", "basedir", ",", "connectionCompleteCallback", ")", "{", "var", "defaultConfig", "=", "require", "(", "\"./config/defaults.json\"", ")", ";", "var", "config", "=", "Config", ".", "create", "(", "basedir", ",", "defaultConfig", ")", ";", ...
Starts up the bot, registering all commands and event listeners. @param {string} basedir - The base directory containing the commands/ and event_listeners/ subdirectories @param {function} connectionCompleteCallback - A function to be called once the bot has connected to the room and is ready to use @returns {object} ...
[ "Starts", "up", "the", "bot", "registering", "all", "commands", "and", "event", "listeners", "." ]
0e4b5e65531c23293d22ac766850c802b1266e48
https://github.com/chrishayesmu/DubBotBase/blob/0e4b5e65531c23293d22ac766850c802b1266e48/main.js#L24-L59
train
chrishayesmu/DubBotBase
main.js
_createCommandHandler
function _createCommandHandler(commands) { return function(chatEvent, globalObject) { if (!chatEvent.command) { return; } var commandName = chatEvent.command; if (!globalObject.config.DubBotBase.areCommandsCaseSensitive) { commandName = commandName.toLowerC...
javascript
function _createCommandHandler(commands) { return function(chatEvent, globalObject) { if (!chatEvent.command) { return; } var commandName = chatEvent.command; if (!globalObject.config.DubBotBase.areCommandsCaseSensitive) { commandName = commandName.toLowerC...
[ "function", "_createCommandHandler", "(", "commands", ")", "{", "return", "function", "(", "chatEvent", ",", "globalObject", ")", "{", "if", "(", "!", "chatEvent", ".", "command", ")", "{", "return", ";", "}", "var", "commandName", "=", "chatEvent", ".", "...
Creates a handler for the CHAT_COMMAND event which will distribute chat commands to the appropriate registered handlers. @param {array} commands - All of the registered command handlers @returns {function} An event handler
[ "Creates", "a", "handler", "for", "the", "CHAT_COMMAND", "event", "which", "will", "distribute", "chat", "commands", "to", "the", "appropriate", "registered", "handlers", "." ]
0e4b5e65531c23293d22ac766850c802b1266e48
https://github.com/chrishayesmu/DubBotBase/blob/0e4b5e65531c23293d22ac766850c802b1266e48/main.js#L68-L98
train
chrishayesmu/DubBotBase
main.js
_registerCommands
function _registerCommands(basedir, globalObject) { var commandsDir = path.resolve(basedir, "commands"); var files; try { files = Utils.getAllFilePathsUnderDirectory(commandsDir); LOG.info("Found the following potential command files: {}", files); } catch (e) { LOG.error("Un...
javascript
function _registerCommands(basedir, globalObject) { var commandsDir = path.resolve(basedir, "commands"); var files; try { files = Utils.getAllFilePathsUnderDirectory(commandsDir); LOG.info("Found the following potential command files: {}", files); } catch (e) { LOG.error("Un...
[ "function", "_registerCommands", "(", "basedir", ",", "globalObject", ")", "{", "var", "commandsDir", "=", "path", ".", "resolve", "(", "basedir", ",", "\"commands\"", ")", ";", "var", "files", ";", "try", "{", "files", "=", "Utils", ".", "getAllFilePathsUnd...
Registers all of the eligible files from the commands directory as commands with the bot. @param {string} basedir - The base directory which holds the commands directory @param {object} bot - An instance of DubBotBase.Bot
[ "Registers", "all", "of", "the", "eligible", "files", "from", "the", "commands", "directory", "as", "commands", "with", "the", "bot", "." ]
0e4b5e65531c23293d22ac766850c802b1266e48
https://github.com/chrishayesmu/DubBotBase/blob/0e4b5e65531c23293d22ac766850c802b1266e48/main.js#L107-L144
train
chrishayesmu/DubBotBase
main.js
_registerEventListeners
function _registerEventListeners(basedir, globalObject) { var bot = globalObject.bot; var eventListenerDir = path.resolve(basedir, "event_listeners"); var files; try { files = Utils.getAllFilePathsUnderDirectory(eventListenerDir); LOG.info("Found the following potential event listener f...
javascript
function _registerEventListeners(basedir, globalObject) { var bot = globalObject.bot; var eventListenerDir = path.resolve(basedir, "event_listeners"); var files; try { files = Utils.getAllFilePathsUnderDirectory(eventListenerDir); LOG.info("Found the following potential event listener f...
[ "function", "_registerEventListeners", "(", "basedir", ",", "globalObject", ")", "{", "var", "bot", "=", "globalObject", ".", "bot", ";", "var", "eventListenerDir", "=", "path", ".", "resolve", "(", "basedir", ",", "\"event_listeners\"", ")", ";", "var", "file...
Registers all of the eligible files from the event_listeners directory as event listeners with the bot. @param {string} basedir - The base directory which holds the event_listeners directory @param {object} bot - An instance of DubBotBase.Bot
[ "Registers", "all", "of", "the", "eligible", "files", "from", "the", "event_listeners", "directory", "as", "event", "listeners", "with", "the", "bot", "." ]
0e4b5e65531c23293d22ac766850c802b1266e48
https://github.com/chrishayesmu/DubBotBase/blob/0e4b5e65531c23293d22ac766850c802b1266e48/main.js#L153-L232
train
jfseb/mgnlq_model
js/model/model.js
getMongoHandle
function getMongoHandle(mongoose) { var res = { mongoose: mongoose, modelDocs: {}, modelESchemas: {}, mongoMaps: {} }; var modelES = Schemaload.getExtendedSchemaModel(mongoose); return modelES.distinct('modelname').then((modelnames) => { debuglog(() => 'here disti...
javascript
function getMongoHandle(mongoose) { var res = { mongoose: mongoose, modelDocs: {}, modelESchemas: {}, mongoMaps: {} }; var modelES = Schemaload.getExtendedSchemaModel(mongoose); return modelES.distinct('modelname').then((modelnames) => { debuglog(() => 'here disti...
[ "function", "getMongoHandle", "(", "mongoose", ")", "{", "var", "res", "=", "{", "mongoose", ":", "mongoose", ",", "modelDocs", ":", "{", "}", ",", "modelESchemas", ":", "{", "}", ",", "mongoMaps", ":", "{", "}", "}", ";", "var", "modelES", "=", "Sch...
returns when all models are loaded and all modeldocs are made @param mongoose
[ "returns", "when", "all", "models", "are", "loaded", "and", "all", "modeldocs", "are", "made" ]
be1be4406b05718d666d6d0f712c9cadb5169f2c
https://github.com/jfseb/mgnlq_model/blob/be1be4406b05718d666d6d0f712c9cadb5169f2c/js/model/model.js#L40-L69
train
jfseb/mgnlq_model
js/model/model.js
getDomainsForBitField
function getDomainsForBitField(oModel, bitfield) { return oModel.domains.filter(domain => (getDomainBitIndex(domain, oModel) & bitfield)); }
javascript
function getDomainsForBitField(oModel, bitfield) { return oModel.domains.filter(domain => (getDomainBitIndex(domain, oModel) & bitfield)); }
[ "function", "getDomainsForBitField", "(", "oModel", ",", "bitfield", ")", "{", "return", "oModel", ".", "domains", ".", "filter", "(", "domain", "=>", "(", "getDomainBitIndex", "(", "domain", ",", "oModel", ")", "&", "bitfield", ")", ")", ";", "}" ]
Given a bitfield, return an unsorted set of domains matching present bits @param oModel @param bitfield
[ "Given", "a", "bitfield", "return", "an", "unsorted", "set", "of", "domains", "matching", "present", "bits" ]
be1be4406b05718d666d6d0f712c9cadb5169f2c
https://github.com/jfseb/mgnlq_model/blob/be1be4406b05718d666d6d0f712c9cadb5169f2c/js/model/model.js#L525-L527
train
jfseb/mgnlq_model
js/model/model.js
loadModels
function loadModels(mongoose, modelPath) { if (mongoose === undefined) { throw new Error('expect a mongoose handle to be passed'); } return getMongoHandle(mongoose).then((modelHandle) => { debuglog(`got a mongo handle for ${modelPath}`); return _loadModelsFull(modelHandle, modelPath)...
javascript
function loadModels(mongoose, modelPath) { if (mongoose === undefined) { throw new Error('expect a mongoose handle to be passed'); } return getMongoHandle(mongoose).then((modelHandle) => { debuglog(`got a mongo handle for ${modelPath}`); return _loadModelsFull(modelHandle, modelPath)...
[ "function", "loadModels", "(", "mongoose", ",", "modelPath", ")", "{", "if", "(", "mongoose", "===", "undefined", ")", "{", "throw", "new", "Error", "(", "'expect a mongoose handle to be passed'", ")", ";", "}", "return", "getMongoHandle", "(", "mongoose", ")", ...
expects an open connection! @param mongoose @param modelPath
[ "expects", "an", "open", "connection!" ]
be1be4406b05718d666d6d0f712c9cadb5169f2c
https://github.com/jfseb/mgnlq_model/blob/be1be4406b05718d666d6d0f712c9cadb5169f2c/js/model/model.js#L1202-L1210
train
jmorrell/backbone-paginated-collection
index.js
difference
function difference(arrayA, arrayB) { var maxLength = _.max([ arrayA.length, arrayB.length ]); for (var i = 0, j = 0; i < maxLength; i += 1, j += 1) { if (arrayA[i] !== arrayB[j]) { if (arrayB[i-1] === arrayA[i]) { j -= 1; } else if (arrayB[i+1] === arrayA[i]) { j += 1; } else...
javascript
function difference(arrayA, arrayB) { var maxLength = _.max([ arrayA.length, arrayB.length ]); for (var i = 0, j = 0; i < maxLength; i += 1, j += 1) { if (arrayA[i] !== arrayB[j]) { if (arrayB[i-1] === arrayA[i]) { j -= 1; } else if (arrayB[i+1] === arrayA[i]) { j += 1; } else...
[ "function", "difference", "(", "arrayA", ",", "arrayB", ")", "{", "var", "maxLength", "=", "_", ".", "max", "(", "[", "arrayA", ".", "length", ",", "arrayB", ".", "length", "]", ")", ";", "for", "(", "var", "i", "=", "0", ",", "j", "=", "0", ";...
Given two arrays of backbone models, with at most one model added and one model removed from each, return the model in arrayA that is not in arrayB or undefined.
[ "Given", "two", "arrays", "of", "backbone", "models", "with", "at", "most", "one", "model", "added", "and", "one", "model", "removed", "from", "each", "return", "the", "model", "in", "arrayA", "that", "is", "not", "in", "arrayB", "or", "undefined", "." ]
46b8de1c8b24d741852294048f21d43225838364
https://github.com/jmorrell/backbone-paginated-collection/blob/46b8de1c8b24d741852294048f21d43225838364/index.js#L52-L66
train
MauroJr/amp
src/decode.js
decode
function decode(buf) { let off = 0; var i; // unpack meta const meta = buf[(off += 1)]; // const VERSION = meta >> 4; const argv = meta & 0xf; const args = new Array(argv); // unpack args for (i = 0; i < argv; i += 1) { const len = buf.readUInt32BE(off); off += 4; args[i] = buf.slice(of...
javascript
function decode(buf) { let off = 0; var i; // unpack meta const meta = buf[(off += 1)]; // const VERSION = meta >> 4; const argv = meta & 0xf; const args = new Array(argv); // unpack args for (i = 0; i < argv; i += 1) { const len = buf.readUInt32BE(off); off += 4; args[i] = buf.slice(of...
[ "function", "decode", "(", "buf", ")", "{", "let", "off", "=", "0", ";", "var", "i", ";", "// unpack meta", "const", "meta", "=", "buf", "[", "(", "off", "+=", "1", ")", "]", ";", "// const VERSION = meta >> 4;", "const", "argv", "=", "meta", "&", "0...
Decode the given `buf`. @param {Buffer} buf @return {Object} @api public
[ "Decode", "the", "given", "buf", "." ]
2b7df0bcf91228d02bdd6d6f1e1238743dbbb086
https://github.com/MauroJr/amp/blob/2b7df0bcf91228d02bdd6d6f1e1238743dbbb086/src/decode.js#L12-L31
train
kevinconway/Event.js
event/event.js
appendListener
function appendListener(event, listener, once) { this.events[event] = this.events[event] || []; this.events[event].push({ "listener": listener, "once": !!once }); this.emit('newListener', event, listener); if (this.events[event].length > this.maxListeners) { console.warn('warni...
javascript
function appendListener(event, listener, once) { this.events[event] = this.events[event] || []; this.events[event].push({ "listener": listener, "once": !!once }); this.emit('newListener', event, listener); if (this.events[event].length > this.maxListeners) { console.warn('warni...
[ "function", "appendListener", "(", "event", ",", "listener", ",", "once", ")", "{", "this", ".", "events", "[", "event", "]", "=", "this", ".", "events", "[", "event", "]", "||", "[", "]", ";", "this", ".", "events", "[", "event", "]", ".", "push",...
Adds a listener to the list. Private method hidden from api.
[ "Adds", "a", "listener", "to", "the", "list", ".", "Private", "method", "hidden", "from", "api", "." ]
65b4a0b4e19defaa9a863c107633b1835929a660
https://github.com/kevinconway/Event.js/blob/65b4a0b4e19defaa9a863c107633b1835929a660/event/event.js#L35-L54
train
joemccann/photopipe
utils/validation.js
function(u){ var urlObj = url.parse(u) return u.replace( urlObj.search, '').replace('#', '') }
javascript
function(u){ var urlObj = url.parse(u) return u.replace( urlObj.search, '').replace('#', '') }
[ "function", "(", "u", ")", "{", "var", "urlObj", "=", "url", ".", "parse", "(", "u", ")", "return", "u", ".", "replace", "(", "urlObj", ".", "search", ",", "''", ")", ".", "replace", "(", "'#'", ",", "''", ")", "}" ]
Brute force way of removing querystring and hash
[ "Brute", "force", "way", "of", "removing", "querystring", "and", "hash" ]
20318fde11163a8b732b077a141a8d8530372333
https://github.com/joemccann/photopipe/blob/20318fde11163a8b732b077a141a8d8530372333/utils/validation.js#L10-L13
train
joemccann/photopipe
utils/validation.js
function(u){ var urlObj = url.parse(u) return urlObj.protocol + "//" + urlObj.hostname + urlObj.pathname }
javascript
function(u){ var urlObj = url.parse(u) return urlObj.protocol + "//" + urlObj.hostname + urlObj.pathname }
[ "function", "(", "u", ")", "{", "var", "urlObj", "=", "url", ".", "parse", "(", "u", ")", "return", "urlObj", ".", "protocol", "+", "\"//\"", "+", "urlObj", ".", "hostname", "+", "urlObj", ".", "pathname", "}" ]
Build path from urlObj after parsing
[ "Build", "path", "from", "urlObj", "after", "parsing" ]
20318fde11163a8b732b077a141a8d8530372333
https://github.com/joemccann/photopipe/blob/20318fde11163a8b732b077a141a8d8530372333/utils/validation.js#L15-L18
train
bredele/post
post.js
PostEmitter
function PostEmitter() { var _this = this; //might be global this._listener = function(ev) { //check origin //then var data = ev.data; _this.emit.apply(_this, data instanceof Array ? data : [data]); }; window[attach](prefix + 'message', this._listener); }
javascript
function PostEmitter() { var _this = this; //might be global this._listener = function(ev) { //check origin //then var data = ev.data; _this.emit.apply(_this, data instanceof Array ? data : [data]); }; window[attach](prefix + 'message', this._listener); }
[ "function", "PostEmitter", "(", ")", "{", "var", "_this", "=", "this", ";", "//might be global", "this", ".", "_listener", "=", "function", "(", "ev", ")", "{", "//check origin", "//then", "var", "data", "=", "ev", ".", "data", ";", "_this", ".", "emit",...
PostEmitter constructor. Listen local and remote messages. @api public
[ "PostEmitter", "constructor", ".", "Listen", "local", "and", "remote", "messages", "." ]
a0a7365e432c4d10e660e872825c094c08f32ba8
https://github.com/bredele/post/blob/a0a7365e432c4d10e660e872825c094c08f32ba8/post.js#L397-L407
train
SolarNetwork/solarnetwork-d3
src/color/util.js
sn_color_map
function sn_color_map(fillColors, keys) { var colorRange = d3.scale.ordinal().range(fillColors); var colorData = keys.map(function(el, i) { return {source:el, color:colorRange(i)}; }); // also provide a mapping of sources to corresponding colors var i, len, sourceName; for ( i = 0, len = colorData.length; i < le...
javascript
function sn_color_map(fillColors, keys) { var colorRange = d3.scale.ordinal().range(fillColors); var colorData = keys.map(function(el, i) { return {source:el, color:colorRange(i)}; }); // also provide a mapping of sources to corresponding colors var i, len, sourceName; for ( i = 0, len = colorData.length; i < le...
[ "function", "sn_color_map", "(", "fillColors", ",", "keys", ")", "{", "var", "colorRange", "=", "d3", ".", "scale", ".", "ordinal", "(", ")", ".", "range", "(", "fillColors", ")", ";", "var", "colorData", "=", "keys", ".", "map", "(", "function", "(", ...
Return an array of colors for a set of unique keys, where the returned array also contains associative properties for all key values to thier corresponding color value. <p>This is designed so the set of keys always map to the same color, even across charts where not all sources may be present.</p> @preserve
[ "Return", "an", "array", "of", "colors", "for", "a", "set", "of", "unique", "keys", "where", "the", "returned", "array", "also", "contains", "associative", "properties", "for", "all", "key", "values", "to", "thier", "corresponding", "color", "value", "." ]
26848b1c303b98b7c0ddeefb8c68c5f5bf78927e
https://github.com/SolarNetwork/solarnetwork-d3/blob/26848b1c303b98b7c0ddeefb8c68c5f5bf78927e/src/color/util.js#L17-L37
train
SolarNetwork/solarnetwork-d3
src/color/util.js
sn_color_color
function sn_color_color(d) { var s = Number(d.source); if ( isNaN(s) ) { return sn.runtime.colorData[d.source]; } return sn.runtime.colorData.reduce(function(c, obj) { return (obj.source === d.source ? obj.color : c); }, sn.runtime.colorData[0].color); }
javascript
function sn_color_color(d) { var s = Number(d.source); if ( isNaN(s) ) { return sn.runtime.colorData[d.source]; } return sn.runtime.colorData.reduce(function(c, obj) { return (obj.source === d.source ? obj.color : c); }, sn.runtime.colorData[0].color); }
[ "function", "sn_color_color", "(", "d", ")", "{", "var", "s", "=", "Number", "(", "d", ".", "source", ")", ";", "if", "(", "isNaN", "(", "s", ")", ")", "{", "return", "sn", ".", "runtime", ".", "colorData", "[", "d", ".", "source", "]", ";", "}...
Use the configured runtime color map to turn a source into a color. The {@code sn.runtime.colorData} property must be set to a color map object as returned by {@link sn.colorMap}. @param {object} d the data element, expected to contain a {@code source} property @returns {string} color value @preserve
[ "Use", "the", "configured", "runtime", "color", "map", "to", "turn", "a", "source", "into", "a", "color", "." ]
26848b1c303b98b7c0ddeefb8c68c5f5bf78927e
https://github.com/SolarNetwork/solarnetwork-d3/blob/26848b1c303b98b7c0ddeefb8c68c5f5bf78927e/src/color/util.js#L49-L57
train
frankandrobot/js-go-channels
packages/js-go-channels/src/index.js
_createConsumerMessage
function _createConsumerMessage(consumer, message, {chanId}) { const { iterator: consumerIterator, type: requestType, payload } = consumer if (requestType === cSelectRequest) { const {selectedChanIds} = payload const i = selectedChanIds.indexOf(chanId) const response = new Array(selectedCh...
javascript
function _createConsumerMessage(consumer, message, {chanId}) { const { iterator: consumerIterator, type: requestType, payload } = consumer if (requestType === cSelectRequest) { const {selectedChanIds} = payload const i = selectedChanIds.indexOf(chanId) const response = new Array(selectedCh...
[ "function", "_createConsumerMessage", "(", "consumer", ",", "message", ",", "{", "chanId", "}", ")", "{", "const", "{", "iterator", ":", "consumerIterator", ",", "type", ":", "requestType", ",", "payload", "}", "=", "consumer", "if", "(", "requestType", "===...
Does what it says. Need to take into account the case when the consumer is a pending select, pending take. `select`s have a different signature. @param {Object} consumer - the consumer and message that was queued @param {Iterator} consumer.iterator @param {string} consumer.type - the consumer's message type @param {Obj...
[ "Does", "what", "it", "says", ".", "Need", "to", "take", "into", "account", "the", "case", "when", "the", "consumer", "is", "a", "pending", "select", "pending", "take", ".", "select", "s", "have", "a", "different", "signature", "." ]
cf1f7329e5e424a9e4123816f2b27adf73022eff
https://github.com/frankandrobot/js-go-channels/blob/cf1f7329e5e424a9e4123816f2b27adf73022eff/packages/js-go-channels/src/index.js#L65-L81
train
leipert/gulp-stack
tasks/app.js
function () { var stream = new $.streamqueue({ objectMode: true }); //Optionally injected additional javascript sourcecode injectIntoStream(stream, options.injectInto.js.pre); // App files without vendor files ...
javascript
function () { var stream = new $.streamqueue({ objectMode: true }); //Optionally injected additional javascript sourcecode injectIntoStream(stream, options.injectInto.js.pre); // App files without vendor files ...
[ "function", "(", ")", "{", "var", "stream", "=", "new", "$", ".", "streamqueue", "(", "{", "objectMode", ":", "true", "}", ")", ";", "//Optionally injected additional javascript sourcecode", "injectIntoStream", "(", "stream", ",", "options", ".", "injectInto", "...
Takes all app javascript files, angular templates and concats and minifies them
[ "Takes", "all", "app", "javascript", "files", "angular", "templates", "and", "concats", "and", "minifies", "them" ]
717bd0524f835393d2d3870c3e8f4d9af39c52c7
https://github.com/leipert/gulp-stack/blob/717bd0524f835393d2d3870c3e8f4d9af39c52c7/tasks/app.js#L28-L54
train
leipert/gulp-stack
tasks/app.js
function () { var stream = new $.streamqueue({ objectMode: true }); //Optionally injected additional css sourcecode injectIntoStream(stream, options.injectInto.css.pre); // App files without vendor files ...
javascript
function () { var stream = new $.streamqueue({ objectMode: true }); //Optionally injected additional css sourcecode injectIntoStream(stream, options.injectInto.css.pre); // App files without vendor files ...
[ "function", "(", ")", "{", "var", "stream", "=", "new", "$", ".", "streamqueue", "(", "{", "objectMode", ":", "true", "}", ")", ";", "//Optionally injected additional css sourcecode", "injectIntoStream", "(", "stream", ",", "options", ".", "injectInto", ".", "...
Takes all app css files and concats and minfies them
[ "Takes", "all", "app", "css", "files", "and", "concats", "and", "minfies", "them" ]
717bd0524f835393d2d3870c3e8f4d9af39c52c7
https://github.com/leipert/gulp-stack/blob/717bd0524f835393d2d3870c3e8f4d9af39c52c7/tasks/app.js#L60-L79
train
hammy2899/circle-assign
src/merge.js
merge
function merge(target, ...sources) { let targetObject = target; if (!isObj(target)) { targetObject = {}; } // for all the sources provided merge them with // the target object sources.forEach((s) => { // before merging check the source is an object if (isObj(s)) { targetObject = mergeObj...
javascript
function merge(target, ...sources) { let targetObject = target; if (!isObj(target)) { targetObject = {}; } // for all the sources provided merge them with // the target object sources.forEach((s) => { // before merging check the source is an object if (isObj(s)) { targetObject = mergeObj...
[ "function", "merge", "(", "target", ",", "...", "sources", ")", "{", "let", "targetObject", "=", "target", ";", "if", "(", "!", "isObj", "(", "target", ")", ")", "{", "targetObject", "=", "{", "}", ";", "}", "// for all the sources provided merge them with",...
Merge specified objects into one object with the most right object having the most priority @param {Object} target The base object @param {...Object} sources The object(s) to merge @returns {Object} The merged object(s) result
[ "Merge", "specified", "objects", "into", "one", "object", "with", "the", "most", "right", "object", "having", "the", "most", "priority" ]
4eb202021279b789ce758b3feae2417eb7f2ded5
https://github.com/hammy2899/circle-assign/blob/4eb202021279b789ce758b3feae2417eb7f2ded5/src/merge.js#L13-L30
train
benquarmby/gulp-byo-jslint
index.js
lintStream
function lintStream(spec) { if (!spec || !spec.jslint) { throw new gulpUtil.PluginError(pluginName, 'The file path to jslint is required.'); } var errors = 0; function lint(source, callback) { var contents = source.contents.toString('utf8'); var result = context.jslint(contents...
javascript
function lintStream(spec) { if (!spec || !spec.jslint) { throw new gulpUtil.PluginError(pluginName, 'The file path to jslint is required.'); } var errors = 0; function lint(source, callback) { var contents = source.contents.toString('utf8'); var result = context.jslint(contents...
[ "function", "lintStream", "(", "spec", ")", "{", "if", "(", "!", "spec", "||", "!", "spec", ".", "jslint", ")", "{", "throw", "new", "gulpUtil", ".", "PluginError", "(", "pluginName", ",", "'The file path to jslint is required.'", ")", ";", "}", "var", "er...
Runs JSLint over each item in the stream. @param {Object} spec The specification. @param {String} spec.jslint The file path to jslint.js. @param {Object} [spec.options] The options to pass to JSLint. @param {Array} [spec.globals] The list of known global variables to pass to JSLint. @param {Boolean} [spec.noFail] True ...
[ "Runs", "JSLint", "over", "each", "item", "in", "the", "stream", "." ]
aeae37424e325ae390a25bc4cf93d333da1de559
https://github.com/benquarmby/gulp-byo-jslint/blob/aeae37424e325ae390a25bc4cf93d333da1de559/index.js#L50-L105
train
veo-labs/openveo-rest-nodejs-client
lib/RestClient.js
rejectAll
function rejectAll(requests, error) { for (const request of requests) { request.abort(); request.reject(error); } }
javascript
function rejectAll(requests, error) { for (const request of requests) { request.abort(); request.reject(error); } }
[ "function", "rejectAll", "(", "requests", ",", "error", ")", "{", "for", "(", "const", "request", "of", "requests", ")", "{", "request", ".", "abort", "(", ")", ";", "request", ".", "reject", "(", "error", ")", ";", "}", "}" ]
Rejects all requests with the given error. If the request is running, it will be aborted. @private @param {Set} requests The list of requests to reject @param {Error} error The reject's error
[ "Rejects", "all", "requests", "with", "the", "given", "error", "." ]
c88f8daca56ca38d649bd76633a55440e5dc47c2
https://github.com/veo-labs/openveo-rest-nodejs-client/blob/c88f8daca56ca38d649bd76633a55440e5dc47c2/lib/RestClient.js#L27-L32
train
deanlandolt/endo
util/index.js
UnauthorizedError
function UnauthorizedError(message) { Error.call(this); Error.captureStackTrace(this, this.constructor); this.status = 401; this.message = 'Unauthorized: ' + message; this.name = this.constructor.name; }
javascript
function UnauthorizedError(message) { Error.call(this); Error.captureStackTrace(this, this.constructor); this.status = 401; this.message = 'Unauthorized: ' + message; this.name = this.constructor.name; }
[ "function", "UnauthorizedError", "(", "message", ")", "{", "Error", ".", "call", "(", "this", ")", ";", "Error", ".", "captureStackTrace", "(", "this", ",", "this", ".", "constructor", ")", ";", "this", ".", "status", "=", "401", ";", "this", ".", "mes...
thrown when endpoint authorization fails
[ "thrown", "when", "endpoint", "authorization", "fails" ]
e96234226e3a56e5c71b7f68690b5cc98123ed03
https://github.com/deanlandolt/endo/blob/e96234226e3a56e5c71b7f68690b5cc98123ed03/util/index.js#L181-L188
train
deanlandolt/endo
util/index.js
NotFoundError
function NotFoundError(message) { Error.call(this); Error.captureStackTrace(this, this.constructor); this.status = 404; this.message = 'Not Found: ' + message; this.name = this.constructor.name; }
javascript
function NotFoundError(message) { Error.call(this); Error.captureStackTrace(this, this.constructor); this.status = 404; this.message = 'Not Found: ' + message; this.name = this.constructor.name; }
[ "function", "NotFoundError", "(", "message", ")", "{", "Error", ".", "call", "(", "this", ")", ";", "Error", ".", "captureStackTrace", "(", "this", ",", "this", ".", "constructor", ")", ";", "this", ".", "status", "=", "404", ";", "this", ".", "message...
thrown when endpoint resolution fails
[ "thrown", "when", "endpoint", "resolution", "fails" ]
e96234226e3a56e5c71b7f68690b5cc98123ed03
https://github.com/deanlandolt/endo/blob/e96234226e3a56e5c71b7f68690b5cc98123ed03/util/index.js#L196-L203
train
SwirlNetworks/discus
src/view.js
function(el) { var self = this, $el = $(el); if ($el.length > 1) { $el.each(function() { self.addElement(this); }); } else if ($el.length === 0) { throw new Error("Invalid element!"); } if (this.$el.closest($el).length) { throw new Error("Element is a child of this view. This is only for ...
javascript
function(el) { var self = this, $el = $(el); if ($el.length > 1) { $el.each(function() { self.addElement(this); }); } else if ($el.length === 0) { throw new Error("Invalid element!"); } if (this.$el.closest($el).length) { throw new Error("Element is a child of this view. This is only for ...
[ "function", "(", "el", ")", "{", "var", "self", "=", "this", ",", "$el", "=", "$", "(", "el", ")", ";", "if", "(", "$el", ".", "length", ">", "1", ")", "{", "$el", ".", "each", "(", "function", "(", ")", "{", "self", ".", "addElement", "(", ...
track el as part of this view even though it's not a child..
[ "track", "el", "as", "part", "of", "this", "view", "even", "though", "it", "s", "not", "a", "child", ".." ]
79df8de5ec268879e50ec1e12e78b62a13b4a427
https://github.com/SwirlNetworks/discus/blob/79df8de5ec268879e50ec1e12e78b62a13b4a427/src/view.js#L186-L222
train
smartface/styler
src/styler.js
styler
function styler(...rawStyles) { const stylesBundle = buildStyles.apply(null, rawStyles); /** * Styling composer * * @param {...string} classNames - Class names of desired styles */ return function stylingComposer(classNames, error) { var parsedClassNames; const styles = []; const notFoun...
javascript
function styler(...rawStyles) { const stylesBundle = buildStyles.apply(null, rawStyles); /** * Styling composer * * @param {...string} classNames - Class names of desired styles */ return function stylingComposer(classNames, error) { var parsedClassNames; const styles = []; const notFoun...
[ "function", "styler", "(", "...", "rawStyles", ")", "{", "const", "stylesBundle", "=", "buildStyles", ".", "apply", "(", "null", ",", "rawStyles", ")", ";", "/**\n * Styling composer\n * \n * @param {...string} classNames - Class names of desired styles\n */", "return...
Styling Wrapper. In order to return desired styles. Makes styles flatted then merge all by classNames then pass merged styles to callback. @example const styler = require("@smartface/styler").styler or require("@smartface/styler/lib/styler"); const styles = { ".button"{ widht: "100px", height: "30px", ".blue": { color...
[ "Styling", "Wrapper", ".", "In", "order", "to", "return", "desired", "styles", ".", "Makes", "styles", "flatted", "then", "merge", "all", "by", "classNames", "then", "pass", "merged", "styles", "to", "callback", "." ]
fca15ea571a73f0acffa2e6f44668993b127daf1
https://github.com/smartface/styler/blob/fca15ea571a73f0acffa2e6f44668993b127daf1/src/styler.js#L49-L147
train
chrishayesmu/DubBotBase
src/utils.js
checkHasValue
function checkHasValue(value, message) { checkNotEmpty(message, "No error message passed to checkHasValue"); if (value === null || typeof value === "undefined") { throw new Error(message); } }
javascript
function checkHasValue(value, message) { checkNotEmpty(message, "No error message passed to checkHasValue"); if (value === null || typeof value === "undefined") { throw new Error(message); } }
[ "function", "checkHasValue", "(", "value", ",", "message", ")", "{", "checkNotEmpty", "(", "message", ",", "\"No error message passed to checkHasValue\"", ")", ";", "if", "(", "value", "===", "null", "||", "typeof", "value", "===", "\"undefined\"", ")", "{", "th...
Ensures that the value passed in is not null or undefined. If it is, throws an error with the message provided. @param {mixed} value - Anything which should not be null or undefined @param {string} message - A message to throw in an Error if no value is present
[ "Ensures", "that", "the", "value", "passed", "in", "is", "not", "null", "or", "undefined", ".", "If", "it", "is", "throws", "an", "error", "with", "the", "message", "provided", "." ]
0e4b5e65531c23293d22ac766850c802b1266e48
https://github.com/chrishayesmu/DubBotBase/blob/0e4b5e65531c23293d22ac766850c802b1266e48/src/utils.js#L35-L41
train
chrishayesmu/DubBotBase
src/utils.js
checkNotEmpty
function checkNotEmpty(string, message) { if (!message || !message.trim()) { throw new Error("No error message passed to checkNotEmpty"); } if (!string || !string.trim()) { throw new Error(message); } }
javascript
function checkNotEmpty(string, message) { if (!message || !message.trim()) { throw new Error("No error message passed to checkNotEmpty"); } if (!string || !string.trim()) { throw new Error(message); } }
[ "function", "checkNotEmpty", "(", "string", ",", "message", ")", "{", "if", "(", "!", "message", "||", "!", "message", ".", "trim", "(", ")", ")", "{", "throw", "new", "Error", "(", "\"No error message passed to checkNotEmpty\"", ")", ";", "}", "if", "(", ...
Checks that the string passed in is not null, empty or entirely whitespace. If this is not the case, throws an error with the message provided. @param {string} string - The string to check @param {string} message - A message to throw in an Error if the string is empty
[ "Checks", "that", "the", "string", "passed", "in", "is", "not", "null", "empty", "or", "entirely", "whitespace", ".", "If", "this", "is", "not", "the", "case", "throws", "an", "error", "with", "the", "message", "provided", "." ]
0e4b5e65531c23293d22ac766850c802b1266e48
https://github.com/chrishayesmu/DubBotBase/blob/0e4b5e65531c23293d22ac766850c802b1266e48/src/utils.js#L50-L58
train
chrishayesmu/DubBotBase
src/utils.js
checkValueIsInObject
function checkValueIsInObject(value, object, message) { checkNotEmpty(message, "No error message passed to checkValueIsInObject"); var key = findValueInObject(value, object); if (typeof key === "undefined") { // Make sure the value's actually missing and it's not hidden behind undefined if...
javascript
function checkValueIsInObject(value, object, message) { checkNotEmpty(message, "No error message passed to checkValueIsInObject"); var key = findValueInObject(value, object); if (typeof key === "undefined") { // Make sure the value's actually missing and it's not hidden behind undefined if...
[ "function", "checkValueIsInObject", "(", "value", ",", "object", ",", "message", ")", "{", "checkNotEmpty", "(", "message", ",", "\"No error message passed to checkValueIsInObject\"", ")", ";", "var", "key", "=", "findValueInObject", "(", "value", ",", "object", ")"...
Checks that the value provided exists under one of the top-level keys in the object provided. If it does not, an error is thrown containing the message given. @param {mixed} value - A value to search for @param {object} object - An object to search in @param {string} message - A message to throw in an Error if the str...
[ "Checks", "that", "the", "value", "provided", "exists", "under", "one", "of", "the", "top", "-", "level", "keys", "in", "the", "object", "provided", ".", "If", "it", "does", "not", "an", "error", "is", "thrown", "containing", "the", "message", "given", "...
0e4b5e65531c23293d22ac766850c802b1266e48
https://github.com/chrishayesmu/DubBotBase/blob/0e4b5e65531c23293d22ac766850c802b1266e48/src/utils.js#L69-L80
train
chrishayesmu/DubBotBase
src/utils.js
deepEquals
function deepEquals(obj1, obj2) { if (typeof obj1 !== typeof obj2) { return false; } // NaN check if (obj1 !== obj1) { return obj2 !== obj2; } // Non-object types will compare correctly with === if (typeof obj1 !== "object") { return obj1 === obj2; } if (!_...
javascript
function deepEquals(obj1, obj2) { if (typeof obj1 !== typeof obj2) { return false; } // NaN check if (obj1 !== obj1) { return obj2 !== obj2; } // Non-object types will compare correctly with === if (typeof obj1 !== "object") { return obj1 === obj2; } if (!_...
[ "function", "deepEquals", "(", "obj1", ",", "obj2", ")", "{", "if", "(", "typeof", "obj1", "!==", "typeof", "obj2", ")", "{", "return", "false", ";", "}", "// NaN check", "if", "(", "obj1", "!==", "obj1", ")", "{", "return", "obj2", "!==", "obj2", ";...
Performs a deep check to see if the two values provided are equal. For non-object types, this refers to simple equality; for object types, the two objects must contain all of the same keys and have the same values behind all of those keys. THIS METHOD DOES NOT CHECK FOR CYCLES IN THE OBJECTS PROVIDED. Don't try to use...
[ "Performs", "a", "deep", "check", "to", "see", "if", "the", "two", "values", "provided", "are", "equal", ".", "For", "non", "-", "object", "types", "this", "refers", "to", "simple", "equality", ";", "for", "object", "types", "the", "two", "objects", "mus...
0e4b5e65531c23293d22ac766850c802b1266e48
https://github.com/chrishayesmu/DubBotBase/blob/0e4b5e65531c23293d22ac766850c802b1266e48/src/utils.js#L96-L120
train
chrishayesmu/DubBotBase
src/utils.js
findValueInObject
function findValueInObject(value, object) { checkHasType(object, "object", "Non-object value provided as second argument to findValueInObject"); checkHasValue(object, "Invalid null object provided as second argument to findValueInObject"); for (var key in object) { var objValue = object[key]; ...
javascript
function findValueInObject(value, object) { checkHasType(object, "object", "Non-object value provided as second argument to findValueInObject"); checkHasValue(object, "Invalid null object provided as second argument to findValueInObject"); for (var key in object) { var objValue = object[key]; ...
[ "function", "findValueInObject", "(", "value", ",", "object", ")", "{", "checkHasType", "(", "object", ",", "\"object\"", ",", "\"Non-object value provided as second argument to findValueInObject\"", ")", ";", "checkHasValue", "(", "object", ",", "\"Invalid null object prov...
Locates the value provided under the first level of keys in the given object. Since this function uses undefined as a return value when the provided value is not found, it is not possible to directly search for anything where the key is actually undefined. Anyone interested in this functionality can easily wrap this me...
[ "Locates", "the", "value", "provided", "under", "the", "first", "level", "of", "keys", "in", "the", "given", "object", ".", "Since", "this", "function", "uses", "undefined", "as", "a", "return", "value", "when", "the", "provided", "value", "is", "not", "fo...
0e4b5e65531c23293d22ac766850c802b1266e48
https://github.com/chrishayesmu/DubBotBase/blob/0e4b5e65531c23293d22ac766850c802b1266e48/src/utils.js#L133-L146
train
chrishayesmu/DubBotBase
src/utils.js
getAllFilePathsUnderDirectory
function getAllFilePathsUnderDirectory(directory) { // TODO: make this run in parallel, async var filesInBaseDir = fs.readdirSync(directory); var allFiles = []; if (!filesInBaseDir) { return allFiles; } for (var i = 0; i < filesInBaseDir.length; i++) { var filePath = path.reso...
javascript
function getAllFilePathsUnderDirectory(directory) { // TODO: make this run in parallel, async var filesInBaseDir = fs.readdirSync(directory); var allFiles = []; if (!filesInBaseDir) { return allFiles; } for (var i = 0; i < filesInBaseDir.length; i++) { var filePath = path.reso...
[ "function", "getAllFilePathsUnderDirectory", "(", "directory", ")", "{", "// TODO: make this run in parallel, async", "var", "filesInBaseDir", "=", "fs", ".", "readdirSync", "(", "directory", ")", ";", "var", "allFiles", "=", "[", "]", ";", "if", "(", "!", "filesI...
Retrieves all of the file paths which can be found in the base directory provided. The method recurses through all subdirectories within the base directory. Only file paths are returned; directories, symbolic links, etc, are not included. @param {string} directory - The path (relative or absolute) to the base director...
[ "Retrieves", "all", "of", "the", "file", "paths", "which", "can", "be", "found", "in", "the", "base", "directory", "provided", ".", "The", "method", "recurses", "through", "all", "subdirectories", "within", "the", "base", "directory", ".", "Only", "file", "p...
0e4b5e65531c23293d22ac766850c802b1266e48
https://github.com/chrishayesmu/DubBotBase/blob/0e4b5e65531c23293d22ac766850c802b1266e48/src/utils.js#L157-L180
train
chrishayesmu/DubBotBase
src/utils.js
_checkKeysFromFirstAreInSecond
function _checkKeysFromFirstAreInSecond(first, second) { for (var key in first) { if (!(key in second)) { return false; } var value1 = first[key]; var value2 = second[key]; if (!deepEquals(value1, value2)) { return false; } } return ...
javascript
function _checkKeysFromFirstAreInSecond(first, second) { for (var key in first) { if (!(key in second)) { return false; } var value1 = first[key]; var value2 = second[key]; if (!deepEquals(value1, value2)) { return false; } } return ...
[ "function", "_checkKeysFromFirstAreInSecond", "(", "first", ",", "second", ")", "{", "for", "(", "var", "key", "in", "first", ")", "{", "if", "(", "!", "(", "key", "in", "second", ")", ")", "{", "return", "false", ";", "}", "var", "value1", "=", "fir...
Checks that the keys which are in the first object are also in the second object, and that they have the same value in both places. @param {object} first - The first object to check @param {object} second - The second object to check @returns {boolean} True if all of the keys from the first are present and equal in th...
[ "Checks", "that", "the", "keys", "which", "are", "in", "the", "first", "object", "are", "also", "in", "the", "second", "object", "and", "that", "they", "have", "the", "same", "value", "in", "both", "places", "." ]
0e4b5e65531c23293d22ac766850c802b1266e48
https://github.com/chrishayesmu/DubBotBase/blob/0e4b5e65531c23293d22ac766850c802b1266e48/src/utils.js#L210-L225
train
Val-istar-Guo/koa-ajax-params
src/index.js
getBody
function getBody(req) { return new Promise((resolve, reject) => { let data = ''; req .on('data', (chunk) => { data += chunk; }) .on('end', () => { resolve(data); }) .on('error', reject); }); }
javascript
function getBody(req) { return new Promise((resolve, reject) => { let data = ''; req .on('data', (chunk) => { data += chunk; }) .on('end', () => { resolve(data); }) .on('error', reject); }); }
[ "function", "getBody", "(", "req", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "let", "data", "=", "''", ";", "req", ".", "on", "(", "'data'", ",", "(", "chunk", ")", "=>", "{", "data", "+=", "chunk",...
import querystring from 'querystring';
[ "import", "querystring", "from", "querystring", ";" ]
2f51b918421709479469f1e8908917ede25eb306
https://github.com/Val-istar-Guo/koa-ajax-params/blob/2f51b918421709479469f1e8908917ede25eb306/src/index.js#L4-L16
train
CleverStack/clever-accounts
controllers/AccountController.js
function(req, res, next) { var accData = req.user.Account , newData = { name: req.body.name || accData.name, logo: req.body.logo || accData.logo, info: req.body.info || accData.info, email: req.body.email || accData.emai...
javascript
function(req, res, next) { var accData = req.user.Account , newData = { name: req.body.name || accData.name, logo: req.body.logo || accData.logo, info: req.body.info || accData.info, email: req.body.email || accData.emai...
[ "function", "(", "req", ",", "res", ",", "next", ")", "{", "var", "accData", "=", "req", ".", "user", ".", "Account", ",", "newData", "=", "{", "name", ":", "req", ".", "body", ".", "name", "||", "accData", ".", "name", ",", "logo", ":", "req", ...
Middleware helper function to format data in POST or PUT requests @param {Request} req The Request Object @param {Response} res The response object @param {Function} next Continue past this middleware @return {void}
[ "Middleware", "helper", "function", "to", "format", "data", "in", "POST", "or", "PUT", "requests" ]
d9e136eef41ebd92884bc13d017ba8f5f66e5c67
https://github.com/CleverStack/clever-accounts/blob/d9e136eef41ebd92884bc13d017ba8f5f66e5c67/controllers/AccountController.js#L36-L48
train
CleverStack/clever-accounts
controllers/AccountController.js
function(req, res, next){ var subdomain = req.body.subdomain; if (!subdomain) { return res.json(400, 'Company subdomain is mandatory!'); } AccountService .find({ where: { subdomain: subdomain } }) .then(function(result){ ...
javascript
function(req, res, next){ var subdomain = req.body.subdomain; if (!subdomain) { return res.json(400, 'Company subdomain is mandatory!'); } AccountService .find({ where: { subdomain: subdomain } }) .then(function(result){ ...
[ "function", "(", "req", ",", "res", ",", "next", ")", "{", "var", "subdomain", "=", "req", ".", "body", ".", "subdomain", ";", "if", "(", "!", "subdomain", ")", "{", "return", "res", ".", "json", "(", "400", ",", "'Company subdomain is mandatory!'", ")...
Middleware helper function for requiring a unique subDomain for a given POST request @param {Request} req The Request Object @param {Response} res The response object @param {Function} next Continue past this middleware @return {void}
[ "Middleware", "helper", "function", "for", "requiring", "a", "unique", "subDomain", "for", "a", "given", "POST", "request" ]
d9e136eef41ebd92884bc13d017ba8f5f66e5c67
https://github.com/CleverStack/clever-accounts/blob/d9e136eef41ebd92884bc13d017ba8f5f66e5c67/controllers/AccountController.js#L58-L80
train
liymax/pddux
lib/index.js
finalize
function finalize(base, path, patches, inversePatches) { if (isProxy(base)) { var state = base[PROXY_STATE]; if (state.modified === true) { if (state.finalized === true) return state.copy; state.finalized = true; var result = finalizeObject(useProxies ...
javascript
function finalize(base, path, patches, inversePatches) { if (isProxy(base)) { var state = base[PROXY_STATE]; if (state.modified === true) { if (state.finalized === true) return state.copy; state.finalized = true; var result = finalizeObject(useProxies ...
[ "function", "finalize", "(", "base", ",", "path", ",", "patches", ",", "inversePatches", ")", "{", "if", "(", "isProxy", "(", "base", ")", ")", "{", "var", "state", "=", "base", "[", "PROXY_STATE", "]", ";", "if", "(", "state", ".", "modified", "==="...
given a base object, returns it if unmodified, or return the changed cloned if modified
[ "given", "a", "base", "object", "returns", "it", "if", "unmodified", "or", "return", "the", "changed", "cloned", "if", "modified" ]
cb1c8c74e5d32bbd9802eb2248cd9bcab8518749
https://github.com/liymax/pddux/blob/cb1c8c74e5d32bbd9802eb2248cd9bcab8518749/lib/index.js#L167-L182
train
liymax/pddux
lib/index.js
produce
function produce(baseState, producer, patchListener) { // prettier-ignore if (arguments.length < 1 || arguments.length > 3) throw new Error("produce expects 1 to 3 arguments, got " + arguments.length); // curried invocation if (typeof baseState === "function") { // prettier-ignore ...
javascript
function produce(baseState, producer, patchListener) { // prettier-ignore if (arguments.length < 1 || arguments.length > 3) throw new Error("produce expects 1 to 3 arguments, got " + arguments.length); // curried invocation if (typeof baseState === "function") { // prettier-ignore ...
[ "function", "produce", "(", "baseState", ",", "producer", ",", "patchListener", ")", "{", "// prettier-ignore", "if", "(", "arguments", ".", "length", "<", "1", "||", "arguments", ".", "length", ">", "3", ")", "throw", "new", "Error", "(", "\"produce expects...
produce takes a state, and runs a function against it. That function can freely mutate the state, as it will create copies-on-write. This means that the original state will stay unchanged, and once the function finishes, the modified state is returned @export @param {any} baseState - the state to start with @param {Fu...
[ "produce", "takes", "a", "state", "and", "runs", "a", "function", "against", "it", ".", "That", "function", "can", "freely", "mutate", "the", "state", "as", "it", "will", "create", "copies", "-", "on", "-", "write", ".", "This", "means", "that", "the", ...
cb1c8c74e5d32bbd9802eb2248cd9bcab8518749
https://github.com/liymax/pddux/blob/cb1c8c74e5d32bbd9802eb2248cd9bcab8518749/lib/index.js#L639-L677
train
lesx/lesx-jsx
lib/babel-core/src/config/option-manager.js
mergeOptions
function mergeOptions(config, pass) { var _this = this; var result = loadConfig(config); var plugins = result.plugins.map(function (descriptor) { return loadPluginDescriptor(descriptor); }); var presets = result.presets.map(function (descriptor) { return loadPresetDescrip...
javascript
function mergeOptions(config, pass) { var _this = this; var result = loadConfig(config); var plugins = result.plugins.map(function (descriptor) { return loadPluginDescriptor(descriptor); }); var presets = result.presets.map(function (descriptor) { return loadPresetDescrip...
[ "function", "mergeOptions", "(", "config", ",", "pass", ")", "{", "var", "_this", "=", "this", ";", "var", "result", "=", "loadConfig", "(", "config", ")", ";", "var", "plugins", "=", "result", ".", "plugins", ".", "map", "(", "function", "(", "descrip...
This is called when we want to merge the input `opts` into the base options. - `alias` is used to output pretty traces back to the original source. - `loc` is used to point to the original config. - `dirname` is used to resolve plugins relative to it.
[ "This", "is", "called", "when", "we", "want", "to", "merge", "the", "input", "opts", "into", "the", "base", "options", "." ]
6b82f5ee115add3fb61b83c8e22e83fad66ad437
https://github.com/lesx/lesx-jsx/blob/6b82f5ee115add3fb61b83c8e22e83fad66ad437/lib/babel-core/src/config/option-manager.js#L143-L188
train
lesx/lesx-jsx
lib/babel-core/src/config/option-manager.js
loadConfig
function loadConfig(config) { var options = normalizeOptions(config); if (config.options.plugins != null && !Array.isArray(config.options.plugins)) { throw new Error(".plugins should be an array, null, or undefined"); } var plugins = (config.options.plugins || []).map(function (plugin, index) { var _n...
javascript
function loadConfig(config) { var options = normalizeOptions(config); if (config.options.plugins != null && !Array.isArray(config.options.plugins)) { throw new Error(".plugins should be an array, null, or undefined"); } var plugins = (config.options.plugins || []).map(function (plugin, index) { var _n...
[ "function", "loadConfig", "(", "config", ")", "{", "var", "options", "=", "normalizeOptions", "(", "config", ")", ";", "if", "(", "config", ".", "options", ".", "plugins", "!=", "null", "&&", "!", "Array", ".", "isArray", "(", "config", ".", "options", ...
Load and validate the given config into a set of options, plugins, and presets.
[ "Load", "and", "validate", "the", "given", "config", "into", "a", "set", "of", "options", "plugins", "and", "presets", "." ]
6b82f5ee115add3fb61b83c8e22e83fad66ad437
https://github.com/lesx/lesx-jsx/blob/6b82f5ee115add3fb61b83c8e22e83fad66ad437/lib/babel-core/src/config/option-manager.js#L281-L323
train
lesx/lesx-jsx
lib/babel-core/src/config/option-manager.js
loadPresetDescriptor
function loadPresetDescriptor(descriptor) { return { type: "preset", options: loadDescriptor(descriptor).value, alias: descriptor.alias, loc: descriptor.loc, dirname: descriptor.dirname }; }
javascript
function loadPresetDescriptor(descriptor) { return { type: "preset", options: loadDescriptor(descriptor).value, alias: descriptor.alias, loc: descriptor.loc, dirname: descriptor.dirname }; }
[ "function", "loadPresetDescriptor", "(", "descriptor", ")", "{", "return", "{", "type", ":", "\"preset\"", ",", "options", ":", "loadDescriptor", "(", "descriptor", ")", ".", "value", ",", "alias", ":", "descriptor", ".", "alias", ",", "loc", ":", "descripto...
Generate a config object that will act as the root of a new nested config.
[ "Generate", "a", "config", "object", "that", "will", "act", "as", "the", "root", "of", "a", "new", "nested", "config", "." ]
6b82f5ee115add3fb61b83c8e22e83fad66ad437
https://github.com/lesx/lesx-jsx/blob/6b82f5ee115add3fb61b83c8e22e83fad66ad437/lib/babel-core/src/config/option-manager.js#L419-L427
train
karfcz/kff
src/View.js
function(options) { options = options || {}; this._modelBindersMap = null; this._collectionBinder = null; this._bindingIndex = null; this._itemAlias = null; this._subviewsStruct = null; this._explicitSubviewsStruct = null; this._pendingRefresh = false; this._pendingRefreshRoot = false; this._subv...
javascript
function(options) { options = options || {}; this._modelBindersMap = null; this._collectionBinder = null; this._bindingIndex = null; this._itemAlias = null; this._subviewsStruct = null; this._explicitSubviewsStruct = null; this._pendingRefresh = false; this._pendingRefreshRoot = false; this._subv...
[ "function", "(", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "this", ".", "_modelBindersMap", "=", "null", ";", "this", ".", "_collectionBinder", "=", "null", ";", "this", ".", "_bindingIndex", "=", "null", ";", "this", ".", "_...
Base class for views @constructs @param {Object} options Options object @param {DOM Element|jQuery} options.element A DOM element that will be a root element of the view @param {Array} options.scope Array of model instances to be used by the view
[ "Base", "class", "for", "views" ]
533b69e8bc9e9b7f60b403d776678bf1c06ac502
https://github.com/karfcz/kff/blob/533b69e8bc9e9b7f60b403d776678bf1c06ac502/src/View.js#L90-L165
train
karfcz/kff
src/View.js
function() { if(!this._modelBindersMap) this._initBinding(); if(!this._collectionBinder) { this._explicitSubviewsStruct = null; if(this._template) this.element.innerHTML = this._template; if(this.render !== noop) this.render(); this.renderSubviews(); } }
javascript
function() { if(!this._modelBindersMap) this._initBinding(); if(!this._collectionBinder) { this._explicitSubviewsStruct = null; if(this._template) this.element.innerHTML = this._template; if(this.render !== noop) this.render(); this.renderSubviews(); } }
[ "function", "(", ")", "{", "if", "(", "!", "this", ".", "_modelBindersMap", ")", "this", ".", "_initBinding", "(", ")", ";", "if", "(", "!", "this", ".", "_collectionBinder", ")", "{", "this", ".", "_explicitSubviewsStruct", "=", "null", ";", "if", "("...
Renders the view. It will be called automatically. Should not be called directly.
[ "Renders", "the", "view", ".", "It", "will", "be", "called", "automatically", ".", "Should", "not", "be", "called", "directly", "." ]
533b69e8bc9e9b7f60b403d776678bf1c06ac502
https://github.com/karfcz/kff/blob/533b69e8bc9e9b7f60b403d776678bf1c06ac502/src/View.js#L208-L220
train
karfcz/kff
src/View.js
function() { if(this._isRunning && !this._isSuspended) { var shouldRefresh = true; if(typeof this.shouldRefresh === 'function') shouldRefresh = this.shouldRefresh(); if(shouldRefresh) { if(typeof this.refresh === 'function') this.refresh(); if(this._collectionBinder) { this._collection...
javascript
function() { if(this._isRunning && !this._isSuspended) { var shouldRefresh = true; if(typeof this.shouldRefresh === 'function') shouldRefresh = this.shouldRefresh(); if(shouldRefresh) { if(typeof this.refresh === 'function') this.refresh(); if(this._collectionBinder) { this._collection...
[ "function", "(", ")", "{", "if", "(", "this", ".", "_isRunning", "&&", "!", "this", ".", "_isSuspended", ")", "{", "var", "shouldRefresh", "=", "true", ";", "if", "(", "typeof", "this", ".", "shouldRefresh", "===", "'function'", ")", "shouldRefresh", "="...
Refreshes all binders, subviews and bound views
[ "Refreshes", "all", "binders", "subviews", "and", "bound", "views" ]
533b69e8bc9e9b7f60b403d776678bf1c06ac502
https://github.com/karfcz/kff/blob/533b69e8bc9e9b7f60b403d776678bf1c06ac502/src/View.js#L350-L376
train
karfcz/kff
src/View.js
function() { var view = this; while(view.parentView) { view = view.parentView; } if(view.dispatcher !== null) { view.dispatcher.trigger({ type: 'refresh' }); this._pendingRefreshRoot = false; } }
javascript
function() { var view = this; while(view.parentView) { view = view.parentView; } if(view.dispatcher !== null) { view.dispatcher.trigger({ type: 'refresh' }); this._pendingRefreshRoot = false; } }
[ "function", "(", ")", "{", "var", "view", "=", "this", ";", "while", "(", "view", ".", "parentView", ")", "{", "view", "=", "view", ".", "parentView", ";", "}", "if", "(", "view", ".", "dispatcher", "!==", "null", ")", "{", "view", ".", "dispatcher...
Refreshes all views from root
[ "Refreshes", "all", "views", "from", "root" ]
533b69e8bc9e9b7f60b403d776678bf1c06ac502
https://github.com/karfcz/kff/blob/533b69e8bc9e9b7f60b403d776678bf1c06ac502/src/View.js#L381-L394
train
karfcz/kff
src/View.js
function() { this._destroyBinding(); if(this._collectionBinder) this._collectionBinder.destroyBoundViews(); this._modelBindersMap = null; this._collectionBinder = null; this._bindingIndex = null; this._itemAlias = null; this.element.removeAttribute(settings.DATA_RENDERED_ATTR); this.undelegateEvents...
javascript
function() { this._destroyBinding(); if(this._collectionBinder) this._collectionBinder.destroyBoundViews(); this._modelBindersMap = null; this._collectionBinder = null; this._bindingIndex = null; this._itemAlias = null; this.element.removeAttribute(settings.DATA_RENDERED_ATTR); this.undelegateEvents...
[ "function", "(", ")", "{", "this", ".", "_destroyBinding", "(", ")", ";", "if", "(", "this", ".", "_collectionBinder", ")", "this", ".", "_collectionBinder", ".", "destroyBoundViews", "(", ")", ";", "this", ".", "_modelBindersMap", "=", "null", ";", "this"...
Destroys the view (destroys all subviews and unbinds previously bound DOM events. It will be called automatically. Should not be called directly.
[ "Destroys", "the", "view", "(", "destroys", "all", "subviews", "and", "unbinds", "previously", "bound", "DOM", "events", ".", "It", "will", "be", "called", "automatically", ".", "Should", "not", "be", "called", "directly", "." ]
533b69e8bc9e9b7f60b403d776678bf1c06ac502
https://github.com/karfcz/kff/blob/533b69e8bc9e9b7f60b403d776678bf1c06ac502/src/View.js#L400-L431
train
karfcz/kff
src/View.js
function() { if(this._collectionBinder) { this._collectionBinder.destroyBoundViews(); } else { var subView, i, l; // Destroy subviews if(this.subviews !== null) { for(i = 0, l = this.subviews.length; i < l; i++) { subView = this.subviews[i]; subView.destroyAll(); } } ...
javascript
function() { if(this._collectionBinder) { this._collectionBinder.destroyBoundViews(); } else { var subView, i, l; // Destroy subviews if(this.subviews !== null) { for(i = 0, l = this.subviews.length; i < l; i++) { subView = this.subviews[i]; subView.destroyAll(); } } ...
[ "function", "(", ")", "{", "if", "(", "this", ".", "_collectionBinder", ")", "{", "this", ".", "_collectionBinder", ".", "destroyBoundViews", "(", ")", ";", "}", "else", "{", "var", "subView", ",", "i", ",", "l", ";", "// Destroy subviews", "if", "(", ...
Destroys the subviews. It will be called automatically. Should not be called directly.
[ "Destroys", "the", "subviews", ".", "It", "will", "be", "called", "automatically", ".", "Should", "not", "be", "called", "directly", "." ]
533b69e8bc9e9b7f60b403d776678bf1c06ac502
https://github.com/karfcz/kff/blob/533b69e8bc9e9b7f60b403d776678bf1c06ac502/src/View.js#L532-L554
train
karfcz/kff
src/View.js
function(keyPath) { if(typeof keyPath === 'string') keyPath = keyPath.split('.'); var rootCursorName = keyPath[0]; keyPath = keyPath.slice(1); var rootCursor = this.scope[rootCursorName]; if(!(rootCursor instanceof Cursor)) rootCursor = new Cursor(rootCursor, keyPath); var cursor = rootCursor.refine(keyP...
javascript
function(keyPath) { if(typeof keyPath === 'string') keyPath = keyPath.split('.'); var rootCursorName = keyPath[0]; keyPath = keyPath.slice(1); var rootCursor = this.scope[rootCursorName]; if(!(rootCursor instanceof Cursor)) rootCursor = new Cursor(rootCursor, keyPath); var cursor = rootCursor.refine(keyP...
[ "function", "(", "keyPath", ")", "{", "if", "(", "typeof", "keyPath", "===", "'string'", ")", "keyPath", "=", "keyPath", ".", "split", "(", "'.'", ")", ";", "var", "rootCursorName", "=", "keyPath", "[", "0", "]", ";", "keyPath", "=", "keyPath", ".", ...
Returns a model object bound to the view or to the parent view. Accepts the model name as a string or key path in the form of "modelName.attribute.nextAttribute etc.". Will search for "modelName" in current view, then in parent view etc. When found, returns a value of "attribute.nextAtrribute" using model's mget metho...
[ "Returns", "a", "model", "object", "bound", "to", "the", "view", "or", "to", "the", "parent", "view", "." ]
533b69e8bc9e9b7f60b403d776678bf1c06ac502
https://github.com/karfcz/kff/blob/533b69e8bc9e9b7f60b403d776678bf1c06ac502/src/View.js#L578-L590
train
karfcz/kff
src/View.js
function(events) { if(!Array.isArray(events)) { if(arguments.length === 2 || arguments.length === 3) this.domEvents.push(Array.prototype.slice.apply(arguments)); return; } else if(!Array.isArray(events[0])) { events = Array.prototype.slice.apply(arguments); } Array.prototype.push.apply(this.domE...
javascript
function(events) { if(!Array.isArray(events)) { if(arguments.length === 2 || arguments.length === 3) this.domEvents.push(Array.prototype.slice.apply(arguments)); return; } else if(!Array.isArray(events[0])) { events = Array.prototype.slice.apply(arguments); } Array.prototype.push.apply(this.domE...
[ "function", "(", "events", ")", "{", "if", "(", "!", "Array", ".", "isArray", "(", "events", ")", ")", "{", "if", "(", "arguments", ".", "length", "===", "2", "||", "arguments", ".", "length", "===", "3", ")", "this", ".", "domEvents", ".", "push",...
Adds events config to the internal events array. @private @param {Array} events Array of arrays of binding config
[ "Adds", "events", "config", "to", "the", "internal", "events", "array", "." ]
533b69e8bc9e9b7f60b403d776678bf1c06ac502
https://github.com/karfcz/kff/blob/533b69e8bc9e9b7f60b403d776678bf1c06ac502/src/View.js#L598-L610
train
karfcz/kff
src/View.js
function(viewName, options) { var subView, args; if(this._subviewsArgs && Array.isArray(this._subviewsArgs[viewName])) { args = this._subviewsArgs[viewName]; if(typeof args[0] === 'object' && args[0] !== null) options = immerge(options, args[0]); } options.parentView = this; if(viewName === 'View'...
javascript
function(viewName, options) { var subView, args; if(this._subviewsArgs && Array.isArray(this._subviewsArgs[viewName])) { args = this._subviewsArgs[viewName]; if(typeof args[0] === 'object' && args[0] !== null) options = immerge(options, args[0]); } options.parentView = this; if(viewName === 'View'...
[ "function", "(", "viewName", ",", "options", ")", "{", "var", "subView", ",", "args", ";", "if", "(", "this", ".", "_subviewsArgs", "&&", "Array", ".", "isArray", "(", "this", ".", "_subviewsArgs", "[", "viewName", "]", ")", ")", "{", "args", "=", "t...
Creates a new subview and adds it to the internal subviews list. Do not use this method directly, use addSubview method instead. @private @param {String} viewName Name of the view @param {Object} options Options object for the subview constructor @return {View} Created view
[ "Creates", "a", "new", "subview", "and", "adds", "it", "to", "the", "internal", "subviews", "list", ".", "Do", "not", "use", "this", "method", "directly", "use", "addSubview", "method", "instead", "." ]
533b69e8bc9e9b7f60b403d776678bf1c06ac502
https://github.com/karfcz/kff/blob/533b69e8bc9e9b7f60b403d776678bf1c06ac502/src/View.js#L709-L729
train
karfcz/kff
src/View.js
function(element, viewName, options) { if(this._explicitSubviewsStruct === null) this._explicitSubviewsStruct = []; this._explicitSubviewsStruct.push({ viewName: viewName, element: element, options: options || {} }); }
javascript
function(element, viewName, options) { if(this._explicitSubviewsStruct === null) this._explicitSubviewsStruct = []; this._explicitSubviewsStruct.push({ viewName: viewName, element: element, options: options || {} }); }
[ "function", "(", "element", ",", "viewName", ",", "options", ")", "{", "if", "(", "this", ".", "_explicitSubviewsStruct", "===", "null", ")", "this", ".", "_explicitSubviewsStruct", "=", "[", "]", ";", "this", ".", "_explicitSubviewsStruct", ".", "push", "("...
Adds subview metadata to the internal list. The subviews from this list are then rendered in renderSubviews method which is automatically called when the view is rendered. This method can be used is in the render method to manually create a view that is not parsed from html/template (for example for an element that si...
[ "Adds", "subview", "metadata", "to", "the", "internal", "list", ".", "The", "subviews", "from", "this", "list", "are", "then", "rendered", "in", "renderSubviews", "method", "which", "is", "automatically", "called", "when", "the", "view", "is", "rendered", "." ...
533b69e8bc9e9b7f60b403d776678bf1c06ac502
https://github.com/karfcz/kff/blob/533b69e8bc9e9b7f60b403d776678bf1c06ac502/src/View.js#L744-L752
train
karfcz/kff
src/View.js
function(force) { if(this._collectionBinder) { this._collectionBinder.refreshBinders(force); } else { this._refreshOwnBinders(force); if(this.subviews !== null) { for(var i = 0, l = this.subviews.length; i < l; i++) this.subviews[i].refreshBinders(force); } } }
javascript
function(force) { if(this._collectionBinder) { this._collectionBinder.refreshBinders(force); } else { this._refreshOwnBinders(force); if(this.subviews !== null) { for(var i = 0, l = this.subviews.length; i < l; i++) this.subviews[i].refreshBinders(force); } } }
[ "function", "(", "force", ")", "{", "if", "(", "this", ".", "_collectionBinder", ")", "{", "this", ".", "_collectionBinder", ".", "refreshBinders", "(", "force", ")", ";", "}", "else", "{", "this", ".", "_refreshOwnBinders", "(", "force", ")", ";", "if",...
Refreshes data-binders in all subviews. @param {Object} event Any event object that caused refreshing
[ "Refreshes", "data", "-", "binders", "in", "all", "subviews", "." ]
533b69e8bc9e9b7f60b403d776678bf1c06ac502
https://github.com/karfcz/kff/blob/533b69e8bc9e9b7f60b403d776678bf1c06ac502/src/View.js#L764-L778
train
karfcz/kff
src/View.js
function() { if(this._collectionBinder) { this._collectionBinder.refreshIndexedBinders(); } else { if(this._modelBindersMap) { this._modelBindersMap.refreshIndexedBinders(); } if(this.subviews !== null) { for(var i = 0, l = this.subviews.length; i < l; i++) this.subviews[i].refreshI...
javascript
function() { if(this._collectionBinder) { this._collectionBinder.refreshIndexedBinders(); } else { if(this._modelBindersMap) { this._modelBindersMap.refreshIndexedBinders(); } if(this.subviews !== null) { for(var i = 0, l = this.subviews.length; i < l; i++) this.subviews[i].refreshI...
[ "function", "(", ")", "{", "if", "(", "this", ".", "_collectionBinder", ")", "{", "this", ".", "_collectionBinder", ".", "refreshIndexedBinders", "(", ")", ";", "}", "else", "{", "if", "(", "this", ".", "_modelBindersMap", ")", "{", "this", ".", "_modelB...
Refreshes all indexed binders of this view or subviews @private @return {[type]} [description]
[ "Refreshes", "all", "indexed", "binders", "of", "this", "view", "or", "subviews" ]
533b69e8bc9e9b7f60b403d776678bf1c06ac502
https://github.com/karfcz/kff/blob/533b69e8bc9e9b7f60b403d776678bf1c06ac502/src/View.js#L786-L803
train
karfcz/kff
src/View.js
function() { var l; var clonedSubview; var options = this.options; options.parentView = null; options.env = this.env; options._clone = true; var clonedView = new this.constructor(options); if(this.subviews !== null) { l = this.subviews.length; clonedView.subviews = new Array(l); while(l--...
javascript
function() { var l; var clonedSubview; var options = this.options; options.parentView = null; options.env = this.env; options._clone = true; var clonedView = new this.constructor(options); if(this.subviews !== null) { l = this.subviews.length; clonedView.subviews = new Array(l); while(l--...
[ "function", "(", ")", "{", "var", "l", ";", "var", "clonedSubview", ";", "var", "options", "=", "this", ".", "options", ";", "options", ".", "parentView", "=", "null", ";", "options", ".", "env", "=", "this", ".", "env", ";", "options", ".", "_clone"...
Clones this binding view @return {View} Cloned view
[ "Clones", "this", "binding", "view" ]
533b69e8bc9e9b7f60b403d776678bf1c06ac502
https://github.com/karfcz/kff/blob/533b69e8bc9e9b7f60b403d776678bf1c06ac502/src/View.js#L888-L941
train
karfcz/kff
src/View.js
function(element) { var i, l; this.element = element; this._rebindSubViews(element, { subviewIndex: 0, subviewsStructIndex: 0, index: 0 }); if(this._modelBindersMap) { this._modelBindersMap.setView(this); } if(this._collectionBinder) { this._collectionBinder.view = this; } }
javascript
function(element) { var i, l; this.element = element; this._rebindSubViews(element, { subviewIndex: 0, subviewsStructIndex: 0, index: 0 }); if(this._modelBindersMap) { this._modelBindersMap.setView(this); } if(this._collectionBinder) { this._collectionBinder.view = this; } }
[ "function", "(", "element", ")", "{", "var", "i", ",", "l", ";", "this", ".", "element", "=", "element", ";", "this", ".", "_rebindSubViews", "(", "element", ",", "{", "subviewIndex", ":", "0", ",", "subviewsStructIndex", ":", "0", ",", "index", ":", ...
Rebinds the view to another DOM element @private @param {DOMELement} element New DOM element of the view
[ "Rebinds", "the", "view", "to", "another", "DOM", "element" ]
533b69e8bc9e9b7f60b403d776678bf1c06ac502
https://github.com/karfcz/kff/blob/533b69e8bc9e9b7f60b403d776678bf1c06ac502/src/View.js#L982-L1004
train
binder-project/binder-logging
lib/reader.js
BinderLogReader
function BinderLogReader () { this.config = defaultConfig var staticLogsUrl = this.config.host + ':' + this.config.elasticsearch.port this.client = new elasticsearch.Client({ host: staticLogsUrl, log: 'error' }) }
javascript
function BinderLogReader () { this.config = defaultConfig var staticLogsUrl = this.config.host + ':' + this.config.elasticsearch.port this.client = new elasticsearch.Client({ host: staticLogsUrl, log: 'error' }) }
[ "function", "BinderLogReader", "(", ")", "{", "this", ".", "config", "=", "defaultConfig", "var", "staticLogsUrl", "=", "this", ".", "config", ".", "host", "+", "':'", "+", "this", ".", "config", ".", "elasticsearch", ".", "port", "this", ".", "client", ...
Reads or streams Binder log messages, optionally for a specific application @constructor
[ "Reads", "or", "streams", "Binder", "log", "messages", "optionally", "for", "a", "specific", "application" ]
e31b21a4fd3fa815664dc79c9c2a95a0dbfc7632
https://github.com/binder-project/binder-logging/blob/e31b21a4fd3fa815664dc79c9c2a95a0dbfc7632/lib/reader.js#L30-L37
train
binder-project/binder-logging
lib/reader.js
function (config) { if (!config) { config = defaultConfig } var error = validateConfig(config) if (error) { } config = assign(defaultConfig, config) return new BinderLogReader(config) }
javascript
function (config) { if (!config) { config = defaultConfig } var error = validateConfig(config) if (error) { } config = assign(defaultConfig, config) return new BinderLogReader(config) }
[ "function", "(", "config", ")", "{", "if", "(", "!", "config", ")", "{", "config", "=", "defaultConfig", "}", "var", "error", "=", "validateConfig", "(", "config", ")", "if", "(", "error", ")", "{", "}", "config", "=", "assign", "(", "defaultConfig", ...
Returns an instance of BinderLogReader @param {object} config - BinderLogReader configuration options
[ "Returns", "an", "instance", "of", "BinderLogReader" ]
e31b21a4fd3fa815664dc79c9c2a95a0dbfc7632
https://github.com/binder-project/binder-logging/blob/e31b21a4fd3fa815664dc79c9c2a95a0dbfc7632/lib/reader.js#L161-L170
train
AndreasMadsen/steer
lib/extension.js
function(done) { var source = __dirname + '/background.js'; var dest = self.dir + '/background.js'; fs.readFile(source, 'utf8', function(err, background) { if (err) return done(err); // Make background.js connect with the websocke...
javascript
function(done) { var source = __dirname + '/background.js'; var dest = self.dir + '/background.js'; fs.readFile(source, 'utf8', function(err, background) { if (err) return done(err); // Make background.js connect with the websocke...
[ "function", "(", "done", ")", "{", "var", "source", "=", "__dirname", "+", "'/background.js'", ";", "var", "dest", "=", "self", ".", "dir", "+", "'/background.js'", ";", "fs", ".", "readFile", "(", "source", ",", "'utf8'", ",", "function", "(", "err", ...
write background.js the file that connect to the websocket server defined in this file
[ "write", "background", ".", "js", "the", "file", "that", "connect", "to", "the", "websocket", "server", "defined", "in", "this", "file" ]
5f19587abb1d6384bcff3e4bdede1fdce178d7b2
https://github.com/AndreasMadsen/steer/blob/5f19587abb1d6384bcff3e4bdede1fdce178d7b2/lib/extension.js#L78-L90
train
AndreasMadsen/steer
lib/extension.js
closeServer
function closeServer(done) { if (self.server) { self.server.close(); self.server.removeListener('error', handlers.relayError); } self.httpServer.close(done); }
javascript
function closeServer(done) { if (self.server) { self.server.close(); self.server.removeListener('error', handlers.relayError); } self.httpServer.close(done); }
[ "function", "closeServer", "(", "done", ")", "{", "if", "(", "self", ".", "server", ")", "{", "self", ".", "server", ".", "close", "(", ")", ";", "self", ".", "server", ".", "removeListener", "(", "'error'", ",", "handlers", ".", "relayError", ")", "...
close down the the server used for websockets
[ "close", "down", "the", "the", "server", "used", "for", "websockets" ]
5f19587abb1d6384bcff3e4bdede1fdce178d7b2
https://github.com/AndreasMadsen/steer/blob/5f19587abb1d6384bcff3e4bdede1fdce178d7b2/lib/extension.js#L123-L129
train
AndreasMadsen/steer
lib/extension.js
removeExtensionDir
function removeExtensionDir(done) { if (!self.dir) return done(null); rimraf(self.dir, done); }
javascript
function removeExtensionDir(done) { if (!self.dir) return done(null); rimraf(self.dir, done); }
[ "function", "removeExtensionDir", "(", "done", ")", "{", "if", "(", "!", "self", ".", "dir", ")", "return", "done", "(", "null", ")", ";", "rimraf", "(", "self", ".", "dir", ",", "done", ")", ";", "}" ]
remove extension files
[ "remove", "extension", "files" ]
5f19587abb1d6384bcff3e4bdede1fdce178d7b2
https://github.com/AndreasMadsen/steer/blob/5f19587abb1d6384bcff3e4bdede1fdce178d7b2/lib/extension.js#L132-L136
train
thlorenz/ispawn
ispawn.js
createAndSpawn
function createAndSpawn(opts) { const spawned = createSpawn(opts) const termination = spawned.spawn() return { termination, proc: spawned.proc } }
javascript
function createAndSpawn(opts) { const spawned = createSpawn(opts) const termination = spawned.spawn() return { termination, proc: spawned.proc } }
[ "function", "createAndSpawn", "(", "opts", ")", "{", "const", "spawned", "=", "createSpawn", "(", "opts", ")", "const", "termination", "=", "spawned", ".", "spawn", "(", ")", "return", "{", "termination", ",", "proc", ":", "spawned", ".", "proc", "}", "}...
Spawns a process with the given options allowing to intercept `stdout` and `stderr` output of the application itself or the underlying process, i.e. V8 and Node.js messages. ### onStdout and onStderr interceptors The functions, `onStdout`, `onStderr` called with each line written to the respective file descriptor hav...
[ "Spawns", "a", "process", "with", "the", "given", "options", "allowing", "to", "intercept", "stdout", "and", "stderr", "output", "of", "the", "application", "itself", "or", "the", "underlying", "process", "i", ".", "e", ".", "V8", "and", "Node", ".", "js",...
5709839b44764d60f2cd78e1cf78a6a5afed9ac2
https://github.com/thlorenz/ispawn/blob/5709839b44764d60f2cd78e1cf78a6a5afed9ac2/ispawn.js#L172-L176
train
JimmyRobz/mokuai
utils/bool-string-option.js
boolStringOption
function boolStringOption(value){ if(value === 'true' || value === true) return true; if(value === 'false' || value === false) return false; return value; }
javascript
function boolStringOption(value){ if(value === 'true' || value === true) return true; if(value === 'false' || value === false) return false; return value; }
[ "function", "boolStringOption", "(", "value", ")", "{", "if", "(", "value", "===", "'true'", "||", "value", "===", "true", ")", "return", "true", ";", "if", "(", "value", "===", "'false'", "||", "value", "===", "false", ")", "return", "false", ";", "re...
Utility function to get the option value from string or boolean value
[ "Utility", "function", "to", "get", "the", "option", "value", "from", "string", "or", "boolean", "value" ]
02ba6dfd6fb61b4a124e15a8252cff7e940132ac
https://github.com/JimmyRobz/mokuai/blob/02ba6dfd6fb61b4a124e15a8252cff7e940132ac/utils/bool-string-option.js#L2-L6
train
spacemaus/postvox
vox-server/interchangeserver.js
createExpressAppServer
function createExpressAppServer(app, port) { return new P(function(resolve, reject) { var appServer = app.listen(port, function() { var addr = appServer.address(); resolve({ app: app, appServer: appServer, serverUrl: url.format({ protocol: 'http', hostname: addr.address, ...
javascript
function createExpressAppServer(app, port) { return new P(function(resolve, reject) { var appServer = app.listen(port, function() { var addr = appServer.address(); resolve({ app: app, appServer: appServer, serverUrl: url.format({ protocol: 'http', hostname: addr.address, ...
[ "function", "createExpressAppServer", "(", "app", ",", "port", ")", "{", "return", "new", "P", "(", "function", "(", "resolve", ",", "reject", ")", "{", "var", "appServer", "=", "app", ".", "listen", "(", "port", ",", "function", "(", ")", "{", "var", ...
Creates an Express app and begins listening on the configured address. @param {Function} app The express app. @param {Number} port The port to listen on. @returns {Promise<Object>} app_server: The server listening to the given port. serverUrl: The url to report to clients.
[ "Creates", "an", "Express", "app", "and", "begins", "listening", "on", "the", "configured", "address", "." ]
de98e5ed37edaee1b1edadf93e15eb8f8d21f457
https://github.com/spacemaus/postvox/blob/de98e5ed37edaee1b1edadf93e15eb8f8d21f457/vox-server/interchangeserver.js#L71-L82
train
MauroJr/amp
src/encode.js
encode
function encode(args) { const argc = args.length; let len = 1; let off = 0; var i; // data length for (i = 0; i < argc; i += 1) { len += 4 + args[i].length; } // buffer const buf = Buffer.alloc(len); // pack meta buf[off += 1] = (VERSION << 4) | argc; // pack args for (i = 0; i < argc;...
javascript
function encode(args) { const argc = args.length; let len = 1; let off = 0; var i; // data length for (i = 0; i < argc; i += 1) { len += 4 + args[i].length; } // buffer const buf = Buffer.alloc(len); // pack meta buf[off += 1] = (VERSION << 4) | argc; // pack args for (i = 0; i < argc;...
[ "function", "encode", "(", "args", ")", "{", "const", "argc", "=", "args", ".", "length", ";", "let", "len", "=", "1", ";", "let", "off", "=", "0", ";", "var", "i", ";", "// data length", "for", "(", "i", "=", "0", ";", "i", "<", "argc", ";", ...
Encode `msg` and `args`. @param {Array} args @return {Buffer} @api public
[ "Encode", "msg", "and", "args", "." ]
2b7df0bcf91228d02bdd6d6f1e1238743dbbb086
https://github.com/MauroJr/amp/blob/2b7df0bcf91228d02bdd6d6f1e1238743dbbb086/src/encode.js#L18-L47
train
tmpfs/ttycolor
index.js
proxy
function proxy(options, format) { var tty = options.tty , method = options.method , re = /(%[sdj])+/g , start , end; if(arguments.length === 1) { return method.apply(console, []); } var arg, i, replacing, replacements, matches, tag; replacing = (typeof format === 'string') && re.test(f...
javascript
function proxy(options, format) { var tty = options.tty , method = options.method , re = /(%[sdj])+/g , start , end; if(arguments.length === 1) { return method.apply(console, []); } var arg, i, replacing, replacements, matches, tag; replacing = (typeof format === 'string') && re.test(f...
[ "function", "proxy", "(", "options", ",", "format", ")", "{", "var", "tty", "=", "options", ".", "tty", ",", "method", "=", "options", ".", "method", ",", "re", "=", "/", "(%[sdj])+", "/", "g", ",", "start", ",", "end", ";", "if", "(", "arguments",...
Escapes replacement values. @param options Proxy configuration options. @param options.tty A boolean indicating whether the output is a tty. @param options.method A method to proxy to. @param options.stream A writable stream to write to. @param format The format string. @param ... The format string arguments.
[ "Escapes", "replacement", "values", "." ]
4b72de7f61bfd922f227f3f4e7c61fb95ff9c023
https://github.com/tmpfs/ttycolor/blob/4b72de7f61bfd922f227f3f4e7c61fb95ff9c023/index.js#L23-L92
train
tmpfs/ttycolor
index.js
format
function format(fmt) { var args = [].slice.call(arguments, 0); var tty = true; var test = (typeof fmt === 'function') ? fmt : null; if(test) { tty = test(); args.shift(); } args.unshift({scope: util, method: util.format, tty: tty}); //console.dir(args); return proxy.apply(null, args); }
javascript
function format(fmt) { var args = [].slice.call(arguments, 0); var tty = true; var test = (typeof fmt === 'function') ? fmt : null; if(test) { tty = test(); args.shift(); } args.unshift({scope: util, method: util.format, tty: tty}); //console.dir(args); return proxy.apply(null, args); }
[ "function", "format", "(", "fmt", ")", "{", "var", "args", "=", "[", "]", ".", "slice", ".", "call", "(", "arguments", ",", "0", ")", ";", "var", "tty", "=", "true", ";", "var", "test", "=", "(", "typeof", "fmt", "===", "'function'", ")", "?", ...
Retrieve a formatted string.
[ "Retrieve", "a", "formatted", "string", "." ]
4b72de7f61bfd922f227f3f4e7c61fb95ff9c023
https://github.com/tmpfs/ttycolor/blob/4b72de7f61bfd922f227f3f4e7c61fb95ff9c023/index.js#L150-L161
train
tmpfs/ttycolor
index.js
main
function main(option, parser, force) { if(typeof option === 'function') { parser = option; option = null; } if(option !== false) { option = option || parse.option; parser = parser || parse; } //var mode = parse.auto; if(typeof parser === 'function') { module.exports.mode = parser(parse.m...
javascript
function main(option, parser, force) { if(typeof option === 'function') { parser = option; option = null; } if(option !== false) { option = option || parse.option; parser = parser || parse; } //var mode = parse.auto; if(typeof parser === 'function') { module.exports.mode = parser(parse.m...
[ "function", "main", "(", "option", ",", "parser", ",", "force", ")", "{", "if", "(", "typeof", "option", "===", "'function'", ")", "{", "parser", "=", "option", ";", "option", "=", "null", ";", "}", "if", "(", "option", "!==", "false", ")", "{", "o...
Module main entry point to initialize console method overrides. @param option The option name to use when parsing command line argments. @param parser The command line parser implementation. @param force Force initialization.
[ "Module", "main", "entry", "point", "to", "initialize", "console", "method", "overrides", "." ]
4b72de7f61bfd922f227f3f4e7c61fb95ff9c023
https://github.com/tmpfs/ttycolor/blob/4b72de7f61bfd922f227f3f4e7c61fb95ff9c023/index.js#L201-L216
train
samsonjs/gitter
lib/index.js
camel
function camel(s) { return s.replace(/_(.)/g, function(_, l) { return l.toUpperCase() }) }
javascript
function camel(s) { return s.replace(/_(.)/g, function(_, l) { return l.toUpperCase() }) }
[ "function", "camel", "(", "s", ")", "{", "return", "s", ".", "replace", "(", "/", "_(.)", "/", "g", ",", "function", "(", "_", ",", "l", ")", "{", "return", "l", ".", "toUpperCase", "(", ")", "}", ")", "}" ]
created_at => createdAt
[ "created_at", "=", ">", "createdAt" ]
ac9f2f618154f03b68a8b49addd28cfd55a260bc
https://github.com/samsonjs/gitter/blob/ac9f2f618154f03b68a8b49addd28cfd55a260bc/lib/index.js#L455-L457
train
samsonjs/gitter
lib/index.js
camelize
function camelize(obj) { if (!obj || typeof obj === 'string') return obj if (Array.isArray(obj)) return obj.map(camelize) if (typeof obj === 'object') { return Object.keys(obj).reduce(function(camelizedObj, k) { camelizedObj[camel(k)] = camelize(obj[k]) return camelizedObj }, {})...
javascript
function camelize(obj) { if (!obj || typeof obj === 'string') return obj if (Array.isArray(obj)) return obj.map(camelize) if (typeof obj === 'object') { return Object.keys(obj).reduce(function(camelizedObj, k) { camelizedObj[camel(k)] = camelize(obj[k]) return camelizedObj }, {})...
[ "function", "camelize", "(", "obj", ")", "{", "if", "(", "!", "obj", "||", "typeof", "obj", "===", "'string'", ")", "return", "obj", "if", "(", "Array", ".", "isArray", "(", "obj", ")", ")", "return", "obj", ".", "map", "(", "camelize", ")", "if", ...
camelize all keys of an object, or all objects in an array
[ "camelize", "all", "keys", "of", "an", "object", "or", "all", "objects", "in", "an", "array" ]
ac9f2f618154f03b68a8b49addd28cfd55a260bc
https://github.com/samsonjs/gitter/blob/ac9f2f618154f03b68a8b49addd28cfd55a260bc/lib/index.js#L460-L470
train
MD4/potato-masher
lib/map.js
_mainMap
function _mainMap(data, schema, options) { options = options || {}; var mapping = _map(data, schema, options); if (options.removeChanged) { var mappedFields = _getMappedFields(schema); mappedFields.forEach(function (field) { _removeMappedFields(mapping, field); }); ...
javascript
function _mainMap(data, schema, options) { options = options || {}; var mapping = _map(data, schema, options); if (options.removeChanged) { var mappedFields = _getMappedFields(schema); mappedFields.forEach(function (field) { _removeMappedFields(mapping, field); }); ...
[ "function", "_mainMap", "(", "data", ",", "schema", ",", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "var", "mapping", "=", "_map", "(", "data", ",", "schema", ",", "options", ")", ";", "if", "(", "options", ".", "removeChang...
Main map function Returns a new object with its new aspect given by the schema @param data @param schema @param options @returns {*} @private
[ "Main", "map", "function", "Returns", "a", "new", "object", "with", "its", "new", "aspect", "given", "by", "the", "schema" ]
88e21a45350e7204f4102e7186c5beaa8753bd7f
https://github.com/MD4/potato-masher/blob/88e21a45350e7204f4102e7186c5beaa8753bd7f/lib/map.js#L20-L31
train
MD4/potato-masher
lib/map.js
_map
function _map(data, schema, options) { options = options || {}; if (!schema || data === null) { return data; } if (schema instanceof Array) { return _mapArray(data, schema, options); } if (typeof schema === 'object') { return _mapObject(data, schema, options); } r...
javascript
function _map(data, schema, options) { options = options || {}; if (!schema || data === null) { return data; } if (schema instanceof Array) { return _mapArray(data, schema, options); } if (typeof schema === 'object') { return _mapObject(data, schema, options); } r...
[ "function", "_map", "(", "data", ",", "schema", ",", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "if", "(", "!", "schema", "||", "data", "===", "null", ")", "{", "return", "data", ";", "}", "if", "(", "schema", "instanceof"...
Returns a new object with its new aspect given by the schema @param data Object to map @param schema Fields to map @param options Options @returns {*} @private
[ "Returns", "a", "new", "object", "with", "its", "new", "aspect", "given", "by", "the", "schema" ]
88e21a45350e7204f4102e7186c5beaa8753bd7f
https://github.com/MD4/potato-masher/blob/88e21a45350e7204f4102e7186c5beaa8753bd7f/lib/map.js#L41-L53
train
MD4/potato-masher
lib/map.js
_removeMappedFields
function _removeMappedFields(mapping, path) { if (typeof path === 'number') { delete mapping[path]; return mapping; } var keys = path.split(_separator); if (keys.length <= 1) { delete mapping[path]; return mapping; } return _removeMappedFields( mapping[pat...
javascript
function _removeMappedFields(mapping, path) { if (typeof path === 'number') { delete mapping[path]; return mapping; } var keys = path.split(_separator); if (keys.length <= 1) { delete mapping[path]; return mapping; } return _removeMappedFields( mapping[pat...
[ "function", "_removeMappedFields", "(", "mapping", ",", "path", ")", "{", "if", "(", "typeof", "path", "===", "'number'", ")", "{", "delete", "mapping", "[", "path", "]", ";", "return", "mapping", ";", "}", "var", "keys", "=", "path", ".", "split", "("...
!! Function with side effects !! Removes given fields of a dataset @param mapping Data to clean @param path Path to field to delete @returns {*} @private
[ "!!", "Function", "with", "side", "effects", "!!", "Removes", "given", "fields", "of", "a", "dataset" ]
88e21a45350e7204f4102e7186c5beaa8753bd7f
https://github.com/MD4/potato-masher/blob/88e21a45350e7204f4102e7186c5beaa8753bd7f/lib/map.js#L93-L109
train
MD4/potato-masher
lib/map.js
_getMappedFields
function _getMappedFields(schema) { if (schema === undefined || schema === null) { return; } if (schema instanceof Array) { return schema .reduce(function (memo, key) { var mappedField = _getMappedFields(key); if (mappedField !== undefined)...
javascript
function _getMappedFields(schema) { if (schema === undefined || schema === null) { return; } if (schema instanceof Array) { return schema .reduce(function (memo, key) { var mappedField = _getMappedFields(key); if (mappedField !== undefined)...
[ "function", "_getMappedFields", "(", "schema", ")", "{", "if", "(", "schema", "===", "undefined", "||", "schema", "===", "null", ")", "{", "return", ";", "}", "if", "(", "schema", "instanceof", "Array", ")", "{", "return", "schema", ".", "reduce", "(", ...
Returns the fields which are used in the final object @param schema Target schema @returns {*} @private
[ "Returns", "the", "fields", "which", "are", "used", "in", "the", "final", "object" ]
88e21a45350e7204f4102e7186c5beaa8753bd7f
https://github.com/MD4/potato-masher/blob/88e21a45350e7204f4102e7186c5beaa8753bd7f/lib/map.js#L117-L147
train
MD4/potato-masher
lib/map.js
_mapArray
function _mapArray(data, schema, options) { var base = []; if (data instanceof Array && options.keep) { base = _clone(data); } if (typeof data === 'object' && options.keep) { base = Object .keys(data) .map(function(key) { return data[key]; ...
javascript
function _mapArray(data, schema, options) { var base = []; if (data instanceof Array && options.keep) { base = _clone(data); } if (typeof data === 'object' && options.keep) { base = Object .keys(data) .map(function(key) { return data[key]; ...
[ "function", "_mapArray", "(", "data", ",", "schema", ",", "options", ")", "{", "var", "base", "=", "[", "]", ";", "if", "(", "data", "instanceof", "Array", "&&", "options", ".", "keep", ")", "{", "base", "=", "_clone", "(", "data", ")", ";", "}", ...
Returns a new object with its new aspect from an array schema @param data Object to map @param schema Fields to map @param options Options @returns {*} @private
[ "Returns", "a", "new", "object", "with", "its", "new", "aspect", "from", "an", "array", "schema" ]
88e21a45350e7204f4102e7186c5beaa8753bd7f
https://github.com/MD4/potato-masher/blob/88e21a45350e7204f4102e7186c5beaa8753bd7f/lib/map.js#L157-L174
train
MD4/potato-masher
lib/map.js
_mapObject
function _mapObject(data, schema, options) { return Object .keys(schema) .reduce(function (memo, key) { memo[key] = _mapDataValue(data, schema[key]); return memo; }, options.keep ? _clone(data) : {}); }
javascript
function _mapObject(data, schema, options) { return Object .keys(schema) .reduce(function (memo, key) { memo[key] = _mapDataValue(data, schema[key]); return memo; }, options.keep ? _clone(data) : {}); }
[ "function", "_mapObject", "(", "data", ",", "schema", ",", "options", ")", "{", "return", "Object", ".", "keys", "(", "schema", ")", ".", "reduce", "(", "function", "(", "memo", ",", "key", ")", "{", "memo", "[", "key", "]", "=", "_mapDataValue", "("...
Returns a new object with its new aspect from an object schema @param data Object to map @param schema Fields to map @param options Options @returns {*} @private
[ "Returns", "a", "new", "object", "with", "its", "new", "aspect", "from", "an", "object", "schema" ]
88e21a45350e7204f4102e7186c5beaa8753bd7f
https://github.com/MD4/potato-masher/blob/88e21a45350e7204f4102e7186c5beaa8753bd7f/lib/map.js#L184-L191
train
MD4/potato-masher
lib/map.js
_mapDataValue
function _mapDataValue(data, nestedSchema) { if (typeof nestedSchema === 'function') { return nestedSchema.apply(data); } else if (typeof nestedSchema === 'object') { return _map(data, nestedSchema); } else { return _getDataValue(data, nestedSchema); } }
javascript
function _mapDataValue(data, nestedSchema) { if (typeof nestedSchema === 'function') { return nestedSchema.apply(data); } else if (typeof nestedSchema === 'object') { return _map(data, nestedSchema); } else { return _getDataValue(data, nestedSchema); } }
[ "function", "_mapDataValue", "(", "data", ",", "nestedSchema", ")", "{", "if", "(", "typeof", "nestedSchema", "===", "'function'", ")", "{", "return", "nestedSchema", ".", "apply", "(", "data", ")", ";", "}", "else", "if", "(", "typeof", "nestedSchema", "=...
Returns the value of an object from a nested schema @param data Object to map @param nestedSchema Path to value, function to execute or nested schema @returns {*} @private
[ "Returns", "the", "value", "of", "an", "object", "from", "a", "nested", "schema" ]
88e21a45350e7204f4102e7186c5beaa8753bd7f
https://github.com/MD4/potato-masher/blob/88e21a45350e7204f4102e7186c5beaa8753bd7f/lib/map.js#L200-L208
train
MD4/potato-masher
lib/map.js
_getDataValue
function _getDataValue(data, path) { if (data === undefined) { return undefined; } if (typeof path === 'number') { return data[path]; } if (typeof path === 'string') { var keys = path.split(_separator); if (keys.length <= 1) { return data[keys[0]]; ...
javascript
function _getDataValue(data, path) { if (data === undefined) { return undefined; } if (typeof path === 'number') { return data[path]; } if (typeof path === 'string') { var keys = path.split(_separator); if (keys.length <= 1) { return data[keys[0]]; ...
[ "function", "_getDataValue", "(", "data", ",", "path", ")", "{", "if", "(", "data", "===", "undefined", ")", "{", "return", "undefined", ";", "}", "if", "(", "typeof", "path", "===", "'number'", ")", "{", "return", "data", "[", "path", "]", ";", "}",...
Returns the value of an object from its path @param data Object to map @param path Path to value in object @returns {*} @private
[ "Returns", "the", "value", "of", "an", "object", "from", "its", "path" ]
88e21a45350e7204f4102e7186c5beaa8753bd7f
https://github.com/MD4/potato-masher/blob/88e21a45350e7204f4102e7186c5beaa8753bd7f/lib/map.js#L217-L237
train
linyngfly/omelo
lib/server/server.js
function (app) { let p = pathUtil.getCronPath(app.getBase(), app.getServerType()); if (p) { return Loader.load(p, app); } }
javascript
function (app) { let p = pathUtil.getCronPath(app.getBase(), app.getServerType()); if (p) { return Loader.load(p, app); } }
[ "function", "(", "app", ")", "{", "let", "p", "=", "pathUtil", ".", "getCronPath", "(", "app", ".", "getBase", "(", ")", ",", "app", ".", "getServerType", "(", ")", ")", ";", "if", "(", "p", ")", "{", "return", "Loader", ".", "load", "(", "p", ...
Load cron handlers from current application
[ "Load", "cron", "handlers", "from", "current", "application" ]
fb5f79fa31c69de36bd1c370bad5edfa753ca601
https://github.com/linyngfly/omelo/blob/fb5f79fa31c69de36bd1c370bad5edfa753ca601/lib/server/server.js#L194-L199
train
linyngfly/omelo
lib/server/server.js
function (server, app) { let env = app.get(Constants.RESERVED.ENV); let p = path.join(app.getBase(), app.get(Constants.RESERVED.SERVICE_PATH), Constants.FILEPATH.CRON); if (!fs.existsSync(p)) { p = path.join(app.getBase(), Constants.FILEPATH.CONFIG_DIR, env, path.basename(Constants.FILEPATH.CRON)); if (!f...
javascript
function (server, app) { let env = app.get(Constants.RESERVED.ENV); let p = path.join(app.getBase(), app.get(Constants.RESERVED.SERVICE_PATH), Constants.FILEPATH.CRON); if (!fs.existsSync(p)) { p = path.join(app.getBase(), Constants.FILEPATH.CONFIG_DIR, env, path.basename(Constants.FILEPATH.CRON)); if (!f...
[ "function", "(", "server", ",", "app", ")", "{", "let", "env", "=", "app", ".", "get", "(", "Constants", ".", "RESERVED", ".", "ENV", ")", ";", "let", "p", "=", "path", ".", "join", "(", "app", ".", "getBase", "(", ")", ",", "app", ".", "get", ...
Load crons from configure file
[ "Load", "crons", "from", "configure", "file" ]
fb5f79fa31c69de36bd1c370bad5edfa753ca601
https://github.com/linyngfly/omelo/blob/fb5f79fa31c69de36bd1c370bad5edfa753ca601/lib/server/server.js#L204-L229
train
linyngfly/omelo
lib/server/server.js
function (isGlobal, server, err, msg, session, resp, opts, cb) { let fm; if (isGlobal) { fm = server.globalFilterService; } else { fm = server.filterService; } if (fm) { if (isGlobal) { fm.afterFilter(err, msg, session, resp, function () { // do nothing }); } else { f...
javascript
function (isGlobal, server, err, msg, session, resp, opts, cb) { let fm; if (isGlobal) { fm = server.globalFilterService; } else { fm = server.filterService; } if (fm) { if (isGlobal) { fm.afterFilter(err, msg, session, resp, function () { // do nothing }); } else { f...
[ "function", "(", "isGlobal", ",", "server", ",", "err", ",", "msg", ",", "session", ",", "resp", ",", "opts", ",", "cb", ")", "{", "let", "fm", ";", "if", "(", "isGlobal", ")", "{", "fm", "=", "server", ".", "globalFilterService", ";", "}", "else",...
Fire after filter chain if have
[ "Fire", "after", "filter", "chain", "if", "have" ]
fb5f79fa31c69de36bd1c370bad5edfa753ca601
https://github.com/linyngfly/omelo/blob/fb5f79fa31c69de36bd1c370bad5edfa753ca601/lib/server/server.js#L251-L269
train
linyngfly/omelo
lib/server/server.js
function (isGlobal, server, err, msg, session, resp, opts, cb) { let handler; if (isGlobal) { handler = server.app.get(Constants.RESERVED.GLOBAL_ERROR_HANDLER); } else { handler = server.app.get(Constants.RESERVED.ERROR_HANDLER); } if (!handler) { logger.debug('no default error handler to resolve ...
javascript
function (isGlobal, server, err, msg, session, resp, opts, cb) { let handler; if (isGlobal) { handler = server.app.get(Constants.RESERVED.GLOBAL_ERROR_HANDLER); } else { handler = server.app.get(Constants.RESERVED.ERROR_HANDLER); } if (!handler) { logger.debug('no default error handler to resolve ...
[ "function", "(", "isGlobal", ",", "server", ",", "err", ",", "msg", ",", "session", ",", "resp", ",", "opts", ",", "cb", ")", "{", "let", "handler", ";", "if", "(", "isGlobal", ")", "{", "handler", "=", "server", ".", "app", ".", "get", "(", "Con...
pass err to the global error handler if specified
[ "pass", "err", "to", "the", "global", "error", "handler", "if", "specified" ]
fb5f79fa31c69de36bd1c370bad5edfa753ca601
https://github.com/linyngfly/omelo/blob/fb5f79fa31c69de36bd1c370bad5edfa753ca601/lib/server/server.js#L274-L291
train
linyngfly/omelo
lib/server/server.js
function (route) { if (!route) { return null; } let ts = route.split('.'); if (ts.length !== 3) { return null; } return { route: route, serverType: ts[0], handler: ts[1], method: ts[2] }; }
javascript
function (route) { if (!route) { return null; } let ts = route.split('.'); if (ts.length !== 3) { return null; } return { route: route, serverType: ts[0], handler: ts[1], method: ts[2] }; }
[ "function", "(", "route", ")", "{", "if", "(", "!", "route", ")", "{", "return", "null", ";", "}", "let", "ts", "=", "route", ".", "split", "(", "'.'", ")", ";", "if", "(", "ts", ".", "length", "!==", "3", ")", "{", "return", "null", ";", "}"...
Parse route string. @param {String} route route string, such as: serverName.handlerName.methodName @return {Object} parse result object or null for illeagle route string
[ "Parse", "route", "string", "." ]
fb5f79fa31c69de36bd1c370bad5edfa753ca601
https://github.com/linyngfly/omelo/blob/fb5f79fa31c69de36bd1c370bad5edfa753ca601/lib/server/server.js#L313-L328
train
mbroadst/rethunk
lib/metadata.js
Metadata
function Metadata(resolve, reject, query, options) { this.resolve = this._wrapResolveForProfile(resolve); this.reject = reject; this.query = query; // The query in case we have to build a backtrace this.options = options || {}; this.cursor = false; }
javascript
function Metadata(resolve, reject, query, options) { this.resolve = this._wrapResolveForProfile(resolve); this.reject = reject; this.query = query; // The query in case we have to build a backtrace this.options = options || {}; this.cursor = false; }
[ "function", "Metadata", "(", "resolve", ",", "reject", ",", "query", ",", "options", ")", "{", "this", ".", "resolve", "=", "this", ".", "_wrapResolveForProfile", "(", "resolve", ")", ";", "this", ".", "reject", "=", "reject", ";", "this", ".", "query", ...
Metadata we keep per query
[ "Metadata", "we", "keep", "per", "query" ]
48cad0fa139883f49489b93afbb87502532a876a
https://github.com/mbroadst/rethunk/blob/48cad0fa139883f49489b93afbb87502532a876a/lib/metadata.js#L3-L9
train
iolo/express-toybox
server.js
start
function start(app, config, callback) { if (httpServer) { DEBUG && debug('***ignore*** http server is already running!'); callback && callback(false); return httpServer; } config = _.merge({}, DEF_CONFIG, config); DEBUG && debug('start http server http://' + config.host + ':' +...
javascript
function start(app, config, callback) { if (httpServer) { DEBUG && debug('***ignore*** http server is already running!'); callback && callback(false); return httpServer; } config = _.merge({}, DEF_CONFIG, config); DEBUG && debug('start http server http://' + config.host + ':' +...
[ "function", "start", "(", "app", ",", "config", ",", "callback", ")", "{", "if", "(", "httpServer", ")", "{", "DEBUG", "&&", "debug", "(", "'***ignore*** http server is already running!'", ")", ";", "callback", "&&", "callback", "(", "false", ")", ";", "retu...
start http server. @param {*} app request listener. might be express(or connect) application instance. @param {*} [config] http server configurations @param {String} [config.host='localhost'] @param {Number} [config.port=3000] @param {Function(http.Server)} callback @returns {http.Server} http server instance
[ "start", "http", "server", "." ]
c375a1388cfc167017e8dcd2325e71ca86ccb994
https://github.com/iolo/express-toybox/blob/c375a1388cfc167017e8dcd2325e71ca86ccb994/server.js#L26-L54
train
iolo/express-toybox
server.js
stop
function stop(callback) { if (httpServer) { DEBUG && debug('stop http server'); try { httpServer.close(); } catch (e) { } httpServer = null; } else { DEBUG && debug('***ignore*** http server is not running!'); } callback && callback(false); }
javascript
function stop(callback) { if (httpServer) { DEBUG && debug('stop http server'); try { httpServer.close(); } catch (e) { } httpServer = null; } else { DEBUG && debug('***ignore*** http server is not running!'); } callback && callback(false); }
[ "function", "stop", "(", "callback", ")", "{", "if", "(", "httpServer", ")", "{", "DEBUG", "&&", "debug", "(", "'stop http server'", ")", ";", "try", "{", "httpServer", ".", "close", "(", ")", ";", "}", "catch", "(", "e", ")", "{", "}", "httpServer",...
stop http server @param {Function} callback
[ "stop", "http", "server" ]
c375a1388cfc167017e8dcd2325e71ca86ccb994
https://github.com/iolo/express-toybox/blob/c375a1388cfc167017e8dcd2325e71ca86ccb994/server.js#L61-L73
train