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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
53,000 | HenriJ/careless | vendor/browser-transforms.js | createSourceCodeErrorMessage | function createSourceCodeErrorMessage(code, e) {
var sourceLines = code.split('\n');
var erroneousLine = sourceLines[e.lineNumber - 1];
// Removes any leading indenting spaces and gets the number of
// chars indenting the `erroneousLine`
var indentation = 0;
erroneousLine = erroneousLine.replace(/^\s+/, fu... | javascript | function createSourceCodeErrorMessage(code, e) {
var sourceLines = code.split('\n');
var erroneousLine = sourceLines[e.lineNumber - 1];
// Removes any leading indenting spaces and gets the number of
// chars indenting the `erroneousLine`
var indentation = 0;
erroneousLine = erroneousLine.replace(/^\s+/, fu... | [
"function",
"createSourceCodeErrorMessage",
"(",
"code",
",",
"e",
")",
"{",
"var",
"sourceLines",
"=",
"code",
".",
"split",
"(",
"'\\n'",
")",
";",
"var",
"erroneousLine",
"=",
"sourceLines",
"[",
"e",
".",
"lineNumber",
"-",
"1",
"]",
";",
"// Removes a... | This method returns a nicely formated line of code pointing to the exact
location of the error `e`. The line is limited in size so big lines of code
are also shown in a readable way.
Example:
... x', overflow:'scroll'}} id={} onScroll={this.scroll} class=" ...
^
@param {string} code The full string of code
@param {Er... | [
"This",
"method",
"returns",
"a",
"nicely",
"formated",
"line",
"of",
"code",
"pointing",
"to",
"the",
"exact",
"location",
"of",
"the",
"error",
"e",
".",
"The",
"line",
"is",
"limited",
"in",
"size",
"so",
"big",
"lines",
"of",
"code",
"are",
"also",
... | 7dea2384b412bf2a03e111dae22055dd9bdf95fe | https://github.com/HenriJ/careless/blob/7dea2384b412bf2a03e111dae22055dd9bdf95fe/vendor/browser-transforms.js#L83-L110 |
53,001 | borntorun/grunt-release-build | tasks/releasebuild.js | verifyTasks | function verifyTasks() {
if ( options.tasks.build ) {
if ( isTypeString(options.tasks.build) ) {
options.tasks.build = [options.tasks.build];
}
if ( util.isArray(options.tasks.build) ) {
options.tasks.build.forEach(function( item ) {
if ( !isTypeString(item)... | javascript | function verifyTasks() {
if ( options.tasks.build ) {
if ( isTypeString(options.tasks.build) ) {
options.tasks.build = [options.tasks.build];
}
if ( util.isArray(options.tasks.build) ) {
options.tasks.build.forEach(function( item ) {
if ( !isTypeString(item)... | [
"function",
"verifyTasks",
"(",
")",
"{",
"if",
"(",
"options",
".",
"tasks",
".",
"build",
")",
"{",
"if",
"(",
"isTypeString",
"(",
"options",
".",
"tasks",
".",
"build",
")",
")",
"{",
"options",
".",
"tasks",
".",
"build",
"=",
"[",
"options",
... | Test tasks.build option | [
"Test",
"tasks",
".",
"build",
"option"
] | 9f0a72c88a5e134f92766f4b9ef2b7906a791215 | https://github.com/borntorun/grunt-release-build/blob/9f0a72c88a5e134f92766f4b9ef2b7906a791215/tasks/releasebuild.js#L137-L156 |
53,002 | borntorun/grunt-release-build | tasks/releasebuild.js | verifyOthers | function verifyOthers() {
if ( !isTypeString(options.commit) ) {
errorOption('commit', options.commit);
}
if ( !isTypeString(options.tag) ) {
errorOption('tag', options.tag);
}
} | javascript | function verifyOthers() {
if ( !isTypeString(options.commit) ) {
errorOption('commit', options.commit);
}
if ( !isTypeString(options.tag) ) {
errorOption('tag', options.tag);
}
} | [
"function",
"verifyOthers",
"(",
")",
"{",
"if",
"(",
"!",
"isTypeString",
"(",
"options",
".",
"commit",
")",
")",
"{",
"errorOption",
"(",
"'commit'",
",",
"options",
".",
"commit",
")",
";",
"}",
"if",
"(",
"!",
"isTypeString",
"(",
"options",
".",
... | Test other options | [
"Test",
"other",
"options"
] | 9f0a72c88a5e134f92766f4b9ef2b7906a791215 | https://github.com/borntorun/grunt-release-build/blob/9f0a72c88a5e134f92766f4b9ef2b7906a791215/tasks/releasebuild.js#L161-L168 |
53,003 | borntorun/grunt-release-build | tasks/releasebuild.js | isCurrentBranch | function isCurrentBranch( branch ) {
return function() {
var deferred = Q.defer();
Q.fcall(command('git symbolic-ref --short -q HEAD', 'Get current branch'))
.then(function( data ) {
//console.log('data=',data);
if ( data && data.trim() === branch ) {
... | javascript | function isCurrentBranch( branch ) {
return function() {
var deferred = Q.defer();
Q.fcall(command('git symbolic-ref --short -q HEAD', 'Get current branch'))
.then(function( data ) {
//console.log('data=',data);
if ( data && data.trim() === branch ) {
... | [
"function",
"isCurrentBranch",
"(",
"branch",
")",
"{",
"return",
"function",
"(",
")",
"{",
"var",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
";",
"Q",
".",
"fcall",
"(",
"command",
"(",
"'git symbolic-ref --short -q HEAD'",
",",
"'Get current branch'",
... | Test if a brach is the current one
@param branch
@returns {Function} | [
"Test",
"if",
"a",
"brach",
"is",
"the",
"current",
"one"
] | 9f0a72c88a5e134f92766f4b9ef2b7906a791215 | https://github.com/borntorun/grunt-release-build/blob/9f0a72c88a5e134f92766f4b9ef2b7906a791215/tasks/releasebuild.js#L175-L195 |
53,004 | borntorun/grunt-release-build | tasks/releasebuild.js | runBuildTasks | function runBuildTasks() {
return (function() {
if ( options.tasks.build.length > 0 ) {
var aToRun = [];
options.tasks.build.forEach(function( item ) {
aToRun.push(command('grunt ' + item, 'Task:' + item));
});
return aToRun.reduce(function( accum, cur... | javascript | function runBuildTasks() {
return (function() {
if ( options.tasks.build.length > 0 ) {
var aToRun = [];
options.tasks.build.forEach(function( item ) {
aToRun.push(command('grunt ' + item, 'Task:' + item));
});
return aToRun.reduce(function( accum, cur... | [
"function",
"runBuildTasks",
"(",
")",
"{",
"return",
"(",
"function",
"(",
")",
"{",
"if",
"(",
"options",
".",
"tasks",
".",
"build",
".",
"length",
">",
"0",
")",
"{",
"var",
"aToRun",
"=",
"[",
"]",
";",
"options",
".",
"tasks",
".",
"build",
... | Run build tasks | [
"Run",
"build",
"tasks"
] | 9f0a72c88a5e134f92766f4b9ef2b7906a791215 | https://github.com/borntorun/grunt-release-build/blob/9f0a72c88a5e134f92766f4b9ef2b7906a791215/tasks/releasebuild.js#L298-L312 |
53,005 | borntorun/grunt-release-build | tasks/releasebuild.js | gitTag | function gitTag() {
return function() {
var deferred = Q.defer();
if (!grunt.option('version')) {
throw new Error('Error in step [Git tag]. Version is not defined.');
}
Q.fcall(command(format('git tag -a v%s -m \'%s\'', grunt.option('version'), options.tag.replace('%v', ... | javascript | function gitTag() {
return function() {
var deferred = Q.defer();
if (!grunt.option('version')) {
throw new Error('Error in step [Git tag]. Version is not defined.');
}
Q.fcall(command(format('git tag -a v%s -m \'%s\'', grunt.option('version'), options.tag.replace('%v', ... | [
"function",
"gitTag",
"(",
")",
"{",
"return",
"function",
"(",
")",
"{",
"var",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
";",
"if",
"(",
"!",
"grunt",
".",
"option",
"(",
"'version'",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Error in st... | Tag the new version
@returns {Function} | [
"Tag",
"the",
"new",
"version"
] | 9f0a72c88a5e134f92766f4b9ef2b7906a791215 | https://github.com/borntorun/grunt-release-build/blob/9f0a72c88a5e134f92766f4b9ef2b7906a791215/tasks/releasebuild.js#L359-L376 |
53,006 | borntorun/grunt-release-build | tasks/releasebuild.js | gitRemote | function gitRemote() {
return function() {
var deferred = Q.defer();
Q.fcall(command('git remote', 'Git remote'))
.then(function( data ) {
if ( !data || !data.trim() ) {
deferred.reject(new Error('Error in step [Git remote]. No remotes founds.'));
}
... | javascript | function gitRemote() {
return function() {
var deferred = Q.defer();
Q.fcall(command('git remote', 'Git remote'))
.then(function( data ) {
if ( !data || !data.trim() ) {
deferred.reject(new Error('Error in step [Git remote]. No remotes founds.'));
}
... | [
"function",
"gitRemote",
"(",
")",
"{",
"return",
"function",
"(",
")",
"{",
"var",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
";",
"Q",
".",
"fcall",
"(",
"command",
"(",
"'git remote'",
",",
"'Git remote'",
")",
")",
".",
"then",
"(",
"function"... | Retrieve the remote name
@returns {Function} | [
"Retrieve",
"the",
"remote",
"name"
] | 9f0a72c88a5e134f92766f4b9ef2b7906a791215 | https://github.com/borntorun/grunt-release-build/blob/9f0a72c88a5e134f92766f4b9ef2b7906a791215/tasks/releasebuild.js#L382-L420 |
53,007 | tolokoban/ToloFrameWork | ker/mod/squire2/squire-raw.js | function ( range, root ) {
var container = range.startContainer,
block;
// If inline, get the containing block.
if ( isInline( container ) ) {
block = getPreviousBlock( container, root );
} else if ( container !== root && isBlock( container ) ) {
block = container;
} else {
... | javascript | function ( range, root ) {
var container = range.startContainer,
block;
// If inline, get the containing block.
if ( isInline( container ) ) {
block = getPreviousBlock( container, root );
} else if ( container !== root && isBlock( container ) ) {
block = container;
} else {
... | [
"function",
"(",
"range",
",",
"root",
")",
"{",
"var",
"container",
"=",
"range",
".",
"startContainer",
",",
"block",
";",
"// If inline, get the containing block.",
"if",
"(",
"isInline",
"(",
"container",
")",
")",
"{",
"block",
"=",
"getPreviousBlock",
"(... | Returns the first block at least partially contained by the range, or null if no block is contained by the range. | [
"Returns",
"the",
"first",
"block",
"at",
"least",
"partially",
"contained",
"by",
"the",
"range",
"or",
"null",
"if",
"no",
"block",
"is",
"contained",
"by",
"the",
"range",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/squire2/squire-raw.js#L1142-L1157 | |
53,008 | tolokoban/ToloFrameWork | ker/mod/squire2/squire-raw.js | function ( event ) {
var types = event.dataTransfer.types;
var l = types.length;
var hasPlain = false;
var hasHTML = false;
while ( l-- ) {
switch ( types[l] ) {
case 'text/plain':
hasPlain = true;
break;
case 'text/html':
hasHTML = true;
break;
... | javascript | function ( event ) {
var types = event.dataTransfer.types;
var l = types.length;
var hasPlain = false;
var hasHTML = false;
while ( l-- ) {
switch ( types[l] ) {
case 'text/plain':
hasPlain = true;
break;
case 'text/html':
hasHTML = true;
break;
... | [
"function",
"(",
"event",
")",
"{",
"var",
"types",
"=",
"event",
".",
"dataTransfer",
".",
"types",
";",
"var",
"l",
"=",
"types",
".",
"length",
";",
"var",
"hasPlain",
"=",
"false",
";",
"var",
"hasHTML",
"=",
"false",
";",
"while",
"(",
"l",
"-... | On Windows you can drag an drop text. We can't handle this ourselves, because as far as I can see, there's no way to get the drop insertion point. So just save an undo state and hope for the best. | [
"On",
"Windows",
"you",
"can",
"drag",
"an",
"drop",
"text",
".",
"We",
"can",
"t",
"handle",
"this",
"ourselves",
"because",
"as",
"far",
"as",
"I",
"can",
"see",
"there",
"s",
"no",
"way",
"to",
"get",
"the",
"drop",
"insertion",
"point",
".",
"So"... | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/squire2/squire-raw.js#L2417-L2437 | |
53,009 | gethuman/pancakes-angular | lib/ngapp/page.settings.js | updateHead | function updateHead(title, description) {
updateTitle(title);
description = (description || '').replace(/"/g, '');
var metaDesc = angular.element($rootElement.find('meta[name=description]')[0]);
metaDesc.attr('content', description);
} | javascript | function updateHead(title, description) {
updateTitle(title);
description = (description || '').replace(/"/g, '');
var metaDesc = angular.element($rootElement.find('meta[name=description]')[0]);
metaDesc.attr('content', description);
} | [
"function",
"updateHead",
"(",
"title",
",",
"description",
")",
"{",
"updateTitle",
"(",
"title",
")",
";",
"description",
"=",
"(",
"description",
"||",
"''",
")",
".",
"replace",
"(",
"/",
"\"",
"/",
"g",
",",
"''",
")",
";",
"var",
"metaDesc",
"=... | Set the page title and description
@param title
@param description | [
"Set",
"the",
"page",
"title",
"and",
"description"
] | 9589b7ba09619843e271293088005c62ed23f355 | https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/ngapp/page.settings.js#L22-L27 |
53,010 | gethuman/pancakes-angular | lib/ngapp/page.settings.js | updatePageStyle | function updatePageStyle(pageName) {
var pageCssId = 'gh-' + pageName.replace('.', '-');
var elem = $rootElement.find('.maincontent');
if (elem && elem.length) {
elem = angular.element(elem[0]);
elem.attr('id', pageCssId);
}
} | javascript | function updatePageStyle(pageName) {
var pageCssId = 'gh-' + pageName.replace('.', '-');
var elem = $rootElement.find('.maincontent');
if (elem && elem.length) {
elem = angular.element(elem[0]);
elem.attr('id', pageCssId);
}
} | [
"function",
"updatePageStyle",
"(",
"pageName",
")",
"{",
"var",
"pageCssId",
"=",
"'gh-'",
"+",
"pageName",
".",
"replace",
"(",
"'.'",
",",
"'-'",
")",
";",
"var",
"elem",
"=",
"$rootElement",
".",
"find",
"(",
"'.maincontent'",
")",
";",
"if",
"(",
... | Update the class name used to key off all styles on the page
@param pageName | [
"Update",
"the",
"class",
"name",
"used",
"to",
"key",
"off",
"all",
"styles",
"on",
"the",
"page"
] | 9589b7ba09619843e271293088005c62ed23f355 | https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/ngapp/page.settings.js#L33-L41 |
53,011 | lautr3k/lw.canvas-filters | src/canvas-filters.js | canvasFilters | function canvasFilters(canvas, settings) {
settings = Object.assign({}, {
smoothing : false, // Smoothing [true|fale]
brightness : 0, // Image brightness [-255 to +255]
contrast : 0, // Image contrast [-255 to +255]
gamma : 0, // Image gamma correction [0.... | javascript | function canvasFilters(canvas, settings) {
settings = Object.assign({}, {
smoothing : false, // Smoothing [true|fale]
brightness : 0, // Image brightness [-255 to +255]
contrast : 0, // Image contrast [-255 to +255]
gamma : 0, // Image gamma correction [0.... | [
"function",
"canvasFilters",
"(",
"canvas",
",",
"settings",
")",
"{",
"settings",
"=",
"Object",
".",
"assign",
"(",
"{",
"}",
",",
"{",
"smoothing",
":",
"false",
",",
"// Smoothing [true|fale]",
"brightness",
":",
"0",
",",
"// Image brightness [-255 to +255]... | Apply filters on provided canvas | [
"Apply",
"filters",
"on",
"provided",
"canvas"
] | b2766e5d4d306d6fa17016d0fb00365887065c20 | https://github.com/lautr3k/lw.canvas-filters/blob/b2766e5d4d306d6fa17016d0fb00365887065c20/src/canvas-filters.js#L130-L190 |
53,012 | MostlyJS/mostly-poplarjs-rest | src/wrappers.js | getHandler | function getHandler (method, trans, version) {
return function (req, res, next) {
res.setHeader('Allow', Object.values(allowedMethods).join(','));
let service = req.params.__service;
let id = req.params.__id;
let action = req.params.__action;
let path = '/' + service +
(id? '/' + id : '') +... | javascript | function getHandler (method, trans, version) {
return function (req, res, next) {
res.setHeader('Allow', Object.values(allowedMethods).join(','));
let service = req.params.__service;
let id = req.params.__id;
let action = req.params.__action;
let path = '/' + service +
(id? '/' + id : '') +... | [
"function",
"getHandler",
"(",
"method",
",",
"trans",
",",
"version",
")",
"{",
"return",
"function",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"res",
".",
"setHeader",
"(",
"'Allow'",
",",
"Object",
".",
"values",
"(",
"allowedMethods",
")",
"."... | A function that returns the middleware for a given method | [
"A",
"function",
"that",
"returns",
"the",
"middleware",
"for",
"a",
"given",
"method"
] | 0acd6ebe93e3d7dd9c08cd6e31d2b194d0a87e54 | https://github.com/MostlyJS/mostly-poplarjs-rest/blob/0acd6ebe93e3d7dd9c08cd6e31d2b194d0a87e54/src/wrappers.js#L21-L72 |
53,013 | jaycetde/is-validation | lib/chain.js | Chain | function Chain(val, name) {
if (!(this instanceof Chain)) return new Chain(val, name);
this._val = val;
this._name = name;
this.clear();
return this;
} | javascript | function Chain(val, name) {
if (!(this instanceof Chain)) return new Chain(val, name);
this._val = val;
this._name = name;
this.clear();
return this;
} | [
"function",
"Chain",
"(",
"val",
",",
"name",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Chain",
")",
")",
"return",
"new",
"Chain",
"(",
"val",
",",
"name",
")",
";",
"this",
".",
"_val",
"=",
"val",
";",
"this",
".",
"_name",
"=",
... | Creates a chain instance
@constructor
@this {Chain}
@param {!Object} val The value the chain is focused on
@param {string} name A human-readable name of the value | [
"Creates",
"a",
"chain",
"instance"
] | 6dc9ddb830480f4bd680f904163126a9c247fa98 | https://github.com/jaycetde/is-validation/blob/6dc9ddb830480f4bd680f904163126a9c247fa98/lib/chain.js#L23-L33 |
53,014 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/RGraph/RGraph.modaldialog.js | function (id, width)
{
ModalDialog.id = id;
ModalDialog.width = width;
ModalDialog.ShowBackground();
ModalDialog.ShowDialog();
// Install the event handlers
window.onresize = ModalDialog.Resize;
//... | javascript | function (id, width)
{
ModalDialog.id = id;
ModalDialog.width = width;
ModalDialog.ShowBackground();
ModalDialog.ShowDialog();
// Install the event handlers
window.onresize = ModalDialog.Resize;
//... | [
"function",
"(",
"id",
",",
"width",
")",
"{",
"ModalDialog",
".",
"id",
"=",
"id",
";",
"ModalDialog",
".",
"width",
"=",
"width",
";",
"ModalDialog",
".",
"ShowBackground",
"(",
")",
";",
"ModalDialog",
".",
"ShowDialog",
"(",
")",
";",
"// Install the... | Shows the dialog with the supplied DIV acting as the contents
@param string id The ID of the DIV to use as the dialogs contents
@param int width The width of the dialog | [
"Shows",
"the",
"dialog",
"with",
"the",
"supplied",
"DIV",
"acting",
"as",
"the",
"contents"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/RGraph/RGraph.modaldialog.js#L32-L51 | |
53,015 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/RGraph/RGraph.modaldialog.js | function ()
{
// Create the background if neccessary
ModalDialog.background = document.createElement('DIV');
ModalDialog.background.className = 'ModalDialog_background';
ModalDialog.background.style.position = 'fixed';
ModalDialog.background.style... | javascript | function ()
{
// Create the background if neccessary
ModalDialog.background = document.createElement('DIV');
ModalDialog.background.className = 'ModalDialog_background';
ModalDialog.background.style.position = 'fixed';
ModalDialog.background.style... | [
"function",
"(",
")",
"{",
"// Create the background if neccessary",
"ModalDialog",
".",
"background",
"=",
"document",
".",
"createElement",
"(",
"'DIV'",
")",
";",
"ModalDialog",
".",
"background",
".",
"className",
"=",
"'ModalDialog_background'",
";",
"ModalDialog... | Shows the background semi-transparent darkened DIV | [
"Shows",
"the",
"background",
"semi",
"-",
"transparent",
"darkened",
"DIV"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/RGraph/RGraph.modaldialog.js#L59-L77 | |
53,016 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/RGraph/RGraph.modaldialog.js | function ()
{
if (ModalDialog.dialog) {
ModalDialog.dialog.style.left = (document.body.offsetWidth / 2) - (ModalDialog.dialog.offsetWidth / 2) + 'px';
}
ModalDialog.background.style.width = '2500px';
ModalDialog.background.style.height = '250... | javascript | function ()
{
if (ModalDialog.dialog) {
ModalDialog.dialog.style.left = (document.body.offsetWidth / 2) - (ModalDialog.dialog.offsetWidth / 2) + 'px';
}
ModalDialog.background.style.width = '2500px';
ModalDialog.background.style.height = '250... | [
"function",
"(",
")",
"{",
"if",
"(",
"ModalDialog",
".",
"dialog",
")",
"{",
"ModalDialog",
".",
"dialog",
".",
"style",
".",
"left",
"=",
"(",
"document",
".",
"body",
".",
"offsetWidth",
"/",
"2",
")",
"-",
"(",
"ModalDialog",
".",
"dialog",
".",
... | Accommodate the window being resized | [
"Accommodate",
"the",
"window",
"being",
"resized"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/RGraph/RGraph.modaldialog.js#L224-L232 | |
53,017 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/RGraph/RGraph.modaldialog.js | function (name, func)
{
if (typeof(ModalDialog.events) == 'undefined') {
ModalDialog.events = [];
}
ModalDialog.events.push([name, func]);
} | javascript | function (name, func)
{
if (typeof(ModalDialog.events) == 'undefined') {
ModalDialog.events = [];
}
ModalDialog.events.push([name, func]);
} | [
"function",
"(",
"name",
",",
"func",
")",
"{",
"if",
"(",
"typeof",
"(",
"ModalDialog",
".",
"events",
")",
"==",
"'undefined'",
")",
"{",
"ModalDialog",
".",
"events",
"=",
"[",
"]",
";",
"}",
"ModalDialog",
".",
"events",
".",
"push",
"(",
"[",
... | Returns the page height
@return int The page height | [
"Returns",
"the",
"page",
"height"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/RGraph/RGraph.modaldialog.js#L242-L249 | |
53,018 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/RGraph/RGraph.modaldialog.js | function (name)
{
for (var i=0; i<ModalDialog.events.length; ++i) {
if (typeof(ModalDialog.events[i][0]) == 'string' && ModalDialog.events[i][0] == name && typeof(ModalDialog.events[i][1]) == 'function') {
ModalDialog.events[i][1]();
}
... | javascript | function (name)
{
for (var i=0; i<ModalDialog.events.length; ++i) {
if (typeof(ModalDialog.events[i][0]) == 'string' && ModalDialog.events[i][0] == name && typeof(ModalDialog.events[i][1]) == 'function') {
ModalDialog.events[i][1]();
}
... | [
"function",
"(",
"name",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"ModalDialog",
".",
"events",
".",
"length",
";",
"++",
"i",
")",
"{",
"if",
"(",
"typeof",
"(",
"ModalDialog",
".",
"events",
"[",
"i",
"]",
"[",
"0",
"]",
"... | Used to fire the ModalDialog custom event
@param object obj The graph object that fires the event
@param string event The name of the event to fire | [
"Used",
"to",
"fire",
"the",
"ModalDialog",
"custom",
"event"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/RGraph/RGraph.modaldialog.js#L260-L267 | |
53,019 | yefremov/aggregatejs | median.js | median | function median(array) {
var length = array.length;
if (length === 0) {
throw new RangeError("Error");
}
array.sort(function(a, b) {
return a - b;
});
var middle = Math.floor(length / 2);
return length % 2 ? array[middle] : (array[middle] + array[middle - 1]) / 2;
} | javascript | function median(array) {
var length = array.length;
if (length === 0) {
throw new RangeError("Error");
}
array.sort(function(a, b) {
return a - b;
});
var middle = Math.floor(length / 2);
return length % 2 ? array[middle] : (array[middle] + array[middle - 1]) / 2;
} | [
"function",
"median",
"(",
"array",
")",
"{",
"var",
"length",
"=",
"array",
".",
"length",
";",
"if",
"(",
"length",
"===",
"0",
")",
"{",
"throw",
"new",
"RangeError",
"(",
"\"Error\"",
")",
";",
"}",
"array",
".",
"sort",
"(",
"function",
"(",
"... | Returns the median of the numbers in `array`.
@param {Array} array Range of numbers to get the median.
@return {number}
@example
median([100, -100, 150, -50, 100, 250]);
// => 100 | [
"Returns",
"the",
"median",
"of",
"the",
"numbers",
"in",
"array",
"."
] | 932b28a15a5707135e7095950000a838db409511 | https://github.com/yefremov/aggregatejs/blob/932b28a15a5707135e7095950000a838db409511/median.js#L19-L33 |
53,020 | sendanor/nor-db | lib/mysql/Connection.js | Connection | function Connection(conn) {
if(!(this instanceof Connection)) {
return new Connection(conn);
}
var self = this;
if(!conn) { throw new TypeError("no connection set"); }
self._connection = conn;
self._connect = Q.nfbind(self._connection.connect.bind(self._connection));
self._query = Q.nfbind(self._connec... | javascript | function Connection(conn) {
if(!(this instanceof Connection)) {
return new Connection(conn);
}
var self = this;
if(!conn) { throw new TypeError("no connection set"); }
self._connection = conn;
self._connect = Q.nfbind(self._connection.connect.bind(self._connection));
self._query = Q.nfbind(self._connec... | [
"function",
"Connection",
"(",
"conn",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Connection",
")",
")",
"{",
"return",
"new",
"Connection",
"(",
"conn",
")",
";",
"}",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"!",
"conn",
")",
"{",
... | Create MySQL connection object | [
"Create",
"MySQL",
"connection",
"object"
] | db4b78691956a49370fc9d9a4eed27e7d3720aeb | https://github.com/sendanor/nor-db/blob/db4b78691956a49370fc9d9a4eed27e7d3720aeb/lib/mysql/Connection.js#L10-L26 |
53,021 | MeldCE/skemer | src/spec/lib/builder.js | mapFalseInputs | function mapFalseInputs(suite, input, p) {
if (p === undefined) {
p = 0;
}
for (p; p < input.length; p++) {
if (input[p] === false) {
var i, newInput = [];
for (i in suite[map[p]]) {
var mapped, cloned = input.slice(0);
cloned[p] = i;
if ((mapped = mapFalseInputs(suit... | javascript | function mapFalseInputs(suite, input, p) {
if (p === undefined) {
p = 0;
}
for (p; p < input.length; p++) {
if (input[p] === false) {
var i, newInput = [];
for (i in suite[map[p]]) {
var mapped, cloned = input.slice(0);
cloned[p] = i;
if ((mapped = mapFalseInputs(suit... | [
"function",
"mapFalseInputs",
"(",
"suite",
",",
"input",
",",
"p",
")",
"{",
"if",
"(",
"p",
"===",
"undefined",
")",
"{",
"p",
"=",
"0",
";",
"}",
"for",
"(",
"p",
";",
"p",
"<",
"input",
".",
"length",
";",
"p",
"++",
")",
"{",
"if",
"(",
... | Expands tests containing false to repeat over all the available values
@param {Obect} suite Test suite of test array to expand
@param {Array} input Test to expand
@param {number} p Last test element expanded
@returns {Array|true} New expanded array or true if no expansion required | [
"Expands",
"tests",
"containing",
"false",
"to",
"repeat",
"over",
"all",
"the",
"available",
"values"
] | 9ef7b00c7c96db5d13c368180b2f660e571de44c | https://github.com/MeldCE/skemer/blob/9ef7b00c7c96db5d13c368180b2f660e571de44c/src/spec/lib/builder.js#L15-L38 |
53,022 | icelab/attache-upload.js | src/index.js | presignRequest | function presignRequest (presignUrl, token) {
return new Promise((resolve, reject) => {
request
.post(presignUrl)
.set({
'Accept': 'application/json',
'Content-Type': 'application/json',
'X-CSRF-Token': token
})
.end((err, res) => {
// throw a custom error m... | javascript | function presignRequest (presignUrl, token) {
return new Promise((resolve, reject) => {
request
.post(presignUrl)
.set({
'Accept': 'application/json',
'Content-Type': 'application/json',
'X-CSRF-Token': token
})
.end((err, res) => {
// throw a custom error m... | [
"function",
"presignRequest",
"(",
"presignUrl",
",",
"token",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"request",
".",
"post",
"(",
"presignUrl",
")",
".",
"set",
"(",
"{",
"'Accept'",
":",
"'application/... | presignRequest
Perform an XHR request and Resolve or Reject
@param {String} presignUrl
@param {String} token
@param {Promise} | [
"presignRequest",
"Perform",
"an",
"XHR",
"request",
"and",
"Resolve",
"or",
"Reject"
] | ff40a9d8caa45c53e147c810dc7449de685fcaf4 | https://github.com/icelab/attache-upload.js/blob/ff40a9d8caa45c53e147c810dc7449de685fcaf4/src/index.js#L197-L212 |
53,023 | icelab/attache-upload.js | src/index.js | presign | function presign (presignUrl, token, fn = presignRequest) {
return new Promise((resolve, reject) => {
fn(presignUrl, token)
.then(responseStatus)
.then(parseJSON)
.then((res) => {
resolve(res)
})
.catch((err) => {
reject(err)
})
})
} | javascript | function presign (presignUrl, token, fn = presignRequest) {
return new Promise((resolve, reject) => {
fn(presignUrl, token)
.then(responseStatus)
.then(parseJSON)
.then((res) => {
resolve(res)
})
.catch((err) => {
reject(err)
})
})
} | [
"function",
"presign",
"(",
"presignUrl",
",",
"token",
",",
"fn",
"=",
"presignRequest",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"fn",
"(",
"presignUrl",
",",
"token",
")",
".",
"then",
"(",
"responseS... | presign
Take a url and optional token
return a Promise
@param {String} presignUrl
@param {String} token
@param {Function} defaults to presignRequest()
@param {Promise} | [
"presign",
"Take",
"a",
"url",
"and",
"optional",
"token",
"return",
"a",
"Promise"
] | ff40a9d8caa45c53e147c810dc7449de685fcaf4 | https://github.com/icelab/attache-upload.js/blob/ff40a9d8caa45c53e147c810dc7449de685fcaf4/src/index.js#L224-L236 |
53,024 | sumanjs/suman-inquirer-directory | index.js | Prompt | function Prompt () {
Base.apply(this, arguments);
if (!this.opt.basePath) {
this.throwParamError('basePath');
}
this.pathIndexHash = {};
this.originalBaseDir = this.currentPath =
path.normalize(path.isAbsolute(this.opt.basePath) ?
path.resolve(this.opt.basePath) : path.resolve(process.cwd(), t... | javascript | function Prompt () {
Base.apply(this, arguments);
if (!this.opt.basePath) {
this.throwParamError('basePath');
}
this.pathIndexHash = {};
this.originalBaseDir = this.currentPath =
path.normalize(path.isAbsolute(this.opt.basePath) ?
path.resolve(this.opt.basePath) : path.resolve(process.cwd(), t... | [
"function",
"Prompt",
"(",
")",
"{",
"Base",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"if",
"(",
"!",
"this",
".",
"opt",
".",
"basePath",
")",
"{",
"this",
".",
"throwParamError",
"(",
"'basePath'",
")",
";",
"}",
"this",
".",
"pathI... | stores what index to use for a path if you go back a directory
Constructor | [
"stores",
"what",
"index",
"to",
"use",
"for",
"a",
"path",
"if",
"you",
"go",
"back",
"a",
"directory",
"Constructor"
] | 6ecc706476ed0644ebf8442593884906df1c6faa | https://github.com/sumanjs/suman-inquirer-directory/blob/6ecc706476ed0644ebf8442593884906df1c6faa/index.js#L44-L75 |
53,025 | taoyuan/wide | lib/transports/file.js | createAndFlush | function createAndFlush(size) {
if (self._stream) {
self._stream.end();
self._stream.destroySoon();
}
self._size = size;
self.filename = target;
self._stream = fs.createWriteStream(fullname, self.options);
//
... | javascript | function createAndFlush(size) {
if (self._stream) {
self._stream.end();
self._stream.destroySoon();
}
self._size = size;
self.filename = target;
self._stream = fs.createWriteStream(fullname, self.options);
//
... | [
"function",
"createAndFlush",
"(",
"size",
")",
"{",
"if",
"(",
"self",
".",
"_stream",
")",
"{",
"self",
".",
"_stream",
".",
"end",
"(",
")",
";",
"self",
".",
"_stream",
".",
"destroySoon",
"(",
")",
";",
"}",
"self",
".",
"_size",
"=",
"size",
... | Creates the `WriteStream` and then flushes any buffered messages. | [
"Creates",
"the",
"WriteStream",
"and",
"then",
"flushes",
"any",
"buffered",
"messages",
"."
] | a3bc92580f43c56001d8a6d72b45b0e44ba3a7c6 | https://github.com/taoyuan/wide/blob/a3bc92580f43c56001d8a6d72b45b0e44ba3a7c6/lib/transports/file.js#L417-L456 |
53,026 | nbrownus/ppunit | lib/Suite.js | function (title) {
Suite.super_.call(this)
this.title = title
this.suites = []
this.exclusivity = Suite.EXCLUSIVITY.NONE
this.testExclusivity = undefined
this.parent = undefined
this.nextTests = []
this.globalTests = []
this.testContainer = false
this.testDependencies = []
... | javascript | function (title) {
Suite.super_.call(this)
this.title = title
this.suites = []
this.exclusivity = Suite.EXCLUSIVITY.NONE
this.testExclusivity = undefined
this.parent = undefined
this.nextTests = []
this.globalTests = []
this.testContainer = false
this.testDependencies = []
... | [
"function",
"(",
"title",
")",
"{",
"Suite",
".",
"super_",
".",
"call",
"(",
"this",
")",
"this",
".",
"title",
"=",
"title",
"this",
".",
"suites",
"=",
"[",
"]",
"this",
".",
"exclusivity",
"=",
"Suite",
".",
"EXCLUSIVITY",
".",
"NONE",
"this",
... | Contains a set of tests and children suites
@param {String} title Title for the suite
@constructor | [
"Contains",
"a",
"set",
"of",
"tests",
"and",
"children",
"suites"
] | dcce602497d9548ce9085a8db115e65561dcc3de | https://github.com/nbrownus/ppunit/blob/dcce602497d9548ce9085a8db115e65561dcc3de/lib/Suite.js#L12-L41 | |
53,027 | origin1tech/chek | dist/modules/is.js | isArray | function isArray(val) {
/* istanbul ignore if */
if (!Array.isArray)
return constant_1.toStr.call(val) === '[object Array]';
return Array.isArray(val);
} | javascript | function isArray(val) {
/* istanbul ignore if */
if (!Array.isArray)
return constant_1.toStr.call(val) === '[object Array]';
return Array.isArray(val);
} | [
"function",
"isArray",
"(",
"val",
")",
"{",
"/* istanbul ignore if */",
"if",
"(",
"!",
"Array",
".",
"isArray",
")",
"return",
"constant_1",
".",
"toStr",
".",
"call",
"(",
"val",
")",
"===",
"'[object Array]'",
";",
"return",
"Array",
".",
"isArray",
"(... | Is Array
Check if value is an array.
@param val the value to test if is array. | [
"Is",
"Array",
"Check",
"if",
"value",
"is",
"an",
"array",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/is.js#L20-L25 |
53,028 | origin1tech/chek | dist/modules/is.js | isBrowser | function isBrowser(override) {
// Enables checking a process.env key while
// in Node.
if (override)
return typeof process !== 'undefined' &&
function_1.tryWrap(to_1.toBoolean, process.env &&
process.env[override])(false) === true;
// Otherwise just return NOT Node.
... | javascript | function isBrowser(override) {
// Enables checking a process.env key while
// in Node.
if (override)
return typeof process !== 'undefined' &&
function_1.tryWrap(to_1.toBoolean, process.env &&
process.env[override])(false) === true;
// Otherwise just return NOT Node.
... | [
"function",
"isBrowser",
"(",
"override",
")",
"{",
"// Enables checking a process.env key while",
"// in Node.",
"if",
"(",
"override",
")",
"return",
"typeof",
"process",
"!==",
"'undefined'",
"&&",
"function_1",
".",
"tryWrap",
"(",
"to_1",
".",
"toBoolean",
",",... | Is Browser
Checks if script is running in browser.
@param override an optional key to inspect on process.env. | [
"Is",
"Browser",
"Checks",
"if",
"script",
"is",
"running",
"in",
"browser",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/is.js#L42-L51 |
53,029 | origin1tech/chek | dist/modules/is.js | isDebug | function isDebug(debugging) {
// If manually passed just return.
if (isValue(debugging))
return debugging;
var eargv = process && process.execArgv;
function chkDebug() {
return (eargv.filter(function (v) { return /^(--debug|--inspect)/.test(v); }).length ||
isValue(v8debug));... | javascript | function isDebug(debugging) {
// If manually passed just return.
if (isValue(debugging))
return debugging;
var eargv = process && process.execArgv;
function chkDebug() {
return (eargv.filter(function (v) { return /^(--debug|--inspect)/.test(v); }).length ||
isValue(v8debug));... | [
"function",
"isDebug",
"(",
"debugging",
")",
"{",
"// If manually passed just return.",
"if",
"(",
"isValue",
"(",
"debugging",
")",
")",
"return",
"debugging",
";",
"var",
"eargv",
"=",
"process",
"&&",
"process",
".",
"execArgv",
";",
"function",
"chkDebug",
... | Indicates if app is in debug mode.
@param debugging a manual flag to denote debugging. | [
"Indicates",
"if",
"app",
"is",
"in",
"debug",
"mode",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/is.js#L81-L91 |
53,030 | origin1tech/chek | dist/modules/is.js | isEmpty | function isEmpty(val) {
return (isUndefined(val) ||
isNull(val) ||
(isString(val) && val.length === 0) ||
(isNumber(val) && isNaN(val)) ||
(isPlainObject(val) && !array_1.keys(val).length) ||
(isArray(val) && !val.length));
} | javascript | function isEmpty(val) {
return (isUndefined(val) ||
isNull(val) ||
(isString(val) && val.length === 0) ||
(isNumber(val) && isNaN(val)) ||
(isPlainObject(val) && !array_1.keys(val).length) ||
(isArray(val) && !val.length));
} | [
"function",
"isEmpty",
"(",
"val",
")",
"{",
"return",
"(",
"isUndefined",
"(",
"val",
")",
"||",
"isNull",
"(",
"val",
")",
"||",
"(",
"isString",
"(",
"val",
")",
"&&",
"val",
".",
"length",
"===",
"0",
")",
"||",
"(",
"isNumber",
"(",
"val",
"... | Is Empty
Test if value provided is empty.
Note 0 would be empty.
@param val value to be inspected. | [
"Is",
"Empty",
"Test",
"if",
"value",
"provided",
"is",
"empty",
".",
"Note",
"0",
"would",
"be",
"empty",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/is.js#L100-L107 |
53,031 | origin1tech/chek | dist/modules/is.js | isEqual | function isEqual(val, comp, loose) {
if (isDate(val) && isDate(comp))
return to_1.toEpoch(val) === to_1.toEpoch(comp);
if (loose)
return val == comp;
return val === comp;
} | javascript | function isEqual(val, comp, loose) {
if (isDate(val) && isDate(comp))
return to_1.toEpoch(val) === to_1.toEpoch(comp);
if (loose)
return val == comp;
return val === comp;
} | [
"function",
"isEqual",
"(",
"val",
",",
"comp",
",",
"loose",
")",
"{",
"if",
"(",
"isDate",
"(",
"val",
")",
"&&",
"isDate",
"(",
"comp",
")",
")",
"return",
"to_1",
".",
"toEpoch",
"(",
"val",
")",
"===",
"to_1",
".",
"toEpoch",
"(",
"comp",
")... | Is Equal
Tests if two values are equal.
Does not support "deep equal".
@param val the value to be compared.
@param comp the comparer value.
@param loose when true == is used instead of ===. | [
"Is",
"Equal",
"Tests",
"if",
"two",
"values",
"are",
"equal",
".",
"Does",
"not",
"support",
"deep",
"equal",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/is.js#L118-L124 |
53,032 | origin1tech/chek | dist/modules/is.js | isError | function isError(val, prop) {
if (!isValue(val) || !isObject(val))
return false;
var type = constant_1.toStr.call(val).toLowerCase();
return type === '[object error]' || type === '[object domexception]' || !isEmpty(val[prop]);
} | javascript | function isError(val, prop) {
if (!isValue(val) || !isObject(val))
return false;
var type = constant_1.toStr.call(val).toLowerCase();
return type === '[object error]' || type === '[object domexception]' || !isEmpty(val[prop]);
} | [
"function",
"isError",
"(",
"val",
",",
"prop",
")",
"{",
"if",
"(",
"!",
"isValue",
"(",
"val",
")",
"||",
"!",
"isObject",
"(",
"val",
")",
")",
"return",
"false",
";",
"var",
"type",
"=",
"constant_1",
".",
"toStr",
".",
"call",
"(",
"val",
")... | Is Error
Checks if value is an error. Allows custom error property
which can be useful in certain scenarios to flag an object
as an error.
@param val the value/object to be inspected.
@param prop a custom property to check if exists indicating is error. | [
"Is",
"Error",
"Checks",
"if",
"value",
"is",
"an",
"error",
".",
"Allows",
"custom",
"error",
"property",
"which",
"can",
"be",
"useful",
"in",
"certain",
"scenarios",
"to",
"flag",
"an",
"object",
"as",
"an",
"error",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/is.js#L135-L140 |
53,033 | origin1tech/chek | dist/modules/is.js | isDocker | function isDocker() {
if (!isNode())
return false;
var hasEnv = function_1.tryWrap(function () {
statSync('/.dockerenv');
return true;
})(false);
var hasGroup = function_1.tryWrap(function () {
return ~readFileSync('/proc/self/cgroup', 'utf8').indexOf('docker');
})(fa... | javascript | function isDocker() {
if (!isNode())
return false;
var hasEnv = function_1.tryWrap(function () {
statSync('/.dockerenv');
return true;
})(false);
var hasGroup = function_1.tryWrap(function () {
return ~readFileSync('/proc/self/cgroup', 'utf8').indexOf('docker');
})(fa... | [
"function",
"isDocker",
"(",
")",
"{",
"if",
"(",
"!",
"isNode",
"(",
")",
")",
"return",
"false",
";",
"var",
"hasEnv",
"=",
"function_1",
".",
"tryWrap",
"(",
"function",
"(",
")",
"{",
"statSync",
"(",
"'/.dockerenv'",
")",
";",
"return",
"true",
... | Is Docker
Checks if running inside Docker container. | [
"Is",
"Docker",
"Checks",
"if",
"running",
"inside",
"Docker",
"container",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/is.js#L172-L183 |
53,034 | origin1tech/chek | dist/modules/is.js | isObject | function isObject(val) {
return (!isUndefined(val) &&
!isNull(val) &&
((val && val.constructor === Object) || typeof val === 'function' || typeof val === 'object'));
} | javascript | function isObject(val) {
return (!isUndefined(val) &&
!isNull(val) &&
((val && val.constructor === Object) || typeof val === 'function' || typeof val === 'object'));
} | [
"function",
"isObject",
"(",
"val",
")",
"{",
"return",
"(",
"!",
"isUndefined",
"(",
"val",
")",
"&&",
"!",
"isNull",
"(",
"val",
")",
"&&",
"(",
"(",
"val",
"&&",
"val",
".",
"constructor",
"===",
"Object",
")",
"||",
"typeof",
"val",
"===",
"'fu... | Is Object
Checks if value is an object.
@param val the value to inspect. | [
"Is",
"Object",
"Checks",
"if",
"value",
"is",
"an",
"object",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/is.js#L288-L292 |
53,035 | origin1tech/chek | dist/modules/is.js | isPromise | function isPromise(val, name) {
name = name || 'Promise';
return (!isEmpty(val) &&
val.constructor &&
val.constructor.name === name);
} | javascript | function isPromise(val, name) {
name = name || 'Promise';
return (!isEmpty(val) &&
val.constructor &&
val.constructor.name === name);
} | [
"function",
"isPromise",
"(",
"val",
",",
"name",
")",
"{",
"name",
"=",
"name",
"||",
"'Promise'",
";",
"return",
"(",
"!",
"isEmpty",
"(",
"val",
")",
"&&",
"val",
".",
"constructor",
"&&",
"val",
".",
"constructor",
".",
"name",
"===",
"name",
")"... | Is Promise
Checks if value is a Promise.
@param val the value to inspect.
@param name optional constructor name for promise defaults to Promise. | [
"Is",
"Promise",
"Checks",
"if",
"value",
"is",
"a",
"Promise",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/is.js#L311-L316 |
53,036 | rowanmanning/mocha-srv | lib/app.js | renderTmpl | function renderTmpl (path, vars, callback) {
fs.readFile(path, 'utf8', function (err, file) {
if (err) {
return callback(err);
}
var out = file.replace(/\{\{([a-z]+)\}\}/ig, function (all, name) {
return vars[name];
});
callback(null, out);
});
} | javascript | function renderTmpl (path, vars, callback) {
fs.readFile(path, 'utf8', function (err, file) {
if (err) {
return callback(err);
}
var out = file.replace(/\{\{([a-z]+)\}\}/ig, function (all, name) {
return vars[name];
});
callback(null, out);
});
} | [
"function",
"renderTmpl",
"(",
"path",
",",
"vars",
",",
"callback",
")",
"{",
"fs",
".",
"readFile",
"(",
"path",
",",
"'utf8'",
",",
"function",
"(",
"err",
",",
"file",
")",
"{",
"if",
"(",
"err",
")",
"{",
"return",
"callback",
"(",
"err",
")",... | Poor-man's mustache | [
"Poor",
"-",
"man",
"s",
"mustache"
] | 47af5e5bc91bb37ba5ccdb0ea7cf1771748fdff2 | https://github.com/rowanmanning/mocha-srv/blob/47af5e5bc91bb37ba5ccdb0ea7cf1771748fdff2/lib/app.js#L55-L65 |
53,037 | sendanor/nor-nopg | src/schema/v0032.js | function(db) {
var methods_uuid = uuid();
debug.assert(methods_uuid).is('uuid');
return db.query('CREATE SEQUENCE methods_seq')
.query(['CREATE TABLE IF NOT EXISTS methods (',
" id uuid PRIMARY KEY NOT NULL default uuid_generate_v5('"+methods_uuid+"', nextval('methods_seq'::regclass)::text),",
' typ... | javascript | function(db) {
var methods_uuid = uuid();
debug.assert(methods_uuid).is('uuid');
return db.query('CREATE SEQUENCE methods_seq')
.query(['CREATE TABLE IF NOT EXISTS methods (',
" id uuid PRIMARY KEY NOT NULL default uuid_generate_v5('"+methods_uuid+"', nextval('methods_seq'::regclass)::text),",
' typ... | [
"function",
"(",
"db",
")",
"{",
"var",
"methods_uuid",
"=",
"uuid",
"(",
")",
";",
"debug",
".",
"assert",
"(",
"methods_uuid",
")",
".",
"is",
"(",
"'uuid'",
")",
";",
"return",
"db",
".",
"query",
"(",
"'CREATE SEQUENCE methods_seq'",
")",
".",
"que... | The methods table | [
"The",
"methods",
"table"
] | 0d99b86c1a1996b5828b56de8de23700df8bbc0c | https://github.com/sendanor/nor-nopg/blob/0d99b86c1a1996b5828b56de8de23700df8bbc0c/src/schema/v0032.js#L10-L67 | |
53,038 | jokeyrhyme/jqlint | jqlint.js | isInstance | function isInstance(node) {
if (node.type === 'Identifier') {
if (currentOptions.angular) {
if (instanceVarsRegExp.angular.test(node.name)) {
return true;
}
} else {
if (instanceVarsRegExp.noangular.test(node.name)) {
return true;
}
}
}
if (node.type === 'CallEx... | javascript | function isInstance(node) {
if (node.type === 'Identifier') {
if (currentOptions.angular) {
if (instanceVarsRegExp.angular.test(node.name)) {
return true;
}
} else {
if (instanceVarsRegExp.noangular.test(node.name)) {
return true;
}
}
}
if (node.type === 'CallEx... | [
"function",
"isInstance",
"(",
"node",
")",
"{",
"if",
"(",
"node",
".",
"type",
"===",
"'Identifier'",
")",
"{",
"if",
"(",
"currentOptions",
".",
"angular",
")",
"{",
"if",
"(",
"instanceVarsRegExp",
".",
"angular",
".",
"test",
"(",
"node",
".",
"na... | determine if a syntax node a jQuery-wrapped element list
@param node
@returns {boolean} | [
"determine",
"if",
"a",
"syntax",
"node",
"a",
"jQuery",
"-",
"wrapped",
"element",
"list"
] | 23989825abb0afe5b92cea31c9334d385ca93afb | https://github.com/jokeyrhyme/jqlint/blob/23989825abb0afe5b92cea31c9334d385ca93afb/jqlint.js#L64-L90 |
53,039 | meltmedia/node-usher | lib/decider/poller.js | DecisionPoller | function DecisionPoller(name, domain, options) {
if (!(this instanceof DecisionPoller)) {
return new DecisionPoller(name, domain, options);
}
if (!_.isString(name)) {
throw new Error('A `name` is required');
}
if (!_.isString(domain)) {
throw new Error('A `domain` is required');
}
this.name... | javascript | function DecisionPoller(name, domain, options) {
if (!(this instanceof DecisionPoller)) {
return new DecisionPoller(name, domain, options);
}
if (!_.isString(name)) {
throw new Error('A `name` is required');
}
if (!_.isString(domain)) {
throw new Error('A `domain` is required');
}
this.name... | [
"function",
"DecisionPoller",
"(",
"name",
",",
"domain",
",",
"options",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"DecisionPoller",
")",
")",
"{",
"return",
"new",
"DecisionPoller",
"(",
"name",
",",
"domain",
",",
"options",
")",
";",
"}",
... | Represents a single, named decision poller, where all workflow versions can be created. Tasks will automaticly be
routed to the first workflow that satisfies the version requested. If no valid workflow is found, the task will
be marked as a failure.
@constructor
@param {string} name - The name of the workflow.
@param ... | [
"Represents",
"a",
"single",
"named",
"decision",
"poller",
"where",
"all",
"workflow",
"versions",
"can",
"be",
"created",
".",
"Tasks",
"will",
"automaticly",
"be",
"routed",
"to",
"the",
"first",
"workflow",
"that",
"satisfies",
"the",
"version",
"requested",... | fe6183bf7097f84bef935e8d9c19463accc08ad6 | https://github.com/meltmedia/node-usher/blob/fe6183bf7097f84bef935e8d9c19463accc08ad6/lib/decider/poller.js#L33-L64 |
53,040 | sorensen/configs | index.js | getInfo | function getInfo(d) {
var p = path.join(d, 'package.json')
return exists(p) ? require(p) : false
} | javascript | function getInfo(d) {
var p = path.join(d, 'package.json')
return exists(p) ? require(p) : false
} | [
"function",
"getInfo",
"(",
"d",
")",
"{",
"var",
"p",
"=",
"path",
".",
"join",
"(",
"d",
",",
"'package.json'",
")",
"return",
"exists",
"(",
"p",
")",
"?",
"require",
"(",
"p",
")",
":",
"false",
"}"
] | Find and load the `package.json` of the parent
@param {String} target directory
@returns {Object} package info | [
"Find",
"and",
"load",
"the",
"package",
".",
"json",
"of",
"the",
"parent"
] | 579d15081f47188749f4cf5efc527417809aeecb | https://github.com/sorensen/configs/blob/579d15081f47188749f4cf5efc527417809aeecb/index.js#L31-L34 |
53,041 | sorensen/configs | index.js | getPath | function getPath() {
var p = info && info.config ? info.config : './config'
if (p.charAt(0) === '/') return p
return path.join(base, p)
} | javascript | function getPath() {
var p = info && info.config ? info.config : './config'
if (p.charAt(0) === '/') return p
return path.join(base, p)
} | [
"function",
"getPath",
"(",
")",
"{",
"var",
"p",
"=",
"info",
"&&",
"info",
".",
"config",
"?",
"info",
".",
"config",
":",
"'./config'",
"if",
"(",
"p",
".",
"charAt",
"(",
"0",
")",
"===",
"'/'",
")",
"return",
"p",
"return",
"path",
".",
"joi... | Determine the directory config from `package.info`, can
be relative to the project base or an absolute path
@returns {String} directory | [
"Determine",
"the",
"directory",
"config",
"from",
"package",
".",
"info",
"can",
"be",
"relative",
"to",
"the",
"project",
"base",
"or",
"an",
"absolute",
"path"
] | 579d15081f47188749f4cf5efc527417809aeecb | https://github.com/sorensen/configs/blob/579d15081f47188749f4cf5efc527417809aeecb/index.js#L43-L47 |
53,042 | sorensen/configs | index.js | pathExtend | function pathExtend(p) {
if (!exists(p)) return false
loaded.push(p)
return extend(config, require(p))
} | javascript | function pathExtend(p) {
if (!exists(p)) return false
loaded.push(p)
return extend(config, require(p))
} | [
"function",
"pathExtend",
"(",
"p",
")",
"{",
"if",
"(",
"!",
"exists",
"(",
"p",
")",
")",
"return",
"false",
"loaded",
".",
"push",
"(",
"p",
")",
"return",
"extend",
"(",
"config",
",",
"require",
"(",
"p",
")",
")",
"}"
] | Check if a path exists and extend the config if so
@param {String} path
@returns {Object} extened config | [
"Check",
"if",
"a",
"path",
"exists",
"and",
"extend",
"the",
"config",
"if",
"so"
] | 579d15081f47188749f4cf5efc527417809aeecb | https://github.com/sorensen/configs/blob/579d15081f47188749f4cf5efc527417809aeecb/index.js#L56-L60 |
53,043 | ClinicalSoftwareSolutions/stackmob-client | stackmob-js-0.9.2.js | function(options, methods){
options = options || {};
// Wrap yes/no methods with a success method
options['success'] = function(result){
if ( methods['isValidResult'](result) ){
if (typeof methods['yes'] === "function") methods['yes'](result);
} else {
if (typeof m... | javascript | function(options, methods){
options = options || {};
// Wrap yes/no methods with a success method
options['success'] = function(result){
if ( methods['isValidResult'](result) ){
if (typeof methods['yes'] === "function") methods['yes'](result);
} else {
if (typeof m... | [
"function",
"(",
"options",
",",
"methods",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"// Wrap yes/no methods with a success method",
"options",
"[",
"'success'",
"]",
"=",
"function",
"(",
"result",
")",
"{",
"if",
"(",
"methods",
"[",
"'isV... | Helper method to allow altering callback methods | [
"Helper",
"method",
"to",
"allow",
"altering",
"callback",
"methods"
] | 9ee3ddbdf4172b4ed826283bb7d855b6ee22f67a | https://github.com/ClinicalSoftwareSolutions/stackmob-client/blob/9ee3ddbdf4172b4ed826283bb7d855b6ee22f67a/stackmob-js-0.9.2.js#L127-L145 | |
53,044 | ClinicalSoftwareSolutions/stackmob-client | stackmob-js-0.9.2.js | function(username, options) {
if ( this._containsCallbacks(options, ['yes', 'no']) ){
options = this._generateCallbacks(options, {
'isValidResult': function(result) {
return result == username;
},
'yes': options['yes'],
'no': options['no'],
'er... | javascript | function(username, options) {
if ( this._containsCallbacks(options, ['yes', 'no']) ){
options = this._generateCallbacks(options, {
'isValidResult': function(result) {
return result == username;
},
'yes': options['yes'],
'no': options['no'],
'er... | [
"function",
"(",
"username",
",",
"options",
")",
"{",
"if",
"(",
"this",
".",
"_containsCallbacks",
"(",
"options",
",",
"[",
"'yes'",
",",
"'no'",
"]",
")",
")",
"{",
"options",
"=",
"this",
".",
"_generateCallbacks",
"(",
"options",
",",
"{",
"'isVa... | Without specifying the 'options' argument, this is a "dumb" method in that simply checks if the given `username` is that of the logged in user without asking the server.
Optionally accepts asynchronous callback methods in the options object. When provided, this method will renew the refresh token if required. | [
"Without",
"specifying",
"the",
"options",
"argument",
"this",
"is",
"a",
"dumb",
"method",
"in",
"that",
"simply",
"checks",
"if",
"the",
"given",
"username",
"is",
"that",
"of",
"the",
"logged",
"in",
"user",
"without",
"asking",
"the",
"server",
"."
] | 9ee3ddbdf4172b4ed826283bb7d855b6ee22f67a | https://github.com/ClinicalSoftwareSolutions/stackmob-client/blob/9ee3ddbdf4172b4ed826283bb7d855b6ee22f67a/stackmob-js-0.9.2.js#L196-L210 | |
53,045 | ClinicalSoftwareSolutions/stackmob-client | stackmob-js-0.9.2.js | function() {
if( StackMob['useRelativePathForAjax'] ){
// Build "relative path" (also used for OAuth signing)
return StackMob.apiDomain ? StackMob.apiDomain : (this.getHostname() + (this.getPort() ? ':' + this.getPort() : '')) + '/';
} else {
// Use absolute path and operate through ... | javascript | function() {
if( StackMob['useRelativePathForAjax'] ){
// Build "relative path" (also used for OAuth signing)
return StackMob.apiDomain ? StackMob.apiDomain : (this.getHostname() + (this.getPort() ? ':' + this.getPort() : '')) + '/';
} else {
// Use absolute path and operate through ... | [
"function",
"(",
")",
"{",
"if",
"(",
"StackMob",
"[",
"'useRelativePathForAjax'",
"]",
")",
"{",
"// Build \"relative path\" (also used for OAuth signing)",
"return",
"StackMob",
".",
"apiDomain",
"?",
"StackMob",
".",
"apiDomain",
":",
"(",
"this",
".",
"getHostna... | This is an internally used method to get the API URL no matter what the context - development, production, etc. This envelopes `getDevAPIBase` and `getProdAPIBase` in that this method is smart enough to choose which of the URLs to use. | [
"This",
"is",
"an",
"internally",
"used",
"method",
"to",
"get",
"the",
"API",
"URL",
"no",
"matter",
"what",
"the",
"context",
"-",
"development",
"production",
"etc",
".",
"This",
"envelopes",
"getDevAPIBase",
"and",
"getProdAPIBase",
"in",
"that",
"this",
... | 9ee3ddbdf4172b4ed826283bb7d855b6ee22f67a | https://github.com/ClinicalSoftwareSolutions/stackmob-client/blob/9ee3ddbdf4172b4ed826283bb7d855b6ee22f67a/stackmob-js-0.9.2.js#L234-L242 | |
53,046 | ClinicalSoftwareSolutions/stackmob-client | stackmob-js-0.9.2.js | function(options) {
options = options || {};
//If we aren't running in OAuth 2.0 mode, then kick out early.
if(!this.isOAuth2Mode()){
if (options && options['error'])
options['error']();
return false;
}
//Check to see if we have all the necessary OAuth 2.0 crede... | javascript | function(options) {
options = options || {};
//If we aren't running in OAuth 2.0 mode, then kick out early.
if(!this.isOAuth2Mode()){
if (options && options['error'])
options['error']();
return false;
}
//Check to see if we have all the necessary OAuth 2.0 crede... | [
"function",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"//If we aren't running in OAuth 2.0 mode, then kick out early.",
"if",
"(",
"!",
"this",
".",
"isOAuth2Mode",
"(",
")",
")",
"{",
"if",
"(",
"options",
"&&",
"options",
"[",... | StackMob validates OAuth 2.0 credentials upon each request and will send back a error message if the credentials have expired. To save the trip, developers can check to see if their user has valid OAuth 2.0 credentials that indicate the user is logged in. | [
"StackMob",
"validates",
"OAuth",
"2",
".",
"0",
"credentials",
"upon",
"each",
"request",
"and",
"will",
"send",
"back",
"a",
"error",
"message",
"if",
"the",
"credentials",
"have",
"expired",
".",
"To",
"save",
"the",
"trip",
"developers",
"can",
"check",
... | 9ee3ddbdf4172b4ed826283bb7d855b6ee22f67a | https://github.com/ClinicalSoftwareSolutions/stackmob-client/blob/9ee3ddbdf4172b4ed826283bb7d855b6ee22f67a/stackmob-js-0.9.2.js#L298-L340 | |
53,047 | ClinicalSoftwareSolutions/stackmob-client | stackmob-js-0.9.2.js | function() {
var oauth_accessToken = StackMob.Storage.retrieve('oauth2.accessToken');
var oauth_macKey = StackMob.Storage.retrieve('oauth2.macKey');
var oauth_expires = StackMob.Storage.retrieve('oauth2.expires');
var oauth_refreshToken = StackMob.Storage.retrieve(StackMob.REFRESH_TOKEN_KEY);
... | javascript | function() {
var oauth_accessToken = StackMob.Storage.retrieve('oauth2.accessToken');
var oauth_macKey = StackMob.Storage.retrieve('oauth2.macKey');
var oauth_expires = StackMob.Storage.retrieve('oauth2.expires');
var oauth_refreshToken = StackMob.Storage.retrieve(StackMob.REFRESH_TOKEN_KEY);
... | [
"function",
"(",
")",
"{",
"var",
"oauth_accessToken",
"=",
"StackMob",
".",
"Storage",
".",
"retrieve",
"(",
"'oauth2.accessToken'",
")",
";",
"var",
"oauth_macKey",
"=",
"StackMob",
".",
"Storage",
".",
"retrieve",
"(",
"'oauth2.macKey'",
")",
";",
"var",
... | Retrieve the OAuth 2.0 credentials from client storage. | [
"Retrieve",
"the",
"OAuth",
"2",
".",
"0",
"credentials",
"from",
"client",
"storage",
"."
] | 9ee3ddbdf4172b4ed826283bb7d855b6ee22f67a | https://github.com/ClinicalSoftwareSolutions/stackmob-client/blob/9ee3ddbdf4172b4ed826283bb7d855b6ee22f67a/stackmob-js-0.9.2.js#L376-L402 | |
53,048 | ClinicalSoftwareSolutions/stackmob-client | stackmob-js-0.9.2.js | function(options) {
options = options || {};
// Run stuff before StackMob is initialized.
this.initStart(options);
/* DEPRECATED METHODS BELOW */
this.userSchema = options['userSchema']; // DEPRECATED: Use StackMob.User.extend({ schemaName: 'customschemaname' });
this.login... | javascript | function(options) {
options = options || {};
// Run stuff before StackMob is initialized.
this.initStart(options);
/* DEPRECATED METHODS BELOW */
this.userSchema = options['userSchema']; // DEPRECATED: Use StackMob.User.extend({ schemaName: 'customschemaname' });
this.login... | [
"function",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"// Run stuff before StackMob is initialized.",
"this",
".",
"initStart",
"(",
"options",
")",
";",
"/* DEPRECATED METHODS BELOW */",
"this",
".",
"userSchema",
"=",
"options",
"... | Externally called by user to initialize their StackMob config. | [
"Externally",
"called",
"by",
"user",
"to",
"initialize",
"their",
"StackMob",
"config",
"."
] | 9ee3ddbdf4172b4ed826283bb7d855b6ee22f67a | https://github.com/ClinicalSoftwareSolutions/stackmob-client/blob/9ee3ddbdf4172b4ed826283bb7d855b6ee22f67a/stackmob-js-0.9.2.js#L455-L537 | |
53,049 | ClinicalSoftwareSolutions/stackmob-client | stackmob-js-0.9.2.js | function(facebookAccessToken, options) {
options = options || {};
options['data'] = options['data'] || {};
_.extend(options['data'], {
"fb_at" : facebookAccessToken,
"token_type" : "mac"
});
(this.sync || Backbone.sync).call(this, "linkUserWithFacebook", this... | javascript | function(facebookAccessToken, options) {
options = options || {};
options['data'] = options['data'] || {};
_.extend(options['data'], {
"fb_at" : facebookAccessToken,
"token_type" : "mac"
});
(this.sync || Backbone.sync).call(this, "linkUserWithFacebook", this... | [
"function",
"(",
"facebookAccessToken",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"options",
"[",
"'data'",
"]",
"=",
"options",
"[",
"'data'",
"]",
"||",
"{",
"}",
";",
"_",
".",
"extend",
"(",
"options",
"[",
"'data'... | Use after a user has logged in with a regular user account and you want to add Facebook to their account | [
"Use",
"after",
"a",
"user",
"has",
"logged",
"in",
"with",
"a",
"regular",
"user",
"account",
"and",
"you",
"want",
"to",
"add",
"Facebook",
"to",
"their",
"account"
] | 9ee3ddbdf4172b4ed826283bb7d855b6ee22f67a | https://github.com/ClinicalSoftwareSolutions/stackmob-client/blob/9ee3ddbdf4172b4ed826283bb7d855b6ee22f67a/stackmob-js-0.9.2.js#L1516-L1525 | |
53,050 | ClinicalSoftwareSolutions/stackmob-client | stackmob-js-0.9.2.js | function(b){
/*
* Naming convention: A.or(B)
*/
if (typeof this.orId == "undefined"){
/*
* If A is a normal AND query:
* Clone A into newQuery
* Clear newQuery's params
* Assign OR Group# (1)
* Prefix A params with and[#... | javascript | function(b){
/*
* Naming convention: A.or(B)
*/
if (typeof this.orId == "undefined"){
/*
* If A is a normal AND query:
* Clone A into newQuery
* Clear newQuery's params
* Assign OR Group# (1)
* Prefix A params with and[#... | [
"function",
"(",
"b",
")",
"{",
"/*\n * Naming convention: A.or(B)\n */",
"if",
"(",
"typeof",
"this",
".",
"orId",
"==",
"\"undefined\"",
")",
"{",
"/*\n * If A is a normal AND query:\n * Clone A into newQuery\n * Clear newQuery's params... | Combine a Query with an OR operator between it and
the current Query object.
Example:
var isAged = new StackMob.Collection.Query().equals("age", "25");
var isNYC = new StackMob.Collection.Query().equals("location", "NYC");
var notJohn = new StackMob.Collection.Query().notEquals("name", "john");
var notMary = new St... | [
"Combine",
"a",
"Query",
"with",
"an",
"OR",
"operator",
"between",
"it",
"and",
"the",
"current",
"Query",
"object",
"."
] | 9ee3ddbdf4172b4ed826283bb7d855b6ee22f67a | https://github.com/ClinicalSoftwareSolutions/stackmob-client/blob/9ee3ddbdf4172b4ed826283bb7d855b6ee22f67a/stackmob-js-0.9.2.js#L1660-L1755 | |
53,051 | ClinicalSoftwareSolutions/stackmob-client | stackmob-js-0.9.2.js | function(b){
/*
* Naming convention: A.or(B)
*
* Combine all params of a and b into one object
*/
var a = this;
var newQuery = this.clone();
for (var key in b['params']){
newQuery['params'][key] = b['params'][key];
}
return... | javascript | function(b){
/*
* Naming convention: A.or(B)
*
* Combine all params of a and b into one object
*/
var a = this;
var newQuery = this.clone();
for (var key in b['params']){
newQuery['params'][key] = b['params'][key];
}
return... | [
"function",
"(",
"b",
")",
"{",
"/*\n * Naming convention: A.or(B)\n *\n * Combine all params of a and b into one object\n */",
"var",
"a",
"=",
"this",
";",
"var",
"newQuery",
"=",
"this",
".",
"clone",
"(",
")",
";",
"for",
"(",
"var",
... | Combine a Query with an AND operator between it and
the current Query object.
Example:
var isAged = new StackMob.Collection.Query().equals("age", "25");
var isNYC = new StackMob.Collection.Query().equals("location", "NYC");
var notJohn = new StackMob.Collection.Query().notEquals("name", "john");
var notMary = new S... | [
"Combine",
"a",
"Query",
"with",
"an",
"AND",
"operator",
"between",
"it",
"and",
"the",
"current",
"Query",
"object",
"."
] | 9ee3ddbdf4172b4ed826283bb7d855b6ee22f67a | https://github.com/ClinicalSoftwareSolutions/stackmob-client/blob/9ee3ddbdf4172b4ed826283bb7d855b6ee22f67a/stackmob-js-0.9.2.js#L1772-L1787 | |
53,052 | Lindurion/closure-pro-build | lib/js-builder.js | build | function build(
projectOptions, buildOptions, outDirsAsync, cssRenamingFileAsync) {
var inputFilesAsync = resolveInputsAsync(projectOptions);
return outDirsAsync.then(function(outDirs) {
var transitiveClosureDepsAsync =
closureDepCalculator.calcDeps(projectOptions, buildOptions, outDirs);
retur... | javascript | function build(
projectOptions, buildOptions, outDirsAsync, cssRenamingFileAsync) {
var inputFilesAsync = resolveInputsAsync(projectOptions);
return outDirsAsync.then(function(outDirs) {
var transitiveClosureDepsAsync =
closureDepCalculator.calcDeps(projectOptions, buildOptions, outDirs);
retur... | [
"function",
"build",
"(",
"projectOptions",
",",
"buildOptions",
",",
"outDirsAsync",
",",
"cssRenamingFileAsync",
")",
"{",
"var",
"inputFilesAsync",
"=",
"resolveInputsAsync",
"(",
"projectOptions",
")",
";",
"return",
"outDirsAsync",
".",
"then",
"(",
"function",... | Builds project JS as specified in the given options, using Closure JS
Compiler if required and assembling final output JS files.
@param {!Object} projectOptions Specifies the project input files; see
README.md for option documentation.
@param {!Object} buildOptions Specifies options specific to this build (like
debug/r... | [
"Builds",
"project",
"JS",
"as",
"specified",
"in",
"the",
"given",
"options",
"using",
"Closure",
"JS",
"Compiler",
"if",
"required",
"and",
"assembling",
"final",
"output",
"JS",
"files",
"."
] | c279d0fcc3a65969d2fe965f55e627b074792f1a | https://github.com/Lindurion/closure-pro-build/blob/c279d0fcc3a65969d2fe965f55e627b074792f1a/lib/js-builder.js#L43-L63 |
53,053 | melnikov-s/anvoy | src/template.js | getNodesMetaData | function getNodesMetaData(rootEl) {
let elMeta = [];
let toVisit = [rootEl];
let current = {el: rootEl, path: [], isPre: $.tag(rootEl) === 'PRE'};
//generate paths for comment and text nodes. There's no way to quickly retrieve them
//need to deeply traverse the DOM tree
while (current) {
... | javascript | function getNodesMetaData(rootEl) {
let elMeta = [];
let toVisit = [rootEl];
let current = {el: rootEl, path: [], isPre: $.tag(rootEl) === 'PRE'};
//generate paths for comment and text nodes. There's no way to quickly retrieve them
//need to deeply traverse the DOM tree
while (current) {
... | [
"function",
"getNodesMetaData",
"(",
"rootEl",
")",
"{",
"let",
"elMeta",
"=",
"[",
"]",
";",
"let",
"toVisit",
"=",
"[",
"rootEl",
"]",
";",
"let",
"current",
"=",
"{",
"el",
":",
"rootEl",
",",
"path",
":",
"[",
"]",
",",
"isPre",
":",
"$",
"."... | gather meta data from a DOM element template. Only runs once per template and the resulting data can be applied to any cloned template. Primarly used to generate paths to non-static nodes within a cloned template. | [
"gather",
"meta",
"data",
"from",
"a",
"DOM",
"element",
"template",
".",
"Only",
"runs",
"once",
"per",
"template",
"and",
"the",
"resulting",
"data",
"can",
"be",
"applied",
"to",
"any",
"cloned",
"template",
".",
"Primarly",
"used",
"to",
"generate",
"p... | c0c5ff2a409004721a26bb9815d7cc7706b6c4e0 | https://github.com/melnikov-s/anvoy/blob/c0c5ff2a409004721a26bb9815d7cc7706b6c4e0/src/template.js#L141-L186 |
53,054 | cli-kit/cli-mid-parser | index.js | getParserConfiguration | function getParserConfiguration(target, config) {
target = target || this;
config = config || {alias: {}, flags: [], options: []};
var k, arg, key
, conf = this.configure();
var no = /^\[?no\]?/, nor = /(\[no-?\]-?)/;
for(k in target._options) {
arg = target._options[k];
// misconfigured option,... | javascript | function getParserConfiguration(target, config) {
target = target || this;
config = config || {alias: {}, flags: [], options: []};
var k, arg, key
, conf = this.configure();
var no = /^\[?no\]?/, nor = /(\[no-?\]-?)/;
for(k in target._options) {
arg = target._options[k];
// misconfigured option,... | [
"function",
"getParserConfiguration",
"(",
"target",
",",
"config",
")",
"{",
"target",
"=",
"target",
"||",
"this",
";",
"config",
"=",
"config",
"||",
"{",
"alias",
":",
"{",
"}",
",",
"flags",
":",
"[",
"]",
",",
"options",
":",
"[",
"]",
"}",
"... | Retrieve a configuration suitable for passing to
the arguments parser. | [
"Retrieve",
"a",
"configuration",
"suitable",
"for",
"passing",
"to",
"the",
"arguments",
"parser",
"."
] | cfd6300eeb5cc69a33370c9b1a0978bbdce250bf | https://github.com/cli-kit/cli-mid-parser/blob/cfd6300eeb5cc69a33370c9b1a0978bbdce250bf/index.js#L8-L59 |
53,055 | uxter/fluxter | src/fluxter.js | next | function next(actionData) {
index++;
if(index === store.middlewares.length) {
done(actionData);
} else {
store.middlewares[index](store, actionName, actionData, next);
}
} | javascript | function next(actionData) {
index++;
if(index === store.middlewares.length) {
done(actionData);
} else {
store.middlewares[index](store, actionName, actionData, next);
}
} | [
"function",
"next",
"(",
"actionData",
")",
"{",
"index",
"++",
";",
"if",
"(",
"index",
"===",
"store",
".",
"middlewares",
".",
"length",
")",
"{",
"done",
"(",
"actionData",
")",
";",
"}",
"else",
"{",
"store",
".",
"middlewares",
"[",
"index",
"]... | Call next middleware or done
@function next
@param {*} actionData - An action data | [
"Call",
"next",
"middleware",
"or",
"done"
] | f3a878c92ec3b3bab609515aca3ae8982d044ecd | https://github.com/uxter/fluxter/blob/f3a878c92ec3b3bab609515aca3ae8982d044ecd/src/fluxter.js#L158-L165 |
53,056 | uxter/fluxter | src/fluxter.js | checkArgumentType | function checkArgumentType(argument, position, type) {
let wrongTypeOf = typeof argument !== type;
let isCheckObject = type === 'object';
let n = isCheckObject ? 'n' : '';
if (isCheckObject && (wrongTypeOf || argument.constructor !== Object) || wrongTypeOf) {
throw new TypeError('A ' + position ... | javascript | function checkArgumentType(argument, position, type) {
let wrongTypeOf = typeof argument !== type;
let isCheckObject = type === 'object';
let n = isCheckObject ? 'n' : '';
if (isCheckObject && (wrongTypeOf || argument.constructor !== Object) || wrongTypeOf) {
throw new TypeError('A ' + position ... | [
"function",
"checkArgumentType",
"(",
"argument",
",",
"position",
",",
"type",
")",
"{",
"let",
"wrongTypeOf",
"=",
"typeof",
"argument",
"!==",
"type",
";",
"let",
"isCheckObject",
"=",
"type",
"===",
"'object'",
";",
"let",
"n",
"=",
"isCheckObject",
"?",... | Check type of argument
@function checkArgumentType
@param {*} argument
@param {String} position - first, second, ...
@param {String} type - string, function, ...
@throws {TypeError}
@private | [
"Check",
"type",
"of",
"argument"
] | f3a878c92ec3b3bab609515aca3ae8982d044ecd | https://github.com/uxter/fluxter/blob/f3a878c92ec3b3bab609515aca3ae8982d044ecd/src/fluxter.js#L200-L207 |
53,057 | N4SJAMK/jarmo-express | index.js | onResponseFinished | function onResponseFinished() {
// Resolve the payload from the 'request' and 'response' objects,
// and send it to the Jarmo server, catching any errors.
var payload = config.resolve(req, res, Date.now() - start);
if(!payload) {
// If the payload is falsy we don't send the data. This allows
// for... | javascript | function onResponseFinished() {
// Resolve the payload from the 'request' and 'response' objects,
// and send it to the Jarmo server, catching any errors.
var payload = config.resolve(req, res, Date.now() - start);
if(!payload) {
// If the payload is falsy we don't send the data. This allows
// for... | [
"function",
"onResponseFinished",
"(",
")",
"{",
"// Resolve the payload from the 'request' and 'response' objects,",
"// and send it to the Jarmo server, catching any errors.",
"var",
"payload",
"=",
"config",
".",
"resolve",
"(",
"req",
",",
"res",
",",
"Date",
".",
"now",
... | Get the data out of the request and response and send it to the
configured server. Also make sure to remove listeners when done. | [
"Get",
"the",
"data",
"out",
"of",
"the",
"request",
"and",
"response",
"and",
"send",
"it",
"to",
"the",
"configured",
"server",
".",
"Also",
"make",
"sure",
"to",
"remove",
"listeners",
"when",
"done",
"."
] | 42808d93ef29922f6a9a68fd3507d280c2a45a0f | https://github.com/N4SJAMK/jarmo-express/blob/42808d93ef29922f6a9a68fd3507d280c2a45a0f/index.js#L61-L78 |
53,058 | N4SJAMK/jarmo-express | index.js | removeListeners | function removeListeners() {
res.removeListener('error', removeListeners);
res.removeListener('close', removeListeners);
res.removeListener('finish', onResponseFinished);
} | javascript | function removeListeners() {
res.removeListener('error', removeListeners);
res.removeListener('close', removeListeners);
res.removeListener('finish', onResponseFinished);
} | [
"function",
"removeListeners",
"(",
")",
"{",
"res",
".",
"removeListener",
"(",
"'error'",
",",
"removeListeners",
")",
";",
"res",
".",
"removeListener",
"(",
"'close'",
",",
"removeListeners",
")",
";",
"res",
".",
"removeListener",
"(",
"'finish'",
",",
... | Clean up listeners to prevent any memory shenanigans. | [
"Clean",
"up",
"listeners",
"to",
"prevent",
"any",
"memory",
"shenanigans",
"."
] | 42808d93ef29922f6a9a68fd3507d280c2a45a0f | https://github.com/N4SJAMK/jarmo-express/blob/42808d93ef29922f6a9a68fd3507d280c2a45a0f/index.js#L83-L87 |
53,059 | N4SJAMK/jarmo-express | index.js | send | function send(host, port, payload, callback) {
// Create a Buffer of the JSON stringified payload, so we can send it.
var data = new Buffer(JSON.stringify(payload));
// Resolve or reject the promise once the we have at least attempted to
// send the payload. Should we add some sort of a retry on error?
return cli... | javascript | function send(host, port, payload, callback) {
// Create a Buffer of the JSON stringified payload, so we can send it.
var data = new Buffer(JSON.stringify(payload));
// Resolve or reject the promise once the we have at least attempted to
// send the payload. Should we add some sort of a retry on error?
return cli... | [
"function",
"send",
"(",
"host",
",",
"port",
",",
"payload",
",",
"callback",
")",
"{",
"// Create a Buffer of the JSON stringified payload, so we can send it.",
"var",
"data",
"=",
"new",
"Buffer",
"(",
"JSON",
".",
"stringify",
"(",
"payload",
")",
")",
";",
... | Send data via UDP to the target server.
@param {string} host Server host.
@param {string} port Server port.
@param {object} payload Payload object, that will be made into a string,
and sent to the server.
@return {Promise} Promise for sending the payload. | [
"Send",
"data",
"via",
"UDP",
"to",
"the",
"target",
"server",
"."
] | 42808d93ef29922f6a9a68fd3507d280c2a45a0f | https://github.com/N4SJAMK/jarmo-express/blob/42808d93ef29922f6a9a68fd3507d280c2a45a0f/index.js#L127-L134 |
53,060 | micro-node/amqp | lib/amqp.js | assetQueue | function assetQueue(addr, queue, options) {
return createChannel(addr).then(data => {
let ch = data[1];
return ch.assertQueue(queue, options).then(q => [ch, q]);
});
} | javascript | function assetQueue(addr, queue, options) {
return createChannel(addr).then(data => {
let ch = data[1];
return ch.assertQueue(queue, options).then(q => [ch, q]);
});
} | [
"function",
"assetQueue",
"(",
"addr",
",",
"queue",
",",
"options",
")",
"{",
"return",
"createChannel",
"(",
"addr",
")",
".",
"then",
"(",
"data",
"=>",
"{",
"let",
"ch",
"=",
"data",
"[",
"1",
"]",
";",
"return",
"ch",
".",
"assertQueue",
"(",
... | asset queue helper | [
"asset",
"queue",
"helper"
] | 40e12b04a4426f51b790284c13ebef9fd91a6733 | https://github.com/micro-node/amqp/blob/40e12b04a4426f51b790284c13ebef9fd91a6733/lib/amqp.js#L183-L189 |
53,061 | micro-node/amqp | lib/amqp.js | createChannel | function createChannel(addr) {
return amqp.connect(genAddr(addr)).then(conn => {
return conn.createChannel().then(ch => {
connections.push(conn);
return [conn, ch];
});
}, debugError);
} | javascript | function createChannel(addr) {
return amqp.connect(genAddr(addr)).then(conn => {
return conn.createChannel().then(ch => {
connections.push(conn);
return [conn, ch];
});
}, debugError);
} | [
"function",
"createChannel",
"(",
"addr",
")",
"{",
"return",
"amqp",
".",
"connect",
"(",
"genAddr",
"(",
"addr",
")",
")",
".",
"then",
"(",
"conn",
"=>",
"{",
"return",
"conn",
".",
"createChannel",
"(",
")",
".",
"then",
"(",
"ch",
"=>",
"{",
"... | create channel helper | [
"create",
"channel",
"helper"
] | 40e12b04a4426f51b790284c13ebef9fd91a6733 | https://github.com/micro-node/amqp/blob/40e12b04a4426f51b790284c13ebef9fd91a6733/lib/amqp.js#L192-L200 |
53,062 | iuap-design/compox | dist/compox.js | SubClass | function SubClass() {
var ret;
// Call the parent constructor.
parent.apply(this, arguments);
// Only call initialize in self constructor.
if(this.constructor === SubClass && this.initialize) {
ret = this.initialize.apply(this, arguments);
}
return ret ? ret : this;
} | javascript | function SubClass() {
var ret;
// Call the parent constructor.
parent.apply(this, arguments);
// Only call initialize in self constructor.
if(this.constructor === SubClass && this.initialize) {
ret = this.initialize.apply(this, arguments);
}
return ret ? ret : this;
} | [
"function",
"SubClass",
"(",
")",
"{",
"var",
"ret",
";",
"// Call the parent constructor.",
"parent",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"// Only call initialize in self constructor.",
"if",
"(",
"this",
".",
"constructor",
"===",
"SubClass",
... | The created class constructor | [
"The",
"created",
"class",
"constructor"
] | 79b6a6d24a64f072134cc7385b6cdd29a2e310ac | https://github.com/iuap-design/compox/blob/79b6a6d24a64f072134cc7385b6cdd29a2e310ac/dist/compox.js#L537-L547 |
53,063 | iuap-design/compox | dist/compox.js | function (event) {
//event = $.event.fix(event); // jQuery event normalization.
var element = this;//event.target;
// @ TextNode -> nodeType == 3
element = (element.nodeType == 3) ? element.parentNode : element;
if (opt['disableInInput']) { // Disable shortcut keys in Input, Tex... | javascript | function (event) {
//event = $.event.fix(event); // jQuery event normalization.
var element = this;//event.target;
// @ TextNode -> nodeType == 3
element = (element.nodeType == 3) ? element.parentNode : element;
if (opt['disableInInput']) { // Disable shortcut keys in Input, Tex... | [
"function",
"(",
"event",
")",
"{",
"//event = $.event.fix(event); // jQuery event normalization.",
"var",
"element",
"=",
"this",
";",
"//event.target;",
"// @ TextNode -> nodeType == 3",
"element",
"=",
"(",
"element",
".",
"nodeType",
"==",
"3",
")",
"?",
"element",
... | inspect if keystroke matches | [
"inspect",
"if",
"keystroke",
"matches"
] | 79b6a6d24a64f072134cc7385b6cdd29a2e310ac | https://github.com/iuap-design/compox/blob/79b6a6d24a64f072134cc7385b6cdd29a2e310ac/dist/compox.js#L712-L766 | |
53,064 | gethuman/pancakes-recipe | utils/active.user.js | init | function init() {
return user.initComplete ?
Q.when(user) :
userService.findMe()
.then(function setUserLocal(me) {
me = me || {};
// pull out the user
_.extend(user, me.user);
// return the ... | javascript | function init() {
return user.initComplete ?
Q.when(user) :
userService.findMe()
.then(function setUserLocal(me) {
me = me || {};
// pull out the user
_.extend(user, me.user);
// return the ... | [
"function",
"init",
"(",
")",
"{",
"return",
"user",
".",
"initComplete",
"?",
"Q",
".",
"when",
"(",
"user",
")",
":",
"userService",
".",
"findMe",
"(",
")",
".",
"then",
"(",
"function",
"setUserLocal",
"(",
"me",
")",
"{",
"me",
"=",
"me",
"||"... | If user already loaded, use that, otherwise get it from the API
@returns {*} | [
"If",
"user",
"already",
"loaded",
"use",
"that",
"otherwise",
"get",
"it",
"from",
"the",
"API"
] | ea3feb8839e2edaf1b4577c052b8958953db4498 | https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/utils/active.user.js#L18-L34 |
53,065 | Postmedia/timbits | lib/timbits.js | filteredFiles | function filteredFiles(folder, pattern) {
var files = [];
if (fs.existsSync(folder)){
fs.readdirSync(folder).forEach(function(file) {
if (file.match(pattern) != null)
files.push(file);
});
}
return files;
} | javascript | function filteredFiles(folder, pattern) {
var files = [];
if (fs.existsSync(folder)){
fs.readdirSync(folder).forEach(function(file) {
if (file.match(pattern) != null)
files.push(file);
});
}
return files;
} | [
"function",
"filteredFiles",
"(",
"folder",
",",
"pattern",
")",
"{",
"var",
"files",
"=",
"[",
"]",
";",
"if",
"(",
"fs",
".",
"existsSync",
"(",
"folder",
")",
")",
"{",
"fs",
".",
"readdirSync",
"(",
"folder",
")",
".",
"forEach",
"(",
"function",... | retrieve list of matching files in a folder | [
"retrieve",
"list",
"of",
"matching",
"files",
"in",
"a",
"folder"
] | 0213593db6cf94bb35679a4fad01588b19f7fe62 | https://github.com/Postmedia/timbits/blob/0213593db6cf94bb35679a4fad01588b19f7fe62/lib/timbits.js#L28-L38 |
53,066 | Postmedia/timbits | lib/timbits.js | loadViews | function loadViews(timbit) {
timbit.views = [];
var pattern = new RegExp('\.' + timbits.app.settings['view engine'] + '$')
, folder = path.join(config.home, 'views', timbit.viewBase);
if (fs.existsSync(folder)) {
var files = fs.readdirSync(folder);
files.forEach(function(file) {
timbit.view... | javascript | function loadViews(timbit) {
timbit.views = [];
var pattern = new RegExp('\.' + timbits.app.settings['view engine'] + '$')
, folder = path.join(config.home, 'views', timbit.viewBase);
if (fs.existsSync(folder)) {
var files = fs.readdirSync(folder);
files.forEach(function(file) {
timbit.view... | [
"function",
"loadViews",
"(",
"timbit",
")",
"{",
"timbit",
".",
"views",
"=",
"[",
"]",
";",
"var",
"pattern",
"=",
"new",
"RegExp",
"(",
"'\\.'",
"+",
"timbits",
".",
"app",
".",
"settings",
"[",
"'view engine'",
"]",
"+",
"'$'",
")",
",",
"folder"... | automagically load views for a given timbit | [
"automagically",
"load",
"views",
"for",
"a",
"given",
"timbit"
] | 0213593db6cf94bb35679a4fad01588b19f7fe62 | https://github.com/Postmedia/timbits/blob/0213593db6cf94bb35679a4fad01588b19f7fe62/lib/timbits.js#L57-L72 |
53,067 | Postmedia/timbits | lib/timbits.js | compileTemplate | function compileTemplate(name) {
var filename = path.join(__dirname, "templates", name + '.hjs');
var contents = fs.readFileSync(filename);
return hogan.compile(contents.toString());
} | javascript | function compileTemplate(name) {
var filename = path.join(__dirname, "templates", name + '.hjs');
var contents = fs.readFileSync(filename);
return hogan.compile(contents.toString());
} | [
"function",
"compileTemplate",
"(",
"name",
")",
"{",
"var",
"filename",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"\"templates\"",
",",
"name",
"+",
"'.hjs'",
")",
";",
"var",
"contents",
"=",
"fs",
".",
"readFileSync",
"(",
"filename",
")",
";",... | compile built in templates | [
"compile",
"built",
"in",
"templates"
] | 0213593db6cf94bb35679a4fad01588b19f7fe62 | https://github.com/Postmedia/timbits/blob/0213593db6cf94bb35679a4fad01588b19f7fe62/lib/timbits.js#L87-L91 |
53,068 | Postmedia/timbits | lib/timbits.js | allowedMethods | function allowedMethods(methods) {
// default values
var methodsAllowed = { 'GET': true, 'POST': false, 'PUT': false, 'HEAD': false, 'DELETE': false };
// check and override if one of the default methods
for (var key in methods) {
var newKey = key.toUpperCase();
if ( methodsAllowed[newKey]!=undefined) ... | javascript | function allowedMethods(methods) {
// default values
var methodsAllowed = { 'GET': true, 'POST': false, 'PUT': false, 'HEAD': false, 'DELETE': false };
// check and override if one of the default methods
for (var key in methods) {
var newKey = key.toUpperCase();
if ( methodsAllowed[newKey]!=undefined) ... | [
"function",
"allowedMethods",
"(",
"methods",
")",
"{",
"// default values",
"var",
"methodsAllowed",
"=",
"{",
"'GET'",
":",
"true",
",",
"'POST'",
":",
"false",
",",
"'PUT'",
":",
"false",
",",
"'HEAD'",
":",
"false",
",",
"'DELETE'",
":",
"false",
"}",
... | generates the allowed methods | [
"generates",
"the",
"allowed",
"methods"
] | 0213593db6cf94bb35679a4fad01588b19f7fe62 | https://github.com/Postmedia/timbits/blob/0213593db6cf94bb35679a4fad01588b19f7fe62/lib/timbits.js#L94-L105 |
53,069 | bigpipe/parsifal | index.js | text | function text(element) {
var type = element.nodeType
, value = '';
if (1 === type || 9 === type || 11 === type) {
//
// Use `textContent` instead of `innerText` as it's inconsistent with new
// lines.
//
if ('string' === typeof element.textContent) return element.textContent;
for (elem... | javascript | function text(element) {
var type = element.nodeType
, value = '';
if (1 === type || 9 === type || 11 === type) {
//
// Use `textContent` instead of `innerText` as it's inconsistent with new
// lines.
//
if ('string' === typeof element.textContent) return element.textContent;
for (elem... | [
"function",
"text",
"(",
"element",
")",
"{",
"var",
"type",
"=",
"element",
".",
"nodeType",
",",
"value",
"=",
"''",
";",
"if",
"(",
"1",
"===",
"type",
"||",
"9",
"===",
"type",
"||",
"11",
"===",
"type",
")",
"{",
"//",
"// Use `textContent` inst... | Get the text or inner text from a given element.
@param {Element} element
@returns {String} text
@api public | [
"Get",
"the",
"text",
"or",
"inner",
"text",
"from",
"a",
"given",
"element",
"."
] | 4b35938c62b72810c4117cda5d57123cb8a9a318 | https://github.com/bigpipe/parsifal/blob/4b35938c62b72810c4117cda5d57123cb8a9a318/index.js#L58-L77 |
53,070 | bigpipe/parsifal | index.js | attribute | function attribute(element, name, val) {
return supports.attributes || !supports.html
? element.getAttribute(name)
: (val = element.getAttributeNode(name)) && val.specified ? val.value : '';
} | javascript | function attribute(element, name, val) {
return supports.attributes || !supports.html
? element.getAttribute(name)
: (val = element.getAttributeNode(name)) && val.specified ? val.value : '';
} | [
"function",
"attribute",
"(",
"element",
",",
"name",
",",
"val",
")",
"{",
"return",
"supports",
".",
"attributes",
"||",
"!",
"supports",
".",
"html",
"?",
"element",
".",
"getAttribute",
"(",
"name",
")",
":",
"(",
"val",
"=",
"element",
".",
"getAt... | Find the attribute.
@param {Element} element
@returns {String} The `.value` of the element.
@api private | [
"Find",
"the",
"attribute",
"."
] | 4b35938c62b72810c4117cda5d57123cb8a9a318 | https://github.com/bigpipe/parsifal/blob/4b35938c62b72810c4117cda5d57123cb8a9a318/index.js#L97-L101 |
53,071 | bigpipe/parsifal | index.js | get | function get(element) {
var name = element.nodeName.toLowerCase()
, value;
if (get.parser[element.type] && hasOwn.call(get.parser, element.type)) {
value = get.parser[element.type](element);
} else if (get.parser[name] && hasOwn.call(get.parser, name)) {
value = get.parser[name](element);
}
if (... | javascript | function get(element) {
var name = element.nodeName.toLowerCase()
, value;
if (get.parser[element.type] && hasOwn.call(get.parser, element.type)) {
value = get.parser[element.type](element);
} else if (get.parser[name] && hasOwn.call(get.parser, name)) {
value = get.parser[name](element);
}
if (... | [
"function",
"get",
"(",
"element",
")",
"{",
"var",
"name",
"=",
"element",
".",
"nodeName",
".",
"toLowerCase",
"(",
")",
",",
"value",
";",
"if",
"(",
"get",
".",
"parser",
"[",
"element",
".",
"type",
"]",
"&&",
"hasOwn",
".",
"call",
"(",
"get"... | Get the value from a given element.
@param {Element} element The HTML element we need to extract the value from.
@returns {Mixed} The value of the element.
@api public | [
"Get",
"the",
"value",
"from",
"a",
"given",
"element",
"."
] | 4b35938c62b72810c4117cda5d57123cb8a9a318 | https://github.com/bigpipe/parsifal/blob/4b35938c62b72810c4117cda5d57123cb8a9a318/index.js#L110-L127 |
53,072 | redisjs/jsr-server | lib/command/server/monitor.js | execute | function execute(req, res) {
req.conn.monitor(this);
res.send(null, Constants.OK);
} | javascript | function execute(req, res) {
req.conn.monitor(this);
res.send(null, Constants.OK);
} | [
"function",
"execute",
"(",
"req",
",",
"res",
")",
"{",
"req",
".",
"conn",
".",
"monitor",
"(",
"this",
")",
";",
"res",
".",
"send",
"(",
"null",
",",
"Constants",
".",
"OK",
")",
";",
"}"
] | Respond to the MONITOR command. | [
"Respond",
"to",
"the",
"MONITOR",
"command",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/server/monitor.js#L17-L20 |
53,073 | chanoch/simple-react-router | src/route/RouteConfiguration.js | routeMatcher | function routeMatcher(keys) {
return match => {
const parseParams = paramsParser(keys);
if(match) {
const params = parseParams(match);
return {
match,
keys,
params,
}
}
}
} | javascript | function routeMatcher(keys) {
return match => {
const parseParams = paramsParser(keys);
if(match) {
const params = parseParams(match);
return {
match,
keys,
params,
}
}
}
} | [
"function",
"routeMatcher",
"(",
"keys",
")",
"{",
"return",
"match",
"=>",
"{",
"const",
"parseParams",
"=",
"paramsParser",
"(",
"keys",
")",
";",
"if",
"(",
"match",
")",
"{",
"const",
"params",
"=",
"parseParams",
"(",
"match",
")",
";",
"return",
... | A route match instance which parses for URL params based on the specific location
passed into it.
@param {RegExpExecArray} pathMatch - an array of tokens based on the regexp execution
@param {*} keys - the list of parameter keys (:param) to extract from the URI | [
"A",
"route",
"match",
"instance",
"which",
"parses",
"for",
"URL",
"params",
"based",
"on",
"the",
"specific",
"location",
"passed",
"into",
"it",
"."
] | 3c71feeeb039111f33c934257732e2ea6ddde9ff | https://github.com/chanoch/simple-react-router/blob/3c71feeeb039111f33c934257732e2ea6ddde9ff/src/route/RouteConfiguration.js#L35-L47 |
53,074 | cafjs/caf_iot | lib/plug_iot_queue.js | function(msg, code, errorStr, cb1) {
return function(error, data) {
if (error) {
error = json_rpc.newSysError(msg, code, errorStr,
error);
}
cb1(error, data);
... | javascript | function(msg, code, errorStr, cb1) {
return function(error, data) {
if (error) {
error = json_rpc.newSysError(msg, code, errorStr,
error);
}
cb1(error, data);
... | [
"function",
"(",
"msg",
",",
"code",
",",
"errorStr",
",",
"cb1",
")",
"{",
"return",
"function",
"(",
"error",
",",
"data",
")",
"{",
"if",
"(",
"error",
")",
"{",
"error",
"=",
"json_rpc",
".",
"newSysError",
"(",
"msg",
",",
"code",
",",
"errorS... | Wraps error into a SystemError | [
"Wraps",
"error",
"into",
"a",
"SystemError"
] | 12e4042c354d966be2736cb7e00d0fae64875788 | https://github.com/cafjs/caf_iot/blob/12e4042c354d966be2736cb7e00d0fae64875788/lib/plug_iot_queue.js#L50-L58 | |
53,075 | vkiding/judpack-lib | src/plugman/platforms/android.js | function(project_dir) {
var mDoc = xml_helpers.parseElementtreeSync(path.join(project_dir, 'AndroidManifest.xml'));
return mDoc._root.attrib['package'];
} | javascript | function(project_dir) {
var mDoc = xml_helpers.parseElementtreeSync(path.join(project_dir, 'AndroidManifest.xml'));
return mDoc._root.attrib['package'];
} | [
"function",
"(",
"project_dir",
")",
"{",
"var",
"mDoc",
"=",
"xml_helpers",
".",
"parseElementtreeSync",
"(",
"path",
".",
"join",
"(",
"project_dir",
",",
"'AndroidManifest.xml'",
")",
")",
";",
"return",
"mDoc",
".",
"_root",
".",
"attrib",
"[",
"'package... | reads the package name out of the Android Manifest file @param string project_dir the absolute path to the directory containing the project @return string the name of the package | [
"reads",
"the",
"package",
"name",
"out",
"of",
"the",
"Android",
"Manifest",
"file"
] | 8657cecfec68221109279106adca8dbc81f430f4 | https://github.com/vkiding/judpack-lib/blob/8657cecfec68221109279106adca8dbc81f430f4/src/plugman/platforms/android.js#L61-L65 | |
53,076 | origin1tech/chek | dist/modules/function.js | tryWrap | function tryWrap(fn) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
return function (def) {
try {
return fn.apply(void 0, args);
}
catch (ex) {
if (is_1.isFunction(def))
return def(e... | javascript | function tryWrap(fn) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
return function (def) {
try {
return fn.apply(void 0, args);
}
catch (ex) {
if (is_1.isFunction(def))
return def(e... | [
"function",
"tryWrap",
"(",
"fn",
")",
"{",
"var",
"args",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"_i",
"=",
"1",
";",
"_i",
"<",
"arguments",
".",
"length",
";",
"_i",
"++",
")",
"{",
"args",
"[",
"_i",
"-",
"1",
"]",
"=",
"arguments",
"[",
... | Try Wrap
Generic helper for calling try catch on a method.
If a default method is provided it will return in on error
otherwise it will return null.
@example
function func(val: any) { return isString(val); }
const result = tryWrap(func)();
With params
tryWrap(JSON.stringify, { name: 'Adele', age: 30 }, null, 2)()
Wi... | [
"Try",
"Wrap",
"Generic",
"helper",
"for",
"calling",
"try",
"catch",
"on",
"a",
"method",
".",
"If",
"a",
"default",
"method",
"is",
"provided",
"it",
"will",
"return",
"in",
"on",
"error",
"otherwise",
"it",
"will",
"return",
"null",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/function.js#L46-L61 |
53,077 | origin1tech/chek | dist/modules/function.js | tryRequire | function tryRequire(name, def, isRoot) {
function _require() {
if (!is_1.isNode())
/* istanbul ignore next */
return to_1.toDefault(null, def);
if (isRoot)
return require.main.require(name);
return require(name);
}
return tryWrap(_require)(def);
} | javascript | function tryRequire(name, def, isRoot) {
function _require() {
if (!is_1.isNode())
/* istanbul ignore next */
return to_1.toDefault(null, def);
if (isRoot)
return require.main.require(name);
return require(name);
}
return tryWrap(_require)(def);
} | [
"function",
"tryRequire",
"(",
"name",
",",
"def",
",",
"isRoot",
")",
"{",
"function",
"_require",
"(",
")",
"{",
"if",
"(",
"!",
"is_1",
".",
"isNode",
"(",
")",
")",
"/* istanbul ignore next */",
"return",
"to_1",
".",
"toDefault",
"(",
"null",
",",
... | Try Require
Tries to require a module returns null
if cannot require or empty object.
@param name the name of module to try and require.
@param def optional default value on null.
@param isRoot used internally by tryRootRequire to require root modules. | [
"Try",
"Require",
"Tries",
"to",
"require",
"a",
"module",
"returns",
"null",
"if",
"cannot",
"require",
"or",
"empty",
"object",
"."
] | 6bc3ab0ac36126cc7918a244a606009749897b2e | https://github.com/origin1tech/chek/blob/6bc3ab0ac36126cc7918a244a606009749897b2e/dist/modules/function.js#L72-L82 |
53,078 | gethuman/pancakes-angular | lib/ngapp/state.loader.js | getPascalCase | function getPascalCase(val) {
var parts = val.split('.');
var newVal = '';
for (var i = 0; i < parts.length; i++) {
newVal += parts[i].substring(0, 1).toUpperCase() + parts[i].substring(1);
}
return newVal;
} | javascript | function getPascalCase(val) {
var parts = val.split('.');
var newVal = '';
for (var i = 0; i < parts.length; i++) {
newVal += parts[i].substring(0, 1).toUpperCase() + parts[i].substring(1);
}
return newVal;
} | [
"function",
"getPascalCase",
"(",
"val",
")",
"{",
"var",
"parts",
"=",
"val",
".",
"split",
"(",
"'.'",
")",
";",
"var",
"newVal",
"=",
"''",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"parts",
".",
"length",
";",
"i",
"++",
")",
... | Helper function to get pascal case of a route name
@param val
@returns {string} | [
"Helper",
"function",
"to",
"get",
"pascal",
"case",
"of",
"a",
"route",
"name"
] | 9589b7ba09619843e271293088005c62ed23f355 | https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/ngapp/state.loader.js#L17-L26 |
53,079 | palantus/mscp-browserlibs | www/js/jquery.longpress.js | mouseup_callback | function mouseup_callback(e) {
var press_time = new Date().getTime() - mouse_down_time;
if (press_time < duration) {
// cancel the timeout
clearTimeout(timeout);
// call the shortCallback if provided
if (typ... | javascript | function mouseup_callback(e) {
var press_time = new Date().getTime() - mouse_down_time;
if (press_time < duration) {
// cancel the timeout
clearTimeout(timeout);
// call the shortCallback if provided
if (typ... | [
"function",
"mouseup_callback",
"(",
"e",
")",
"{",
"var",
"press_time",
"=",
"new",
"Date",
"(",
")",
".",
"getTime",
"(",
")",
"-",
"mouse_down_time",
";",
"if",
"(",
"press_time",
"<",
"duration",
")",
"{",
"// cancel the timeout",
"clearTimeout",
"(",
... | mouseup or touchend callback | [
"mouseup",
"or",
"touchend",
"callback"
] | d8344639697e137af767d04b5111120890579556 | https://github.com/palantus/mscp-browserlibs/blob/d8344639697e137af767d04b5111120890579556/www/js/jquery.longpress.js#L46-L61 |
53,080 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/modules/treemap.src.js | function () {
var series = this,
points = series.points,
options,
level,
dataLabelsGroup = this.dataLabelsGroup,
dataLabels;
each(points, function (point) {
if (point.node.isVisible) {
level = series.levelMap[point.level];
if (!point.isLeaf || level) {
options = undefined;
... | javascript | function () {
var series = this,
points = series.points,
options,
level,
dataLabelsGroup = this.dataLabelsGroup,
dataLabels;
each(points, function (point) {
if (point.node.isVisible) {
level = series.levelMap[point.level];
if (!point.isLeaf || level) {
options = undefined;
... | [
"function",
"(",
")",
"{",
"var",
"series",
"=",
"this",
",",
"points",
"=",
"series",
".",
"points",
",",
"options",
",",
"level",
",",
"dataLabelsGroup",
"=",
"this",
".",
"dataLabelsGroup",
",",
"dataLabels",
";",
"each",
"(",
"points",
",",
"function... | Extend drawDataLabels with logic to handle the levels option | [
"Extend",
"drawDataLabels",
"with",
"logic",
"to",
"handle",
"the",
"levels",
"option"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/modules/treemap.src.js#L567-L600 | |
53,081 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/modules/treemap.src.js | function () {
var series = this,
points = series.points,
seriesOptions = series.options,
attr,
hover,
level;
each(points, function (point) {
if (point.node.isVisible) {
level = series.levelMap[point.level];
attr = {
stroke: seriesOptions.borderColor,
'stroke-width': s... | javascript | function () {
var series = this,
points = series.points,
seriesOptions = series.options,
attr,
hover,
level;
each(points, function (point) {
if (point.node.isVisible) {
level = series.levelMap[point.level];
attr = {
stroke: seriesOptions.borderColor,
'stroke-width': s... | [
"function",
"(",
")",
"{",
"var",
"series",
"=",
"this",
",",
"points",
"=",
"series",
".",
"points",
",",
"seriesOptions",
"=",
"series",
".",
"options",
",",
"attr",
",",
"hover",
",",
"level",
";",
"each",
"(",
"points",
",",
"function",
"(",
"poi... | Extending ColumnSeries drawPoints | [
"Extending",
"ColumnSeries",
"drawPoints"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/modules/treemap.src.js#L605-L674 | |
53,082 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/modules/treemap.src.js | function () {
var series = this,
points = series.points;
each(points, function (point) {
var drillId,
drillName;
if (point.node.isVisible) {
H.removeEvent(point, 'click');
if (point.graphic) {
point.graphic.css({ cursor: 'default' });
}
// Get the drill to id
if (s... | javascript | function () {
var series = this,
points = series.points;
each(points, function (point) {
var drillId,
drillName;
if (point.node.isVisible) {
H.removeEvent(point, 'click');
if (point.graphic) {
point.graphic.css({ cursor: 'default' });
}
// Get the drill to id
if (s... | [
"function",
"(",
")",
"{",
"var",
"series",
"=",
"this",
",",
"points",
"=",
"series",
".",
"points",
";",
"each",
"(",
"points",
",",
"function",
"(",
"point",
")",
"{",
"var",
"drillId",
",",
"drillName",
";",
"if",
"(",
"point",
".",
"node",
"."... | Add drilling on the suitable points | [
"Add",
"drilling",
"on",
"the",
"suitable",
"points"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/modules/treemap.src.js#L678-L711 | |
53,083 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/modules/treemap.src.js | function (point) {
var series = this,
drillId = false;
if ((point.node.level - series.nodeMap[series.rootNode].level) === 1 && !point.isLeaf) {
drillId = point.id;
}
return drillId;
} | javascript | function (point) {
var series = this,
drillId = false;
if ((point.node.level - series.nodeMap[series.rootNode].level) === 1 && !point.isLeaf) {
drillId = point.id;
}
return drillId;
} | [
"function",
"(",
"point",
")",
"{",
"var",
"series",
"=",
"this",
",",
"drillId",
"=",
"false",
";",
"if",
"(",
"(",
"point",
".",
"node",
".",
"level",
"-",
"series",
".",
"nodeMap",
"[",
"series",
".",
"rootNode",
"]",
".",
"level",
")",
"===",
... | Finds the drill id for a parent node.
Returns false if point should not have a click event
@param {Object} point
@return {string || boolean} Drill to id or false when point should not have a click event | [
"Finds",
"the",
"drill",
"id",
"for",
"a",
"parent",
"node",
".",
"Returns",
"false",
"if",
"point",
"should",
"not",
"have",
"a",
"click",
"event"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/modules/treemap.src.js#L718-L725 | |
53,084 | MakerCollider/node-red-contrib-smartnode-hook | html/scripts/highchart/modules/treemap.src.js | function (point) {
var series = this,
drillId = false,
nodeParent;
if ((point.node.parent !== series.rootNode) && (point.isLeaf)) {
nodeParent = point.node;
while (!drillId) {
nodeParent = series.nodeMap[nodeParent.parent];
if (nodeParent.parent === series.rootNode) {
drillId = nod... | javascript | function (point) {
var series = this,
drillId = false,
nodeParent;
if ((point.node.parent !== series.rootNode) && (point.isLeaf)) {
nodeParent = point.node;
while (!drillId) {
nodeParent = series.nodeMap[nodeParent.parent];
if (nodeParent.parent === series.rootNode) {
drillId = nod... | [
"function",
"(",
"point",
")",
"{",
"var",
"series",
"=",
"this",
",",
"drillId",
"=",
"false",
",",
"nodeParent",
";",
"if",
"(",
"(",
"point",
".",
"node",
".",
"parent",
"!==",
"series",
".",
"rootNode",
")",
"&&",
"(",
"point",
".",
"isLeaf",
"... | Finds the drill id for a leaf node.
Returns false if point should not have a click event
@param {Object} point
@return {string || boolean} Drill to id or false when point should not have a click event | [
"Finds",
"the",
"drill",
"id",
"for",
"a",
"leaf",
"node",
".",
"Returns",
"false",
"if",
"point",
"should",
"not",
"have",
"a",
"click",
"event"
] | 245c267e832968bad880ca009929043e82c7bc25 | https://github.com/MakerCollider/node-red-contrib-smartnode-hook/blob/245c267e832968bad880ca009929043e82c7bc25/html/scripts/highchart/modules/treemap.src.js#L732-L746 | |
53,085 | wunderbyte/grunt-spiritual-edbml | tasks/things/formatter.js | simplified | function simplified(js) {
var is = false;
var go = false;
var here = 'out.html += '; // hardcoced
var gone = ' '; // hardcoded to equal length
var fixes = [];
var lines = js.split('\n').map(function(line, index) {
go = line.trim().startsWith(here);
if (is && go) {
line = line.replace(here, gone)... | javascript | function simplified(js) {
var is = false;
var go = false;
var here = 'out.html += '; // hardcoced
var gone = ' '; // hardcoded to equal length
var fixes = [];
var lines = js.split('\n').map(function(line, index) {
go = line.trim().startsWith(here);
if (is && go) {
line = line.replace(here, gone)... | [
"function",
"simplified",
"(",
"js",
")",
"{",
"var",
"is",
"=",
"false",
";",
"var",
"go",
"=",
"false",
";",
"var",
"here",
"=",
"'out.html += '",
";",
"// hardcoced",
"var",
"gone",
"=",
"' '",
";",
"// hardcoded to equal length",
"var",
"fixes... | Substiture repeated lines of `out.html +=` with simple
`+` concatenation. Watch out for hardcoded strings here.
@param {string} js
@returns {string} | [
"Substiture",
"repeated",
"lines",
"of",
"out",
".",
"html",
"+",
"=",
"with",
"simple",
"+",
"concatenation",
".",
"Watch",
"out",
"for",
"hardcoded",
"strings",
"here",
"."
] | 2ba0aa8042eceee917f1ee48c7881345df3bce46 | https://github.com/wunderbyte/grunt-spiritual-edbml/blob/2ba0aa8042eceee917f1ee48c7881345df3bce46/tasks/things/formatter.js#L76-L98 |
53,086 | ashleydavis/routey | route_init.js | function (params) {
//
// Close the route once it has been handled.
//
var closeRoute = function () {
that._closeRoute(dir, req, res, params);
};
var async = new Async(closeRoute);
routeConfig.handler(req, res, params, async);
if (!async.started()) {
// No async operation was started.... | javascript | function (params) {
//
// Close the route once it has been handled.
//
var closeRoute = function () {
that._closeRoute(dir, req, res, params);
};
var async = new Async(closeRoute);
routeConfig.handler(req, res, params, async);
if (!async.started()) {
// No async operation was started.... | [
"function",
"(",
"params",
")",
"{",
"// ",
"// Close the route once it has been handled.",
"//",
"var",
"closeRoute",
"=",
"function",
"(",
")",
"{",
"that",
".",
"_closeRoute",
"(",
"dir",
",",
"req",
",",
"res",
",",
"params",
")",
";",
"}",
";",
"var",... | When the route has been opened, invoke the route handler. | [
"When",
"the",
"route",
"has",
"been",
"opened",
"invoke",
"the",
"route",
"handler",
"."
] | dd5e797603f6f0b584d6712165e9b73c7d8efc78 | https://github.com/ashleydavis/routey/blob/dd5e797603f6f0b584d6712165e9b73c7d8efc78/route_init.js#L158-L174 | |
53,087 | semantic-math/math-traverse | lib/replace.js | replace | function replace(node, {enter, leave}) {
let rep = (enter && enter(node)) || node
switch (rep.type) {
// regular non-leaf nodes
case 'Apply':
for (let i = 0; i < rep.args.length; i++) {
const arg = rep.args[i]
rep.args[i] = replace(arg, {enter, leave}... | javascript | function replace(node, {enter, leave}) {
let rep = (enter && enter(node)) || node
switch (rep.type) {
// regular non-leaf nodes
case 'Apply':
for (let i = 0; i < rep.args.length; i++) {
const arg = rep.args[i]
rep.args[i] = replace(arg, {enter, leave}... | [
"function",
"replace",
"(",
"node",
",",
"{",
"enter",
",",
"leave",
"}",
")",
"{",
"let",
"rep",
"=",
"(",
"enter",
"&&",
"enter",
"(",
"node",
")",
")",
"||",
"node",
"switch",
"(",
"rep",
".",
"type",
")",
"{",
"// regular non-leaf nodes",
"case",... | replace - visit all nodes in the tree with the ability to replace them.
This function may modify the node passed in and/or any of its descendants.
If neither 'enter' nor 'leave' return a value, the node is unchanged.
If 'enter' returns a new node, the children of the new node will be traversed
instead of the old one.... | [
"replace",
"-",
"visit",
"all",
"nodes",
"in",
"the",
"tree",
"with",
"the",
"ability",
"to",
"replace",
"them",
"."
] | 251430b4a984200fb1b3fd373fde2da50a78830c | https://github.com/semantic-math/math-traverse/blob/251430b4a984200fb1b3fd373fde2da50a78830c/lib/replace.js#L12-L61 |
53,088 | ottojs/otto-errors | lib/bad_request.error.js | ErrorBadRequest | function ErrorBadRequest (message) {
Error.call(this);
// Add Information
this.name = 'ErrorBadRequest';
this.type = 'client';
this.status = 400;
if (message) {
this.message = message;
}
} | javascript | function ErrorBadRequest (message) {
Error.call(this);
// Add Information
this.name = 'ErrorBadRequest';
this.type = 'client';
this.status = 400;
if (message) {
this.message = message;
}
} | [
"function",
"ErrorBadRequest",
"(",
"message",
")",
"{",
"Error",
".",
"call",
"(",
"this",
")",
";",
"// Add Information",
"this",
".",
"name",
"=",
"'ErrorBadRequest'",
";",
"this",
".",
"type",
"=",
"'client'",
";",
"this",
".",
"status",
"=",
"400",
... | Error - ErrorBadRequest | [
"Error",
"-",
"ErrorBadRequest"
] | a3c6d98fd5d35ce3c136ed7e1edd2f800af268d9 | https://github.com/ottojs/otto-errors/blob/a3c6d98fd5d35ce3c136ed7e1edd2f800af268d9/lib/bad_request.error.js#L8-L20 |
53,089 | Objectway/bower-rhodecode-resolver | index.js | function (source) {
packageUrl = source;
if (source && source.indexOf(bower.config.rhodecode.repo) != -1) {
return true;
}
return Q.nfcall(registryClient.lookup.bind(registryClient), source)
.then(function (entry) {
i... | javascript | function (source) {
packageUrl = source;
if (source && source.indexOf(bower.config.rhodecode.repo) != -1) {
return true;
}
return Q.nfcall(registryClient.lookup.bind(registryClient), source)
.then(function (entry) {
i... | [
"function",
"(",
"source",
")",
"{",
"packageUrl",
"=",
"source",
";",
"if",
"(",
"source",
"&&",
"source",
".",
"indexOf",
"(",
"bower",
".",
"config",
".",
"rhodecode",
".",
"repo",
")",
"!=",
"-",
"1",
")",
"{",
"return",
"true",
";",
"}",
"retu... | Match method tells whether resolver supports given source It can return either boolean or promise of boolean | [
"Match",
"method",
"tells",
"whether",
"resolver",
"supports",
"given",
"source",
"It",
"can",
"return",
"either",
"boolean",
"or",
"promise",
"of",
"boolean"
] | b5e563c7aecc2b45bf904785a714a110769109cb | https://github.com/Objectway/bower-rhodecode-resolver/blob/b5e563c7aecc2b45bf904785a714a110769109cb/index.js#L32-L50 | |
53,090 | Objectway/bower-rhodecode-resolver | index.js | function (endpoint) {
var deferred = Q.defer(),
tmpDir = tmp.dirSync().name,
target = endpoint.target == '*' ? 'tip' : endpoint.target,
url = endpoint.source + '/archive/' + target + '.zip?auth_token=' + bower.config.rhodecode.token,
filePath =... | javascript | function (endpoint) {
var deferred = Q.defer(),
tmpDir = tmp.dirSync().name,
target = endpoint.target == '*' ? 'tip' : endpoint.target,
url = endpoint.source + '/archive/' + target + '.zip?auth_token=' + bower.config.rhodecode.token,
filePath =... | [
"function",
"(",
"endpoint",
")",
"{",
"var",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
",",
"tmpDir",
"=",
"tmp",
".",
"dirSync",
"(",
")",
".",
"name",
",",
"target",
"=",
"endpoint",
".",
"target",
"==",
"'*'",
"?",
"'tip'",
":",
"endpoint",... | It downloads package and extracts it to temporary directory You can use npm's "tmp" package to tmp directories See the "Resolver API" section for details on this method | [
"It",
"downloads",
"package",
"and",
"extracts",
"it",
"to",
"temporary",
"directory",
"You",
"can",
"use",
"npm",
"s",
"tmp",
"package",
"to",
"tmp",
"directories",
"See",
"the",
"Resolver",
"API",
"section",
"for",
"details",
"on",
"this",
"method"
] | b5e563c7aecc2b45bf904785a714a110769109cb | https://github.com/Objectway/bower-rhodecode-resolver/blob/b5e563c7aecc2b45bf904785a714a110769109cb/index.js#L96-L150 | |
53,091 | polo2ro/restitute | src/service.js | listItemsService | function listItemsService(app) {
apiService.call(this);
this.setApp(app);
var service = this;
/**
* Default function used to resolve a result set
*
* @param {Error} err mongoose error
* @param {Array} docs an array of mongoose documents or an array of objects
*/
this.... | javascript | function listItemsService(app) {
apiService.call(this);
this.setApp(app);
var service = this;
/**
* Default function used to resolve a result set
*
* @param {Error} err mongoose error
* @param {Array} docs an array of mongoose documents or an array of objects
*/
this.... | [
"function",
"listItemsService",
"(",
"app",
")",
"{",
"apiService",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"setApp",
"(",
"app",
")",
";",
"var",
"service",
"=",
"this",
";",
"/**\n * Default function used to resolve a result set\n *\n * @param... | Service to get a list of items
output a resultset | [
"Service",
"to",
"get",
"a",
"list",
"of",
"items",
"output",
"a",
"resultset"
] | 532f10b01469f76b8a60f5be624ebf562ebfcf55 | https://github.com/polo2ro/restitute/blob/532f10b01469f76b8a60f5be624ebf562ebfcf55/src/service.js#L333-L400 |
53,092 | derdesign/protos | middleware/logger/transport-redis.js | initRedis | function initRedis(config, callback) {
var self = this;
protos.util.checkLocalPort(config.port, function(err) {
if (err) {
app.log("RedisTransport [%s:%s] %s", config.host, config.port, err.code);
} else {
// Set redis client
self.client = redis.createClient(config.port, config.host, s... | javascript | function initRedis(config, callback) {
var self = this;
protos.util.checkLocalPort(config.port, function(err) {
if (err) {
app.log("RedisTransport [%s:%s] %s", config.host, config.port, err.code);
} else {
// Set redis client
self.client = redis.createClient(config.port, config.host, s... | [
"function",
"initRedis",
"(",
"config",
",",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
";",
"protos",
".",
"util",
".",
"checkLocalPort",
"(",
"config",
".",
"port",
",",
"function",
"(",
"err",
")",
"{",
"if",
"(",
"err",
")",
"{",
"app",
... | Initializes the redis client
@param {object} config
@param {function} callback
@private | [
"Initializes",
"the",
"redis",
"client"
] | 0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9 | https://github.com/derdesign/protos/blob/0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9/middleware/logger/transport-redis.js#L124-L167 |
53,093 | tjmehta/mongooseware | lib/method-lists/list-instance-methods.js | listInstanceMethods | function listInstanceMethods (Model) {
var classMethods = Object.keys(Model.schema.methods);
for (var method in ModelPrototype) {
if (!isPrivateMethod(method) && isFunction(ModelPrototype[method])) {
classMethods.push(method);
}
}
return classMethods;
} | javascript | function listInstanceMethods (Model) {
var classMethods = Object.keys(Model.schema.methods);
for (var method in ModelPrototype) {
if (!isPrivateMethod(method) && isFunction(ModelPrototype[method])) {
classMethods.push(method);
}
}
return classMethods;
} | [
"function",
"listInstanceMethods",
"(",
"Model",
")",
"{",
"var",
"classMethods",
"=",
"Object",
".",
"keys",
"(",
"Model",
".",
"schema",
".",
"methods",
")",
";",
"for",
"(",
"var",
"method",
"in",
"ModelPrototype",
")",
"{",
"if",
"(",
"!",
"isPrivate... | Return list of all instance methods when supplied a Model constructor
@param {Object} Model
@return {Array} | [
"Return",
"list",
"of",
"all",
"instance",
"methods",
"when",
"supplied",
"a",
"Model",
"constructor"
] | c62ce0bac82880826b3528231e08f5e5b3efdb83 | https://github.com/tjmehta/mongooseware/blob/c62ce0bac82880826b3528231e08f5e5b3efdb83/lib/method-lists/list-instance-methods.js#L19-L27 |
53,094 | BlueSilverCat/bsc-utilities | lib/utility.js | circulationSearch | function circulationSearch(array, current, direction, func) {
let start = 0;
let end = array.length - 1;
if (direction === -1) {
start = array.length - 1;
end = 0;
}
for (let i = current; i * direction <= end * direction; i += direction) {
if (func(array[i])) {
return i;
}
}
for (le... | javascript | function circulationSearch(array, current, direction, func) {
let start = 0;
let end = array.length - 1;
if (direction === -1) {
start = array.length - 1;
end = 0;
}
for (let i = current; i * direction <= end * direction; i += direction) {
if (func(array[i])) {
return i;
}
}
for (le... | [
"function",
"circulationSearch",
"(",
"array",
",",
"current",
",",
"direction",
",",
"func",
")",
"{",
"let",
"start",
"=",
"0",
";",
"let",
"end",
"=",
"array",
".",
"length",
"-",
"1",
";",
"if",
"(",
"direction",
"===",
"-",
"1",
")",
"{",
"sta... | direction 1, -1 need test | [
"direction",
"1",
"-",
"1",
"need",
"test"
] | 51315321b9a260987689c50cf8acfb53eb758c7a | https://github.com/BlueSilverCat/bsc-utilities/blob/51315321b9a260987689c50cf8acfb53eb758c7a/lib/utility.js#L377-L397 |
53,095 | redisjs/jsr-server | lib/command/database/zset/zincrby.js | execute | function execute(req, res) {
// store returns a number but we need to send
// a bulk string reply
var reply = req.exec.proxy(req, res);
res.send(null, '' + reply);
} | javascript | function execute(req, res) {
// store returns a number but we need to send
// a bulk string reply
var reply = req.exec.proxy(req, res);
res.send(null, '' + reply);
} | [
"function",
"execute",
"(",
"req",
",",
"res",
")",
"{",
"// store returns a number but we need to send",
"// a bulk string reply",
"var",
"reply",
"=",
"req",
".",
"exec",
".",
"proxy",
"(",
"req",
",",
"res",
")",
";",
"res",
".",
"send",
"(",
"null",
",",... | Respond to the ZINCRBY command. | [
"Respond",
"to",
"the",
"ZINCRBY",
"command",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/database/zset/zincrby.js#L17-L22 |
53,096 | bucharest-gold/unifiedpush-admin-client | lib/applications.js | find | function find (client) {
return function find (pushAppId) {
const req = {
url: pushAppId ? `${client.baseUrl}/rest/applications/${pushAppId}` : `${client.baseUrl}/rest/applications/`
};
return request(client, req)
.then((response) => {
if (response.resp.statusCode !== 200) {
... | javascript | function find (client) {
return function find (pushAppId) {
const req = {
url: pushAppId ? `${client.baseUrl}/rest/applications/${pushAppId}` : `${client.baseUrl}/rest/applications/`
};
return request(client, req)
.then((response) => {
if (response.resp.statusCode !== 200) {
... | [
"function",
"find",
"(",
"client",
")",
"{",
"return",
"function",
"find",
"(",
"pushAppId",
")",
"{",
"const",
"req",
"=",
"{",
"url",
":",
"pushAppId",
"?",
"`",
"${",
"client",
".",
"baseUrl",
"}",
"${",
"pushAppId",
"}",
"`",
":",
"`",
"${",
"c... | A function to get all the push applications or just 1 push application
@param {string} [pushAppId] - The id of the push application
@returns {Promise} A promise that will resolve with the Array of application objects or if a pushAppId is specified, just the application object
@example
adminClient(baseUrl, settings)
.th... | [
"A",
"function",
"to",
"get",
"all",
"the",
"push",
"applications",
"or",
"just",
"1",
"push",
"application"
] | a39c98c9a383d7f87cb5cbbc25c4371ea1ad049e | https://github.com/bucharest-gold/unifiedpush-admin-client/blob/a39c98c9a383d7f87cb5cbbc25c4371ea1ad049e/lib/applications.js#L32-L47 |
53,097 | bucharest-gold/unifiedpush-admin-client | lib/applications.js | update | function update (client) {
return function update (pushApp) {
const req = {
url: `${client.baseUrl}/rest/applications/${pushApp.pushApplicationID}`,
body: pushApp,
method: 'PUT'
};
return request(client, req)
.then((response) => {
if (response.resp.statusCode !== 204) {
... | javascript | function update (client) {
return function update (pushApp) {
const req = {
url: `${client.baseUrl}/rest/applications/${pushApp.pushApplicationID}`,
body: pushApp,
method: 'PUT'
};
return request(client, req)
.then((response) => {
if (response.resp.statusCode !== 204) {
... | [
"function",
"update",
"(",
"client",
")",
"{",
"return",
"function",
"update",
"(",
"pushApp",
")",
"{",
"const",
"req",
"=",
"{",
"url",
":",
"`",
"${",
"client",
".",
"baseUrl",
"}",
"${",
"pushApp",
".",
"pushApplicationID",
"}",
"`",
",",
"body",
... | A function to update an existing Push Application
@param {object} pushApp - The JSON representation of the push application to update. pushApp.pushApplicationID and pushApp.name is required. ATM, it looks like the only fields that are updatable are name and description
@returns {Promise} A promise that resolves with N... | [
"A",
"function",
"to",
"update",
"an",
"existing",
"Push",
"Application"
] | a39c98c9a383d7f87cb5cbbc25c4371ea1ad049e | https://github.com/bucharest-gold/unifiedpush-admin-client/blob/a39c98c9a383d7f87cb5cbbc25c4371ea1ad049e/lib/applications.js#L94-L111 |
53,098 | bucharest-gold/unifiedpush-admin-client | lib/applications.js | bootstrap | function bootstrap (client) {
return function bootstrap (pushApp) {
const req = {
url: `${client.baseUrl}/rest/applications/bootstrap`,
method: 'POST'
};
const data = pushApp;
// If they send in a string, then lets assume that is the location of the cert file
// Otherwise, we will as... | javascript | function bootstrap (client) {
return function bootstrap (pushApp) {
const req = {
url: `${client.baseUrl}/rest/applications/bootstrap`,
method: 'POST'
};
const data = pushApp;
// If they send in a string, then lets assume that is the location of the cert file
// Otherwise, we will as... | [
"function",
"bootstrap",
"(",
"client",
")",
"{",
"return",
"function",
"bootstrap",
"(",
"pushApp",
")",
"{",
"const",
"req",
"=",
"{",
"url",
":",
"`",
"${",
"client",
".",
"baseUrl",
"}",
"`",
",",
"method",
":",
"'POST'",
"}",
";",
"const",
"data... | A Convenience function to create a complete Push Application with a set of variants
@param {object} pushApp - The push application object
@param {string} pushApp.pushApplicationName - The name of the Push Application
@param {string} [pushApp.androidVariantName] - Android Variant Name
@param {string} [pushApp.androidGoo... | [
"A",
"Convenience",
"function",
"to",
"create",
"a",
"complete",
"Push",
"Application",
"with",
"a",
"set",
"of",
"variants"
] | a39c98c9a383d7f87cb5cbbc25c4371ea1ad049e | https://github.com/bucharest-gold/unifiedpush-admin-client/blob/a39c98c9a383d7f87cb5cbbc25c4371ea1ad049e/lib/applications.js#L204-L234 |
53,099 | API-Load-Testing/http-request-hook | http-request-hook.js | function () {
var res = arguments[0];
userOptions.emit('response', req, res);
if (callback && userOptions.resCallback) callback.apply(this, arguments);
res.on('end', function() {
userOptions.emit('afterResponse', req, res);
});
} | javascript | function () {
var res = arguments[0];
userOptions.emit('response', req, res);
if (callback && userOptions.resCallback) callback.apply(this, arguments);
res.on('end', function() {
userOptions.emit('afterResponse', req, res);
});
} | [
"function",
"(",
")",
"{",
"var",
"res",
"=",
"arguments",
"[",
"0",
"]",
";",
"userOptions",
".",
"emit",
"(",
"'response'",
",",
"req",
",",
"res",
")",
";",
"if",
"(",
"callback",
"&&",
"userOptions",
".",
"resCallback",
")",
"callback",
".",
"app... | Create the callback function for response | [
"Create",
"the",
"callback",
"function",
"for",
"response"
] | 660c115f298613fc1556d6a40ac78f1c2c322fa4 | https://github.com/API-Load-Testing/http-request-hook/blob/660c115f298613fc1556d6a40ac78f1c2c322fa4/http-request-hook.js#L124-L136 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.