repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
partition
stringclasses
1 value
pkgcloud/pkgcloud-bootstrapper
lib/pkgcloud-bootstrapper.js
bootstrap
function bootstrap(next) { if (!options.commands || !options.commands.length) { return next(); } var hasErr; self.ssh({ keys: options.keys, server: options.server, commands: options.commands, remoteUser: options.remoteUser, tunnel: options.tunnel...
javascript
function bootstrap(next) { if (!options.commands || !options.commands.length) { return next(); } var hasErr; self.ssh({ keys: options.keys, server: options.server, commands: options.commands, remoteUser: options.remoteUser, tunnel: options.tunnel...
[ "function", "bootstrap", "(", "next", ")", "{", "if", "(", "!", "options", ".", "commands", "||", "!", "options", ".", "commands", ".", "length", ")", "{", "return", "next", "(", ")", ";", "}", "var", "hasErr", ";", "self", ".", "ssh", "(", "{", ...
3. Bootstrap the server with the appropriate commands.
[ "3", ".", "Bootstrap", "the", "server", "with", "the", "appropriate", "commands", "." ]
773d75b8ac3744408a9626c9c6161aafea0a33b4
https://github.com/pkgcloud/pkgcloud-bootstrapper/blob/773d75b8ac3744408a9626c9c6161aafea0a33b4/lib/pkgcloud-bootstrapper.js#L303-L326
train
jldec/pub-generator
output.js
fixOutputPaths
function fixOutputPaths(output, files) { // map directories to use for index files var dirMap = {}; u.each(files, function(file) { dirMap[ppath.dirname(file.path)] = true; // edge case - treat /foo/ as directory too if (/\/$/.test(file.path) && ppath.dirname(file.path) !== file.path) { ...
javascript
function fixOutputPaths(output, files) { // map directories to use for index files var dirMap = {}; u.each(files, function(file) { dirMap[ppath.dirname(file.path)] = true; // edge case - treat /foo/ as directory too if (/\/$/.test(file.path) && ppath.dirname(file.path) !== file.path) { ...
[ "function", "fixOutputPaths", "(", "output", ",", "files", ")", "{", "// map directories to use for index files", "var", "dirMap", "=", "{", "}", ";", "u", ".", "each", "(", "files", ",", "function", "(", "file", ")", "{", "dirMap", "[", "ppath", ".", "dir...
convert file-paths to 'index' files where necessary
[ "convert", "file", "-", "paths", "to", "index", "files", "where", "necessary" ]
524081509921ac8cb897753142324d61e10afdf3
https://github.com/jldec/pub-generator/blob/524081509921ac8cb897753142324d61e10afdf3/output.js#L110-L136
train
binduwavell/generator-alfresco-common
lib/maven-archetype-generate.js
addModuleToParentPom
function addModuleToParentPom (parentPomPath, properties, yoFs) { var pomStr = yoFs.read(parentPomPath); var pomEditor = mavenPomModule(pomStr); pomEditor.addModule(properties.artifactId); yoFs.write(parentPomPath, pomEditor.getPOMString()); }
javascript
function addModuleToParentPom (parentPomPath, properties, yoFs) { var pomStr = yoFs.read(parentPomPath); var pomEditor = mavenPomModule(pomStr); pomEditor.addModule(properties.artifactId); yoFs.write(parentPomPath, pomEditor.getPOMString()); }
[ "function", "addModuleToParentPom", "(", "parentPomPath", ",", "properties", ",", "yoFs", ")", "{", "var", "pomStr", "=", "yoFs", ".", "read", "(", "parentPomPath", ")", ";", "var", "pomEditor", "=", "mavenPomModule", "(", "pomStr", ")", ";", "pomEditor", "....
When a child module is instantiated we need to make sure the parent pom references the child. @param {!string} parentPomPath @param {!Object} properties @param {!Object} yoFs
[ "When", "a", "child", "module", "is", "instantiated", "we", "need", "to", "make", "sure", "the", "parent", "pom", "references", "the", "child", "." ]
d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4
https://github.com/binduwavell/generator-alfresco-common/blob/d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4/lib/maven-archetype-generate.js#L92-L97
train
binduwavell/generator-alfresco-common
lib/maven-archetype-generate.js
processModules
function processModules (resourcesPath, targetPath, directory, modules, parentPomPath, properties, yoFs) { modules.forEach(module => { debug('Processing module', module); var modulePath = path.join(directory, module.dir); properties.artifactId = pathFiltering.filter(module.dir, properties); addModuleT...
javascript
function processModules (resourcesPath, targetPath, directory, modules, parentPomPath, properties, yoFs) { modules.forEach(module => { debug('Processing module', module); var modulePath = path.join(directory, module.dir); properties.artifactId = pathFiltering.filter(module.dir, properties); addModuleT...
[ "function", "processModules", "(", "resourcesPath", ",", "targetPath", ",", "directory", ",", "modules", ",", "parentPomPath", ",", "properties", ",", "yoFs", ")", "{", "modules", ".", "forEach", "(", "module", "=>", "{", "debug", "(", "'Processing module'", "...
Given a list of modules, this accounts for the module directory and updates the artifactId property. Then it copies the module pom.xml, any filesets defined in the module and finally recuses on any sub-modules. @param {!string} resourcesPath @param {!string} targetPath @param {!string} directory @param {!Array<{dir: !...
[ "Given", "a", "list", "of", "modules", "this", "accounts", "for", "the", "module", "directory", "and", "updates", "the", "artifactId", "property", ".", "Then", "it", "copies", "the", "module", "pom", ".", "xml", "any", "filesets", "defined", "in", "the", "...
d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4
https://github.com/binduwavell/generator-alfresco-common/blob/d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4/lib/maven-archetype-generate.js#L214-L224
train
binduwavell/generator-alfresco-common
lib/maven-archetype-generate.js
filesFromFileSet
function filesFromFileSet (dirname, fileset) { if (!fileset.includes || !fileset.includes.length) { return []; } return fileset.includes .filter(include => !glob.hasMagic(include)) .map(include => path.join(dirname, include)); }
javascript
function filesFromFileSet (dirname, fileset) { if (!fileset.includes || !fileset.includes.length) { return []; } return fileset.includes .filter(include => !glob.hasMagic(include)) .map(include => path.join(dirname, include)); }
[ "function", "filesFromFileSet", "(", "dirname", ",", "fileset", ")", "{", "if", "(", "!", "fileset", ".", "includes", "||", "!", "fileset", ".", "includes", ".", "length", ")", "{", "return", "[", "]", ";", "}", "return", "fileset", ".", "includes", "....
The includes in a fileset may be globs or they may be individual files. This extracts all of the individual files and makes them absolute. @param {!string} dirname @param {!Array<{includes: Array<string>}>} fileset @returns {!Array<string>}
[ "The", "includes", "in", "a", "fileset", "may", "be", "globs", "or", "they", "may", "be", "individual", "files", ".", "This", "extracts", "all", "of", "the", "individual", "files", "and", "makes", "them", "absolute", "." ]
d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4
https://github.com/binduwavell/generator-alfresco-common/blob/d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4/lib/maven-archetype-generate.js#L307-L314
train
binduwavell/generator-alfresco-common
lib/maven-archetype-generate.js
globsToExcludeFromFileSet
function globsToExcludeFromFileSet (dirname, fileset) { if (fileset.excludes && fileset.excludes.length) { return fileset.excludes.map(exclude => '!' + path.join(dirname, exclude)); } else { return []; } }
javascript
function globsToExcludeFromFileSet (dirname, fileset) { if (fileset.excludes && fileset.excludes.length) { return fileset.excludes.map(exclude => '!' + path.join(dirname, exclude)); } else { return []; } }
[ "function", "globsToExcludeFromFileSet", "(", "dirname", ",", "fileset", ")", "{", "if", "(", "fileset", ".", "excludes", "&&", "fileset", ".", "excludes", ".", "length", ")", "{", "return", "fileset", ".", "excludes", ".", "map", "(", "exclude", "=>", "'!...
The excludes in a fileset are all treated as globs. This extracts all of them and makes them absolute. @param {!string} dirname @param {Array<{excludes: Array<string>}>} fileset @returns {Array<string>}
[ "The", "excludes", "in", "a", "fileset", "are", "all", "treated", "as", "globs", ".", "This", "extracts", "all", "of", "them", "and", "makes", "them", "absolute", "." ]
d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4
https://github.com/binduwavell/generator-alfresco-common/blob/d9ba309a1b1d26a97268a07a49ac9e5d86b31dc4/lib/maven-archetype-generate.js#L341-L347
train
socialally/air
lib/air/filter.js
filter
function filter(selector) { var arr = [], $ = this.air; this.each(function(el) { var selections; if(typeof selector === 'function') { if(selector.call(el)) { arr.push(el); } }else{ selections = $(selector); if(~selections.dom.indexOf(el)) { arr.push(el); } ...
javascript
function filter(selector) { var arr = [], $ = this.air; this.each(function(el) { var selections; if(typeof selector === 'function') { if(selector.call(el)) { arr.push(el); } }else{ selections = $(selector); if(~selections.dom.indexOf(el)) { arr.push(el); } ...
[ "function", "filter", "(", "selector", ")", "{", "var", "arr", "=", "[", "]", ",", "$", "=", "this", ".", "air", ";", "this", ".", "each", "(", "function", "(", "el", ")", "{", "var", "selections", ";", "if", "(", "typeof", "selector", "===", "'f...
Reduce the set of matched elements to those that match the selector or pass the function's test.
[ "Reduce", "the", "set", "of", "matched", "elements", "to", "those", "that", "match", "the", "selector", "or", "pass", "the", "function", "s", "test", "." ]
a3d94de58aaa4930a425fbcc7266764bf6ca8ca6
https://github.com/socialally/air/blob/a3d94de58aaa4930a425fbcc7266764bf6ca8ca6/lib/air/filter.js#L5-L21
train
charto/charto-loader
src/loader.js
exec
function exec() { var result; while(scripts.length) { var script = scripts.shift(); if(typeof(script) == 'function') { result = script(); if(result && typeof(result) == 'object' && typeof(result.then) == 'function') { result.then(exec); break; } } else { eval(script); } } }
javascript
function exec() { var result; while(scripts.length) { var script = scripts.shift(); if(typeof(script) == 'function') { result = script(); if(result && typeof(result) == 'object' && typeof(result.then) == 'function') { result.then(exec); break; } } else { eval(script); } } }
[ "function", "exec", "(", ")", "{", "var", "result", ";", "while", "(", "scripts", ".", "length", ")", "{", "var", "script", "=", "scripts", ".", "shift", "(", ")", ";", "if", "(", "typeof", "(", "script", ")", "==", "'function'", ")", "{", "result"...
Try to load a single module from multiple possible addresses. @param { number } num - Index of module in deps to maintain order. @param { string } key - Key for successfully resolved address cache. @param { string[] } urls - Addresses in order of decreasing preference.
[ "Try", "to", "load", "a", "single", "module", "from", "multiple", "possible", "addresses", "." ]
640ebb383bbda2be388c7c04ba627cb7d4263a0b
https://github.com/charto/charto-loader/blob/640ebb383bbda2be388c7c04ba627cb7d4263a0b/src/loader.js#L190-L205
train
owstack/btc-wallet-service
lib/server.js
WalletService
function WalletService() { if (!initialized) throw new Error('Server not initialized'); this.lock = lock; this.storage = storage; this.blockchainExplorer = blockchainExplorer; this.blockchainExplorerOpts = blockchainExplorerOpts; this.messageBroker = messageBroker; this.fiatRateService = fiatRateServ...
javascript
function WalletService() { if (!initialized) throw new Error('Server not initialized'); this.lock = lock; this.storage = storage; this.blockchainExplorer = blockchainExplorer; this.blockchainExplorerOpts = blockchainExplorerOpts; this.messageBroker = messageBroker; this.fiatRateService = fiatRateServ...
[ "function", "WalletService", "(", ")", "{", "if", "(", "!", "initialized", ")", "throw", "new", "Error", "(", "'Server not initialized'", ")", ";", "this", ".", "lock", "=", "lock", ";", "this", ".", "storage", "=", "storage", ";", "this", ".", "blockcha...
Creates an instance of the Btc Wallet Service. @constructor
[ "Creates", "an", "instance", "of", "the", "Btc", "Wallet", "Service", "." ]
1c5f30621fd18794a7795bdc56f027cdaf593616
https://github.com/owstack/btc-wallet-service/blob/1c5f30621fd18794a7795bdc56f027cdaf593616/lib/server.js#L49-L60
train
nodejitsu/contour
pagelets/nodejitsu/analytics/base.js
initialize
function initialize() { switch (this.type) { case 'ga': ga('create', this.key, this.domain); ga('send', 'pageview'); break; case 'segment': default: window.analytics.load(this.key); window.analytics.page(); break; } }
javascript
function initialize() { switch (this.type) { case 'ga': ga('create', this.key, this.domain); ga('send', 'pageview'); break; case 'segment': default: window.analytics.load(this.key); window.analytics.page(); break; } }
[ "function", "initialize", "(", ")", "{", "switch", "(", "this", ".", "type", ")", "{", "case", "'ga'", ":", "ga", "(", "'create'", ",", "this", ".", "key", ",", "this", ".", "domain", ")", ";", "ga", "(", "'send'", ",", "'pageview'", ")", ";", "b...
After initialization, load the required analytics stack. @api private
[ "After", "initialization", "load", "the", "required", "analytics", "stack", "." ]
0828e9bd25ef1eeb97ea231c447118d9867021b6
https://github.com/nodejitsu/contour/blob/0828e9bd25ef1eeb97ea231c447118d9867021b6/pagelets/nodejitsu/analytics/base.js#L33-L46
train
nodejitsu/contour
pagelets/nodejitsu/analytics/base.js
map
function map(data) { var result = {} , i = this.properties.length; while (i--) result[this.properties[i]] = data[i]; return result; }
javascript
function map(data) { var result = {} , i = this.properties.length; while (i--) result[this.properties[i]] = data[i]; return result; }
[ "function", "map", "(", "data", ")", "{", "var", "result", "=", "{", "}", ",", "i", "=", "this", ".", "properties", ".", "length", ";", "while", "(", "i", "--", ")", "result", "[", "this", ".", "properties", "[", "i", "]", "]", "=", "data", "["...
Map data to properties in consequtive order. @param {Array} data collection @api private
[ "Map", "data", "to", "properties", "in", "consequtive", "order", "." ]
0828e9bd25ef1eeb97ea231c447118d9867021b6
https://github.com/nodejitsu/contour/blob/0828e9bd25ef1eeb97ea231c447118d9867021b6/pagelets/nodejitsu/analytics/base.js#L65-L71
train
nodejitsu/contour
pagelets/nodejitsu/analytics/base.js
log
function log(e) { var data = $(e.element).get('track').split(';'); // Revenue only allows numbers remove it if it is not a number. if ('number' !== typeof data[3]) data.splice(3); analytics.track(data.splice(0, 1), this.map(data)); }
javascript
function log(e) { var data = $(e.element).get('track').split(';'); // Revenue only allows numbers remove it if it is not a number. if ('number' !== typeof data[3]) data.splice(3); analytics.track(data.splice(0, 1), this.map(data)); }
[ "function", "log", "(", "e", ")", "{", "var", "data", "=", "$", "(", "e", ".", "element", ")", ".", "get", "(", "'track'", ")", ".", "split", "(", "';'", ")", ";", "// Revenue only allows numbers remove it if it is not a number.", "if", "(", "'number'", "!...
Track event and send it to segment.io, mapping data to properties. @param {Event} e @api private
[ "Track", "event", "and", "send", "it", "to", "segment", ".", "io", "mapping", "data", "to", "properties", "." ]
0828e9bd25ef1eeb97ea231c447118d9867021b6
https://github.com/nodejitsu/contour/blob/0828e9bd25ef1eeb97ea231c447118d9867021b6/pagelets/nodejitsu/analytics/base.js#L79-L85
train
nodejitsu/contour
pagelets/nodejitsu/analytics/base.js
google
function google(e) { var tracker = this.tracking.ga; if (!tracker) return; ga(function done() { ga.getByName(tracker).send.apply( tracker, [ 'event' ].concat($(e.element).get('track').split(';')) ); }); }
javascript
function google(e) { var tracker = this.tracking.ga; if (!tracker) return; ga(function done() { ga.getByName(tracker).send.apply( tracker, [ 'event' ].concat($(e.element).get('track').split(';')) ); }); }
[ "function", "google", "(", "e", ")", "{", "var", "tracker", "=", "this", ".", "tracking", ".", "ga", ";", "if", "(", "!", "tracker", ")", "return", ";", "ga", "(", "function", "done", "(", ")", "{", "ga", ".", "getByName", "(", "tracker", ")", "....
Track the event and send beacon to all remaining trackers. @param {Event} e @api private
[ "Track", "the", "event", "and", "send", "beacon", "to", "all", "remaining", "trackers", "." ]
0828e9bd25ef1eeb97ea231c447118d9867021b6
https://github.com/nodejitsu/contour/blob/0828e9bd25ef1eeb97ea231c447118d9867021b6/pagelets/nodejitsu/analytics/base.js#L93-L103
train
moqada/github-contribution-stats
src/index.js
fetchGitHub
function fetchGitHub(url) { return fetch(url).then(res => { if (res.status === STATUS_NOT_FOUND) { throw new Error('USER_NOT_FOUND'); } else if (res.status !== STATUS_OK) { throw new Error('CANNOT_FETCH_DATA'); } return res.text(); }); }
javascript
function fetchGitHub(url) { return fetch(url).then(res => { if (res.status === STATUS_NOT_FOUND) { throw new Error('USER_NOT_FOUND'); } else if (res.status !== STATUS_OK) { throw new Error('CANNOT_FETCH_DATA'); } return res.text(); }); }
[ "function", "fetchGitHub", "(", "url", ")", "{", "return", "fetch", "(", "url", ")", ".", "then", "(", "res", "=>", "{", "if", "(", "res", ".", "status", "===", "STATUS_NOT_FOUND", ")", "{", "throw", "new", "Error", "(", "'USER_NOT_FOUND'", ")", ";", ...
Fetch HTML from GitHub @param {string} url - URL @return {Promise<string, Error>}
[ "Fetch", "HTML", "from", "GitHub" ]
0c5d07889c030ed699527e4c61a9763e794a9be0
https://github.com/moqada/github-contribution-stats/blob/0c5d07889c030ed699527e4c61a9763e794a9be0/src/index.js#L91-L100
train
moqada/github-contribution-stats
src/index.js
getStreaks
function getStreaks(contributions) { const start = contributions[0].date; const end = contributions.slice(-1)[0].date; const streak = {days: 0, start: null, end: null, unmeasurable: false}; let currentStreak = Object.assign({}, streak); let longestStreak = Object.assign({}, streak); contributions.forEach(re...
javascript
function getStreaks(contributions) { const start = contributions[0].date; const end = contributions.slice(-1)[0].date; const streak = {days: 0, start: null, end: null, unmeasurable: false}; let currentStreak = Object.assign({}, streak); let longestStreak = Object.assign({}, streak); contributions.forEach(re...
[ "function", "getStreaks", "(", "contributions", ")", "{", "const", "start", "=", "contributions", "[", "0", "]", ".", "date", ";", "const", "end", "=", "contributions", ".", "slice", "(", "-", "1", ")", "[", "0", "]", ".", "date", ";", "const", "stre...
Parse data to streak @param {Array<{date: string, count: number}>} contributions - List of contributions @return {{currentStreak: Streak, longestStreak: Streak}}
[ "Parse", "data", "to", "streak" ]
0c5d07889c030ed699527e4c61a9763e794a9be0
https://github.com/moqada/github-contribution-stats/blob/0c5d07889c030ed699527e4c61a9763e794a9be0/src/index.js#L109-L134
train
moqada/github-contribution-stats
src/index.js
parseCalendar
function parseCalendar($calendar) { const data = []; $calendar.find('rect').each((i, elm) => { const $rect = cheerio(elm); const date = $rect.attr('data-date'); if (!date) { return; } data.push({ date, count: parseInt($rect.attr('data-count'), 10) }); }); return data; }
javascript
function parseCalendar($calendar) { const data = []; $calendar.find('rect').each((i, elm) => { const $rect = cheerio(elm); const date = $rect.attr('data-date'); if (!date) { return; } data.push({ date, count: parseInt($rect.attr('data-count'), 10) }); }); return data; }
[ "function", "parseCalendar", "(", "$calendar", ")", "{", "const", "data", "=", "[", "]", ";", "$calendar", ".", "find", "(", "'rect'", ")", ".", "each", "(", "(", "i", ",", "elm", ")", "=>", "{", "const", "$rect", "=", "cheerio", "(", "elm", ")", ...
Parse HTML to list of contribution @param {Object} $calendar - cheerio object @return {Array<{date: string, count: number}>}
[ "Parse", "HTML", "to", "list", "of", "contribution" ]
0c5d07889c030ed699527e4c61a9763e794a9be0
https://github.com/moqada/github-contribution-stats/blob/0c5d07889c030ed699527e4c61a9763e794a9be0/src/index.js#L143-L157
train
moqada/github-contribution-stats
src/index.js
summarizeContributions
function summarizeContributions(contributions) { let busiestDay = null; let total = 0; contributions.forEach(d => { if (d.count > 0 && (!busiestDay || d.count > busiestDay.count)) { busiestDay = d; } total += d.count; }); return { busiestDay, end: contributions.slice(-1)[0].date, ...
javascript
function summarizeContributions(contributions) { let busiestDay = null; let total = 0; contributions.forEach(d => { if (d.count > 0 && (!busiestDay || d.count > busiestDay.count)) { busiestDay = d; } total += d.count; }); return { busiestDay, end: contributions.slice(-1)[0].date, ...
[ "function", "summarizeContributions", "(", "contributions", ")", "{", "let", "busiestDay", "=", "null", ";", "let", "total", "=", "0", ";", "contributions", ".", "forEach", "(", "d", "=>", "{", "if", "(", "d", ".", "count", ">", "0", "&&", "(", "!", ...
Summarize list of contribution @param {Array<{date: string, count: number}>} contributions - List of contribution @return {{end: string, start: string, total: number, busiestDay: {date: string, count: number}}}
[ "Summarize", "list", "of", "contribution" ]
0c5d07889c030ed699527e4c61a9763e794a9be0
https://github.com/moqada/github-contribution-stats/blob/0c5d07889c030ed699527e4c61a9763e794a9be0/src/index.js#L166-L181
train
lucbories/devapt-core-server
src/js/start_node.js
reload_file
function reload_file(arg_file_path) { const file_name = path.basename(arg_file_path) const this_file_name = path.basename(__filename) if (file_name == this_file_name) { console.info('Need to reload after change on ' + this_file_name) return } const exts = ['.js', '.json'] const ext = path.extname(arg_file_...
javascript
function reload_file(arg_file_path) { const file_name = path.basename(arg_file_path) const this_file_name = path.basename(__filename) if (file_name == this_file_name) { console.info('Need to reload after change on ' + this_file_name) return } const exts = ['.js', '.json'] const ext = path.extname(arg_file_...
[ "function", "reload_file", "(", "arg_file_path", ")", "{", "const", "file_name", "=", "path", ".", "basename", "(", "arg_file_path", ")", "const", "this_file_name", "=", "path", ".", "basename", "(", "__filename", ")", "if", "(", "file_name", "==", "this_file_...
Reload a file. @param {string} arg_file_path - file path name. @returns {nothing}
[ "Reload", "a", "file", "." ]
3f11b62e1d967202111b5f54536bbeddfe3443c9
https://github.com/lucbories/devapt-core-server/blob/3f11b62e1d967202111b5f54536bbeddfe3443c9/src/js/start_node.js#L146-L168
train
lucbories/devapt-core-server
src/js/start_node.js
watch
function watch(arg_src_dir) { console.info('Watching for change on: ' + arg_src_dir) const watch_settings = { ignored: /[\/\\]\./, persistent: true } var watcher = chokidar.watch(arg_src_dir, watch_settings) watcher.on('change', reload_file) return watcher }
javascript
function watch(arg_src_dir) { console.info('Watching for change on: ' + arg_src_dir) const watch_settings = { ignored: /[\/\\]\./, persistent: true } var watcher = chokidar.watch(arg_src_dir, watch_settings) watcher.on('change', reload_file) return watcher }
[ "function", "watch", "(", "arg_src_dir", ")", "{", "console", ".", "info", "(", "'Watching for change on: '", "+", "arg_src_dir", ")", "const", "watch_settings", "=", "{", "ignored", ":", "/", "[\\/\\\\]\\.", "/", ",", "persistent", ":", "true", "}", "var", ...
Watch directory files. @param {string} arg_src_dir - source directory. @returns {object} - watcher object.
[ "Watch", "directory", "files", "." ]
3f11b62e1d967202111b5f54536bbeddfe3443c9
https://github.com/lucbories/devapt-core-server/blob/3f11b62e1d967202111b5f54536bbeddfe3443c9/src/js/start_node.js#L179-L188
train
OpenSmartEnvironment/ose
lib/peer/remote.js
rxServer
function rxServer(val) { // {{{2 /** * Called, when received "server" message as a client. */ if (! ( val.space === this.peer.space.name && val.peer === this.peer.name )) { O.log.error(this, 'This is not the right peer'); this.close(); return; } this.rx = rxConfirm; this.tx({ spa...
javascript
function rxServer(val) { // {{{2 /** * Called, when received "server" message as a client. */ if (! ( val.space === this.peer.space.name && val.peer === this.peer.name )) { O.log.error(this, 'This is not the right peer'); this.close(); return; } this.rx = rxConfirm; this.tx({ spa...
[ "function", "rxServer", "(", "val", ")", "{", "// {{{2", "/**\n * Called, when received \"server\" message as a client.\n */", "if", "(", "!", "(", "val", ".", "space", "===", "this", ".", "peer", ".", "space", ".", "name", "&&", "val", ".", "peer", "===", "th...
WS {{{1 All methods are bound to "ws"
[ "WS", "{{{", "1", "All", "methods", "are", "bound", "to", "ws" ]
2ab051d9db6e77341c40abb9cbdae6ce586917e0
https://github.com/OpenSmartEnvironment/ose/blob/2ab051d9db6e77341c40abb9cbdae6ce586917e0/lib/peer/remote.js#L419-L440
train
vadr-vr/VR-Analytics-JSCore
js/deviceData.js
_setVadrDeviceCookie
function _setVadrDeviceCookie(){ // setting cookie valid for years set in constants const cookieValidFor = constants.cookieValidForYears; const deviceCookieName = constants.deviceCookieName; const currentDate = new Date(); const laterDate = new Date(); laterDate.setFullYear(currentDate.getFull...
javascript
function _setVadrDeviceCookie(){ // setting cookie valid for years set in constants const cookieValidFor = constants.cookieValidForYears; const deviceCookieName = constants.deviceCookieName; const currentDate = new Date(); const laterDate = new Date(); laterDate.setFullYear(currentDate.getFull...
[ "function", "_setVadrDeviceCookie", "(", ")", "{", "// setting cookie valid for years set in constants", "const", "cookieValidFor", "=", "constants", ".", "cookieValidForYears", ";", "const", "deviceCookieName", "=", "constants", ".", "deviceCookieName", ";", "const", "curr...
sets the deviceId to Cookie
[ "sets", "the", "deviceId", "to", "Cookie" ]
7e4a493c824c2c1716360dcb6a3bfecfede5df3b
https://github.com/vadr-vr/VR-Analytics-JSCore/blob/7e4a493c824c2c1716360dcb6a3bfecfede5df3b/js/deviceData.js#L73-L89
train
socialally/air
lib/air/remove.js
remove
function remove() { var i, el; for(i = 0;i < this.length;i++) { el = this.dom[i]; // if for some reason this point to the document element // an exception will occur, pretty hard to reproduce so // going to let it slide if(el.parentNode) { el.parentNode.removeChild(el); this.dom.spli...
javascript
function remove() { var i, el; for(i = 0;i < this.length;i++) { el = this.dom[i]; // if for some reason this point to the document element // an exception will occur, pretty hard to reproduce so // going to let it slide if(el.parentNode) { el.parentNode.removeChild(el); this.dom.spli...
[ "function", "remove", "(", ")", "{", "var", "i", ",", "el", ";", "for", "(", "i", "=", "0", ";", "i", "<", "this", ".", "length", ";", "i", "++", ")", "{", "el", "=", "this", ".", "dom", "[", "i", "]", ";", "// if for some reason this point to th...
Remove all matched elements.
[ "Remove", "all", "matched", "elements", "." ]
a3d94de58aaa4930a425fbcc7266764bf6ca8ca6
https://github.com/socialally/air/blob/a3d94de58aaa4930a425fbcc7266764bf6ca8ca6/lib/air/remove.js#L4-L18
train
feedhenry/fh-reportingclient
lib/mbaas-reporting.js
getEnvNumericalValue
function getEnvNumericalValue(envValue, defaultVal) { var limit = defaultVal; if (envValue) { limit = parseInt(envValue,10); if (isNaN(limit)) { limit = defaultVal; } } return limit; }
javascript
function getEnvNumericalValue(envValue, defaultVal) { var limit = defaultVal; if (envValue) { limit = parseInt(envValue,10); if (isNaN(limit)) { limit = defaultVal; } } return limit; }
[ "function", "getEnvNumericalValue", "(", "envValue", ",", "defaultVal", ")", "{", "var", "limit", "=", "defaultVal", ";", "if", "(", "envValue", ")", "{", "limit", "=", "parseInt", "(", "envValue", ",", "10", ")", ";", "if", "(", "isNaN", "(", "limit", ...
parse the value if it is present and if it is not NaN return that else return the default
[ "parse", "the", "value", "if", "it", "is", "present", "and", "if", "it", "is", "not", "NaN", "return", "that", "else", "return", "the", "default" ]
a0e2c959ce73addbf138d48f3ed46ef87229ae1a
https://github.com/feedhenry/fh-reportingclient/blob/a0e2c959ce73addbf138d48f3ed46ef87229ae1a/lib/mbaas-reporting.js#L10-L19
train
vadr-vr/VR-Analytics-JSCore
js/config.js
setApplication
function setApplication(appId, token, version){ appConfig['appId'] = appId; appConfig['appToken'] = token; appConfig['version'] = version; }
javascript
function setApplication(appId, token, version){ appConfig['appId'] = appId; appConfig['appToken'] = token; appConfig['version'] = version; }
[ "function", "setApplication", "(", "appId", ",", "token", ",", "version", ")", "{", "appConfig", "[", "'appId'", "]", "=", "appId", ";", "appConfig", "[", "'appToken'", "]", "=", "token", ";", "appConfig", "[", "'version'", "]", "=", "version", ";", "}" ...
Sets the application details such as appId, appToken, version @memberof ApplicationConfig @param {string} appId application id provided by vadr @param {token} token application token provided by vadr @param {version} version version of application set by developer
[ "Sets", "the", "application", "details", "such", "as", "appId", "appToken", "version" ]
7e4a493c824c2c1716360dcb6a3bfecfede5df3b
https://github.com/vadr-vr/VR-Analytics-JSCore/blob/7e4a493c824c2c1716360dcb6a3bfecfede5df3b/js/config.js#L27-L33
train
mchalapuk/hyper-text-slider
lib/utils/detect-features.js
featureNameFromProperty
function featureNameFromProperty(instance, defaultName, candidateMap) { for (var key in candidateMap) { if (typeof instance[key] !== 'undefined') { return candidateMap[key]; } } console.warn('no feature name detected for '+ defaultName +' using default'); return defaultName; }
javascript
function featureNameFromProperty(instance, defaultName, candidateMap) { for (var key in candidateMap) { if (typeof instance[key] !== 'undefined') { return candidateMap[key]; } } console.warn('no feature name detected for '+ defaultName +' using default'); return defaultName; }
[ "function", "featureNameFromProperty", "(", "instance", ",", "defaultName", ",", "candidateMap", ")", "{", "for", "(", "var", "key", "in", "candidateMap", ")", "{", "if", "(", "typeof", "instance", "[", "key", "]", "!==", "'undefined'", ")", "{", "return", ...
Detects browser-specific names of browser features by checking availability of browser-specific properties in given object instance. @param {Object} instance object that will be checked for existence of properties @param {String} defaultName name used if nothing else detected (standard-compliant name) @param {Object} ...
[ "Detects", "browser", "-", "specific", "names", "of", "browser", "features", "by", "checking", "availability", "of", "browser", "-", "specific", "properties", "in", "given", "object", "instance", "." ]
2711b41b9bbf1d528e4a0bd31b2efdf91dce55b4
https://github.com/mchalapuk/hyper-text-slider/blob/2711b41b9bbf1d528e4a0bd31b2efdf91dce55b4/lib/utils/detect-features.js#L54-L63
train
stevenvelozo/tidings
source/Tidings-CommonServices.js
function(pDefaultMessage, pError, pRequest, pResponse, fNext) { var tmpErrorMessage = pDefaultMessage; var tmpErrorCode = 1; var tmpScope = null; var tmpParams = null; var tmpSessionID = null; if (typeof(pError) === 'object') { tmpErrorMessage = pError.Message; if (pError.Code) tmpE...
javascript
function(pDefaultMessage, pError, pRequest, pResponse, fNext) { var tmpErrorMessage = pDefaultMessage; var tmpErrorCode = 1; var tmpScope = null; var tmpParams = null; var tmpSessionID = null; if (typeof(pError) === 'object') { tmpErrorMessage = pError.Message; if (pError.Code) tmpE...
[ "function", "(", "pDefaultMessage", ",", "pError", ",", "pRequest", ",", "pResponse", ",", "fNext", ")", "{", "var", "tmpErrorMessage", "=", "pDefaultMessage", ";", "var", "tmpErrorCode", "=", "1", ";", "var", "tmpScope", "=", "null", ";", "var", "tmpParams"...
Send an Error Code and Error Message to the client, and log it as an error in the log files. @method sendCodedError
[ "Send", "an", "Error", "Code", "and", "Error", "Message", "to", "the", "client", "and", "log", "it", "as", "an", "error", "in", "the", "log", "files", "." ]
761c7b4d746c874f43cfecfa1cf3f192fa8f5755
https://github.com/stevenvelozo/tidings/blob/761c7b4d746c874f43cfecfa1cf3f192fa8f5755/source/Tidings-CommonServices.js#L39-L74
train
stevenvelozo/tidings
source/Tidings-CommonServices.js
function(pMessage, pRequest, pResponse, fNext) { var tmpSessionID = null; if (pRequest.UserSession) { tmpSessionID = pRequest.UserSession.SessionID; } _Log.warn('API Error: '+pMessage, {SessionID: tmpSessionID, RequestID:pRequest.RequestUUID, RequestURL:pRequest.url, Action:'APIError'}, pRequest);...
javascript
function(pMessage, pRequest, pResponse, fNext) { var tmpSessionID = null; if (pRequest.UserSession) { tmpSessionID = pRequest.UserSession.SessionID; } _Log.warn('API Error: '+pMessage, {SessionID: tmpSessionID, RequestID:pRequest.RequestUUID, RequestURL:pRequest.url, Action:'APIError'}, pRequest);...
[ "function", "(", "pMessage", ",", "pRequest", ",", "pResponse", ",", "fNext", ")", "{", "var", "tmpSessionID", "=", "null", ";", "if", "(", "pRequest", ".", "UserSession", ")", "{", "tmpSessionID", "=", "pRequest", ".", "UserSession", ".", "SessionID", ";"...
Send an Error to the client, and log it as an error in the log files. @method sendError
[ "Send", "an", "Error", "to", "the", "client", "and", "log", "it", "as", "an", "error", "in", "the", "log", "files", "." ]
761c7b4d746c874f43cfecfa1cf3f192fa8f5755
https://github.com/stevenvelozo/tidings/blob/761c7b4d746c874f43cfecfa1cf3f192fa8f5755/source/Tidings-CommonServices.js#L82-L94
train
rolandliwag/serverrunner
index.js
startWorkers
function startWorkers() { _.range(0, numWorkers).forEach(function (index) { workers.push(startWorker(startPort + index)); }); }
javascript
function startWorkers() { _.range(0, numWorkers).forEach(function (index) { workers.push(startWorker(startPort + index)); }); }
[ "function", "startWorkers", "(", ")", "{", "_", ".", "range", "(", "0", ",", "numWorkers", ")", ".", "forEach", "(", "function", "(", "index", ")", "{", "workers", ".", "push", "(", "startWorker", "(", "startPort", "+", "index", ")", ")", ";", "}", ...
Start the workers
[ "Start", "the", "workers" ]
8a85f2d5af82c6a9d1d6c3b7eff68ab06e238aa7
https://github.com/rolandliwag/serverrunner/blob/8a85f2d5af82c6a9d1d6c3b7eff68ab06e238aa7/index.js#L48-L52
train
rolandliwag/serverrunner
index.js
startWorker
function startWorker(port) { var worker = child.fork(serverWorker, [ '--port', port, '--server', serverFile, '--allowForcedExit', allowForcedExit, '--config', JSON.stringify(config.app || {}), '--title', workerTitle ]); worker.on('exit...
javascript
function startWorker(port) { var worker = child.fork(serverWorker, [ '--port', port, '--server', serverFile, '--allowForcedExit', allowForcedExit, '--config', JSON.stringify(config.app || {}), '--title', workerTitle ]); worker.on('exit...
[ "function", "startWorker", "(", "port", ")", "{", "var", "worker", "=", "child", ".", "fork", "(", "serverWorker", ",", "[", "'--port'", ",", "port", ",", "'--server'", ",", "serverFile", ",", "'--allowForcedExit'", ",", "allowForcedExit", ",", "'--config'", ...
Start a worker on a specific port @private
[ "Start", "a", "worker", "on", "a", "specific", "port" ]
8a85f2d5af82c6a9d1d6c3b7eff68ab06e238aa7
https://github.com/rolandliwag/serverrunner/blob/8a85f2d5af82c6a9d1d6c3b7eff68ab06e238aa7/index.js#L58-L69
train
rolandliwag/serverrunner
index.js
createWorkerExitHandler
function createWorkerExitHandler(port) { return function (code, signal) { var workerIndex = port - startPort; workers[workerIndex] = null; if (code !== 0 || code === null) { console.log('Worker exited with code: ' + code); if (!shuttingDown)...
javascript
function createWorkerExitHandler(port) { return function (code, signal) { var workerIndex = port - startPort; workers[workerIndex] = null; if (code !== 0 || code === null) { console.log('Worker exited with code: ' + code); if (!shuttingDown)...
[ "function", "createWorkerExitHandler", "(", "port", ")", "{", "return", "function", "(", "code", ",", "signal", ")", "{", "var", "workerIndex", "=", "port", "-", "startPort", ";", "workers", "[", "workerIndex", "]", "=", "null", ";", "if", "(", "code", "...
Create a listener function to handle a premature exit event from a worker @private @param {Number} port The port number of the worker. @returns {Function}
[ "Create", "a", "listener", "function", "to", "handle", "a", "premature", "exit", "event", "from", "a", "worker" ]
8a85f2d5af82c6a9d1d6c3b7eff68ab06e238aa7
https://github.com/rolandliwag/serverrunner/blob/8a85f2d5af82c6a9d1d6c3b7eff68ab06e238aa7/index.js#L145-L164
train
soichih/node-htcondor
index.js
condor_simple
function condor_simple(cmd, opts) { var deferred = Q.defer(); var p = spawn(cmd, opts, {env: get_condor_env()});//, {cwd: __dirname}); //load event var stdout = ""; p.stdout.on('data', function (data) { stdout += data; }); var stderr = ""; p.stderr.on('data', function (data) { ...
javascript
function condor_simple(cmd, opts) { var deferred = Q.defer(); var p = spawn(cmd, opts, {env: get_condor_env()});//, {cwd: __dirname}); //load event var stdout = ""; p.stdout.on('data', function (data) { stdout += data; }); var stderr = ""; p.stderr.on('data', function (data) { ...
[ "function", "condor_simple", "(", "cmd", ",", "opts", ")", "{", "var", "deferred", "=", "Q", ".", "defer", "(", ")", ";", "var", "p", "=", "spawn", "(", "cmd", ",", "opts", ",", "{", "env", ":", "get_condor_env", "(", ")", "}", ")", ";", "//, {cw...
run simple condor command that takes job id as an argument
[ "run", "simple", "condor", "command", "that", "takes", "job", "id", "as", "an", "argument" ]
8800d84356d7235a6a19587464b0a3201bf4f9fc
https://github.com/soichih/node-htcondor/blob/8800d84356d7235a6a19587464b0a3201bf4f9fc/index.js#L218-L242
train
jquense/cobble
lib/descriptors.js
describe
function describe(composer, trailing) { return function (method) { return new Descriptor(function (key, previousValues) { if ( method !== undefined) previousValues[trailing ? 'push' : 'unshift' ](method) //console.log(previousValues) return reduce(previousValues, function(merged, nex...
javascript
function describe(composer, trailing) { return function (method) { return new Descriptor(function (key, previousValues) { if ( method !== undefined) previousValues[trailing ? 'push' : 'unshift' ](method) //console.log(previousValues) return reduce(previousValues, function(merged, nex...
[ "function", "describe", "(", "composer", ",", "trailing", ")", "{", "return", "function", "(", "method", ")", "{", "return", "new", "Descriptor", "(", "function", "(", "key", ",", "previousValues", ")", "{", "if", "(", "method", "!==", "undefined", ")", ...
turns a normal decorator into a 'descriptor' @param {function} composer @return {function}
[ "turns", "a", "normal", "decorator", "into", "a", "descriptor" ]
25889b99309cdd6d690fa8efdb6f86e99c41c466
https://github.com/jquense/cobble/blob/25889b99309cdd6d690fa8efdb6f86e99c41c466/lib/descriptors.js#L89-L106
train
nathanbuchar/gulp-import-tasks
lib/gulp-import-tasks.js
parseTaskObject
function parseTaskObject(task, options) { if (Array.isArray(task)) { return task; } else { return task.bind(null, gulp, ...options.params); } }
javascript
function parseTaskObject(task, options) { if (Array.isArray(task)) { return task; } else { return task.bind(null, gulp, ...options.params); } }
[ "function", "parseTaskObject", "(", "task", ",", "options", ")", "{", "if", "(", "Array", ".", "isArray", "(", "task", ")", ")", "{", "return", "task", ";", "}", "else", "{", "return", "task", ".", "bind", "(", "null", ",", "gulp", ",", "...", "opt...
This builds the task object. A gulp task may be either an array or a function, so we must handle both. If it is an array, we return it immediately, otherwise we create a new function with the correctly-bounded parameters. @param {Array|Function} task @param {Object} options @returns {Array|Function}
[ "This", "builds", "the", "task", "object", ".", "A", "gulp", "task", "may", "be", "either", "an", "array", "or", "a", "function", "so", "we", "must", "handle", "both", ".", "If", "it", "is", "an", "array", "we", "return", "it", "immediately", "otherwis...
2d65e761e2100f68a422a2e63d24725e31247bb7
https://github.com/nathanbuchar/gulp-import-tasks/blob/2d65e761e2100f68a422a2e63d24725e31247bb7/lib/gulp-import-tasks.js#L49-L55
train
nathanbuchar/gulp-import-tasks
lib/gulp-import-tasks.js
registerTask
function registerTask(file, options) { const task = require(file.path); const taskName = path.basename(file.path, file.ext); const taskObject = parseTaskObject(task, options); // Register this task with Gulp. gulp.task.call(gulp, taskName, taskObject); debug(`registered "${taskName}" task`); }
javascript
function registerTask(file, options) { const task = require(file.path); const taskName = path.basename(file.path, file.ext); const taskObject = parseTaskObject(task, options); // Register this task with Gulp. gulp.task.call(gulp, taskName, taskObject); debug(`registered "${taskName}" task`); }
[ "function", "registerTask", "(", "file", ",", "options", ")", "{", "const", "task", "=", "require", "(", "file", ".", "path", ")", ";", "const", "taskName", "=", "path", ".", "basename", "(", "file", ".", "path", ",", "file", ".", "ext", ")", ";", ...
Registers a Gulp task given a file and a set of options. @param {Object} file @param {Object} options
[ "Registers", "a", "Gulp", "task", "given", "a", "file", "and", "a", "set", "of", "options", "." ]
2d65e761e2100f68a422a2e63d24725e31247bb7
https://github.com/nathanbuchar/gulp-import-tasks/blob/2d65e761e2100f68a422a2e63d24725e31247bb7/lib/gulp-import-tasks.js#L63-L72
train
nathanbuchar/gulp-import-tasks
lib/gulp-import-tasks.js
parseFile
function parseFile(dir, filename) { const filePath = path.join(dir, filename); const fileStat = fs.statSync(filePath); const fileExt = path.extname(filename); return { path: filePath, stat: fileStat, ext: fileExt }; }
javascript
function parseFile(dir, filename) { const filePath = path.join(dir, filename); const fileStat = fs.statSync(filePath); const fileExt = path.extname(filename); return { path: filePath, stat: fileStat, ext: fileExt }; }
[ "function", "parseFile", "(", "dir", ",", "filename", ")", "{", "const", "filePath", "=", "path", ".", "join", "(", "dir", ",", "filename", ")", ";", "const", "fileStat", "=", "fs", ".", "statSync", "(", "filePath", ")", ";", "const", "fileExt", "=", ...
Parses relevant file properties into a single object. @param {string} dir @param {string} filename @returns {Object}
[ "Parses", "relevant", "file", "properties", "into", "a", "single", "object", "." ]
2d65e761e2100f68a422a2e63d24725e31247bb7
https://github.com/nathanbuchar/gulp-import-tasks/blob/2d65e761e2100f68a422a2e63d24725e31247bb7/lib/gulp-import-tasks.js#L81-L91
train
nathanbuchar/gulp-import-tasks
lib/gulp-import-tasks.js
handleFile
function handleFile(dir, options) { return filename => { const file = parseFile(dir, filename); debug(`found "${filename}"`); // Exit early if this item is not a file. if (!file.stat.isFile()) { debug(`skipped "${filename}" (not a file)`); return; } // Exit early if this item is...
javascript
function handleFile(dir, options) { return filename => { const file = parseFile(dir, filename); debug(`found "${filename}"`); // Exit early if this item is not a file. if (!file.stat.isFile()) { debug(`skipped "${filename}" (not a file)`); return; } // Exit early if this item is...
[ "function", "handleFile", "(", "dir", ",", "options", ")", "{", "return", "filename", "=>", "{", "const", "file", "=", "parseFile", "(", "dir", ",", "filename", ")", ";", "debug", "(", "`", "${", "filename", "}", "`", ")", ";", "// Exit early if this ite...
Creates a closure that is invoked for each item in the chosen directory. Verifies that the item is a file and of the correct type, then registers the task. @param {string} dir @param {Object} options @returns {Function}
[ "Creates", "a", "closure", "that", "is", "invoked", "for", "each", "item", "in", "the", "chosen", "directory", ".", "Verifies", "that", "the", "item", "is", "a", "file", "and", "of", "the", "correct", "type", "then", "registers", "the", "task", "." ]
2d65e761e2100f68a422a2e63d24725e31247bb7
https://github.com/nathanbuchar/gulp-import-tasks/blob/2d65e761e2100f68a422a2e63d24725e31247bb7/lib/gulp-import-tasks.js#L102-L122
train
nathanbuchar/gulp-import-tasks
lib/gulp-import-tasks.js
extendDefaultOptions
function extendDefaultOptions(options) { return Object.assign({ dir: DEFAULT_DIRECTORY, extensions: DEFAULT_EXTENSIONS, params: DEFAULT_PARAMS }, options); }
javascript
function extendDefaultOptions(options) { return Object.assign({ dir: DEFAULT_DIRECTORY, extensions: DEFAULT_EXTENSIONS, params: DEFAULT_PARAMS }, options); }
[ "function", "extendDefaultOptions", "(", "options", ")", "{", "return", "Object", ".", "assign", "(", "{", "dir", ":", "DEFAULT_DIRECTORY", ",", "extensions", ":", "DEFAULT_EXTENSIONS", ",", "params", ":", "DEFAULT_PARAMS", "}", ",", "options", ")", ";", "}" ]
Extends default options with user options. @param {Object} options @returns {Object}
[ "Extends", "default", "options", "with", "user", "options", "." ]
2d65e761e2100f68a422a2e63d24725e31247bb7
https://github.com/nathanbuchar/gulp-import-tasks/blob/2d65e761e2100f68a422a2e63d24725e31247bb7/lib/gulp-import-tasks.js#L130-L136
train
nathanbuchar/gulp-import-tasks
lib/gulp-import-tasks.js
importTasks
function importTasks(options) { const opts = parseOptions(options); const cwd = process.cwd(); const dir = path.join(cwd, opts.dir); debug(`importing tasks from "${dir}"...`); // This synchronously reads the contents within the chosen directory then // loops through each item, verifies that it is in fact ...
javascript
function importTasks(options) { const opts = parseOptions(options); const cwd = process.cwd(); const dir = path.join(cwd, opts.dir); debug(`importing tasks from "${dir}"...`); // This synchronously reads the contents within the chosen directory then // loops through each item, verifies that it is in fact ...
[ "function", "importTasks", "(", "options", ")", "{", "const", "opts", "=", "parseOptions", "(", "options", ")", ";", "const", "cwd", "=", "process", ".", "cwd", "(", ")", ";", "const", "dir", "=", "path", ".", "join", "(", "cwd", ",", "opts", ".", ...
Registers all gulp tasks within the given directory. @param {Object|string} [options] @param {string} [options.dir='tasks'] @param {Array.<string>} [options.extensions=['.js']] @param {Array.<*>} [options.params=[]]
[ "Registers", "all", "gulp", "tasks", "within", "the", "given", "directory", "." ]
2d65e761e2100f68a422a2e63d24725e31247bb7
https://github.com/nathanbuchar/gulp-import-tasks/blob/2d65e761e2100f68a422a2e63d24725e31247bb7/lib/gulp-import-tasks.js#L162-L177
train
cettia/cettia-protocol
lib/transport-http-stream-transport.js
onmessage
function onmessage(data) { if (!handshaked) { handshaked = true; // The handshake output is in the form of URI. var result = url.parse(data, true).query; // A newly issued id for HTTP transport. It is used to identify which HTTP transport // is assoc...
javascript
function onmessage(data) { if (!handshaked) { handshaked = true; // The handshake output is in the form of URI. var result = url.parse(data, true).query; // A newly issued id for HTTP transport. It is used to identify which HTTP transport // is assoc...
[ "function", "onmessage", "(", "data", ")", "{", "if", "(", "!", "handshaked", ")", "{", "handshaked", "=", "true", ";", "// The handshake output is in the form of URI.", "var", "result", "=", "url", ".", "parse", "(", "data", ",", "true", ")", ".", "query", ...
On a message of the event stream format of Server-Sent Events,
[ "On", "a", "message", "of", "the", "event", "stream", "format", "of", "Server", "-", "Sent", "Events" ]
9af3b578a9ae7b33099932903b52faeb2ca92528
https://github.com/cettia/cettia-protocol/blob/9af3b578a9ae7b33099932903b52faeb2ca92528/lib/transport-http-stream-transport.js#L64-L98
train
solid/solid-auth-tls
src/auth.js
loginTo
function loginTo (endpoint, config) { return global.IS_BROWSER ? loginFromBrowser(endpoint, config) : loginFromNode(endpoint, config) }
javascript
function loginTo (endpoint, config) { return global.IS_BROWSER ? loginFromBrowser(endpoint, config) : loginFromNode(endpoint, config) }
[ "function", "loginTo", "(", "endpoint", ",", "config", ")", "{", "return", "global", ".", "IS_BROWSER", "?", "loginFromBrowser", "(", "endpoint", ",", "config", ")", ":", "loginFromNode", "(", "endpoint", ",", "config", ")", "}" ]
Logs in to the specified endpoint with the given configuration @param {AUTH_ENDPOINTS} endpoint - the endpoint type @param {@link module:config-default} config - the config object @returns {(Promise<String>|Promise<null>)} the WebID as a string if the client cert is recognized, otherwise null.
[ "Logs", "in", "to", "the", "specified", "endpoint", "with", "the", "given", "configuration" ]
a27dea9c29778db936adf48be8042895af3a8f43
https://github.com/solid/solid-auth-tls/blob/a27dea9c29778db936adf48be8042895af3a8f43/src/auth.js#L60-L64
train
solid/solid-auth-tls
src/auth.js
loginFromBrowser
function loginFromBrowser (endpoint, config) { let uri switch (endpoint) { case AUTH_ENDPOINTS.PRIMARY: uri = config.authEndpoint || window.location.origin + window.location.pathname break case AUTH_ENDPOINTS.SECONDARY: uri = config.fallbackAuthEndpoint break } return new Promi...
javascript
function loginFromBrowser (endpoint, config) { let uri switch (endpoint) { case AUTH_ENDPOINTS.PRIMARY: uri = config.authEndpoint || window.location.origin + window.location.pathname break case AUTH_ENDPOINTS.SECONDARY: uri = config.fallbackAuthEndpoint break } return new Promi...
[ "function", "loginFromBrowser", "(", "endpoint", ",", "config", ")", "{", "let", "uri", "switch", "(", "endpoint", ")", "{", "case", "AUTH_ENDPOINTS", ".", "PRIMARY", ":", "uri", "=", "config", ".", "authEndpoint", "||", "window", ".", "location", ".", "or...
Logs in to the specified endpoint from within the browser @param {AUTH_ENDPOINTS} endpoint - the endpoint type @param {@link module:config-default} config - the config object @returns {(Promise<String>|Promise<null>)} the WebID as a string if the client cert is recognized, otherwise null.
[ "Logs", "in", "to", "the", "specified", "endpoint", "from", "within", "the", "browser" ]
a27dea9c29778db936adf48be8042895af3a8f43
https://github.com/solid/solid-auth-tls/blob/a27dea9c29778db936adf48be8042895af3a8f43/src/auth.js#L73-L97
train
solid/solid-auth-tls
src/auth.js
loginFromNode
function loginFromNode (endpoint, config) { if (!(config.key && config.cert)) { throw new Error('Must provide TLS key and cert when running in node') } let uri switch (endpoint) { case AUTH_ENDPOINTS.PRIMARY: uri = config.authEndpoint break case AUTH_ENDPOINTS.SECONDARY: uri = co...
javascript
function loginFromNode (endpoint, config) { if (!(config.key && config.cert)) { throw new Error('Must provide TLS key and cert when running in node') } let uri switch (endpoint) { case AUTH_ENDPOINTS.PRIMARY: uri = config.authEndpoint break case AUTH_ENDPOINTS.SECONDARY: uri = co...
[ "function", "loginFromNode", "(", "endpoint", ",", "config", ")", "{", "if", "(", "!", "(", "config", ".", "key", "&&", "config", ".", "cert", ")", ")", "{", "throw", "new", "Error", "(", "'Must provide TLS key and cert when running in node'", ")", "}", "let...
Logs in to the specified endpoint from within a Node.js environment @param {AUTH_ENDPOINTS} endpoint - the endpoint type @param {@link module:config-default} config - the config object @returns {(Promise<String>|Promise<null>)} the WebID as a string if the client cert is recognized, otherwise null.
[ "Logs", "in", "to", "the", "specified", "endpoint", "from", "within", "a", "Node", ".", "js", "environment" ]
a27dea9c29778db936adf48be8042895af3a8f43
https://github.com/solid/solid-auth-tls/blob/a27dea9c29778db936adf48be8042895af3a8f43/src/auth.js#L106-L153
train
danigb/note.midi
index.js
midi
function midi (note) { if ((typeof note === 'number' || typeof note === 'string') && note > 0 && note < 128) return +note var p = Array.isArray(note) ? note : parse(note) if (!p || p.length < 2) return null return p[0] * 7 + p[1] * 12 + 12 }
javascript
function midi (note) { if ((typeof note === 'number' || typeof note === 'string') && note > 0 && note < 128) return +note var p = Array.isArray(note) ? note : parse(note) if (!p || p.length < 2) return null return p[0] * 7 + p[1] * 12 + 12 }
[ "function", "midi", "(", "note", ")", "{", "if", "(", "(", "typeof", "note", "===", "'number'", "||", "typeof", "note", "===", "'string'", ")", "&&", "note", ">", "0", "&&", "note", "<", "128", ")", "return", "+", "note", "var", "p", "=", "Array", ...
Get the midi number of a note If the argument passed to this function is a valid midi number, it returns it The note can be an string in scientific notation or [array pitch notation](https://github.com/danigb/music.array.notation) @name midi @function @param {String|Array} note - the note in string or array notation...
[ "Get", "the", "midi", "number", "of", "a", "note" ]
4673847d157859995d51d10c8b853ee447fca448
https://github.com/danigb/note.midi/blob/4673847d157859995d51d10c8b853ee447fca448/index.js#L24-L30
train
cettia/cettia-protocol
lib/socket.js
find
function find() { // If there is no remaining URI, fires `error` and `close` event as it means that all // tries failed. if (uris.length === 0) { // Now that `connecting` event is being fired, there is no `error` and `close` event user // added. Delays to fire them a little while. ...
javascript
function find() { // If there is no remaining URI, fires `error` and `close` event as it means that all // tries failed. if (uris.length === 0) { // Now that `connecting` event is being fired, there is no `error` and `close` event user // added. Delays to fire them a little while. ...
[ "function", "find", "(", ")", "{", "// If there is no remaining URI, fires `error` and `close` event as it means that all", "// tries failed.", "if", "(", "uris", ".", "length", "===", "0", ")", "{", "// Now that `connecting` event is being fired, there is no `error` and `close` even...
Starts a process to find a working transport.
[ "Starts", "a", "process", "to", "find", "a", "working", "transport", "." ]
9af3b578a9ae7b33099932903b52faeb2ca92528
https://github.com/cettia/cettia-protocol/blob/9af3b578a9ae7b33099932903b52faeb2ca92528/lib/socket.js#L120-L259
train
cettia/cettia-protocol
lib/server.js
onevent
function onevent(event) { // Event should have the following properties: // * `id: string`: an event identifier. // * `type: string`: an event type. // * `data: any`: an event data. // * `reply: boolean`: true if this event requires the reply. // If the client sends a pl...
javascript
function onevent(event) { // Event should have the following properties: // * `id: string`: an event identifier. // * `type: string`: an event type. // * `data: any`: an event data. // * `reply: boolean`: true if this event requires the reply. // If the client sends a pl...
[ "function", "onevent", "(", "event", ")", "{", "// Event should have the following properties:", "// * `id: string`: an event identifier.", "// * `type: string`: an event type.", "// * `data: any`: an event data.", "// * `reply: boolean`: true if this event requires the reply.", "// If the cli...
When an event object is created from `text` or `binary` event.
[ "When", "an", "event", "object", "is", "created", "from", "text", "or", "binary", "event", "." ]
9af3b578a9ae7b33099932903b52faeb2ca92528
https://github.com/cettia/cettia-protocol/blob/9af3b578a9ae7b33099932903b52faeb2ca92528/lib/server.js#L96-L124
train
kidney/postcss-iconfont
src/index.js
insertGlyphsRules
function insertGlyphsRules(rule, result) { // Reverse order // make sure to insert the characters in ascending order let glyphs = result.glyphs.slice(0); let glyphLen = glyphs.length; while (glyphLen--) { let glyph = glyphs[glyphLen]; let node = postcss.rule({ selector: '...
javascript
function insertGlyphsRules(rule, result) { // Reverse order // make sure to insert the characters in ascending order let glyphs = result.glyphs.slice(0); let glyphLen = glyphs.length; while (glyphLen--) { let glyph = glyphs[glyphLen]; let node = postcss.rule({ selector: '...
[ "function", "insertGlyphsRules", "(", "rule", ",", "result", ")", "{", "// Reverse order", "// make sure to insert the characters in ascending order", "let", "glyphs", "=", "result", ".", "glyphs", ".", "slice", "(", "0", ")", ";", "let", "glyphLen", "=", "glyphs", ...
Insert glyphs css rules @param rule @param result
[ "Insert", "glyphs", "css", "rules" ]
35bc3eecc0a0baa1db32ec523ff2904b0b9aa08d
https://github.com/kidney/postcss-iconfont/blob/35bc3eecc0a0baa1db32ec523ff2904b0b9aa08d/src/index.js#L170-L214
train
rksm/estree-to-js
index.js
extractTypeSourcesFromMarkdown
function extractTypeSourcesFromMarkdown(mdSource) { var types = lang.string.lines(mdSource).reduce((typesAkk, line) => { if (line.trim().startsWith("//")) return typesAkk; if (typesAkk.current && !line.trim().length) { typesAkk.types.push(typesAkk.current); typesAkk.current = []; } else if (typesAkk...
javascript
function extractTypeSourcesFromMarkdown(mdSource) { var types = lang.string.lines(mdSource).reduce((typesAkk, line) => { if (line.trim().startsWith("//")) return typesAkk; if (typesAkk.current && !line.trim().length) { typesAkk.types.push(typesAkk.current); typesAkk.current = []; } else if (typesAkk...
[ "function", "extractTypeSourcesFromMarkdown", "(", "mdSource", ")", "{", "var", "types", "=", "lang", ".", "string", ".", "lines", "(", "mdSource", ")", ".", "reduce", "(", "(", "typesAkk", ",", "line", ")", "=>", "{", "if", "(", "line", ".", "trim", "...
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- estree spec markdown parser
[ "-", "=", "-", "=", "-", "=", "-", "=", "-", "=", "-", "=", "-", "=", "-", "=", "-", "=", "-", "=", "-", "=", "-", "=", "-", "=", "-", "=", "-", "=", "-", "=", "-", "=", "-", "=", "-", "=", "-", "=", "-", "=", "-", "=", "-", "...
3cb21c9c63ff329651f08197d353965e80551bd2
https://github.com/rksm/estree-to-js/blob/3cb21c9c63ff329651f08197d353965e80551bd2/index.js#L53-L66
train
alexindigo/cartesian
index.js
cartesian
function cartesian(list) { var last, init, keys, product = []; if (Array.isArray(list)) { init = []; last = list.length - 1; } else if (typeof list == 'object' && list !== null) { init = {}; keys = Object.keys(list); last = keys.length - 1; } else { throw new TypeError('Expect...
javascript
function cartesian(list) { var last, init, keys, product = []; if (Array.isArray(list)) { init = []; last = list.length - 1; } else if (typeof list == 'object' && list !== null) { init = {}; keys = Object.keys(list); last = keys.length - 1; } else { throw new TypeError('Expect...
[ "function", "cartesian", "(", "list", ")", "{", "var", "last", ",", "init", ",", "keys", ",", "product", "=", "[", "]", ";", "if", "(", "Array", ".", "isArray", "(", "list", ")", ")", "{", "init", "=", "[", "]", ";", "last", "=", "list", ".", ...
Creates cartesian product of the provided properties @param {object|array} list - list of (array) properties or array of arrays @returns {array} all the combinations of the properties
[ "Creates", "cartesian", "product", "of", "the", "provided", "properties" ]
378663ad87902a058bd7202eb3e87a91993c1d3a
https://github.com/alexindigo/cartesian/blob/378663ad87902a058bd7202eb3e87a91993c1d3a/index.js#L12-L60
train
alexindigo/cartesian
index.js
store
function store(obj, elem, key) { Array.isArray(obj) ? obj.push(elem) : (obj[key] = elem); }
javascript
function store(obj, elem, key) { Array.isArray(obj) ? obj.push(elem) : (obj[key] = elem); }
[ "function", "store", "(", "obj", ",", "elem", ",", "key", ")", "{", "Array", ".", "isArray", "(", "obj", ")", "?", "obj", ".", "push", "(", "elem", ")", ":", "(", "obj", "[", "key", "]", "=", "elem", ")", ";", "}" ]
Stores provided element in the provided object or array @param {object|array} obj - object or array to add to @param {mixed} elem - element to add @param {string|number} key - object's property key to add to @returns {void}
[ "Stores", "provided", "element", "in", "the", "provided", "object", "or", "array" ]
378663ad87902a058bd7202eb3e87a91993c1d3a
https://github.com/alexindigo/cartesian/blob/378663ad87902a058bd7202eb3e87a91993c1d3a/index.js#L81-L84
train
jordangarcia/nuclear-js-react-addons
build/nuclearComponent.js
nuclearComponent
function nuclearComponent(Component, getDataBindings) { console.warn('nuclearComponent is deprecated, use `connect()` instead'); // support decorator pattern // detect all React Components because they have a render method if (arguments.length === 0 || !Component.prototype.render) { // Component here is the...
javascript
function nuclearComponent(Component, getDataBindings) { console.warn('nuclearComponent is deprecated, use `connect()` instead'); // support decorator pattern // detect all React Components because they have a render method if (arguments.length === 0 || !Component.prototype.render) { // Component here is the...
[ "function", "nuclearComponent", "(", "Component", ",", "getDataBindings", ")", "{", "console", ".", "warn", "(", "'nuclearComponent is deprecated, use `connect()` instead'", ")", ";", "// support decorator pattern", "// detect all React Components because they have a render method", ...
Provides dataBindings + reactor as props to wrapped component Example: var WrappedComponent = nuclearComponent(Component, function(props) { return { counter: 'counter' }; ); Also supports the decorator pattern: @nuclearComponent((props) => { return { counter: 'counter' } }) class BaseComponent extends React.Component...
[ "Provides", "dataBindings", "+", "reactor", "as", "props", "to", "wrapped", "component" ]
5550ebd6ec07bfec01aa557908735142613dcdb3
https://github.com/jordangarcia/nuclear-js-react-addons/blob/5550ebd6ec07bfec01aa557908735142613dcdb3/build/nuclearComponent.js#L38-L48
train
opendxl/node-red-contrib-dxl
lib/node-utils.js
function (value, defaultValue) { if (module.exports.isEmpty(value)) { value = defaultValue } else if (typeof value === 'string') { value = value.trim().toLowerCase() switch (value) { case 'false': value = 0 break case 'true': value = 1 br...
javascript
function (value, defaultValue) { if (module.exports.isEmpty(value)) { value = defaultValue } else if (typeof value === 'string') { value = value.trim().toLowerCase() switch (value) { case 'false': value = 0 break case 'true': value = 1 br...
[ "function", "(", "value", ",", "defaultValue", ")", "{", "if", "(", "module", ".", "exports", ".", "isEmpty", "(", "value", ")", ")", "{", "value", "=", "defaultValue", "}", "else", "if", "(", "typeof", "value", "===", "'string'", ")", "{", "value", ...
Convert the supplied value into a number. @param value - The value to convert. @param defaultValue - If the value parameter is undefined, null, a zero-length string, or a string containing only whitespace characters, the defaultValue is returned. @returns The converted or default value. If the value parameter is non-nu...
[ "Convert", "the", "supplied", "value", "into", "a", "number", "." ]
a68169c4357162f48d98006fb40843795f997f28
https://github.com/opendxl/node-red-contrib-dxl/blob/a68169c4357162f48d98006fb40843795f997f28/lib/node-utils.js#L21-L42
train
sheepsteak/react-perf-component
lib/index.js
perf
function perf(Target) { if (process.env.NODE_ENV === 'production') { return Target; } // eslint-disable-next-line global-require var ReactPerf = require('react-addons-perf'); var Perf = function (_Component) { _inherits(Perf, _Component); function Perf() { _classCallCheck(this, Perf); ...
javascript
function perf(Target) { if (process.env.NODE_ENV === 'production') { return Target; } // eslint-disable-next-line global-require var ReactPerf = require('react-addons-perf'); var Perf = function (_Component) { _inherits(Perf, _Component); function Perf() { _classCallCheck(this, Perf); ...
[ "function", "perf", "(", "Target", ")", "{", "if", "(", "process", ".", "env", ".", "NODE_ENV", "===", "'production'", ")", "{", "return", "Target", ";", "}", "// eslint-disable-next-line global-require", "var", "ReactPerf", "=", "require", "(", "'react-addons-p...
Wraps the passed in `Component` in a higher-order component. It can then measure the performance of every render of the `Component`. Can also be used as an ES2016 decorator. @param {ReactComponent} Component the component to wrap @return {ReactComponent} the wrapped component
[ "Wraps", "the", "passed", "in", "Component", "in", "a", "higher", "-", "order", "component", ".", "It", "can", "then", "measure", "the", "performance", "of", "every", "render", "of", "the", "Component", "." ]
b6b34c578e715940e59f958ba5b5d1b52a64f253
https://github.com/sheepsteak/react-perf-component/blob/b6b34c578e715940e59f958ba5b5d1b52a64f253/lib/index.js#L31-L81
train
jordangarcia/nuclear-js-react-addons
build/provideReactor.js
provideReactor
function provideReactor(Component, additionalContextTypes) { console.warn('`provideReactor` is deprecated, use `<Provider reactor={reactor} />` instead'); // support decorator pattern if (arguments.length === 0 || typeof arguments[0] !== 'function') { additionalContextTypes = arguments[0]; return function...
javascript
function provideReactor(Component, additionalContextTypes) { console.warn('`provideReactor` is deprecated, use `<Provider reactor={reactor} />` instead'); // support decorator pattern if (arguments.length === 0 || typeof arguments[0] !== 'function') { additionalContextTypes = arguments[0]; return function...
[ "function", "provideReactor", "(", "Component", ",", "additionalContextTypes", ")", "{", "console", ".", "warn", "(", "'`provideReactor` is deprecated, use `<Provider reactor={reactor} />` instead'", ")", ";", "// support decorator pattern", "if", "(", "arguments", ".", "leng...
Provides reactor prop to all children as React context Example: var WrappedComponent = provideReactor(Component, { foo: React.PropTypes.string }); Also supports the decorator pattern: @provideReactor({ foo: React.PropTypes.string }) class BaseComponent extends React.Component { render() { return <div/>; } } @method ...
[ "Provides", "reactor", "prop", "to", "all", "children", "as", "React", "context" ]
5550ebd6ec07bfec01aa557908735142613dcdb3
https://github.com/jordangarcia/nuclear-js-react-addons/blob/5550ebd6ec07bfec01aa557908735142613dcdb3/build/provideReactor.js#L81-L92
train
jefftham/wsm
lib/wsm.js
wsConnect
function wsConnect() { var typeOfConnection; if (location.protocol === 'https:') { typeOfConnection = 'wss'; } else { typeOfConnection = 'ws' } self.ws = new WebSocket(typeOfConnection + '://' + location.hostname + ':' + loca...
javascript
function wsConnect() { var typeOfConnection; if (location.protocol === 'https:') { typeOfConnection = 'wss'; } else { typeOfConnection = 'ws' } self.ws = new WebSocket(typeOfConnection + '://' + location.hostname + ':' + loca...
[ "function", "wsConnect", "(", ")", "{", "var", "typeOfConnection", ";", "if", "(", "location", ".", "protocol", "===", "'https:'", ")", "{", "typeOfConnection", "=", "'wss'", ";", "}", "else", "{", "typeOfConnection", "=", "'ws'", "}", "self", ".", "ws", ...
on browser wrap browser's websocket connection into one function, if the connection drop or close, try to reconnect itself.
[ "on", "browser", "wrap", "browser", "s", "websocket", "connection", "into", "one", "function", "if", "the", "connection", "drop", "or", "close", "try", "to", "reconnect", "itself", "." ]
6d88aa1e8cc21384aa918c3f9526fe61aa92483f
https://github.com/jefftham/wsm/blob/6d88aa1e8cc21384aa918c3f9526fe61aa92483f/lib/wsm.js#L172-L205
train
Ustimov/node-red-flow-drawer
src/red/localfilesystem.js
getLocalNodeFiles
function getLocalNodeFiles(dir) { dir = path.resolve(dir); var result = []; var files = []; var icons = []; try { files = fs.readdirSync(dir); } catch(err) { return {files: [], icons: []}; } files.sort(); files.forEach(function(fn) { var stats = fs.statSync(p...
javascript
function getLocalNodeFiles(dir) { dir = path.resolve(dir); var result = []; var files = []; var icons = []; try { files = fs.readdirSync(dir); } catch(err) { return {files: [], icons: []}; } files.sort(); files.forEach(function(fn) { var stats = fs.statSync(p...
[ "function", "getLocalNodeFiles", "(", "dir", ")", "{", "dir", "=", "path", ".", "resolve", "(", "dir", ")", ";", "var", "result", "=", "[", "]", ";", "var", "files", "=", "[", "]", ";", "var", "icons", "=", "[", "]", ";", "try", "{", "files", "...
Synchronously walks the directory looking for node files. Emits 'node-icon-dir' events for an icon dirs found @param dir the directory to search @return an array of fully-qualified paths to .js files
[ "Synchronously", "walks", "the", "directory", "looking", "for", "node", "files", ".", "Emits", "node", "-", "icon", "-", "dir", "events", "for", "an", "icon", "dirs", "found" ]
58bb5f760d6800f41b9557e030b1ea7db2db02c0
https://github.com/Ustimov/node-red-flow-drawer/blob/58bb5f760d6800f41b9557e030b1ea7db2db02c0/src/red/localfilesystem.js#L74-L108
train
Ustimov/node-red-flow-drawer
src/red/localfilesystem.js
scanTreeForNodesModules
function scanTreeForNodesModules(moduleName) { var dir = settings.coreNodesDir; var results = []; var userDir; if (settings.userDir) { userDir = path.join(settings.userDir,"node_modules"); results = scanDirForNodesModules(userDir,moduleName); results.forEach(function(r) { r.loca...
javascript
function scanTreeForNodesModules(moduleName) { var dir = settings.coreNodesDir; var results = []; var userDir; if (settings.userDir) { userDir = path.join(settings.userDir,"node_modules"); results = scanDirForNodesModules(userDir,moduleName); results.forEach(function(r) { r.loca...
[ "function", "scanTreeForNodesModules", "(", "moduleName", ")", "{", "var", "dir", "=", "settings", ".", "coreNodesDir", ";", "var", "results", "=", "[", "]", ";", "var", "userDir", ";", "if", "(", "settings", ".", "userDir", ")", "{", "userDir", "=", "pa...
Scans the node_modules path for nodes @param moduleName the name of the module to be found @return a list of node modules: {dir,package}
[ "Scans", "the", "node_modules", "path", "for", "nodes" ]
58bb5f760d6800f41b9557e030b1ea7db2db02c0
https://github.com/Ustimov/node-red-flow-drawer/blob/58bb5f760d6800f41b9557e030b1ea7db2db02c0/src/red/localfilesystem.js#L163-L186
train
NickCis/polygonize
src/Graph.js
validateGeoJson
function validateGeoJson(geoJson) { if (!geoJson) throw new Error('No geojson passed'); if (geoJson.type !== 'FeatureCollection' && geoJson.type !== 'GeometryCollection' && geoJson.type !== 'MultiLineString' && geoJson.type !== 'LineString' && geoJson.type !== 'Feature' ) throw new Error(...
javascript
function validateGeoJson(geoJson) { if (!geoJson) throw new Error('No geojson passed'); if (geoJson.type !== 'FeatureCollection' && geoJson.type !== 'GeometryCollection' && geoJson.type !== 'MultiLineString' && geoJson.type !== 'LineString' && geoJson.type !== 'Feature' ) throw new Error(...
[ "function", "validateGeoJson", "(", "geoJson", ")", "{", "if", "(", "!", "geoJson", ")", "throw", "new", "Error", "(", "'No geojson passed'", ")", ";", "if", "(", "geoJson", ".", "type", "!==", "'FeatureCollection'", "&&", "geoJson", ".", "type", "!==", "'...
Validates the geoJson. @param {Geojson} geoJson - input geoJson. @throws {Error} if geoJson is invalid.
[ "Validates", "the", "geoJson", "." ]
f8f9ea78debfdfd1d60a7429ddf6ba64fb54d0cc
https://github.com/NickCis/polygonize/blob/f8f9ea78debfdfd1d60a7429ddf6ba64fb54d0cc/src/Graph.js#L12-L23
train
discolabs/grunt-shopify-theme-settings
tasks/shopify_theme_settings.js
getCombinedTemplateDirectory
function getCombinedTemplateDirectory(templateDirectories) { // Automatically track and clean up files at exit. temp.track(); // Create a temporary directory to hold our template files. var combinedTemplateDirectory = temp.mkdirSync('templates'); // Copy templates from our source directories into ...
javascript
function getCombinedTemplateDirectory(templateDirectories) { // Automatically track and clean up files at exit. temp.track(); // Create a temporary directory to hold our template files. var combinedTemplateDirectory = temp.mkdirSync('templates'); // Copy templates from our source directories into ...
[ "function", "getCombinedTemplateDirectory", "(", "templateDirectories", ")", "{", "// Automatically track and clean up files at exit.", "temp", ".", "track", "(", ")", ";", "// Create a temporary directory to hold our template files.", "var", "combinedTemplateDirectory", "=", "temp...
Given a list of template directories, compile them into a single template directory. Templates with the same name will be overridden, with preference given to those first in the list. @param templateDirectories @return string
[ "Given", "a", "list", "of", "template", "directories", "compile", "them", "into", "a", "single", "template", "directory", ".", "Templates", "with", "the", "same", "name", "will", "be", "overridden", "with", "preference", "given", "to", "those", "first", "in", ...
31ac81131de393ef4d5715f2d90a5641c8d991f8
https://github.com/discolabs/grunt-shopify-theme-settings/blob/31ac81131de393ef4d5715f2d90a5641c8d991f8/tasks/shopify_theme_settings.js#L99-L116
train
discolabs/grunt-shopify-theme-settings
tasks/shopify_theme_settings.js
addSwigFilters
function addSwigFilters() { /** * Zero padding function. * Used as both a filter and internally here. * * @param input * @param length * @returns {string} */ function zeropad(input, length) { input = input + ''; // Ensure input is a string. length = length || 2; /...
javascript
function addSwigFilters() { /** * Zero padding function. * Used as both a filter and internally here. * * @param input * @param length * @returns {string} */ function zeropad(input, length) { input = input + ''; // Ensure input is a string. length = length || 2; /...
[ "function", "addSwigFilters", "(", ")", "{", "/**\n * Zero padding function.\n * Used as both a filter and internally here.\n *\n * @param input\n * @param length\n * @returns {string}\n */", "function", "zeropad", "(", "input", ",", "length", ")", "{", "input...
Add some custom filters to Swig for use in templates.
[ "Add", "some", "custom", "filters", "to", "Swig", "for", "use", "in", "templates", "." ]
31ac81131de393ef4d5715f2d90a5641c8d991f8
https://github.com/discolabs/grunt-shopify-theme-settings/blob/31ac81131de393ef4d5715f2d90a5641c8d991f8/tasks/shopify_theme_settings.js#L121-L173
train
discolabs/grunt-shopify-theme-settings
tasks/shopify_theme_settings.js
zeropad
function zeropad(input, length) { input = input + ''; // Ensure input is a string. length = length || 2; // Ensure a length is set. return input.length >= length ? input : new Array(length - input.length + 1).join('0') + input; }
javascript
function zeropad(input, length) { input = input + ''; // Ensure input is a string. length = length || 2; // Ensure a length is set. return input.length >= length ? input : new Array(length - input.length + 1).join('0') + input; }
[ "function", "zeropad", "(", "input", ",", "length", ")", "{", "input", "=", "input", "+", "''", ";", "// Ensure input is a string.", "length", "=", "length", "||", "2", ";", "// Ensure a length is set.", "return", "input", ".", "length", ">=", "length", "?", ...
Zero padding function. Used as both a filter and internally here. @param input @param length @returns {string}
[ "Zero", "padding", "function", ".", "Used", "as", "both", "a", "filter", "and", "internally", "here", "." ]
31ac81131de393ef4d5715f2d90a5641c8d991f8
https://github.com/discolabs/grunt-shopify-theme-settings/blob/31ac81131de393ef4d5715f2d90a5641c8d991f8/tasks/shopify_theme_settings.js#L131-L135
train
jhermsmeier/gulp-rm
index.js
rmdirWalk
function rmdirWalk( ls, done ) { if( ls.length === 0 ) return done() fs.rmdir( ls.shift().path, function( error ) { if( error ) log( error.message ) rmdirWalk( ls, done ) }) }
javascript
function rmdirWalk( ls, done ) { if( ls.length === 0 ) return done() fs.rmdir( ls.shift().path, function( error ) { if( error ) log( error.message ) rmdirWalk( ls, done ) }) }
[ "function", "rmdirWalk", "(", "ls", ",", "done", ")", "{", "if", "(", "ls", ".", "length", "===", "0", ")", "return", "done", "(", ")", "fs", ".", "rmdir", "(", "ls", ".", "shift", "(", ")", ".", "path", ",", "function", "(", "error", ")", "{",...
Walk an array of directories and delete one after another @param {Array<Object>} ls @param {Function} done
[ "Walk", "an", "array", "of", "directories", "and", "delete", "one", "after", "another" ]
73a223b13b55030b0201da313124a42f4163eafb
https://github.com/jhermsmeier/gulp-rm/blob/73a223b13b55030b0201da313124a42f4163eafb/index.js#L12-L18
train
koajs/atomic-session
lib/mongodb.js
Session
function Session(context) { this.context = context this.cookies = context.cookies this.update = this.update.bind(this) }
javascript
function Session(context) { this.context = context this.cookies = context.cookies this.update = this.update.bind(this) }
[ "function", "Session", "(", "context", ")", "{", "this", ".", "context", "=", "context", "this", ".", "cookies", "=", "context", ".", "cookies", "this", ".", "update", "=", "this", ".", "update", ".", "bind", "(", "this", ")", "}" ]
Session constructor.
[ "Session", "constructor", "." ]
5ef7ccd8ae2189e1e35a9422670f83d7b7ba079a
https://github.com/koajs/atomic-session/blob/5ef7ccd8ae2189e1e35a9422670f83d7b7ba079a/lib/mongodb.js#L90-L94
train
adriann0/npm-aprs-parser
lib/SymbolIconUtils.js
function (symbol) { return symbolDict[symbol.charCodeAt(0)] && symbolDict[symbol.charCodeAt(0)][symbol.charCodeAt(1)] || symbolDict[symbol.charCodeAt(1)] && symbolDict[symbol.charCodeAt(0)][symbol.charCodeAt(0)]; }
javascript
function (symbol) { return symbolDict[symbol.charCodeAt(0)] && symbolDict[symbol.charCodeAt(0)][symbol.charCodeAt(1)] || symbolDict[symbol.charCodeAt(1)] && symbolDict[symbol.charCodeAt(0)][symbol.charCodeAt(0)]; }
[ "function", "(", "symbol", ")", "{", "return", "symbolDict", "[", "symbol", ".", "charCodeAt", "(", "0", ")", "]", "&&", "symbolDict", "[", "symbol", ".", "charCodeAt", "(", "0", ")", "]", "[", "symbol", ".", "charCodeAt", "(", "1", ")", "]", "||", ...
table + symbol id
[ "table", "+", "symbol", "id" ]
c189e758cca0641a37c426ebd4c9e0a880d6bdb3
https://github.com/adriann0/npm-aprs-parser/blob/c189e758cca0641a37c426ebd4c9e0a880d6bdb3/lib/SymbolIconUtils.js#L204-L206
train
LastLeaf/epub-generator
lib/builder.js
function(){ STATIC_FILES.forEach(function(file){ addFile(fs.createReadStream(__dirname + '/templates/' + file), { name: file }); }); }
javascript
function(){ STATIC_FILES.forEach(function(file){ addFile(fs.createReadStream(__dirname + '/templates/' + file), { name: file }); }); }
[ "function", "(", ")", "{", "STATIC_FILES", ".", "forEach", "(", "function", "(", "file", ")", "{", "addFile", "(", "fs", ".", "createReadStream", "(", "__dirname", "+", "'/templates/'", "+", "file", ")", ",", "{", "name", ":", "file", "}", ")", ";", ...
add static files
[ "add", "static", "files" ]
de7191f990c6c61dc4ff55238e79be7517e46bc3
https://github.com/LastLeaf/epub-generator/blob/de7191f990c6c61dc4ff55238e79be7517e46bc3/lib/builder.js#L46-L50
train
LastLeaf/epub-generator
lib/builder.js
function(){ for(var i=0; i<DYNAMIC_FILES.length; i++) { addFile(dynamicFilesCompiled[i](options), { name: DYNAMIC_FILES[i] }); } }
javascript
function(){ for(var i=0; i<DYNAMIC_FILES.length; i++) { addFile(dynamicFilesCompiled[i](options), { name: DYNAMIC_FILES[i] }); } }
[ "function", "(", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "DYNAMIC_FILES", ".", "length", ";", "i", "++", ")", "{", "addFile", "(", "dynamicFilesCompiled", "[", "i", "]", "(", "options", ")", ",", "{", "name", ":", "DYNAMIC_FILES"...
add dynamic files
[ "add", "dynamic", "files" ]
de7191f990c6c61dc4ff55238e79be7517e46bc3
https://github.com/LastLeaf/epub-generator/blob/de7191f990c6c61dc4ff55238e79be7517e46bc3/lib/builder.js#L53-L57
train
nebrius/transport-logger
lib/transportlogger.js
Transport
function Transport(settings, levels) { settings = settings || {}; this.levels = levels; // Set the base settings this.settings = { levels: levels, timestamp: !!settings.timestamp, prependLevel: !!settings.prependLevel, colorize: !!settings.colorize, name: settings.name }; // Parse the ...
javascript
function Transport(settings, levels) { settings = settings || {}; this.levels = levels; // Set the base settings this.settings = { levels: levels, timestamp: !!settings.timestamp, prependLevel: !!settings.prependLevel, colorize: !!settings.colorize, name: settings.name }; // Parse the ...
[ "function", "Transport", "(", "settings", ",", "levels", ")", "{", "settings", "=", "settings", "||", "{", "}", ";", "this", ".", "levels", "=", "levels", ";", "// Set the base settings", "this", ".", "settings", "=", "{", "levels", ":", "levels", ",", "...
Settings for creating a transport. @name module:transport-logger.TransportSettings @type Object @property {Boolean} [timestamp] Timestamps each log message with a UTC date (default false) @property {Boolean} [prependLevel] Prepends each log message with the log level (default false) @property {String} [minLevel] The m...
[ "Settings", "for", "creating", "a", "transport", "." ]
d9a0eef021ac9511ed215e688ddb4ca97392eea1
https://github.com/nebrius/transport-logger/blob/d9a0eef021ac9511ed215e688ddb4ca97392eea1/lib/transportlogger.js#L103-L145
train
nebrius/transport-logger
lib/transportlogger.js
Logger
function Logger(transports, settings) { var i, len, transport, levels, transportInstances = [], names = {}; // Normalize the inputs if (!transports) { transports = [{}]; } else if (!Array.isArray(transports)) { transports = [transports]; } settings = settings || {}; levels...
javascript
function Logger(transports, settings) { var i, len, transport, levels, transportInstances = [], names = {}; // Normalize the inputs if (!transports) { transports = [{}]; } else if (!Array.isArray(transports)) { transports = [transports]; } settings = settings || {}; levels...
[ "function", "Logger", "(", "transports", ",", "settings", ")", "{", "var", "i", ",", "len", ",", "transport", ",", "levels", ",", "transportInstances", "=", "[", "]", ",", "names", "=", "{", "}", ";", "// Normalize the inputs", "if", "(", "!", "transport...
The global settings for the logger that applies to all transports @name module:transport-logger.GlobalSettings @type Object @property {Object} [levels] The log levels @property {String} <log-level> The key specifies the log level, and the value specifies the color. Colors are one of 'black', 'red', 'green', 'yellow', ...
[ "The", "global", "settings", "for", "the", "logger", "that", "applies", "to", "all", "transports" ]
d9a0eef021ac9511ed215e688ddb4ca97392eea1
https://github.com/nebrius/transport-logger/blob/d9a0eef021ac9511ed215e688ddb4ca97392eea1/lib/transportlogger.js#L217-L285
train
jan-swiecki/node-autowire
lib/ModuleFinder.js
mapAllNames
function mapAllNames(path) { log("[%s] Mapping %s", self.parentModuleName, path); fs.readdirSync(path).forEach(function(p){ var absPath = PATH.resolve(path+PATH.sep+p); var lstat = fs.lstatSync(absPath); if(lstat.isFile() && isModule(p)) { var name = getModuleName(p); self.upd...
javascript
function mapAllNames(path) { log("[%s] Mapping %s", self.parentModuleName, path); fs.readdirSync(path).forEach(function(p){ var absPath = PATH.resolve(path+PATH.sep+p); var lstat = fs.lstatSync(absPath); if(lstat.isFile() && isModule(p)) { var name = getModuleName(p); self.upd...
[ "function", "mapAllNames", "(", "path", ")", "{", "log", "(", "\"[%s] Mapping %s\"", ",", "self", ".", "parentModuleName", ",", "path", ")", ";", "fs", ".", "readdirSync", "(", "path", ")", ".", "forEach", "(", "function", "(", "p", ")", "{", "var", "a...
Saves absPath -> filename mapping in the map @param path
[ "Saves", "absPath", "-", ">", "filename", "mapping", "in", "the", "map" ]
a5bddb8d1d581ffab9c23e2a50c8fedede83ec1b
https://github.com/jan-swiecki/node-autowire/blob/a5bddb8d1d581ffab9c23e2a50c8fedede83ec1b/lib/ModuleFinder.js#L338-L363
train
jan-swiecki/node-autowire
lib/ModuleFinder.js
findProjectRoot
function findProjectRoot(startPath) { log.trace("findProjectRoot startPath = %s", startPath); if(isDiskRoot()) { if(hasPackageJson()) { return startPath; } else { throw new Error("Cannot find project root"); } } else if(hasPackageJson()) { return startPath; } else...
javascript
function findProjectRoot(startPath) { log.trace("findProjectRoot startPath = %s", startPath); if(isDiskRoot()) { if(hasPackageJson()) { return startPath; } else { throw new Error("Cannot find project root"); } } else if(hasPackageJson()) { return startPath; } else...
[ "function", "findProjectRoot", "(", "startPath", ")", "{", "log", ".", "trace", "(", "\"findProjectRoot startPath = %s\"", ",", "startPath", ")", ";", "if", "(", "isDiskRoot", "(", ")", ")", "{", "if", "(", "hasPackageJson", "(", ")", ")", "{", "return", "...
Going up the folder tree returns the first folder with package.json present. @param startPath @returns {*}
[ "Going", "up", "the", "folder", "tree", "returns", "the", "first", "folder", "with", "package", ".", "json", "present", "." ]
a5bddb8d1d581ffab9c23e2a50c8fedede83ec1b
https://github.com/jan-swiecki/node-autowire/blob/a5bddb8d1d581ffab9c23e2a50c8fedede83ec1b/lib/ModuleFinder.js#L400-L421
train
cettia/cettia-protocol
lib/transport-http-server.js
createLongpollTransport
function createLongpollTransport(req, res) { // The current response which can be used to send a message or close the connection. It's not // null when it's available and null when it's not available. var response; // A flag to mark this transport is aborted. It's used when `response` is not available, if // ...
javascript
function createLongpollTransport(req, res) { // The current response which can be used to send a message or close the connection. It's not // null when it's available and null when it's not available. var response; // A flag to mark this transport is aborted. It's used when `response` is not available, if // ...
[ "function", "createLongpollTransport", "(", "req", ",", "res", ")", "{", "// The current response which can be used to send a message or close the connection. It's not", "// null when it's available and null when it's not available.", "var", "response", ";", "// A flag to mark this transpo...
The client performs a HTTP persistent connection and the server ends the response with data. Then, the client receives it and performs a request again and again.
[ "The", "client", "performs", "a", "HTTP", "persistent", "connection", "and", "the", "server", "ends", "the", "response", "with", "data", ".", "Then", "the", "client", "receives", "it", "and", "performs", "a", "request", "again", "and", "again", "." ]
9af3b578a9ae7b33099932903b52faeb2ca92528
https://github.com/cettia/cettia-protocol/blob/9af3b578a9ae7b33099932903b52faeb2ca92528/lib/transport-http-server.js#L271-L425
train
eladnava/koa-async
wrapper.js
wrapAsyncMethod
function wrapAsyncMethod(fn, ctx) { return function() { // Obtain function arguments var args = [].slice.call(arguments); // Return a thunkified function that receives a done callback return new Promise(function(resolve, reject) { // Add a custom callback to provided arg...
javascript
function wrapAsyncMethod(fn, ctx) { return function() { // Obtain function arguments var args = [].slice.call(arguments); // Return a thunkified function that receives a done callback return new Promise(function(resolve, reject) { // Add a custom callback to provided arg...
[ "function", "wrapAsyncMethod", "(", "fn", ",", "ctx", ")", "{", "return", "function", "(", ")", "{", "// Obtain function arguments", "var", "args", "=", "[", "]", ".", "slice", ".", "call", "(", "arguments", ")", ";", "// Return a thunkified function that receiv...
Wrap async methods inside a promise
[ "Wrap", "async", "methods", "inside", "a", "promise" ]
e1f2b3a483c0c8dde853bbc29860b96bcf91707a
https://github.com/eladnava/koa-async/blob/e1f2b3a483c0c8dde853bbc29860b96bcf91707a/wrapper.js#L4-L26
train
eladnava/koa-async
wrapper.js
wrapAsync
function wrapAsync() { // Traverse async methods for (var fn in async) { // Promisify the method async[fn] = wrapAsyncMethod(async[fn], async); } // Return co-friendly async object return async; }
javascript
function wrapAsync() { // Traverse async methods for (var fn in async) { // Promisify the method async[fn] = wrapAsyncMethod(async[fn], async); } // Return co-friendly async object return async; }
[ "function", "wrapAsync", "(", ")", "{", "// Traverse async methods", "for", "(", "var", "fn", "in", "async", ")", "{", "// Promisify the method", "async", "[", "fn", "]", "=", "wrapAsyncMethod", "(", "async", "[", "fn", "]", ",", "async", ")", ";", "}", ...
Wraps an async object with co-friendly functions
[ "Wraps", "an", "async", "object", "with", "co", "-", "friendly", "functions" ]
e1f2b3a483c0c8dde853bbc29860b96bcf91707a
https://github.com/eladnava/koa-async/blob/e1f2b3a483c0c8dde853bbc29860b96bcf91707a/wrapper.js#L29-L38
train
silas/node-mesos
lib/marathon.js
Marathon
function Marathon(opts) { if (!(this instanceof Marathon)) { return new Marathon(opts); } opts = opts || {}; if (!opts.baseUrl) { opts.baseUrl = (opts.secure ? 'https:' : 'http:') + '//' + (opts.host || '127.0.0.1') + ':' + (opts.port || '8080') + '/v2'; } opts.name = 'marathon'; opt...
javascript
function Marathon(opts) { if (!(this instanceof Marathon)) { return new Marathon(opts); } opts = opts || {}; if (!opts.baseUrl) { opts.baseUrl = (opts.secure ? 'https:' : 'http:') + '//' + (opts.host || '127.0.0.1') + ':' + (opts.port || '8080') + '/v2'; } opts.name = 'marathon'; opt...
[ "function", "Marathon", "(", "opts", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Marathon", ")", ")", "{", "return", "new", "Marathon", "(", "opts", ")", ";", "}", "opts", "=", "opts", "||", "{", "}", ";", "if", "(", "!", "opts", ".", ...
Initialize a new `Marathon` client. @param {Object} opts
[ "Initialize", "a", "new", "Marathon", "client", "." ]
157ca9fa9cfeb13def49cf8f6ef53ff7e708da95
https://github.com/silas/node-mesos/blob/157ca9fa9cfeb13def49cf8f6ef53ff7e708da95/lib/marathon.js#L25-L44
train
jordangarcia/nuclear-js-react-addons
src/nuclearMixin.js
getState
function getState(reactor, data) { var state = {} each(data, function(value, key) { state[key] = reactor.evaluate(value) }) return state }
javascript
function getState(reactor, data) { var state = {} each(data, function(value, key) { state[key] = reactor.evaluate(value) }) return state }
[ "function", "getState", "(", "reactor", ",", "data", ")", "{", "var", "state", "=", "{", "}", "each", "(", "data", ",", "function", "(", "value", ",", "key", ")", "{", "state", "[", "key", "]", "=", "reactor", ".", "evaluate", "(", "value", ")", ...
Returns a mapping of the getDataBinding keys to the reactor values
[ "Returns", "a", "mapping", "of", "the", "getDataBinding", "keys", "to", "the", "reactor", "values" ]
5550ebd6ec07bfec01aa557908735142613dcdb3
https://github.com/jordangarcia/nuclear-js-react-addons/blob/5550ebd6ec07bfec01aa557908735142613dcdb3/src/nuclearMixin.js#L18-L24
train
IonicaBizau/fs-file-tree
lib/index.js
fsFileTree
function fsFileTree (inputPath, opts, cb) { let result = {}; if (typeof inputPath === "function") { cb = inputPath; inputPath = process.cwd(); opts = {}; } else if (typeof opts === "function") { cb = opts; if (typeof inputPath === "object") { opts = inputP...
javascript
function fsFileTree (inputPath, opts, cb) { let result = {}; if (typeof inputPath === "function") { cb = inputPath; inputPath = process.cwd(); opts = {}; } else if (typeof opts === "function") { cb = opts; if (typeof inputPath === "object") { opts = inputP...
[ "function", "fsFileTree", "(", "inputPath", ",", "opts", ",", "cb", ")", "{", "let", "result", "=", "{", "}", ";", "if", "(", "typeof", "inputPath", "===", "\"function\"", ")", "{", "cb", "=", "inputPath", ";", "inputPath", "=", "process", ".", "cwd", ...
fsFileTree Get a directory file tree as an object. @name fsFileTree @function @param {String} inputPath The input path. @param {Object} opts An object containing the following fields: - `camelCase` (Boolean): Convert the file names in camelcase format (to be easily accessible using dot notation). - `all` (Boolean): I...
[ "fsFileTree", "Get", "a", "directory", "file", "tree", "as", "an", "object", "." ]
a16cf9258ef96734b4767d546edd17616d61df21
https://github.com/IonicaBizau/fs-file-tree/blob/a16cf9258ef96734b4767d546edd17616d61df21/lib/index.js#L24-L65
train
gragland/react-component-data
src/resolveRecursive.js
walkTree
function walkTree(element, context, mergeProps, visitor) { const Component = element.type; if (typeof Component === 'function') { const props = assign({}, Component.defaultProps, element.props, (mergeProps || {})); let childContext = context; let child; // Are we are a react class? // https:...
javascript
function walkTree(element, context, mergeProps, visitor) { const Component = element.type; if (typeof Component === 'function') { const props = assign({}, Component.defaultProps, element.props, (mergeProps || {})); let childContext = context; let child; // Are we are a react class? // https:...
[ "function", "walkTree", "(", "element", ",", "context", ",", "mergeProps", ",", "visitor", ")", "{", "const", "Component", "=", "element", ".", "type", ";", "if", "(", "typeof", "Component", "===", "'function'", ")", "{", "const", "props", "=", "assign", ...
Recurse an React Element tree, running visitor on each element. If visitor returns `false`, don't call the element's render function or recurse into its child elements
[ "Recurse", "an", "React", "Element", "tree", "running", "visitor", "on", "each", "element", ".", "If", "visitor", "returns", "false", "don", "t", "call", "the", "element", "s", "render", "function", "or", "recurse", "into", "its", "child", "elements" ]
788397f133e4d327e074689f17b3f8e47abdaf2e
https://github.com/gragland/react-component-data/blob/788397f133e4d327e074689f17b3f8e47abdaf2e/src/resolveRecursive.js#L10-L88
train
gragland/react-component-data
src/resolveRecursive.js
getDataFromTree
function getDataFromTree(rootElement, rootContext, fetchRoot, mergeProps, isTopLevel){ //console.log(`Now searching element (${rootElement.type.name || rootElement.type.displayName}):`, rootElement); // Get array of queries (fetchData promises) from tree // This will traverse down recursively looking for fetchD...
javascript
function getDataFromTree(rootElement, rootContext, fetchRoot, mergeProps, isTopLevel){ //console.log(`Now searching element (${rootElement.type.name || rootElement.type.displayName}):`, rootElement); // Get array of queries (fetchData promises) from tree // This will traverse down recursively looking for fetchD...
[ "function", "getDataFromTree", "(", "rootElement", ",", "rootContext", ",", "fetchRoot", ",", "mergeProps", ",", "isTopLevel", ")", "{", "//console.log(`Now searching element (${rootElement.type.name || rootElement.type.displayName}):`, rootElement);", "// Get array of queries (fetchDa...
XXX component Cache
[ "XXX", "component", "Cache" ]
788397f133e4d327e074689f17b3f8e47abdaf2e
https://github.com/gragland/react-component-data/blob/788397f133e4d327e074689f17b3f8e47abdaf2e/src/resolveRecursive.js#L130-L169
train
rksm/estree-to-js
bin/estree-to-js.js
jsonSpec
function jsonSpec() { return parsedArgs.specFile ? read(parsedArgs.specFile).then(JSON.parse) : require("../index").fetch(parsedArgs.urls) .then(mdSource => require("../index").parse(mdSource)) }
javascript
function jsonSpec() { return parsedArgs.specFile ? read(parsedArgs.specFile).then(JSON.parse) : require("../index").fetch(parsedArgs.urls) .then(mdSource => require("../index").parse(mdSource)) }
[ "function", "jsonSpec", "(", ")", "{", "return", "parsedArgs", ".", "specFile", "?", "read", "(", "parsedArgs", ".", "specFile", ")", ".", "then", "(", "JSON", ".", "parse", ")", ":", "require", "(", "\"../index\"", ")", ".", "fetch", "(", "parsedArgs", ...
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- helpers
[ "-", "=", "-", "=", "-", "=", "-", "=", "-", "=", "-", "=", "-", "=", "-", "=", "-", "=", "-", "=", "-", "=", "-", "=", "-", "=", "-", "=", "-", "=", "-", "=", "-", "=", "-", "=", "-", "=", "-", "=", "-", "=", "-", "=", "-", "...
3cb21c9c63ff329651f08197d353965e80551bd2
https://github.com/rksm/estree-to-js/blob/3cb21c9c63ff329651f08197d353965e80551bd2/bin/estree-to-js.js#L53-L58
train
cettia/cettia-protocol
lib/transport-websocket-server.js
createWebSocketTransport
function createWebSocketTransport(ws) { // A transport object. var self = new events.EventEmitter(); // Transport URI contains information like protocol header as query. self.uri = ws.upgradeReq.url; // Simply delegates WebSocket's events to transport and transport's behaviors to WebSocket. ws.onmessage = f...
javascript
function createWebSocketTransport(ws) { // A transport object. var self = new events.EventEmitter(); // Transport URI contains information like protocol header as query. self.uri = ws.upgradeReq.url; // Simply delegates WebSocket's events to transport and transport's behaviors to WebSocket. ws.onmessage = f...
[ "function", "createWebSocketTransport", "(", "ws", ")", "{", "// A transport object.", "var", "self", "=", "new", "events", ".", "EventEmitter", "(", ")", ";", "// Transport URI contains information like protocol header as query.", "self", ".", "uri", "=", "ws", ".", ...
WebSocket is a protocol designed for a full-duplex communications over a TCP connection.
[ "WebSocket", "is", "a", "protocol", "designed", "for", "a", "full", "-", "duplex", "communications", "over", "a", "TCP", "connection", "." ]
9af3b578a9ae7b33099932903b52faeb2ca92528
https://github.com/cettia/cettia-protocol/blob/9af3b578a9ae7b33099932903b52faeb2ca92528/lib/transport-websocket-server.js#L30-L69
train
flightjs/flight-with-state
src/index.js
cloneStateDef
function cloneStateDef(stateDef) { stateDef = (stateDef || {}); return function () { var ctx = this; return Object.keys(stateDef).reduce((state, k) => { var value = stateDef[k]; state[k] = (typeof value === 'function' ? value.call(ctx) : value); return state; ...
javascript
function cloneStateDef(stateDef) { stateDef = (stateDef || {}); return function () { var ctx = this; return Object.keys(stateDef).reduce((state, k) => { var value = stateDef[k]; state[k] = (typeof value === 'function' ? value.call(ctx) : value); return state; ...
[ "function", "cloneStateDef", "(", "stateDef", ")", "{", "stateDef", "=", "(", "stateDef", "||", "{", "}", ")", ";", "return", "function", "(", ")", "{", "var", "ctx", "=", "this", ";", "return", "Object", ".", "keys", "(", "stateDef", ")", ".", "redu...
Returns a function that returns a clone of the object passed to it initially
[ "Returns", "a", "function", "that", "returns", "a", "clone", "of", "the", "object", "passed", "to", "it", "initially" ]
3ccf726bdeff9778aabb04adab351eff3f852f46
https://github.com/flightjs/flight-with-state/blob/3ccf726bdeff9778aabb04adab351eff3f852f46/src/index.js#L8-L18
train
aholstenson/amounts
lib/quantity.js
createUnits
function createUnits(conversions, withNames=false) { const result = {}; conversions.forEach(c => c.names.forEach(name => result[unitToLower(normalizeUnitName(name))] = { name: c.names[0], prefix: c.prefix, scale: c.scale, toBase: c.toBase, fr...
javascript
function createUnits(conversions, withNames=false) { const result = {}; conversions.forEach(c => c.names.forEach(name => result[unitToLower(normalizeUnitName(name))] = { name: c.names[0], prefix: c.prefix, scale: c.scale, toBase: c.toBase, fr...
[ "function", "createUnits", "(", "conversions", ",", "withNames", "=", "false", ")", "{", "const", "result", "=", "{", "}", ";", "conversions", ".", "forEach", "(", "c", "=>", "c", ".", "names", ".", "forEach", "(", "name", "=>", "result", "[", "unitToL...
Map a list of conversions into an object where each name is represented as a key.
[ "Map", "a", "list", "of", "conversions", "into", "an", "object", "where", "each", "name", "is", "represented", "as", "a", "key", "." ]
04fdc68b782918eeaeae62bfcdcb0f20f7afb527
https://github.com/aholstenson/amounts/blob/04fdc68b782918eeaeae62bfcdcb0f20f7afb527/lib/quantity.js#L113-L129
train
aholstenson/amounts
lib/quantity.js
createUnitRegex
function createUnitRegex(units) { return Object.keys(units) .sort((a, b) => b.length - a.length) .map(unit => unit.length > 2 ? caseInsensitivePart(unit) : unit) .join('|'); }
javascript
function createUnitRegex(units) { return Object.keys(units) .sort((a, b) => b.length - a.length) .map(unit => unit.length > 2 ? caseInsensitivePart(unit) : unit) .join('|'); }
[ "function", "createUnitRegex", "(", "units", ")", "{", "return", "Object", ".", "keys", "(", "units", ")", ".", "sort", "(", "(", "a", ",", "b", ")", "=>", "b", ".", "length", "-", "a", ".", "length", ")", ".", "map", "(", "unit", "=>", "unit", ...
Create a regex for the given associative object.
[ "Create", "a", "regex", "for", "the", "given", "associative", "object", "." ]
04fdc68b782918eeaeae62bfcdcb0f20f7afb527
https://github.com/aholstenson/amounts/blob/04fdc68b782918eeaeae62bfcdcb0f20f7afb527/lib/quantity.js#L154-L159
train
EspressoLogicCafe/APICreatorSDK
APICreatorSDK.js
function (url, key, password) { var deferred, options, headers, liveapicreator; liveapicreator = _.extend({}, SDK); liveapicreator.url = this.stripWrappingSlashes(url); liveapicreator.params = _.pick(URL.parse(url), 'host', 'path', 'port'); liveapicreator.params.headers = {}; if (url.match('https')) ...
javascript
function (url, key, password) { var deferred, options, headers, liveapicreator; liveapicreator = _.extend({}, SDK); liveapicreator.url = this.stripWrappingSlashes(url); liveapicreator.params = _.pick(URL.parse(url), 'host', 'path', 'port'); liveapicreator.params.headers = {}; if (url.match('https')) ...
[ "function", "(", "url", ",", "key", ",", "password", ")", "{", "var", "deferred", ",", "options", ",", "headers", ",", "liveapicreator", ";", "liveapicreator", "=", "_", ".", "extend", "(", "{", "}", ",", "SDK", ")", ";", "liveapicreator", ".", "url", ...
The default method of connecting to an API. Returns an instance of this library and initializes a promise used to make requests on API endpoints. @param string url the API url base e.g. http://localhost:8080/rest/default/demo/v1 @param string key an API key, typically found in Logic Designer's Security section. When c...
[ "The", "default", "method", "of", "connecting", "to", "an", "API", ".", "Returns", "an", "instance", "of", "this", "library", "and", "initializes", "a", "promise", "used", "to", "make", "requests", "on", "API", "endpoints", "." ]
ada0acf7c9e91807bcb781ba233282915ed13770
https://github.com/EspressoLogicCafe/APICreatorSDK/blob/ada0acf7c9e91807bcb781ba233282915ed13770/APICreatorSDK.js#L102-L149
train
EspressoLogicCafe/APICreatorSDK
APICreatorSDK.js
function (options, headers) { if (!headers) { headers = {}; } if (options.headers) { var headers = options.headers; headers = _.extend(headers, this.headers, headers); } return options; }
javascript
function (options, headers) { if (!headers) { headers = {}; } if (options.headers) { var headers = options.headers; headers = _.extend(headers, this.headers, headers); } return options; }
[ "function", "(", "options", ",", "headers", ")", "{", "if", "(", "!", "headers", ")", "{", "headers", "=", "{", "}", ";", "}", "if", "(", "options", ".", "headers", ")", "{", "var", "headers", "=", "options", ".", "headers", ";", "headers", "=", ...
Internal method for merging liveapicreatorsdk.headers attributes with those passed in via headers. @param object options a collection of URL.parse(url) attributes, which may or may not contain options.headers @param object headers a collection of header attributes to be appended to the request
[ "Internal", "method", "for", "merging", "liveapicreatorsdk", ".", "headers", "attributes", "with", "those", "passed", "in", "via", "headers", "." ]
ada0acf7c9e91807bcb781ba233282915ed13770
https://github.com/EspressoLogicCafe/APICreatorSDK/blob/ada0acf7c9e91807bcb781ba233282915ed13770/APICreatorSDK.js#L173-L180
train
stehefan/postcss-env-replace
index.js
verifyParameters
function verifyParameters(replacements, value, decl, environment) { if (undefined === replacements[value]) { throw decl.error( 'Unknown variable ' + value, { plugin: plugin.name } ); } if (undefined === replacements[value][environment]) { throw decl.error( ...
javascript
function verifyParameters(replacements, value, decl, environment) { if (undefined === replacements[value]) { throw decl.error( 'Unknown variable ' + value, { plugin: plugin.name } ); } if (undefined === replacements[value][environment]) { throw decl.error( ...
[ "function", "verifyParameters", "(", "replacements", ",", "value", ",", "decl", ",", "environment", ")", "{", "if", "(", "undefined", "===", "replacements", "[", "value", "]", ")", "{", "throw", "decl", ".", "error", "(", "'Unknown variable '", "+", "value",...
Verifies the found options and checks whether they are configured or not @param {Object} replacements - Object containing replacement information per environment @param {String} value - String found inside the declaration that should be replaced @param {Declaration} decl - Declaration currently examined @param {String...
[ "Verifies", "the", "found", "options", "and", "checks", "whether", "they", "are", "configured", "or", "not" ]
f6f879dbcc2cb7268f16d9e2bc6a931f609ead13
https://github.com/stehefan/postcss-env-replace/blob/f6f879dbcc2cb7268f16d9e2bc6a931f609ead13/index.js#L19-L34
train
stehefan/postcss-env-replace
index.js
walkDeclaration
function walkDeclaration(decl, environment, replacements) { decl.value = decl.value.replace(functionRegex, function (match, value) { verifyParameters(replacements, value, decl, environment); return replacements[value][environment]; }); }
javascript
function walkDeclaration(decl, environment, replacements) { decl.value = decl.value.replace(functionRegex, function (match, value) { verifyParameters(replacements, value, decl, environment); return replacements[value][environment]; }); }
[ "function", "walkDeclaration", "(", "decl", ",", "environment", ",", "replacements", ")", "{", "decl", ".", "value", "=", "decl", ".", "value", ".", "replace", "(", "functionRegex", ",", "function", "(", "match", ",", "value", ")", "{", "verifyParameters", ...
Parses one CSS-declaration from the given AST and checks for possible replacements @param {Declaration} decl - one CSS-Declaration from the AST @param {String} environment - current environment @param {String} replacements - Object containing all replacements that we have inside the options
[ "Parses", "one", "CSS", "-", "declaration", "from", "the", "given", "AST", "and", "checks", "for", "possible", "replacements" ]
f6f879dbcc2cb7268f16d9e2bc6a931f609ead13
https://github.com/stehefan/postcss-env-replace/blob/f6f879dbcc2cb7268f16d9e2bc6a931f609ead13/index.js#L45-L51
train
silas/node-mesos
lib/chronos.js
Chronos
function Chronos(opts) { if (!(this instanceof Chronos)) { return new Chronos(opts); } opts = opts || {}; if (!opts.baseUrl) { opts.baseUrl = (opts.secure ? 'https:' : 'http:') + '//' + (opts.host || '127.0.0.1') + ':' + (opts.port || '4400') + '/scheduler'; } opts.name = 'chronos'; ...
javascript
function Chronos(opts) { if (!(this instanceof Chronos)) { return new Chronos(opts); } opts = opts || {}; if (!opts.baseUrl) { opts.baseUrl = (opts.secure ? 'https:' : 'http:') + '//' + (opts.host || '127.0.0.1') + ':' + (opts.port || '4400') + '/scheduler'; } opts.name = 'chronos'; ...
[ "function", "Chronos", "(", "opts", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Chronos", ")", ")", "{", "return", "new", "Chronos", "(", "opts", ")", ";", "}", "opts", "=", "opts", "||", "{", "}", ";", "if", "(", "!", "opts", ".", "b...
Initialize a new `Chronos` client. @param {Object} opts
[ "Initialize", "a", "new", "Chronos", "client", "." ]
157ca9fa9cfeb13def49cf8f6ef53ff7e708da95
https://github.com/silas/node-mesos/blob/157ca9fa9cfeb13def49cf8f6ef53ff7e708da95/lib/chronos.js#L23-L42
train
Kong/galileo-agent-node
lib/helpers.js
function (testOverride) { var ret = '127.0.0.1' os = testOverride || os var interfaces = os.networkInterfaces() Object.keys(interfaces).forEach(function (el) { interfaces[el].forEach(function (el2) { if (!el2.internal && el2.family === 'IPv4') { ret = el2.address } ...
javascript
function (testOverride) { var ret = '127.0.0.1' os = testOverride || os var interfaces = os.networkInterfaces() Object.keys(interfaces).forEach(function (el) { interfaces[el].forEach(function (el2) { if (!el2.internal && el2.family === 'IPv4') { ret = el2.address } ...
[ "function", "(", "testOverride", ")", "{", "var", "ret", "=", "'127.0.0.1'", "os", "=", "testOverride", "||", "os", "var", "interfaces", "=", "os", ".", "networkInterfaces", "(", ")", "Object", ".", "keys", "(", "interfaces", ")", ".", "forEach", "(", "f...
get server address from network interface
[ "get", "server", "address", "from", "network", "interface" ]
651626bbf82c66e0b1786992a7fd7e18845f076b
https://github.com/Kong/galileo-agent-node/blob/651626bbf82c66e0b1786992a7fd7e18845f076b/lib/helpers.js#L20-L34
train
Kong/galileo-agent-node
lib/helpers.js
function (string) { if (!string || string === '' || string.indexOf('\r\n') === -1) { return { version: 'HTTP/1.1', statusText: '' } } var lines = string.split('\r\n') var status = lines.shift() // Remove empty strings lines = lines.filter(Boolean) // Parse stat...
javascript
function (string) { if (!string || string === '' || string.indexOf('\r\n') === -1) { return { version: 'HTTP/1.1', statusText: '' } } var lines = string.split('\r\n') var status = lines.shift() // Remove empty strings lines = lines.filter(Boolean) // Parse stat...
[ "function", "(", "string", ")", "{", "if", "(", "!", "string", "||", "string", "===", "''", "||", "string", ".", "indexOf", "(", "'\\r\\n'", ")", "===", "-", "1", ")", "{", "return", "{", "version", ":", "'HTTP/1.1'", ",", "statusText", ":", "''", ...
convert header string to assoc array
[ "convert", "header", "string", "to", "assoc", "array" ]
651626bbf82c66e0b1786992a7fd7e18845f076b
https://github.com/Kong/galileo-agent-node/blob/651626bbf82c66e0b1786992a7fd7e18845f076b/lib/helpers.js#L61-L92
train
Kong/galileo-agent-node
lib/helpers.js
function (line) { var pieces = line.split(' ') // Header string pieces var output = { version: pieces.shift(), status: parseFloat(pieces.shift()), statusText: pieces.join(' ') } return output }
javascript
function (line) { var pieces = line.split(' ') // Header string pieces var output = { version: pieces.shift(), status: parseFloat(pieces.shift()), statusText: pieces.join(' ') } return output }
[ "function", "(", "line", ")", "{", "var", "pieces", "=", "line", ".", "split", "(", "' '", ")", "// Header string pieces", "var", "output", "=", "{", "version", ":", "pieces", ".", "shift", "(", ")", ",", "status", ":", "parseFloat", "(", "pieces", "."...
parse status line into an object
[ "parse", "status", "line", "into", "an", "object" ]
651626bbf82c66e0b1786992a7fd7e18845f076b
https://github.com/Kong/galileo-agent-node/blob/651626bbf82c66e0b1786992a7fd7e18845f076b/lib/helpers.js#L97-L108
train
Kong/galileo-agent-node
lib/helpers.js
function (obj) { // sanity check if (!obj || typeof obj !== 'object') { return [] } var results = [] Object.keys(obj).forEach(function (name) { // nested values in query string if (typeof obj[name] === 'object') { obj[name].forEach(function (value) { results.pus...
javascript
function (obj) { // sanity check if (!obj || typeof obj !== 'object') { return [] } var results = [] Object.keys(obj).forEach(function (name) { // nested values in query string if (typeof obj[name] === 'object') { obj[name].forEach(function (value) { results.pus...
[ "function", "(", "obj", ")", "{", "// sanity check", "if", "(", "!", "obj", "||", "typeof", "obj", "!==", "'object'", ")", "{", "return", "[", "]", "}", "var", "results", "=", "[", "]", "Object", ".", "keys", "(", "obj", ")", ".", "forEach", "(", ...
Transform objects into an array of key value pairs.
[ "Transform", "objects", "into", "an", "array", "of", "key", "value", "pairs", "." ]
651626bbf82c66e0b1786992a7fd7e18845f076b
https://github.com/Kong/galileo-agent-node/blob/651626bbf82c66e0b1786992a7fd7e18845f076b/lib/helpers.js#L127-L154
train
Kong/galileo-agent-node
lib/helpers.js
function (headers, key, def) { if (headers instanceof Array) { var regex = new RegExp(key, 'i') for (var i = 0; i < headers.length; i++) { if (regex.test(headers[i].name)) { return headers[i].value } } } return def !== undefined ? def : false }
javascript
function (headers, key, def) { if (headers instanceof Array) { var regex = new RegExp(key, 'i') for (var i = 0; i < headers.length; i++) { if (regex.test(headers[i].name)) { return headers[i].value } } } return def !== undefined ? def : false }
[ "function", "(", "headers", ",", "key", ",", "def", ")", "{", "if", "(", "headers", "instanceof", "Array", ")", "{", "var", "regex", "=", "new", "RegExp", "(", "key", ",", "'i'", ")", "for", "(", "var", "i", "=", "0", ";", "i", "<", "headers", ...
uses regex to match a header value
[ "uses", "regex", "to", "match", "a", "header", "value" ]
651626bbf82c66e0b1786992a7fd7e18845f076b
https://github.com/Kong/galileo-agent-node/blob/651626bbf82c66e0b1786992a7fd7e18845f076b/lib/helpers.js#L159-L170
train
Kong/galileo-agent-node
lib/helpers.js
function (req) { var keys = Object.keys(req.headers) var values = keys.map(function (key) { return req.headers[key] }) var headers = req.method + req.url + keys.join() + values.join() // startline: [method] [url] HTTP/1.1\r\n = 12 // endline: \r\n = 2 // every header + \r\n = * 2 ...
javascript
function (req) { var keys = Object.keys(req.headers) var values = keys.map(function (key) { return req.headers[key] }) var headers = req.method + req.url + keys.join() + values.join() // startline: [method] [url] HTTP/1.1\r\n = 12 // endline: \r\n = 2 // every header + \r\n = * 2 ...
[ "function", "(", "req", ")", "{", "var", "keys", "=", "Object", ".", "keys", "(", "req", ".", "headers", ")", "var", "values", "=", "keys", ".", "map", "(", "function", "(", "key", ")", "{", "return", "req", ".", "headers", "[", "key", "]", "}", ...
quickly calculates the header size in bytes for a given array of headers
[ "quickly", "calculates", "the", "header", "size", "in", "bytes", "for", "a", "given", "array", "of", "headers" ]
651626bbf82c66e0b1786992a7fd7e18845f076b
https://github.com/Kong/galileo-agent-node/blob/651626bbf82c66e0b1786992a7fd7e18845f076b/lib/helpers.js#L175-L189
train
rakuten-frontend/generator-rff
generators/app/index.js
function () { var done = this.async(); var questions = []; var choices = [ { name: 'Standard Preset', value: 'standard' }, { name: 'Minimum Preset', value: 'minimum' }, { name: 'Custom Configuration (Advanced)', ...
javascript
function () { var done = this.async(); var questions = []; var choices = [ { name: 'Standard Preset', value: 'standard' }, { name: 'Minimum Preset', value: 'minimum' }, { name: 'Custom Configuration (Advanced)', ...
[ "function", "(", ")", "{", "var", "done", "=", "this", ".", "async", "(", ")", ";", "var", "questions", "=", "[", "]", ";", "var", "choices", "=", "[", "{", "name", ":", "'Standard Preset'", ",", "value", ":", "'standard'", "}", ",", "{", "name", ...
Setup prompting type
[ "Setup", "prompting", "type" ]
f0621e5b2a042036599d2126701af6a2f59e563f
https://github.com/rakuten-frontend/generator-rff/blob/f0621e5b2a042036599d2126701af6a2f59e563f/generators/app/index.js#L43-L109
train
rakuten-frontend/generator-rff
generators/app/index.js
function () { this.cfg = {}; // Copy from prompt settings Object.keys(this.settings).forEach(function (key) { this.cfg[key] = this.settings[key]; }.bind(this)); // Boolean config options.forEach(function (option) { var name = option.name; option.choices.forE...
javascript
function () { this.cfg = {}; // Copy from prompt settings Object.keys(this.settings).forEach(function (key) { this.cfg[key] = this.settings[key]; }.bind(this)); // Boolean config options.forEach(function (option) { var name = option.name; option.choices.forE...
[ "function", "(", ")", "{", "this", ".", "cfg", "=", "{", "}", ";", "// Copy from prompt settings", "Object", ".", "keys", "(", "this", ".", "settings", ")", ".", "forEach", "(", "function", "(", "key", ")", "{", "this", ".", "cfg", "[", "key", "]", ...
Config for template generator
[ "Config", "for", "template", "generator" ]
f0621e5b2a042036599d2126701af6a2f59e563f
https://github.com/rakuten-frontend/generator-rff/blob/f0621e5b2a042036599d2126701af6a2f59e563f/generators/app/index.js#L187-L218
train
tradle/simple-wallet
index.js
Wallet
function Wallet (options) { this.priv = typeof options.priv === 'string' ? bitcoin.ECKey.fromWIF(options.priv) : options.priv typeforce(typeforce.Object, this.priv) typeforce({ blockchain: typeforce.Object, networkName: typeforce.String }, options) assert(options.networkName in bitcoin.netwo...
javascript
function Wallet (options) { this.priv = typeof options.priv === 'string' ? bitcoin.ECKey.fromWIF(options.priv) : options.priv typeforce(typeforce.Object, this.priv) typeforce({ blockchain: typeforce.Object, networkName: typeforce.String }, options) assert(options.networkName in bitcoin.netwo...
[ "function", "Wallet", "(", "options", ")", "{", "this", ".", "priv", "=", "typeof", "options", ".", "priv", "===", "'string'", "?", "bitcoin", ".", "ECKey", ".", "fromWIF", "(", "options", ".", "priv", ")", ":", "options", ".", "priv", "typeforce", "("...
primitive one key common blockchain wallet @param {Object} options @param {String|ECKey} options.priv @param {CommonBlockchain impl} options.blockchain common-blockchain api
[ "primitive", "one", "key", "common", "blockchain", "wallet" ]
de0c8d5d932aab08c93688b6565a25c793ee9915
https://github.com/tradle/simple-wallet/blob/de0c8d5d932aab08c93688b6565a25c793ee9915/index.js#L18-L37
train
gcanti/flowcheck
visitors.js
visitTypedVariableDeclarator
function visitTypedVariableDeclarator(traverse, node, path, state) { var ctx = new Context(state); if (node.init) { utils.catchup(node.init.range[0], state); utils.append(ctx.getProperty('check') + '(', state); traverse(node.init, path, state); utils.catchup(node.init.range[1], state); utils.app...
javascript
function visitTypedVariableDeclarator(traverse, node, path, state) { var ctx = new Context(state); if (node.init) { utils.catchup(node.init.range[0], state); utils.append(ctx.getProperty('check') + '(', state); traverse(node.init, path, state); utils.catchup(node.init.range[1], state); utils.app...
[ "function", "visitTypedVariableDeclarator", "(", "traverse", ",", "node", ",", "path", ",", "state", ")", "{", "var", "ctx", "=", "new", "Context", "(", "state", ")", ";", "if", "(", "node", ".", "init", ")", "{", "utils", ".", "catchup", "(", "node", ...
handle variable declarations
[ "handle", "variable", "declarations" ]
7c29f7ebdd962b4cc3b26771a1b3c1319b5137c5
https://github.com/gcanti/flowcheck/blob/7c29f7ebdd962b4cc3b26771a1b3c1319b5137c5/visitors.js#L171-L182
train
gcanti/flowcheck
visitors.js
visitTypedFunction
function visitTypedFunction(traverse, node, path, state) { var klass = getParentClassDeclaration(path); var generics = klass && klass.typeParameters ? toLookup(klass.typeParameters.params.map(getName)) : {}; if (node.typeParameters) { generics = mixin(generics, toLookup(node.typeParameters.params.map(getName)...
javascript
function visitTypedFunction(traverse, node, path, state) { var klass = getParentClassDeclaration(path); var generics = klass && klass.typeParameters ? toLookup(klass.typeParameters.params.map(getName)) : {}; if (node.typeParameters) { generics = mixin(generics, toLookup(node.typeParameters.params.map(getName)...
[ "function", "visitTypedFunction", "(", "traverse", ",", "node", ",", "path", ",", "state", ")", "{", "var", "klass", "=", "getParentClassDeclaration", "(", "path", ")", ";", "var", "generics", "=", "klass", "&&", "klass", ".", "typeParameters", "?", "toLooku...
handle typed functions a typed function is a function such that at least one param or the return value is typed
[ "handle", "typed", "functions", "a", "typed", "function", "is", "a", "function", "such", "that", "at", "least", "one", "param", "or", "the", "return", "value", "is", "typed" ]
7c29f7ebdd962b4cc3b26771a1b3c1319b5137c5
https://github.com/gcanti/flowcheck/blob/7c29f7ebdd962b4cc3b26771a1b3c1319b5137c5/visitors.js#L193-L226
train
gcanti/flowcheck
visitors.js
visitTypeAlias
function visitTypeAlias(traverse, node, path, state) { var ctx = new Context(state); utils.catchup(node.range[1], state); utils.append('var ' + node.id.name + ' = ' + ctx.getType(node.right) + ';', state); return false; }
javascript
function visitTypeAlias(traverse, node, path, state) { var ctx = new Context(state); utils.catchup(node.range[1], state); utils.append('var ' + node.id.name + ' = ' + ctx.getType(node.right) + ';', state); return false; }
[ "function", "visitTypeAlias", "(", "traverse", ",", "node", ",", "path", ",", "state", ")", "{", "var", "ctx", "=", "new", "Context", "(", "state", ")", ";", "utils", ".", "catchup", "(", "node", ".", "range", "[", "1", "]", ",", "state", ")", ";",...
handle type aliases
[ "handle", "type", "aliases" ]
7c29f7ebdd962b4cc3b26771a1b3c1319b5137c5
https://github.com/gcanti/flowcheck/blob/7c29f7ebdd962b4cc3b26771a1b3c1319b5137c5/visitors.js#L240-L245
train
tomaszczechowski/jsbeautify-loader
index.js
function (type) { var handlers = { 'html': beautify.html, 'css': beautify.css, 'js': beautify.js }; if (type === undefined) { return beautify; } if (type in handlers) { return handlers[type]; } throw new Error('Unrecognized beautifier type:', type); }
javascript
function (type) { var handlers = { 'html': beautify.html, 'css': beautify.css, 'js': beautify.js }; if (type === undefined) { return beautify; } if (type in handlers) { return handlers[type]; } throw new Error('Unrecognized beautifier type:', type); }
[ "function", "(", "type", ")", "{", "var", "handlers", "=", "{", "'html'", ":", "beautify", ".", "html", ",", "'css'", ":", "beautify", ".", "css", ",", "'js'", ":", "beautify", ".", "js", "}", ";", "if", "(", "type", "===", "undefined", ")", "{", ...
Method returns beautify handler for specific type of file. @param {String} type - type of file e.g. html or js. @return {Object} - beautify object.
[ "Method", "returns", "beautify", "handler", "for", "specific", "type", "of", "file", "." ]
a896ee6c348d779c27694e3225cf5355f88b2e74
https://github.com/tomaszczechowski/jsbeautify-loader/blob/a896ee6c348d779c27694e3225cf5355f88b2e74/index.js#L25-L37
train