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,000 | pmh/espresso | lib/ometa/ometa/ometa.js | cached | function cached(grammar_file) {
var fs = require('fs'),
path = require('path'),
change = fs.statSync(grammar_file).mtime.valueOf(),
cache = [cache_path,'/', path.basename(grammar_file), '.', change, '.js'].join('');
if(!fs.existsSync(cache_path))
fs.mkdirSync(cache_path);
if(fs.... | javascript | function cached(grammar_file) {
var fs = require('fs'),
path = require('path'),
change = fs.statSync(grammar_file).mtime.valueOf(),
cache = [cache_path,'/', path.basename(grammar_file), '.', change, '.js'].join('');
if(!fs.existsSync(cache_path))
fs.mkdirSync(cache_path);
if(fs.... | [
"function",
"cached",
"(",
"grammar_file",
")",
"{",
"var",
"fs",
"=",
"require",
"(",
"'fs'",
")",
",",
"path",
"=",
"require",
"(",
"'path'",
")",
",",
"change",
"=",
"fs",
".",
"statSync",
"(",
"grammar_file",
")",
".",
"mtime",
".",
"valueOf",
"(... | Internal function to cache grammars. Creates a `.cache` directory in the current
working path. | [
"Internal",
"function",
"to",
"cache",
"grammars",
".",
"Creates",
"a",
".",
"cache",
"directory",
"in",
"the",
"current",
"working",
"path",
"."
] | 26d7b2089a2098344aaaf32ec7eb942e91a7edf5 | https://github.com/pmh/espresso/blob/26d7b2089a2098344aaaf32ec7eb942e91a7edf5/lib/ometa/ometa/ometa.js#L8-L23 |
57,001 | pmh/espresso | lib/ometa/ometa/ometa.js | load | function load(grammar_file) {
var fs = require('fs'),
grammar = fs.readFileSync(grammar_file, 'utf-8');
return compile(grammar)
} | javascript | function load(grammar_file) {
var fs = require('fs'),
grammar = fs.readFileSync(grammar_file, 'utf-8');
return compile(grammar)
} | [
"function",
"load",
"(",
"grammar_file",
")",
"{",
"var",
"fs",
"=",
"require",
"(",
"'fs'",
")",
",",
"grammar",
"=",
"fs",
".",
"readFileSync",
"(",
"grammar_file",
",",
"'utf-8'",
")",
";",
"return",
"compile",
"(",
"grammar",
")",
"}"
] | Loads the specified grammar file and returns the generated grammar JavaScript
code for it. Evaling this code in your module will create the grammar objects
in the global module namespace. | [
"Loads",
"the",
"specified",
"grammar",
"file",
"and",
"returns",
"the",
"generated",
"grammar",
"JavaScript",
"code",
"for",
"it",
".",
"Evaling",
"this",
"code",
"in",
"your",
"module",
"will",
"create",
"the",
"grammar",
"objects",
"in",
"the",
"global",
... | 26d7b2089a2098344aaaf32ec7eb942e91a7edf5 | https://github.com/pmh/espresso/blob/26d7b2089a2098344aaaf32ec7eb942e91a7edf5/lib/ometa/ometa/ometa.js#L30-L34 |
57,002 | pmh/espresso | lib/ometa/ometa/ometa.js | run | function run(grammar, module, filename) {
// this is used to bind OMeta to runtime. It can be used also (lateron) to dynamically
// inject other environment-variables.
// {a:1,b:2,c:3,d:4} -> function(a,b,c,d) {...}.call(1,2,3,4)
// this is better than `with`, since it offers full control
var source = [
... | javascript | function run(grammar, module, filename) {
// this is used to bind OMeta to runtime. It can be used also (lateron) to dynamically
// inject other environment-variables.
// {a:1,b:2,c:3,d:4} -> function(a,b,c,d) {...}.call(1,2,3,4)
// this is better than `with`, since it offers full control
var source = [
... | [
"function",
"run",
"(",
"grammar",
",",
"module",
",",
"filename",
")",
"{",
"// this is used to bind OMeta to runtime. It can be used also (lateron) to dynamically",
"// inject other environment-variables. ",
"// {a:1,b:2,c:3,d:4} -> function(a,b,c,d) {...}.call(1,2,3,4)",
"// this is ... | Evaluates the grammar-module and returns the exports of that module | [
"Evaluates",
"the",
"grammar",
"-",
"module",
"and",
"returns",
"the",
"exports",
"of",
"that",
"module"
] | 26d7b2089a2098344aaaf32ec7eb942e91a7edf5 | https://github.com/pmh/espresso/blob/26d7b2089a2098344aaaf32ec7eb942e91a7edf5/lib/ometa/ometa/ometa.js#L50-L65 |
57,003 | torworx/well | function.js | _apply | function _apply(func, thisArg, promisedArgs) {
return well.all(promisedArgs || []).then(function(args) {
return func.apply(thisArg, args);
});
} | javascript | function _apply(func, thisArg, promisedArgs) {
return well.all(promisedArgs || []).then(function(args) {
return func.apply(thisArg, args);
});
} | [
"function",
"_apply",
"(",
"func",
",",
"thisArg",
",",
"promisedArgs",
")",
"{",
"return",
"well",
".",
"all",
"(",
"promisedArgs",
"||",
"[",
"]",
")",
".",
"then",
"(",
"function",
"(",
"args",
")",
"{",
"return",
"func",
".",
"apply",
"(",
"thisA... | Apply helper that allows specifying thisArg
@private | [
"Apply",
"helper",
"that",
"allows",
"specifying",
"thisArg"
] | 45a1724a0a4192628c80b3c4ae541d6de28ac7da | https://github.com/torworx/well/blob/45a1724a0a4192628c80b3c4ae541d6de28ac7da/function.js#L59-L63 |
57,004 | torworx/well | function.js | lift | function lift(func /*, args... */) {
var args = slice.call(arguments, 1);
return function() {
return _apply(func, this, args.concat(slice.call(arguments)));
};
} | javascript | function lift(func /*, args... */) {
var args = slice.call(arguments, 1);
return function() {
return _apply(func, this, args.concat(slice.call(arguments)));
};
} | [
"function",
"lift",
"(",
"func",
"/*, args... */",
")",
"{",
"var",
"args",
"=",
"slice",
".",
"call",
"(",
"arguments",
",",
"1",
")",
";",
"return",
"function",
"(",
")",
"{",
"return",
"_apply",
"(",
"func",
",",
"this",
",",
"args",
".",
"concat"... | Takes a 'regular' function and returns a version of that function that
returns a promise instead of a plain value, and handles thrown errors by
returning a rejected promise. Also accepts a list of arguments to be
prepended to the new function, as does Function.prototype.bind.
The resulting function is promise-aware, i... | [
"Takes",
"a",
"regular",
"function",
"and",
"returns",
"a",
"version",
"of",
"that",
"function",
"that",
"returns",
"a",
"promise",
"instead",
"of",
"a",
"plain",
"value",
"and",
"handles",
"thrown",
"errors",
"by",
"returning",
"a",
"rejected",
"promise",
"... | 45a1724a0a4192628c80b3c4ae541d6de28ac7da | https://github.com/torworx/well/blob/45a1724a0a4192628c80b3c4ae541d6de28ac7da/function.js#L133-L138 |
57,005 | camshaft/pack-n-stack | lib/stack.js | createStack | function createStack(app) {
if (!app) {
throw new Error("Pack-n-stack requires an express/connect app");
};
app = utils.merge(app, proto);
Object.defineProperty(app, "count", {
get: function() {
return app.stack.length;
}
});
return app;
} | javascript | function createStack(app) {
if (!app) {
throw new Error("Pack-n-stack requires an express/connect app");
};
app = utils.merge(app, proto);
Object.defineProperty(app, "count", {
get: function() {
return app.stack.length;
}
});
return app;
} | [
"function",
"createStack",
"(",
"app",
")",
"{",
"if",
"(",
"!",
"app",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Pack-n-stack requires an express/connect app\"",
")",
";",
"}",
";",
"app",
"=",
"utils",
".",
"merge",
"(",
"app",
",",
"proto",
")",
";",... | Create a new stack.
@return {Function}
@api public | [
"Create",
"a",
"new",
"stack",
"."
] | ec5fe9a4cb9895b89e137e966a4eaffb7931881c | https://github.com/camshaft/pack-n-stack/blob/ec5fe9a4cb9895b89e137e966a4eaffb7931881c/lib/stack.js#L29-L43 |
57,006 | dggriffin/mitto | lib/index.js | loadConfig | function loadConfig(filename) {
//Does our consumer have a valid .mitto?
var mittoObject = _loadMitto();
//Is it in a valid format?
mittoObject = _validateMitto(mittoObject);
//Does our consumer's consumer have a config of 'filename'?
var configObject = _findFile(filename);
//Is it in a valid format as p... | javascript | function loadConfig(filename) {
//Does our consumer have a valid .mitto?
var mittoObject = _loadMitto();
//Is it in a valid format?
mittoObject = _validateMitto(mittoObject);
//Does our consumer's consumer have a config of 'filename'?
var configObject = _findFile(filename);
//Is it in a valid format as p... | [
"function",
"loadConfig",
"(",
"filename",
")",
"{",
"//Does our consumer have a valid .mitto?",
"var",
"mittoObject",
"=",
"_loadMitto",
"(",
")",
";",
"//Is it in a valid format?",
"mittoObject",
"=",
"_validateMitto",
"(",
"mittoObject",
")",
";",
"//Does our consumer'... | Find JSON configuration given a filename
Applies .mitto constraints if your package has a .mitto package present
@return {json converted to Object} | [
"Find",
"JSON",
"configuration",
"given",
"a",
"filename",
"Applies",
".",
"mitto",
"constraints",
"if",
"your",
"package",
"has",
"a",
".",
"mitto",
"package",
"present"
] | a58cd439b67b626522078b8003a82a348103a66c | https://github.com/dggriffin/mitto/blob/a58cd439b67b626522078b8003a82a348103a66c/lib/index.js#L28-L38 |
57,007 | dggriffin/mitto | lib/index.js | _findFile | function _findFile(filename) {
var cwd = process.cwd();
var parts = cwd.split(_path2.default.sep);
do {
var loc = parts.join(_path2.default.sep);
if (!loc) break;
var file = _path2.default.join(loc, filename);
if (_fs2.default.existsSync(file)) {
var fileObj = undefined;
try {
... | javascript | function _findFile(filename) {
var cwd = process.cwd();
var parts = cwd.split(_path2.default.sep);
do {
var loc = parts.join(_path2.default.sep);
if (!loc) break;
var file = _path2.default.join(loc, filename);
if (_fs2.default.existsSync(file)) {
var fileObj = undefined;
try {
... | [
"function",
"_findFile",
"(",
"filename",
")",
"{",
"var",
"cwd",
"=",
"process",
".",
"cwd",
"(",
")",
";",
"var",
"parts",
"=",
"cwd",
".",
"split",
"(",
"_path2",
".",
"default",
".",
"sep",
")",
";",
"do",
"{",
"var",
"loc",
"=",
"parts",
"."... | PRIVATE HELPER FUNCTIONS
Find a "require" a JSON configuration given the filename | [
"PRIVATE",
"HELPER",
"FUNCTIONS",
"Find",
"a",
"require",
"a",
"JSON",
"configuration",
"given",
"the",
"filename"
] | a58cd439b67b626522078b8003a82a348103a66c | https://github.com/dggriffin/mitto/blob/a58cd439b67b626522078b8003a82a348103a66c/lib/index.js#L45-L67 |
57,008 | dggriffin/mitto | lib/index.js | _validateMitto | function _validateMitto(mittoObject) {
if (!mittoObject) {
return null;
}
if (!mittoObject.hasOwnProperty("name")) {
throw new Error("\"name\" property is missing from your .mitto and is required.");
}
if (mittoObject.hasOwnProperty("required")) {
for (var key in mittoObject.required) {
if... | javascript | function _validateMitto(mittoObject) {
if (!mittoObject) {
return null;
}
if (!mittoObject.hasOwnProperty("name")) {
throw new Error("\"name\" property is missing from your .mitto and is required.");
}
if (mittoObject.hasOwnProperty("required")) {
for (var key in mittoObject.required) {
if... | [
"function",
"_validateMitto",
"(",
"mittoObject",
")",
"{",
"if",
"(",
"!",
"mittoObject",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"!",
"mittoObject",
".",
"hasOwnProperty",
"(",
"\"name\"",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"\\\"na... | Validate .mitto object handed off to function to ensure it is syntatical correct | [
"Validate",
".",
"mitto",
"object",
"handed",
"off",
"to",
"function",
"to",
"ensure",
"it",
"is",
"syntatical",
"correct"
] | a58cd439b67b626522078b8003a82a348103a66c | https://github.com/dggriffin/mitto/blob/a58cd439b67b626522078b8003a82a348103a66c/lib/index.js#L75-L123 |
57,009 | dggriffin/mitto | lib/index.js | _validateConfig | function _validateConfig(configObject, mittoObject) {
var packageObject = _findFile('package.json');
if (!mittoObject) {
return configObject;
}
if (!configObject && mittoObject.required && Object.keys(mittoObject.required).length) {
throw new Error(mittoObject.name + " configuration file not found, and... | javascript | function _validateConfig(configObject, mittoObject) {
var packageObject = _findFile('package.json');
if (!mittoObject) {
return configObject;
}
if (!configObject && mittoObject.required && Object.keys(mittoObject.required).length) {
throw new Error(mittoObject.name + " configuration file not found, and... | [
"function",
"_validateConfig",
"(",
"configObject",
",",
"mittoObject",
")",
"{",
"var",
"packageObject",
"=",
"_findFile",
"(",
"'package.json'",
")",
";",
"if",
"(",
"!",
"mittoObject",
")",
"{",
"return",
"configObject",
";",
"}",
"if",
"(",
"!",
"configO... | Validate the consuming user's present config to ensure it meets the product producer's .mitto syntatical specifications | [
"Validate",
"the",
"consuming",
"user",
"s",
"present",
"config",
"to",
"ensure",
"it",
"meets",
"the",
"product",
"producer",
"s",
".",
"mitto",
"syntatical",
"specifications"
] | a58cd439b67b626522078b8003a82a348103a66c | https://github.com/dggriffin/mitto/blob/a58cd439b67b626522078b8003a82a348103a66c/lib/index.js#L126-L159 |
57,010 | yoshuawuyts/urit | index.js | parse | function parse (tmpl) {
tmpl = tmpl || ''
const parser = uritemplate.parse(tmpl)
return function expand (params) {
params = params || {}
return parser.expand(params)
}
} | javascript | function parse (tmpl) {
tmpl = tmpl || ''
const parser = uritemplate.parse(tmpl)
return function expand (params) {
params = params || {}
return parser.expand(params)
}
} | [
"function",
"parse",
"(",
"tmpl",
")",
"{",
"tmpl",
"=",
"tmpl",
"||",
"''",
"const",
"parser",
"=",
"uritemplate",
".",
"parse",
"(",
"tmpl",
")",
"return",
"function",
"expand",
"(",
"params",
")",
"{",
"params",
"=",
"params",
"||",
"{",
"}",
"ret... | parse a uri template str -> str | [
"parse",
"a",
"uri",
"template",
"str",
"-",
">",
"str"
] | 9f3c9a06a93c509189d9bf9876c5f4d77ee2776e | https://github.com/yoshuawuyts/urit/blob/9f3c9a06a93c509189d9bf9876c5f4d77ee2776e/index.js#L7-L15 |
57,011 | imlucas/node-stor | stores/localstorage.js | prostrate | function prostrate(source){
return function(method, transform){
transform = transform || {};
return function(){
var args = Array.prototype.slice.call(arguments, 0),
fn = args.pop(),
res,
last;
if(args[0] && ['removeItem', 'getItem', 'setItem'].indexOf(method) > -1){
... | javascript | function prostrate(source){
return function(method, transform){
transform = transform || {};
return function(){
var args = Array.prototype.slice.call(arguments, 0),
fn = args.pop(),
res,
last;
if(args[0] && ['removeItem', 'getItem', 'setItem'].indexOf(method) > -1){
... | [
"function",
"prostrate",
"(",
"source",
")",
"{",
"return",
"function",
"(",
"method",
",",
"transform",
")",
"{",
"transform",
"=",
"transform",
"||",
"{",
"}",
";",
"return",
"function",
"(",
")",
"{",
"var",
"args",
"=",
"Array",
".",
"prototype",
"... | Make local storage async, get and set JSON-ify. | [
"Make",
"local",
"storage",
"async",
"get",
"and",
"set",
"JSON",
"-",
"ify",
"."
] | 6b74af52bf160873658bc3570db716d44c33f335 | https://github.com/imlucas/node-stor/blob/6b74af52bf160873658bc3570db716d44c33f335/stores/localstorage.js#L5-L50 |
57,012 | ayecue/node-klass | src/klass/Logger.js | function(args){
return forEach(args,function(_,item){
var messages = this.result,
type = typeof item;
if (type == 'string') {
messages.push('%s');
} else if (type == 'number') {
messages.push('%d');
} else if (type == 'boolean') {
messages.push('%s');
} else {
messages.p... | javascript | function(args){
return forEach(args,function(_,item){
var messages = this.result,
type = typeof item;
if (type == 'string') {
messages.push('%s');
} else if (type == 'number') {
messages.push('%d');
} else if (type == 'boolean') {
messages.push('%s');
} else {
messages.p... | [
"function",
"(",
"args",
")",
"{",
"return",
"forEach",
"(",
"args",
",",
"function",
"(",
"_",
",",
"item",
")",
"{",
"var",
"messages",
"=",
"this",
".",
"result",
",",
"type",
"=",
"typeof",
"item",
";",
"if",
"(",
"type",
"==",
"'string'",
")",... | Generating console message templates | [
"Generating",
"console",
"message",
"templates"
] | d0583db943bfc6186e45d205735bebd88828e117 | https://github.com/ayecue/node-klass/blob/d0583db943bfc6186e45d205735bebd88828e117/src/klass/Logger.js#L57-L72 | |
57,013 | ayecue/node-klass | src/klass/Logger.js | function(context,args,error,color){
var me = this,
base = context.getCalledKlass(),
contextName = base ? base.getName() : CONSTANTS.LOGGER.UNKNOWN_NAME,
methodName = context.getCalledName() || CONSTANTS.LOGGER.ANONYMOUS_NAME,
messages = me.toMessages(args);
color = color || (error ? CONSTANTS.LOG... | javascript | function(context,args,error,color){
var me = this,
base = context.getCalledKlass(),
contextName = base ? base.getName() : CONSTANTS.LOGGER.UNKNOWN_NAME,
methodName = context.getCalledName() || CONSTANTS.LOGGER.ANONYMOUS_NAME,
messages = me.toMessages(args);
color = color || (error ? CONSTANTS.LOG... | [
"function",
"(",
"context",
",",
"args",
",",
"error",
",",
"color",
")",
"{",
"var",
"me",
"=",
"this",
",",
"base",
"=",
"context",
".",
"getCalledKlass",
"(",
")",
",",
"contextName",
"=",
"base",
"?",
"base",
".",
"getName",
"(",
")",
":",
"CON... | Default print function to show context messages | [
"Default",
"print",
"function",
"to",
"show",
"context",
"messages"
] | d0583db943bfc6186e45d205735bebd88828e117 | https://github.com/ayecue/node-klass/blob/d0583db943bfc6186e45d205735bebd88828e117/src/klass/Logger.js#L77-L99 | |
57,014 | taf2/tiamat | lib/tiamat/server.js | resetWorker | function resetWorker() {
sigqueue = [];
mastersigs.forEach(process.removeAllListeners.bind(process));
process.removeAllListeners('exit');
process.env.TIAMAT = '1';
} | javascript | function resetWorker() {
sigqueue = [];
mastersigs.forEach(process.removeAllListeners.bind(process));
process.removeAllListeners('exit');
process.env.TIAMAT = '1';
} | [
"function",
"resetWorker",
"(",
")",
"{",
"sigqueue",
"=",
"[",
"]",
";",
"mastersigs",
".",
"forEach",
"(",
"process",
".",
"removeAllListeners",
".",
"bind",
"(",
"process",
")",
")",
";",
"process",
".",
"removeAllListeners",
"(",
"'exit'",
")",
";",
... | unregister events setup by master | [
"unregister",
"events",
"setup",
"by",
"master"
] | f51a33bb94897bc5c9e1849990b418d0bfe49e48 | https://github.com/taf2/tiamat/blob/f51a33bb94897bc5c9e1849990b418d0bfe49e48/lib/tiamat/server.js#L227-L232 |
57,015 | chrisenytc/gngb-api | lib/gngb-api.js | function (res, name, version) {
//Options
var imgPath, width;
//RegExp
var re = /^\d\.\d.\d$/;
//Test version
if (re.test(version)) {
imgPath = path.join(dir, name + '.png');
width = 76;
} else if (version.length === 6) {
imgPath = path.join(dir, name + '-larger.png');
width = 80;
} else... | javascript | function (res, name, version) {
//Options
var imgPath, width;
//RegExp
var re = /^\d\.\d.\d$/;
//Test version
if (re.test(version)) {
imgPath = path.join(dir, name + '.png');
width = 76;
} else if (version.length === 6) {
imgPath = path.join(dir, name + '-larger.png');
width = 80;
} else... | [
"function",
"(",
"res",
",",
"name",
",",
"version",
")",
"{",
"//Options",
"var",
"imgPath",
",",
"width",
";",
"//RegExp",
"var",
"re",
"=",
"/",
"^\\d\\.\\d.\\d$",
"/",
";",
"//Test version",
"if",
"(",
"re",
".",
"test",
"(",
"version",
")",
")",
... | Create version badge | [
"Create",
"version",
"badge"
] | 020e8c9cb899fb3df0da452151d7afb5e6be78f5 | https://github.com/chrisenytc/gngb-api/blob/020e8c9cb899fb3df0da452151d7afb5e6be78f5/lib/gngb-api.js#L43-L71 | |
57,016 | chrisenytc/gngb-api | lib/gngb-api.js | function (service, name, user) {
//
var services = [];
//
services['gh'] = 'https://api.github.com/repos/:user/:name/releases';
services['npm'] = 'http://registry.npmjs.org/:name/latest';
services['gem'] = 'https://rubygems.org/api/v1/gems/:name.json';
services['bower'] = 'https://api.github.com/repos/:us... | javascript | function (service, name, user) {
//
var services = [];
//
services['gh'] = 'https://api.github.com/repos/:user/:name/releases';
services['npm'] = 'http://registry.npmjs.org/:name/latest';
services['gem'] = 'https://rubygems.org/api/v1/gems/:name.json';
services['bower'] = 'https://api.github.com/repos/:us... | [
"function",
"(",
"service",
",",
"name",
",",
"user",
")",
"{",
"//",
"var",
"services",
"=",
"[",
"]",
";",
"//",
"services",
"[",
"'gh'",
"]",
"=",
"'https://api.github.com/repos/:user/:name/releases'",
";",
"services",
"[",
"'npm'",
"]",
"=",
"'http://reg... | Get formated service url | [
"Get",
"formated",
"service",
"url"
] | 020e8c9cb899fb3df0da452151d7afb5e6be78f5 | https://github.com/chrisenytc/gngb-api/blob/020e8c9cb899fb3df0da452151d7afb5e6be78f5/lib/gngb-api.js#L74-L87 | |
57,017 | chrisenytc/gngb-api | lib/gngb-api.js | function (service, data) {
switch (service) {
case 'gh':
return data[0].tag_name.replace(/^v/, '');
case 'npm':
return data.version;
case 'gem':
return data.version;
case 'bower':
return data[0].tag_name.replace(/^v/, '');
default:
console.log(service + 'not found!');
break;
}
} | javascript | function (service, data) {
switch (service) {
case 'gh':
return data[0].tag_name.replace(/^v/, '');
case 'npm':
return data.version;
case 'gem':
return data.version;
case 'bower':
return data[0].tag_name.replace(/^v/, '');
default:
console.log(service + 'not found!');
break;
}
} | [
"function",
"(",
"service",
",",
"data",
")",
"{",
"switch",
"(",
"service",
")",
"{",
"case",
"'gh'",
":",
"return",
"data",
"[",
"0",
"]",
".",
"tag_name",
".",
"replace",
"(",
"/",
"^v",
"/",
",",
"''",
")",
";",
"case",
"'npm'",
":",
"return"... | Get data and format version | [
"Get",
"data",
"and",
"format",
"version"
] | 020e8c9cb899fb3df0da452151d7afb5e6be78f5 | https://github.com/chrisenytc/gngb-api/blob/020e8c9cb899fb3df0da452151d7afb5e6be78f5/lib/gngb-api.js#L90-L104 | |
57,018 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/resourcemanager.js | function( names, callback, scope ) {
// Ensure that we have an array of names.
if ( !CKEDITOR.tools.isArray( names ) )
names = names ? [ names ] : [];
var loaded = this.loaded,
registered = this.registered,
urls = [],
urlsNames = {},
resources = {};
// Loop through all names.
for ( var i = 0;... | javascript | function( names, callback, scope ) {
// Ensure that we have an array of names.
if ( !CKEDITOR.tools.isArray( names ) )
names = names ? [ names ] : [];
var loaded = this.loaded,
registered = this.registered,
urls = [],
urlsNames = {},
resources = {};
// Loop through all names.
for ( var i = 0;... | [
"function",
"(",
"names",
",",
"callback",
",",
"scope",
")",
"{",
"// Ensure that we have an array of names.",
"if",
"(",
"!",
"CKEDITOR",
".",
"tools",
".",
"isArray",
"(",
"names",
")",
")",
"names",
"=",
"names",
"?",
"[",
"names",
"]",
":",
"[",
"]"... | Loads one or more resources.
CKEDITOR.plugins.load( 'myplugin', function( plugins ) {
alert( plugins[ 'myplugin' ] ); // object
} );
@param {String/Array} name The name of the resource to load. It may be a
string with a single resource name, or an array with several names.
@param {Function} callback A function to be ... | [
"Loads",
"one",
"or",
"more",
"resources",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/resourcemanager.js#L179-L227 | |
57,019 | bengreenier/lconf | Parser.js | load | function load(file) {
if (path.extname(file) === ".yaml" || path.extname(file) === ".yml") {
return yaml.safeLoad(fs.readFileSync(file));
} else if (path.extname(file) === ".json") {
var r = JSON.parse(fs.readFileSync(file));
return r;
} else if (path.extname(file) === ".js") {
... | javascript | function load(file) {
if (path.extname(file) === ".yaml" || path.extname(file) === ".yml") {
return yaml.safeLoad(fs.readFileSync(file));
} else if (path.extname(file) === ".json") {
var r = JSON.parse(fs.readFileSync(file));
return r;
} else if (path.extname(file) === ".js") {
... | [
"function",
"load",
"(",
"file",
")",
"{",
"if",
"(",
"path",
".",
"extname",
"(",
"file",
")",
"===",
"\".yaml\"",
"||",
"path",
".",
"extname",
"(",
"file",
")",
"===",
"\".yml\"",
")",
"{",
"return",
"yaml",
".",
"safeLoad",
"(",
"fs",
".",
"rea... | Does the actual file parsing | [
"Does",
"the",
"actual",
"file",
"parsing"
] | 212b7e15dc18585be99600a505b35fe94f9758ea | https://github.com/bengreenier/lconf/blob/212b7e15dc18585be99600a505b35fe94f9758ea/Parser.js#L59-L79 |
57,020 | bjnortier/triptych | build/events/EventGenerator.js | addOffset | function addOffset(element, event) {
event.offsetX = Math.round(event.pageX - element.offset().left);
event.offsetY = Math.round(event.pageY - element.offset().top);
return event;
} | javascript | function addOffset(element, event) {
event.offsetX = Math.round(event.pageX - element.offset().left);
event.offsetY = Math.round(event.pageY - element.offset().top);
return event;
} | [
"function",
"addOffset",
"(",
"element",
",",
"event",
")",
"{",
"event",
".",
"offsetX",
"=",
"Math",
".",
"round",
"(",
"event",
".",
"pageX",
"-",
"element",
".",
"offset",
"(",
")",
".",
"left",
")",
";",
"event",
".",
"offsetY",
"=",
"Math",
"... | Add offset support to all browsers | [
"Add",
"offset",
"support",
"to",
"all",
"browsers"
] | 3f61ac1b74842ac48d8a1eaef9e71becbcfb1e8a | https://github.com/bjnortier/triptych/blob/3f61ac1b74842ac48d8a1eaef9e71becbcfb1e8a/build/events/EventGenerator.js#L9-L13 |
57,021 | oskarhagberg/gbgcity | lib/traveltime.js | getRoute | function getRoute(id, params, callback) {
params = params || {};
core.callApiWithPathSegment('/TravelTimesService/v1.0/Routes', id, params, callback);
} | javascript | function getRoute(id, params, callback) {
params = params || {};
core.callApiWithPathSegment('/TravelTimesService/v1.0/Routes', id, params, callback);
} | [
"function",
"getRoute",
"(",
"id",
",",
"params",
",",
"callback",
")",
"{",
"params",
"=",
"params",
"||",
"{",
"}",
";",
"core",
".",
"callApiWithPathSegment",
"(",
"'/TravelTimesService/v1.0/Routes'",
",",
"id",
",",
"params",
",",
"callback",
")",
";",
... | Returns a route
@memberof module:gbgcity/TravelTime
@param {String} id The id of the route
@param {Object} [params] An object containing additional parameters.
@param {Function} callback The function to call with results, function({Error} error, {Object} results)/
@see http://data.goteborg.se/TravelTimesService/v1.0/h... | [
"Returns",
"a",
"route"
] | d2de903b2fba83cc953ae218905380fef080cb2d | https://github.com/oskarhagberg/gbgcity/blob/d2de903b2fba83cc953ae218905380fef080cb2d/lib/traveltime.js#L27-L30 |
57,022 | scazan/taskengine | taskengine.js | readTasks | function readTasks(err, data, callback) {
this.tasks = JSON.parse(data);
var sortedTasks = _.sortBy(this.tasks, function(task) { return parseInt(task.id, 10); });
largestID = sortedTasks[sortedTasks.length-1].id;
if(callback) {
callback(err, this);
}
} | javascript | function readTasks(err, data, callback) {
this.tasks = JSON.parse(data);
var sortedTasks = _.sortBy(this.tasks, function(task) { return parseInt(task.id, 10); });
largestID = sortedTasks[sortedTasks.length-1].id;
if(callback) {
callback(err, this);
}
} | [
"function",
"readTasks",
"(",
"err",
",",
"data",
",",
"callback",
")",
"{",
"this",
".",
"tasks",
"=",
"JSON",
".",
"parse",
"(",
"data",
")",
";",
"var",
"sortedTasks",
"=",
"_",
".",
"sortBy",
"(",
"this",
".",
"tasks",
",",
"function",
"(",
"ta... | Parse the tasks from a string and set the global tasks array
@param err
@param {String} data
@param {function} callback
@return {undefined} | [
"Parse",
"the",
"tasks",
"from",
"a",
"string",
"and",
"set",
"the",
"global",
"tasks",
"array"
] | 0fa7d67f8d33f03fdc10174561110660963a52db | https://github.com/scazan/taskengine/blob/0fa7d67f8d33f03fdc10174561110660963a52db/taskengine.js#L56-L65 |
57,023 | scazan/taskengine | taskengine.js | addTask | function addTask(taskData, subTaskData) {
var subTaskList,
parsedData,
subTask = false;
if(taskData !== undefined) {
if(parseInt(taskData,10) > -1) {
subTaskList = this.getTaskByID(parseInt(taskData,10)).subTasks;
parsedData = this.parseInputData(subTaskData);
subTask = true;
}
... | javascript | function addTask(taskData, subTaskData) {
var subTaskList,
parsedData,
subTask = false;
if(taskData !== undefined) {
if(parseInt(taskData,10) > -1) {
subTaskList = this.getTaskByID(parseInt(taskData,10)).subTasks;
parsedData = this.parseInputData(subTaskData);
subTask = true;
}
... | [
"function",
"addTask",
"(",
"taskData",
",",
"subTaskData",
")",
"{",
"var",
"subTaskList",
",",
"parsedData",
",",
"subTask",
"=",
"false",
";",
"if",
"(",
"taskData",
"!==",
"undefined",
")",
"{",
"if",
"(",
"parseInt",
"(",
"taskData",
",",
"10",
")",... | Add the given task to our array
@param taskData
@param callback
@return {undefined} | [
"Add",
"the",
"given",
"task",
"to",
"our",
"array"
] | 0fa7d67f8d33f03fdc10174561110660963a52db | https://github.com/scazan/taskengine/blob/0fa7d67f8d33f03fdc10174561110660963a52db/taskengine.js#L124-L162 |
57,024 | scazan/taskengine | taskengine.js | closeTask | function closeTask(taskID) {
taskID = parseInt(taskID, 10);
var task = this.getTaskByID(taskID);
if(task) {
task.open = false;
console.log('closing:');
return task;
}
else {
return false;
}
} | javascript | function closeTask(taskID) {
taskID = parseInt(taskID, 10);
var task = this.getTaskByID(taskID);
if(task) {
task.open = false;
console.log('closing:');
return task;
}
else {
return false;
}
} | [
"function",
"closeTask",
"(",
"taskID",
")",
"{",
"taskID",
"=",
"parseInt",
"(",
"taskID",
",",
"10",
")",
";",
"var",
"task",
"=",
"this",
".",
"getTaskByID",
"(",
"taskID",
")",
";",
"if",
"(",
"task",
")",
"{",
"task",
".",
"open",
"=",
"false"... | Set a task as "done" or "closed"
@return {undefined} | [
"Set",
"a",
"task",
"as",
"done",
"or",
"closed"
] | 0fa7d67f8d33f03fdc10174561110660963a52db | https://github.com/scazan/taskengine/blob/0fa7d67f8d33f03fdc10174561110660963a52db/taskengine.js#L214-L228 |
57,025 | sigmaframeworks/sigma-libs | src/phonelib.js | getExample | function getExample(countryCode, numberType, national) {
try {
var phoneUtil = i18n.phonenumbers.PhoneNumberUtil.getInstance();
var numberObj = phoneUtil.getExampleNumberForType(countryCode, numberType);
var format = (national) ? i18n.phonenumbers.PhoneNumberFormat.NATIONAL : i18n.phonenumbe... | javascript | function getExample(countryCode, numberType, national) {
try {
var phoneUtil = i18n.phonenumbers.PhoneNumberUtil.getInstance();
var numberObj = phoneUtil.getExampleNumberForType(countryCode, numberType);
var format = (national) ? i18n.phonenumbers.PhoneNumberFormat.NATIONAL : i18n.phonenumbe... | [
"function",
"getExample",
"(",
"countryCode",
",",
"numberType",
",",
"national",
")",
"{",
"try",
"{",
"var",
"phoneUtil",
"=",
"i18n",
".",
"phonenumbers",
".",
"PhoneNumberUtil",
".",
"getInstance",
"(",
")",
";",
"var",
"numberObj",
"=",
"phoneUtil",
"."... | get an example number for the given country code | [
"get",
"an",
"example",
"number",
"for",
"the",
"given",
"country",
"code"
] | a2a835bad8f9e08d32a9d4541a14b13a3fed4055 | https://github.com/sigmaframeworks/sigma-libs/blob/a2a835bad8f9e08d32a9d4541a14b13a3fed4055/src/phonelib.js#L18-L27 |
57,026 | sigmaframeworks/sigma-libs | src/phonelib.js | format | function format(number, countryCode, type) {
try {
var phoneUtil = i18n.phonenumbers.PhoneNumberUtil.getInstance();
var numberObj = phoneUtil.parseAndKeepRawInput(number, countryCode || '');
type = (typeof type == "undefined") ? i18n.phonenumbers.PhoneNumberFormat.INTERNATIONAL : type;
... | javascript | function format(number, countryCode, type) {
try {
var phoneUtil = i18n.phonenumbers.PhoneNumberUtil.getInstance();
var numberObj = phoneUtil.parseAndKeepRawInput(number, countryCode || '');
type = (typeof type == "undefined") ? i18n.phonenumbers.PhoneNumberFormat.INTERNATIONAL : type;
... | [
"function",
"format",
"(",
"number",
",",
"countryCode",
",",
"type",
")",
"{",
"try",
"{",
"var",
"phoneUtil",
"=",
"i18n",
".",
"phonenumbers",
".",
"PhoneNumberUtil",
".",
"getInstance",
"(",
")",
";",
"var",
"numberObj",
"=",
"phoneUtil",
".",
"parseAn... | format the given number to the given type | [
"format",
"the",
"given",
"number",
"to",
"the",
"given",
"type"
] | a2a835bad8f9e08d32a9d4541a14b13a3fed4055 | https://github.com/sigmaframeworks/sigma-libs/blob/a2a835bad8f9e08d32a9d4541a14b13a3fed4055/src/phonelib.js#L31-L43 |
57,027 | sigmaframeworks/sigma-libs | src/phonelib.js | isValid | function isValid(number, countryCode) {
try {
var phoneUtil = i18n.phonenumbers.PhoneNumberUtil.getInstance();
var numberObj = phoneUtil.parseAndKeepRawInput(number, countryCode);
return phoneUtil.isValidNumber(numberObj);
} catch (e) {
return false;
}
} | javascript | function isValid(number, countryCode) {
try {
var phoneUtil = i18n.phonenumbers.PhoneNumberUtil.getInstance();
var numberObj = phoneUtil.parseAndKeepRawInput(number, countryCode);
return phoneUtil.isValidNumber(numberObj);
} catch (e) {
return false;
}
} | [
"function",
"isValid",
"(",
"number",
",",
"countryCode",
")",
"{",
"try",
"{",
"var",
"phoneUtil",
"=",
"i18n",
".",
"phonenumbers",
".",
"PhoneNumberUtil",
".",
"getInstance",
"(",
")",
";",
"var",
"numberObj",
"=",
"phoneUtil",
".",
"parseAndKeepRawInput",
... | check if given number is valid | [
"check",
"if",
"given",
"number",
"is",
"valid"
] | a2a835bad8f9e08d32a9d4541a14b13a3fed4055 | https://github.com/sigmaframeworks/sigma-libs/blob/a2a835bad8f9e08d32a9d4541a14b13a3fed4055/src/phonelib.js#L109-L117 |
57,028 | raincatcher-beta/raincatcher-file-angular | lib/file-client/index.js | create | function create(fileToCreate) {
//Creating a unique channel to get the response
var topicUid = shortid.generate();
var topicParams = {topicUid: topicUid, itemToCreate: fileToCreate};
var donePromise = mediator.promise(fileSubscribers.getTopic(CONSTANTS.TOPICS.CREATE, CONSTANTS.DONE_PREFIX, topicUid));
var err... | javascript | function create(fileToCreate) {
//Creating a unique channel to get the response
var topicUid = shortid.generate();
var topicParams = {topicUid: topicUid, itemToCreate: fileToCreate};
var donePromise = mediator.promise(fileSubscribers.getTopic(CONSTANTS.TOPICS.CREATE, CONSTANTS.DONE_PREFIX, topicUid));
var err... | [
"function",
"create",
"(",
"fileToCreate",
")",
"{",
"//Creating a unique channel to get the response",
"var",
"topicUid",
"=",
"shortid",
".",
"generate",
"(",
")",
";",
"var",
"topicParams",
"=",
"{",
"topicUid",
":",
"topicUid",
",",
"itemToCreate",
":",
"fileT... | Creating a new file.
@param {object} fileToCreate - The File to create. | [
"Creating",
"a",
"new",
"file",
"."
] | a76d406ca62d6c29da3caf94cc9db75f343ec797 | https://github.com/raincatcher-beta/raincatcher-file-angular/blob/a76d406ca62d6c29da3caf94cc9db75f343ec797/lib/file-client/index.js#L40-L49 |
57,029 | raincatcher-beta/raincatcher-file-angular | lib/file-client/index.js | list | function list() {
var donePromise = mediator.promise(fileSubscribers.getTopic(CONSTANTS.TOPICS.LIST, CONSTANTS.DONE_PREFIX));
var errorPromise = mediator.promise(fileSubscribers.getTopic(CONSTANTS.TOPICS.LIST, CONSTANTS.ERROR_PREFIX));
mediator.publish(fileSubscribers.getTopic(CONSTANTS.TOPICS.LIST));
return g... | javascript | function list() {
var donePromise = mediator.promise(fileSubscribers.getTopic(CONSTANTS.TOPICS.LIST, CONSTANTS.DONE_PREFIX));
var errorPromise = mediator.promise(fileSubscribers.getTopic(CONSTANTS.TOPICS.LIST, CONSTANTS.ERROR_PREFIX));
mediator.publish(fileSubscribers.getTopic(CONSTANTS.TOPICS.LIST));
return g... | [
"function",
"list",
"(",
")",
"{",
"var",
"donePromise",
"=",
"mediator",
".",
"promise",
"(",
"fileSubscribers",
".",
"getTopic",
"(",
"CONSTANTS",
".",
"TOPICS",
".",
"LIST",
",",
"CONSTANTS",
".",
"DONE_PREFIX",
")",
")",
";",
"var",
"errorPromise",
"="... | Listing All Files | [
"Listing",
"All",
"Files"
] | a76d406ca62d6c29da3caf94cc9db75f343ec797 | https://github.com/raincatcher-beta/raincatcher-file-angular/blob/a76d406ca62d6c29da3caf94cc9db75f343ec797/lib/file-client/index.js#L54-L60 |
57,030 | thomasmodeneis/soundcloudnodejs | soundcloudnodejs.js | addTrack | function addTrack(options) {
return new Promise(function (resolve, reject) {
var form = new FormData();
form.append('format', 'json');
if (!options.title) {
reject('Error while addTrack track options.title is required but is null');
} else {
form.append('trac... | javascript | function addTrack(options) {
return new Promise(function (resolve, reject) {
var form = new FormData();
form.append('format', 'json');
if (!options.title) {
reject('Error while addTrack track options.title is required but is null');
} else {
form.append('trac... | [
"function",
"addTrack",
"(",
"options",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"var",
"form",
"=",
"new",
"FormData",
"(",
")",
";",
"form",
".",
"append",
"(",
"'format'",
",",
"'json'",
")",
... | Add a new track
@param options
@param cb
@returns {*} | [
"Add",
"a",
"new",
"track"
] | b52461cdb6cafbe84c3b7ff367196fb03ad27afd | https://github.com/thomasmodeneis/soundcloudnodejs/blob/b52461cdb6cafbe84c3b7ff367196fb03ad27afd/soundcloudnodejs.js#L28-L104 |
57,031 | thomasmodeneis/soundcloudnodejs | soundcloudnodejs.js | removeAllTracks | function removeAllTracks(tracks, token, count, callback) {
var track = tracks[count];
if (!track) {
return callback('done');
}
var options = {
id: track.id,
oauth_token: token.oauth_token
};
removeTrack(options).then(function (track) {
if (DEBUG_MODE_ON) {
... | javascript | function removeAllTracks(tracks, token, count, callback) {
var track = tracks[count];
if (!track) {
return callback('done');
}
var options = {
id: track.id,
oauth_token: token.oauth_token
};
removeTrack(options).then(function (track) {
if (DEBUG_MODE_ON) {
... | [
"function",
"removeAllTracks",
"(",
"tracks",
",",
"token",
",",
"count",
",",
"callback",
")",
"{",
"var",
"track",
"=",
"tracks",
"[",
"count",
"]",
";",
"if",
"(",
"!",
"track",
")",
"{",
"return",
"callback",
"(",
"'done'",
")",
";",
"}",
"var",
... | Remove all tracks for a account.
@param tracks
@param token
@param count
@param callback | [
"Remove",
"all",
"tracks",
"for",
"a",
"account",
"."
] | b52461cdb6cafbe84c3b7ff367196fb03ad27afd | https://github.com/thomasmodeneis/soundcloudnodejs/blob/b52461cdb6cafbe84c3b7ff367196fb03ad27afd/soundcloudnodejs.js#L147-L170 |
57,032 | thomasmodeneis/soundcloudnodejs | soundcloudnodejs.js | searchTrack_q | function searchTrack_q(options) {
return new Promise(function (resolve, reject) {
if (!options.oauth_token) {
reject(new Error('Error searchTrack_q oauth_token is required and is null '));
} else {
if (!options.q) {
reject(new Error('Error searchTrack_q optio... | javascript | function searchTrack_q(options) {
return new Promise(function (resolve, reject) {
if (!options.oauth_token) {
reject(new Error('Error searchTrack_q oauth_token is required and is null '));
} else {
if (!options.q) {
reject(new Error('Error searchTrack_q optio... | [
"function",
"searchTrack_q",
"(",
"options",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"if",
"(",
"!",
"options",
".",
"oauth_token",
")",
"{",
"reject",
"(",
"new",
"Error",
"(",
"'Error searchTrack_q ... | Search for a track
@param options
@returns {bluebird|exports|module.exports} | [
"Search",
"for",
"a",
"track"
] | b52461cdb6cafbe84c3b7ff367196fb03ad27afd | https://github.com/thomasmodeneis/soundcloudnodejs/blob/b52461cdb6cafbe84c3b7ff367196fb03ad27afd/soundcloudnodejs.js#L213-L247 |
57,033 | thomasmodeneis/soundcloudnodejs | soundcloudnodejs.js | resolveUri | function resolveUri(options) {
return new Promise(function (resolve, reject) {
if (!options.client_id) {
reject(new Error('Error resolveUri options.client_id is required but is null'));
} else {
if (!options.uri) {
throw new Error('Error resolveUri options.ur... | javascript | function resolveUri(options) {
return new Promise(function (resolve, reject) {
if (!options.client_id) {
reject(new Error('Error resolveUri options.client_id is required but is null'));
} else {
if (!options.uri) {
throw new Error('Error resolveUri options.ur... | [
"function",
"resolveUri",
"(",
"options",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"if",
"(",
"!",
"options",
".",
"client_id",
")",
"{",
"reject",
"(",
"new",
"Error",
"(",
"'Error resolveUri options.... | Resolve a URI
@param options
@returns {bluebird|exports|module.exports} | [
"Resolve",
"a",
"URI"
] | b52461cdb6cafbe84c3b7ff367196fb03ad27afd | https://github.com/thomasmodeneis/soundcloudnodejs/blob/b52461cdb6cafbe84c3b7ff367196fb03ad27afd/soundcloudnodejs.js#L254-L295 |
57,034 | thomasmodeneis/soundcloudnodejs | soundcloudnodejs.js | addTrackToNewPlaylist | function addTrackToNewPlaylist(options) {
return new Promise(function (resolve, reject) {
var form = new FormData();
form.append('format', 'json');
if (!options.tracks) {
return reject('Error while addTrackToNewPlaylist options.tracks is null');
} else {
_.ea... | javascript | function addTrackToNewPlaylist(options) {
return new Promise(function (resolve, reject) {
var form = new FormData();
form.append('format', 'json');
if (!options.tracks) {
return reject('Error while addTrackToNewPlaylist options.tracks is null');
} else {
_.ea... | [
"function",
"addTrackToNewPlaylist",
"(",
"options",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"var",
"form",
"=",
"new",
"FormData",
"(",
")",
";",
"form",
".",
"append",
"(",
"'format'",
",",
"'json... | Add track to new playlist
@param options
@param cb
@returns {*} | [
"Add",
"track",
"to",
"new",
"playlist"
] | b52461cdb6cafbe84c3b7ff367196fb03ad27afd | https://github.com/thomasmodeneis/soundcloudnodejs/blob/b52461cdb6cafbe84c3b7ff367196fb03ad27afd/soundcloudnodejs.js#L377-L436 |
57,035 | thomasmodeneis/soundcloudnodejs | soundcloudnodejs.js | getPlaylist | function getPlaylist(options) {
return new Promise(function (resolve, reject) {
if (!options.oauth_token) {
reject(new Error('Error oauth_token is required, but is null'));
} else {
var uri = 'https://api.soundcloud.com/me/playlists?format=json&oauth_token=' + options.oauth_... | javascript | function getPlaylist(options) {
return new Promise(function (resolve, reject) {
if (!options.oauth_token) {
reject(new Error('Error oauth_token is required, but is null'));
} else {
var uri = 'https://api.soundcloud.com/me/playlists?format=json&oauth_token=' + options.oauth_... | [
"function",
"getPlaylist",
"(",
"options",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"if",
"(",
"!",
"options",
".",
"oauth_token",
")",
"{",
"reject",
"(",
"new",
"Error",
"(",
"'Error oauth_token is r... | Get a playlist
@param options
@returns {bluebird|exports|module.exports} | [
"Get",
"a",
"playlist"
] | b52461cdb6cafbe84c3b7ff367196fb03ad27afd | https://github.com/thomasmodeneis/soundcloudnodejs/blob/b52461cdb6cafbe84c3b7ff367196fb03ad27afd/soundcloudnodejs.js#L443-L473 |
57,036 | thomasmodeneis/soundcloudnodejs | soundcloudnodejs.js | getToken | function getToken(options) {
return new Promise(function (resolve) {
var curl_options = {
'url': 'https://api.soundcloud.com/oauth2/token',
'method': 'POST',
verbose: true,
encoding: 'utf8',
data: options,
timeout: 10000
};
... | javascript | function getToken(options) {
return new Promise(function (resolve) {
var curl_options = {
'url': 'https://api.soundcloud.com/oauth2/token',
'method': 'POST',
verbose: true,
encoding: 'utf8',
data: options,
timeout: 10000
};
... | [
"function",
"getToken",
"(",
"options",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
")",
"{",
"var",
"curl_options",
"=",
"{",
"'url'",
":",
"'https://api.soundcloud.com/oauth2/token'",
",",
"'method'",
":",
"'POST'",
",",
"verbose",
... | Get a fresh token, need to be use with caution as SoundCloud will allow you to get very few tokens
Its smart to save your tokens and re-use it along your code
@param options
@returns {bluebird|exports|module.exports} | [
"Get",
"a",
"fresh",
"token",
"need",
"to",
"be",
"use",
"with",
"caution",
"as",
"SoundCloud",
"will",
"allow",
"you",
"to",
"get",
"very",
"few",
"tokens",
"Its",
"smart",
"to",
"save",
"your",
"tokens",
"and",
"re",
"-",
"use",
"it",
"along",
"your"... | b52461cdb6cafbe84c3b7ff367196fb03ad27afd | https://github.com/thomasmodeneis/soundcloudnodejs/blob/b52461cdb6cafbe84c3b7ff367196fb03ad27afd/soundcloudnodejs.js#L558-L593 |
57,037 | thanhpk/vue2-strap | dist/dropdownhover.js | DropdownHover | function DropdownHover($elem, options) {
var args = arguments;
// Is the first parameter an object (options), or was omitted,
// instantiate a new instance of the plugin.
if (options === undefined || typeof options === 'object') {
// This allows the plugin to be called with $.fn.bootstrapDropdownHover();
if (!... | javascript | function DropdownHover($elem, options) {
var args = arguments;
// Is the first parameter an object (options), or was omitted,
// instantiate a new instance of the plugin.
if (options === undefined || typeof options === 'object') {
// This allows the plugin to be called with $.fn.bootstrapDropdownHover();
if (!... | [
"function",
"DropdownHover",
"(",
"$elem",
",",
"options",
")",
"{",
"var",
"args",
"=",
"arguments",
";",
"// Is the first parameter an object (options), or was omitted,",
"// instantiate a new instance of the plugin.",
"if",
"(",
"options",
"===",
"undefined",
"||",
"type... | A really lightweight plugin wrapper around the constructor, preventing against multiple instantiations | [
"A",
"really",
"lightweight",
"plugin",
"wrapper",
"around",
"the",
"constructor",
"preventing",
"against",
"multiple",
"instantiations"
] | 44e93ce3c985b31aa7ccb11f67842914ddb6013f | https://github.com/thanhpk/vue2-strap/blob/44e93ce3c985b31aa7ccb11f67842914ddb6013f/dist/dropdownhover.js#L162-L220 |
57,038 | Barandis/xduce | src/modules/reduction.js | init | function init(collection) {
switch (true) {
case isImplemented(collection, 'init'):
return collection[p.init];
case isString(collection):
return () => '';
case isArray(collection):
return () => [];
case isObject(collection):
return () => ({});
case isFunction(collection):
... | javascript | function init(collection) {
switch (true) {
case isImplemented(collection, 'init'):
return collection[p.init];
case isString(collection):
return () => '';
case isArray(collection):
return () => [];
case isObject(collection):
return () => ({});
case isFunction(collection):
... | [
"function",
"init",
"(",
"collection",
")",
"{",
"switch",
"(",
"true",
")",
"{",
"case",
"isImplemented",
"(",
"collection",
",",
"'init'",
")",
":",
"return",
"collection",
"[",
"p",
".",
"init",
"]",
";",
"case",
"isString",
"(",
"collection",
")",
... | Returns an init function for a collection. This is a function that returns a new, empty instance of the collection in
question. If the collection doesn't support reduction, `null` is returned. This makes conditionals a bit easier to
work with.
In order to support the conversion of functions into reducers, function sup... | [
"Returns",
"an",
"init",
"function",
"for",
"a",
"collection",
".",
"This",
"is",
"a",
"function",
"that",
"returns",
"a",
"new",
"empty",
"instance",
"of",
"the",
"collection",
"in",
"question",
".",
"If",
"the",
"collection",
"doesn",
"t",
"support",
"re... | b454f154f7663475670d4802e28e98ade8c468e7 | https://github.com/Barandis/xduce/blob/b454f154f7663475670d4802e28e98ade8c468e7/src/modules/reduction.js#L49-L66 |
57,039 | Barandis/xduce | src/modules/reduction.js | step | function step(collection) {
switch (true) {
case isImplemented(collection, 'step'):
return collection[p.step];
case isString(collection):
return (acc, input) => {
const value = isKvFormObject(input) ? input.v : input;
return acc + value;
};
case isArray(collection):
... | javascript | function step(collection) {
switch (true) {
case isImplemented(collection, 'step'):
return collection[p.step];
case isString(collection):
return (acc, input) => {
const value = isKvFormObject(input) ? input.v : input;
return acc + value;
};
case isArray(collection):
... | [
"function",
"step",
"(",
"collection",
")",
"{",
"switch",
"(",
"true",
")",
"{",
"case",
"isImplemented",
"(",
"collection",
",",
"'step'",
")",
":",
"return",
"collection",
"[",
"p",
".",
"step",
"]",
";",
"case",
"isString",
"(",
"collection",
")",
... | Returns a step function for a collection. This is a function that takes an accumulator and a value and returns the
result of reducing the value into the accumulator. If the collection doesn't support reduction, `null` is returned.
The returned function itself simply reduces the input into the target collection without ... | [
"Returns",
"a",
"step",
"function",
"for",
"a",
"collection",
".",
"This",
"is",
"a",
"function",
"that",
"takes",
"an",
"accumulator",
"and",
"a",
"value",
"and",
"returns",
"the",
"result",
"of",
"reducing",
"the",
"value",
"into",
"the",
"accumulator",
... | b454f154f7663475670d4802e28e98ade8c468e7 | https://github.com/Barandis/xduce/blob/b454f154f7663475670d4802e28e98ade8c468e7/src/modules/reduction.js#L82-L134 |
57,040 | Barandis/xduce | src/modules/reduction.js | result | function result(collection) {
switch (true) {
case isImplemented(collection, 'result'):
return collection[p.result];
case isString(collection):
case isArray(collection):
case isObject(collection):
case isFunction(collection):
return value => value;
default:
return null;
}
} | javascript | function result(collection) {
switch (true) {
case isImplemented(collection, 'result'):
return collection[p.result];
case isString(collection):
case isArray(collection):
case isObject(collection):
case isFunction(collection):
return value => value;
default:
return null;
}
} | [
"function",
"result",
"(",
"collection",
")",
"{",
"switch",
"(",
"true",
")",
"{",
"case",
"isImplemented",
"(",
"collection",
",",
"'result'",
")",
":",
"return",
"collection",
"[",
"p",
".",
"result",
"]",
";",
"case",
"isString",
"(",
"collection",
"... | Returns a result function for a collection. This is a function that performs any final processing that should be done
on the result of a reduction. If the collection doesn't support reduction, `null` is returned.
In order to support the conversion of functions into reducers, function support is also provided.
@privat... | [
"Returns",
"a",
"result",
"function",
"for",
"a",
"collection",
".",
"This",
"is",
"a",
"function",
"that",
"performs",
"any",
"final",
"processing",
"that",
"should",
"be",
"done",
"on",
"the",
"result",
"of",
"a",
"reduction",
".",
"If",
"the",
"collecti... | b454f154f7663475670d4802e28e98ade8c468e7 | https://github.com/Barandis/xduce/blob/b454f154f7663475670d4802e28e98ade8c468e7/src/modules/reduction.js#L149-L161 |
57,041 | theodoreb/jquarry | lib/target/scan-jquery-use.js | quickCheckMethods | function quickCheckMethods(tokens, JQAPI) {
var JQMethods = _.pluck(JQAPI, 'method');
var identifiers = _.where(tokens, {type: 'Identifier'});
return !!_.intersection(JQMethods, _.pluck(identifiers, 'value')).length;
} | javascript | function quickCheckMethods(tokens, JQAPI) {
var JQMethods = _.pluck(JQAPI, 'method');
var identifiers = _.where(tokens, {type: 'Identifier'});
return !!_.intersection(JQMethods, _.pluck(identifiers, 'value')).length;
} | [
"function",
"quickCheckMethods",
"(",
"tokens",
",",
"JQAPI",
")",
"{",
"var",
"JQMethods",
"=",
"_",
".",
"pluck",
"(",
"JQAPI",
",",
"'method'",
")",
";",
"var",
"identifiers",
"=",
"_",
".",
"where",
"(",
"tokens",
",",
"{",
"type",
":",
"'Identifie... | Check any jQuery method appears in the code.
@param tokens
@param JQAPI
@returns {boolean} | [
"Check",
"any",
"jQuery",
"method",
"appears",
"in",
"the",
"code",
"."
] | 7066617e592e9c8ae3acb23cc0f1a3847654a6c0 | https://github.com/theodoreb/jquarry/blob/7066617e592e9c8ae3acb23cc0f1a3847654a6c0/lib/target/scan-jquery-use.js#L26-L30 |
57,042 | fritbot/fb-opt-quotes | import_quotes.js | checkFinished | function checkFinished() {
if ((import_count + dupe_count) % 100 === 0) {
console.log('Imported', import_count + dupe_count, '/', quote_count);
}
// Once we're done, show the stats and tell the bot to shutdown.
// Since the bot is fully async-aware itself, it won't shut down unless explicitly told to.
if (finis... | javascript | function checkFinished() {
if ((import_count + dupe_count) % 100 === 0) {
console.log('Imported', import_count + dupe_count, '/', quote_count);
}
// Once we're done, show the stats and tell the bot to shutdown.
// Since the bot is fully async-aware itself, it won't shut down unless explicitly told to.
if (finis... | [
"function",
"checkFinished",
"(",
")",
"{",
"if",
"(",
"(",
"import_count",
"+",
"dupe_count",
")",
"%",
"100",
"===",
"0",
")",
"{",
"console",
".",
"log",
"(",
"'Imported'",
",",
"import_count",
"+",
"dupe_count",
",",
"'/'",
",",
"quote_count",
")",
... | Check if all async DB calls have finished. Output if so. | [
"Check",
"if",
"all",
"async",
"DB",
"calls",
"have",
"finished",
".",
"Output",
"if",
"so",
"."
] | f5cc97d95b3a2bfbe619c026fa70b61556dc9757 | https://github.com/fritbot/fb-opt-quotes/blob/f5cc97d95b3a2bfbe619c026fa70b61556dc9757/import_quotes.js#L58-L71 |
57,043 | rxaviers/builder-amd-css | bower_components/require-css/normalize.js | absoluteURI | function absoluteURI(uri, base) {
if (uri.substr(0, 2) == './')
uri = uri.substr(2);
// absolute urls are left in tact
if (uri.match(absUrlRegEx) || uri.match(protocolRegEx))
return uri;
var baseParts = base.split('/');
var uriParts = uri.split('/');
baseParts.pop();
... | javascript | function absoluteURI(uri, base) {
if (uri.substr(0, 2) == './')
uri = uri.substr(2);
// absolute urls are left in tact
if (uri.match(absUrlRegEx) || uri.match(protocolRegEx))
return uri;
var baseParts = base.split('/');
var uriParts = uri.split('/');
baseParts.pop();
... | [
"function",
"absoluteURI",
"(",
"uri",
",",
"base",
")",
"{",
"if",
"(",
"uri",
".",
"substr",
"(",
"0",
",",
"2",
")",
"==",
"'./'",
")",
"uri",
"=",
"uri",
".",
"substr",
"(",
"2",
")",
";",
"// absolute urls are left in tact",
"if",
"(",
"uri",
... | given a relative URI, calculate the absolute URI | [
"given",
"a",
"relative",
"URI",
"calculate",
"the",
"absolute",
"URI"
] | ad225d76285a68c5fa750fdc31e2f2c7365aa8b3 | https://github.com/rxaviers/builder-amd-css/blob/ad225d76285a68c5fa750fdc31e2f2c7365aa8b3/bower_components/require-css/normalize.js#L63-L83 |
57,044 | rxaviers/builder-amd-css | bower_components/require-css/normalize.js | relativeURI | function relativeURI(uri, base) {
// reduce base and uri strings to just their difference string
var baseParts = base.split('/');
baseParts.pop();
base = baseParts.join('/') + '/';
i = 0;
while (base.substr(i, 1) == uri.substr(i, 1))
i++;
while (base.substr(i, 1) != '/')
i--... | javascript | function relativeURI(uri, base) {
// reduce base and uri strings to just their difference string
var baseParts = base.split('/');
baseParts.pop();
base = baseParts.join('/') + '/';
i = 0;
while (base.substr(i, 1) == uri.substr(i, 1))
i++;
while (base.substr(i, 1) != '/')
i--... | [
"function",
"relativeURI",
"(",
"uri",
",",
"base",
")",
"{",
"// reduce base and uri strings to just their difference string",
"var",
"baseParts",
"=",
"base",
".",
"split",
"(",
"'/'",
")",
";",
"baseParts",
".",
"pop",
"(",
")",
";",
"base",
"=",
"baseParts",... | given an absolute URI, calculate the relative URI | [
"given",
"an",
"absolute",
"URI",
"calculate",
"the",
"relative",
"URI"
] | ad225d76285a68c5fa750fdc31e2f2c7365aa8b3 | https://github.com/rxaviers/builder-amd-css/blob/ad225d76285a68c5fa750fdc31e2f2c7365aa8b3/bower_components/require-css/normalize.js#L87-L113 |
57,045 | ahinni/underscore-more | lib/functional.js | partialAny | function partialAny(fn /* arguments */) {
var appliedArgs = Array.prototype.slice.call(arguments, 1);
if ( appliedArgs.length < 1 ) return fn;
return function () {
var args = _.deepClone(appliedArgs);
var partialArgs = _.toArray(arguments);
for (var i=0; i < args.length; i++) {
if... | javascript | function partialAny(fn /* arguments */) {
var appliedArgs = Array.prototype.slice.call(arguments, 1);
if ( appliedArgs.length < 1 ) return fn;
return function () {
var args = _.deepClone(appliedArgs);
var partialArgs = _.toArray(arguments);
for (var i=0; i < args.length; i++) {
if... | [
"function",
"partialAny",
"(",
"fn",
"/* arguments */",
")",
"{",
"var",
"appliedArgs",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
",",
"1",
")",
";",
"if",
"(",
"appliedArgs",
".",
"length",
"<",
"1",
")",
"return",
"... | use _ as a placeholder, and bind non placeholder arguments to fn When the new function is invoked, apply the passed arguments into the placeholders | [
"use",
"_",
"as",
"a",
"placeholder",
"and",
"bind",
"non",
"placeholder",
"arguments",
"to",
"fn",
"When",
"the",
"new",
"function",
"is",
"invoked",
"apply",
"the",
"passed",
"arguments",
"into",
"the",
"placeholders"
] | 91c87a2c4bf6a3bd31edb94dbf0d15630cc5284e | https://github.com/ahinni/underscore-more/blob/91c87a2c4bf6a3bd31edb94dbf0d15630cc5284e/lib/functional.js#L21-L34 |
57,046 | nelsonpecora/chain-of-promises | dist/index.js | tryFn | function tryFn(fn, args) {
try {
return Promise.resolve(fn.apply(null, args));
} catch (e) {
return Promise.reject(e);
}
} | javascript | function tryFn(fn, args) {
try {
return Promise.resolve(fn.apply(null, args));
} catch (e) {
return Promise.reject(e);
}
} | [
"function",
"tryFn",
"(",
"fn",
",",
"args",
")",
"{",
"try",
"{",
"return",
"Promise",
".",
"resolve",
"(",
"fn",
".",
"apply",
"(",
"null",
",",
"args",
")",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"return",
"Promise",
".",
"reject",
"(",
... | try to resolve a function.
resolve if it returns a resolved promise or value
reject if it returns a rejected promise or throws an error
@param {function} fn
@param {array} args
@returns {Promise} | [
"try",
"to",
"resolve",
"a",
"function",
".",
"resolve",
"if",
"it",
"returns",
"a",
"resolved",
"promise",
"or",
"value",
"reject",
"if",
"it",
"returns",
"a",
"rejected",
"promise",
"or",
"throws",
"an",
"error"
] | 16880d9618b05410ea82fa74c20c565f2ec6d580 | https://github.com/nelsonpecora/chain-of-promises/blob/16880d9618b05410ea82fa74c20c565f2ec6d580/dist/index.js#L47-L53 |
57,047 | activethread/vulpejs | lib/ui/public/javascripts/internal/01-services.js | function (key, value) {
if (!supported) {
try {
$cookieStore.set(key, value);
return value;
} catch (e) {
console.log('Local Storage not supported, make sure you have the $cookieStore supported.');
}
}
var saver = JSON.stringify(value);
stora... | javascript | function (key, value) {
if (!supported) {
try {
$cookieStore.set(key, value);
return value;
} catch (e) {
console.log('Local Storage not supported, make sure you have the $cookieStore supported.');
}
}
var saver = JSON.stringify(value);
stora... | [
"function",
"(",
"key",
",",
"value",
")",
"{",
"if",
"(",
"!",
"supported",
")",
"{",
"try",
"{",
"$cookieStore",
".",
"set",
"(",
"key",
",",
"value",
")",
";",
"return",
"value",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"console",
".",
"log",
... | Set - let's you set a new localStorage key pair set
@param key -
a string that will be used as the accessor for the pair
@param value -
the value of the localStorage item
@return {*} - will return whatever it is you've stored in the local storage | [
"Set",
"-",
"let",
"s",
"you",
"set",
"a",
"new",
"localStorage",
"key",
"pair",
"set"
] | cba9529ebb13892b2c7d07219c7fa69137151fbd | https://github.com/activethread/vulpejs/blob/cba9529ebb13892b2c7d07219c7fa69137151fbd/lib/ui/public/javascripts/internal/01-services.js#L67-L79 | |
57,048 | activethread/vulpejs | lib/ui/public/javascripts/internal/01-services.js | function (key) {
if (!supported) {
try {
return privateMethods.parseValue($cookieStore.get(key));
} catch (e) {
return null;
}
}
var item = storage.getItem(key);
return privateMethods.parseValue(item);
} | javascript | function (key) {
if (!supported) {
try {
return privateMethods.parseValue($cookieStore.get(key));
} catch (e) {
return null;
}
}
var item = storage.getItem(key);
return privateMethods.parseValue(item);
} | [
"function",
"(",
"key",
")",
"{",
"if",
"(",
"!",
"supported",
")",
"{",
"try",
"{",
"return",
"privateMethods",
".",
"parseValue",
"(",
"$cookieStore",
".",
"get",
"(",
"key",
")",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"return",
"null",
";",... | Get - let's you get the value of any pair you've stored
@param key -
the string that you set as accessor for the pair
@return {*} - Object,String,Float,Boolean depending on what you stored | [
"Get",
"-",
"let",
"s",
"you",
"get",
"the",
"value",
"of",
"any",
"pair",
"you",
"ve",
"stored"
] | cba9529ebb13892b2c7d07219c7fa69137151fbd | https://github.com/activethread/vulpejs/blob/cba9529ebb13892b2c7d07219c7fa69137151fbd/lib/ui/public/javascripts/internal/01-services.js#L87-L97 | |
57,049 | activethread/vulpejs | lib/ui/public/javascripts/internal/01-services.js | function (key) {
if (!supported) {
try {
$cookieStore.remove(key);
return true;
} catch (e) {
return false;
}
}
storage.removeItem(key);
return true;
} | javascript | function (key) {
if (!supported) {
try {
$cookieStore.remove(key);
return true;
} catch (e) {
return false;
}
}
storage.removeItem(key);
return true;
} | [
"function",
"(",
"key",
")",
"{",
"if",
"(",
"!",
"supported",
")",
"{",
"try",
"{",
"$cookieStore",
".",
"remove",
"(",
"key",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"return",
"false",
";",
"}",
"}",
"storage",
".",
... | Remove - let's you nuke a value from localStorage
@param key -
the accessor value
@return {boolean} - if everything went as planned | [
"Remove",
"-",
"let",
"s",
"you",
"nuke",
"a",
"value",
"from",
"localStorage"
] | cba9529ebb13892b2c7d07219c7fa69137151fbd | https://github.com/activethread/vulpejs/blob/cba9529ebb13892b2c7d07219c7fa69137151fbd/lib/ui/public/javascripts/internal/01-services.js#L105-L116 | |
57,050 | camshaft/canary-store | index.js | CanaryStore | function CanaryStore() {
var self = this;
EventEmitter.call(self);
var counter = self._counter = new Counter();
counter.on('resource', self._onresource.bind(self));
self._id = 0;
self._variants = {};
self._callbacks = {};
self._assigners = [];
self._assignments = {};
self._overrides = {};
self._p... | javascript | function CanaryStore() {
var self = this;
EventEmitter.call(self);
var counter = self._counter = new Counter();
counter.on('resource', self._onresource.bind(self));
self._id = 0;
self._variants = {};
self._callbacks = {};
self._assigners = [];
self._assignments = {};
self._overrides = {};
self._p... | [
"function",
"CanaryStore",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"EventEmitter",
".",
"call",
"(",
"self",
")",
";",
"var",
"counter",
"=",
"self",
".",
"_counter",
"=",
"new",
"Counter",
"(",
")",
";",
"counter",
".",
"on",
"(",
"'resource... | Create a CanaryStore | [
"Create",
"a",
"CanaryStore"
] | dd4f2eb33ed5146136c2d233dd2ba4fa5b59aafc | https://github.com/camshaft/canary-store/blob/dd4f2eb33ed5146136c2d233dd2ba4fa5b59aafc/index.js#L23-L42 |
57,051 | mongodb-js/mj | commands/install.js | isModuleInstalledGlobally | function isModuleInstalledGlobally(name, fn) {
var cmd = 'npm ls --global --json --depth=0';
exec(cmd, function(err, stdout) {
if (err) {
return fn(err);
}
var data = JSON.parse(stdout);
var installed = data.dependencies[name];
fn(null, installed !== undefined);
});
} | javascript | function isModuleInstalledGlobally(name, fn) {
var cmd = 'npm ls --global --json --depth=0';
exec(cmd, function(err, stdout) {
if (err) {
return fn(err);
}
var data = JSON.parse(stdout);
var installed = data.dependencies[name];
fn(null, installed !== undefined);
});
} | [
"function",
"isModuleInstalledGlobally",
"(",
"name",
",",
"fn",
")",
"{",
"var",
"cmd",
"=",
"'npm ls --global --json --depth=0'",
";",
"exec",
"(",
"cmd",
",",
"function",
"(",
"err",
",",
"stdout",
")",
"{",
"if",
"(",
"err",
")",
"{",
"return",
"fn",
... | Check if a module with `name` is installed globally.
@param {String} name of the module, e.g. jshint
@param {Function} fn (error, exists) | [
"Check",
"if",
"a",
"module",
"with",
"name",
"is",
"installed",
"globally",
"."
] | a643970372c74baf8cfc7087cda80d3f6001fe7b | https://github.com/mongodb-js/mj/blob/a643970372c74baf8cfc7087cda80d3f6001fe7b/commands/install.js#L27-L38 |
57,052 | neikvon/rese-api | lib/router.js | controllerWrap | function controllerWrap(ctx, ctrl, hooks, next) {
let result
const preHooks = []
hooks.pre.map(pre => {
preHooks.push(() => pre(ctx))
})
return sequenceAndReturnOne(preHooks)
.then(() => {
return ctrl(ctx)
})
.then(data => {
if (!data && ctx.body && ctx.body.data) {
data =... | javascript | function controllerWrap(ctx, ctrl, hooks, next) {
let result
const preHooks = []
hooks.pre.map(pre => {
preHooks.push(() => pre(ctx))
})
return sequenceAndReturnOne(preHooks)
.then(() => {
return ctrl(ctx)
})
.then(data => {
if (!data && ctx.body && ctx.body.data) {
data =... | [
"function",
"controllerWrap",
"(",
"ctx",
",",
"ctrl",
",",
"hooks",
",",
"next",
")",
"{",
"let",
"result",
"const",
"preHooks",
"=",
"[",
"]",
"hooks",
".",
"pre",
".",
"map",
"(",
"pre",
"=>",
"{",
"preHooks",
".",
"push",
"(",
"(",
")",
"=>",
... | controller wrap
wrap controllers for router
@param {object} ctx context
@param {function} ctrl controller function
@param {object} hooks controller hook functions
@param {function} next koa router next function
@returns | [
"controller",
"wrap",
"wrap",
"controllers",
"for",
"router"
] | c2361cd256b08089a1b850db65112c4806a9f3fc | https://github.com/neikvon/rese-api/blob/c2361cd256b08089a1b850db65112c4806a9f3fc/lib/router.js#L16-L52 |
57,053 | SamDelgado/async-lite | async-lite.js | function(arr, iterator, callback) {
callback = _doOnce(callback || noop);
var amount = arr.length;
if (!isArray(arr)) return callback();
var completed = 0;
doEach(arr, function(item) {
iterator(item, doOnce(function(err) {
if (err) {
callback(err);
... | javascript | function(arr, iterator, callback) {
callback = _doOnce(callback || noop);
var amount = arr.length;
if (!isArray(arr)) return callback();
var completed = 0;
doEach(arr, function(item) {
iterator(item, doOnce(function(err) {
if (err) {
callback(err);
... | [
"function",
"(",
"arr",
",",
"iterator",
",",
"callback",
")",
"{",
"callback",
"=",
"_doOnce",
"(",
"callback",
"||",
"noop",
")",
";",
"var",
"amount",
"=",
"arr",
".",
"length",
";",
"if",
"(",
"!",
"isArray",
"(",
"arr",
")",
")",
"return",
"ca... | runs the task on every item in the array at once | [
"runs",
"the",
"task",
"on",
"every",
"item",
"in",
"the",
"array",
"at",
"once"
] | 45977c8f707f89b4606a6c980897166e529ab405 | https://github.com/SamDelgado/async-lite/blob/45977c8f707f89b4606a6c980897166e529ab405/async-lite.js#L61-L79 | |
57,054 | SamDelgado/async-lite | async-lite.js | function(tasks, callback) {
var keys; var length; var i; var results; var kind;
var updated_tasks = [];
var is_object;
var counter = 0;
if (isArray(tasks)) {
length = tasks.length;
results = [];
} else if (isObject(tasks)) {
is_object = true;
keys... | javascript | function(tasks, callback) {
var keys; var length; var i; var results; var kind;
var updated_tasks = [];
var is_object;
var counter = 0;
if (isArray(tasks)) {
length = tasks.length;
results = [];
} else if (isObject(tasks)) {
is_object = true;
keys... | [
"function",
"(",
"tasks",
",",
"callback",
")",
"{",
"var",
"keys",
";",
"var",
"length",
";",
"var",
"i",
";",
"var",
"results",
";",
"var",
"kind",
";",
"var",
"updated_tasks",
"=",
"[",
"]",
";",
"var",
"is_object",
";",
"var",
"counter",
"=",
"... | can accept an object or array will return an object or array of results in the correct order | [
"can",
"accept",
"an",
"object",
"or",
"array",
"will",
"return",
"an",
"object",
"or",
"array",
"of",
"results",
"in",
"the",
"correct",
"order"
] | 45977c8f707f89b4606a6c980897166e529ab405 | https://github.com/SamDelgado/async-lite/blob/45977c8f707f89b4606a6c980897166e529ab405/async-lite.js#L111-L157 | |
57,055 | SamDelgado/async-lite | async-lite.js | function(tasks, callback) {
if (!isArray(tasks)) return callback();
var length = tasks.length;
var results = [];
function runTask(index) {
tasks[index](function(err, result) {
if (err) return callback(err);
results[index] = result;
if (index < length - 1)... | javascript | function(tasks, callback) {
if (!isArray(tasks)) return callback();
var length = tasks.length;
var results = [];
function runTask(index) {
tasks[index](function(err, result) {
if (err) return callback(err);
results[index] = result;
if (index < length - 1)... | [
"function",
"(",
"tasks",
",",
"callback",
")",
"{",
"if",
"(",
"!",
"isArray",
"(",
"tasks",
")",
")",
"return",
"callback",
"(",
")",
";",
"var",
"length",
"=",
"tasks",
".",
"length",
";",
"var",
"results",
"=",
"[",
"]",
";",
"function",
"runTa... | only accepts an array since the preservation of the order of properties on an object can't be guaranteed returns an array of results in order | [
"only",
"accepts",
"an",
"array",
"since",
"the",
"preservation",
"of",
"the",
"order",
"of",
"properties",
"on",
"an",
"object",
"can",
"t",
"be",
"guaranteed",
"returns",
"an",
"array",
"of",
"results",
"in",
"order"
] | 45977c8f707f89b4606a6c980897166e529ab405 | https://github.com/SamDelgado/async-lite/blob/45977c8f707f89b4606a6c980897166e529ab405/async-lite.js#L161-L178 | |
57,056 | samsonjs/batteries | lib/object.js | methodWrapper | function methodWrapper(fn) {
return function() {
var args = [].slice.call(arguments);
args.unshift(this);
return fn.apply(this, args);
};
} | javascript | function methodWrapper(fn) {
return function() {
var args = [].slice.call(arguments);
args.unshift(this);
return fn.apply(this, args);
};
} | [
"function",
"methodWrapper",
"(",
"fn",
")",
"{",
"return",
"function",
"(",
")",
"{",
"var",
"args",
"=",
"[",
"]",
".",
"slice",
".",
"call",
"(",
"arguments",
")",
";",
"args",
".",
"unshift",
"(",
"this",
")",
";",
"return",
"fn",
".",
"apply",... | Make a wrapper than passes `this` as the first argument, Python style. All extension functions that can extend native types must follow this convention. | [
"Make",
"a",
"wrapper",
"than",
"passes",
"this",
"as",
"the",
"first",
"argument",
"Python",
"style",
".",
"All",
"extension",
"functions",
"that",
"can",
"extend",
"native",
"types",
"must",
"follow",
"this",
"convention",
"."
] | 48ca583338a89a9ec344cda7011da92dfc2f6d03 | https://github.com/samsonjs/batteries/blob/48ca583338a89a9ec344cda7011da92dfc2f6d03/lib/object.js#L43-L49 |
57,057 | alphakevin/new-filename | index.js | getNewFilename | function getNewFilename(list, name) {
if (list.indexOf(name) === -1) {
return name;
}
const parsed = parseFilename(name);
const base = parsed.base;
const ext = parsed.ext;
if (!base) {
const newName = getNextNumberName(ext);
return getNewFilename(list, newName);
} else {
const basename = g... | javascript | function getNewFilename(list, name) {
if (list.indexOf(name) === -1) {
return name;
}
const parsed = parseFilename(name);
const base = parsed.base;
const ext = parsed.ext;
if (!base) {
const newName = getNextNumberName(ext);
return getNewFilename(list, newName);
} else {
const basename = g... | [
"function",
"getNewFilename",
"(",
"list",
",",
"name",
")",
"{",
"if",
"(",
"list",
".",
"indexOf",
"(",
"name",
")",
"===",
"-",
"1",
")",
"{",
"return",
"name",
";",
"}",
"const",
"parsed",
"=",
"parseFilename",
"(",
"name",
")",
";",
"const",
"... | Generating a new filename to avoid names in the list by adding sequenced number
@param {string[]} list - Filenames already in use
@param {string} name - New filenames about to use
@returns {string} - Generated new filename | [
"Generating",
"a",
"new",
"filename",
"to",
"avoid",
"names",
"in",
"the",
"list",
"by",
"adding",
"sequenced",
"number"
] | a6aab955c8a3856376a02d2f90af0e9cde9593b0 | https://github.com/alphakevin/new-filename/blob/a6aab955c8a3856376a02d2f90af0e9cde9593b0/index.js#L34-L48 |
57,058 | bogdosarov/grunt-contrib-less-compiller | tasks/less.js | processDirective | function processDirective(list, directive) {
_(options.paths).forEach(function(filepath) {
_.each(list, function(item) {
item = path.join(filepath, item);
console.log(item);
grunt.file.expand(grunt.template.process(item)).map(function(ea) {
importDirectives.push('... | javascript | function processDirective(list, directive) {
_(options.paths).forEach(function(filepath) {
_.each(list, function(item) {
item = path.join(filepath, item);
console.log(item);
grunt.file.expand(grunt.template.process(item)).map(function(ea) {
importDirectives.push('... | [
"function",
"processDirective",
"(",
"list",
",",
"directive",
")",
"{",
"_",
"(",
"options",
".",
"paths",
")",
".",
"forEach",
"(",
"function",
"(",
"filepath",
")",
"{",
"_",
".",
"each",
"(",
"list",
",",
"function",
"(",
"item",
")",
"{",
"item"... | Prepare import directives to be prepended to source files | [
"Prepare",
"import",
"directives",
"to",
"be",
"prepended",
"to",
"source",
"files"
] | b7538ce61763fa8eba0d4abf5ea2ebddffb4e854 | https://github.com/bogdosarov/grunt-contrib-less-compiller/blob/b7538ce61763fa8eba0d4abf5ea2ebddffb4e854/tasks/less.js#L122-L133 |
57,059 | PsychoLlama/panic-manager | src/spawn-clients/index.js | create | function create (config) {
/** Generate each client as described. */
config.clients.forEach(function (client) {
if (client.type === 'node') {
/** Fork a new node process. */
fork(config.panic);
}
});
} | javascript | function create (config) {
/** Generate each client as described. */
config.clients.forEach(function (client) {
if (client.type === 'node') {
/** Fork a new node process. */
fork(config.panic);
}
});
} | [
"function",
"create",
"(",
"config",
")",
"{",
"/** Generate each client as described. */",
"config",
".",
"clients",
".",
"forEach",
"(",
"function",
"(",
"client",
")",
"{",
"if",
"(",
"client",
".",
"type",
"===",
"'node'",
")",
"{",
"/** Fork a new node proc... | Create a bunch of panic clients.
@param {Object} config - A description of clients to generate.
@param {String} config.panic - The url to a panic server.
@param {Object[]} config.clients - A list of clients to generate.
Each should have a client "type" string.
@returns {undefined}
@example
create({
panic: 'http://... | [
"Create",
"a",
"bunch",
"of",
"panic",
"clients",
"."
] | d68c8c918994a5b93647bd7965e364d6ddc411de | https://github.com/PsychoLlama/panic-manager/blob/d68c8c918994a5b93647bd7965e364d6ddc411de/src/spawn-clients/index.js#L20-L30 |
57,060 | alexindigo/multibundle | index.js | Multibundle | function Multibundle(config, components)
{
var tasks;
if (!(this instanceof Multibundle))
{
return new Multibundle(config, components);
}
// turn on object mode
Readable.call(this, {objectMode: true});
// prepare config options
this.config = lodash.merge({}, Multibundle._defaults, config);
this... | javascript | function Multibundle(config, components)
{
var tasks;
if (!(this instanceof Multibundle))
{
return new Multibundle(config, components);
}
// turn on object mode
Readable.call(this, {objectMode: true});
// prepare config options
this.config = lodash.merge({}, Multibundle._defaults, config);
this... | [
"function",
"Multibundle",
"(",
"config",
",",
"components",
")",
"{",
"var",
"tasks",
";",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Multibundle",
")",
")",
"{",
"return",
"new",
"Multibundle",
"(",
"config",
",",
"components",
")",
";",
"}",
"// turn... | Parses multibundle config and transforms it into requirejs compatible options.
@constructor
@param {object} config - process configuration object
@param {array} components - list of bundles to build
@alias module:Multibundle | [
"Parses",
"multibundle",
"config",
"and",
"transforms",
"it",
"into",
"requirejs",
"compatible",
"options",
"."
] | 3eac4c590600cc71cd8dc18119187cc73c9175bb | https://github.com/alexindigo/multibundle/blob/3eac4c590600cc71cd8dc18119187cc73c9175bb/index.js#L47-L87 |
57,061 | epeli/yalr | lib/md2json.js | function (tokens){
if (!this.next()) return;
if (this.current.type === "heading" &&
this.current.depth === this.optionDepth) {
return this.findDescription(this.current.text.trim());
}
this.findOption();
} | javascript | function (tokens){
if (!this.next()) return;
if (this.current.type === "heading" &&
this.current.depth === this.optionDepth) {
return this.findDescription(this.current.text.trim());
}
this.findOption();
} | [
"function",
"(",
"tokens",
")",
"{",
"if",
"(",
"!",
"this",
".",
"next",
"(",
")",
")",
"return",
";",
"if",
"(",
"this",
".",
"current",
".",
"type",
"===",
"\"heading\"",
"&&",
"this",
".",
"current",
".",
"depth",
"===",
"this",
".",
"optionDep... | Find an option | [
"Find",
"an",
"option"
] | a6c3cab59fe9ac5745e52c55210dc22c7f9a8b54 | https://github.com/epeli/yalr/blob/a6c3cab59fe9ac5745e52c55210dc22c7f9a8b54/lib/md2json.js#L45-L54 | |
57,062 | epeli/yalr | lib/md2json.js | function (option) {
if (!this.next()) return;
if (this.current.type === "paragraph") {
this.results.push({
name: option,
description: this.current.text.trim()
});
return this.findOption();
}
this.findDescription(option);
} | javascript | function (option) {
if (!this.next()) return;
if (this.current.type === "paragraph") {
this.results.push({
name: option,
description: this.current.text.trim()
});
return this.findOption();
}
this.findDescription(option);
} | [
"function",
"(",
"option",
")",
"{",
"if",
"(",
"!",
"this",
".",
"next",
"(",
")",
")",
"return",
";",
"if",
"(",
"this",
".",
"current",
".",
"type",
"===",
"\"paragraph\"",
")",
"{",
"this",
".",
"results",
".",
"push",
"(",
"{",
"name",
":",
... | Find a description for an option | [
"Find",
"a",
"description",
"for",
"an",
"option"
] | a6c3cab59fe9ac5745e52c55210dc22c7f9a8b54 | https://github.com/epeli/yalr/blob/a6c3cab59fe9ac5745e52c55210dc22c7f9a8b54/lib/md2json.js#L57-L70 | |
57,063 | vkiding/jud-styler | lib/validator.js | LENGTH_VALIDATOR | function LENGTH_VALIDATOR(v) {
v = (v || '').toString()
var match = v.match(LENGTH_REGEXP)
if (match) {
var unit = match[1]
if (!unit) {
return {value: parseFloat(v)}
}
else if (SUPPORT_CSS_UNIT.indexOf(unit) > -1) {
return {value: v}
}
else {
return {
value: par... | javascript | function LENGTH_VALIDATOR(v) {
v = (v || '').toString()
var match = v.match(LENGTH_REGEXP)
if (match) {
var unit = match[1]
if (!unit) {
return {value: parseFloat(v)}
}
else if (SUPPORT_CSS_UNIT.indexOf(unit) > -1) {
return {value: v}
}
else {
return {
value: par... | [
"function",
"LENGTH_VALIDATOR",
"(",
"v",
")",
"{",
"v",
"=",
"(",
"v",
"||",
"''",
")",
".",
"toString",
"(",
")",
"var",
"match",
"=",
"v",
".",
"match",
"(",
"LENGTH_REGEXP",
")",
"if",
"(",
"match",
")",
"{",
"var",
"unit",
"=",
"match",
"[",... | the values below is valid
- number
- number + 'px'
@param {string} v
@return {function} a function to return
- value: number|null
- reason(k, v, result) | [
"the",
"values",
"below",
"is",
"valid",
"-",
"number",
"-",
"number",
"+",
"px"
] | 1563f84b9acd649bd546a8859e9a9226689ef1dc | https://github.com/vkiding/jud-styler/blob/1563f84b9acd649bd546a8859e9a9226689ef1dc/lib/validator.js#L187-L215 |
57,064 | vkiding/jud-styler | lib/validator.js | NUMBER_VALIDATOR | function NUMBER_VALIDATOR(v) {
v = (v || '').toString()
var match = v.match(LENGTH_REGEXP)
if (match && !match[1]) {
return {value: parseFloat(v)}
}
return {
value: null,
reason: function reason(k, v, result) {
return 'ERROR: property value `' + v + '` is not supported for `' + util.camelC... | javascript | function NUMBER_VALIDATOR(v) {
v = (v || '').toString()
var match = v.match(LENGTH_REGEXP)
if (match && !match[1]) {
return {value: parseFloat(v)}
}
return {
value: null,
reason: function reason(k, v, result) {
return 'ERROR: property value `' + v + '` is not supported for `' + util.camelC... | [
"function",
"NUMBER_VALIDATOR",
"(",
"v",
")",
"{",
"v",
"=",
"(",
"v",
"||",
"''",
")",
".",
"toString",
"(",
")",
"var",
"match",
"=",
"v",
".",
"match",
"(",
"LENGTH_REGEXP",
")",
"if",
"(",
"match",
"&&",
"!",
"match",
"[",
"1",
"]",
")",
"... | only integer or float value is valid
@param {string} v
@return {function} a function to return
- value: number|null
- reason(k, v, result) | [
"only",
"integer",
"or",
"float",
"value",
"is",
"valid"
] | 1563f84b9acd649bd546a8859e9a9226689ef1dc | https://github.com/vkiding/jud-styler/blob/1563f84b9acd649bd546a8859e9a9226689ef1dc/lib/validator.js#L292-L306 |
57,065 | vkiding/jud-styler | lib/validator.js | INTEGER_VALIDATOR | function INTEGER_VALIDATOR(v) {
v = (v || '').toString()
if (v.match(/^[-+]?\d+$/)) {
return {value: parseInt(v, 10)}
}
return {
value: null,
reason: function reason(k, v, result) {
return 'ERROR: property value `' + v + '` is not supported for `' + util.camelCaseToHyphened(k) + '` (only int... | javascript | function INTEGER_VALIDATOR(v) {
v = (v || '').toString()
if (v.match(/^[-+]?\d+$/)) {
return {value: parseInt(v, 10)}
}
return {
value: null,
reason: function reason(k, v, result) {
return 'ERROR: property value `' + v + '` is not supported for `' + util.camelCaseToHyphened(k) + '` (only int... | [
"function",
"INTEGER_VALIDATOR",
"(",
"v",
")",
"{",
"v",
"=",
"(",
"v",
"||",
"''",
")",
".",
"toString",
"(",
")",
"if",
"(",
"v",
".",
"match",
"(",
"/",
"^[-+]?\\d+$",
"/",
")",
")",
"{",
"return",
"{",
"value",
":",
"parseInt",
"(",
"v",
"... | only integer value is valid
@param {string} v
@return {function} a function to return
- value: number|null
- reason(k, v, result) | [
"only",
"integer",
"value",
"is",
"valid"
] | 1563f84b9acd649bd546a8859e9a9226689ef1dc | https://github.com/vkiding/jud-styler/blob/1563f84b9acd649bd546a8859e9a9226689ef1dc/lib/validator.js#L316-L329 |
57,066 | vkiding/jud-styler | lib/validator.js | genValidatorMap | function genValidatorMap() {
var groupName, group, name
for (groupName in PROP_NAME_GROUPS) {
group = PROP_NAME_GROUPS[groupName]
for (name in group) {
validatorMap[name] = group[name]
}
}
} | javascript | function genValidatorMap() {
var groupName, group, name
for (groupName in PROP_NAME_GROUPS) {
group = PROP_NAME_GROUPS[groupName]
for (name in group) {
validatorMap[name] = group[name]
}
}
} | [
"function",
"genValidatorMap",
"(",
")",
"{",
"var",
"groupName",
",",
"group",
",",
"name",
"for",
"(",
"groupName",
"in",
"PROP_NAME_GROUPS",
")",
"{",
"group",
"=",
"PROP_NAME_GROUPS",
"[",
"groupName",
"]",
"for",
"(",
"name",
"in",
"group",
")",
"{",
... | flatten `PROP_NAME_GROUPS` to `validatorMap` | [
"flatten",
"PROP_NAME_GROUPS",
"to",
"validatorMap"
] | 1563f84b9acd649bd546a8859e9a9226689ef1dc | https://github.com/vkiding/jud-styler/blob/1563f84b9acd649bd546a8859e9a9226689ef1dc/lib/validator.js#L544-L552 |
57,067 | monoture/monoture-dashboard | public/app/services/post.js | function(post) {
return $http({
url : '/api/v1/posts/' + post._id,
method : 'PUT',
params : {access_token : authProvider.getUser().token},
data : post
}).catch(authProvider.checkApiResponse);
} | javascript | function(post) {
return $http({
url : '/api/v1/posts/' + post._id,
method : 'PUT',
params : {access_token : authProvider.getUser().token},
data : post
}).catch(authProvider.checkApiResponse);
} | [
"function",
"(",
"post",
")",
"{",
"return",
"$http",
"(",
"{",
"url",
":",
"'/api/v1/posts/'",
"+",
"post",
".",
"_id",
",",
"method",
":",
"'PUT'",
",",
"params",
":",
"{",
"access_token",
":",
"authProvider",
".",
"getUser",
"(",
")",
".",
"token",
... | Saves a post | [
"Saves",
"a",
"post"
] | 0f64656585a69fa0035adec130bce7b3d1b259f4 | https://github.com/monoture/monoture-dashboard/blob/0f64656585a69fa0035adec130bce7b3d1b259f4/public/app/services/post.js#L23-L30 | |
57,068 | monoture/monoture-dashboard | public/app/services/post.js | function(id) {
return $http({
url : '/api/v1/posts/' + id,
method : 'DELETE',
params : {access_token : authProvider.getUser().token}
}).catch(authProvider.checkApiResponse);
} | javascript | function(id) {
return $http({
url : '/api/v1/posts/' + id,
method : 'DELETE',
params : {access_token : authProvider.getUser().token}
}).catch(authProvider.checkApiResponse);
} | [
"function",
"(",
"id",
")",
"{",
"return",
"$http",
"(",
"{",
"url",
":",
"'/api/v1/posts/'",
"+",
"id",
",",
"method",
":",
"'DELETE'",
",",
"params",
":",
"{",
"access_token",
":",
"authProvider",
".",
"getUser",
"(",
")",
".",
"token",
"}",
"}",
"... | Deletes a post | [
"Deletes",
"a",
"post"
] | 0f64656585a69fa0035adec130bce7b3d1b259f4 | https://github.com/monoture/monoture-dashboard/blob/0f64656585a69fa0035adec130bce7b3d1b259f4/public/app/services/post.js#L43-L49 | |
57,069 | RnbWd/parse-browserify | lib/router.js | function() {
if (!this.routes) {
return;
}
var routes = [];
for (var route in this.routes) {
if (this.routes.hasOwnProperty(route)) {
routes.unshift([route, this.routes[route]]);
}
}
for (var i = 0, l = routes.length; i < l; i++) {
this.rout... | javascript | function() {
if (!this.routes) {
return;
}
var routes = [];
for (var route in this.routes) {
if (this.routes.hasOwnProperty(route)) {
routes.unshift([route, this.routes[route]]);
}
}
for (var i = 0, l = routes.length; i < l; i++) {
this.rout... | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"routes",
")",
"{",
"return",
";",
"}",
"var",
"routes",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"route",
"in",
"this",
".",
"routes",
")",
"{",
"if",
"(",
"this",
".",
"routes",
".",
"ha... | Bind all defined routes to `Parse.history`. We have to reverse the order of the routes here to support behavior where the most general routes can be defined at the bottom of the route map. | [
"Bind",
"all",
"defined",
"routes",
"to",
"Parse",
".",
"history",
".",
"We",
"have",
"to",
"reverse",
"the",
"order",
"of",
"the",
"routes",
"here",
"to",
"support",
"behavior",
"where",
"the",
"most",
"general",
"routes",
"can",
"be",
"defined",
"at",
... | c19c1b798e4010a552e130b1a9ce3b5d084dc101 | https://github.com/RnbWd/parse-browserify/blob/c19c1b798e4010a552e130b1a9ce3b5d084dc101/lib/router.js#L82-L95 | |
57,070 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/editable.js | function( editor, element ) {
// Transform the element into a CKEDITOR.dom.element instance.
this.base( element.$ || element );
this.editor = editor;
/**
* Indicates the initialization status of the editable element. The following statuses are available:
*
* * **unloaded** – the initial ... | javascript | function( editor, element ) {
// Transform the element into a CKEDITOR.dom.element instance.
this.base( element.$ || element );
this.editor = editor;
/**
* Indicates the initialization status of the editable element. The following statuses are available:
*
* * **unloaded** – the initial ... | [
"function",
"(",
"editor",
",",
"element",
")",
"{",
"// Transform the element into a CKEDITOR.dom.element instance.",
"this",
".",
"base",
"(",
"element",
".",
"$",
"||",
"element",
")",
";",
"this",
".",
"editor",
"=",
"editor",
";",
"/**\n\t\t\t * Indicates the i... | The constructor only stores generic editable creation logic that is commonly shared among
all different editable elements.
@constructor Creates an editable class instance.
@param {CKEDITOR.editor} editor The editor instance on which the editable operates.
@param {HTMLElement/CKEDITOR.dom.element} element Any DOM eleme... | [
"The",
"constructor",
"only",
"stores",
"generic",
"editable",
"creation",
"logic",
"that",
"is",
"commonly",
"shared",
"among",
"all",
"different",
"editable",
"elements",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/editable.js#L26-L56 | |
57,071 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/editable.js | function( cls ) {
var classes = this.getCustomData( 'classes' );
if ( !this.hasClass( cls ) ) {
!classes && ( classes = [] ), classes.push( cls );
this.setCustomData( 'classes', classes );
this.addClass( cls );
}
} | javascript | function( cls ) {
var classes = this.getCustomData( 'classes' );
if ( !this.hasClass( cls ) ) {
!classes && ( classes = [] ), classes.push( cls );
this.setCustomData( 'classes', classes );
this.addClass( cls );
}
} | [
"function",
"(",
"cls",
")",
"{",
"var",
"classes",
"=",
"this",
".",
"getCustomData",
"(",
"'classes'",
")",
";",
"if",
"(",
"!",
"this",
".",
"hasClass",
"(",
"cls",
")",
")",
"{",
"!",
"classes",
"&&",
"(",
"classes",
"=",
"[",
"]",
")",
",",
... | Adds a CSS class name to this editable that needs to be removed on detaching.
@param {String} className The class name to be added.
@see CKEDITOR.dom.element#addClass | [
"Adds",
"a",
"CSS",
"class",
"name",
"to",
"this",
"editable",
"that",
"needs",
"to",
"be",
"removed",
"on",
"detaching",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/editable.js#L206-L213 | |
57,072 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/editable.js | function( attr, val ) {
var orgVal = this.getAttribute( attr );
if ( val !== orgVal ) {
!this._.attrChanges && ( this._.attrChanges = {} );
// Saved the original attribute val.
if ( !( attr in this._.attrChanges ) )
this._.attrChanges[ attr ] = orgVal;
this.setAttribute( attr, val );... | javascript | function( attr, val ) {
var orgVal = this.getAttribute( attr );
if ( val !== orgVal ) {
!this._.attrChanges && ( this._.attrChanges = {} );
// Saved the original attribute val.
if ( !( attr in this._.attrChanges ) )
this._.attrChanges[ attr ] = orgVal;
this.setAttribute( attr, val );... | [
"function",
"(",
"attr",
",",
"val",
")",
"{",
"var",
"orgVal",
"=",
"this",
".",
"getAttribute",
"(",
"attr",
")",
";",
"if",
"(",
"val",
"!==",
"orgVal",
")",
"{",
"!",
"this",
".",
"_",
".",
"attrChanges",
"&&",
"(",
"this",
".",
"_",
".",
"... | Make an attribution change that would be reverted on editable detaching.
@param {String} attr The attribute name to be changed.
@param {String} val The value of specified attribute. | [
"Make",
"an",
"attribution",
"change",
"that",
"would",
"be",
"reverted",
"on",
"editable",
"detaching",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/editable.js#L220-L231 | |
57,073 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/editable.js | function( element, range ) {
var editor = this.editor,
enterMode = editor.config.enterMode,
elementName = element.getName(),
isBlock = CKEDITOR.dtd.$block[ elementName ];
if ( range.checkReadOnly() )
return false;
// Remove the original contents, merge split nodes.
range.deleteCont... | javascript | function( element, range ) {
var editor = this.editor,
enterMode = editor.config.enterMode,
elementName = element.getName(),
isBlock = CKEDITOR.dtd.$block[ elementName ];
if ( range.checkReadOnly() )
return false;
// Remove the original contents, merge split nodes.
range.deleteCont... | [
"function",
"(",
"element",
",",
"range",
")",
"{",
"var",
"editor",
"=",
"this",
".",
"editor",
",",
"enterMode",
"=",
"editor",
".",
"config",
".",
"enterMode",
",",
"elementName",
"=",
"element",
".",
"getName",
"(",
")",
",",
"isBlock",
"=",
"CKEDI... | Inserts an element into the position in the editor determined by range.
@param {CKEDITOR.dom.element} element The element to be inserted.
@param {CKEDITOR.dom.range} range The range as a place of insertion.
@returns {Boolean} Informs whether insertion was successful. | [
"Inserts",
"an",
"element",
"into",
"the",
"position",
"in",
"the",
"editor",
"determined",
"by",
"range",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/editable.js#L311-L359 | |
57,074 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/editable.js | function( element ) {
// Prepare for the insertion. For example - focus editor (#11848).
beforeInsert( this );
var editor = this.editor,
enterMode = editor.activeEnterMode,
selection = editor.getSelection(),
range = selection.getRanges()[ 0 ],
elementName = element.getName(),
isBlo... | javascript | function( element ) {
// Prepare for the insertion. For example - focus editor (#11848).
beforeInsert( this );
var editor = this.editor,
enterMode = editor.activeEnterMode,
selection = editor.getSelection(),
range = selection.getRanges()[ 0 ],
elementName = element.getName(),
isBlo... | [
"function",
"(",
"element",
")",
"{",
"// Prepare for the insertion. For example - focus editor (#11848).",
"beforeInsert",
"(",
"this",
")",
";",
"var",
"editor",
"=",
"this",
".",
"editor",
",",
"enterMode",
"=",
"editor",
".",
"activeEnterMode",
",",
"selection",
... | Inserts an element into the currently selected position in the editor.
@param {CKEDITOR.dom.element} element The element to be inserted. | [
"Inserts",
"an",
"element",
"into",
"the",
"currently",
"selected",
"position",
"in",
"the",
"editor",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/editable.js#L366-L409 | |
57,075 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/editable.js | needsBrFiller | function needsBrFiller( selection, path ) {
// Fake selection does not need filler, because it is fake.
if ( selection.isFake )
return 0;
// Ensure bogus br could help to move cursor (out of styles) to the end of block. (#7041)
var pathBlock = path.block || path.blockLimit,
lastNode = pathBlock && pathBl... | javascript | function needsBrFiller( selection, path ) {
// Fake selection does not need filler, because it is fake.
if ( selection.isFake )
return 0;
// Ensure bogus br could help to move cursor (out of styles) to the end of block. (#7041)
var pathBlock = path.block || path.blockLimit,
lastNode = pathBlock && pathBl... | [
"function",
"needsBrFiller",
"(",
"selection",
",",
"path",
")",
"{",
"// Fake selection does not need filler, because it is fake.",
"if",
"(",
"selection",
".",
"isFake",
")",
"return",
"0",
";",
"// Ensure bogus br could help to move cursor (out of styles) to the end of block. ... | Checks whether current selection requires br filler to be appended. @returns Block which needs filler or falsy value. | [
"Checks",
"whether",
"current",
"selection",
"requires",
"br",
"filler",
"to",
"be",
"appended",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/editable.js#L965-L984 |
57,076 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/editable.js | prepareRangeToDataInsertion | function prepareRangeToDataInsertion( that ) {
var range = that.range,
mergeCandidates = that.mergeCandidates,
node, marker, path, startPath, endPath, previous, bm;
// If range starts in inline element then insert a marker, so empty
// inline elements won't be removed while range.deleteContents
// ... | javascript | function prepareRangeToDataInsertion( that ) {
var range = that.range,
mergeCandidates = that.mergeCandidates,
node, marker, path, startPath, endPath, previous, bm;
// If range starts in inline element then insert a marker, so empty
// inline elements won't be removed while range.deleteContents
// ... | [
"function",
"prepareRangeToDataInsertion",
"(",
"that",
")",
"{",
"var",
"range",
"=",
"that",
".",
"range",
",",
"mergeCandidates",
"=",
"that",
".",
"mergeCandidates",
",",
"node",
",",
"marker",
",",
"path",
",",
"startPath",
",",
"endPath",
",",
"previou... | Prepare range to its data deletion. Delete its contents. Prepare it to insertion. | [
"Prepare",
"range",
"to",
"its",
"data",
"deletion",
".",
"Delete",
"its",
"contents",
".",
"Prepare",
"it",
"to",
"insertion",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/editable.js#L1259-L1335 |
57,077 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/editable.js | stripBlockTagIfSingleLine | function stripBlockTagIfSingleLine( dataWrapper ) {
var block, children;
if ( dataWrapper.getChildCount() == 1 && // Only one node bein inserted.
checkIfElement( block = dataWrapper.getFirst() ) && // And it's an element.
block.is( stripSingleBlockTags ) ) // That's <p> or <div> or header.
{... | javascript | function stripBlockTagIfSingleLine( dataWrapper ) {
var block, children;
if ( dataWrapper.getChildCount() == 1 && // Only one node bein inserted.
checkIfElement( block = dataWrapper.getFirst() ) && // And it's an element.
block.is( stripSingleBlockTags ) ) // That's <p> or <div> or header.
{... | [
"function",
"stripBlockTagIfSingleLine",
"(",
"dataWrapper",
")",
"{",
"var",
"block",
",",
"children",
";",
"if",
"(",
"dataWrapper",
".",
"getChildCount",
"(",
")",
"==",
"1",
"&&",
"// Only one node bein inserted.",
"checkIfElement",
"(",
"block",
"=",
"dataWra... | Rule 7. | [
"Rule",
"7",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/editable.js#L1829-L1847 |
57,078 | mnichols/ankh | lib/kernel.js | Kernel | function Kernel(){
this.registrations = new Registrations()
this.decorators = new Decorators()
this.resolvers = {}
this.activators = {}
this._inflight = new Inflight(this.decorators)
registerSystemServices.call(this)
} | javascript | function Kernel(){
this.registrations = new Registrations()
this.decorators = new Decorators()
this.resolvers = {}
this.activators = {}
this._inflight = new Inflight(this.decorators)
registerSystemServices.call(this)
} | [
"function",
"Kernel",
"(",
")",
"{",
"this",
".",
"registrations",
"=",
"new",
"Registrations",
"(",
")",
"this",
".",
"decorators",
"=",
"new",
"Decorators",
"(",
")",
"this",
".",
"resolvers",
"=",
"{",
"}",
"this",
".",
"activators",
"=",
"{",
"}",
... | The workhorse for resolving dependencies
@class Kernel | [
"The",
"workhorse",
"for",
"resolving",
"dependencies"
] | b5f6eae24b2dece4025b4f11cea7f1560d3b345f | https://github.com/mnichols/ankh/blob/b5f6eae24b2dece4025b4f11cea7f1560d3b345f/lib/kernel.js#L91-L98 |
57,079 | vanng822/pstarter | lib/pstarter.js | forkWorkers | function forkWorkers(numWorkers, env) {
var workers = [];
env = env || {};
for(var i = 0; i < numWorkers; i++) {
worker = cluster.fork(env);
console.info("Start worker: " + worker.process.pid + ' at ' + (new Date()).toISOString());
workers.push(worker);
}
return workers;
} | javascript | function forkWorkers(numWorkers, env) {
var workers = [];
env = env || {};
for(var i = 0; i < numWorkers; i++) {
worker = cluster.fork(env);
console.info("Start worker: " + worker.process.pid + ' at ' + (new Date()).toISOString());
workers.push(worker);
}
return workers;
} | [
"function",
"forkWorkers",
"(",
"numWorkers",
",",
"env",
")",
"{",
"var",
"workers",
"=",
"[",
"]",
";",
"env",
"=",
"env",
"||",
"{",
"}",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"numWorkers",
";",
"i",
"++",
")",
"{",
"worker",... | Fork workers. | [
"Fork",
"workers",
"."
] | 2f6bc2eae3906f5270e38a6a2613a472aabf8af6 | https://github.com/vanng822/pstarter/blob/2f6bc2eae3906f5270e38a6a2613a472aabf8af6/lib/pstarter.js#L171-L180 |
57,080 | karlpatrickespiritu/args-checker-js | samples/sample.js | run | function run(booleanOrString, anyDataType, functionOrObject, aNumber, anArray) {
/*
* if expectations aren't met, args checker will throw appropriate exceptions
* notifying the user regarding the errors of the arguments.
* */
args.expect(arguments, ['boolean|string', '*', 'function|... | javascript | function run(booleanOrString, anyDataType, functionOrObject, aNumber, anArray) {
/*
* if expectations aren't met, args checker will throw appropriate exceptions
* notifying the user regarding the errors of the arguments.
* */
args.expect(arguments, ['boolean|string', '*', 'function|... | [
"function",
"run",
"(",
"booleanOrString",
",",
"anyDataType",
",",
"functionOrObject",
",",
"aNumber",
",",
"anArray",
")",
"{",
"/*\n * if expectations aren't met, args checker will throw appropriate exceptions\n * notifying the user regarding the errors of the arguments.... | sample method.
@param {boolean/string}
@param {mixed/optional}
@param {function/object}
@param {number} | [
"sample",
"method",
"."
] | 7c46f20ae3e8854ef16c6cd7794f60a6b570ca31 | https://github.com/karlpatrickespiritu/args-checker-js/blob/7c46f20ae3e8854ef16c6cd7794f60a6b570ca31/samples/sample.js#L12-L21 |
57,081 | xStorage/xS-js-libp2p-mplex | src/muxer.js | catchError | function catchError (stream) {
return {
source: pull(
stream.source,
pullCatch((err) => {
if (err.message === 'Channel destroyed') {
return
}
return false
})
),
sink: stream.sink
}
} | javascript | function catchError (stream) {
return {
source: pull(
stream.source,
pullCatch((err) => {
if (err.message === 'Channel destroyed') {
return
}
return false
})
),
sink: stream.sink
}
} | [
"function",
"catchError",
"(",
"stream",
")",
"{",
"return",
"{",
"source",
":",
"pull",
"(",
"stream",
".",
"source",
",",
"pullCatch",
"(",
"(",
"err",
")",
"=>",
"{",
"if",
"(",
"err",
".",
"message",
"===",
"'Channel destroyed'",
")",
"{",
"return"... | Catch error makes sure that even though we get the "Channel destroyed" error from when closing streams, that it's not leaking through since it's not really an error for us, channels shoul close cleanly. | [
"Catch",
"error",
"makes",
"sure",
"that",
"even",
"though",
"we",
"get",
"the",
"Channel",
"destroyed",
"error",
"from",
"when",
"closing",
"streams",
"that",
"it",
"s",
"not",
"leaking",
"through",
"since",
"it",
"s",
"not",
"really",
"an",
"error",
"for... | 99616ac226e3f119c1f2b72524e4c7e61a346ba7 | https://github.com/xStorage/xS-js-libp2p-mplex/blob/99616ac226e3f119c1f2b72524e4c7e61a346ba7/src/muxer.js#L17-L30 |
57,082 | yoshuawuyts/dates-of-today | index.js | datesOfToday | function datesOfToday () {
const ret = {}
ret.year = String(new Date().getFullYear())
ret.month = prefix(String(new Date().getMonth()))
ret.day = prefix(String(new Date().getDate()))
ret.date = [ret.year, ret.month, ret.day].join('-')
return ret
} | javascript | function datesOfToday () {
const ret = {}
ret.year = String(new Date().getFullYear())
ret.month = prefix(String(new Date().getMonth()))
ret.day = prefix(String(new Date().getDate()))
ret.date = [ret.year, ret.month, ret.day].join('-')
return ret
} | [
"function",
"datesOfToday",
"(",
")",
"{",
"const",
"ret",
"=",
"{",
"}",
"ret",
".",
"year",
"=",
"String",
"(",
"new",
"Date",
"(",
")",
".",
"getFullYear",
"(",
")",
")",
"ret",
".",
"month",
"=",
"prefix",
"(",
"String",
"(",
"new",
"Date",
"... | get today's date null -> null | [
"get",
"today",
"s",
"date",
"null",
"-",
">",
"null"
] | 77a67ac8e443f3c0c01798aba6be11cdccda2c25 | https://github.com/yoshuawuyts/dates-of-today/blob/77a67ac8e443f3c0c01798aba6be11cdccda2c25/index.js#L5-L14 |
57,083 | char1e5/ot-webdriverjs | _base.js | closureRequire | function closureRequire(symbol) {
closure.goog.require(symbol);
return closure.goog.getObjectByName(symbol);
} | javascript | function closureRequire(symbol) {
closure.goog.require(symbol);
return closure.goog.getObjectByName(symbol);
} | [
"function",
"closureRequire",
"(",
"symbol",
")",
"{",
"closure",
".",
"goog",
".",
"require",
"(",
"symbol",
")",
";",
"return",
"closure",
".",
"goog",
".",
"getObjectByName",
"(",
"symbol",
")",
";",
"}"
] | Loads a symbol by name from the protected Closure context.
@param {string} symbol The symbol to load.
@return {?} The loaded symbol, or {@code null} if not found.
@throws {Error} If the symbol has not been defined. | [
"Loads",
"a",
"symbol",
"by",
"name",
"from",
"the",
"protected",
"Closure",
"context",
"."
] | 5fc8cabcb481602673f1d47cdf544d681c35f784 | https://github.com/char1e5/ot-webdriverjs/blob/5fc8cabcb481602673f1d47cdf544d681c35f784/_base.js#L125-L128 |
57,084 | 7ictor/gulp-couchapp | index.js | buildURL | function buildURL(dbName, opts) {
var authentication
opts.scheme = opts.scheme || 'http'
opts.host = opts.host || '127.0.0.1'
opts.port = opts.port || '5984'
if (has(opts, 'auth')) {
if (typeof opts.auth === 'object') {
authentication = opts.auth.username + ':' + opts.auth.password + '@'
... | javascript | function buildURL(dbName, opts) {
var authentication
opts.scheme = opts.scheme || 'http'
opts.host = opts.host || '127.0.0.1'
opts.port = opts.port || '5984'
if (has(opts, 'auth')) {
if (typeof opts.auth === 'object') {
authentication = opts.auth.username + ':' + opts.auth.password + '@'
... | [
"function",
"buildURL",
"(",
"dbName",
",",
"opts",
")",
"{",
"var",
"authentication",
"opts",
".",
"scheme",
"=",
"opts",
".",
"scheme",
"||",
"'http'",
"opts",
".",
"host",
"=",
"opts",
".",
"host",
"||",
"'127.0.0.1'",
"opts",
".",
"port",
"=",
"opt... | Build the URL to push CouchApp.
@param {String} dbName
@param {Object} opts
@return {String} | [
"Build",
"the",
"URL",
"to",
"push",
"CouchApp",
"."
] | 01269cdce8f176fb71212f8e475afc44842b2cc1 | https://github.com/7ictor/gulp-couchapp/blob/01269cdce8f176fb71212f8e475afc44842b2cc1/index.js#L31-L44 |
57,085 | 7ictor/gulp-couchapp | index.js | pushCouchapp | function pushCouchapp(dbName, opts) {
opts = opts || {}
if (!dbName && typeof dbName !== 'string') {
throw new PluginError(PLUGIN_NAME, 'Missing database name.');
}
return through.obj(function (file, enc, cb) {
var ddocObj = require(file.path)
var url = /^https?:\/\//.test(dbName) ? dbName : build... | javascript | function pushCouchapp(dbName, opts) {
opts = opts || {}
if (!dbName && typeof dbName !== 'string') {
throw new PluginError(PLUGIN_NAME, 'Missing database name.');
}
return through.obj(function (file, enc, cb) {
var ddocObj = require(file.path)
var url = /^https?:\/\//.test(dbName) ? dbName : build... | [
"function",
"pushCouchapp",
"(",
"dbName",
",",
"opts",
")",
"{",
"opts",
"=",
"opts",
"||",
"{",
"}",
"if",
"(",
"!",
"dbName",
"&&",
"typeof",
"dbName",
"!==",
"'string'",
")",
"{",
"throw",
"new",
"PluginError",
"(",
"PLUGIN_NAME",
",",
"'Missing data... | Push a CouchApp to a CouchDB database.
@param {String} db
@param {Object} opts
@return {Stream} | [
"Push",
"a",
"CouchApp",
"to",
"a",
"CouchDB",
"database",
"."
] | 01269cdce8f176fb71212f8e475afc44842b2cc1 | https://github.com/7ictor/gulp-couchapp/blob/01269cdce8f176fb71212f8e475afc44842b2cc1/index.js#L53-L90 |
57,086 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/colordialog/dialogs/colordialog.js | whiteOrBlack | function whiteOrBlack( color ) {
color = color.replace( /^#/, '' );
for ( var i = 0, rgb = []; i <= 2; i++ )
rgb[ i ] = parseInt( color.substr( i * 2, 2 ), 16 );
var luma = ( 0.2126 * rgb[ 0 ] ) + ( 0.7152 * rgb[ 1 ] ) + ( 0.0722 * rgb[ 2 ] );
return '#' + ( luma >= 165 ? '000' : 'fff' );
} | javascript | function whiteOrBlack( color ) {
color = color.replace( /^#/, '' );
for ( var i = 0, rgb = []; i <= 2; i++ )
rgb[ i ] = parseInt( color.substr( i * 2, 2 ), 16 );
var luma = ( 0.2126 * rgb[ 0 ] ) + ( 0.7152 * rgb[ 1 ] ) + ( 0.0722 * rgb[ 2 ] );
return '#' + ( luma >= 165 ? '000' : 'fff' );
} | [
"function",
"whiteOrBlack",
"(",
"color",
")",
"{",
"color",
"=",
"color",
".",
"replace",
"(",
"/",
"^#",
"/",
",",
"''",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"rgb",
"=",
"[",
"]",
";",
"i",
"<=",
"2",
";",
"i",
"++",
")",
"rgb... | Basing black-white decision off of luma scheme using the Rec. 709 version | [
"Basing",
"black",
"-",
"white",
"decision",
"off",
"of",
"luma",
"scheme",
"using",
"the",
"Rec",
".",
"709",
"version"
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/colordialog/dialogs/colordialog.js#L41-L47 |
57,087 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/colordialog/dialogs/colordialog.js | updateHighlight | function updateHighlight( event ) {
// Convert to event.
!event.name && ( event = new CKEDITOR.event( event ) );
var isFocus = !( /mouse/ ).test( event.name ),
target = event.data.getTarget(),
color;
if ( target.getName() == 'td' && ( color = target.getChild( 0 ).getHtml() ) ) {
removeHighli... | javascript | function updateHighlight( event ) {
// Convert to event.
!event.name && ( event = new CKEDITOR.event( event ) );
var isFocus = !( /mouse/ ).test( event.name ),
target = event.data.getTarget(),
color;
if ( target.getName() == 'td' && ( color = target.getChild( 0 ).getHtml() ) ) {
removeHighli... | [
"function",
"updateHighlight",
"(",
"event",
")",
"{",
"// Convert to event.\r",
"!",
"event",
".",
"name",
"&&",
"(",
"event",
"=",
"new",
"CKEDITOR",
".",
"event",
"(",
"event",
")",
")",
";",
"var",
"isFocus",
"=",
"!",
"(",
"/",
"mouse",
"/",
")",
... | Apply highlight style. | [
"Apply",
"highlight",
"style",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/colordialog/dialogs/colordialog.js#L53-L75 |
57,088 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/colordialog/dialogs/colordialog.js | removeHighlight | function removeHighlight( event ) {
var isFocus = !( /mouse/ ).test( event.name ),
target = isFocus && focused;
if ( target ) {
var color = target.getChild( 0 ).getHtml();
target.setStyle( 'border-color', color );
target.setStyle( 'border-style', 'solid' );
}
if ( !( focused || hovered )... | javascript | function removeHighlight( event ) {
var isFocus = !( /mouse/ ).test( event.name ),
target = isFocus && focused;
if ( target ) {
var color = target.getChild( 0 ).getHtml();
target.setStyle( 'border-color', color );
target.setStyle( 'border-style', 'solid' );
}
if ( !( focused || hovered )... | [
"function",
"removeHighlight",
"(",
"event",
")",
"{",
"var",
"isFocus",
"=",
"!",
"(",
"/",
"mouse",
"/",
")",
".",
"test",
"(",
"event",
".",
"name",
")",
",",
"target",
"=",
"isFocus",
"&&",
"focused",
";",
"if",
"(",
"target",
")",
"{",
"var",
... | Remove previously focused style. | [
"Remove",
"previously",
"focused",
"style",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/colordialog/dialogs/colordialog.js#L87-L101 |
57,089 | redisjs/jsr-validate | lib/validators/type.js | num | function num(type, value) {
var val;
if(type === NUMERIC.INTEGER) {
val = utils.strtoint(value);
if(isNaN(val)) throw IntegerRange;
}else{
val = utils.strtofloat(value);
if(isNaN(val)) throw InvalidFloat;
}
return val;
} | javascript | function num(type, value) {
var val;
if(type === NUMERIC.INTEGER) {
val = utils.strtoint(value);
if(isNaN(val)) throw IntegerRange;
}else{
val = utils.strtofloat(value);
if(isNaN(val)) throw InvalidFloat;
}
return val;
} | [
"function",
"num",
"(",
"type",
",",
"value",
")",
"{",
"var",
"val",
";",
"if",
"(",
"type",
"===",
"NUMERIC",
".",
"INTEGER",
")",
"{",
"val",
"=",
"utils",
".",
"strtoint",
"(",
"value",
")",
";",
"if",
"(",
"isNaN",
"(",
"val",
")",
")",
"t... | Helper for testing numeric types.
Throws an error if the coerced type is NaN.
@param type The type constant.
@param value The value to test.
@return The coerced value. | [
"Helper",
"for",
"testing",
"numeric",
"types",
"."
] | 2e0dddafb32c019ef9293a35b96cdd78dd8e4ae5 | https://github.com/redisjs/jsr-validate/blob/2e0dddafb32c019ef9293a35b96cdd78dd8e4ae5/lib/validators/type.js#L21-L31 |
57,090 | redisjs/jsr-validate | lib/validators/type.js | type | function type(cmd, args, info) {
// definition provided by earlier command validation
/* istanbul ignore next: currently subcommands do not type validate */
var def = info.command.sub ? info.command.sub.def : info.command.def
// expected type of the value based on the supplied command
, expected = TYPES[c... | javascript | function type(cmd, args, info) {
// definition provided by earlier command validation
/* istanbul ignore next: currently subcommands do not type validate */
var def = info.command.sub ? info.command.sub.def : info.command.def
// expected type of the value based on the supplied command
, expected = TYPES[c... | [
"function",
"type",
"(",
"cmd",
",",
"args",
",",
"info",
")",
"{",
"// definition provided by earlier command validation",
"/* istanbul ignore next: currently subcommands do not type validate */",
"var",
"def",
"=",
"info",
".",
"command",
".",
"sub",
"?",
"info",
".",
... | Validate whether a command is operating on the correct type.
@param cmd The command name (lowercase).
@param args The command arguments, must be an array.
@param info The server information. | [
"Validate",
"whether",
"a",
"command",
"is",
"operating",
"on",
"the",
"correct",
"type",
"."
] | 2e0dddafb32c019ef9293a35b96cdd78dd8e4ae5 | https://github.com/redisjs/jsr-validate/blob/2e0dddafb32c019ef9293a35b96cdd78dd8e4ae5/lib/validators/type.js#L40-L126 |
57,091 | oskarhagberg/gbgcity | lib/airquality.js | getMeasurements | function getMeasurements(startDate, endDate, params, callback) {
params = params || {};
if(!startDate && !endDate) {
startDate = new Date();
startDate.setHours(startDate.getHours() - 24);
startDate = formatDate(startDate);
endDate = new Date();
endDate = formatDate(endDate);
}
... | javascript | function getMeasurements(startDate, endDate, params, callback) {
params = params || {};
if(!startDate && !endDate) {
startDate = new Date();
startDate.setHours(startDate.getHours() - 24);
startDate = formatDate(startDate);
endDate = new Date();
endDate = formatDate(endDate);
}
... | [
"function",
"getMeasurements",
"(",
"startDate",
",",
"endDate",
",",
"params",
",",
"callback",
")",
"{",
"params",
"=",
"params",
"||",
"{",
"}",
";",
"if",
"(",
"!",
"startDate",
"&&",
"!",
"endDate",
")",
"{",
"startDate",
"=",
"new",
"Date",
"(",
... | Returns a list of measurements
@memberof module:gbgcity/AirQuality
@param {Date} startDate From when to get measurements
@param {Date} endDate To when to get measurements
@param {Object} [params] An object containing additional parameters.
@param {Function} callback The function to call with results, function({Error} ... | [
"Returns",
"a",
"list",
"of",
"measurements"
] | d2de903b2fba83cc953ae218905380fef080cb2d | https://github.com/oskarhagberg/gbgcity/blob/d2de903b2fba83cc953ae218905380fef080cb2d/lib/airquality.js#L37-L49 |
57,092 | cliffano/eggtart | lib/validator.js | validate | function validate(rules, args, cb) {
try {
_known(rules, args);
_required(rules, args);
Object.keys(args).forEach(function (arg) {
var value = args[arg],
ruleSet = rules[arg];
try {
ruleSet.forEach(function (rule) {
if (rule !== 'required') {
exports.ch... | javascript | function validate(rules, args, cb) {
try {
_known(rules, args);
_required(rules, args);
Object.keys(args).forEach(function (arg) {
var value = args[arg],
ruleSet = rules[arg];
try {
ruleSet.forEach(function (rule) {
if (rule !== 'required') {
exports.ch... | [
"function",
"validate",
"(",
"rules",
",",
"args",
",",
"cb",
")",
"{",
"try",
"{",
"_known",
"(",
"rules",
",",
"args",
")",
";",
"_required",
"(",
"rules",
",",
"args",
")",
";",
"Object",
".",
"keys",
"(",
"args",
")",
".",
"forEach",
"(",
"fu... | Validate arguments against a set of rules.
@param {Object} rules: argument name-ruleset pair, ruleset is an array of check functions
@param {Object} args: argument name-value pair
@param {Function} cb: standard cb(err, result) callback | [
"Validate",
"arguments",
"against",
"a",
"set",
"of",
"rules",
"."
] | 12b33ea12c5f5bdcdf8559260e46bc5b5137526f | https://github.com/cliffano/eggtart/blob/12b33ea12c5f5bdcdf8559260e46bc5b5137526f/lib/validator.js#L11-L37 |
57,093 | yoshuawuyts/object-join | index.js | clone | function clone(obj1, obj2, index) {
index = index || 0;
for (var i in obj2) {
if ('object' == typeof i) obj1[i] = recursiveMerge(obj1[i], obj2[i], index++);
else obj1[i] = obj2[i];
}
return obj1;
} | javascript | function clone(obj1, obj2, index) {
index = index || 0;
for (var i in obj2) {
if ('object' == typeof i) obj1[i] = recursiveMerge(obj1[i], obj2[i], index++);
else obj1[i] = obj2[i];
}
return obj1;
} | [
"function",
"clone",
"(",
"obj1",
",",
"obj2",
",",
"index",
")",
"{",
"index",
"=",
"index",
"||",
"0",
";",
"for",
"(",
"var",
"i",
"in",
"obj2",
")",
"{",
"if",
"(",
"'object'",
"==",
"typeof",
"i",
")",
"obj1",
"[",
"i",
"]",
"=",
"recursiv... | Merge the properties from one object to another object. If duplicate keys
exist on the same level, obj2 takes presedence over obj1.
@param {Object} obj1
@param {Object} obj2
@param {Number} index
@return {Object}
@api private | [
"Merge",
"the",
"properties",
"from",
"one",
"object",
"to",
"another",
"object",
".",
"If",
"duplicate",
"keys",
"exist",
"on",
"the",
"same",
"level",
"obj2",
"takes",
"presedence",
"over",
"obj1",
"."
] | 74cb333080c687e233757f67d930135ae8c809a3 | https://github.com/yoshuawuyts/object-join/blob/74cb333080c687e233757f67d930135ae8c809a3/index.js#L35-L42 |
57,094 | papandreou/node-fsplusgit | lib/FsPlusGit.js | addContentsDirectoryToReaddirResultAndCallOriginalCallback | function addContentsDirectoryToReaddirResultAndCallOriginalCallback(err, entryNames) {
if (!err && Array.isArray(entryNames)) {
entryNames = ['gitFakeFs'].concat(entryNames);
}
cb.call(thi... | javascript | function addContentsDirectoryToReaddirResultAndCallOriginalCallback(err, entryNames) {
if (!err && Array.isArray(entryNames)) {
entryNames = ['gitFakeFs'].concat(entryNames);
}
cb.call(thi... | [
"function",
"addContentsDirectoryToReaddirResultAndCallOriginalCallback",
"(",
"err",
",",
"entryNames",
")",
"{",
"if",
"(",
"!",
"err",
"&&",
"Array",
".",
"isArray",
"(",
"entryNames",
")",
")",
"{",
"entryNames",
"=",
"[",
"'gitFakeFs'",
"]",
".",
"concat",
... | Intercept the result and add the 'gitFakeFs' dir | [
"Intercept",
"the",
"result",
"and",
"add",
"the",
"gitFakeFs",
"dir"
] | 3445dcdb4c92f267acf009bf7c4156e014788cfb | https://github.com/papandreou/node-fsplusgit/blob/3445dcdb4c92f267acf009bf7c4156e014788cfb/lib/FsPlusGit.js#L121-L126 |
57,095 | kallaspriit/html-literal | build/src/index.js | html | function html(template) {
var expressions = [];
for (var _i = 1; _i < arguments.length; _i++) {
expressions[_i - 1] = arguments[_i];
}
var result = "";
var i = 0;
// resolve each expression and build the result string
for (var _a = 0, template_1 = template; _a < template_1.length; _a... | javascript | function html(template) {
var expressions = [];
for (var _i = 1; _i < arguments.length; _i++) {
expressions[_i - 1] = arguments[_i];
}
var result = "";
var i = 0;
// resolve each expression and build the result string
for (var _a = 0, template_1 = template; _a < template_1.length; _a... | [
"function",
"html",
"(",
"template",
")",
"{",
"var",
"expressions",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"_i",
"=",
"1",
";",
"_i",
"<",
"arguments",
".",
"length",
";",
"_i",
"++",
")",
"{",
"expressions",
"[",
"_i",
"-",
"1",
"]",
"=",
"ar... | html tag function, accepts simple values, arrays, promises | [
"html",
"tag",
"function",
"accepts",
"simple",
"values",
"arrays",
"promises"
] | 8965f39dfdc5a63a25a20f2a8cbc1dbfc9ecfdc3 | https://github.com/kallaspriit/html-literal/blob/8965f39dfdc5a63a25a20f2a8cbc1dbfc9ecfdc3/build/src/index.js#L9-L25 |
57,096 | posttool/currentcms | lib/public/js/lib/ck/plugins/table/dialogs/table.js | validatorNum | function validatorNum( msg ) {
return function() {
var value = this.getValue(),
pass = !!( CKEDITOR.dialog.validate.integer()( value ) && value > 0 );
if ( !pass ) {
alert( msg );
this.select();
}
return pass;
};
} | javascript | function validatorNum( msg ) {
return function() {
var value = this.getValue(),
pass = !!( CKEDITOR.dialog.validate.integer()( value ) && value > 0 );
if ( !pass ) {
alert( msg );
this.select();
}
return pass;
};
} | [
"function",
"validatorNum",
"(",
"msg",
")",
"{",
"return",
"function",
"(",
")",
"{",
"var",
"value",
"=",
"this",
".",
"getValue",
"(",
")",
",",
"pass",
"=",
"!",
"!",
"(",
"CKEDITOR",
".",
"dialog",
".",
"validate",
".",
"integer",
"(",
")",
"(... | Whole-positive-integer validator. | [
"Whole",
"-",
"positive",
"-",
"integer",
"validator",
"."
] | 9afc9f907bad3b018d961af66c3abb33cd82b051 | https://github.com/posttool/currentcms/blob/9afc9f907bad3b018d961af66c3abb33cd82b051/lib/public/js/lib/ck/plugins/table/dialogs/table.js#L34-L46 |
57,097 | lorenwest/monitor-min | lib/Router.js | function(monitor, callback) {
callback = callback || function(){};
var t = this,
monitorJSON = monitor.toMonitorJSON(),
probeJSON = null,
probeClass = monitorJSON.probeClass,
startTime = Date.now(),
monitorStr = probeClass + '.' + monitor.toServerString().r... | javascript | function(monitor, callback) {
callback = callback || function(){};
var t = this,
monitorJSON = monitor.toMonitorJSON(),
probeJSON = null,
probeClass = monitorJSON.probeClass,
startTime = Date.now(),
monitorStr = probeClass + '.' + monitor.toServerString().r... | [
"function",
"(",
"monitor",
",",
"callback",
")",
"{",
"callback",
"=",
"callback",
"||",
"function",
"(",
")",
"{",
"}",
";",
"var",
"t",
"=",
"this",
",",
"monitorJSON",
"=",
"monitor",
".",
"toMonitorJSON",
"(",
")",
",",
"probeJSON",
"=",
"null",
... | Connect a Monitor object to a remote Probe
This accepts an instance of a Monitor and figures out how to connect it
to a running Probe.
Upon callback the probe data is set into the monitor (unless an error
occurred)
@method connectMonitor
@protected
@param monitor {Monitor} - The monitor requesting to connect with th... | [
"Connect",
"a",
"Monitor",
"object",
"to",
"a",
"remote",
"Probe"
] | 859ba34a121498dc1cb98577ae24abd825407fca | https://github.com/lorenwest/monitor-min/blob/859ba34a121498dc1cb98577ae24abd825407fca/lib/Router.js#L238-L290 | |
57,098 | lorenwest/monitor-min | lib/Router.js | function(monitorJSON, callback) {
// Build a key for this probe from the probeClass and initParams
var t = this,
probeKey = t.buildProbeKey(monitorJSON),
probeClass = monitorJSON.probeClass,
initParams = monitorJSON.initParams,
probeImpl = null;
var whenDone =... | javascript | function(monitorJSON, callback) {
// Build a key for this probe from the probeClass and initParams
var t = this,
probeKey = t.buildProbeKey(monitorJSON),
probeClass = monitorJSON.probeClass,
initParams = monitorJSON.initParams,
probeImpl = null;
var whenDone =... | [
"function",
"(",
"monitorJSON",
",",
"callback",
")",
"{",
"// Build a key for this probe from the probeClass and initParams",
"var",
"t",
"=",
"this",
",",
"probeKey",
"=",
"t",
".",
"buildProbeKey",
"(",
"monitorJSON",
")",
",",
"probeClass",
"=",
"monitorJSON",
"... | Connect to an internal probe implementation
This connects with a probe running in this process. It will instantiate
the probe if it isn't currently running.
@method connectInternal
@protected
@param monitorJSON {Object} - The monitor toJSON data. Containing:
@param monitorJSON.probeClass {String} - The probe class ... | [
"Connect",
"to",
"an",
"internal",
"probe",
"implementation"
] | 859ba34a121498dc1cb98577ae24abd825407fca | https://github.com/lorenwest/monitor-min/blob/859ba34a121498dc1cb98577ae24abd825407fca/lib/Router.js#L645-L721 | |
57,099 | Nichejs/Seminarjs | private/lib/core/connect.js | connect | function connect() {
// detect type of each argument
for (var i = 0; i < arguments.length; i++) {
if (arguments[i].constructor.name === 'Mongoose') {
// detected Mongoose
this.mongoose = arguments[i];
} else if (arguments[i].name === 'app') {
// detected Express app
this.app = arguments[i];
}
}
re... | javascript | function connect() {
// detect type of each argument
for (var i = 0; i < arguments.length; i++) {
if (arguments[i].constructor.name === 'Mongoose') {
// detected Mongoose
this.mongoose = arguments[i];
} else if (arguments[i].name === 'app') {
// detected Express app
this.app = arguments[i];
}
}
re... | [
"function",
"connect",
"(",
")",
"{",
"// detect type of each argument",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"arguments",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"arguments",
"[",
"i",
"]",
".",
"constructor",
".",
"name",
"=... | Connects Seminarjs to the application's mongoose instance.
####Example:
var mongoose = require('mongoose');
seminarjs.connect(mongoose);
@param {Object} connections
@api public | [
"Connects",
"Seminarjs",
"to",
"the",
"application",
"s",
"mongoose",
"instance",
"."
] | 53c4c1d5c33ffbf6320b10f25679bf181cbf853e | https://github.com/Nichejs/Seminarjs/blob/53c4c1d5c33ffbf6320b10f25679bf181cbf853e/private/lib/core/connect.js#L14-L26 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.