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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
50,000 | origin1tech/chek | dist/modules/array.js | push | function push(arr) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
arr = arr.concat(flatten.apply(void 0, args));
return {
array: arr,
val: arr.length
};
} | javascript | function push(arr) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
arr = arr.concat(flatten.apply(void 0, args));
return {
array: arr,
val: arr.length
};
} | [
"function",
"push",
"(",
"arr",
")",
"{",
"var",
"args",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"_i",
"=",
"1",
";",
"_i",
"<",
"arguments",
".",
"length",
";",
"_i",
"++",
")",
"{",
"args",
"[",
"_i",
"-",
"1",
"]",
"=",
"arguments",
"[",
... | Push
Non mutating way to push to an array.
@param arr the array to push items to.
@param args the items to be added. | [
"Push",
"Non",
"mutating",
"way",
"to",
"push",
"to",
"an",
"array",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/array.js#L249-L259 |
50,001 | origin1tech/chek | dist/modules/array.js | splice | function splice(arr, start, remove) {
var items = [];
for (var _i = 3; _i < arguments.length; _i++) {
items[_i - 3] = arguments[_i];
}
start = start || 0;
var head = arr.slice(0, start);
var tail = arr.slice(start);
var removed = [];
if (remove) {
removed = tail.slice(0, ... | javascript | function splice(arr, start, remove) {
var items = [];
for (var _i = 3; _i < arguments.length; _i++) {
items[_i - 3] = arguments[_i];
}
start = start || 0;
var head = arr.slice(0, start);
var tail = arr.slice(start);
var removed = [];
if (remove) {
removed = tail.slice(0, ... | [
"function",
"splice",
"(",
"arr",
",",
"start",
",",
"remove",
")",
"{",
"var",
"items",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"_i",
"=",
"3",
";",
"_i",
"<",
"arguments",
".",
"length",
";",
"_i",
"++",
")",
"{",
"items",
"[",
"_i",
"-",
"3... | Splice
Non mutating way of splicing an array.
@param arr the array to be spliced.
@param start the starting index (default: 0)
@param remove the count to be spliced (default: 1)
@param items additional items to be concatenated. | [
"Splice",
"Non",
"mutating",
"way",
"of",
"splicing",
"an",
"array",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/array.js#L287-L311 |
50,002 | origin1tech/chek | dist/modules/array.js | unshift | function unshift(arr) {
var items = [];
for (var _i = 1; _i < arguments.length; _i++) {
items[_i - 1] = arguments[_i];
}
arr = arr.concat(flatten(items));
return {
array: arr,
val: arr.length
};
} | javascript | function unshift(arr) {
var items = [];
for (var _i = 1; _i < arguments.length; _i++) {
items[_i - 1] = arguments[_i];
}
arr = arr.concat(flatten(items));
return {
array: arr,
val: arr.length
};
} | [
"function",
"unshift",
"(",
"arr",
")",
"{",
"var",
"items",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"_i",
"=",
"1",
";",
"_i",
"<",
"arguments",
".",
"length",
";",
"_i",
"++",
")",
"{",
"items",
"[",
"_i",
"-",
"1",
"]",
"=",
"arguments",
"[... | Unshift
Unshifts a value to an array in a non mutable way.
@param arr the array to be unshifted.
@param value the value to be unshifted | [
"Unshift",
"Unshifts",
"a",
"value",
"to",
"an",
"array",
"in",
"a",
"non",
"mutable",
"way",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/array.js#L320-L330 |
50,003 | hydrojs/karma-hydro | index.js | init | function init(config) {
var hydroConfig = config.hydro || {};
var hydroJs = hydroConfig.path || dirname(dirname(require.resolve('hydro'))) + '/dist/hydro.js';
var before = hydroConfig.before || [];
config.files.unshift(createPattern(__dirname + '/adapter.js'));
config.files.unshift(createPattern(hydroJs));
... | javascript | function init(config) {
var hydroConfig = config.hydro || {};
var hydroJs = hydroConfig.path || dirname(dirname(require.resolve('hydro'))) + '/dist/hydro.js';
var before = hydroConfig.before || [];
config.files.unshift(createPattern(__dirname + '/adapter.js'));
config.files.unshift(createPattern(hydroJs));
... | [
"function",
"init",
"(",
"config",
")",
"{",
"var",
"hydroConfig",
"=",
"config",
".",
"hydro",
"||",
"{",
"}",
";",
"var",
"hydroJs",
"=",
"hydroConfig",
".",
"path",
"||",
"dirname",
"(",
"dirname",
"(",
"require",
".",
"resolve",
"(",
"'hydro'",
")"... | Insert hydro into the loaded files.
@param {Array} files
@api public | [
"Insert",
"hydro",
"into",
"the",
"loaded",
"files",
"."
] | a0d5e083b1ddd1c4fbc7d6fa29ed1b0d9d4a5193 | https://github.com/hydrojs/karma-hydro/blob/a0d5e083b1ddd1c4fbc7d6fa29ed1b0d9d4a5193/index.js#L32-L43 |
50,004 | 2dbibracte/rlog | public/bower_components/ui-bootstrap/misc/demo/assets/smoothscroll-angular-custom.js | function(element) {
// return value of html.getBoundingClientRect().top ... IE : 0, other browsers : -pageYOffset
if(element.nodeName === 'HTML') return -window.pageYOffset
return element.getBoundingClientRect().top + window.pageYOffset;
} | javascript | function(element) {
// return value of html.getBoundingClientRect().top ... IE : 0, other browsers : -pageYOffset
if(element.nodeName === 'HTML') return -window.pageYOffset
return element.getBoundingClientRect().top + window.pageYOffset;
} | [
"function",
"(",
"element",
")",
"{",
"// return value of html.getBoundingClientRect().top ... IE : 0, other browsers : -pageYOffset",
"if",
"(",
"element",
".",
"nodeName",
"===",
"'HTML'",
")",
"return",
"-",
"window",
".",
"pageYOffset",
"return",
"element",
".",
"getB... | Get the top position of an element in the document | [
"Get",
"the",
"top",
"position",
"of",
"an",
"element",
"in",
"the",
"document"
] | 10f63cf81ffcd23b37c70620c77942c885e3ce5e | https://github.com/2dbibracte/rlog/blob/10f63cf81ffcd23b37c70620c77942c885e3ce5e/public/bower_components/ui-bootstrap/misc/demo/assets/smoothscroll-angular-custom.js#L12-L16 | |
50,005 | 2dbibracte/rlog | public/bower_components/ui-bootstrap/misc/demo/assets/smoothscroll-angular-custom.js | function(el, duration, callback){
duration = duration || 500;
var start = window.pageYOffset;
if (typeof el === 'number') {
var end = parseInt(el);
} else {
var end = getTop(el);
}
var clock = Date.now();
var requestAnimationFrame = window.requestAnimationFrame ||
windo... | javascript | function(el, duration, callback){
duration = duration || 500;
var start = window.pageYOffset;
if (typeof el === 'number') {
var end = parseInt(el);
} else {
var end = getTop(el);
}
var clock = Date.now();
var requestAnimationFrame = window.requestAnimationFrame ||
windo... | [
"function",
"(",
"el",
",",
"duration",
",",
"callback",
")",
"{",
"duration",
"=",
"duration",
"||",
"500",
";",
"var",
"start",
"=",
"window",
".",
"pageYOffset",
";",
"if",
"(",
"typeof",
"el",
"===",
"'number'",
")",
"{",
"var",
"end",
"=",
"pars... | we use requestAnimationFrame to be called by the browser before every repaint if the first argument is an element then scroll to the top of this element if the first argument is numeric then scroll to this location if the callback exist, it is called when the scrolling is finished | [
"we",
"use",
"requestAnimationFrame",
"to",
"be",
"called",
"by",
"the",
"browser",
"before",
"every",
"repaint",
"if",
"the",
"first",
"argument",
"is",
"an",
"element",
"then",
"scroll",
"to",
"the",
"top",
"of",
"this",
"element",
"if",
"the",
"first",
... | 10f63cf81ffcd23b37c70620c77942c885e3ce5e | https://github.com/2dbibracte/rlog/blob/10f63cf81ffcd23b37c70620c77942c885e3ce5e/public/bower_components/ui-bootstrap/misc/demo/assets/smoothscroll-angular-custom.js#L35-L62 | |
50,006 | konfirm/devour-gulp | lib/devour.js | preload | function preload() {
var path = config.gulpFiles;
if (/^[^\/]/.test(path)) {
path = config.basePath + '/' + path;
}
glob.sync(path + '/*/*.js').map(function(file) {
return file.replace(path, '').split('/').filter(function(split) {
return !!split;
});
}).forEach(function(file) {
register(
... | javascript | function preload() {
var path = config.gulpFiles;
if (/^[^\/]/.test(path)) {
path = config.basePath + '/' + path;
}
glob.sync(path + '/*/*.js').map(function(file) {
return file.replace(path, '').split('/').filter(function(split) {
return !!split;
});
}).forEach(function(file) {
register(
... | [
"function",
"preload",
"(",
")",
"{",
"var",
"path",
"=",
"config",
".",
"gulpFiles",
";",
"if",
"(",
"/",
"^[^\\/]",
"/",
".",
"test",
"(",
"path",
")",
")",
"{",
"path",
"=",
"config",
".",
"basePath",
"+",
"'/'",
"+",
"path",
";",
"}",
"glob",... | Load all available tasks and pipes
@name preload
@access internal
@return void | [
"Load",
"all",
"available",
"tasks",
"and",
"pipes"
] | eed953ac3c582c653fd63cbbb4b550dd33e88d13 | https://github.com/konfirm/devour-gulp/blob/eed953ac3c582c653fd63cbbb4b550dd33e88d13/lib/devour.js#L49-L80 |
50,007 | konfirm/devour-gulp | lib/devour.js | register | function register(type, name, create) {
if (!(type in definitions)) {
definitions[type] = {};
}
if (type === 'pipe') {
create = chain(create, devour);
}
definitions[type][name] = create;
} | javascript | function register(type, name, create) {
if (!(type in definitions)) {
definitions[type] = {};
}
if (type === 'pipe') {
create = chain(create, devour);
}
definitions[type][name] = create;
} | [
"function",
"register",
"(",
"type",
",",
"name",
",",
"create",
")",
"{",
"if",
"(",
"!",
"(",
"type",
"in",
"definitions",
")",
")",
"{",
"definitions",
"[",
"type",
"]",
"=",
"{",
"}",
";",
"}",
"if",
"(",
"type",
"===",
"'pipe'",
")",
"{",
... | Register a task or pipe
@name resgister
@access internal
@param string type [accepts any value, actual values: 'task' or 'pipe']
@param string name
@param function create
@return void | [
"Register",
"a",
"task",
"or",
"pipe"
] | eed953ac3c582c653fd63cbbb4b550dd33e88d13 | https://github.com/konfirm/devour-gulp/blob/eed953ac3c582c653fd63cbbb4b550dd33e88d13/lib/devour.js#L91-L101 |
50,008 | konfirm/devour-gulp | lib/devour.js | plug | function plug(name) {
var part, scope;
if (!('buffer' in plug.prototype)) {
plug.prototype.buffer = {};
}
part = name.split('.');
scope = part.shift();
if (!(scope in plug.prototype.buffer)) {
plug.prototype.buffer[scope] = wanted.require('gulp-' + scope);
}
scope = plug.prototype.buffer[scop... | javascript | function plug(name) {
var part, scope;
if (!('buffer' in plug.prototype)) {
plug.prototype.buffer = {};
}
part = name.split('.');
scope = part.shift();
if (!(scope in plug.prototype.buffer)) {
plug.prototype.buffer[scope] = wanted.require('gulp-' + scope);
}
scope = plug.prototype.buffer[scop... | [
"function",
"plug",
"(",
"name",
")",
"{",
"var",
"part",
",",
"scope",
";",
"if",
"(",
"!",
"(",
"'buffer'",
"in",
"plug",
".",
"prototype",
")",
")",
"{",
"plug",
".",
"prototype",
".",
"buffer",
"=",
"{",
"}",
";",
"}",
"part",
"=",
"name",
... | Obtain a gulp plugin, initialized with given arguments
@name plug
@access internal
@param string name [automatically prefixed with 'gulp-']
@return stream initialized plugin | [
"Obtain",
"a",
"gulp",
"plugin",
"initialized",
"with",
"given",
"arguments"
] | eed953ac3c582c653fd63cbbb4b550dd33e88d13 | https://github.com/konfirm/devour-gulp/blob/eed953ac3c582c653fd63cbbb4b550dd33e88d13/lib/devour.js#L110-L145 |
50,009 | konfirm/devour-gulp | lib/devour.js | startRequested | function startRequested() {
var start = [];
if (run.length) {
run.forEach(function(task) {
var exists = task.replace(/:.*$/, '') in definitions.task;
console.log(
'Task %s %s',
exists ? chalk.green(task) : chalk.red(task),
exists ? 'running' : 'not found!'
);
if (exists) {
... | javascript | function startRequested() {
var start = [];
if (run.length) {
run.forEach(function(task) {
var exists = task.replace(/:.*$/, '') in definitions.task;
console.log(
'Task %s %s',
exists ? chalk.green(task) : chalk.red(task),
exists ? 'running' : 'not found!'
);
if (exists) {
... | [
"function",
"startRequested",
"(",
")",
"{",
"var",
"start",
"=",
"[",
"]",
";",
"if",
"(",
"run",
".",
"length",
")",
"{",
"run",
".",
"forEach",
"(",
"function",
"(",
"task",
")",
"{",
"var",
"exists",
"=",
"task",
".",
"replace",
"(",
"/",
":.... | Start tasks provided from the command line
@name startRequested
@access internal
@return bool started | [
"Start",
"tasks",
"provided",
"from",
"the",
"command",
"line"
] | eed953ac3c582c653fd63cbbb4b550dd33e88d13 | https://github.com/konfirm/devour-gulp/blob/eed953ac3c582c653fd63cbbb4b550dd33e88d13/lib/devour.js#L153-L187 |
50,010 | jamespdlynn/microjs | examples/game/lib/client.js | readData | function readData(raw){
var dataObj = micro.toJSON(new Buffer(raw));
var type = dataObj._type;
delete dataObj._type;
switch (type){
case "Ping":
//Grab latency (if exists) and bounce back the exact same data packet
... | javascript | function readData(raw){
var dataObj = micro.toJSON(new Buffer(raw));
var type = dataObj._type;
delete dataObj._type;
switch (type){
case "Ping":
//Grab latency (if exists) and bounce back the exact same data packet
... | [
"function",
"readData",
"(",
"raw",
")",
"{",
"var",
"dataObj",
"=",
"micro",
".",
"toJSON",
"(",
"new",
"Buffer",
"(",
"raw",
")",
")",
";",
"var",
"type",
"=",
"dataObj",
".",
"_type",
";",
"delete",
"dataObj",
".",
"_type",
";",
"switch",
"(",
"... | Handle data received from server | [
"Handle",
"data",
"received",
"from",
"server"
] | 780a4074de84bcd74e3ae50d0ed64144b4474166 | https://github.com/jamespdlynn/microjs/blob/780a4074de84bcd74e3ae50d0ed64144b4474166/examples/game/lib/client.js#L39-L89 |
50,011 | jamespdlynn/microjs | examples/game/lib/client.js | onUserPlayerChange | function onUserPlayerChange(data){
var player = gameData.player;
//Check if data contains different values
if (player.get("angle") !== data.angle.toPrecision(1) || player.get("isAccelerating") !== data.isAccelerating){
var buffer = micro.toBinary(data, "PlayerUpdate... | javascript | function onUserPlayerChange(data){
var player = gameData.player;
//Check if data contains different values
if (player.get("angle") !== data.angle.toPrecision(1) || player.get("isAccelerating") !== data.isAccelerating){
var buffer = micro.toBinary(data, "PlayerUpdate... | [
"function",
"onUserPlayerChange",
"(",
"data",
")",
"{",
"var",
"player",
"=",
"gameData",
".",
"player",
";",
"//Check if data contains different values",
"if",
"(",
"player",
".",
"get",
"(",
"\"angle\"",
")",
"!==",
"data",
".",
"angle",
".",
"toPrecision",
... | When a user player change event is caught, send a "PlayerUpdate" to the server | [
"When",
"a",
"user",
"player",
"change",
"event",
"is",
"caught",
"send",
"a",
"PlayerUpdate",
"to",
"the",
"server"
] | 780a4074de84bcd74e3ae50d0ed64144b4474166 | https://github.com/jamespdlynn/microjs/blob/780a4074de84bcd74e3ae50d0ed64144b4474166/examples/game/lib/client.js#L92-L106 |
50,012 | jonschlinkert/expand-task | index.js | Task | function Task(options) {
if (!(this instanceof Task)) {
return new Task(options);
}
utils.is(this, 'task');
use(this);
this.options = options || {};
if (utils.isTask(options)) {
this.options = {};
this.addTargets(options);
return this;
}
} | javascript | function Task(options) {
if (!(this instanceof Task)) {
return new Task(options);
}
utils.is(this, 'task');
use(this);
this.options = options || {};
if (utils.isTask(options)) {
this.options = {};
this.addTargets(options);
return this;
}
} | [
"function",
"Task",
"(",
"options",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Task",
")",
")",
"{",
"return",
"new",
"Task",
"(",
"options",
")",
";",
"}",
"utils",
".",
"is",
"(",
"this",
",",
"'task'",
")",
";",
"use",
"(",
"this",
... | Create a new Task with the given `options`
```js
var task = new Task({cwd: 'src'});
task.addTargets({
site: {src: ['*.hbs']},
blog: {src: ['*.md']}
});
```
@param {Object} `options`
@api public | [
"Create",
"a",
"new",
"Task",
"with",
"the",
"given",
"options"
] | b885ce5ec49f93980780a3e31e8ec3a1a892e1de | https://github.com/jonschlinkert/expand-task/blob/b885ce5ec49f93980780a3e31e8ec3a1a892e1de/index.js#L22-L36 |
50,013 | moov2/grunt-orchard-development | tasks/download.js | function (info, cb) {
// Default to a binary request
var options = info.src;
var dest = info.dest;
// Request the url
var req = request(options);
// On error, callback
req.on('error', cb);
// On response, callback for wri... | javascript | function (info, cb) {
// Default to a binary request
var options = info.src;
var dest = info.dest;
// Request the url
var req = request(options);
// On error, callback
req.on('error', cb);
// On response, callback for wri... | [
"function",
"(",
"info",
",",
"cb",
")",
"{",
"// Default to a binary request",
"var",
"options",
"=",
"info",
".",
"src",
";",
"var",
"dest",
"=",
"info",
".",
"dest",
";",
"// Request the url",
"var",
"req",
"=",
"request",
"(",
"options",
")",
";",
"/... | Downloads single file to local computer. | [
"Downloads",
"single",
"file",
"to",
"local",
"computer",
"."
] | 658c5bae73f894469d099a7c2d735f9cda08d0cc | https://github.com/moov2/grunt-orchard-development/blob/658c5bae73f894469d099a7c2d735f9cda08d0cc/tasks/download.js#L37-L69 | |
50,014 | moov2/grunt-orchard-development | tasks/download.js | function (url, content) {
var dirName = path.dirname(url);
if (!fs.existsSync(dirName)) {
fs.mkdirSync(dirName);
}
fs.writeFileSync(url, content, {
mode: 0777
});
} | javascript | function (url, content) {
var dirName = path.dirname(url);
if (!fs.existsSync(dirName)) {
fs.mkdirSync(dirName);
}
fs.writeFileSync(url, content, {
mode: 0777
});
} | [
"function",
"(",
"url",
",",
"content",
")",
"{",
"var",
"dirName",
"=",
"path",
".",
"dirname",
"(",
"url",
")",
";",
"if",
"(",
"!",
"fs",
".",
"existsSync",
"(",
"dirName",
")",
")",
"{",
"fs",
".",
"mkdirSync",
"(",
"dirName",
")",
";",
"}",
... | Writes data to a file, ensuring that the containing directory exists. | [
"Writes",
"data",
"to",
"a",
"file",
"ensuring",
"that",
"the",
"containing",
"directory",
"exists",
"."
] | 658c5bae73f894469d099a7c2d735f9cda08d0cc | https://github.com/moov2/grunt-orchard-development/blob/658c5bae73f894469d099a7c2d735f9cda08d0cc/tasks/download.js#L90-L100 | |
50,015 | moov2/grunt-orchard-development | tasks/download.js | function (onComplete) {
grunt.file.delete(options.tempDir, { force: true });
fs.exists(options.downloadDestination, function (exists) {
if (exists) {
fs.unlinkSync(options.downloadDestination);
}
if (onComplete) {
... | javascript | function (onComplete) {
grunt.file.delete(options.tempDir, { force: true });
fs.exists(options.downloadDestination, function (exists) {
if (exists) {
fs.unlinkSync(options.downloadDestination);
}
if (onComplete) {
... | [
"function",
"(",
"onComplete",
")",
"{",
"grunt",
".",
"file",
".",
"delete",
"(",
"options",
".",
"tempDir",
",",
"{",
"force",
":",
"true",
"}",
")",
";",
"fs",
".",
"exists",
"(",
"options",
".",
"downloadDestination",
",",
"function",
"(",
"exists"... | Deletes the downloaded zip & temporary directory. | [
"Deletes",
"the",
"downloaded",
"zip",
"&",
"temporary",
"directory",
"."
] | 658c5bae73f894469d099a7c2d735f9cda08d0cc | https://github.com/moov2/grunt-orchard-development/blob/658c5bae73f894469d099a7c2d735f9cda08d0cc/tasks/download.js#L129-L141 | |
50,016 | moov2/grunt-orchard-development | tasks/download.js | function (orchardDownload) {
grunt.log.writeln('downloading Orchard ' + options.version + ', this may take a while...');
helpers.curl({
src: orchardDownload.url,
dest: options.downloadDestination
}, function handleCurlComplete (err) {
... | javascript | function (orchardDownload) {
grunt.log.writeln('downloading Orchard ' + options.version + ', this may take a while...');
helpers.curl({
src: orchardDownload.url,
dest: options.downloadDestination
}, function handleCurlComplete (err) {
... | [
"function",
"(",
"orchardDownload",
")",
"{",
"grunt",
".",
"log",
".",
"writeln",
"(",
"'downloading Orchard '",
"+",
"options",
".",
"version",
"+",
"', this may take a while...'",
")",
";",
"helpers",
".",
"curl",
"(",
"{",
"src",
":",
"orchardDownload",
".... | Downloads a version of Orchard from the Internet. | [
"Downloads",
"a",
"version",
"of",
"Orchard",
"from",
"the",
"Internet",
"."
] | 658c5bae73f894469d099a7c2d735f9cda08d0cc | https://github.com/moov2/grunt-orchard-development/blob/658c5bae73f894469d099a7c2d735f9cda08d0cc/tasks/download.js#L146-L162 | |
50,017 | moov2/grunt-orchard-development | tasks/download.js | function (orchardDownload) {
var content, dest, zip;
grunt.log.writeln('extracting downloaded zip...');
fs.mkdirSync(options.tempDir);
fs.readFile(options.downloadDestination, function (err, data) {
if (err) {
throw err;
... | javascript | function (orchardDownload) {
var content, dest, zip;
grunt.log.writeln('extracting downloaded zip...');
fs.mkdirSync(options.tempDir);
fs.readFile(options.downloadDestination, function (err, data) {
if (err) {
throw err;
... | [
"function",
"(",
"orchardDownload",
")",
"{",
"var",
"content",
",",
"dest",
",",
"zip",
";",
"grunt",
".",
"log",
".",
"writeln",
"(",
"'extracting downloaded zip...'",
")",
";",
"fs",
".",
"mkdirSync",
"(",
"options",
".",
"tempDir",
")",
";",
"fs",
".... | Unzips the download that contains Orchard and sets up the extracted files
in a directory reflecting the version number. | [
"Unzips",
"the",
"download",
"that",
"contains",
"Orchard",
"and",
"sets",
"up",
"the",
"extracted",
"files",
"in",
"a",
"directory",
"reflecting",
"the",
"version",
"number",
"."
] | 658c5bae73f894469d099a7c2d735f9cda08d0cc | https://github.com/moov2/grunt-orchard-development/blob/658c5bae73f894469d099a7c2d735f9cda08d0cc/tasks/download.js#L168-L202 | |
50,018 | moov2/grunt-orchard-development | tasks/download.js | function () {
// ensures the uncompressed Orchard code is inside the version directory
// inside directory that contains local Orchard install. This is to
// ensure a directory structure like `/local/1.8.1/Orchard-1.8.1`
// doesn't occur becuase the download zip contents ... | javascript | function () {
// ensures the uncompressed Orchard code is inside the version directory
// inside directory that contains local Orchard install. This is to
// ensure a directory structure like `/local/1.8.1/Orchard-1.8.1`
// doesn't occur becuase the download zip contents ... | [
"function",
"(",
")",
"{",
"// ensures the uncompressed Orchard code is inside the version directory",
"// inside directory that contains local Orchard install. This is to",
"// ensure a directory structure like `/local/1.8.1/Orchard-1.8.1`",
"// doesn't occur becuase the download zip contents is with... | Moves extract files into directory that reflects the version number. | [
"Moves",
"extract",
"files",
"into",
"directory",
"that",
"reflects",
"the",
"version",
"number",
"."
] | 658c5bae73f894469d099a7c2d735f9cda08d0cc | https://github.com/moov2/grunt-orchard-development/blob/658c5bae73f894469d099a7c2d735f9cda08d0cc/tasks/download.js#L207-L219 | |
50,019 | Psychopoulet/node-promfs | lib/extends/_directoryToString.js | _directoryToString | function _directoryToString (directory, encoding, separator, callback) {
if ("undefined" === typeof directory) {
throw new ReferenceError("missing \"directory\" argument");
}
else if ("string" !== typeof directory) {
throw new TypeError("\"directory\" argument is not a string");
}
else if ("... | javascript | function _directoryToString (directory, encoding, separator, callback) {
if ("undefined" === typeof directory) {
throw new ReferenceError("missing \"directory\" argument");
}
else if ("string" !== typeof directory) {
throw new TypeError("\"directory\" argument is not a string");
}
else if ("... | [
"function",
"_directoryToString",
"(",
"directory",
",",
"encoding",
",",
"separator",
",",
"callback",
")",
"{",
"if",
"(",
"\"undefined\"",
"===",
"typeof",
"directory",
")",
"{",
"throw",
"new",
"ReferenceError",
"(",
"\"missing \\\"directory\\\" argument\"",
")"... | methods
Async directoryToString
@param {string} directory : directory to work with
@param {string} encoding : encoding to use
@param {string} separator : used to separate content (can be "")
@param {function|null} callback : operation's result
@returns {void} | [
"methods",
"Async",
"directoryToString"
] | 016e272fc58c6ef6eae5ea551a0e8873f0ac20cc | https://github.com/Psychopoulet/node-promfs/blob/016e272fc58c6ef6eae5ea551a0e8873f0ac20cc/lib/extends/_directoryToString.js#L24-L62 |
50,020 | impromptu/impromptu-git | index.js | function (porcelainStatus) {
var PORCELAIN_PROPERTY_REGEXES = {
// Leading non-whitespace that is not a question mark
staged: /^[^\?\s]/,
// Trailing non-whitespace
unstaged: /\S$/,
// Any "A" or "??"
added: /A|\?\?/,
// Any "M"
modified: /M/,
// Any "D"
deleted: /D/,
// An... | javascript | function (porcelainStatus) {
var PORCELAIN_PROPERTY_REGEXES = {
// Leading non-whitespace that is not a question mark
staged: /^[^\?\s]/,
// Trailing non-whitespace
unstaged: /\S$/,
// Any "A" or "??"
added: /A|\?\?/,
// Any "M"
modified: /M/,
// Any "D"
deleted: /D/,
// An... | [
"function",
"(",
"porcelainStatus",
")",
"{",
"var",
"PORCELAIN_PROPERTY_REGEXES",
"=",
"{",
"// Leading non-whitespace that is not a question mark",
"staged",
":",
"/",
"^[^\\?\\s]",
"/",
",",
"// Trailing non-whitespace",
"unstaged",
":",
"/",
"\\S$",
"/",
",",
"// An... | Helper function to format git statuses | [
"Helper",
"function",
"to",
"format",
"git",
"statuses"
] | ce078c236bec273d52bd8a2a5f780dee423e3595 | https://github.com/impromptu/impromptu-git/blob/ce078c236bec273d52bd8a2a5f780dee423e3595/index.js#L6-L34 | |
50,021 | cemtopkaya/kuark-db | src/db_kalem.js | f_tahta_kalem_takip_ekle | function f_tahta_kalem_takip_ekle(_tahta_id, _kalem_id) {
//kalem takip edilecek olarak belirlendiğinde ihalesi de takip edilecek olarak ayarlamalıyız
return result.dbQ.sadd(result.kp.tahta.ssetTakiptekiKalemleri(_tahta_id), _kalem_id)
.then(function () {
return result.db... | javascript | function f_tahta_kalem_takip_ekle(_tahta_id, _kalem_id) {
//kalem takip edilecek olarak belirlendiğinde ihalesi de takip edilecek olarak ayarlamalıyız
return result.dbQ.sadd(result.kp.tahta.ssetTakiptekiKalemleri(_tahta_id), _kalem_id)
.then(function () {
return result.db... | [
"function",
"f_tahta_kalem_takip_ekle",
"(",
"_tahta_id",
",",
"_kalem_id",
")",
"{",
"//kalem takip edilecek olarak belirlendiğinde ihalesi de takip edilecek olarak ayarlamalıyız\r",
"return",
"result",
".",
"dbQ",
".",
"sadd",
"(",
"result",
".",
"kp",
".",
"tahta",
".",
... | Takip edilecek kalem setine ekle
@param _tahta_id
@param _kalem_id
@returns {*} | [
"Takip",
"edilecek",
"kalem",
"setine",
"ekle"
] | d584aaf51f65a013bec79220a05007bd70767ac2 | https://github.com/cemtopkaya/kuark-db/blob/d584aaf51f65a013bec79220a05007bd70767ac2/src/db_kalem.js#L229-L238 |
50,022 | cemtopkaya/kuark-db | src/db_kalem.js | f_kalem_ekle_tahta | function f_kalem_ekle_tahta(_tahta_id, _ihale_id, _es_kalem, _db_kalem, _kul_id) {
var onay_durumu = _es_kalem.OnayDurumu;
//genel ihaleye tahtada yeni kalem ekleniyor
//bu durumda sadece tahtanın (tahta:401:ihale:101:kalem) kalemlerine eklemeliyiz
//ihalenin genel kalemlerine de... | javascript | function f_kalem_ekle_tahta(_tahta_id, _ihale_id, _es_kalem, _db_kalem, _kul_id) {
var onay_durumu = _es_kalem.OnayDurumu;
//genel ihaleye tahtada yeni kalem ekleniyor
//bu durumda sadece tahtanın (tahta:401:ihale:101:kalem) kalemlerine eklemeliyiz
//ihalenin genel kalemlerine de... | [
"function",
"f_kalem_ekle_tahta",
"(",
"_tahta_id",
",",
"_ihale_id",
",",
"_es_kalem",
",",
"_db_kalem",
",",
"_kul_id",
")",
"{",
"var",
"onay_durumu",
"=",
"_es_kalem",
".",
"OnayDurumu",
";",
"//genel ihaleye tahtada yeni kalem ekleniyor\r",
"//bu durumda sadece tahta... | Tahtaya yeni kalem ekle
@param _tahta_id
@param _ihale_id
@param _es_kalem
@param _db_kalem
@param _kul_id
@returns {*} | [
"Tahtaya",
"yeni",
"kalem",
"ekle"
] | d584aaf51f65a013bec79220a05007bd70767ac2 | https://github.com/cemtopkaya/kuark-db/blob/d584aaf51f65a013bec79220a05007bd70767ac2/src/db_kalem.js#L809-L843 |
50,023 | iopa-io/iopa-rest | src/iopa-rest/context.js | _setIgnoreCase | function _setIgnoreCase(obj, key, val) {
var key_lower = key.toLowerCase();
for (var p in obj) {
if (obj.hasOwnProperty(p) && key_lower == p.toLowerCase()) {
obj[p] = val;
return;
}
}
obj[key] = val;
} | javascript | function _setIgnoreCase(obj, key, val) {
var key_lower = key.toLowerCase();
for (var p in obj) {
if (obj.hasOwnProperty(p) && key_lower == p.toLowerCase()) {
obj[p] = val;
return;
}
}
obj[key] = val;
} | [
"function",
"_setIgnoreCase",
"(",
"obj",
",",
"key",
",",
"val",
")",
"{",
"var",
"key_lower",
"=",
"key",
".",
"toLowerCase",
"(",
")",
";",
"for",
"(",
"var",
"p",
"in",
"obj",
")",
"{",
"if",
"(",
"obj",
".",
"hasOwnProperty",
"(",
"p",
")",
... | Adds or updates a javascript object, case insensitive for key property
@method private_setIgnoreCase
@param obj (object) the object to search
@param key (string) the new or existing property name
@param val (string) the new property value
@private | [
"Adds",
"or",
"updates",
"a",
"javascript",
"object",
"case",
"insensitive",
"for",
"key",
"property"
] | 14a6b11ecf8859683cd62dc2c853985cfb0555f5 | https://github.com/iopa-io/iopa-rest/blob/14a6b11ecf8859683cd62dc2c853985cfb0555f5/src/iopa-rest/context.js#L127-L137 |
50,024 | derdesign/protos | storages/sqlite.js | SQLiteStorage | function SQLiteStorage(config) {
/*jshint bitwise: false */
var self = this;
this.events = new EventEmitter();
app.debug(util.format('Initializing SQLite Storage on %s', config.filename));
config = config || {};
config.table = config.table || "storage";
config.mode = config.mode || (sqlite3... | javascript | function SQLiteStorage(config) {
/*jshint bitwise: false */
var self = this;
this.events = new EventEmitter();
app.debug(util.format('Initializing SQLite Storage on %s', config.filename));
config = config || {};
config.table = config.table || "storage";
config.mode = config.mode || (sqlite3... | [
"function",
"SQLiteStorage",
"(",
"config",
")",
"{",
"/*jshint bitwise: false */",
"var",
"self",
"=",
"this",
";",
"this",
".",
"events",
"=",
"new",
"EventEmitter",
"(",
")",
";",
"app",
".",
"debug",
"(",
"util",
".",
"format",
"(",
"'Initializing SQLite... | SQLite Storage class
@class SQLiteStorage
@extends Storage
@constructor
@param {object} app Application instance
@param {object} config Storage configuration | [
"SQLite",
"Storage",
"class"
] | 0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9 | https://github.com/derdesign/protos/blob/0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9/storages/sqlite.js#L23-L78 |
50,025 | ottojs/otto-errors | lib/conflict.error.js | ErrorConflict | function ErrorConflict (message) {
Error.call(this);
// Add Information
this.name = 'ErrorConflict';
this.type = 'client';
this.status = 409;
if (message) {
this.message = message;
}
} | javascript | function ErrorConflict (message) {
Error.call(this);
// Add Information
this.name = 'ErrorConflict';
this.type = 'client';
this.status = 409;
if (message) {
this.message = message;
}
} | [
"function",
"ErrorConflict",
"(",
"message",
")",
"{",
"Error",
".",
"call",
"(",
"this",
")",
";",
"// Add Information",
"this",
".",
"name",
"=",
"'ErrorConflict'",
";",
"this",
".",
"type",
"=",
"'client'",
";",
"this",
".",
"status",
"=",
"409",
";",... | Error - ErrorConflict | [
"Error",
"-",
"ErrorConflict"
] | a3c6d98fd5d35ce3c136ed7e1edd2f800af268d9 | https://github.com/ottojs/otto-errors/blob/a3c6d98fd5d35ce3c136ed7e1edd2f800af268d9/lib/conflict.error.js#L8-L20 |
50,026 | xiamidaxia/xiami | meteor/minimongo/minimongo.js | function (f, fieldsIndex, ignoreEmptyFields) {
if (!f)
return function () {};
return function (/*args*/) {
var context = this;
var args = arguments;
if (self.collection.paused)
return;
if (fieldsIndex !== undefined && self.projectionFn) {
args[fi... | javascript | function (f, fieldsIndex, ignoreEmptyFields) {
if (!f)
return function () {};
return function (/*args*/) {
var context = this;
var args = arguments;
if (self.collection.paused)
return;
if (fieldsIndex !== undefined && self.projectionFn) {
args[fi... | [
"function",
"(",
"f",
",",
"fieldsIndex",
",",
"ignoreEmptyFields",
")",
"{",
"if",
"(",
"!",
"f",
")",
"return",
"function",
"(",
")",
"{",
"}",
";",
"return",
"function",
"(",
"/*args*/",
")",
"{",
"var",
"context",
"=",
"this",
";",
"var",
"args",... | furthermore, callbacks enqueue until the operation we're working on is done. | [
"furthermore",
"callbacks",
"enqueue",
"until",
"the",
"operation",
"we",
"re",
"working",
"on",
"is",
"done",
"."
] | 6fcee92c493c12bf8fd67c7068e67fa6a72a306b | https://github.com/xiamidaxia/xiami/blob/6fcee92c493c12bf8fd67c7068e67fa6a72a306b/meteor/minimongo/minimongo.js#L321-L341 | |
50,027 | valiton/node-various-cluster | lib/worker.js | Worker | function Worker() {
this.config = JSON.parse(process.env.WORKER_CONFIG);
if (typeof this.config !== 'object') {
throw new Error('WORKER_CONFIG is missing');
}
process.title = process.variousCluster = this.config.title;
} | javascript | function Worker() {
this.config = JSON.parse(process.env.WORKER_CONFIG);
if (typeof this.config !== 'object') {
throw new Error('WORKER_CONFIG is missing');
}
process.title = process.variousCluster = this.config.title;
} | [
"function",
"Worker",
"(",
")",
"{",
"this",
".",
"config",
"=",
"JSON",
".",
"parse",
"(",
"process",
".",
"env",
".",
"WORKER_CONFIG",
")",
";",
"if",
"(",
"typeof",
"this",
".",
"config",
"!==",
"'object'",
")",
"{",
"throw",
"new",
"Error",
"(",
... | create a new Worker instance
@memberOf global
@constructor
@this {Worker} | [
"create",
"a",
"new",
"Worker",
"instance"
] | b570ff342ef9138e4ae57a3639f3abc8820217ab | https://github.com/valiton/node-various-cluster/blob/b570ff342ef9138e4ae57a3639f3abc8820217ab/lib/worker.js#L96-L102 |
50,028 | integreat-io/integreat-adapter-couchdb | lib/authstrats/couchdb.js | couchdbAuth | function couchdbAuth ({uri, key, secret} = {}) {
return {
/**
* Check whether we've already ran authentication.
* @returns {boolean} `true` if already authenticated, otherwise `false`
*/
isAuthenticated () {
return !!this._cookie
},
/**
* Authenticate and return true if auth... | javascript | function couchdbAuth ({uri, key, secret} = {}) {
return {
/**
* Check whether we've already ran authentication.
* @returns {boolean} `true` if already authenticated, otherwise `false`
*/
isAuthenticated () {
return !!this._cookie
},
/**
* Authenticate and return true if auth... | [
"function",
"couchdbAuth",
"(",
"{",
"uri",
",",
"key",
",",
"secret",
"}",
"=",
"{",
"}",
")",
"{",
"return",
"{",
"/**\n * Check whether we've already ran authentication.\n * @returns {boolean} `true` if already authenticated, otherwise `false`\n */",
"isAuthenticat... | Create an instance of the couchdb strategy. Will retrieve an an
authentication cookie and send the cookie with every request.
@param {Object} options - Options object
@returns {Object} Strategy object | [
"Create",
"an",
"instance",
"of",
"the",
"couchdb",
"strategy",
".",
"Will",
"retrieve",
"an",
"an",
"authentication",
"cookie",
"and",
"send",
"the",
"cookie",
"with",
"every",
"request",
"."
] | e792aaa3e85c5dae41959bc449ed3b0e149f7ebf | https://github.com/integreat-io/integreat-adapter-couchdb/blob/e792aaa3e85c5dae41959bc449ed3b0e149f7ebf/lib/authstrats/couchdb.js#L11-L47 |
50,029 | gethuman/pancakes-recipe | middleware/mw.caller.js | getDeviceId | function getDeviceId(req) {
// NOTE: client_id and client_secret are deprecated so eventually remove
var deviceId = req.headers['x-device-id'];
var deviceSecret = req.headers['x-device-secret'];
// if client ID and secret don't exist, then no device
if (!deviceId || !deviceSecr... | javascript | function getDeviceId(req) {
// NOTE: client_id and client_secret are deprecated so eventually remove
var deviceId = req.headers['x-device-id'];
var deviceSecret = req.headers['x-device-secret'];
// if client ID and secret don't exist, then no device
if (!deviceId || !deviceSecr... | [
"function",
"getDeviceId",
"(",
"req",
")",
"{",
"// NOTE: client_id and client_secret are deprecated so eventually remove",
"var",
"deviceId",
"=",
"req",
".",
"headers",
"[",
"'x-device-id'",
"]",
";",
"var",
"deviceSecret",
"=",
"req",
".",
"headers",
"[",
"'x-devi... | Get the device id if it exists and the secret is valid
@param req
@returns {string} | [
"Get",
"the",
"device",
"id",
"if",
"it",
"exists",
"and",
"the",
"secret",
"is",
"valid"
] | ea3feb8839e2edaf1b4577c052b8958953db4498 | https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/middleware/mw.caller.js#L14-L36 |
50,030 | gethuman/pancakes-recipe | middleware/mw.caller.js | getCaller | function getCaller(req) {
var ipAddress = req.headers['x-forwarded-for'] || req.info.remoteAddress || '';
var user = req.user;
if (user) {
// if user admin and there is an onBehalfOf value then use onBehalfOf
if (user.role === 'admin' && req.query.onBehalfOfId) {
... | javascript | function getCaller(req) {
var ipAddress = req.headers['x-forwarded-for'] || req.info.remoteAddress || '';
var user = req.user;
if (user) {
// if user admin and there is an onBehalfOf value then use onBehalfOf
if (user.role === 'admin' && req.query.onBehalfOfId) {
... | [
"function",
"getCaller",
"(",
"req",
")",
"{",
"var",
"ipAddress",
"=",
"req",
".",
"headers",
"[",
"'x-forwarded-for'",
"]",
"||",
"req",
".",
"info",
".",
"remoteAddress",
"||",
"''",
";",
"var",
"user",
"=",
"req",
".",
"user",
";",
"if",
"(",
"us... | Get the caller based on the request
@param req
@returns {*} | [
"Get",
"the",
"caller",
"based",
"on",
"the",
"request"
] | ea3feb8839e2edaf1b4577c052b8958953db4498 | https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/middleware/mw.caller.js#L43-L91 |
50,031 | andreypopp/es6-module-jstransform | visitors.js | visitImportDeclaration | function visitImportDeclaration(traverse, node, path, state) {
var specifier, name;
utils.catchup(node.range[0], state);
switch (node.kind) {
// import "module"
case undefined:
utils.append('require(' + node.source.raw + ');', state);
break;
// import name from "module"
case "defaul... | javascript | function visitImportDeclaration(traverse, node, path, state) {
var specifier, name;
utils.catchup(node.range[0], state);
switch (node.kind) {
// import "module"
case undefined:
utils.append('require(' + node.source.raw + ');', state);
break;
// import name from "module"
case "defaul... | [
"function",
"visitImportDeclaration",
"(",
"traverse",
",",
"node",
",",
"path",
",",
"state",
")",
"{",
"var",
"specifier",
",",
"name",
";",
"utils",
".",
"catchup",
"(",
"node",
".",
"range",
"[",
"0",
"]",
",",
"state",
")",
";",
"switch",
"(",
"... | Visit ImportDeclaration.
Examples:
import "module"
import name from "module"
import { name, one as other } from "module" | [
"Visit",
"ImportDeclaration",
"."
] | 639fe364f6a3bc1de87d2d3edf5b0dd682b3289b | https://github.com/andreypopp/es6-module-jstransform/blob/639fe364f6a3bc1de87d2d3edf5b0dd682b3289b/visitors.js#L16-L62 |
50,032 | andreypopp/es6-module-jstransform | visitors.js | visitModuleDeclaration | function visitModuleDeclaration(traverse, node, path, state) {
utils.catchup(node.range[0], state);
utils.append('var ' + node.id.name + ' = require(' + node.source.raw + ');', state);
utils.move(node.range[1], state);
return false;
} | javascript | function visitModuleDeclaration(traverse, node, path, state) {
utils.catchup(node.range[0], state);
utils.append('var ' + node.id.name + ' = require(' + node.source.raw + ');', state);
utils.move(node.range[1], state);
return false;
} | [
"function",
"visitModuleDeclaration",
"(",
"traverse",
",",
"node",
",",
"path",
",",
"state",
")",
"{",
"utils",
".",
"catchup",
"(",
"node",
".",
"range",
"[",
"0",
"]",
",",
"state",
")",
";",
"utils",
".",
"append",
"(",
"'var '",
"+",
"node",
".... | Visit ModuleDeclaration.
Example:
module name from "module" | [
"Visit",
"ModuleDeclaration",
"."
] | 639fe364f6a3bc1de87d2d3edf5b0dd682b3289b | https://github.com/andreypopp/es6-module-jstransform/blob/639fe364f6a3bc1de87d2d3edf5b0dd682b3289b/visitors.js#L216-L221 |
50,033 | derdesign/protos | lib/protos.js | commonStartupOperations | function commonStartupOperations() {
if (options.stayUp) {
process.on('uncaughtException', app.log); // prints stack trace
}
startupMessage.call(this, options);
} | javascript | function commonStartupOperations() {
if (options.stayUp) {
process.on('uncaughtException', app.log); // prints stack trace
}
startupMessage.call(this, options);
} | [
"function",
"commonStartupOperations",
"(",
")",
"{",
"if",
"(",
"options",
".",
"stayUp",
")",
"{",
"process",
".",
"on",
"(",
"'uncaughtException'",
",",
"app",
".",
"log",
")",
";",
"// prints stack trace",
"}",
"startupMessage",
".",
"call",
"(",
"this",... | Convenience function, to avoid repetition | [
"Convenience",
"function",
"to",
"avoid",
"repetition"
] | 0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9 | https://github.com/derdesign/protos/blob/0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9/lib/protos.js#L685-L690 |
50,034 | allex-servercore-libs/servicepack | authentication/strategies/ipstrategycreator.js | ip2long | function ip2long( a, b, c, d ) {
for (
c = b = 0;
d = a.split('.')[b++];
c +=
d >> 8
|
b > 4 ?
NaN
:
d * (1 << -8 * b)
)
d = parseInt(
+d
&&
d
);
return c
} | javascript | function ip2long( a, b, c, d ) {
for (
c = b = 0;
d = a.split('.')[b++];
c +=
d >> 8
|
b > 4 ?
NaN
:
d * (1 << -8 * b)
)
d = parseInt(
+d
&&
d
);
return c
} | [
"function",
"ip2long",
"(",
"a",
",",
"b",
",",
"c",
",",
"d",
")",
"{",
"for",
"(",
"c",
"=",
"b",
"=",
"0",
";",
"d",
"=",
"a",
".",
"split",
"(",
"'.'",
")",
"[",
"b",
"++",
"]",
";",
"c",
"+=",
"d",
">>",
"8",
"|",
"b",
">",
"4",
... | Convert an IP to a long integer. | [
"Convert",
"an",
"IP",
"to",
"a",
"long",
"integer",
"."
] | 1b0ce2fe7b9208ab6c8d60d862ceeaf970797d23 | https://github.com/allex-servercore-libs/servicepack/blob/1b0ce2fe7b9208ab6c8d60d862ceeaf970797d23/authentication/strategies/ipstrategycreator.js#L13-L31 |
50,035 | allex-servercore-libs/servicepack | authentication/strategies/ipstrategycreator.js | cidr_match | function cidr_match( ip, range ) {
//
// If the range doesn't have a slash it will only match if identical to the IP.
//
if ( range.indexOf( "/" ) < 0 )
{
return ( ip == range );
}
//
// Split the range by the slash
//
var parsed = range.split( "/" );
if... | javascript | function cidr_match( ip, range ) {
//
// If the range doesn't have a slash it will only match if identical to the IP.
//
if ( range.indexOf( "/" ) < 0 )
{
return ( ip == range );
}
//
// Split the range by the slash
//
var parsed = range.split( "/" );
if... | [
"function",
"cidr_match",
"(",
"ip",
",",
"range",
")",
"{",
"//",
"// If the range doesn't have a slash it will only match if identical to the IP.",
"//",
"if",
"(",
"range",
".",
"indexOf",
"(",
"\"/\"",
")",
"<",
"0",
")",
"{",
"return",
"(",
"ip",
"==",
"ra... | Determine whether the given IP falls within the specified CIDR range. | [
"Determine",
"whether",
"the",
"given",
"IP",
"falls",
"within",
"the",
"specified",
"CIDR",
"range",
"."
] | 1b0ce2fe7b9208ab6c8d60d862ceeaf970797d23 | https://github.com/allex-servercore-libs/servicepack/blob/1b0ce2fe7b9208ab6c8d60d862ceeaf970797d23/authentication/strategies/ipstrategycreator.js#L56-L132 |
50,036 | Rifdhan/weighted-randomly-select | index.js | selectWithValidation | function selectWithValidation(choices) {
// Validate argument is an array
if(!choices || !choices.length) {
throw new Error("Randomly Select: invalid argument, please provide a non-empty array");
}
// Validate that:
// - each array entry has a 'chance' and 'result' property
// - each 'chance' field is a number... | javascript | function selectWithValidation(choices) {
// Validate argument is an array
if(!choices || !choices.length) {
throw new Error("Randomly Select: invalid argument, please provide a non-empty array");
}
// Validate that:
// - each array entry has a 'chance' and 'result' property
// - each 'chance' field is a number... | [
"function",
"selectWithValidation",
"(",
"choices",
")",
"{",
"// Validate argument is an array",
"if",
"(",
"!",
"choices",
"||",
"!",
"choices",
".",
"length",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Randomly Select: invalid argument, please provide a non-empty array... | Performs validation on input before performing the random selection | [
"Performs",
"validation",
"on",
"input",
"before",
"performing",
"the",
"random",
"selection"
] | b11f26f70f3a16e130a24b5b9f87631297024e8c | https://github.com/Rifdhan/weighted-randomly-select/blob/b11f26f70f3a16e130a24b5b9f87631297024e8c/index.js#L4-L33 |
50,037 | Rifdhan/weighted-randomly-select | index.js | selectWithoutValidation | function selectWithoutValidation(choices) {
// Generate a list of options with positive non-zero chances
let choicesWithNonZeroChances = [];
let totalWeight = 0.0;
for(let i = 0; i < choices.length; i++) {
if(choices[i].chance > 0.0) {
choicesWithNonZeroChances.push(choices[i]);
totalWeight += choices[i].ch... | javascript | function selectWithoutValidation(choices) {
// Generate a list of options with positive non-zero chances
let choicesWithNonZeroChances = [];
let totalWeight = 0.0;
for(let i = 0; i < choices.length; i++) {
if(choices[i].chance > 0.0) {
choicesWithNonZeroChances.push(choices[i]);
totalWeight += choices[i].ch... | [
"function",
"selectWithoutValidation",
"(",
"choices",
")",
"{",
"// Generate a list of options with positive non-zero chances",
"let",
"choicesWithNonZeroChances",
"=",
"[",
"]",
";",
"let",
"totalWeight",
"=",
"0.0",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i"... | Performs the random selection without validating any input | [
"Performs",
"the",
"random",
"selection",
"without",
"validating",
"any",
"input"
] | b11f26f70f3a16e130a24b5b9f87631297024e8c | https://github.com/Rifdhan/weighted-randomly-select/blob/b11f26f70f3a16e130a24b5b9f87631297024e8c/index.js#L36-L58 |
50,038 | emiljohansson/captn | captn.dom.addclass/index.js | addClass | function addClass(element, className) {
if (!hasClassNameProperty(element) || hasClass(element, className)) {
return;
}
element.className = (element.className + ' ' + className).replace(/^\s+|\s+$/g, '');
} | javascript | function addClass(element, className) {
if (!hasClassNameProperty(element) || hasClass(element, className)) {
return;
}
element.className = (element.className + ' ' + className).replace(/^\s+|\s+$/g, '');
} | [
"function",
"addClass",
"(",
"element",
",",
"className",
")",
"{",
"if",
"(",
"!",
"hasClassNameProperty",
"(",
"element",
")",
"||",
"hasClass",
"(",
"element",
",",
"className",
")",
")",
"{",
"return",
";",
"}",
"element",
".",
"className",
"=",
"(",... | Adds a class name to the element's list of class names.
@static
@param {DOMElement} element The DOM element to modify.
@param {string} className The name to append.
@example
hasClass(el, 'container');
// => false
addClass(el, 'container');
hasClass(el, 'container');
// => true | [
"Adds",
"a",
"class",
"name",
"to",
"the",
"element",
"s",
"list",
"of",
"class",
"names",
"."
] | dae7520116dc2148b4de06af7e1d7a47a3a3ac37 | https://github.com/emiljohansson/captn/blob/dae7520116dc2148b4de06af7e1d7a47a3a3ac37/captn.dom.addclass/index.js#L22-L27 |
50,039 | ripter/bind | src/bind.dom.js | bind | function bind(element, eventName, callback) {
element.addEventListener(eventName, callback);
return function unbind() {
element.removeEventListener(eventName, callback);
};
} | javascript | function bind(element, eventName, callback) {
element.addEventListener(eventName, callback);
return function unbind() {
element.removeEventListener(eventName, callback);
};
} | [
"function",
"bind",
"(",
"element",
",",
"eventName",
",",
"callback",
")",
"{",
"element",
".",
"addEventListener",
"(",
"eventName",
",",
"callback",
")",
";",
"return",
"function",
"unbind",
"(",
")",
"{",
"element",
".",
"removeEventListener",
"(",
"even... | bind - listens to event on element, returning a function to stop listening to the event.
@param {EventTarget} element - https://developer.mozilla.org/en-US/docs/Web/API/EventTarget
@param {String} eventName - Name of the event. Like 'click', or 'did-custom-event'
@param {Function} callback -
@return unbind - function t... | [
"bind",
"-",
"listens",
"to",
"event",
"on",
"element",
"returning",
"a",
"function",
"to",
"stop",
"listening",
"to",
"the",
"event",
"."
] | e41e89fc3dc3ea3eb0e8ccfeb8ba97ba4a29b7a5 | https://github.com/ripter/bind/blob/e41e89fc3dc3ea3eb0e8ccfeb8ba97ba4a29b7a5/src/bind.dom.js#L8-L14 |
50,040 | xiamidaxia/xiami | meteor/minimongo/projection.js | function (doc, ruleTree) {
// Special case for "sets"
if (_.isArray(doc))
return _.map(doc, function (subdoc) { return transform(subdoc, ruleTree); });
var res = details.including ? {} : EJSON.clone(doc);
_.each(ruleTree, function (rule, key) {
if (!_.has(doc, key))
return;
if... | javascript | function (doc, ruleTree) {
// Special case for "sets"
if (_.isArray(doc))
return _.map(doc, function (subdoc) { return transform(subdoc, ruleTree); });
var res = details.including ? {} : EJSON.clone(doc);
_.each(ruleTree, function (rule, key) {
if (!_.has(doc, key))
return;
if... | [
"function",
"(",
"doc",
",",
"ruleTree",
")",
"{",
"// Special case for \"sets\"",
"if",
"(",
"_",
".",
"isArray",
"(",
"doc",
")",
")",
"return",
"_",
".",
"map",
"(",
"doc",
",",
"function",
"(",
"subdoc",
")",
"{",
"return",
"transform",
"(",
"subdo... | returns transformed doc according to ruleTree | [
"returns",
"transformed",
"doc",
"according",
"to",
"ruleTree"
] | 6fcee92c493c12bf8fd67c7068e67fa6a72a306b | https://github.com/xiamidaxia/xiami/blob/6fcee92c493c12bf8fd67c7068e67fa6a72a306b/meteor/minimongo/projection.js#L24-L45 | |
50,041 | bithavoc/node-orch-amqp | lib/amqp_source.js | AmqpQueue | function AmqpQueue(source) {
assert.ok(source);
TasksSource.Queue.apply(this, []);
this.source = source;
this._amqpProcessing = false;
} | javascript | function AmqpQueue(source) {
assert.ok(source);
TasksSource.Queue.apply(this, []);
this.source = source;
this._amqpProcessing = false;
} | [
"function",
"AmqpQueue",
"(",
"source",
")",
"{",
"assert",
".",
"ok",
"(",
"source",
")",
";",
"TasksSource",
".",
"Queue",
".",
"apply",
"(",
"this",
",",
"[",
"]",
")",
";",
"this",
".",
"source",
"=",
"source",
";",
"this",
".",
"_amqpProcessing"... | AMQP Queue Wrapper | [
"AMQP",
"Queue",
"Wrapper"
] | d61b1035e87e4c41df1c7a7cb1472d91f225d117 | https://github.com/bithavoc/node-orch-amqp/blob/d61b1035e87e4c41df1c7a7cb1472d91f225d117/lib/amqp_source.js#L72-L77 |
50,042 | robertontiu/wrapper6 | src/promises.js | resolve | function resolve(promiseLike) {
// Return if already promised
if (promiseLike instanceof Promise) {
return promiseLike;
}
var promises = [];
if (promiseLike instanceof Array) {
promiseLike.forEach((promiseLikeEntry) => {
promises.push(promisify(promiseLikeEntry));
... | javascript | function resolve(promiseLike) {
// Return if already promised
if (promiseLike instanceof Promise) {
return promiseLike;
}
var promises = [];
if (promiseLike instanceof Array) {
promiseLike.forEach((promiseLikeEntry) => {
promises.push(promisify(promiseLikeEntry));
... | [
"function",
"resolve",
"(",
"promiseLike",
")",
"{",
"// Return if already promised",
"if",
"(",
"promiseLike",
"instanceof",
"Promise",
")",
"{",
"return",
"promiseLike",
";",
"}",
"var",
"promises",
"=",
"[",
"]",
";",
"if",
"(",
"promiseLike",
"instanceof",
... | Resolves one or more promise-likes
@param {*} promiseLike
@returns {Promise} | [
"Resolves",
"one",
"or",
"more",
"promise",
"-",
"likes"
] | 70f99dcda0f2e0926b689be349ab9bb95e84a22d | https://github.com/robertontiu/wrapper6/blob/70f99dcda0f2e0926b689be349ab9bb95e84a22d/src/promises.js#L35-L70 |
50,043 | the-terribles/evergreen | lib/graph-builder.js | GraphBuilder | function GraphBuilder(options){
options = options || {};
// Precedence for resolvers.
this.resolvers = options.resolvers || [
require('./resolvers/absolute'),
require('./resolvers/relative'),
require('./resolvers/environment')
];
this.handlers = options.directives || [];
} | javascript | function GraphBuilder(options){
options = options || {};
// Precedence for resolvers.
this.resolvers = options.resolvers || [
require('./resolvers/absolute'),
require('./resolvers/relative'),
require('./resolvers/environment')
];
this.handlers = options.directives || [];
} | [
"function",
"GraphBuilder",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"// Precedence for resolvers.",
"this",
".",
"resolvers",
"=",
"options",
".",
"resolvers",
"||",
"[",
"require",
"(",
"'./resolvers/absolute'",
")",
",",
"re... | Instantiate the GraphBuilder with the set of Directive Handlers.
Directive Handler:
{
strategy: 'name',
handle: function(DirectiveContext, tree, metadata, callback){
return callback(err, DirectiveContext);
}
@param options {Object}
@constructor | [
"Instantiate",
"the",
"GraphBuilder",
"with",
"the",
"set",
"of",
"Directive",
"Handlers",
"."
] | c1adaea1ce825727c5c5ed75d858e2f0d22657e2 | https://github.com/the-terribles/evergreen/blob/c1adaea1ce825727c5c5ed75d858e2f0d22657e2/lib/graph-builder.js#L29-L41 |
50,044 | gethuman/pancakes-recipe | middleware/mw.error.handling.js | handleGlobalError | function handleGlobalError() {
// make sure Q provides long stack traces (disabled in prod for performance)
Q.longStackSupport = config.longStackSupport;
// hopefully we handle errors before this point, but this will log anything not caught
process.on('uncaughtException', function (err... | javascript | function handleGlobalError() {
// make sure Q provides long stack traces (disabled in prod for performance)
Q.longStackSupport = config.longStackSupport;
// hopefully we handle errors before this point, but this will log anything not caught
process.on('uncaughtException', function (err... | [
"function",
"handleGlobalError",
"(",
")",
"{",
"// make sure Q provides long stack traces (disabled in prod for performance)",
"Q",
".",
"longStackSupport",
"=",
"config",
".",
"longStackSupport",
";",
"// hopefully we handle errors before this point, but this will log anything not caug... | Configure global error handling which includes Q and catching uncaught exceptions | [
"Configure",
"global",
"error",
"handling",
"which",
"includes",
"Q",
"and",
"catching",
"uncaught",
"exceptions"
] | ea3feb8839e2edaf1b4577c052b8958953db4498 | https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/middleware/mw.error.handling.js#L13-L25 |
50,045 | gethuman/pancakes-recipe | middleware/mw.error.handling.js | handlePreResponseError | function handlePreResponseError(server) {
server.ext('onPreResponse', function (request, reply) {
var response = request.response;
var originalResponse = response;
var msg;
// No error, keep going with the reply as normal
if (!response.isBoom) { reply... | javascript | function handlePreResponseError(server) {
server.ext('onPreResponse', function (request, reply) {
var response = request.response;
var originalResponse = response;
var msg;
// No error, keep going with the reply as normal
if (!response.isBoom) { reply... | [
"function",
"handlePreResponseError",
"(",
"server",
")",
"{",
"server",
".",
"ext",
"(",
"'onPreResponse'",
",",
"function",
"(",
"request",
",",
"reply",
")",
"{",
"var",
"response",
"=",
"request",
".",
"response",
";",
"var",
"originalResponse",
"=",
"re... | Set up the pre-response error handler
@param server | [
"Set",
"up",
"the",
"pre",
"-",
"response",
"error",
"handler"
] | ea3feb8839e2edaf1b4577c052b8958953db4498 | https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/middleware/mw.error.handling.js#L31-L100 |
50,046 | erwan/gulp-gist | index.js | leftAlign | function leftAlign(lines) {
if (lines.length == 0) return lines;
var distance = lines[0].match(/^\s*/)[0].length;
var result = [];
lines.forEach(function(line){
result.push(line.slice(Math.min(distance, line.match(/^\s*/)[0].length)));
});
return result;
} | javascript | function leftAlign(lines) {
if (lines.length == 0) return lines;
var distance = lines[0].match(/^\s*/)[0].length;
var result = [];
lines.forEach(function(line){
result.push(line.slice(Math.min(distance, line.match(/^\s*/)[0].length)));
});
return result;
} | [
"function",
"leftAlign",
"(",
"lines",
")",
"{",
"if",
"(",
"lines",
".",
"length",
"==",
"0",
")",
"return",
"lines",
";",
"var",
"distance",
"=",
"lines",
"[",
"0",
"]",
".",
"match",
"(",
"/",
"^\\s*",
"/",
")",
"[",
"0",
"]",
".",
"length",
... | Remove indent from the left, aligning everything with the first line | [
"Remove",
"indent",
"from",
"the",
"left",
"aligning",
"everything",
"with",
"the",
"first",
"line"
] | 1ea776220d6bd322cec9804e40b2c54e735ed0d8 | https://github.com/erwan/gulp-gist/blob/1ea776220d6bd322cec9804e40b2c54e735ed0d8/index.js#L13-L21 |
50,047 | usrz/javascript-esquire | src/esquire.js | inject | function inject() {
var args = normalize(arguments);
/* Sanity check, need a callback */
if (!args.function) {
throw new EsquireError("Callback for injection unspecified");
}
/* Create a fake "null" module and return its value */
var module = new Module(null, args.arguments... | javascript | function inject() {
var args = normalize(arguments);
/* Sanity check, need a callback */
if (!args.function) {
throw new EsquireError("Callback for injection unspecified");
}
/* Create a fake "null" module and return its value */
var module = new Module(null, args.arguments... | [
"function",
"inject",
"(",
")",
"{",
"var",
"args",
"=",
"normalize",
"(",
"arguments",
")",
";",
"/* Sanity check, need a callback */",
"if",
"(",
"!",
"args",
".",
"function",
")",
"{",
"throw",
"new",
"EsquireError",
"(",
"\"Callback for injection unspecified\"... | Request injection for the specified modules.
@instance
@function inject
@memberof Esquire
@example -
var esq = new Esquire();
esq.inject(['modA', 'depB'], function(a, b) {
// 'a' will be an instance of 'modA'
// 'b' will be an instance of 'depB'
return "something";
}).then(function(result) {
// The function will be ... | [
"Request",
"injection",
"for",
"the",
"specified",
"modules",
"."
] | 59ed57393d9fc1fedd9ec50a7abb6fa7e59e491b | https://github.com/usrz/javascript-esquire/blob/59ed57393d9fc1fedd9ec50a7abb6fa7e59e491b/src/esquire.js#L1076-L1092 |
50,048 | onecommons/polyform | packages/polyform-config/index.js | tryExtensions | function tryExtensions(p, exts, isMain) {
for (var i = 0; i < exts.length; i++) {
const filename = tryFile(p + exts[i], isMain);
if (filename) {
return filename;
}
}
return false;
} | javascript | function tryExtensions(p, exts, isMain) {
for (var i = 0; i < exts.length; i++) {
const filename = tryFile(p + exts[i], isMain);
if (filename) {
return filename;
}
}
return false;
} | [
"function",
"tryExtensions",
"(",
"p",
",",
"exts",
",",
"isMain",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"exts",
".",
"length",
";",
"i",
"++",
")",
"{",
"const",
"filename",
"=",
"tryFile",
"(",
"p",
"+",
"exts",
"[",
"i",... | given a path check a the file exists with any of the set extensions | [
"given",
"a",
"path",
"check",
"a",
"the",
"file",
"exists",
"with",
"any",
"of",
"the",
"set",
"extensions"
] | 98cc56f7e8283e9a46a789434400e5d432b1ac80 | https://github.com/onecommons/polyform/blob/98cc56f7e8283e9a46a789434400e5d432b1ac80/packages/polyform-config/index.js#L44-L53 |
50,049 | c1rabbit/mers-min | mers.js | generate | function generate (orgID, loanNumber) {
//strip non-numeric or letters
loanNumber = loanNumber.replace(/\D/g,"");
orgID = orgID.replace(/\D/g,"");
//string letters
var loanNum = loanNumber.replace(/[a-z]/gi,"");
orgID = orgID.replace(/[a-z]/gi,"");
if (orgID.toString().length != 7 ){
throw new Error... | javascript | function generate (orgID, loanNumber) {
//strip non-numeric or letters
loanNumber = loanNumber.replace(/\D/g,"");
orgID = orgID.replace(/\D/g,"");
//string letters
var loanNum = loanNumber.replace(/[a-z]/gi,"");
orgID = orgID.replace(/[a-z]/gi,"");
if (orgID.toString().length != 7 ){
throw new Error... | [
"function",
"generate",
"(",
"orgID",
",",
"loanNumber",
")",
"{",
"//strip non-numeric or letters",
"loanNumber",
"=",
"loanNumber",
".",
"replace",
"(",
"/",
"\\D",
"/",
"g",
",",
"\"\"",
")",
";",
"orgID",
"=",
"orgID",
".",
"replace",
"(",
"/",
"\\D",
... | mod 10 weight 2 | [
"mod",
"10",
"weight",
"2"
] | 426371ccb80ed1e710244166396d21bb3cd0e716 | https://github.com/c1rabbit/mers-min/blob/426371ccb80ed1e710244166396d21bb3cd0e716/mers.js#L2-L51 |
50,050 | BeepBoopHQ/botkit-storage-beepboop | src/storage.js | bbTeamToBotkitTeam | function bbTeamToBotkitTeam (team) {
return {
id: team.slack_team_id,
createdBy: team.slack_user_id,
url: `https://${team.slack_team_domain}.slack.com/`,
name: team.slack_team_name,
bot: {
name: team.slack_bot_user_name,
token: team.slack_bot_access_token,
user_id: team.slack_bot... | javascript | function bbTeamToBotkitTeam (team) {
return {
id: team.slack_team_id,
createdBy: team.slack_user_id,
url: `https://${team.slack_team_domain}.slack.com/`,
name: team.slack_team_name,
bot: {
name: team.slack_bot_user_name,
token: team.slack_bot_access_token,
user_id: team.slack_bot... | [
"function",
"bbTeamToBotkitTeam",
"(",
"team",
")",
"{",
"return",
"{",
"id",
":",
"team",
".",
"slack_team_id",
",",
"createdBy",
":",
"team",
".",
"slack_user_id",
",",
"url",
":",
"`",
"${",
"team",
".",
"slack_team_domain",
"}",
"`",
",",
"name",
":"... | transform beep boop team into what botkit expects | [
"transform",
"beep",
"boop",
"team",
"into",
"what",
"botkit",
"expects"
] | 4bb2bfda995feb71a8ad77df213f11c6cbb7650d | https://github.com/BeepBoopHQ/botkit-storage-beepboop/blob/4bb2bfda995feb71a8ad77df213f11c6cbb7650d/src/storage.js#L137-L151 |
50,051 | nrn/gen-pasta | gen-pasta.js | genPasta | function genPasta (opts) {
// GENERAL Functions
//
function slice (ar, start, end) {
return Array.prototype.slice.call(ar, start, end)
}
function log () {
if (console && console.log) console.log(slice(arguments))
}
function combine (returned, added) {
Object.keys(added).forEach(function (key... | javascript | function genPasta (opts) {
// GENERAL Functions
//
function slice (ar, start, end) {
return Array.prototype.slice.call(ar, start, end)
}
function log () {
if (console && console.log) console.log(slice(arguments))
}
function combine (returned, added) {
Object.keys(added).forEach(function (key... | [
"function",
"genPasta",
"(",
"opts",
")",
"{",
"// GENERAL Functions",
"//",
"function",
"slice",
"(",
"ar",
",",
"start",
",",
"end",
")",
"{",
"return",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"ar",
",",
"start",
",",
"end",
")",
... | gen-pasta.js | [
"gen",
"-",
"pasta",
".",
"js"
] | 7e583cd000a8eab9b15c96440d24240d613a8801 | https://github.com/nrn/gen-pasta/blob/7e583cd000a8eab9b15c96440d24240d613a8801/gen-pasta.js#L3-L59 |
50,052 | dalekjs/dalek-driver-sauce | lib/commands/url.js | function (url, hash, uuid) {
this.lastCalledUrl = url;
this.actionQueue.push(this.webdriverClient.url.bind(this.webdriverClient, url));
this.actionQueue.push(this._openCb.bind(this, url, hash, uuid));
return this;
} | javascript | function (url, hash, uuid) {
this.lastCalledUrl = url;
this.actionQueue.push(this.webdriverClient.url.bind(this.webdriverClient, url));
this.actionQueue.push(this._openCb.bind(this, url, hash, uuid));
return this;
} | [
"function",
"(",
"url",
",",
"hash",
",",
"uuid",
")",
"{",
"this",
".",
"lastCalledUrl",
"=",
"url",
";",
"this",
".",
"actionQueue",
".",
"push",
"(",
"this",
".",
"webdriverClient",
".",
"url",
".",
"bind",
"(",
"this",
".",
"webdriverClient",
",",
... | Navigate to a new URL
@method open
@param {string} url Url to navigate to
@param {string} hash Unique hash of that fn call
@param {string} uuid Unique hash of that fn call
@chainable | [
"Navigate",
"to",
"a",
"new",
"URL"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/lib/commands/url.js#L50-L55 | |
50,053 | dalekjs/dalek-driver-sauce | lib/commands/url.js | function (expected, hash) {
this.actionQueue.push(this.webdriverClient.getUrl.bind(this.webdriverClient));
this.actionQueue.push(this._urlCb.bind(this, expected, hash));
return this;
} | javascript | function (expected, hash) {
this.actionQueue.push(this.webdriverClient.getUrl.bind(this.webdriverClient));
this.actionQueue.push(this._urlCb.bind(this, expected, hash));
return this;
} | [
"function",
"(",
"expected",
",",
"hash",
")",
"{",
"this",
".",
"actionQueue",
".",
"push",
"(",
"this",
".",
"webdriverClient",
".",
"getUrl",
".",
"bind",
"(",
"this",
".",
"webdriverClient",
")",
")",
";",
"this",
".",
"actionQueue",
".",
"push",
"... | Fetches the current url
@method url
@param {string} expected Expected url
@param {string} hash Unique hash of that fn call
@chainable | [
"Fetches",
"the",
"current",
"url"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/lib/commands/url.js#L84-L88 | |
50,054 | just-paja/pwf.js | lib/pwf.js | function(mods) {
for (var i = 0, len = mods.length; i < len; i++) {
if (!internal.is_module_ready(mods[i])) {
return false;
}
}
return true;
} | javascript | function(mods) {
for (var i = 0, len = mods.length; i < len; i++) {
if (!internal.is_module_ready(mods[i])) {
return false;
}
}
return true;
} | [
"function",
"(",
"mods",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"mods",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"internal",
".",
"is_module_ready",
"(",
"mods",
"[",
"i",
"]",
")",
... | Dear sir, are all modules of this list ready?
@param Object modules List (array) of module names
@return bool | [
"Dear",
"sir",
"are",
"all",
"modules",
"of",
"this",
"list",
"ready?"
] | f2ae9607f378b3ba4553d48f4a1bc179029b16ea | https://github.com/just-paja/pwf.js/blob/f2ae9607f378b3ba4553d48f4a1bc179029b16ea/lib/pwf.js#L44-L52 | |
50,055 | just-paja/pwf.js | lib/pwf.js | function(mods) {
for (var i = 0, len = mods.length; i < len; i++) {
if (self.get_module_status(mods[i]) !== internal.states.initialized) {
return false;
}
}
return true;
} | javascript | function(mods) {
for (var i = 0, len = mods.length; i < len; i++) {
if (self.get_module_status(mods[i]) !== internal.states.initialized) {
return false;
}
}
return true;
} | [
"function",
"(",
"mods",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"mods",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"if",
"(",
"self",
".",
"get_module_status",
"(",
"mods",
"[",
"i",
"]",
")",
"!==",
... | Dear sir, are all members of this noble name list initialized?
@param list modules module name
@return bool | [
"Dear",
"sir",
"are",
"all",
"members",
"of",
"this",
"noble",
"name",
"list",
"initialized?"
] | f2ae9607f378b3ba4553d48f4a1bc179029b16ea | https://github.com/just-paja/pwf.js/blob/f2ae9607f378b3ba4553d48f4a1bc179029b16ea/lib/pwf.js#L61-L69 | |
50,056 | just-paja/pwf.js | lib/pwf.js | function()
{
if (typeof console !== 'undefined' && ((pwf.has('module', 'config') && pwf.config.get('debug.frontend')) || !pwf.has('module', 'config'))) {
var args = pwf.clone_array(arguments);
if (args.length > 1) {
console.log(args);
} else {
console.log(args[0]);
}
}
} | javascript | function()
{
if (typeof console !== 'undefined' && ((pwf.has('module', 'config') && pwf.config.get('debug.frontend')) || !pwf.has('module', 'config'))) {
var args = pwf.clone_array(arguments);
if (args.length > 1) {
console.log(args);
} else {
console.log(args[0]);
}
}
} | [
"function",
"(",
")",
"{",
"if",
"(",
"typeof",
"console",
"!==",
"'undefined'",
"&&",
"(",
"(",
"pwf",
".",
"has",
"(",
"'module'",
",",
"'config'",
")",
"&&",
"pwf",
".",
"config",
".",
"get",
"(",
"'debug.frontend'",
")",
")",
"||",
"!",
"pwf",
... | Safe dump data into console. Takes any number of any arguments
@param mixed any
@return void | [
"Safe",
"dump",
"data",
"into",
"console",
".",
"Takes",
"any",
"number",
"of",
"any",
"arguments"
] | f2ae9607f378b3ba4553d48f4a1bc179029b16ea | https://github.com/just-paja/pwf.js/blob/f2ae9607f378b3ba4553d48f4a1bc179029b16ea/lib/pwf.js#L1205-L1216 | |
50,057 | just-paja/pwf.js | lib/pwf.js | function(items)
{
var register = [];
/// Export as module if running under nodejs
if (typeof global === 'object') {
register.push(global);
}
if (typeof window === 'object') {
register.push(window);
}
// Browse all resolved global objects and bind pwf items
for (var i = 0; i < register.length; ... | javascript | function(items)
{
var register = [];
/// Export as module if running under nodejs
if (typeof global === 'object') {
register.push(global);
}
if (typeof window === 'object') {
register.push(window);
}
// Browse all resolved global objects and bind pwf items
for (var i = 0; i < register.length; ... | [
"function",
"(",
"items",
")",
"{",
"var",
"register",
"=",
"[",
"]",
";",
"/// Export as module if running under nodejs",
"if",
"(",
"typeof",
"global",
"===",
"'object'",
")",
"{",
"register",
".",
"push",
"(",
"global",
")",
";",
"}",
"if",
"(",
"typeof... | Register items into global objects
@param object items Key-value objects to register
@return void | [
"Register",
"items",
"into",
"global",
"objects"
] | f2ae9607f378b3ba4553d48f4a1bc179029b16ea | https://github.com/just-paja/pwf.js/blob/f2ae9607f378b3ba4553d48f4a1bc179029b16ea/lib/pwf.js#L1223-L1267 | |
50,058 | dvalchanov/luckio | src/luckio.js | luckio | function luckio(chance) {
var min = 1;
var max = math.maxRange(chance);
var luckyNumber = math.randomNumber(min, max);
return function() {
if (math.randomNumber(min, max) === luckyNumber) return true;
return false;
}
} | javascript | function luckio(chance) {
var min = 1;
var max = math.maxRange(chance);
var luckyNumber = math.randomNumber(min, max);
return function() {
if (math.randomNumber(min, max) === luckyNumber) return true;
return false;
}
} | [
"function",
"luckio",
"(",
"chance",
")",
"{",
"var",
"min",
"=",
"1",
";",
"var",
"max",
"=",
"math",
".",
"maxRange",
"(",
"chance",
")",
";",
"var",
"luckyNumber",
"=",
"math",
".",
"randomNumber",
"(",
"min",
",",
"max",
")",
";",
"return",
"fu... | Pick a lucky number and return a function that matches its picked lucky number
to the initial one. If equal it will return `true`, if not `false`.
@param {Number} chance Lucky chance to pick a number
@returns {Function} | [
"Pick",
"a",
"lucky",
"number",
"and",
"return",
"a",
"function",
"that",
"matches",
"its",
"picked",
"lucky",
"number",
"to",
"the",
"initial",
"one",
".",
"If",
"equal",
"it",
"will",
"return",
"true",
"if",
"not",
"false",
"."
] | 5340b97880f848c2cebc997a1e9a2771572e1762 | https://github.com/dvalchanov/luckio/blob/5340b97880f848c2cebc997a1e9a2771572e1762/src/luckio.js#L13-L22 |
50,059 | gethuman/pancakes-recipe | utils/i18n.js | getScopeValue | function getScopeValue(scope, field) {
if (!scope || !field) { return null; }
var fieldParts = field.split('.');
var pntr = scope;
_.each(fieldParts, function (fieldPart) {
if (pntr) {
pntr = pntr[fieldPart];
}
});
return pntr;
... | javascript | function getScopeValue(scope, field) {
if (!scope || !field) { return null; }
var fieldParts = field.split('.');
var pntr = scope;
_.each(fieldParts, function (fieldPart) {
if (pntr) {
pntr = pntr[fieldPart];
}
});
return pntr;
... | [
"function",
"getScopeValue",
"(",
"scope",
",",
"field",
")",
"{",
"if",
"(",
"!",
"scope",
"||",
"!",
"field",
")",
"{",
"return",
"null",
";",
"}",
"var",
"fieldParts",
"=",
"field",
".",
"split",
"(",
"'.'",
")",
";",
"var",
"pntr",
"=",
"scope"... | Get a value from scope for a given field
@param scope
@param field
@returns {{}} | [
"Get",
"a",
"value",
"from",
"scope",
"for",
"a",
"given",
"field"
] | ea3feb8839e2edaf1b4577c052b8958953db4498 | https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/utils/i18n.js#L18-L31 |
50,060 | gethuman/pancakes-recipe | utils/i18n.js | interpolate | function interpolate(val, scope) {
// if no scope or value with {{ then no interpolation and can just return translated
if (!scope || !val || !val.match) { return val; }
// first, we need to get all values with a {{ }} in the string
var i18nVars = val.match(i18nVarExpr);
// lo... | javascript | function interpolate(val, scope) {
// if no scope or value with {{ then no interpolation and can just return translated
if (!scope || !val || !val.match) { return val; }
// first, we need to get all values with a {{ }} in the string
var i18nVars = val.match(i18nVarExpr);
// lo... | [
"function",
"interpolate",
"(",
"val",
",",
"scope",
")",
"{",
"// if no scope or value with {{ then no interpolation and can just return translated",
"if",
"(",
"!",
"scope",
"||",
"!",
"val",
"||",
"!",
"val",
".",
"match",
")",
"{",
"return",
"val",
";",
"}",
... | Attempt to interpolate the string
@param val
@param scope
@returns {*} | [
"Attempt",
"to",
"interpolate",
"the",
"string"
] | ea3feb8839e2edaf1b4577c052b8958953db4498 | https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/utils/i18n.js#L39-L55 |
50,061 | gethuman/pancakes-recipe | utils/i18n.js | translate | function translate(val, scope, status) {
var app = (scope && scope.appName) || context.get('app') || '';
var lang = (scope && scope.lang) || context.get('lang') || 'en';
var translated;
// if just one character or is a number, don't do translation
if (!val || val.length < 2 || !... | javascript | function translate(val, scope, status) {
var app = (scope && scope.appName) || context.get('app') || '';
var lang = (scope && scope.lang) || context.get('lang') || 'en';
var translated;
// if just one character or is a number, don't do translation
if (!val || val.length < 2 || !... | [
"function",
"translate",
"(",
"val",
",",
"scope",
",",
"status",
")",
"{",
"var",
"app",
"=",
"(",
"scope",
"&&",
"scope",
".",
"appName",
")",
"||",
"context",
".",
"get",
"(",
"'app'",
")",
"||",
"''",
";",
"var",
"lang",
"=",
"(",
"scope",
"&... | Translate given text into the target language. If not in the target language,
look in english, and then finally just return back the value itself
@param val
@param scope
@param status
@returns {string} | [
"Translate",
"given",
"text",
"into",
"the",
"target",
"language",
".",
"If",
"not",
"in",
"the",
"target",
"language",
"look",
"in",
"english",
"and",
"then",
"finally",
"just",
"return",
"back",
"the",
"value",
"itself"
] | ea3feb8839e2edaf1b4577c052b8958953db4498 | https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/utils/i18n.js#L66-L92 |
50,062 | skerit/hawkejs | lib/client/dom_spotting.js | initialCheck | function initialCheck(attr_name) {
var elements = document.querySelectorAll('[' + attr_name + ']'),
element,
value,
i,
l;
for (i = 0; i < elements.length; i++) {
element = elements[i];
value = element.getAttribute(attr_name);
if (initial_seen.get(element)) {
continue;
}
if (attrib... | javascript | function initialCheck(attr_name) {
var elements = document.querySelectorAll('[' + attr_name + ']'),
element,
value,
i,
l;
for (i = 0; i < elements.length; i++) {
element = elements[i];
value = element.getAttribute(attr_name);
if (initial_seen.get(element)) {
continue;
}
if (attrib... | [
"function",
"initialCheck",
"(",
"attr_name",
")",
"{",
"var",
"elements",
"=",
"document",
".",
"querySelectorAll",
"(",
"'['",
"+",
"attr_name",
"+",
"']'",
")",
",",
"element",
",",
"value",
",",
"i",
",",
"l",
";",
"for",
"(",
"i",
"=",
"0",
";",... | Do an initial check for the given attribute name
@author Jelle De Loecker <jelle@develry.be>
@since 1.0.0
@version 1.1.2
@param {String} attr_name | [
"Do",
"an",
"initial",
"check",
"for",
"the",
"given",
"attribute",
"name"
] | 15ed7205183ac2c425362deb8c0796c0d16b898a | https://github.com/skerit/hawkejs/blob/15ed7205183ac2c425362deb8c0796c0d16b898a/lib/client/dom_spotting.js#L74-L97 |
50,063 | skerit/hawkejs | lib/client/dom_spotting.js | checkChildren | function checkChildren(mutation, node, seen) {
var attr,
k,
l;
if (seen == null) {
seen = initial_seen;
}
// Ignore text nodes
if (node.nodeType === 3 || node.nodeType === 8) {
return;
}
// Only check attributes for nodes that haven't been checked before
if (!seen.get(node)) {
// Indicate t... | javascript | function checkChildren(mutation, node, seen) {
var attr,
k,
l;
if (seen == null) {
seen = initial_seen;
}
// Ignore text nodes
if (node.nodeType === 3 || node.nodeType === 8) {
return;
}
// Only check attributes for nodes that haven't been checked before
if (!seen.get(node)) {
// Indicate t... | [
"function",
"checkChildren",
"(",
"mutation",
",",
"node",
",",
"seen",
")",
"{",
"var",
"attr",
",",
"k",
",",
"l",
";",
"if",
"(",
"seen",
"==",
"null",
")",
"{",
"seen",
"=",
"initial_seen",
";",
"}",
"// Ignore text nodes",
"if",
"(",
"node",
"."... | Check this added node and all its children
@author Jelle De Loecker <jelle@develry.be>
@since 1.0.0
@version 1.0.0
@param {Object} mutation
@param {Node} node
@param {WeakMap} seen | [
"Check",
"this",
"added",
"node",
"and",
"all",
"its",
"children"
] | 15ed7205183ac2c425362deb8c0796c0d16b898a | https://github.com/skerit/hawkejs/blob/15ed7205183ac2c425362deb8c0796c0d16b898a/lib/client/dom_spotting.js#L110-L149 |
50,064 | valiton/node-simple-pool | lib/simplepool.js | SimplePool | function SimplePool() {
var args;
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
this.current = 0;
this.pool = args.length === 1 && Array.isArray(args[0]) ? args[0] : args;
} | javascript | function SimplePool() {
var args;
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
this.current = 0;
this.pool = args.length === 1 && Array.isArray(args[0]) ? args[0] : args;
} | [
"function",
"SimplePool",
"(",
")",
"{",
"var",
"args",
";",
"args",
"=",
"1",
"<=",
"arguments",
".",
"length",
"?",
"__slice",
".",
"call",
"(",
"arguments",
",",
"0",
")",
":",
"[",
"]",
";",
"this",
".",
"current",
"=",
"0",
";",
"this",
".",... | create a new SimplePool instance
@memberOf global
@constructor
@this {SimplePool} | [
"create",
"a",
"new",
"SimplePool",
"instance"
] | 5b6220a7f3b9d000dc66483280509b85e4b70d5d | https://github.com/valiton/node-simple-pool/blob/5b6220a7f3b9d000dc66483280509b85e4b70d5d/lib/simplepool.js#L26-L31 |
50,065 | vibe-project/vibe-protocol | lib/transport-http-server.js | createBaseTransport | function createBaseTransport(req, res) {
// A transport object.
var self = new events.EventEmitter();
// Because HTTP transport consists of multiple exchanges, an universally
// unique identifier is required.
self.id = uuid.v4();
// A flag to check the transport is opened.
var opened = true;... | javascript | function createBaseTransport(req, res) {
// A transport object.
var self = new events.EventEmitter();
// Because HTTP transport consists of multiple exchanges, an universally
// unique identifier is required.
self.id = uuid.v4();
// A flag to check the transport is opened.
var opened = true;... | [
"function",
"createBaseTransport",
"(",
"req",
",",
"res",
")",
"{",
"// A transport object.",
"var",
"self",
"=",
"new",
"events",
".",
"EventEmitter",
"(",
")",
";",
"// Because HTTP transport consists of multiple exchanges, an universally",
"// unique identifier is require... | A base transport. | [
"A",
"base",
"transport",
"."
] | 4a350acade3760ea13e75d7b9ce0815cf8b1d688 | https://github.com/vibe-project/vibe-protocol/blob/4a350acade3760ea13e75d7b9ce0815cf8b1d688/lib/transport-http-server.js#L181-L202 |
50,066 | vibe-project/vibe-protocol | lib/transport-http-server.js | createStreamTransport | function createStreamTransport(req, res) {
// A transport object.
var self = createBaseTransport(req, res);
// Any error on request-response should propagate to transport.
req.on("error", function(error) {
self.emit("error", error);
});
res.on("error", function(error) {
self.emit... | javascript | function createStreamTransport(req, res) {
// A transport object.
var self = createBaseTransport(req, res);
// Any error on request-response should propagate to transport.
req.on("error", function(error) {
self.emit("error", error);
});
res.on("error", function(error) {
self.emit... | [
"function",
"createStreamTransport",
"(",
"req",
",",
"res",
")",
"{",
"// A transport object.",
"var",
"self",
"=",
"createBaseTransport",
"(",
"req",
",",
"res",
")",
";",
"// Any error on request-response should propagate to transport.",
"req",
".",
"on",
"(",
"\"e... | The client performs a HTTP persistent connection and watches changes in response and the server prints chunk as data to response. | [
"The",
"client",
"performs",
"a",
"HTTP",
"persistent",
"connection",
"and",
"watches",
"changes",
"in",
"response",
"and",
"the",
"server",
"prints",
"chunk",
"as",
"data",
"to",
"response",
"."
] | 4a350acade3760ea13e75d7b9ce0815cf8b1d688 | https://github.com/vibe-project/vibe-protocol/blob/4a350acade3760ea13e75d7b9ce0815cf8b1d688/lib/transport-http-server.js#L206-L275 |
50,067 | unshiftio/failure | index.js | toJSON | function toJSON() {
var obj = { message: this.message, stack: this.stack }, key;
for (key in this) {
if (
has.call(this, key)
&& 'function' !== typeof this[key]
) {
obj[key] = this[key];
}
}
return obj;
} | javascript | function toJSON() {
var obj = { message: this.message, stack: this.stack }, key;
for (key in this) {
if (
has.call(this, key)
&& 'function' !== typeof this[key]
) {
obj[key] = this[key];
}
}
return obj;
} | [
"function",
"toJSON",
"(",
")",
"{",
"var",
"obj",
"=",
"{",
"message",
":",
"this",
".",
"message",
",",
"stack",
":",
"this",
".",
"stack",
"}",
",",
"key",
";",
"for",
"(",
"key",
"in",
"this",
")",
"{",
"if",
"(",
"has",
".",
"call",
"(",
... | Return an object with all the information that should be in the JSON output.
It doesn't matter if we list keys that might not be in the err as the
JSON.stringify will remove properties who's values are set to `undefined`. So
we want to make sure that we include some common properties.
@returns {Object}
@api public | [
"Return",
"an",
"object",
"with",
"all",
"the",
"information",
"that",
"should",
"be",
"in",
"the",
"JSON",
"output",
".",
"It",
"doesn",
"t",
"matter",
"if",
"we",
"list",
"keys",
"that",
"might",
"not",
"be",
"in",
"the",
"err",
"as",
"the",
"JSON",
... | 085e848942f68d8169985799979fb69af553e196 | https://github.com/unshiftio/failure/blob/085e848942f68d8169985799979fb69af553e196/index.js#L14-L27 |
50,068 | deepjs/autobahn | lib/app-init.js | function(session) {
if (session && session.user) {
if (session.user.roles)
return { roles: session.user.roles };
return { roles: "user" };
}
return { roles: "public" };
} | javascript | function(session) {
if (session && session.user) {
if (session.user.roles)
return { roles: session.user.roles };
return { roles: "user" };
}
return { roles: "public" };
} | [
"function",
"(",
"session",
")",
"{",
"if",
"(",
"session",
"&&",
"session",
".",
"user",
")",
"{",
"if",
"(",
"session",
".",
"user",
".",
"roles",
")",
"return",
"{",
"roles",
":",
"session",
".",
"user",
".",
"roles",
"}",
";",
"return",
"{",
... | default session modes handler | [
"default",
"session",
"modes",
"handler"
] | fe2dfa15c84a4a79bfde86abc1c63fc9f03e6cef | https://github.com/deepjs/autobahn/blob/fe2dfa15c84a4a79bfde86abc1c63fc9f03e6cef/lib/app-init.js#L179-L186 | |
50,069 | vidi-insights/vidi-influx-sink | influx-sink.js | on_write | function on_write (metric, enc, done) {
var name = metric.name
var values = metric.values
var tags = metric.tags
locals.batch.list[name] = locals.batch.list[name] || []
locals.batch.list[name].push([values, tags])
locals.batch.count = locals.batch.count + 1
var exceeded = locals.batch.count >= locals.ba... | javascript | function on_write (metric, enc, done) {
var name = metric.name
var values = metric.values
var tags = metric.tags
locals.batch.list[name] = locals.batch.list[name] || []
locals.batch.list[name].push([values, tags])
locals.batch.count = locals.batch.count + 1
var exceeded = locals.batch.count >= locals.ba... | [
"function",
"on_write",
"(",
"metric",
",",
"enc",
",",
"done",
")",
"{",
"var",
"name",
"=",
"metric",
".",
"name",
"var",
"values",
"=",
"metric",
".",
"values",
"var",
"tags",
"=",
"metric",
".",
"tags",
"locals",
".",
"batch",
".",
"list",
"[",
... | Called each time the stream is written to | [
"Called",
"each",
"time",
"the",
"stream",
"is",
"written",
"to"
] | 613851b6f7372415e62384a8a09624d362887f0d | https://github.com/vidi-insights/vidi-influx-sink/blob/613851b6f7372415e62384a8a09624d362887f0d/influx-sink.js#L72-L89 |
50,070 | therne/importer | lib/importer.js | importerSync | function importerSync(options, handler) {
var modulePath, recursive = false, parent = '';
if (typeof options === 'string') {
modulePath = options;
} else {
modulePath = options.path;
recursive = options.recursive || recursive;
parent = options.parent || parent;
if (... | javascript | function importerSync(options, handler) {
var modulePath, recursive = false, parent = '';
if (typeof options === 'string') {
modulePath = options;
} else {
modulePath = options.path;
recursive = options.recursive || recursive;
parent = options.parent || parent;
if (... | [
"function",
"importerSync",
"(",
"options",
",",
"handler",
")",
"{",
"var",
"modulePath",
",",
"recursive",
"=",
"false",
",",
"parent",
"=",
"''",
";",
"if",
"(",
"typeof",
"options",
"===",
"'string'",
")",
"{",
"modulePath",
"=",
"options",
";",
"}",... | Retrieves all sources in a given directory and calls handler.
@param options Import options. (or module directory path)
@param {eachModule} [handler] Called when import each module. | [
"Retrieves",
"all",
"sources",
"in",
"a",
"given",
"directory",
"and",
"calls",
"handler",
"."
] | 2c39ee45e434e7974139b96484dda11db72da467 | https://github.com/therne/importer/blob/2c39ee45e434e7974139b96484dda11db72da467/lib/importer.js#L22-L59 |
50,071 | itsa-server/itsa-classes | classes.js | function (prototypes, force) {
var instance, proto, names, l, i, replaceMap, protectedMap, name, nameInProto, finalName, propDescriptor, extraInfo;
if (!prototypes) {
return;
}
instance = this; // the Class
proto = instance.prototype;
names = Object.getOwnProp... | javascript | function (prototypes, force) {
var instance, proto, names, l, i, replaceMap, protectedMap, name, nameInProto, finalName, propDescriptor, extraInfo;
if (!prototypes) {
return;
}
instance = this; // the Class
proto = instance.prototype;
names = Object.getOwnProp... | [
"function",
"(",
"prototypes",
",",
"force",
")",
"{",
"var",
"instance",
",",
"proto",
",",
"names",
",",
"l",
",",
"i",
",",
"replaceMap",
",",
"protectedMap",
",",
"name",
",",
"nameInProto",
",",
"finalName",
",",
"propDescriptor",
",",
"extraInfo",
... | Merges the given prototypes of properties into the `prototype` of the Class.
**Note1 ** to be used on instances --> ONLY on Classes
**Note2 ** properties with getters and/or unwritable will NOT be merged
The members in the hash prototypes will become members with
instances of the merged class.
By default, this metho... | [
"Merges",
"the",
"given",
"prototypes",
"of",
"properties",
"into",
"the",
"prototype",
"of",
"the",
"Class",
"."
] | 58f3355a5d68d528194d362fb99dd32ea31ec7cf | https://github.com/itsa-server/itsa-classes/blob/58f3355a5d68d528194d362fb99dd32ea31ec7cf/classes.js#L177-L254 | |
50,072 | itsa-server/itsa-classes | classes.js | function (properties) {
var proto = this.prototype,
replaceMap = arguments[1] || REPLACE_CLASS_METHODS; // hidden feature, used by itags
Array.isArray(properties) || (properties=[properties]);
properties.forEach(function(prop) {
prop = replaceMap[prop] || prop;
... | javascript | function (properties) {
var proto = this.prototype,
replaceMap = arguments[1] || REPLACE_CLASS_METHODS; // hidden feature, used by itags
Array.isArray(properties) || (properties=[properties]);
properties.forEach(function(prop) {
prop = replaceMap[prop] || prop;
... | [
"function",
"(",
"properties",
")",
"{",
"var",
"proto",
"=",
"this",
".",
"prototype",
",",
"replaceMap",
"=",
"arguments",
"[",
"1",
"]",
"||",
"REPLACE_CLASS_METHODS",
";",
"// hidden feature, used by itags",
"Array",
".",
"isArray",
"(",
"properties",
")",
... | Removes the specified prototypes from the Class.
@method removePrototypes
@param properties {String|Array} Hash of properties to be removed from the Class
@chainable | [
"Removes",
"the",
"specified",
"prototypes",
"from",
"the",
"Class",
"."
] | 58f3355a5d68d528194d362fb99dd32ea31ec7cf | https://github.com/itsa-server/itsa-classes/blob/58f3355a5d68d528194d362fb99dd32ea31ec7cf/classes.js#L264-L273 | |
50,073 | itsa-server/itsa-classes | classes.js | function(constructorFn, chainConstruct) {
var instance = this;
if (typeof constructorFn==='boolean') {
chainConstruct = constructorFn;
constructorFn = null;
}
(typeof chainConstruct === 'boolean') || (chainConstruct=DEFAULT_CHAIN_CONSTRUCT);
instance.$$con... | javascript | function(constructorFn, chainConstruct) {
var instance = this;
if (typeof constructorFn==='boolean') {
chainConstruct = constructorFn;
constructorFn = null;
}
(typeof chainConstruct === 'boolean') || (chainConstruct=DEFAULT_CHAIN_CONSTRUCT);
instance.$$con... | [
"function",
"(",
"constructorFn",
",",
"chainConstruct",
")",
"{",
"var",
"instance",
"=",
"this",
";",
"if",
"(",
"typeof",
"constructorFn",
"===",
"'boolean'",
")",
"{",
"chainConstruct",
"=",
"constructorFn",
";",
"constructorFn",
"=",
"null",
";",
"}",
"... | Redefines the constructor fo the Class
@method setConstructor
@param [constructorFn] {Function} The function that will serve as the new constructor for the class.
If `undefined` defaults to `NOOP`
@param [prototypes] {Object} Hash map of properties to be added to the prototype of the new class.
@param [chainConstruct=... | [
"Redefines",
"the",
"constructor",
"fo",
"the",
"Class"
] | 58f3355a5d68d528194d362fb99dd32ea31ec7cf | https://github.com/itsa-server/itsa-classes/blob/58f3355a5d68d528194d362fb99dd32ea31ec7cf/classes.js#L285-L295 | |
50,074 | itsa-server/itsa-classes | classes.js | function (constructor, prototypes, chainConstruct) {
var instance = this,
constructorClosure = {},
baseProt, proto, constrFn;
if (typeof constructor === 'boolean') {
constructor = null;
prototypes = null;
chainConstruct = constructor;
... | javascript | function (constructor, prototypes, chainConstruct) {
var instance = this,
constructorClosure = {},
baseProt, proto, constrFn;
if (typeof constructor === 'boolean') {
constructor = null;
prototypes = null;
chainConstruct = constructor;
... | [
"function",
"(",
"constructor",
",",
"prototypes",
",",
"chainConstruct",
")",
"{",
"var",
"instance",
"=",
"this",
",",
"constructorClosure",
"=",
"{",
"}",
",",
"baseProt",
",",
"proto",
",",
"constrFn",
";",
"if",
"(",
"typeof",
"constructor",
"===",
"'... | Returns a newly created class inheriting from this class
using the given `constructor` with the
prototypes listed in `prototypes` merged in.
The newly created class has the `$$super` static property
available to access all of is ancestor's instance methods.
Further methods can be added via the [mergePrototypes](#met... | [
"Returns",
"a",
"newly",
"created",
"class",
"inheriting",
"from",
"this",
"class",
"using",
"the",
"given",
"constructor",
"with",
"the",
"prototypes",
"listed",
"in",
"prototypes",
"merged",
"in",
"."
] | 58f3355a5d68d528194d362fb99dd32ea31ec7cf | https://github.com/itsa-server/itsa-classes/blob/58f3355a5d68d528194d362fb99dd32ea31ec7cf/classes.js#L329-L394 | |
50,075 | admoexperience/generator-admo | templates/bower/jquery.transit.js | checkTransform3dSupport | function checkTransform3dSupport() {
div.style[support.transform] = '';
div.style[support.transform] = 'rotateY(90deg)';
return div.style[support.transform] !== '';
} | javascript | function checkTransform3dSupport() {
div.style[support.transform] = '';
div.style[support.transform] = 'rotateY(90deg)';
return div.style[support.transform] !== '';
} | [
"function",
"checkTransform3dSupport",
"(",
")",
"{",
"div",
".",
"style",
"[",
"support",
".",
"transform",
"]",
"=",
"''",
";",
"div",
".",
"style",
"[",
"support",
".",
"transform",
"]",
"=",
"'rotateY(90deg)'",
";",
"return",
"div",
".",
"style",
"["... | Helper function to check if transform3D is supported. Should return true for Webkits and Firefox 10+. | [
"Helper",
"function",
"to",
"check",
"if",
"transform3D",
"is",
"supported",
".",
"Should",
"return",
"true",
"for",
"Webkits",
"and",
"Firefox",
"10",
"+",
"."
] | f27e261990948860e14f735f3cd7c59bf1130feb | https://github.com/admoexperience/generator-admo/blob/f27e261990948860e14f735f3cd7c59bf1130feb/templates/bower/jquery.transit.js#L56-L60 |
50,076 | admoexperience/generator-admo | templates/bower/jquery.transit.js | function(elem, v) {
var value = v;
if (!(value instanceof Transform)) {
value = new Transform(value);
}
// We've seen the 3D version of Scale() not work in Chrome when the
// element being scaled extends outside of the viewport. Thus, we're
// forcing Chrome to not use the... | javascript | function(elem, v) {
var value = v;
if (!(value instanceof Transform)) {
value = new Transform(value);
}
// We've seen the 3D version of Scale() not work in Chrome when the
// element being scaled extends outside of the viewport. Thus, we're
// forcing Chrome to not use the... | [
"function",
"(",
"elem",
",",
"v",
")",
"{",
"var",
"value",
"=",
"v",
";",
"if",
"(",
"!",
"(",
"value",
"instanceof",
"Transform",
")",
")",
"{",
"value",
"=",
"new",
"Transform",
"(",
"value",
")",
";",
"}",
"// We've seen the 3D version of Scale() no... | The setter accepts a `Transform` object or a string. | [
"The",
"setter",
"accepts",
"a",
"Transform",
"object",
"or",
"a",
"string",
"."
] | f27e261990948860e14f735f3cd7c59bf1130feb | https://github.com/admoexperience/generator-admo/blob/f27e261990948860e14f735f3cd7c59bf1130feb/templates/bower/jquery.transit.js#L143-L162 | |
50,077 | admoexperience/generator-admo | templates/bower/jquery.transit.js | function() {
if (bound) { self.unbind(transitionEnd, cb); }
if (i > 0) {
self.each(function() {
this.style[support.transition] = (oldTransitions[this] || null);
});
}
if (typeof callback === 'function') { callback.apply(self); }
if (typeof nextCa... | javascript | function() {
if (bound) { self.unbind(transitionEnd, cb); }
if (i > 0) {
self.each(function() {
this.style[support.transition] = (oldTransitions[this] || null);
});
}
if (typeof callback === 'function') { callback.apply(self); }
if (typeof nextCa... | [
"function",
"(",
")",
"{",
"if",
"(",
"bound",
")",
"{",
"self",
".",
"unbind",
"(",
"transitionEnd",
",",
"cb",
")",
";",
"}",
"if",
"(",
"i",
">",
"0",
")",
"{",
"self",
".",
"each",
"(",
"function",
"(",
")",
"{",
"this",
".",
"style",
"["... | Prepare the callback. | [
"Prepare",
"the",
"callback",
"."
] | f27e261990948860e14f735f3cd7c59bf1130feb | https://github.com/admoexperience/generator-admo/blob/f27e261990948860e14f735f3cd7c59bf1130feb/templates/bower/jquery.transit.js#L589-L600 | |
50,078 | admoexperience/generator-admo | templates/bower/jquery.transit.js | function(next) {
var i = 0;
// Durations that are too slow will get transitions mixed up.
// (Tested on Mac/FF 7.0.1)
if ((support.transition === 'MozTransition') && (i < 25)) { i = 25; }
window.setTimeout(function() { run(next); }, i);
} | javascript | function(next) {
var i = 0;
// Durations that are too slow will get transitions mixed up.
// (Tested on Mac/FF 7.0.1)
if ((support.transition === 'MozTransition') && (i < 25)) { i = 25; }
window.setTimeout(function() { run(next); }, i);
} | [
"function",
"(",
"next",
")",
"{",
"var",
"i",
"=",
"0",
";",
"// Durations that are too slow will get transitions mixed up.",
"// (Tested on Mac/FF 7.0.1)",
"if",
"(",
"(",
"support",
".",
"transition",
"===",
"'MozTransition'",
")",
"&&",
"(",
"i",
"<",
"25",
")... | Defer running. This allows the browser to paint any pending CSS it hasn't painted yet before doing the transitions. | [
"Defer",
"running",
".",
"This",
"allows",
"the",
"browser",
"to",
"paint",
"any",
"pending",
"CSS",
"it",
"hasn",
"t",
"painted",
"yet",
"before",
"doing",
"the",
"transitions",
"."
] | f27e261990948860e14f735f3cd7c59bf1130feb | https://github.com/admoexperience/generator-admo/blob/f27e261990948860e14f735f3cd7c59bf1130feb/templates/bower/jquery.transit.js#L622-L630 | |
50,079 | getmillipede/millipede-node | lib/millipede.js | Millipede | function Millipede(size, options) {
options = options || {};
this.size = size;
this.reverse = options.reverse;
this.horizontal = options.horizontal;
this.position = options.position || 0;
this.top = options.top || 0;
this.left = options.left || 0;
this.validate();
} | javascript | function Millipede(size, options) {
options = options || {};
this.size = size;
this.reverse = options.reverse;
this.horizontal = options.horizontal;
this.position = options.position || 0;
this.top = options.top || 0;
this.left = options.left || 0;
this.validate();
} | [
"function",
"Millipede",
"(",
"size",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"this",
".",
"size",
"=",
"size",
";",
"this",
".",
"reverse",
"=",
"options",
".",
"reverse",
";",
"this",
".",
"horizontal",
"=",
"optio... | Initialize a new `Millipede` with the given `size` and `options`.
@param {Number} size
@param {Object} options
@return {Millipede}
@public | [
"Initialize",
"a",
"new",
"Millipede",
"with",
"the",
"given",
"size",
"and",
"options",
"."
] | e68244e91e458a2916a09124847c655f993ff970 | https://github.com/getmillipede/millipede-node/blob/e68244e91e458a2916a09124847c655f993ff970/lib/millipede.js#L26-L38 |
50,080 | interlockjs/plugins | packages/share/src/take.js | rawBundleFromFile | function rawBundleFromFile (dir, filename) {
return readFilePromise(path.join(dir, filename))
.then(content => {
return { dest: filename, raw: content };
});
} | javascript | function rawBundleFromFile (dir, filename) {
return readFilePromise(path.join(dir, filename))
.then(content => {
return { dest: filename, raw: content };
});
} | [
"function",
"rawBundleFromFile",
"(",
"dir",
",",
"filename",
")",
"{",
"return",
"readFilePromise",
"(",
"path",
".",
"join",
"(",
"dir",
",",
"filename",
")",
")",
".",
"then",
"(",
"content",
"=>",
"{",
"return",
"{",
"dest",
":",
"filename",
",",
"... | Given a directory and file in that directory, return a promise
that resolves to a bundle that contains the filename and raw
content.
@param {String} dir Valid path to directory containing Interlock bundles.
@param {String} filename Filename of bundle in dir.
@returns {Promise} Resolves to bundl... | [
"Given",
"a",
"directory",
"and",
"file",
"in",
"that",
"directory",
"return",
"a",
"promise",
"that",
"resolves",
"to",
"a",
"bundle",
"that",
"contains",
"the",
"filename",
"and",
"raw",
"content",
"."
] | 05197e4511b64d269260fe3c701ceff864897ab3 | https://github.com/interlockjs/plugins/blob/05197e4511b64d269260fe3c701ceff864897ab3/packages/share/src/take.js#L26-L31 |
50,081 | JohnnieFucker/dreamix-rpc | lib/rpc-client/router.js | defRoute | function defRoute(session, msg, context, cb) {
const list = context.getServersByType(msg.serverType);
if (!list || !list.length) {
cb(new Error(`can not find server info for type:${msg.serverType}`));
return;
}
const uid = session ? (session.uid || '') : '';
const index = Math.abs(cr... | javascript | function defRoute(session, msg, context, cb) {
const list = context.getServersByType(msg.serverType);
if (!list || !list.length) {
cb(new Error(`can not find server info for type:${msg.serverType}`));
return;
}
const uid = session ? (session.uid || '') : '';
const index = Math.abs(cr... | [
"function",
"defRoute",
"(",
"session",
",",
"msg",
",",
"context",
",",
"cb",
")",
"{",
"const",
"list",
"=",
"context",
".",
"getServersByType",
"(",
"msg",
".",
"serverType",
")",
";",
"if",
"(",
"!",
"list",
"||",
"!",
"list",
".",
"length",
")",... | Calculate route info and return an appropriate server id.
@param session {Object} session object for current rpc request
@param msg {Object} rpc message. {serverType, service, method, args, opts}
@param context {Object} context of client
@param cb(err, serverId) | [
"Calculate",
"route",
"info",
"and",
"return",
"an",
"appropriate",
"server",
"id",
"."
] | eb29e247214148c025456b2bb0542e1094fd2edb | https://github.com/JohnnieFucker/dreamix-rpc/blob/eb29e247214148c025456b2bb0542e1094fd2edb/lib/rpc-client/router.js#L13-L22 |
50,082 | JohnnieFucker/dreamix-rpc | lib/rpc-client/router.js | rdRoute | function rdRoute(client, serverType, msg, cb) {
const servers = client._station.serversMap[serverType];
if (!servers || !servers.length) {
utils.invokeCallback(cb, new Error(`rpc servers not exist with serverType: ${serverType}`));
return;
}
const index = Math.floor(Math.random() * serve... | javascript | function rdRoute(client, serverType, msg, cb) {
const servers = client._station.serversMap[serverType];
if (!servers || !servers.length) {
utils.invokeCallback(cb, new Error(`rpc servers not exist with serverType: ${serverType}`));
return;
}
const index = Math.floor(Math.random() * serve... | [
"function",
"rdRoute",
"(",
"client",
",",
"serverType",
",",
"msg",
",",
"cb",
")",
"{",
"const",
"servers",
"=",
"client",
".",
"_station",
".",
"serversMap",
"[",
"serverType",
"]",
";",
"if",
"(",
"!",
"servers",
"||",
"!",
"servers",
".",
"length"... | Random algorithm for calculating server id.
@param client {Object} rpc client.
@param serverType {String} rpc target serverType.
@param msg {Object} rpc message.
@param cb {Function} cb(err, serverId). | [
"Random",
"algorithm",
"for",
"calculating",
"server",
"id",
"."
] | eb29e247214148c025456b2bb0542e1094fd2edb | https://github.com/JohnnieFucker/dreamix-rpc/blob/eb29e247214148c025456b2bb0542e1094fd2edb/lib/rpc-client/router.js#L32-L40 |
50,083 | JohnnieFucker/dreamix-rpc | lib/rpc-client/router.js | rrRoute | function rrRoute(client, serverType, msg, cb) {
const servers = client._station.serversMap[serverType];
if (!servers || !servers.length) {
utils.invokeCallback(cb, new Error(`rpc servers not exist with serverType: ${serverType}`));
return;
}
let index;
if (!client.rrParam) {
... | javascript | function rrRoute(client, serverType, msg, cb) {
const servers = client._station.serversMap[serverType];
if (!servers || !servers.length) {
utils.invokeCallback(cb, new Error(`rpc servers not exist with serverType: ${serverType}`));
return;
}
let index;
if (!client.rrParam) {
... | [
"function",
"rrRoute",
"(",
"client",
",",
"serverType",
",",
"msg",
",",
"cb",
")",
"{",
"const",
"servers",
"=",
"client",
".",
"_station",
".",
"serversMap",
"[",
"serverType",
"]",
";",
"if",
"(",
"!",
"servers",
"||",
"!",
"servers",
".",
"length"... | Round-Robin algorithm for calculating server id.
@param client {Object} rpc client.
@param serverType {String} rpc target serverType.
@param msg {Object} rpc message.
@param cb {Function} cb(err, serverId). | [
"Round",
"-",
"Robin",
"algorithm",
"for",
"calculating",
"server",
"id",
"."
] | eb29e247214148c025456b2bb0542e1094fd2edb | https://github.com/JohnnieFucker/dreamix-rpc/blob/eb29e247214148c025456b2bb0542e1094fd2edb/lib/rpc-client/router.js#L50-L70 |
50,084 | JohnnieFucker/dreamix-rpc | lib/rpc-client/router.js | wrrRoute | function wrrRoute(client, serverType, msg, cb) {
const servers = client._station.serversMap[serverType];
if (!servers || !servers.length) {
utils.invokeCallback(cb, new Error(`rpc servers not exist with serverType: ${serverType}`));
return;
}
let index;
let weight;
if (!client.wr... | javascript | function wrrRoute(client, serverType, msg, cb) {
const servers = client._station.serversMap[serverType];
if (!servers || !servers.length) {
utils.invokeCallback(cb, new Error(`rpc servers not exist with serverType: ${serverType}`));
return;
}
let index;
let weight;
if (!client.wr... | [
"function",
"wrrRoute",
"(",
"client",
",",
"serverType",
",",
"msg",
",",
"cb",
")",
"{",
"const",
"servers",
"=",
"client",
".",
"_station",
".",
"serversMap",
"[",
"serverType",
"]",
";",
"if",
"(",
"!",
"servers",
"||",
"!",
"servers",
".",
"length... | Weight-Round-Robin algorithm for calculating server id.
@param client {Object} rpc client.
@param serverType {String} rpc target serverType.
@param msg {Object} rpc message.
@param cb {Function} cb(err, serverId). | [
"Weight",
"-",
"Round",
"-",
"Robin",
"algorithm",
"for",
"calculating",
"server",
"id",
"."
] | eb29e247214148c025456b2bb0542e1094fd2edb | https://github.com/JohnnieFucker/dreamix-rpc/blob/eb29e247214148c025456b2bb0542e1094fd2edb/lib/rpc-client/router.js#L80-L127 |
50,085 | JohnnieFucker/dreamix-rpc | lib/rpc-client/router.js | laRoute | function laRoute(client, serverType, msg, cb) {
const servers = client._station.serversMap[serverType];
if (!servers || !servers.length) {
utils.invokeCallback(cb, new Error(`rpc servers not exist with serverType: ${serverType}`));
return;
}
const actives = [];
if (!client.laParam) {... | javascript | function laRoute(client, serverType, msg, cb) {
const servers = client._station.serversMap[serverType];
if (!servers || !servers.length) {
utils.invokeCallback(cb, new Error(`rpc servers not exist with serverType: ${serverType}`));
return;
}
const actives = [];
if (!client.laParam) {... | [
"function",
"laRoute",
"(",
"client",
",",
"serverType",
",",
"msg",
",",
"cb",
")",
"{",
"const",
"servers",
"=",
"client",
".",
"_station",
".",
"serversMap",
"[",
"serverType",
"]",
";",
"if",
"(",
"!",
"servers",
"||",
"!",
"servers",
".",
"length"... | Least-Active algorithm for calculating server id.
@param client {Object} rpc client.
@param serverType {String} rpc target serverType.
@param msg {Object} rpc message.
@param cb {Function} cb(err, serverId). | [
"Least",
"-",
"Active",
"algorithm",
"for",
"calculating",
"server",
"id",
"."
] | eb29e247214148c025456b2bb0542e1094fd2edb | https://github.com/JohnnieFucker/dreamix-rpc/blob/eb29e247214148c025456b2bb0542e1094fd2edb/lib/rpc-client/router.js#L137-L178 |
50,086 | JohnnieFucker/dreamix-rpc | lib/rpc-client/router.js | chRoute | function chRoute(client, serverType, msg, cb) {
const servers = client._station.serversMap[serverType];
if (!servers || !servers.length) {
utils.invokeCallback(cb, new Error(`rpc servers not exist with serverType: ${serverType}`));
return;
}
let con;
if (!client.chParam) {
cl... | javascript | function chRoute(client, serverType, msg, cb) {
const servers = client._station.serversMap[serverType];
if (!servers || !servers.length) {
utils.invokeCallback(cb, new Error(`rpc servers not exist with serverType: ${serverType}`));
return;
}
let con;
if (!client.chParam) {
cl... | [
"function",
"chRoute",
"(",
"client",
",",
"serverType",
",",
"msg",
",",
"cb",
")",
"{",
"const",
"servers",
"=",
"client",
".",
"_station",
".",
"serversMap",
"[",
"serverType",
"]",
";",
"if",
"(",
"!",
"servers",
"||",
"!",
"servers",
".",
"length"... | Consistent-Hash algorithm for calculating server id.
@param client {Object} rpc client.
@param serverType {String} rpc target serverType.
@param msg {Object} rpc message.
@param cb {Function} cb(err, serverId). | [
"Consistent",
"-",
"Hash",
"algorithm",
"for",
"calculating",
"server",
"id",
"."
] | eb29e247214148c025456b2bb0542e1094fd2edb | https://github.com/JohnnieFucker/dreamix-rpc/blob/eb29e247214148c025456b2bb0542e1094fd2edb/lib/rpc-client/router.js#L188-L208 |
50,087 | demmer/validate-options | lib/validate-options.js | isValid | function isValid(options, key) {
var value = _.isFunction(options) ? options(key) : options[key];
if (typeof value === 'undefined') {
return false;
}
if (value === null) {
return false;
}
if (value === '') {
return false;
}
if (_.isNaN(value)) {
return... | javascript | function isValid(options, key) {
var value = _.isFunction(options) ? options(key) : options[key];
if (typeof value === 'undefined') {
return false;
}
if (value === null) {
return false;
}
if (value === '') {
return false;
}
if (_.isNaN(value)) {
return... | [
"function",
"isValid",
"(",
"options",
",",
"key",
")",
"{",
"var",
"value",
"=",
"_",
".",
"isFunction",
"(",
"options",
")",
"?",
"options",
"(",
"key",
")",
":",
"options",
"[",
"key",
"]",
";",
"if",
"(",
"typeof",
"value",
"===",
"'undefined'",
... | Check if the specified option is valid. | [
"Check",
"if",
"the",
"specified",
"option",
"is",
"valid",
"."
] | af18816366adca0b6da7347dcb31b9336b862a6d | https://github.com/demmer/validate-options/blob/af18816366adca0b6da7347dcb31b9336b862a6d/lib/validate-options.js#L11-L31 |
50,088 | jsekamane/Cree | cree.js | function(user, stage, method){
switch (method) {
case 'withinRooms':
var room = user.getRoom();
if(stageCount(stage, room) == room.size) {
console.log("Finished syncronising in " + room.name + ". Enough members in stage " + stage);
// Once all members are present start experiment
f... | javascript | function(user, stage, method){
switch (method) {
case 'withinRooms':
var room = user.getRoom();
if(stageCount(stage, room) == room.size) {
console.log("Finished syncronising in " + room.name + ". Enough members in stage " + stage);
// Once all members are present start experiment
f... | [
"function",
"(",
"user",
",",
"stage",
",",
"method",
")",
"{",
"switch",
"(",
"method",
")",
"{",
"case",
"'withinRooms'",
":",
"var",
"room",
"=",
"user",
".",
"getRoom",
"(",
")",
";",
"if",
"(",
"stageCount",
"(",
"stage",
",",
"room",
")",
"==... | Syncronise user stages. E.g. wait for other users to catch up to the waiting stage. | [
"Syncronise",
"user",
"stages",
".",
"E",
".",
"g",
".",
"wait",
"for",
"other",
"users",
"to",
"catch",
"up",
"to",
"the",
"waiting",
"stage",
"."
] | ccff87d4bb5b95c8d96c44731033f29a82df871e | https://github.com/jsekamane/Cree/blob/ccff87d4bb5b95c8d96c44731033f29a82df871e/cree.js#L161-L190 | |
50,089 | jsekamane/Cree | cree.js | function(stage, room) {
i = 0;
var stagemembers = (typeof room === 'undefined') ? members : _.pluck(room.getMembers(true), 'id');
for(var key in stagemembers)
if(cloak.getUser(stagemembers[key]).data._stage == stage)
i++;
return i;
} | javascript | function(stage, room) {
i = 0;
var stagemembers = (typeof room === 'undefined') ? members : _.pluck(room.getMembers(true), 'id');
for(var key in stagemembers)
if(cloak.getUser(stagemembers[key]).data._stage == stage)
i++;
return i;
} | [
"function",
"(",
"stage",
",",
"room",
")",
"{",
"i",
"=",
"0",
";",
"var",
"stagemembers",
"=",
"(",
"typeof",
"room",
"===",
"'undefined'",
")",
"?",
"members",
":",
"_",
".",
"pluck",
"(",
"room",
".",
"getMembers",
"(",
"true",
")",
",",
"'id'"... | Counts and returns the number of users in a particular stage. | [
"Counts",
"and",
"returns",
"the",
"number",
"of",
"users",
"in",
"a",
"particular",
"stage",
"."
] | ccff87d4bb5b95c8d96c44731033f29a82df871e | https://github.com/jsekamane/Cree/blob/ccff87d4bb5b95c8d96c44731033f29a82df871e/cree.js#L193-L200 | |
50,090 | jsekamane/Cree | cree.js | function(url) {
i = 0;
for(var key in members)
if(cloak.getUser(members[key]).data._load == url)
i++;
return i;
} | javascript | function(url) {
i = 0;
for(var key in members)
if(cloak.getUser(members[key]).data._load == url)
i++;
return i;
} | [
"function",
"(",
"url",
")",
"{",
"i",
"=",
"0",
";",
"for",
"(",
"var",
"key",
"in",
"members",
")",
"if",
"(",
"cloak",
".",
"getUser",
"(",
"members",
"[",
"key",
"]",
")",
".",
"data",
".",
"_load",
"==",
"url",
")",
"i",
"++",
";",
"retu... | Counts and returns the number of users in a particular url. | [
"Counts",
"and",
"returns",
"the",
"number",
"of",
"users",
"in",
"a",
"particular",
"url",
"."
] | ccff87d4bb5b95c8d96c44731033f29a82df871e | https://github.com/jsekamane/Cree/blob/ccff87d4bb5b95c8d96c44731033f29a82df871e/cree.js#L204-L210 | |
50,091 | jsekamane/Cree | cree.js | function(user){
// First time nextStage() is called set the stage to zero. Otherwise keep track when continuing to the next stage
user.data._stage = (typeof user.data._stage === 'undefined') ? 0 : user.data._stage+1;
// Next stage is which type?
var type = (typeof experiment.stages[user.data._stage].type ... | javascript | function(user){
// First time nextStage() is called set the stage to zero. Otherwise keep track when continuing to the next stage
user.data._stage = (typeof user.data._stage === 'undefined') ? 0 : user.data._stage+1;
// Next stage is which type?
var type = (typeof experiment.stages[user.data._stage].type ... | [
"function",
"(",
"user",
")",
"{",
"// First time nextStage() is called set the stage to zero. Otherwise keep track when continuing to the next stage",
"user",
".",
"data",
".",
"_stage",
"=",
"(",
"typeof",
"user",
".",
"data",
".",
"_stage",
"===",
"'undefined'",
")",
"... | Push the user to the next stage | [
"Push",
"the",
"user",
"to",
"the",
"next",
"stage"
] | ccff87d4bb5b95c8d96c44731033f29a82df871e | https://github.com/jsekamane/Cree/blob/ccff87d4bb5b95c8d96c44731033f29a82df871e/cree.js#L219-L250 | |
50,092 | jsekamane/Cree | cree.js | function(){
console.log("Last user has finished the experiment!");
var userdata = new Object();
for(var key in cloak.getUsers()) {
cloak.getUsers()[key].data.device = parser.setUA(cloak.getUsers()[key].data._device).getResult(); // Parse the useragent before saving data.
userdata[cloak.getUsers()[key].id... | javascript | function(){
console.log("Last user has finished the experiment!");
var userdata = new Object();
for(var key in cloak.getUsers()) {
cloak.getUsers()[key].data.device = parser.setUA(cloak.getUsers()[key].data._device).getResult(); // Parse the useragent before saving data.
userdata[cloak.getUsers()[key].id... | [
"function",
"(",
")",
"{",
"console",
".",
"log",
"(",
"\"Last user has finished the experiment!\"",
")",
";",
"var",
"userdata",
"=",
"new",
"Object",
"(",
")",
";",
"for",
"(",
"var",
"key",
"in",
"cloak",
".",
"getUsers",
"(",
")",
")",
"{",
"cloak",
... | Finalize the experiment | [
"Finalize",
"the",
"experiment"
] | ccff87d4bb5b95c8d96c44731033f29a82df871e | https://github.com/jsekamane/Cree/blob/ccff87d4bb5b95c8d96c44731033f29a82df871e/cree.js#L324-L395 | |
50,093 | jsekamane/Cree | cree.js | function(ip) {
var unique = true;
for(var key in cloak.getLobby().getMembers()) {
if(ip == cloak.getLobby().getMembers()[key].data.ip)
unique = false;
}
return unique;
} | javascript | function(ip) {
var unique = true;
for(var key in cloak.getLobby().getMembers()) {
if(ip == cloak.getLobby().getMembers()[key].data.ip)
unique = false;
}
return unique;
} | [
"function",
"(",
"ip",
")",
"{",
"var",
"unique",
"=",
"true",
";",
"for",
"(",
"var",
"key",
"in",
"cloak",
".",
"getLobby",
"(",
")",
".",
"getMembers",
"(",
")",
")",
"{",
"if",
"(",
"ip",
"==",
"cloak",
".",
"getLobby",
"(",
")",
".",
"getM... | Check if user has same IP as a user in the lobby. | [
"Check",
"if",
"user",
"has",
"same",
"IP",
"as",
"a",
"user",
"in",
"the",
"lobby",
"."
] | ccff87d4bb5b95c8d96c44731033f29a82df871e | https://github.com/jsekamane/Cree/blob/ccff87d4bb5b95c8d96c44731033f29a82df871e/cree.js#L420-L427 | |
50,094 | fernandofranca/launchpod | lib/repl-socket-server.js | start | function start(config, setDefaultREPLCommands, getAppInstance) {
// Defines the IPC socket file path
var socketAddr = path.join(process.cwd(), 'socket-ctl');
// Deletes the file if already exists
if (fs.existsSync(socketAddr)) fs.unlinkSync(socketAddr);
// Create and start the socket server
socketServer ... | javascript | function start(config, setDefaultREPLCommands, getAppInstance) {
// Defines the IPC socket file path
var socketAddr = path.join(process.cwd(), 'socket-ctl');
// Deletes the file if already exists
if (fs.existsSync(socketAddr)) fs.unlinkSync(socketAddr);
// Create and start the socket server
socketServer ... | [
"function",
"start",
"(",
"config",
",",
"setDefaultREPLCommands",
",",
"getAppInstance",
")",
"{",
"// Defines the IPC socket file path",
"var",
"socketAddr",
"=",
"path",
".",
"join",
"(",
"process",
".",
"cwd",
"(",
")",
",",
"'socket-ctl'",
")",
";",
"// Del... | Starts an IPC socket server
Every new socket connection will be piped to a REPL | [
"Starts",
"an",
"IPC",
"socket",
"server",
"Every",
"new",
"socket",
"connection",
"will",
"be",
"piped",
"to",
"a",
"REPL"
] | 882d614a4271846e17b3ba0ca319340a607580bc | https://github.com/fernandofranca/launchpod/blob/882d614a4271846e17b3ba0ca319340a607580bc/lib/repl-socket-server.js#L16-L51 |
50,095 | zland/zland-map | stores/MapStore.js | calculatePositionDiff | function calculatePositionDiff(position) {
if (!_lastDiffPosition) {
return _lastDiffPosition = position;
}
var dx, dy, p1, p2;
p1 = position;
p2 = _lastDiffPosition;
dx = p2.x - p1.x;
dy = p2.y - p1.y;
_calcMoveDiffX += dx;
_calcMoveDiffY += dy;
_overallMoveDiffY += dy;
_overallMoveDiffX += d... | javascript | function calculatePositionDiff(position) {
if (!_lastDiffPosition) {
return _lastDiffPosition = position;
}
var dx, dy, p1, p2;
p1 = position;
p2 = _lastDiffPosition;
dx = p2.x - p1.x;
dy = p2.y - p1.y;
_calcMoveDiffX += dx;
_calcMoveDiffY += dy;
_overallMoveDiffY += dy;
_overallMoveDiffX += d... | [
"function",
"calculatePositionDiff",
"(",
"position",
")",
"{",
"if",
"(",
"!",
"_lastDiffPosition",
")",
"{",
"return",
"_lastDiffPosition",
"=",
"position",
";",
"}",
"var",
"dx",
",",
"dy",
",",
"p1",
",",
"p2",
";",
"p1",
"=",
"position",
";",
"p2",
... | position diff methods | [
"position",
"diff",
"methods"
] | adff5510e3c267ce87e166f0a0354c7a85db8752 | https://github.com/zland/zland-map/blob/adff5510e3c267ce87e166f0a0354c7a85db8752/stores/MapStore.js#L220-L234 |
50,096 | Encapsule-Annex/onm-server-rest-routes | routes.js | function(req, res) {
var packages = {};
var appJSON = require('../../package.json');
packages[appJSON.name] = appJSON;
packages['onm'] = require('../onm/package.json');
res.send(packages);
} | javascript | function(req, res) {
var packages = {};
var appJSON = require('../../package.json');
packages[appJSON.name] = appJSON;
packages['onm'] = require('../onm/package.json');
res.send(packages);
} | [
"function",
"(",
"req",
",",
"res",
")",
"{",
"var",
"packages",
"=",
"{",
"}",
";",
"var",
"appJSON",
"=",
"require",
"(",
"'../../package.json'",
")",
";",
"packages",
"[",
"appJSON",
".",
"name",
"]",
"=",
"appJSON",
";",
"packages",
"[",
"'onm'",
... | Get basic information about this server endpoint. | [
"Get",
"basic",
"information",
"about",
"this",
"server",
"endpoint",
"."
] | 2d831d46e13be0191c3562df20b61378bed49ee6 | https://github.com/Encapsule-Annex/onm-server-rest-routes/blob/2d831d46e13be0191c3562df20b61378bed49ee6/routes.js#L14-L20 | |
50,097 | Encapsule-Annex/onm-server-rest-routes | routes.js | function(req, res) {
var stores = [];
for (key in onmStoreDictionary) {
stores.push({
dataModel: onmStoreDictionary[key].model.jsonTag,
storeKey: key
});
}
res.send(200, stores);
} | javascript | function(req, res) {
var stores = [];
for (key in onmStoreDictionary) {
stores.push({
dataModel: onmStoreDictionary[key].model.jsonTag,
storeKey: key
});
}
res.send(200, stores);
} | [
"function",
"(",
"req",
",",
"res",
")",
"{",
"var",
"stores",
"=",
"[",
"]",
";",
"for",
"(",
"key",
"in",
"onmStoreDictionary",
")",
"{",
"stores",
".",
"push",
"(",
"{",
"dataModel",
":",
"onmStoreDictionary",
"[",
"key",
"]",
".",
"model",
".",
... | Enumerate the in-memory onm stores managed by this node instance. | [
"Enumerate",
"the",
"in",
"-",
"memory",
"onm",
"stores",
"managed",
"by",
"this",
"node",
"instance",
"."
] | 2d831d46e13be0191c3562df20b61378bed49ee6 | https://github.com/Encapsule-Annex/onm-server-rest-routes/blob/2d831d46e13be0191c3562df20b61378bed49ee6/routes.js#L39-L48 | |
50,098 | Encapsule-Annex/onm-server-rest-routes | routes.js | function(req, res) {
if (!req._body || (req.body == null) || !req.body) {
res.send(400, "Invalid POST missing required request body.");
return;
}
if ((req.body.model == null) || !req.body.model) {
res.send(400, "Invalid POST missing 'mo... | javascript | function(req, res) {
if (!req._body || (req.body == null) || !req.body) {
res.send(400, "Invalid POST missing required request body.");
return;
}
if ((req.body.model == null) || !req.body.model) {
res.send(400, "Invalid POST missing 'mo... | [
"function",
"(",
"req",
",",
"res",
")",
"{",
"if",
"(",
"!",
"req",
".",
"_body",
"||",
"(",
"req",
".",
"body",
"==",
"null",
")",
"||",
"!",
"req",
".",
"body",
")",
"{",
"res",
".",
"send",
"(",
"400",
",",
"\"Invalid POST missing required requ... | Create a new in-memory data store instance using the the indicated onm data model. | [
"Create",
"a",
"new",
"in",
"-",
"memory",
"data",
"store",
"instance",
"using",
"the",
"the",
"indicated",
"onm",
"data",
"model",
"."
] | 2d831d46e13be0191c3562df20b61378bed49ee6 | https://github.com/Encapsule-Annex/onm-server-rest-routes/blob/2d831d46e13be0191c3562df20b61378bed49ee6/routes.js#L116-L138 | |
50,099 | Encapsule-Annex/onm-server-rest-routes | routes.js | function(req, res) {
if (!req._body || (req.body == null) || !req.body) {
res.send(400, "Invalid POST missing required request body.");
return;
}
if ((req.body.store == null) || !req.body.store) {
res.send(400, "Invalid POST mising 'sto... | javascript | function(req, res) {
if (!req._body || (req.body == null) || !req.body) {
res.send(400, "Invalid POST missing required request body.");
return;
}
if ((req.body.store == null) || !req.body.store) {
res.send(400, "Invalid POST mising 'sto... | [
"function",
"(",
"req",
",",
"res",
")",
"{",
"if",
"(",
"!",
"req",
".",
"_body",
"||",
"(",
"req",
".",
"body",
"==",
"null",
")",
"||",
"!",
"req",
".",
"body",
")",
"{",
"res",
".",
"send",
"(",
"400",
",",
"\"Invalid POST missing required requ... | Create a new component data resource in the indicated store using the specified address hash to indicate the specific component to create. | [
"Create",
"a",
"new",
"component",
"data",
"resource",
"in",
"the",
"indicated",
"store",
"using",
"the",
"specified",
"address",
"hash",
"to",
"indicate",
"the",
"specific",
"component",
"to",
"create",
"."
] | 2d831d46e13be0191c3562df20b61378bed49ee6 | https://github.com/Encapsule-Annex/onm-server-rest-routes/blob/2d831d46e13be0191c3562df20b61378bed49ee6/routes.js#L143-L178 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.