id int32 0 58k | repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 |
|---|---|---|---|---|---|---|---|---|---|---|---|
57,800 | camshaft/anvil-cli | lib/local.js | statFiles | function statFiles(files, source, fn) {
var batch = new Batch();
files.forEach(function(file) {
batch.push(statFile(file, source));
});
batch.end(fn);
} | javascript | function statFiles(files, source, fn) {
var batch = new Batch();
files.forEach(function(file) {
batch.push(statFile(file, source));
});
batch.end(fn);
} | [
"function",
"statFiles",
"(",
"files",
",",
"source",
",",
"fn",
")",
"{",
"var",
"batch",
"=",
"new",
"Batch",
"(",
")",
";",
"files",
".",
"forEach",
"(",
"function",
"(",
"file",
")",
"{",
"batch",
".",
"push",
"(",
"statFile",
"(",
"file",
",",... | Get files info
@param {Array} files
@param {String} source
@param {Function} fn | [
"Get",
"files",
"info"
] | 5930e2165698c5577a0bcfa471dd521089acfb78 | https://github.com/camshaft/anvil-cli/blob/5930e2165698c5577a0bcfa471dd521089acfb78/lib/local.js#L147-L155 |
57,801 | camshaft/anvil-cli | lib/local.js | statFile | function statFile(file, source) {
return function(cb) {
var abs = join(source, file);
stat(abs, function(err, stats) {
if (err) return cb(err);
var manifest = {
name: file,
abs: abs,
mtime: Math.floor(stats.mtime.getTime() / 1000),
mode: '' + parseInt(stats.mode.to... | javascript | function statFile(file, source) {
return function(cb) {
var abs = join(source, file);
stat(abs, function(err, stats) {
if (err) return cb(err);
var manifest = {
name: file,
abs: abs,
mtime: Math.floor(stats.mtime.getTime() / 1000),
mode: '' + parseInt(stats.mode.to... | [
"function",
"statFile",
"(",
"file",
",",
"source",
")",
"{",
"return",
"function",
"(",
"cb",
")",
"{",
"var",
"abs",
"=",
"join",
"(",
"source",
",",
"file",
")",
";",
"stat",
"(",
"abs",
",",
"function",
"(",
"err",
",",
"stats",
")",
"{",
"if... | Get a file manifest
@param {String} file
@param {String} source
@return {Function} | [
"Get",
"a",
"file",
"manifest"
] | 5930e2165698c5577a0bcfa471dd521089acfb78 | https://github.com/camshaft/anvil-cli/blob/5930e2165698c5577a0bcfa471dd521089acfb78/lib/local.js#L165-L192 |
57,802 | camshaft/anvil-cli | lib/local.js | calculateHash | function calculateHash(file, fn) {
read(file, function(err, bin) {
if (err) return fn(err);
fn(null, hash('sha256').update(bin).digest('hex'));
});
} | javascript | function calculateHash(file, fn) {
read(file, function(err, bin) {
if (err) return fn(err);
fn(null, hash('sha256').update(bin).digest('hex'));
});
} | [
"function",
"calculateHash",
"(",
"file",
",",
"fn",
")",
"{",
"read",
"(",
"file",
",",
"function",
"(",
"err",
",",
"bin",
")",
"{",
"if",
"(",
"err",
")",
"return",
"fn",
"(",
"err",
")",
";",
"fn",
"(",
"null",
",",
"hash",
"(",
"'sha256'",
... | Calculate hash for a file
@param {String} file
@param {Function} fn | [
"Calculate",
"hash",
"for",
"a",
"file"
] | 5930e2165698c5577a0bcfa471dd521089acfb78 | https://github.com/camshaft/anvil-cli/blob/5930e2165698c5577a0bcfa471dd521089acfb78/lib/local.js#L201-L206 |
57,803 | camshaft/anvil-cli | lib/local.js | normalizeManifest | function normalizeManifest(manifest, fn) {
var obj = {};
manifest.forEach(function(file) {
if (!file) return;
obj[file.name] = {
mtime: file.mtime,
mode: file.mode,
size: file.size,
hash: file.hash,
link: file.link
};
});
fn(null, obj);
} | javascript | function normalizeManifest(manifest, fn) {
var obj = {};
manifest.forEach(function(file) {
if (!file) return;
obj[file.name] = {
mtime: file.mtime,
mode: file.mode,
size: file.size,
hash: file.hash,
link: file.link
};
});
fn(null, obj);
} | [
"function",
"normalizeManifest",
"(",
"manifest",
",",
"fn",
")",
"{",
"var",
"obj",
"=",
"{",
"}",
";",
"manifest",
".",
"forEach",
"(",
"function",
"(",
"file",
")",
"{",
"if",
"(",
"!",
"file",
")",
"return",
";",
"obj",
"[",
"file",
".",
"name"... | Normalize the manifest into the expected format
@param {Object} manifest
@param {Function} fn | [
"Normalize",
"the",
"manifest",
"into",
"the",
"expected",
"format"
] | 5930e2165698c5577a0bcfa471dd521089acfb78 | https://github.com/camshaft/anvil-cli/blob/5930e2165698c5577a0bcfa471dd521089acfb78/lib/local.js#L215-L228 |
57,804 | camshaft/anvil-cli | lib/local.js | findMissing | function findMissing(manifest, request, host, fn) {
request
.post(host + '/manifest/diff')
.send({manifest: JSON.stringify(manifest)})
.end(function(err, res) {
if (err) return fn(err);
if (res.error) return fn(res.error);
fn(null, res.body);
});
} | javascript | function findMissing(manifest, request, host, fn) {
request
.post(host + '/manifest/diff')
.send({manifest: JSON.stringify(manifest)})
.end(function(err, res) {
if (err) return fn(err);
if (res.error) return fn(res.error);
fn(null, res.body);
});
} | [
"function",
"findMissing",
"(",
"manifest",
",",
"request",
",",
"host",
",",
"fn",
")",
"{",
"request",
".",
"post",
"(",
"host",
"+",
"'/manifest/diff'",
")",
".",
"send",
"(",
"{",
"manifest",
":",
"JSON",
".",
"stringify",
"(",
"manifest",
")",
"}"... | Find the missing files in the manifest
@param {Object} manifest
@param {Request} request
@param {String} host
@param {Function} fn | [
"Find",
"the",
"missing",
"files",
"in",
"the",
"manifest"
] | 5930e2165698c5577a0bcfa471dd521089acfb78 | https://github.com/camshaft/anvil-cli/blob/5930e2165698c5577a0bcfa471dd521089acfb78/lib/local.js#L239-L248 |
57,805 | camshaft/anvil-cli | lib/local.js | selectMissing | function selectMissing(missing, manifest, fn) {
fn(null, manifest.filter(function(file) {
return file && ~missing.indexOf(file.hash);
}));
} | javascript | function selectMissing(missing, manifest, fn) {
fn(null, manifest.filter(function(file) {
return file && ~missing.indexOf(file.hash);
}));
} | [
"function",
"selectMissing",
"(",
"missing",
",",
"manifest",
",",
"fn",
")",
"{",
"fn",
"(",
"null",
",",
"manifest",
".",
"filter",
"(",
"function",
"(",
"file",
")",
"{",
"return",
"file",
"&&",
"~",
"missing",
".",
"indexOf",
"(",
"file",
".",
"h... | Find the missing files from the manifest
@param {Array} missing
@param {Array} manifest
@param {Function} fn | [
"Find",
"the",
"missing",
"files",
"from",
"the",
"manifest"
] | 5930e2165698c5577a0bcfa471dd521089acfb78 | https://github.com/camshaft/anvil-cli/blob/5930e2165698c5577a0bcfa471dd521089acfb78/lib/local.js#L258-L262 |
57,806 | camshaft/anvil-cli | lib/local.js | uploadMissing | function uploadMissing(missing, request, host, log, fn) {
var batch = new Batch();
missing.forEach(function(file) {
batch.push(uploadFile(file, request, host));
});
batch.on('progress', function() {
log('.');
});
batch.end(function(err, res) {
log(' done\n');
fn(err, res);
});
} | javascript | function uploadMissing(missing, request, host, log, fn) {
var batch = new Batch();
missing.forEach(function(file) {
batch.push(uploadFile(file, request, host));
});
batch.on('progress', function() {
log('.');
});
batch.end(function(err, res) {
log(' done\n');
fn(err, res);
});
} | [
"function",
"uploadMissing",
"(",
"missing",
",",
"request",
",",
"host",
",",
"log",
",",
"fn",
")",
"{",
"var",
"batch",
"=",
"new",
"Batch",
"(",
")",
";",
"missing",
".",
"forEach",
"(",
"function",
"(",
"file",
")",
"{",
"batch",
".",
"push",
... | Upload the missing files to the build server
@param {Array} missing
@param {Request} request
@param {String} host
@param {Function} fn | [
"Upload",
"the",
"missing",
"files",
"to",
"the",
"build",
"server"
] | 5930e2165698c5577a0bcfa471dd521089acfb78 | https://github.com/camshaft/anvil-cli/blob/5930e2165698c5577a0bcfa471dd521089acfb78/lib/local.js#L273-L288 |
57,807 | camshaft/anvil-cli | lib/local.js | uploadFile | function uploadFile(file, request, host) {
return function(cb) {
request
.post(host + '/file/' + file.hash)
.attach('data', file.abs)
.end(function(err, res) {
if (err) return cb(err);
if (res.error) return cb(res.error);
return cb();
});
};
} | javascript | function uploadFile(file, request, host) {
return function(cb) {
request
.post(host + '/file/' + file.hash)
.attach('data', file.abs)
.end(function(err, res) {
if (err) return cb(err);
if (res.error) return cb(res.error);
return cb();
});
};
} | [
"function",
"uploadFile",
"(",
"file",
",",
"request",
",",
"host",
")",
"{",
"return",
"function",
"(",
"cb",
")",
"{",
"request",
".",
"post",
"(",
"host",
"+",
"'/file/'",
"+",
"file",
".",
"hash",
")",
".",
"attach",
"(",
"'data'",
",",
"file",
... | Upload a single file to the build server
@param {String} file
@param {Request} request
@param {String} host
@return {Function} | [
"Upload",
"a",
"single",
"file",
"to",
"the",
"build",
"server"
] | 5930e2165698c5577a0bcfa471dd521089acfb78 | https://github.com/camshaft/anvil-cli/blob/5930e2165698c5577a0bcfa471dd521089acfb78/lib/local.js#L299-L310 |
57,808 | camshaft/anvil-cli | lib/local.js | saveManifest | function saveManifest(manifest, request, host, fn) {
request
.post(host + '/manifest')
.send({manifest: JSON.stringify(manifest)})
.end(function(err, res) {
if (err) return fn(err);
if (res.error) return fn(res.error);
fn(null, res.headers.location);
});
} | javascript | function saveManifest(manifest, request, host, fn) {
request
.post(host + '/manifest')
.send({manifest: JSON.stringify(manifest)})
.end(function(err, res) {
if (err) return fn(err);
if (res.error) return fn(res.error);
fn(null, res.headers.location);
});
} | [
"function",
"saveManifest",
"(",
"manifest",
",",
"request",
",",
"host",
",",
"fn",
")",
"{",
"request",
".",
"post",
"(",
"host",
"+",
"'/manifest'",
")",
".",
"send",
"(",
"{",
"manifest",
":",
"JSON",
".",
"stringify",
"(",
"manifest",
")",
"}",
... | Save the manifest file to the build server
@param {Object} manifest
@param {Request} request
@param {String} host
@param {Function} fn | [
"Save",
"the",
"manifest",
"file",
"to",
"the",
"build",
"server"
] | 5930e2165698c5577a0bcfa471dd521089acfb78 | https://github.com/camshaft/anvil-cli/blob/5930e2165698c5577a0bcfa471dd521089acfb78/lib/local.js#L321-L330 |
57,809 | yanhick/middlebot | lib/index.js | use | function use(type) {
// Convert args to array.
var args = Array.prototype.slice.call(arguments);
// Check if type not provided.
if ('string' !== typeof type && type instanceof Array === false) {
type = [];
} else {
if ('string' === typeof type) {
//wrap string in array to homoge... | javascript | function use(type) {
// Convert args to array.
var args = Array.prototype.slice.call(arguments);
// Check if type not provided.
if ('string' !== typeof type && type instanceof Array === false) {
type = [];
} else {
if ('string' === typeof type) {
//wrap string in array to homoge... | [
"function",
"use",
"(",
"type",
")",
"{",
"// Convert args to array.",
"var",
"args",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
")",
";",
"// Check if type not provided.",
"if",
"(",
"'string'",
"!==",
"typeof",
"type",
"&&",... | Add a middleware in the stack for the given
type.
@param {*} type the handler type where to use
the middleware. If not provided, middleware is always
used. Can be either a string or an array of string
@param {function} middlewares
@returns the middlebot instance | [
"Add",
"a",
"middleware",
"in",
"the",
"stack",
"for",
"the",
"given",
"type",
"."
] | 1920d56c0f4b162d892b8b7f70df575875bc943c | https://github.com/yanhick/middlebot/blob/1920d56c0f4b162d892b8b7f70df575875bc943c/lib/index.js#L29-L49 |
57,810 | yanhick/middlebot | lib/index.js | handle | function handle(type, req, res, out) {
var index = 0;
var ended = false;
// When called stop middlewares execution.
res.end = end;
// Handle next middleware in stack.
function next(err) {
var middleware = stack[index++];
// No more middlewares or early end.
if (!middleware |... | javascript | function handle(type, req, res, out) {
var index = 0;
var ended = false;
// When called stop middlewares execution.
res.end = end;
// Handle next middleware in stack.
function next(err) {
var middleware = stack[index++];
// No more middlewares or early end.
if (!middleware |... | [
"function",
"handle",
"(",
"type",
",",
"req",
",",
"res",
",",
"out",
")",
"{",
"var",
"index",
"=",
"0",
";",
"var",
"ended",
"=",
"false",
";",
"// When called stop middlewares execution.",
"res",
".",
"end",
"=",
"end",
";",
"// Handle next middleware in... | Handle all middlewares of the provided
type.
@param {string} type the middleware type to
handle
@param {Object} req request object
@param {Object} res response object
@param {function} out optional function to
be called once all middleware have been
handled
@returns the middlebot instance | [
"Handle",
"all",
"middlewares",
"of",
"the",
"provided",
"type",
"."
] | 1920d56c0f4b162d892b8b7f70df575875bc943c | https://github.com/yanhick/middlebot/blob/1920d56c0f4b162d892b8b7f70df575875bc943c/lib/index.js#L65-L115 |
57,811 | readwritetools/rwserve-plugin-sdk | dist/expect.function.js | writeToConsoleOrStderr | function writeToConsoleOrStderr(message) {
if (typeof console == 'object' && typeof console.warn == 'function')
console.warn(message);
else if (typeof process == 'object' && typeof process.stderr == 'object' && typeof process.stderr.write == 'function')
process.stderr.write(message);
else
throw new Error(messa... | javascript | function writeToConsoleOrStderr(message) {
if (typeof console == 'object' && typeof console.warn == 'function')
console.warn(message);
else if (typeof process == 'object' && typeof process.stderr == 'object' && typeof process.stderr.write == 'function')
process.stderr.write(message);
else
throw new Error(messa... | [
"function",
"writeToConsoleOrStderr",
"(",
"message",
")",
"{",
"if",
"(",
"typeof",
"console",
"==",
"'object'",
"&&",
"typeof",
"console",
".",
"warn",
"==",
"'function'",
")",
"console",
".",
"warn",
"(",
"message",
")",
";",
"else",
"if",
"(",
"typeof"... | ^ Send message to browser console or CLI stderr | [
"^",
"Send",
"message",
"to",
"browser",
"console",
"or",
"CLI",
"stderr"
] | 7f3b86b4d5279e26306225983c3d7f382f69dcce | https://github.com/readwritetools/rwserve-plugin-sdk/blob/7f3b86b4d5279e26306225983c3d7f382f69dcce/dist/expect.function.js#L90-L97 |
57,812 | frisb/fdboost | lib/enhance/encoding/typecodes.js | function(value) {
switch (typeof value) {
case 'undefined':
return this.undefined;
case 'string':
return this.string;
case 'number':
if (value % 1 === 0) {
return this.integer;
} else {
return this.double;
}
... | javascript | function(value) {
switch (typeof value) {
case 'undefined':
return this.undefined;
case 'string':
return this.string;
case 'number':
if (value % 1 === 0) {
return this.integer;
} else {
return this.double;
}
... | [
"function",
"(",
"value",
")",
"{",
"switch",
"(",
"typeof",
"value",
")",
"{",
"case",
"'undefined'",
":",
"return",
"this",
".",
"undefined",
";",
"case",
"'string'",
":",
"return",
"this",
".",
"string",
";",
"case",
"'number'",
":",
"if",
"(",
"val... | Gets type code value for name.
@method
@param {string} value Value to test type for.
@return {integer} Type code value | [
"Gets",
"type",
"code",
"value",
"for",
"name",
"."
] | 66cfb6552940aa92f35dbb1cf4d0695d842205c2 | https://github.com/frisb/fdboost/blob/66cfb6552940aa92f35dbb1cf4d0695d842205c2/lib/enhance/encoding/typecodes.js#L36-L68 | |
57,813 | tmpfs/manual | index.js | preamble | function preamble(opts) {
var str = '';
var index = opts.section || SECTION;
var date = opts.date || new Date().toISOString();
var version = opts.version || '1.0';
// section name
var sname = section(index);
var title = opts.title || opts.name;
if(!title) {
throw new TypeError('manual preamble requi... | javascript | function preamble(opts) {
var str = '';
var index = opts.section || SECTION;
var date = opts.date || new Date().toISOString();
var version = opts.version || '1.0';
// section name
var sname = section(index);
var title = opts.title || opts.name;
if(!title) {
throw new TypeError('manual preamble requi... | [
"function",
"preamble",
"(",
"opts",
")",
"{",
"var",
"str",
"=",
"''",
";",
"var",
"index",
"=",
"opts",
".",
"section",
"||",
"SECTION",
";",
"var",
"date",
"=",
"opts",
".",
"date",
"||",
"new",
"Date",
"(",
")",
".",
"toISOString",
"(",
")",
... | Gets the preamble for a man page.
@param options The preamble options.
@param options.title The document title.
@param options.version A version number.
@param options.date Document generation date.
@param options.section The man section number (1-8).
@param options.comment A comment string.
@param options.name A name... | [
"Gets",
"the",
"preamble",
"for",
"a",
"man",
"page",
"."
] | 5a869c4c49e18f7014969eec529ec9e9c9d7ba05 | https://github.com/tmpfs/manual/blob/5a869c4c49e18f7014969eec529ec9e9c9d7ba05/index.js#L111-L147 |
57,814 | CCISEL/connect-controller | lib/RouteInfo.js | splitActionName | function splitActionName(actionName) {
if(actionName.indexOf('_') > 0) return actionName.split('_')
else return actionName.split(/(?=[A-Z])/).map(p => p.toLowerCase())
} | javascript | function splitActionName(actionName) {
if(actionName.indexOf('_') > 0) return actionName.split('_')
else return actionName.split(/(?=[A-Z])/).map(p => p.toLowerCase())
} | [
"function",
"splitActionName",
"(",
"actionName",
")",
"{",
"if",
"(",
"actionName",
".",
"indexOf",
"(",
"'_'",
")",
">",
"0",
")",
"return",
"actionName",
".",
"split",
"(",
"'_'",
")",
"else",
"return",
"actionName",
".",
"split",
"(",
"/",
"(?=[A-Z])... | Returns an array with the action's name split by underscores
or lowerCamelCase. | [
"Returns",
"an",
"array",
"with",
"the",
"action",
"s",
"name",
"split",
"by",
"underscores",
"or",
"lowerCamelCase",
"."
] | c8e2587c5a31e3cb54e3668c4b98b7b7526d69b4 | https://github.com/CCISEL/connect-controller/blob/c8e2587c5a31e3cb54e3668c4b98b7b7526d69b4/lib/RouteInfo.js#L163-L166 |
57,815 | CCISEL/connect-controller | lib/RouteInfo.js | parseMethodName | function parseMethodName(parts, argsNames) {
/**
* argsName could be in different case from that
* of function's name.
*/
const argsNamesLower = argsNames.map(arg => arg.toLowerCase())
/**
* Suppresses HTTP method if exists
*/
if(keysMethods.indexOf(parts[0].toLowerCase... | javascript | function parseMethodName(parts, argsNames) {
/**
* argsName could be in different case from that
* of function's name.
*/
const argsNamesLower = argsNames.map(arg => arg.toLowerCase())
/**
* Suppresses HTTP method if exists
*/
if(keysMethods.indexOf(parts[0].toLowerCase... | [
"function",
"parseMethodName",
"(",
"parts",
",",
"argsNames",
")",
"{",
"/**\r\n * argsName could be in different case from that\r\n * of function's name.\r\n */",
"const",
"argsNamesLower",
"=",
"argsNames",
".",
"map",
"(",
"arg",
"=>",
"arg",
".",
"toLowerCase... | Returns the route path for the corresponding controller
method name. | [
"Returns",
"the",
"route",
"path",
"for",
"the",
"corresponding",
"controller",
"method",
"name",
"."
] | c8e2587c5a31e3cb54e3668c4b98b7b7526d69b4 | https://github.com/CCISEL/connect-controller/blob/c8e2587c5a31e3cb54e3668c4b98b7b7526d69b4/lib/RouteInfo.js#L172-L200 |
57,816 | CCISEL/connect-controller | lib/RouteInfo.js | parseHttpMethod | function parseHttpMethod(parts) {
const prefix = parts[0].toLowerCase()
if(keysMethods.indexOf(prefix) >= 0)
return prefix
else
return GET
} | javascript | function parseHttpMethod(parts) {
const prefix = parts[0].toLowerCase()
if(keysMethods.indexOf(prefix) >= 0)
return prefix
else
return GET
} | [
"function",
"parseHttpMethod",
"(",
"parts",
")",
"{",
"const",
"prefix",
"=",
"parts",
"[",
"0",
"]",
".",
"toLowerCase",
"(",
")",
"if",
"(",
"keysMethods",
".",
"indexOf",
"(",
"prefix",
")",
">=",
"0",
")",
"return",
"prefix",
"else",
"return",
"GE... | Gets the HTTP method from the Controller method name.
Otherwise returns 'get'. | [
"Gets",
"the",
"HTTP",
"method",
"from",
"the",
"Controller",
"method",
"name",
".",
"Otherwise",
"returns",
"get",
"."
] | c8e2587c5a31e3cb54e3668c4b98b7b7526d69b4 | https://github.com/CCISEL/connect-controller/blob/c8e2587c5a31e3cb54e3668c4b98b7b7526d69b4/lib/RouteInfo.js#L206-L212 |
57,817 | CCISEL/connect-controller | lib/RouteInfo.js | lookupParameterOnReq | function lookupParameterOnReq(name, index, length) {
return (req, res) => {
if(req[name]) return req[name]
if(req.query && req.query[name]) return req.query[name]
if(req.body && req.body[name]) return req.body[name]
if(res.locals && res.locals[name]) return res.locals[name]
... | javascript | function lookupParameterOnReq(name, index, length) {
return (req, res) => {
if(req[name]) return req[name]
if(req.query && req.query[name]) return req.query[name]
if(req.body && req.body[name]) return req.body[name]
if(res.locals && res.locals[name]) return res.locals[name]
... | [
"function",
"lookupParameterOnReq",
"(",
"name",
",",
"index",
",",
"length",
")",
"{",
"return",
"(",
"req",
",",
"res",
")",
"=>",
"{",
"if",
"(",
"req",
"[",
"name",
"]",
")",
"return",
"req",
"[",
"name",
"]",
"if",
"(",
"req",
".",
"query",
... | !!!!!DEPRECATED >= 2.0.1
Given the name of a parameter search for it in req, req.query,
req.body, res.locals, app.locals. | [
"!!!!!DEPRECATED",
">",
"=",
"2",
".",
"0",
".",
"1",
"Given",
"the",
"name",
"of",
"a",
"parameter",
"search",
"for",
"it",
"in",
"req",
"req",
".",
"query",
"req",
".",
"body",
"res",
".",
"locals",
"app",
".",
"locals",
"."
] | c8e2587c5a31e3cb54e3668c4b98b7b7526d69b4 | https://github.com/CCISEL/connect-controller/blob/c8e2587c5a31e3cb54e3668c4b98b7b7526d69b4/lib/RouteInfo.js#L245-L263 |
57,818 | assemble/assemble-loader | index.js | appLoader | function appLoader(app, config) {
app.define('load', load('view', config));
var fn = app.view;
app.define('view', function() {
var view = fn.apply(this, arguments);
utils.contents.sync(view);
return view;
});
} | javascript | function appLoader(app, config) {
app.define('load', load('view', config));
var fn = app.view;
app.define('view', function() {
var view = fn.apply(this, arguments);
utils.contents.sync(view);
return view;
});
} | [
"function",
"appLoader",
"(",
"app",
",",
"config",
")",
"{",
"app",
".",
"define",
"(",
"'load'",
",",
"load",
"(",
"'view'",
",",
"config",
")",
")",
";",
"var",
"fn",
"=",
"app",
".",
"view",
";",
"app",
".",
"define",
"(",
"'view'",
",",
"fun... | Adds a `.load` method to the "app" instance for loading views that
that don't belong to any particular collection. It just returns the
object of views instead of caching them.
```js
var loader = require('assemble-loader');
var assemble = require('assemble');
var app = assemble();
app.use(loader());
var views = app.lo... | [
"Adds",
"a",
".",
"load",
"method",
"to",
"the",
"app",
"instance",
"for",
"loading",
"views",
"that",
"that",
"don",
"t",
"belong",
"to",
"any",
"particular",
"collection",
".",
"It",
"just",
"returns",
"the",
"object",
"of",
"views",
"instead",
"of",
"... | 6d6b001cfa43c0628098f1e77c4d74292b3dbb0d | https://github.com/assemble/assemble-loader/blob/6d6b001cfa43c0628098f1e77c4d74292b3dbb0d/index.js#L59-L68 |
57,819 | assemble/assemble-loader | index.js | createLoader | function createLoader(options, fn) {
var loader = new utils.Loader(options);
return function() {
if (!this.isApp) loader.cache = this.views;
loader.options.loaderFn = fn.bind(this);
loader.load.apply(loader, arguments);
return loader.cache;
};
} | javascript | function createLoader(options, fn) {
var loader = new utils.Loader(options);
return function() {
if (!this.isApp) loader.cache = this.views;
loader.options.loaderFn = fn.bind(this);
loader.load.apply(loader, arguments);
return loader.cache;
};
} | [
"function",
"createLoader",
"(",
"options",
",",
"fn",
")",
"{",
"var",
"loader",
"=",
"new",
"utils",
".",
"Loader",
"(",
"options",
")",
";",
"return",
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"isApp",
")",
"loader",
".",
"cache",
... | Create a `Loader` instance with a `loaderfn` bound
to the app or collection instance. | [
"Create",
"a",
"Loader",
"instance",
"with",
"a",
"loaderfn",
"bound",
"to",
"the",
"app",
"or",
"collection",
"instance",
"."
] | 6d6b001cfa43c0628098f1e77c4d74292b3dbb0d | https://github.com/assemble/assemble-loader/blob/6d6b001cfa43c0628098f1e77c4d74292b3dbb0d/index.js#L143-L151 |
57,820 | assemble/assemble-loader | index.js | load | function load(method, config) {
return function(patterns, options) {
var opts = mergeOptions(this, config, options);
var loader = createLoader(opts, this[method]);
return loader.apply(this, arguments);
};
} | javascript | function load(method, config) {
return function(patterns, options) {
var opts = mergeOptions(this, config, options);
var loader = createLoader(opts, this[method]);
return loader.apply(this, arguments);
};
} | [
"function",
"load",
"(",
"method",
",",
"config",
")",
"{",
"return",
"function",
"(",
"patterns",
",",
"options",
")",
"{",
"var",
"opts",
"=",
"mergeOptions",
"(",
"this",
",",
"config",
",",
"options",
")",
";",
"var",
"loader",
"=",
"createLoader",
... | Create a function for loading views using the given
`method` on the collection or app. | [
"Create",
"a",
"function",
"for",
"loading",
"views",
"using",
"the",
"given",
"method",
"on",
"the",
"collection",
"or",
"app",
"."
] | 6d6b001cfa43c0628098f1e77c4d74292b3dbb0d | https://github.com/assemble/assemble-loader/blob/6d6b001cfa43c0628098f1e77c4d74292b3dbb0d/index.js#L158-L164 |
57,821 | Nichejs/Seminarjs | private/lib/core/start.js | function () {
waitForServers--;
if (waitForServers) return;
if (seminarjs.get('logger')) {
console.log(dashes + startupMessages.join('\n') + dashes);
}
events.onStart && events.onStart();
} | javascript | function () {
waitForServers--;
if (waitForServers) return;
if (seminarjs.get('logger')) {
console.log(dashes + startupMessages.join('\n') + dashes);
}
events.onStart && events.onStart();
} | [
"function",
"(",
")",
"{",
"waitForServers",
"--",
";",
"if",
"(",
"waitForServers",
")",
"return",
";",
"if",
"(",
"seminarjs",
".",
"get",
"(",
"'logger'",
")",
")",
"{",
"console",
".",
"log",
"(",
"dashes",
"+",
"startupMessages",
".",
"join",
"(",... | Log the startup messages and calls the onStart method | [
"Log",
"the",
"startup",
"messages",
"and",
"calls",
"the",
"onStart",
"method"
] | 53c4c1d5c33ffbf6320b10f25679bf181cbf853e | https://github.com/Nichejs/Seminarjs/blob/53c4c1d5c33ffbf6320b10f25679bf181cbf853e/private/lib/core/start.js#L89-L96 | |
57,822 | thiagodp/better-randstr | index.js | randstr | function randstr(options) {
var opt = _validateOptions(options);
var from, to;
if (Array.isArray(opt.length)) {
_a = opt.length, from = _a[0], to = _a[1];
}
else {
from = to = opt.length;
}
var str = '';
if (0 === to) {
return str;
}
var charsIsString = 's... | javascript | function randstr(options) {
var opt = _validateOptions(options);
var from, to;
if (Array.isArray(opt.length)) {
_a = opt.length, from = _a[0], to = _a[1];
}
else {
from = to = opt.length;
}
var str = '';
if (0 === to) {
return str;
}
var charsIsString = 's... | [
"function",
"randstr",
"(",
"options",
")",
"{",
"var",
"opt",
"=",
"_validateOptions",
"(",
"options",
")",
";",
"var",
"from",
",",
"to",
";",
"if",
"(",
"Array",
".",
"isArray",
"(",
"opt",
".",
"length",
")",
")",
"{",
"_a",
"=",
"opt",
".",
... | Generates a random string according to the given options.
@param options Options
@returns a string | [
"Generates",
"a",
"random",
"string",
"according",
"to",
"the",
"given",
"options",
"."
] | e63bc3085ad87e6f5ed1c59e5710e599127c3dce | https://github.com/thiagodp/better-randstr/blob/e63bc3085ad87e6f5ed1c59e5710e599127c3dce/index.js#L132-L187 |
57,823 | niallo/deadlift | lib/deploy.js | updateStatus | function updateStatus(evType, opts) {
var t2 = new Date()
var elapsed = (t2.getTime() - t1.getTime()) / 1000
var msg = {
timeElapsed:elapsed,
stdout: opts.stdout || "",
stderr: opts.stderr || "",
stdmerged: opts.stdmerged || "",
info: opts.info,
step: opts.step,
dep... | javascript | function updateStatus(evType, opts) {
var t2 = new Date()
var elapsed = (t2.getTime() - t1.getTime()) / 1000
var msg = {
timeElapsed:elapsed,
stdout: opts.stdout || "",
stderr: opts.stderr || "",
stdmerged: opts.stdmerged || "",
info: opts.info,
step: opts.step,
dep... | [
"function",
"updateStatus",
"(",
"evType",
",",
"opts",
")",
"{",
"var",
"t2",
"=",
"new",
"Date",
"(",
")",
"var",
"elapsed",
"=",
"(",
"t2",
".",
"getTime",
"(",
")",
"-",
"t1",
".",
"getTime",
"(",
")",
")",
"/",
"1000",
"var",
"msg",
"=",
"... | Emit a status update event. This can result in data being sent to the user's browser in realtime via socket.io. | [
"Emit",
"a",
"status",
"update",
"event",
".",
"This",
"can",
"result",
"in",
"data",
"being",
"sent",
"to",
"the",
"user",
"s",
"browser",
"in",
"realtime",
"via",
"socket",
".",
"io",
"."
] | ff37d4eeccc326ec5e1390394585f6ac10bcc703 | https://github.com/niallo/deadlift/blob/ff37d4eeccc326ec5e1390394585f6ac10bcc703/lib/deploy.js#L24-L42 |
57,824 | blake-regalia/spaz.js | lib/main/js_sparql.js | function(s_thing) {
if(H_SPARQL_CHARS[s_thing[0]]) return s_thing;
else if(s_thing.indexOf(':') != -1) return s_thing;
else if(s_thing == 'a') return s_thing;
else return ':'+s_thing;
} | javascript | function(s_thing) {
if(H_SPARQL_CHARS[s_thing[0]]) return s_thing;
else if(s_thing.indexOf(':') != -1) return s_thing;
else if(s_thing == 'a') return s_thing;
else return ':'+s_thing;
} | [
"function",
"(",
"s_thing",
")",
"{",
"if",
"(",
"H_SPARQL_CHARS",
"[",
"s_thing",
"[",
"0",
"]",
"]",
")",
"return",
"s_thing",
";",
"else",
"if",
"(",
"s_thing",
".",
"indexOf",
"(",
"':'",
")",
"!=",
"-",
"1",
")",
"return",
"s_thing",
";",
"els... | converts thing alias to proper identifier if not already specified | [
"converts",
"thing",
"alias",
"to",
"proper",
"identifier",
"if",
"not",
"already",
"specified"
] | e0a04ab4783a0e386e245a3551e1a41bd746da35 | https://github.com/blake-regalia/spaz.js/blob/e0a04ab4783a0e386e245a3551e1a41bd746da35/lib/main/js_sparql.js#L75-L80 | |
57,825 | blake-regalia/spaz.js | lib/main/js_sparql.js | function(s_str) {
if(H_SPARQL_CHARS[s_str[0]]) return s_str;
else if(s_str.indexOf(':') != -1) return s_str;
else if(/^(?:[0-9]|(?:\-|\.|\-\.)[0-9])/.test(s_str)) return s_str;
else return JSON.stringify(s_str);
} | javascript | function(s_str) {
if(H_SPARQL_CHARS[s_str[0]]) return s_str;
else if(s_str.indexOf(':') != -1) return s_str;
else if(/^(?:[0-9]|(?:\-|\.|\-\.)[0-9])/.test(s_str)) return s_str;
else return JSON.stringify(s_str);
} | [
"function",
"(",
"s_str",
")",
"{",
"if",
"(",
"H_SPARQL_CHARS",
"[",
"s_str",
"[",
"0",
"]",
"]",
")",
"return",
"s_str",
";",
"else",
"if",
"(",
"s_str",
".",
"indexOf",
"(",
"':'",
")",
"!=",
"-",
"1",
")",
"return",
"s_str",
";",
"else",
"if"... | converts string to proper identifier if not already specified | [
"converts",
"string",
"to",
"proper",
"identifier",
"if",
"not",
"already",
"specified"
] | e0a04ab4783a0e386e245a3551e1a41bd746da35 | https://github.com/blake-regalia/spaz.js/blob/e0a04ab4783a0e386e245a3551e1a41bd746da35/lib/main/js_sparql.js#L90-L95 | |
57,826 | blake-regalia/spaz.js | lib/main/js_sparql.js | function(sq_prefixes) {
var s_select = this.select || '*';
var sq_select = 'SELECT '+s_select+' WHERE {';
var sq_where = this.where;
var sq_tail = this.tail;
var sq_group = this.group? ' GROUP BY '+this.group: '';
var sq_order = this.order? ' ORDER BY '+this.order: '';
var sq_limit_offset = this.limit;
... | javascript | function(sq_prefixes) {
var s_select = this.select || '*';
var sq_select = 'SELECT '+s_select+' WHERE {';
var sq_where = this.where;
var sq_tail = this.tail;
var sq_group = this.group? ' GROUP BY '+this.group: '';
var sq_order = this.order? ' ORDER BY '+this.order: '';
var sq_limit_offset = this.limit;
... | [
"function",
"(",
"sq_prefixes",
")",
"{",
"var",
"s_select",
"=",
"this",
".",
"select",
"||",
"'*'",
";",
"var",
"sq_select",
"=",
"'SELECT '",
"+",
"s_select",
"+",
"' WHERE {'",
";",
"var",
"sq_where",
"=",
"this",
".",
"where",
";",
"var",
"sq_tail",... | converts query hash to sparql string | [
"converts",
"query",
"hash",
"to",
"sparql",
"string"
] | e0a04ab4783a0e386e245a3551e1a41bd746da35 | https://github.com/blake-regalia/spaz.js/blob/e0a04ab4783a0e386e245a3551e1a41bd746da35/lib/main/js_sparql.js#L98-L116 | |
57,827 | blake-regalia/spaz.js | lib/main/js_sparql.js | function(s_query, f_okay) {
$.ajax({
url: s_endpoint_url+'query',
method: 'GET',
data: {
query: s_query,
},
dataType: 'json',
success: function(h_res) {
f_okay && f_okay(h_res);
},
});
} | javascript | function(s_query, f_okay) {
$.ajax({
url: s_endpoint_url+'query',
method: 'GET',
data: {
query: s_query,
},
dataType: 'json',
success: function(h_res) {
f_okay && f_okay(h_res);
},
});
} | [
"function",
"(",
"s_query",
",",
"f_okay",
")",
"{",
"$",
".",
"ajax",
"(",
"{",
"url",
":",
"s_endpoint_url",
"+",
"'query'",
",",
"method",
":",
"'GET'",
",",
"data",
":",
"{",
"query",
":",
"s_query",
",",
"}",
",",
"dataType",
":",
"'json'",
",... | submits a query | [
"submits",
"a",
"query"
] | e0a04ab4783a0e386e245a3551e1a41bd746da35 | https://github.com/blake-regalia/spaz.js/blob/e0a04ab4783a0e386e245a3551e1a41bd746da35/lib/main/js_sparql.js#L131-L143 | |
57,828 | blake-regalia/spaz.js | lib/main/js_sparql.js | function(h_subjects, b_raw) {
// initiliaze output
var s_out = '';
// add slot for tail
var s_tail = '';
// newline + indent
var _ = '\n\t'+(b_raw? '\t':'');
// root nodes must be subjects
for(var s_rs in h_subjects) {
//
var z_predicates = h_subjects[s_rs];
// declaring option... | javascript | function(h_subjects, b_raw) {
// initiliaze output
var s_out = '';
// add slot for tail
var s_tail = '';
// newline + indent
var _ = '\n\t'+(b_raw? '\t':'');
// root nodes must be subjects
for(var s_rs in h_subjects) {
//
var z_predicates = h_subjects[s_rs];
// declaring option... | [
"function",
"(",
"h_subjects",
",",
"b_raw",
")",
"{",
"// initiliaze output",
"var",
"s_out",
"=",
"''",
";",
"// add slot for tail",
"var",
"s_tail",
"=",
"''",
";",
"// newline + indent",
"var",
"_",
"=",
"'\\n\\t'",
"+",
"(",
"b_raw",
"?",
"'\\t'",
":",
... | constructs sparql query string from hash | [
"constructs",
"sparql",
"query",
"string",
"from",
"hash"
] | e0a04ab4783a0e386e245a3551e1a41bd746da35 | https://github.com/blake-regalia/spaz.js/blob/e0a04ab4783a0e386e245a3551e1a41bd746da35/lib/main/js_sparql.js#L415-L471 | |
57,829 | blake-regalia/spaz.js | lib/main/js_sparql.js | function(s_query) {
// execute function
var f_exec = function(f_okay) {
submit_query(s_query, f_okay);
};
var d_self = {
exec: f_exec,
results: function(f_okay) {
f_exec(function(h_res) {
f_okay && f_okay(h_res.results.bindings);
});
},
each: function(f_each, f_okay) {
... | javascript | function(s_query) {
// execute function
var f_exec = function(f_okay) {
submit_query(s_query, f_okay);
};
var d_self = {
exec: f_exec,
results: function(f_okay) {
f_exec(function(h_res) {
f_okay && f_okay(h_res.results.bindings);
});
},
each: function(f_each, f_okay) {
... | [
"function",
"(",
"s_query",
")",
"{",
"// execute function",
"var",
"f_exec",
"=",
"function",
"(",
"f_okay",
")",
"{",
"submit_query",
"(",
"s_query",
",",
"f_okay",
")",
";",
"}",
";",
"var",
"d_self",
"=",
"{",
"exec",
":",
"f_exec",
",",
"results",
... | executes raw sparql query from string | [
"executes",
"raw",
"sparql",
"query",
"from",
"string"
] | e0a04ab4783a0e386e245a3551e1a41bd746da35 | https://github.com/blake-regalia/spaz.js/blob/e0a04ab4783a0e386e245a3551e1a41bd746da35/lib/main/js_sparql.js#L475-L505 | |
57,830 | blake-regalia/spaz.js | lib/main/js_sparql.js | function(channel) {
return function() {
var args = Array.prototype.slice.call(arguments);
args.unshift(__class+':');
console[channel].apply(console, args);
};
} | javascript | function(channel) {
return function() {
var args = Array.prototype.slice.call(arguments);
args.unshift(__class+':');
console[channel].apply(console, args);
};
} | [
"function",
"(",
"channel",
")",
"{",
"return",
"function",
"(",
")",
"{",
"var",
"args",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
")",
";",
"args",
".",
"unshift",
"(",
"__class",
"+",
"':'",
")",
";",
"console",
... | output a message to the console prefixed with this class's tag | [
"output",
"a",
"message",
"to",
"the",
"console",
"prefixed",
"with",
"this",
"class",
"s",
"tag"
] | e0a04ab4783a0e386e245a3551e1a41bd746da35 | https://github.com/blake-regalia/spaz.js/blob/e0a04ab4783a0e386e245a3551e1a41bd746da35/lib/main/js_sparql.js#L599-L605 | |
57,831 | richRemer/twixt-select | select.js | into | function into(impl) {
/**
* @param {string} selector
* @param {Document|Element} [context]
*/
return function(selector, context) {
var callContext = this,
extra;
if (typeof selector === "string") {
if (context && context.querySelector) {
ex... | javascript | function into(impl) {
/**
* @param {string} selector
* @param {Document|Element} [context]
*/
return function(selector, context) {
var callContext = this,
extra;
if (typeof selector === "string") {
if (context && context.querySelector) {
ex... | [
"function",
"into",
"(",
"impl",
")",
"{",
"/**\n * @param {string} selector\n * @param {Document|Element} [context]\n */",
"return",
"function",
"(",
"selector",
",",
"context",
")",
"{",
"var",
"callContext",
"=",
"this",
",",
"extra",
";",
"if",
"(",
"t... | Create function composition which passes each selected element to a base
function.
@param {function} impl
@returns {function} | [
"Create",
"function",
"composition",
"which",
"passes",
"each",
"selected",
"element",
"to",
"a",
"base",
"function",
"."
] | 8f4cb70623f578d197a23a49e6dcd42a2bb772be | https://github.com/richRemer/twixt-select/blob/8f4cb70623f578d197a23a49e6dcd42a2bb772be/select.js#L7-L31 |
57,832 | richRemer/twixt-select | select.js | select | function select(selector, context, fn) {
var nodes;
if (arguments.length === 2 && typeof context === "function") {
fn = context;
context = undefined;
}
nodes = (context || document).querySelectorAll(selector);
nodes = Array.prototype.slice.call(nodes);
if (fn) node... | javascript | function select(selector, context, fn) {
var nodes;
if (arguments.length === 2 && typeof context === "function") {
fn = context;
context = undefined;
}
nodes = (context || document).querySelectorAll(selector);
nodes = Array.prototype.slice.call(nodes);
if (fn) node... | [
"function",
"select",
"(",
"selector",
",",
"context",
",",
"fn",
")",
"{",
"var",
"nodes",
";",
"if",
"(",
"arguments",
".",
"length",
"===",
"2",
"&&",
"typeof",
"context",
"===",
"\"function\"",
")",
"{",
"fn",
"=",
"context",
";",
"context",
"=",
... | Return selected elements or iterate and apply a function.
@param {string} selector
@param {Document|Element} [context]
@param {function} [fn]
@returns {Node[]} | [
"Return",
"selected",
"elements",
"or",
"iterate",
"and",
"apply",
"a",
"function",
"."
] | 8f4cb70623f578d197a23a49e6dcd42a2bb772be | https://github.com/richRemer/twixt-select/blob/8f4cb70623f578d197a23a49e6dcd42a2bb772be/select.js#L40-L53 |
57,833 | brycebaril/node-loose-interval | index.js | LooseInterval | function LooseInterval(fn, interval, callback) {
if (!(this instanceof LooseInterval)) return new LooseInterval(fn, interval, callback)
if (typeof fn != "function") throw new Error("LooseInterval requires a function")
if (typeof interval == "function") {
callback = interval
interval = null
}
this.fn ... | javascript | function LooseInterval(fn, interval, callback) {
if (!(this instanceof LooseInterval)) return new LooseInterval(fn, interval, callback)
if (typeof fn != "function") throw new Error("LooseInterval requires a function")
if (typeof interval == "function") {
callback = interval
interval = null
}
this.fn ... | [
"function",
"LooseInterval",
"(",
"fn",
",",
"interval",
",",
"callback",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"LooseInterval",
")",
")",
"return",
"new",
"LooseInterval",
"(",
"fn",
",",
"interval",
",",
"callback",
")",
"if",
"(",
"type... | Create a loose-interval repeated task. Like setInterval but will reschedule when the task
finishes to avoid overlapping tasks. Your function must provide a callback to alert its
completion.
@param {Function} fn The function to repeatedly call. Must provide a callback. fn(cb)
@param {Number} interval Millisecond... | [
"Create",
"a",
"loose",
"-",
"interval",
"repeated",
"task",
".",
"Like",
"setInterval",
"but",
"will",
"reschedule",
"when",
"the",
"task",
"finishes",
"to",
"avoid",
"overlapping",
"tasks",
".",
"Your",
"function",
"must",
"provide",
"a",
"callback",
"to",
... | 68d2880e2ab9b4978c488a3d55be491e0409ebd3 | https://github.com/brycebaril/node-loose-interval/blob/68d2880e2ab9b4978c488a3d55be491e0409ebd3/index.js#L14-L30 |
57,834 | Techniv/node-cmd-conf | libs/cmd-conf.js | process | function process(){
if (!conf.configured) that.configure();
var args = command.args.slice(0);
for(var i in args){
var arg = args[i];
if(conf.regexp.test(arg)){
var catchWord = RegExp.$2;
switch(RegExp.$1){
case '-':
processShortKey(catchWord, i, args);
break;
case '--':
... | javascript | function process(){
if (!conf.configured) that.configure();
var args = command.args.slice(0);
for(var i in args){
var arg = args[i];
if(conf.regexp.test(arg)){
var catchWord = RegExp.$2;
switch(RegExp.$1){
case '-':
processShortKey(catchWord, i, args);
break;
case '--':
... | [
"function",
"process",
"(",
")",
"{",
"if",
"(",
"!",
"conf",
".",
"configured",
")",
"that",
".",
"configure",
"(",
")",
";",
"var",
"args",
"=",
"command",
".",
"args",
".",
"slice",
"(",
"0",
")",
";",
"for",
"(",
"var",
"i",
"in",
"args",
"... | Fire the command line analyse | [
"Fire",
"the",
"command",
"line",
"analyse"
] | ecefaf9c1eb3a68a7ab4e5b9a0b71329a7d52646 | https://github.com/Techniv/node-cmd-conf/blob/ecefaf9c1eb3a68a7ab4e5b9a0b71329a7d52646/libs/cmd-conf.js#L145-L165 |
57,835 | ForbesLindesay-Unmaintained/sauce-test | lib/get-sauce-platforms.js | getPlatforms | function getPlatforms(options) {
return request('GET', 'https://saucelabs.com/rest/v1/info/platforms/webdriver')
.getBody('utf8').then(JSON.parse).then(function (platforms) {
var obj = {};
platforms.map(function (platform) {
return {
browserName: platform.api_name,
version: platform.sh... | javascript | function getPlatforms(options) {
return request('GET', 'https://saucelabs.com/rest/v1/info/platforms/webdriver')
.getBody('utf8').then(JSON.parse).then(function (platforms) {
var obj = {};
platforms.map(function (platform) {
return {
browserName: platform.api_name,
version: platform.sh... | [
"function",
"getPlatforms",
"(",
"options",
")",
"{",
"return",
"request",
"(",
"'GET'",
",",
"'https://saucelabs.com/rest/v1/info/platforms/webdriver'",
")",
".",
"getBody",
"(",
"'utf8'",
")",
".",
"then",
"(",
"JSON",
".",
"parse",
")",
".",
"then",
"(",
"f... | Get an object containing the platforms supported by sauce labs
Platforms:
```js
{
"chrome": [{"browserName": "chrome", "version": "34", platform:" Mac 10.9"}, ...]
...
}
```
@option {Function.<Platform,Boolean>} filterPlatforms
Return `true` to include the platform in the resulting set.
@option {Fun... | [
"Get",
"an",
"object",
"containing",
"the",
"platforms",
"supported",
"by",
"sauce",
"labs"
] | 7c671b3321dc63aefc00c1c8d49e943ead2e7f5e | https://github.com/ForbesLindesay-Unmaintained/sauce-test/blob/7c671b3321dc63aefc00c1c8d49e943ead2e7f5e/lib/get-sauce-platforms.js#L29-L61 |
57,836 | rhyolight/github-data | lib/blob.js | Blob | function Blob(source, parent, githubClient) {
this.gh = githubClient;
this.parent = parent;
this.sha = source.sha;
this.rawContent = source.content;
this.size = source.size;
this.contents = new Buffer(this.rawContent, 'base64').toString('utf-8');
} | javascript | function Blob(source, parent, githubClient) {
this.gh = githubClient;
this.parent = parent;
this.sha = source.sha;
this.rawContent = source.content;
this.size = source.size;
this.contents = new Buffer(this.rawContent, 'base64').toString('utf-8');
} | [
"function",
"Blob",
"(",
"source",
",",
"parent",
",",
"githubClient",
")",
"{",
"this",
".",
"gh",
"=",
"githubClient",
";",
"this",
".",
"parent",
"=",
"parent",
";",
"this",
".",
"sha",
"=",
"source",
".",
"sha",
";",
"this",
".",
"rawContent",
"=... | A git blob object.
@class Blob
@param source {Object} JSON response from API, used to build.
@param parent {Object} Expected to be {{#crossLink "Tree"}}{{/crossLink}}.
@param githubClient {Object} GitHub API Client object.
@constructor | [
"A",
"git",
"blob",
"object",
"."
] | 5d6a3fc0e7ecfeaec03e4815b0940c2d9ce07d64 | https://github.com/rhyolight/github-data/blob/5d6a3fc0e7ecfeaec03e4815b0940c2d9ce07d64/lib/blob.js#L9-L16 |
57,837 | frankc60/jpretty | src/jPretty.js | pJson | function pJson(events, top = '') {
Object.keys(events).forEach((i) => {
if (typeof events[i] === 'object' && events[i] != null) {
let rtn;
if (Object.prototype.toString.call(events) === '[object Array]') {
rtn = (`${top}[${i}]`);
} else { rtn = (`${top}.${i}`); }
pJ... | javascript | function pJson(events, top = '') {
Object.keys(events).forEach((i) => {
if (typeof events[i] === 'object' && events[i] != null) {
let rtn;
if (Object.prototype.toString.call(events) === '[object Array]') {
rtn = (`${top}[${i}]`);
} else { rtn = (`${top}.${i}`); }
pJ... | [
"function",
"pJson",
"(",
"events",
",",
"top",
"=",
"''",
")",
"{",
"Object",
".",
"keys",
"(",
"events",
")",
".",
"forEach",
"(",
"(",
"i",
")",
"=>",
"{",
"if",
"(",
"typeof",
"events",
"[",
"i",
"]",
"===",
"'object'",
"&&",
"events",
"[",
... | json needs to arrive stringified | [
"json",
"needs",
"to",
"arrive",
"stringified"
] | 15c26bff27542c83ce28376b7065e09d2daa935a | https://github.com/frankc60/jpretty/blob/15c26bff27542c83ce28376b7065e09d2daa935a/src/jPretty.js#L11-L25 |
57,838 | frankc60/jpretty | src/jPretty.js | jPretty | function jPretty(obj) {
// make sure data is a json obj
if(typeof obj === "string") {
obj = obj.replace(/\s/g,"");
obj = obj.replace(/'/g,'"');
}
let gl;
try {
const p = JSON.parse(obj);
gl = obj; // already stringified
} catch (e) { // not stringified
if(typeof obj === "string")... | javascript | function jPretty(obj) {
// make sure data is a json obj
if(typeof obj === "string") {
obj = obj.replace(/\s/g,"");
obj = obj.replace(/'/g,'"');
}
let gl;
try {
const p = JSON.parse(obj);
gl = obj; // already stringified
} catch (e) { // not stringified
if(typeof obj === "string")... | [
"function",
"jPretty",
"(",
"obj",
")",
"{",
"// make sure data is a json obj",
"if",
"(",
"typeof",
"obj",
"===",
"\"string\"",
")",
"{",
"obj",
"=",
"obj",
".",
"replace",
"(",
"/",
"\\s",
"/",
"g",
",",
"\"\"",
")",
";",
"obj",
"=",
"obj",
".",
"r... | Tidies up the json into a correct javascript object notation.
@param {object} obj text or object.
calls the main prettyJson module passing the json obj as argument. | [
"Tidies",
"up",
"the",
"json",
"into",
"a",
"correct",
"javascript",
"object",
"notation",
"."
] | 15c26bff27542c83ce28376b7065e09d2daa935a | https://github.com/frankc60/jpretty/blob/15c26bff27542c83ce28376b7065e09d2daa935a/src/jPretty.js#L36-L77 |
57,839 | Ma3Route/node-sdk | lib/client.js | Client | function Client(options) {
options = options || { };
this._key = options.key || null;
this._secret = options.secret || null;
this._proxy = options.proxy || null;
return this;
} | javascript | function Client(options) {
options = options || { };
this._key = options.key || null;
this._secret = options.secret || null;
this._proxy = options.proxy || null;
return this;
} | [
"function",
"Client",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"this",
".",
"_key",
"=",
"options",
".",
"key",
"||",
"null",
";",
"this",
".",
"_secret",
"=",
"options",
".",
"secret",
"||",
"null",
";",
"this",
".... | An API client.
All the module functions can be accessed using a client
@example
// create a new client
var client = new sdk.Client({ key: "SoM3C0mP1exKey", secret: "pSu3d0rAnD0mS3CrEt" });
// retrieive a single traffic update
client.trafficUpdates.getOne(1, function(err, items) {
console.log(err, items);
});
@constr... | [
"An",
"API",
"client",
".",
"All",
"the",
"module",
"functions",
"can",
"be",
"accessed",
"using",
"a",
"client"
] | a2769d97d77d6f762d23e743bf4c749e2bad0d8a | https://github.com/Ma3Route/node-sdk/blob/a2769d97d77d6f762d23e743bf4c749e2bad0d8a/lib/client.js#L56-L62 |
57,840 | AndiDittrich/Node.async-magic | lib/parallel.js | parallel | async function parallel(resolvers, limit=-1){
// set default limit
if (limit < 1){
limit = 1000;
}
// buffer
const results = [];
// calculate chunk size
// limit step size to input array size
const chunkSize = Math.min(limit, resolvers.length);
// process resolvers in chun... | javascript | async function parallel(resolvers, limit=-1){
// set default limit
if (limit < 1){
limit = 1000;
}
// buffer
const results = [];
// calculate chunk size
// limit step size to input array size
const chunkSize = Math.min(limit, resolvers.length);
// process resolvers in chun... | [
"async",
"function",
"parallel",
"(",
"resolvers",
",",
"limit",
"=",
"-",
"1",
")",
"{",
"// set default limit",
"if",
"(",
"limit",
"<",
"1",
")",
"{",
"limit",
"=",
"1000",
";",
"}",
"// buffer",
"const",
"results",
"=",
"[",
"]",
";",
"// calculate... | resolves multiple promises in parallel | [
"resolves",
"multiple",
"promises",
"in",
"parallel"
] | 0c41dd27d8f7539bb24034bc23ce870f5f8a10b3 | https://github.com/AndiDittrich/Node.async-magic/blob/0c41dd27d8f7539bb24034bc23ce870f5f8a10b3/lib/parallel.js#L2-L30 |
57,841 | eklem/search-index-indexer | index.js | function(error, newIndex) {
if (error) {
console.log('Data error for ' + dataurl + '\n' + error)
}
if (!error) {
index = newIndex
var timeStart = Date.now()
request(dataurl)
.pipe(JSONStream.parse())
.pipe(index.defaultPipeline())
.pipe(index.add())
.on('data', function(dat... | javascript | function(error, newIndex) {
if (error) {
console.log('Data error for ' + dataurl + '\n' + error)
}
if (!error) {
index = newIndex
var timeStart = Date.now()
request(dataurl)
.pipe(JSONStream.parse())
.pipe(index.defaultPipeline())
.pipe(index.add())
.on('data', function(dat... | [
"function",
"(",
"error",
",",
"newIndex",
")",
"{",
"if",
"(",
"error",
")",
"{",
"console",
".",
"log",
"(",
"'Data error for '",
"+",
"dataurl",
"+",
"'\\n'",
"+",
"error",
")",
"}",
"if",
"(",
"!",
"error",
")",
"{",
"index",
"=",
"newIndex",
"... | indexData const with pipeline pipeline | [
"indexData",
"const",
"with",
"pipeline",
"pipeline"
] | 8be0dffad9f2babc486ad9f9de9918c4e976dcfa | https://github.com/eklem/search-index-indexer/blob/8be0dffad9f2babc486ad9f9de9918c4e976dcfa/index.js#L28-L48 | |
57,842 | greggman/hft-sample-ui | src/hft/scripts/misc/strings.js | function(str, len, padChar) {
str = stringIt(str);
if (str.length >= len) {
return str;
}
var padStr = getPadding(padChar, len);
return str + padStr.substr(str.length - len);
} | javascript | function(str, len, padChar) {
str = stringIt(str);
if (str.length >= len) {
return str;
}
var padStr = getPadding(padChar, len);
return str + padStr.substr(str.length - len);
} | [
"function",
"(",
"str",
",",
"len",
",",
"padChar",
")",
"{",
"str",
"=",
"stringIt",
"(",
"str",
")",
";",
"if",
"(",
"str",
".",
"length",
">=",
"len",
")",
"{",
"return",
"str",
";",
"}",
"var",
"padStr",
"=",
"getPadding",
"(",
"padChar",
","... | Pad string on right
@param {string} str string to pad
@param {number} len number of characters to pad to
@param {string} padChar character to pad with
@returns {string} padded string.
@memberOf module:Strings | [
"Pad",
"string",
"on",
"right"
] | b9e20afd5183db73522bcfae48225c87e01f68c0 | https://github.com/greggman/hft-sample-ui/blob/b9e20afd5183db73522bcfae48225c87e01f68c0/src/hft/scripts/misc/strings.js#L75-L82 | |
57,843 | greggman/hft-sample-ui | src/hft/scripts/misc/strings.js | function(str, start) {
return (str.length >= start.length &&
str.substr(0, start.length) === start);
} | javascript | function(str, start) {
return (str.length >= start.length &&
str.substr(0, start.length) === start);
} | [
"function",
"(",
"str",
",",
"start",
")",
"{",
"return",
"(",
"str",
".",
"length",
">=",
"start",
".",
"length",
"&&",
"str",
".",
"substr",
"(",
"0",
",",
"start",
".",
"length",
")",
"===",
"start",
")",
";",
"}"
] | True if string starts with prefix
@static
@param {String} str string to check for start
@param {String} prefix start value
@returns {Boolean} true if str starts with prefix
@memberOf module:Strings | [
"True",
"if",
"string",
"starts",
"with",
"prefix"
] | b9e20afd5183db73522bcfae48225c87e01f68c0 | https://github.com/greggman/hft-sample-ui/blob/b9e20afd5183db73522bcfae48225c87e01f68c0/src/hft/scripts/misc/strings.js#L151-L154 | |
57,844 | greggman/hft-sample-ui | src/hft/scripts/misc/strings.js | function(str, end) {
return (str.length >= end.length &&
str.substring(str.length - end.length) === end);
} | javascript | function(str, end) {
return (str.length >= end.length &&
str.substring(str.length - end.length) === end);
} | [
"function",
"(",
"str",
",",
"end",
")",
"{",
"return",
"(",
"str",
".",
"length",
">=",
"end",
".",
"length",
"&&",
"str",
".",
"substring",
"(",
"str",
".",
"length",
"-",
"end",
".",
"length",
")",
"===",
"end",
")",
";",
"}"
] | True if string ends with suffix
@param {String} str string to check for start
@param {String} suffix start value
@returns {Boolean} true if str starts with suffix
@memberOf module:Strings | [
"True",
"if",
"string",
"ends",
"with",
"suffix"
] | b9e20afd5183db73522bcfae48225c87e01f68c0 | https://github.com/greggman/hft-sample-ui/blob/b9e20afd5183db73522bcfae48225c87e01f68c0/src/hft/scripts/misc/strings.js#L163-L166 | |
57,845 | vonWolfehaus/gulp-sort-amd | shim/define.js | set | function set(key, module, global) {
var m = null;
var isGlobal = global && typeof global !== 'undefined';
// check to make sure the module has been assigned only once
if (isGlobal) {
if (global.hasOwnProperty(key)) {
throw '[define-shim] Module ' + key + ' already exists';
}
}
else if (_map.hasOw... | javascript | function set(key, module, global) {
var m = null;
var isGlobal = global && typeof global !== 'undefined';
// check to make sure the module has been assigned only once
if (isGlobal) {
if (global.hasOwnProperty(key)) {
throw '[define-shim] Module ' + key + ' already exists';
}
}
else if (_map.hasOw... | [
"function",
"set",
"(",
"key",
",",
"module",
",",
"global",
")",
"{",
"var",
"m",
"=",
"null",
";",
"var",
"isGlobal",
"=",
"global",
"&&",
"typeof",
"global",
"!==",
"'undefined'",
";",
"// check to make sure the module has been assigned only once",
"if",
"(",... | global is an optional object and will attach the constructed module to it if present | [
"global",
"is",
"an",
"optional",
"object",
"and",
"will",
"attach",
"the",
"constructed",
"module",
"to",
"it",
"if",
"present"
] | d778710d95e0d82de68bd767f063b7430815c330 | https://github.com/vonWolfehaus/gulp-sort-amd/blob/d778710d95e0d82de68bd767f063b7430815c330/shim/define.js#L11-L33 |
57,846 | queckezz/list | lib/insert.js | insert | function insert (i, val, array) {
array = copy(array)
array.splice(i, 0, val)
return array
} | javascript | function insert (i, val, array) {
array = copy(array)
array.splice(i, 0, val)
return array
} | [
"function",
"insert",
"(",
"i",
",",
"val",
",",
"array",
")",
"{",
"array",
"=",
"copy",
"(",
"array",
")",
"array",
".",
"splice",
"(",
"i",
",",
"0",
",",
"val",
")",
"return",
"array",
"}"
] | Returns a new array with the supplied element inserted
at index `i`.
@param {Int} i
@param {Any} val
@param {Array} array
@return {Array} | [
"Returns",
"a",
"new",
"array",
"with",
"the",
"supplied",
"element",
"inserted",
"at",
"index",
"i",
"."
] | a26130020b447a1aa136f0fed3283821490f7da4 | https://github.com/queckezz/list/blob/a26130020b447a1aa136f0fed3283821490f7da4/lib/insert.js#L14-L18 |
57,847 | AmrEldib/agol-data-faker | index.js | generateFakeDataForSchema | function generateFakeDataForSchema(schemaName) {
return new RSVP.Promise(function (resolve, reject) {
agolSchemas.getSchema(schemaName).then(function (schema) {
// Generate fake data
var fakeData = jsf(schema);
// return fake data
resolve(fakeData);
});
});
} | javascript | function generateFakeDataForSchema(schemaName) {
return new RSVP.Promise(function (resolve, reject) {
agolSchemas.getSchema(schemaName).then(function (schema) {
// Generate fake data
var fakeData = jsf(schema);
// return fake data
resolve(fakeData);
});
});
} | [
"function",
"generateFakeDataForSchema",
"(",
"schemaName",
")",
"{",
"return",
"new",
"RSVP",
".",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"agolSchemas",
".",
"getSchema",
"(",
"schemaName",
")",
".",
"then",
"(",
"function",
"(... | Generate fake data for a certain schema
@param {string} schemaName Name of the schema to be generated.
@returns {object} Promise. The resolve function has one parameter representing the generated fake data. | [
"Generate",
"fake",
"data",
"for",
"a",
"certain",
"schema"
] | 9bb7e29698a34effd98afe135d053256050a072e | https://github.com/AmrEldib/agol-data-faker/blob/9bb7e29698a34effd98afe135d053256050a072e/index.js#L16-L25 |
57,848 | byu-oit/fully-typed | bin/fully-typed.js | FullyTyped | function FullyTyped (configuration) {
if (arguments.length === 0 || configuration === null) configuration = {};
// validate input parameter
if (!util.isPlainObject(configuration)) {
throw Error('If provided, the schema configuration must be a plain object. Received: ' + configuration);
}
/... | javascript | function FullyTyped (configuration) {
if (arguments.length === 0 || configuration === null) configuration = {};
// validate input parameter
if (!util.isPlainObject(configuration)) {
throw Error('If provided, the schema configuration must be a plain object. Received: ' + configuration);
}
/... | [
"function",
"FullyTyped",
"(",
"configuration",
")",
"{",
"if",
"(",
"arguments",
".",
"length",
"===",
"0",
"||",
"configuration",
"===",
"null",
")",
"configuration",
"=",
"{",
"}",
";",
"// validate input parameter",
"if",
"(",
"!",
"util",
".",
"isPlainO... | Validate a value against the schema and throw an error if encountered.
@function
@name FullyTyped#validate
@param {*} value
@param {string} [prefix='']
@throws {Error}
Get a typed schema.
@constructor
@param {object, object[]} [configuration={}]
@returns {FullyTyped} | [
"Validate",
"a",
"value",
"against",
"the",
"schema",
"and",
"throw",
"an",
"error",
"if",
"encountered",
"."
] | ed6b3ed88ffc72990acffb765232eaaee261afef | https://github.com/byu-oit/fully-typed/blob/ed6b3ed88ffc72990acffb765232eaaee261afef/bin/fully-typed.js#L71-L93 |
57,849 | justinhelmer/vinyl-tasks | lib/hooks.js | validate | function validate(task, options) {
if (!task) {
if (options.verbose) {
console.log(' -', chalk.bold.yellow('[WARNING]:'), 'Task does not exist');
}
return Promise.resolve(false);
}
return new Promise(function(resolve, reject) {
var hooks = task.hooks(options) || {};
... | javascript | function validate(task, options) {
if (!task) {
if (options.verbose) {
console.log(' -', chalk.bold.yellow('[WARNING]:'), 'Task does not exist');
}
return Promise.resolve(false);
}
return new Promise(function(resolve, reject) {
var hooks = task.hooks(options) || {};
... | [
"function",
"validate",
"(",
"task",
",",
"options",
")",
"{",
"if",
"(",
"!",
"task",
")",
"{",
"if",
"(",
"options",
".",
"verbose",
")",
"{",
"console",
".",
"log",
"(",
"' -'",
",",
"chalk",
".",
"bold",
".",
"yellow",
"(",
"'[WARNING]:'",
")"... | Hook executed before task is run.
Validate whether or not the task should be run. Should return `true` or `false` to indicate whether or not to run the task.
Can also return a bluebird promise that resolves with the value of `true` or `false`.
@name validate
@param {object} task - The task object.
@param {object} [op... | [
"Hook",
"executed",
"before",
"task",
"is",
"run",
"."
] | eca1f79065a3653023896c4f546dc44dbac81e62 | https://github.com/justinhelmer/vinyl-tasks/blob/eca1f79065a3653023896c4f546dc44dbac81e62/lib/hooks.js#L66-L92 |
57,850 | leomp12/console-files | index.js | log | function log (out, desc) {
logger.log(header())
if (desc) {
logger.log(desc)
}
logger.log(out)
logger.log()
} | javascript | function log (out, desc) {
logger.log(header())
if (desc) {
logger.log(desc)
}
logger.log(out)
logger.log()
} | [
"function",
"log",
"(",
"out",
",",
"desc",
")",
"{",
"logger",
".",
"log",
"(",
"header",
"(",
")",
")",
"if",
"(",
"desc",
")",
"{",
"logger",
".",
"log",
"(",
"desc",
")",
"}",
"logger",
".",
"log",
"(",
"out",
")",
"logger",
".",
"log",
"... | function to substitute console.log | [
"function",
"to",
"substitute",
"console",
".",
"log"
] | 07b12b6adee0db8f1bc819f500a3be667838de74 | https://github.com/leomp12/console-files/blob/07b12b6adee0db8f1bc819f500a3be667838de74/index.js#L33-L40 |
57,851 | leomp12/console-files | index.js | error | function error (out, desc) {
logger.error(header())
if (desc) {
logger.error(desc)
}
logger.error(out)
logger.error()
} | javascript | function error (out, desc) {
logger.error(header())
if (desc) {
logger.error(desc)
}
logger.error(out)
logger.error()
} | [
"function",
"error",
"(",
"out",
",",
"desc",
")",
"{",
"logger",
".",
"error",
"(",
"header",
"(",
")",
")",
"if",
"(",
"desc",
")",
"{",
"logger",
".",
"error",
"(",
"desc",
")",
"}",
"logger",
".",
"error",
"(",
"out",
")",
"logger",
".",
"e... | function to substitute console.error | [
"function",
"to",
"substitute",
"console",
".",
"error"
] | 07b12b6adee0db8f1bc819f500a3be667838de74 | https://github.com/leomp12/console-files/blob/07b12b6adee0db8f1bc819f500a3be667838de74/index.js#L43-L50 |
57,852 | robertblackwell/yake | src/yake.js | watch | function watch(glob, taskName)
{
var watcher = chokidar.watch(glob, {persistent: true,});
watcher.on('ready', ()=>
{
watcher.on('all', (event, path)=>
{
invokeTask(taskName);
});
});
} | javascript | function watch(glob, taskName)
{
var watcher = chokidar.watch(glob, {persistent: true,});
watcher.on('ready', ()=>
{
watcher.on('all', (event, path)=>
{
invokeTask(taskName);
});
});
} | [
"function",
"watch",
"(",
"glob",
",",
"taskName",
")",
"{",
"var",
"watcher",
"=",
"chokidar",
".",
"watch",
"(",
"glob",
",",
"{",
"persistent",
":",
"true",
",",
"}",
")",
";",
"watcher",
".",
"on",
"(",
"'ready'",
",",
"(",
")",
"=>",
"{",
"w... | Watch files and then invoke a task | [
"Watch",
"files",
"and",
"then",
"invoke",
"a",
"task"
] | 172b02e29303fb718bac88bbda9b85749c57169c | https://github.com/robertblackwell/yake/blob/172b02e29303fb718bac88bbda9b85749c57169c/src/yake.js#L52-L62 |
57,853 | robertblackwell/yake | src/yake.js | invokeTask | function invokeTask(taskName)
{
const tc = TASKS.globals.globalTaskCollection;
const t = tc.getByName(taskName);
if (t === undefined)
{
YERROR.raiseError(`task ${taskName} not found`);
}
TASKS.invokeTask(tc, t);
} | javascript | function invokeTask(taskName)
{
const tc = TASKS.globals.globalTaskCollection;
const t = tc.getByName(taskName);
if (t === undefined)
{
YERROR.raiseError(`task ${taskName} not found`);
}
TASKS.invokeTask(tc, t);
} | [
"function",
"invokeTask",
"(",
"taskName",
")",
"{",
"const",
"tc",
"=",
"TASKS",
".",
"globals",
".",
"globalTaskCollection",
";",
"const",
"t",
"=",
"tc",
".",
"getByName",
"(",
"taskName",
")",
";",
"if",
"(",
"t",
"===",
"undefined",
")",
"{",
"YER... | Invoke a task by name | [
"Invoke",
"a",
"task",
"by",
"name"
] | 172b02e29303fb718bac88bbda9b85749c57169c | https://github.com/robertblackwell/yake/blob/172b02e29303fb718bac88bbda9b85749c57169c/src/yake.js#L67-L77 |
57,854 | creationix/git-node-platform | sha1.js | create | function create() {
var sha1sum = crypto.createHash('sha1');
return { update: update, digest: digest };
function update(data) {
sha1sum.update(data);
}
function digest() {
return sha1sum.digest('hex');
}
} | javascript | function create() {
var sha1sum = crypto.createHash('sha1');
return { update: update, digest: digest };
function update(data) {
sha1sum.update(data);
}
function digest() {
return sha1sum.digest('hex');
}
} | [
"function",
"create",
"(",
")",
"{",
"var",
"sha1sum",
"=",
"crypto",
".",
"createHash",
"(",
"'sha1'",
")",
";",
"return",
"{",
"update",
":",
"update",
",",
"digest",
":",
"digest",
"}",
";",
"function",
"update",
"(",
"data",
")",
"{",
"sha1sum",
... | A streaming interface for when nothing is passed in. | [
"A",
"streaming",
"interface",
"for",
"when",
"nothing",
"is",
"passed",
"in",
"."
] | fa9b0367e3b92b6f4f50d93b0d2d7ba93cb27fb9 | https://github.com/creationix/git-node-platform/blob/fa9b0367e3b92b6f4f50d93b0d2d7ba93cb27fb9/sha1.js#L11-L22 |
57,855 | georgenorman/tessel-kit | lib/general-utils.js | function(obj, maxNumProperties) {
var result = "";
maxNumProperties = maxNumProperties === undefined ? Number.MAX_VALUE : maxNumProperties;
if (obj !== undefined && obj !== null) {
var separator = "";
var propCount = 0;
for (var propertyName in obj) {
var objValue;... | javascript | function(obj, maxNumProperties) {
var result = "";
maxNumProperties = maxNumProperties === undefined ? Number.MAX_VALUE : maxNumProperties;
if (obj !== undefined && obj !== null) {
var separator = "";
var propCount = 0;
for (var propertyName in obj) {
var objValue;... | [
"function",
"(",
"obj",
",",
"maxNumProperties",
")",
"{",
"var",
"result",
"=",
"\"\"",
";",
"maxNumProperties",
"=",
"maxNumProperties",
"===",
"undefined",
"?",
"Number",
".",
"MAX_VALUE",
":",
"maxNumProperties",
";",
"if",
"(",
"obj",
"!==",
"undefined",
... | Return a String, of the form "propertyName = propertyValue\n", for every property of the given obj, or until
maxNumProperties has been reached.
@param obj object to retrieve the properties from.
@param maxNumProperties optional limiter for the number of properties to retrieve.
@returns {string} new-line separated set ... | [
"Return",
"a",
"String",
"of",
"the",
"form",
"propertyName",
"=",
"propertyValue",
"\\",
"n",
"for",
"every",
"property",
"of",
"the",
"given",
"obj",
"or",
"until",
"maxNumProperties",
"has",
"been",
"reached",
"."
] | 487e91360f0ecf8500d24297228842e2c01ac762 | https://github.com/georgenorman/tessel-kit/blob/487e91360f0ecf8500d24297228842e2c01ac762/lib/general-utils.js#L86-L115 | |
57,856 | georgenorman/tessel-kit | lib/general-utils.js | function(argumentName, defaultValue) {
var result = argMap[argumentName];
if (this.isEmpty(result) && this.isNotEmpty(defaultValue)) {
if (typeof defaultValue === 'object') {
result = defaultValue[argumentName];
} else {
result = defaultValue;
}
}
re... | javascript | function(argumentName, defaultValue) {
var result = argMap[argumentName];
if (this.isEmpty(result) && this.isNotEmpty(defaultValue)) {
if (typeof defaultValue === 'object') {
result = defaultValue[argumentName];
} else {
result = defaultValue;
}
}
re... | [
"function",
"(",
"argumentName",
",",
"defaultValue",
")",
"{",
"var",
"result",
"=",
"argMap",
"[",
"argumentName",
"]",
";",
"if",
"(",
"this",
".",
"isEmpty",
"(",
"result",
")",
"&&",
"this",
".",
"isNotEmpty",
"(",
"defaultValue",
")",
")",
"{",
"... | Return the commandline argument specified by argumentName. If not found, then return the specified defaultValue.
Example commandline:
"tessel run app/app.js climatePort=A foo=1.23 bar=4.56"
Example Usages (for the commandline shown above):
// returns "1.23"
tesselKit.tesselUtils.getArgumentValue("foo", "asdfgh");
//... | [
"Return",
"the",
"commandline",
"argument",
"specified",
"by",
"argumentName",
".",
"If",
"not",
"found",
"then",
"return",
"the",
"specified",
"defaultValue",
"."
] | 487e91360f0ecf8500d24297228842e2c01ac762 | https://github.com/georgenorman/tessel-kit/blob/487e91360f0ecf8500d24297228842e2c01ac762/lib/general-utils.js#L155-L167 | |
57,857 | nutella-framework/nutella_lib.js | gulpfile.js | bundle | function bundle() {
return bundler.bundle()
// log errors if they happen
.on('error', gutil.log.bind(gutil, 'Browserify Error'))
.pipe(source('nutella_lib.js'))
.pipe(gulp.dest('./dist'));
} | javascript | function bundle() {
return bundler.bundle()
// log errors if they happen
.on('error', gutil.log.bind(gutil, 'Browserify Error'))
.pipe(source('nutella_lib.js'))
.pipe(gulp.dest('./dist'));
} | [
"function",
"bundle",
"(",
")",
"{",
"return",
"bundler",
".",
"bundle",
"(",
")",
"// log errors if they happen",
".",
"on",
"(",
"'error'",
",",
"gutil",
".",
"log",
".",
"bind",
"(",
"gutil",
",",
"'Browserify Error'",
")",
")",
".",
"pipe",
"(",
"sou... | output build logs to terminal | [
"output",
"build",
"logs",
"to",
"terminal"
] | b3a3406a407e2a1ada6edcc503b70991f9cb249b | https://github.com/nutella-framework/nutella_lib.js/blob/b3a3406a407e2a1ada6edcc503b70991f9cb249b/gulpfile.js#L17-L23 |
57,858 | TheRoSS/jsfilter | lib/error.js | JFP_Error | function JFP_Error(message) {
Error.call(this, message);
Object.defineProperty(this, "name", {
value: this.constructor.name
});
Object.defineProperty(this, "message", {
value: message
});
if (Error.captureStackTrace) {
Error.captureStackTrace(this, this.constructor);
... | javascript | function JFP_Error(message) {
Error.call(this, message);
Object.defineProperty(this, "name", {
value: this.constructor.name
});
Object.defineProperty(this, "message", {
value: message
});
if (Error.captureStackTrace) {
Error.captureStackTrace(this, this.constructor);
... | [
"function",
"JFP_Error",
"(",
"message",
")",
"{",
"Error",
".",
"call",
"(",
"this",
",",
"message",
")",
";",
"Object",
".",
"defineProperty",
"(",
"this",
",",
"\"name\"",
",",
"{",
"value",
":",
"this",
".",
"constructor",
".",
"name",
"}",
")",
... | JFP_Error - base error class
@param {string} message
@constructor | [
"JFP_Error",
"-",
"base",
"error",
"class"
] | e06e689e7ad175eb1479645c9b4e38fadc385cf5 | https://github.com/TheRoSS/jsfilter/blob/e06e689e7ad175eb1479645c9b4e38fadc385cf5/lib/error.js#L17-L35 |
57,859 | AndreasMadsen/piccolo | lib/modules/util.js | type | function type(input) {
//If the input value is null, undefined or NaN the toStringTypes object shouldn't be used
if (input === null || input === undefined || (input !== input && String(input) === "NaN")) {
return String(input);
}
// use the typeMap to detect the type and fallback to object if the type was... | javascript | function type(input) {
//If the input value is null, undefined or NaN the toStringTypes object shouldn't be used
if (input === null || input === undefined || (input !== input && String(input) === "NaN")) {
return String(input);
}
// use the typeMap to detect the type and fallback to object if the type was... | [
"function",
"type",
"(",
"input",
")",
"{",
"//If the input value is null, undefined or NaN the toStringTypes object shouldn't be used",
"if",
"(",
"input",
"===",
"null",
"||",
"input",
"===",
"undefined",
"||",
"(",
"input",
"!==",
"input",
"&&",
"String",
"(",
"inp... | detect type using typeMap | [
"detect",
"type",
"using",
"typeMap"
] | ef43f5634c564eef0d21a4a6aa103b2f1e3baa3d | https://github.com/AndreasMadsen/piccolo/blob/ef43f5634c564eef0d21a4a6aa103b2f1e3baa3d/lib/modules/util.js#L14-L23 |
57,860 | AndreasMadsen/piccolo | lib/modules/util.js | inherits | function inherits(constructor, superConstructor) {
constructor.super_ = superConstructor;
constructor.prototype = Object.create(superConstructor.prototype, {
'constructor': {
'value': constructor,
'enumerable': false,
'writable': true,
'configurable': true
}
});
} | javascript | function inherits(constructor, superConstructor) {
constructor.super_ = superConstructor;
constructor.prototype = Object.create(superConstructor.prototype, {
'constructor': {
'value': constructor,
'enumerable': false,
'writable': true,
'configurable': true
}
});
} | [
"function",
"inherits",
"(",
"constructor",
",",
"superConstructor",
")",
"{",
"constructor",
".",
"super_",
"=",
"superConstructor",
";",
"constructor",
".",
"prototype",
"=",
"Object",
".",
"create",
"(",
"superConstructor",
".",
"prototype",
",",
"{",
"'const... | Inherit the prototype methods from one constructor into another | [
"Inherit",
"the",
"prototype",
"methods",
"from",
"one",
"constructor",
"into",
"another"
] | ef43f5634c564eef0d21a4a6aa103b2f1e3baa3d | https://github.com/AndreasMadsen/piccolo/blob/ef43f5634c564eef0d21a4a6aa103b2f1e3baa3d/lib/modules/util.js#L37-L47 |
57,861 | enten/confectioner | lib/confectioner.js | Confectioner | function Confectioner() {
if (!(this instanceof Confectioner)) {
var instance = Object.create(clazz);
Confectioner.apply(instance, arguments);
return instance;
}
this.keys = [];
this.addKey.apply(this, Array.prototype.slice.call(arguments));
} | javascript | function Confectioner() {
if (!(this instanceof Confectioner)) {
var instance = Object.create(clazz);
Confectioner.apply(instance, arguments);
return instance;
}
this.keys = [];
this.addKey.apply(this, Array.prototype.slice.call(arguments));
} | [
"function",
"Confectioner",
"(",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Confectioner",
")",
")",
"{",
"var",
"instance",
"=",
"Object",
".",
"create",
"(",
"clazz",
")",
";",
"Confectioner",
".",
"apply",
"(",
"instance",
",",
"arguments",... | Initialize a new `Confectioner`.
@public
@class
@constructor Confectioner
@param {Mixed} ...
@example var config = Confectioner();
@example var config = Confectioner('env', 'NODE_ENV', 'development');
@example var config = Confectioner({
host: { envName: 'MY_HOST', defValue: 'localhost' },
port: { envName: 'MY_PORT',... | [
"Initialize",
"a",
"new",
"Confectioner",
"."
] | 4f735e8ee1e36ebe250a2a866b07e10820207346 | https://github.com/enten/confectioner/blob/4f735e8ee1e36ebe250a2a866b07e10820207346/lib/confectioner.js#L193-L203 |
57,862 | fardog/node-random-lib | index.js | floatFromBuffer | function floatFromBuffer (buf) {
if (buf.length < FLOAT_ENTROPY_BYTES) {
throw new Error(
'buffer must contain at least ' + FLOAT_ENTROPY_BYTES + ' bytes of entropy'
)
}
var position = 0
// http://stackoverflow.com/questions/15753019/floating-point-number-from-crypto-randombytes-in-javascript
r... | javascript | function floatFromBuffer (buf) {
if (buf.length < FLOAT_ENTROPY_BYTES) {
throw new Error(
'buffer must contain at least ' + FLOAT_ENTROPY_BYTES + ' bytes of entropy'
)
}
var position = 0
// http://stackoverflow.com/questions/15753019/floating-point-number-from-crypto-randombytes-in-javascript
r... | [
"function",
"floatFromBuffer",
"(",
"buf",
")",
"{",
"if",
"(",
"buf",
".",
"length",
"<",
"FLOAT_ENTROPY_BYTES",
")",
"{",
"throw",
"new",
"Error",
"(",
"'buffer must contain at least '",
"+",
"FLOAT_ENTROPY_BYTES",
"+",
"' bytes of entropy'",
")",
"}",
"var",
... | Given a buffer containing bytes of entropy, generate a double-precision
64-bit float.
@param {Buffer} buf a buffer of bytes
@returns {Number} a float | [
"Given",
"a",
"buffer",
"containing",
"bytes",
"of",
"entropy",
"generate",
"a",
"double",
"-",
"precision",
"64",
"-",
"bit",
"float",
"."
] | 1dc05c8ada71049cbd2382239c1c6c6042bf3d97 | https://github.com/fardog/node-random-lib/blob/1dc05c8ada71049cbd2382239c1c6c6042bf3d97/index.js#L142-L159 |
57,863 | fardog/node-random-lib | index.js | applyNSync | function applyNSync () {
var args = Array.prototype.slice.call(arguments)
var fn = args.shift()
var num = args.shift()
var arr = []
for (var i = 0; i < num; ++i) {
arr.push(fn.apply(null, args))
}
return arr
} | javascript | function applyNSync () {
var args = Array.prototype.slice.call(arguments)
var fn = args.shift()
var num = args.shift()
var arr = []
for (var i = 0; i < num; ++i) {
arr.push(fn.apply(null, args))
}
return arr
} | [
"function",
"applyNSync",
"(",
")",
"{",
"var",
"args",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
")",
"var",
"fn",
"=",
"args",
".",
"shift",
"(",
")",
"var",
"num",
"=",
"args",
".",
"shift",
"(",
")",
"var",
... | Apply a function a number of times, returning an array of the results.
@param {Function} fn the function to call on each
@param {Number} num the size of the array to generate
@param {*} args... a list of args to pass to the function fn
@returns {Array} the filled array | [
"Apply",
"a",
"function",
"a",
"number",
"of",
"times",
"returning",
"an",
"array",
"of",
"the",
"results",
"."
] | 1dc05c8ada71049cbd2382239c1c6c6042bf3d97 | https://github.com/fardog/node-random-lib/blob/1dc05c8ada71049cbd2382239c1c6c6042bf3d97/index.js#L169-L181 |
57,864 | fardog/node-random-lib | index.js | applyN | function applyN (fn, opts, ready) {
var num = opts.num || 0
var unique = opts.unique
var arr = []
fn(opts, onValue)
function onValue (err, value) {
if (err) {
return ready(err)
}
if (!unique || arr.indexOf(value) === -1) {
arr.push(value)
}
if (arr.length >= num) {
r... | javascript | function applyN (fn, opts, ready) {
var num = opts.num || 0
var unique = opts.unique
var arr = []
fn(opts, onValue)
function onValue (err, value) {
if (err) {
return ready(err)
}
if (!unique || arr.indexOf(value) === -1) {
arr.push(value)
}
if (arr.length >= num) {
r... | [
"function",
"applyN",
"(",
"fn",
",",
"opts",
",",
"ready",
")",
"{",
"var",
"num",
"=",
"opts",
".",
"num",
"||",
"0",
"var",
"unique",
"=",
"opts",
".",
"unique",
"var",
"arr",
"=",
"[",
"]",
"fn",
"(",
"opts",
",",
"onValue",
")",
"function",
... | Creates an array of items, whose contents are the result of calling
asynchronous function fn once for each item in the array. The function is
called in series, until the array is filled.
@param {Function} fn the function to be called with ({Objct} opts, ready)
where `ready` must be called with (err, value)
@param {Obj... | [
"Creates",
"an",
"array",
"of",
"items",
"whose",
"contents",
"are",
"the",
"result",
"of",
"calling",
"asynchronous",
"function",
"fn",
"once",
"for",
"each",
"item",
"in",
"the",
"array",
".",
"The",
"function",
"is",
"called",
"in",
"series",
"until",
"... | 1dc05c8ada71049cbd2382239c1c6c6042bf3d97 | https://github.com/fardog/node-random-lib/blob/1dc05c8ada71049cbd2382239c1c6c6042bf3d97/index.js#L193-L218 |
57,865 | Zenedith/npm-my-restify-api | lib/plugin/cors.js | restifyCORSSimple | function restifyCORSSimple(req, res, next) {
var origin;
if (!(origin = matchOrigin(req, origins))) {
next();
return;
}
function corsOnHeader() {
origin = req.headers.origin;
if (opts.credentials) {
res.setHeader(AC_ALLOW_CREDS, 'true');
}
res.setHeader(AC_... | javascript | function restifyCORSSimple(req, res, next) {
var origin;
if (!(origin = matchOrigin(req, origins))) {
next();
return;
}
function corsOnHeader() {
origin = req.headers.origin;
if (opts.credentials) {
res.setHeader(AC_ALLOW_CREDS, 'true');
}
res.setHeader(AC_... | [
"function",
"restifyCORSSimple",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"origin",
";",
"if",
"(",
"!",
"(",
"origin",
"=",
"matchOrigin",
"(",
"req",
",",
"origins",
")",
")",
")",
"{",
"next",
"(",
")",
";",
"return",
";",
"}",
"f... | Handler for simple requests | [
"Handler",
"for",
"simple",
"requests"
] | 946e40ede37124f6f4acaea19d73ab3c9d5074d9 | https://github.com/Zenedith/npm-my-restify-api/blob/946e40ede37124f6f4acaea19d73ab3c9d5074d9/lib/plugin/cors.js#L82-L105 |
57,866 | Itee/i-return | builds/i-return.js | processErrorAndData | function processErrorAndData (error, data) {
if (_cb.beforeReturnErrorAndData) { _cb.beforeReturnErrorAndData(error, data); }
if (_cb.returnErrorAndData) { _cb.returnErrorAndData(error, data, response); }
if (_cb.afterReturnErrorAndData) { _cb.afterReturnErrorAndData(error, data); }
} | javascript | function processErrorAndData (error, data) {
if (_cb.beforeReturnErrorAndData) { _cb.beforeReturnErrorAndData(error, data); }
if (_cb.returnErrorAndData) { _cb.returnErrorAndData(error, data, response); }
if (_cb.afterReturnErrorAndData) { _cb.afterReturnErrorAndData(error, data); }
} | [
"function",
"processErrorAndData",
"(",
"error",
",",
"data",
")",
"{",
"if",
"(",
"_cb",
".",
"beforeReturnErrorAndData",
")",
"{",
"_cb",
".",
"beforeReturnErrorAndData",
"(",
"error",
",",
"data",
")",
";",
"}",
"if",
"(",
"_cb",
".",
"returnErrorAndData"... | Call provided callback for error and data case.
@param error - The database receive error
@param data - The database retrieved data | [
"Call",
"provided",
"callback",
"for",
"error",
"and",
"data",
"case",
"."
] | 895953cb344e0929883863808429a3b8fa61d678 | https://github.com/Itee/i-return/blob/895953cb344e0929883863808429a3b8fa61d678/builds/i-return.js#L314-L318 |
57,867 | Itee/i-return | builds/i-return.js | processError | function processError (error) {
if (_cb.beforeReturnError) { _cb.beforeReturnError(error); }
if (_cb.returnError) { _cb.returnError(error, response); }
if (_cb.afterReturnError) { _cb.afterReturnError(error); }
} | javascript | function processError (error) {
if (_cb.beforeReturnError) { _cb.beforeReturnError(error); }
if (_cb.returnError) { _cb.returnError(error, response); }
if (_cb.afterReturnError) { _cb.afterReturnError(error); }
} | [
"function",
"processError",
"(",
"error",
")",
"{",
"if",
"(",
"_cb",
".",
"beforeReturnError",
")",
"{",
"_cb",
".",
"beforeReturnError",
"(",
"error",
")",
";",
"}",
"if",
"(",
"_cb",
".",
"returnError",
")",
"{",
"_cb",
".",
"returnError",
"(",
"err... | Call provided callback for error case.
@param error - The database receive error | [
"Call",
"provided",
"callback",
"for",
"error",
"case",
"."
] | 895953cb344e0929883863808429a3b8fa61d678 | https://github.com/Itee/i-return/blob/895953cb344e0929883863808429a3b8fa61d678/builds/i-return.js#L325-L329 |
57,868 | Itee/i-return | builds/i-return.js | processData | function processData (data) {
if (_cb.beforeReturnData) { _cb.beforeReturnData(data); }
if (_cb.returnData) { _cb.returnData(data, response); }
if (_cb.afterReturnData) { _cb.afterReturnData(data); }
} | javascript | function processData (data) {
if (_cb.beforeReturnData) { _cb.beforeReturnData(data); }
if (_cb.returnData) { _cb.returnData(data, response); }
if (_cb.afterReturnData) { _cb.afterReturnData(data); }
} | [
"function",
"processData",
"(",
"data",
")",
"{",
"if",
"(",
"_cb",
".",
"beforeReturnData",
")",
"{",
"_cb",
".",
"beforeReturnData",
"(",
"data",
")",
";",
"}",
"if",
"(",
"_cb",
".",
"returnData",
")",
"{",
"_cb",
".",
"returnData",
"(",
"data",
"... | Call provided callback for data case.
@param data - The database retrieved data | [
"Call",
"provided",
"callback",
"for",
"data",
"case",
"."
] | 895953cb344e0929883863808429a3b8fa61d678 | https://github.com/Itee/i-return/blob/895953cb344e0929883863808429a3b8fa61d678/builds/i-return.js#L336-L340 |
57,869 | Itee/i-return | builds/i-return.js | processNotFound | function processNotFound () {
if (_cb.beforeReturnNotFound) { _cb.beforeReturnNotFound(); }
if (_cb.returnNotFound) { _cb.returnNotFound(response); }
if (_cb.afterReturnNotFound) { _cb.afterReturnNotFound(); }
} | javascript | function processNotFound () {
if (_cb.beforeReturnNotFound) { _cb.beforeReturnNotFound(); }
if (_cb.returnNotFound) { _cb.returnNotFound(response); }
if (_cb.afterReturnNotFound) { _cb.afterReturnNotFound(); }
} | [
"function",
"processNotFound",
"(",
")",
"{",
"if",
"(",
"_cb",
".",
"beforeReturnNotFound",
")",
"{",
"_cb",
".",
"beforeReturnNotFound",
"(",
")",
";",
"}",
"if",
"(",
"_cb",
".",
"returnNotFound",
")",
"{",
"_cb",
".",
"returnNotFound",
"(",
"response",... | Call provided callback for not found data case. | [
"Call",
"provided",
"callback",
"for",
"not",
"found",
"data",
"case",
"."
] | 895953cb344e0929883863808429a3b8fa61d678 | https://github.com/Itee/i-return/blob/895953cb344e0929883863808429a3b8fa61d678/builds/i-return.js#L345-L349 |
57,870 | aaaschmitt/hubot-google-auth | auth.js | function(token) {
this.oauthClient.setCredentials(token);
this.brain.set(this.TOKEN_KEY, token.access_token);
if (token.refresh_token) {
this.brain.set(this.REFRESH_KEY, token.refresh_token);
}
this.brain.set(this.EXPIRY_KEY, +token.expiry_date);
this.brain.sa... | javascript | function(token) {
this.oauthClient.setCredentials(token);
this.brain.set(this.TOKEN_KEY, token.access_token);
if (token.refresh_token) {
this.brain.set(this.REFRESH_KEY, token.refresh_token);
}
this.brain.set(this.EXPIRY_KEY, +token.expiry_date);
this.brain.sa... | [
"function",
"(",
"token",
")",
"{",
"this",
".",
"oauthClient",
".",
"setCredentials",
"(",
"token",
")",
";",
"this",
".",
"brain",
".",
"set",
"(",
"this",
".",
"TOKEN_KEY",
",",
"token",
".",
"access_token",
")",
";",
"if",
"(",
"token",
".",
"ref... | Stores the token and expire time into the robot brain and
Sets it in the oauthClient
@param token the token object returned from google oauth2 | [
"Stores",
"the",
"token",
"and",
"expire",
"time",
"into",
"the",
"robot",
"brain",
"and",
"Sets",
"it",
"in",
"the",
"oauthClient"
] | 046c70965022f1aeebc03eede375650c8dcf1b7c | https://github.com/aaaschmitt/hubot-google-auth/blob/046c70965022f1aeebc03eede375650c8dcf1b7c/auth.js#L65-L74 | |
57,871 | aaaschmitt/hubot-google-auth | auth.js | function(code, cb) {
var self = this;
this.oauthClient.getToken(code, function(err, token) {
if (err) {
cb({
err: err,
msg: 'Error while trying to retrieve access token'
});
return;
}
... | javascript | function(code, cb) {
var self = this;
this.oauthClient.getToken(code, function(err, token) {
if (err) {
cb({
err: err,
msg: 'Error while trying to retrieve access token'
});
return;
}
... | [
"function",
"(",
"code",
",",
"cb",
")",
"{",
"var",
"self",
"=",
"this",
";",
"this",
".",
"oauthClient",
".",
"getToken",
"(",
"code",
",",
"function",
"(",
"err",
",",
"token",
")",
"{",
"if",
"(",
"err",
")",
"{",
"cb",
"(",
"{",
"err",
":"... | Used to set the code provided by the generated auth url.
This code is generated for a user and is needed to initiate the oauth2 handshake
@param code the code obtained by a user from the auth url | [
"Used",
"to",
"set",
"the",
"code",
"provided",
"by",
"the",
"generated",
"auth",
"url",
".",
"This",
"code",
"is",
"generated",
"for",
"a",
"user",
"and",
"is",
"needed",
"to",
"initiate",
"the",
"oauth2",
"handshake"
] | 046c70965022f1aeebc03eede375650c8dcf1b7c | https://github.com/aaaschmitt/hubot-google-auth/blob/046c70965022f1aeebc03eede375650c8dcf1b7c/auth.js#L101-L117 | |
57,872 | aaaschmitt/hubot-google-auth | auth.js | function(cb) {
var at = this.brain.get(this.TOKEN_KEY),
rt = this.brain.get(this.REFRESH_KEY);
if (at == null || rt == null) {
cb({
err: null,
msg: 'Error: No tokens found. Please authorize this app and store a refresh token'
});
... | javascript | function(cb) {
var at = this.brain.get(this.TOKEN_KEY),
rt = this.brain.get(this.REFRESH_KEY);
if (at == null || rt == null) {
cb({
err: null,
msg: 'Error: No tokens found. Please authorize this app and store a refresh token'
});
... | [
"function",
"(",
"cb",
")",
"{",
"var",
"at",
"=",
"this",
".",
"brain",
".",
"get",
"(",
"this",
".",
"TOKEN_KEY",
")",
",",
"rt",
"=",
"this",
".",
"brain",
".",
"get",
"(",
"this",
".",
"REFRESH_KEY",
")",
";",
"if",
"(",
"at",
"==",
"null",... | Checks the current expire time and determines if the token is valid.
Refreshes the token if it is not valid.
@param cb the callback function (err, resp), use this to make api calls | [
"Checks",
"the",
"current",
"expire",
"time",
"and",
"determines",
"if",
"the",
"token",
"is",
"valid",
".",
"Refreshes",
"the",
"token",
"if",
"it",
"is",
"not",
"valid",
"."
] | 046c70965022f1aeebc03eede375650c8dcf1b7c | https://github.com/aaaschmitt/hubot-google-auth/blob/046c70965022f1aeebc03eede375650c8dcf1b7c/auth.js#L125-L161 | |
57,873 | aaaschmitt/hubot-google-auth | auth.js | function() {
return {
token: this.brain.get(this.TOKEN_KEY),
refresh_token: this.brain.get(this.REFRESH_KEY),
expire_date: this.brain.get(this.EXPIRY_KEY)
}
} | javascript | function() {
return {
token: this.brain.get(this.TOKEN_KEY),
refresh_token: this.brain.get(this.REFRESH_KEY),
expire_date: this.brain.get(this.EXPIRY_KEY)
}
} | [
"function",
"(",
")",
"{",
"return",
"{",
"token",
":",
"this",
".",
"brain",
".",
"get",
"(",
"this",
".",
"TOKEN_KEY",
")",
",",
"refresh_token",
":",
"this",
".",
"brain",
".",
"get",
"(",
"this",
".",
"REFRESH_KEY",
")",
",",
"expire_date",
":",
... | Returns the current set of tokens | [
"Returns",
"the",
"current",
"set",
"of",
"tokens"
] | 046c70965022f1aeebc03eede375650c8dcf1b7c | https://github.com/aaaschmitt/hubot-google-auth/blob/046c70965022f1aeebc03eede375650c8dcf1b7c/auth.js#L166-L172 | |
57,874 | CodersBrothers/BtcAverage | btcaverage.js | findValueByPath | function findValueByPath(jsonData, path){
var errorParts = false;
path.split('.').forEach(function(part){
if(!errorParts){
jsonData = jsonData[part];
if(!jsonData) errorParts = true;
}
});
return errorParts ? 0 : parseFloat(jsonData);
} | javascript | function findValueByPath(jsonData, path){
var errorParts = false;
path.split('.').forEach(function(part){
if(!errorParts){
jsonData = jsonData[part];
if(!jsonData) errorParts = true;
}
});
return errorParts ? 0 : parseFloat(jsonData);
} | [
"function",
"findValueByPath",
"(",
"jsonData",
",",
"path",
")",
"{",
"var",
"errorParts",
"=",
"false",
";",
"path",
".",
"split",
"(",
"'.'",
")",
".",
"forEach",
"(",
"function",
"(",
"part",
")",
"{",
"if",
"(",
"!",
"errorParts",
")",
"{",
"jso... | FIND VALUE BY PATH
@param {Object} jsonData
@param {String} path | [
"FIND",
"VALUE",
"BY",
"PATH"
] | ef936af295f55a3328a790ebb2bcba6df4c1b378 | https://github.com/CodersBrothers/BtcAverage/blob/ef936af295f55a3328a790ebb2bcba6df4c1b378/btcaverage.js#L17-L26 |
57,875 | CodersBrothers/BtcAverage | btcaverage.js | requestPrice | function requestPrice(urlAPI, callback){
request({
method: 'GET',
url: urlAPI,
timeout: TIMEOUT,
maxRedirects: 2
}, function(error, res, body){
if(!error){
try{
var current = JSON.parse(body);
callback(current);
}cat... | javascript | function requestPrice(urlAPI, callback){
request({
method: 'GET',
url: urlAPI,
timeout: TIMEOUT,
maxRedirects: 2
}, function(error, res, body){
if(!error){
try{
var current = JSON.parse(body);
callback(current);
}cat... | [
"function",
"requestPrice",
"(",
"urlAPI",
",",
"callback",
")",
"{",
"request",
"(",
"{",
"method",
":",
"'GET'",
",",
"url",
":",
"urlAPI",
",",
"timeout",
":",
"TIMEOUT",
",",
"maxRedirects",
":",
"2",
"}",
",",
"function",
"(",
"error",
",",
"res",... | GET PRICE FROM API SERVICE
@param {String} urlAPI
@param {Function} callback | [
"GET",
"PRICE",
"FROM",
"API",
"SERVICE"
] | ef936af295f55a3328a790ebb2bcba6df4c1b378 | https://github.com/CodersBrothers/BtcAverage/blob/ef936af295f55a3328a790ebb2bcba6df4c1b378/btcaverage.js#L34-L51 |
57,876 | isaacperaza/elixir-busting | index.js | function(buildPath, manifest) {
fs.stat(manifest, function(err, stat) {
if (! err) {
manifest = JSON.parse(fs.readFileSync(manifest));
for (var key in manifest) {
del.sync(buildPath + '/' + manifest[key], { force: true });
}
}
});
} | javascript | function(buildPath, manifest) {
fs.stat(manifest, function(err, stat) {
if (! err) {
manifest = JSON.parse(fs.readFileSync(manifest));
for (var key in manifest) {
del.sync(buildPath + '/' + manifest[key], { force: true });
}
}
});
} | [
"function",
"(",
"buildPath",
",",
"manifest",
")",
"{",
"fs",
".",
"stat",
"(",
"manifest",
",",
"function",
"(",
"err",
",",
"stat",
")",
"{",
"if",
"(",
"!",
"err",
")",
"{",
"manifest",
"=",
"JSON",
".",
"parse",
"(",
"fs",
".",
"readFileSync",... | Empty all relevant files from the build directory.
@param {string} buildPath
@param {string} manifest | [
"Empty",
"all",
"relevant",
"files",
"from",
"the",
"build",
"directory",
"."
] | 7238222465f73dfedd8f049b6daf32b5cbaddcf9 | https://github.com/isaacperaza/elixir-busting/blob/7238222465f73dfedd8f049b6daf32b5cbaddcf9/index.js#L90-L100 | |
57,877 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/htmlparser/node.js | function() {
var children = this.parent.children,
index = CKEDITOR.tools.indexOf( children, this ),
previous = this.previous,
next = this.next;
previous && ( previous.next = next );
next && ( next.previous = previous );
children.splice( index, 1 );
this.parent = null;
} | javascript | function() {
var children = this.parent.children,
index = CKEDITOR.tools.indexOf( children, this ),
previous = this.previous,
next = this.next;
previous && ( previous.next = next );
next && ( next.previous = previous );
children.splice( index, 1 );
this.parent = null;
} | [
"function",
"(",
")",
"{",
"var",
"children",
"=",
"this",
".",
"parent",
".",
"children",
",",
"index",
"=",
"CKEDITOR",
".",
"tools",
".",
"indexOf",
"(",
"children",
",",
"this",
")",
",",
"previous",
"=",
"this",
".",
"previous",
",",
"next",
"="... | Remove this node from a tree.
@since 4.1 | [
"Remove",
"this",
"node",
"from",
"a",
"tree",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/htmlparser/node.js#L24-L34 | |
57,878 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/htmlparser/node.js | function( condition ) {
var checkFn =
typeof condition == 'function' ?
condition :
typeof condition == 'string' ?
function( el ) {
return el.name == condition;
} :
function( el ) {
return el.name in condition;
};
var parent = this.parent;
// Parent has to be an el... | javascript | function( condition ) {
var checkFn =
typeof condition == 'function' ?
condition :
typeof condition == 'string' ?
function( el ) {
return el.name == condition;
} :
function( el ) {
return el.name in condition;
};
var parent = this.parent;
// Parent has to be an el... | [
"function",
"(",
"condition",
")",
"{",
"var",
"checkFn",
"=",
"typeof",
"condition",
"==",
"'function'",
"?",
"condition",
":",
"typeof",
"condition",
"==",
"'string'",
"?",
"function",
"(",
"el",
")",
"{",
"return",
"el",
".",
"name",
"==",
"condition",
... | Gets the closest ancestor element of this element which satisfies given condition
@since 4.3
@param {String/Object/Function} condition Name of an ancestor, hash of names or validator function.
@returns {CKEDITOR.htmlParser.element} The closest ancestor which satisfies given condition or `null`. | [
"Gets",
"the",
"closest",
"ancestor",
"element",
"of",
"this",
"element",
"which",
"satisfies",
"given",
"condition"
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/htmlparser/node.js#L105-L127 | |
57,879 | leocornus/leocornus-visualdata | src/zoomable-circles.js | function(d) {
var self = this;
$('#circle-info').html(d.name);
console.log(d);
var focus0 = self.focus;
self.focus = d;
var transition = d3.transition()
.duration(d3.event.altKey ? 7500 : 750)
.tween("zoom", fun... | javascript | function(d) {
var self = this;
$('#circle-info').html(d.name);
console.log(d);
var focus0 = self.focus;
self.focus = d;
var transition = d3.transition()
.duration(d3.event.altKey ? 7500 : 750)
.tween("zoom", fun... | [
"function",
"(",
"d",
")",
"{",
"var",
"self",
"=",
"this",
";",
"$",
"(",
"'#circle-info'",
")",
".",
"html",
"(",
"d",
".",
"name",
")",
";",
"console",
".",
"log",
"(",
"d",
")",
";",
"var",
"focus0",
"=",
"self",
".",
"focus",
";",
"self",
... | a function responsible for zooming in on circles | [
"a",
"function",
"responsible",
"for",
"zooming",
"in",
"on",
"circles"
] | 9d9714ca11c126f0250e650f3c1c4086709af3ab | https://github.com/leocornus/leocornus-visualdata/blob/9d9714ca11c126f0250e650f3c1c4086709af3ab/src/zoomable-circles.js#L273-L317 | |
57,880 | AKST/nuimo-client.js | src/withNuimo.js | discoverServicesAndCharacteristics | function discoverServicesAndCharacteristics(error) {
if (error) { return reject(error); }
peripheral.discoverSomeServicesAndCharacteristics(
ALL_SERVICES,
ALL_CHARACTERISTICS,
setupEmitter
);
} | javascript | function discoverServicesAndCharacteristics(error) {
if (error) { return reject(error); }
peripheral.discoverSomeServicesAndCharacteristics(
ALL_SERVICES,
ALL_CHARACTERISTICS,
setupEmitter
);
} | [
"function",
"discoverServicesAndCharacteristics",
"(",
"error",
")",
"{",
"if",
"(",
"error",
")",
"{",
"return",
"reject",
"(",
"error",
")",
";",
"}",
"peripheral",
".",
"discoverSomeServicesAndCharacteristics",
"(",
"ALL_SERVICES",
",",
"ALL_CHARACTERISTICS",
","... | discovers the sensor service and it's characteristics
@param {error} | [
"discovers",
"the",
"sensor",
"service",
"and",
"it",
"s",
"characteristics"
] | a37977b604aef33abb02f9fdde1a4f64d9a0c906 | https://github.com/AKST/nuimo-client.js/blob/a37977b604aef33abb02f9fdde1a4f64d9a0c906/src/withNuimo.js#L66-L73 |
57,881 | AKST/nuimo-client.js | src/withNuimo.js | setupEmitter | function setupEmitter(error) {
if (error) { return reject(error); }
const sensorService = getService(SERVICE_SENSOR_UUID, peripheral);
const notifiable = sensorService.characteristics;
const withNotified = Promise.all(notifiable.map(characteristic =>
new Promise((resolve, reject) =>
... | javascript | function setupEmitter(error) {
if (error) { return reject(error); }
const sensorService = getService(SERVICE_SENSOR_UUID, peripheral);
const notifiable = sensorService.characteristics;
const withNotified = Promise.all(notifiable.map(characteristic =>
new Promise((resolve, reject) =>
... | [
"function",
"setupEmitter",
"(",
"error",
")",
"{",
"if",
"(",
"error",
")",
"{",
"return",
"reject",
"(",
"error",
")",
";",
"}",
"const",
"sensorService",
"=",
"getService",
"(",
"SERVICE_SENSOR_UUID",
",",
"peripheral",
")",
";",
"const",
"notifiable",
... | setup each service characteristic of the sensor to emit data on new data
when all have been setup with characteristic.notify then resolve the promise
@param {error} | [
"setup",
"each",
"service",
"characteristic",
"of",
"the",
"sensor",
"to",
"emit",
"data",
"on",
"new",
"data",
"when",
"all",
"have",
"been",
"setup",
"with",
"characteristic",
".",
"notify",
"then",
"resolve",
"the",
"promise"
] | a37977b604aef33abb02f9fdde1a4f64d9a0c906 | https://github.com/AKST/nuimo-client.js/blob/a37977b604aef33abb02f9fdde1a4f64d9a0c906/src/withNuimo.js#L80-L104 |
57,882 | jasonrhodes/pagemaki | pagemaki.js | function (config) {
this.globals = config.globals || {};
this.templates = {};
this.config = _.extend({}, defaults, config);
this.config.optionsRegex = new RegExp("^" + this.config.optionsDelimiter + "([\\S\\s]+)" + this.config.optionsDelimiter + "([\\S\\s]+)");
} | javascript | function (config) {
this.globals = config.globals || {};
this.templates = {};
this.config = _.extend({}, defaults, config);
this.config.optionsRegex = new RegExp("^" + this.config.optionsDelimiter + "([\\S\\s]+)" + this.config.optionsDelimiter + "([\\S\\s]+)");
} | [
"function",
"(",
"config",
")",
"{",
"this",
".",
"globals",
"=",
"config",
".",
"globals",
"||",
"{",
"}",
";",
"this",
".",
"templates",
"=",
"{",
"}",
";",
"this",
".",
"config",
"=",
"_",
".",
"extend",
"(",
"{",
"}",
",",
"defaults",
",",
... | Constructor for the Pagemaki class
@param {[type]} config [description] | [
"Constructor",
"for",
"the",
"Pagemaki",
"class"
] | 843892a62696a6db392d9f4646818a31b44a8da2 | https://github.com/jasonrhodes/pagemaki/blob/843892a62696a6db392d9f4646818a31b44a8da2/pagemaki.js#L47-L52 | |
57,883 | blake-regalia/rmprop.js | lib/index.js | function(z_real, w_copy, s_property) {
// property is a function (ie: instance method)
if('function' === typeof z_real[s_property]) {
// implement same method name in virtual object
w_copy[s_property] = function() {
// forward to real class
return z_real[s_property].apply(z_real, arguments);
};
}
// ... | javascript | function(z_real, w_copy, s_property) {
// property is a function (ie: instance method)
if('function' === typeof z_real[s_property]) {
// implement same method name in virtual object
w_copy[s_property] = function() {
// forward to real class
return z_real[s_property].apply(z_real, arguments);
};
}
// ... | [
"function",
"(",
"z_real",
",",
"w_copy",
",",
"s_property",
")",
"{",
"// property is a function (ie: instance method)",
"if",
"(",
"'function'",
"===",
"typeof",
"z_real",
"[",
"s_property",
"]",
")",
"{",
"// implement same method name in virtual object",
"w_copy",
"... | creates a transparent property on w_copy using z_real | [
"creates",
"a",
"transparent",
"property",
"on",
"w_copy",
"using",
"z_real"
] | 864ff0c4d24f2a4fcf684d5729bc5dafe14b3671 | https://github.com/blake-regalia/rmprop.js/blob/864ff0c4d24f2a4fcf684d5729bc5dafe14b3671/lib/index.js#L85-L163 | |
57,884 | tbashor/architect-debug-logger | logger.js | logFn | function logFn(level){
return function(msg){
var args = Array.prototype.slice.call(arguments);
if (level === 'hr'){
args = ['------------------------------------------------------------'];
args.push({_hr: true});
level = 'debug';
}
var logFn = logger[level] || conso... | javascript | function logFn(level){
return function(msg){
var args = Array.prototype.slice.call(arguments);
if (level === 'hr'){
args = ['------------------------------------------------------------'];
args.push({_hr: true});
level = 'debug';
}
var logFn = logger[level] || conso... | [
"function",
"logFn",
"(",
"level",
")",
"{",
"return",
"function",
"(",
"msg",
")",
"{",
"var",
"args",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
")",
";",
"if",
"(",
"level",
"===",
"'hr'",
")",
"{",
"args",
"=",... | Wrap winston logger to be somewhat api compatible with debug | [
"Wrap",
"winston",
"logger",
"to",
"be",
"somewhat",
"api",
"compatible",
"with",
"debug"
] | 1d2806d2ffb8f66892f6ed7b65bd5b5abc501973 | https://github.com/tbashor/architect-debug-logger/blob/1d2806d2ffb8f66892f6ed7b65bd5b5abc501973/logger.js#L156-L169 |
57,885 | tbashor/architect-debug-logger | logger.js | disable | function disable(namespaces) {
var split = (namespaces || '').split(/[\s,]+/);
var len = split.length;
function removeNamespaceFromNames(namespaces){
_.remove(exports.names, function(name){
return name.toString() === '/^' + namespaces + '$/';
});
}
for (var i = 0; i < len; i++) {
if (!spli... | javascript | function disable(namespaces) {
var split = (namespaces || '').split(/[\s,]+/);
var len = split.length;
function removeNamespaceFromNames(namespaces){
_.remove(exports.names, function(name){
return name.toString() === '/^' + namespaces + '$/';
});
}
for (var i = 0; i < len; i++) {
if (!spli... | [
"function",
"disable",
"(",
"namespaces",
")",
"{",
"var",
"split",
"=",
"(",
"namespaces",
"||",
"''",
")",
".",
"split",
"(",
"/",
"[\\s,]+",
"/",
")",
";",
"var",
"len",
"=",
"split",
".",
"length",
";",
"function",
"removeNamespaceFromNames",
"(",
... | Disables a debug mode by namespaces. This can include modes
separated by a colon and wildcards.
@param {String} namespaces
@api public | [
"Disables",
"a",
"debug",
"mode",
"by",
"namespaces",
".",
"This",
"can",
"include",
"modes",
"separated",
"by",
"a",
"colon",
"and",
"wildcards",
"."
] | 1d2806d2ffb8f66892f6ed7b65bd5b5abc501973 | https://github.com/tbashor/architect-debug-logger/blob/1d2806d2ffb8f66892f6ed7b65bd5b5abc501973/logger.js#L236-L259 |
57,886 | zuzana/mocha-xunit-zh | xunit-zh.js | XUnitZH | function XUnitZH(runner) {
var tests = [],
passes = 0,
failures = 0;
runner.on('pass', function(test){
test.state = 'passed';
passes++;
tests.push(test);
test.number = tests.length;
});
runner.on('fail', function(test){
test.state = 'failed';
failures++;
tests.push(... | javascript | function XUnitZH(runner) {
var tests = [],
passes = 0,
failures = 0;
runner.on('pass', function(test){
test.state = 'passed';
passes++;
tests.push(test);
test.number = tests.length;
});
runner.on('fail', function(test){
test.state = 'failed';
failures++;
tests.push(... | [
"function",
"XUnitZH",
"(",
"runner",
")",
"{",
"var",
"tests",
"=",
"[",
"]",
",",
"passes",
"=",
"0",
",",
"failures",
"=",
"0",
";",
"runner",
".",
"on",
"(",
"'pass'",
",",
"function",
"(",
"test",
")",
"{",
"test",
".",
"state",
"=",
"'passe... | Initialize a new `XUnitZH` reporter.
@param {Runner} runner
@api public | [
"Initialize",
"a",
"new",
"XUnitZH",
"reporter",
"."
] | 9c8862fb0562eae3f0cc9d09704f55a093203e81 | https://github.com/zuzana/mocha-xunit-zh/blob/9c8862fb0562eae3f0cc9d09704f55a093203e81/xunit-zh.js#L35-L80 |
57,887 | zuzana/mocha-xunit-zh | xunit-zh.js | toConsole | function toConsole(number, name, state, content){
console.log(number + ') ' + state + ' ' + name);
if (content) {
console.log('\t' + content);
}
} | javascript | function toConsole(number, name, state, content){
console.log(number + ') ' + state + ' ' + name);
if (content) {
console.log('\t' + content);
}
} | [
"function",
"toConsole",
"(",
"number",
",",
"name",
",",
"state",
",",
"content",
")",
"{",
"console",
".",
"log",
"(",
"number",
"+",
"') '",
"+",
"state",
"+",
"' '",
"+",
"name",
")",
";",
"if",
"(",
"content",
")",
"{",
"console",
".",
"log",
... | Output to console | [
"Output",
"to",
"console"
] | 9c8862fb0562eae3f0cc9d09704f55a093203e81 | https://github.com/zuzana/mocha-xunit-zh/blob/9c8862fb0562eae3f0cc9d09704f55a093203e81/xunit-zh.js#L128-L133 |
57,888 | TribeMedia/tribemedia-kurento-client-elements-js | lib/complexTypes/IceComponentState.js | checkIceComponentState | function checkIceComponentState(key, value)
{
if(typeof value != 'string')
throw SyntaxError(key+' param should be a String, not '+typeof value);
if(!value.match('DISCONNECTED|GATHERING|CONNECTING|CONNECTED|READY|FAILED'))
throw SyntaxError(key+' param is not one of [DISCONNECTED|GATHERING|CONNECTING|CONNE... | javascript | function checkIceComponentState(key, value)
{
if(typeof value != 'string')
throw SyntaxError(key+' param should be a String, not '+typeof value);
if(!value.match('DISCONNECTED|GATHERING|CONNECTING|CONNECTED|READY|FAILED'))
throw SyntaxError(key+' param is not one of [DISCONNECTED|GATHERING|CONNECTING|CONNE... | [
"function",
"checkIceComponentState",
"(",
"key",
",",
"value",
")",
"{",
"if",
"(",
"typeof",
"value",
"!=",
"'string'",
")",
"throw",
"SyntaxError",
"(",
"key",
"+",
"' param should be a String, not '",
"+",
"typeof",
"value",
")",
";",
"if",
"(",
"!",
"va... | States of an ICE component.
@typedef elements/complexTypes.IceComponentState
@type {(DISCONNECTED|GATHERING|CONNECTING|CONNECTED|READY|FAILED)}
Checker for {@link elements/complexTypes.IceComponentState}
@memberof module:elements/complexTypes
@param {external:String} key
@param {module:elements/complexTypes.IceCo... | [
"States",
"of",
"an",
"ICE",
"component",
"."
] | 1a5570f05bf8c2c25bbeceb4f96cb2770f634de9 | https://github.com/TribeMedia/tribemedia-kurento-client-elements-js/blob/1a5570f05bf8c2c25bbeceb4f96cb2770f634de9/lib/complexTypes/IceComponentState.js#L37-L44 |
57,889 | dlindahl/stemcell | src/components/Bit.js | applyStyles | function applyStyles (css) {
return flattenDeep(css)
.reduce(
(classNames, declarations) => {
if (!declarations) {
return classNames
}
classNames.push(glamor(declarations))
return classNames
},
[]
)
.join(' ')
} | javascript | function applyStyles (css) {
return flattenDeep(css)
.reduce(
(classNames, declarations) => {
if (!declarations) {
return classNames
}
classNames.push(glamor(declarations))
return classNames
},
[]
)
.join(' ')
} | [
"function",
"applyStyles",
"(",
"css",
")",
"{",
"return",
"flattenDeep",
"(",
"css",
")",
".",
"reduce",
"(",
"(",
"classNames",
",",
"declarations",
")",
"=>",
"{",
"if",
"(",
"!",
"declarations",
")",
"{",
"return",
"classNames",
"}",
"classNames",
".... | Generate CSS classnames from CSS props | [
"Generate",
"CSS",
"classnames",
"from",
"CSS",
"props"
] | 1901c637bb5d7dc00e45184a424c429c8b9dc3be | https://github.com/dlindahl/stemcell/blob/1901c637bb5d7dc00e45184a424c429c8b9dc3be/src/components/Bit.js#L18-L31 |
57,890 | sreenaths/em-tgraph | addon/utils/data-processor.js | centericMap | function centericMap(array, callback) {
var retArray = [],
length,
left, right;
if(array) {
length = array.length - 1;
left = length >> 1;
while(left >= 0) {
retArray[left] = callback(array[left]);
right = length - left;
if(right !== left) {
retArray[right] = call... | javascript | function centericMap(array, callback) {
var retArray = [],
length,
left, right;
if(array) {
length = array.length - 1;
left = length >> 1;
while(left >= 0) {
retArray[left] = callback(array[left]);
right = length - left;
if(right !== left) {
retArray[right] = call... | [
"function",
"centericMap",
"(",
"array",
",",
"callback",
")",
"{",
"var",
"retArray",
"=",
"[",
"]",
",",
"length",
",",
"left",
",",
"right",
";",
"if",
"(",
"array",
")",
"{",
"length",
"=",
"array",
".",
"length",
"-",
"1",
";",
"left",
"=",
... | Iterates the array in a symmetric order, from middle to outwards
@param array {Array} Array to be iterated
@param callback {Function} Function to be called for each item
@return A new array created with value returned by callback | [
"Iterates",
"the",
"array",
"in",
"a",
"symmetric",
"order",
"from",
"middle",
"to",
"outwards"
] | 8d6a8f46b911a165ac16561731735ab762954996 | https://github.com/sreenaths/em-tgraph/blob/8d6a8f46b911a165ac16561731735ab762954996/addon/utils/data-processor.js#L160-L179 |
57,891 | sreenaths/em-tgraph | addon/utils/data-processor.js | function (children) {
var allChildren = this.get('allChildren');
if(allChildren) {
this._setChildren(allChildren.filter(function (child) {
return children.indexOf(child) !== -1; // true if child is in children
}));
}
} | javascript | function (children) {
var allChildren = this.get('allChildren');
if(allChildren) {
this._setChildren(allChildren.filter(function (child) {
return children.indexOf(child) !== -1; // true if child is in children
}));
}
} | [
"function",
"(",
"children",
")",
"{",
"var",
"allChildren",
"=",
"this",
".",
"get",
"(",
"'allChildren'",
")",
";",
"if",
"(",
"allChildren",
")",
"{",
"this",
".",
"_setChildren",
"(",
"allChildren",
".",
"filter",
"(",
"function",
"(",
"child",
")",
... | Public function.
Set the child array after filtering
@param children {Array} Array of DataNodes to be set | [
"Public",
"function",
".",
"Set",
"the",
"child",
"array",
"after",
"filtering"
] | 8d6a8f46b911a165ac16561731735ab762954996 | https://github.com/sreenaths/em-tgraph/blob/8d6a8f46b911a165ac16561731735ab762954996/addon/utils/data-processor.js#L215-L222 | |
57,892 | sreenaths/em-tgraph | addon/utils/data-processor.js | function (childrenToRemove) {
var children = this.get('children');
if(children) {
children = children.filter(function (child) {
return childrenToRemove.indexOf(child) === -1; // false if child is in children
});
this._setChildren(children);
}
} | javascript | function (childrenToRemove) {
var children = this.get('children');
if(children) {
children = children.filter(function (child) {
return childrenToRemove.indexOf(child) === -1; // false if child is in children
});
this._setChildren(children);
}
} | [
"function",
"(",
"childrenToRemove",
")",
"{",
"var",
"children",
"=",
"this",
".",
"get",
"(",
"'children'",
")",
";",
"if",
"(",
"children",
")",
"{",
"children",
"=",
"children",
".",
"filter",
"(",
"function",
"(",
"child",
")",
"{",
"return",
"chi... | Filter out the given children from the children array.
@param childrenToRemove {Array} Array of DataNodes to be removed | [
"Filter",
"out",
"the",
"given",
"children",
"from",
"the",
"children",
"array",
"."
] | 8d6a8f46b911a165ac16561731735ab762954996 | https://github.com/sreenaths/em-tgraph/blob/8d6a8f46b911a165ac16561731735ab762954996/addon/utils/data-processor.js#L227-L235 | |
57,893 | sreenaths/em-tgraph | addon/utils/data-processor.js | function (property, callback, thisArg) {
if(this.get(property)) {
this.get(property).forEach(callback, thisArg);
}
} | javascript | function (property, callback, thisArg) {
if(this.get(property)) {
this.get(property).forEach(callback, thisArg);
}
} | [
"function",
"(",
"property",
",",
"callback",
",",
"thisArg",
")",
"{",
"if",
"(",
"this",
".",
"get",
"(",
"property",
")",
")",
"{",
"this",
".",
"get",
"(",
"property",
")",
".",
"forEach",
"(",
"callback",
",",
"thisArg",
")",
";",
"}",
"}"
] | If the property is available, expects it to be an array and iterate over
its elements using the callback.
@param vertex {DataNode}
@param callback {Function}
@param thisArg {} Will be value of this inside the callback | [
"If",
"the",
"property",
"is",
"available",
"expects",
"it",
"to",
"be",
"an",
"array",
"and",
"iterate",
"over",
"its",
"elements",
"using",
"the",
"callback",
"."
] | 8d6a8f46b911a165ac16561731735ab762954996 | https://github.com/sreenaths/em-tgraph/blob/8d6a8f46b911a165ac16561731735ab762954996/addon/utils/data-processor.js#L258-L262 | |
57,894 | sreenaths/em-tgraph | addon/utils/data-processor.js | function (depth) {
this.set('depth', depth);
depth++;
this.get('inputs').forEach(function (input) {
input.set('depth', depth);
});
} | javascript | function (depth) {
this.set('depth', depth);
depth++;
this.get('inputs').forEach(function (input) {
input.set('depth', depth);
});
} | [
"function",
"(",
"depth",
")",
"{",
"this",
".",
"set",
"(",
"'depth'",
",",
"depth",
")",
";",
"depth",
"++",
";",
"this",
".",
"get",
"(",
"'inputs'",
")",
".",
"forEach",
"(",
"function",
"(",
"input",
")",
"{",
"input",
".",
"set",
"(",
"'dep... | Sets depth of the vertex and all its input children
@param depth {Number} | [
"Sets",
"depth",
"of",
"the",
"vertex",
"and",
"all",
"its",
"input",
"children"
] | 8d6a8f46b911a165ac16561731735ab762954996 | https://github.com/sreenaths/em-tgraph/blob/8d6a8f46b911a165ac16561731735ab762954996/addon/utils/data-processor.js#L315-L322 | |
57,895 | sreenaths/em-tgraph | addon/utils/data-processor.js | function() {
this.setChildren(this.get('inputs').concat(this.get('children') || []));
var ancestor = this.get('parent.parent');
if(ancestor) {
ancestor.setChildren(this.get('outputs').concat(ancestor.get('children') || []));
}
this.set('_additionalsIncluded', true);
... | javascript | function() {
this.setChildren(this.get('inputs').concat(this.get('children') || []));
var ancestor = this.get('parent.parent');
if(ancestor) {
ancestor.setChildren(this.get('outputs').concat(ancestor.get('children') || []));
}
this.set('_additionalsIncluded', true);
... | [
"function",
"(",
")",
"{",
"this",
".",
"setChildren",
"(",
"this",
".",
"get",
"(",
"'inputs'",
")",
".",
"concat",
"(",
"this",
".",
"get",
"(",
"'children'",
")",
"||",
"[",
"]",
")",
")",
";",
"var",
"ancestor",
"=",
"this",
".",
"get",
"(",
... | Include sources and sinks in the children list, so that they are displayed | [
"Include",
"sources",
"and",
"sinks",
"in",
"the",
"children",
"list",
"so",
"that",
"they",
"are",
"displayed"
] | 8d6a8f46b911a165ac16561731735ab762954996 | https://github.com/sreenaths/em-tgraph/blob/8d6a8f46b911a165ac16561731735ab762954996/addon/utils/data-processor.js#L335-L343 | |
57,896 | sreenaths/em-tgraph | addon/utils/data-processor.js | function() {
this.removeChildren(this.get('inputs'));
var ancestor = this.get('parent.parent');
if(ancestor) {
ancestor.removeChildren(this.get('outputs'));
}
this.set('_additionalsIncluded', false);
} | javascript | function() {
this.removeChildren(this.get('inputs'));
var ancestor = this.get('parent.parent');
if(ancestor) {
ancestor.removeChildren(this.get('outputs'));
}
this.set('_additionalsIncluded', false);
} | [
"function",
"(",
")",
"{",
"this",
".",
"removeChildren",
"(",
"this",
".",
"get",
"(",
"'inputs'",
")",
")",
";",
"var",
"ancestor",
"=",
"this",
".",
"get",
"(",
"'parent.parent'",
")",
";",
"if",
"(",
"ancestor",
")",
"{",
"ancestor",
".",
"remove... | Exclude sources and sinks in the children list, so that they are hidden | [
"Exclude",
"sources",
"and",
"sinks",
"in",
"the",
"children",
"list",
"so",
"that",
"they",
"are",
"hidden"
] | 8d6a8f46b911a165ac16561731735ab762954996 | https://github.com/sreenaths/em-tgraph/blob/8d6a8f46b911a165ac16561731735ab762954996/addon/utils/data-processor.js#L347-L355 | |
57,897 | sreenaths/em-tgraph | addon/utils/data-processor.js | function () {
var vertex = this.get('vertex');
this._super();
// Initialize data members
this.setProperties({
id: vertex.get('vertexName') + this.get('name'),
depth: vertex.get('depth') + 1
});
} | javascript | function () {
var vertex = this.get('vertex');
this._super();
// Initialize data members
this.setProperties({
id: vertex.get('vertexName') + this.get('name'),
depth: vertex.get('depth') + 1
});
} | [
"function",
"(",
")",
"{",
"var",
"vertex",
"=",
"this",
".",
"get",
"(",
"'vertex'",
")",
";",
"this",
".",
"_super",
"(",
")",
";",
"// Initialize data members",
"this",
".",
"setProperties",
"(",
"{",
"id",
":",
"vertex",
".",
"get",
"(",
"'vertexNa... | The vertex DataNode to which this node is linked | [
"The",
"vertex",
"DataNode",
"to",
"which",
"this",
"node",
"is",
"linked"
] | 8d6a8f46b911a165ac16561731735ab762954996 | https://github.com/sreenaths/em-tgraph/blob/8d6a8f46b911a165ac16561731735ab762954996/addon/utils/data-processor.js#L375-L384 | |
57,898 | sreenaths/em-tgraph | addon/utils/data-processor.js | function (vertex, data) {
return InputDataNode.create(Ember.$.extend(data, {
treeParent: vertex,
vertex: vertex
}));
} | javascript | function (vertex, data) {
return InputDataNode.create(Ember.$.extend(data, {
treeParent: vertex,
vertex: vertex
}));
} | [
"function",
"(",
"vertex",
",",
"data",
")",
"{",
"return",
"InputDataNode",
".",
"create",
"(",
"Ember",
".",
"$",
".",
"extend",
"(",
"data",
",",
"{",
"treeParent",
":",
"vertex",
",",
"vertex",
":",
"vertex",
"}",
")",
")",
";",
"}"
] | Initiate an InputDataNode
@param vertex {DataNode}
@param data {Object} | [
"Initiate",
"an",
"InputDataNode"
] | 8d6a8f46b911a165ac16561731735ab762954996 | https://github.com/sreenaths/em-tgraph/blob/8d6a8f46b911a165ac16561731735ab762954996/addon/utils/data-processor.js#L391-L396 | |
57,899 | sreenaths/em-tgraph | addon/utils/data-processor.js | _normalizeVertexTree | function _normalizeVertexTree(vertex) {
var children = vertex.get('children');
if(children) {
children = children.filter(function (child) {
_normalizeVertexTree(child);
return child.get('type') !== 'vertex' || child.get('treeParent') === vertex;
});
vertex._setChildren(children);
}
re... | javascript | function _normalizeVertexTree(vertex) {
var children = vertex.get('children');
if(children) {
children = children.filter(function (child) {
_normalizeVertexTree(child);
return child.get('type') !== 'vertex' || child.get('treeParent') === vertex;
});
vertex._setChildren(children);
}
re... | [
"function",
"_normalizeVertexTree",
"(",
"vertex",
")",
"{",
"var",
"children",
"=",
"vertex",
".",
"get",
"(",
"'children'",
")",
";",
"if",
"(",
"children",
")",
"{",
"children",
"=",
"children",
".",
"filter",
"(",
"function",
"(",
"child",
")",
"{",
... | Part of step 1
To remove recurring vertices in the tree
@param vertex {Object} root vertex | [
"Part",
"of",
"step",
"1",
"To",
"remove",
"recurring",
"vertices",
"in",
"the",
"tree"
] | 8d6a8f46b911a165ac16561731735ab762954996 | https://github.com/sreenaths/em-tgraph/blob/8d6a8f46b911a165ac16561731735ab762954996/addon/utils/data-processor.js#L495-L508 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.