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
julescarbon/grunt-dentist
tasks/dentist.js
remove_script_tags
function remove_script_tags(){ html = html.replace(/<script[^>]*>.*?<\/script>/g, function(str){ if (str.match(/ type=/) && ! str.match(/text\/javascript/)) { return str; } else if (str.match(/src=['"]?(https?)/)) { return str; } else if (str.match(/src=['"]?\/\//)) { return str; } ...
javascript
function remove_script_tags(){ html = html.replace(/<script[^>]*>.*?<\/script>/g, function(str){ if (str.match(/ type=/) && ! str.match(/text\/javascript/)) { return str; } else if (str.match(/src=['"]?(https?)/)) { return str; } else if (str.match(/src=['"]?\/\//)) { return str; } ...
[ "function", "remove_script_tags", "(", ")", "{", "html", "=", "html", ".", "replace", "(", "/", "<script[^>]*>.*?<\\/script>", "/", "g", ",", "function", "(", "str", ")", "{", "if", "(", "str", ".", "match", "(", "/", " type=", "/", ")", "&&", "!", "...
Remove script tags pointing at local assets. Avoid wiping external dependencies and non-JS content inside script tags
[ "Remove", "script", "tags", "pointing", "at", "local", "assets", ".", "Avoid", "wiping", "external", "dependencies", "and", "non", "-", "JS", "content", "inside", "script", "tags" ]
d6dc4921f67bf521fb044fdb89bffe9cbdeacbbb
https://github.com/julescarbon/grunt-dentist/blob/d6dc4921f67bf521fb044fdb89bffe9cbdeacbbb/tasks/dentist.js#L137-L145
train
julescarbon/grunt-dentist
tasks/dentist.js
remove_stylesheet_tags
function remove_stylesheet_tags() { // We can remove the style tag with impunity, it is always inlining. html = html.replace(/<style.+?<\/style>/g, ""); // External style resources use the link tag, check again for externals. if (options.clean_stylesheets) { html = html.replace(/<link[^...
javascript
function remove_stylesheet_tags() { // We can remove the style tag with impunity, it is always inlining. html = html.replace(/<style.+?<\/style>/g, ""); // External style resources use the link tag, check again for externals. if (options.clean_stylesheets) { html = html.replace(/<link[^...
[ "function", "remove_stylesheet_tags", "(", ")", "{", "// We can remove the style tag with impunity, it is always inlining.", "html", "=", "html", ".", "replace", "(", "/", "<style.+?<\\/style>", "/", "g", ",", "\"\"", ")", ";", "// External style resources use the link tag, c...
Remove style and link tags pointing at local stylesheets
[ "Remove", "style", "and", "link", "tags", "pointing", "at", "local", "stylesheets" ]
d6dc4921f67bf521fb044fdb89bffe9cbdeacbbb
https://github.com/julescarbon/grunt-dentist/blob/d6dc4921f67bf521fb044fdb89bffe9cbdeacbbb/tasks/dentist.js#L148-L165
train
julescarbon/grunt-dentist
tasks/dentist.js
remove_comments
function remove_comments(){ if (options.clean_comments) { html = html.replace(/<!--[\s\S]*?-->/g, function(str){ if (str.match(/<!--\[if /)) { return str; } if (str.match(/\n/)) { return str; } else { return ""; } }); } }
javascript
function remove_comments(){ if (options.clean_comments) { html = html.replace(/<!--[\s\S]*?-->/g, function(str){ if (str.match(/<!--\[if /)) { return str; } if (str.match(/\n/)) { return str; } else { return ""; } }); } }
[ "function", "remove_comments", "(", ")", "{", "if", "(", "options", ".", "clean_comments", ")", "{", "html", "=", "html", ".", "replace", "(", "/", "<!--[\\s\\S]*?-->", "/", "g", ",", "function", "(", "str", ")", "{", "if", "(", "str", ".", "match", ...
Remove HTML comments
[ "Remove", "HTML", "comments" ]
d6dc4921f67bf521fb044fdb89bffe9cbdeacbbb
https://github.com/julescarbon/grunt-dentist/blob/d6dc4921f67bf521fb044fdb89bffe9cbdeacbbb/tasks/dentist.js#L168-L176
train
julescarbon/grunt-dentist
tasks/dentist.js
inject
function inject (tag, shims){ var added = shims.some(function(shim){ var i = html.lastIndexOf(shim); if (i !== -1) { html = html.substr(0, i) + tag + html.substr(i); return true; } return false; }); // Failing that, just append it. if (! added)...
javascript
function inject (tag, shims){ var added = shims.some(function(shim){ var i = html.lastIndexOf(shim); if (i !== -1) { html = html.substr(0, i) + tag + html.substr(i); return true; } return false; }); // Failing that, just append it. if (! added)...
[ "function", "inject", "(", "tag", ",", "shims", ")", "{", "var", "added", "=", "shims", ".", "some", "(", "function", "(", "shim", ")", "{", "var", "i", "=", "html", ".", "lastIndexOf", "(", "shim", ")", ";", "if", "(", "i", "!==", "-", "1", ")...
Inject some text before a specified tag
[ "Inject", "some", "text", "before", "a", "specified", "tag" ]
d6dc4921f67bf521fb044fdb89bffe9cbdeacbbb
https://github.com/julescarbon/grunt-dentist/blob/d6dc4921f67bf521fb044fdb89bffe9cbdeacbbb/tasks/dentist.js#L179-L192
train
julescarbon/grunt-dentist
tasks/dentist.js
inject_script_shim
function inject_script_shim () { if (options.include_js) { var script_tag = '<script type="text/javascript" src="' + options.include_js + '"></script>'; if (options.js_insert_marker && html.indexOf(options.js_insert_marker) !== -1) { html = html.replace(options.js_insert_marker, script_t...
javascript
function inject_script_shim () { if (options.include_js) { var script_tag = '<script type="text/javascript" src="' + options.include_js + '"></script>'; if (options.js_insert_marker && html.indexOf(options.js_insert_marker) !== -1) { html = html.replace(options.js_insert_marker, script_t...
[ "function", "inject_script_shim", "(", ")", "{", "if", "(", "options", ".", "include_js", ")", "{", "var", "script_tag", "=", "'<script type=\"text/javascript\" src=\"'", "+", "options", ".", "include_js", "+", "'\"></script>'", ";", "if", "(", "options", ".", "...
Inject a script tag pointed at the minified JS. Attempt to insert the shim before the closing body tag.
[ "Inject", "a", "script", "tag", "pointed", "at", "the", "minified", "JS", ".", "Attempt", "to", "insert", "the", "shim", "before", "the", "closing", "body", "tag", "." ]
d6dc4921f67bf521fb044fdb89bffe9cbdeacbbb
https://github.com/julescarbon/grunt-dentist/blob/d6dc4921f67bf521fb044fdb89bffe9cbdeacbbb/tasks/dentist.js#L196-L207
train
julescarbon/grunt-dentist
tasks/dentist.js
inject_stylesheet_shim
function inject_stylesheet_shim () { if (options.include_css) { var style_tag = '<link rel="stylesheet" type="text/css" href="' + options.include_css + '">'; if (options.css_insert_marker && html.indexOf(options.css_insert_marker) !== -1) { html = html.replace(options.css_insert_marker, ...
javascript
function inject_stylesheet_shim () { if (options.include_css) { var style_tag = '<link rel="stylesheet" type="text/css" href="' + options.include_css + '">'; if (options.css_insert_marker && html.indexOf(options.css_insert_marker) !== -1) { html = html.replace(options.css_insert_marker, ...
[ "function", "inject_stylesheet_shim", "(", ")", "{", "if", "(", "options", ".", "include_css", ")", "{", "var", "style_tag", "=", "'<link rel=\"stylesheet\" type=\"text/css\" href=\"'", "+", "options", ".", "include_css", "+", "'\">'", ";", "if", "(", "options", "...
Inject a style tag pointed at the minified CSS. Attempt to insert the shim before the closing head tag.
[ "Inject", "a", "style", "tag", "pointed", "at", "the", "minified", "CSS", ".", "Attempt", "to", "insert", "the", "shim", "before", "the", "closing", "head", "tag", "." ]
d6dc4921f67bf521fb044fdb89bffe9cbdeacbbb
https://github.com/julescarbon/grunt-dentist/blob/d6dc4921f67bf521fb044fdb89bffe9cbdeacbbb/tasks/dentist.js#L211-L222
train
julescarbon/grunt-dentist
tasks/dentist.js
write_css
function write_css () { if (dest.dest_css) { grunt.file.write(dest.dest_css, strip_whitespace(styles.join("\n"))); grunt.log.writeln('Stylesheet ' + dest.dest_css + '" extracted.'); } }
javascript
function write_css () { if (dest.dest_css) { grunt.file.write(dest.dest_css, strip_whitespace(styles.join("\n"))); grunt.log.writeln('Stylesheet ' + dest.dest_css + '" extracted.'); } }
[ "function", "write_css", "(", ")", "{", "if", "(", "dest", ".", "dest_css", ")", "{", "grunt", ".", "file", ".", "write", "(", "dest", ".", "dest_css", ",", "strip_whitespace", "(", "styles", ".", "join", "(", "\"\\n\"", ")", ")", ")", ";", "grunt", ...
Write the CSS
[ "Write", "the", "CSS" ]
d6dc4921f67bf521fb044fdb89bffe9cbdeacbbb
https://github.com/julescarbon/grunt-dentist/blob/d6dc4921f67bf521fb044fdb89bffe9cbdeacbbb/tasks/dentist.js#L233-L238
train
julescarbon/grunt-dentist
tasks/dentist.js
write_js
function write_js () { if (dest.dest_js) { grunt.file.write(dest.dest_js, strip_whitespace(scripts.join(";\n"))); grunt.log.writeln('Script "' + dest.dest_js + '" extracted.'); } }
javascript
function write_js () { if (dest.dest_js) { grunt.file.write(dest.dest_js, strip_whitespace(scripts.join(";\n"))); grunt.log.writeln('Script "' + dest.dest_js + '" extracted.'); } }
[ "function", "write_js", "(", ")", "{", "if", "(", "dest", ".", "dest_js", ")", "{", "grunt", ".", "file", ".", "write", "(", "dest", ".", "dest_js", ",", "strip_whitespace", "(", "scripts", ".", "join", "(", "\";\\n\"", ")", ")", ")", ";", "grunt", ...
Write the JS
[ "Write", "the", "JS" ]
d6dc4921f67bf521fb044fdb89bffe9cbdeacbbb
https://github.com/julescarbon/grunt-dentist/blob/d6dc4921f67bf521fb044fdb89bffe9cbdeacbbb/tasks/dentist.js#L241-L246
train
julescarbon/grunt-dentist
tasks/dentist.js
write_html
function write_html () { if (dest.dest_html) { grunt.file.write(dest.dest_html, strip_whitespace(html)); grunt.log.writeln('Document "' + dest.dest_html + '" extracted.'); } }
javascript
function write_html () { if (dest.dest_html) { grunt.file.write(dest.dest_html, strip_whitespace(html)); grunt.log.writeln('Document "' + dest.dest_html + '" extracted.'); } }
[ "function", "write_html", "(", ")", "{", "if", "(", "dest", ".", "dest_html", ")", "{", "grunt", ".", "file", ".", "write", "(", "dest", ".", "dest_html", ",", "strip_whitespace", "(", "html", ")", ")", ";", "grunt", ".", "log", ".", "writeln", "(", ...
Write the HTML
[ "Write", "the", "HTML" ]
d6dc4921f67bf521fb044fdb89bffe9cbdeacbbb
https://github.com/julescarbon/grunt-dentist/blob/d6dc4921f67bf521fb044fdb89bffe9cbdeacbbb/tasks/dentist.js#L249-L254
train
julescarbon/grunt-dentist
tasks/dentist.js
run_dentist
function run_dentist() { if (load_files() && parse_html()) { if (dest.dest_html) { if (dest.dest_js) { remove_inline_scripts(); remove_script_tags(); inject_script_shim(); } if (dest.dest_css) { remove_inline_stylesheets(); ...
javascript
function run_dentist() { if (load_files() && parse_html()) { if (dest.dest_html) { if (dest.dest_js) { remove_inline_scripts(); remove_script_tags(); inject_script_shim(); } if (dest.dest_css) { remove_inline_stylesheets(); ...
[ "function", "run_dentist", "(", ")", "{", "if", "(", "load_files", "(", ")", "&&", "parse_html", "(", ")", ")", "{", "if", "(", "dest", ".", "dest_html", ")", "{", "if", "(", "dest", ".", "dest_js", ")", "{", "remove_inline_scripts", "(", ")", ";", ...
Main Dentist task
[ "Main", "Dentist", "task" ]
d6dc4921f67bf521fb044fdb89bffe9cbdeacbbb
https://github.com/julescarbon/grunt-dentist/blob/d6dc4921f67bf521fb044fdb89bffe9cbdeacbbb/tasks/dentist.js#L257-L281
train
TMiguelT/pokemontcgscraper
index.js
scrapeEnergies
function scrapeEnergies(el, $, func) { const $el = $(el); $el.find("li").each(function (i, val) { const $val = $(val); const type = $val.attr("title"); func(type, $val); }); }
javascript
function scrapeEnergies(el, $, func) { const $el = $(el); $el.find("li").each(function (i, val) { const $val = $(val); const type = $val.attr("title"); func(type, $val); }); }
[ "function", "scrapeEnergies", "(", "el", ",", "$", ",", "func", ")", "{", "const", "$el", "=", "$", "(", "el", ")", ";", "$el", ".", "find", "(", "\"li\"", ")", ".", "each", "(", "function", "(", "i", ",", "val", ")", "{", "const", "$val", "=",...
Calls the callback function on each energy @param el the DOM element to start scraping from @param $ the query object el exists within @param func called with (energy, $), where energy is the energy type (Fire etc.) and $ is a jQuery element for this energy
[ "Calls", "the", "callback", "function", "on", "each", "energy" ]
b8fb289cf582b5d158f94f3903b17409dfc3f168
https://github.com/TMiguelT/pokemontcgscraper/blob/b8fb289cf582b5d158f94f3903b17409dfc3f168/index.js#L68-L76
train
TMiguelT/pokemontcgscraper
index.js
scrapeAll
function scrapeAll(query, scrapeDetails) { return co(function *() { //By default, scrape the card details scrapeDetails = scrapeDetails === undefined ? true : scrapeDetails; //Load the HTML page const scrapeURL = makeUrl(SCRAPE_URL, query); const search = yield scrapeSearch...
javascript
function scrapeAll(query, scrapeDetails) { return co(function *() { //By default, scrape the card details scrapeDetails = scrapeDetails === undefined ? true : scrapeDetails; //Load the HTML page const scrapeURL = makeUrl(SCRAPE_URL, query); const search = yield scrapeSearch...
[ "function", "scrapeAll", "(", "query", ",", "scrapeDetails", ")", "{", "return", "co", "(", "function", "*", "(", ")", "{", "//By default, scrape the card details", "scrapeDetails", "=", "scrapeDetails", "===", "undefined", "?", "true", ":", "scrapeDetails", ";", ...
Scrapes the Pokemon TCG database @param query The query string to use for the search. @param scrapeDetails True if you want to return the card data, false if you just want the URLs @returns {*}
[ "Scrapes", "the", "Pokemon", "TCG", "database" ]
b8fb289cf582b5d158f94f3903b17409dfc3f168
https://github.com/TMiguelT/pokemontcgscraper/blob/b8fb289cf582b5d158f94f3903b17409dfc3f168/index.js#L242-L273
train
benlue/newsql
lib/newsql.js
matchSQLFilter
function matchSQLFilter(tableSchema, whereCol) { for (var i in whereCol) { var col = whereCol[i], schema = tableSchema[col.tbName]; if (!schema) throw new Error('A filter column refers to an unknown table [' + col.tbName + ']'); if (schema.columns.indexOf(col.col) < 0) return false; } return ...
javascript
function matchSQLFilter(tableSchema, whereCol) { for (var i in whereCol) { var col = whereCol[i], schema = tableSchema[col.tbName]; if (!schema) throw new Error('A filter column refers to an unknown table [' + col.tbName + ']'); if (schema.columns.indexOf(col.col) < 0) return false; } return ...
[ "function", "matchSQLFilter", "(", "tableSchema", ",", "whereCol", ")", "{", "for", "(", "var", "i", "in", "whereCol", ")", "{", "var", "col", "=", "whereCol", "[", "i", "]", ",", "schema", "=", "tableSchema", "[", "col", ".", "tbName", "]", ";", "if...
check if whereCol contains any non-sql columns.
[ "check", "if", "whereCol", "contains", "any", "non", "-", "sql", "columns", "." ]
0c7fe03b134459ec952871fd9aa67c5dff18c612
https://github.com/benlue/newsql/blob/0c7fe03b134459ec952871fd9aa67c5dff18c612/lib/newsql.js#L1070-L1082
train
benlue/newsql
lib/newsql.js
collectFilterColumns
function collectFilterColumns(dftTable, filter, col) { var isLogical = false; if (filter.op === 'AND' || filter.op === 'and' || filter.op === 'OR' || filter.op === 'or') { filter.op = filter.op.toLowerCase(); isLogical = true; } if (isLogical) { filter.filters.forEach(function(f) { collectFilterColum...
javascript
function collectFilterColumns(dftTable, filter, col) { var isLogical = false; if (filter.op === 'AND' || filter.op === 'and' || filter.op === 'OR' || filter.op === 'or') { filter.op = filter.op.toLowerCase(); isLogical = true; } if (isLogical) { filter.filters.forEach(function(f) { collectFilterColum...
[ "function", "collectFilterColumns", "(", "dftTable", ",", "filter", ",", "col", ")", "{", "var", "isLogical", "=", "false", ";", "if", "(", "filter", ".", "op", "===", "'AND'", "||", "filter", ".", "op", "===", "'and'", "||", "filter", ".", "op", "==="...
Check if a filter contains json-columns
[ "Check", "if", "a", "filter", "contains", "json", "-", "columns" ]
0c7fe03b134459ec952871fd9aa67c5dff18c612
https://github.com/benlue/newsql/blob/0c7fe03b134459ec952871fd9aa67c5dff18c612/lib/newsql.js#L1242-L1267
train
benlue/newsql
lib/newsql.js
buildSqlFilter
function buildSqlFilter(filter, columns) { if (filter.op === 'and') { var clones = []; filter.filters.forEach(function(f) { var cf = buildSqlFilter(f, columns); if (cf) clones.push( cf ); }); var len = clones.length; if (len < 1) return null; else return len > 1 ? {op: 'and', fi...
javascript
function buildSqlFilter(filter, columns) { if (filter.op === 'and') { var clones = []; filter.filters.forEach(function(f) { var cf = buildSqlFilter(f, columns); if (cf) clones.push( cf ); }); var len = clones.length; if (len < 1) return null; else return len > 1 ? {op: 'and', fi...
[ "function", "buildSqlFilter", "(", "filter", ",", "columns", ")", "{", "if", "(", "filter", ".", "op", "===", "'and'", ")", "{", "var", "clones", "=", "[", "]", ";", "filter", ".", "filters", ".", "forEach", "(", "function", "(", "f", ")", "{", "va...
Build a new SQL filter with 'inertia' columns
[ "Build", "a", "new", "SQL", "filter", "with", "inertia", "columns" ]
0c7fe03b134459ec952871fd9aa67c5dff18c612
https://github.com/benlue/newsql/blob/0c7fe03b134459ec952871fd9aa67c5dff18c612/lib/newsql.js#L1273-L1306
train
tollwerk/fractal-typo3
index.js
writeFile
function writeFile(file, content) { fs.writeFileSync(file, content); files.push(path.relative(app.components.get('path'), file)); }
javascript
function writeFile(file, content) { fs.writeFileSync(file, content); files.push(path.relative(app.components.get('path'), file)); }
[ "function", "writeFile", "(", "file", ",", "content", ")", "{", "fs", ".", "writeFileSync", "(", "file", ",", "content", ")", ";", "files", ".", "push", "(", "path", ".", "relative", "(", "app", ".", "components", ".", "get", "(", "'path'", ")", ",",...
Write a file to disc @param {String} path File path @param {String} content File content
[ "Write", "a", "file", "to", "disc" ]
7a331642e34f8a898895c32c03f81b8aef41ef2b
https://github.com/tollwerk/fractal-typo3/blob/7a331642e34f8a898895c32c03f81b8aef41ef2b/index.js#L25-L28
train
tollwerk/fractal-typo3
index.js
configureComponent
function configureComponent(configPath, component, componentPath) { let config; try { config = require(configPath); // If this is the default variant if (!component.variant) { config.title = component.name; config.status = component.status; config.con...
javascript
function configureComponent(configPath, component, componentPath) { let config; try { config = require(configPath); // If this is the default variant if (!component.variant) { config.title = component.name; config.status = component.status; config.con...
[ "function", "configureComponent", "(", "configPath", ",", "component", ",", "componentPath", ")", "{", "let", "config", ";", "try", "{", "config", "=", "require", "(", "configPath", ")", ";", "// If this is the default variant", "if", "(", "!", "component", ".",...
Configure a component @param {String} configPath Component configuration path @param {Object} component Component properties @param {String} componentPath Component path
[ "Configure", "a", "component" ]
7a331642e34f8a898895c32c03f81b8aef41ef2b
https://github.com/tollwerk/fractal-typo3/blob/7a331642e34f8a898895c32c03f81b8aef41ef2b/index.js#L37-L103
train
tollwerk/fractal-typo3
index.js
createCollection
function createCollection(dirPrefix, dirPath, dirConfigs) { const dir = dirPath.shift(); const dirConfig = dirConfigs.shift() || {}; const absDir = path.join(dirPrefix, dir); // Create the collection directory try { if (!fs.statSync(absDir).isDirectory()) { throw new Error('1');...
javascript
function createCollection(dirPrefix, dirPath, dirConfigs) { const dir = dirPath.shift(); const dirConfig = dirConfigs.shift() || {}; const absDir = path.join(dirPrefix, dir); // Create the collection directory try { if (!fs.statSync(absDir).isDirectory()) { throw new Error('1');...
[ "function", "createCollection", "(", "dirPrefix", ",", "dirPath", ",", "dirConfigs", ")", "{", "const", "dir", "=", "dirPath", ".", "shift", "(", ")", ";", "const", "dirConfig", "=", "dirConfigs", ".", "shift", "(", ")", "||", "{", "}", ";", "const", "...
Create and pre-configure a directory @param {String} dirPrefix Path prefix @param {Array} dirPath Directory path @param {Array} dirConfigs Local directory configurations @return {boolean} Directory been created and pre-configured
[ "Create", "and", "pre", "-", "configure", "a", "directory" ]
7a331642e34f8a898895c32c03f81b8aef41ef2b
https://github.com/tollwerk/fractal-typo3/blob/7a331642e34f8a898895c32c03f81b8aef41ef2b/index.js#L113-L153
train
tollwerk/fractal-typo3
index.js
registerComponent
function registerComponent(component) { const componentName = dashify(component.name); const componentLocalConfig = (component.local instanceof Array) ? component.local : []; while (componentLocalConfig.length < component.path.length) { componentLocalConfig.push([]); } const componentPath = ...
javascript
function registerComponent(component) { const componentName = dashify(component.name); const componentLocalConfig = (component.local instanceof Array) ? component.local : []; while (componentLocalConfig.length < component.path.length) { componentLocalConfig.push([]); } const componentPath = ...
[ "function", "registerComponent", "(", "component", ")", "{", "const", "componentName", "=", "dashify", "(", "component", ".", "name", ")", ";", "const", "componentLocalConfig", "=", "(", "component", ".", "local", "instanceof", "Array", ")", "?", "component", ...
Register a component @param {Object} component Component
[ "Register", "a", "component" ]
7a331642e34f8a898895c32c03f81b8aef41ef2b
https://github.com/tollwerk/fractal-typo3/blob/7a331642e34f8a898895c32c03f81b8aef41ef2b/index.js#L160-L191
train
tollwerk/fractal-typo3
index.js
update
function update(args, done) { app = this.fractal; let typo3cli = path.join(typo3path, '../vendor/bin/typo3'); let typo3args = ['extbase', 'component:discover']; try { if (fs.statSync(typo3cli).isFile()) { typo3args.shift(); } } catch (e) { typo3cli = path.join(ty...
javascript
function update(args, done) { app = this.fractal; let typo3cli = path.join(typo3path, '../vendor/bin/typo3'); let typo3args = ['extbase', 'component:discover']; try { if (fs.statSync(typo3cli).isFile()) { typo3args.shift(); } } catch (e) { typo3cli = path.join(ty...
[ "function", "update", "(", "args", ",", "done", ")", "{", "app", "=", "this", ".", "fractal", ";", "let", "typo3cli", "=", "path", ".", "join", "(", "typo3path", ",", "'../vendor/bin/typo3'", ")", ";", "let", "typo3args", "=", "[", "'extbase'", ",", "'...
Update the components by extracting them from a TYPO3 instance @param {Array} args Arguments @param {Function} done Callback
[ "Update", "the", "components", "by", "extracting", "them", "from", "a", "TYPO3", "instance" ]
7a331642e34f8a898895c32c03f81b8aef41ef2b
https://github.com/tollwerk/fractal-typo3/blob/7a331642e34f8a898895c32c03f81b8aef41ef2b/index.js#L222-L270
train
tollwerk/fractal-typo3
index.js
encodeURIParams
function encodeURIParams(params, prefix) { let parts = []; for (const name in params) { if (Object.prototype.hasOwnProperty.call(params, name)) { const paramName = prefix ? (`${prefix}[${encodeURIComponent(name)}]`) : encodeURIComponent(name); if (typeof params[name] === 'object'...
javascript
function encodeURIParams(params, prefix) { let parts = []; for (const name in params) { if (Object.prototype.hasOwnProperty.call(params, name)) { const paramName = prefix ? (`${prefix}[${encodeURIComponent(name)}]`) : encodeURIComponent(name); if (typeof params[name] === 'object'...
[ "function", "encodeURIParams", "(", "params", ",", "prefix", ")", "{", "let", "parts", "=", "[", "]", ";", "for", "(", "const", "name", "in", "params", ")", "{", "if", "(", "Object", ".", "prototype", ".", "hasOwnProperty", ".", "call", "(", "params", ...
Encode an object as URI parameters @param {Object} params Parameter object @param {String} prefix Parameter prefix @return {Array} Encoded URI parameters
[ "Encode", "an", "object", "as", "URI", "parameters" ]
7a331642e34f8a898895c32c03f81b8aef41ef2b
https://github.com/tollwerk/fractal-typo3/blob/7a331642e34f8a898895c32c03f81b8aef41ef2b/index.js#L279-L293
train
tollwerk/fractal-typo3
index.js
componentGraphUrl
function componentGraphUrl(component) { const context = ('variants' in component) ? component.variants().default().context : component.context; const graphUrl = url.parse(context.typo3); graphUrl.search = `?${encodeURIParams(Object.assign(context.request.arguments, { tx_twcomponentlibrary_component:...
javascript
function componentGraphUrl(component) { const context = ('variants' in component) ? component.variants().default().context : component.context; const graphUrl = url.parse(context.typo3); graphUrl.search = `?${encodeURIParams(Object.assign(context.request.arguments, { tx_twcomponentlibrary_component:...
[ "function", "componentGraphUrl", "(", "component", ")", "{", "const", "context", "=", "(", "'variants'", "in", "component", ")", "?", "component", ".", "variants", "(", ")", ".", "default", "(", ")", ".", "context", ":", "component", ".", "context", ";", ...
Create and return the graph URL for a particular component @param {Component} component Component
[ "Create", "and", "return", "the", "graph", "URL", "for", "a", "particular", "component" ]
7a331642e34f8a898895c32c03f81b8aef41ef2b
https://github.com/tollwerk/fractal-typo3/blob/7a331642e34f8a898895c32c03f81b8aef41ef2b/index.js#L300-L308
train
tollwerk/fractal-typo3
index.js
configure
function configure(t3path, t3url, t3theme) { typo3path = t3path; typo3url = t3url; // If a Fractal theme is given if ((typeof t3theme === 'object') && (typeof t3theme.options === 'function')) { t3theme.addLoadPath(path.resolve(__dirname, 'lib', 'views')); // Add the graph panel ...
javascript
function configure(t3path, t3url, t3theme) { typo3path = t3path; typo3url = t3url; // If a Fractal theme is given if ((typeof t3theme === 'object') && (typeof t3theme.options === 'function')) { t3theme.addLoadPath(path.resolve(__dirname, 'lib', 'views')); // Add the graph panel ...
[ "function", "configure", "(", "t3path", ",", "t3url", ",", "t3theme", ")", "{", "typo3path", "=", "t3path", ";", "typo3url", "=", "t3url", ";", "// If a Fractal theme is given", "if", "(", "(", "typeof", "t3theme", "===", "'object'", ")", "&&", "(", "typeof"...
Configure the TYPO3 connection @param {String} t3path TYPO3 default path @param {String} t3url TYPO3 base URL @param {Theme} t3theme TYPO3 theme
[ "Configure", "the", "TYPO3", "connection" ]
7a331642e34f8a898895c32c03f81b8aef41ef2b
https://github.com/tollwerk/fractal-typo3/blob/7a331642e34f8a898895c32c03f81b8aef41ef2b/index.js#L317-L335
train
tollwerk/fractal-typo3
index.js
engine
function engine() { return { register(source, gapp) { const typo3Engine = require('./lib/typo3.js'); const handlebars = require('@frctl/handlebars'); typo3Engine.handlebars = handlebars({}).register(source, gapp); typo3Engine.handlebars.load(); ret...
javascript
function engine() { return { register(source, gapp) { const typo3Engine = require('./lib/typo3.js'); const handlebars = require('@frctl/handlebars'); typo3Engine.handlebars = handlebars({}).register(source, gapp); typo3Engine.handlebars.load(); ret...
[ "function", "engine", "(", ")", "{", "return", "{", "register", "(", "source", ",", "gapp", ")", "{", "const", "typo3Engine", "=", "require", "(", "'./lib/typo3.js'", ")", ";", "const", "handlebars", "=", "require", "(", "'@frctl/handlebars'", ")", ";", "t...
TYPO3 template engine
[ "TYPO3", "template", "engine" ]
7a331642e34f8a898895c32c03f81b8aef41ef2b
https://github.com/tollwerk/fractal-typo3/blob/7a331642e34f8a898895c32c03f81b8aef41ef2b/index.js#L363-L373
train
chrahunt/tagpro-navmesh
tools/geom/diagonals.js
drawUpperTriangle
function drawUpperTriangle(d, loc) { if (d == "r") { var first = {x: 50, y: 0}; var second = {x: 50, y: 50}; } else { var first = {x: 50, y: 0}; var second = {x: 0, y: 50}; } context.beginPath(); context.moveTo(loc.x, loc.y); context.lineTo(loc.x + fir...
javascript
function drawUpperTriangle(d, loc) { if (d == "r") { var first = {x: 50, y: 0}; var second = {x: 50, y: 50}; } else { var first = {x: 50, y: 0}; var second = {x: 0, y: 50}; } context.beginPath(); context.moveTo(loc.x, loc.y); context.lineTo(loc.x + fir...
[ "function", "drawUpperTriangle", "(", "d", ",", "loc", ")", "{", "if", "(", "d", "==", "\"r\"", ")", "{", "var", "first", "=", "{", "x", ":", "50", ",", "y", ":", "0", "}", ";", "var", "second", "=", "{", "x", ":", "50", ",", "y", ":", "50"...
draw upper triangle going certain direction at location
[ "draw", "upper", "triangle", "going", "certain", "direction", "at", "location" ]
b50fbdad1061fb4760ac22ee756f34ab3e177539
https://github.com/chrahunt/tagpro-navmesh/blob/b50fbdad1061fb4760ac22ee756f34ab3e177539/tools/geom/diagonals.js#L210-L229
train
chrahunt/tagpro-navmesh
tools/geom/diagonals.js
drawBadCells
function drawBadCells(cells) { var context = c.getContext('2d'); var canvas = c; // from global. // Drawing bad cells var draw_loc = {x: 0, y: 0}; for (var i = 0; i < cells.length; i++) { var cell_info = cells[i]; var cell = cell_info[0]; var matched_entrances = cell_info[1]; var matched_exits...
javascript
function drawBadCells(cells) { var context = c.getContext('2d'); var canvas = c; // from global. // Drawing bad cells var draw_loc = {x: 0, y: 0}; for (var i = 0; i < cells.length; i++) { var cell_info = cells[i]; var cell = cell_info[0]; var matched_entrances = cell_info[1]; var matched_exits...
[ "function", "drawBadCells", "(", "cells", ")", "{", "var", "context", "=", "c", ".", "getContext", "(", "'2d'", ")", ";", "var", "canvas", "=", "c", ";", "// from global.", "// Drawing bad cells", "var", "draw_loc", "=", "{", "x", ":", "0", ",", "y", "...
Function for drawing the cells that were unmatched.
[ "Function", "for", "drawing", "the", "cells", "that", "were", "unmatched", "." ]
b50fbdad1061fb4760ac22ee756f34ab3e177539
https://github.com/chrahunt/tagpro-navmesh/blob/b50fbdad1061fb4760ac22ee756f34ab3e177539/tools/geom/diagonals.js#L437-L462
train
chrahunt/tagpro-navmesh
tools/geom/diagonals.js
getIndexForLoc
function getIndexForLoc(loc) { var col = Math.floor(loc.x / total_width); var row = Math.floor(loc.y / total_width); var index = col + (row * 5); return index; }
javascript
function getIndexForLoc(loc) { var col = Math.floor(loc.x / total_width); var row = Math.floor(loc.y / total_width); var index = col + (row * 5); return index; }
[ "function", "getIndexForLoc", "(", "loc", ")", "{", "var", "col", "=", "Math", ".", "floor", "(", "loc", ".", "x", "/", "total_width", ")", ";", "var", "row", "=", "Math", ".", "floor", "(", "loc", ".", "y", "/", "total_width", ")", ";", "var", "...
Given a location, return the index of the element that is present at that location. If it doesn't correspond to a good index, then it is -1.
[ "Given", "a", "location", "return", "the", "index", "of", "the", "element", "that", "is", "present", "at", "that", "location", ".", "If", "it", "doesn", "t", "correspond", "to", "a", "good", "index", "then", "it", "is", "-", "1", "." ]
b50fbdad1061fb4760ac22ee756f34ab3e177539
https://github.com/chrahunt/tagpro-navmesh/blob/b50fbdad1061fb4760ac22ee756f34ab3e177539/tools/geom/diagonals.js#L485-L490
train
pbeardshear/Tycho
lib/tycho.js
handleIncomingMessage
function handleIncomingMessage(event, message, source) { var blocks = event.split(':'), id = blocks[2] || blocks[1]; if (id in self.transactions && source in self.transactions[id]) { self.transactions[id][source].resolve([message, source]); } }
javascript
function handleIncomingMessage(event, message, source) { var blocks = event.split(':'), id = blocks[2] || blocks[1]; if (id in self.transactions && source in self.transactions[id]) { self.transactions[id][source].resolve([message, source]); } }
[ "function", "handleIncomingMessage", "(", "event", ",", "message", ",", "source", ")", "{", "var", "blocks", "=", "event", ".", "split", "(", "':'", ")", ",", "id", "=", "blocks", "[", "2", "]", "||", "blocks", "[", "1", "]", ";", "if", "(", "id", ...
Handler for messages from the store
[ "Handler", "for", "messages", "from", "the", "store" ]
11ff1b9bda5044edb575d58c3b5533335c7b5d88
https://github.com/pbeardshear/Tycho/blob/11ff1b9bda5044edb575d58c3b5533335c7b5d88/lib/tycho.js#L53-L59
train
pbeardshear/Tycho
lib/tycho.js
handleControlConnection
function handleControlConnection(connection) { connection.on('data', function (data) { console.log('Got command:', data.toString().trim()); var request = data.toString().trim().split(' '), cmd = request[0], target = request[1], newline = '\r\n', response; console.log('Command is:', cmd); s...
javascript
function handleControlConnection(connection) { connection.on('data', function (data) { console.log('Got command:', data.toString().trim()); var request = data.toString().trim().split(' '), cmd = request[0], target = request[1], newline = '\r\n', response; console.log('Command is:', cmd); s...
[ "function", "handleControlConnection", "(", "connection", ")", "{", "connection", ".", "on", "(", "'data'", ",", "function", "(", "data", ")", "{", "console", ".", "log", "(", "'Got command:'", ",", "data", ".", "toString", "(", ")", ".", "trim", "(", ")...
Handler for new connections to the control server Also defines the valid commands that can be issued to workers
[ "Handler", "for", "new", "connections", "to", "the", "control", "server", "Also", "defines", "the", "valid", "commands", "that", "can", "be", "issued", "to", "workers" ]
11ff1b9bda5044edb575d58c3b5533335c7b5d88
https://github.com/pbeardshear/Tycho/blob/11ff1b9bda5044edb575d58c3b5533335c7b5d88/lib/tycho.js#L65-L131
train
pbeardshear/Tycho
lib/tycho.js
handleWorkerRestart
function handleWorkerRestart(worker, code, signal) { delete self.workers[worker.id]; if (self.reviveWorkers) { var zombie = cluster.fork({ config: JSON.stringify(self.config) }); self.workers[zombie.id] = zombie; } }
javascript
function handleWorkerRestart(worker, code, signal) { delete self.workers[worker.id]; if (self.reviveWorkers) { var zombie = cluster.fork({ config: JSON.stringify(self.config) }); self.workers[zombie.id] = zombie; } }
[ "function", "handleWorkerRestart", "(", "worker", ",", "code", ",", "signal", ")", "{", "delete", "self", ".", "workers", "[", "worker", ".", "id", "]", ";", "if", "(", "self", ".", "reviveWorkers", ")", "{", "var", "zombie", "=", "cluster", ".", "fork...
Restart a worker when one goes offline
[ "Restart", "a", "worker", "when", "one", "goes", "offline" ]
11ff1b9bda5044edb575d58c3b5533335c7b5d88
https://github.com/pbeardshear/Tycho/blob/11ff1b9bda5044edb575d58c3b5533335c7b5d88/lib/tycho.js#L136-L144
train
pbeardshear/Tycho
lib/tycho.js
wait
function wait(id, callback) { var promises = []; self.transactions[id] = {}; lib.each(self.workers, function (worker) { var deferred = Q.defer(); self.transactions[id][worker.id] = deferred; promises.push(deferred.promise); }); Q.spread(promises, callback); }
javascript
function wait(id, callback) { var promises = []; self.transactions[id] = {}; lib.each(self.workers, function (worker) { var deferred = Q.defer(); self.transactions[id][worker.id] = deferred; promises.push(deferred.promise); }); Q.spread(promises, callback); }
[ "function", "wait", "(", "id", ",", "callback", ")", "{", "var", "promises", "=", "[", "]", ";", "self", ".", "transactions", "[", "id", "]", "=", "{", "}", ";", "lib", ".", "each", "(", "self", ".", "workers", ",", "function", "(", "worker", ")"...
Create a transaction which resolves when a response is heard from each active worker
[ "Create", "a", "transaction", "which", "resolves", "when", "a", "response", "is", "heard", "from", "each", "active", "worker" ]
11ff1b9bda5044edb575d58c3b5533335c7b5d88
https://github.com/pbeardshear/Tycho/blob/11ff1b9bda5044edb575d58c3b5533335c7b5d88/lib/tycho.js#L150-L161
train
reklatsmasters/ip2buf
index.js
pton
function pton(af, addr, dest, index) { switch (af) { case IPV4_OCTETS: return pton4(addr, dest, index) case IPV6_OCTETS: return pton6(addr, dest, index) default: throw new Error('Unsupported ip address.') } }
javascript
function pton(af, addr, dest, index) { switch (af) { case IPV4_OCTETS: return pton4(addr, dest, index) case IPV6_OCTETS: return pton6(addr, dest, index) default: throw new Error('Unsupported ip address.') } }
[ "function", "pton", "(", "af", ",", "addr", ",", "dest", ",", "index", ")", "{", "switch", "(", "af", ")", "{", "case", "IPV4_OCTETS", ":", "return", "pton4", "(", "addr", ",", "dest", ",", "index", ")", "case", "IPV6_OCTETS", ":", "return", "pton6",...
Convert ip address to the Buffer. @param {number} af - type of an address. @param {string} addr - source address. @param {Buffer} [dest] - target buffer. @param {number} [index] - start position in the target buffer.
[ "Convert", "ip", "address", "to", "the", "Buffer", "." ]
439c55cc7605423929808d42a29b9cd284914cd6
https://github.com/reklatsmasters/ip2buf/blob/439c55cc7605423929808d42a29b9cd284914cd6/index.js#L27-L36
train
sbarwe/node-red-contrib-contextbrowser
contextbrowser.js
copycontext
function copycontext(context) { var t = {}; var keys = context.keys(); var i = keys.length; var k, v, j; while (i--) { k = keys[i]; if (k[0] == '_') continue; v = context.get(k); if (v && {}.toString.call(v) === '[object Function]') continue; try { ...
javascript
function copycontext(context) { var t = {}; var keys = context.keys(); var i = keys.length; var k, v, j; while (i--) { k = keys[i]; if (k[0] == '_') continue; v = context.get(k); if (v && {}.toString.call(v) === '[object Function]') continue; try { ...
[ "function", "copycontext", "(", "context", ")", "{", "var", "t", "=", "{", "}", ";", "var", "keys", "=", "context", ".", "keys", "(", ")", ";", "var", "i", "=", "keys", ".", "length", ";", "var", "k", ",", "v", ",", "j", ";", "while", "(", "i...
prepare context object for serialization
[ "prepare", "context", "object", "for", "serialization" ]
38db41ad015334eb662dd95413236dd546c753e5
https://github.com/sbarwe/node-red-contrib-contextbrowser/blob/38db41ad015334eb662dd95413236dd546c753e5/contextbrowser.js#L32-L54
train
thlorenz/ps-aux
index.js
parseLine
function parseLine(line) { // except for the command, no field has a space, so we split by that and piece the command back together var parts = line.split(/ +/); return { user : parts[0] , pid : parseInt(parts[1]) , '%cpu' : parseFloat(parts[2]) , '%mem' : parseFloat(parts[3]) , vsz...
javascript
function parseLine(line) { // except for the command, no field has a space, so we split by that and piece the command back together var parts = line.split(/ +/); return { user : parts[0] , pid : parseInt(parts[1]) , '%cpu' : parseFloat(parts[2]) , '%mem' : parseFloat(parts[3]) , vsz...
[ "function", "parseLine", "(", "line", ")", "{", "// except for the command, no field has a space, so we split by that and piece the command back together", "var", "parts", "=", "line", ".", "split", "(", "/", " +", "/", ")", ";", "return", "{", "user", ":", "parts", "...
Parses out process info from a given `ps aux` line. @name parseLine @private @function @param {string} line the raw info for the given process @return {Object} with parsed out process info
[ "Parses", "out", "process", "info", "from", "a", "given", "ps", "aux", "line", "." ]
482b1fea2a8924313196113c488f334c5a2bfed9
https://github.com/thlorenz/ps-aux/blob/482b1fea2a8924313196113c488f334c5a2bfed9/index.js#L16-L32
train
d-oliveros/isomorphine
src/client/createProxiedMethod.js
proxiedMethod
function proxiedMethod(params, path) { // Get the arguments that should be passed to the server var payload = Array.prototype.slice.call(arguments).slice(2); // Save the callback function for later use var callback = util.firstFunction(payload); // Transform the callback function in the arguments into a ...
javascript
function proxiedMethod(params, path) { // Get the arguments that should be passed to the server var payload = Array.prototype.slice.call(arguments).slice(2); // Save the callback function for later use var callback = util.firstFunction(payload); // Transform the callback function in the arguments into a ...
[ "function", "proxiedMethod", "(", "params", ",", "path", ")", "{", "// Get the arguments that should be passed to the server", "var", "payload", "=", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "arguments", ")", ".", "slice", "(", "2", ")", ";", ...
Serializes the parameters sent in the function's call, and sends a POST request to isomorphine's endpoint in the server. @param {Object} params The server's configuration and error handlers. @param {Object} path The path to the serverside method to be called.
[ "Serializes", "the", "parameters", "sent", "in", "the", "function", "s", "call", "and", "sends", "a", "POST", "request", "to", "isomorphine", "s", "endpoint", "in", "the", "server", "." ]
cb123d16b4be3bb7ec57758bd0b2e43767e91864
https://github.com/d-oliveros/isomorphine/blob/cb123d16b4be3bb7ec57758bd0b2e43767e91864/src/client/createProxiedMethod.js#L32-L51
train
d-oliveros/isomorphine
src/client/createProxiedMethod.js
doRequest
function doRequest(endpoint, payload, params, callback) { debug('Calling API endpoint: ' + endpoint + '.'); request .post(endpoint) .send({ payload: payload }) .set('Accept', 'application/json') .end(function(err, res) { if ((!res || !res.body) && !err) { err = new Error('No response ...
javascript
function doRequest(endpoint, payload, params, callback) { debug('Calling API endpoint: ' + endpoint + '.'); request .post(endpoint) .send({ payload: payload }) .set('Accept', 'application/json') .end(function(err, res) { if ((!res || !res.body) && !err) { err = new Error('No response ...
[ "function", "doRequest", "(", "endpoint", ",", "payload", ",", "params", ",", "callback", ")", "{", "debug", "(", "'Calling API endpoint: '", "+", "endpoint", "+", "'.'", ")", ";", "request", ".", "post", "(", "endpoint", ")", ".", "send", "(", "{", "pay...
Runs a request to an isomorphine's endpoint with the provided payload. @param {String} endpoint The endpoint to request. @param {Array} payload The arguments to send. @param {Object} params The server's configuration and error handlers. @param {Function} callback The callback function to call afterwa...
[ "Runs", "a", "request", "to", "an", "isomorphine", "s", "endpoint", "with", "the", "provided", "payload", "." ]
cb123d16b4be3bb7ec57758bd0b2e43767e91864
https://github.com/d-oliveros/isomorphine/blob/cb123d16b4be3bb7ec57758bd0b2e43767e91864/src/client/createProxiedMethod.js#L61-L92
train
d-oliveros/isomorphine
src/client/createProxiedMethod.js
buildEndpoint
function buildEndpoint(config, path) { var host = config.host; var port = config.port; if (!host) throw new Error('No host is specified in proxied method config'); var base = host + (port ? ':' + port : ''); var fullpath = '/isomorphine/' + path; var endpoint = base + fullpath; debug('Built endpoint: '...
javascript
function buildEndpoint(config, path) { var host = config.host; var port = config.port; if (!host) throw new Error('No host is specified in proxied method config'); var base = host + (port ? ':' + port : ''); var fullpath = '/isomorphine/' + path; var endpoint = base + fullpath; debug('Built endpoint: '...
[ "function", "buildEndpoint", "(", "config", ",", "path", ")", "{", "var", "host", "=", "config", ".", "host", ";", "var", "port", "=", "config", ".", "port", ";", "if", "(", "!", "host", ")", "throw", "new", "Error", "(", "'No host is specified in proxie...
Builds a method's API endpoint. @param {Object} config The host and port parameters to use. @param {String} path The path to the serverside method. @return {String} The endpoint to request.
[ "Builds", "a", "method", "s", "API", "endpoint", "." ]
cb123d16b4be3bb7ec57758bd0b2e43767e91864
https://github.com/d-oliveros/isomorphine/blob/cb123d16b4be3bb7ec57758bd0b2e43767e91864/src/client/createProxiedMethod.js#L116-L129
train
othiym23/async-some
some.js
some
function some (list, test, cb) { assert("length" in list, "array must be arraylike") assert.equal(typeof test, "function", "predicate must be callable") assert.equal(typeof cb, "function", "callback must be callable") var array = slice(list) , index = 0 , length = array.length , hecomes = deza...
javascript
function some (list, test, cb) { assert("length" in list, "array must be arraylike") assert.equal(typeof test, "function", "predicate must be callable") assert.equal(typeof cb, "function", "callback must be callable") var array = slice(list) , index = 0 , length = array.length , hecomes = deza...
[ "function", "some", "(", "list", ",", "test", ",", "cb", ")", "{", "assert", "(", "\"length\"", "in", "list", ",", "\"array must be arraylike\"", ")", "assert", ".", "equal", "(", "typeof", "test", ",", "\"function\"", ",", "\"predicate must be callable\"", ")...
short-circuited async Array.prototype.some implementation Serially evaluates a list of values from a JS array or arraylike against an asynchronous predicate, terminating on the first truthy value. If the predicate encounters an error, pass it to the completion callback. Otherwise, pass the truthy value passed by the p...
[ "short", "-", "circuited", "async", "Array", ".", "prototype", ".", "some", "implementation" ]
3a5086ad54739c48b2bbf073f23bcc95658199e3
https://github.com/othiym23/async-some/blob/3a5086ad54739c48b2bbf073f23bcc95658199e3/some.js#L15-L40
train
othiym23/async-some
some.js
slice
function slice(args) { var l = args.length, a = [], i for (i = 0; i < l; i++) a[i] = args[i] return a }
javascript
function slice(args) { var l = args.length, a = [], i for (i = 0; i < l; i++) a[i] = args[i] return a }
[ "function", "slice", "(", "args", ")", "{", "var", "l", "=", "args", ".", "length", ",", "a", "=", "[", "]", ",", "i", "for", "(", "i", "=", "0", ";", "i", "<", "l", ";", "i", "++", ")", "a", "[", "i", "]", "=", "args", "[", "i", "]", ...
Array.prototype.slice on arguments arraylike is expensive
[ "Array", ".", "prototype", ".", "slice", "on", "arguments", "arraylike", "is", "expensive" ]
3a5086ad54739c48b2bbf073f23bcc95658199e3
https://github.com/othiym23/async-some/blob/3a5086ad54739c48b2bbf073f23bcc95658199e3/some.js#L43-L47
train
dominictarr/dat-table
index.js
Column
function Column (table, header, i) { this._table = table, this._header = header, this._i = i }
javascript
function Column (table, header, i) { this._table = table, this._header = header, this._i = i }
[ "function", "Column", "(", "table", ",", "header", ",", "i", ")", "{", "this", ".", "_table", "=", "table", ",", "this", ".", "_header", "=", "header", ",", "this", ".", "_i", "=", "i", "}" ]
this does nothing currently... but maybe it would be good to have something like this? so that you can pass columns to functions?
[ "this", "does", "nothing", "currently", "...", "but", "maybe", "it", "would", "be", "good", "to", "have", "something", "like", "this?", "so", "that", "you", "can", "pass", "columns", "to", "functions?" ]
d4c41e346ff4d721284a04841d1e7e0ed57a434d
https://github.com/dominictarr/dat-table/blob/d4c41e346ff4d721284a04841d1e7e0ed57a434d/index.js#L352-L354
train
rask/gulp-yaml-data
index.js
function (file, enc, cb) { var yaml_files = options.src; if (typeof yaml_files === 'string') { yaml_files = [yaml_files]; } var yaml_data = {}; // Read all files in order, and override if later files contain same values. for (var i = 0; i < yaml_files.lengt...
javascript
function (file, enc, cb) { var yaml_files = options.src; if (typeof yaml_files === 'string') { yaml_files = [yaml_files]; } var yaml_data = {}; // Read all files in order, and override if later files contain same values. for (var i = 0; i < yaml_files.lengt...
[ "function", "(", "file", ",", "enc", ",", "cb", ")", "{", "var", "yaml_files", "=", "options", ".", "src", ";", "if", "(", "typeof", "yaml_files", "===", "'string'", ")", "{", "yaml_files", "=", "[", "yaml_files", "]", ";", "}", "var", "yaml_data", "...
Transform current stream to include a YAML data file.
[ "Transform", "current", "stream", "to", "include", "a", "YAML", "data", "file", "." ]
c4a86a4ec4bed2f622a2267f23fdcdf58033ce1c
https://github.com/rask/gulp-yaml-data/blob/c4a86a4ec4bed2f622a2267f23fdcdf58033ce1c/index.js#L40-L67
train
looeee/npm-three-app
demo/module-import/js/vendor/GLTFLoader.js
GLTFDracoMeshCompressionExtension
function GLTFDracoMeshCompressionExtension( json, dracoLoader ) { if ( !dracoLoader ) { throw new Error( 'THREE.GLTFLoader: No DRACOLoader instance provided.' ); } this.name = EXTENSIONS.KHR_DRACO_MESH_COMPRESSION; this.json = json; this.dracoLoader = dracoLoader; THREE.DRACOLoader.getDecoderModule(...
javascript
function GLTFDracoMeshCompressionExtension( json, dracoLoader ) { if ( !dracoLoader ) { throw new Error( 'THREE.GLTFLoader: No DRACOLoader instance provided.' ); } this.name = EXTENSIONS.KHR_DRACO_MESH_COMPRESSION; this.json = json; this.dracoLoader = dracoLoader; THREE.DRACOLoader.getDecoderModule(...
[ "function", "GLTFDracoMeshCompressionExtension", "(", "json", ",", "dracoLoader", ")", "{", "if", "(", "!", "dracoLoader", ")", "{", "throw", "new", "Error", "(", "'THREE.GLTFLoader: No DRACOLoader instance provided.'", ")", ";", "}", "this", ".", "name", "=", "EX...
DRACO Mesh Compression Extension Specification: https://github.com/KhronosGroup/glTF/pull/874
[ "DRACO", "Mesh", "Compression", "Extension" ]
439be8d3119bf0f00a7790f77a57ec76fc126580
https://github.com/looeee/npm-three-app/blob/439be8d3119bf0f00a7790f77a57ec76fc126580/demo/module-import/js/vendor/GLTFLoader.js#L501-L514
train
fin-hypergrid/rectangular
index.js
function(iteratee, context) { context = context || this; for (var x = this.origin.x, x2 = this.corner.x; x < x2; x++) { for (var y = this.origin.y, y2 = this.corner.y; y < y2; y++) { iteratee.call(context, x, y); } } }
javascript
function(iteratee, context) { context = context || this; for (var x = this.origin.x, x2 = this.corner.x; x < x2; x++) { for (var y = this.origin.y, y2 = this.corner.y; y < y2; y++) { iteratee.call(context, x, y); } } }
[ "function", "(", "iteratee", ",", "context", ")", "{", "context", "=", "context", "||", "this", ";", "for", "(", "var", "x", "=", "this", ".", "origin", ".", "x", ",", "x2", "=", "this", ".", "corner", ".", "x", ";", "x", "<", "x2", ";", "x", ...
iterate over all points within this rect, invoking `iteratee` for each. @param {function(number,number)} iteratee - Function to call for each point. Bound to `context` when given; otherwise it is bound to this rect. Each invocation of `iteratee` is called with two arguments: the horizontal and vertical coordinates of t...
[ "iterate", "over", "all", "points", "within", "this", "rect", "invoking", "iteratee", "for", "each", "." ]
da7517823973c847ddb18c4ba4c0d25f8e55f52f
https://github.com/fin-hypergrid/rectangular/blob/da7517823973c847ddb18c4ba4c0d25f8e55f52f/index.js#L493-L500
train
Yomguithereal/dolman
index.js
makeRouter
function makeRouter() { // Solving arguments var args = [].slice.call(arguments); var beforeMiddlewares = args.slice(0, -1), routes = args[args.length - 1]; var router = express.Router(); routes.forEach(function(route) { if (!route.url) throw Error('dolman.router: one route...
javascript
function makeRouter() { // Solving arguments var args = [].slice.call(arguments); var beforeMiddlewares = args.slice(0, -1), routes = args[args.length - 1]; var router = express.Router(); routes.forEach(function(route) { if (!route.url) throw Error('dolman.router: one route...
[ "function", "makeRouter", "(", ")", "{", "// Solving arguments", "var", "args", "=", "[", "]", ".", "slice", ".", "call", "(", "arguments", ")", ";", "var", "beforeMiddlewares", "=", "args", ".", "slice", "(", "0", ",", "-", "1", ")", ",", "routes", ...
Router function.
[ "Router", "function", "." ]
b0c5fe40fa43467ce39e064a5361d6b5b24ed58a
https://github.com/Yomguithereal/dolman/blob/b0c5fe40fa43467ce39e064a5361d6b5b24ed58a/index.js#L45-L100
train
Yomguithereal/dolman
index.js
specs
function specs() { var routes = {}; // Reducing the app's recursive stack function reduceStack(path, items, item) { var nextPath; if (item.handle && item.handle.stack) { nextPath = join(path, (item.path || helpers.unescapeRegex(item.regexp) || '')); return items.concat(item.han...
javascript
function specs() { var routes = {}; // Reducing the app's recursive stack function reduceStack(path, items, item) { var nextPath; if (item.handle && item.handle.stack) { nextPath = join(path, (item.path || helpers.unescapeRegex(item.regexp) || '')); return items.concat(item.han...
[ "function", "specs", "(", ")", "{", "var", "routes", "=", "{", "}", ";", "// Reducing the app's recursive stack", "function", "reduceStack", "(", "path", ",", "items", ",", "item", ")", "{", "var", "nextPath", ";", "if", "(", "item", ".", "handle", "&&", ...
Specifications functions.
[ "Specifications", "functions", "." ]
b0c5fe40fa43467ce39e064a5361d6b5b24ed58a
https://github.com/Yomguithereal/dolman/blob/b0c5fe40fa43467ce39e064a5361d6b5b24ed58a/index.js#L105-L162
train
Yomguithereal/dolman
index.js
reduceStack
function reduceStack(path, items, item) { var nextPath; if (item.handle && item.handle.stack) { nextPath = join(path, (item.path || helpers.unescapeRegex(item.regexp) || '')); return items.concat(item.handle.stack.reduce(reduceStack.bind(null, nextPath), [])); } if (item.route)...
javascript
function reduceStack(path, items, item) { var nextPath; if (item.handle && item.handle.stack) { nextPath = join(path, (item.path || helpers.unescapeRegex(item.regexp) || '')); return items.concat(item.handle.stack.reduce(reduceStack.bind(null, nextPath), [])); } if (item.route)...
[ "function", "reduceStack", "(", "path", ",", "items", ",", "item", ")", "{", "var", "nextPath", ";", "if", "(", "item", ".", "handle", "&&", "item", ".", "handle", ".", "stack", ")", "{", "nextPath", "=", "join", "(", "path", ",", "(", "item", ".",...
Reducing the app's recursive stack
[ "Reducing", "the", "app", "s", "recursive", "stack" ]
b0c5fe40fa43467ce39e064a5361d6b5b24ed58a
https://github.com/Yomguithereal/dolman/blob/b0c5fe40fa43467ce39e064a5361d6b5b24ed58a/index.js#L109-L126
train
codeactual/grunt-horde
lib/grunt-horde/index.js
GruntHorde
function GruntHorde(grunt) { this.cwd = process.cwd(); this.config = { initConfig: {}, loadNpmTasks: {}, loadTasks: {}, registerMultiTask: {}, registerTask: {} }; this.frozenConfig = {}; this.grunt = grunt; this.lootBatch = []; }
javascript
function GruntHorde(grunt) { this.cwd = process.cwd(); this.config = { initConfig: {}, loadNpmTasks: {}, loadTasks: {}, registerMultiTask: {}, registerTask: {} }; this.frozenConfig = {}; this.grunt = grunt; this.lootBatch = []; }
[ "function", "GruntHorde", "(", "grunt", ")", "{", "this", ".", "cwd", "=", "process", ".", "cwd", "(", ")", ";", "this", ".", "config", "=", "{", "initConfig", ":", "{", "}", ",", "loadNpmTasks", ":", "{", "}", ",", "loadTasks", ":", "{", "}", ",...
GruntHorde constructor. Usage: // Gruntfile.js module.exports = function(grunt) { require('grunt-horde') .create(grunt) .loot('my-base-config-module') .loot('./config/grunt') .attack(); }; Properties: - `{object} config` Gruntfile.js values indexed by `grunt` method name - `{object} initConfig` - `{object} loadNpmT...
[ "GruntHorde", "constructor", "." ]
6ddbb70972cc961988af9f2a8d39e60552903972
https://github.com/codeactual/grunt-horde/blob/6ddbb70972cc961988af9f2a8d39e60552903972/lib/grunt-horde/index.js#L68-L80
train
d-oliveros/isomorphine
src/server/router.js
createRouter
function createRouter(modules) { debug('Creating a new router. Modules: ' + JSON.stringify(modules, null, 3)); var router = express(); router.use(bodyParser.json()); // Map the requested entity path with the actual serverside entity router.use('/isomorphine', methodLoader(modules)); // Proxy request pipe...
javascript
function createRouter(modules) { debug('Creating a new router. Modules: ' + JSON.stringify(modules, null, 3)); var router = express(); router.use(bodyParser.json()); // Map the requested entity path with the actual serverside entity router.use('/isomorphine', methodLoader(modules)); // Proxy request pipe...
[ "function", "createRouter", "(", "modules", ")", "{", "debug", "(", "'Creating a new router. Modules: '", "+", "JSON", ".", "stringify", "(", "modules", ",", "null", ",", "3", ")", ")", ";", "var", "router", "=", "express", "(", ")", ";", "router", ".", ...
Creates an express or connect-styled router, and exposes the provided modules in the router's API surface area. @param {Object} modules The entities to use. @returns {Function} An express app instance. @providesModule router
[ "Creates", "an", "express", "or", "connect", "-", "styled", "router", "and", "exposes", "the", "provided", "modules", "in", "the", "router", "s", "API", "surface", "area", "." ]
cb123d16b4be3bb7ec57758bd0b2e43767e91864
https://github.com/d-oliveros/isomorphine/blob/cb123d16b4be3bb7ec57758bd0b2e43767e91864/src/server/router.js#L23-L36
train
d-oliveros/isomorphine
src/server/router.js
methodLoader
function methodLoader(modules) { return function(req, res, next) { if (req.path === '/') return next(); var path = req.path.substr(1).split('/'); var currModule = modules; var isLastIndex, p, method; debug('Looking for isomorphine entity in: ' + path.join('.')); for (var i = 0, len = path.l...
javascript
function methodLoader(modules) { return function(req, res, next) { if (req.path === '/') return next(); var path = req.path.substr(1).split('/'); var currModule = modules; var isLastIndex, p, method; debug('Looking for isomorphine entity in: ' + path.join('.')); for (var i = 0, len = path.l...
[ "function", "methodLoader", "(", "modules", ")", "{", "return", "function", "(", "req", ",", "res", ",", "next", ")", "{", "if", "(", "req", ".", "path", "===", "'/'", ")", "return", "next", "(", ")", ";", "var", "path", "=", "req", ".", "path", ...
Maps the parameter "entity" to the actual server-side entity. @param {Object} modules The entities available in this api. @returns {Function} Middleware function that maps the :entity param with the real entity, and exposes it in req.
[ "Maps", "the", "parameter", "entity", "to", "the", "actual", "server", "-", "side", "entity", "." ]
cb123d16b4be3bb7ec57758bd0b2e43767e91864
https://github.com/d-oliveros/isomorphine/blob/cb123d16b4be3bb7ec57758bd0b2e43767e91864/src/server/router.js#L45-L81
train
walbo/grunt-px-to-rem
tasks/px_to_rem.js
checkFallback
function checkFallback(obj) { var props = []; var hasFallback = []; var values = []; for (var prop in obj) { if (obj.hasOwnProperty(prop)) { var pro = obj[prop].prop; if (obj[prop].type === 'comment') { continue; } if (props.indexOf(...
javascript
function checkFallback(obj) { var props = []; var hasFallback = []; var values = []; for (var prop in obj) { if (obj.hasOwnProperty(prop)) { var pro = obj[prop].prop; if (obj[prop].type === 'comment') { continue; } if (props.indexOf(...
[ "function", "checkFallback", "(", "obj", ")", "{", "var", "props", "=", "[", "]", ";", "var", "hasFallback", "=", "[", "]", ";", "var", "values", "=", "[", "]", ";", "for", "(", "var", "prop", "in", "obj", ")", "{", "if", "(", "obj", ".", "hasO...
Function to check if rem and px exist
[ "Function", "to", "check", "if", "rem", "and", "px", "exist" ]
6d14790e33dae9b9c37270c90249c80c17719f61
https://github.com/walbo/grunt-px-to-rem/blob/6d14790e33dae9b9c37270c90249c80c17719f61/tasks/px_to_rem.js#L149-L181
train
adityamukho/node-box-sdk
lib/connector.js
function () { if (this.auth_url) { return this.auth_url; } var self = this, destination = { protocol: 'https', host: 'www.box.com', pathname: '/api/oauth2/authorize', search: querystring.stringify({ response_type: 'code', ...
javascript
function () { if (this.auth_url) { return this.auth_url; } var self = this, destination = { protocol: 'https', host: 'www.box.com', pathname: '/api/oauth2/authorize', search: querystring.stringify({ response_type: 'code', ...
[ "function", "(", ")", "{", "if", "(", "this", ".", "auth_url", ")", "{", "return", "this", ".", "auth_url", ";", "}", "var", "self", "=", "this", ",", "destination", "=", "{", "protocol", ":", "'https'", ",", "host", ":", "'www.box.com'", ",", "pathn...
The returned URL should be provided to the end user when running in standalone mode. @summary Get the authentication URL to manually navigate to. @returns {string} The authentication URL.
[ "The", "returned", "URL", "should", "be", "provided", "to", "the", "end", "user", "when", "running", "in", "standalone", "mode", "." ]
b8403df59d53ba4e8bed5de3675467544981a683
https://github.com/adityamukho/node-box-sdk/blob/b8403df59d53ba4e8bed5de3675467544981a683/lib/connector.js#L47-L66
train
freakimkaefig/musicjson2abc
index.js
getAbcKey
function getAbcKey(fifths, mode) { if (typeof mode === 'undefined' || mode === null) mode = 'major'; return circleOfFifths[mode][fifths]; }
javascript
function getAbcKey(fifths, mode) { if (typeof mode === 'undefined' || mode === null) mode = 'major'; return circleOfFifths[mode][fifths]; }
[ "function", "getAbcKey", "(", "fifths", ",", "mode", ")", "{", "if", "(", "typeof", "mode", "===", "'undefined'", "||", "mode", "===", "null", ")", "mode", "=", "'major'", ";", "return", "circleOfFifths", "[", "mode", "]", "[", "fifths", "]", ";", "}" ...
Returns the key for abc notation from given fifths @param {number} fifths - The position inside the circle of fifths @param {string|undefined} mode - The mode (major / minor) @returns {string}
[ "Returns", "the", "key", "for", "abc", "notation", "from", "given", "fifths" ]
c119c7927c3c9b6aa5f3558cc73990478472dfbb
https://github.com/freakimkaefig/musicjson2abc/blob/c119c7927c3c9b6aa5f3558cc73990478472dfbb/index.js#L281-L284
train
freakimkaefig/musicjson2abc
index.js
getJSONId
function getJSONId(data) { var lines = data.split('\n'); for (var i = 0; i < lines.length; i++) { if (lines[i].indexOf('T:') > -1) { return lines[i].substr(lines[i].indexOf(':') + 1, lines[i].length); } } throw new Error('Could not determine "T:" field'); }
javascript
function getJSONId(data) { var lines = data.split('\n'); for (var i = 0; i < lines.length; i++) { if (lines[i].indexOf('T:') > -1) { return lines[i].substr(lines[i].indexOf(':') + 1, lines[i].length); } } throw new Error('Could not determine "T:" field'); }
[ "function", "getJSONId", "(", "data", ")", "{", "var", "lines", "=", "data", ".", "split", "(", "'\\n'", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "lines", ".", "length", ";", "i", "++", ")", "{", "if", "(", "lines", "[", "i"...
Get id from abc string @param {String} data - The abc string @returns {string}
[ "Get", "id", "from", "abc", "string" ]
c119c7927c3c9b6aa5f3558cc73990478472dfbb
https://github.com/freakimkaefig/musicjson2abc/blob/c119c7927c3c9b6aa5f3558cc73990478472dfbb/index.js#L335-L343
train
freakimkaefig/musicjson2abc
index.js
function(tune) { var ret = { attributes: { divisions: 1 /tune.getBeatLength(), clef: { line: 2 }, key: {}, time: {} } }; var measures = []; var measureCounter = 0; var barlineCounter = 0; // parse lines for (var l = 0; l < tune.lines.length; l++) { for (v...
javascript
function(tune) { var ret = { attributes: { divisions: 1 /tune.getBeatLength(), clef: { line: 2 }, key: {}, time: {} } }; var measures = []; var measureCounter = 0; var barlineCounter = 0; // parse lines for (var l = 0; l < tune.lines.length; l++) { for (v...
[ "function", "(", "tune", ")", "{", "var", "ret", "=", "{", "attributes", ":", "{", "divisions", ":", "1", "/", "tune", ".", "getBeatLength", "(", ")", ",", "clef", ":", "{", "line", ":", "2", "}", ",", "key", ":", "{", "}", ",", "time", ":", ...
Creates json object from abc tunes object @param {object} tune - The parsed tune object @returns {object}
[ "Creates", "json", "object", "from", "abc", "tunes", "object" ]
c119c7927c3c9b6aa5f3558cc73990478472dfbb
https://github.com/freakimkaefig/musicjson2abc/blob/c119c7927c3c9b6aa5f3558cc73990478472dfbb/index.js#L350-L422
train
freakimkaefig/musicjson2abc
index.js
function() { var attributes = { repeat: { left: false, right: false } }; var notes = []; /** * Set repeat left for measure */ this.setRepeatLeft = function () { attributes.repeat.left = true; }; /** * Set repeat right for measure */ this.setRepeatRight = function ()...
javascript
function() { var attributes = { repeat: { left: false, right: false } }; var notes = []; /** * Set repeat left for measure */ this.setRepeatLeft = function () { attributes.repeat.left = true; }; /** * Set repeat right for measure */ this.setRepeatRight = function ()...
[ "function", "(", ")", "{", "var", "attributes", "=", "{", "repeat", ":", "{", "left", ":", "false", ",", "right", ":", "false", "}", "}", ";", "var", "notes", "=", "[", "]", ";", "/**\n * Set repeat left for measure\n */", "this", ".", "setRepeatLeft",...
Constructor for measure objects @constructor
[ "Constructor", "for", "measure", "objects" ]
c119c7927c3c9b6aa5f3558cc73990478472dfbb
https://github.com/freakimkaefig/musicjson2abc/blob/c119c7927c3c9b6aa5f3558cc73990478472dfbb/index.js#L428-L519
train
Hugo-ter-Doest/chart-parsers
lib/HeadCornerParser.js
HeadCornerChartParser
function HeadCornerChartParser(grammar) { this.grammar = grammar; this.grammar.computeHCRelation(); logger.debug("HeadCornerChartParser: " + JSON.stringify(grammar.hc)); }
javascript
function HeadCornerChartParser(grammar) { this.grammar = grammar; this.grammar.computeHCRelation(); logger.debug("HeadCornerChartParser: " + JSON.stringify(grammar.hc)); }
[ "function", "HeadCornerChartParser", "(", "grammar", ")", "{", "this", ".", "grammar", "=", "grammar", ";", "this", ".", "grammar", ".", "computeHCRelation", "(", ")", ";", "logger", ".", "debug", "(", "\"HeadCornerChartParser: \"", "+", "JSON", ".", "stringif...
Constructor for the left-corner parser
[ "Constructor", "for", "the", "left", "-", "corner", "parser" ]
81be32f897f6dceeffebd2009ad865964da12c4b
https://github.com/Hugo-ter-Doest/chart-parsers/blob/81be32f897f6dceeffebd2009ad865964da12c4b/lib/HeadCornerParser.js#L181-L185
train
d-oliveros/isomorphine
src/server/factory.js
requireMethods
function requireMethods(dir) { if (!dir) dir = getCallerDirname(); var modules = {}; fs .readdirSync(dir) .filter(function(filename) { return filename !== 'index.js'; }) .forEach(function(filename) { var filePath = path.join(dir, filename); var Stats = fs.lstatSync(filePath); ...
javascript
function requireMethods(dir) { if (!dir) dir = getCallerDirname(); var modules = {}; fs .readdirSync(dir) .filter(function(filename) { return filename !== 'index.js'; }) .forEach(function(filename) { var filePath = path.join(dir, filename); var Stats = fs.lstatSync(filePath); ...
[ "function", "requireMethods", "(", "dir", ")", "{", "if", "(", "!", "dir", ")", "dir", "=", "getCallerDirname", "(", ")", ";", "var", "modules", "=", "{", "}", ";", "fs", ".", "readdirSync", "(", "dir", ")", ".", "filter", "(", "function", "(", "fi...
Recursively requires the modules in current dir. @param {String} dir The base directory to require entities from. @return {Object} An object with all the modules loaded.
[ "Recursively", "requires", "the", "modules", "in", "current", "dir", "." ]
cb123d16b4be3bb7ec57758bd0b2e43767e91864
https://github.com/d-oliveros/isomorphine/blob/cb123d16b4be3bb7ec57758bd0b2e43767e91864/src/server/factory.js#L50-L86
train
d-oliveros/isomorphine
src/server/factory.js
getCallerDirname
function getCallerDirname() { var orig = Error.prepareStackTrace; Error.prepareStackTrace = function(_, stack){ return stack; }; var err = new Error(); Error.captureStackTrace(err, arguments.callee); var stack = err.stack; Error.prepareStackTrace = orig; var requester = stack[2].getFileName(); return p...
javascript
function getCallerDirname() { var orig = Error.prepareStackTrace; Error.prepareStackTrace = function(_, stack){ return stack; }; var err = new Error(); Error.captureStackTrace(err, arguments.callee); var stack = err.stack; Error.prepareStackTrace = orig; var requester = stack[2].getFileName(); return p...
[ "function", "getCallerDirname", "(", ")", "{", "var", "orig", "=", "Error", ".", "prepareStackTrace", ";", "Error", ".", "prepareStackTrace", "=", "function", "(", "_", ",", "stack", ")", "{", "return", "stack", ";", "}", ";", "var", "err", "=", "new", ...
Gets the dirname of the caller function that is calling this method. @return {String} Absolute path to the caller's directory.
[ "Gets", "the", "dirname", "of", "the", "caller", "function", "that", "is", "calling", "this", "method", "." ]
cb123d16b4be3bb7ec57758bd0b2e43767e91864
https://github.com/d-oliveros/isomorphine/blob/cb123d16b4be3bb7ec57758bd0b2e43767e91864/src/server/factory.js#L92-L102
train
adityamukho/node-box-sdk
lib/api/content/folders.js
function (name, parent_id, done, config) { if (!_.isString(name) || !_.isNumber(parseInt(parent_id, 10))) { return done(new Error('Invalid params. Required - name: string, parent_id: number')); } this._request(['folders'], 'POST', done, null, { name: name, parent: {...
javascript
function (name, parent_id, done, config) { if (!_.isString(name) || !_.isNumber(parseInt(parent_id, 10))) { return done(new Error('Invalid params. Required - name: string, parent_id: number')); } this._request(['folders'], 'POST', done, null, { name: name, parent: {...
[ "function", "(", "name", ",", "parent_id", ",", "done", ",", "config", ")", "{", "if", "(", "!", "_", ".", "isString", "(", "name", ")", "||", "!", "_", ".", "isNumber", "(", "parseInt", "(", "parent_id", ",", "10", ")", ")", ")", "{", "return", ...
Used to create a new empty folder. The new folder will be created inside of the specified parent folder. @summary Create a New Folder. @see {@link https://developers.box.com/docs/#folders-create-a-new-folder} @param {string} name - The folder's name. @param {number} parent_id - The parent folder's ID. @param {requestCa...
[ "Used", "to", "create", "a", "new", "empty", "folder", ".", "The", "new", "folder", "will", "be", "created", "inside", "of", "the", "specified", "parent", "folder", "." ]
b8403df59d53ba4e8bed5de3675467544981a683
https://github.com/adityamukho/node-box-sdk/blob/b8403df59d53ba4e8bed5de3675467544981a683/lib/api/content/folders.js#L59-L69
train
svanderburg/nijs
lib/ast/NixAttrReference.js
NixAttrReference
function NixAttrReference(args) { this.attrSetExpr = args.attrSetExpr; this.refExpr = args.refExpr; this.orExpr = args.orExpr; }
javascript
function NixAttrReference(args) { this.attrSetExpr = args.attrSetExpr; this.refExpr = args.refExpr; this.orExpr = args.orExpr; }
[ "function", "NixAttrReference", "(", "args", ")", "{", "this", ".", "attrSetExpr", "=", "args", ".", "attrSetExpr", ";", "this", ".", "refExpr", "=", "args", ".", "refExpr", ";", "this", ".", "orExpr", "=", "args", ".", "orExpr", ";", "}" ]
Creates a new NixAttrReference instance. @class NixAttrReference @extends NixObject @classdesc Captures the abstract syntax of a Nix of an expression yielding an attribute set and an expression yielding an attribute name that references a member of the former attribute set. @constructor @param {Object} args Arguments...
[ "Creates", "a", "new", "NixAttrReference", "instance", "." ]
4e2738cbff3a43aba9297315ca5120cecf8dae3e
https://github.com/svanderburg/nijs/blob/4e2738cbff3a43aba9297315ca5120cecf8dae3e/lib/ast/NixAttrReference.js#L20-L24
train
ericprud/jsg
lib/json-grammar.js
throwUnexpected
function throwUnexpected (attr, obj) { var e = Unexpected(attr, obj); Error.captureStackTrace(e, throwUnexpected); throw e; }
javascript
function throwUnexpected (attr, obj) { var e = Unexpected(attr, obj); Error.captureStackTrace(e, throwUnexpected); throw e; }
[ "function", "throwUnexpected", "(", "attr", ",", "obj", ")", "{", "var", "e", "=", "Unexpected", "(", "attr", ",", "obj", ")", ";", "Error", ".", "captureStackTrace", "(", "e", ",", "throwUnexpected", ")", ";", "throw", "e", ";", "}" ]
thrower for inline conditionals
[ "thrower", "for", "inline", "conditionals" ]
0be3fcf487356c23c88117081214d00bb2fb3274
https://github.com/ericprud/jsg/blob/0be3fcf487356c23c88117081214d00bb2fb3274/lib/json-grammar.js#L21-L25
train
thlorenz/dockerify
index.js
targz
function targz(stream, opts) { return exports.tar(stream.pipe(zlib.createGunzip()), opts); }
javascript
function targz(stream, opts) { return exports.tar(stream.pipe(zlib.createGunzip()), opts); }
[ "function", "targz", "(", "stream", ",", "opts", ")", "{", "return", "exports", ".", "tar", "(", "stream", ".", "pipe", "(", "zlib", ".", "createGunzip", "(", ")", ")", ",", "opts", ")", ";", "}" ]
Gunzips the .tar.gz stream and passes it along to `tar`. @name targz @function @param {ReadableStream} stream .tar.gz stream @param {Object} opts @see `tar` @return {ReadableStream} the transformed tar stream
[ "Gunzips", "the", ".", "tar", ".", "gz", "stream", "and", "passes", "it", "along", "to", "tar", "." ]
5f769115c32782cc60db50c2ce4b3bbc7e5d68b5
https://github.com/thlorenz/dockerify/blob/5f769115c32782cc60db50c2ce4b3bbc7e5d68b5/index.js#L142-L144
train
deepstreamIO/deepstream.io-tools-react
src/deepstream-react.js
function( state ) { var key, clonedState = {}; for( key in state ) { if( key !== LOCAL ) { clonedState[ key ] = state[ key ]; } } return clonedState; }
javascript
function( state ) { var key, clonedState = {}; for( key in state ) { if( key !== LOCAL ) { clonedState[ key ] = state[ key ]; } } return clonedState; }
[ "function", "(", "state", ")", "{", "var", "key", ",", "clonedState", "=", "{", "}", ";", "for", "(", "key", "in", "state", ")", "{", "if", "(", "key", "!==", "LOCAL", ")", "{", "clonedState", "[", "key", "]", "=", "state", "[", "key", "]", ";"...
Creates a shallow copy of the state and omits the local namespace @param {Object} state a serializable component state @private @returns {Object} clonedState a serializable component state
[ "Creates", "a", "shallow", "copy", "of", "the", "state", "and", "omits", "the", "local", "namespace" ]
aec3b3fe3c9b12da0b05daf7a878173a3763e864
https://github.com/deepstreamIO/deepstream.io-tools-react/blob/aec3b3fe3c9b12da0b05daf7a878173a3763e864/src/deepstream-react.js#L143-L154
train
deepstreamIO/deepstream.io-tools-react
src/deepstream-react.js
function() { if( this.dsRecord && this.dsRecord.isReady && Object.keys( this.dsRecord.get() ).length === 0 && this.state ) { this.dsRecord.set( this.state ); } }
javascript
function() { if( this.dsRecord && this.dsRecord.isReady && Object.keys( this.dsRecord.get() ).length === 0 && this.state ) { this.dsRecord.set( this.state ); } }
[ "function", "(", ")", "{", "if", "(", "this", ".", "dsRecord", "&&", "this", ".", "dsRecord", ".", "isReady", "&&", "Object", ".", "keys", "(", "this", ".", "dsRecord", ".", "get", "(", ")", ")", ".", "length", "===", "0", "&&", "this", ".", "sta...
Set's the record's initial dataset, but only if the record is present, is empty and the state is populated. This would most likely be the case for new react components that expose a getInitialState method @private @returns {void}
[ "Set", "s", "the", "record", "s", "initial", "dataset", "but", "only", "if", "the", "record", "is", "present", "is", "empty", "and", "the", "state", "is", "populated", ".", "This", "would", "most", "likely", "be", "the", "case", "for", "new", "react", ...
aec3b3fe3c9b12da0b05daf7a878173a3763e864
https://github.com/deepstreamIO/deepstream.io-tools-react/blob/aec3b3fe3c9b12da0b05daf7a878173a3763e864/src/deepstream-react.js#L164-L168
train
Liby99/keeling-js
lib/crypto.js
encrypt
function encrypt(salt, password) { var hash = crypto.createHash('sha256').update(salt + password).digest('base64'); return salt + hash; }
javascript
function encrypt(salt, password) { var hash = crypto.createHash('sha256').update(salt + password).digest('base64'); return salt + hash; }
[ "function", "encrypt", "(", "salt", ",", "password", ")", "{", "var", "hash", "=", "crypto", ".", "createHash", "(", "'sha256'", ")", ".", "update", "(", "salt", "+", "password", ")", ".", "digest", "(", "'base64'", ")", ";", "return", "salt", "+", "...
Encrypt the password with the salt @param salt @param password
[ "Encrypt", "the", "password", "with", "the", "salt" ]
a49d7669c9a5425185068554c0b013cf87fffe20
https://github.com/Liby99/keeling-js/blob/a49d7669c9a5425185068554c0b013cf87fffe20/lib/crypto.js#L51-L54
train
jub3i/node-mem-stat
index.js
_toCamelCase
function _toCamelCase(str) { var newString = ''; var insideParens = false; newString += str[0].toLowerCase(); for (var i = 1; i < str.length; i++) { var char = str[i]; switch (char) { case ')': case '_': break; case '(': insideParens = true; break; default...
javascript
function _toCamelCase(str) { var newString = ''; var insideParens = false; newString += str[0].toLowerCase(); for (var i = 1; i < str.length; i++) { var char = str[i]; switch (char) { case ')': case '_': break; case '(': insideParens = true; break; default...
[ "function", "_toCamelCase", "(", "str", ")", "{", "var", "newString", "=", "''", ";", "var", "insideParens", "=", "false", ";", "newString", "+=", "str", "[", "0", "]", ".", "toLowerCase", "(", ")", ";", "for", "(", "var", "i", "=", "1", ";", "i", ...
quick dirty to handle parens and underscores
[ "quick", "dirty", "to", "handle", "parens", "and", "underscores" ]
8481e35560bfcdf73a76c9be4b869ed3eef2f009
https://github.com/jub3i/node-mem-stat/blob/8481e35560bfcdf73a76c9be4b869ed3eef2f009/index.js#L131-L156
train
doowb/githubbot
index.js
GithubBot
function GithubBot(options) { if (!(this instanceof GithubBot)) { return new GithubBot(options); } BaseBot.call(this, options); this.handlers(events); this.define('events', events); }
javascript
function GithubBot(options) { if (!(this instanceof GithubBot)) { return new GithubBot(options); } BaseBot.call(this, options); this.handlers(events); this.define('events', events); }
[ "function", "GithubBot", "(", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "GithubBot", ")", ")", "{", "return", "new", "GithubBot", "(", "options", ")", ";", "}", "BaseBot", ".", "call", "(", "this", ",", "options", ")", ";", "thi...
Create a new instance of a GithubBot with provided options. ```js var bot = new GithubBot(); ``` @param {Object} `options` Options to configure the github bot. @api public
[ "Create", "a", "new", "instance", "of", "a", "GithubBot", "with", "provided", "options", "." ]
aa084bd2c432fa1edea58431db5d8ffee1f4da7c
https://github.com/doowb/githubbot/blob/aa084bd2c432fa1edea58431db5d8ffee1f4da7c/index.js#L24-L32
train
adityamukho/node-box-sdk
lib/api/content/events.js
function () { var self = this; async.waterfall([ function (next) { if (!self.events) { self.events = new Datastore(); self.events.ensureIndex({ fieldName: 'event_id', unique: true }); self.eve...
javascript
function () { var self = this; async.waterfall([ function (next) { if (!self.events) { self.events = new Datastore(); self.events.ensureIndex({ fieldName: 'event_id', unique: true }); self.eve...
[ "function", "(", ")", "{", "var", "self", "=", "this", ";", "async", ".", "waterfall", "(", "[", "function", "(", "next", ")", "{", "if", "(", "!", "self", ".", "events", ")", "{", "self", ".", "events", "=", "new", "Datastore", "(", ")", ";", ...
Start long-polling for events. @see {@link https://developers.box.com/docs/#events-long-polling} @fires Connection#"polling.error" @fires Connection#"polling.end"
[ "Start", "long", "-", "polling", "for", "events", "." ]
b8403df59d53ba4e8bed5de3675467544981a683
https://github.com/adityamukho/node-box-sdk/blob/b8403df59d53ba4e8bed5de3675467544981a683/lib/api/content/events.js#L17-L79
train
adityamukho/node-box-sdk
lib/api/content/search.js
function (query, opts, done, config) { if (!_.isString(query)) { return done(new Error('query must be a string.')); } opts = opts || {}; opts.query = query; this._request(['search'], 'GET', done, opts, null, null, null, null, config); }
javascript
function (query, opts, done, config) { if (!_.isString(query)) { return done(new Error('query must be a string.')); } opts = opts || {}; opts.query = query; this._request(['search'], 'GET', done, opts, null, null, null, null, config); }
[ "function", "(", "query", ",", "opts", ",", "done", ",", "config", ")", "{", "if", "(", "!", "_", ".", "isString", "(", "query", ")", ")", "{", "return", "done", "(", "new", "Error", "(", "'query must be a string.'", ")", ")", ";", "}", "opts", "="...
Options and parameters for search. @typedef {Object} OptsSearch @property {string} [scope] - The scope for which you want to limit your search to. Can be {@linkcode user_content} for a search limited to only the current user or {@linkcode enterprise_content} for the entire enterprise. @property {string} [file_extension...
[ "Options", "and", "parameters", "for", "search", "." ]
b8403df59d53ba4e8bed5de3675467544981a683
https://github.com/adityamukho/node-box-sdk/blob/b8403df59d53ba4e8bed5de3675467544981a683/lib/api/content/search.js#L59-L68
train
paritytech/js-jsonrpc
scripts/build-rpc-markdown.js
hasExample
function hasExample ({ optional, example, details } = {}) { if (optional || example !== undefined) { return true; } if (details !== undefined) { const values = Object.keys(details).map((key) => details[key]); return values.every(hasExample); } return false; }
javascript
function hasExample ({ optional, example, details } = {}) { if (optional || example !== undefined) { return true; } if (details !== undefined) { const values = Object.keys(details).map((key) => details[key]); return values.every(hasExample); } return false; }
[ "function", "hasExample", "(", "{", "optional", ",", "example", ",", "details", "}", "=", "{", "}", ")", "{", "if", "(", "optional", "||", "example", "!==", "undefined", ")", "{", "return", "true", ";", "}", "if", "(", "details", "!==", "undefined", ...
Checks if a field definition has an example, or describes an object with fields that recursively have examples of their own, or is optional.
[ "Checks", "if", "a", "field", "definition", "has", "an", "example", "or", "describes", "an", "object", "with", "fields", "that", "recursively", "have", "examples", "of", "their", "own", "or", "is", "optional", "." ]
045b8953926cbc0f663de328954f1ca4ba8a4e7c
https://github.com/paritytech/js-jsonrpc/blob/045b8953926cbc0f663de328954f1ca4ba8a4e7c/scripts/build-rpc-markdown.js#L88-L100
train
paritytech/js-jsonrpc
scripts/build-rpc-markdown.js
getExample
function getExample (obj) { if (isArray(obj)) { return removeOptionalWithoutExamples(obj).map(getExample); } const { example, details } = obj; if (example === undefined && details !== undefined) { const nested = {}; Object.keys(details).forEach((key) => { nested[key] = getExample(details[ke...
javascript
function getExample (obj) { if (isArray(obj)) { return removeOptionalWithoutExamples(obj).map(getExample); } const { example, details } = obj; if (example === undefined && details !== undefined) { const nested = {}; Object.keys(details).forEach((key) => { nested[key] = getExample(details[ke...
[ "function", "getExample", "(", "obj", ")", "{", "if", "(", "isArray", "(", "obj", ")", ")", "{", "return", "removeOptionalWithoutExamples", "(", "obj", ")", ".", "map", "(", "getExample", ")", ";", "}", "const", "{", "example", ",", "details", "}", "="...
Grabs JSON compatible
[ "Grabs", "JSON", "compatible" ]
045b8953926cbc0f663de328954f1ca4ba8a4e7c
https://github.com/paritytech/js-jsonrpc/blob/045b8953926cbc0f663de328954f1ca4ba8a4e7c/scripts/build-rpc-markdown.js#L110-L128
train
paritytech/js-jsonrpc
scripts/build-rpc-markdown.js
methodComparator
function methodComparator (a, b) { const sectionA = spec[a].section || ''; const sectionB = spec[b].section || ''; return sectionA.localeCompare(sectionB) || a.localeCompare(b); }
javascript
function methodComparator (a, b) { const sectionA = spec[a].section || ''; const sectionB = spec[b].section || ''; return sectionA.localeCompare(sectionB) || a.localeCompare(b); }
[ "function", "methodComparator", "(", "a", ",", "b", ")", "{", "const", "sectionA", "=", "spec", "[", "a", "]", ".", "section", "||", "''", ";", "const", "sectionB", "=", "spec", "[", "b", "]", ".", "section", "||", "''", ";", "return", "sectionA", ...
Comparator that will sort by sections first, names second
[ "Comparator", "that", "will", "sort", "by", "sections", "first", "names", "second" ]
045b8953926cbc0f663de328954f1ca4ba8a4e7c
https://github.com/paritytech/js-jsonrpc/blob/045b8953926cbc0f663de328954f1ca4ba8a4e7c/scripts/build-rpc-markdown.js#L283-L288
train
quantmind/d3-visualize
src/transforms/aggregate.js
group
function group (frame) { let v, name, op; const entries = fields.map((field, index) => { name = ops[index]; op = scalar_operations.get('count'); if (name) { op = scalar_operations.get(name); if (!op) { op = scalar_op...
javascript
function group (frame) { let v, name, op; const entries = fields.map((field, index) => { name = ops[index]; op = scalar_operations.get('count'); if (name) { op = scalar_operations.get(name); if (!op) { op = scalar_op...
[ "function", "group", "(", "frame", ")", "{", "let", "v", ",", "name", ",", "op", ";", "const", "entries", "=", "fields", ".", "map", "(", "(", "field", ",", "index", ")", "=>", "{", "name", "=", "ops", "[", "index", "]", ";", "op", "=", "scalar...
Perform aggregation with a set of data fields to group by
[ "Perform", "aggregation", "with", "a", "set", "of", "data", "fields", "to", "group", "by" ]
67dac5a3ea5146eb70eb975667b49cf3827a5df7
https://github.com/quantmind/d3-visualize/blob/67dac5a3ea5146eb70eb975667b49cf3827a5df7/src/transforms/aggregate.js#L93-L123
train
ralphv/zoran
index.js
function(func, name) { return proxy.createProxy(func, handlers.beforeFunc, handlers.afterFunc, {attachMonitor: true}, name); }
javascript
function(func, name) { return proxy.createProxy(func, handlers.beforeFunc, handlers.afterFunc, {attachMonitor: true}, name); }
[ "function", "(", "func", ",", "name", ")", "{", "return", "proxy", ".", "createProxy", "(", "func", ",", "handlers", ".", "beforeFunc", ",", "handlers", ".", "afterFunc", ",", "{", "attachMonitor", ":", "true", "}", ",", "name", ")", ";", "}" ]
Manually attach a monitor to a single function @param {function} func the function reference to monitor @param {string} name the name of the function, this will be the main identifier in the statistics produced @returns {function} the new function reference that should replace the passed in reference
[ "Manually", "attach", "a", "monitor", "to", "a", "single", "function" ]
b8f83d37e32ca496353b6e1981fa09e25de3cc35
https://github.com/ralphv/zoran/blob/b8f83d37e32ca496353b6e1981fa09e25de3cc35/index.js#L112-L114
train
ralphv/zoran
index.js
function(name, args) { var callInstance = {name: name}; handlers.beforeFunc({name: name}, null, args, callInstance); return callInstance; }
javascript
function(name, args) { var callInstance = {name: name}; handlers.beforeFunc({name: name}, null, args, callInstance); return callInstance; }
[ "function", "(", "name", ",", "args", ")", "{", "var", "callInstance", "=", "{", "name", ":", "name", "}", ";", "handlers", ".", "beforeFunc", "(", "{", "name", ":", "name", "}", ",", "null", ",", "args", ",", "callInstance", ")", ";", "return", "c...
Manually call at the beginning of a certain operation you want to measure @param {string} name this will be the main identifier in the statistics produced @param {array} args arguments of arguments @returns {{}} the callInstance object, you must pass this to the matching end function
[ "Manually", "call", "at", "the", "beginning", "of", "a", "certain", "operation", "you", "want", "to", "measure" ]
b8f83d37e32ca496353b6e1981fa09e25de3cc35
https://github.com/ralphv/zoran/blob/b8f83d37e32ca496353b6e1981fa09e25de3cc35/index.js#L122-L126
train
ralphv/zoran
index.js
function(args, callInstance) { handlers.afterFunc({name: callInstance.name}, null, args, callInstance); }
javascript
function(args, callInstance) { handlers.afterFunc({name: callInstance.name}, null, args, callInstance); }
[ "function", "(", "args", ",", "callInstance", ")", "{", "handlers", ".", "afterFunc", "(", "{", "name", ":", "callInstance", ".", "name", "}", ",", "null", ",", "args", ",", "callInstance", ")", ";", "}" ]
Manually call at the end of a certain operation you want to measure @param {array} args args arguments of arguments @param callInstance the return value you got from begin function must be passed here
[ "Manually", "call", "at", "the", "end", "of", "a", "certain", "operation", "you", "want", "to", "measure" ]
b8f83d37e32ca496353b6e1981fa09e25de3cc35
https://github.com/ralphv/zoran/blob/b8f83d37e32ca496353b6e1981fa09e25de3cc35/index.js#L133-L135
train
reactbits/fiber
lib/message/uploadbutton.js
UploadButton
function UploadButton(props) { var onClick = function onClick() { var inputStyle = 'display:block;visibility:hidden;width:0;height:0'; var input = $('<input style="' + inputStyle + '" type="file" name="somename" size="chars">'); input.appendTo($('body')); input.change(function () { console.log('...
javascript
function UploadButton(props) { var onClick = function onClick() { var inputStyle = 'display:block;visibility:hidden;width:0;height:0'; var input = $('<input style="' + inputStyle + '" type="file" name="somename" size="chars">'); input.appendTo($('body')); input.change(function () { console.log('...
[ "function", "UploadButton", "(", "props", ")", "{", "var", "onClick", "=", "function", "onClick", "(", ")", "{", "var", "inputStyle", "=", "'display:block;visibility:hidden;width:0;height:0'", ";", "var", "input", "=", "$", "(", "'<input style=\"'", "+", "inputSty...
import Upload from 'component-upload';
[ "import", "Upload", "from", "component", "-", "upload", ";" ]
69704fc2083ac3cbd2246a326ee6b8e9c8f52074
https://github.com/reactbits/fiber/blob/69704fc2083ac3cbd2246a326ee6b8e9c8f52074/lib/message/uploadbutton.js#L63-L99
train
d-oliveros/isomorphine
src/client/factory.js
createProxies
function createProxies(config, map, parentPath) { parentPath = parentPath || []; var isBase = parentPath.length === 0; var proxies = {}; var path; for (var key in map) { if (map.hasOwnProperty(key)) { if (isObject(map[key])) { proxies[key] = createProxies(config, map[key], parentPath.conca...
javascript
function createProxies(config, map, parentPath) { parentPath = parentPath || []; var isBase = parentPath.length === 0; var proxies = {}; var path; for (var key in map) { if (map.hasOwnProperty(key)) { if (isObject(map[key])) { proxies[key] = createProxies(config, map[key], parentPath.conca...
[ "function", "createProxies", "(", "config", ",", "map", ",", "parentPath", ")", "{", "parentPath", "=", "parentPath", "||", "[", "]", ";", "var", "isBase", "=", "parentPath", ".", "length", "===", "0", ";", "var", "proxies", "=", "{", "}", ";", "var", ...
Creates proxied methods using a provided map. If parentPath is provided, it will be used to build the proxied method's endpoint. @param {Object} map The entity map to use. @param {Array} parentPath The path to the parent entity.
[ "Creates", "proxied", "methods", "using", "a", "provided", "map", ".", "If", "parentPath", "is", "provided", "it", "will", "be", "used", "to", "build", "the", "proxied", "method", "s", "endpoint", "." ]
cb123d16b4be3bb7ec57758bd0b2e43767e91864
https://github.com/d-oliveros/isomorphine/blob/cb123d16b4be3bb7ec57758bd0b2e43767e91864/src/client/factory.js#L68-L88
train
d-oliveros/isomorphine
src/client/factory.js
getConfigFromBrowser
function getConfigFromBrowser() { var defaultLocation = { port: '80', hostname: 'localhost', protocol: 'http:' }; var wLocation = (global.location) ? global.location : defaultLocation; var location = { port: wLocation.port, host: wLocation.protocol + '//' + wLocation.hostname }; ...
javascript
function getConfigFromBrowser() { var defaultLocation = { port: '80', hostname: 'localhost', protocol: 'http:' }; var wLocation = (global.location) ? global.location : defaultLocation; var location = { port: wLocation.port, host: wLocation.protocol + '//' + wLocation.hostname }; ...
[ "function", "getConfigFromBrowser", "(", ")", "{", "var", "defaultLocation", "=", "{", "port", ":", "'80'", ",", "hostname", ":", "'localhost'", ",", "protocol", ":", "'http:'", "}", ";", "var", "wLocation", "=", "(", "global", ".", "location", ")", "?", ...
Gets the default configuration based on environmental variables @return {Object} Initial config
[ "Gets", "the", "default", "configuration", "based", "on", "environmental", "variables" ]
cb123d16b4be3bb7ec57758bd0b2e43767e91864
https://github.com/d-oliveros/isomorphine/blob/cb123d16b4be3bb7ec57758bd0b2e43767e91864/src/client/factory.js#L94-L117
train
paritytech/js-jsonrpc
src/helpers.js
withPreamble
function withPreamble (preamble, spec) { Object.defineProperty(spec, '_preamble', { value: preamble.trim(), enumerable: false }); return spec; }
javascript
function withPreamble (preamble, spec) { Object.defineProperty(spec, '_preamble', { value: preamble.trim(), enumerable: false }); return spec; }
[ "function", "withPreamble", "(", "preamble", ",", "spec", ")", "{", "Object", ".", "defineProperty", "(", "spec", ",", "'_preamble'", ",", "{", "value", ":", "preamble", ".", "trim", "(", ")", ",", "enumerable", ":", "false", "}", ")", ";", "return", "...
Enrich the API spec by additional markdown-formatted preamble
[ "Enrich", "the", "API", "spec", "by", "additional", "markdown", "-", "formatted", "preamble" ]
045b8953926cbc0f663de328954f1ca4ba8a4e7c
https://github.com/paritytech/js-jsonrpc/blob/045b8953926cbc0f663de328954f1ca4ba8a4e7c/src/helpers.js#L52-L59
train
paritytech/js-jsonrpc
src/helpers.js
withComment
function withComment (example, comment) { const constructor = example == null ? null : example.constructor; if (constructor === Object || constructor === Array) { Object.defineProperty(example, '_comment', { value: comment, enumerable: false }); return example; } // Convert primitives...
javascript
function withComment (example, comment) { const constructor = example == null ? null : example.constructor; if (constructor === Object || constructor === Array) { Object.defineProperty(example, '_comment', { value: comment, enumerable: false }); return example; } // Convert primitives...
[ "function", "withComment", "(", "example", ",", "comment", ")", "{", "const", "constructor", "=", "example", "==", "null", "?", "null", ":", "example", ".", "constructor", ";", "if", "(", "constructor", "===", "Object", "||", "constructor", "===", "Array", ...
Enrich any example value with a comment to print in the docs
[ "Enrich", "any", "example", "value", "with", "a", "comment", "to", "print", "in", "the", "docs" ]
045b8953926cbc0f663de328954f1ca4ba8a4e7c
https://github.com/paritytech/js-jsonrpc/blob/045b8953926cbc0f663de328954f1ca4ba8a4e7c/src/helpers.js#L62-L76
train
vicanso/performance-nodejs
index.js
getDelay
function getDelay(start, interval) { const delta = process.hrtime(start); const nanosec = (delta[0] * 1e9) + delta[1]; /* eslint no-bitwise: ["error", { "int32Hint": true }] */ return Math.max((nanosec / 1e6 | 0) - interval, 0); }
javascript
function getDelay(start, interval) { const delta = process.hrtime(start); const nanosec = (delta[0] * 1e9) + delta[1]; /* eslint no-bitwise: ["error", { "int32Hint": true }] */ return Math.max((nanosec / 1e6 | 0) - interval, 0); }
[ "function", "getDelay", "(", "start", ",", "interval", ")", "{", "const", "delta", "=", "process", ".", "hrtime", "(", "start", ")", ";", "const", "nanosec", "=", "(", "delta", "[", "0", "]", "*", "1e9", ")", "+", "delta", "[", "1", "]", ";", "/*...
Get the dalay of interval @param {Array} start The start time @param {Number} interval The value of interval, ms @returns {Number} The dalay ms
[ "Get", "the", "dalay", "of", "interval" ]
8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca
https://github.com/vicanso/performance-nodejs/blob/8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca/index.js#L34-L39
train
vicanso/performance-nodejs
index.js
format
function format(value, unitInfo) { const unit = unitInfo.unit; const precision = unitInfo.precision || 0; let v = 0; switch (unit) { case 'GB': v = value / GB; break; case 'MB': v = value / MB; break; default: v = value; break; } v = parseFloat(Number(v).toFix...
javascript
function format(value, unitInfo) { const unit = unitInfo.unit; const precision = unitInfo.precision || 0; let v = 0; switch (unit) { case 'GB': v = value / GB; break; case 'MB': v = value / MB; break; default: v = value; break; } v = parseFloat(Number(v).toFix...
[ "function", "format", "(", "value", ",", "unitInfo", ")", "{", "const", "unit", "=", "unitInfo", ".", "unit", ";", "const", "precision", "=", "unitInfo", ".", "precision", "||", "0", ";", "let", "v", "=", "0", ";", "switch", "(", "unit", ")", "{", ...
Format the bytes by unit @param {Number} value Bytes count @param {Object} unitInfo {unit: String, precision: Number} unit: 'GB', 'MB' or 'B' precision: the precision of size, default is 0 @returns {Number}
[ "Format", "the", "bytes", "by", "unit" ]
8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca
https://github.com/vicanso/performance-nodejs/blob/8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca/index.js#L49-L66
train
vicanso/performance-nodejs
index.js
getHeapStatistics
function getHeapStatistics(unitInfo) { const data = v8.getHeapStatistics(); const keys = Object.keys(data); const result = {}; keys.forEach((key) => { result[key] = format(data[key], unitInfo); }); return result; }
javascript
function getHeapStatistics(unitInfo) { const data = v8.getHeapStatistics(); const keys = Object.keys(data); const result = {}; keys.forEach((key) => { result[key] = format(data[key], unitInfo); }); return result; }
[ "function", "getHeapStatistics", "(", "unitInfo", ")", "{", "const", "data", "=", "v8", ".", "getHeapStatistics", "(", ")", ";", "const", "keys", "=", "Object", ".", "keys", "(", "data", ")", ";", "const", "result", "=", "{", "}", ";", "keys", ".", "...
Get the heap statistics @param {Object} unitInfo The unit format setting @returns {Object} The heap statistics
[ "Get", "the", "heap", "statistics" ]
8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca
https://github.com/vicanso/performance-nodejs/blob/8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca/index.js#L73-L81
train
vicanso/performance-nodejs
index.js
getHeapSpaceStatistics
function getHeapSpaceStatistics(unitInfo) { const arr = v8.getHeapSpaceStatistics(); const result = {}; arr.forEach((item) => { const data = {}; const keys = Object.keys(item); keys.forEach((key) => { if (key === 'space_name') { return; } // replace the space_ key prefix ...
javascript
function getHeapSpaceStatistics(unitInfo) { const arr = v8.getHeapSpaceStatistics(); const result = {}; arr.forEach((item) => { const data = {}; const keys = Object.keys(item); keys.forEach((key) => { if (key === 'space_name') { return; } // replace the space_ key prefix ...
[ "function", "getHeapSpaceStatistics", "(", "unitInfo", ")", "{", "const", "arr", "=", "v8", ".", "getHeapSpaceStatistics", "(", ")", ";", "const", "result", "=", "{", "}", ";", "arr", ".", "forEach", "(", "(", "item", ")", "=>", "{", "const", "data", "...
Get the heap space statistics @param {Object} unitInfo The unit format setting @returns {Object} The heap space statistics
[ "Get", "the", "heap", "space", "statistics" ]
8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca
https://github.com/vicanso/performance-nodejs/blob/8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca/index.js#L88-L104
train
vicanso/performance-nodejs
index.js
getMemoryUsage
function getMemoryUsage(unitInfo) { const data = process.memoryUsage(); const keys = Object.keys(data); const result = {}; keys.forEach((key) => { result[key] = format(data[key], unitInfo); }); return result; }
javascript
function getMemoryUsage(unitInfo) { const data = process.memoryUsage(); const keys = Object.keys(data); const result = {}; keys.forEach((key) => { result[key] = format(data[key], unitInfo); }); return result; }
[ "function", "getMemoryUsage", "(", "unitInfo", ")", "{", "const", "data", "=", "process", ".", "memoryUsage", "(", ")", ";", "const", "keys", "=", "Object", ".", "keys", "(", "data", ")", ";", "const", "result", "=", "{", "}", ";", "keys", ".", "forE...
Get the memory usage @param {Object} unitInfo The unit format setting @returns {Object} The memory usage
[ "Get", "the", "memory", "usage" ]
8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca
https://github.com/vicanso/performance-nodejs/blob/8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca/index.js#L111-L119
train
vicanso/performance-nodejs
index.js
get
function get(arr, filter, defaultValue) { let result; arr.forEach((tmp) => { if (tmp && filter(tmp)) { result = tmp; } }); return result || defaultValue; }
javascript
function get(arr, filter, defaultValue) { let result; arr.forEach((tmp) => { if (tmp && filter(tmp)) { result = tmp; } }); return result || defaultValue; }
[ "function", "get", "(", "arr", ",", "filter", ",", "defaultValue", ")", "{", "let", "result", ";", "arr", ".", "forEach", "(", "(", "tmp", ")", "=>", "{", "if", "(", "tmp", "&&", "filter", "(", "tmp", ")", ")", "{", "result", "=", "tmp", ";", "...
Get the value from array by filter @param {Array} arr The array to filter @param {Function} filter The filter function @param {any} defaultValue The default value for no value is valid @returns {any} The value of filter
[ "Get", "the", "value", "from", "array", "by", "filter" ]
8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca
https://github.com/vicanso/performance-nodejs/blob/8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca/index.js#L128-L136
train
vicanso/performance-nodejs
index.js
convertUnit
function convertUnit(str) { const reg = /\.\d*/; const result = reg.exec(str); if (result && result[0]) { return { precision: result[0].length - 1, unit: str.substring(result[0].length + 1), }; } return { unit: str, }; }
javascript
function convertUnit(str) { const reg = /\.\d*/; const result = reg.exec(str); if (result && result[0]) { return { precision: result[0].length - 1, unit: str.substring(result[0].length + 1), }; } return { unit: str, }; }
[ "function", "convertUnit", "(", "str", ")", "{", "const", "reg", "=", "/", "\\.\\d*", "/", ";", "const", "result", "=", "reg", ".", "exec", "(", "str", ")", ";", "if", "(", "result", "&&", "result", "[", "0", "]", ")", "{", "return", "{", "precis...
Convert the unit info @param {String} str The unit info @returns {Object} The format unit info
[ "Convert", "the", "unit", "info" ]
8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca
https://github.com/vicanso/performance-nodejs/blob/8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca/index.js#L143-L155
train
vicanso/performance-nodejs
index.js
getCpuUsage
function getCpuUsage(previousValue, start) { if (!previousValue) { return null; } const usage = process.cpuUsage(previousValue); const delta = process.hrtime(start); const total = Math.ceil(((delta[0] * 1e9) + delta[1]) / 1000); const usedPercent = Math.round(((usage.user + usage.system) / total) * 100)...
javascript
function getCpuUsage(previousValue, start) { if (!previousValue) { return null; } const usage = process.cpuUsage(previousValue); const delta = process.hrtime(start); const total = Math.ceil(((delta[0] * 1e9) + delta[1]) / 1000); const usedPercent = Math.round(((usage.user + usage.system) / total) * 100)...
[ "function", "getCpuUsage", "(", "previousValue", ",", "start", ")", "{", "if", "(", "!", "previousValue", ")", "{", "return", "null", ";", "}", "const", "usage", "=", "process", ".", "cpuUsage", "(", "previousValue", ")", ";", "const", "delta", "=", "pro...
Get the cpu usage @param {Object} previousValue The previous cpu usage @param {Array} start The previous process.hrtime @returns {Object} The cpu usage { user: Number, system: Number, usedPercent: Number, userUsedPercent: Number, systemUsedPercent: Number, total: total }
[ "Get", "the", "cpu", "usage" ]
8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca
https://github.com/vicanso/performance-nodejs/blob/8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca/index.js#L170-L183
train
vicanso/performance-nodejs
index.js
camelCaseData
function camelCaseData(data) { const result = {}; const keys = Object.keys(data); keys.forEach((k) => { const key = camelCase(k); const value = data[k]; if (isObject(value)) { result[key] = camelCaseData(value); } else { result[key] = value; } }); return result; }
javascript
function camelCaseData(data) { const result = {}; const keys = Object.keys(data); keys.forEach((k) => { const key = camelCase(k); const value = data[k]; if (isObject(value)) { result[key] = camelCaseData(value); } else { result[key] = value; } }); return result; }
[ "function", "camelCaseData", "(", "data", ")", "{", "const", "result", "=", "{", "}", ";", "const", "keys", "=", "Object", ".", "keys", "(", "data", ")", ";", "keys", ".", "forEach", "(", "(", "k", ")", "=>", "{", "const", "key", "=", "camelCase", ...
Convert the data to camel case @param {Object} data @returns
[ "Convert", "the", "data", "to", "camel", "case" ]
8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca
https://github.com/vicanso/performance-nodejs/blob/8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca/index.js#L191-L204
train
vicanso/performance-nodejs
index.js
flatten
function flatten(data, pre) { const prefix = pre || ''; const keys = Object.keys(data); const result = {}; keys.forEach((k) => { const value = data[k]; const key = [prefix, k].join('-'); if (isObject(value)) { Object.assign(result, flatten(value, key)); } else { result[key] = value; ...
javascript
function flatten(data, pre) { const prefix = pre || ''; const keys = Object.keys(data); const result = {}; keys.forEach((k) => { const value = data[k]; const key = [prefix, k].join('-'); if (isObject(value)) { Object.assign(result, flatten(value, key)); } else { result[key] = value; ...
[ "function", "flatten", "(", "data", ",", "pre", ")", "{", "const", "prefix", "=", "pre", "||", "''", ";", "const", "keys", "=", "Object", ".", "keys", "(", "data", ")", ";", "const", "result", "=", "{", "}", ";", "keys", ".", "forEach", "(", "(",...
Flatten the data @param {Object} data @returns
[ "Flatten", "the", "data" ]
8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca
https://github.com/vicanso/performance-nodejs/blob/8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca/index.js#L212-L226
train
vicanso/performance-nodejs
index.js
performance
function performance() { /* eslint prefer-rest-params: 0 */ const args = Array.from(arguments); const interval = get(args, isNumber, 100); const fn = get(args, isFunction, noop); const unitInfo = convertUnit(get(args, isString, 'B').toUpperCase()); let start = process.hrtime(); let cpuUsage = process.cpuU...
javascript
function performance() { /* eslint prefer-rest-params: 0 */ const args = Array.from(arguments); const interval = get(args, isNumber, 100); const fn = get(args, isFunction, noop); const unitInfo = convertUnit(get(args, isString, 'B').toUpperCase()); let start = process.hrtime(); let cpuUsage = process.cpuU...
[ "function", "performance", "(", ")", "{", "/* eslint prefer-rest-params: 0 */", "const", "args", "=", "Array", ".", "from", "(", "arguments", ")", ";", "const", "interval", "=", "get", "(", "args", ",", "isNumber", ",", "100", ")", ";", "const", "fn", "=",...
Get the performance of node, include lag, heap, heapSpace, cpuUsage, memoryUsage @param {Function} fn The callback function of performance @param {Interval} interval The interval of get performance @returns {Timer} The setInterval timer
[ "Get", "the", "performance", "of", "node", "include", "lag", "heap", "heapSpace", "cpuUsage", "memoryUsage" ]
8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca
https://github.com/vicanso/performance-nodejs/blob/8c65a819c8cfef2cbe77c2abae3f8cb7d4373cca/index.js#L234-L266
train
epeli/node-clim
index.js
consoleProxy
function consoleProxy(ob){ // list from http://nodejs.org/api/stdio.html var methods = ["dir", "time", "timeEnd", "trace", "assert"]; methods.forEach(function(method){ if (ob[method]) return; ob[method] = function(){ return console[method].apply(console, arguments); }; }); }
javascript
function consoleProxy(ob){ // list from http://nodejs.org/api/stdio.html var methods = ["dir", "time", "timeEnd", "trace", "assert"]; methods.forEach(function(method){ if (ob[method]) return; ob[method] = function(){ return console[method].apply(console, arguments); }; }); }
[ "function", "consoleProxy", "(", "ob", ")", "{", "// list from http://nodejs.org/api/stdio.html", "var", "methods", "=", "[", "\"dir\"", ",", "\"time\"", ",", "\"timeEnd\"", ",", "\"trace\"", ",", "\"assert\"", "]", ";", "methods", ".", "forEach", "(", "function",...
Just proxy methods we don't care about to original console object
[ "Just", "proxy", "methods", "we", "don", "t", "care", "about", "to", "original", "console", "object" ]
93a692976d4dda04992f729d4b6483af11394ad9
https://github.com/epeli/node-clim/blob/93a692976d4dda04992f729d4b6483af11394ad9/index.js#L65-L74
train
dunckr/retext-overuse
index.js
getOveruse
function getOveruse(duplicates, limit) { var duplicate; for (duplicate in duplicates) { if (duplicates[duplicate] < limit) { delete duplicates[duplicate] } } return keys(duplicates); }
javascript
function getOveruse(duplicates, limit) { var duplicate; for (duplicate in duplicates) { if (duplicates[duplicate] < limit) { delete duplicates[duplicate] } } return keys(duplicates); }
[ "function", "getOveruse", "(", "duplicates", ",", "limit", ")", "{", "var", "duplicate", ";", "for", "(", "duplicate", "in", "duplicates", ")", "{", "if", "(", "duplicates", "[", "duplicate", "]", "<", "limit", ")", "{", "delete", "duplicates", "[", "dup...
Get duplicates that are used too frequently. @param {Object} duplicates - Phrases to search for. @param {number} limit - Number of times phrase must have been used. @return {Array.<string>}
[ "Get", "duplicates", "that", "are", "used", "too", "frequently", "." ]
4fc1a408cf24c11976f65a88f7e958dc3f868198
https://github.com/dunckr/retext-overuse/blob/4fc1a408cf24c11976f65a88f7e958dc3f868198/index.js#L49-L57
train
thysultan/jsx.js
index.js
use
function use (filepath, destination) { var startTime = Date.now(); var text = read(filepath); if (text !== false) { fs.writeFile(destination, jsx(text), function (err) { if (err) { throw err; } var endTime = Date.now(); log('[Finished in ' + (endTime - startTime) + 'ms]'); }); } else...
javascript
function use (filepath, destination) { var startTime = Date.now(); var text = read(filepath); if (text !== false) { fs.writeFile(destination, jsx(text), function (err) { if (err) { throw err; } var endTime = Date.now(); log('[Finished in ' + (endTime - startTime) + 'ms]'); }); } else...
[ "function", "use", "(", "filepath", ",", "destination", ")", "{", "var", "startTime", "=", "Date", ".", "now", "(", ")", ";", "var", "text", "=", "read", "(", "filepath", ")", ";", "if", "(", "text", "!==", "false", ")", "{", "fs", ".", "writeFile"...
use the file to transpile
[ "use", "the", "file", "to", "transpile" ]
8bac10d311d30dd9f2eb9c5b853635518414782a
https://github.com/thysultan/jsx.js/blob/8bac10d311d30dd9f2eb9c5b853635518414782a/index.js#L36-L50
train
alexindigo/node-envar
index.js
envar
function envar(key) { var i, value; // be extra paranoid if (typeof key != 'string' || !key) return undefined; // lookup according to the order for (i=0; i<state.order.length; i++) { if ((value = lookup[state.order[i]](key)) !== undefined) { return value; } } // nothing found retu...
javascript
function envar(key) { var i, value; // be extra paranoid if (typeof key != 'string' || !key) return undefined; // lookup according to the order for (i=0; i<state.order.length; i++) { if ((value = lookup[state.order[i]](key)) !== undefined) { return value; } } // nothing found retu...
[ "function", "envar", "(", "key", ")", "{", "var", "i", ",", "value", ";", "// be extra paranoid", "if", "(", "typeof", "key", "!=", "'string'", "||", "!", "key", ")", "return", "undefined", ";", "// lookup according to the order", "for", "(", "i", "=", "0"...
Looks up requested variable @param {string} key - variable name to look for @returns {mixed} - found variable or `undefined` if nothing found
[ "Looks", "up", "requested", "variable" ]
8599dbb82d6e160704543ff5d6623b6d49c501fb
https://github.com/alexindigo/node-envar/blob/8599dbb82d6e160704543ff5d6623b6d49c501fb/index.js#L41-L59
train
ndp/csster
src/ie/rounded_corners.js
roundedCorners
function roundedCorners(side, radius) { if (!radius) { radius = side || 10; side = 'all'; } if (side == 'all') { if (browserInfo().msie) { return { 'border-radius': radius, behavior: 'url(border-radius-ie.htc)', visibility: 'hidden' } } else if (br...
javascript
function roundedCorners(side, radius) { if (!radius) { radius = side || 10; side = 'all'; } if (side == 'all') { if (browserInfo().msie) { return { 'border-radius': radius, behavior: 'url(border-radius-ie.htc)', visibility: 'hidden' } } else if (br...
[ "function", "roundedCorners", "(", "side", ",", "radius", ")", "{", "if", "(", "!", "radius", ")", "{", "radius", "=", "side", "||", "10", ";", "side", "=", "'all'", ";", "}", "if", "(", "side", "==", "'all'", ")", "{", "if", "(", "browserInfo", ...
Override of Csster's built-in method to support rounded corners on IE. See docs there for description.
[ "Override", "of", "Csster", "s", "built", "-", "in", "method", "to", "support", "rounded", "corners", "on", "IE", ".", "See", "docs", "there", "for", "description", "." ]
d836680b58dc8d6d06dc62c9893aca34c69d3de5
https://github.com/ndp/csster/blob/d836680b58dc8d6d06dc62c9893aca34c69d3de5/src/ie/rounded_corners.js#L7-L54
train
graemeboy/matrix-rotate
lib/rotateMatrix.js
transpose
function transpose(matrix) { // For NxN matrix var n = matrix[0].length; var temp; // Walk through columns for (var i = 0, j = 0; i < n; i++) { j = i; // Walk through rows while (j < n) { if (i !== j) { temp = matrix[i][j]; matrix[i][j] = matrix[j][i]; matrix[j][i] = temp; } j++; } }...
javascript
function transpose(matrix) { // For NxN matrix var n = matrix[0].length; var temp; // Walk through columns for (var i = 0, j = 0; i < n; i++) { j = i; // Walk through rows while (j < n) { if (i !== j) { temp = matrix[i][j]; matrix[i][j] = matrix[j][i]; matrix[j][i] = temp; } j++; } }...
[ "function", "transpose", "(", "matrix", ")", "{", "// For NxN matrix", "var", "n", "=", "matrix", "[", "0", "]", ".", "length", ";", "var", "temp", ";", "// Walk through columns", "for", "(", "var", "i", "=", "0", ",", "j", "=", "0", ";", "i", "<", ...
Transpose a 2D matrix
[ "Transpose", "a", "2D", "matrix" ]
126f52de06cb9c165505db7ba626cf308d586d4a
https://github.com/graemeboy/matrix-rotate/blob/126f52de06cb9c165505db7ba626cf308d586d4a/lib/rotateMatrix.js#L21-L39
train
thealjey/webcompiler
lib/webpack.js
getConfig
function getConfig(react) { const loaders = [{ test: /\.js$/, exclude: /node_modules/, loader: 'babel', query: _util.babelFEOptions }, { test: /\.json$/, loader: 'json' }, { test: /jsdom/, loader: 'null' }]; if (react) { loaders.unshift({ test: /\.js$/, exclude...
javascript
function getConfig(react) { const loaders = [{ test: /\.js$/, exclude: /node_modules/, loader: 'babel', query: _util.babelFEOptions }, { test: /\.json$/, loader: 'json' }, { test: /jsdom/, loader: 'null' }]; if (react) { loaders.unshift({ test: /\.js$/, exclude...
[ "function", "getConfig", "(", "react", ")", "{", "const", "loaders", "=", "[", "{", "test", ":", "/", "\\.js$", "/", ",", "exclude", ":", "/", "node_modules", "/", ",", "loader", ":", "'babel'", ",", "query", ":", "_util", ".", "babelFEOptions", "}", ...
Webpack helpers. Mostly for internal use. You can use it to tweak the Babel options. @module webpack @private Returns a webpack configuration object. @memberof module:webpack @private @method getConfig @param {boolean} react - true if the react loader is needed @return {Object} webpack configuration object
[ "Webpack", "helpers", ".", "Mostly", "for", "internal", "use", "." ]
eb094f1632e5313ed0c5391a303150f1416b9629
https://github.com/thealjey/webcompiler/blob/eb094f1632e5313ed0c5391a303150f1416b9629/lib/webpack.js#L59-L94
train
thealjey/webcompiler
lib/webpack.js
getCompiler
function getCompiler(inPath, outPath, { library, libraryTarget }) { const compiler = (0, _webpack2.default)(_extends({}, getConfig(false), { devtool: _util.isProduction ? 'source-map' : 'eval-source-map', entry: ['babel-polyfill', inPath], output: { path: (0, _path.dirname)(outPath), filename: (0, _path.b...
javascript
function getCompiler(inPath, outPath, { library, libraryTarget }) { const compiler = (0, _webpack2.default)(_extends({}, getConfig(false), { devtool: _util.isProduction ? 'source-map' : 'eval-source-map', entry: ['babel-polyfill', inPath], output: { path: (0, _path.dirname)(outPath), filename: (0, _path.b...
[ "function", "getCompiler", "(", "inPath", ",", "outPath", ",", "{", "library", ",", "libraryTarget", "}", ")", "{", "const", "compiler", "=", "(", "0", ",", "_webpack2", ".", "default", ")", "(", "_extends", "(", "{", "}", ",", "getConfig", "(", "false...
Returns a webpack Compiler instance. @memberof module:webpack @private @method getCompiler @param {string} inPath - the path to an input file @param {string} outPath - the path to an output file @param {JSCompilerConfig} options - configuration object @return {Object} webpack Compiler instance
[ "Returns", "a", "webpack", "Compiler", "instance", "." ]
eb094f1632e5313ed0c5391a303150f1416b9629
https://github.com/thealjey/webcompiler/blob/eb094f1632e5313ed0c5391a303150f1416b9629/lib/webpack.js#L107-L118
train