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
nwoltman/pro-array
pro-array.js
function(size) { size = size || 1; var numChunks = Math.ceil(this.length / size); var result = new Array(numChunks); for (var i = 0, index = 0; i < numChunks; i++) { result[i] = chunkSlice(this, index, index += size); } return result; }
javascript
function(size) { size = size || 1; var numChunks = Math.ceil(this.length / size); var result = new Array(numChunks); for (var i = 0, index = 0; i < numChunks; i++) { result[i] = chunkSlice(this, index, index += size); } return result; }
[ "function", "(", "size", ")", "{", "size", "=", "size", "||", "1", ";", "var", "numChunks", "=", "Math", ".", "ceil", "(", "this", ".", "length", "/", "size", ")", ";", "var", "result", "=", "new", "Array", "(", "numChunks", ")", ";", "for", "(",...
Creates an array of elements split into groups the length of `size`. If the array can't be split evenly, the final chunk will be the remaining elements. @function Array#chunk @param {number} [size=1] - The length of each chunk. @returns {Array} An array containing the chunks. @throws {RangeError} Throws when `size` is...
[ "Creates", "an", "array", "of", "elements", "split", "into", "groups", "the", "length", "of", "size", ".", "If", "the", "array", "can", "t", "be", "split", "evenly", "the", "final", "chunk", "will", "be", "the", "remaining", "elements", "." ]
c61a7be99e932912f95e553b57bf1bca16e3c709
https://github.com/nwoltman/pro-array/blob/c61a7be99e932912f95e553b57bf1bca16e3c709/pro-array.js#L187-L198
train
nwoltman/pro-array
pro-array.js
function() { var result = []; for (var i = 0; i < this.length; i++) { var value = this[i]; if (Array.isArray(value)) { for (var j = 0; j < value.length; j++) { result.push(value[j]); } } else { result.push(value); } } return result; }
javascript
function() { var result = []; for (var i = 0; i < this.length; i++) { var value = this[i]; if (Array.isArray(value)) { for (var j = 0; j < value.length; j++) { result.push(value[j]); } } else { result.push(value); } } return result; }
[ "function", "(", ")", "{", "var", "result", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "this", ".", "length", ";", "i", "++", ")", "{", "var", "value", "=", "this", "[", "i", "]", ";", "if", "(", "Array", ".", "i...
Flattens a nested array a single level. @function Array#flatten @returns {Array} The new flattened array. @example [1, [2, 3, [4]], 5].flatten(); // -> [1, 2, 3, [4], 5]
[ "Flattens", "a", "nested", "array", "a", "single", "level", "." ]
c61a7be99e932912f95e553b57bf1bca16e3c709
https://github.com/nwoltman/pro-array/blob/c61a7be99e932912f95e553b57bf1bca16e3c709/pro-array.js#L402-L417
train
nwoltman/pro-array
pro-array.js
function() { var remStartIndex = 0; var numToRemove = 0; for (var i = 0; i < this.length; i++) { var removeCurrentIndex = false; for (var j = 0; j < arguments.length; j++) { if (this[i] === arguments[j]) { removeCurrentIndex = true; break; } } i...
javascript
function() { var remStartIndex = 0; var numToRemove = 0; for (var i = 0; i < this.length; i++) { var removeCurrentIndex = false; for (var j = 0; j < arguments.length; j++) { if (this[i] === arguments[j]) { removeCurrentIndex = true; break; } } i...
[ "function", "(", ")", "{", "var", "remStartIndex", "=", "0", ";", "var", "numToRemove", "=", "0", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "this", ".", "length", ";", "i", "++", ")", "{", "var", "removeCurrentIndex", "=", "false", ";...
Removes all occurrences of the passed in items from the array and returns the array. __Note:__ Unlike {@link Array#without|`.without()`}, this method mutates the array. @function Array#remove @param {...*} items - Items to remove from the array. @returns {Array} The array this method was called on. @example var arra...
[ "Removes", "all", "occurrences", "of", "the", "passed", "in", "items", "from", "the", "array", "and", "returns", "the", "array", "." ]
c61a7be99e932912f95e553b57bf1bca16e3c709
https://github.com/nwoltman/pro-array/blob/c61a7be99e932912f95e553b57bf1bca16e3c709/pro-array.js#L601-L632
train
nwoltman/pro-array
pro-array.js
function(isSorted) { var result = []; var length = this.length; if (!length) { return result; } result[0] = this[0]; var i = 1; if (isSorted) { for (; i < length; i++) { if (this[i] !== this[i - 1]) { result.push(this[i]); } } } else { ...
javascript
function(isSorted) { var result = []; var length = this.length; if (!length) { return result; } result[0] = this[0]; var i = 1; if (isSorted) { for (; i < length; i++) { if (this[i] !== this[i - 1]) { result.push(this[i]); } } } else { ...
[ "function", "(", "isSorted", ")", "{", "var", "result", "=", "[", "]", ";", "var", "length", "=", "this", ".", "length", ";", "if", "(", "!", "length", ")", "{", "return", "result", ";", "}", "result", "[", "0", "]", "=", "this", "[", "0", "]",...
Returns a duplicate-free clone of the array. @function Array#unique @param {boolean} [isSorted=false] - If the array's contents are sorted and this is set to `true`, a faster algorithm will be used to create the unique array. @returns {Array} The new, duplicate-free array. @example // Unsorted [4, 2, 3, 2, 1, 4].uniq...
[ "Returns", "a", "duplicate", "-", "free", "clone", "of", "the", "array", "." ]
c61a7be99e932912f95e553b57bf1bca16e3c709
https://github.com/nwoltman/pro-array/blob/c61a7be99e932912f95e553b57bf1bca16e3c709/pro-array.js#L684-L710
train
nwoltman/pro-array
pro-array.js
function() { var result = []; next: for (var i = 0; i < this.length; i++) { for (var j = 0; j < arguments.length; j++) { if (this[i] === arguments[j]) { continue next; } } result.push(this[i]); } return result; }
javascript
function() { var result = []; next: for (var i = 0; i < this.length; i++) { for (var j = 0; j < arguments.length; j++) { if (this[i] === arguments[j]) { continue next; } } result.push(this[i]); } return result; }
[ "function", "(", ")", "{", "var", "result", "=", "[", "]", ";", "next", ":", "for", "(", "var", "i", "=", "0", ";", "i", "<", "this", ".", "length", ";", "i", "++", ")", "{", "for", "(", "var", "j", "=", "0", ";", "j", "<", "arguments", "...
Returns a copy of the array without any elements from the input parameters. @function Array#without @param {...*} items - Items to leave out of the returned array. @returns {Array} The new array of filtered values. @example [1, 2, 3, 4].without(2, 4); // -> [1, 3] [1, 1].without(1); // -> []
[ "Returns", "a", "copy", "of", "the", "array", "without", "any", "elements", "from", "the", "input", "parameters", "." ]
c61a7be99e932912f95e553b57bf1bca16e3c709
https://github.com/nwoltman/pro-array/blob/c61a7be99e932912f95e553b57bf1bca16e3c709/pro-array.js#L726-L739
train
Cereceres/flatten-array
index.js
flattenArray
function flattenArray(arrayToFlatten, arrayFlatten) { // check if the arg is a array, if not a error is thrown if(!Array.isArray(arrayToFlatten)) throw new Error('Only can flat arrays and you pass a ' + typeof arrayToFlatten) // set the default value of arrayFlatten, this validation is used only in the firs...
javascript
function flattenArray(arrayToFlatten, arrayFlatten) { // check if the arg is a array, if not a error is thrown if(!Array.isArray(arrayToFlatten)) throw new Error('Only can flat arrays and you pass a ' + typeof arrayToFlatten) // set the default value of arrayFlatten, this validation is used only in the firs...
[ "function", "flattenArray", "(", "arrayToFlatten", ",", "arrayFlatten", ")", "{", "// check if the arg is a array, if not a error is thrown", "if", "(", "!", "Array", ".", "isArray", "(", "arrayToFlatten", ")", ")", "throw", "new", "Error", "(", "'Only can flat arrays a...
recursive function to flatten a array of integers given @func @param {Array} - arrayToFlatten of integers
[ "recursive", "function", "to", "flatten", "a", "array", "of", "integers", "given" ]
1ce0612a34ef235126384951c4abdef9a81c2099
https://github.com/Cereceres/flatten-array/blob/1ce0612a34ef235126384951c4abdef9a81c2099/index.js#L7-L27
train
RetailMeNotSandbox/grunt-hooks
tasks/grunt-hooks.js
nextQuestion
function nextQuestion() { if ( !hooks.length ) { if ( !!options.onDone ) { grunt.log.writeln( '' ); grunt.log.writeln( options.onDone.blue ); } done(); } else { var hookConfig = hooks.shift(); promptHook( hookConfig ); } }
javascript
function nextQuestion() { if ( !hooks.length ) { if ( !!options.onDone ) { grunt.log.writeln( '' ); grunt.log.writeln( options.onDone.blue ); } done(); } else { var hookConfig = hooks.shift(); promptHook( hookConfig ); } }
[ "function", "nextQuestion", "(", ")", "{", "if", "(", "!", "hooks", ".", "length", ")", "{", "if", "(", "!", "!", "options", ".", "onDone", ")", "{", "grunt", ".", "log", ".", "writeln", "(", "''", ")", ";", "grunt", ".", "log", ".", "writeln", ...
option passed to task via flag
[ "option", "passed", "to", "task", "via", "flag" ]
22611771304fb8a49552d25a10629f47bb415670
https://github.com/RetailMeNotSandbox/grunt-hooks/blob/22611771304fb8a49552d25a10629f47bb415670/tasks/grunt-hooks.js#L20-L31
train
RetailMeNotSandbox/grunt-hooks
tasks/grunt-hooks.js
actuallyInstallHook
function actuallyInstallHook( hookToCopy, whereToPutIt, sourceCanonicalName ) { mkpath.sync( path.join( './', path.dirname( whereToPutIt ) ) ); exec( 'cp ' + hookToCopy + ' ' + whereToPutIt ); grunt.log.writeln( [ 'Installed ', sourceCanonicalName, ' hook in ', whereToPutIt ].join( '' ).green...
javascript
function actuallyInstallHook( hookToCopy, whereToPutIt, sourceCanonicalName ) { mkpath.sync( path.join( './', path.dirname( whereToPutIt ) ) ); exec( 'cp ' + hookToCopy + ' ' + whereToPutIt ); grunt.log.writeln( [ 'Installed ', sourceCanonicalName, ' hook in ', whereToPutIt ].join( '' ).green...
[ "function", "actuallyInstallHook", "(", "hookToCopy", ",", "whereToPutIt", ",", "sourceCanonicalName", ")", "{", "mkpath", ".", "sync", "(", "path", ".", "join", "(", "'./'", ",", "path", ".", "dirname", "(", "whereToPutIt", ")", ")", ")", ";", "exec", "("...
Installs the hook without checking if it already exists
[ "Installs", "the", "hook", "without", "checking", "if", "it", "already", "exists" ]
22611771304fb8a49552d25a10629f47bb415670
https://github.com/RetailMeNotSandbox/grunt-hooks/blob/22611771304fb8a49552d25a10629f47bb415670/tasks/grunt-hooks.js#L109-L119
train
gregtatum/npm-on-tap
on-tap.js
function(e) { var touch = e.touches[0] // Make sure click doesn't fire touchClientX = touch.clientX touchClientY = touch.clientY timestamp = Date.now() }
javascript
function(e) { var touch = e.touches[0] // Make sure click doesn't fire touchClientX = touch.clientX touchClientY = touch.clientY timestamp = Date.now() }
[ "function", "(", "e", ")", "{", "var", "touch", "=", "e", ".", "touches", "[", "0", "]", "// Make sure click doesn't fire", "touchClientX", "=", "touch", ".", "clientX", "touchClientY", "=", "touch", ".", "clientY", "timestamp", "=", "Date", ".", "now", "(...
Disable click if touch is fired
[ "Disable", "click", "if", "touch", "is", "fired" ]
c0aecdea1edb0ce2b3c50b8e5ae6d09db92f3c78
https://github.com/gregtatum/npm-on-tap/blob/c0aecdea1edb0ce2b3c50b8e5ae6d09db92f3c78/on-tap.js#L41-L49
train
KyperTech/grout
examples/browser/app.js
login
function login(){ console.log('Login called'); var username = document.getElementById('login-username').value; var password = document.getElementById('login-password').value; // {username:username, password:password} grout.login('google').then(function (loginInfo){ console.log('successful login:',...
javascript
function login(){ console.log('Login called'); var username = document.getElementById('login-username').value; var password = document.getElementById('login-password').value; // {username:username, password:password} grout.login('google').then(function (loginInfo){ console.log('successful login:',...
[ "function", "login", "(", ")", "{", "console", ".", "log", "(", "'Login called'", ")", ";", "var", "username", "=", "document", ".", "getElementById", "(", "'login-username'", ")", ".", "value", ";", "var", "password", "=", "document", ".", "getElementById",...
Login user based on entered credentials
[ "Login", "user", "based", "on", "entered", "credentials" ]
54e6d7118ce03edc2cf671b28e235be664162a77
https://github.com/KyperTech/grout/blob/54e6d7118ce03edc2cf671b28e235be664162a77/examples/browser/app.js#L25-L36
train
KyperTech/grout
examples/browser/app.js
logout
function logout(){ console.log('Logout called'); grout.logout().then(function(){ console.log('successful logout'); setStatus(); }, function (err){ console.error('logout() : Error logging out:', err); }); }
javascript
function logout(){ console.log('Logout called'); grout.logout().then(function(){ console.log('successful logout'); setStatus(); }, function (err){ console.error('logout() : Error logging out:', err); }); }
[ "function", "logout", "(", ")", "{", "console", ".", "log", "(", "'Logout called'", ")", ";", "grout", ".", "logout", "(", ")", ".", "then", "(", "function", "(", ")", "{", "console", ".", "log", "(", "'successful logout'", ")", ";", "setStatus", "(", ...
Log currently logged in user out
[ "Log", "currently", "logged", "in", "user", "out" ]
54e6d7118ce03edc2cf671b28e235be664162a77
https://github.com/KyperTech/grout/blob/54e6d7118ce03edc2cf671b28e235be664162a77/examples/browser/app.js#L38-L46
train
KyperTech/grout
examples/browser/app.js
signup
function signup(){ console.log('signup called'); var name = document.getElementById('signup-name').value; var username = document.getElementById('signup-username').value; var email = document.getElementById('signup-email').value; var password = document.getElementById('signup-password').value; ...
javascript
function signup(){ console.log('signup called'); var name = document.getElementById('signup-name').value; var username = document.getElementById('signup-username').value; var email = document.getElementById('signup-email').value; var password = document.getElementById('signup-password').value; ...
[ "function", "signup", "(", ")", "{", "console", ".", "log", "(", "'signup called'", ")", ";", "var", "name", "=", "document", ".", "getElementById", "(", "'signup-name'", ")", ".", "value", ";", "var", "username", "=", "document", ".", "getElementById", "(...
Signup and login as a new user
[ "Signup", "and", "login", "as", "a", "new", "user" ]
54e6d7118ce03edc2cf671b28e235be664162a77
https://github.com/KyperTech/grout/blob/54e6d7118ce03edc2cf671b28e235be664162a77/examples/browser/app.js#L48-L62
train
KyperTech/grout
examples/browser/app.js
getProjects
function getProjects(){ console.log('getProjects called'); grout.Projects.get().then(function(appsList){ console.log('apps list loaded:', appsList); var outHtml = '<h2>No app data</h2>'; if (appsList) { outHtml = '<ul>'; appsList.forEach(function(app){ outHtml += '<li...
javascript
function getProjects(){ console.log('getProjects called'); grout.Projects.get().then(function(appsList){ console.log('apps list loaded:', appsList); var outHtml = '<h2>No app data</h2>'; if (appsList) { outHtml = '<ul>'; appsList.forEach(function(app){ outHtml += '<li...
[ "function", "getProjects", "(", ")", "{", "console", ".", "log", "(", "'getProjects called'", ")", ";", "grout", ".", "Projects", ".", "get", "(", ")", ".", "then", "(", "function", "(", "appsList", ")", "{", "console", ".", "log", "(", "'apps list loade...
Get list of applications
[ "Get", "list", "of", "applications" ]
54e6d7118ce03edc2cf671b28e235be664162a77
https://github.com/KyperTech/grout/blob/54e6d7118ce03edc2cf671b28e235be664162a77/examples/browser/app.js#L64-L78
train
KyperTech/grout
examples/browser/app.js
getFile
function getFile() { var file = grout.Project('test', 'scott').File({key: 'index.html', path: 'index.html'}); console.log('fbUrl', file.fbUrl); console.log('fbRef', file.fbRef); file.get().then(function(app){ console.log('file loaded:', app); document.getElementById("output").innerHTML = JSO...
javascript
function getFile() { var file = grout.Project('test', 'scott').File({key: 'index.html', path: 'index.html'}); console.log('fbUrl', file.fbUrl); console.log('fbRef', file.fbRef); file.get().then(function(app){ console.log('file loaded:', app); document.getElementById("output").innerHTML = JSO...
[ "function", "getFile", "(", ")", "{", "var", "file", "=", "grout", ".", "Project", "(", "'test'", ",", "'scott'", ")", ".", "File", "(", "{", "key", ":", "'index.html'", ",", "path", ":", "'index.html'", "}", ")", ";", "console", ".", "log", "(", "...
Get single file content
[ "Get", "single", "file", "content" ]
54e6d7118ce03edc2cf671b28e235be664162a77
https://github.com/KyperTech/grout/blob/54e6d7118ce03edc2cf671b28e235be664162a77/examples/browser/app.js#L81-L89
train
KyperTech/grout
examples/browser/app.js
getUsers
function getUsers(){ console.log('getUsers called'); grout.Users.get().then(function(app){ console.log('apps list loaded:', app); document.getElementById("output").innerHTML = JSON.stringify(app); }, function(err){ console.error('Error getting users:', err); }); }
javascript
function getUsers(){ console.log('getUsers called'); grout.Users.get().then(function(app){ console.log('apps list loaded:', app); document.getElementById("output").innerHTML = JSON.stringify(app); }, function(err){ console.error('Error getting users:', err); }); }
[ "function", "getUsers", "(", ")", "{", "console", ".", "log", "(", "'getUsers called'", ")", ";", "grout", ".", "Users", ".", "get", "(", ")", ".", "then", "(", "function", "(", "app", ")", "{", "console", ".", "log", "(", "'apps list loaded:'", ",", ...
Get list of users
[ "Get", "list", "of", "users" ]
54e6d7118ce03edc2cf671b28e235be664162a77
https://github.com/KyperTech/grout/blob/54e6d7118ce03edc2cf671b28e235be664162a77/examples/browser/app.js#L134-L142
train
KyperTech/grout
examples/browser/app.js
searchUsers
function searchUsers(searchStr){ console.log('getUsers called'); if(!searchStr){ searchStr = document.getElementById('search').value; } grout.Users.search(searchStr).then(function(users){ console.log('search users loaded:', users); document.getElementById("search-output").innerHTML = J...
javascript
function searchUsers(searchStr){ console.log('getUsers called'); if(!searchStr){ searchStr = document.getElementById('search').value; } grout.Users.search(searchStr).then(function(users){ console.log('search users loaded:', users); document.getElementById("search-output").innerHTML = J...
[ "function", "searchUsers", "(", "searchStr", ")", "{", "console", ".", "log", "(", "'getUsers called'", ")", ";", "if", "(", "!", "searchStr", ")", "{", "searchStr", "=", "document", ".", "getElementById", "(", "'search'", ")", ".", "value", ";", "}", "g...
Search users based on a provided string
[ "Search", "users", "based", "on", "a", "provided", "string" ]
54e6d7118ce03edc2cf671b28e235be664162a77
https://github.com/KyperTech/grout/blob/54e6d7118ce03edc2cf671b28e235be664162a77/examples/browser/app.js#L144-L153
train
wronex/node-conquer
bin/logger.js
write
function write(msg, color, prefix) { if (!prefix) prefix = clc.cyan('[conquer]'); // Print each line of the message on its own line. var messages = msg.split('\n'); for (var i = 0; i < messages.length; i++) { var message = messages[i].replace(/(\s?$)|(\n?$)/gm, ''); if (message && message.length > 0) cons...
javascript
function write(msg, color, prefix) { if (!prefix) prefix = clc.cyan('[conquer]'); // Print each line of the message on its own line. var messages = msg.split('\n'); for (var i = 0; i < messages.length; i++) { var message = messages[i].replace(/(\s?$)|(\n?$)/gm, ''); if (message && message.length > 0) cons...
[ "function", "write", "(", "msg", ",", "color", ",", "prefix", ")", "{", "if", "(", "!", "prefix", ")", "prefix", "=", "clc", ".", "cyan", "(", "'[conquer]'", ")", ";", "// Print each line of the message on its own line.", "var", "messages", "=", "msg", ".", ...
Writes the supplied message to the log. @param {String} msg - the message. @param {Function} [color] - the clc coloring function to use on each message. @param {String} [prefix] - a message prefix. Defaults to '[conquer]'.
[ "Writes", "the", "supplied", "message", "to", "the", "log", "." ]
48fa586d1fad15ad544d143d1ba4b97172fed0f1
https://github.com/wronex/node-conquer/blob/48fa586d1fad15ad544d143d1ba4b97172fed0f1/bin/logger.js#L12-L23
train
wronex/node-conquer
bin/logger.js
log
function log() { var msg = util.format.apply(null, Array.prototype.slice.call(arguments, 0)); write(msg); }
javascript
function log() { var msg = util.format.apply(null, Array.prototype.slice.call(arguments, 0)); write(msg); }
[ "function", "log", "(", ")", "{", "var", "msg", "=", "util", ".", "format", ".", "apply", "(", "null", ",", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "arguments", ",", "0", ")", ")", ";", "write", "(", "msg", ")", ";", "}" ]
Writes the supplied parameters to the log.
[ "Writes", "the", "supplied", "parameters", "to", "the", "log", "." ]
48fa586d1fad15ad544d143d1ba4b97172fed0f1
https://github.com/wronex/node-conquer/blob/48fa586d1fad15ad544d143d1ba4b97172fed0f1/bin/logger.js#L26-L29
train
wronex/node-conquer
bin/logger.js
warn
function warn() { var msg = util.format.apply(null, Array.prototype.slice.call(arguments, 0)); write(msg, clc.yellow); }
javascript
function warn() { var msg = util.format.apply(null, Array.prototype.slice.call(arguments, 0)); write(msg, clc.yellow); }
[ "function", "warn", "(", ")", "{", "var", "msg", "=", "util", ".", "format", ".", "apply", "(", "null", ",", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "arguments", ",", "0", ")", ")", ";", "write", "(", "msg", ",", "clc", ".", ...
Writes the supplied parameters to the log as a warning.
[ "Writes", "the", "supplied", "parameters", "to", "the", "log", "as", "a", "warning", "." ]
48fa586d1fad15ad544d143d1ba4b97172fed0f1
https://github.com/wronex/node-conquer/blob/48fa586d1fad15ad544d143d1ba4b97172fed0f1/bin/logger.js#L32-L35
train
wronex/node-conquer
bin/logger.js
error
function error() { var msg = util.format.apply(null, Array.prototype.slice.call(arguments, 0)); write(msg, clc.red); }
javascript
function error() { var msg = util.format.apply(null, Array.prototype.slice.call(arguments, 0)); write(msg, clc.red); }
[ "function", "error", "(", ")", "{", "var", "msg", "=", "util", ".", "format", ".", "apply", "(", "null", ",", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "arguments", ",", "0", ")", ")", ";", "write", "(", "msg", ",", "clc", ".", ...
Writes the supplied parameters to the log as an error.
[ "Writes", "the", "supplied", "parameters", "to", "the", "log", "as", "an", "error", "." ]
48fa586d1fad15ad544d143d1ba4b97172fed0f1
https://github.com/wronex/node-conquer/blob/48fa586d1fad15ad544d143d1ba4b97172fed0f1/bin/logger.js#L38-L41
train
wronex/node-conquer
bin/logger.js
scriptLog
function scriptLog(script, msg, isError) { write(msg, isError ? clc.red : null, clc.yellow('[' + script + ']')); }
javascript
function scriptLog(script, msg, isError) { write(msg, isError ? clc.red : null, clc.yellow('[' + script + ']')); }
[ "function", "scriptLog", "(", "script", ",", "msg", ",", "isError", ")", "{", "write", "(", "msg", ",", "isError", "?", "clc", ".", "red", ":", "null", ",", "clc", ".", "yellow", "(", "'['", "+", "script", "+", "']'", ")", ")", ";", "}" ]
Writes the supplied message from the running script to the log. @param {String} script - the name of the running script. @param {String} msg - the message. @param {Boolean} isError - indicates if the message is an error message.
[ "Writes", "the", "supplied", "message", "from", "the", "running", "script", "to", "the", "log", "." ]
48fa586d1fad15ad544d143d1ba4b97172fed0f1
https://github.com/wronex/node-conquer/blob/48fa586d1fad15ad544d143d1ba4b97172fed0f1/bin/logger.js#L49-L53
train
leocornus/leocornus-visualdata
src/bilevel-sunburst.js
Plugin
function Plugin(element, options, jsonData) { // same the DOM element. this.element = element; this.jsonData = jsonData; // merge the options. // the jQuery extend function, the later object will // overwrite the former object. this.options = $.extend({}, defaultO...
javascript
function Plugin(element, options, jsonData) { // same the DOM element. this.element = element; this.jsonData = jsonData; // merge the options. // the jQuery extend function, the later object will // overwrite the former object. this.options = $.extend({}, defaultO...
[ "function", "Plugin", "(", "element", ",", "options", ",", "jsonData", ")", "{", "// same the DOM element.", "this", ".", "element", "=", "element", ";", "this", ".", "jsonData", "=", "jsonData", ";", "// merge the options.", "// the jQuery extend function, the later ...
the constructor for bilevelSunburst plugin.
[ "the", "constructor", "for", "bilevelSunburst", "plugin", "." ]
9d9714ca11c126f0250e650f3c1c4086709af3ab
https://github.com/leocornus/leocornus-visualdata/blob/9d9714ca11c126f0250e650f3c1c4086709af3ab/src/bilevel-sunburst.js#L35-L47
train
leocornus/leocornus-visualdata
src/bilevel-sunburst.js
function(options, jsonData) { //console.log(jsonData); var self = this; // remove the existing one. $('#' + self.attrId).empty(); // need merge the options with default options. self.options = $.extend({}, defaultOptions, options); se...
javascript
function(options, jsonData) { //console.log(jsonData); var self = this; // remove the existing one. $('#' + self.attrId).empty(); // need merge the options with default options. self.options = $.extend({}, defaultOptions, options); se...
[ "function", "(", "options", ",", "jsonData", ")", "{", "//console.log(jsonData);", "var", "self", "=", "this", ";", "// remove the existing one.", "$", "(", "'#'", "+", "self", ".", "attrId", ")", ".", "empty", "(", ")", ";", "// need merge the options with defa...
reload the plugin.
[ "reload", "the", "plugin", "." ]
9d9714ca11c126f0250e650f3c1c4086709af3ab
https://github.com/leocornus/leocornus-visualdata/blob/9d9714ca11c126f0250e650f3c1c4086709af3ab/src/bilevel-sunburst.js#L128-L139
train
leocornus/leocornus-visualdata
src/bilevel-sunburst.js
function() { var self = this; var bsExplanation = ''; if(self.options.explanationBuilder) { // call customized explanation builder. bsExplanation = self.options.explanationBuilder(self.attrId); } else { ...
javascript
function() { var self = this; var bsExplanation = ''; if(self.options.explanationBuilder) { // call customized explanation builder. bsExplanation = self.options.explanationBuilder(self.attrId); } else { ...
[ "function", "(", ")", "{", "var", "self", "=", "this", ";", "var", "bsExplanation", "=", "''", ";", "if", "(", "self", ".", "options", ".", "explanationBuilder", ")", "{", "// call customized explanation builder.", "bsExplanation", "=", "self", ".", "options",...
append the explanation div and the inline styles for it. the option explanationBuilder will be checked to allow developer to customize the explanation div self.options.explanationBuilder(prefix);
[ "append", "the", "explanation", "div", "and", "the", "inline", "styles", "for", "it", ".", "the", "option", "explanationBuilder", "will", "be", "checked", "to", "allow", "developer", "to", "customize", "the", "explanation", "div" ]
9d9714ca11c126f0250e650f3c1c4086709af3ab
https://github.com/leocornus/leocornus-visualdata/blob/9d9714ca11c126f0250e650f3c1c4086709af3ab/src/bilevel-sunburst.js#L148-L163
train
leocornus/leocornus-visualdata
src/bilevel-sunburst.js
function() { var self = this; // calculate the location and offset. // the largest rectangle that can be inscribed in a // circle is a square. // calculate the offset for the center of the chart. var offset = $('#' + self.getGenericId('svg'))....
javascript
function() { var self = this; // calculate the location and offset. // the largest rectangle that can be inscribed in a // circle is a square. // calculate the offset for the center of the chart. var offset = $('#' + self.getGenericId('svg'))....
[ "function", "(", ")", "{", "var", "self", "=", "this", ";", "// calculate the location and offset.", "// the largest rectangle that can be inscribed in a ", "// circle is a square.", "// calculate the offset for the center of the chart.", "var", "offset", "=", "$", "(", "'#'", ...
apply styles for the explanation div. this should happen after we have the location and offset of the svg.
[ "apply", "styles", "for", "the", "explanation", "div", ".", "this", "should", "happen", "after", "we", "have", "the", "location", "and", "offset", "of", "the", "svg", "." ]
9d9714ca11c126f0250e650f3c1c4086709af3ab
https://github.com/leocornus/leocornus-visualdata/blob/9d9714ca11c126f0250e650f3c1c4086709af3ab/src/bilevel-sunburst.js#L170-L230
train
leocornus/leocornus-visualdata
src/bilevel-sunburst.js
function(p) { var self = this; if (p.depth > 1) p = p.parent; // no children if (!p.children) return; //console.log("zoom in p.value = " + p.value); //console.log("zoom in p.name = " + p.name); self.updateExplanation(p.value, p.name)...
javascript
function(p) { var self = this; if (p.depth > 1) p = p.parent; // no children if (!p.children) return; //console.log("zoom in p.value = " + p.value); //console.log("zoom in p.name = " + p.name); self.updateExplanation(p.value, p.name)...
[ "function", "(", "p", ")", "{", "var", "self", "=", "this", ";", "if", "(", "p", ".", "depth", ">", "1", ")", "p", "=", "p", ".", "parent", ";", "// no children", "if", "(", "!", "p", ".", "children", ")", "return", ";", "//console.log(\"zoom in p....
handle zoomin, it happen on arcs.
[ "handle", "zoomin", "it", "happen", "on", "arcs", "." ]
9d9714ca11c126f0250e650f3c1c4086709af3ab
https://github.com/leocornus/leocornus-visualdata/blob/9d9714ca11c126f0250e650f3c1c4086709af3ab/src/bilevel-sunburst.js#L357-L370
train
leocornus/leocornus-visualdata
src/bilevel-sunburst.js
function(pageviews, name) { var self = this; $("#" + self.getGenericId('pageviews')) .text(self.formatNumber(pageviews)); $("#" + self.getGenericId("group")).text(name); var percentage = pageviews / self.totalValue; $("#" + self.getGenericId(...
javascript
function(pageviews, name) { var self = this; $("#" + self.getGenericId('pageviews')) .text(self.formatNumber(pageviews)); $("#" + self.getGenericId("group")).text(name); var percentage = pageviews / self.totalValue; $("#" + self.getGenericId(...
[ "function", "(", "pageviews", ",", "name", ")", "{", "var", "self", "=", "this", ";", "$", "(", "\"#\"", "+", "self", ".", "getGenericId", "(", "'pageviews'", ")", ")", ".", "text", "(", "self", ".", "formatNumber", "(", "pageviews", ")", ")", ";", ...
update the explanation div. TODO: Should allow user to update through the self.options.explanationUpdater.
[ "update", "the", "explanation", "div", "." ]
9d9714ca11c126f0250e650f3c1c4086709af3ab
https://github.com/leocornus/leocornus-visualdata/blob/9d9714ca11c126f0250e650f3c1c4086709af3ab/src/bilevel-sunburst.js#L378-L388
train
leocornus/leocornus-visualdata
src/bilevel-sunburst.js
function(p) { var self = this; if (!p) return; if (!p.parent) return; //console.log("zoom out p.value = " + p.parent.value); //console.log("zoom out p.name = " + p.parent.name); //console.log(p.parent); self.updateExplanation(p.paren...
javascript
function(p) { var self = this; if (!p) return; if (!p.parent) return; //console.log("zoom out p.value = " + p.parent.value); //console.log("zoom out p.name = " + p.parent.name); //console.log(p.parent); self.updateExplanation(p.paren...
[ "function", "(", "p", ")", "{", "var", "self", "=", "this", ";", "if", "(", "!", "p", ")", "return", ";", "if", "(", "!", "p", ".", "parent", ")", "return", ";", "//console.log(\"zoom out p.value = \" + p.parent.value);", "//console.log(\"zoom out p.name = \" + ...
handle zoomout, for center circle.
[ "handle", "zoomout", "for", "center", "circle", "." ]
9d9714ca11c126f0250e650f3c1c4086709af3ab
https://github.com/leocornus/leocornus-visualdata/blob/9d9714ca11c126f0250e650f3c1c4086709af3ab/src/bilevel-sunburst.js#L393-L406
train
isaacsimmons/cache-manifest-generator
index.js
onFile
function onFile(filePath, stat) { if (filePath.match(ignore) || filePath.match(globalIgnore)) { return; } var newTimestamp = updateTimestamp(stat.mtime); if (manifest['CACHE'].insert(toUrl(cleanPath(filePath))) || newTimestamp) { updateListener(manifest); } }
javascript
function onFile(filePath, stat) { if (filePath.match(ignore) || filePath.match(globalIgnore)) { return; } var newTimestamp = updateTimestamp(stat.mtime); if (manifest['CACHE'].insert(toUrl(cleanPath(filePath))) || newTimestamp) { updateListener(manifest); } }
[ "function", "onFile", "(", "filePath", ",", "stat", ")", "{", "if", "(", "filePath", ".", "match", "(", "ignore", ")", "||", "filePath", ".", "match", "(", "globalIgnore", ")", ")", "{", "return", ";", "}", "var", "newTimestamp", "=", "updateTimestamp", ...
If no ignore pattern is given, use one that matches nothing
[ "If", "no", "ignore", "pattern", "is", "given", "use", "one", "that", "matches", "nothing" ]
9746c47e33d1febae7639b56383a757d2a138bfe
https://github.com/isaacsimmons/cache-manifest-generator/blob/9746c47e33d1febae7639b56383a757d2a138bfe/index.js#L152-L158
train
dan-nl/yeoman-prompting-helpers
src/filter-prompts.js
filterPrompts
function filterPrompts( PromptAnswers, generator_prompts ) { return filter( generator_prompts, function iteratee( prompt ) { return typeof PromptAnswers.get( prompt.name ) === 'undefined'; } ); }
javascript
function filterPrompts( PromptAnswers, generator_prompts ) { return filter( generator_prompts, function iteratee( prompt ) { return typeof PromptAnswers.get( prompt.name ) === 'undefined'; } ); }
[ "function", "filterPrompts", "(", "PromptAnswers", ",", "generator_prompts", ")", "{", "return", "filter", "(", "generator_prompts", ",", "function", "iteratee", "(", "prompt", ")", "{", "return", "typeof", "PromptAnswers", ".", "get", "(", "prompt", ".", "name"...
if a prompt.name already exists in PromptAnswers.answers that prompt will not be returned in the resulting Array @param {PromptAnswers} PromptAnswers @param {Array} generator_prompts @returns {Array}
[ "if", "a", "prompt", ".", "name", "already", "exists", "in", "PromptAnswers", ".", "answers", "that", "prompt", "will", "not", "be", "returned", "in", "the", "resulting", "Array" ]
6b698989f7350f736705bae66d8481d01512612c
https://github.com/dan-nl/yeoman-prompting-helpers/blob/6b698989f7350f736705bae66d8481d01512612c/src/filter-prompts.js#L16-L23
train
commenthol/streamss-through
index.js
Through
function Through (options, transform, flush) { var self = this if (!(this instanceof Through)) { return new Through(options, transform, flush) } if (typeof options === 'function') { flush = transform transform = options options = {} } options = options || {} Transform.call(this, options...
javascript
function Through (options, transform, flush) { var self = this if (!(this instanceof Through)) { return new Through(options, transform, flush) } if (typeof options === 'function') { flush = transform transform = options options = {} } options = options || {} Transform.call(this, options...
[ "function", "Through", "(", "options", ",", "transform", ",", "flush", ")", "{", "var", "self", "=", "this", "if", "(", "!", "(", "this", "instanceof", "Through", ")", ")", "{", "return", "new", "Through", "(", "options", ",", "transform", ",", "flush"...
Stream transformer with functional API @constructor @param {Object} [options] - Stream options @param {Boolean} options.objectMode - Whether this stream should behave as a stream of objects. Default=false @param {Number} options.highWaterMark - The maximum number of bytes to store in the internal buffer before ceasing...
[ "Stream", "transformer", "with", "functional", "API" ]
713b5256db6b0f4d4a3efe2ed4256ef626c753cb
https://github.com/commenthol/streamss-through/blob/713b5256db6b0f4d4a3efe2ed4256ef626c753cb/index.js#L41-L85
train
brianloveswords/gogo
lib/field.mysql.js
finishSpec
function finishSpec(spec, opts, field) { if (opts.unique) { var keylength = parseInt(opts.unique, 10) ? opts.unique : undefined; if (opts.unique === true && spec.sql.match(/^(text|blob)/i)) { var msg = 'When adding a unique key to an unsized type (text or blob), unique must be set with a length e.g...
javascript
function finishSpec(spec, opts, field) { if (opts.unique) { var keylength = parseInt(opts.unique, 10) ? opts.unique : undefined; if (opts.unique === true && spec.sql.match(/^(text|blob)/i)) { var msg = 'When adding a unique key to an unsized type (text or blob), unique must be set with a length e.g...
[ "function", "finishSpec", "(", "spec", ",", "opts", ",", "field", ")", "{", "if", "(", "opts", ".", "unique", ")", "{", "var", "keylength", "=", "parseInt", "(", "opts", ".", "unique", ",", "10", ")", "?", "opts", ".", "unique", ":", "undefined", "...
Helper for handling generic options for field generators. @param {Object} spec @param {Object} opts see below @param {String} field @param {Boolean} opts.null when false, adds `required` validator, `not null` to field @param {Boolean} opts.required opposite of `opts.null` @param {Boolean|Integer} opts.unique integer ...
[ "Helper", "for", "handling", "generic", "options", "for", "field", "generators", "." ]
f17ee794e0439ed961907f52b91bcb74dcca351a
https://github.com/brianloveswords/gogo/blob/f17ee794e0439ed961907f52b91bcb74dcca351a/lib/field.mysql.js#L22-L57
train
darrencruse/sugarlisp-core
sl-types.js
pprintSEXP
function pprintSEXP(formJson, opts, indentLevel, priorNodeStr) { opts = opts || {}; opts.lbracket = "("; opts.rbracket = ")"; opts.separator = " "; opts.bareSymbols = true; return pprintJSON(formJson, opts, indentLevel, priorNodeStr); }
javascript
function pprintSEXP(formJson, opts, indentLevel, priorNodeStr) { opts = opts || {}; opts.lbracket = "("; opts.rbracket = ")"; opts.separator = " "; opts.bareSymbols = true; return pprintJSON(formJson, opts, indentLevel, priorNodeStr); }
[ "function", "pprintSEXP", "(", "formJson", ",", "opts", ",", "indentLevel", ",", "priorNodeStr", ")", "{", "opts", "=", "opts", "||", "{", "}", ";", "opts", ".", "lbracket", "=", "\"(\"", ";", "opts", ".", "rbracket", "=", "\")\"", ";", "opts", ".", ...
"pretty print" lisp s-expressions from the form tree to a string
[ "pretty", "print", "lisp", "s", "-", "expressions", "from", "the", "form", "tree", "to", "a", "string" ]
c6ff983ebc3d60268054d6fe046db4aff6c5f78c
https://github.com/darrencruse/sugarlisp-core/blob/c6ff983ebc3d60268054d6fe046db4aff6c5f78c/sl-types.js#L639-L646
train
darrencruse/sugarlisp-core
sl-types.js
isQuotedString
function isQuotedString(str) { var is = false; if(typeof str === 'string') { var firstChar = str.charAt(0); is = (['"', "'", '`'].indexOf(firstChar) !== -1); } return is; }
javascript
function isQuotedString(str) { var is = false; if(typeof str === 'string') { var firstChar = str.charAt(0); is = (['"', "'", '`'].indexOf(firstChar) !== -1); } return is; }
[ "function", "isQuotedString", "(", "str", ")", "{", "var", "is", "=", "false", ";", "if", "(", "typeof", "str", "===", "'string'", ")", "{", "var", "firstChar", "=", "str", ".", "charAt", "(", "0", ")", ";", "is", "=", "(", "[", "'\"'", ",", "\"'...
Is the text a quoted string?
[ "Is", "the", "text", "a", "quoted", "string?" ]
c6ff983ebc3d60268054d6fe046db4aff6c5f78c
https://github.com/darrencruse/sugarlisp-core/blob/c6ff983ebc3d60268054d6fe046db4aff6c5f78c/sl-types.js#L848-L855
train
darrencruse/sugarlisp-core
sl-types.js
stripQuotes
function stripQuotes(text) { var sansquotes = text; if(isQuotedString(text)) { if(text.length === 2) { sanquotes = ""; // empty string } else { sansquotes = text.substring(1, text.length-1); // DELETE? sansquotes = unescapeQuotes(sansquotes); } } return sansquotes; }
javascript
function stripQuotes(text) { var sansquotes = text; if(isQuotedString(text)) { if(text.length === 2) { sanquotes = ""; // empty string } else { sansquotes = text.substring(1, text.length-1); // DELETE? sansquotes = unescapeQuotes(sansquotes); } } return sansquotes; }
[ "function", "stripQuotes", "(", "text", ")", "{", "var", "sansquotes", "=", "text", ";", "if", "(", "isQuotedString", "(", "text", ")", ")", "{", "if", "(", "text", ".", "length", "===", "2", ")", "{", "sanquotes", "=", "\"\"", ";", "// empty string", ...
strip the quotes from around a string if there are any otherwise return the string as given. since we are removing the quotes we also unescape quotes within the string.
[ "strip", "the", "quotes", "from", "around", "a", "string", "if", "there", "are", "any", "otherwise", "return", "the", "string", "as", "given", ".", "since", "we", "are", "removing", "the", "quotes", "we", "also", "unescape", "quotes", "within", "the", "str...
c6ff983ebc3d60268054d6fe046db4aff6c5f78c
https://github.com/darrencruse/sugarlisp-core/blob/c6ff983ebc3d60268054d6fe046db4aff6c5f78c/sl-types.js#L877-L889
train
darrencruse/sugarlisp-core
sl-types.js
addQuotes
function addQuotes(text, quoteChar) { var withquotes = text; if(!isQuotedString(text)) { var delim = quoteChar && quoteChar.length === 1 ? quoteChar : '"'; withquotes = delim + text + delim; } return withquotes; }
javascript
function addQuotes(text, quoteChar) { var withquotes = text; if(!isQuotedString(text)) { var delim = quoteChar && quoteChar.length === 1 ? quoteChar : '"'; withquotes = delim + text + delim; } return withquotes; }
[ "function", "addQuotes", "(", "text", ",", "quoteChar", ")", "{", "var", "withquotes", "=", "text", ";", "if", "(", "!", "isQuotedString", "(", "text", ")", ")", "{", "var", "delim", "=", "quoteChar", "&&", "quoteChar", ".", "length", "===", "1", "?", ...
add quotes around a string if there aren't any otherwise return the string as given. since we're adding the quotes we also escape quotes within the string.
[ "add", "quotes", "around", "a", "string", "if", "there", "aren", "t", "any", "otherwise", "return", "the", "string", "as", "given", ".", "since", "we", "re", "adding", "the", "quotes", "we", "also", "escape", "quotes", "within", "the", "string", "." ]
c6ff983ebc3d60268054d6fe046db4aff6c5f78c
https://github.com/darrencruse/sugarlisp-core/blob/c6ff983ebc3d60268054d6fe046db4aff6c5f78c/sl-types.js#L897-L904
train
mattdesl/gl-texture2d-pixels
index.js
getPixels
function getPixels(texture, opts) { var gl = texture.gl if (!gl) throw new Error("must provide gl-texture2d object with a valid 'gl' context") if (!fbo) { var handle = gl.createFramebuffer() fbo = { handle: handle, dispose: dispose, gl: gl ...
javascript
function getPixels(texture, opts) { var gl = texture.gl if (!gl) throw new Error("must provide gl-texture2d object with a valid 'gl' context") if (!fbo) { var handle = gl.createFramebuffer() fbo = { handle: handle, dispose: dispose, gl: gl ...
[ "function", "getPixels", "(", "texture", ",", "opts", ")", "{", "var", "gl", "=", "texture", ".", "gl", "if", "(", "!", "gl", ")", "throw", "new", "Error", "(", "\"must provide gl-texture2d object with a valid 'gl' context\"", ")", "if", "(", "!", "fbo", ")"...
Split into another module or use gl-fbo somehow
[ "Split", "into", "another", "module", "or", "use", "gl", "-", "fbo", "somehow" ]
06bdd8a71635414642db025b09b47da05c8953d9
https://github.com/mattdesl/gl-texture2d-pixels/blob/06bdd8a71635414642db025b09b47da05c8953d9/index.js#L8-L45
train
stefanmintert/ep_xmlexport
Line.js
function(listsEnabled, lineAttributesEnabled) { if ((!hasList() && !hasLineAttributes) || (!listsEnabled && !lineAttributesEnabled)) { return { lineAttributes: [], inlineAttributeString: rawAttributeString, inlinePlaintext: rawText ...
javascript
function(listsEnabled, lineAttributesEnabled) { if ((!hasList() && !hasLineAttributes) || (!listsEnabled && !lineAttributesEnabled)) { return { lineAttributes: [], inlineAttributeString: rawAttributeString, inlinePlaintext: rawText ...
[ "function", "(", "listsEnabled", ",", "lineAttributesEnabled", ")", "{", "if", "(", "(", "!", "hasList", "(", ")", "&&", "!", "hasLineAttributes", ")", "||", "(", "!", "listsEnabled", "&&", "!", "lineAttributesEnabled", ")", ")", "{", "return", "{", "lineA...
splits the line into line attributes and the remaining plain text and inline attributes depending on the given parameters @param {Boolean} listsEnabled if the client sent the parameter lists=true @param {Boolean} lineAttributesEnabled if the client sent the parameter lineattribs=true @return {lineAttributes: Array, inl...
[ "splits", "the", "line", "into", "line", "attributes", "and", "the", "remaining", "plain", "text", "and", "inline", "attributes", "depending", "on", "the", "given", "parameters" ]
c46a742b66bc048453ebe26c7b3fbd710ae8f7c4
https://github.com/stefanmintert/ep_xmlexport/blob/c46a742b66bc048453ebe26c7b3fbd710ae8f7c4/Line.js#L128-L182
train
Jam3/innkeeper
lib/storeRedis.js
function( userID ) { var id = curId; curId++; if( curId == Number.MAX_VALUE ) curId = Number.MIN_VALUE; roomUsers[ id ] = []; return this.setRoomData( id, {} ) .then( this.joinRoom.bind( this, userID, id ) ) .then( function() { return id; }); }
javascript
function( userID ) { var id = curId; curId++; if( curId == Number.MAX_VALUE ) curId = Number.MIN_VALUE; roomUsers[ id ] = []; return this.setRoomData( id, {} ) .then( this.joinRoom.bind( this, userID, id ) ) .then( function() { return id; }); }
[ "function", "(", "userID", ")", "{", "var", "id", "=", "curId", ";", "curId", "++", ";", "if", "(", "curId", "==", "Number", ".", "MAX_VALUE", ")", "curId", "=", "Number", ".", "MIN_VALUE", ";", "roomUsers", "[", "id", "]", "=", "[", "]", ";", "r...
This will create a roomID, roomDataObject, and users array for the room @return {Promise} This promise will return a room id once the room is created
[ "This", "will", "create", "a", "roomID", "roomDataObject", "and", "users", "array", "for", "the", "room" ]
95182271c62cf4416442c825189f025234b6ef1e
https://github.com/Jam3/innkeeper/blob/95182271c62cf4416442c825189f025234b6ef1e/lib/storeRedis.js#L36-L53
train
Jam3/innkeeper
lib/storeRedis.js
function( userID, roomID ) { var userCount; if( roomUsers[ roomID ] === undefined ) { return promise.reject( 'No room with the id: ' + roomID ); } else { var userIDX = roomUsers[ roomID ].indexOf( userID ); if( userIDX != -1 ) { roomUsers[ roomID ].splice( userIDX, 1 ); userCount = roomUse...
javascript
function( userID, roomID ) { var userCount; if( roomUsers[ roomID ] === undefined ) { return promise.reject( 'No room with the id: ' + roomID ); } else { var userIDX = roomUsers[ roomID ].indexOf( userID ); if( userIDX != -1 ) { roomUsers[ roomID ].splice( userIDX, 1 ); userCount = roomUse...
[ "function", "(", "userID", ",", "roomID", ")", "{", "var", "userCount", ";", "if", "(", "roomUsers", "[", "roomID", "]", "===", "undefined", ")", "{", "return", "promise", ".", "reject", "(", "'No room with the id: '", "+", "roomID", ")", ";", "}", "else...
Remove a user from a room @param {String} userID an id for the user whose leaving @param {String} roomID an id for the room the user is leaving @return {Promise} When this promise resolves it will send the number of users in the room
[ "Remove", "a", "user", "from", "a", "room" ]
95182271c62cf4416442c825189f025234b6ef1e
https://github.com/Jam3/innkeeper/blob/95182271c62cf4416442c825189f025234b6ef1e/lib/storeRedis.js#L81-L109
train
Jam3/innkeeper
lib/storeRedis.js
function( roomID ) { if( keys.length > 0 ) { var randIdx = Math.round( Math.random() * ( keys.length - 1 ) ), key = keys.splice( randIdx, 1 )[ 0 ]; keyToId[ key ] = roomID; idToKey[ roomID ] = key; return promise.resolve( key ); } else { return promise.reject( 'Run out of keys' ); } }
javascript
function( roomID ) { if( keys.length > 0 ) { var randIdx = Math.round( Math.random() * ( keys.length - 1 ) ), key = keys.splice( randIdx, 1 )[ 0 ]; keyToId[ key ] = roomID; idToKey[ roomID ] = key; return promise.resolve( key ); } else { return promise.reject( 'Run out of keys' ); } }
[ "function", "(", "roomID", ")", "{", "if", "(", "keys", ".", "length", ">", "0", ")", "{", "var", "randIdx", "=", "Math", ".", "round", "(", "Math", ".", "random", "(", ")", "*", "(", "keys", ".", "length", "-", "1", ")", ")", ",", "key", "="...
get a key which can be used to enter a room vs entering room via roomID @param {String} roomID id of the room you'd like a key for @return {Promise} A promise will be returned which will return a roomKey on success
[ "get", "a", "key", "which", "can", "be", "used", "to", "enter", "a", "room", "vs", "entering", "room", "via", "roomID" ]
95182271c62cf4416442c825189f025234b6ef1e
https://github.com/Jam3/innkeeper/blob/95182271c62cf4416442c825189f025234b6ef1e/lib/storeRedis.js#L118-L133
train
Jam3/innkeeper
lib/storeRedis.js
function( roomID, key ) { return this.getRoomIdForKey( key ) .then( function( savedRoomId ) { if( savedRoomId == roomID ) { delete idToKey[ roomID ]; delete keyToId[ key ]; keys.push( key ); return promise.resolve(); } else { return promise.reject( 'roomID and roomID for key do not m...
javascript
function( roomID, key ) { return this.getRoomIdForKey( key ) .then( function( savedRoomId ) { if( savedRoomId == roomID ) { delete idToKey[ roomID ]; delete keyToId[ key ]; keys.push( key ); return promise.resolve(); } else { return promise.reject( 'roomID and roomID for key do not m...
[ "function", "(", "roomID", ",", "key", ")", "{", "return", "this", ".", "getRoomIdForKey", "(", "key", ")", ".", "then", "(", "function", "(", "savedRoomId", ")", "{", "if", "(", "savedRoomId", "==", "roomID", ")", "{", "delete", "idToKey", "[", "roomI...
return a room key so someone else can use it. @param {String} roomID id of the room you'll be returning a key for @param {String} key the key you'd like to return @return {Promise} This promise will succeed when the room key was returned
[ "return", "a", "room", "key", "so", "someone", "else", "can", "use", "it", "." ]
95182271c62cf4416442c825189f025234b6ef1e
https://github.com/Jam3/innkeeper/blob/95182271c62cf4416442c825189f025234b6ef1e/lib/storeRedis.js#L142-L160
train
Jam3/innkeeper
lib/storeRedis.js
function( key ) { var savedRoomId = keyToId[ key ]; if( savedRoomId ) { return promise.resolve( savedRoomId ); } else { return promise.reject(); } }
javascript
function( key ) { var savedRoomId = keyToId[ key ]; if( savedRoomId ) { return promise.resolve( savedRoomId ); } else { return promise.reject(); } }
[ "function", "(", "key", ")", "{", "var", "savedRoomId", "=", "keyToId", "[", "key", "]", ";", "if", "(", "savedRoomId", ")", "{", "return", "promise", ".", "resolve", "(", "savedRoomId", ")", ";", "}", "else", "{", "return", "promise", ".", "reject", ...
return the room id for the given key @param {String} key key used to enter the room @return {Promise} This promise will succeed with the room id and fail if no room id exists for key
[ "return", "the", "room", "id", "for", "the", "given", "key" ]
95182271c62cf4416442c825189f025234b6ef1e
https://github.com/Jam3/innkeeper/blob/95182271c62cf4416442c825189f025234b6ef1e/lib/storeRedis.js#L168-L179
train
Jam3/innkeeper
lib/storeRedis.js
function( roomID, key, value ) { if( roomData[ roomID ] === undefined ) roomData[ roomID ] = {}; roomData[ roomID ][ key ] = value; return promise.resolve( value ); }
javascript
function( roomID, key, value ) { if( roomData[ roomID ] === undefined ) roomData[ roomID ] = {}; roomData[ roomID ][ key ] = value; return promise.resolve( value ); }
[ "function", "(", "roomID", ",", "key", ",", "value", ")", "{", "if", "(", "roomData", "[", "roomID", "]", "===", "undefined", ")", "roomData", "[", "roomID", "]", "=", "{", "}", ";", "roomData", "[", "roomID", "]", "[", "key", "]", "=", "value", ...
set a variable on the rooms data object @param {String} roomID id for the room whose @param {String} key variable name/key that you want to set @param {*} value Value you'd like to set for the variable @return {Promise} once this promise succeeds the rooms variable will be set
[ "set", "a", "variable", "on", "the", "rooms", "data", "object" ]
95182271c62cf4416442c825189f025234b6ef1e
https://github.com/Jam3/innkeeper/blob/95182271c62cf4416442c825189f025234b6ef1e/lib/storeRedis.js#L189-L197
train
Jam3/innkeeper
lib/storeRedis.js
function( roomID, key ) { if( roomData[ roomID ] === undefined ) { return promise.reject( 'There is no room by that id' ); } else { return promise.resolve( roomData[ roomID ][ key ] ); } }
javascript
function( roomID, key ) { if( roomData[ roomID ] === undefined ) { return promise.reject( 'There is no room by that id' ); } else { return promise.resolve( roomData[ roomID ][ key ] ); } }
[ "function", "(", "roomID", ",", "key", ")", "{", "if", "(", "roomData", "[", "roomID", "]", "===", "undefined", ")", "{", "return", "promise", ".", "reject", "(", "'There is no room by that id'", ")", ";", "}", "else", "{", "return", "promise", ".", "res...
get a variable from the rooms data object @param {String} roomID id for the room @param {String} key variable name/key that you want to get @return {Promise} once this promise succeeds it will return the variable value it will fail if the variable does not exist
[ "get", "a", "variable", "from", "the", "rooms", "data", "object" ]
95182271c62cf4416442c825189f025234b6ef1e
https://github.com/Jam3/innkeeper/blob/95182271c62cf4416442c825189f025234b6ef1e/lib/storeRedis.js#L206-L215
train
Jam3/innkeeper
lib/storeRedis.js
function( roomID, key ) { var oldVal; if( roomData[ roomID ] === undefined ) { return promise.reject( 'There is no room by that id' ); } else { oldVal = roomData[ roomID ][ key ]; delete roomData[ roomID ][ key ]; return promise.resolve( oldVal ); } }
javascript
function( roomID, key ) { var oldVal; if( roomData[ roomID ] === undefined ) { return promise.reject( 'There is no room by that id' ); } else { oldVal = roomData[ roomID ][ key ]; delete roomData[ roomID ][ key ]; return promise.resolve( oldVal ); } }
[ "function", "(", "roomID", ",", "key", ")", "{", "var", "oldVal", ";", "if", "(", "roomData", "[", "roomID", "]", "===", "undefined", ")", "{", "return", "promise", ".", "reject", "(", "'There is no room by that id'", ")", ";", "}", "else", "{", "oldVal"...
delete a variable from the rooms data object @param {String} roomID id for the room @param {String} key variable name/key that you want to delete @return {Promise} once this promise succeeds it will return the value that was stored before delete
[ "delete", "a", "variable", "from", "the", "rooms", "data", "object" ]
95182271c62cf4416442c825189f025234b6ef1e
https://github.com/Jam3/innkeeper/blob/95182271c62cf4416442c825189f025234b6ef1e/lib/storeRedis.js#L224-L239
train
TribeMedia/tribemedia-kurento-client-core
lib/complexTypes/Tag.js
Tag
function Tag(tagDict){ if(!(this instanceof Tag)) return new Tag(tagDict) // Check tagDict has the required fields checkType('String', 'tagDict.key', tagDict.key, {required: true}); checkType('String', 'tagDict.value', tagDict.value, {required: true}); // Init parent class Tag.super_.call(this, tagDic...
javascript
function Tag(tagDict){ if(!(this instanceof Tag)) return new Tag(tagDict) // Check tagDict has the required fields checkType('String', 'tagDict.key', tagDict.key, {required: true}); checkType('String', 'tagDict.value', tagDict.value, {required: true}); // Init parent class Tag.super_.call(this, tagDic...
[ "function", "Tag", "(", "tagDict", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Tag", ")", ")", "return", "new", "Tag", "(", "tagDict", ")", "// Check tagDict has the required fields", "checkType", "(", "'String'", ",", "'tagDict.key'", ",", "tagDict"...
Pair key-value with info about a MediaObject @constructor module:core/complexTypes.Tag @property {external:String} key Tag key @property {external:String} value Tag Value
[ "Pair", "key", "-", "value", "with", "info", "about", "a", "MediaObject" ]
de4c0094644aae91320e330f9cea418a3ac55468
https://github.com/TribeMedia/tribemedia-kurento-client-core/blob/de4c0094644aae91320e330f9cea418a3ac55468/lib/complexTypes/Tag.js#L37-L61
train
adriancmiranda/load-gulp-config
index.js
readJSON
function readJSON(filepath){ var buffer = {}; try{ buffer = JSON.parse(fs.readFileSync(filepath, { encoding:'utf8' })); } catch(error){} return buffer; }
javascript
function readJSON(filepath){ var buffer = {}; try{ buffer = JSON.parse(fs.readFileSync(filepath, { encoding:'utf8' })); } catch(error){} return buffer; }
[ "function", "readJSON", "(", "filepath", ")", "{", "var", "buffer", "=", "{", "}", ";", "try", "{", "buffer", "=", "JSON", ".", "parse", "(", "fs", ".", "readFileSync", "(", "filepath", ",", "{", "encoding", ":", "'utf8'", "}", ")", ")", ";", "}", ...
Synchronous version of `fs.readFile`. Returns the contents of the file and parse to JSON. @see https://nodejs.org/api/fs.html#fs_fs_readfilesync_file_options
[ "Synchronous", "version", "of", "fs", ".", "readFile", ".", "Returns", "the", "contents", "of", "the", "file", "and", "parse", "to", "JSON", "." ]
feb6f9e460998f3e1ac1a2651739e6803671b40f
https://github.com/adriancmiranda/load-gulp-config/blob/feb6f9e460998f3e1ac1a2651739e6803671b40f/index.js#L47-L53
train
adriancmiranda/load-gulp-config
index.js
readYAML
function readYAML(filepath){ var buffer = {}; try{ buffer = YAML.safeLoad(fs.readFileSync(filepath, { schema:YAML.DEFAULT_FULL_SCHEMA })); }catch(error){ console.error(error); } return buffer; }
javascript
function readYAML(filepath){ var buffer = {}; try{ buffer = YAML.safeLoad(fs.readFileSync(filepath, { schema:YAML.DEFAULT_FULL_SCHEMA })); }catch(error){ console.error(error); } return buffer; }
[ "function", "readYAML", "(", "filepath", ")", "{", "var", "buffer", "=", "{", "}", ";", "try", "{", "buffer", "=", "YAML", ".", "safeLoad", "(", "fs", ".", "readFileSync", "(", "filepath", ",", "{", "schema", ":", "YAML", ".", "DEFAULT_FULL_SCHEMA", "}...
Synchronous version of `fs.readFile`. Returns the contents of the file and parse to YAML. @see https://nodejs.org/api/fs.html#fs_fs_readfilesync_file_options
[ "Synchronous", "version", "of", "fs", ".", "readFile", ".", "Returns", "the", "contents", "of", "the", "file", "and", "parse", "to", "YAML", "." ]
feb6f9e460998f3e1ac1a2651739e6803671b40f
https://github.com/adriancmiranda/load-gulp-config/blob/feb6f9e460998f3e1ac1a2651739e6803671b40f/index.js#L57-L65
train
adriancmiranda/load-gulp-config
index.js
createMultitasks
function createMultitasks(gulp, aliases){ for(var task in aliases){ if(aliases.hasOwnProperty(task)){ var cmds = []; aliases[task].forEach(function(cmd){ cmds.push(cmd); }); gulp.task(task, cmds); } } return aliases; }
javascript
function createMultitasks(gulp, aliases){ for(var task in aliases){ if(aliases.hasOwnProperty(task)){ var cmds = []; aliases[task].forEach(function(cmd){ cmds.push(cmd); }); gulp.task(task, cmds); } } return aliases; }
[ "function", "createMultitasks", "(", "gulp", ",", "aliases", ")", "{", "for", "(", "var", "task", "in", "aliases", ")", "{", "if", "(", "aliases", ".", "hasOwnProperty", "(", "task", ")", ")", "{", "var", "cmds", "=", "[", "]", ";", "aliases", "[", ...
Configure multitasks from aliases.yml
[ "Configure", "multitasks", "from", "aliases", ".", "yml" ]
feb6f9e460998f3e1ac1a2651739e6803671b40f
https://github.com/adriancmiranda/load-gulp-config/blob/feb6f9e460998f3e1ac1a2651739e6803671b40f/index.js#L137-L148
train
adriancmiranda/load-gulp-config
index.js
filterFiles
function filterFiles(gulp, options, taskFile){ var ext = path.extname(taskFile); if(/\.(js|coffee)$/i.test(ext)){ createTask(gulp, options, taskFile); }else if(/\.(json)$/i.test(ext)){ createMultitasks(gulp, require(taskFile)); }else if(/\.(ya?ml)$/i.test(ext)){ createMultitasks(gulp, readYAML(taskFile)); } ...
javascript
function filterFiles(gulp, options, taskFile){ var ext = path.extname(taskFile); if(/\.(js|coffee)$/i.test(ext)){ createTask(gulp, options, taskFile); }else if(/\.(json)$/i.test(ext)){ createMultitasks(gulp, require(taskFile)); }else if(/\.(ya?ml)$/i.test(ext)){ createMultitasks(gulp, readYAML(taskFile)); } ...
[ "function", "filterFiles", "(", "gulp", ",", "options", ",", "taskFile", ")", "{", "var", "ext", "=", "path", ".", "extname", "(", "taskFile", ")", ";", "if", "(", "/", "\\.(js|coffee)$", "/", "i", ".", "test", "(", "ext", ")", ")", "{", "createTask"...
Filter files by extension.
[ "Filter", "files", "by", "extension", "." ]
feb6f9e460998f3e1ac1a2651739e6803671b40f
https://github.com/adriancmiranda/load-gulp-config/blob/feb6f9e460998f3e1ac1a2651739e6803671b40f/index.js#L151-L160
train
adriancmiranda/load-gulp-config
index.js
loadGulpConfig
function loadGulpConfig(gulp, options){ options = Object.assign({ data:{} }, options); options.dirs = isObject(options.dirs) ? options.dirs : {}; options.configPath = isString(options.configPath) ? options.configPath : 'tasks'; glob.sync(options.configPath, { realpath:true }).forEach(filterFiles.bind(this, gulp, op...
javascript
function loadGulpConfig(gulp, options){ options = Object.assign({ data:{} }, options); options.dirs = isObject(options.dirs) ? options.dirs : {}; options.configPath = isString(options.configPath) ? options.configPath : 'tasks'; glob.sync(options.configPath, { realpath:true }).forEach(filterFiles.bind(this, gulp, op...
[ "function", "loadGulpConfig", "(", "gulp", ",", "options", ")", "{", "options", "=", "Object", ".", "assign", "(", "{", "data", ":", "{", "}", "}", ",", "options", ")", ";", "options", ".", "dirs", "=", "isObject", "(", "options", ".", "dirs", ")", ...
Load multiple gulp tasks using globbing patterns.
[ "Load", "multiple", "gulp", "tasks", "using", "globbing", "patterns", "." ]
feb6f9e460998f3e1ac1a2651739e6803671b40f
https://github.com/adriancmiranda/load-gulp-config/blob/feb6f9e460998f3e1ac1a2651739e6803671b40f/index.js#L163-L169
train
leizongmin/node-lei-pipe
lib/sort.js
setAfter
function setAfter (pipes, ai, bi) { // console.log(' move %s => %s', ai, bi); var ap = pipes[ai]; pipes.splice(ai, 1); pipes.splice(bi, 0, ap); }
javascript
function setAfter (pipes, ai, bi) { // console.log(' move %s => %s', ai, bi); var ap = pipes[ai]; pipes.splice(ai, 1); pipes.splice(bi, 0, ap); }
[ "function", "setAfter", "(", "pipes", ",", "ai", ",", "bi", ")", "{", "// console.log(' move %s => %s', ai, bi);", "var", "ap", "=", "pipes", "[", "ai", "]", ";", "pipes", ".", "splice", "(", "ai", ",", "1", ")", ";", "pipes", ".", "splice", "(", "bi"...
set a after b
[ "set", "a", "after", "b" ]
d211b59a3d9ce78bf0d01fd45115fc9f61495a00
https://github.com/leizongmin/node-lei-pipe/blob/d211b59a3d9ce78bf0d01fd45115fc9f61495a00/lib/sort.js#L68-L73
train
leizongmin/node-lei-pipe
lib/sort.js
setBefore
function setBefore (pipes, ai, bi) { // console.log(' move %s => %s', ai, bi); var ap = pipes[ai]; pipes.splice(ai, 1); pipes.splice(bi, 0, ap); }
javascript
function setBefore (pipes, ai, bi) { // console.log(' move %s => %s', ai, bi); var ap = pipes[ai]; pipes.splice(ai, 1); pipes.splice(bi, 0, ap); }
[ "function", "setBefore", "(", "pipes", ",", "ai", ",", "bi", ")", "{", "// console.log(' move %s => %s', ai, bi);", "var", "ap", "=", "pipes", "[", "ai", "]", ";", "pipes", ".", "splice", "(", "ai", ",", "1", ")", ";", "pipes", ".", "splice", "(", "bi...
set a before b
[ "set", "a", "before", "b" ]
d211b59a3d9ce78bf0d01fd45115fc9f61495a00
https://github.com/leizongmin/node-lei-pipe/blob/d211b59a3d9ce78bf0d01fd45115fc9f61495a00/lib/sort.js#L76-L81
train
redisjs/jsr-validate
lib/validators/arity.js
arity
function arity(cmd, args, info, sub) { var subcommand = sub !== undefined; // command validation decorated the info var def = sub || info.command.def , expected = def.arity , first = def.first , last = def.last , step = def.step , min = Math.abs(expected) , max // account for command,...
javascript
function arity(cmd, args, info, sub) { var subcommand = sub !== undefined; // command validation decorated the info var def = sub || info.command.def , expected = def.arity , first = def.first , last = def.last , step = def.step , min = Math.abs(expected) , max // account for command,...
[ "function", "arity", "(", "cmd", ",", "args", ",", "info", ",", "sub", ")", "{", "var", "subcommand", "=", "sub", "!==", "undefined", ";", "// command validation decorated the info", "var", "def", "=", "sub", "||", "info", ".", "command", ".", "def", ",", ...
Validate argument length. @param cmd The command name (lowercase). @param args The command arguments, must be an array. @param info The server information.
[ "Validate", "argument", "length", "." ]
2e0dddafb32c019ef9293a35b96cdd78dd8e4ae5
https://github.com/redisjs/jsr-validate/blob/2e0dddafb32c019ef9293a35b96cdd78dd8e4ae5/lib/validators/arity.js#L14-L57
train
meisterplayer/js-dev
gulp/jsdoc.js
createGenerateDocs
function createGenerateDocs(inPath, outPath) { if (!inPath) { throw new Error('Input path(s) argument is required'); } if (!outPath) { throw new Error('Output path argument is required'); } const jsDocConfig = { opts: { destination: outPath, }, }; ...
javascript
function createGenerateDocs(inPath, outPath) { if (!inPath) { throw new Error('Input path(s) argument is required'); } if (!outPath) { throw new Error('Output path argument is required'); } const jsDocConfig = { opts: { destination: outPath, }, }; ...
[ "function", "createGenerateDocs", "(", "inPath", ",", "outPath", ")", "{", "if", "(", "!", "inPath", ")", "{", "throw", "new", "Error", "(", "'Input path(s) argument is required'", ")", ";", "}", "if", "(", "!", "outPath", ")", "{", "throw", "new", "Error"...
Higher order function to create gulp function that generates JSdocs from parsed files. @param {string|string[]} inPath The globs to the files from which the docs should be generated @param {string} outPath The destination path for the docs @return {function} Function that can be used as a gulp task
[ "Higher", "order", "function", "to", "create", "gulp", "function", "that", "generates", "JSdocs", "from", "parsed", "files", "." ]
c2646678c49dcdaa120ba3f24824da52b0c63e31
https://github.com/meisterplayer/js-dev/blob/c2646678c49dcdaa120ba3f24824da52b0c63e31/gulp/jsdoc.js#L10-L29
train
warehouseai/feedsme-api-client
index.js
Feedsme
function Feedsme(opts) { if (!this) new Feedsme(opts); // eslint-disable-line no-new if (typeof opts === 'string') { this.base = opts; } else if (opts.protocol && opts.href) { this.base = url.format(opts); } else if (opts.url || opts.uri) { this.base = opts.url || opts.uri; } else { throw new...
javascript
function Feedsme(opts) { if (!this) new Feedsme(opts); // eslint-disable-line no-new if (typeof opts === 'string') { this.base = opts; } else if (opts.protocol && opts.href) { this.base = url.format(opts); } else if (opts.url || opts.uri) { this.base = opts.url || opts.uri; } else { throw new...
[ "function", "Feedsme", "(", "opts", ")", "{", "if", "(", "!", "this", ")", "new", "Feedsme", "(", "opts", ")", ";", "// eslint-disable-line no-new", "if", "(", "typeof", "opts", "===", "'string'", ")", "{", "this", ".", "base", "=", "opts", ";", "}", ...
Feedsme API client. @constructor @param {Object|String} opts Options for root URL of feedsme service @param {String} opts.url The root URL of the feedsme service @param {String} opts.uri The root URL of the feedsme service @param {String} opts.href The href for root URL of the feedsme service @param {String} opts.prot...
[ "Feedsme", "API", "client", "." ]
da7aa3b2d05704808da29752fd590e93d6af87d7
https://github.com/warehouseai/feedsme-api-client/blob/da7aa3b2d05704808da29752fd590e93d6af87d7/index.js#L26-L50
train
warehouseai/feedsme-api-client
index.js
validateBody
function validateBody(err, body) { body = tryParse(body); if (err || !body) { return next(err || new Error('Unparsable response with statusCode ' + statusCode)); } if (statusCode !== 200) { return next(new Error(body.message || 'Invalid status code ' + statusCode)); } ...
javascript
function validateBody(err, body) { body = tryParse(body); if (err || !body) { return next(err || new Error('Unparsable response with statusCode ' + statusCode)); } if (statusCode !== 200) { return next(new Error(body.message || 'Invalid status code ' + statusCode)); } ...
[ "function", "validateBody", "(", "err", ",", "body", ")", "{", "body", "=", "tryParse", "(", "body", ")", ";", "if", "(", "err", "||", "!", "body", ")", "{", "return", "next", "(", "err", "||", "new", "Error", "(", "'Unparsable response with statusCode '...
If a callback is passed, validate the returned body
[ "If", "a", "callback", "is", "passed", "validate", "the", "returned", "body" ]
da7aa3b2d05704808da29752fd590e93d6af87d7
https://github.com/warehouseai/feedsme-api-client/blob/da7aa3b2d05704808da29752fd590e93d6af87d7/index.js#L138-L150
train
happner/happner-test-modules
lib/as_late.js
AsLate
function AsLate(arg, u, ments) { this.args = arg + u + ments; this.started = false; }
javascript
function AsLate(arg, u, ments) { this.args = arg + u + ments; this.started = false; }
[ "function", "AsLate", "(", "arg", ",", "u", ",", "ments", ")", "{", "this", ".", "args", "=", "arg", "+", "u", "+", "ments", ";", "this", ".", "started", "=", "false", ";", "}" ]
Tests use this module to inssert into an already running mesh node
[ "Tests", "use", "this", "module", "to", "inssert", "into", "an", "already", "running", "mesh", "node" ]
c091371de6392478f731fce4aba262403d89aeff
https://github.com/happner/happner-test-modules/blob/c091371de6392478f731fce4aba262403d89aeff/lib/as_late.js#L5-L8
train
kubicle/nice-emitter
index.js
getObjectClassname
function getObjectClassname (listener) { if (!listener) return DEFAULT_LISTENER; if (typeof listener === 'string') return listener; var constr = listener.constructor; return constr.name || constr.toString().split(/ |\(/, 2)[1]; }
javascript
function getObjectClassname (listener) { if (!listener) return DEFAULT_LISTENER; if (typeof listener === 'string') return listener; var constr = listener.constructor; return constr.name || constr.toString().split(/ |\(/, 2)[1]; }
[ "function", "getObjectClassname", "(", "listener", ")", "{", "if", "(", "!", "listener", ")", "return", "DEFAULT_LISTENER", ";", "if", "(", "typeof", "listener", "===", "'string'", ")", "return", "listener", ";", "var", "constr", "=", "listener", ".", "const...
Using 0 is a bit faster for old API when in debug mode
[ "Using", "0", "is", "a", "bit", "faster", "for", "old", "API", "when", "in", "debug", "mode" ]
17b8ea1ac01a7d22a714dfa3c512c197c45b847f
https://github.com/kubicle/nice-emitter/blob/17b8ea1ac01a7d22a714dfa3c512c197c45b847f/index.js#L506-L511
train
byu-oit/sans-server
bin/server/sans-server.js
SansServer
function SansServer(configuration) { if (!(this instanceof SansServer)) return new SansServer(configuration); const config = configuration && typeof configuration === 'object' ? Object.assign(configuration) : {}; config.logs = config.hasOwnProperty('logs') ? config.logs : true; config.rejectable = conf...
javascript
function SansServer(configuration) { if (!(this instanceof SansServer)) return new SansServer(configuration); const config = configuration && typeof configuration === 'object' ? Object.assign(configuration) : {}; config.logs = config.hasOwnProperty('logs') ? config.logs : true; config.rejectable = conf...
[ "function", "SansServer", "(", "configuration", ")", "{", "if", "(", "!", "(", "this", "instanceof", "SansServer", ")", ")", "return", "new", "SansServer", "(", "configuration", ")", ";", "const", "config", "=", "configuration", "&&", "typeof", "configuration"...
Create a san-server instance. @param {object} [configuration] Configuration options. @param {boolean} [configuration.logs=true] Whether to output grouped logs at the end of a request. @param {boolean} [configuration.rejectable=false] Whether an error while processing the request should cause a failure or return a 500 r...
[ "Create", "a", "san", "-", "server", "instance", "." ]
022bcf7b47321e6e8aa20467cd96a6a84a457ec8
https://github.com/byu-oit/sans-server/blob/022bcf7b47321e6e8aa20467cd96a6a84a457ec8/bin/server/sans-server.js#L37-L110
train
byu-oit/sans-server
bin/server/sans-server.js
addHook
function addHook(hooks, type, weight, hook) { const length = arguments.length; let start = 2; if (typeof type !== 'string') { const err = Error('Expected first parameter to be a string. Received: ' + type); err.code = 'ESHOOK'; throw err; } // handle variable input paramete...
javascript
function addHook(hooks, type, weight, hook) { const length = arguments.length; let start = 2; if (typeof type !== 'string') { const err = Error('Expected first parameter to be a string. Received: ' + type); err.code = 'ESHOOK'; throw err; } // handle variable input paramete...
[ "function", "addHook", "(", "hooks", ",", "type", ",", "weight", ",", "hook", ")", "{", "const", "length", "=", "arguments", ".", "length", ";", "let", "start", "=", "2", ";", "if", "(", "typeof", "type", "!==", "'string'", ")", "{", "const", "err", ...
Define a hook that is applied to all requests. @param {object} hooks @param {string} type @param {number} [weight=0] @param {...function} hook @returns {SansServer}
[ "Define", "a", "hook", "that", "is", "applied", "to", "all", "requests", "." ]
022bcf7b47321e6e8aa20467cd96a6a84a457ec8
https://github.com/byu-oit/sans-server/blob/022bcf7b47321e6e8aa20467cd96a6a84a457ec8/bin/server/sans-server.js#L130-L160
train
byu-oit/sans-server
bin/server/sans-server.js
defineHookRunner
function defineHookRunner(runners, type) { if (runners.types.hasOwnProperty(type)) { const err = Error('There is already a hook runner defined for this type: ' + type); err.code = 'ESHOOK'; throw err; } const s = Symbol(type); runners.types[type] = s; runners.symbols[s] = ty...
javascript
function defineHookRunner(runners, type) { if (runners.types.hasOwnProperty(type)) { const err = Error('There is already a hook runner defined for this type: ' + type); err.code = 'ESHOOK'; throw err; } const s = Symbol(type); runners.types[type] = s; runners.symbols[s] = ty...
[ "function", "defineHookRunner", "(", "runners", ",", "type", ")", "{", "if", "(", "runners", ".", "types", ".", "hasOwnProperty", "(", "type", ")", ")", "{", "const", "err", "=", "Error", "(", "'There is already a hook runner defined for this type: '", "+", "typ...
Define a hook runner by specifying a unique type that can only be executed using the symbol returned. @param {{types: object, symbols: object}} runners @param {string} type @returns {Symbol}
[ "Define", "a", "hook", "runner", "by", "specifying", "a", "unique", "type", "that", "can", "only", "be", "executed", "using", "the", "symbol", "returned", "." ]
022bcf7b47321e6e8aa20467cd96a6a84a457ec8
https://github.com/byu-oit/sans-server/blob/022bcf7b47321e6e8aa20467cd96a6a84a457ec8/bin/server/sans-server.js#L168-L180
train
byu-oit/sans-server
bin/server/sans-server.js
request
function request(server, config, hooks, keys, request, callback) { const start = Date.now(); if (typeof request === 'function' && typeof callback !== 'function') { callback = request; request = {}; } // handle argument variations and get Request instance const args = Array.from(arg...
javascript
function request(server, config, hooks, keys, request, callback) { const start = Date.now(); if (typeof request === 'function' && typeof callback !== 'function') { callback = request; request = {}; } // handle argument variations and get Request instance const args = Array.from(arg...
[ "function", "request", "(", "server", ",", "config", ",", "hooks", ",", "keys", ",", "request", ",", "callback", ")", "{", "const", "start", "=", "Date", ".", "now", "(", ")", ";", "if", "(", "typeof", "request", "===", "'function'", "&&", "typeof", ...
Get a request started. @param {SansServer} server @param {object} config @param {object} hooks @param {object} keys @param {object} [request] @param {function} [callback]
[ "Get", "a", "request", "started", "." ]
022bcf7b47321e6e8aa20467cd96a6a84a457ec8
https://github.com/byu-oit/sans-server/blob/022bcf7b47321e6e8aa20467cd96a6a84a457ec8/bin/server/sans-server.js#L191-L250
train
byu-oit/sans-server
bin/server/sans-server.js
timeout
function timeout(seconds) { return function timeoutSet(req, res, next) { const timeoutId = setTimeout(() => { if (!res.sent) res.sendStatus(504) }, 1000 * seconds); req.hook('response', Number.MAX_SAFE_INTEGER - 1000, function timeoutClear(req, res, next) { clearTime...
javascript
function timeout(seconds) { return function timeoutSet(req, res, next) { const timeoutId = setTimeout(() => { if (!res.sent) res.sendStatus(504) }, 1000 * seconds); req.hook('response', Number.MAX_SAFE_INTEGER - 1000, function timeoutClear(req, res, next) { clearTime...
[ "function", "timeout", "(", "seconds", ")", "{", "return", "function", "timeoutSet", "(", "req", ",", "res", ",", "next", ")", "{", "const", "timeoutId", "=", "setTimeout", "(", "(", ")", "=>", "{", "if", "(", "!", "res", ".", "sent", ")", "res", "...
Request middleware to apply timeouts to the request. @param {number} seconds @returns {function}
[ "Request", "middleware", "to", "apply", "timeouts", "to", "the", "request", "." ]
022bcf7b47321e6e8aa20467cd96a6a84a457ec8
https://github.com/byu-oit/sans-server/blob/022bcf7b47321e6e8aa20467cd96a6a84a457ec8/bin/server/sans-server.js#L257-L270
train
byu-oit/sans-server
bin/server/sans-server.js
transform
function transform(req, res, next) { const state = res.state; const body = state.body; const type = typeof body; const isBuffer = body instanceof Buffer; let contentType; // error conversion if (body instanceof Error) { res.log('transform', 'Converting Error to response'); r...
javascript
function transform(req, res, next) { const state = res.state; const body = state.body; const type = typeof body; const isBuffer = body instanceof Buffer; let contentType; // error conversion if (body instanceof Error) { res.log('transform', 'Converting Error to response'); r...
[ "function", "transform", "(", "req", ",", "res", ",", "next", ")", "{", "const", "state", "=", "res", ".", "state", ";", "const", "body", "=", "state", ".", "body", ";", "const", "type", "=", "typeof", "body", ";", "const", "isBuffer", "=", "body", ...
Response middleware for transforming the response body and setting content type. @param {Request} req @param {Response} res @param {function} next
[ "Response", "middleware", "for", "transforming", "the", "response", "body", "and", "setting", "content", "type", "." ]
022bcf7b47321e6e8aa20467cd96a6a84a457ec8
https://github.com/byu-oit/sans-server/blob/022bcf7b47321e6e8aa20467cd96a6a84a457ec8/bin/server/sans-server.js#L278-L319
train
byu-oit/sans-server
bin/server/sans-server.js
validMethod
function validMethod(req, res, next) { if (httpMethods.indexOf(req.method) === -1) { res.sendStatus(405); } else { next(); } }
javascript
function validMethod(req, res, next) { if (httpMethods.indexOf(req.method) === -1) { res.sendStatus(405); } else { next(); } }
[ "function", "validMethod", "(", "req", ",", "res", ",", "next", ")", "{", "if", "(", "httpMethods", ".", "indexOf", "(", "req", ".", "method", ")", "===", "-", "1", ")", "{", "res", ".", "sendStatus", "(", "405", ")", ";", "}", "else", "{", "next...
Middleware to make sure the method is valid. @param {Request} req @param {Response} res @param {function} next
[ "Middleware", "to", "make", "sure", "the", "method", "is", "valid", "." ]
022bcf7b47321e6e8aa20467cd96a6a84a457ec8
https://github.com/byu-oit/sans-server/blob/022bcf7b47321e6e8aa20467cd96a6a84a457ec8/bin/server/sans-server.js#L327-L333
train
huafu/ember-dev-fixtures
private/utils/dev-fixtures/model.js
function (name) { if (!this.instances[name]) { this.instances[name] = DevFixturesModel.create({name: name}); } return this.instances[name]; }
javascript
function (name) { if (!this.instances[name]) { this.instances[name] = DevFixturesModel.create({name: name}); } return this.instances[name]; }
[ "function", "(", "name", ")", "{", "if", "(", "!", "this", ".", "instances", "[", "name", "]", ")", "{", "this", ".", "instances", "[", "name", "]", "=", "DevFixturesModel", ".", "create", "(", "{", "name", ":", "name", "}", ")", ";", "}", "retur...
Get or create the singleton instance for given model name @method for @param {string} name @return {DevFixturesModel}
[ "Get", "or", "create", "the", "singleton", "instance", "for", "given", "model", "name" ]
811ed4d339c2dc840d5b297b5b244726cf1339ca
https://github.com/huafu/ember-dev-fixtures/blob/811ed4d339c2dc840d5b297b5b244726cf1339ca/private/utils/dev-fixtures/model.js#L78-L83
train
KeyboardLeopard/leopardize
index.js
sliceOf
function sliceOf(ars, i, parts) { return ars.slice( Math.floor(i/parts*ars.length), Math.floor((i+1)/parts*ars.length)); }
javascript
function sliceOf(ars, i, parts) { return ars.slice( Math.floor(i/parts*ars.length), Math.floor((i+1)/parts*ars.length)); }
[ "function", "sliceOf", "(", "ars", ",", "i", ",", "parts", ")", "{", "return", "ars", ".", "slice", "(", "Math", ".", "floor", "(", "i", "/", "parts", "*", "ars", ".", "length", ")", ",", "Math", ".", "floor", "(", "(", "i", "+", "1", ")", "/...
Slice against, for arrays or strings.
[ "Slice", "against", "for", "arrays", "or", "strings", "." ]
5b89d648318401cfc0c8325cae71e473d759e1db
https://github.com/KeyboardLeopard/leopardize/blob/5b89d648318401cfc0c8325cae71e473d759e1db/index.js#L24-L28
train
digiaonline/generator-nord-backbone
app/templates/components/viewManager.js
function(className, viewArgs) { var self = this, view = this.views[className], dfd = $.Deferred(); if (view) { view.undelegateEvents(); } this.loader.load(className) .then(function(Constructor) { ...
javascript
function(className, viewArgs) { var self = this, view = this.views[className], dfd = $.Deferred(); if (view) { view.undelegateEvents(); } this.loader.load(className) .then(function(Constructor) { ...
[ "function", "(", "className", ",", "viewArgs", ")", "{", "var", "self", "=", "this", ",", "view", "=", "this", ".", "views", "[", "className", "]", ",", "dfd", "=", "$", ".", "Deferred", "(", ")", ";", "if", "(", "view", ")", "{", "view", ".", ...
Creates a new view. @param {string} className the view to create @param {Object} viewArgs view options
[ "Creates", "a", "new", "view", "." ]
bc962e16b6354c7a4034ce09cf4030b9d300202e
https://github.com/digiaonline/generator-nord-backbone/blob/bc962e16b6354c7a4034ce09cf4030b9d300202e/app/templates/components/viewManager.js#L29-L47
train
jantimon/ng-directive-parser
lib/ng-directive-parser.js
Directive
function Directive(filename, directiveArguments) { this.filename = filename; this.name = directiveArguments[0].value; var directiveConfiguration = directiveArguments[1]; // Extract the last attribute of the array if (directiveConfiguration.type === 'ArrayExpression' && directiveConfiguration.elements.length) ...
javascript
function Directive(filename, directiveArguments) { this.filename = filename; this.name = directiveArguments[0].value; var directiveConfiguration = directiveArguments[1]; // Extract the last attribute of the array if (directiveConfiguration.type === 'ArrayExpression' && directiveConfiguration.elements.length) ...
[ "function", "Directive", "(", "filename", ",", "directiveArguments", ")", "{", "this", ".", "filename", "=", "filename", ";", "this", ".", "name", "=", "directiveArguments", "[", "0", "]", ".", "value", ";", "var", "directiveConfiguration", "=", "directiveArgu...
Class for a directive information bundle @param filename @param directiveArguments @constructor
[ "Class", "for", "a", "directive", "information", "bundle" ]
e7bb3b800243be7399d8af3ab2546dd3f159beda
https://github.com/jantimon/ng-directive-parser/blob/e7bb3b800243be7399d8af3ab2546dd3f159beda/lib/ng-directive-parser.js#L21-L61
train
jantimon/ng-directive-parser
lib/ng-directive-parser.js
parseAst
function parseAst(filename, ast) { var directives = []; esprimaHelper.traverse(ast, function (node) { var calleeExpressionName = esprimaHelper.getCallExpressionName(node); if (calleeExpressionName === 'directive') { var directiveArguments = node['arguments'] || []; if (directiveArguments.length ...
javascript
function parseAst(filename, ast) { var directives = []; esprimaHelper.traverse(ast, function (node) { var calleeExpressionName = esprimaHelper.getCallExpressionName(node); if (calleeExpressionName === 'directive') { var directiveArguments = node['arguments'] || []; if (directiveArguments.length ...
[ "function", "parseAst", "(", "filename", ",", "ast", ")", "{", "var", "directives", "=", "[", "]", ";", "esprimaHelper", ".", "traverse", "(", "ast", ",", "function", "(", "node", ")", "{", "var", "calleeExpressionName", "=", "esprimaHelper", ".", "getCall...
Parse the given AST @returns {Directive[]}
[ "Parse", "the", "given", "AST" ]
e7bb3b800243be7399d8af3ab2546dd3f159beda
https://github.com/jantimon/ng-directive-parser/blob/e7bb3b800243be7399d8af3ab2546dd3f159beda/lib/ng-directive-parser.js#L68-L80
train
jantimon/ng-directive-parser
lib/ng-directive-parser.js
parseFile
function parseFile(filename, code) { if (/directive/.test(code)) { return ngDirectiveParser.parseAst(filename, esprima.parse(code)); } return []; }
javascript
function parseFile(filename, code) { if (/directive/.test(code)) { return ngDirectiveParser.parseAst(filename, esprima.parse(code)); } return []; }
[ "function", "parseFile", "(", "filename", ",", "code", ")", "{", "if", "(", "/", "directive", "/", ".", "test", "(", "code", ")", ")", "{", "return", "ngDirectiveParser", ".", "parseAst", "(", "filename", ",", "esprima", ".", "parse", "(", "code", ")",...
Parses the given source @returns {Directive[]}
[ "Parses", "the", "given", "source" ]
e7bb3b800243be7399d8af3ab2546dd3f159beda
https://github.com/jantimon/ng-directive-parser/blob/e7bb3b800243be7399d8af3ab2546dd3f159beda/lib/ng-directive-parser.js#L90-L95
train
markselby/node-db-pool
lib/db-pool.js
connStr
function connStr(conn) { var conf = mergeDefaults(conn); var connString = conf.driver + '://' + conf.username + (conf.password ? ':' + conf.password : '') + '@' + conf.host + (conf.port ? ':' + conf.port : '') + '/' + conf.database; return connString; }
javascript
function connStr(conn) { var conf = mergeDefaults(conn); var connString = conf.driver + '://' + conf.username + (conf.password ? ':' + conf.password : '') + '@' + conf.host + (conf.port ? ':' + conf.port : '') + '/' + conf.database; return connString; }
[ "function", "connStr", "(", "conn", ")", "{", "var", "conf", "=", "mergeDefaults", "(", "conn", ")", ";", "var", "connString", "=", "conf", ".", "driver", "+", "'://'", "+", "conf", ".", "username", "+", "(", "conf", ".", "password", "?", "':'", "+",...
Build a connection string from target db + env hash
[ "Build", "a", "connection", "string", "from", "target", "db", "+", "env", "hash" ]
97a329ca7cb625f9453dc4c887b84b5ac591a49f
https://github.com/markselby/node-db-pool/blob/97a329ca7cb625f9453dc4c887b84b5ac591a49f/lib/db-pool.js#L100-L105
train
markselby/node-db-pool
lib/db-pool.js
createPool
function createPool(conn) { var conf = connectionConfig[conn.app][conn.env]; conf.connStr = connStr(conn); console.log('Creating pool to : ' + conf.connStr); // Create the pool on the conf object for easy future access conf.pool = anydb.createPool(conf.connStr, { min: conf.min, max: conf.max, onCo...
javascript
function createPool(conn) { var conf = connectionConfig[conn.app][conn.env]; conf.connStr = connStr(conn); console.log('Creating pool to : ' + conf.connStr); // Create the pool on the conf object for easy future access conf.pool = anydb.createPool(conf.connStr, { min: conf.min, max: conf.max, onCo...
[ "function", "createPool", "(", "conn", ")", "{", "var", "conf", "=", "connectionConfig", "[", "conn", ".", "app", "]", "[", "conn", ".", "env", "]", ";", "conf", ".", "connStr", "=", "connStr", "(", "conn", ")", ";", "console", ".", "log", "(", "'C...
Create the connection pool via any-db
[ "Create", "the", "connection", "pool", "via", "any", "-", "db" ]
97a329ca7cb625f9453dc4c887b84b5ac591a49f
https://github.com/markselby/node-db-pool/blob/97a329ca7cb625f9453dc4c887b84b5ac591a49f/lib/db-pool.js#L108-L126
train
ottopecz/talentcomposer
lib/mlMutators.js
parseML
function parseML(memberLog, required) { return memberLog.map(member => { const cloned = clone(member); const key = Reflect.ownKeys(cloned)[0]; const value = cloned[key]; cloned[key] = value.filter(elem => (elem !== required)); return cloned; }); }
javascript
function parseML(memberLog, required) { return memberLog.map(member => { const cloned = clone(member); const key = Reflect.ownKeys(cloned)[0]; const value = cloned[key]; cloned[key] = value.filter(elem => (elem !== required)); return cloned; }); }
[ "function", "parseML", "(", "memberLog", ",", "required", ")", "{", "return", "memberLog", ".", "map", "(", "member", "=>", "{", "const", "cloned", "=", "clone", "(", "member", ")", ";", "const", "key", "=", "Reflect", ".", "ownKeys", "(", "cloned", ")...
Removes the required members of the member log @param {Array.<Object>} memberLog The array of the members. The entries are objects with one own key @param {Symbol} required The required marker @returns {Array.<Object>} The parsed member log
[ "Removes", "the", "required", "members", "of", "the", "member", "log" ]
440c73248ccb6538c7805ada6a8feb5b3ae4a973
https://github.com/ottopecz/talentcomposer/blob/440c73248ccb6538c7805ada6a8feb5b3ae4a973/lib/mlMutators.js#L11-L23
train
ottopecz/talentcomposer
lib/mlMutators.js
addSourceInfoToML
function addSourceInfoToML(memberLog, source) { let cloned = memberLog.slice(); for (const [key, value] of getIterableObjectEntries(source)) { if (Talent.typeCheck(value)) { cloned = addSourceInfoToML(cloned, value); } const foundAndCloned = clone(findWhereKey(cloned, key)); if (!foundAn...
javascript
function addSourceInfoToML(memberLog, source) { let cloned = memberLog.slice(); for (const [key, value] of getIterableObjectEntries(source)) { if (Talent.typeCheck(value)) { cloned = addSourceInfoToML(cloned, value); } const foundAndCloned = clone(findWhereKey(cloned, key)); if (!foundAn...
[ "function", "addSourceInfoToML", "(", "memberLog", ",", "source", ")", "{", "let", "cloned", "=", "memberLog", ".", "slice", "(", ")", ";", "for", "(", "const", "[", "key", ",", "value", "]", "of", "getIterableObjectEntries", "(", "source", ")", ")", "{"...
Adds new entry to the member log or modifies an existing one @param {Array.<Object>} memberLog The array of the members. The entries are objects with one own key @param {Talent} source The talent which info needs to be added. (Might be nested) @returns {Array.<Object>} The modified member log
[ "Adds", "new", "entry", "to", "the", "member", "log", "or", "modifies", "an", "existing", "one" ]
440c73248ccb6538c7805ada6a8feb5b3ae4a973
https://github.com/ottopecz/talentcomposer/blob/440c73248ccb6538c7805ada6a8feb5b3ae4a973/lib/mlMutators.js#L31-L54
train
benadamstyles/roots-i18n
lib/index.js
translate
function translate(content, langFile) { return content.replace(templateRegEx, function (match, capture) { return (0, _lodash2.default)(langMap.get(langFile), capture); }); }
javascript
function translate(content, langFile) { return content.replace(templateRegEx, function (match, capture) { return (0, _lodash2.default)(langMap.get(langFile), capture); }); }
[ "function", "translate", "(", "content", ",", "langFile", ")", "{", "return", "content", ".", "replace", "(", "templateRegEx", ",", "function", "(", "match", ",", "capture", ")", "{", "return", "(", "0", ",", "_lodash2", ".", "default", ")", "(", "langMa...
Pure function to translate a view template file @param {String} content The file content @param {String} langFile The file's path @return {String} The file content, translated
[ "Pure", "function", "to", "translate", "a", "view", "template", "file" ]
333976649f6705a6b31bd5da74aa973b51a39bb5
https://github.com/benadamstyles/roots-i18n/blob/333976649f6705a6b31bd5da74aa973b51a39bb5/lib/index.js#L55-L59
train
ItsAsbreuk/itsa-mojitonthefly-addon
assets/itsa-mojitonthefly.client.js
function (promise) { var targets = this._targets; targets.push(promise); promise['catch']( function() { return true; } ).then( function() { targets.splice(targets.indexOf(promise), 1);...
javascript
function (promise) { var targets = this._targets; targets.push(promise); promise['catch']( function() { return true; } ).then( function() { targets.splice(targets.indexOf(promise), 1);...
[ "function", "(", "promise", ")", "{", "var", "targets", "=", "this", ".", "_targets", ";", "targets", ".", "push", "(", "promise", ")", ";", "promise", "[", "'catch'", "]", "(", "function", "(", ")", "{", "return", "true", ";", "}", ")", ".", "then...
Decorate a promise and register it and its kin as targets for notifications from this instance. Returns the input promise. @method addEvents @param {Promise} promise The Promise to add event support to @return {Promise}
[ "Decorate", "a", "promise", "and", "register", "it", "and", "its", "kin", "as", "targets", "for", "notifications", "from", "this", "instance", "." ]
500de397fef8f80f719360d4ac023bb860934ec0
https://github.com/ItsAsbreuk/itsa-mojitonthefly-addon/blob/500de397fef8f80f719360d4ac023bb860934ec0/assets/itsa-mojitonthefly.client.js#L118-L131
train
ItsAsbreuk/itsa-mojitonthefly-addon
assets/itsa-mojitonthefly.client.js
function (type) { var targets = this._targets.slice(), known = {}, args = arguments.length > 1 && toArray(arguments, 1, true), target, subs, i, j, jlen, guid, callback; // Add index 0 and 1 entries for use in Y.bind.apply(Y, a...
javascript
function (type) { var targets = this._targets.slice(), known = {}, args = arguments.length > 1 && toArray(arguments, 1, true), target, subs, i, j, jlen, guid, callback; // Add index 0 and 1 entries for use in Y.bind.apply(Y, a...
[ "function", "(", "type", ")", "{", "var", "targets", "=", "this", ".", "_targets", ".", "slice", "(", ")", ",", "known", "=", "{", "}", ",", "args", "=", "arguments", ".", "length", ">", "1", "&&", "toArray", "(", "arguments", ",", "1", ",", "tru...
Notify registered Promises and their children of an event. Subscription callbacks will be passed additional _args_ parameters. @method fire @param {String} type The name of the event to notify subscribers of @param {Any*} [args*] Arguments to pass to the callbacks @return {Promise.EventNotifier} this instance @chainab...
[ "Notify", "registered", "Promises", "and", "their", "children", "of", "an", "event", ".", "Subscription", "callbacks", "will", "be", "passed", "additional", "_args_", "parameters", "." ]
500de397fef8f80f719360d4ac023bb860934ec0
https://github.com/ItsAsbreuk/itsa-mojitonthefly-addon/blob/500de397fef8f80f719360d4ac023bb860934ec0/assets/itsa-mojitonthefly.client.js#L143-L202
train
ItsAsbreuk/itsa-mojitonthefly-addon
assets/itsa-mojitonthefly.client.js
function(anchornode) { var valid = (anchornode.get('tagName')==='A') && anchornode.getAttribute('data-pjax-mojit'), attributes, i, parheader; if (valid) { attributes = { 'data-pjax-mojit': anchornode.getAttribute('data-pjax...
javascript
function(anchornode) { var valid = (anchornode.get('tagName')==='A') && anchornode.getAttribute('data-pjax-mojit'), attributes, i, parheader; if (valid) { attributes = { 'data-pjax-mojit': anchornode.getAttribute('data-pjax...
[ "function", "(", "anchornode", ")", "{", "var", "valid", "=", "(", "anchornode", ".", "get", "(", "'tagName'", ")", "===", "'A'", ")", "&&", "anchornode", ".", "getAttribute", "(", "'data-pjax-mojit'", ")", ",", "attributes", ",", "i", ",", "parheader", ...
Simulates an achorclick on a Pjax-link-element. @method Y.mojito.pjax.simulateAnchorClick @param anchornode {Y.Node} the node on which the click should be simulated
[ "Simulates", "an", "achorclick", "on", "a", "Pjax", "-", "link", "-", "element", "." ]
500de397fef8f80f719360d4ac023bb860934ec0
https://github.com/ItsAsbreuk/itsa-mojitonthefly-addon/blob/500de397fef8f80f719360d4ac023bb860934ec0/assets/itsa-mojitonthefly.client.js#L957-L975
train
cheng-kang/vuewild
src/vuewild.js
_getRef
function _getRef (refOrQuery) { if (typeof refOrQuery.ref === 'function') { refOrQuery = refOrQuery.ref() } else if (typeof refOrQuery.ref === 'object') { refOrQuery = refOrQuery.ref } return refOrQuery }
javascript
function _getRef (refOrQuery) { if (typeof refOrQuery.ref === 'function') { refOrQuery = refOrQuery.ref() } else if (typeof refOrQuery.ref === 'object') { refOrQuery = refOrQuery.ref } return refOrQuery }
[ "function", "_getRef", "(", "refOrQuery", ")", "{", "if", "(", "typeof", "refOrQuery", ".", "ref", "===", "'function'", ")", "{", "refOrQuery", "=", "refOrQuery", ".", "ref", "(", ")", "}", "else", "if", "(", "typeof", "refOrQuery", ".", "ref", "===", ...
Returns the original reference of a Wilddog reference or query across SDK versions. @param {WilddogReference|WilddogQuery} refOrQuery @return {WilddogReference}
[ "Returns", "the", "original", "reference", "of", "a", "Wilddog", "reference", "or", "query", "across", "SDK", "versions", "." ]
76288484f73eaa99217dea92a2f34eb67e27405a
https://github.com/cheng-kang/vuewild/blob/76288484f73eaa99217dea92a2f34eb67e27405a/src/vuewild.js#L21-L29
train
cheng-kang/vuewild
src/vuewild.js
createRecord
function createRecord (snapshot) { var value = snapshot.val() var res = isObject(value) ? value : { '.value': value } res['.key'] = _getKey(snapshot) return res }
javascript
function createRecord (snapshot) { var value = snapshot.val() var res = isObject(value) ? value : { '.value': value } res['.key'] = _getKey(snapshot) return res }
[ "function", "createRecord", "(", "snapshot", ")", "{", "var", "value", "=", "snapshot", ".", "val", "(", ")", "var", "res", "=", "isObject", "(", "value", ")", "?", "value", ":", "{", "'.value'", ":", "value", "}", "res", "[", "'.key'", "]", "=", "...
Convert wilddog snapshot into a bindable data record. @param {WilddogSnapshot} snapshot @return {Object}
[ "Convert", "wilddog", "snapshot", "into", "a", "bindable", "data", "record", "." ]
76288484f73eaa99217dea92a2f34eb67e27405a
https://github.com/cheng-kang/vuewild/blob/76288484f73eaa99217dea92a2f34eb67e27405a/src/vuewild.js#L47-L54
train
cheng-kang/vuewild
src/vuewild.js
indexForKey
function indexForKey (array, key) { for (var i = 0; i < array.length; i++) { if (array[i]['.key'] === key) { return i } } /* istanbul ignore next */ return -1 }
javascript
function indexForKey (array, key) { for (var i = 0; i < array.length; i++) { if (array[i]['.key'] === key) { return i } } /* istanbul ignore next */ return -1 }
[ "function", "indexForKey", "(", "array", ",", "key", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "array", ".", "length", ";", "i", "++", ")", "{", "if", "(", "array", "[", "i", "]", "[", "'.key'", "]", "===", "key", ")", "{", ...
Find the index for an object with given key. @param {array} array @param {string} key @return {number}
[ "Find", "the", "index", "for", "an", "object", "with", "given", "key", "." ]
76288484f73eaa99217dea92a2f34eb67e27405a
https://github.com/cheng-kang/vuewild/blob/76288484f73eaa99217dea92a2f34eb67e27405a/src/vuewild.js#L63-L71
train
cheng-kang/vuewild
src/vuewild.js
bind
function bind (vm, key, source) { var asObject = false var cancelCallback = null var readyCallback = null // check { source, asArray, cancelCallback } syntax if (isObject(source) && source.hasOwnProperty('source')) { asObject = source.asObject cancelCallback = source.cancelCallback readyCallback =...
javascript
function bind (vm, key, source) { var asObject = false var cancelCallback = null var readyCallback = null // check { source, asArray, cancelCallback } syntax if (isObject(source) && source.hasOwnProperty('source')) { asObject = source.asObject cancelCallback = source.cancelCallback readyCallback =...
[ "function", "bind", "(", "vm", ",", "key", ",", "source", ")", "{", "var", "asObject", "=", "false", "var", "cancelCallback", "=", "null", "var", "readyCallback", "=", "null", "// check { source, asArray, cancelCallback } syntax", "if", "(", "isObject", "(", "so...
Bind a wilddog data source to a key on a vm. @param {Vue} vm @param {string} key @param {object} source
[ "Bind", "a", "wilddog", "data", "source", "to", "a", "key", "on", "a", "vm", "." ]
76288484f73eaa99217dea92a2f34eb67e27405a
https://github.com/cheng-kang/vuewild/blob/76288484f73eaa99217dea92a2f34eb67e27405a/src/vuewild.js#L80-L109
train
cheng-kang/vuewild
src/vuewild.js
defineReactive
function defineReactive (vm, key, val) { if (key in vm) { vm[key] = val } else { Vue.util.defineReactive(vm, key, val) } }
javascript
function defineReactive (vm, key, val) { if (key in vm) { vm[key] = val } else { Vue.util.defineReactive(vm, key, val) } }
[ "function", "defineReactive", "(", "vm", ",", "key", ",", "val", ")", "{", "if", "(", "key", "in", "vm", ")", "{", "vm", "[", "key", "]", "=", "val", "}", "else", "{", "Vue", ".", "util", ".", "defineReactive", "(", "vm", ",", "key", ",", "val"...
Define a reactive property in a given vm if it's not defined yet @param {Vue} vm @param {string} key @param {*} val
[ "Define", "a", "reactive", "property", "in", "a", "given", "vm", "if", "it", "s", "not", "defined", "yet" ]
76288484f73eaa99217dea92a2f34eb67e27405a
https://github.com/cheng-kang/vuewild/blob/76288484f73eaa99217dea92a2f34eb67e27405a/src/vuewild.js#L119-L125
train
cheng-kang/vuewild
src/vuewild.js
bindAsArray
function bindAsArray (vm, key, source, cancelCallback) { var array = [] defineReactive(vm, key, array) var onAdd = source.on('child_added', function (snapshot, prevKey) { var index = prevKey ? indexForKey(array, prevKey) + 1 : 0 array.splice(index, 0, createRecord(snapshot)) }, cancelCallback) var o...
javascript
function bindAsArray (vm, key, source, cancelCallback) { var array = [] defineReactive(vm, key, array) var onAdd = source.on('child_added', function (snapshot, prevKey) { var index = prevKey ? indexForKey(array, prevKey) + 1 : 0 array.splice(index, 0, createRecord(snapshot)) }, cancelCallback) var o...
[ "function", "bindAsArray", "(", "vm", ",", "key", ",", "source", ",", "cancelCallback", ")", "{", "var", "array", "=", "[", "]", "defineReactive", "(", "vm", ",", "key", ",", "array", ")", "var", "onAdd", "=", "source", ".", "on", "(", "'child_added'",...
Bind a wilddog data source to a key on a vm as an Array. @param {Vue} vm @param {string} key @param {object} source @param {function|null} cancelCallback
[ "Bind", "a", "wilddog", "data", "source", "to", "a", "key", "on", "a", "vm", "as", "an", "Array", "." ]
76288484f73eaa99217dea92a2f34eb67e27405a
https://github.com/cheng-kang/vuewild/blob/76288484f73eaa99217dea92a2f34eb67e27405a/src/vuewild.js#L135-L167
train
cheng-kang/vuewild
src/vuewild.js
bindAsObject
function bindAsObject (vm, key, source, cancelCallback) { defineReactive(vm, key, {}) var cb = source.on('value', function (snapshot) { vm[key] = createRecord(snapshot) }, cancelCallback) vm._wilddogListeners[key] = { value: cb } }
javascript
function bindAsObject (vm, key, source, cancelCallback) { defineReactive(vm, key, {}) var cb = source.on('value', function (snapshot) { vm[key] = createRecord(snapshot) }, cancelCallback) vm._wilddogListeners[key] = { value: cb } }
[ "function", "bindAsObject", "(", "vm", ",", "key", ",", "source", ",", "cancelCallback", ")", "{", "defineReactive", "(", "vm", ",", "key", ",", "{", "}", ")", "var", "cb", "=", "source", ".", "on", "(", "'value'", ",", "function", "(", "snapshot", "...
Bind a wilddog data source to a key on a vm as an Object. @param {Vue} vm @param {string} key @param {Object} source @param {function|null} cancelCallback
[ "Bind", "a", "wilddog", "data", "source", "to", "a", "key", "on", "a", "vm", "as", "an", "Object", "." ]
76288484f73eaa99217dea92a2f34eb67e27405a
https://github.com/cheng-kang/vuewild/blob/76288484f73eaa99217dea92a2f34eb67e27405a/src/vuewild.js#L177-L183
train
cheng-kang/vuewild
src/vuewild.js
unbind
function unbind (vm, key) { var source = vm._wilddogSources && vm._wilddogSources[key] if (!source) { throw new Error( 'VueWild: unbind failed: "' + key + '" is not bound to ' + 'a Wilddog reference.' ) } var listeners = vm._wilddogListeners[key] for (var event in listeners) { source.o...
javascript
function unbind (vm, key) { var source = vm._wilddogSources && vm._wilddogSources[key] if (!source) { throw new Error( 'VueWild: unbind failed: "' + key + '" is not bound to ' + 'a Wilddog reference.' ) } var listeners = vm._wilddogListeners[key] for (var event in listeners) { source.o...
[ "function", "unbind", "(", "vm", ",", "key", ")", "{", "var", "source", "=", "vm", ".", "_wilddogSources", "&&", "vm", ".", "_wilddogSources", "[", "key", "]", "if", "(", "!", "source", ")", "{", "throw", "new", "Error", "(", "'VueWild: unbind failed: \"...
Unbind a wilddog-bound key from a vm. @param {Vue} vm @param {string} key
[ "Unbind", "a", "wilddog", "-", "bound", "key", "from", "a", "vm", "." ]
76288484f73eaa99217dea92a2f34eb67e27405a
https://github.com/cheng-kang/vuewild/blob/76288484f73eaa99217dea92a2f34eb67e27405a/src/vuewild.js#L191-L207
train
cheng-kang/vuewild
src/vuewild.js
ensureRefs
function ensureRefs (vm) { if (!vm.$wilddogRefs) { vm.$wilddogRefs = Object.create(null) vm._wilddogSources = Object.create(null) vm._wilddogListeners = Object.create(null) } }
javascript
function ensureRefs (vm) { if (!vm.$wilddogRefs) { vm.$wilddogRefs = Object.create(null) vm._wilddogSources = Object.create(null) vm._wilddogListeners = Object.create(null) } }
[ "function", "ensureRefs", "(", "vm", ")", "{", "if", "(", "!", "vm", ".", "$wilddogRefs", ")", "{", "vm", ".", "$wilddogRefs", "=", "Object", ".", "create", "(", "null", ")", "vm", ".", "_wilddogSources", "=", "Object", ".", "create", "(", "null", ")...
Ensure the related bookkeeping variables on an instance. @param {Vue} vm
[ "Ensure", "the", "related", "bookkeeping", "variables", "on", "an", "instance", "." ]
76288484f73eaa99217dea92a2f34eb67e27405a
https://github.com/cheng-kang/vuewild/blob/76288484f73eaa99217dea92a2f34eb67e27405a/src/vuewild.js#L214-L220
train
simbo/auto-plug
lib/auto-plug.js
getRequireNameForPackage
function getRequireNameForPackage(pkgName) { if (this.options.rename[pkgName]) { return this.options.rename[pkgName]; } var requireName = pkgName.replace(this.options.replaceExp, ''); return this.options.camelize ? camelize(requireName) : requireName; }
javascript
function getRequireNameForPackage(pkgName) { if (this.options.rename[pkgName]) { return this.options.rename[pkgName]; } var requireName = pkgName.replace(this.options.replaceExp, ''); return this.options.camelize ? camelize(requireName) : requireName; }
[ "function", "getRequireNameForPackage", "(", "pkgName", ")", "{", "if", "(", "this", ".", "options", ".", "rename", "[", "pkgName", "]", ")", "{", "return", "this", ".", "options", ".", "rename", "[", "pkgName", "]", ";", "}", "var", "requireName", "=", ...
returns a filtered name for a require container property @param {String} pkgName original package name @return {String} filtered name
[ "returns", "a", "filtered", "name", "for", "a", "require", "container", "property" ]
ce7178b495c67787d7fd805a37854d927e45a999
https://github.com/simbo/auto-plug/blob/ce7178b495c67787d7fd805a37854d927e45a999/lib/auto-plug.js#L188-L194
train
commenthol/streamss
lib/readarray.js
ReadArray
function ReadArray (options, array) { if (!(this instanceof ReadArray)) { return new ReadArray(options, array) } if (Array.isArray(options)) { array = options options = {} } options = Object.assign({}, options) Readable.call(this, options) this._array = array || [] this._cnt = this._array...
javascript
function ReadArray (options, array) { if (!(this instanceof ReadArray)) { return new ReadArray(options, array) } if (Array.isArray(options)) { array = options options = {} } options = Object.assign({}, options) Readable.call(this, options) this._array = array || [] this._cnt = this._array...
[ "function", "ReadArray", "(", "options", ",", "array", ")", "{", "if", "(", "!", "(", "this", "instanceof", "ReadArray", ")", ")", "{", "return", "new", "ReadArray", "(", "options", ",", "array", ")", "}", "if", "(", "Array", ".", "isArray", "(", "op...
Read from an Array and push into stream. Takes care on pausing to push to the stream if pipe is saturated. @constructor @param {Object} [options] - Stream Options `{encoding, highWaterMark, objectMode, ...}` @param {Array} array - array to push down as stream (If array is an array of objects set `objectMode:true` or ...
[ "Read", "from", "an", "Array", "and", "push", "into", "stream", "." ]
cfef5d0ed30c7efe002018886e2e843c91d3558f
https://github.com/commenthol/streamss/blob/cfef5d0ed30c7efe002018886e2e843c91d3558f/lib/readarray.js#L21-L38
train
camshaft/rework-modules
lib/modules.js
select
function select(rule, prefix) { return rule.selectors && rule.selectors[0] && rule.selectors[0].indexOf(prefix) === 0; }
javascript
function select(rule, prefix) { return rule.selectors && rule.selectors[0] && rule.selectors[0].indexOf(prefix) === 0; }
[ "function", "select", "(", "rule", ",", "prefix", ")", "{", "return", "rule", ".", "selectors", "&&", "rule", ".", "selectors", "[", "0", "]", "&&", "rule", ".", "selectors", "[", "0", "]", ".", "indexOf", "(", "prefix", ")", "===", "0", ";", "}" ]
Match the rule's selector on prefix @param {Object} rule @param {String} prefix @return {Boolean}
[ "Match", "the", "rule", "s", "selector", "on", "prefix" ]
2c3616dbfaab5f039a395968890719887410514b
https://github.com/camshaft/rework-modules/blob/2c3616dbfaab5f039a395968890719887410514b/lib/modules.js#L353-L355
train
yoshuawuyts/methodist
index.js
assertKeys
function assertKeys (routes) { Object.keys(routes).forEach(function (route) { assert.ok(meths.indexOf(route) !== -1, route + ' is an invalid method') }) }
javascript
function assertKeys (routes) { Object.keys(routes).forEach(function (route) { assert.ok(meths.indexOf(route) !== -1, route + ' is an invalid method') }) }
[ "function", "assertKeys", "(", "routes", ")", "{", "Object", ".", "keys", "(", "routes", ")", ".", "forEach", "(", "function", "(", "route", ")", "{", "assert", ".", "ok", "(", "meths", ".", "indexOf", "(", "route", ")", "!==", "-", "1", ",", "rout...
assert object keys obj -> null
[ "assert", "object", "keys", "obj", "-", ">", "null" ]
27ea0672f5e021bec3ee95e00445cccabce6be79
https://github.com/yoshuawuyts/methodist/blob/27ea0672f5e021bec3ee95e00445cccabce6be79/index.js#L34-L38
train
bahmutov/connect-stop
index.js
getQueryResponse
function getQueryResponse(url) { var response; if (options.stopQueryParam) { var parsedUrl = parseUrl(url, true); if (parsedUrl.query && parsedUrl.query[options.stopQueryParam]) { var queryResponse = parseInt(parsedUrl.query[options.stopQueryParam]); if (queryResponse > 1) { ...
javascript
function getQueryResponse(url) { var response; if (options.stopQueryParam) { var parsedUrl = parseUrl(url, true); if (parsedUrl.query && parsedUrl.query[options.stopQueryParam]) { var queryResponse = parseInt(parsedUrl.query[options.stopQueryParam]); if (queryResponse > 1) { ...
[ "function", "getQueryResponse", "(", "url", ")", "{", "var", "response", ";", "if", "(", "options", ".", "stopQueryParam", ")", "{", "var", "parsedUrl", "=", "parseUrl", "(", "url", ",", "true", ")", ";", "if", "(", "parsedUrl", ".", "query", "&&", "pa...
Return the response for this url, if defined
[ "Return", "the", "response", "for", "this", "url", "if", "defined" ]
558c0569f55cf25533dcda88a66495031cf1d140
https://github.com/bahmutov/connect-stop/blob/558c0569f55cf25533dcda88a66495031cf1d140/index.js#L17-L31
train
wigy/chronicles_of_angular
src/store/db.js
engine
function engine(url) { var ret; var parts = /^(\w+):/.exec(url); if (!parts) { d.fatal("Invalid engine URI", url); } try { var Engine = angular.injector(['ng', 'coa.store']).get('Engine' + parts[1].ucfirst()); r...
javascript
function engine(url) { var ret; var parts = /^(\w+):/.exec(url); if (!parts) { d.fatal("Invalid engine URI", url); } try { var Engine = angular.injector(['ng', 'coa.store']).get('Engine' + parts[1].ucfirst()); r...
[ "function", "engine", "(", "url", ")", "{", "var", "ret", ";", "var", "parts", "=", "/", "^(\\w+):", "/", ".", "exec", "(", "url", ")", ";", "if", "(", "!", "parts", ")", "{", "d", ".", "fatal", "(", "\"Invalid engine URI\"", ",", "url", ")", ";"...
Parse URI and instantiate appropriate storage engine.
[ "Parse", "URI", "and", "instantiate", "appropriate", "storage", "engine", "." ]
3505c28291aff469bc58dabba80e192ed0eb3cce
https://github.com/wigy/chronicles_of_angular/blob/3505c28291aff469bc58dabba80e192ed0eb3cce/src/store/db.js#L22-L39
train
wigy/chronicles_of_angular
src/store/db.js
getEngine
function getEngine(name) { if (!dbconfig.has(name)) { d.fatal("Trying to access data storage that is not configured:", name); } var conf = dbconfig.get(name); if (!conf.engine) { conf.engine = engine(conf.url); } ret...
javascript
function getEngine(name) { if (!dbconfig.has(name)) { d.fatal("Trying to access data storage that is not configured:", name); } var conf = dbconfig.get(name); if (!conf.engine) { conf.engine = engine(conf.url); } ret...
[ "function", "getEngine", "(", "name", ")", "{", "if", "(", "!", "dbconfig", ".", "has", "(", "name", ")", ")", "{", "d", ".", "fatal", "(", "\"Trying to access data storage that is not configured:\"", ",", "name", ")", ";", "}", "var", "conf", "=", "dbconf...
Helper function to instantiate and initialize engine. If the named engine is not yet set in `dbconfig`, it is created and inserted there. Note that every time `dbconfig` is changed, the engine is nullified and new one is instantiated on the first use.
[ "Helper", "function", "to", "instantiate", "and", "initialize", "engine", ".", "If", "the", "named", "engine", "is", "not", "yet", "set", "in", "dbconfig", "it", "is", "created", "and", "inserted", "there", ".", "Note", "that", "every", "time", "dbconfig", ...
3505c28291aff469bc58dabba80e192ed0eb3cce
https://github.com/wigy/chronicles_of_angular/blob/3505c28291aff469bc58dabba80e192ed0eb3cce/src/store/db.js#L48-L57
train
ForbesLindesay-Unmaintained/sauce-test
lib/run-driver.js
runDriver
function runDriver(location, driver, options) { options.testComplete = options.testComplete || 'return window.TESTS_COMPLETE'; options.testPassed = options.testPassed || 'return window.TESTS_PASSED && !window.TESTS_FAILED'; var startTime = Date.now(); var jobInfo = { name: options.name, build: process.e...
javascript
function runDriver(location, driver, options) { options.testComplete = options.testComplete || 'return window.TESTS_COMPLETE'; options.testPassed = options.testPassed || 'return window.TESTS_PASSED && !window.TESTS_FAILED'; var startTime = Date.now(); var jobInfo = { name: options.name, build: process.e...
[ "function", "runDriver", "(", "location", ",", "driver", ",", "options", ")", "{", "options", ".", "testComplete", "=", "options", ".", "testComplete", "||", "'return window.TESTS_COMPLETE'", ";", "options", ".", "testPassed", "=", "options", ".", "testPassed", ...
Run a test against a given location with the suplied driver @option {Object} jobInfo An object that gets passed to Sauce Labs @option {Boolean} allowExceptions Set to `true` to skip the check for `window.onerror` @option {String|Function} testComplete A function to test if the job is comple...
[ "Run", "a", "test", "against", "a", "given", "location", "with", "the", "suplied", "driver" ]
7c671b3321dc63aefc00c1c8d49e943ead2e7f5e
https://github.com/ForbesLindesay-Unmaintained/sauce-test/blob/7c671b3321dc63aefc00c1c8d49e943ead2e7f5e/lib/run-driver.js#L23-L73
train
hitchyjs/odem
index.js
mergeAttributes
function mergeAttributes( target, source ) { const propNames = Object.keys( source ); for ( let i = 0, numNames = propNames.length; i < numNames; i++ ) { const name = propNames[i]; const attribute = source[name]; switch ( typeof attribute ) { case "object" : if ( attribute ) { break; } // ...
javascript
function mergeAttributes( target, source ) { const propNames = Object.keys( source ); for ( let i = 0, numNames = propNames.length; i < numNames; i++ ) { const name = propNames[i]; const attribute = source[name]; switch ( typeof attribute ) { case "object" : if ( attribute ) { break; } // ...
[ "function", "mergeAttributes", "(", "target", ",", "source", ")", "{", "const", "propNames", "=", "Object", ".", "keys", "(", "source", ")", ";", "for", "(", "let", "i", "=", "0", ",", "numNames", "=", "propNames", ".", "length", ";", "i", "<", "numN...
Merges separately defined map of static attributes into single schema matching expectations of hitchy-odem. @param {object} target resulting schema for use with hitchy-odem @param {object<string,function>} source maps names of attributes into either one's definition of type and validation requirements @returns {void}
[ "Merges", "separately", "defined", "map", "of", "static", "attributes", "into", "single", "schema", "matching", "expectations", "of", "hitchy", "-", "odem", "." ]
28f3dc31cc3314f9109d2cac1f5f7e20dad6521b
https://github.com/hitchyjs/odem/blob/28f3dc31cc3314f9109d2cac1f5f7e20dad6521b/index.js#L91-L111
train
hitchyjs/odem
index.js
mergeComputeds
function mergeComputeds( target, source ) { const propNames = Object.keys( source ); for ( let i = 0, numNames = propNames.length; i < numNames; i++ ) { const name = propNames[i]; const computer = source[name]; switch ( typeof computer ) { case "function" : break; default : throw new TypeError(...
javascript
function mergeComputeds( target, source ) { const propNames = Object.keys( source ); for ( let i = 0, numNames = propNames.length; i < numNames; i++ ) { const name = propNames[i]; const computer = source[name]; switch ( typeof computer ) { case "function" : break; default : throw new TypeError(...
[ "function", "mergeComputeds", "(", "target", ",", "source", ")", "{", "const", "propNames", "=", "Object", ".", "keys", "(", "source", ")", ";", "for", "(", "let", "i", "=", "0", ",", "numNames", "=", "propNames", ".", "length", ";", "i", "<", "numNa...
Merges separately defined map of computed attributes into single schema matching expectations of hitchy-odem. @param {object} target resulting schema for use with hitchy-odem @param {object<string,function>} source maps names of computed attributes into the related computing function @returns {void}
[ "Merges", "separately", "defined", "map", "of", "computed", "attributes", "into", "single", "schema", "matching", "expectations", "of", "hitchy", "-", "odem", "." ]
28f3dc31cc3314f9109d2cac1f5f7e20dad6521b
https://github.com/hitchyjs/odem/blob/28f3dc31cc3314f9109d2cac1f5f7e20dad6521b/index.js#L121-L138
train