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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
34,800 | posthtml/posthtml-postcss-modules | index.js | processContentWithPostCSS | function processContentWithPostCSS(options, href) {
/**
* @param {String} content [css to process]
* @return {Object} [object with css tokens and css itself]
*/
return function (content) {
if (options.generateScopedName) {
options.generateScopedName = typeof options.generateScopedName === 'functio... | javascript | function processContentWithPostCSS(options, href) {
/**
* @param {String} content [css to process]
* @return {Object} [object with css tokens and css itself]
*/
return function (content) {
if (options.generateScopedName) {
options.generateScopedName = typeof options.generateScopedName === 'functio... | [
"function",
"processContentWithPostCSS",
"(",
"options",
",",
"href",
")",
"{",
"/**\n\t * @param {String} content [css to process]\n\t * @return {Object} [object with css tokens and css itself]\n\t */",
"return",
"function",
"(",
"content",
")",
"{",
"if",
"(",
"options",... | processes css with css-modules plugins
@param {Object} options [plugin's options]
@return {Function} | [
"processes",
"css",
"with",
"css",
"-",
"modules",
"plugins"
] | f524f87cb8e1a478cdc4ae35a0c150e91b855547 | https://github.com/posthtml/posthtml-postcss-modules/blob/f524f87cb8e1a478cdc4ae35a0c150e91b855547/index.js#L50-L97 |
34,801 | TomFrost/node-phonetic | lib/phonetic.js | getDerivative | function getDerivative(num) {
var derivative = 1;
while (num != 0) {
derivative += num % 7;
num = Math.floor(num / 7);
}
return derivative;
} | javascript | function getDerivative(num) {
var derivative = 1;
while (num != 0) {
derivative += num % 7;
num = Math.floor(num / 7);
}
return derivative;
} | [
"function",
"getDerivative",
"(",
"num",
")",
"{",
"var",
"derivative",
"=",
"1",
";",
"while",
"(",
"num",
"!=",
"0",
")",
"{",
"derivative",
"+=",
"num",
"%",
"7",
";",
"num",
"=",
"Math",
".",
"floor",
"(",
"num",
"/",
"7",
")",
";",
"}",
"r... | Gets a derivative of a number by repeatedly dividing it by 7 and adding the
remainders together. It's useful to base decisions on a derivative rather
than the wordObj's current numeric, as it avoids making the same decisions
around the same phonetics.
@param {number} num A number from which a derivative should be cal... | [
"Gets",
"a",
"derivative",
"of",
"a",
"number",
"by",
"repeatedly",
"dividing",
"it",
"by",
"7",
"and",
"adding",
"the",
"remainders",
"together",
".",
"It",
"s",
"useful",
"to",
"base",
"decisions",
"on",
"a",
"derivative",
"rather",
"than",
"the",
"wordO... | bd67e91664210b04087c536ebc3831e4cceafb0a | https://github.com/TomFrost/node-phonetic/blob/bd67e91664210b04087c536ebc3831e4cceafb0a/lib/phonetic.js#L146-L153 |
34,802 | TomFrost/node-phonetic | lib/phonetic.js | getNextPhonetic | function getNextPhonetic(phoneticSet, simpleCap, wordObj, forceSimple) {
var deriv = getDerivative(wordObj.numeric),
simple = (wordObj.numeric + deriv) % wordObj.opts.phoneticSimplicity > 0,
cap = simple || forceSimple ? simpleCap : phoneticSet.length,
phonetic = phoneticSet[wordObj.numeric % cap];
wordObj.nume... | javascript | function getNextPhonetic(phoneticSet, simpleCap, wordObj, forceSimple) {
var deriv = getDerivative(wordObj.numeric),
simple = (wordObj.numeric + deriv) % wordObj.opts.phoneticSimplicity > 0,
cap = simple || forceSimple ? simpleCap : phoneticSet.length,
phonetic = phoneticSet[wordObj.numeric % cap];
wordObj.nume... | [
"function",
"getNextPhonetic",
"(",
"phoneticSet",
",",
"simpleCap",
",",
"wordObj",
",",
"forceSimple",
")",
"{",
"var",
"deriv",
"=",
"getDerivative",
"(",
"wordObj",
".",
"numeric",
")",
",",
"simple",
"=",
"(",
"wordObj",
".",
"numeric",
"+",
"deriv",
... | Gets the next pseudo-random phonetic from a given phonetic set,
intelligently determining whether to include "complex" phonetics in that
set based on the options.phoneticSimplicity.
@param {Array} phoneticSet The array of phonetics from which to choose
@param {number} simpleCap The number of 'simple' phonetics at the ... | [
"Gets",
"the",
"next",
"pseudo",
"-",
"random",
"phonetic",
"from",
"a",
"given",
"phonetic",
"set",
"intelligently",
"determining",
"whether",
"to",
"include",
"complex",
"phonetics",
"in",
"that",
"set",
"based",
"on",
"the",
"options",
".",
"phoneticSimplicit... | bd67e91664210b04087c536ebc3831e4cceafb0a | https://github.com/TomFrost/node-phonetic/blob/bd67e91664210b04087c536ebc3831e4cceafb0a/lib/phonetic.js#L206-L213 |
34,803 | TomFrost/node-phonetic | lib/phonetic.js | getNumericHash | function getNumericHash(data) {
var hash = crypto.createHash('md5'),
numeric = 0,
buf;
hash.update(data + '-Phonetic');
buf = hash.digest();
for (var i = 0; i <= 12; i += 4)
numeric += buf.readUInt32LE(i);
return numeric;
} | javascript | function getNumericHash(data) {
var hash = crypto.createHash('md5'),
numeric = 0,
buf;
hash.update(data + '-Phonetic');
buf = hash.digest();
for (var i = 0; i <= 12; i += 4)
numeric += buf.readUInt32LE(i);
return numeric;
} | [
"function",
"getNumericHash",
"(",
"data",
")",
"{",
"var",
"hash",
"=",
"crypto",
".",
"createHash",
"(",
"'md5'",
")",
",",
"numeric",
"=",
"0",
",",
"buf",
";",
"hash",
".",
"update",
"(",
"data",
"+",
"'-Phonetic'",
")",
";",
"buf",
"=",
"hash",
... | Generates a numeric hash based on the input data. The hash is an md5, with
each block of 32 bits converted to an integer and added together.
@param {string|number} data The string or number to be hashed.
@returns {number} | [
"Generates",
"a",
"numeric",
"hash",
"based",
"on",
"the",
"input",
"data",
".",
"The",
"hash",
"is",
"an",
"md5",
"with",
"each",
"block",
"of",
"32",
"bits",
"converted",
"to",
"an",
"integer",
"and",
"added",
"together",
"."
] | bd67e91664210b04087c536ebc3831e4cceafb0a | https://github.com/TomFrost/node-phonetic/blob/bd67e91664210b04087c536ebc3831e4cceafb0a/lib/phonetic.js#L222-L231 |
34,804 | TomFrost/node-phonetic | lib/phonetic.js | postProcess | function postProcess(wordObj) {
var regex;
for (var i in REPLACEMENTS) {
if (REPLACEMENTS.hasOwnProperty(i)) {
regex = new RegExp(i);
wordObj.word = wordObj.word.replace(regex, REPLACEMENTS[i]);
}
}
if (wordObj.opts.capFirst)
return capFirst(wordObj.word);
return wordObj.word;
} | javascript | function postProcess(wordObj) {
var regex;
for (var i in REPLACEMENTS) {
if (REPLACEMENTS.hasOwnProperty(i)) {
regex = new RegExp(i);
wordObj.word = wordObj.word.replace(regex, REPLACEMENTS[i]);
}
}
if (wordObj.opts.capFirst)
return capFirst(wordObj.word);
return wordObj.word;
} | [
"function",
"postProcess",
"(",
"wordObj",
")",
"{",
"var",
"regex",
";",
"for",
"(",
"var",
"i",
"in",
"REPLACEMENTS",
")",
"{",
"if",
"(",
"REPLACEMENTS",
".",
"hasOwnProperty",
"(",
"i",
")",
")",
"{",
"regex",
"=",
"new",
"RegExp",
"(",
"i",
")",... | Applies post-processing to a word after it has already been generated. In
this phase, the REPLACEMENTS are executed, applying language intelligence
that can make generated words more pronounceable. The first letter is
also capitalized.
@param {{word, numeric, lastSkippedPre, lastSkippedPost, opts}} wordObj The
word ... | [
"Applies",
"post",
"-",
"processing",
"to",
"a",
"word",
"after",
"it",
"has",
"already",
"been",
"generated",
".",
"In",
"this",
"phase",
"the",
"REPLACEMENTS",
"are",
"executed",
"applying",
"language",
"intelligence",
"that",
"can",
"make",
"generated",
"wo... | bd67e91664210b04087c536ebc3831e4cceafb0a | https://github.com/TomFrost/node-phonetic/blob/bd67e91664210b04087c536ebc3831e4cceafb0a/lib/phonetic.js#L243-L254 |
34,805 | amida-tech/blue-button-generate | lib/sectionLevel2.js | function (input) {
var value = bbuo.deepValue(input, 'product.product.name');
if (!bbuo.exists(value)) {
value = bbuo.deepValue(input, 'product.unencoded_name');
}
if (!bbuo.exists(value)) {
return "";
} else {
return value;
}
} | javascript | function (input) {
var value = bbuo.deepValue(input, 'product.product.name');
if (!bbuo.exists(value)) {
value = bbuo.deepValue(input, 'product.unencoded_name');
}
if (!bbuo.exists(value)) {
return "";
} else {
return value;
}
} | [
"function",
"(",
"input",
")",
"{",
"var",
"value",
"=",
"bbuo",
".",
"deepValue",
"(",
"input",
",",
"'product.product.name'",
")",
";",
"if",
"(",
"!",
"bbuo",
".",
"exists",
"(",
"value",
")",
")",
"{",
"value",
"=",
"bbuo",
".",
"deepValue",
"(",... | Name, did not find class in the medication blue-button-data | [
"Name",
"did",
"not",
"find",
"class",
"in",
"the",
"medication",
"blue",
"-",
"button",
"-",
"data"
] | 20515d9ac03384bac7197dca0df7d43523c8c3df | https://github.com/amida-tech/blue-button-generate/blob/20515d9ac03384bac7197dca0df7d43523c8c3df/lib/sectionLevel2.js#L113-L123 | |
34,806 | sheebz/phantom-proxy | lib/webpage.js | function (propertyName, callbackFn) {
var self = this;
request.post(this.options.hostAndPort + '/page/properties/get', {form:{ propertyName:propertyName}},
function (error, response, body) {
error && console.error(error);
... | javascript | function (propertyName, callbackFn) {
var self = this;
request.post(this.options.hostAndPort + '/page/properties/get', {form:{ propertyName:propertyName}},
function (error, response, body) {
error && console.error(error);
... | [
"function",
"(",
"propertyName",
",",
"callbackFn",
")",
"{",
"var",
"self",
"=",
"this",
";",
"request",
".",
"post",
"(",
"this",
".",
"options",
".",
"hostAndPort",
"+",
"'/page/properties/get'",
",",
"{",
"form",
":",
"{",
"propertyName",
":",
"propert... | gets property value ex. version | [
"gets",
"property",
"value",
"ex",
".",
"version"
] | a4963662205400e542668938ce5cf1ab9a66fba0 | https://github.com/sheebz/phantom-proxy/blob/a4963662205400e542668938ce5cf1ab9a66fba0/lib/webpage.js#L63-L77 | |
34,807 | sheebz/phantom-proxy | lib/webpage.js | function (expressionFn, callbackFn) {
var self = this,
url = self.options.hostAndPort + '/page/functions/evaluate';
self.options.debug && console.log('calling url: %s', url);
request.post(url, {
form:{expre... | javascript | function (expressionFn, callbackFn) {
var self = this,
url = self.options.hostAndPort + '/page/functions/evaluate';
self.options.debug && console.log('calling url: %s', url);
request.post(url, {
form:{expre... | [
"function",
"(",
"expressionFn",
",",
"callbackFn",
")",
"{",
"var",
"self",
"=",
"this",
",",
"url",
"=",
"self",
".",
"options",
".",
"hostAndPort",
"+",
"'/page/functions/evaluate'",
";",
"self",
".",
"options",
".",
"debug",
"&&",
"console",
".",
"log"... | Evaluates the given function in the context of the web page. The execution is sandboxed, the web page has no access to the phantom object and it can't probe its own setting. | [
"Evaluates",
"the",
"given",
"function",
"in",
"the",
"context",
"of",
"the",
"web",
"page",
".",
"The",
"execution",
"is",
"sandboxed",
"the",
"web",
"page",
"has",
"no",
"access",
"to",
"the",
"phantom",
"object",
"and",
"it",
"can",
"t",
"probe",
"its... | a4963662205400e542668938ce5cf1ab9a66fba0 | https://github.com/sheebz/phantom-proxy/blob/a4963662205400e542668938ce5cf1ab9a66fba0/lib/webpage.js#L177-L195 | |
34,808 | sheebz/phantom-proxy | lib/webpage.js | function (filename, callbackFn) {
var self = this,
url = self.options.hostAndPort + '/page/functions/render';
self.options.debug && console.log('calling url: %s', url);
request.post(url, {form:{ args:JSON.stringify(
... | javascript | function (filename, callbackFn) {
var self = this,
url = self.options.hostAndPort + '/page/functions/render';
self.options.debug && console.log('calling url: %s', url);
request.post(url, {form:{ args:JSON.stringify(
... | [
"function",
"(",
"filename",
",",
"callbackFn",
")",
"{",
"var",
"self",
"=",
"this",
",",
"url",
"=",
"self",
".",
"options",
".",
"hostAndPort",
"+",
"'/page/functions/render'",
";",
"self",
".",
"options",
".",
"debug",
"&&",
"console",
".",
"log",
"(... | Renders the web page to an image buffer and save it as the specified file. Currently the output format is automatically set based on the file extension. Supported formats are PNG, GIF, JPEG, and PDF. | [
"Renders",
"the",
"web",
"page",
"to",
"an",
"image",
"buffer",
"and",
"save",
"it",
"as",
"the",
"specified",
"file",
".",
"Currently",
"the",
"output",
"format",
"is",
"automatically",
"set",
"based",
"on",
"the",
"file",
"extension",
".",
"Supported",
"... | a4963662205400e542668938ce5cf1ab9a66fba0 | https://github.com/sheebz/phantom-proxy/blob/a4963662205400e542668938ce5cf1ab9a66fba0/lib/webpage.js#L219-L239 | |
34,809 | sheebz/phantom-proxy | lib/webpage.js | function (format, callbackFn) {
var self = this,
args =
[
format
],
url = this.options.hostAndPort + '/page/functions/renderBase64';
this.option... | javascript | function (format, callbackFn) {
var self = this,
args =
[
format
],
url = this.options.hostAndPort + '/page/functions/renderBase64';
this.option... | [
"function",
"(",
"format",
",",
"callbackFn",
")",
"{",
"var",
"self",
"=",
"this",
",",
"args",
"=",
"[",
"format",
"]",
",",
"url",
"=",
"this",
".",
"options",
".",
"hostAndPort",
"+",
"'/page/functions/renderBase64'",
";",
"this",
".",
"options",
"."... | Renders the web page to an image buffer and returns the result as a base64-encoded string representation of that image. Supported formats are PNG, GIF, and JPEG. | [
"Renders",
"the",
"web",
"page",
"to",
"an",
"image",
"buffer",
"and",
"returns",
"the",
"result",
"as",
"a",
"base64",
"-",
"encoded",
"string",
"representation",
"of",
"that",
"image",
".",
"Supported",
"formats",
"are",
"PNG",
"GIF",
"and",
"JPEG",
"."
... | a4963662205400e542668938ce5cf1ab9a66fba0 | https://github.com/sheebz/phantom-proxy/blob/a4963662205400e542668938ce5cf1ab9a66fba0/lib/webpage.js#L242-L263 | |
34,810 | sheebz/phantom-proxy | lib/webpage.js | function (selector, callbackFn, timeout) {
var self = this,
startTime = Date.now(),
timeoutInterval = 150,
testRunning = false,
//if evaluate succeeds, invokes callback w/ true, if timeout,
... | javascript | function (selector, callbackFn, timeout) {
var self = this,
startTime = Date.now(),
timeoutInterval = 150,
testRunning = false,
//if evaluate succeeds, invokes callback w/ true, if timeout,
... | [
"function",
"(",
"selector",
",",
"callbackFn",
",",
"timeout",
")",
"{",
"var",
"self",
"=",
"this",
",",
"startTime",
"=",
"Date",
".",
"now",
"(",
")",
",",
"timeoutInterval",
"=",
"150",
",",
"testRunning",
"=",
"false",
",",
"//if evaluate succeeds, i... | additional methods not in phantomjs api waits for selector to appear, then executes callbackFn | [
"additional",
"methods",
"not",
"in",
"phantomjs",
"api",
"waits",
"for",
"selector",
"to",
"appear",
"then",
"executes",
"callbackFn"
] | a4963662205400e542668938ce5cf1ab9a66fba0 | https://github.com/sheebz/phantom-proxy/blob/a4963662205400e542668938ce5cf1ab9a66fba0/lib/webpage.js#L267-L299 | |
34,811 | addthis/fluxthis | src/Dispatcher.es6.js | dispatchToStores | function dispatchToStores(ids = new Set()) {
ids.forEach((storeID) => {
if (this[IS_PENDING][storeID]) {
return true;
}
invokeCallback.call(this, storeID);
});
} | javascript | function dispatchToStores(ids = new Set()) {
ids.forEach((storeID) => {
if (this[IS_PENDING][storeID]) {
return true;
}
invokeCallback.call(this, storeID);
});
} | [
"function",
"dispatchToStores",
"(",
"ids",
"=",
"new",
"Set",
"(",
")",
")",
"{",
"ids",
".",
"forEach",
"(",
"(",
"storeID",
")",
"=>",
"{",
"if",
"(",
"this",
"[",
"IS_PENDING",
"]",
"[",
"storeID",
"]",
")",
"{",
"return",
"true",
";",
"}",
"... | This method takes an array of store id's and iterates
over them to determine if we should invoke a dispatch
of the action.
@param {Set} ids | [
"This",
"method",
"takes",
"an",
"array",
"of",
"store",
"id",
"s",
"and",
"iterates",
"over",
"them",
"to",
"determine",
"if",
"we",
"should",
"invoke",
"a",
"dispatch",
"of",
"the",
"action",
"."
] | ccd399554ecac886d7389ffe9d6e72519d92c481 | https://github.com/addthis/fluxthis/blob/ccd399554ecac886d7389ffe9d6e72519d92c481/src/Dispatcher.es6.js#L293-L301 |
34,812 | addthis/fluxthis | src/Dispatcher.es6.js | invokeCallback | function invokeCallback(id) {
this[IS_PENDING][id] = true;
this[CALLBACKS][id](this[PENDING_ACTION]);
this[EMIT_CHANGE_CALLBACK].get(id)();
this[IS_HANDLED][id] = true;
} | javascript | function invokeCallback(id) {
this[IS_PENDING][id] = true;
this[CALLBACKS][id](this[PENDING_ACTION]);
this[EMIT_CHANGE_CALLBACK].get(id)();
this[IS_HANDLED][id] = true;
} | [
"function",
"invokeCallback",
"(",
"id",
")",
"{",
"this",
"[",
"IS_PENDING",
"]",
"[",
"id",
"]",
"=",
"true",
";",
"this",
"[",
"CALLBACKS",
"]",
"[",
"id",
"]",
"(",
"this",
"[",
"PENDING_ACTION",
"]",
")",
";",
"this",
"[",
"EMIT_CHANGE_CALLBACK",
... | Call the callback stored with the given id. Also do some internal
bookkeeping.
@param {string} id
@internal | [
"Call",
"the",
"callback",
"stored",
"with",
"the",
"given",
"id",
".",
"Also",
"do",
"some",
"internal",
"bookkeeping",
"."
] | ccd399554ecac886d7389ffe9d6e72519d92c481 | https://github.com/addthis/fluxthis/blob/ccd399554ecac886d7389ffe9d6e72519d92c481/src/Dispatcher.es6.js#L310-L315 |
34,813 | addthis/fluxthis | src/Dispatcher.es6.js | startDispatching | function startDispatching(action) {
require('./debug.es6').logDispatch(action);
Object.keys(this[CALLBACKS]).forEach((id) => {
this[IS_PENDING][id] = false;
this[IS_HANDLED][id] = false;
});
this[PENDING_ACTION] = action;
this[IS_DISPATCHING] = true;
} | javascript | function startDispatching(action) {
require('./debug.es6').logDispatch(action);
Object.keys(this[CALLBACKS]).forEach((id) => {
this[IS_PENDING][id] = false;
this[IS_HANDLED][id] = false;
});
this[PENDING_ACTION] = action;
this[IS_DISPATCHING] = true;
} | [
"function",
"startDispatching",
"(",
"action",
")",
"{",
"require",
"(",
"'./debug.es6'",
")",
".",
"logDispatch",
"(",
"action",
")",
";",
"Object",
".",
"keys",
"(",
"this",
"[",
"CALLBACKS",
"]",
")",
".",
"forEach",
"(",
"(",
"id",
")",
"=>",
"{",
... | Set up bookkeeping needed when dispatching.
@param {object} action
@internal | [
"Set",
"up",
"bookkeeping",
"needed",
"when",
"dispatching",
"."
] | ccd399554ecac886d7389ffe9d6e72519d92c481 | https://github.com/addthis/fluxthis/blob/ccd399554ecac886d7389ffe9d6e72519d92c481/src/Dispatcher.es6.js#L323-L333 |
34,814 | addthis/fluxthis | lib/implore.es6.js | makeQueryString | function makeQueryString(obj, prefix='') {
const str = [];
let prop;
let key;
let value;
for (prop in obj) {
if (obj.hasOwnProperty(prop)) {
key = prefix ?
prefix + '[' + prop + ']' :
prop;
value = obj[prop];
str.push(typeof value === 'object' ?
makeQueryString(value, key) :
encodeURICo... | javascript | function makeQueryString(obj, prefix='') {
const str = [];
let prop;
let key;
let value;
for (prop in obj) {
if (obj.hasOwnProperty(prop)) {
key = prefix ?
prefix + '[' + prop + ']' :
prop;
value = obj[prop];
str.push(typeof value === 'object' ?
makeQueryString(value, key) :
encodeURICo... | [
"function",
"makeQueryString",
"(",
"obj",
",",
"prefix",
"=",
"''",
")",
"{",
"const",
"str",
"=",
"[",
"]",
";",
"let",
"prop",
";",
"let",
"key",
";",
"let",
"value",
";",
"for",
"(",
"prop",
"in",
"obj",
")",
"{",
"if",
"(",
"obj",
".",
"ha... | Take a simple object and turn it into a queryString, recursively.
@param {object} obj - query object
@param {string} prefix - used in recursive calls to keep track of the parent
@return {string} queryString without the '?'' | [
"Take",
"a",
"simple",
"object",
"and",
"turn",
"it",
"into",
"a",
"queryString",
"recursively",
"."
] | ccd399554ecac886d7389ffe9d6e72519d92c481 | https://github.com/addthis/fluxthis/blob/ccd399554ecac886d7389ffe9d6e72519d92c481/lib/implore.es6.js#L246-L265 |
34,815 | zynga/atom | atom.js | removeListener | function removeListener(listeners) {
for (var i = listeners.length; --i >= 0;) {
// There should only be ONE exhausted listener.
if (!listeners[i].calls) {
return listeners.splice(i, 1);
}
}
} | javascript | function removeListener(listeners) {
for (var i = listeners.length; --i >= 0;) {
// There should only be ONE exhausted listener.
if (!listeners[i].calls) {
return listeners.splice(i, 1);
}
}
} | [
"function",
"removeListener",
"(",
"listeners",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"listeners",
".",
"length",
";",
"--",
"i",
">=",
"0",
";",
")",
"{",
"// There should only be ONE exhausted listener.",
"if",
"(",
"!",
"listeners",
"[",
"i",
"]",
".",... | Helper to remove an exausted listener from the listeners array | [
"Helper",
"to",
"remove",
"an",
"exausted",
"listener",
"from",
"the",
"listeners",
"array"
] | cf204967e9267df47d51c2b5b628261c7ed0cec7 | https://github.com/zynga/atom/blob/cf204967e9267df47d51c2b5b628261c7ed0cec7/atom.js#L70-L77 |
34,816 | zynga/atom | atom.js | provide | function provide(nucleus, key, provider) {
provider(preventMultiCall(function (result) {
set(nucleus, key, result);
}));
} | javascript | function provide(nucleus, key, provider) {
provider(preventMultiCall(function (result) {
set(nucleus, key, result);
}));
} | [
"function",
"provide",
"(",
"nucleus",
",",
"key",
",",
"provider",
")",
"{",
"provider",
"(",
"preventMultiCall",
"(",
"function",
"(",
"result",
")",
"{",
"set",
"(",
"nucleus",
",",
"key",
",",
"result",
")",
";",
"}",
")",
")",
";",
"}"
] | Helper function for setting up providers. | [
"Helper",
"function",
"for",
"setting",
"up",
"providers",
"."
] | cf204967e9267df47d51c2b5b628261c7ed0cec7 | https://github.com/zynga/atom/blob/cf204967e9267df47d51c2b5b628261c7ed0cec7/atom.js#L136-L140 |
34,817 | zynga/atom | atom.js | doNext | function doNext() {
if (q) {
q.pending = q.next = (!q.next && q.length) ?
q.shift() : q.next;
q.args = slice.call(arguments, 0);
if (q.pending) {
q.next = 0;
q.pending.apply({}, [preventMultiCall(doNext)].concat(q.args));
}
}
} | javascript | function doNext() {
if (q) {
q.pending = q.next = (!q.next && q.length) ?
q.shift() : q.next;
q.args = slice.call(arguments, 0);
if (q.pending) {
q.next = 0;
q.pending.apply({}, [preventMultiCall(doNext)].concat(q.args));
}
}
} | [
"function",
"doNext",
"(",
")",
"{",
"if",
"(",
"q",
")",
"{",
"q",
".",
"pending",
"=",
"q",
".",
"next",
"=",
"(",
"!",
"q",
".",
"next",
"&&",
"q",
".",
"length",
")",
"?",
"q",
".",
"shift",
"(",
")",
":",
"q",
".",
"next",
";",
"q",
... | Execute the next function in the async queue. | [
"Execute",
"the",
"next",
"function",
"in",
"the",
"async",
"queue",
"."
] | cf204967e9267df47d51c2b5b628261c7ed0cec7 | https://github.com/zynga/atom/blob/cf204967e9267df47d51c2b5b628261c7ed0cec7/atom.js#L168-L178 |
34,818 | zynga/atom | atom.js | function () {
if (q) {
for (var i = 0, len = arguments.length; i < len; i++) {
q.push(arguments[i]);
if (!q.pending) {
doNext.apply({}, q.args || []);
}
}
}
return me;
} | javascript | function () {
if (q) {
for (var i = 0, len = arguments.length; i < len; i++) {
q.push(arguments[i]);
if (!q.pending) {
doNext.apply({}, q.args || []);
}
}
}
return me;
} | [
"function",
"(",
")",
"{",
"if",
"(",
"q",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"arguments",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"q",
".",
"push",
"(",
"arguments",
"[",
"i",
"]",
")",
";... | Add a function or functions to the async queue. Functions added thusly must call their first arg as a callback when done. Any args provided to the callback will be passed in to the next function in the queue. | [
"Add",
"a",
"function",
"or",
"functions",
"to",
"the",
"async",
"queue",
".",
"Functions",
"added",
"thusly",
"must",
"call",
"their",
"first",
"arg",
"as",
"a",
"callback",
"when",
"done",
".",
"Any",
"args",
"provided",
"to",
"the",
"callback",
"will",
... | cf204967e9267df47d51c2b5b628261c7ed0cec7 | https://github.com/zynga/atom/blob/cf204967e9267df47d51c2b5b628261c7ed0cec7/atom.js#L186-L196 | |
34,819 | zynga/atom | atom.js | function () {
delete nucleus.props;
delete nucleus.needs;
delete nucleus.providers;
delete nucleus.listeners;
while (q.length) {
q.pop();
}
nucleus = props = needs = providers = listeners =
q = q.pending = q.next = q.args = 0;
} | javascript | function () {
delete nucleus.props;
delete nucleus.needs;
delete nucleus.providers;
delete nucleus.listeners;
while (q.length) {
q.pop();
}
nucleus = props = needs = providers = listeners =
q = q.pending = q.next = q.args = 0;
} | [
"function",
"(",
")",
"{",
"delete",
"nucleus",
".",
"props",
";",
"delete",
"nucleus",
".",
"needs",
";",
"delete",
"nucleus",
".",
"providers",
";",
"delete",
"nucleus",
".",
"listeners",
";",
"while",
"(",
"q",
".",
"length",
")",
"{",
"q",
".",
"... | Remove references to all properties and listeners. This releases memory, and effective stops the atom from working. | [
"Remove",
"references",
"to",
"all",
"properties",
"and",
"listeners",
".",
"This",
"releases",
"memory",
"and",
"effective",
"stops",
"the",
"atom",
"from",
"working",
"."
] | cf204967e9267df47d51c2b5b628261c7ed0cec7 | https://github.com/zynga/atom/blob/cf204967e9267df47d51c2b5b628261c7ed0cec7/atom.js#L200-L210 | |
34,820 | zynga/atom | atom.js | function (keyOrList, func) {
var keys = toArray(keyOrList), i = -1, len = keys.length, key;
while (++i < len) {
key = keys[i];
func(key, me.get(key));
}
return me;
} | javascript | function (keyOrList, func) {
var keys = toArray(keyOrList), i = -1, len = keys.length, key;
while (++i < len) {
key = keys[i];
func(key, me.get(key));
}
return me;
} | [
"function",
"(",
"keyOrList",
",",
"func",
")",
"{",
"var",
"keys",
"=",
"toArray",
"(",
"keyOrList",
")",
",",
"i",
"=",
"-",
"1",
",",
"len",
"=",
"keys",
".",
"length",
",",
"key",
";",
"while",
"(",
"++",
"i",
"<",
"len",
")",
"{",
"key",
... | Call `func` on each of the specified keys. The key is provided as the first arg, and the value as the second. | [
"Call",
"func",
"on",
"each",
"of",
"the",
"specified",
"keys",
".",
"The",
"key",
"is",
"provided",
"as",
"the",
"first",
"arg",
"and",
"the",
"value",
"as",
"the",
"second",
"."
] | cf204967e9267df47d51c2b5b628261c7ed0cec7 | https://github.com/zynga/atom/blob/cf204967e9267df47d51c2b5b628261c7ed0cec7/atom.js#L214-L221 | |
34,821 | zynga/atom | atom.js | function (keyOrList, func) {
var result = get(nucleus, keyOrList, func);
return func ? result : typeof keyOrList === 'string' ?
result.values[0] : result.values;
} | javascript | function (keyOrList, func) {
var result = get(nucleus, keyOrList, func);
return func ? result : typeof keyOrList === 'string' ?
result.values[0] : result.values;
} | [
"function",
"(",
"keyOrList",
",",
"func",
")",
"{",
"var",
"result",
"=",
"get",
"(",
"nucleus",
",",
"keyOrList",
",",
"func",
")",
";",
"return",
"func",
"?",
"result",
":",
"typeof",
"keyOrList",
"===",
"'string'",
"?",
"result",
".",
"values",
"["... | Get current values for the specified keys. If `func` is provided, it will be called with the values as args. | [
"Get",
"current",
"values",
"for",
"the",
"specified",
"keys",
".",
"If",
"func",
"is",
"provided",
"it",
"will",
"be",
"called",
"with",
"the",
"values",
"as",
"args",
"."
] | cf204967e9267df47d51c2b5b628261c7ed0cec7 | https://github.com/zynga/atom/blob/cf204967e9267df47d51c2b5b628261c7ed0cec7/atom.js#L263-L267 | |
34,822 | zynga/atom | atom.js | function () {
var keys = [];
for (var key in props) {
if (hasOwn.call(props, key)) {
keys.push(key);
}
}
return keys;
} | javascript | function () {
var keys = [];
for (var key in props) {
if (hasOwn.call(props, key)) {
keys.push(key);
}
}
return keys;
} | [
"function",
"(",
")",
"{",
"var",
"keys",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"key",
"in",
"props",
")",
"{",
"if",
"(",
"hasOwn",
".",
"call",
"(",
"props",
",",
"key",
")",
")",
"{",
"keys",
".",
"push",
"(",
"key",
")",
";",
"}",
"}",... | Return a list of all keys. | [
"Return",
"a",
"list",
"of",
"all",
"keys",
"."
] | cf204967e9267df47d51c2b5b628261c7ed0cec7 | https://github.com/zynga/atom/blob/cf204967e9267df47d51c2b5b628261c7ed0cec7/atom.js#L282-L290 | |
34,823 | zynga/atom | atom.js | function (obj) {
for (var p in obj) {
if (hasOwn.call(obj, p)) {
me[p] = obj[p];
}
}
return me;
} | javascript | function (obj) {
for (var p in obj) {
if (hasOwn.call(obj, p)) {
me[p] = obj[p];
}
}
return me;
} | [
"function",
"(",
"obj",
")",
"{",
"for",
"(",
"var",
"p",
"in",
"obj",
")",
"{",
"if",
"(",
"hasOwn",
".",
"call",
"(",
"obj",
",",
"p",
")",
")",
"{",
"me",
"[",
"p",
"]",
"=",
"obj",
"[",
"p",
"]",
";",
"}",
"}",
"return",
"me",
";",
... | Add arbitrary properties to this atom's interface. | [
"Add",
"arbitrary",
"properties",
"to",
"this",
"atom",
"s",
"interface",
"."
] | cf204967e9267df47d51c2b5b628261c7ed0cec7 | https://github.com/zynga/atom/blob/cf204967e9267df47d51c2b5b628261c7ed0cec7/atom.js#L293-L300 | |
34,824 | zynga/atom | atom.js | function (keyOrList, func) { // alias: `bind`
listeners.unshift({ keys: toArray(keyOrList), cb: func,
calls: Infinity });
return me;
} | javascript | function (keyOrList, func) { // alias: `bind`
listeners.unshift({ keys: toArray(keyOrList), cb: func,
calls: Infinity });
return me;
} | [
"function",
"(",
"keyOrList",
",",
"func",
")",
"{",
"// alias: `bind`",
"listeners",
".",
"unshift",
"(",
"{",
"keys",
":",
"toArray",
"(",
"keyOrList",
")",
",",
"cb",
":",
"func",
",",
"calls",
":",
"Infinity",
"}",
")",
";",
"return",
"me",
";",
... | Call `func` whenever any of the specified keys change. The values of the keys will be provided as args to func. | [
"Call",
"func",
"whenever",
"any",
"of",
"the",
"specified",
"keys",
"change",
".",
"The",
"values",
"of",
"the",
"keys",
"will",
"be",
"provided",
"as",
"args",
"to",
"func",
"."
] | cf204967e9267df47d51c2b5b628261c7ed0cec7 | https://github.com/zynga/atom/blob/cf204967e9267df47d51c2b5b628261c7ed0cec7/atom.js#L359-L363 | |
34,825 | zynga/atom | atom.js | function (keyOrList, func) {
var keys = toArray(keyOrList),
results = get(nucleus, keys),
values = results.values,
missing = results.missing;
if (!missing) {
func.apply({}, values);
} else {
listeners.unshift(
{ keys: keys, cb: func, missing: missing, calls: 1 });
}
re... | javascript | function (keyOrList, func) {
var keys = toArray(keyOrList),
results = get(nucleus, keys),
values = results.values,
missing = results.missing;
if (!missing) {
func.apply({}, values);
} else {
listeners.unshift(
{ keys: keys, cb: func, missing: missing, calls: 1 });
}
re... | [
"function",
"(",
"keyOrList",
",",
"func",
")",
"{",
"var",
"keys",
"=",
"toArray",
"(",
"keyOrList",
")",
",",
"results",
"=",
"get",
"(",
"nucleus",
",",
"keys",
")",
",",
"values",
"=",
"results",
".",
"values",
",",
"missing",
"=",
"results",
"."... | Call `func` as soon as all of the specified keys have been set. If they are already set, the function will be called immediately, with all the values provided as args. Guaranteed to be called no more than once. | [
"Call",
"func",
"as",
"soon",
"as",
"all",
"of",
"the",
"specified",
"keys",
"have",
"been",
"set",
".",
"If",
"they",
"are",
"already",
"set",
"the",
"function",
"will",
"be",
"called",
"immediately",
"with",
"all",
"the",
"values",
"provided",
"as",
"a... | cf204967e9267df47d51c2b5b628261c7ed0cec7 | https://github.com/zynga/atom/blob/cf204967e9267df47d51c2b5b628261c7ed0cec7/atom.js#L369-L381 | |
34,826 | zynga/atom | atom.js | function (key, func) {
if (needs[key]) {
provide(nucleus, key, func);
} else if (!providers[key]) {
providers[key] = func;
}
return me;
} | javascript | function (key, func) {
if (needs[key]) {
provide(nucleus, key, func);
} else if (!providers[key]) {
providers[key] = func;
}
return me;
} | [
"function",
"(",
"key",
",",
"func",
")",
"{",
"if",
"(",
"needs",
"[",
"key",
"]",
")",
"{",
"provide",
"(",
"nucleus",
",",
"key",
",",
"func",
")",
";",
"}",
"else",
"if",
"(",
"!",
"providers",
"[",
"key",
"]",
")",
"{",
"providers",
"[",
... | Register a provider for a particular key. The provider `func` is a function that will be called if there is a need to create the key. It must call its first arg as a callback, with the value. Provider functions will be called at most once. | [
"Register",
"a",
"provider",
"for",
"a",
"particular",
"key",
".",
"The",
"provider",
"func",
"is",
"a",
"function",
"that",
"will",
"be",
"called",
"if",
"there",
"is",
"a",
"need",
"to",
"create",
"the",
"key",
".",
"It",
"must",
"call",
"its",
"firs... | cf204967e9267df47d51c2b5b628261c7ed0cec7 | https://github.com/zynga/atom/blob/cf204967e9267df47d51c2b5b628261c7ed0cec7/atom.js#L387-L394 | |
34,827 | zynga/atom | atom.js | function (keyOrMap, value) {
if (typeof keyOrMap === typeObj) {
for (var key in keyOrMap) {
if (hasOwn.call(keyOrMap, key)) {
set(nucleus, key, keyOrMap[key]);
}
}
} else {
set(nucleus, keyOrMap, value);
}
return me;
} | javascript | function (keyOrMap, value) {
if (typeof keyOrMap === typeObj) {
for (var key in keyOrMap) {
if (hasOwn.call(keyOrMap, key)) {
set(nucleus, key, keyOrMap[key]);
}
}
} else {
set(nucleus, keyOrMap, value);
}
return me;
} | [
"function",
"(",
"keyOrMap",
",",
"value",
")",
"{",
"if",
"(",
"typeof",
"keyOrMap",
"===",
"typeObj",
")",
"{",
"for",
"(",
"var",
"key",
"in",
"keyOrMap",
")",
"{",
"if",
"(",
"hasOwn",
".",
"call",
"(",
"keyOrMap",
",",
"key",
")",
")",
"{",
... | Set value for a key, or if `keyOrMap` is an object then set all the keys' corresponding values. | [
"Set",
"value",
"for",
"a",
"key",
"or",
"if",
"keyOrMap",
"is",
"an",
"object",
"then",
"set",
"all",
"the",
"keys",
"corresponding",
"values",
"."
] | cf204967e9267df47d51c2b5b628261c7ed0cec7 | https://github.com/zynga/atom/blob/cf204967e9267df47d51c2b5b628261c7ed0cec7/atom.js#L398-L409 | |
34,828 | mkloubert/nativescript-stringformat | plugin/index.js | join | function join(separator, itemList) {
var result = "";
for (var i = 0; i < itemList.length; i++) {
if (i > 0) {
result += separator;
}
result += itemList[i];
}
return result;
} | javascript | function join(separator, itemList) {
var result = "";
for (var i = 0; i < itemList.length; i++) {
if (i > 0) {
result += separator;
}
result += itemList[i];
}
return result;
} | [
"function",
"join",
"(",
"separator",
",",
"itemList",
")",
"{",
"var",
"result",
"=",
"\"\"",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"itemList",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
">",
"0",
")",
"{",
"res... | Joins items to one string.
@function join
@param {String} separator The separator.
@param {Array} itemList The list of items.
@return {String} The joined string. | [
"Joins",
"items",
"to",
"one",
"string",
"."
] | 83478b3a222574ad9e76f07076b798e6f2d8e6ac | https://github.com/mkloubert/nativescript-stringformat/blob/83478b3a222574ad9e76f07076b798e6f2d8e6ac/plugin/index.js#L564-L573 |
34,829 | mkloubert/nativescript-stringformat | plugin/index.js | similarity | function similarity(left, right, ignoreCase, trim) {
if (left === right) {
return 1;
}
if (TypeUtils.isNullOrUndefined(left) ||
TypeUtils.isNullOrUndefined(right)) {
return 0;
}
if (arguments.length < 4) {
if (arguments.length < 3) {
ignoreCase =... | javascript | function similarity(left, right, ignoreCase, trim) {
if (left === right) {
return 1;
}
if (TypeUtils.isNullOrUndefined(left) ||
TypeUtils.isNullOrUndefined(right)) {
return 0;
}
if (arguments.length < 4) {
if (arguments.length < 3) {
ignoreCase =... | [
"function",
"similarity",
"(",
"left",
",",
"right",
",",
"ignoreCase",
",",
"trim",
")",
"{",
"if",
"(",
"left",
"===",
"right",
")",
"{",
"return",
"1",
";",
"}",
"if",
"(",
"TypeUtils",
".",
"isNullOrUndefined",
"(",
"left",
")",
"||",
"TypeUtils",
... | Returns the similarity of strings.
@function similarity
@param {string} left The "left" string.
@param {string} right The "right" string.
@param {boolean} [ignoreCase] Compare case insensitive or not.
@param {boolean} [trim] Trim both strings before comparison or not.
@return {Number} The similarity between 0 (0 %) ... | [
"Returns",
"the",
"similarity",
"of",
"strings",
"."
] | 83478b3a222574ad9e76f07076b798e6f2d8e6ac | https://github.com/mkloubert/nativescript-stringformat/blob/83478b3a222574ad9e76f07076b798e6f2d8e6ac/plugin/index.js#L587-L642 |
34,830 | sheebz/phantom-proxy | lib/phantom.js | function (filename, callbackFn) {
var self = this;
request.post(this.options.hostAndPort + '/phantom/functions/injectJs', {form:{args:JSON.stringify(arguments)}},
function (error, response, body) {
if (response.statusCode === 200) {
... | javascript | function (filename, callbackFn) {
var self = this;
request.post(this.options.hostAndPort + '/phantom/functions/injectJs', {form:{args:JSON.stringify(arguments)}},
function (error, response, body) {
if (response.statusCode === 200) {
... | [
"function",
"(",
"filename",
",",
"callbackFn",
")",
"{",
"var",
"self",
"=",
"this",
";",
"request",
".",
"post",
"(",
"this",
".",
"options",
".",
"hostAndPort",
"+",
"'/phantom/functions/injectJs'",
",",
"{",
"form",
":",
"{",
"args",
":",
"JSON",
"."... | Injects external script code from the specified file. If the file can not be found in the current directory, libraryPath is used for additional look up. This function returns true if injection is successful, otherwise it returns false. | [
"Injects",
"external",
"script",
"code",
"from",
"the",
"specified",
"file",
".",
"If",
"the",
"file",
"can",
"not",
"be",
"found",
"in",
"the",
"current",
"directory",
"libraryPath",
"is",
"used",
"for",
"additional",
"look",
"up",
".",
"This",
"function",
... | a4963662205400e542668938ce5cf1ab9a66fba0 | https://github.com/sheebz/phantom-proxy/blob/a4963662205400e542668938ce5cf1ab9a66fba0/lib/phantom.js#L106-L118 | |
34,831 | getdave/grunt-deployments | tasks/deployments.js | db_import | function db_import(config, src) {
var cmd;
// 1) Create cmd string from Lo-Dash template
var tpl_mysql = grunt.template.process(tpls.mysql, {
data: {
host: config.host,
user: config.user,
pass: config.pass,
database: c... | javascript | function db_import(config, src) {
var cmd;
// 1) Create cmd string from Lo-Dash template
var tpl_mysql = grunt.template.process(tpls.mysql, {
data: {
host: config.host,
user: config.user,
pass: config.pass,
database: c... | [
"function",
"db_import",
"(",
"config",
",",
"src",
")",
"{",
"var",
"cmd",
";",
"// 1) Create cmd string from Lo-Dash template",
"var",
"tpl_mysql",
"=",
"grunt",
".",
"template",
".",
"process",
"(",
"tpls",
".",
"mysql",
",",
"{",
"data",
":",
"{",
"host"... | Imports a .sql file into the DB provided | [
"Imports",
"a",
".",
"sql",
"file",
"into",
"the",
"DB",
"provided"
] | 504a50e9ce4367d0ee5e74fd83dd7d18d46ad3e7 | https://github.com/getdave/grunt-deployments/blob/504a50e9ce4367d0ee5e74fd83dd7d18d46ad3e7/tasks/deployments.js#L134-L170 |
34,832 | getdave/grunt-deployments | tasks/deployments.js | db_dump | function db_dump(config, output_paths) {
var cmd;
grunt.file.mkdir(output_paths.dir);
// 2) Compile MYSQL cmd via Lo-Dash template string
var tpl_mysqldump = grunt.template.process(tpls.mysqldump, {
data: {
user: config.user,
pass: config.p... | javascript | function db_dump(config, output_paths) {
var cmd;
grunt.file.mkdir(output_paths.dir);
// 2) Compile MYSQL cmd via Lo-Dash template string
var tpl_mysqldump = grunt.template.process(tpls.mysqldump, {
data: {
user: config.user,
pass: config.p... | [
"function",
"db_dump",
"(",
"config",
",",
"output_paths",
")",
"{",
"var",
"cmd",
";",
"grunt",
".",
"file",
".",
"mkdir",
"(",
"output_paths",
".",
"dir",
")",
";",
"// 2) Compile MYSQL cmd via Lo-Dash template string",
"var",
"tpl_mysqldump",
"=",
"grunt",
".... | Dumps a MYSQL database to a suitable backup location | [
"Dumps",
"a",
"MYSQL",
"database",
"to",
"a",
"suitable",
"backup",
"location"
] | 504a50e9ce4367d0ee5e74fd83dd7d18d46ad3e7 | https://github.com/getdave/grunt-deployments/blob/504a50e9ce4367d0ee5e74fd83dd7d18d46ad3e7/tasks/deployments.js#L177-L219 |
34,833 | sheebz/phantom-proxy | lib/proxy.js | function (callbackFn) {
var self = this;
request.post(this.options.hostAndPort + '/phantom/functions/exit', {
form:{
}
},
function (error, response, body) {
if (response && response.statusCode === 200) {... | javascript | function (callbackFn) {
var self = this;
request.post(this.options.hostAndPort + '/phantom/functions/exit', {
form:{
}
},
function (error, response, body) {
if (response && response.statusCode === 200) {... | [
"function",
"(",
"callbackFn",
")",
"{",
"var",
"self",
"=",
"this",
";",
"request",
".",
"post",
"(",
"this",
".",
"options",
".",
"hostAndPort",
"+",
"'/phantom/functions/exit'",
",",
"{",
"form",
":",
"{",
"}",
"}",
",",
"function",
"(",
"error",
",... | terminates phantomjs process | [
"terminates",
"phantomjs",
"process"
] | a4963662205400e542668938ce5cf1ab9a66fba0 | https://github.com/sheebz/phantom-proxy/blob/a4963662205400e542668938ce5cf1ab9a66fba0/lib/proxy.js#L245-L261 | |
34,834 | sheebz/phantom-proxy | lib/proxy.js | function (options, callbackFn) {
var self = this;
//compensate for optional options parm
if (typeof options === 'function') {
callbackFn = options;
options = {};
}
//assign default port
options.port = options.port ... | javascript | function (options, callbackFn) {
var self = this;
//compensate for optional options parm
if (typeof options === 'function') {
callbackFn = options;
options = {};
}
//assign default port
options.port = options.port ... | [
"function",
"(",
"options",
",",
"callbackFn",
")",
"{",
"var",
"self",
"=",
"this",
";",
"//compensate for optional options parm",
"if",
"(",
"typeof",
"options",
"===",
"'function'",
")",
"{",
"callbackFn",
"=",
"options",
";",
"options",
"=",
"{",
"}",
";... | creates a new proxy session - creates phantomjs process and webserver module | [
"creates",
"a",
"new",
"proxy",
"session",
"-",
"creates",
"phantomjs",
"process",
"and",
"webserver",
"module"
] | a4963662205400e542668938ce5cf1ab9a66fba0 | https://github.com/sheebz/phantom-proxy/blob/a4963662205400e542668938ce5cf1ab9a66fba0/lib/proxy.js#L263-L289 | |
34,835 | frdmn/openssl-cert-tools | lib/information.js | function (cert, cb) {
var infoObject = {},
subjectElements = [],
err;
var openssl = spawn('openssl', ['req', '-noout', '-subject', '-nameopt', 'RFC2253']);
// Catch stderr
openssl.stderr.on('data', function (out) {
err = new Error(out);
// Callback and return array
retu... | javascript | function (cert, cb) {
var infoObject = {},
subjectElements = [],
err;
var openssl = spawn('openssl', ['req', '-noout', '-subject', '-nameopt', 'RFC2253']);
// Catch stderr
openssl.stderr.on('data', function (out) {
err = new Error(out);
// Callback and return array
retu... | [
"function",
"(",
"cert",
",",
"cb",
")",
"{",
"var",
"infoObject",
"=",
"{",
"}",
",",
"subjectElements",
"=",
"[",
"]",
",",
"err",
";",
"var",
"openssl",
"=",
"spawn",
"(",
"'openssl'",
",",
"[",
"'req'",
",",
"'-noout'",
",",
"'-subject'",
",",
... | Decodes information from the provided certificate
sign request.
@param {String|Buffer} cert Input certificate
@param {Function} cb Callback
@return {Error} err, {Object} info Error and information object | [
"Decodes",
"information",
"from",
"the",
"provided",
"certificate",
"sign",
"request",
"."
] | 20cb9530459e83f0a22a928f06b776681c9d7dfa | https://github.com/frdmn/openssl-cert-tools/blob/20cb9530459e83f0a22a928f06b776681c9d7dfa/lib/information.js#L106-L152 | |
34,836 | mattdesl/garnish | index.js | toBunyan | function toBunyan (obj) {
if (obj.msg && !obj.message) {
obj.message = obj.msg
delete obj.msg
}
if (typeof obj.level === 'number') {
if (obj.level === 20) obj.level = 'debug'
if (obj.level === 30) obj.level = 'info'
if (obj.level === 40) obj.level = 'warn'
if (obj.level === 50) obj.level ... | javascript | function toBunyan (obj) {
if (obj.msg && !obj.message) {
obj.message = obj.msg
delete obj.msg
}
if (typeof obj.level === 'number') {
if (obj.level === 20) obj.level = 'debug'
if (obj.level === 30) obj.level = 'info'
if (obj.level === 40) obj.level = 'warn'
if (obj.level === 50) obj.level ... | [
"function",
"toBunyan",
"(",
"obj",
")",
"{",
"if",
"(",
"obj",
".",
"msg",
"&&",
"!",
"obj",
".",
"message",
")",
"{",
"obj",
".",
"message",
"=",
"obj",
".",
"msg",
"delete",
"obj",
".",
"msg",
"}",
"if",
"(",
"typeof",
"obj",
".",
"level",
"... | mutate a bole log to bunyan log obj -> null | [
"mutate",
"a",
"bole",
"log",
"to",
"bunyan",
"log",
"obj",
"-",
">",
"null"
] | 27e01cb2769cf5a7d3a1487478d8d9ae63879995 | https://github.com/mattdesl/garnish/blob/27e01cb2769cf5a7d3a1487478d8d9ae63879995/index.js#L47-L59 |
34,837 | back4app/antframework | plugins/ant-graphql/functions/mock.js | mock | function mock (_, mockArgs, fieldArgs, currentValue) {
if (currentValue !== undefined) {
return currentValue;
}
if (mockArgs && mockArgs.with) {
if (fieldArgs) {
try {
return Mustache.render(mockArgs.with, fieldArgs);
} catch (e) {
logger.error(new AntError(
'Coould n... | javascript | function mock (_, mockArgs, fieldArgs, currentValue) {
if (currentValue !== undefined) {
return currentValue;
}
if (mockArgs && mockArgs.with) {
if (fieldArgs) {
try {
return Mustache.render(mockArgs.with, fieldArgs);
} catch (e) {
logger.error(new AntError(
'Coould n... | [
"function",
"mock",
"(",
"_",
",",
"mockArgs",
",",
"fieldArgs",
",",
"currentValue",
")",
"{",
"if",
"(",
"currentValue",
"!==",
"undefined",
")",
"{",
"return",
"currentValue",
";",
"}",
"if",
"(",
"mockArgs",
"&&",
"mockArgs",
".",
"with",
")",
"{",
... | This function mocks a GraphQL field value. | [
"This",
"function",
"mocks",
"a",
"GraphQL",
"field",
"value",
"."
] | 7cba4eb6b4846648471662e0265aacd5a7f18645 | https://github.com/back4app/antframework/blob/7cba4eb6b4846648471662e0265aacd5a7f18645/plugins/ant-graphql/functions/mock.js#L11-L30 |
34,838 | yanceyou/runge-kutta-4 | lib/RungeKutta4.js | function(derives, xStart, yStart, h) {
this.derives = derives
this.x = xStart
this.y = yStart || []
this.dimension = this.y.length
this.h = h || 0.01
// cache the k1, k2, k3, k4 of each step
this._k1
this._k2
this._k3
this._k4
} | javascript | function(derives, xStart, yStart, h) {
this.derives = derives
this.x = xStart
this.y = yStart || []
this.dimension = this.y.length
this.h = h || 0.01
// cache the k1, k2, k3, k4 of each step
this._k1
this._k2
this._k3
this._k4
} | [
"function",
"(",
"derives",
",",
"xStart",
",",
"yStart",
",",
"h",
")",
"{",
"this",
".",
"derives",
"=",
"derives",
"this",
".",
"x",
"=",
"xStart",
"this",
".",
"y",
"=",
"yStart",
"||",
"[",
"]",
"this",
".",
"dimension",
"=",
"this",
".",
"y... | The fourth order Runge-Kutta integration method
@class RungeKutta4
@param {Function} derives Differential equations which needed to integrate
@param {Number} xStart Initial value problem: x0
@param {Array} yStart Initial value problem: y0
@param {Number} h Each step-size value | [
"The",
"fourth",
"order",
"Runge",
"-",
"Kutta",
"integration",
"method"
] | 4d4f2b5a9366727f11006d5527398ca9f9dd5162 | https://github.com/yanceyou/runge-kutta-4/blob/4d4f2b5a9366727f11006d5527398ca9f9dd5162/lib/RungeKutta4.js#L12-L24 | |
34,839 | yanceyou/runge-kutta-4 | lib/RungeKutta4.js | function() {
var derives = this.derives,
x = this.x,
dimension = this.dimension,
h = this.h
var i, _y = []
// Alias: f() <=> this.derives()
// Xn <=> this.x
// Yn <=> this.y
// H <=> ... | javascript | function() {
var derives = this.derives,
x = this.x,
dimension = this.dimension,
h = this.h
var i, _y = []
// Alias: f() <=> this.derives()
// Xn <=> this.x
// Yn <=> this.y
// H <=> ... | [
"function",
"(",
")",
"{",
"var",
"derives",
"=",
"this",
".",
"derives",
",",
"x",
"=",
"this",
".",
"x",
",",
"dimension",
"=",
"this",
".",
"dimension",
",",
"h",
"=",
"this",
".",
"h",
"var",
"i",
",",
"_y",
"=",
"[",
"]",
"// Alias: f() <=> ... | Calculate each step according to step-size h
@return {Array} calculated result at this.x | [
"Calculate",
"each",
"step",
"according",
"to",
"step",
"-",
"size",
"h"
] | 4d4f2b5a9366727f11006d5527398ca9f9dd5162 | https://github.com/yanceyou/runge-kutta-4/blob/4d4f2b5a9366727f11006d5527398ca9f9dd5162/lib/RungeKutta4.js#L32-L76 | |
34,840 | jasonmorita/react-redux-ui-state | dist/reducer.js | reducer | function reducer() {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var action = arguments[1];
// add initial state
if (action.type === (0, _.generateType)(_.types.add, (0, _get2.default)(action, 'payload.name'))) {
return _extends({}, state, _defineProperty... | javascript | function reducer() {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var action = arguments[1];
// add initial state
if (action.type === (0, _.generateType)(_.types.add, (0, _get2.default)(action, 'payload.name'))) {
return _extends({}, state, _defineProperty... | [
"function",
"reducer",
"(",
")",
"{",
"var",
"state",
"=",
"arguments",
".",
"length",
">",
"0",
"&&",
"arguments",
"[",
"0",
"]",
"!==",
"undefined",
"?",
"arguments",
"[",
"0",
"]",
":",
"{",
"}",
";",
"var",
"action",
"=",
"arguments",
"[",
"1",... | this reducer handles all state changes for the uiState slice | [
"this",
"reducer",
"handles",
"all",
"state",
"changes",
"for",
"the",
"uiState",
"slice"
] | 366a896f260c0ec3948afed86b2edf80ba9307af | https://github.com/jasonmorita/react-redux-ui-state/blob/366a896f260c0ec3948afed86b2edf80ba9307af/dist/reducer.js#L26-L55 |
34,841 | EdwonLim/node-sass-china | scripts/coverage.js | suite | function suite() {
process.env.NODESASS_COV = 1;
var coveralls = spawn(bin('coveralls'));
var args = [bin('_mocha')].concat(['--reporter', 'mocha-lcov-reporter']);
var mocha = spawn(process.sass.runtime.execPath, args, {
env: process.env
});
mocha.on('error', function(err) {
console.error(err);
... | javascript | function suite() {
process.env.NODESASS_COV = 1;
var coveralls = spawn(bin('coveralls'));
var args = [bin('_mocha')].concat(['--reporter', 'mocha-lcov-reporter']);
var mocha = spawn(process.sass.runtime.execPath, args, {
env: process.env
});
mocha.on('error', function(err) {
console.error(err);
... | [
"function",
"suite",
"(",
")",
"{",
"process",
".",
"env",
".",
"NODESASS_COV",
"=",
"1",
";",
"var",
"coveralls",
"=",
"spawn",
"(",
"bin",
"(",
"'coveralls'",
")",
")",
";",
"var",
"args",
"=",
"[",
"bin",
"(",
"'_mocha'",
")",
"]",
".",
"concat"... | Run test suite
@api private | [
"Run",
"test",
"suite"
] | 96c13a84e4d68f20d9c5388ad58e2750c2ce786f | https://github.com/EdwonLim/node-sass-china/blob/96c13a84e4d68f20d9c5388ad58e2750c2ce786f/scripts/coverage.js#L16-L38 |
34,842 | EdwonLim/node-sass-china | scripts/coverage.js | coverage | function coverage() {
var jscoverage = spawn(bin('jscoverage'), ['lib', 'lib-cov']);
jscoverage.on('error', function(err) {
console.error(err);
process.exit(1);
});
jscoverage.stderr.setEncoding('utf8');
jscoverage.stderr.on('data', function(err) {
console.error(err);
process.exit(1);
});
... | javascript | function coverage() {
var jscoverage = spawn(bin('jscoverage'), ['lib', 'lib-cov']);
jscoverage.on('error', function(err) {
console.error(err);
process.exit(1);
});
jscoverage.stderr.setEncoding('utf8');
jscoverage.stderr.on('data', function(err) {
console.error(err);
process.exit(1);
});
... | [
"function",
"coverage",
"(",
")",
"{",
"var",
"jscoverage",
"=",
"spawn",
"(",
"bin",
"(",
"'jscoverage'",
")",
",",
"[",
"'lib'",
",",
"'lib-cov'",
"]",
")",
";",
"jscoverage",
".",
"on",
"(",
"'error'",
",",
"function",
"(",
"err",
")",
"{",
"conso... | Generate coverage files
@api private | [
"Generate",
"coverage",
"files"
] | 96c13a84e4d68f20d9c5388ad58e2750c2ce786f | https://github.com/EdwonLim/node-sass-china/blob/96c13a84e4d68f20d9c5388ad58e2750c2ce786f/scripts/coverage.js#L46-L61 |
34,843 | mattdesl/garnish | lib/renderer.js | destructureMessage | function destructureMessage (msg) {
const keys = Object.keys(msg)
var res = ''
for (var i = 0; i < keys.length; i++) {
var key = keys[i]
var val = msg[key]
if (i !== 0) res += '\n'
res += chalk.blue(' "' + key + '"')
res += ': '
res += chalk.green('"' + val + '"')
}
return res
} | javascript | function destructureMessage (msg) {
const keys = Object.keys(msg)
var res = ''
for (var i = 0; i < keys.length; i++) {
var key = keys[i]
var val = msg[key]
if (i !== 0) res += '\n'
res += chalk.blue(' "' + key + '"')
res += ': '
res += chalk.green('"' + val + '"')
}
return res
} | [
"function",
"destructureMessage",
"(",
"msg",
")",
"{",
"const",
"keys",
"=",
"Object",
".",
"keys",
"(",
"msg",
")",
"var",
"res",
"=",
"''",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",
"length",
";",
"i",
"++",
")",
"{",
"va... | destructure a message onto an object if the message is an object. obj -> str | [
"destructure",
"a",
"message",
"onto",
"an",
"object",
"if",
"the",
"message",
"is",
"an",
"object",
".",
"obj",
"-",
">",
"str"
] | 27e01cb2769cf5a7d3a1487478d8d9ae63879995 | https://github.com/mattdesl/garnish/blob/27e01cb2769cf5a7d3a1487478d8d9ae63879995/lib/renderer.js#L180-L192 |
34,844 | glayzzle/php-reflection | src/utils/comment.js | function(ast) {
if (ast) {
try {
var doc = reader.parse(ast.lines);
} catch(e) {
console.error(e.stack);
console.log('Source : \n* ' + ast.lines.join('\n* '));
return;
}
this.summary = doc.summary;
this.tags = {};
this.a... | javascript | function(ast) {
if (ast) {
try {
var doc = reader.parse(ast.lines);
} catch(e) {
console.error(e.stack);
console.log('Source : \n* ' + ast.lines.join('\n* '));
return;
}
this.summary = doc.summary;
this.tags = {};
this.a... | [
"function",
"(",
"ast",
")",
"{",
"if",
"(",
"ast",
")",
"{",
"try",
"{",
"var",
"doc",
"=",
"reader",
".",
"parse",
"(",
"ast",
".",
"lines",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"console",
".",
"error",
"(",
"e",
".",
"stack",
")",
... | Initialize a comment declaration
@public
@constructor comment
@property {String} summary
@property {tag[]} tags
@property {annotation[]} annotations | [
"Initialize",
"a",
"comment",
"declaration"
] | 5a636a31a5f5e3f1745987c60d8b69665def3ca9 | https://github.com/glayzzle/php-reflection/blob/5a636a31a5f5e3f1745987c60d8b69665def3ca9/src/utils/comment.js#L20-L48 | |
34,845 | glayzzle/php-reflection | src/repository/parse.js | function(e) {
delete self._pending[filename];
self.emit('error', {
name: filename,
error: e
});
return reject(e);
} | javascript | function(e) {
delete self._pending[filename];
self.emit('error', {
name: filename,
error: e
});
return reject(e);
} | [
"function",
"(",
"e",
")",
"{",
"delete",
"self",
".",
"_pending",
"[",
"filename",
"]",
";",
"self",
".",
"emit",
"(",
"'error'",
",",
"{",
"name",
":",
"filename",
",",
"error",
":",
"e",
"}",
")",
";",
"return",
"reject",
"(",
"e",
")",
";",
... | error retrieved from worker | [
"error",
"retrieved",
"from",
"worker"
] | 5a636a31a5f5e3f1745987c60d8b69665def3ca9 | https://github.com/glayzzle/php-reflection/blob/5a636a31a5f5e3f1745987c60d8b69665def3ca9/src/repository/parse.js#L97-L104 | |
34,846 | back4app/antframework | packages/ant-cli/spec/bin/ant.spec.js | _expectUsageInstructions | async function _expectUsageInstructions(args) {
const { stdout, stderr } = await exec(getAntCommand(args));
expect(stdout).not.toBeNull();
expect(stdout.split('\n')[0]).toEqual(
'Usage: ant.js [--help] [--version] [--config <path>] [--verbose] <command>'
);
expect(stdout).toContain(
`Usage: ant.js [--... | javascript | async function _expectUsageInstructions(args) {
const { stdout, stderr } = await exec(getAntCommand(args));
expect(stdout).not.toBeNull();
expect(stdout.split('\n')[0]).toEqual(
'Usage: ant.js [--help] [--version] [--config <path>] [--verbose] <command>'
);
expect(stdout).toContain(
`Usage: ant.js [--... | [
"async",
"function",
"_expectUsageInstructions",
"(",
"args",
")",
"{",
"const",
"{",
"stdout",
",",
"stderr",
"}",
"=",
"await",
"exec",
"(",
"getAntCommand",
"(",
"args",
")",
")",
";",
"expect",
"(",
"stdout",
")",
".",
"not",
".",
"toBeNull",
"(",
... | Helper function to run the CLI command with args and check the expected
usage instructions as an output.
@param {string} args The args to be sent to the CLI command.
@async
@private | [
"Helper",
"function",
"to",
"run",
"the",
"CLI",
"command",
"with",
"args",
"and",
"check",
"the",
"expected",
"usage",
"instructions",
"as",
"an",
"output",
"."
] | 7cba4eb6b4846648471662e0265aacd5a7f18645 | https://github.com/back4app/antframework/blob/7cba4eb6b4846648471662e0265aacd5a7f18645/packages/ant-cli/spec/bin/ant.spec.js#L32-L63 |
34,847 | back4app/antframework | packages/ant-cli/spec/bin/ant.spec.js | _expectErrorMessage | async function _expectErrorMessage(args, ...errorMessages) {
expect.hasAssertions();
try {
await exec(getAntCommand(args));
throw new Error('It is expected to throw some error');
} catch (e) {
const { code, stdout, stderr } = e;
expect(code).toEqual(1);
expect(stdout).toEqual('');
for(cons... | javascript | async function _expectErrorMessage(args, ...errorMessages) {
expect.hasAssertions();
try {
await exec(getAntCommand(args));
throw new Error('It is expected to throw some error');
} catch (e) {
const { code, stdout, stderr } = e;
expect(code).toEqual(1);
expect(stdout).toEqual('');
for(cons... | [
"async",
"function",
"_expectErrorMessage",
"(",
"args",
",",
"...",
"errorMessages",
")",
"{",
"expect",
".",
"hasAssertions",
"(",
")",
";",
"try",
"{",
"await",
"exec",
"(",
"getAntCommand",
"(",
"args",
")",
")",
";",
"throw",
"new",
"Error",
"(",
"'... | Helper function to run the CLI command with args and check the expected error
messages as an output.
@param {string} args The args to be sent to the CLI command.
@param {string} errorMessages The expected error messages.
@async
@private | [
"Helper",
"function",
"to",
"run",
"the",
"CLI",
"command",
"with",
"args",
"and",
"check",
"the",
"expected",
"error",
"messages",
"as",
"an",
"output",
"."
] | 7cba4eb6b4846648471662e0265aacd5a7f18645 | https://github.com/back4app/antframework/blob/7cba4eb6b4846648471662e0265aacd5a7f18645/packages/ant-cli/spec/bin/ant.spec.js#L73-L86 |
34,848 | back4app/antframework | packages/ant-cli/spec/bin/ant.spec.js | _expectSuccessMessage | async function _expectSuccessMessage(args, ...successMessages) {
const { stdout, stderr } = await exec(getAntCommand(args));
for (const successMessage of successMessages) {
expect(stdout).toContain(successMessage);
}
expect(stderr).toEqual('');
} | javascript | async function _expectSuccessMessage(args, ...successMessages) {
const { stdout, stderr } = await exec(getAntCommand(args));
for (const successMessage of successMessages) {
expect(stdout).toContain(successMessage);
}
expect(stderr).toEqual('');
} | [
"async",
"function",
"_expectSuccessMessage",
"(",
"args",
",",
"...",
"successMessages",
")",
"{",
"const",
"{",
"stdout",
",",
"stderr",
"}",
"=",
"await",
"exec",
"(",
"getAntCommand",
"(",
"args",
")",
")",
";",
"for",
"(",
"const",
"successMessage",
"... | Helper function to run the CLI command with args and check the expected CLI
success message.
@param {String} args The args to be sent to the CLI command.
@param {String|Array<String>} successMessages The expected success messages.
@async
@private | [
"Helper",
"function",
"to",
"run",
"the",
"CLI",
"command",
"with",
"args",
"and",
"check",
"the",
"expected",
"CLI",
"success",
"message",
"."
] | 7cba4eb6b4846648471662e0265aacd5a7f18645 | https://github.com/back4app/antframework/blob/7cba4eb6b4846648471662e0265aacd5a7f18645/packages/ant-cli/spec/bin/ant.spec.js#L96-L102 |
34,849 | back4app/antframework | packages/ant-cli/spec/bin/ant.spec.js | _expectPackageVersion | async function _expectPackageVersion(args) {
const packageVersion = require(
path.resolve(__dirname, '../../package.json')
).version;
await _expectSuccessMessage(args, `${packageVersion}\n`);
} | javascript | async function _expectPackageVersion(args) {
const packageVersion = require(
path.resolve(__dirname, '../../package.json')
).version;
await _expectSuccessMessage(args, `${packageVersion}\n`);
} | [
"async",
"function",
"_expectPackageVersion",
"(",
"args",
")",
"{",
"const",
"packageVersion",
"=",
"require",
"(",
"path",
".",
"resolve",
"(",
"__dirname",
",",
"'../../package.json'",
")",
")",
".",
"version",
";",
"await",
"_expectSuccessMessage",
"(",
"arg... | Helper function to run the CLI command with args and check the expected CLI
version.
@param {string} args The args to be sent to the CLI command.
@async
@private | [
"Helper",
"function",
"to",
"run",
"the",
"CLI",
"command",
"with",
"args",
"and",
"check",
"the",
"expected",
"CLI",
"version",
"."
] | 7cba4eb6b4846648471662e0265aacd5a7f18645 | https://github.com/back4app/antframework/blob/7cba4eb6b4846648471662e0265aacd5a7f18645/packages/ant-cli/spec/bin/ant.spec.js#L111-L116 |
34,850 | glayzzle/php-reflection | src/utils/position.js | function(node) {
if (node) {
this.start = {
line: node.start.line,
column: node.start.column
};
this.end = {
line: node.end.line,
column: node.end.column
};
this.offset = {
start: node.start.offset,
end: ... | javascript | function(node) {
if (node) {
this.start = {
line: node.start.line,
column: node.start.column
};
this.end = {
line: node.end.line,
column: node.end.column
};
this.offset = {
start: node.start.offset,
end: ... | [
"function",
"(",
"node",
")",
"{",
"if",
"(",
"node",
")",
"{",
"this",
".",
"start",
"=",
"{",
"line",
":",
"node",
".",
"start",
".",
"line",
",",
"column",
":",
"node",
".",
"start",
".",
"column",
"}",
";",
"this",
".",
"end",
"=",
"{",
"... | Defines a position object
@constructor Position
@property {Object} start
@property {Object} end
@property {Object} offset | [
"Defines",
"a",
"position",
"object"
] | 5a636a31a5f5e3f1745987c60d8b69665def3ca9 | https://github.com/glayzzle/php-reflection/blob/5a636a31a5f5e3f1745987c60d8b69665def3ca9/src/utils/position.js#L15-L30 | |
34,851 | jbhannah/amperize | lib/amperize.js | Amperize | function Amperize(options) {
this.config = _.merge({}, DEFAULTS, options || {});
this.emits = emits;
this.htmlParser = new html.Parser(
new html.DomHandler(this.emits('read'))
);
} | javascript | function Amperize(options) {
this.config = _.merge({}, DEFAULTS, options || {});
this.emits = emits;
this.htmlParser = new html.Parser(
new html.DomHandler(this.emits('read'))
);
} | [
"function",
"Amperize",
"(",
"options",
")",
"{",
"this",
".",
"config",
"=",
"_",
".",
"merge",
"(",
"{",
"}",
",",
"DEFAULTS",
",",
"options",
"||",
"{",
"}",
")",
";",
"this",
".",
"emits",
"=",
"emits",
";",
"this",
".",
"htmlParser",
"=",
"n... | Amperizer constructor. Borrows from Minimize.
https://github.com/Swaagie/minimize/blob/4b815e274a424ca89551d28c4e0dd8b06d9bbdc2/lib/minimize.js#L15
@constructor
@param {Object} options Options object
@api public | [
"Amperizer",
"constructor",
".",
"Borrows",
"from",
"Minimize",
"."
] | 07eaf97136176cc5282702c688cfeef3e70991fb | https://github.com/jbhannah/amperize/blob/07eaf97136176cc5282702c688cfeef3e70991fb/lib/amperize.js#L43-L50 |
34,852 | back4app/antframework | plugins/ant-graphql/functions/resolve.js | resolve | async function resolve (ant, resolveArgs, fieldArgs, currentValue, model) {
let field = null;
if (model) {
field = model.field;
}
if (ant && resolveArgs && resolveArgs.to) {
const antFunction = ant.functionController.getFunction(resolveArgs.to);
if (!antFunction) {
logger.error(new AntError(
... | javascript | async function resolve (ant, resolveArgs, fieldArgs, currentValue, model) {
let field = null;
if (model) {
field = model.field;
}
if (ant && resolveArgs && resolveArgs.to) {
const antFunction = ant.functionController.getFunction(resolveArgs.to);
if (!antFunction) {
logger.error(new AntError(
... | [
"async",
"function",
"resolve",
"(",
"ant",
",",
"resolveArgs",
",",
"fieldArgs",
",",
"currentValue",
",",
"model",
")",
"{",
"let",
"field",
"=",
"null",
";",
"if",
"(",
"model",
")",
"{",
"field",
"=",
"model",
".",
"field",
";",
"}",
"if",
"(",
... | This function resolves a GraphQL field value. | [
"This",
"function",
"resolves",
"a",
"GraphQL",
"field",
"value",
"."
] | 7cba4eb6b4846648471662e0265aacd5a7f18645 | https://github.com/back4app/antframework/blob/7cba4eb6b4846648471662e0265aacd5a7f18645/plugins/ant-graphql/functions/resolve.js#L12-L54 |
34,853 | jasonmorita/react-redux-ui-state | dist/index.js | dispatchToProps | function dispatchToProps(dispatch) {
return {
add: function add() {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var name = arguments[1];
return dispatch({
type: generateType(types.add, name),
payload... | javascript | function dispatchToProps(dispatch) {
return {
add: function add() {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var name = arguments[1];
return dispatch({
type: generateType(types.add, name),
payload... | [
"function",
"dispatchToProps",
"(",
"dispatch",
")",
"{",
"return",
"{",
"add",
":",
"function",
"add",
"(",
")",
"{",
"var",
"state",
"=",
"arguments",
".",
"length",
">",
"0",
"&&",
"arguments",
"[",
"0",
"]",
"!==",
"undefined",
"?",
"arguments",
"[... | these are set as props on the HOC | [
"these",
"are",
"set",
"as",
"props",
"on",
"the",
"HOC"
] | 366a896f260c0ec3948afed86b2edf80ba9307af | https://github.com/jasonmorita/react-redux-ui-state/blob/366a896f260c0ec3948afed86b2edf80ba9307af/dist/index.js#L74-L121 |
34,854 | dudemelo/sails-hook-flash | lib/flash.js | function (type) {
if (this.has(type)) {
var messages = req.session[_session_key][type];
delete req.session[_session_key][type];
}
return messages||[];
} | javascript | function (type) {
if (this.has(type)) {
var messages = req.session[_session_key][type];
delete req.session[_session_key][type];
}
return messages||[];
} | [
"function",
"(",
"type",
")",
"{",
"if",
"(",
"this",
".",
"has",
"(",
"type",
")",
")",
"{",
"var",
"messages",
"=",
"req",
".",
"session",
"[",
"_session_key",
"]",
"[",
"type",
"]",
";",
"delete",
"req",
".",
"session",
"[",
"_session_key",
"]",... | Get a specific type of flash messages
@param {string} type
@return {object} | [
"Get",
"a",
"specific",
"type",
"of",
"flash",
"messages"
] | f23f00239b4d2d9f1925920ebd7da45e42c3d79d | https://github.com/dudemelo/sails-hook-flash/blob/f23f00239b4d2d9f1925920ebd7da45e42c3d79d/lib/flash.js#L59-L65 | |
34,855 | frdmn/openssl-cert-tools | lib/certificate.js | function (host, port, cb) {
var err,
data = {};
var openssl = spawn('openssl', ['s_client', '-connect', host + ':' + port, '-servername', host]);
// Clear timeout when execution was successful
openssl.on('exit', function(){
clearTimeout(timeoutTimer);
});
// Catch stderr and sea... | javascript | function (host, port, cb) {
var err,
data = {};
var openssl = spawn('openssl', ['s_client', '-connect', host + ':' + port, '-servername', host]);
// Clear timeout when execution was successful
openssl.on('exit', function(){
clearTimeout(timeoutTimer);
});
// Catch stderr and sea... | [
"function",
"(",
"host",
",",
"port",
",",
"cb",
")",
"{",
"var",
"err",
",",
"data",
"=",
"{",
"}",
";",
"var",
"openssl",
"=",
"spawn",
"(",
"'openssl'",
",",
"[",
"'s_client'",
",",
"'-connect'",
",",
"host",
"+",
"':'",
"+",
"port",
",",
"'-s... | Download certificate from remote host
@param {String} host Input hostname
@param {String} port Input port
@param {Function} cb Callback
@return {Error} err, {Object} data Error and data object | [
"Download",
"certificate",
"from",
"remote",
"host"
] | 20cb9530459e83f0a22a928f06b776681c9d7dfa | https://github.com/frdmn/openssl-cert-tools/blob/20cb9530459e83f0a22a928f06b776681c9d7dfa/lib/certificate.js#L19-L74 | |
34,856 | EdwonLim/node-sass-china | scripts/install.js | applyProxy | function applyProxy(options, cb) {
npmconf.load({}, function (er, conf) {
var proxyUrl;
if (!er) {
proxyUrl = conf.get('https-proxy') ||
conf.get('proxy') ||
conf.get('http-proxy');
}
var env = process.env;
options.proxy = proxyUrl ||
... | javascript | function applyProxy(options, cb) {
npmconf.load({}, function (er, conf) {
var proxyUrl;
if (!er) {
proxyUrl = conf.get('https-proxy') ||
conf.get('proxy') ||
conf.get('http-proxy');
}
var env = process.env;
options.proxy = proxyUrl ||
... | [
"function",
"applyProxy",
"(",
"options",
",",
"cb",
")",
"{",
"npmconf",
".",
"load",
"(",
"{",
"}",
",",
"function",
"(",
"er",
",",
"conf",
")",
"{",
"var",
"proxyUrl",
";",
"if",
"(",
"!",
"er",
")",
"{",
"proxyUrl",
"=",
"conf",
".",
"get",
... | Get applyProxy settings
@param {Object} options
@param {Function} cb
@api private | [
"Get",
"applyProxy",
"settings"
] | 96c13a84e4d68f20d9c5388ad58e2750c2ce786f | https://github.com/EdwonLim/node-sass-china/blob/96c13a84e4d68f20d9c5388ad58e2750c2ce786f/scripts/install.js#L67-L87 |
34,857 | ractivejs/ractive-load | dist/ractive-load.es.js | generateSourceMap | function generateSourceMap ( definition, options ) {
if ( options === void 0 ) { options = {}; }
if ( 'padding' in options ) {
options.offset = options.padding;
if ( !alreadyWarned ) {
console.warn( 'rcu: options.padding is deprecated, use options.offset instead' ); // eslint-disable-line no-console
alrea... | javascript | function generateSourceMap ( definition, options ) {
if ( options === void 0 ) { options = {}; }
if ( 'padding' in options ) {
options.offset = options.padding;
if ( !alreadyWarned ) {
console.warn( 'rcu: options.padding is deprecated, use options.offset instead' ); // eslint-disable-line no-console
alrea... | [
"function",
"generateSourceMap",
"(",
"definition",
",",
"options",
")",
"{",
"if",
"(",
"options",
"===",
"void",
"0",
")",
"{",
"options",
"=",
"{",
"}",
";",
"}",
"if",
"(",
"'padding'",
"in",
"options",
")",
"{",
"options",
".",
"offset",
"=",
"o... | Generates a v3 sourcemap between an original source and its built form
@param {object} definition - the result of `rcu.parse( originalSource )`
@param {object} options
@param {string} options.source - the name of the original source file
@param {number=} options.offset - the number of lines in the generated
code that p... | [
"Generates",
"a",
"v3",
"sourcemap",
"between",
"an",
"original",
"source",
"and",
"its",
"built",
"form"
] | 5fdb5e1b7c12c21330d7c96c8f281e149fb1df81 | https://github.com/ractivejs/ractive-load/blob/5fdb5e1b7c12c21330d7c96c8f281e149fb1df81/dist/ractive-load.es.js#L88-L155 |
34,858 | back4app/antframework | packages/ant-util-yargs/lib/yargsHelper.js | handleErrorMessage | function handleErrorMessage (msg, err, command, exitProcess) {
setErrorHandled();
console.error(`Fatal => ${msg}`);
if (err) {
console.error();
if (isVerboseMode()) {
console.error('Error stack:');
console.error(err.stack);
} else {
console.error('For getting the error stack, use --v... | javascript | function handleErrorMessage (msg, err, command, exitProcess) {
setErrorHandled();
console.error(`Fatal => ${msg}`);
if (err) {
console.error();
if (isVerboseMode()) {
console.error('Error stack:');
console.error(err.stack);
} else {
console.error('For getting the error stack, use --v... | [
"function",
"handleErrorMessage",
"(",
"msg",
",",
"err",
",",
"command",
",",
"exitProcess",
")",
"{",
"setErrorHandled",
"(",
")",
";",
"console",
".",
"error",
"(",
"`",
"${",
"msg",
"}",
"`",
")",
";",
"if",
"(",
"err",
")",
"{",
"console",
".",
... | Helper function that can be used to handle and print error messages occurred
during Yargs parsing and execution.
@param {String} msg The error message.
@param {Error} err The error that generated the problem.
@param {String} command The command that failed.
@param {Boolean} exitProcess Flag indicating it should invoke ... | [
"Helper",
"function",
"that",
"can",
"be",
"used",
"to",
"handle",
"and",
"print",
"error",
"messages",
"occurred",
"during",
"Yargs",
"parsing",
"and",
"execution",
"."
] | 7cba4eb6b4846648471662e0265aacd5a7f18645 | https://github.com/back4app/antframework/blob/7cba4eb6b4846648471662e0265aacd5a7f18645/packages/ant-util-yargs/lib/yargsHelper.js#L44-L68 |
34,859 | back4app/antframework | packages/ant-util-yargs/lib/yargsHelper.js | attachFailHandler | function attachFailHandler (yargs, handler) {
yargs.fail((msg, err, usage) => {
// If failure was handled previously, does nothing.
if (errorHandled) {
return;
}
handler(msg, err, usage);
if (errorHandled) {
// Workaround to avoid yargs from running the command.
// Since yargs ha... | javascript | function attachFailHandler (yargs, handler) {
yargs.fail((msg, err, usage) => {
// If failure was handled previously, does nothing.
if (errorHandled) {
return;
}
handler(msg, err, usage);
if (errorHandled) {
// Workaround to avoid yargs from running the command.
// Since yargs ha... | [
"function",
"attachFailHandler",
"(",
"yargs",
",",
"handler",
")",
"{",
"yargs",
".",
"fail",
"(",
"(",
"msg",
",",
"err",
",",
"usage",
")",
"=>",
"{",
"// If failure was handled previously, does nothing.",
"if",
"(",
"errorHandled",
")",
"{",
"return",
";",... | Attaches an error handler into the Yargs instance.
Guarantees the single error handling with the `errorHandled` flag,
which can be set with the `setErrorHandled` function.
@param {!Yargs} yargs The [Yargs]{@link https://github.com/yargs/yargs/blob/master/yargs.js}
instance.
@param {!Function} handler The error handle... | [
"Attaches",
"an",
"error",
"handler",
"into",
"the",
"Yargs",
"instance",
"."
] | 7cba4eb6b4846648471662e0265aacd5a7f18645 | https://github.com/back4app/antframework/blob/7cba4eb6b4846648471662e0265aacd5a7f18645/packages/ant-util-yargs/lib/yargsHelper.js#L80-L98 |
34,860 | back4app/antframework | packages/ant-util-yargs/lib/yargsHelper.js | executeCommand | async function executeCommand(command, asyncFn) {
try {
await asyncFn();
process.exit(0);
} catch (e) {
handleErrorMessage(e.message, e, command);
}
} | javascript | async function executeCommand(command, asyncFn) {
try {
await asyncFn();
process.exit(0);
} catch (e) {
handleErrorMessage(e.message, e, command);
}
} | [
"async",
"function",
"executeCommand",
"(",
"command",
",",
"asyncFn",
")",
"{",
"try",
"{",
"await",
"asyncFn",
"(",
")",
";",
"process",
".",
"exit",
"(",
"0",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"handleErrorMessage",
"(",
"e",
".",
"messag... | Helper function encapsulates an asynchronous function to be executed
and handled on any errors thrown, providing a friendly error message
based on the command that this function represents.
In case of success, the process is exit with code 0.
In case of failure, the process is exit with code 1.
@param {!String} comman... | [
"Helper",
"function",
"encapsulates",
"an",
"asynchronous",
"function",
"to",
"be",
"executed",
"and",
"handled",
"on",
"any",
"errors",
"thrown",
"providing",
"a",
"friendly",
"error",
"message",
"based",
"on",
"the",
"command",
"that",
"this",
"function",
"rep... | 7cba4eb6b4846648471662e0265aacd5a7f18645 | https://github.com/back4app/antframework/blob/7cba4eb6b4846648471662e0265aacd5a7f18645/packages/ant-util-yargs/lib/yargsHelper.js#L129-L136 |
34,861 | back4app/antframework | plugins/ant-graphql/functions/subscribe.js | subscribe | async function subscribe (ant, field, directiveArgs, fieldArgs) {
if (ant && field && directiveArgs && directiveArgs.to) {
const antFunction = ant.functionController.getFunction(directiveArgs.to);
if (!antFunction) {
logger.error(new AntError(
`Could not find "${directiveArgs.to}" function`
... | javascript | async function subscribe (ant, field, directiveArgs, fieldArgs) {
if (ant && field && directiveArgs && directiveArgs.to) {
const antFunction = ant.functionController.getFunction(directiveArgs.to);
if (!antFunction) {
logger.error(new AntError(
`Could not find "${directiveArgs.to}" function`
... | [
"async",
"function",
"subscribe",
"(",
"ant",
",",
"field",
",",
"directiveArgs",
",",
"fieldArgs",
")",
"{",
"if",
"(",
"ant",
"&&",
"field",
"&&",
"directiveArgs",
"&&",
"directiveArgs",
".",
"to",
")",
"{",
"const",
"antFunction",
"=",
"ant",
".",
"fu... | This function resolves a GraphQL @subscribe directive value. | [
"This",
"function",
"resolves",
"a",
"GraphQL"
] | 7cba4eb6b4846648471662e0265aacd5a7f18645 | https://github.com/back4app/antframework/blob/7cba4eb6b4846648471662e0265aacd5a7f18645/plugins/ant-graphql/functions/subscribe.js#L12-L35 |
34,862 | bosonic/bosonic | dist/bosonic-runtime.js | function(inEvent) {
var eventCopy = Object.create(null);
var p;
for (var i = 0; i < CLONE_PROPS.length; i++) {
p = CLONE_PROPS[i];
eventCopy[p] = inEvent[p] || CLONE_DEFAULTS[i];
// Work around SVGInstanceElement shadow tree
// Return the <use> element that is represen... | javascript | function(inEvent) {
var eventCopy = Object.create(null);
var p;
for (var i = 0; i < CLONE_PROPS.length; i++) {
p = CLONE_PROPS[i];
eventCopy[p] = inEvent[p] || CLONE_DEFAULTS[i];
// Work around SVGInstanceElement shadow tree
// Return the <use> element that is represen... | [
"function",
"(",
"inEvent",
")",
"{",
"var",
"eventCopy",
"=",
"Object",
".",
"create",
"(",
"null",
")",
";",
"var",
"p",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"CLONE_PROPS",
".",
"length",
";",
"i",
"++",
")",
"{",
"p",
"=",
... | Returns a snapshot of inEvent, with writable properties.
@param {Event} inEvent An event that contains properties to copy.
@return {Object} An object containing shallow copies of `inEvent`'s
properties. | [
"Returns",
"a",
"snapshot",
"of",
"inEvent",
"with",
"writable",
"properties",
"."
] | b2d1b892e79f1d9bf7a9762205ea187cf24b8acd | https://github.com/bosonic/bosonic/blob/b2d1b892e79f1d9bf7a9762205ea187cf24b8acd/dist/bosonic-runtime.js#L426-L450 | |
34,863 | bosonic/bosonic | dist/bosonic-runtime.js | function(inEvent) {
var lts = mouse.lastTouches;
var t = inEvent.changedTouches[0];
// only the primary finger will synth mouse events
if (this.isPrimaryTouch(t)) {
// remember x/y of last touch
var lt = { x: t.clientX, y: t.clientY };
lts.push(lt);
var fn = (fu... | javascript | function(inEvent) {
var lts = mouse.lastTouches;
var t = inEvent.changedTouches[0];
// only the primary finger will synth mouse events
if (this.isPrimaryTouch(t)) {
// remember x/y of last touch
var lt = { x: t.clientX, y: t.clientY };
lts.push(lt);
var fn = (fu... | [
"function",
"(",
"inEvent",
")",
"{",
"var",
"lts",
"=",
"mouse",
".",
"lastTouches",
";",
"var",
"t",
"=",
"inEvent",
".",
"changedTouches",
"[",
"0",
"]",
";",
"// only the primary finger will synth mouse events",
"if",
"(",
"this",
".",
"isPrimaryTouch",
"(... | prevent synth mouse events from creating pointer events | [
"prevent",
"synth",
"mouse",
"events",
"from",
"creating",
"pointer",
"events"
] | b2d1b892e79f1d9bf7a9762205ea187cf24b8acd | https://github.com/bosonic/bosonic/blob/b2d1b892e79f1d9bf7a9762205ea187cf24b8acd/dist/bosonic-runtime.js#L1237-L1255 | |
34,864 | bosonic/bosonic | dist/bosonic-runtime.js | function(name, bool, node) {
node = node || this;
if (arguments.length == 1) {
bool = !node.hasAttribute(name) || node.getAttribute(name) == 'false';
}
bool ? node.setAttribute(name, 'true') : node.setAttribute(name, 'false');
} | javascript | function(name, bool, node) {
node = node || this;
if (arguments.length == 1) {
bool = !node.hasAttribute(name) || node.getAttribute(name) == 'false';
}
bool ? node.setAttribute(name, 'true') : node.setAttribute(name, 'false');
} | [
"function",
"(",
"name",
",",
"bool",
",",
"node",
")",
"{",
"node",
"=",
"node",
"||",
"this",
";",
"if",
"(",
"arguments",
".",
"length",
"==",
"1",
")",
"{",
"bool",
"=",
"!",
"node",
".",
"hasAttribute",
"(",
"name",
")",
"||",
"node",
".",
... | for ARIA state properties | [
"for",
"ARIA",
"state",
"properties"
] | b2d1b892e79f1d9bf7a9762205ea187cf24b8acd | https://github.com/bosonic/bosonic/blob/b2d1b892e79f1d9bf7a9762205ea187cf24b8acd/dist/bosonic-runtime.js#L1781-L1787 | |
34,865 | back4app/antframework | plugins/ant-graphql/lib/util/schemaHelper.js | generateSchema | function generateSchema(ant, graphQL, _model) {
let model = [];
if (graphQL) {
for (const directive of graphQL.directiveController.directives) {
const directiveDefinition = graphQL.directiveController
.getDirectiveDefinition(directive);
if (directiveDefinition) {
model.push(directiv... | javascript | function generateSchema(ant, graphQL, _model) {
let model = [];
if (graphQL) {
for (const directive of graphQL.directiveController.directives) {
const directiveDefinition = graphQL.directiveController
.getDirectiveDefinition(directive);
if (directiveDefinition) {
model.push(directiv... | [
"function",
"generateSchema",
"(",
"ant",
",",
"graphQL",
",",
"_model",
")",
"{",
"let",
"model",
"=",
"[",
"]",
";",
"if",
"(",
"graphQL",
")",
"{",
"for",
"(",
"const",
"directive",
"of",
"graphQL",
".",
"directiveController",
".",
"directives",
")",
... | Helper function that can be used to generate a GraphQL schema from Ant
Framework's config.
@param {Ant} ant The {@link Ant} framework instance.
@param {GraphQL} graphQL The {@link GraphQL} plugin instance.
@param {String} _model An optional pre-loaded GraphQL model to be used
instead of requiring the GraphQL plugin to ... | [
"Helper",
"function",
"that",
"can",
"be",
"used",
"to",
"generate",
"a",
"GraphQL",
"schema",
"from",
"Ant",
"Framework",
"s",
"config",
"."
] | 7cba4eb6b4846648471662e0265aacd5a7f18645 | https://github.com/back4app/antframework/blob/7cba4eb6b4846648471662e0265aacd5a7f18645/plugins/ant-graphql/lib/util/schemaHelper.js#L21-L127 |
34,866 | Adeptive/Loxone-NodeJS | loxone-api.js | function(url, callback) {
url = getBaseUrl() + url;
http.get(url, function(response) {
var output = "";
response.on('data', function (chunk) {
output += chunk;
});
response.on('end', function() {
output = JSON.parse(output... | javascript | function(url, callback) {
url = getBaseUrl() + url;
http.get(url, function(response) {
var output = "";
response.on('data', function (chunk) {
output += chunk;
});
response.on('end', function() {
output = JSON.parse(output... | [
"function",
"(",
"url",
",",
"callback",
")",
"{",
"url",
"=",
"getBaseUrl",
"(",
")",
"+",
"url",
";",
"http",
".",
"get",
"(",
"url",
",",
"function",
"(",
"response",
")",
"{",
"var",
"output",
"=",
"\"\"",
";",
"response",
".",
"on",
"(",
"'d... | UTILITY METHODS +++++++++++++++++++++++++++++ | [
"UTILITY",
"METHODS",
"+++++++++++++++++++++++++++++"
] | 8e047dbace33341dc07da4f9a1c304ae0dc85c7f | https://github.com/Adeptive/Loxone-NodeJS/blob/8e047dbace33341dc07da4f9a1c304ae0dc85c7f/loxone-api.js#L77-L113 | |
34,867 | mikolalysenko/ao-mesher | mesh.js | facetAO | function facetAO(a00, a01, a02,
a10, a12,
a20, a21, a22) {
var s00 = (a00&OPAQUE_BIT) ? 1 : 0
, s01 = (a01&OPAQUE_BIT) ? 1 : 0
, s02 = (a02&OPAQUE_BIT) ? 1 : 0
, s10 = (a10&OPAQUE_BIT) ? 1 : 0
, s12 = (a12&OPAQUE_BIT) ? 1 : 0
, s20 = (a20&OPAQUE_BIT) ? 1 : 0
... | javascript | function facetAO(a00, a01, a02,
a10, a12,
a20, a21, a22) {
var s00 = (a00&OPAQUE_BIT) ? 1 : 0
, s01 = (a01&OPAQUE_BIT) ? 1 : 0
, s02 = (a02&OPAQUE_BIT) ? 1 : 0
, s10 = (a10&OPAQUE_BIT) ? 1 : 0
, s12 = (a12&OPAQUE_BIT) ? 1 : 0
, s20 = (a20&OPAQUE_BIT) ? 1 : 0
... | [
"function",
"facetAO",
"(",
"a00",
",",
"a01",
",",
"a02",
",",
"a10",
",",
"a12",
",",
"a20",
",",
"a21",
",",
"a22",
")",
"{",
"var",
"s00",
"=",
"(",
"a00",
"&",
"OPAQUE_BIT",
")",
"?",
"1",
":",
"0",
",",
"s01",
"=",
"(",
"a01",
"&",
"O... | Calculates the ambient occlusion bit mask for a facet | [
"Calculates",
"the",
"ambient",
"occlusion",
"bit",
"mask",
"for",
"a",
"facet"
] | d0a22c2d20fae6e3f64ec64bb8a7f6e35745aeae | https://github.com/mikolalysenko/ao-mesher/blob/d0a22c2d20fae6e3f64ec64bb8a7f6e35745aeae/mesh.js#L48-L63 |
34,868 | mikolalysenko/ao-mesher | mesh.js | generateSurfaceVoxel | function generateSurfaceVoxel(
v000, v001, v002,
v010, v011, v012,
v020, v021, v022,
v100, v101, v102,
v110, v111, v112,
v120, v121, v122) {
var t0 = !(v011 & OPAQUE_BIT)
, t1 = !(v111 & OPAQUE_BIT)
if(v111 && (!v011 || (t0 && !t1))) {
return v111 | FLIP_BIT | facetAO(v000, v001, v002,
... | javascript | function generateSurfaceVoxel(
v000, v001, v002,
v010, v011, v012,
v020, v021, v022,
v100, v101, v102,
v110, v111, v112,
v120, v121, v122) {
var t0 = !(v011 & OPAQUE_BIT)
, t1 = !(v111 & OPAQUE_BIT)
if(v111 && (!v011 || (t0 && !t1))) {
return v111 | FLIP_BIT | facetAO(v000, v001, v002,
... | [
"function",
"generateSurfaceVoxel",
"(",
"v000",
",",
"v001",
",",
"v002",
",",
"v010",
",",
"v011",
",",
"v012",
",",
"v020",
",",
"v021",
",",
"v022",
",",
"v100",
",",
"v101",
",",
"v102",
",",
"v110",
",",
"v111",
",",
"v112",
",",
"v120",
",",... | Generates a surface voxel, complete with ambient occlusion type | [
"Generates",
"a",
"surface",
"voxel",
"complete",
"with",
"ambient",
"occlusion",
"type"
] | d0a22c2d20fae6e3f64ec64bb8a7f6e35745aeae | https://github.com/mikolalysenko/ao-mesher/blob/d0a22c2d20fae6e3f64ec64bb8a7f6e35745aeae/mesh.js#L66-L84 |
34,869 | soplakanets/node-forecastio | index.js | ForecastIoAPIError | function ForecastIoAPIError(url, statusCode, body) {
this.response = {
statusCode: statusCode,
body: body
};
this.message = this._formatErrorMessage(body);
this.name = "ForecastIoAPIError";
Error.call(this);
Error.captureStackTrace(this, arguments.callee);
this.request = "GET " + url;
} | javascript | function ForecastIoAPIError(url, statusCode, body) {
this.response = {
statusCode: statusCode,
body: body
};
this.message = this._formatErrorMessage(body);
this.name = "ForecastIoAPIError";
Error.call(this);
Error.captureStackTrace(this, arguments.callee);
this.request = "GET " + url;
} | [
"function",
"ForecastIoAPIError",
"(",
"url",
",",
"statusCode",
",",
"body",
")",
"{",
"this",
".",
"response",
"=",
"{",
"statusCode",
":",
"statusCode",
",",
"body",
":",
"body",
"}",
";",
"this",
".",
"message",
"=",
"this",
".",
"_formatErrorMessage",... | Represents API errors. | [
"Represents",
"API",
"errors",
"."
] | 7082666ef19c358b3adcdf667aba34b5394d69e8 | https://github.com/soplakanets/node-forecastio/blob/7082666ef19c358b3adcdf667aba34b5394d69e8/index.js#L85-L95 |
34,870 | EdwonLim/node-sass-china | lib/extensions.js | getRuntimeInfo | function getRuntimeInfo() {
var execPath = fs.realpathSync(process.execPath); // resolve symbolic link
var runtime = execPath
.split(/[\\/]+/).pop()
.split('.').shift();
runtime = runtime === 'nodejs' ? 'node' : runtime;
return {
name: runtime,
execPath: execPath
};
} | javascript | function getRuntimeInfo() {
var execPath = fs.realpathSync(process.execPath); // resolve symbolic link
var runtime = execPath
.split(/[\\/]+/).pop()
.split('.').shift();
runtime = runtime === 'nodejs' ? 'node' : runtime;
return {
name: runtime,
execPath: execPath
};
} | [
"function",
"getRuntimeInfo",
"(",
")",
"{",
"var",
"execPath",
"=",
"fs",
".",
"realpathSync",
"(",
"process",
".",
"execPath",
")",
";",
"// resolve symbolic link",
"var",
"runtime",
"=",
"execPath",
".",
"split",
"(",
"/",
"[\\\\/]+",
"/",
")",
".",
"po... | Get Runtime Info
@api private | [
"Get",
"Runtime",
"Info"
] | 96c13a84e4d68f20d9c5388ad58e2750c2ce786f | https://github.com/EdwonLim/node-sass-china/blob/96c13a84e4d68f20d9c5388ad58e2750c2ce786f/lib/extensions.js#L34-L47 |
34,871 | EdwonLim/node-sass-china | lib/extensions.js | getBinaryUrl | function getBinaryUrl() {
var site = flags['--sass-binary-site'] ||
process.env.SASS_BINARY_SITE ||
pkg.nodeSassConfig.binarySite;
return [site, 'v' + pkg.version, sass.binaryName].join('/');
} | javascript | function getBinaryUrl() {
var site = flags['--sass-binary-site'] ||
process.env.SASS_BINARY_SITE ||
pkg.nodeSassConfig.binarySite;
return [site, 'v' + pkg.version, sass.binaryName].join('/');
} | [
"function",
"getBinaryUrl",
"(",
")",
"{",
"var",
"site",
"=",
"flags",
"[",
"'--sass-binary-site'",
"]",
"||",
"process",
".",
"env",
".",
"SASS_BINARY_SITE",
"||",
"pkg",
".",
"nodeSassConfig",
".",
"binarySite",
";",
"return",
"[",
"site",
",",
"'v'",
"... | Determine the URL to fetch binary file from.
By default feth from the node-sass distribution
site on GitHub.
The default URL can be overriden using
the environment variable SASS_BINARY_SITE
or a command line option --sass-binary-site:
node scripts/install.js --sass-binary-site http://example.com/
The URL should to t... | [
"Determine",
"the",
"URL",
"to",
"fetch",
"binary",
"file",
"from",
".",
"By",
"default",
"feth",
"from",
"the",
"node",
"-",
"sass",
"distribution",
"site",
"on",
"GitHub",
"."
] | 96c13a84e4d68f20d9c5388ad58e2750c2ce786f | https://github.com/EdwonLim/node-sass-china/blob/96c13a84e4d68f20d9c5388ad58e2750c2ce786f/lib/extensions.js#L104-L109 |
34,872 | tntvis/tnt.genome | src/genome.js | function (where) {
if (where !== undefined) {
if (where.gene !== undefined) {
get_gene(where);
return;
} else {
if (where.species === undefined) {
where.species = genome_browser.species();
} else {
... | javascript | function (where) {
if (where !== undefined) {
if (where.gene !== undefined) {
get_gene(where);
return;
} else {
if (where.species === undefined) {
where.species = genome_browser.species();
} else {
... | [
"function",
"(",
"where",
")",
"{",
"if",
"(",
"where",
"!==",
"undefined",
")",
"{",
"if",
"(",
"where",
".",
"gene",
"!==",
"undefined",
")",
"{",
"get_gene",
"(",
"where",
")",
";",
"return",
";",
"}",
"else",
"{",
"if",
"(",
"where",
".",
"sp... | We hijack parent's start method | [
"We",
"hijack",
"parent",
"s",
"start",
"method"
] | 3fe11fa8b6145f181bb4baa4607a22fb360c0892 | https://github.com/tntvis/tnt.genome/blob/3fe11fa8b6145f181bb4baa4607a22fb360c0892/src/genome.js#L74-L140 | |
34,873 | alphagov/govuk_frontend_toolkit_npm | javascripts/govuk/details.polyfill.js | function (node, type, callback) {
if (node.addEventListener) {
node.addEventListener(type, function (e) {
callback(e, e.target)
}, false)
} else if (node.attachEvent) {
node.attachEvent('on' + type, function (e) {
callback(e, e.srcElement)
})
}
} | javascript | function (node, type, callback) {
if (node.addEventListener) {
node.addEventListener(type, function (e) {
callback(e, e.target)
}, false)
} else if (node.attachEvent) {
node.attachEvent('on' + type, function (e) {
callback(e, e.srcElement)
})
}
} | [
"function",
"(",
"node",
",",
"type",
",",
"callback",
")",
"{",
"if",
"(",
"node",
".",
"addEventListener",
")",
"{",
"node",
".",
"addEventListener",
"(",
"type",
",",
"function",
"(",
"e",
")",
"{",
"callback",
"(",
"e",
",",
"e",
".",
"target",
... | Add event construct for modern browsers or IE which fires the callback with a pre-converted target reference | [
"Add",
"event",
"construct",
"for",
"modern",
"browsers",
"or",
"IE",
"which",
"fires",
"the",
"callback",
"with",
"a",
"pre",
"-",
"converted",
"target",
"reference"
] | 761632e5bed24c5106f4bdbd8cc99688d8ca616d | https://github.com/alphagov/govuk_frontend_toolkit_npm/blob/761632e5bed24c5106f4bdbd8cc99688d8ca616d/javascripts/govuk/details.polyfill.js#L25-L35 | |
34,874 | alphagov/govuk_frontend_toolkit_npm | javascripts/govuk/details.polyfill.js | function (node, callback) {
GOVUK.details.addEvent(node, 'keypress', function (e, target) {
// When the key gets pressed - check if it is enter or space
if (GOVUK.details.charCode(e) === GOVUK.details.KEY_ENTER || GOVUK.details.charCode(e) === GOVUK.details.KEY_SPACE) {
if (target.nodeNa... | javascript | function (node, callback) {
GOVUK.details.addEvent(node, 'keypress', function (e, target) {
// When the key gets pressed - check if it is enter or space
if (GOVUK.details.charCode(e) === GOVUK.details.KEY_ENTER || GOVUK.details.charCode(e) === GOVUK.details.KEY_SPACE) {
if (target.nodeNa... | [
"function",
"(",
"node",
",",
"callback",
")",
"{",
"GOVUK",
".",
"details",
".",
"addEvent",
"(",
"node",
",",
"'keypress'",
",",
"function",
"(",
"e",
",",
"target",
")",
"{",
"// When the key gets pressed - check if it is enter or space",
"if",
"(",
"GOVUK",
... | Handle cross-modal click events | [
"Handle",
"cross",
"-",
"modal",
"click",
"events"
] | 761632e5bed24c5106f4bdbd8cc99688d8ca616d | https://github.com/alphagov/govuk_frontend_toolkit_npm/blob/761632e5bed24c5106f4bdbd8cc99688d8ca616d/javascripts/govuk/details.polyfill.js#L62-L93 | |
34,875 | alphagov/govuk_frontend_toolkit_npm | javascripts/govuk/details.polyfill.js | function (node, match) {
do {
if (!node || node.nodeName.toLowerCase() === match) {
break
}
node = node.parentNode
} while (node)
return node
} | javascript | function (node, match) {
do {
if (!node || node.nodeName.toLowerCase() === match) {
break
}
node = node.parentNode
} while (node)
return node
} | [
"function",
"(",
"node",
",",
"match",
")",
"{",
"do",
"{",
"if",
"(",
"!",
"node",
"||",
"node",
".",
"nodeName",
".",
"toLowerCase",
"(",
")",
"===",
"match",
")",
"{",
"break",
"}",
"node",
"=",
"node",
".",
"parentNode",
"}",
"while",
"(",
"n... | Get the nearest ancestor element of a node that matches a given tag name | [
"Get",
"the",
"nearest",
"ancestor",
"element",
"of",
"a",
"node",
"that",
"matches",
"a",
"given",
"tag",
"name"
] | 761632e5bed24c5106f4bdbd8cc99688d8ca616d | https://github.com/alphagov/govuk_frontend_toolkit_npm/blob/761632e5bed24c5106f4bdbd8cc99688d8ca616d/javascripts/govuk/details.polyfill.js#L96-L105 | |
34,876 | alphagov/govuk_frontend_toolkit_npm | javascripts/govuk/details.polyfill.js | function (summary) {
var expanded = summary.__details.__summary.getAttribute('aria-expanded') === 'true'
var hidden = summary.__details.__content.getAttribute('aria-hidden') === 'true'
summary.__details.__summary.setAttribute('aria-expanded', (expanded ? 'false' : 'true'))
summary.__details.__c... | javascript | function (summary) {
var expanded = summary.__details.__summary.getAttribute('aria-expanded') === 'true'
var hidden = summary.__details.__content.getAttribute('aria-hidden') === 'true'
summary.__details.__summary.setAttribute('aria-expanded', (expanded ? 'false' : 'true'))
summary.__details.__c... | [
"function",
"(",
"summary",
")",
"{",
"var",
"expanded",
"=",
"summary",
".",
"__details",
".",
"__summary",
".",
"getAttribute",
"(",
"'aria-expanded'",
")",
"===",
"'true'",
"var",
"hidden",
"=",
"summary",
".",
"__details",
".",
"__content",
".",
"getAttr... | Define a statechange function that updates aria-expanded and style.display Also update the arrow position | [
"Define",
"a",
"statechange",
"function",
"that",
"updates",
"aria",
"-",
"expanded",
"and",
"style",
".",
"display",
"Also",
"update",
"the",
"arrow",
"position"
] | 761632e5bed24c5106f4bdbd8cc99688d8ca616d | https://github.com/alphagov/govuk_frontend_toolkit_npm/blob/761632e5bed24c5106f4bdbd8cc99688d8ca616d/javascripts/govuk/details.polyfill.js#L201-L225 | |
34,877 | alphagov/govuk_frontend_toolkit_npm | javascripts/govuk/details.polyfill.js | function ($container) {
GOVUK.details.addEvent(document, 'DOMContentLoaded', GOVUK.details.addDetailsPolyfill)
GOVUK.details.addEvent(window, 'load', GOVUK.details.addDetailsPolyfill)
} | javascript | function ($container) {
GOVUK.details.addEvent(document, 'DOMContentLoaded', GOVUK.details.addDetailsPolyfill)
GOVUK.details.addEvent(window, 'load', GOVUK.details.addDetailsPolyfill)
} | [
"function",
"(",
"$container",
")",
"{",
"GOVUK",
".",
"details",
".",
"addEvent",
"(",
"document",
",",
"'DOMContentLoaded'",
",",
"GOVUK",
".",
"details",
".",
"addDetailsPolyfill",
")",
"GOVUK",
".",
"details",
".",
"addEvent",
"(",
"window",
",",
"'load'... | Bind two load events for modern and older browsers If the first one fires it will set a flag to block the second one but if it's not supported then the second one will fire | [
"Bind",
"two",
"load",
"events",
"for",
"modern",
"and",
"older",
"browsers",
"If",
"the",
"first",
"one",
"fires",
"it",
"will",
"set",
"a",
"flag",
"to",
"block",
"the",
"second",
"one",
"but",
"if",
"it",
"s",
"not",
"supported",
"then",
"the",
"sec... | 761632e5bed24c5106f4bdbd8cc99688d8ca616d | https://github.com/alphagov/govuk_frontend_toolkit_npm/blob/761632e5bed24c5106f4bdbd8cc99688d8ca616d/javascripts/govuk/details.polyfill.js#L234-L237 | |
34,878 | lukem512/pronounceable | pronounceable.js | undef | function undef(w, i, depth, probs) {
if (depth <= 1) return typeof probs[w[i]] === "undefined";
if (typeof probs[w[i]] === "undefined") return true;
return undef(w, i + 1, depth - 1, probs[w[i]]);
} | javascript | function undef(w, i, depth, probs) {
if (depth <= 1) return typeof probs[w[i]] === "undefined";
if (typeof probs[w[i]] === "undefined") return true;
return undef(w, i + 1, depth - 1, probs[w[i]]);
} | [
"function",
"undef",
"(",
"w",
",",
"i",
",",
"depth",
",",
"probs",
")",
"{",
"if",
"(",
"depth",
"<=",
"1",
")",
"return",
"typeof",
"probs",
"[",
"w",
"[",
"i",
"]",
"]",
"===",
"\"undefined\"",
";",
"if",
"(",
"typeof",
"probs",
"[",
"w",
"... | Check for undefined probabilities. | [
"Check",
"for",
"undefined",
"probabilities",
"."
] | 5719a96fe9e9b87e0f1f9b56c19b88f06a9ad9cf | https://github.com/lukem512/pronounceable/blob/5719a96fe9e9b87e0f1f9b56c19b88f06a9ad9cf/pronounceable.js#L29-L33 |
34,879 | lukem512/pronounceable | pronounceable.js | trainTuples | function trainTuples(words) {
var probs = {};
var count = 0;
words.forEach(function(w) {
w = clean(w);
for (var i = 0; i < w.length - 1; i++) {
if (!probs[w[i]]) probs[w[i]] = {};
if (!probs[w[i]][w[i + 1]]) probs[w[i]][w[i + 1]] = 1;
else probs[w[i]][w[i + 1]]++;
count++;
}
... | javascript | function trainTuples(words) {
var probs = {};
var count = 0;
words.forEach(function(w) {
w = clean(w);
for (var i = 0; i < w.length - 1; i++) {
if (!probs[w[i]]) probs[w[i]] = {};
if (!probs[w[i]][w[i + 1]]) probs[w[i]][w[i + 1]] = 1;
else probs[w[i]][w[i + 1]]++;
count++;
}
... | [
"function",
"trainTuples",
"(",
"words",
")",
"{",
"var",
"probs",
"=",
"{",
"}",
";",
"var",
"count",
"=",
"0",
";",
"words",
".",
"forEach",
"(",
"function",
"(",
"w",
")",
"{",
"w",
"=",
"clean",
"(",
"w",
")",
";",
"for",
"(",
"var",
"i",
... | Extract probabilities of word t uple. | [
"Extract",
"probabilities",
"of",
"word",
"t",
"uple",
"."
] | 5719a96fe9e9b87e0f1f9b56c19b88f06a9ad9cf | https://github.com/lukem512/pronounceable/blob/5719a96fe9e9b87e0f1f9b56c19b88f06a9ad9cf/pronounceable.js#L36-L58 |
34,880 | lukem512/pronounceable | pronounceable.js | trainTriples | function trainTriples(words) {
var probs = {};
var count = 0;
words.forEach(function(w) {
w = clean(w);
for (var i = 0; i < w.length - 2; i++) {
if (!probs[w[i]]) probs[w[i]] = {};
if (!probs[w[i]][w[i + 1]]) probs[w[i]][w[i + 1]] = {};
if (!probs[w[i]][w[i + 1]][w[i + 2]]) probs[w[i]]... | javascript | function trainTriples(words) {
var probs = {};
var count = 0;
words.forEach(function(w) {
w = clean(w);
for (var i = 0; i < w.length - 2; i++) {
if (!probs[w[i]]) probs[w[i]] = {};
if (!probs[w[i]][w[i + 1]]) probs[w[i]][w[i + 1]] = {};
if (!probs[w[i]][w[i + 1]][w[i + 2]]) probs[w[i]]... | [
"function",
"trainTriples",
"(",
"words",
")",
"{",
"var",
"probs",
"=",
"{",
"}",
";",
"var",
"count",
"=",
"0",
";",
"words",
".",
"forEach",
"(",
"function",
"(",
"w",
")",
"{",
"w",
"=",
"clean",
"(",
"w",
")",
";",
"for",
"(",
"var",
"i",
... | Extract probabilities of word triples. | [
"Extract",
"probabilities",
"of",
"word",
"triples",
"."
] | 5719a96fe9e9b87e0f1f9b56c19b88f06a9ad9cf | https://github.com/lukem512/pronounceable/blob/5719a96fe9e9b87e0f1f9b56c19b88f06a9ad9cf/pronounceable.js#L61-L89 |
34,881 | bvalosek/infusionsoft-api | infusionsoft/services/IOrderService.js | function(apiKey, contactId, creditCardId,
payPlanId, productIds, subscriptionPlanIds, processSpecials,
promoCodes, _leadAffiliatedId, _affiliatedId) {} | javascript | function(apiKey, contactId, creditCardId,
payPlanId, productIds, subscriptionPlanIds, processSpecials,
promoCodes, _leadAffiliatedId, _affiliatedId) {} | [
"function",
"(",
"apiKey",
",",
"contactId",
",",
"creditCardId",
",",
"payPlanId",
",",
"productIds",
",",
"subscriptionPlanIds",
",",
"processSpecials",
",",
"promoCodes",
",",
"_leadAffiliatedId",
",",
"_affiliatedId",
")",
"{",
"}"
] | Returns the result of order placement. The ids of the order and invoice that were created are returned along with the status of a credit card charge if one was made. | [
"Returns",
"the",
"result",
"of",
"order",
"placement",
".",
"The",
"ids",
"of",
"the",
"order",
"and",
"invoice",
"that",
"were",
"created",
"are",
"returned",
"along",
"with",
"the",
"status",
"of",
"a",
"credit",
"card",
"charge",
"if",
"one",
"was",
... | 883955e23b6f6102db24209ed81a85fb0be596b6 | https://github.com/bvalosek/infusionsoft-api/blob/883955e23b6f6102db24209ed81a85fb0be596b6/infusionsoft/services/IOrderService.js#L13-L15 | |
34,882 | maurobussini/jslinq | src/jslinq.js | equals | function equals(first, second){
//If are the same instance, true
if (first === second)
return true;
//If values are equals, return true
if (first == second)
return true;
//If different type, false
if (typeof first != typeof second)
return false;
//If are not objects, check value
if... | javascript | function equals(first, second){
//If are the same instance, true
if (first === second)
return true;
//If values are equals, return true
if (first == second)
return true;
//If different type, false
if (typeof first != typeof second)
return false;
//If are not objects, check value
if... | [
"function",
"equals",
"(",
"first",
",",
"second",
")",
"{",
"//If are the same instance, true",
"if",
"(",
"first",
"===",
"second",
")",
"return",
"true",
";",
"//If values are equals, return true",
"if",
"(",
"first",
"==",
"second",
")",
"return",
"true",
";... | Verify if first and second element are equals in values | [
"Verify",
"if",
"first",
"and",
"second",
"element",
"are",
"equals",
"in",
"values"
] | cb0bfbe079803a2899196de76916abf604664b55 | https://github.com/maurobussini/jslinq/blob/cb0bfbe079803a2899196de76916abf604664b55/src/jslinq.js#L61-L97 |
34,883 | maurobussini/jslinq | src/jslinq.js | function(a, b){
//Get value for "a" and "b" element
var aValue = expression(a);
var bValue = expression(b);
//Check if one element is greater then the second one
if(aValue < bValue) return -1;
if(aValue > bValue) return 1;
return 0;
} | javascript | function(a, b){
//Get value for "a" and "b" element
var aValue = expression(a);
var bValue = expression(b);
//Check if one element is greater then the second one
if(aValue < bValue) return -1;
if(aValue > bValue) return 1;
return 0;
} | [
"function",
"(",
"a",
",",
"b",
")",
"{",
"//Get value for \"a\" and \"b\" element",
"var",
"aValue",
"=",
"expression",
"(",
"a",
")",
";",
"var",
"bValue",
"=",
"expression",
"(",
"b",
")",
";",
"//Check if one element is greater then the second one",
"if",
"(",... | Define sort action estracting values from objects | [
"Define",
"sort",
"action",
"estracting",
"values",
"from",
"objects"
] | cb0bfbe079803a2899196de76916abf604664b55 | https://github.com/maurobussini/jslinq/blob/cb0bfbe079803a2899196de76916abf604664b55/src/jslinq.js#L284-L294 | |
34,884 | maurobussini/jslinq | src/jslinq.js | subtract | function subtract(otherData, compareExpression) {
//If other data is invalid, return empty array
if (!otherData)
return new jslinq([]);
//Data for output
var outData = [];
//Check every element of "items"
for (var n = 0; n < this.items.length; n++) {
//... | javascript | function subtract(otherData, compareExpression) {
//If other data is invalid, return empty array
if (!otherData)
return new jslinq([]);
//Data for output
var outData = [];
//Check every element of "items"
for (var n = 0; n < this.items.length; n++) {
//... | [
"function",
"subtract",
"(",
"otherData",
",",
"compareExpression",
")",
"{",
"//If other data is invalid, return empty array",
"if",
"(",
"!",
"otherData",
")",
"return",
"new",
"jslinq",
"(",
"[",
"]",
")",
";",
"//Data for output",
"var",
"outData",
"=",
"[",
... | Get only elements NOT contained on provided "otherData" using same instance or compare expression | [
"Get",
"only",
"elements",
"NOT",
"contained",
"on",
"provided",
"otherData",
"using",
"same",
"instance",
"or",
"compare",
"expression"
] | cb0bfbe079803a2899196de76916abf604664b55 | https://github.com/maurobussini/jslinq/blob/cb0bfbe079803a2899196de76916abf604664b55/src/jslinq.js#L757-L820 |
34,885 | retextjs/retext-intensify | index.js | transformer | function transformer(tree, file) {
search(tree, phrases, searcher)
function searcher(match, index, parent, phrase) {
var type = weasel
var message
if (weasels.indexOf(phrase) === -1) {
type = fillers.indexOf(phrase) === -1 ? hedge : filler
}
message = file.warn(
... | javascript | function transformer(tree, file) {
search(tree, phrases, searcher)
function searcher(match, index, parent, phrase) {
var type = weasel
var message
if (weasels.indexOf(phrase) === -1) {
type = fillers.indexOf(phrase) === -1 ? hedge : filler
}
message = file.warn(
... | [
"function",
"transformer",
"(",
"tree",
",",
"file",
")",
"{",
"search",
"(",
"tree",
",",
"phrases",
",",
"searcher",
")",
"function",
"searcher",
"(",
"match",
",",
"index",
",",
"parent",
",",
"phrase",
")",
"{",
"var",
"type",
"=",
"weasel",
"var",... | Search `tree` for validations. | [
"Search",
"tree",
"for",
"validations",
"."
] | 8d52a7eb54de75a50d7f5c4fea18b151c1a656a2 | https://github.com/retextjs/retext-intensify/blob/8d52a7eb54de75a50d7f5c4fea18b151c1a656a2/index.js#L37-L59 |
34,886 | jonschlinkert/html-toc | index.js | buildHTML | function buildHTML(navigation, first, sParentLink) {
return '<ul class="nav' + (first ? ' sidenav' : '') + '">' + navigation.map(function(loc) {
if (!loc || !loc.link) return '';
loc.link = (opts.parentLink && sParentLink ? sParentLink + '-' : '') + loc.link;
loc.$ele.attr('id', loc.link);
... | javascript | function buildHTML(navigation, first, sParentLink) {
return '<ul class="nav' + (first ? ' sidenav' : '') + '">' + navigation.map(function(loc) {
if (!loc || !loc.link) return '';
loc.link = (opts.parentLink && sParentLink ? sParentLink + '-' : '') + loc.link;
loc.$ele.attr('id', loc.link);
... | [
"function",
"buildHTML",
"(",
"navigation",
",",
"first",
",",
"sParentLink",
")",
"{",
"return",
"'<ul class=\"nav'",
"+",
"(",
"first",
"?",
"' sidenav'",
":",
"''",
")",
"+",
"'\">'",
"+",
"navigation",
".",
"map",
"(",
"function",
"(",
"loc",
")",
"{... | Build the HTML for side navigation. | [
"Build",
"the",
"HTML",
"for",
"side",
"navigation",
"."
] | c529bad2f5b964652c8230be7bb4270e31ba734d | https://github.com/jonschlinkert/html-toc/blob/c529bad2f5b964652c8230be7bb4270e31ba734d/index.js#L68-L77 |
34,887 | fabienb4/meteor-jsdoc | example/meteor/client/templates/search.js | function(arrayOfSearchResultsArrays) {
let ids = {};
let dedupedResults = [];
_.each(arrayOfSearchResultsArrays, (searchResults) => {
_.each(searchResults, (item) => {
if (! ids.hasOwnProperty(item._id)) {
ids[item._id] = true;
dedupedResults.push(item);
}
});
});
return... | javascript | function(arrayOfSearchResultsArrays) {
let ids = {};
let dedupedResults = [];
_.each(arrayOfSearchResultsArrays, (searchResults) => {
_.each(searchResults, (item) => {
if (! ids.hasOwnProperty(item._id)) {
ids[item._id] = true;
dedupedResults.push(item);
}
});
});
return... | [
"function",
"(",
"arrayOfSearchResultsArrays",
")",
"{",
"let",
"ids",
"=",
"{",
"}",
";",
"let",
"dedupedResults",
"=",
"[",
"]",
";",
"_",
".",
"each",
"(",
"arrayOfSearchResultsArrays",
",",
"(",
"searchResults",
")",
"=>",
"{",
"_",
".",
"each",
"(",... | When you have two arrays of search results, use this function to deduplicate them | [
"When",
"you",
"have",
"two",
"arrays",
"of",
"search",
"results",
"use",
"this",
"function",
"to",
"deduplicate",
"them"
] | f11ea7d694fac18025f53cb4826cafe80c69c625 | https://github.com/fabienb4/meteor-jsdoc/blob/f11ea7d694fac18025f53cb4826cafe80c69c625/example/meteor/client/templates/search.js#L147-L162 | |
34,888 | mike-goodwin/connect-azuretables | lib/connect-azuretables.js | logOrThrow | function logOrThrow(error, result) {
if (result) {
self.log('connect-azuretables created table ' + self.table);
}
if (error) {
throw ('failed to create table: ' + error);
}
} | javascript | function logOrThrow(error, result) {
if (result) {
self.log('connect-azuretables created table ' + self.table);
}
if (error) {
throw ('failed to create table: ' + error);
}
} | [
"function",
"logOrThrow",
"(",
"error",
",",
"result",
")",
"{",
"if",
"(",
"result",
")",
"{",
"self",
".",
"log",
"(",
"'connect-azuretables created table '",
"+",
"self",
".",
"table",
")",
";",
"}",
"if",
"(",
"error",
")",
"{",
"throw",
"(",
"'fai... | reducing function complexity to keep code climate happy | [
"reducing",
"function",
"complexity",
"to",
"keep",
"code",
"climate",
"happy"
] | b148c19ee6abcf636fd58d8c983aed0a3d0d21b2 | https://github.com/mike-goodwin/connect-azuretables/blob/b148c19ee6abcf636fd58d8c983aed0a3d0d21b2/lib/connect-azuretables.js#L79-L88 |
34,889 | mike-goodwin/connect-azuretables | lib/connect-azuretables.js | errorOrResult | function errorOrResult(error, result, fn) {
return error ? fn(error) : fn(null, result);
} | javascript | function errorOrResult(error, result, fn) {
return error ? fn(error) : fn(null, result);
} | [
"function",
"errorOrResult",
"(",
"error",
",",
"result",
",",
"fn",
")",
"{",
"return",
"error",
"?",
"fn",
"(",
"error",
")",
":",
"fn",
"(",
"null",
",",
"result",
")",
";",
"}"
] | removing duplicate code to keep code climate happy | [
"removing",
"duplicate",
"code",
"to",
"keep",
"code",
"climate",
"happy"
] | b148c19ee6abcf636fd58d8c983aed0a3d0d21b2 | https://github.com/mike-goodwin/connect-azuretables/blob/b148c19ee6abcf636fd58d8c983aed0a3d0d21b2/lib/connect-azuretables.js#L259-L261 |
34,890 | mike-goodwin/connect-azuretables | lib/connect-azuretables.js | getExpiryDate | function getExpiryDate(store, data) {
var offset;
if (data.cookie.originalMaxAge) {
offset = data.cookie.originalMaxAge;
} else {
offset = store.sessionTimeOut * 60000;
}
return offset ? new Date(Date.now() + offset) : null;
} | javascript | function getExpiryDate(store, data) {
var offset;
if (data.cookie.originalMaxAge) {
offset = data.cookie.originalMaxAge;
} else {
offset = store.sessionTimeOut * 60000;
}
return offset ? new Date(Date.now() + offset) : null;
} | [
"function",
"getExpiryDate",
"(",
"store",
",",
"data",
")",
"{",
"var",
"offset",
";",
"if",
"(",
"data",
".",
"cookie",
".",
"originalMaxAge",
")",
"{",
"offset",
"=",
"data",
".",
"cookie",
".",
"originalMaxAge",
";",
"}",
"else",
"{",
"offset",
"="... | expiry date for sessions | [
"expiry",
"date",
"for",
"sessions"
] | b148c19ee6abcf636fd58d8c983aed0a3d0d21b2 | https://github.com/mike-goodwin/connect-azuretables/blob/b148c19ee6abcf636fd58d8c983aed0a3d0d21b2/lib/connect-azuretables.js#L264-L275 |
34,891 | jaredLunde/react-emoji-component | examples/every-emoji/webpack/startServer.js | startListening | function startListening () {
if (isBuilt === false) {
app.listen(
parseInt(port),
host,
() => {
isBuilt = true
console.log(chalk.green(`[React Emoji Component SSR] ${host}:${port}`))
}
)
}
} | javascript | function startListening () {
if (isBuilt === false) {
app.listen(
parseInt(port),
host,
() => {
isBuilt = true
console.log(chalk.green(`[React Emoji Component SSR] ${host}:${port}`))
}
)
}
} | [
"function",
"startListening",
"(",
")",
"{",
"if",
"(",
"isBuilt",
"===",
"false",
")",
"{",
"app",
".",
"listen",
"(",
"parseInt",
"(",
"port",
")",
",",
"host",
",",
"(",
")",
"=>",
"{",
"isBuilt",
"=",
"true",
"console",
".",
"log",
"(",
"chalk"... | express listener which is run after the compiler is done | [
"express",
"listener",
"which",
"is",
"run",
"after",
"the",
"compiler",
"is",
"done"
] | a5083fa3df2b546e66ccfab943623101954c5527 | https://github.com/jaredLunde/react-emoji-component/blob/a5083fa3df2b546e66ccfab943623101954c5527/examples/every-emoji/webpack/startServer.js#L32-L43 |
34,892 | mjyc/cycle-robot-drivers | docs/slides/20190327_rosseattlemeetup/export/libs/reveal.js/3.7.0/plugin/zoom-js/zoom.js | magnify | function magnify( rect, scale ) {
var scrollOffset = getScrollOffset();
// Ensure a width/height is set
rect.width = rect.width || 1;
rect.height = rect.height || 1;
// Center the rect within the zoomed viewport
rect.x -= ( window.innerWidth - ( rect.width * scale ) ) / 2;
rect.y -= ( window.innerHeigh... | javascript | function magnify( rect, scale ) {
var scrollOffset = getScrollOffset();
// Ensure a width/height is set
rect.width = rect.width || 1;
rect.height = rect.height || 1;
// Center the rect within the zoomed viewport
rect.x -= ( window.innerWidth - ( rect.width * scale ) ) / 2;
rect.y -= ( window.innerHeigh... | [
"function",
"magnify",
"(",
"rect",
",",
"scale",
")",
"{",
"var",
"scrollOffset",
"=",
"getScrollOffset",
"(",
")",
";",
"// Ensure a width/height is set",
"rect",
".",
"width",
"=",
"rect",
".",
"width",
"||",
"1",
";",
"rect",
".",
"height",
"=",
"rect"... | Applies the CSS required to zoom in, prefers the use of CSS3
transforms but falls back on zoom for IE.
@param {Object} rect
@param {Number} scale | [
"Applies",
"the",
"CSS",
"required",
"to",
"zoom",
"in",
"prefers",
"the",
"use",
"of",
"CSS3",
"transforms",
"but",
"falls",
"back",
"on",
"zoom",
"for",
"IE",
"."
] | acdc666150d686ee79b0ba917b6afcf09172c925 | https://github.com/mjyc/cycle-robot-drivers/blob/acdc666150d686ee79b0ba917b6afcf09172c925/docs/slides/20190327_rosseattlemeetup/export/libs/reveal.js/3.7.0/plugin/zoom-js/zoom.js#L85-L155 |
34,893 | bvalosek/infusionsoft-api | lib/Queryable.js | function(T)
{
var ret = [];
_(typedef.signature(T)).each(function(info, key) {
if (info.decorations.FIELD)
ret.push(key);
});
return ret;
} | javascript | function(T)
{
var ret = [];
_(typedef.signature(T)).each(function(info, key) {
if (info.decorations.FIELD)
ret.push(key);
});
return ret;
} | [
"function",
"(",
"T",
")",
"{",
"var",
"ret",
"=",
"[",
"]",
";",
"_",
"(",
"typedef",
".",
"signature",
"(",
"T",
")",
")",
".",
"each",
"(",
"function",
"(",
"info",
",",
"key",
")",
"{",
"if",
"(",
"info",
".",
"decorations",
".",
"FIELD",
... | Attempt to determine all the fields on a given type | [
"Attempt",
"to",
"determine",
"all",
"the",
"fields",
"on",
"a",
"given",
"type"
] | 883955e23b6f6102db24209ed81a85fb0be596b6 | https://github.com/bvalosek/infusionsoft-api/blob/883955e23b6f6102db24209ed81a85fb0be596b6/lib/Queryable.js#L35-L45 | |
34,894 | bvalosek/infusionsoft-api | lib/Queryable.js | function(o)
{
var q = this.clone();
q._orderBy = o;
q._ascending = true;
return q;
} | javascript | function(o)
{
var q = this.clone();
q._orderBy = o;
q._ascending = true;
return q;
} | [
"function",
"(",
"o",
")",
"{",
"var",
"q",
"=",
"this",
".",
"clone",
"(",
")",
";",
"q",
".",
"_orderBy",
"=",
"o",
";",
"q",
".",
"_ascending",
"=",
"true",
";",
"return",
"q",
";",
"}"
] | Field to order results | [
"Field",
"to",
"order",
"results"
] | 883955e23b6f6102db24209ed81a85fb0be596b6 | https://github.com/bvalosek/infusionsoft-api/blob/883955e23b6f6102db24209ed81a85fb0be596b6/lib/Queryable.js#L114-L120 | |
34,895 | bvalosek/infusionsoft-api | lib/Queryable.js | function(f)
{
var q = this.clone();
if (arguments.length > 1)
q._fields = _(arguments).toArray();
else if (f)
q._fields = _(f).isArray() ? f : [f];
else
q._fields = Queryable.getFields(this._T);
return q;
} | javascript | function(f)
{
var q = this.clone();
if (arguments.length > 1)
q._fields = _(arguments).toArray();
else if (f)
q._fields = _(f).isArray() ? f : [f];
else
q._fields = Queryable.getFields(this._T);
return q;
} | [
"function",
"(",
"f",
")",
"{",
"var",
"q",
"=",
"this",
".",
"clone",
"(",
")",
";",
"if",
"(",
"arguments",
".",
"length",
">",
"1",
")",
"q",
".",
"_fields",
"=",
"_",
"(",
"arguments",
")",
".",
"toArray",
"(",
")",
";",
"else",
"if",
"("... | Set what fields we will be using | [
"Set",
"what",
"fields",
"we",
"will",
"be",
"using"
] | 883955e23b6f6102db24209ed81a85fb0be596b6 | https://github.com/bvalosek/infusionsoft-api/blob/883955e23b6f6102db24209ed81a85fb0be596b6/lib/Queryable.js#L131-L143 | |
34,896 | bvalosek/infusionsoft-api | lib/Queryable.js | function()
{
if (this._executePromise)
return this._executePromise;
var q = this.clone();
var table = q._T.__name__;
var page = q._page;
var fields = q._fields;
// Create the query from our stuff
var query = {};
_(q._where.concat(q._l... | javascript | function()
{
if (this._executePromise)
return this._executePromise;
var q = this.clone();
var table = q._T.__name__;
var page = q._page;
var fields = q._fields;
// Create the query from our stuff
var query = {};
_(q._where.concat(q._l... | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"_executePromise",
")",
"return",
"this",
".",
"_executePromise",
";",
"var",
"q",
"=",
"this",
".",
"clone",
"(",
")",
";",
"var",
"table",
"=",
"q",
".",
"_T",
".",
"__name__",
";",
"var",
"page"... | Actually hit the API. Returns a promise for the eventual value of these results. Ends up mutating the query and marking it as done If we already have a promise, return that, meaning that it can only be eecuted once | [
"Actually",
"hit",
"the",
"API",
".",
"Returns",
"a",
"promise",
"for",
"the",
"eventual",
"value",
"of",
"these",
"results",
".",
"Ends",
"up",
"mutating",
"the",
"query",
"and",
"marking",
"it",
"as",
"done",
"If",
"we",
"already",
"have",
"a",
"promis... | 883955e23b6f6102db24209ed81a85fb0be596b6 | https://github.com/bvalosek/infusionsoft-api/blob/883955e23b6f6102db24209ed81a85fb0be596b6/lib/Queryable.js#L260-L313 | |
34,897 | bvalosek/infusionsoft-api | lib/Queryable.js | function(table, limit, page, query, fields)
{
if (this._doneLoading)
return;
var _this = this;
// Execute -- add orderBy and ascending?
var args = [table, limit, page, query, fields];
if (this._orderBy) {
args.push(this._orderBy);
args.pu... | javascript | function(table, limit, page, query, fields)
{
if (this._doneLoading)
return;
var _this = this;
// Execute -- add orderBy and ascending?
var args = [table, limit, page, query, fields];
if (this._orderBy) {
args.push(this._orderBy);
args.pu... | [
"function",
"(",
"table",
",",
"limit",
",",
"page",
",",
"query",
",",
"fields",
")",
"{",
"if",
"(",
"this",
".",
"_doneLoading",
")",
"return",
";",
"var",
"_this",
"=",
"this",
";",
"// Execute -- add orderBy and ascending?",
"var",
"args",
"=",
"[",
... | Where the actual API call is fired off. Returns a promise for the eventual raw value from the API call | [
"Where",
"the",
"actual",
"API",
"call",
"is",
"fired",
"off",
".",
"Returns",
"a",
"promise",
"for",
"the",
"eventual",
"raw",
"value",
"from",
"the",
"API",
"call"
] | 883955e23b6f6102db24209ed81a85fb0be596b6 | https://github.com/bvalosek/infusionsoft-api/blob/883955e23b6f6102db24209ed81a85fb0be596b6/lib/Queryable.js#L317-L351 | |
34,898 | bvalosek/infusionsoft-api | infusionsoft/services/IAPIEmailService.js | function(apiKey, pieceTitle, categories,
fromAddress, toAddress, ccAddress, bccAddress, subject, textBody,
htmlBody, contentType, mergeContext) {} | javascript | function(apiKey, pieceTitle, categories,
fromAddress, toAddress, ccAddress, bccAddress, subject, textBody,
htmlBody, contentType, mergeContext) {} | [
"function",
"(",
"apiKey",
",",
"pieceTitle",
",",
"categories",
",",
"fromAddress",
",",
"toAddress",
",",
"ccAddress",
",",
"bccAddress",
",",
"subject",
",",
"textBody",
",",
"htmlBody",
",",
"contentType",
",",
"mergeContext",
")",
"{",
"}"
] | Create a new email template that can be used for future emails | [
"Create",
"a",
"new",
"email",
"template",
"that",
"can",
"be",
"used",
"for",
"future",
"emails"
] | 883955e23b6f6102db24209ed81a85fb0be596b6 | https://github.com/bvalosek/infusionsoft-api/blob/883955e23b6f6102db24209ed81a85fb0be596b6/infusionsoft/services/IAPIEmailService.js#L13-L15 | |
34,899 | bvalosek/infusionsoft-api | infusionsoft/services/IAPIEmailService.js | function(apiKey, contactId, fromName,
fromAddress, toAddress, ccAddresses, bccAddresses, contentType,
subject, htmlBody, textBody, header, receivedDate, sentDate,
emailSentType) {} | javascript | function(apiKey, contactId, fromName,
fromAddress, toAddress, ccAddresses, bccAddresses, contentType,
subject, htmlBody, textBody, header, receivedDate, sentDate,
emailSentType) {} | [
"function",
"(",
"apiKey",
",",
"contactId",
",",
"fromName",
",",
"fromAddress",
",",
"toAddress",
",",
"ccAddresses",
",",
"bccAddresses",
",",
"contentType",
",",
"subject",
",",
"htmlBody",
",",
"textBody",
",",
"header",
",",
"receivedDate",
",",
"sentDat... | This will create an item in the email history for a contact. This does not actually send the email, it only places an item into the email history. Using the API to instruct Infusionsoft to send an email will handle this automatically. | [
"This",
"will",
"create",
"an",
"item",
"in",
"the",
"email",
"history",
"for",
"a",
"contact",
".",
"This",
"does",
"not",
"actually",
"send",
"the",
"email",
"it",
"only",
"places",
"an",
"item",
"into",
"the",
"email",
"history",
".",
"Using",
"the",
... | 883955e23b6f6102db24209ed81a85fb0be596b6 | https://github.com/bvalosek/infusionsoft-api/blob/883955e23b6f6102db24209ed81a85fb0be596b6/infusionsoft/services/IAPIEmailService.js#L21-L24 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.