id
int32
0
58k
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
20,800
haydenbbickerton/vue-charts
dist/vue-charts.common.js
buildWrapper
function buildWrapper(chartType, dataTable, options, containerId) { var wrapper = new google.visualization.ChartWrapper({ chartType: chartType, dataTable: dataTable, options: options, containerId: containerId }); return wrapper; }
javascript
function buildWrapper(chartType, dataTable, options, containerId) { var wrapper = new google.visualization.ChartWrapper({ chartType: chartType, dataTable: dataTable, options: options, containerId: containerId }); return wrapper; }
[ "function", "buildWrapper", "(", "chartType", ",", "dataTable", ",", "options", ",", "containerId", ")", "{", "var", "wrapper", "=", "new", "google", ".", "visualization", ".", "ChartWrapper", "(", "{", "chartType", ":", "chartType", ",", "dataTable", ":", "...
Initialize the wrapper @link https://developers.google.com/chart/interactive/docs/reference#chartwrapper-class @return object
[ "Initialize", "the", "wrapper" ]
f8bb783dd2476d854389678d0abe45b35ad8014b
https://github.com/haydenbbickerton/vue-charts/blob/f8bb783dd2476d854389678d0abe45b35ad8014b/dist/vue-charts.common.js#L290-L299
20,801
haydenbbickerton/vue-charts
dist/vue-charts.common.js
buildChart
function buildChart() { var self = this; // If dataTable isn't set, build it var dataTable = _.isEmpty(self.dataTable) ? self.buildDataTable() : self.dataTable; self.wrapper = self.buildWrapper(self.chartType, dataTable, self.options, self.chartId); // Set the datatable on this instance...
javascript
function buildChart() { var self = this; // If dataTable isn't set, build it var dataTable = _.isEmpty(self.dataTable) ? self.buildDataTable() : self.dataTable; self.wrapper = self.buildWrapper(self.chartType, dataTable, self.options, self.chartId); // Set the datatable on this instance...
[ "function", "buildChart", "(", ")", "{", "var", "self", "=", "this", ";", "// If dataTable isn't set, build it", "var", "dataTable", "=", "_", ".", "isEmpty", "(", "self", ".", "dataTable", ")", "?", "self", ".", "buildDataTable", "(", ")", ":", "self", "....
Build the chart. @return void
[ "Build", "the", "chart", "." ]
f8bb783dd2476d854389678d0abe45b35ad8014b
https://github.com/haydenbbickerton/vue-charts/blob/f8bb783dd2476d854389678d0abe45b35ad8014b/dist/vue-charts.common.js#L307-L323
20,802
haydenbbickerton/vue-charts
dist/vue-charts.common.js
drawChart
function drawChart() { var self = this; // We don't have any (usable) data, or we don't have columns. We can't draw a chart without those. if (!_.isEmpty(self.rows) && !_.isObjectLike(self.rows) || _.isEmpty(self.columns)) { return; } if (_.isNull(self.chart)) { // We hav...
javascript
function drawChart() { var self = this; // We don't have any (usable) data, or we don't have columns. We can't draw a chart without those. if (!_.isEmpty(self.rows) && !_.isObjectLike(self.rows) || _.isEmpty(self.columns)) { return; } if (_.isNull(self.chart)) { // We hav...
[ "function", "drawChart", "(", ")", "{", "var", "self", "=", "this", ";", "// We don't have any (usable) data, or we don't have columns. We can't draw a chart without those.", "if", "(", "!", "_", ".", "isEmpty", "(", "self", ".", "rows", ")", "&&", "!", "_", ".", ...
Draw the chart. @return Promise
[ "Draw", "the", "chart", "." ]
f8bb783dd2476d854389678d0abe45b35ad8014b
https://github.com/haydenbbickerton/vue-charts/blob/f8bb783dd2476d854389678d0abe45b35ad8014b/dist/vue-charts.common.js#L331-L352
20,803
watson-developer-cloud/node-red-node-watson
services/personality_insights/v3.js
prepareParams
function prepareParams(msg, config) { var params = {}, inputlang = config.inputlang ? config.inputlang : 'en', outputlang = config.outputlang ? config.outputlang : 'en'; if (msg.piparams) { if (msg.piparams.inputlanguage && -1 < VALID_INPUT_LANGUAGES.indexOf(msg.piparams.inputlang...
javascript
function prepareParams(msg, config) { var params = {}, inputlang = config.inputlang ? config.inputlang : 'en', outputlang = config.outputlang ? config.outputlang : 'en'; if (msg.piparams) { if (msg.piparams.inputlanguage && -1 < VALID_INPUT_LANGUAGES.indexOf(msg.piparams.inputlang...
[ "function", "prepareParams", "(", "msg", ",", "config", ")", "{", "var", "params", "=", "{", "}", ",", "inputlang", "=", "config", ".", "inputlang", "?", "config", ".", "inputlang", ":", "'en'", ",", "outputlang", "=", "config", ".", "outputlang", "?", ...
This function prepares the params object for the call to Personality Insights
[ "This", "function", "prepares", "the", "params", "object", "for", "the", "call", "to", "Personality", "Insights" ]
2869917ccf28a18cbdc2e58fe071666abd74bf71
https://github.com/watson-developer-cloud/node-red-node-watson/blob/2869917ccf28a18cbdc2e58fe071666abd74bf71/services/personality_insights/v3.js#L93-L127
20,804
watson-developer-cloud/node-red-node-watson
services/personality_insights/v3.js
Node
function Node(config) { RED.nodes.createNode(this,config); var node = this, message = ''; this.on('input', function (msg) { node.status({}); payloadCheck(msg) .then(function(){ return wordcountCheck(msg, config); }) .then(function(){ return credentialsCh...
javascript
function Node(config) { RED.nodes.createNode(this,config); var node = this, message = ''; this.on('input', function (msg) { node.status({}); payloadCheck(msg) .then(function(){ return wordcountCheck(msg, config); }) .then(function(){ return credentialsCh...
[ "function", "Node", "(", "config", ")", "{", "RED", ".", "nodes", ".", "createNode", "(", "this", ",", "config", ")", ";", "var", "node", "=", "this", ",", "message", "=", "''", ";", "this", ".", "on", "(", "'input'", ",", "function", "(", "msg", ...
This is the start of the Node Code. In this case only on input is being processed.
[ "This", "is", "the", "start", "of", "the", "Node", "Code", ".", "In", "this", "case", "only", "on", "input", "is", "being", "processed", "." ]
2869917ccf28a18cbdc2e58fe071666abd74bf71
https://github.com/watson-developer-cloud/node-red-node-watson/blob/2869917ccf28a18cbdc2e58fe071666abd74bf71/services/personality_insights/v3.js#L175-L210
20,805
watson-developer-cloud/node-red-node-watson
services/alchemy_language/v1.js
AlchemyFeatureExtractNode
function AlchemyFeatureExtractNode (config) { RED.nodes.createNode(this, config); var node = this; this.on('input', function (msg) { if (!msg.payload) { this.status({fill:'red', shape:'ring', text:'missing payload'}); var message = 'Missing property: msg.payload'; node.error(m...
javascript
function AlchemyFeatureExtractNode (config) { RED.nodes.createNode(this, config); var node = this; this.on('input', function (msg) { if (!msg.payload) { this.status({fill:'red', shape:'ring', text:'missing payload'}); var message = 'Missing property: msg.payload'; node.error(m...
[ "function", "AlchemyFeatureExtractNode", "(", "config", ")", "{", "RED", ".", "nodes", ".", "createNode", "(", "this", ",", "config", ")", ";", "var", "node", "=", "this", ";", "this", ".", "on", "(", "'input'", ",", "function", "(", "msg", ")", "{", ...
This is the Alchemy Data Node
[ "This", "is", "the", "Alchemy", "Data", "Node" ]
2869917ccf28a18cbdc2e58fe071666abd74bf71
https://github.com/watson-developer-cloud/node-red-node-watson/blob/2869917ccf28a18cbdc2e58fe071666abd74bf71/services/alchemy_language/v1.js#L87-L154
20,806
watson-developer-cloud/node-red-node-watson
services/natural_language_understanding/v1.js
NLUNode
function NLUNode (config) { RED.nodes.createNode(this, config); var node = this; this.on('input', function (msg) { var message = '', options = {}; node.status({}); username = sUsername || this.credentials.username; password = sPassword || this.credentials.password; a...
javascript
function NLUNode (config) { RED.nodes.createNode(this, config); var node = this; this.on('input', function (msg) { var message = '', options = {}; node.status({}); username = sUsername || this.credentials.username; password = sPassword || this.credentials.password; a...
[ "function", "NLUNode", "(", "config", ")", "{", "RED", ".", "nodes", ".", "createNode", "(", "this", ",", "config", ")", ";", "var", "node", "=", "this", ";", "this", ".", "on", "(", "'input'", ",", "function", "(", "msg", ")", "{", "var", "message...
This is the Natural Language Understanding Node
[ "This", "is", "the", "Natural", "Language", "Understanding", "Node" ]
2869917ccf28a18cbdc2e58fe071666abd74bf71
https://github.com/watson-developer-cloud/node-red-node-watson/blob/2869917ccf28a18cbdc2e58fe071666abd74bf71/services/natural_language_understanding/v1.js#L266-L315
20,807
watson-developer-cloud/node-red-node-watson
services/speech_to_text/v1.js
overrideCheck
function overrideCheck(msg) { if (msg.srclang){ var langCode = payloadutils.langTransToSTTFormat(msg.srclang); config.lang = langCode; } return Promise.resolve(); }
javascript
function overrideCheck(msg) { if (msg.srclang){ var langCode = payloadutils.langTransToSTTFormat(msg.srclang); config.lang = langCode; } return Promise.resolve(); }
[ "function", "overrideCheck", "(", "msg", ")", "{", "if", "(", "msg", ".", "srclang", ")", "{", "var", "langCode", "=", "payloadutils", ".", "langTransToSTTFormat", "(", "msg", ".", "srclang", ")", ";", "config", ".", "lang", "=", "langCode", ";", "}", ...
Allow the language to be overridden through msg.srclang, no check for validity
[ "Allow", "the", "language", "to", "be", "overridden", "through", "msg", ".", "srclang", "no", "check", "for", "validity" ]
2869917ccf28a18cbdc2e58fe071666abd74bf71
https://github.com/watson-developer-cloud/node-red-node-watson/blob/2869917ccf28a18cbdc2e58fe071666abd74bf71/services/speech_to_text/v1.js#L140-L146
20,808
watson-developer-cloud/node-red-node-watson
services/speech_to_text/v1.js
payloadNonStreamCheck
function payloadNonStreamCheck(msg) { var message = ''; // The input comes in on msg.payload, and can either be an audio file or a string // representing a URL. if (!msg.payload instanceof Buffer || !typeof msg.payload === 'string') { message = 'Invalid property: msg.payload, can only b...
javascript
function payloadNonStreamCheck(msg) { var message = ''; // The input comes in on msg.payload, and can either be an audio file or a string // representing a URL. if (!msg.payload instanceof Buffer || !typeof msg.payload === 'string') { message = 'Invalid property: msg.payload, can only b...
[ "function", "payloadNonStreamCheck", "(", "msg", ")", "{", "var", "message", "=", "''", ";", "// The input comes in on msg.payload, and can either be an audio file or a string", "// representing a URL.", "if", "(", "!", "msg", ".", "payload", "instanceof", "Buffer", "||", ...
Input is a standard msg.payload
[ "Input", "is", "a", "standard", "msg", ".", "payload" ]
2869917ccf28a18cbdc2e58fe071666abd74bf71
https://github.com/watson-developer-cloud/node-red-node-watson/blob/2869917ccf28a18cbdc2e58fe071666abd74bf71/services/speech_to_text/v1.js#L150-L188
20,809
watson-developer-cloud/node-red-node-watson
services/speech_to_text/v1.js
processInputStream
function processInputStream(msg) { var tmp = msg.payload; if ('string' === typeof msg.payload) { msg.payload = JSON.parse(tmp); } if (msg.payload.action) { if ('start' === msg.payload.action) { startPacket = msg.payload; } } else { msg.payload = {...
javascript
function processInputStream(msg) { var tmp = msg.payload; if ('string' === typeof msg.payload) { msg.payload = JSON.parse(tmp); } if (msg.payload.action) { if ('start' === msg.payload.action) { startPacket = msg.payload; } } else { msg.payload = {...
[ "function", "processInputStream", "(", "msg", ")", "{", "var", "tmp", "=", "msg", ".", "payload", ";", "if", "(", "'string'", "===", "typeof", "msg", ".", "payload", ")", "{", "msg", ".", "payload", "=", "JSON", ".", "parse", "(", "tmp", ")", ";", ...
The input is from a websocket stream in Node-RED. expect action of 'start' or 'stop' or a data blob if its a blob then its going to be audio.
[ "The", "input", "is", "from", "a", "websocket", "stream", "in", "Node", "-", "RED", ".", "expect", "action", "of", "start", "or", "stop", "or", "a", "data", "blob", "if", "its", "a", "blob", "then", "its", "going", "to", "be", "audio", "." ]
2869917ccf28a18cbdc2e58fe071666abd74bf71
https://github.com/watson-developer-cloud/node-red-node-watson/blob/2869917ccf28a18cbdc2e58fe071666abd74bf71/services/speech_to_text/v1.js#L260-L275
20,810
watson-developer-cloud/node-red-node-watson
services/speech_to_text/v1.js
connectIfNeeded
function connectIfNeeded() { // console.log('re-establishing the connect'); websocket = null; socketCreationInProcess = false; // The token may have expired so test for it. getToken(determineService()) .then(() => { return processSTTSocketStart(false); }) ...
javascript
function connectIfNeeded() { // console.log('re-establishing the connect'); websocket = null; socketCreationInProcess = false; // The token may have expired so test for it. getToken(determineService()) .then(() => { return processSTTSocketStart(false); }) ...
[ "function", "connectIfNeeded", "(", ")", "{", "// console.log('re-establishing the connect');", "websocket", "=", "null", ";", "socketCreationInProcess", "=", "false", ";", "// The token may have expired so test for it.", "getToken", "(", "determineService", "(", ")", ")", ...
If we are going to connect to STT through websockets then its going to disconnect or timeout, so need to handle that occurrence.
[ "If", "we", "are", "going", "to", "connect", "to", "STT", "through", "websockets", "then", "its", "going", "to", "disconnect", "or", "timeout", "so", "need", "to", "handle", "that", "occurrence", "." ]
2869917ccf28a18cbdc2e58fe071666abd74bf71
https://github.com/watson-developer-cloud/node-red-node-watson/blob/2869917ccf28a18cbdc2e58fe071666abd74bf71/services/speech_to_text/v1.js#L589-L607
20,811
watson-developer-cloud/node-red-node-watson
utilities/service-utils.js
function(serviceName, returnBoolean, alchemyRegex) { var regex = alchemyRegex ? RegExp('(http|https)(://)('+serviceName+').*') : RegExp('(http|https)(://)([^\/]+)(/)('+serviceName+').*'); var services = appEnv.getServices(); for (var service in services) { if (service...
javascript
function(serviceName, returnBoolean, alchemyRegex) { var regex = alchemyRegex ? RegExp('(http|https)(://)('+serviceName+').*') : RegExp('(http|https)(://)([^\/]+)(/)('+serviceName+').*'); var services = appEnv.getServices(); for (var service in services) { if (service...
[ "function", "(", "serviceName", ",", "returnBoolean", ",", "alchemyRegex", ")", "{", "var", "regex", "=", "alchemyRegex", "?", "RegExp", "(", "'(http|https)(://)('", "+", "serviceName", "+", "').*'", ")", ":", "RegExp", "(", "'(http|https)(://)([^\\/]+)(/)('", "+"...
function to determine if WDC service is bound. A simple check on name may fail because of duplicate usage. This function verifies that the url associated with the service, contains the matched input value, hence reducing the chances of a false match.
[ "function", "to", "determine", "if", "WDC", "service", "is", "bound", ".", "A", "simple", "check", "on", "name", "may", "fail", "because", "of", "duplicate", "usage", ".", "This", "function", "verifies", "that", "the", "url", "associated", "with", "the", "...
2869917ccf28a18cbdc2e58fe071666abd74bf71
https://github.com/watson-developer-cloud/node-red-node-watson/blob/2869917ccf28a18cbdc2e58fe071666abd74bf71/utilities/service-utils.js#L25-L42
20,812
watson-developer-cloud/node-red-node-watson
services/tone_analyzer/v3.js
function(credentials) { var taSettings = {}; username = sUsername || credentials.username; password = sPassword || credentials.password; apikey = sApikey || credentials.apikey; if (apikey) { taSettings.iam_apikey = apikey; } else if (username && password) { taSettings.username = us...
javascript
function(credentials) { var taSettings = {}; username = sUsername || credentials.username; password = sPassword || credentials.password; apikey = sApikey || credentials.apikey; if (apikey) { taSettings.iam_apikey = apikey; } else if (username && password) { taSettings.username = us...
[ "function", "(", "credentials", ")", "{", "var", "taSettings", "=", "{", "}", ";", "username", "=", "sUsername", "||", "credentials", ".", "username", ";", "password", "=", "sPassword", "||", "credentials", ".", "password", ";", "apikey", "=", "sApikey", "...
Check that the credentials have been provided Credentials are needed for each the service.
[ "Check", "that", "the", "credentials", "have", "been", "provided", "Credentials", "are", "needed", "for", "each", "the", "service", "." ]
2869917ccf28a18cbdc2e58fe071666abd74bf71
https://github.com/watson-developer-cloud/node-red-node-watson/blob/2869917ccf28a18cbdc2e58fe071666abd74bf71/services/tone_analyzer/v3.js#L55-L72
20,813
watson-developer-cloud/node-red-node-watson
services/tone_analyzer/v3.js
function(msg, node) { var message = null, taSettings = null; taSettings = checkCreds(node.credentials); if (!taSettings) { message = 'Missing Tone Analyzer service credentials'; } else if (msg.payload) { message = toneutils.checkPayload(msg.payload); } else { message = 'Mi...
javascript
function(msg, node) { var message = null, taSettings = null; taSettings = checkCreds(node.credentials); if (!taSettings) { message = 'Missing Tone Analyzer service credentials'; } else if (msg.payload) { message = toneutils.checkPayload(msg.payload); } else { message = 'Mi...
[ "function", "(", "msg", ",", "node", ")", "{", "var", "message", "=", "null", ",", "taSettings", "=", "null", ";", "taSettings", "=", "checkCreds", "(", "node", ".", "credentials", ")", ";", "if", "(", "!", "taSettings", ")", "{", "message", "=", "'M...
Function that checks the configuration to make sure that credentials, payload and options have been provied in the correct format.
[ "Function", "that", "checks", "the", "configuration", "to", "make", "sure", "that", "credentials", "payload", "and", "options", "have", "been", "provied", "in", "the", "correct", "format", "." ]
2869917ccf28a18cbdc2e58fe071666abd74bf71
https://github.com/watson-developer-cloud/node-red-node-watson/blob/2869917ccf28a18cbdc2e58fe071666abd74bf71/services/tone_analyzer/v3.js#L77-L96
20,814
watson-developer-cloud/node-red-node-watson
services/tone_analyzer/v3.js
function(msg, config, node) { checkConfiguration(msg, node) .then(function(settings) { var options = toneutils.parseOptions(msg, config); options = toneutils.parseLanguage(msg, config, options); node.status({fill:'blue', shape:'dot', text:'requesting'}); return invokeService(co...
javascript
function(msg, config, node) { checkConfiguration(msg, node) .then(function(settings) { var options = toneutils.parseOptions(msg, config); options = toneutils.parseLanguage(msg, config, options); node.status({fill:'blue', shape:'dot', text:'requesting'}); return invokeService(co...
[ "function", "(", "msg", ",", "config", ",", "node", ")", "{", "checkConfiguration", "(", "msg", ",", "node", ")", ".", "then", "(", "function", "(", "settings", ")", "{", "var", "options", "=", "toneutils", ".", "parseOptions", "(", "msg", ",", "config...
function when the node recieves input inside a flow. Configuration is first checked before the service is invoked.
[ "function", "when", "the", "node", "recieves", "input", "inside", "a", "flow", ".", "Configuration", "is", "first", "checked", "before", "the", "service", "is", "invoked", "." ]
2869917ccf28a18cbdc2e58fe071666abd74bf71
https://github.com/watson-developer-cloud/node-red-node-watson/blob/2869917ccf28a18cbdc2e58fe071666abd74bf71/services/tone_analyzer/v3.js#L153-L171
20,815
watson-developer-cloud/node-red-node-watson
services/tone_analyzer/v3.js
Node
function Node (config) { RED.nodes.createNode(this, config); var node = this; // Invoked when the node has received an input as part of a flow. this.on('input', function (msg) { processOnInput(msg, config, node); }); }
javascript
function Node (config) { RED.nodes.createNode(this, config); var node = this; // Invoked when the node has received an input as part of a flow. this.on('input', function (msg) { processOnInput(msg, config, node); }); }
[ "function", "Node", "(", "config", ")", "{", "RED", ".", "nodes", ".", "createNode", "(", "this", ",", "config", ")", ";", "var", "node", "=", "this", ";", "// Invoked when the node has received an input as part of a flow.", "this", ".", "on", "(", "'input'", ...
This is the Tone Analyzer Node.
[ "This", "is", "the", "Tone", "Analyzer", "Node", "." ]
2869917ccf28a18cbdc2e58fe071666abd74bf71
https://github.com/watson-developer-cloud/node-red-node-watson/blob/2869917ccf28a18cbdc2e58fe071666abd74bf71/services/tone_analyzer/v3.js#L175-L183
20,816
watson-developer-cloud/node-red-node-watson
services/alchemy_vision/v1.js
performAction
function performAction(params, feature, cbdone, cbcleanup) { var alchemy_vision = watson.alchemy_vision( { api_key: apikey } ); if (feature == 'imageFaces') { alchemy_vision.recognizeFaces(params, cbdone); } else if (feature == 'imageLink') { alchemy_vision.getImageLinks(params, cbdone); ...
javascript
function performAction(params, feature, cbdone, cbcleanup) { var alchemy_vision = watson.alchemy_vision( { api_key: apikey } ); if (feature == 'imageFaces') { alchemy_vision.recognizeFaces(params, cbdone); } else if (feature == 'imageLink') { alchemy_vision.getImageLinks(params, cbdone); ...
[ "function", "performAction", "(", "params", ",", "feature", ",", "cbdone", ",", "cbcleanup", ")", "{", "var", "alchemy_vision", "=", "watson", ".", "alchemy_vision", "(", "{", "api_key", ":", "apikey", "}", ")", ";", "if", "(", "feature", "==", "'imageFace...
Utility function that performs the alchemy vision call. the cleanup removes the temp storage, and I am not sure whether it should be called here or after alchemy returns and passed control back to cbdone.
[ "Utility", "function", "that", "performs", "the", "alchemy", "vision", "call", ".", "the", "cleanup", "removes", "the", "temp", "storage", "and", "I", "am", "not", "sure", "whether", "it", "should", "be", "called", "here", "or", "after", "alchemy", "returns"...
2869917ccf28a18cbdc2e58fe071666abd74bf71
https://github.com/watson-developer-cloud/node-red-node-watson/blob/2869917ccf28a18cbdc2e58fe071666abd74bf71/services/alchemy_vision/v1.js#L82-L97
20,817
watson-developer-cloud/node-red-node-watson
services/alchemy_vision/v1.js
function(err, keywords) { if (err || keywords.status === 'ERROR') { node.status({fill:'red', shape:'ring', text:'call to alchmeyapi vision service failed'}); console.log('Error:', msg, err); node.error(err, msg); } else { msg.result = keywords[FEATURE_RESP...
javascript
function(err, keywords) { if (err || keywords.status === 'ERROR') { node.status({fill:'red', shape:'ring', text:'call to alchmeyapi vision service failed'}); console.log('Error:', msg, err); node.error(err, msg); } else { msg.result = keywords[FEATURE_RESP...
[ "function", "(", "err", ",", "keywords", ")", "{", "if", "(", "err", "||", "keywords", ".", "status", "===", "'ERROR'", ")", "{", "node", ".", "status", "(", "{", "fill", ":", "'red'", ",", "shape", ":", "'ring'", ",", "text", ":", "'call to alchmeya...
This is the callback after the call to the alchemy service. Set up as a var within this scope, so it has access to node, msg etc. in preparation for the Alchemy service action
[ "This", "is", "the", "callback", "after", "the", "call", "to", "the", "alchemy", "service", ".", "Set", "up", "as", "a", "var", "within", "this", "scope", "so", "it", "has", "access", "to", "node", "msg", "etc", ".", "in", "preparation", "for", "the", ...
2869917ccf28a18cbdc2e58fe071666abd74bf71
https://github.com/watson-developer-cloud/node-red-node-watson/blob/2869917ccf28a18cbdc2e58fe071666abd74bf71/services/alchemy_vision/v1.js#L137-L149
20,818
watson-developer-cloud/node-red-node-watson
services/assistant/v1-workspace-manager.js
executeListExamples
function executeListExamples(node, conv, params, msg) { var p = new Promise(function resolver(resolve, reject){ conv.listExamples(params, function (err, response) { if (err) { reject(err); } else { msg['examples'] = response.examples ? ...
javascript
function executeListExamples(node, conv, params, msg) { var p = new Promise(function resolver(resolve, reject){ conv.listExamples(params, function (err, response) { if (err) { reject(err); } else { msg['examples'] = response.examples ? ...
[ "function", "executeListExamples", "(", "node", ",", "conv", ",", "params", ",", "msg", ")", "{", "var", "p", "=", "new", "Promise", "(", "function", "resolver", "(", "resolve", ",", "reject", ")", "{", "conv", ".", "listExamples", "(", "params", ",", ...
For now we are not doing anything with the pagination response
[ "For", "now", "we", "are", "not", "doing", "anything", "with", "the", "pagination", "response" ]
2869917ccf28a18cbdc2e58fe071666abd74bf71
https://github.com/watson-developer-cloud/node-red-node-watson/blob/2869917ccf28a18cbdc2e58fe071666abd74bf71/services/assistant/v1-workspace-manager.js#L204-L217
20,819
watson-developer-cloud/node-red-node-watson
services/assistant/v1-workspace-manager.js
buildParams
function buildParams(msg, method, config, params) { var p = buildWorkspaceParams(msg, method, config, params) .then(function(){ return buildIntentParams(msg, method, config, params); }) .then(function(){ return buildExampleParams(msg, method, config, params); }) .then(f...
javascript
function buildParams(msg, method, config, params) { var p = buildWorkspaceParams(msg, method, config, params) .then(function(){ return buildIntentParams(msg, method, config, params); }) .then(function(){ return buildExampleParams(msg, method, config, params); }) .then(f...
[ "function", "buildParams", "(", "msg", ",", "method", ",", "config", ",", "params", ")", "{", "var", "p", "=", "buildWorkspaceParams", "(", "msg", ",", "method", ",", "config", ",", "params", ")", ".", "then", "(", "function", "(", ")", "{", "return", ...
Copy over the appropriate parameters for the required method from the node configuration
[ "Copy", "over", "the", "appropriate", "parameters", "for", "the", "required", "method", "from", "the", "node", "configuration" ]
2869917ccf28a18cbdc2e58fe071666abd74bf71
https://github.com/watson-developer-cloud/node-red-node-watson/blob/2869917ccf28a18cbdc2e58fe071666abd74bf71/services/assistant/v1-workspace-manager.js#L861-L883
20,820
watson-developer-cloud/node-red-node-watson
services/assistant/v1-workspace-manager.js
setWorkspaceParams
function setWorkspaceParams(method, params, workspaceObject) { var workspace_id = null; var stash = {}; if ('object' !== typeof workspaceObject) { return Promise.reject('json content expected as input on payload'); } switch(method) { case 'updateIntent': if (params['old_intent']) {...
javascript
function setWorkspaceParams(method, params, workspaceObject) { var workspace_id = null; var stash = {}; if ('object' !== typeof workspaceObject) { return Promise.reject('json content expected as input on payload'); } switch(method) { case 'updateIntent': if (params['old_intent']) {...
[ "function", "setWorkspaceParams", "(", "method", ",", "params", ",", "workspaceObject", ")", "{", "var", "workspace_id", "=", "null", ";", "var", "stash", "=", "{", "}", ";", "if", "(", "'object'", "!==", "typeof", "workspaceObject", ")", "{", "return", "P...
No need to have complicated processing here Looking for individual fields in the json object, like name, language, entities etc. as these are the parameters required for this method are in the json object, at the top level of the json object. So it is safe to overwrite params. 'name', 'language', 'entities', 'intents',...
[ "No", "need", "to", "have", "complicated", "processing", "here", "Looking", "for", "individual", "fields", "in", "the", "json", "object", "like", "name", "language", "entities", "etc", ".", "as", "these", "are", "the", "parameters", "required", "for", "this", ...
2869917ccf28a18cbdc2e58fe071666abd74bf71
https://github.com/watson-developer-cloud/node-red-node-watson/blob/2869917ccf28a18cbdc2e58fe071666abd74bf71/services/assistant/v1-workspace-manager.js#L898-L958
20,821
watson-developer-cloud/node-red-node-watson
services/assistant/v1-workspace-manager.js
processFileForWorkspace
function processFileForWorkspace(info, method) { var workspaceObject = null; switch (method) { case 'createWorkspace': case 'updateWorkspace': case 'createIntent': case 'updateIntent': case 'createEntity': case 'updateEntity': case 'updateEntityValue': case 'createDialogNode': ...
javascript
function processFileForWorkspace(info, method) { var workspaceObject = null; switch (method) { case 'createWorkspace': case 'updateWorkspace': case 'createIntent': case 'updateIntent': case 'createEntity': case 'updateEntity': case 'updateEntityValue': case 'createDialogNode': ...
[ "function", "processFileForWorkspace", "(", "info", ",", "method", ")", "{", "var", "workspaceObject", "=", "null", ";", "switch", "(", "method", ")", "{", "case", "'createWorkspace'", ":", "case", "'updateWorkspace'", ":", "case", "'createIntent'", ":", "case",...
I know this says workspace, but its actually a json object that works both for workspace, intent and entity
[ "I", "know", "this", "says", "workspace", "but", "its", "actually", "a", "json", "object", "that", "works", "both", "for", "workspace", "intent", "and", "entity" ]
2869917ccf28a18cbdc2e58fe071666abd74bf71
https://github.com/watson-developer-cloud/node-red-node-watson/blob/2869917ccf28a18cbdc2e58fe071666abd74bf71/services/assistant/v1-workspace-manager.js#L991-L1012
20,822
watson-developer-cloud/node-red-node-watson
services/assistant/v1-workspace-manager.js
loadFile
function loadFile(node, method, params, msg) { var fileInfo = null; var p = openTheFile() .then(function(info){ fileInfo = info; return syncTheFile(fileInfo, msg); }) .then(function(){ return processFileForWorkspace(fileInfo, method); }) .then(function(works...
javascript
function loadFile(node, method, params, msg) { var fileInfo = null; var p = openTheFile() .then(function(info){ fileInfo = info; return syncTheFile(fileInfo, msg); }) .then(function(){ return processFileForWorkspace(fileInfo, method); }) .then(function(works...
[ "function", "loadFile", "(", "node", ",", "method", ",", "params", ",", "msg", ")", "{", "var", "fileInfo", "=", "null", ";", "var", "p", "=", "openTheFile", "(", ")", ".", "then", "(", "function", "(", "info", ")", "{", "fileInfo", "=", "info", ";...
We are expecting a file on payload. Some of the functions used here are async, so this function is returning a consolidated promise, compromising of all the promises from the async and sync functions.
[ "We", "are", "expecting", "a", "file", "on", "payload", ".", "Some", "of", "the", "functions", "used", "here", "are", "async", "so", "this", "function", "is", "returning", "a", "consolidated", "promise", "compromising", "of", "all", "the", "promises", "from"...
2869917ccf28a18cbdc2e58fe071666abd74bf71
https://github.com/watson-developer-cloud/node-red-node-watson/blob/2869917ccf28a18cbdc2e58fe071666abd74bf71/services/assistant/v1-workspace-manager.js#L1020-L1035
20,823
watson-developer-cloud/node-red-node-watson
services/assistant/v1-workspace-manager.js
Node
function Node (config) { RED.nodes.createNode(this, config); var node = this; this.on('input', function (msg) { var method = config['cwm-custom-mode'], message = '', params = {}; username = sUsername || this.credentials.username; password = sPassword || this.credentials.p...
javascript
function Node (config) { RED.nodes.createNode(this, config); var node = this; this.on('input', function (msg) { var method = config['cwm-custom-mode'], message = '', params = {}; username = sUsername || this.credentials.username; password = sPassword || this.credentials.p...
[ "function", "Node", "(", "config", ")", "{", "RED", ".", "nodes", ".", "createNode", "(", "this", ",", "config", ")", ";", "var", "node", "=", "this", ";", "this", ".", "on", "(", "'input'", ",", "function", "(", "msg", ")", "{", "var", "method", ...
This is the Conversation Workspace Manager Node
[ "This", "is", "the", "Conversation", "Workspace", "Manager", "Node" ]
2869917ccf28a18cbdc2e58fe071666abd74bf71
https://github.com/watson-developer-cloud/node-red-node-watson/blob/2869917ccf28a18cbdc2e58fe071666abd74bf71/services/assistant/v1-workspace-manager.js#L1080-L1151
20,824
watson-developer-cloud/node-red-node-watson
services/language_translator/v3.js
doTranslate
function doTranslate(language_translator, msg, model_id) { var p = new Promise(function resolver(resolve, reject){ // Please be careful when reading the below. The first parameter is // a structure, and the tabbing enforced by codeacy imho obfuscates // the code, rather than making it clea...
javascript
function doTranslate(language_translator, msg, model_id) { var p = new Promise(function resolver(resolve, reject){ // Please be careful when reading the below. The first parameter is // a structure, and the tabbing enforced by codeacy imho obfuscates // the code, rather than making it clea...
[ "function", "doTranslate", "(", "language_translator", ",", "msg", ",", "model_id", ")", "{", "var", "p", "=", "new", "Promise", "(", "function", "resolver", "(", "resolve", ",", "reject", ")", "{", "// Please be careful when reading the below. The first parameter is"...
If a translation is requested, then the model id will have been built by the calling function based on source, target and domain.
[ "If", "a", "translation", "is", "requested", "then", "the", "model", "id", "will", "have", "been", "built", "by", "the", "calling", "function", "based", "on", "source", "target", "and", "domain", "." ]
2869917ccf28a18cbdc2e58fe071666abd74bf71
https://github.com/watson-developer-cloud/node-red-node-watson/blob/2869917ccf28a18cbdc2e58fe071666abd74bf71/services/language_translator/v3.js#L143-L166
20,825
watson-developer-cloud/node-red-node-watson
services/dialog/v1.js
performCreate
function performCreate(node,dialog,msg) { var params = {} node.status({fill:'blue', shape:'dot', text:'requesting create of new dialog template'}); //if ('file' in msg.dialog_params && 'dialog_name' in msg.dialog_params) { if ('dialog_name' in msg.dialog_params) { // extension supported : only...
javascript
function performCreate(node,dialog,msg) { var params = {} node.status({fill:'blue', shape:'dot', text:'requesting create of new dialog template'}); //if ('file' in msg.dialog_params && 'dialog_name' in msg.dialog_params) { if ('dialog_name' in msg.dialog_params) { // extension supported : only...
[ "function", "performCreate", "(", "node", ",", "dialog", ",", "msg", ")", "{", "var", "params", "=", "{", "}", "node", ".", "status", "(", "{", "fill", ":", "'blue'", ",", "shape", ":", "'dot'", ",", "text", ":", "'requesting create of new dialog template'...
This function creates a new dialog template. The name must be unique, the file can be in any accepted format, and be either a text file or a binary buffer.
[ "This", "function", "creates", "a", "new", "dialog", "template", ".", "The", "name", "must", "be", "unique", "the", "file", "can", "be", "in", "any", "accepted", "format", "and", "be", "either", "a", "text", "file", "or", "a", "binary", "buffer", "." ]
2869917ccf28a18cbdc2e58fe071666abd74bf71
https://github.com/watson-developer-cloud/node-red-node-watson/blob/2869917ccf28a18cbdc2e58fe071666abd74bf71/services/dialog/v1.js#L184-L227
20,826
watson-developer-cloud/node-red-node-watson
services/dialog/v1.js
performDelete
function performDelete(node,dialog,msg, config) { var params = {}; var message = ''; node.status({fill:'blue', shape:'dot', text:'requesting delete of a dialog instance'}); if (!config.dialog || '' != config.dialog) { params.dialog_id = config.dialog; dialog.deleteDialog(params, func...
javascript
function performDelete(node,dialog,msg, config) { var params = {}; var message = ''; node.status({fill:'blue', shape:'dot', text:'requesting delete of a dialog instance'}); if (!config.dialog || '' != config.dialog) { params.dialog_id = config.dialog; dialog.deleteDialog(params, func...
[ "function", "performDelete", "(", "node", ",", "dialog", ",", "msg", ",", "config", ")", "{", "var", "params", "=", "{", "}", ";", "var", "message", "=", "''", ";", "node", ".", "status", "(", "{", "fill", ":", "'blue'", ",", "shape", ":", "'dot'",...
This function delete an existing dialog instance.
[ "This", "function", "delete", "an", "existing", "dialog", "instance", "." ]
2869917ccf28a18cbdc2e58fe071666abd74bf71
https://github.com/watson-developer-cloud/node-red-node-watson/blob/2869917ccf28a18cbdc2e58fe071666abd74bf71/services/dialog/v1.js#L230-L263
20,827
watson-developer-cloud/node-red-node-watson
services/dialog/v1.js
performList
function performList(node,dialog,msg) { node.status({fill:'blue', shape:'dot', text:'requesting list of dialogs'}); dialog.getDialogs({}, function(err, dialogs){ node.status({}); if (err) { node.status({fill:'red', shape:'ring', text:'call to dialog service failed'}); node.error(err, m...
javascript
function performList(node,dialog,msg) { node.status({fill:'blue', shape:'dot', text:'requesting list of dialogs'}); dialog.getDialogs({}, function(err, dialogs){ node.status({}); if (err) { node.status({fill:'red', shape:'ring', text:'call to dialog service failed'}); node.error(err, m...
[ "function", "performList", "(", "node", ",", "dialog", ",", "msg", ")", "{", "node", ".", "status", "(", "{", "fill", ":", "'blue'", ",", "shape", ":", "'dot'", ",", "text", ":", "'requesting list of dialogs'", "}", ")", ";", "dialog", ".", "getDialogs",...
This function performs the operation to fetch a list of all dialog templates
[ "This", "function", "performs", "the", "operation", "to", "fetch", "a", "list", "of", "all", "dialog", "templates" ]
2869917ccf28a18cbdc2e58fe071666abd74bf71
https://github.com/watson-developer-cloud/node-red-node-watson/blob/2869917ccf28a18cbdc2e58fe071666abd74bf71/services/dialog/v1.js#L266-L280
20,828
watson-developer-cloud/node-red-node-watson
services/dialog/v1.js
performDeleteAll
function performDeleteAll(node,dialog,msg) { node.status({fill:'blue', shape:'dot', text:'requesting Delete All dialogs'}); dialog.getDialogs({}, function(err, dialogs){ node.status({}); if (err) { node.status({fill:'red', shape:'ring', text:'Delete All : call to getDialogs service fai...
javascript
function performDeleteAll(node,dialog,msg) { node.status({fill:'blue', shape:'dot', text:'requesting Delete All dialogs'}); dialog.getDialogs({}, function(err, dialogs){ node.status({}); if (err) { node.status({fill:'red', shape:'ring', text:'Delete All : call to getDialogs service fai...
[ "function", "performDeleteAll", "(", "node", ",", "dialog", ",", "msg", ")", "{", "node", ".", "status", "(", "{", "fill", ":", "'blue'", ",", "shape", ":", "'dot'", ",", "text", ":", "'requesting Delete All dialogs'", "}", ")", ";", "dialog", ".", "getD...
This function performs the operation to Delete ALL Dialogs
[ "This", "function", "performs", "the", "operation", "to", "Delete", "ALL", "Dialogs" ]
2869917ccf28a18cbdc2e58fe071666abd74bf71
https://github.com/watson-developer-cloud/node-red-node-watson/blob/2869917ccf28a18cbdc2e58fe071666abd74bf71/services/dialog/v1.js#L283-L330
20,829
watson-developer-cloud/node-red-node-watson
services/visual_recognition/v3.js
addTask
function addTask(asyncTasks, msg, k, listParams, node) { asyncTasks.push(function(callback) { var buffer = msg.params[k]; temp.open({ suffix: '.' + fileType(buffer).ext }, function(err, info) { if (err) { node.status({ fill: 'red', shape: 'ring', ...
javascript
function addTask(asyncTasks, msg, k, listParams, node) { asyncTasks.push(function(callback) { var buffer = msg.params[k]; temp.open({ suffix: '.' + fileType(buffer).ext }, function(err, info) { if (err) { node.status({ fill: 'red', shape: 'ring', ...
[ "function", "addTask", "(", "asyncTasks", ",", "msg", ",", "k", ",", "listParams", ",", "node", ")", "{", "asyncTasks", ".", "push", "(", "function", "(", "callback", ")", "{", "var", "buffer", "=", "msg", ".", "params", "[", "k", "]", ";", "temp", ...
This is where the two read stream tasks are built, individually asynTasks will be the two functions that will be invoked added one at a time, each time this function is invoked msg holds the parameters k is the key value for the files in msg. listParams is where the files will go so that they can be sent to the service...
[ "This", "is", "where", "the", "two", "read", "stream", "tasks", "are", "built", "individually", "asynTasks", "will", "be", "the", "two", "functions", "that", "will", "be", "invoked", "added", "one", "at", "a", "time", "each", "time", "this", "function", "i...
2869917ccf28a18cbdc2e58fe071666abd74bf71
https://github.com/watson-developer-cloud/node-red-node-watson/blob/2869917ccf28a18cbdc2e58fe071666abd74bf71/services/visual_recognition/v3.js#L267-L292
20,830
watson-developer-cloud/node-red-node-watson
services/text_to_speech/v1-corpus-builder.js
Node
function Node (config) { RED.nodes.createNode(this, config); var node = this; this.on('input', function (msg) { var method = config['tts-custom-mode'], message = '', params = {}; username = sUsername || this.credentials.username; password = sPassword || this.credentials.p...
javascript
function Node (config) { RED.nodes.createNode(this, config); var node = this; this.on('input', function (msg) { var method = config['tts-custom-mode'], message = '', params = {}; username = sUsername || this.credentials.username; password = sPassword || this.credentials.p...
[ "function", "Node", "(", "config", ")", "{", "RED", ".", "nodes", ".", "createNode", "(", "this", ",", "config", ")", ";", "var", "node", "=", "this", ";", "this", ".", "on", "(", "'input'", ",", "function", "(", "msg", ")", "{", "var", "method", ...
This is the Speech to Text V1 Query Builder Node
[ "This", "is", "the", "Speech", "to", "Text", "V1", "Query", "Builder", "Node" ]
2869917ccf28a18cbdc2e58fe071666abd74bf71
https://github.com/watson-developer-cloud/node-red-node-watson/blob/2869917ccf28a18cbdc2e58fe071666abd74bf71/services/text_to_speech/v1-corpus-builder.js#L356-L397
20,831
astorije/chai-immutable
chai-immutable.js
assertCollectionSizeLeast
function assertCollectionSizeLeast(_super) { return function(n) { if (utils.flag(this, 'immutable.collection.size')) { assertIsIterable(this._obj); const { size } = this._obj; new Assertion(size).a('number'); this.assert( size >= n, 'expected #{this} to ha...
javascript
function assertCollectionSizeLeast(_super) { return function(n) { if (utils.flag(this, 'immutable.collection.size')) { assertIsIterable(this._obj); const { size } = this._obj; new Assertion(size).a('number'); this.assert( size >= n, 'expected #{this} to ha...
[ "function", "assertCollectionSizeLeast", "(", "_super", ")", "{", "return", "function", "(", "n", ")", "{", "if", "(", "utils", ".", "flag", "(", "this", ",", "'immutable.collection.size'", ")", ")", "{", "assertIsIterable", "(", "this", ".", "_obj", ")", ...
Numerical comparator overwrites
[ "Numerical", "comparator", "overwrites" ]
3749bed866516061be66f6459840aa1b21dd7d28
https://github.com/astorije/chai-immutable/blob/3749bed866516061be66f6459840aa1b21dd7d28/chai-immutable.js#L682-L702
20,832
Paperspace/paperspace-node
lib/request.js
request
function request( host, method, path, params, query, headers, options, file, cb, debug ) { if (!options) options = {}; // Remove leading/trailing slash from the path/host so that we can join // the two together no matter which way the user chose to provide them. if (path[0] === FSLASH) { path = path.sl...
javascript
function request( host, method, path, params, query, headers, options, file, cb, debug ) { if (!options) options = {}; // Remove leading/trailing slash from the path/host so that we can join // the two together no matter which way the user chose to provide them. if (path[0] === FSLASH) { path = path.sl...
[ "function", "request", "(", "host", ",", "method", ",", "path", ",", "params", ",", "query", ",", "headers", ",", "options", ",", "file", ",", "cb", ",", "debug", ")", "{", "if", "(", "!", "options", ")", "options", "=", "{", "}", ";", "// Remove l...
General-purpose HTTP request method, based on superagent
[ "General", "-", "purpose", "HTTP", "request", "method", "based", "on", "superagent" ]
aed9c28610dbefb70bf382189f068182062325a6
https://github.com/Paperspace/paperspace-node/blob/aed9c28610dbefb70bf382189f068182062325a6/lib/request.js#L21-L123
20,833
Paperspace/paperspace-node
lib/paperspace.js
eachEndpoint
function eachEndpoint(iterator) { for (var namespace in endpoints) { var methods = endpoints[namespace]; for (var name in methods) { var method = methods[name]; iterator(namespace, name, method); } } return endpoints; }
javascript
function eachEndpoint(iterator) { for (var namespace in endpoints) { var methods = endpoints[namespace]; for (var name in methods) { var method = methods[name]; iterator(namespace, name, method); } } return endpoints; }
[ "function", "eachEndpoint", "(", "iterator", ")", "{", "for", "(", "var", "namespace", "in", "endpoints", ")", "{", "var", "methods", "=", "endpoints", "[", "namespace", "]", ";", "for", "(", "var", "name", "in", "methods", ")", "{", "var", "method", "...
Iterate through all the endpoints available and return the namespace, method name, and method to the iterator function
[ "Iterate", "through", "all", "the", "endpoints", "available", "and", "return", "the", "namespace", "method", "name", "and", "method", "to", "the", "iterator", "function" ]
aed9c28610dbefb70bf382189f068182062325a6
https://github.com/Paperspace/paperspace-node/blob/aed9c28610dbefb70bf382189f068182062325a6/lib/paperspace.js#L15-L27
20,834
Paperspace/paperspace-node
lib/paperspace.js
paperspace
function paperspace(options) { if (options && !isAnyAuthOptionPresent(options)) { throw NO_CREDS; } var api = {}; eachEndpoint(function _eachEndpoint(namespace, name, method) { if (!api[namespace]) api[namespace] = {}; api[namespace][name] = wrapMethod(method, options); }); return api; }
javascript
function paperspace(options) { if (options && !isAnyAuthOptionPresent(options)) { throw NO_CREDS; } var api = {}; eachEndpoint(function _eachEndpoint(namespace, name, method) { if (!api[namespace]) api[namespace] = {}; api[namespace][name] = wrapMethod(method, options); }); return api; }
[ "function", "paperspace", "(", "options", ")", "{", "if", "(", "options", "&&", "!", "isAnyAuthOptionPresent", "(", "options", ")", ")", "{", "throw", "NO_CREDS", ";", "}", "var", "api", "=", "{", "}", ";", "eachEndpoint", "(", "function", "_eachEndpoint",...
Entrypoint to the API for those who want to use a certain set of credentials for authenticating all requests
[ "Entrypoint", "to", "the", "API", "for", "those", "who", "want", "to", "use", "a", "certain", "set", "of", "credentials", "for", "authenticating", "all", "requests" ]
aed9c28610dbefb70bf382189f068182062325a6
https://github.com/Paperspace/paperspace-node/blob/aed9c28610dbefb70bf382189f068182062325a6/lib/paperspace.js#L56-L69
20,835
Paperspace/paperspace-node
lib/client.js
client
function client(method, path, inputs, headers, file, cb) { var body = null; var query = {}; var options = {}; // It's assumed these will be provided, but just in case... if (!headers) headers = {}; headers.ps_client_name = clientName; headers.ps_client_version = clientVersion; // Send input params as the que...
javascript
function client(method, path, inputs, headers, file, cb) { var body = null; var query = {}; var options = {}; // It's assumed these will be provided, but just in case... if (!headers) headers = {}; headers.ps_client_name = clientName; headers.ps_client_version = clientVersion; // Send input params as the que...
[ "function", "client", "(", "method", ",", "path", ",", "inputs", ",", "headers", ",", "file", ",", "cb", ")", "{", "var", "body", "=", "null", ";", "var", "query", "=", "{", "}", ";", "var", "options", "=", "{", "}", ";", "// It's assumed these will ...
Simple wrapper over the request function that inserts a 'host' parameter as the first argument, since most use cases are always going to use the same host as provided via the baked-in config.
[ "Simple", "wrapper", "over", "the", "request", "function", "that", "inserts", "a", "host", "parameter", "as", "the", "first", "argument", "since", "most", "use", "cases", "are", "always", "going", "to", "use", "the", "same", "host", "as", "provided", "via", ...
aed9c28610dbefb70bf382189f068182062325a6
https://github.com/Paperspace/paperspace-node/blob/aed9c28610dbefb70bf382189f068182062325a6/lib/client.js#L26-L73
20,836
cloudant/couchbackup
app.js
isSafePositiveInteger
function isSafePositiveInteger(x) { // https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991; // Is it a number? return Object.prototype.toString.call(x) === '[object Number]' && // Is it an ...
javascript
function isSafePositiveInteger(x) { // https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991; // Is it a number? return Object.prototype.toString.call(x) === '[object Number]' && // Is it an ...
[ "function", "isSafePositiveInteger", "(", "x", ")", "{", "// https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER", "const", "MAX_SAFE_INTEGER", "=", "Number", ".", "MAX_SAFE_INTEGER", "||", "9007199254740991", ";", "// Is it a number?...
Test for a positive, safe integer. @param {object} x - Object under test.
[ "Test", "for", "a", "positive", "safe", "integer", "." ]
73a0140a539971e97cdec0233def5db5f9d8f13b
https://github.com/cloudant/couchbackup/blob/73a0140a539971e97cdec0233def5db5f9d8f13b/app.js#L38-L49
20,837
cloudant/couchbackup
app.js
function(srcUrl, targetStream, opts, callback) { var listenerErrorIndicator = { errored: false }; if (typeof callback === 'undefined' && typeof opts === 'function') { callback = opts; opts = {}; } if (!validateArgs(srcUrl, opts, callback)) { // bad args, bail return; } /...
javascript
function(srcUrl, targetStream, opts, callback) { var listenerErrorIndicator = { errored: false }; if (typeof callback === 'undefined' && typeof opts === 'function') { callback = opts; opts = {}; } if (!validateArgs(srcUrl, opts, callback)) { // bad args, bail return; } /...
[ "function", "(", "srcUrl", ",", "targetStream", ",", "opts", ",", "callback", ")", "{", "var", "listenerErrorIndicator", "=", "{", "errored", ":", "false", "}", ";", "if", "(", "typeof", "callback", "===", "'undefined'", "&&", "typeof", "opts", "===", "'fu...
Backup a Cloudant database to a stream. @param {string} srcUrl - URL of database to backup. @param {stream.Writable} targetStream - Stream to write content to. @param {object} opts - Backup options. @param {number} [opts.parallelism=5] - Number of parallel HTTP requests to use. @param {number} [opts.bufferSize=500] - ...
[ "Backup", "a", "Cloudant", "database", "to", "a", "stream", "." ]
73a0140a539971e97cdec0233def5db5f9d8f13b
https://github.com/cloudant/couchbackup/blob/73a0140a539971e97cdec0233def5db5f9d8f13b/app.js#L200-L305
20,838
cloudant/couchbackup
app.js
function(srcStream, targetUrl, opts, callback) { var listenerErrorIndicator = { errored: false }; if (typeof callback === 'undefined' && typeof opts === 'function') { callback = opts; opts = {}; } validateArgs(targetUrl, opts, callback); opts = Object.assign({}, defaults(), opts); c...
javascript
function(srcStream, targetUrl, opts, callback) { var listenerErrorIndicator = { errored: false }; if (typeof callback === 'undefined' && typeof opts === 'function') { callback = opts; opts = {}; } validateArgs(targetUrl, opts, callback); opts = Object.assign({}, defaults(), opts); c...
[ "function", "(", "srcStream", ",", "targetUrl", ",", "opts", ",", "callback", ")", "{", "var", "listenerErrorIndicator", "=", "{", "errored", ":", "false", "}", ";", "if", "(", "typeof", "callback", "===", "'undefined'", "&&", "typeof", "opts", "===", "'fu...
Restore a backup from a stream. @param {stream.Readable} srcStream - Stream containing backed up data. @param {string} targetUrl - Target database. @param {object} opts - Restore options. @param {number} opts.parallelism - Number of parallel HTTP requests to use. Default 5. @param {number} opts.bufferSize - Number of ...
[ "Restore", "a", "backup", "from", "a", "stream", "." ]
73a0140a539971e97cdec0233def5db5f9d8f13b
https://github.com/cloudant/couchbackup/blob/73a0140a539971e97cdec0233def5db5f9d8f13b/app.js#L319-L377
20,839
cloudant/couchbackup
includes/backup.js
downloadRemainingBatches
function downloadRemainingBatches(log, db, ee, startTime, batchesPerDownloadSession, parallelism) { var total = 0; // running total of documents downloaded so far var noRemainingBatches = false; // Generate a set of batches (up to batchesPerDownloadSession) to download from the // log file and download them. S...
javascript
function downloadRemainingBatches(log, db, ee, startTime, batchesPerDownloadSession, parallelism) { var total = 0; // running total of documents downloaded so far var noRemainingBatches = false; // Generate a set of batches (up to batchesPerDownloadSession) to download from the // log file and download them. S...
[ "function", "downloadRemainingBatches", "(", "log", ",", "db", ",", "ee", ",", "startTime", ",", "batchesPerDownloadSession", ",", "parallelism", ")", "{", "var", "total", "=", "0", ";", "// running total of documents downloaded so far", "var", "noRemainingBatches", "...
Download remaining batches in a log file, splitting batches into sets to avoid enqueueing too many in one go. @param {string} log - log file name to maintain download state @param {string} db - nodejs-cloudant db @param {events.EventEmitter} ee - event emitter to emit received events on @param {time} startTime - start...
[ "Download", "remaining", "batches", "in", "a", "log", "file", "splitting", "batches", "into", "sets", "to", "avoid", "enqueueing", "too", "many", "in", "one", "go", "." ]
73a0140a539971e97cdec0233def5db5f9d8f13b
https://github.com/cloudant/couchbackup/blob/73a0140a539971e97cdec0233def5db5f9d8f13b/includes/backup.js#L111-L153
20,840
cloudant/couchbackup
includes/backup.js
readBatchSetIdsFromLogFile
function readBatchSetIdsFromLogFile(log, batchesPerDownloadSession, callback) { logfilesummary(log, function processSummary(err, summary) { if (!summary.changesComplete) { callback(new error.BackupError('IncompleteChangesInLogFile', 'WARNING: Changes did not finish spooling')); return; } ...
javascript
function readBatchSetIdsFromLogFile(log, batchesPerDownloadSession, callback) { logfilesummary(log, function processSummary(err, summary) { if (!summary.changesComplete) { callback(new error.BackupError('IncompleteChangesInLogFile', 'WARNING: Changes did not finish spooling')); return; } ...
[ "function", "readBatchSetIdsFromLogFile", "(", "log", ",", "batchesPerDownloadSession", ",", "callback", ")", "{", "logfilesummary", "(", "log", ",", "function", "processSummary", "(", "err", ",", "summary", ")", "{", "if", "(", "!", "summary", ".", "changesComp...
Return a set of uncompleted download batch IDs from the log file. @param {string} log - log file path @param {number} batchesPerDownloadSession - maximum IDs to return @param {function} callback - sign (err, batchSetIds array)
[ "Return", "a", "set", "of", "uncompleted", "download", "batch", "IDs", "from", "the", "log", "file", "." ]
73a0140a539971e97cdec0233def5db5f9d8f13b
https://github.com/cloudant/couchbackup/blob/73a0140a539971e97cdec0233def5db5f9d8f13b/includes/backup.js#L162-L177
20,841
cloudant/couchbackup
includes/backup.js
processBatchSet
function processBatchSet(db, parallelism, log, batches, ee, start, grandtotal, callback) { var hasErrored = false; var total = grandtotal; // queue to process the fetch requests in an orderly fashion using _bulk_get var q = async.queue(function(payload, done) { var output = []; var thisBatch = payload....
javascript
function processBatchSet(db, parallelism, log, batches, ee, start, grandtotal, callback) { var hasErrored = false; var total = grandtotal; // queue to process the fetch requests in an orderly fashion using _bulk_get var q = async.queue(function(payload, done) { var output = []; var thisBatch = payload....
[ "function", "processBatchSet", "(", "db", ",", "parallelism", ",", "log", ",", "batches", ",", "ee", ",", "start", ",", "grandtotal", ",", "callback", ")", "{", "var", "hasErrored", "=", "false", ";", "var", "total", "=", "grandtotal", ";", "// queue to pr...
Download a set of batches retrieved from a log file. When a download is complete, add a line to the logfile indicating such. @param {any} db - nodejs-cloudant database @param {any} parallelism - number of concurrent requests to make @param {any} log - log file to drive downloads from @param {any} batches - batches to ...
[ "Download", "a", "set", "of", "batches", "retrieved", "from", "a", "log", "file", ".", "When", "a", "download", "is", "complete", "add", "a", "line", "to", "the", "logfile", "indicating", "such", "." ]
73a0140a539971e97cdec0233def5db5f9d8f13b
https://github.com/cloudant/couchbackup/blob/73a0140a539971e97cdec0233def5db5f9d8f13b/includes/backup.js#L194-L260
20,842
cloudant/couchbackup
includes/backup.js
getPropertyNames
function getPropertyNames(obj, count) { // decide which batch numbers to deal with var batchestofetch = []; var j = 0; for (var i in obj) { batchestofetch.push(parseInt(i)); j++; if (j >= count) break; } return batchestofetch; }
javascript
function getPropertyNames(obj, count) { // decide which batch numbers to deal with var batchestofetch = []; var j = 0; for (var i in obj) { batchestofetch.push(parseInt(i)); j++; if (j >= count) break; } return batchestofetch; }
[ "function", "getPropertyNames", "(", "obj", ",", "count", ")", "{", "// decide which batch numbers to deal with", "var", "batchestofetch", "=", "[", "]", ";", "var", "j", "=", "0", ";", "for", "(", "var", "i", "in", "obj", ")", "{", "batchestofetch", ".", ...
Returns first N properties on an object. @param {object} obj - object with properties @param {number} count - number of properties to return
[ "Returns", "first", "N", "properties", "on", "an", "object", "." ]
73a0140a539971e97cdec0233def5db5f9d8f13b
https://github.com/cloudant/couchbackup/blob/73a0140a539971e97cdec0233def5db5f9d8f13b/includes/backup.js#L268-L278
20,843
cloudant/couchbackup
examples/s3-backup-stream.js
bucketAccessible
function bucketAccessible(s3, bucketName) { return new Promise(function(resolve, reject) { var params = { Bucket: bucketName }; s3.headBucket(params, function(err, data) { if (err) { reject(new VError(err, 'S3 bucket not accessible')); } else { resolve(); } }); ...
javascript
function bucketAccessible(s3, bucketName) { return new Promise(function(resolve, reject) { var params = { Bucket: bucketName }; s3.headBucket(params, function(err, data) { if (err) { reject(new VError(err, 'S3 bucket not accessible')); } else { resolve(); } }); ...
[ "function", "bucketAccessible", "(", "s3", ",", "bucketName", ")", "{", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "var", "params", "=", "{", "Bucket", ":", "bucketName", "}", ";", "s3", ".", "headBucket", "(", ...
Return a promise that resolves if the bucket is available and rejects if not. @param {any} s3 S3 client object @param {any} bucketName Bucket name @returns Promise
[ "Return", "a", "promise", "that", "resolves", "if", "the", "bucket", "is", "available", "and", "rejects", "if", "not", "." ]
73a0140a539971e97cdec0233def5db5f9d8f13b
https://github.com/cloudant/couchbackup/blob/73a0140a539971e97cdec0233def5db5f9d8f13b/examples/s3-backup-stream.js#L92-L105
20,844
cloudant/couchbackup
examples/s3-backup-stream.js
backupToS3
function backupToS3(sourceUrl, s3Client, s3Bucket, s3Key, shallow) { return new Promise((resolve, reject) => { debug(`Setting up S3 upload to ${s3Bucket}/${s3Key}`); // A pass through stream that has couchbackup's output // written to it and it then read by the S3 upload client. // It has a 64MB high...
javascript
function backupToS3(sourceUrl, s3Client, s3Bucket, s3Key, shallow) { return new Promise((resolve, reject) => { debug(`Setting up S3 upload to ${s3Bucket}/${s3Key}`); // A pass through stream that has couchbackup's output // written to it and it then read by the S3 upload client. // It has a 64MB high...
[ "function", "backupToS3", "(", "sourceUrl", ",", "s3Client", ",", "s3Bucket", ",", "s3Key", ",", "shallow", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "debug", "(", "`", "${", "s3Bucket", "}", "${", "s3Key...
Backup directly from Cloudant to an object store object via a stream. @param {any} sourceUrl URL of database @param {any} s3Client Object store client @param {any} s3Bucket Backup destination bucket @param {any} s3Key Backup destination key name (shouldn't exist) @param {any} shallow Whether to use the couchbackup `sh...
[ "Backup", "directly", "from", "Cloudant", "to", "an", "object", "store", "object", "via", "a", "stream", "." ]
73a0140a539971e97cdec0233def5db5f9d8f13b
https://github.com/cloudant/couchbackup/blob/73a0140a539971e97cdec0233def5db5f9d8f13b/examples/s3-backup-stream.js#L117-L163
20,845
cloudant/couchbackup
includes/logfilesummary.js
function(obj) { if (obj.command === 't') { state[obj.batch] = true; } else if (obj.command === 'd') { delete state[obj.batch]; } else if (obj.command === 'changes_complete') { changesComplete = true; } }
javascript
function(obj) { if (obj.command === 't') { state[obj.batch] = true; } else if (obj.command === 'd') { delete state[obj.batch]; } else if (obj.command === 'changes_complete') { changesComplete = true; } }
[ "function", "(", "obj", ")", "{", "if", "(", "obj", ".", "command", "===", "'t'", ")", "{", "state", "[", "obj", ".", "batch", "]", "=", "true", ";", "}", "else", "if", "(", "obj", ".", "command", "===", "'d'", ")", "{", "delete", "state", "[",...
called with each line from the log file
[ "called", "with", "each", "line", "from", "the", "log", "file" ]
73a0140a539971e97cdec0233def5db5f9d8f13b
https://github.com/cloudant/couchbackup/blob/73a0140a539971e97cdec0233def5db5f9d8f13b/includes/logfilesummary.js#L74-L82
20,846
cloudant/couchbackup
examples/s3-backup-file.js
createBackupFile
function createBackupFile(sourceUrl, backupTmpFilePath) { return new Promise((resolve, reject) => { couchbackup.backup( sourceUrl, fs.createWriteStream(backupTmpFilePath), (err) => { if (err) { return reject(new VError(err, 'CouchBackup process failed')); } debu...
javascript
function createBackupFile(sourceUrl, backupTmpFilePath) { return new Promise((resolve, reject) => { couchbackup.backup( sourceUrl, fs.createWriteStream(backupTmpFilePath), (err) => { if (err) { return reject(new VError(err, 'CouchBackup process failed')); } debu...
[ "function", "createBackupFile", "(", "sourceUrl", ",", "backupTmpFilePath", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "couchbackup", ".", "backup", "(", "sourceUrl", ",", "fs", ".", "createWriteStream", "(", "b...
Use couchbackup to create a backup of the specified database to a file path. @param {any} sourceUrl Database URL @param {any} backupTmpFilePath Path to write file @returns Promise
[ "Use", "couchbackup", "to", "create", "a", "backup", "of", "the", "specified", "database", "to", "a", "file", "path", "." ]
73a0140a539971e97cdec0233def5db5f9d8f13b
https://github.com/cloudant/couchbackup/blob/73a0140a539971e97cdec0233def5db5f9d8f13b/examples/s3-backup-file.js#L120-L134
20,847
cloudant/couchbackup
examples/s3-backup-file.js
uploadNewBackup
function uploadNewBackup(s3, backupTmpFilePath, bucket, key) { return new Promise((resolve, reject) => { debug(`Uploading from ${backupTmpFilePath} to ${bucket}/${key}`); function uploadFromStream(s3, bucket, key) { const pass = new stream.PassThrough(); const params = { Bucket: bucket, ...
javascript
function uploadNewBackup(s3, backupTmpFilePath, bucket, key) { return new Promise((resolve, reject) => { debug(`Uploading from ${backupTmpFilePath} to ${bucket}/${key}`); function uploadFromStream(s3, bucket, key) { const pass = new stream.PassThrough(); const params = { Bucket: bucket, ...
[ "function", "uploadNewBackup", "(", "s3", ",", "backupTmpFilePath", ",", "bucket", ",", "key", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "debug", "(", "`", "${", "backupTmpFilePath", "}", "${", "bucket", "}...
Upload a backup file to an S3 bucket. @param {any} s3 Object store client @param {any} backupTmpFilePath Path of backup file to write. @param {any} bucket Object store bucket name @param {any} key Object store key name @returns Promise
[ "Upload", "a", "backup", "file", "to", "an", "S3", "bucket", "." ]
73a0140a539971e97cdec0233def5db5f9d8f13b
https://github.com/cloudant/couchbackup/blob/73a0140a539971e97cdec0233def5db5f9d8f13b/examples/s3-backup-file.js#L145-L178
20,848
cloudant/couchbackup
includes/config.js
apiDefaults
function apiDefaults() { return { parallelism: 5, bufferSize: 500, requestTimeout: 120000, log: tmp.fileSync().name, resume: false, mode: 'full' }; }
javascript
function apiDefaults() { return { parallelism: 5, bufferSize: 500, requestTimeout: 120000, log: tmp.fileSync().name, resume: false, mode: 'full' }; }
[ "function", "apiDefaults", "(", ")", "{", "return", "{", "parallelism", ":", "5", ",", "bufferSize", ":", "500", ",", "requestTimeout", ":", "120000", ",", "log", ":", "tmp", ".", "fileSync", "(", ")", ".", "name", ",", "resume", ":", "false", ",", "...
Return API default settings.
[ "Return", "API", "default", "settings", "." ]
73a0140a539971e97cdec0233def5db5f9d8f13b
https://github.com/cloudant/couchbackup/blob/73a0140a539971e97cdec0233def5db5f9d8f13b/includes/config.js#L22-L31
20,849
cloudant/couchbackup
includes/writer.js
processBuffer
function processBuffer(flush, callback) { function taskCallback(err, payload) { if (err && !didError) { debug(`Queue task failed with error ${err.name}`); didError = true; q.kill(); writer.emit('error', err); } } if (flush || buffer.length >= bufferSize) { ...
javascript
function processBuffer(flush, callback) { function taskCallback(err, payload) { if (err && !didError) { debug(`Queue task failed with error ${err.name}`); didError = true; q.kill(); writer.emit('error', err); } } if (flush || buffer.length >= bufferSize) { ...
[ "function", "processBuffer", "(", "flush", ",", "callback", ")", "{", "function", "taskCallback", "(", "err", ",", "payload", ")", "{", "if", "(", "err", "&&", "!", "didError", ")", "{", "debug", "(", "`", "${", "err", ".", "name", "}", "`", ")", "...
write the contents of the buffer to CouchDB in blocks of bufferSize
[ "write", "the", "contents", "of", "the", "buffer", "to", "CouchDB", "in", "blocks", "of", "bufferSize" ]
73a0140a539971e97cdec0233def5db5f9d8f13b
https://github.com/cloudant/couchbackup/blob/73a0140a539971e97cdec0233def5db5f9d8f13b/includes/writer.js#L96-L154
20,850
cloudant/couchbackup
includes/writer.js
function() { // if we encountered an error, stop this until loop if (didError) { return true; } if (flush) { return q.idle() && q.length() === 0; } else { return q.length() <= parallelism * 2; } }
javascript
function() { // if we encountered an error, stop this until loop if (didError) { return true; } if (flush) { return q.idle() && q.length() === 0; } else { return q.length() <= parallelism * 2; } }
[ "function", "(", ")", "{", "// if we encountered an error, stop this until loop", "if", "(", "didError", ")", "{", "return", "true", ";", "}", "if", "(", "flush", ")", "{", "return", "q", ".", "idle", "(", ")", "&&", "q", ".", "length", "(", ")", "===", ...
wait until the queue length drops to twice the paralellism or until empty on the last write
[ "wait", "until", "the", "queue", "length", "drops", "to", "twice", "the", "paralellism", "or", "until", "empty", "on", "the", "last", "write" ]
73a0140a539971e97cdec0233def5db5f9d8f13b
https://github.com/cloudant/couchbackup/blob/73a0140a539971e97cdec0233def5db5f9d8f13b/includes/writer.js#L128-L138
20,851
cloudant/couchbackup
includes/spoolchanges.js
function(lastOne) { if (buffer.length >= bufferSize || (lastOne && buffer.length > 0)) { debug('writing', buffer.length, 'changes to the backup file'); var b = { docs: buffer.splice(0, bufferSize), batch: batch }; logStream.write(':t batch' + batch + ' ' + JSON.stringify(b.docs) + '\n'); ee....
javascript
function(lastOne) { if (buffer.length >= bufferSize || (lastOne && buffer.length > 0)) { debug('writing', buffer.length, 'changes to the backup file'); var b = { docs: buffer.splice(0, bufferSize), batch: batch }; logStream.write(':t batch' + batch + ' ' + JSON.stringify(b.docs) + '\n'); ee....
[ "function", "(", "lastOne", ")", "{", "if", "(", "buffer", ".", "length", ">=", "bufferSize", "||", "(", "lastOne", "&&", "buffer", ".", "length", ">", "0", ")", ")", "{", "debug", "(", "'writing'", ",", "buffer", ".", "length", ",", "'changes to the b...
send documents ids to the queue in batches of bufferSize + the last batch
[ "send", "documents", "ids", "to", "the", "queue", "in", "batches", "of", "bufferSize", "+", "the", "last", "batch" ]
73a0140a539971e97cdec0233def5db5f9d8f13b
https://github.com/cloudant/couchbackup/blob/73a0140a539971e97cdec0233def5db5f9d8f13b/includes/spoolchanges.js#L39-L47
20,852
cloudant/couchbackup
includes/spoolchanges.js
function(c) { if (c) { if (c.error) { ee.emit('error', new error.BackupError('InvalidChange', `Received invalid change: ${c}`)); } else if (c.changes) { var obj = { id: c.id }; buffer.push(obj); processBuffer(false); } else if (c.last_seq) { lastSeq = c.last...
javascript
function(c) { if (c) { if (c.error) { ee.emit('error', new error.BackupError('InvalidChange', `Received invalid change: ${c}`)); } else if (c.changes) { var obj = { id: c.id }; buffer.push(obj); processBuffer(false); } else if (c.last_seq) { lastSeq = c.last...
[ "function", "(", "c", ")", "{", "if", "(", "c", ")", "{", "if", "(", "c", ".", "error", ")", "{", "ee", ".", "emit", "(", "'error'", ",", "new", "error", ".", "BackupError", "(", "'InvalidChange'", ",", "`", "${", "c", "}", "`", ")", ")", ";"...
called once per received change
[ "called", "once", "per", "received", "change" ]
73a0140a539971e97cdec0233def5db5f9d8f13b
https://github.com/cloudant/couchbackup/blob/73a0140a539971e97cdec0233def5db5f9d8f13b/includes/spoolchanges.js#L50-L62
20,853
gentooboontoo/js-quantities
lib/JSLitmus.js
function(n) { if (n == Infinity) { return 'Infinity'; } else if (n > 1e9) { n = Math.round(n/1e8); return n/10 + 'B'; } else if (n > 1e6) { n = Math.round(n/1e5); return n/10 + 'M'; } else if (n > 1e3) { n = Math.round(n/1e2); return n/10 +...
javascript
function(n) { if (n == Infinity) { return 'Infinity'; } else if (n > 1e9) { n = Math.round(n/1e8); return n/10 + 'B'; } else if (n > 1e6) { n = Math.round(n/1e5); return n/10 + 'M'; } else if (n > 1e3) { n = Math.round(n/1e2); return n/10 +...
[ "function", "(", "n", ")", "{", "if", "(", "n", "==", "Infinity", ")", "{", "return", "'Infinity'", ";", "}", "else", "if", "(", "n", ">", "1e9", ")", "{", "n", "=", "Math", ".", "round", "(", "n", "/", "1e8", ")", ";", "return", "n", "/", ...
Convert a number to an abbreviated string like, "15K" or "10M"
[ "Convert", "a", "number", "to", "an", "abbreviated", "string", "like", "15K", "or", "10M" ]
368d45526500dda7cc31a25fd77c30d7ec4b3208
https://github.com/gentooboontoo/js-quantities/blob/368d45526500dda7cc31a25fd77c30d7ec4b3208/lib/JSLitmus.js#L64-L78
20,854
gentooboontoo/js-quantities
lib/JSLitmus.js
function(count) { var me = this; // Make sure calibration tests have run if (!me.isCalibration && Test.calibrate(function() {me.run(count);})) return; this.error = null; try { var start, f = this.f, now, i = count; // Start the timer start = new Date(); ...
javascript
function(count) { var me = this; // Make sure calibration tests have run if (!me.isCalibration && Test.calibrate(function() {me.run(count);})) return; this.error = null; try { var start, f = this.f, now, i = count; // Start the timer start = new Date(); ...
[ "function", "(", "count", ")", "{", "var", "me", "=", "this", ";", "// Make sure calibration tests have run", "if", "(", "!", "me", ".", "isCalibration", "&&", "Test", ".", "calibrate", "(", "function", "(", ")", "{", "me", ".", "run", "(", "count", ")",...
The nuts and bolts code that actually runs a test
[ "The", "nuts", "and", "bolts", "code", "that", "actually", "runs", "a", "test" ]
368d45526500dda7cc31a25fd77c30d7ec4b3208
https://github.com/gentooboontoo/js-quantities/blob/368d45526500dda7cc31a25fd77c30d7ec4b3208/lib/JSLitmus.js#L191-L249
20,855
gentooboontoo/js-quantities
lib/JSLitmus.js
function(/**Boolean*/ normalize) { var p = this.period; // Adjust period based on the calibration test time if (normalize && !this.isCalibration) { var cal = Test.CALIBRATIONS[this.loopArg ? 0 : 1]; // If the period is within 20% of the calibration time, then zero the // it o...
javascript
function(/**Boolean*/ normalize) { var p = this.period; // Adjust period based on the calibration test time if (normalize && !this.isCalibration) { var cal = Test.CALIBRATIONS[this.loopArg ? 0 : 1]; // If the period is within 20% of the calibration time, then zero the // it o...
[ "function", "(", "/**Boolean*/", "normalize", ")", "{", "var", "p", "=", "this", ".", "period", ";", "// Adjust period based on the calibration test time", "if", "(", "normalize", "&&", "!", "this", ".", "isCalibration", ")", "{", "var", "cal", "=", "Test", "....
Get the number of operations per second for this test. @param normalize if true, iteration loop overhead taken into account
[ "Get", "the", "number", "of", "operations", "per", "second", "for", "this", "test", "." ]
368d45526500dda7cc31a25fd77c30d7ec4b3208
https://github.com/gentooboontoo/js-quantities/blob/368d45526500dda7cc31a25fd77c30d7ec4b3208/lib/JSLitmus.js#L256-L269
20,856
gentooboontoo/js-quantities
lib/JSLitmus.js
function() { var el = jsl.$('jslitmus_container'); if (!el) document.body.appendChild(el = document.createElement('div')); el.innerHTML = MARKUP; // Render the UI for all our tests for (var i=0; i < JSLitmus._tests.length; i++) JSLitmus.renderTest(JSLitmus._tests[i]); }
javascript
function() { var el = jsl.$('jslitmus_container'); if (!el) document.body.appendChild(el = document.createElement('div')); el.innerHTML = MARKUP; // Render the UI for all our tests for (var i=0; i < JSLitmus._tests.length; i++) JSLitmus.renderTest(JSLitmus._tests[i]); }
[ "function", "(", ")", "{", "var", "el", "=", "jsl", ".", "$", "(", "'jslitmus_container'", ")", ";", "if", "(", "!", "el", ")", "document", ".", "body", ".", "appendChild", "(", "el", "=", "document", ".", "createElement", "(", "'div'", ")", ")", "...
Set up the UI
[ "Set", "up", "the", "UI" ]
368d45526500dda7cc31a25fd77c30d7ec4b3208
https://github.com/gentooboontoo/js-quantities/blob/368d45526500dda7cc31a25fd77c30d7ec4b3208/lib/JSLitmus.js#L441-L450
20,857
gentooboontoo/js-quantities
lib/JSLitmus.js
function(name, f) { // Create the Test object var test = new Test(name, f); JSLitmus._tests.push(test); // Re-render if the test state changes test.onChange = JSLitmus.renderTest; // Run the next test if this one finished test.onStop = function(test) { if (JSLitmus.on...
javascript
function(name, f) { // Create the Test object var test = new Test(name, f); JSLitmus._tests.push(test); // Re-render if the test state changes test.onChange = JSLitmus.renderTest; // Run the next test if this one finished test.onStop = function(test) { if (JSLitmus.on...
[ "function", "(", "name", ",", "f", ")", "{", "// Create the Test object", "var", "test", "=", "new", "Test", "(", "name", ",", "f", ")", ";", "JSLitmus", ".", "_tests", ".", "push", "(", "test", ")", ";", "// Re-render if the test state changes", "test", "...
Create a new test
[ "Create", "a", "new", "test" ]
368d45526500dda7cc31a25fd77c30d7ec4b3208
https://github.com/gentooboontoo/js-quantities/blob/368d45526500dda7cc31a25fd77c30d7ec4b3208/lib/JSLitmus.js#L524-L541
20,858
gentooboontoo/js-quantities
lib/JSLitmus.js
function(e) { e = e || window.event; var reverse = e && e.shiftKey, len = JSLitmus._tests.length; for (var i = 0; i < len; i++) { JSLitmus._queueTest(JSLitmus._tests[!reverse ? i : (len - i - 1)]); } }
javascript
function(e) { e = e || window.event; var reverse = e && e.shiftKey, len = JSLitmus._tests.length; for (var i = 0; i < len; i++) { JSLitmus._queueTest(JSLitmus._tests[!reverse ? i : (len - i - 1)]); } }
[ "function", "(", "e", ")", "{", "e", "=", "e", "||", "window", ".", "event", ";", "var", "reverse", "=", "e", "&&", "e", ".", "shiftKey", ",", "len", "=", "JSLitmus", ".", "_tests", ".", "length", ";", "for", "(", "var", "i", "=", "0", ";", "...
Add all tests to the run queue
[ "Add", "all", "tests", "to", "the", "run", "queue" ]
368d45526500dda7cc31a25fd77c30d7ec4b3208
https://github.com/gentooboontoo/js-quantities/blob/368d45526500dda7cc31a25fd77c30d7ec4b3208/lib/JSLitmus.js#L546-L552
20,859
gentooboontoo/js-quantities
lib/JSLitmus.js
function() { while (JSLitmus._queue.length) { var test = JSLitmus._queue.shift(); JSLitmus.renderTest(test); } }
javascript
function() { while (JSLitmus._queue.length) { var test = JSLitmus._queue.shift(); JSLitmus.renderTest(test); } }
[ "function", "(", ")", "{", "while", "(", "JSLitmus", ".", "_queue", ".", "length", ")", "{", "var", "test", "=", "JSLitmus", ".", "_queue", ".", "shift", "(", ")", ";", "JSLitmus", ".", "renderTest", "(", "test", ")", ";", "}", "}" ]
Remove all tests from the run queue. The current test has to finish on it's own though
[ "Remove", "all", "tests", "from", "the", "run", "queue", ".", "The", "current", "test", "has", "to", "finish", "on", "it", "s", "own", "though" ]
368d45526500dda7cc31a25fd77c30d7ec4b3208
https://github.com/gentooboontoo/js-quantities/blob/368d45526500dda7cc31a25fd77c30d7ec4b3208/lib/JSLitmus.js#L558-L563
20,860
gentooboontoo/js-quantities
lib/JSLitmus.js
function() { if (!JSLitmus.currentTest) { var test = JSLitmus._queue.shift(); if (test) { jsl.$('stop_button').disabled = false; JSLitmus.currentTest = test; test.run(); JSLitmus.renderTest(test); if (JSLitmus.onTestStart) JSLitmus.onTestStart(test...
javascript
function() { if (!JSLitmus.currentTest) { var test = JSLitmus._queue.shift(); if (test) { jsl.$('stop_button').disabled = false; JSLitmus.currentTest = test; test.run(); JSLitmus.renderTest(test); if (JSLitmus.onTestStart) JSLitmus.onTestStart(test...
[ "function", "(", ")", "{", "if", "(", "!", "JSLitmus", ".", "currentTest", ")", "{", "var", "test", "=", "JSLitmus", ".", "_queue", ".", "shift", "(", ")", ";", "if", "(", "test", ")", "{", "jsl", ".", "$", "(", "'stop_button'", ")", ".", "disabl...
Run the next test in the run queue
[ "Run", "the", "next", "test", "in", "the", "run", "queue" ]
368d45526500dda7cc31a25fd77c30d7ec4b3208
https://github.com/gentooboontoo/js-quantities/blob/368d45526500dda7cc31a25fd77c30d7ec4b3208/lib/JSLitmus.js#L568-L582
20,861
gentooboontoo/js-quantities
lib/JSLitmus.js
function(test) { if (jsl.indexOf(JSLitmus._queue, test) >= 0) return; JSLitmus._queue.push(test); JSLitmus.renderTest(test); JSLitmus._nextTest(); }
javascript
function(test) { if (jsl.indexOf(JSLitmus._queue, test) >= 0) return; JSLitmus._queue.push(test); JSLitmus.renderTest(test); JSLitmus._nextTest(); }
[ "function", "(", "test", ")", "{", "if", "(", "jsl", ".", "indexOf", "(", "JSLitmus", ".", "_queue", ",", "test", ")", ">=", "0", ")", "return", ";", "JSLitmus", ".", "_queue", ".", "push", "(", "test", ")", ";", "JSLitmus", ".", "renderTest", "(",...
Add a test to the run queue
[ "Add", "a", "test", "to", "the", "run", "queue" ]
368d45526500dda7cc31a25fd77c30d7ec4b3208
https://github.com/gentooboontoo/js-quantities/blob/368d45526500dda7cc31a25fd77c30d7ec4b3208/lib/JSLitmus.js#L587-L592
20,862
gentooboontoo/js-quantities
lib/JSLitmus.js
function() { var n = JSLitmus._tests.length, markers = [], data = []; var d, min = 0, max = -1e10; var normalize = jsl.$('test_normalize').checked; // Gather test data for (var i=0; i < JSLitmus._tests.length; i++) { var test = JSLitmus._tests[i]; if (test.count) { ...
javascript
function() { var n = JSLitmus._tests.length, markers = [], data = []; var d, min = 0, max = -1e10; var normalize = jsl.$('test_normalize').checked; // Gather test data for (var i=0; i < JSLitmus._tests.length; i++) { var test = JSLitmus._tests[i]; if (test.count) { ...
[ "function", "(", ")", "{", "var", "n", "=", "JSLitmus", ".", "_tests", ".", "length", ",", "markers", "=", "[", "]", ",", "data", "=", "[", "]", ";", "var", "d", ",", "min", "=", "0", ",", "max", "=", "-", "1e10", ";", "var", "normalize", "="...
Generate a Google Chart URL that shows the data for all tests
[ "Generate", "a", "Google", "Chart", "URL", "that", "shows", "the", "data", "for", "all", "tests" ]
368d45526500dda7cc31a25fd77c30d7ec4b3208
https://github.com/gentooboontoo/js-quantities/blob/368d45526500dda7cc31a25fd77c30d7ec4b3208/lib/JSLitmus.js#L597-L645
20,863
castillo-io/angular-css
angular-css.js
mapBreakpointToMedia
function mapBreakpointToMedia(stylesheet) { if (angular.isDefined(options.breakpoints)) { if (stylesheet.breakpoint in options.breakpoints) { stylesheet.media = options.breakpoints[stylesheet.breakpoint]; } delete stylesheet.breakpoints; } }
javascript
function mapBreakpointToMedia(stylesheet) { if (angular.isDefined(options.breakpoints)) { if (stylesheet.breakpoint in options.breakpoints) { stylesheet.media = options.breakpoints[stylesheet.breakpoint]; } delete stylesheet.breakpoints; } }
[ "function", "mapBreakpointToMedia", "(", "stylesheet", ")", "{", "if", "(", "angular", ".", "isDefined", "(", "options", ".", "breakpoints", ")", ")", "{", "if", "(", "stylesheet", ".", "breakpoint", "in", "options", ".", "breakpoints", ")", "{", "stylesheet...
Map breakpoitns defined in defaults to stylesheet media attribute
[ "Map", "breakpoitns", "defined", "in", "defaults", "to", "stylesheet", "media", "attribute" ]
94a58bd8daf0c2b5e3b398002e60d78219ec0c6b
https://github.com/castillo-io/angular-css/blob/94a58bd8daf0c2b5e3b398002e60d78219ec0c6b/angular-css.js#L116-L123
20,864
castillo-io/angular-css
angular-css.js
addViaMediaQuery
function addViaMediaQuery(stylesheet) { if (!stylesheet) { if(DEBUG) $log.error('No stylesheet provided'); return; } // Media query object mediaQuery[stylesheet.href] = $window.matchMedia(stylesheet.media); // Media Query Listener function mediaQue...
javascript
function addViaMediaQuery(stylesheet) { if (!stylesheet) { if(DEBUG) $log.error('No stylesheet provided'); return; } // Media query object mediaQuery[stylesheet.href] = $window.matchMedia(stylesheet.media); // Media Query Listener function mediaQue...
[ "function", "addViaMediaQuery", "(", "stylesheet", ")", "{", "if", "(", "!", "stylesheet", ")", "{", "if", "(", "DEBUG", ")", "$log", ".", "error", "(", "'No stylesheet provided'", ")", ";", "return", ";", "}", "// Media query object", "mediaQuery", "[", "st...
Add Media Query
[ "Add", "Media", "Query" ]
94a58bd8daf0c2b5e3b398002e60d78219ec0c6b
https://github.com/castillo-io/angular-css/blob/94a58bd8daf0c2b5e3b398002e60d78219ec0c6b/angular-css.js#L211-L240
20,865
castillo-io/angular-css
angular-css.js
removeViaMediaQuery
function removeViaMediaQuery(stylesheet) { if (!stylesheet) { if(DEBUG) $log.error('No stylesheet provided'); return; } // Remove media query listener if ($rootScope && angular.isDefined(mediaQuery) && mediaQuery[stylesheet.href] && angular.isD...
javascript
function removeViaMediaQuery(stylesheet) { if (!stylesheet) { if(DEBUG) $log.error('No stylesheet provided'); return; } // Remove media query listener if ($rootScope && angular.isDefined(mediaQuery) && mediaQuery[stylesheet.href] && angular.isD...
[ "function", "removeViaMediaQuery", "(", "stylesheet", ")", "{", "if", "(", "!", "stylesheet", ")", "{", "if", "(", "DEBUG", ")", "$log", ".", "error", "(", "'No stylesheet provided'", ")", ";", "return", ";", "}", "// Remove media query listener", "if", "(", ...
Remove Media Query
[ "Remove", "Media", "Query" ]
94a58bd8daf0c2b5e3b398002e60d78219ec0c6b
https://github.com/castillo-io/angular-css/blob/94a58bd8daf0c2b5e3b398002e60d78219ec0c6b/angular-css.js#L245-L256
20,866
webpack-contrib/webpack-command
lib/compiler.js
requireReporter
function requireReporter(name) { const prefix = capitalize(camelcase(name)); const locations = [`./reporters/${prefix}Reporter`, name, path.resolve(name)]; let result = null; for (const location of locations) { try { // eslint-disable-next-line import/no-dynamic-require, global-require result =...
javascript
function requireReporter(name) { const prefix = capitalize(camelcase(name)); const locations = [`./reporters/${prefix}Reporter`, name, path.resolve(name)]; let result = null; for (const location of locations) { try { // eslint-disable-next-line import/no-dynamic-require, global-require result =...
[ "function", "requireReporter", "(", "name", ")", "{", "const", "prefix", "=", "capitalize", "(", "camelcase", "(", "name", ")", ")", ";", "const", "locations", "=", "[", "`", "${", "prefix", "}", "`", ",", "name", ",", "path", ".", "resolve", "(", "n...
Attempts to require a specified reporter. Tries the local built-ins first, and if that fails, attempts to load an npm module that exports a reporter handler function, and if that fails, attempts to load the reporter relative to the current working directory.
[ "Attempts", "to", "require", "a", "specified", "reporter", ".", "Tries", "the", "local", "built", "-", "ins", "first", "and", "if", "that", "fails", "attempts", "to", "load", "an", "npm", "module", "that", "exports", "a", "reporter", "handler", "function", ...
be83d805be69b7e2495f13e2b09a0c5092569190
https://github.com/webpack-contrib/webpack-command/blob/be83d805be69b7e2495f13e2b09a0c5092569190/lib/compiler.js#L48-L67
20,867
webpack-contrib/webpack-command
lib/compiler.js
sanitize
function sanitize(config) { const configs = [].concat(config).map((conf) => { const result = merge({}, conf); delete result.progress; delete result.reporter; delete result.watchStdin; // TODO: remove the need for this for (const property of ['entry', 'output']) { const target = result[p...
javascript
function sanitize(config) { const configs = [].concat(config).map((conf) => { const result = merge({}, conf); delete result.progress; delete result.reporter; delete result.watchStdin; // TODO: remove the need for this for (const property of ['entry', 'output']) { const target = result[p...
[ "function", "sanitize", "(", "config", ")", "{", "const", "configs", "=", "[", "]", ".", "concat", "(", "config", ")", ".", "map", "(", "(", "conf", ")", "=>", "{", "const", "result", "=", "merge", "(", "{", "}", ",", "conf", ")", ";", "delete", ...
Removes invalid webpack config properties leftover from applying flags
[ "Removes", "invalid", "webpack", "config", "properties", "leftover", "from", "applying", "flags" ]
be83d805be69b7e2495f13e2b09a0c5092569190
https://github.com/webpack-contrib/webpack-command/blob/be83d805be69b7e2495f13e2b09a0c5092569190/lib/compiler.js#L72-L92
20,868
stealjs/steal-tools
lib/loader/find_bundle.js
minusJS
function minusJS(name) { var idx = name.indexOf(".js"); return idx === -1 ? name : name.substr(0, idx); }
javascript
function minusJS(name) { var idx = name.indexOf(".js"); return idx === -1 ? name : name.substr(0, idx); }
[ "function", "minusJS", "(", "name", ")", "{", "var", "idx", "=", "name", ".", "indexOf", "(", "\".js\"", ")", ";", "return", "idx", "===", "-", "1", "?", "name", ":", "name", ".", "substr", "(", "0", ",", "idx", ")", ";", "}" ]
Remove the .js extension to make these proper module names.
[ "Remove", "the", ".", "js", "extension", "to", "make", "these", "proper", "module", "names", "." ]
48cfb4ff67f421765be53a71b90a70ba857ca583
https://github.com/stealjs/steal-tools/blob/48cfb4ff67f421765be53a71b90a70ba857ca583/lib/loader/find_bundle.js#L69-L72
20,869
stealjs/steal-tools
lib/loader/normalize_bundle.js
getLoader
function getLoader(data) { if(typeof Loader !== "undefined" && (data instanceof global.Loader)) { return data; } else if(typeof LoaderPolyfill !== "undefined" && (data instanceof global.LoaderPolyfill)) { return data; } else { return data.steal.System; } }
javascript
function getLoader(data) { if(typeof Loader !== "undefined" && (data instanceof global.Loader)) { return data; } else if(typeof LoaderPolyfill !== "undefined" && (data instanceof global.LoaderPolyfill)) { return data; } else { return data.steal.System; } }
[ "function", "getLoader", "(", "data", ")", "{", "if", "(", "typeof", "Loader", "!==", "\"undefined\"", "&&", "(", "data", "instanceof", "global", ".", "Loader", ")", ")", "{", "return", "data", ";", "}", "else", "if", "(", "typeof", "LoaderPolyfill", "!=...
We could directly receive a loader or this might be a dependencyGraph object containing the loader.
[ "We", "could", "directly", "receive", "a", "loader", "or", "this", "might", "be", "a", "dependencyGraph", "object", "containing", "the", "loader", "." ]
48cfb4ff67f421765be53a71b90a70ba857ca583
https://github.com/stealjs/steal-tools/blob/48cfb4ff67f421765be53a71b90a70ba857ca583/lib/loader/normalize_bundle.js#L19-L27
20,870
stealjs/steal-tools
lib/stream/adjust_bundles_path.js
adjustBundlesPath
function adjustBundlesPath(data, options) { var path = require("path"); var configuration = clone(data.configuration); var bundlesPath = configuration.bundlesPath; Object.defineProperty(configuration, "bundlesPath", { configurable: true, get: function() { return path.join(bundlesPath, options.target); } ...
javascript
function adjustBundlesPath(data, options) { var path = require("path"); var configuration = clone(data.configuration); var bundlesPath = configuration.bundlesPath; Object.defineProperty(configuration, "bundlesPath", { configurable: true, get: function() { return path.join(bundlesPath, options.target); } ...
[ "function", "adjustBundlesPath", "(", "data", ",", "options", ")", "{", "var", "path", "=", "require", "(", "\"path\"", ")", ";", "var", "configuration", "=", "clone", "(", "data", ".", "configuration", ")", ";", "var", "bundlesPath", "=", "configuration", ...
Appends the target name to the bundles path Each target build should be written in its own subfolder, e.g: dist/bundles/node dist/bundles/web dist/bundles/worker This should only happen when target is explicitly set.
[ "Appends", "the", "target", "name", "to", "the", "bundles", "path" ]
48cfb4ff67f421765be53a71b90a70ba857ca583
https://github.com/stealjs/steal-tools/blob/48cfb4ff67f421765be53a71b90a70ba857ca583/lib/stream/adjust_bundles_path.js#L27-L42
20,871
stealjs/steal-tools
lib/graph/make_graph_with_bundles.js
mergeIntoMasterAndAddBundle
function mergeIntoMasterAndAddBundle(opts) { var mains = opts.mains; var loader = opts.loader; var newGraph = opts.newGraph; var bundleName = opts.bundleName; var masterGraph = opts.masterGraph; for(var name in newGraph) { var oldNode = masterGraph[name]; var newNode = newGraph[name]; if(!oldNode || hasNe...
javascript
function mergeIntoMasterAndAddBundle(opts) { var mains = opts.mains; var loader = opts.loader; var newGraph = opts.newGraph; var bundleName = opts.bundleName; var masterGraph = opts.masterGraph; for(var name in newGraph) { var oldNode = masterGraph[name]; var newNode = newGraph[name]; if(!oldNode || hasNe...
[ "function", "mergeIntoMasterAndAddBundle", "(", "opts", ")", "{", "var", "mains", "=", "opts", ".", "mains", ";", "var", "loader", "=", "opts", ".", "loader", ";", "var", "newGraph", "=", "opts", ".", "newGraph", ";", "var", "bundleName", "=", "opts", "....
merges everything in `newGraph` into `masterGraph` and make sure it lists `bundle` as one of its bundles.
[ "merges", "everything", "in", "newGraph", "into", "masterGraph", "and", "make", "sure", "it", "lists", "bundle", "as", "one", "of", "its", "bundles", "." ]
48cfb4ff67f421765be53a71b90a70ba857ca583
https://github.com/stealjs/steal-tools/blob/48cfb4ff67f421765be53a71b90a70ba857ca583/lib/graph/make_graph_with_bundles.js#L36-L72
20,872
stealjs/steal-tools
lib/graph/make_graph_with_bundles.js
createModuleConfig
function createModuleConfig(loader) { var tmp = require("tmp"); var config = {}; var virtualModules = loader.virtualModules || {}; for(var moduleName in virtualModules) { var filename = tmp.fileSync().name; var source = virtualModules[moduleName]; fs.writeFileSync(filename, source, "utf8"); var paths = con...
javascript
function createModuleConfig(loader) { var tmp = require("tmp"); var config = {}; var virtualModules = loader.virtualModules || {}; for(var moduleName in virtualModules) { var filename = tmp.fileSync().name; var source = virtualModules[moduleName]; fs.writeFileSync(filename, source, "utf8"); var paths = con...
[ "function", "createModuleConfig", "(", "loader", ")", "{", "var", "tmp", "=", "require", "(", "\"tmp\"", ")", ";", "var", "config", "=", "{", "}", ";", "var", "virtualModules", "=", "loader", ".", "virtualModules", "||", "{", "}", ";", "for", "(", "var...
Create temporary files for virtual modules.
[ "Create", "temporary", "files", "for", "virtual", "modules", "." ]
48cfb4ff67f421765be53a71b90a70ba857ca583
https://github.com/stealjs/steal-tools/blob/48cfb4ff67f421765be53a71b90a70ba857ca583/lib/graph/make_graph_with_bundles.js#L75-L88
20,873
stealjs/steal-tools
lib/graph/make_graph_with_bundles.js
copyIfSet
function copyIfSet(src, dest, prop) { if (src[prop]) { dest[prop] = src[prop]; } }
javascript
function copyIfSet(src, dest, prop) { if (src[prop]) { dest[prop] = src[prop]; } }
[ "function", "copyIfSet", "(", "src", ",", "dest", ",", "prop", ")", "{", "if", "(", "src", "[", "prop", "]", ")", "{", "dest", "[", "prop", "]", "=", "src", "[", "prop", "]", ";", "}", "}" ]
If `prop` exists in the `src` object, it copies its value to `dest`
[ "If", "prop", "exists", "in", "the", "src", "object", "it", "copies", "its", "value", "to", "dest" ]
48cfb4ff67f421765be53a71b90a70ba857ca583
https://github.com/stealjs/steal-tools/blob/48cfb4ff67f421765be53a71b90a70ba857ca583/lib/graph/make_graph_with_bundles.js#L91-L95
20,874
stealjs/steal-tools
lib/stream/add_plugin_names.js
addPluginName
function addPluginName(data) { var loader = data.loader; var bundles = data.bundles; var promises = bundles.map(function(bundle) { if (!isJavaScriptBundle(bundle)) { return loader.normalize(bundle.name).then(function(name) { bundle.pluginName = name.substring(name.indexOf("!") + 1); }); } }); retur...
javascript
function addPluginName(data) { var loader = data.loader; var bundles = data.bundles; var promises = bundles.map(function(bundle) { if (!isJavaScriptBundle(bundle)) { return loader.normalize(bundle.name).then(function(name) { bundle.pluginName = name.substring(name.indexOf("!") + 1); }); } }); retur...
[ "function", "addPluginName", "(", "data", ")", "{", "var", "loader", "=", "data", ".", "loader", ";", "var", "bundles", "=", "data", ".", "bundles", ";", "var", "promises", "=", "bundles", ".", "map", "(", "function", "(", "bundle", ")", "{", "if", "...
Adds `pluginName` property to non JS bundles
[ "Adds", "pluginName", "property", "to", "non", "JS", "bundles" ]
48cfb4ff67f421765be53a71b90a70ba857ca583
https://github.com/stealjs/steal-tools/blob/48cfb4ff67f421765be53a71b90a70ba857ca583/lib/stream/add_plugin_names.js#L17-L32
20,875
stealjs/steal-tools
lib/stream/write_bundle_manifest.js
getWeightOf
function getWeightOf(bundle) { var isCss = bundle.buildType === "css"; var isMainBundle = bundle.bundles.length === 1; if (isCss) { return 1; } else if (isMainBundle) { return 2; } else { return 3; } }
javascript
function getWeightOf(bundle) { var isCss = bundle.buildType === "css"; var isMainBundle = bundle.bundles.length === 1; if (isCss) { return 1; } else if (isMainBundle) { return 2; } else { return 3; } }
[ "function", "getWeightOf", "(", "bundle", ")", "{", "var", "isCss", "=", "bundle", ".", "buildType", "===", "\"css\"", ";", "var", "isMainBundle", "=", "bundle", ".", "bundles", ".", "length", "===", "1", ";", "if", "(", "isCss", ")", "{", "return", "1...
A very simplified version of HTTP2 stream priorities Bundles with the lowest weight should be loaded first @param {Object} bundle - A bundle object @return {Number} 1 for css bundles, 2 for main JS bundles, 3 for shared bundles
[ "A", "very", "simplified", "version", "of", "HTTP2", "stream", "priorities", "Bundles", "with", "the", "lowest", "weight", "should", "be", "loaded", "first" ]
48cfb4ff67f421765be53a71b90a70ba857ca583
https://github.com/stealjs/steal-tools/blob/48cfb4ff67f421765be53a71b90a70ba857ca583/lib/stream/write_bundle_manifest.js#L72-L83
20,876
stealjs/steal-tools
lib/stream/write_bundle_manifest.js
getSharedBundlesOf
function getSharedBundlesOf(name, baseUrl, bundles, mains) { var shared = {}; var normalize = require("normalize-path"); // this will ensure that we only add the main bundle if there is a single // main; not a multi-main project. var singleMain = mains.length === 1 && mains[0]; bundles.forEach(function(bundle) {...
javascript
function getSharedBundlesOf(name, baseUrl, bundles, mains) { var shared = {}; var normalize = require("normalize-path"); // this will ensure that we only add the main bundle if there is a single // main; not a multi-main project. var singleMain = mains.length === 1 && mains[0]; bundles.forEach(function(bundle) {...
[ "function", "getSharedBundlesOf", "(", "name", ",", "baseUrl", ",", "bundles", ",", "mains", ")", "{", "var", "shared", "=", "{", "}", ";", "var", "normalize", "=", "require", "(", "\"normalize-path\"", ")", ";", "// this will ensure that we only add the main bund...
Returns an object of shared bundles data @param {string} name - A bundle name @param {string} baseUrl - The loader's baseURL @param {Array} bundles - The bundles array created by the build process @param {Array} mains - The main entry point modules @return {Object} Each key is a shared bundle relative path and the valu...
[ "Returns", "an", "object", "of", "shared", "bundles", "data" ]
48cfb4ff67f421765be53a71b90a70ba857ca583
https://github.com/stealjs/steal-tools/blob/48cfb4ff67f421765be53a71b90a70ba857ca583/lib/stream/write_bundle_manifest.js#L94-L119
20,877
stealjs/steal-tools
lib/bundle/make_bundles_config.js
getBundlesPaths
function getBundlesPaths(configuration){ // If a bundlesPath is not provided, the paths are not needed because they are // already set up in steal.js if(!configuration.loader.bundlesPath) { return ""; } var bundlesPath = configuration.bundlesPathURL; // Get the dist directory and set the paths output var path...
javascript
function getBundlesPaths(configuration){ // If a bundlesPath is not provided, the paths are not needed because they are // already set up in steal.js if(!configuration.loader.bundlesPath) { return ""; } var bundlesPath = configuration.bundlesPathURL; // Get the dist directory and set the paths output var path...
[ "function", "getBundlesPaths", "(", "configuration", ")", "{", "// If a bundlesPath is not provided, the paths are not needed because they are", "// already set up in steal.js", "if", "(", "!", "configuration", ".", "loader", ".", "bundlesPath", ")", "{", "return", "\"\"", ";...
Get the System.paths needed to map bundles, if a different bundlesPath is provided.
[ "Get", "the", "System", ".", "paths", "needed", "to", "map", "bundles", "if", "a", "different", "bundlesPath", "is", "provided", "." ]
48cfb4ff67f421765be53a71b90a70ba857ca583
https://github.com/stealjs/steal-tools/blob/48cfb4ff67f421765be53a71b90a70ba857ca583/lib/bundle/make_bundles_config.js#L57-L70
20,878
stealjs/steal-tools
lib/graph/recycle.js
regenerate
function regenerate(moduleName, done){ var cfg = clone(config, true); // if the moduleName is not in the graph, make it the main. if(moduleName && !cachedData.graph[moduleName]) { cfg.main = moduleName; } makeBundleGraph(cfg, options).then(function(data){ var graph = data.graph; var oldGraph = cache...
javascript
function regenerate(moduleName, done){ var cfg = clone(config, true); // if the moduleName is not in the graph, make it the main. if(moduleName && !cachedData.graph[moduleName]) { cfg.main = moduleName; } makeBundleGraph(cfg, options).then(function(data){ var graph = data.graph; var oldGraph = cache...
[ "function", "regenerate", "(", "moduleName", ",", "done", ")", "{", "var", "cfg", "=", "clone", "(", "config", ",", "true", ")", ";", "// if the moduleName is not in the graph, make it the main.", "if", "(", "moduleName", "&&", "!", "cachedData", ".", "graph", "...
Regenerate a new bundle graph and copy over the transforms so they can be reused.
[ "Regenerate", "a", "new", "bundle", "graph", "and", "copy", "over", "the", "transforms", "so", "they", "can", "be", "reused", "." ]
48cfb4ff67f421765be53a71b90a70ba857ca583
https://github.com/stealjs/steal-tools/blob/48cfb4ff67f421765be53a71b90a70ba857ca583/lib/graph/recycle.js#L18-L36
20,879
stealjs/steal-tools
lib/graph/recycle.js
diff
function diff(node) { var oldBundle = (cachedData.loader.bundle || []).slice(); return getDependencies(node.load).then(function(result){ var newBundle = (cachedData.loader.bundle || []).slice(); // If the deps are the same we can return the existing graph. if(same(node.deps, result.deps) && same(ol...
javascript
function diff(node) { var oldBundle = (cachedData.loader.bundle || []).slice(); return getDependencies(node.load).then(function(result){ var newBundle = (cachedData.loader.bundle || []).slice(); // If the deps are the same we can return the existing graph. if(same(node.deps, result.deps) && same(ol...
[ "function", "diff", "(", "node", ")", "{", "var", "oldBundle", "=", "(", "cachedData", ".", "loader", ".", "bundle", "||", "[", "]", ")", ".", "slice", "(", ")", ";", "return", "getDependencies", "(", "node", ".", "load", ")", ".", "then", "(", "fu...
Check to see if the node has changed. Do this by looking at the source and running it through System.instantiate to see if new deps were added. Recursively do the same for any System.defined modules.
[ "Check", "to", "see", "if", "the", "node", "has", "changed", ".", "Do", "this", "by", "looking", "at", "the", "source", "and", "running", "it", "through", "System", ".", "instantiate", "to", "see", "if", "new", "deps", "were", "added", ".", "Recursively"...
48cfb4ff67f421765be53a71b90a70ba857ca583
https://github.com/stealjs/steal-tools/blob/48cfb4ff67f421765be53a71b90a70ba857ca583/lib/graph/recycle.js#L97-L129
20,880
stealjs/steal-tools
lib/stream/envify.js
inlineNodeEnvironmentVariables
function inlineNodeEnvironmentVariables(data) { var dependencyGraph = data.graph; var configuration = data.configuration; var options = configuration.options; if (options.envify) { winston.info("Inlining Node-style environment variables..."); envifyGraph(dependencyGraph, options); envifyGraph(data.configGrap...
javascript
function inlineNodeEnvironmentVariables(data) { var dependencyGraph = data.graph; var configuration = data.configuration; var options = configuration.options; if (options.envify) { winston.info("Inlining Node-style environment variables..."); envifyGraph(dependencyGraph, options); envifyGraph(data.configGrap...
[ "function", "inlineNodeEnvironmentVariables", "(", "data", ")", "{", "var", "dependencyGraph", "=", "data", ".", "graph", ";", "var", "configuration", "=", "data", ".", "configuration", ";", "var", "options", "=", "configuration", ".", "options", ";", "if", "(...
Replaces Node-style environment variables with plain strings.
[ "Replaces", "Node", "-", "style", "environment", "variables", "with", "plain", "strings", "." ]
48cfb4ff67f421765be53a71b90a70ba857ca583
https://github.com/stealjs/steal-tools/blob/48cfb4ff67f421765be53a71b90a70ba857ca583/lib/stream/envify.js#L16-L28
20,881
stealjs/steal-tools
lib/process_babel_presets.js
getPresetName
function getPresetName(preset) { if (includesPresetName(preset)) { return _.isString(preset) ? preset : _.head(preset); } else { return null; } }
javascript
function getPresetName(preset) { if (includesPresetName(preset)) { return _.isString(preset) ? preset : _.head(preset); } else { return null; } }
[ "function", "getPresetName", "(", "preset", ")", "{", "if", "(", "includesPresetName", "(", "preset", ")", ")", "{", "return", "_", ".", "isString", "(", "preset", ")", "?", "preset", ":", "_", ".", "head", "(", "preset", ")", ";", "}", "else", "{", ...
Gets the babel preset name @param {BabelPreset} preset A babel preset @return {?string} The preset name
[ "Gets", "the", "babel", "preset", "name" ]
48cfb4ff67f421765be53a71b90a70ba857ca583
https://github.com/stealjs/steal-tools/blob/48cfb4ff67f421765be53a71b90a70ba857ca583/lib/process_babel_presets.js#L92-L99
20,882
stealjs/steal-tools
lib/process_babel_presets.js
includesPresetName
function includesPresetName(preset) { return _.isString(preset) || _.isArray(preset) && _.isString(_.head(preset)); }
javascript
function includesPresetName(preset) { return _.isString(preset) || _.isArray(preset) && _.isString(_.head(preset)); }
[ "function", "includesPresetName", "(", "preset", ")", "{", "return", "_", ".", "isString", "(", "preset", ")", "||", "_", ".", "isArray", "(", "preset", ")", "&&", "_", ".", "isString", "(", "_", ".", "head", "(", "preset", ")", ")", ";", "}" ]
Whether the babel preset name was provided @param {BabelPreset} preset @return {boolean}
[ "Whether", "the", "babel", "preset", "name", "was", "provided" ]
48cfb4ff67f421765be53a71b90a70ba857ca583
https://github.com/stealjs/steal-tools/blob/48cfb4ff67f421765be53a71b90a70ba857ca583/lib/process_babel_presets.js#L106-L109
20,883
stealjs/steal-tools
lib/process_babel_presets.js
isBuiltinPreset
function isBuiltinPreset(name) { var isNpmPresetName = /^(?:babel-preset-)/; var availablePresets = babel.availablePresets || {}; var shorthand = isNpmPresetName.test(name) ? name.replace("babel-preset-", "") : name; return !!availablePresets[shorthand]; }
javascript
function isBuiltinPreset(name) { var isNpmPresetName = /^(?:babel-preset-)/; var availablePresets = babel.availablePresets || {}; var shorthand = isNpmPresetName.test(name) ? name.replace("babel-preset-", "") : name; return !!availablePresets[shorthand]; }
[ "function", "isBuiltinPreset", "(", "name", ")", "{", "var", "isNpmPresetName", "=", "/", "^(?:babel-preset-)", "/", ";", "var", "availablePresets", "=", "babel", ".", "availablePresets", "||", "{", "}", ";", "var", "shorthand", "=", "isNpmPresetName", ".", "t...
Whether the preset is built in babel-standalone @param {string} name A preset path @return {boolean} `true` if preset is builtin, `false` otherwise Babel presets can be set using the following variations: 1) the npm preset name, which by convention starts with `babel-preset-` 2) A shorthand name, which is the npm na...
[ "Whether", "the", "preset", "is", "built", "in", "babel", "-", "standalone" ]
48cfb4ff67f421765be53a71b90a70ba857ca583
https://github.com/stealjs/steal-tools/blob/48cfb4ff67f421765be53a71b90a70ba857ca583/lib/process_babel_presets.js#L139-L148
20,884
stealjs/steal-tools
lib/stream/load_node_builder.js
loadNodeBuilder
function loadNodeBuilder(data) { return new Promise(function(resolve, reject) { var graph = data.graph; var loader = data.loader; var promises = keys(graph).map(function(nodeName) { var node = graph[nodeName]; // pluginBuilder | extensionBuilder is a module identifier that // should be loaded to repla...
javascript
function loadNodeBuilder(data) { return new Promise(function(resolve, reject) { var graph = data.graph; var loader = data.loader; var promises = keys(graph).map(function(nodeName) { var node = graph[nodeName]; // pluginBuilder | extensionBuilder is a module identifier that // should be loaded to repla...
[ "function", "loadNodeBuilder", "(", "data", ")", "{", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "var", "graph", "=", "data", ".", "graph", ";", "var", "loader", "=", "data", ".", "loader", ";", "var", "promis...
Replaces a node source with its builder module @param {Object} data - The stream's data object @return {Promise.<graph>}
[ "Replaces", "a", "node", "source", "with", "its", "builder", "module" ]
48cfb4ff67f421765be53a71b90a70ba857ca583
https://github.com/stealjs/steal-tools/blob/48cfb4ff67f421765be53a71b90a70ba857ca583/lib/stream/load_node_builder.js#L20-L72
20,885
stealjs/steal-tools
lib/build/export.js
normalize
function normalize(loader, mods) { var modNames = (mods && !Array.isArray(mods)) ? [mods] : mods; return (modNames || []).map(function(moduleName) { return !_.isString(moduleName) ? Promise.resolve(moduleName) : loader.normalize(moduleName); }); }
javascript
function normalize(loader, mods) { var modNames = (mods && !Array.isArray(mods)) ? [mods] : mods; return (modNames || []).map(function(moduleName) { return !_.isString(moduleName) ? Promise.resolve(moduleName) : loader.normalize(moduleName); }); }
[ "function", "normalize", "(", "loader", ",", "mods", ")", "{", "var", "modNames", "=", "(", "mods", "&&", "!", "Array", ".", "isArray", "(", "mods", ")", ")", "?", "[", "mods", "]", ":", "mods", ";", "return", "(", "modNames", "||", "[", "]", ")"...
Normalize module names @param {string|Array.<string>} mods A module name (or a list of them) @return {Array.<Promise.<string>>} An array of promises that resolved to normalized module names.
[ "Normalize", "module", "names" ]
48cfb4ff67f421765be53a71b90a70ba857ca583
https://github.com/stealjs/steal-tools/blob/48cfb4ff67f421765be53a71b90a70ba857ca583/lib/build/export.js#L54-L62
20,886
stealjs/steal-tools
lib/graph/slim_graph.js
isExcludedFromBuild
function isExcludedFromBuild(node) { if (node.load.excludeFromBuild) { return true; } if ( node.load.metadata && node.load.metadata.hasOwnProperty("bundle") && node.load.metadata.bundle === false ) { return true; } if ( node.isPlugin && !node.value.includeInBuild && !node.load.metadata.includeIn...
javascript
function isExcludedFromBuild(node) { if (node.load.excludeFromBuild) { return true; } if ( node.load.metadata && node.load.metadata.hasOwnProperty("bundle") && node.load.metadata.bundle === false ) { return true; } if ( node.isPlugin && !node.value.includeInBuild && !node.load.metadata.includeIn...
[ "function", "isExcludedFromBuild", "(", "node", ")", "{", "if", "(", "node", ".", "load", ".", "excludeFromBuild", ")", "{", "return", "true", ";", "}", "if", "(", "node", ".", "load", ".", "metadata", "&&", "node", ".", "load", ".", "metadata", ".", ...
Whether the node is flagged to be removed from the build @param {Object} node - A node from a bundle @return {boolean} `true` if flagged, `false` otherwise
[ "Whether", "the", "node", "is", "flagged", "to", "be", "removed", "from", "the", "build" ]
48cfb4ff67f421765be53a71b90a70ba857ca583
https://github.com/stealjs/steal-tools/blob/48cfb4ff67f421765be53a71b90a70ba857ca583/lib/graph/slim_graph.js#L198-L220
20,887
stealjs/steal-tools
lib/graph/make_graph.js
ignoredMetas
function ignoredMetas(cfgs, metas){ cfgs = cfgs || {}; Object.keys(metas).forEach(function(name){ var cfg = metas[name]; if(cfg && cfg.bundle === false) { cfgs[name] = cfg; } }); return { meta: cfgs }; }
javascript
function ignoredMetas(cfgs, metas){ cfgs = cfgs || {}; Object.keys(metas).forEach(function(name){ var cfg = metas[name]; if(cfg && cfg.bundle === false) { cfgs[name] = cfg; } }); return { meta: cfgs }; }
[ "function", "ignoredMetas", "(", "cfgs", ",", "metas", ")", "{", "cfgs", "=", "cfgs", "||", "{", "}", ";", "Object", ".", "keys", "(", "metas", ")", ".", "forEach", "(", "function", "(", "name", ")", "{", "var", "cfg", "=", "metas", "[", "name", ...
Create a config of the ignored meta modules
[ "Create", "a", "config", "of", "the", "ignored", "meta", "modules" ]
48cfb4ff67f421765be53a71b90a70ba857ca583
https://github.com/stealjs/steal-tools/blob/48cfb4ff67f421765be53a71b90a70ba857ca583/lib/graph/make_graph.js#L176-L185
20,888
stealjs/steal-tools
lib/process_babel_plugins.js
processPlugins
function processPlugins(baseURL, plugins) { var normalized = []; // path.resolve does not work correctly if baseURL starts with "file:" baseURL = baseURL.replace("file:", ""); plugins = plugins || []; plugins.forEach(function(plugin) { var name = getPluginName(plugin); if (isPluginFunction(plugin) || isBuil...
javascript
function processPlugins(baseURL, plugins) { var normalized = []; // path.resolve does not work correctly if baseURL starts with "file:" baseURL = baseURL.replace("file:", ""); plugins = plugins || []; plugins.forEach(function(plugin) { var name = getPluginName(plugin); if (isPluginFunction(plugin) || isBuil...
[ "function", "processPlugins", "(", "baseURL", ",", "plugins", ")", "{", "var", "normalized", "=", "[", "]", ";", "// path.resolve does not work correctly if baseURL starts with \"file:\"", "baseURL", "=", "baseURL", ".", "replace", "(", "\"file:\"", ",", "\"\"", ")", ...
Collect builtin plugin names and non builtin plugin functions @param {string} baseURL The loader baseURL value @param {BabelPlugin[]} plugins An array of babel plugins @return {BabelPlugin[]} An array of babel plugins filtered by the babel environment name and with non-builtins replaced by their respective functions
[ "Collect", "builtin", "plugin", "names", "and", "non", "builtin", "plugin", "functions" ]
48cfb4ff67f421765be53a71b90a70ba857ca583
https://github.com/stealjs/steal-tools/blob/48cfb4ff67f421765be53a71b90a70ba857ca583/lib/process_babel_plugins.js#L54-L84
20,889
stealjs/steal-tools
lib/process_babel_plugins.js
isPluginFunction
function isPluginFunction(plugin) { return _.isFunction(plugin) || _.isFunction(_.head(plugin)); }
javascript
function isPluginFunction(plugin) { return _.isFunction(plugin) || _.isFunction(_.head(plugin)); }
[ "function", "isPluginFunction", "(", "plugin", ")", "{", "return", "_", ".", "isFunction", "(", "plugin", ")", "||", "_", ".", "isFunction", "(", "_", ".", "head", "(", "plugin", ")", ")", ";", "}" ]
Whether the plugin function was provided instead of the plugin name @param {BabelPlugin} plugin @return {boolean} `true` if a plugin function was provided, `false` otherwise
[ "Whether", "the", "plugin", "function", "was", "provided", "instead", "of", "the", "plugin", "name" ]
48cfb4ff67f421765be53a71b90a70ba857ca583
https://github.com/stealjs/steal-tools/blob/48cfb4ff67f421765be53a71b90a70ba857ca583/lib/process_babel_plugins.js#L91-L93
20,890
stealjs/steal-tools
lib/process_babel_plugins.js
getPluginName
function getPluginName(plugin) { if (isPluginFunction(plugin)) return null; return _.isString(plugin) ? plugin : _.head(plugin); }
javascript
function getPluginName(plugin) { if (isPluginFunction(plugin)) return null; return _.isString(plugin) ? plugin : _.head(plugin); }
[ "function", "getPluginName", "(", "plugin", ")", "{", "if", "(", "isPluginFunction", "(", "plugin", ")", ")", "return", "null", ";", "return", "_", ".", "isString", "(", "plugin", ")", "?", "plugin", ":", "_", ".", "head", "(", "plugin", ")", ";", "}...
Gets the plugin name @param {BabelPlugin} plugin An item inside of `babelOptions.plugins` @return {?string} The plugin name
[ "Gets", "the", "plugin", "name" ]
48cfb4ff67f421765be53a71b90a70ba857ca583
https://github.com/stealjs/steal-tools/blob/48cfb4ff67f421765be53a71b90a70ba857ca583/lib/process_babel_plugins.js#L114-L118
20,891
stealjs/steal-tools
lib/process_babel_plugins.js
isBuiltinPlugin
function isBuiltinPlugin(name) { var isNpmPluginName = /^(?:babel-plugin-)/; var availablePlugins = babel.availablePlugins; // if the full npm plugin name was set in `babelOptions.plugins`, use the // shorthand to check whether the plugin is included in babel-standalone; // shorthand plugin names are used interna...
javascript
function isBuiltinPlugin(name) { var isNpmPluginName = /^(?:babel-plugin-)/; var availablePlugins = babel.availablePlugins; // if the full npm plugin name was set in `babelOptions.plugins`, use the // shorthand to check whether the plugin is included in babel-standalone; // shorthand plugin names are used interna...
[ "function", "isBuiltinPlugin", "(", "name", ")", "{", "var", "isNpmPluginName", "=", "/", "^(?:babel-plugin-)", "/", ";", "var", "availablePlugins", "=", "babel", ".", "availablePlugins", ";", "// if the full npm plugin name was set in `babelOptions.plugins`, use the", "// ...
Whether the plugin is built in babel-standalone @param {string} name A plugin path or shorthand name. @return {boolean} `true` if plugin is bundled, `false` otherwise Babel plugins can be set using the following variations: 1) the npm plugin name, which by convention starts with `babel-plugin-` (e.g babel-plugin-tra...
[ "Whether", "the", "plugin", "is", "built", "in", "babel", "-", "standalone" ]
48cfb4ff67f421765be53a71b90a70ba857ca583
https://github.com/stealjs/steal-tools/blob/48cfb4ff67f421765be53a71b90a70ba857ca583/lib/process_babel_plugins.js#L136-L148
20,892
stealjs/steal-tools
lib/build/continuous.js
rebuild
function rebuild(moduleNames){ moduleName = moduleNames[0] || ""; moduleNames.forEach(function(moduleName){ graphStream.write(moduleName); }); }
javascript
function rebuild(moduleNames){ moduleName = moduleNames[0] || ""; moduleNames.forEach(function(moduleName){ graphStream.write(moduleName); }); }
[ "function", "rebuild", "(", "moduleNames", ")", "{", "moduleName", "=", "moduleNames", "[", "0", "]", "||", "\"\"", ";", "moduleNames", ".", "forEach", "(", "function", "(", "moduleName", ")", "{", "graphStream", ".", "write", "(", "moduleName", ")", ";", ...
A function that is called whenever a module is found by the watch stream. Called with the name of the module and used to rebuild.
[ "A", "function", "that", "is", "called", "whenever", "a", "module", "is", "found", "by", "the", "watch", "stream", ".", "Called", "with", "the", "name", "of", "the", "module", "and", "used", "to", "rebuild", "." ]
48cfb4ff67f421765be53a71b90a70ba857ca583
https://github.com/stealjs/steal-tools/blob/48cfb4ff67f421765be53a71b90a70ba857ca583/lib/build/continuous.js#L23-L28
20,893
stealjs/steal-tools
lib/graph/transpile.js
flagCircularDependencies
function flagCircularDependencies(graph) { var includes = require("lodash/includes"); var nodes = Array.isArray(graph) ? graph : require("lodash/values")(graph); for (var i = 0; i < nodes.length; i += 1) { var curr = nodes[i]; for (var j = i + 1; j < nodes.length; j += 1) { var next = nodes[j]; if ( ...
javascript
function flagCircularDependencies(graph) { var includes = require("lodash/includes"); var nodes = Array.isArray(graph) ? graph : require("lodash/values")(graph); for (var i = 0; i < nodes.length; i += 1) { var curr = nodes[i]; for (var j = i + 1; j < nodes.length; j += 1) { var next = nodes[j]; if ( ...
[ "function", "flagCircularDependencies", "(", "graph", ")", "{", "var", "includes", "=", "require", "(", "\"lodash/includes\"", ")", ";", "var", "nodes", "=", "Array", ".", "isArray", "(", "graph", ")", "?", "graph", ":", "require", "(", "\"lodash/values\"", ...
Adds a circular flag to the load object of cyclic dependencies MUTATES THE GRAPH @param {Object} graph - The graph to check
[ "Adds", "a", "circular", "flag", "to", "the", "load", "object", "of", "cyclic", "dependencies" ]
48cfb4ff67f421765be53a71b90a70ba857ca583
https://github.com/stealjs/steal-tools/blob/48cfb4ff67f421765be53a71b90a70ba857ca583/lib/graph/transpile.js#L172-L193
20,894
stealjs/steal-tools
lib/node/make_slim_config_node.js
getRelativeBundlePath
function getRelativeBundlePath(target, bundle) { var baseUrl = options.baseUrl.replace("file:", ""); return target !== "web" ? getBundleFileName(bundle) : path.join( path.relative(baseUrl, options.bundlesPath), getBundleFileName(bundle) ); }
javascript
function getRelativeBundlePath(target, bundle) { var baseUrl = options.baseUrl.replace("file:", ""); return target !== "web" ? getBundleFileName(bundle) : path.join( path.relative(baseUrl, options.bundlesPath), getBundleFileName(bundle) ); }
[ "function", "getRelativeBundlePath", "(", "target", ",", "bundle", ")", "{", "var", "baseUrl", "=", "options", ".", "baseUrl", ".", "replace", "(", "\"file:\"", ",", "\"\"", ")", ";", "return", "target", "!==", "\"web\"", "?", "getBundleFileName", "(", "bund...
Returns the bundle's path For nodejs, the name of the bundle is returned since `require` will locate the bundle relative to the main module folder. For the web, a relative path to the loader baseUrl is returned, so the loader can use script tags to load the bundles during runtime. @param {string} target - The name o...
[ "Returns", "the", "bundle", "s", "path", "For", "nodejs", "the", "name", "of", "the", "bundle", "is", "returned", "since", "require", "will", "locate", "the", "bundle", "relative", "to", "the", "main", "module", "folder", ".", "For", "the", "web", "a", "...
48cfb4ff67f421765be53a71b90a70ba857ca583
https://github.com/stealjs/steal-tools/blob/48cfb4ff67f421765be53a71b90a70ba857ca583/lib/node/make_slim_config_node.js#L52-L61
20,895
stealjs/steal-tools
lib/build/slim.js
function(results) { var value; if (targets.length) { value = {}; results.forEach(function(result, index) { value[targets[index]] = result; }); } else { value = results[0]; } slimDfd.resolve(value); }
javascript
function(results) { var value; if (targets.length) { value = {}; results.forEach(function(result, index) { value[targets[index]] = result; }); } else { value = results[0]; } slimDfd.resolve(value); }
[ "function", "(", "results", ")", "{", "var", "value", ";", "if", "(", "targets", ".", "length", ")", "{", "value", "=", "{", "}", ";", "results", ".", "forEach", "(", "function", "(", "result", ",", "index", ")", "{", "value", "[", "targets", "[", ...
If no `target` is provided resolves `buildResult`; otherwise resolves an object where the key is the target name and its value the `buildResult` object.
[ "If", "no", "target", "is", "provided", "resolves", "buildResult", ";", "otherwise", "resolves", "an", "object", "where", "the", "key", "is", "the", "target", "name", "and", "its", "value", "the", "buildResult", "object", "." ]
48cfb4ff67f421765be53a71b90a70ba857ca583
https://github.com/stealjs/steal-tools/blob/48cfb4ff67f421765be53a71b90a70ba857ca583/lib/build/slim.js#L126-L139
20,896
stealjs/steal-tools
lib/bundle/name.js
getUniqueName
function getUniqueName(dirName, shortened, buildTypeSuffix) { if (!usedBundleNames[dirName + shortened + buildTypeSuffix]) { return dirName + shortened + buildTypeSuffix + ""; }else { return dirName + shortened + "-" + (bundleCounter++) + buildTypeSuffix + ""; } }
javascript
function getUniqueName(dirName, shortened, buildTypeSuffix) { if (!usedBundleNames[dirName + shortened + buildTypeSuffix]) { return dirName + shortened + buildTypeSuffix + ""; }else { return dirName + shortened + "-" + (bundleCounter++) + buildTypeSuffix + ""; } }
[ "function", "getUniqueName", "(", "dirName", ",", "shortened", ",", "buildTypeSuffix", ")", "{", "if", "(", "!", "usedBundleNames", "[", "dirName", "+", "shortened", "+", "buildTypeSuffix", "]", ")", "{", "return", "dirName", "+", "shortened", "+", "buildTypeS...
get a unique name, based on bundleCounter @param dirName @param shortened @param buildTypeSuffix @returns {string}
[ "get", "a", "unique", "name", "based", "on", "bundleCounter" ]
48cfb4ff67f421765be53a71b90a70ba857ca583
https://github.com/stealjs/steal-tools/blob/48cfb4ff67f421765be53a71b90a70ba857ca583/lib/bundle/name.js#L101-L107
20,897
panuhorsmalahti/gulp-tslint
index.js
log
function log(message, level) { var prefix = "[" + colors.cyan("gulp-tslint") + "]"; if (level === "error") { fancyLog(prefix, colors.red("error"), message); } else { fancyLog(prefix, message); } }
javascript
function log(message, level) { var prefix = "[" + colors.cyan("gulp-tslint") + "]"; if (level === "error") { fancyLog(prefix, colors.red("error"), message); } else { fancyLog(prefix, message); } }
[ "function", "log", "(", "message", ",", "level", ")", "{", "var", "prefix", "=", "\"[\"", "+", "colors", ".", "cyan", "(", "\"gulp-tslint\"", ")", "+", "\"]\"", ";", "if", "(", "level", "===", "\"error\"", ")", "{", "fancyLog", "(", "prefix", ",", "c...
Log an event or error using gutil.log. @param {string} message the log message. @param {string} level can be "error". Optional. Leave empty for the default logging type.
[ "Log", "an", "event", "or", "error", "using", "gutil", ".", "log", "." ]
bdea3ff458044129f40df91874efc07866e68b65
https://github.com/panuhorsmalahti/gulp-tslint/blob/bdea3ff458044129f40df91874efc07866e68b65/index.js#L45-L53
20,898
panuhorsmalahti/gulp-tslint
index.js
function (pluginOptions) { // If user options are undefined, set an empty options object if (!pluginOptions) { pluginOptions = {}; } // Save off pluginOptions so we can get it in `report()` tslintPlugin.pluginOptions = pluginOptions; // TSLint default options var options = { ...
javascript
function (pluginOptions) { // If user options are undefined, set an empty options object if (!pluginOptions) { pluginOptions = {}; } // Save off pluginOptions so we can get it in `report()` tslintPlugin.pluginOptions = pluginOptions; // TSLint default options var options = { ...
[ "function", "(", "pluginOptions", ")", "{", "// If user options are undefined, set an empty options object", "if", "(", "!", "pluginOptions", ")", "{", "pluginOptions", "=", "{", "}", ";", "}", "// Save off pluginOptions so we can get it in `report()`", "tslintPlugin", ".", ...
Main plugin function @param {PluginOptions} [pluginOptions] contains the options for gulp-tslint. Optional. @returns {any}
[ "Main", "plugin", "function" ]
bdea3ff458044129f40df91874efc07866e68b65
https://github.com/panuhorsmalahti/gulp-tslint/blob/bdea3ff458044129f40df91874efc07866e68b65/index.js#L73-L112
20,899
panuhorsmalahti/gulp-tslint
index.js
function (file) { if (file.tslint) { // Version 5.0.0 of tslint no longer has a failureCount member // It was renamed to errorCount. See tslint issue #2439 var failureCount = file.tslint.errorCount; if (!options.allowWarnings) { failureCount += fil...
javascript
function (file) { if (file.tslint) { // Version 5.0.0 of tslint no longer has a failureCount member // It was renamed to errorCount. See tslint issue #2439 var failureCount = file.tslint.errorCount; if (!options.allowWarnings) { failureCount += fil...
[ "function", "(", "file", ")", "{", "if", "(", "file", ".", "tslint", ")", "{", "// Version 5.0.0 of tslint no longer has a failureCount member", "// It was renamed to errorCount. See tslint issue #2439", "var", "failureCount", "=", "file", ".", "tslint", ".", "errorCount", ...
Log formatted output for each file individually
[ "Log", "formatted", "output", "for", "each", "file", "individually" ]
bdea3ff458044129f40df91874efc07866e68b65
https://github.com/panuhorsmalahti/gulp-tslint/blob/bdea3ff458044129f40df91874efc07866e68b65/index.js#L138-L175