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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
18,200 | Yomguithereal/talisman | src/stemmers/french/carry.js | applyRules | function applyRules(rules, stem) {
for (let i = 0, l = rules.length; i < l; i++) {
const [min, pattern, replacement = ''] = rules[i];
if (stem.slice(-pattern.length) === pattern) {
const newStem = stem.slice(0, -pattern.length) + replacement,
m = computeM(newStem);
if (m <= min)
... | javascript | function applyRules(rules, stem) {
for (let i = 0, l = rules.length; i < l; i++) {
const [min, pattern, replacement = ''] = rules[i];
if (stem.slice(-pattern.length) === pattern) {
const newStem = stem.slice(0, -pattern.length) + replacement,
m = computeM(newStem);
if (m <= min)
... | [
"function",
"applyRules",
"(",
"rules",
",",
"stem",
")",
"{",
"for",
"(",
"let",
"i",
"=",
"0",
",",
"l",
"=",
"rules",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"const",
"[",
"min",
",",
"pattern",
",",
"replacement",
"=",
... | Function used to apply a set of rules to the current stem.
@param {string} stem - Target stem.
@return {string} - The resulting stem. | [
"Function",
"used",
"to",
"apply",
"a",
"set",
"of",
"rules",
"to",
"the",
"current",
"stem",
"."
] | 51756b23cfd7e32c61f11c2f5a31f6396d15812a | https://github.com/Yomguithereal/talisman/blob/51756b23cfd7e32c61f11c2f5a31f6396d15812a/src/stemmers/french/carry.js#L314-L331 |
18,201 | Yomguithereal/talisman | src/stats/inferential.js | genericVariance | function genericVariance(ddof, sequence) {
const length = sequence.length;
if (!length)
throw Error('talisman/stats/inferential#variance: the given list is empty.');
// Returning 0 if the denominator would be <= 0
const denominator = length - ddof;
if (denominator <= 0)
return 0;
const m = mean(... | javascript | function genericVariance(ddof, sequence) {
const length = sequence.length;
if (!length)
throw Error('talisman/stats/inferential#variance: the given list is empty.');
// Returning 0 if the denominator would be <= 0
const denominator = length - ddof;
if (denominator <= 0)
return 0;
const m = mean(... | [
"function",
"genericVariance",
"(",
"ddof",
",",
"sequence",
")",
"{",
"const",
"length",
"=",
"sequence",
".",
"length",
";",
"if",
"(",
"!",
"length",
")",
"throw",
"Error",
"(",
"'talisman/stats/inferential#variance: the given list is empty.'",
")",
";",
"// Re... | Function computing the sample variance of the given sequence.
@param {number} ddof - Delta degrees of freedom.
@param {array} sequence - The sequence to process.
@return {number} - The variance.
@throws {Error} - The function expects a non-empty list. | [
"Function",
"computing",
"the",
"sample",
"variance",
"of",
"the",
"given",
"sequence",
"."
] | 51756b23cfd7e32c61f11c2f5a31f6396d15812a | https://github.com/Yomguithereal/talisman/blob/51756b23cfd7e32c61f11c2f5a31f6396d15812a/src/stats/inferential.js#L18-L38 |
18,202 | Yomguithereal/talisman | src/stats/inferential.js | genericStdev | function genericStdev(ddof, sequence) {
const v = genericVariance(ddof, sequence);
return Math.sqrt(v);
} | javascript | function genericStdev(ddof, sequence) {
const v = genericVariance(ddof, sequence);
return Math.sqrt(v);
} | [
"function",
"genericStdev",
"(",
"ddof",
",",
"sequence",
")",
"{",
"const",
"v",
"=",
"genericVariance",
"(",
"ddof",
",",
"sequence",
")",
";",
"return",
"Math",
".",
"sqrt",
"(",
"v",
")",
";",
"}"
] | Function computing the sample standard deviation of the given sequence.
@param {number} ddof - Delta degrees of freedom.
@param {array} sequence - The sequence to process.
@return {number} - The variance.
@throws {Error} - The function expects a non-empty list. | [
"Function",
"computing",
"the",
"sample",
"standard",
"deviation",
"of",
"the",
"given",
"sequence",
"."
] | 51756b23cfd7e32c61f11c2f5a31f6396d15812a | https://github.com/Yomguithereal/talisman/blob/51756b23cfd7e32c61f11c2f5a31f6396d15812a/src/stats/inferential.js#L49-L53 |
18,203 | Yomguithereal/talisman | src/metrics/distance/sift4.js | withoutTranspositions | function withoutTranspositions(maxOffset, maxDistance, a, b) {
// Early termination
if (a === b)
return 0;
const la = a.length,
lb = b.length;
if (!la || !lb)
return Math.max(la, lb);
let cursorA = 0,
cursorB = 0,
longestCommonSubsequence = 0,
localCommonSubstring = 0;
... | javascript | function withoutTranspositions(maxOffset, maxDistance, a, b) {
// Early termination
if (a === b)
return 0;
const la = a.length,
lb = b.length;
if (!la || !lb)
return Math.max(la, lb);
let cursorA = 0,
cursorB = 0,
longestCommonSubsequence = 0,
localCommonSubstring = 0;
... | [
"function",
"withoutTranspositions",
"(",
"maxOffset",
",",
"maxDistance",
",",
"a",
",",
"b",
")",
"{",
"// Early termination",
"if",
"(",
"a",
"===",
"b",
")",
"return",
"0",
";",
"const",
"la",
"=",
"a",
".",
"length",
",",
"lb",
"=",
"b",
".",
"l... | Simplest version of the SIFT4 algorithm.
@param {number} maxOffset - Search window.
@param {number} maxDistance - Maximum distance before exiting.
@param {string|array} a - First sequence.
@param {string|array} b - Second sequence.
@return {number} - The distance... | [
"Simplest",
"version",
"of",
"the",
"SIFT4",
"algorithm",
"."
] | 51756b23cfd7e32c61f11c2f5a31f6396d15812a | https://github.com/Yomguithereal/talisman/blob/51756b23cfd7e32c61f11c2f5a31f6396d15812a/src/metrics/distance/sift4.js#L35-L94 |
18,204 | Yomguithereal/talisman | src/metrics/distance/sift4.js | withTranspositions | function withTranspositions(maxOffset, maxDistance, a, b) {
// Early termination
if (a === b)
return 0;
const la = a.length,
lb = b.length;
if (!la || !lb)
return Math.max(la, lb);
let cursorA = 0,
cursorB = 0,
longestCommonSubsequence = 0,
localCommonSubstring = 0,
... | javascript | function withTranspositions(maxOffset, maxDistance, a, b) {
// Early termination
if (a === b)
return 0;
const la = a.length,
lb = b.length;
if (!la || !lb)
return Math.max(la, lb);
let cursorA = 0,
cursorB = 0,
longestCommonSubsequence = 0,
localCommonSubstring = 0,
... | [
"function",
"withTranspositions",
"(",
"maxOffset",
",",
"maxDistance",
",",
"a",
",",
"b",
")",
"{",
"// Early termination",
"if",
"(",
"a",
"===",
"b",
")",
"return",
"0",
";",
"const",
"la",
"=",
"a",
".",
"length",
",",
"lb",
"=",
"b",
".",
"leng... | Version of the SIFT4 function computing transpositions.
@param {number} maxOffset - Search window.
@param {number} maxDistance - Maximum distance before exiting.
@param {string|array} a - First sequence.
@param {string|array} b - Second sequence.
@return {number} ... | [
"Version",
"of",
"the",
"SIFT4",
"function",
"computing",
"transpositions",
"."
] | 51756b23cfd7e32c61f11c2f5a31f6396d15812a | https://github.com/Yomguithereal/talisman/blob/51756b23cfd7e32c61f11c2f5a31f6396d15812a/src/metrics/distance/sift4.js#L105-L223 |
18,205 | Yomguithereal/talisman | src/tag/averaged-perceptron.js | createContext | function createContext(sentence) {
const context = new Array(sentence.length + 4);
context[0] = START[0];
context[1] = START[1];
for (let j = 0, m = sentence.length; j < m; j++)
context[j + 2] = normalize(sentence[j][0]);
context[context.length - 2] = END[0];
context[context.length - 1] = ... | javascript | function createContext(sentence) {
const context = new Array(sentence.length + 4);
context[0] = START[0];
context[1] = START[1];
for (let j = 0, m = sentence.length; j < m; j++)
context[j + 2] = normalize(sentence[j][0]);
context[context.length - 2] = END[0];
context[context.length - 1] = ... | [
"function",
"createContext",
"(",
"sentence",
")",
"{",
"const",
"context",
"=",
"new",
"Array",
"(",
"sentence",
".",
"length",
"+",
"4",
")",
";",
"context",
"[",
"0",
"]",
"=",
"START",
"[",
"0",
"]",
";",
"context",
"[",
"1",
"]",
"=",
"START",... | Function used to build a context from the given tokenized sentence.
@param {array} sentence - Target sentence.
@return {array} - Context. | [
"Function",
"used",
"to",
"build",
"a",
"context",
"from",
"the",
"given",
"tokenized",
"sentence",
"."
] | 51756b23cfd7e32c61f11c2f5a31f6396d15812a | https://github.com/Yomguithereal/talisman/blob/51756b23cfd7e32c61f11c2f5a31f6396d15812a/src/tag/averaged-perceptron.js#L123-L135 |
18,206 | Yomguithereal/talisman | src/inflectors/spanish/noun.js | transferCase | function transferCase(source, target) {
let cased = '';
for (let i = 0, l = target.length; i < l; i++) {
const c = source[i].toLowerCase() === source[i] ?
'toLowerCase' :
'toUpperCase';
cased += target[i][c]();
}
return cased;
} | javascript | function transferCase(source, target) {
let cased = '';
for (let i = 0, l = target.length; i < l; i++) {
const c = source[i].toLowerCase() === source[i] ?
'toLowerCase' :
'toUpperCase';
cased += target[i][c]();
}
return cased;
} | [
"function",
"transferCase",
"(",
"source",
",",
"target",
")",
"{",
"let",
"cased",
"=",
"''",
";",
"for",
"(",
"let",
"i",
"=",
"0",
",",
"l",
"=",
"target",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"const",
"c",
"=",
"so... | Function used to apply source word's case to target word.
@param {string} source - Source word.
@param {string} target - Target word.
@return {string} | [
"Function",
"used",
"to",
"apply",
"source",
"word",
"s",
"case",
"to",
"target",
"word",
"."
] | 51756b23cfd7e32c61f11c2f5a31f6396d15812a | https://github.com/Yomguithereal/talisman/blob/51756b23cfd7e32c61f11c2f5a31f6396d15812a/src/inflectors/spanish/noun.js#L77-L89 |
18,207 | Yomguithereal/talisman | src/phonetics/nysiis.js | nysiis | function nysiis(type, name) {
if (typeof name !== 'string')
throw Error('talisman/phonetics/nysiis: the given name is not a string.');
// Preparing the string
name = deburr(name)
.toUpperCase()
.trim()
.replace(/[^A-Z]/g, '');
// Getting the proper patterns
const patterns = PATTERNS[type];
... | javascript | function nysiis(type, name) {
if (typeof name !== 'string')
throw Error('talisman/phonetics/nysiis: the given name is not a string.');
// Preparing the string
name = deburr(name)
.toUpperCase()
.trim()
.replace(/[^A-Z]/g, '');
// Getting the proper patterns
const patterns = PATTERNS[type];
... | [
"function",
"nysiis",
"(",
"type",
",",
"name",
")",
"{",
"if",
"(",
"typeof",
"name",
"!==",
"'string'",
")",
"throw",
"Error",
"(",
"'talisman/phonetics/nysiis: the given name is not a string.'",
")",
";",
"// Preparing the string",
"name",
"=",
"deburr",
"(",
"... | Function taking a single name and computing its NYSIIS code.
@param {string} name - The name to process.
@return {string} - The NYSIIS code.
@throws {Error} The function expects the name to be a string. | [
"Function",
"taking",
"a",
"single",
"name",
"and",
"computing",
"its",
"NYSIIS",
"code",
"."
] | 51756b23cfd7e32c61f11c2f5a31f6396d15812a | https://github.com/Yomguithereal/talisman/blob/51756b23cfd7e32c61f11c2f5a31f6396d15812a/src/phonetics/nysiis.js#L92-L128 |
18,208 | Yomguithereal/talisman | src/stats/frequencies.js | frequencies | function frequencies(sequence) {
const index = {};
// Handling strings
sequence = seq(sequence);
for (let i = 0, l = sequence.length; i < l; i++) {
const element = sequence[i];
if (!index[element])
index[element] = 0;
index[element]++;
}
return index;
} | javascript | function frequencies(sequence) {
const index = {};
// Handling strings
sequence = seq(sequence);
for (let i = 0, l = sequence.length; i < l; i++) {
const element = sequence[i];
if (!index[element])
index[element] = 0;
index[element]++;
}
return index;
} | [
"function",
"frequencies",
"(",
"sequence",
")",
"{",
"const",
"index",
"=",
"{",
"}",
";",
"// Handling strings",
"sequence",
"=",
"seq",
"(",
"sequence",
")",
";",
"for",
"(",
"let",
"i",
"=",
"0",
",",
"l",
"=",
"sequence",
".",
"length",
";",
"i"... | Function taking a sequence and computing its frequencies.
@param {mixed} sequence - The sequence to process.
@return {object} - A dict of the sequence's frequencies.
@example
// frequencies([1, 1, 2, 3, 3, 3]) => {1: 2, 2: 1, 3: 3}
// frequencies('test') => {t: 2, e: 1, s: 1} | [
"Function",
"taking",
"a",
"sequence",
"and",
"computing",
"its",
"frequencies",
"."
] | 51756b23cfd7e32c61f11c2f5a31f6396d15812a | https://github.com/Yomguithereal/talisman/blob/51756b23cfd7e32c61f11c2f5a31f6396d15812a/src/stats/frequencies.js#L19-L34 |
18,209 | Yomguithereal/talisman | src/stats/frequencies.js | relativeFrequencies | function relativeFrequencies(sequence) {
let index,
length;
// Handling the object polymorphism
if (typeof sequence === 'object' && !Array.isArray(sequence)) {
index = sequence;
length = 0;
for (const k in index)
length += index[k];
}
else {
length = sequence.length;
index = ... | javascript | function relativeFrequencies(sequence) {
let index,
length;
// Handling the object polymorphism
if (typeof sequence === 'object' && !Array.isArray(sequence)) {
index = sequence;
length = 0;
for (const k in index)
length += index[k];
}
else {
length = sequence.length;
index = ... | [
"function",
"relativeFrequencies",
"(",
"sequence",
")",
"{",
"let",
"index",
",",
"length",
";",
"// Handling the object polymorphism",
"if",
"(",
"typeof",
"sequence",
"===",
"'object'",
"&&",
"!",
"Array",
".",
"isArray",
"(",
"sequence",
")",
")",
"{",
"in... | Relative version of the `frequencies` function.
@param {mixed} sequence - The sequence to process. If an object is passed
the function will assume it's representing
absolute frequencies.
@return {object} - A dict of the sequence's relative frequencies.
@example
// frequencies([1, 1, 2, 3, 3, 3]) => {1: ~0.... | [
"Relative",
"version",
"of",
"the",
"frequencies",
"function",
"."
] | 51756b23cfd7e32c61f11c2f5a31f6396d15812a | https://github.com/Yomguithereal/talisman/blob/51756b23cfd7e32c61f11c2f5a31f6396d15812a/src/stats/frequencies.js#L48-L71 |
18,210 | Yomguithereal/talisman | src/tokenizers/sentences/punkt.js | dunningLogLikelihood | function dunningLogLikelihood(a, b, ab, N) {
const p1 = b / N,
p2 = 0.99;
const nullHypothesis = ab * Math.log(p1) + (a - ab) * Math.log(1 - p1),
alternativeHyphothesis = ab * Math.log(p2) + (a - ab) * Math.log(1 - p2);
const likelihood = nullHypothesis - alternativeHyphothesis;
return (-2 * ... | javascript | function dunningLogLikelihood(a, b, ab, N) {
const p1 = b / N,
p2 = 0.99;
const nullHypothesis = ab * Math.log(p1) + (a - ab) * Math.log(1 - p1),
alternativeHyphothesis = ab * Math.log(p2) + (a - ab) * Math.log(1 - p2);
const likelihood = nullHypothesis - alternativeHyphothesis;
return (-2 * ... | [
"function",
"dunningLogLikelihood",
"(",
"a",
",",
"b",
",",
"ab",
",",
"N",
")",
"{",
"const",
"p1",
"=",
"b",
"/",
"N",
",",
"p2",
"=",
"0.99",
";",
"const",
"nullHypothesis",
"=",
"ab",
"*",
"Math",
".",
"log",
"(",
"p1",
")",
"+",
"(",
"a",... | Miscellaneous helpers.
Computing the Dunning log-likelihood ratio scores for abbreviation
candidates.
@param {number} a - Count of <a>.
@param {number} b - Count of <b>.
@param {number} ab - Count of <ab>.
@param {number} N - Number of elements in the distribution.
@return {number} - The log-likelihood. | [
"Miscellaneous",
"helpers",
".",
"Computing",
"the",
"Dunning",
"log",
"-",
"likelihood",
"ratio",
"scores",
"for",
"abbreviation",
"candidates",
"."
] | 51756b23cfd7e32c61f11c2f5a31f6396d15812a | https://github.com/Yomguithereal/talisman/blob/51756b23cfd7e32c61f11c2f5a31f6396d15812a/src/tokenizers/sentences/punkt.js#L428-L438 |
18,211 | Yomguithereal/talisman | src/tokenizers/sentences/punkt.js | colLogLikelihood | function colLogLikelihood(a, b, ab, N) {
const p = b / N,
p1 = ab / a,
p2 = (b - ab) / (N - a);
const summand1 = ab * Math.log(p) + (a - ab) * Math.log(1 - p),
summand2 = (b - ab) * Math.log(p) + (N - a - b + ab) * Math.log(1 - p);
let summand3 = 0;
if (a !== ab)
summand3 = ab * Ma... | javascript | function colLogLikelihood(a, b, ab, N) {
const p = b / N,
p1 = ab / a,
p2 = (b - ab) / (N - a);
const summand1 = ab * Math.log(p) + (a - ab) * Math.log(1 - p),
summand2 = (b - ab) * Math.log(p) + (N - a - b + ab) * Math.log(1 - p);
let summand3 = 0;
if (a !== ab)
summand3 = ab * Ma... | [
"function",
"colLogLikelihood",
"(",
"a",
",",
"b",
",",
"ab",
",",
"N",
")",
"{",
"const",
"p",
"=",
"b",
"/",
"N",
",",
"p1",
"=",
"ab",
"/",
"a",
",",
"p2",
"=",
"(",
"b",
"-",
"ab",
")",
"/",
"(",
"N",
"-",
"a",
")",
";",
"const",
"... | A function that wil just compute log-likelihood estimate, in the original
paper, it's described in algorithm 6 and 7.
Note: this SHOULD be the original Dunning log-likelihood values.
@param {number} a - Count of <a>.
@param {number} b - Count of <b>.
@param {number} ab - Count of <ab>.
@param {number} N - Number o... | [
"A",
"function",
"that",
"wil",
"just",
"compute",
"log",
"-",
"likelihood",
"estimate",
"in",
"the",
"original",
"paper",
"it",
"s",
"described",
"in",
"algorithm",
"6",
"and",
"7",
"."
] | 51756b23cfd7e32c61f11c2f5a31f6396d15812a | https://github.com/Yomguithereal/talisman/blob/51756b23cfd7e32c61f11c2f5a31f6396d15812a/src/tokenizers/sentences/punkt.js#L452-L471 |
18,212 | filamentgroup/politespace | dist/libs/libs.js | function( name, value ) {
if ( completed == null ) {
name = requestHeadersNames[ name.toLowerCase() ] =
requestHeadersNames[ name.toLowerCase() ] || name;
requestHeaders[ name ] = value;
}
return this;
} | javascript | function( name, value ) {
if ( completed == null ) {
name = requestHeadersNames[ name.toLowerCase() ] =
requestHeadersNames[ name.toLowerCase() ] || name;
requestHeaders[ name ] = value;
}
return this;
} | [
"function",
"(",
"name",
",",
"value",
")",
"{",
"if",
"(",
"completed",
"==",
"null",
")",
"{",
"name",
"=",
"requestHeadersNames",
"[",
"name",
".",
"toLowerCase",
"(",
")",
"]",
"=",
"requestHeadersNames",
"[",
"name",
".",
"toLowerCase",
"(",
")",
... | Caches the header | [
"Caches",
"the",
"header"
] | 4486a6d036e21821c27f491d2524e02a7f61ffbd | https://github.com/filamentgroup/politespace/blob/4486a6d036e21821c27f491d2524e02a7f61ffbd/dist/libs/libs.js#L8953-L8960 | |
18,213 | mikaelbr/marked-terminal | index.js | reflowText | function reflowText (text, width, gfm) {
// Hard break was inserted by Renderer.prototype.br or is
// <br /> when gfm is true
var splitRe = gfm ? HARD_RETURN_GFM_RE : HARD_RETURN_RE,
sections = text.split(splitRe),
reflowed = [];
sections.forEach(function (section) {
// Split the section by esc... | javascript | function reflowText (text, width, gfm) {
// Hard break was inserted by Renderer.prototype.br or is
// <br /> when gfm is true
var splitRe = gfm ? HARD_RETURN_GFM_RE : HARD_RETURN_RE,
sections = text.split(splitRe),
reflowed = [];
sections.forEach(function (section) {
// Split the section by esc... | [
"function",
"reflowText",
"(",
"text",
",",
"width",
",",
"gfm",
")",
"{",
"// Hard break was inserted by Renderer.prototype.br or is",
"// <br /> when gfm is true",
"var",
"splitRe",
"=",
"gfm",
"?",
"HARD_RETURN_GFM_RE",
":",
"HARD_RETURN_RE",
",",
"sections",
"=",
"t... | Munge \n's and spaces in "text" so that the number of characters between \n's is less than or equal to "width". | [
"Munge",
"\\",
"n",
"s",
"and",
"spaces",
"in",
"text",
"so",
"that",
"the",
"number",
"of",
"characters",
"between",
"\\",
"n",
"s",
"is",
"less",
"than",
"or",
"equal",
"to",
"width",
"."
] | b799d0444739c184018a73174867cb42f6201f10 | https://github.com/mikaelbr/marked-terminal/blob/b799d0444739c184018a73174867cb42f6201f10/index.js#L226-L321 |
18,214 | mikaelbr/marked-terminal | index.js | fixNestedLists | function fixNestedLists (body, indent) {
var regex = new RegExp('' +
'(\\S(?: | )?)' + // Last char of current point, plus one or two spaces
// to allow trailing spaces
'((?:' + indent + ')+)' + // Indentation of sub point
'(' + POINT_REGEX + '(?:.*)+)$', 'gm'); // Body of subpoint... | javascript | function fixNestedLists (body, indent) {
var regex = new RegExp('' +
'(\\S(?: | )?)' + // Last char of current point, plus one or two spaces
// to allow trailing spaces
'((?:' + indent + ')+)' + // Indentation of sub point
'(' + POINT_REGEX + '(?:.*)+)$', 'gm'); // Body of subpoint... | [
"function",
"fixNestedLists",
"(",
"body",
",",
"indent",
")",
"{",
"var",
"regex",
"=",
"new",
"RegExp",
"(",
"''",
"+",
"'(\\\\S(?: | )?)'",
"+",
"// Last char of current point, plus one or two spaces",
"// to allow trailing spaces",
"'((?:'",
"+",
"indent",
"+",
"... | Prevents nested lists from joining their parent list's last line | [
"Prevents",
"nested",
"lists",
"from",
"joining",
"their",
"parent",
"list",
"s",
"last",
"line"
] | b799d0444739c184018a73174867cb42f6201f10 | https://github.com/mikaelbr/marked-terminal/blob/b799d0444739c184018a73174867cb42f6201f10/index.js#L337-L344 |
18,215 | helion3/inspire-tree | src/tree.js | map | function map(tree, method, args) {
return tree.model[method].apply(tree.model, args);
} | javascript | function map(tree, method, args) {
return tree.model[method].apply(tree.model, args);
} | [
"function",
"map",
"(",
"tree",
",",
"method",
",",
"args",
")",
"{",
"return",
"tree",
".",
"model",
"[",
"method",
"]",
".",
"apply",
"(",
"tree",
".",
"model",
",",
"args",
")",
";",
"}"
] | Maps a method to the root TreeNodes collection.
@private
@param {InspireTree} tree Tree instance.
@param {string} method Method name.
@param {arguments} args Proxied arguments.
@return {mixed} Proxied return value. | [
"Maps",
"a",
"method",
"to",
"the",
"root",
"TreeNodes",
"collection",
"."
] | f2c62437e3fe9c89544064e18191cd62673e38c2 | https://github.com/helion3/inspire-tree/blob/f2c62437e3fe9c89544064e18191cd62673e38c2/src/tree.js#L20-L22 |
18,216 | helion3/inspire-tree | src/treenodes.js | getPredicateFunction | function getPredicateFunction(predicate) {
let fn = predicate;
if (_.isString(predicate)) {
fn = node => (_.isFunction(node[predicate]) ? node[predicate]() : node[predicate]);
}
return fn;
} | javascript | function getPredicateFunction(predicate) {
let fn = predicate;
if (_.isString(predicate)) {
fn = node => (_.isFunction(node[predicate]) ? node[predicate]() : node[predicate]);
}
return fn;
} | [
"function",
"getPredicateFunction",
"(",
"predicate",
")",
"{",
"let",
"fn",
"=",
"predicate",
";",
"if",
"(",
"_",
".",
"isString",
"(",
"predicate",
")",
")",
"{",
"fn",
"=",
"node",
"=>",
"(",
"_",
".",
"isFunction",
"(",
"node",
"[",
"predicate",
... | Creates a predicate function.
@private
@param {string|function} predicate Property name or custom function.
@return {function} Predicate function. | [
"Creates",
"a",
"predicate",
"function",
"."
] | f2c62437e3fe9c89544064e18191cd62673e38c2 | https://github.com/helion3/inspire-tree/blob/f2c62437e3fe9c89544064e18191cd62673e38c2/src/treenodes.js#L42-L49 |
18,217 | helion3/inspire-tree | src/treenodes.js | baseStatePredicate | function baseStatePredicate(state, full) {
if (full) {
return this.extract(state);
}
// Cache a state predicate function
const fn = getPredicateFunction(state);
return this.flatten(node => {
// Never include removed nodes unless specifically requested
if (state !== 'removed... | javascript | function baseStatePredicate(state, full) {
if (full) {
return this.extract(state);
}
// Cache a state predicate function
const fn = getPredicateFunction(state);
return this.flatten(node => {
// Never include removed nodes unless specifically requested
if (state !== 'removed... | [
"function",
"baseStatePredicate",
"(",
"state",
",",
"full",
")",
"{",
"if",
"(",
"full",
")",
"{",
"return",
"this",
".",
"extract",
"(",
"state",
")",
";",
"}",
"// Cache a state predicate function",
"const",
"fn",
"=",
"getPredicateFunction",
"(",
"state",
... | Base function to filter nodes by state value.
@private
@param {string} state State property
@param {boolean} full Return a non-flat hierarchy
@return {TreeNodes} Array of matching nodes. | [
"Base",
"function",
"to",
"filter",
"nodes",
"by",
"state",
"value",
"."
] | f2c62437e3fe9c89544064e18191cd62673e38c2 | https://github.com/helion3/inspire-tree/blob/f2c62437e3fe9c89544064e18191cd62673e38c2/src/treenodes.js#L59-L75 |
18,218 | helion3/inspire-tree | src/treenode.js | cloneItree | function cloneItree(itree, excludeKeys) {
const clone = {};
excludeKeys = _.castArray(excludeKeys);
excludeKeys.push('ref');
_.each(itree, (v, k) => {
if (!_.includes(excludeKeys, k)) {
clone[k] = _.cloneDeep(v);
}
});
return clone;
} | javascript | function cloneItree(itree, excludeKeys) {
const clone = {};
excludeKeys = _.castArray(excludeKeys);
excludeKeys.push('ref');
_.each(itree, (v, k) => {
if (!_.includes(excludeKeys, k)) {
clone[k] = _.cloneDeep(v);
}
});
return clone;
} | [
"function",
"cloneItree",
"(",
"itree",
",",
"excludeKeys",
")",
"{",
"const",
"clone",
"=",
"{",
"}",
";",
"excludeKeys",
"=",
"_",
".",
"castArray",
"(",
"excludeKeys",
")",
";",
"excludeKeys",
".",
"push",
"(",
"'ref'",
")",
";",
"_",
".",
"each",
... | Helper method to clone an ITree config object.
Rejects non-clonable properties like ref.
@private
@param {object} itree ITree configuration object
@param {array} excludeKeys Keys to exclude, if any
@return {object} Cloned ITree. | [
"Helper",
"method",
"to",
"clone",
"an",
"ITree",
"config",
"object",
"."
] | f2c62437e3fe9c89544064e18191cd62673e38c2 | https://github.com/helion3/inspire-tree/blob/f2c62437e3fe9c89544064e18191cd62673e38c2/src/treenode.js#L20-L32 |
18,219 | helion3/inspire-tree | src/treenode.js | baseState | function baseState(node, property, val) {
const currentVal = node.itree.state[property];
if (typeof val !== 'undefined' && currentVal !== val) {
// Update values
node.itree.state[property] = val;
if (property !== 'rendered') {
node.markDirty();
}
// Emit an... | javascript | function baseState(node, property, val) {
const currentVal = node.itree.state[property];
if (typeof val !== 'undefined' && currentVal !== val) {
// Update values
node.itree.state[property] = val;
if (property !== 'rendered') {
node.markDirty();
}
// Emit an... | [
"function",
"baseState",
"(",
"node",
",",
"property",
",",
"val",
")",
"{",
"const",
"currentVal",
"=",
"node",
".",
"itree",
".",
"state",
"[",
"property",
"]",
";",
"if",
"(",
"typeof",
"val",
"!==",
"'undefined'",
"&&",
"currentVal",
"!==",
"val",
... | Get or set a state value.
This is a base method and will not invoke related changes, for example
setting selected=false will not trigger any deselection logic.
@private
@param {TreeNode} node Tree node.
@param {string} property Property name.
@param {boolean} val New value, if setting.
@return {boolean} Current value... | [
"Get",
"or",
"set",
"a",
"state",
"value",
"."
] | f2c62437e3fe9c89544064e18191cd62673e38c2 | https://github.com/helion3/inspire-tree/blob/f2c62437e3fe9c89544064e18191cd62673e38c2/src/treenode.js#L46-L62 |
18,220 | helion3/inspire-tree | src/lib/base-state-change.js | resetState | function resetState(node) {
_.each(node._tree.defaultState, (val, prop) => {
node.state(prop, val);
});
return node;
} | javascript | function resetState(node) {
_.each(node._tree.defaultState, (val, prop) => {
node.state(prop, val);
});
return node;
} | [
"function",
"resetState",
"(",
"node",
")",
"{",
"_",
".",
"each",
"(",
"node",
".",
"_tree",
".",
"defaultState",
",",
"(",
"val",
",",
"prop",
")",
"=>",
"{",
"node",
".",
"state",
"(",
"prop",
",",
"val",
")",
";",
"}",
")",
";",
"return",
"... | Reset a node's state to the tree default.
@private
@param {TreeNode} node Node object.
@returns {TreeNode} Node object. | [
"Reset",
"a",
"node",
"s",
"state",
"to",
"the",
"tree",
"default",
"."
] | f2c62437e3fe9c89544064e18191cd62673e38c2 | https://github.com/helion3/inspire-tree/blob/f2c62437e3fe9c89544064e18191cd62673e38c2/src/lib/base-state-change.js#L10-L16 |
18,221 | uphold/github-changelog-generator | src/index.js | run | async function run() {
const fetcher = new ChangelogFetcher({ base, futureRelease, futureReleaseTag, labels, owner, repo, token });
const releases = await fetcher.fetchChangelog();
formatChangelog(releases).forEach(line => process.stdout.write(line));
} | javascript | async function run() {
const fetcher = new ChangelogFetcher({ base, futureRelease, futureReleaseTag, labels, owner, repo, token });
const releases = await fetcher.fetchChangelog();
formatChangelog(releases).forEach(line => process.stdout.write(line));
} | [
"async",
"function",
"run",
"(",
")",
"{",
"const",
"fetcher",
"=",
"new",
"ChangelogFetcher",
"(",
"{",
"base",
",",
"futureRelease",
",",
"futureReleaseTag",
",",
"labels",
",",
"owner",
",",
"repo",
",",
"token",
"}",
")",
";",
"const",
"releases",
"=... | Run the changelog generator. | [
"Run",
"the",
"changelog",
"generator",
"."
] | 788c260ded8f121c7f255b101b352c9d065866ec | https://github.com/uphold/github-changelog-generator/blob/788c260ded8f121c7f255b101b352c9d065866ec/src/index.js#L64-L69 |
18,222 | gjunge/rateit.js | scripts/jquery.rateit.js | function (element, event) {
var pageX = (event.changedTouches) ? event.changedTouches[0].pageX : event.pageX;
var offsetx = pageX - $(element).offset().left;
if (!ltr) { offsetx = range.width() - offsetx };
if (offsetx > range.width()) { offsetx = range.w... | javascript | function (element, event) {
var pageX = (event.changedTouches) ? event.changedTouches[0].pageX : event.pageX;
var offsetx = pageX - $(element).offset().left;
if (!ltr) { offsetx = range.width() - offsetx };
if (offsetx > range.width()) { offsetx = range.w... | [
"function",
"(",
"element",
",",
"event",
")",
"{",
"var",
"pageX",
"=",
"(",
"event",
".",
"changedTouches",
")",
"?",
"event",
".",
"changedTouches",
"[",
"0",
"]",
".",
"pageX",
":",
"event",
".",
"pageX",
";",
"var",
"offsetx",
"=",
"pageX",
"-",... | this function calculates the score based on the current position of the mouse. | [
"this",
"function",
"calculates",
"the",
"score",
"based",
"on",
"the",
"current",
"position",
"of",
"the",
"mouse",
"."
] | 4310c1d307949f3c487ea143e8f6660358765777 | https://github.com/gjunge/rateit.js/blob/4310c1d307949f3c487ea143e8f6660358765777/scripts/jquery.rateit.js#L282-L291 | |
18,223 | gjunge/rateit.js | scripts/jquery.rateit.js | function (score) {
var w = score * itemdata('starwidth') * itemdata('step');
var h = range.find('.rateit-hover');
if (h.data('width') != w) {
range.find('.rateit-selected').hide();
h.width(w).show().data('width', w);
... | javascript | function (score) {
var w = score * itemdata('starwidth') * itemdata('step');
var h = range.find('.rateit-hover');
if (h.data('width') != w) {
range.find('.rateit-selected').hide();
h.width(w).show().data('width', w);
... | [
"function",
"(",
"score",
")",
"{",
"var",
"w",
"=",
"score",
"*",
"itemdata",
"(",
"'starwidth'",
")",
"*",
"itemdata",
"(",
"'step'",
")",
";",
"var",
"h",
"=",
"range",
".",
"find",
"(",
"'.rateit-hover'",
")",
";",
"if",
"(",
"h",
".",
"data",
... | sets the hover element based on the score. | [
"sets",
"the",
"hover",
"element",
"based",
"on",
"the",
"score",
"."
] | 4310c1d307949f3c487ea143e8f6660358765777 | https://github.com/gjunge/rateit.js/blob/4310c1d307949f3c487ea143e8f6660358765777/scripts/jquery.rateit.js#L294-L303 | |
18,224 | cytoscape/cytoscape.js-popper | src/collection.js | getRenderedCenter | function getRenderedCenter(target, renderedDimensions){
let pos = target.renderedPosition();
let dimensions = renderedDimensions(target);
let offsetX = dimensions.w / 2;
let offsetY = dimensions.h / 2;
return {
x : (pos.x - offsetX),
y : (pos.y - offsetY)
};
} | javascript | function getRenderedCenter(target, renderedDimensions){
let pos = target.renderedPosition();
let dimensions = renderedDimensions(target);
let offsetX = dimensions.w / 2;
let offsetY = dimensions.h / 2;
return {
x : (pos.x - offsetX),
y : (pos.y - offsetY)
};
} | [
"function",
"getRenderedCenter",
"(",
"target",
",",
"renderedDimensions",
")",
"{",
"let",
"pos",
"=",
"target",
".",
"renderedPosition",
"(",
")",
";",
"let",
"dimensions",
"=",
"renderedDimensions",
"(",
"target",
")",
";",
"let",
"offsetX",
"=",
"dimension... | Get the rendered center | [
"Get",
"the",
"rendered",
"center"
] | 0372af85ef1c02dedc9bb29278391f7566844404 | https://github.com/cytoscape/cytoscape.js-popper/blob/0372af85ef1c02dedc9bb29278391f7566844404/src/collection.js#L29-L39 |
18,225 | cytoscape/cytoscape.js-popper | src/collection.js | getRenderedMidpoint | function getRenderedMidpoint(target){
let p = target.midpoint();
let pan = target.cy().pan();
let zoom = target.cy().zoom();
return {
x: p.x * zoom + pan.x,
y: p.y * zoom + pan.y
};
} | javascript | function getRenderedMidpoint(target){
let p = target.midpoint();
let pan = target.cy().pan();
let zoom = target.cy().zoom();
return {
x: p.x * zoom + pan.x,
y: p.y * zoom + pan.y
};
} | [
"function",
"getRenderedMidpoint",
"(",
"target",
")",
"{",
"let",
"p",
"=",
"target",
".",
"midpoint",
"(",
")",
";",
"let",
"pan",
"=",
"target",
".",
"cy",
"(",
")",
".",
"pan",
"(",
")",
";",
"let",
"zoom",
"=",
"target",
".",
"cy",
"(",
")",... | Get the rendered position of the midpoint | [
"Get",
"the",
"rendered",
"position",
"of",
"the",
"midpoint"
] | 0372af85ef1c02dedc9bb29278391f7566844404 | https://github.com/cytoscape/cytoscape.js-popper/blob/0372af85ef1c02dedc9bb29278391f7566844404/src/collection.js#L42-L51 |
18,226 | cytoscape/cytoscape.js-popper | src/popper.js | getPopper | function getPopper(target, opts) {
let refObject = getRef(target, opts);
let content = getContent(target, opts.content);
let popperOpts = assign({}, popperDefaults, opts.popper);
return new Popper(refObject, content, popperOpts);
} | javascript | function getPopper(target, opts) {
let refObject = getRef(target, opts);
let content = getContent(target, opts.content);
let popperOpts = assign({}, popperDefaults, opts.popper);
return new Popper(refObject, content, popperOpts);
} | [
"function",
"getPopper",
"(",
"target",
",",
"opts",
")",
"{",
"let",
"refObject",
"=",
"getRef",
"(",
"target",
",",
"opts",
")",
";",
"let",
"content",
"=",
"getContent",
"(",
"target",
",",
"opts",
".",
"content",
")",
";",
"let",
"popperOpts",
"=",... | Create a new popper object for a core or element target | [
"Create",
"a",
"new",
"popper",
"object",
"for",
"a",
"core",
"or",
"element",
"target"
] | 0372af85ef1c02dedc9bb29278391f7566844404 | https://github.com/cytoscape/cytoscape.js-popper/blob/0372af85ef1c02dedc9bb29278391f7566844404/src/popper.js#L15-L21 |
18,227 | cytoscape/cytoscape.js-popper | src/core.js | createOptionsObject | function createOptionsObject(target, opts) {
let defaults = {
boundingBox : {
top: 0,
left: 0,
right: 0,
bottom: 0,
w: 3,
h: 3,
},
renderedDimensions : () => ({w: 3, h: 3}),
redneredPosition : () => ({x : 0, y : 0}),
popper : {},
cy : target
};
return a... | javascript | function createOptionsObject(target, opts) {
let defaults = {
boundingBox : {
top: 0,
left: 0,
right: 0,
bottom: 0,
w: 3,
h: 3,
},
renderedDimensions : () => ({w: 3, h: 3}),
redneredPosition : () => ({x : 0, y : 0}),
popper : {},
cy : target
};
return a... | [
"function",
"createOptionsObject",
"(",
"target",
",",
"opts",
")",
"{",
"let",
"defaults",
"=",
"{",
"boundingBox",
":",
"{",
"top",
":",
"0",
",",
"left",
":",
"0",
",",
"right",
":",
"0",
",",
"bottom",
":",
"0",
",",
"w",
":",
"3",
",",
"h",
... | Create a options object with required default values | [
"Create",
"a",
"options",
"object",
"with",
"required",
"default",
"values"
] | 0372af85ef1c02dedc9bb29278391f7566844404 | https://github.com/cytoscape/cytoscape.js-popper/blob/0372af85ef1c02dedc9bb29278391f7566844404/src/core.js#L15-L32 |
18,228 | felixrieseberg/electron-windows-store | lib/utils.js | ensureWindows | function ensureWindows () {
if (process.platform !== 'win32') {
log('This tool requires Windows 10.\n')
log('You can run a virtual machine using the free VirtualBox and')
log('the free Windows Virtual Machines found at http://modern.ie.\n')
log('For more information, please see the readme.')
proce... | javascript | function ensureWindows () {
if (process.platform !== 'win32') {
log('This tool requires Windows 10.\n')
log('You can run a virtual machine using the free VirtualBox and')
log('the free Windows Virtual Machines found at http://modern.ie.\n')
log('For more information, please see the readme.')
proce... | [
"function",
"ensureWindows",
"(",
")",
"{",
"if",
"(",
"process",
".",
"platform",
"!==",
"'win32'",
")",
"{",
"log",
"(",
"'This tool requires Windows 10.\\n'",
")",
"log",
"(",
"'You can run a virtual machine using the free VirtualBox and'",
")",
"log",
"(",
"'the f... | Ensures that the currently running platform is Windows,
exiting the process if it is not | [
"Ensures",
"that",
"the",
"currently",
"running",
"platform",
"is",
"Windows",
"exiting",
"the",
"process",
"if",
"it",
"is",
"not"
] | ecdcee197df30e21a2a094edfc350eac1c3cddc5 | https://github.com/felixrieseberg/electron-windows-store/blob/ecdcee197df30e21a2a094edfc350eac1c3cddc5/lib/utils.js#L9-L29 |
18,229 | felixrieseberg/electron-windows-store | lib/utils.js | hasVariableResources | function hasVariableResources (assetsDirectory) {
const files = require('fs-extra').readdirSync(assetsDirectory)
const hasScale = files.find(file => /\.scale-...\./g.test(file))
return (!!hasScale)
} | javascript | function hasVariableResources (assetsDirectory) {
const files = require('fs-extra').readdirSync(assetsDirectory)
const hasScale = files.find(file => /\.scale-...\./g.test(file))
return (!!hasScale)
} | [
"function",
"hasVariableResources",
"(",
"assetsDirectory",
")",
"{",
"const",
"files",
"=",
"require",
"(",
"'fs-extra'",
")",
".",
"readdirSync",
"(",
"assetsDirectory",
")",
"const",
"hasScale",
"=",
"files",
".",
"find",
"(",
"file",
"=>",
"/",
"\\.scale-.... | Makes an educated guess whether or not resources have
multiple variations or resource versions for
language, scale, contrast, etc
@param assetsDirectory - Path to a the assets directory
@returns {boolean} - Are the assets variable? | [
"Makes",
"an",
"educated",
"guess",
"whether",
"or",
"not",
"resources",
"have",
"multiple",
"variations",
"or",
"resource",
"versions",
"for",
"language",
"scale",
"contrast",
"etc"
] | ecdcee197df30e21a2a094edfc350eac1c3cddc5 | https://github.com/felixrieseberg/electron-windows-store/blob/ecdcee197df30e21a2a094edfc350eac1c3cddc5/lib/utils.js#L39-L44 |
18,230 | felixrieseberg/electron-windows-store | lib/utils.js | executeChildProcess | function executeChildProcess (fileName, args, options) {
return new Promise((resolve, reject) => {
const child = require('child_process').spawn(fileName, args, options)
child.stdout.on('data', (data) => log(data.toString()))
child.stderr.on('data', (data) => log(data.toString()))
child.on('exit', (c... | javascript | function executeChildProcess (fileName, args, options) {
return new Promise((resolve, reject) => {
const child = require('child_process').spawn(fileName, args, options)
child.stdout.on('data', (data) => log(data.toString()))
child.stderr.on('data', (data) => log(data.toString()))
child.on('exit', (c... | [
"function",
"executeChildProcess",
"(",
"fileName",
",",
"args",
",",
"options",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"const",
"child",
"=",
"require",
"(",
"'child_process'",
")",
".",
"spawn",
"(",
"... | Starts a child process using the provided executable
@param fileName - Path to the executable to start
@param args - Arguments for spawn
@param options - Options passed to spawn
@returns {Promise} - A promise that resolves when the
process exits | [
"Starts",
"a",
"child",
"process",
"using",
"the",
"provided",
"executable"
] | ecdcee197df30e21a2a094edfc350eac1c3cddc5 | https://github.com/felixrieseberg/electron-windows-store/blob/ecdcee197df30e21a2a094edfc350eac1c3cddc5/lib/utils.js#L65-L81 |
18,231 | felixrieseberg/electron-windows-store | lib/setup.js | isSetupRequired | function isSetupRequired (program) {
const config = dotfile.get() || {}
const hasPublisher = (config.publisher || program.publisher)
const hasDevCert = (config.devCert || program.devCert)
const hasWindowsKit = (config.windowsKit || program.windowsKit)
const hasBaseImage = (config.expandedBaseImage || program.... | javascript | function isSetupRequired (program) {
const config = dotfile.get() || {}
const hasPublisher = (config.publisher || program.publisher)
const hasDevCert = (config.devCert || program.devCert)
const hasWindowsKit = (config.windowsKit || program.windowsKit)
const hasBaseImage = (config.expandedBaseImage || program.... | [
"function",
"isSetupRequired",
"(",
"program",
")",
"{",
"const",
"config",
"=",
"dotfile",
".",
"get",
"(",
")",
"||",
"{",
"}",
"const",
"hasPublisher",
"=",
"(",
"config",
".",
"publisher",
"||",
"program",
".",
"publisher",
")",
"const",
"hasDevCert",
... | Determines whether all setup settings are okay.
@returns {boolean} - Whether everything is setup correctly. | [
"Determines",
"whether",
"all",
"setup",
"settings",
"are",
"okay",
"."
] | ecdcee197df30e21a2a094edfc350eac1c3cddc5 | https://github.com/felixrieseberg/electron-windows-store/blob/ecdcee197df30e21a2a094edfc350eac1c3cddc5/lib/setup.js#L27-L40 |
18,232 | felixrieseberg/electron-windows-store | lib/setup.js | wizardSetup | function wizardSetup (program) {
const welcome = multiline.stripIndent(function () { /*
Welcome to the Electron-Windows-Store tool!
This tool will assist you with turning your Electron app into
a swanky Windows Store app.
We need to know some settings. We will ask you only once and s... | javascript | function wizardSetup (program) {
const welcome = multiline.stripIndent(function () { /*
Welcome to the Electron-Windows-Store tool!
This tool will assist you with turning your Electron app into
a swanky Windows Store app.
We need to know some settings. We will ask you only once and s... | [
"function",
"wizardSetup",
"(",
"program",
")",
"{",
"const",
"welcome",
"=",
"multiline",
".",
"stripIndent",
"(",
"function",
"(",
")",
"{",
"/*\n Welcome to the Electron-Windows-Store tool!\n\n This tool will assist you with turning your Electron app into\n ... | Runs a wizard, helping the user setup configuration
@param program - Commander program object
@returns {Promise} - Promsise that returns once wizard completed | [
"Runs",
"a",
"wizard",
"helping",
"the",
"user",
"setup",
"configuration"
] | ecdcee197df30e21a2a094edfc350eac1c3cddc5 | https://github.com/felixrieseberg/electron-windows-store/blob/ecdcee197df30e21a2a094edfc350eac1c3cddc5/lib/setup.js#L79-L185 |
18,233 | felixrieseberg/electron-windows-store | lib/setup.js | logConfiguration | function logConfiguration (program) {
utils.log(chalk.bold.green.underline('\nConfiguration: '))
utils.log(`Desktop Converter Location: ${program.desktopConverter}`)
utils.log(`Expanded Base Image: ${program.expandedBaseImage}`)
utils.log(`Publisher: ${program.publisher}`)
uti... | javascript | function logConfiguration (program) {
utils.log(chalk.bold.green.underline('\nConfiguration: '))
utils.log(`Desktop Converter Location: ${program.desktopConverter}`)
utils.log(`Expanded Base Image: ${program.expandedBaseImage}`)
utils.log(`Publisher: ${program.publisher}`)
uti... | [
"function",
"logConfiguration",
"(",
"program",
")",
"{",
"utils",
".",
"log",
"(",
"chalk",
".",
"bold",
".",
"green",
".",
"underline",
"(",
"'\\nConfiguration: '",
")",
")",
"utils",
".",
"log",
"(",
"`",
"${",
"program",
".",
"desktopConverter",
"}",
... | Logs the current configuration to utils
@param program - Commander program object | [
"Logs",
"the",
"current",
"configuration",
"to",
"utils"
] | ecdcee197df30e21a2a094edfc350eac1c3cddc5 | https://github.com/felixrieseberg/electron-windows-store/blob/ecdcee197df30e21a2a094edfc350eac1c3cddc5/lib/setup.js#L192-L200 |
18,234 | felixrieseberg/electron-windows-store | lib/setup.js | setup | function setup (program) {
return new Promise((resolve, reject) => {
if (isSetupRequired(program)) {
// If we're setup, merge the dotfile configuration into the program
defaults(program, dotfile.get())
logConfiguration(program)
resolve()
} else {
// We're not setup, let's do that... | javascript | function setup (program) {
return new Promise((resolve, reject) => {
if (isSetupRequired(program)) {
// If we're setup, merge the dotfile configuration into the program
defaults(program, dotfile.get())
logConfiguration(program)
resolve()
} else {
// We're not setup, let's do that... | [
"function",
"setup",
"(",
"program",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"if",
"(",
"isSetupRequired",
"(",
"program",
")",
")",
"{",
"// If we're setup, merge the dotfile configuration into the program",
"defa... | Runs setup, checking if all configuration is existent,
and merging the dotfile with the program object
@param program - Commander program object
@returns {Promise} - Promsise that returns once setup completed | [
"Runs",
"setup",
"checking",
"if",
"all",
"configuration",
"is",
"existent",
"and",
"merging",
"the",
"dotfile",
"with",
"the",
"program",
"object"
] | ecdcee197df30e21a2a094edfc350eac1c3cddc5 | https://github.com/felixrieseberg/electron-windows-store/blob/ecdcee197df30e21a2a094edfc350eac1c3cddc5/lib/setup.js#L209-L225 |
18,235 | felixrieseberg/electron-windows-store | lib/convert.js | convertWithContainer | function convertWithContainer (program) {
return new Promise((resolve, reject) => {
if (!program.desktopConverter) {
utils.log('Could not find the Project Centennial Desktop App Converter, which is required to')
utils.log('run the conversion to appx using a Windows Container.\n')
utils.log('Cons... | javascript | function convertWithContainer (program) {
return new Promise((resolve, reject) => {
if (!program.desktopConverter) {
utils.log('Could not find the Project Centennial Desktop App Converter, which is required to')
utils.log('run the conversion to appx using a Windows Container.\n')
utils.log('Cons... | [
"function",
"convertWithContainer",
"(",
"program",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"if",
"(",
"!",
"program",
".",
"desktopConverter",
")",
"{",
"utils",
".",
"log",
"(",
"'Could not find the Project... | Converts the given Electron app using Project Centennial
Container Virtualization.
@param program - Program object containing the user's instructions
@returns - Promise | [
"Converts",
"the",
"given",
"Electron",
"app",
"using",
"Project",
"Centennial",
"Container",
"Virtualization",
"."
] | ecdcee197df30e21a2a094edfc350eac1c3cddc5 | https://github.com/felixrieseberg/electron-windows-store/blob/ecdcee197df30e21a2a094edfc350eac1c3cddc5/lib/convert.js#L18-L86 |
18,236 | Sage/streamlinejs | lib/register.js | specialRequire | function specialRequire(name, fromDir) {
if (!fromDir) fromDir = process.cwd();
var paths = Module._nodeModulePaths(fromDir);
var path = Module._findPath(name, paths);
return path ? require(path) : require(name);
} | javascript | function specialRequire(name, fromDir) {
if (!fromDir) fromDir = process.cwd();
var paths = Module._nodeModulePaths(fromDir);
var path = Module._findPath(name, paths);
return path ? require(path) : require(name);
} | [
"function",
"specialRequire",
"(",
"name",
",",
"fromDir",
")",
"{",
"if",
"(",
"!",
"fromDir",
")",
"fromDir",
"=",
"process",
".",
"cwd",
"(",
")",
";",
"var",
"paths",
"=",
"Module",
".",
"_nodeModulePaths",
"(",
"fromDir",
")",
";",
"var",
"path",
... | special require for CoffeeScript registration | [
"special",
"require",
"for",
"CoffeeScript",
"registration"
] | fbd28601ddb00a337a39e044eb035b6b7890abc1 | https://github.com/Sage/streamlinejs/blob/fbd28601ddb00a337a39e044eb035b6b7890abc1/lib/register.js#L12-L17 |
18,237 | Sage/streamlinejs | examples/streamlineMe/streamlineMe.js | _transform | function _transform() {
var codeIn = $('#codeIn').val();
try {
var codeOut = Streamline.transform(codeIn, {
runtime: _generators ? "generators" : "callbacks",
});
$('#codeOut').val(codeOut);
info("ready");
} catch (ex) {
console.error(ex);
error(ex.message);
}
} | javascript | function _transform() {
var codeIn = $('#codeIn').val();
try {
var codeOut = Streamline.transform(codeIn, {
runtime: _generators ? "generators" : "callbacks",
});
$('#codeOut').val(codeOut);
info("ready");
} catch (ex) {
console.error(ex);
error(ex.message);
}
} | [
"function",
"_transform",
"(",
")",
"{",
"var",
"codeIn",
"=",
"$",
"(",
"'#codeIn'",
")",
".",
"val",
"(",
")",
";",
"try",
"{",
"var",
"codeOut",
"=",
"Streamline",
".",
"transform",
"(",
"codeIn",
",",
"{",
"runtime",
":",
"_generators",
"?",
"\"g... | define demo if user does not execute intro | [
"define",
"demo",
"if",
"user",
"does",
"not",
"execute",
"intro"
] | fbd28601ddb00a337a39e044eb035b6b7890abc1 | https://github.com/Sage/streamlinejs/blob/fbd28601ddb00a337a39e044eb035b6b7890abc1/examples/streamlineMe/streamlineMe.js#L153-L165 |
18,238 | jshttp/on-finished | index.js | onFinished | function onFinished (msg, listener) {
if (isFinished(msg) !== false) {
defer(listener, null, msg)
return msg
}
// attach the listener to the message
attachListener(msg, listener)
return msg
} | javascript | function onFinished (msg, listener) {
if (isFinished(msg) !== false) {
defer(listener, null, msg)
return msg
}
// attach the listener to the message
attachListener(msg, listener)
return msg
} | [
"function",
"onFinished",
"(",
"msg",
",",
"listener",
")",
"{",
"if",
"(",
"isFinished",
"(",
"msg",
")",
"!==",
"false",
")",
"{",
"defer",
"(",
"listener",
",",
"null",
",",
"msg",
")",
"return",
"msg",
"}",
"// attach the listener to the message",
"att... | Invoke callback when the response has finished, useful for
cleaning up resources afterwards.
@param {object} msg
@param {function} listener
@return {object}
@public | [
"Invoke",
"callback",
"when",
"the",
"response",
"has",
"finished",
"useful",
"for",
"cleaning",
"up",
"resources",
"afterwards",
"."
] | 08345db3b23a2db01c6dfe720aff51385fe801d4 | https://github.com/jshttp/on-finished/blob/08345db3b23a2db01c6dfe720aff51385fe801d4/index.js#L45-L55 |
18,239 | jshttp/on-finished | index.js | isFinished | function isFinished (msg) {
var socket = msg.socket
if (typeof msg.finished === 'boolean') {
// OutgoingMessage
return Boolean(msg.finished || (socket && !socket.writable))
}
if (typeof msg.complete === 'boolean') {
// IncomingMessage
return Boolean(msg.upgrade || !socket || !socket.readable |... | javascript | function isFinished (msg) {
var socket = msg.socket
if (typeof msg.finished === 'boolean') {
// OutgoingMessage
return Boolean(msg.finished || (socket && !socket.writable))
}
if (typeof msg.complete === 'boolean') {
// IncomingMessage
return Boolean(msg.upgrade || !socket || !socket.readable |... | [
"function",
"isFinished",
"(",
"msg",
")",
"{",
"var",
"socket",
"=",
"msg",
".",
"socket",
"if",
"(",
"typeof",
"msg",
".",
"finished",
"===",
"'boolean'",
")",
"{",
"// OutgoingMessage",
"return",
"Boolean",
"(",
"msg",
".",
"finished",
"||",
"(",
"soc... | Determine if message is already finished.
@param {object} msg
@return {boolean}
@public | [
"Determine",
"if",
"message",
"is",
"already",
"finished",
"."
] | 08345db3b23a2db01c6dfe720aff51385fe801d4 | https://github.com/jshttp/on-finished/blob/08345db3b23a2db01c6dfe720aff51385fe801d4/index.js#L65-L80 |
18,240 | jshttp/on-finished | index.js | attachFinishedListener | function attachFinishedListener (msg, callback) {
var eeMsg
var eeSocket
var finished = false
function onFinish (error) {
eeMsg.cancel()
eeSocket.cancel()
finished = true
callback(error)
}
// finished on first message event
eeMsg = eeSocket = first([[msg, 'end', 'finish']], onFinish)
... | javascript | function attachFinishedListener (msg, callback) {
var eeMsg
var eeSocket
var finished = false
function onFinish (error) {
eeMsg.cancel()
eeSocket.cancel()
finished = true
callback(error)
}
// finished on first message event
eeMsg = eeSocket = first([[msg, 'end', 'finish']], onFinish)
... | [
"function",
"attachFinishedListener",
"(",
"msg",
",",
"callback",
")",
"{",
"var",
"eeMsg",
"var",
"eeSocket",
"var",
"finished",
"=",
"false",
"function",
"onFinish",
"(",
"error",
")",
"{",
"eeMsg",
".",
"cancel",
"(",
")",
"eeSocket",
".",
"cancel",
"(... | Attach a finished listener to the message.
@param {object} msg
@param {function} callback
@private | [
"Attach",
"a",
"finished",
"listener",
"to",
"the",
"message",
"."
] | 08345db3b23a2db01c6dfe720aff51385fe801d4 | https://github.com/jshttp/on-finished/blob/08345db3b23a2db01c6dfe720aff51385fe801d4/index.js#L90-L130 |
18,241 | jshttp/on-finished | index.js | attachListener | function attachListener (msg, listener) {
var attached = msg.__onFinished
// create a private single listener with queue
if (!attached || !attached.queue) {
attached = msg.__onFinished = createListener(msg)
attachFinishedListener(msg, attached)
}
attached.queue.push(listener)
} | javascript | function attachListener (msg, listener) {
var attached = msg.__onFinished
// create a private single listener with queue
if (!attached || !attached.queue) {
attached = msg.__onFinished = createListener(msg)
attachFinishedListener(msg, attached)
}
attached.queue.push(listener)
} | [
"function",
"attachListener",
"(",
"msg",
",",
"listener",
")",
"{",
"var",
"attached",
"=",
"msg",
".",
"__onFinished",
"// create a private single listener with queue",
"if",
"(",
"!",
"attached",
"||",
"!",
"attached",
".",
"queue",
")",
"{",
"attached",
"=",... | Attach the listener to the message.
@param {object} msg
@return {function}
@private | [
"Attach",
"the",
"listener",
"to",
"the",
"message",
"."
] | 08345db3b23a2db01c6dfe720aff51385fe801d4 | https://github.com/jshttp/on-finished/blob/08345db3b23a2db01c6dfe720aff51385fe801d4/index.js#L140-L150 |
18,242 | jshttp/on-finished | index.js | createListener | function createListener (msg) {
function listener (err) {
if (msg.__onFinished === listener) msg.__onFinished = null
if (!listener.queue) return
var queue = listener.queue
listener.queue = null
for (var i = 0; i < queue.length; i++) {
queue[i](err, msg)
}
}
listener.queue = []
... | javascript | function createListener (msg) {
function listener (err) {
if (msg.__onFinished === listener) msg.__onFinished = null
if (!listener.queue) return
var queue = listener.queue
listener.queue = null
for (var i = 0; i < queue.length; i++) {
queue[i](err, msg)
}
}
listener.queue = []
... | [
"function",
"createListener",
"(",
"msg",
")",
"{",
"function",
"listener",
"(",
"err",
")",
"{",
"if",
"(",
"msg",
".",
"__onFinished",
"===",
"listener",
")",
"msg",
".",
"__onFinished",
"=",
"null",
"if",
"(",
"!",
"listener",
".",
"queue",
")",
"re... | Create listener on message.
@param {object} msg
@return {function}
@private | [
"Create",
"listener",
"on",
"message",
"."
] | 08345db3b23a2db01c6dfe720aff51385fe801d4 | https://github.com/jshttp/on-finished/blob/08345db3b23a2db01c6dfe720aff51385fe801d4/index.js#L160-L176 |
18,243 | jshttp/on-finished | index.js | patchAssignSocket | function patchAssignSocket (res, callback) {
var assignSocket = res.assignSocket
if (typeof assignSocket !== 'function') return
// res.on('socket', callback) is broken in 0.8
res.assignSocket = function _assignSocket (socket) {
assignSocket.call(this, socket)
callback(socket)
}
} | javascript | function patchAssignSocket (res, callback) {
var assignSocket = res.assignSocket
if (typeof assignSocket !== 'function') return
// res.on('socket', callback) is broken in 0.8
res.assignSocket = function _assignSocket (socket) {
assignSocket.call(this, socket)
callback(socket)
}
} | [
"function",
"patchAssignSocket",
"(",
"res",
",",
"callback",
")",
"{",
"var",
"assignSocket",
"=",
"res",
".",
"assignSocket",
"if",
"(",
"typeof",
"assignSocket",
"!==",
"'function'",
")",
"return",
"// res.on('socket', callback) is broken in 0.8",
"res",
".",
"as... | Patch ServerResponse.prototype.assignSocket for node.js 0.8.
@param {ServerResponse} res
@param {function} callback
@private
istanbul ignore next: node.js 0.8 patch | [
"Patch",
"ServerResponse",
".",
"prototype",
".",
"assignSocket",
"for",
"node",
".",
"js",
"0",
".",
"8",
"."
] | 08345db3b23a2db01c6dfe720aff51385fe801d4 | https://github.com/jshttp/on-finished/blob/08345db3b23a2db01c6dfe720aff51385fe801d4/index.js#L187-L197 |
18,244 | seek-oss/serverless-haskell | serverless-plugin/ld.js | parseLdOutput | function parseLdOutput(output) {
const libraryList = output.split('\n').filter(ln => ln.includes('=>'));
const result = {};
libraryList.forEach(s => {
const [name, _, libPath] = s.trim().split(' ');
result[name] = libPath;
});
return result;
} | javascript | function parseLdOutput(output) {
const libraryList = output.split('\n').filter(ln => ln.includes('=>'));
const result = {};
libraryList.forEach(s => {
const [name, _, libPath] = s.trim().split(' ');
result[name] = libPath;
});
return result;
} | [
"function",
"parseLdOutput",
"(",
"output",
")",
"{",
"const",
"libraryList",
"=",
"output",
".",
"split",
"(",
"'\\n'",
")",
".",
"filter",
"(",
"ln",
"=>",
"ln",
".",
"includes",
"(",
"'=>'",
")",
")",
";",
"const",
"result",
"=",
"{",
"}",
";",
... | Parse output of ldd or ldconfig and return a map of library names to paths | [
"Parse",
"output",
"of",
"ldd",
"or",
"ldconfig",
"and",
"return",
"a",
"map",
"of",
"library",
"names",
"to",
"paths"
] | 04f67b86b6b23f3e44a8d9ad651f5020e399834a | https://github.com/seek-oss/serverless-haskell/blob/04f67b86b6b23f3e44a8d9ad651f5020e399834a/serverless-plugin/ld.js#L6-L16 |
18,245 | logux/core | base-node.js | BaseNode | function BaseNode (nodeId, log, connection, options) {
/**
* Unique current machine name.
* @type {string}
*
* @example
* console.log(node.localNodeId + ' is started')
*/
this.localNodeId = nodeId
/**
* Log for synchronization.
* @type {Log}
*/
this.log = log
/**
* Connection use... | javascript | function BaseNode (nodeId, log, connection, options) {
/**
* Unique current machine name.
* @type {string}
*
* @example
* console.log(node.localNodeId + ' is started')
*/
this.localNodeId = nodeId
/**
* Log for synchronization.
* @type {Log}
*/
this.log = log
/**
* Connection use... | [
"function",
"BaseNode",
"(",
"nodeId",
",",
"log",
",",
"connection",
",",
"options",
")",
"{",
"/**\n * Unique current machine name.\n * @type {string}\n *\n * @example\n * console.log(node.localNodeId + ' is started')\n */",
"this",
".",
"localNodeId",
"=",
"nodeId",
... | Base methods for synchronization nodes. Client and server nodes
are based on this module.
@param {string} nodeId Unique current machine name.
@param {Log} log Logux log instance to be synchronized.
@param {Connection} connection Connection to remote node.
@param {object} [options] Synchronization options.
@param {obje... | [
"Base",
"methods",
"for",
"synchronization",
"nodes",
".",
"Client",
"and",
"server",
"nodes",
"are",
"based",
"on",
"this",
"module",
"."
] | fd5ab2eddd0b7ec8fa77ba55e8a30e5cad09ab23 | https://github.com/logux/core/blob/fd5ab2eddd0b7ec8fa77ba55e8a30e5cad09ab23/base-node.js#L73-L189 |
18,246 | logux/core | base-node.js | destroy | function destroy () {
if (this.connection.destroy) {
this.connection.destroy()
} else if (this.connected) {
this.connection.disconnect('destroy')
}
for (var i = 0; i < this.unbind.length; i++) {
this.unbind[i]()
}
clearTimeout(this.pingTimeout)
this.endTimeout()
} | javascript | function destroy () {
if (this.connection.destroy) {
this.connection.destroy()
} else if (this.connected) {
this.connection.disconnect('destroy')
}
for (var i = 0; i < this.unbind.length; i++) {
this.unbind[i]()
}
clearTimeout(this.pingTimeout)
this.endTimeout()
} | [
"function",
"destroy",
"(",
")",
"{",
"if",
"(",
"this",
".",
"connection",
".",
"destroy",
")",
"{",
"this",
".",
"connection",
".",
"destroy",
"(",
")",
"}",
"else",
"if",
"(",
"this",
".",
"connected",
")",
"{",
"this",
".",
"connection",
".",
"... | Shut down the connection and unsubscribe from log events.
@return {undefined}
@example
connection.on('disconnect', () => {
server.destroy()
}) | [
"Shut",
"down",
"the",
"connection",
"and",
"unsubscribe",
"from",
"log",
"events",
"."
] | fd5ab2eddd0b7ec8fa77ba55e8a30e5cad09ab23 | https://github.com/logux/core/blob/fd5ab2eddd0b7ec8fa77ba55e8a30e5cad09ab23/base-node.js#L335-L346 |
18,247 | logux/core | server-node.js | ServerNode | function ServerNode (nodeId, log, connection, options) {
options = merge(options, DEFAULT_OPTIONS)
BaseNode.call(this, nodeId, log, connection, options)
if (this.options.fixTime) {
throw new Error(
'Logux Server could not fix time. Set opts.fixTime for Client node.')
}
this.state = 'connecting'
} | javascript | function ServerNode (nodeId, log, connection, options) {
options = merge(options, DEFAULT_OPTIONS)
BaseNode.call(this, nodeId, log, connection, options)
if (this.options.fixTime) {
throw new Error(
'Logux Server could not fix time. Set opts.fixTime for Client node.')
}
this.state = 'connecting'
} | [
"function",
"ServerNode",
"(",
"nodeId",
",",
"log",
",",
"connection",
",",
"options",
")",
"{",
"options",
"=",
"merge",
"(",
"options",
",",
"DEFAULT_OPTIONS",
")",
"BaseNode",
".",
"call",
"(",
"this",
",",
"nodeId",
",",
"log",
",",
"connection",
",... | Server node in synchronization pair.
Instead of client node, it doesn’t initialize synchronization
and destroy itself on disconnect.
@param {string} nodeId Unique current machine name.
@param {Log} log Logux log instance to be synchronized.
@param {Connection} connection Connection to remote node.
@param {object} [op... | [
"Server",
"node",
"in",
"synchronization",
"pair",
"."
] | fd5ab2eddd0b7ec8fa77ba55e8a30e5cad09ab23 | https://github.com/logux/core/blob/fd5ab2eddd0b7ec8fa77ba55e8a30e5cad09ab23/server-node.js#L48-L58 |
18,248 | logux/core | client-node.js | ClientNode | function ClientNode (nodeId, log, connection, options) {
options = merge(options, DEFAULT_OPTIONS)
BaseNode.call(this, nodeId, log, connection, options)
} | javascript | function ClientNode (nodeId, log, connection, options) {
options = merge(options, DEFAULT_OPTIONS)
BaseNode.call(this, nodeId, log, connection, options)
} | [
"function",
"ClientNode",
"(",
"nodeId",
",",
"log",
",",
"connection",
",",
"options",
")",
"{",
"options",
"=",
"merge",
"(",
"options",
",",
"DEFAULT_OPTIONS",
")",
"BaseNode",
".",
"call",
"(",
"this",
",",
"nodeId",
",",
"log",
",",
"connection",
",... | Client node in synchronization pair.
Instead of server node, it initializes synchronization
and sends connect message.
@param {string} nodeId Unique current machine name.
@param {Log} log Logux log instance to be synchronized.
@param {Connection} connection Connection to remote node.
@param {object} [options] Synchro... | [
"Client",
"node",
"in",
"synchronization",
"pair",
"."
] | fd5ab2eddd0b7ec8fa77ba55e8a30e5cad09ab23 | https://github.com/logux/core/blob/fd5ab2eddd0b7ec8fa77ba55e8a30e5cad09ab23/client-node.js#L49-L52 |
18,249 | logux/core | log.js | Log | function Log (opts) {
if (!opts) opts = { }
if (typeof opts.nodeId === 'undefined') {
throw new Error('Expected node ID')
}
if (typeof opts.store !== 'object') {
throw new Error('Expected store')
}
if (opts.nodeId.indexOf(' ') !== -1) {
throw new Error('Space is prohibited in node ID')
}
/... | javascript | function Log (opts) {
if (!opts) opts = { }
if (typeof opts.nodeId === 'undefined') {
throw new Error('Expected node ID')
}
if (typeof opts.store !== 'object') {
throw new Error('Expected store')
}
if (opts.nodeId.indexOf(' ') !== -1) {
throw new Error('Space is prohibited in node ID')
}
/... | [
"function",
"Log",
"(",
"opts",
")",
"{",
"if",
"(",
"!",
"opts",
")",
"opts",
"=",
"{",
"}",
"if",
"(",
"typeof",
"opts",
".",
"nodeId",
"===",
"'undefined'",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Expected node ID'",
")",
"}",
"if",
"(",
"type... | Stores actions with time marks. Log is main idea in Logux.
In most end-user tools you will work with log and should know log API.
@param {object} opts Options.
@param {Store} opts.store Store for log.
@param {string|number} opts.nodeId Unique current machine name.
@example
import Log from 'logux-core/log'
const log =... | [
"Stores",
"actions",
"with",
"time",
"marks",
".",
"Log",
"is",
"main",
"idea",
"in",
"Logux",
".",
"In",
"most",
"end",
"-",
"user",
"tools",
"you",
"will",
"work",
"with",
"log",
"and",
"should",
"know",
"log",
"API",
"."
] | fd5ab2eddd0b7ec8fa77ba55e8a30e5cad09ab23 | https://github.com/logux/core/blob/fd5ab2eddd0b7ec8fa77ba55e8a30e5cad09ab23/log.js#L23-L48 |
18,250 | logux/core | log.js | add | function add (action, meta) {
if (typeof action.type === 'undefined') {
throw new Error('Expected "type" in action')
}
if (!meta) meta = { }
var newId = false
if (typeof meta.id === 'undefined') {
newId = true
meta.id = this.generateId()
}
if (typeof meta.time === 'undef... | javascript | function add (action, meta) {
if (typeof action.type === 'undefined') {
throw new Error('Expected "type" in action')
}
if (!meta) meta = { }
var newId = false
if (typeof meta.id === 'undefined') {
newId = true
meta.id = this.generateId()
}
if (typeof meta.time === 'undef... | [
"function",
"add",
"(",
"action",
",",
"meta",
")",
"{",
"if",
"(",
"typeof",
"action",
".",
"type",
"===",
"'undefined'",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Expected \"type\" in action'",
")",
"}",
"if",
"(",
"!",
"meta",
")",
"meta",
"=",
"{",... | Add action to log.
It will set `id`, `time` (if they was missed) and `added` property
to `meta` and call all listeners.
@param {Action} action The new action.
@param {Meta} [meta] Open structure for action metadata.
@param {string} [meta.id] Unique action ID.
@param {number} [meta.time] Action created time.
Milliseco... | [
"Add",
"action",
"to",
"log",
"."
] | fd5ab2eddd0b7ec8fa77ba55e8a30e5cad09ab23 | https://github.com/logux/core/blob/fd5ab2eddd0b7ec8fa77ba55e8a30e5cad09ab23/log.js#L100-L161 |
18,251 | logux/core | log.js | generateId | function generateId () {
var now = Date.now()
if (now <= this.lastTime) {
now = this.lastTime
this.sequence += 1
} else {
this.lastTime = now
this.sequence = 0
}
return now + ' ' + this.nodeId + ' ' + this.sequence
} | javascript | function generateId () {
var now = Date.now()
if (now <= this.lastTime) {
now = this.lastTime
this.sequence += 1
} else {
this.lastTime = now
this.sequence = 0
}
return now + ' ' + this.nodeId + ' ' + this.sequence
} | [
"function",
"generateId",
"(",
")",
"{",
"var",
"now",
"=",
"Date",
".",
"now",
"(",
")",
"if",
"(",
"now",
"<=",
"this",
".",
"lastTime",
")",
"{",
"now",
"=",
"this",
".",
"lastTime",
"this",
".",
"sequence",
"+=",
"1",
"}",
"else",
"{",
"this"... | Generate next unique action ID.
@return {string} Unique action ID.
@example
const id = log.generateId() | [
"Generate",
"next",
"unique",
"action",
"ID",
"."
] | fd5ab2eddd0b7ec8fa77ba55e8a30e5cad09ab23 | https://github.com/logux/core/blob/fd5ab2eddd0b7ec8fa77ba55e8a30e5cad09ab23/log.js#L171-L181 |
18,252 | logux/core | log.js | each | function each (opts, callback) {
if (!callback) {
callback = opts
opts = { order: 'created' }
}
var store = this.store
return new Promise(function (resolve) {
function nextPage (get) {
get().then(function (page) {
var result
for (var i = page.entries.length... | javascript | function each (opts, callback) {
if (!callback) {
callback = opts
opts = { order: 'created' }
}
var store = this.store
return new Promise(function (resolve) {
function nextPage (get) {
get().then(function (page) {
var result
for (var i = page.entries.length... | [
"function",
"each",
"(",
"opts",
",",
"callback",
")",
"{",
"if",
"(",
"!",
"callback",
")",
"{",
"callback",
"=",
"opts",
"opts",
"=",
"{",
"order",
":",
"'created'",
"}",
"}",
"var",
"store",
"=",
"this",
".",
"store",
"return",
"new",
"Promise",
... | Iterates through all actions, from last to first.
Return false from callback if you want to stop iteration.
@param {object} [opts] Iterator options.
@param {'added'|'created'} [opts.order='created'] Sort entries by created
time or when they was
added to this log.
@param {iterator} callback Function will be executed o... | [
"Iterates",
"through",
"all",
"actions",
"from",
"last",
"to",
"first",
"."
] | fd5ab2eddd0b7ec8fa77ba55e8a30e5cad09ab23 | https://github.com/logux/core/blob/fd5ab2eddd0b7ec8fa77ba55e8a30e5cad09ab23/log.js#L208-L235 |
18,253 | logux/core | ws-connection.js | WsConnection | function WsConnection (url, WS, opts) {
this.connected = false
this.emitter = new NanoEvents()
if (WS) {
this.WS = WS
} else if (typeof WebSocket !== 'undefined') {
this.WS = WebSocket
} else {
throw new Error('No WebSocket support')
}
this.url = url
this.opts = opts
} | javascript | function WsConnection (url, WS, opts) {
this.connected = false
this.emitter = new NanoEvents()
if (WS) {
this.WS = WS
} else if (typeof WebSocket !== 'undefined') {
this.WS = WebSocket
} else {
throw new Error('No WebSocket support')
}
this.url = url
this.opts = opts
} | [
"function",
"WsConnection",
"(",
"url",
",",
"WS",
",",
"opts",
")",
"{",
"this",
".",
"connected",
"=",
"false",
"this",
".",
"emitter",
"=",
"new",
"NanoEvents",
"(",
")",
"if",
"(",
"WS",
")",
"{",
"this",
".",
"WS",
"=",
"WS",
"}",
"else",
"i... | Logux connection for browser WebSocket.
@param {string} url WebSocket server URL.
@param {function} [WS] WebSocket class if you want change implementation.
@param {object} opts Extra option for WebSocket constructor.
@example
import { WsConnection } from 'logux-core'
const connection = new WsConnection('wss://logux.... | [
"Logux",
"connection",
"for",
"browser",
"WebSocket",
"."
] | fd5ab2eddd0b7ec8fa77ba55e8a30e5cad09ab23 | https://github.com/logux/core/blob/fd5ab2eddd0b7ec8fa77ba55e8a30e5cad09ab23/ws-connection.js#L19-L31 |
18,254 | logux/core | is-first-older.js | isFirstOlder | function isFirstOlder (firstMeta, secondMeta) {
if (firstMeta && !secondMeta) {
return false
} else if (!firstMeta && secondMeta) {
return true
}
if (firstMeta.time > secondMeta.time) {
return false
} else if (firstMeta.time < secondMeta.time) {
return true
}
var first = split(firstMeta.... | javascript | function isFirstOlder (firstMeta, secondMeta) {
if (firstMeta && !secondMeta) {
return false
} else if (!firstMeta && secondMeta) {
return true
}
if (firstMeta.time > secondMeta.time) {
return false
} else if (firstMeta.time < secondMeta.time) {
return true
}
var first = split(firstMeta.... | [
"function",
"isFirstOlder",
"(",
"firstMeta",
",",
"secondMeta",
")",
"{",
"if",
"(",
"firstMeta",
"&&",
"!",
"secondMeta",
")",
"{",
"return",
"false",
"}",
"else",
"if",
"(",
"!",
"firstMeta",
"&&",
"secondMeta",
")",
"{",
"return",
"true",
"}",
"if",
... | Compare time, when log entries were created.
It uses `meta.time` and `meta.id` to detect entries order.
@param {Meta} firstMeta Some action’s metadata.
@param {Meta} secondMeta Other action’s metadata.
@return {boolean} Is first action is older than second.
@example
import { isFirstOlder } from 'logux-core'
if (isF... | [
"Compare",
"time",
"when",
"log",
"entries",
"were",
"created",
"."
] | fd5ab2eddd0b7ec8fa77ba55e8a30e5cad09ab23 | https://github.com/logux/core/blob/fd5ab2eddd0b7ec8fa77ba55e8a30e5cad09ab23/is-first-older.js#L23-L51 |
18,255 | logux/core | logux-error.js | LoguxError | function LoguxError (type, options, received) {
Error.call(this, type)
/**
* Always equal to `LoguxError`. The best way to check error class.
* @type {string}
*
* @example
* if (error.name === 'LoguxError') { }
*/
this.name = 'LoguxError'
/**
* The error code.
* @type {string}
*
... | javascript | function LoguxError (type, options, received) {
Error.call(this, type)
/**
* Always equal to `LoguxError`. The best way to check error class.
* @type {string}
*
* @example
* if (error.name === 'LoguxError') { }
*/
this.name = 'LoguxError'
/**
* The error code.
* @type {string}
*
... | [
"function",
"LoguxError",
"(",
"type",
",",
"options",
",",
"received",
")",
"{",
"Error",
".",
"call",
"(",
"this",
",",
"type",
")",
"/**\n * Always equal to `LoguxError`. The best way to check error class.\n * @type {string}\n *\n * @example\n * if (error.name === 'L... | Logux error in logs synchronization.
@param {string} type The error code.
@param {any} options The error option.
@param {boolean} received Was error received from remote node.
@example
if (error.name === 'LoguxError') {
console.log('Server throws: ' + error.description)
}
@extends Error
@class | [
"Logux",
"error",
"in",
"logs",
"synchronization",
"."
] | fd5ab2eddd0b7ec8fa77ba55e8a30e5cad09ab23 | https://github.com/logux/core/blob/fd5ab2eddd0b7ec8fa77ba55e8a30e5cad09ab23/logux-error.js#L16-L78 |
18,256 | azuqua/cassanknex | schema/keyspaceBuilder.js | _getStrategyGrouping | function _getStrategyGrouping(_class) {
return function () {
var replicationParams = _.toArray(arguments)
, replication = {"class": _class};
if (_class === methods.withSimpleStrategy.name) {
if (typeof replicationParams[0] === "undefined")
throw new Error("SimpleStrategy requires replic... | javascript | function _getStrategyGrouping(_class) {
return function () {
var replicationParams = _.toArray(arguments)
, replication = {"class": _class};
if (_class === methods.withSimpleStrategy.name) {
if (typeof replicationParams[0] === "undefined")
throw new Error("SimpleStrategy requires replic... | [
"function",
"_getStrategyGrouping",
"(",
"_class",
")",
"{",
"return",
"function",
"(",
")",
"{",
"var",
"replicationParams",
"=",
"_",
".",
"toArray",
"(",
"arguments",
")",
",",
"replication",
"=",
"{",
"\"class\"",
":",
"_class",
"}",
";",
"if",
"(",
... | Returns function used to build the `with replication` clause in a create keyspace statement
@param _class
@returns {Function}
@private | [
"Returns",
"function",
"used",
"to",
"build",
"the",
"with",
"replication",
"clause",
"in",
"a",
"create",
"keyspace",
"statement"
] | 341826b8a4b99042abba4032058131967629e110 | https://github.com/azuqua/cassanknex/blob/341826b8a4b99042abba4032058131967629e110/schema/keyspaceBuilder.js#L41-L78 |
18,257 | azuqua/cassanknex | schema/keyspaceBuilder.js | _getAndGrouping | function _getAndGrouping(type) {
return function () {
var boolean = _.toArray(arguments);
this._statements.push({
grouping: "and",
type: type,
value: arguments[0] ? arguments[0] : false
});
return this;
};
} | javascript | function _getAndGrouping(type) {
return function () {
var boolean = _.toArray(arguments);
this._statements.push({
grouping: "and",
type: type,
value: arguments[0] ? arguments[0] : false
});
return this;
};
} | [
"function",
"_getAndGrouping",
"(",
"type",
")",
"{",
"return",
"function",
"(",
")",
"{",
"var",
"boolean",
"=",
"_",
".",
"toArray",
"(",
"arguments",
")",
";",
"this",
".",
"_statements",
".",
"push",
"(",
"{",
"grouping",
":",
"\"and\"",
",",
"type... | returns function used to build the `and` clause of a create keyspace statement
@param type
@returns {Function}
@private | [
"returns",
"function",
"used",
"to",
"build",
"the",
"and",
"clause",
"of",
"a",
"create",
"keyspace",
"statement"
] | 341826b8a4b99042abba4032058131967629e110 | https://github.com/azuqua/cassanknex/blob/341826b8a4b99042abba4032058131967629e110/schema/keyspaceBuilder.js#L87-L99 |
18,258 | azuqua/cassanknex | index.js | _attachExecMethod | function _attachExecMethod(qb) {
/**
* Create the exec function for a pass through to the datastax driver.
*
* @param `{Object} options` optional argument passed to datastax driver upon query execution
* @param `{Function} cb` => function(err, result) {}
* @returns {Client|exports|module.exports}
*/... | javascript | function _attachExecMethod(qb) {
/**
* Create the exec function for a pass through to the datastax driver.
*
* @param `{Object} options` optional argument passed to datastax driver upon query execution
* @param `{Function} cb` => function(err, result) {}
* @returns {Client|exports|module.exports}
*/... | [
"function",
"_attachExecMethod",
"(",
"qb",
")",
"{",
"/**\n * Create the exec function for a pass through to the datastax driver.\n *\n * @param `{Object} options` optional argument passed to datastax driver upon query execution\n * @param `{Function} cb` => function(err, result) {}\n * @retu... | hooks the 'exec' cassandra client method to our query builder object
@param qb
@private | [
"hooks",
"the",
"exec",
"cassandra",
"client",
"method",
"to",
"our",
"query",
"builder",
"object"
] | 341826b8a4b99042abba4032058131967629e110 | https://github.com/azuqua/cassanknex/blob/341826b8a4b99042abba4032058131967629e110/index.js#L132-L170 |
18,259 | azuqua/cassanknex | index.js | _attachStreamMethod | function _attachStreamMethod(qb) {
/**
* Create the stream function for a pass through to the datastax driver,
* all callbacks are defaulted to lodash#noop if not declared.
*
* @param `{Object} options` optional argument passed to datastax driver upon query execution
* @param `{Object} cbs` =>
* {
... | javascript | function _attachStreamMethod(qb) {
/**
* Create the stream function for a pass through to the datastax driver,
* all callbacks are defaulted to lodash#noop if not declared.
*
* @param `{Object} options` optional argument passed to datastax driver upon query execution
* @param `{Object} cbs` =>
* {
... | [
"function",
"_attachStreamMethod",
"(",
"qb",
")",
"{",
"/**\n * Create the stream function for a pass through to the datastax driver,\n * all callbacks are defaulted to lodash#noop if not declared.\n *\n * @param `{Object} options` optional argument passed to datastax driver upon query executio... | hooks the 'stream' cassandra client method to our query builder object
@param qb
@private | [
"hooks",
"the",
"stream",
"cassandra",
"client",
"method",
"to",
"our",
"query",
"builder",
"object"
] | 341826b8a4b99042abba4032058131967629e110 | https://github.com/azuqua/cassanknex/blob/341826b8a4b99042abba4032058131967629e110/index.js#L177-L214 |
18,260 | azuqua/cassanknex | index.js | _attachEachRowMethod | function _attachEachRowMethod(qb) {
/**
* Create the eachRow function for a pass through to the datastax driver.
*
* @param `{Object} options` optional argument passed to datastax driver upon query execution
* @param `{Function} rowCb` => function(row) {}
* @param `{Function} errorCb` => function(err) ... | javascript | function _attachEachRowMethod(qb) {
/**
* Create the eachRow function for a pass through to the datastax driver.
*
* @param `{Object} options` optional argument passed to datastax driver upon query execution
* @param `{Function} rowCb` => function(row) {}
* @param `{Function} errorCb` => function(err) ... | [
"function",
"_attachEachRowMethod",
"(",
"qb",
")",
"{",
"/**\n * Create the eachRow function for a pass through to the datastax driver.\n *\n * @param `{Object} options` optional argument passed to datastax driver upon query execution\n * @param `{Function} rowCb` => function(row) {}\n * @par... | hooks the 'eachRow' cassandra client method to our query builder object
@param qb
@private | [
"hooks",
"the",
"eachRow",
"cassandra",
"client",
"method",
"to",
"our",
"query",
"builder",
"object"
] | 341826b8a4b99042abba4032058131967629e110 | https://github.com/azuqua/cassanknex/blob/341826b8a4b99042abba4032058131967629e110/index.js#L221-L258 |
18,261 | azuqua/cassanknex | index.js | _attachBatchMethod | function _attachBatchMethod(qb) {
/**
*
* @param options
* @param cassakni
* @param cb
* @returns {Client|exports|module.exports}
*/
qb.batch = function (options, cassakni, cb) {
var _options
, _cassakni
, _cb;
// options is really cassakni, cassakni is cb
if (_.isArray(o... | javascript | function _attachBatchMethod(qb) {
/**
*
* @param options
* @param cassakni
* @param cb
* @returns {Client|exports|module.exports}
*/
qb.batch = function (options, cassakni, cb) {
var _options
, _cassakni
, _cb;
// options is really cassakni, cassakni is cb
if (_.isArray(o... | [
"function",
"_attachBatchMethod",
"(",
"qb",
")",
"{",
"/**\n *\n * @param options\n * @param cassakni\n * @param cb\n * @returns {Client|exports|module.exports}\n */",
"qb",
".",
"batch",
"=",
"function",
"(",
"options",
",",
"cassakni",
",",
"cb",
")",
"{",
"var... | hooks the 'batch' cassandra client method to our query builder object
@param qb
@private | [
"hooks",
"the",
"batch",
"cassandra",
"client",
"method",
"to",
"our",
"query",
"builder",
"object"
] | 341826b8a4b99042abba4032058131967629e110 | https://github.com/azuqua/cassanknex/blob/341826b8a4b99042abba4032058131967629e110/index.js#L265-L323 |
18,262 | vue-typed/vue-typed | gulpfile.js | startWatch | function startWatch() {
var rp = path.join(rootPath, '/**/*.md')
watcher = gulp.watch([rp, '!' + rp + '/_book/'], function() {
rebuildBook(reload)
})
return watcher
} | javascript | function startWatch() {
var rp = path.join(rootPath, '/**/*.md')
watcher = gulp.watch([rp, '!' + rp + '/_book/'], function() {
rebuildBook(reload)
})
return watcher
} | [
"function",
"startWatch",
"(",
")",
"{",
"var",
"rp",
"=",
"path",
".",
"join",
"(",
"rootPath",
",",
"'/**/*.md'",
")",
"watcher",
"=",
"gulp",
".",
"watch",
"(",
"[",
"rp",
",",
"'!'",
"+",
"rp",
"+",
"'/_book/'",
"]",
",",
"function",
"(",
")",
... | start watching md files + when files changed reload browser | [
"start",
"watching",
"md",
"files",
"+",
"when",
"files",
"changed",
"reload",
"browser"
] | c7946ef5091a9edba6402b9a72bd80df33f4c651 | https://github.com/vue-typed/vue-typed/blob/c7946ef5091a9edba6402b9a72bd80df33f4c651/gulpfile.js#L68-L74 |
18,263 | jsvine/notebookjs | notebook.js | function (format) {
return function (data) {
var el = makeElement("img", [ "image-output" ]);
el.src = "data:image/" + format + ";base64," + joinText(data).replace(/\n/g, "");
return el;
};
} | javascript | function (format) {
return function (data) {
var el = makeElement("img", [ "image-output" ]);
el.src = "data:image/" + format + ";base64," + joinText(data).replace(/\n/g, "");
return el;
};
} | [
"function",
"(",
"format",
")",
"{",
"return",
"function",
"(",
"data",
")",
"{",
"var",
"el",
"=",
"makeElement",
"(",
"\"img\"",
",",
"[",
"\"image-output\"",
"]",
")",
";",
"el",
".",
"src",
"=",
"\"data:image/\"",
"+",
"format",
"+",
"\";base64,\"",
... | Outputs and output-renderers | [
"Outputs",
"and",
"output",
"-",
"renderers"
] | b594a4046b864722a147632d2abd08f94f8393ed | https://github.com/jsvine/notebookjs/blob/b594a4046b864722a147632d2abd08f94f8393ed/notebook.js#L92-L98 | |
18,264 | appium/appium-doctor | lib/utils.js | resolveExecutablePath | async function resolveExecutablePath (cmd) {
let executablePath;
try {
executablePath = await fs.which(cmd);
if (executablePath && await fs.exists(executablePath)) {
return executablePath;
}
} catch (err) {
if ((/not found/gi).test(err.message)) {
log.debug(err);
} else {
log... | javascript | async function resolveExecutablePath (cmd) {
let executablePath;
try {
executablePath = await fs.which(cmd);
if (executablePath && await fs.exists(executablePath)) {
return executablePath;
}
} catch (err) {
if ((/not found/gi).test(err.message)) {
log.debug(err);
} else {
log... | [
"async",
"function",
"resolveExecutablePath",
"(",
"cmd",
")",
"{",
"let",
"executablePath",
";",
"try",
"{",
"executablePath",
"=",
"await",
"fs",
".",
"which",
"(",
"cmd",
")",
";",
"if",
"(",
"executablePath",
"&&",
"await",
"fs",
".",
"exists",
"(",
... | Return an executable path of cmd
@param {string} cmd Standard output by command
@return {?string} The full path of cmd. `null` if the cmd is not found. | [
"Return",
"an",
"executable",
"path",
"of",
"cmd"
] | c00f604047b2addb7c544e12ddb524169bf8067e | https://github.com/appium/appium-doctor/blob/c00f604047b2addb7c544e12ddb524169bf8067e/lib/utils.js#L42-L61 |
18,265 | AFASSoftware/maquette | website/source/tutorial/assets/saucer-orbit.js | tick | function tick() {
var moment = (new Date().getTime() - startDate)/1000;
x = Math.round(150 * Math.sin(moment));
y = Math.round(150 * Math.cos(moment));
requestAnimationFrame(tick);
} | javascript | function tick() {
var moment = (new Date().getTime() - startDate)/1000;
x = Math.round(150 * Math.sin(moment));
y = Math.round(150 * Math.cos(moment));
requestAnimationFrame(tick);
} | [
"function",
"tick",
"(",
")",
"{",
"var",
"moment",
"=",
"(",
"new",
"Date",
"(",
")",
".",
"getTime",
"(",
")",
"-",
"startDate",
")",
"/",
"1000",
";",
"x",
"=",
"Math",
".",
"round",
"(",
"150",
"*",
"Math",
".",
"sin",
"(",
"moment",
")",
... | This function continually adjusts the saucer position | [
"This",
"function",
"continually",
"adjusts",
"the",
"saucer",
"position"
] | a65ae617d5f04d4804a2b4dc40263d0a90cd2c10 | https://github.com/AFASSoftware/maquette/blob/a65ae617d5f04d4804a2b4dc40263d0a90cd2c10/website/source/tutorial/assets/saucer-orbit.js#L14-L19 |
18,266 | AFASSoftware/maquette | examples/todomvc/js/components/todoListComponent.js | function (todo) {
model.remove(todo.id, function () {
todos.splice(todos.indexOf(todo), 1);
if (todo.completed) {
completedCount--;
} else {
itemsLeft--;
checkedAll = completedCount === todos.length;
}
});
} | javascript | function (todo) {
model.remove(todo.id, function () {
todos.splice(todos.indexOf(todo), 1);
if (todo.completed) {
completedCount--;
} else {
itemsLeft--;
checkedAll = completedCount === todos.length;
}
});
} | [
"function",
"(",
"todo",
")",
"{",
"model",
".",
"remove",
"(",
"todo",
".",
"id",
",",
"function",
"(",
")",
"{",
"todos",
".",
"splice",
"(",
"todos",
".",
"indexOf",
"(",
"todo",
")",
",",
"1",
")",
";",
"if",
"(",
"todo",
".",
"completed",
... | the todoComponent currently being edited | [
"the",
"todoComponent",
"currently",
"being",
"edited"
] | a65ae617d5f04d4804a2b4dc40263d0a90cd2c10 | https://github.com/AFASSoftware/maquette/blob/a65ae617d5f04d4804a2b4dc40263d0a90cd2c10/examples/todomvc/js/components/todoListComponent.js#L97-L107 | |
18,267 | AFASSoftware/maquette | examples/todomvc/js/models/store.js | function (query, callback) {
if (!callback) {
return;
}
var todos = data.todos;
callback.call(undefined, todos.filter(function (todo) {
for (var q in query) {
if (query[q] !== todo[q]) {
return false;
}
}
ret... | javascript | function (query, callback) {
if (!callback) {
return;
}
var todos = data.todos;
callback.call(undefined, todos.filter(function (todo) {
for (var q in query) {
if (query[q] !== todo[q]) {
return false;
}
}
ret... | [
"function",
"(",
"query",
",",
"callback",
")",
"{",
"if",
"(",
"!",
"callback",
")",
"{",
"return",
";",
"}",
"var",
"todos",
"=",
"data",
".",
"todos",
";",
"callback",
".",
"call",
"(",
"undefined",
",",
"todos",
".",
"filter",
"(",
"function",
... | Finds items based on a query given as a JS object
@param {object} query The query to match against (i.e. {foo: 'bar'})
@param {function} callback The callback to fire when the query has
completed running
@example
db.find({foo: 'bar', hello: 'world'}, function (data) {
// data will return any items that have foo: bar... | [
"Finds",
"items",
"based",
"on",
"a",
"query",
"given",
"as",
"a",
"JS",
"object"
] | a65ae617d5f04d4804a2b4dc40263d0a90cd2c10 | https://github.com/AFASSoftware/maquette/blob/a65ae617d5f04d4804a2b4dc40263d0a90cd2c10/examples/todomvc/js/models/store.js#L49-L64 | |
18,268 | AFASSoftware/maquette | examples/todomvc/js/models/store.js | function (updateData, callback, id) {
var todos = data.todos;
callback = callback || function () { };
// If an ID was actually given, find the item and update each property
if (id) {
for (var i = 0; i < todos.length; i++) {
if (todos[i].id === id) {
... | javascript | function (updateData, callback, id) {
var todos = data.todos;
callback = callback || function () { };
// If an ID was actually given, find the item and update each property
if (id) {
for (var i = 0; i < todos.length; i++) {
if (todos[i].id === id) {
... | [
"function",
"(",
"updateData",
",",
"callback",
",",
"id",
")",
"{",
"var",
"todos",
"=",
"data",
".",
"todos",
";",
"callback",
"=",
"callback",
"||",
"function",
"(",
")",
"{",
"}",
";",
"// If an ID was actually given, find the item and update each property",
... | Will save the given data to the DB. If no item exists it will create a new
item, otherwise it'll simply update an existing item's properties
@param {object} updateData The data to save back into the DB
@param {function} callback The callback to fire after saving
@param {number} id An optional param to enter an ID of a... | [
"Will",
"save",
"the",
"given",
"data",
"to",
"the",
"DB",
".",
"If",
"no",
"item",
"exists",
"it",
"will",
"create",
"a",
"new",
"item",
"otherwise",
"it",
"ll",
"simply",
"update",
"an",
"existing",
"item",
"s",
"properties"
] | a65ae617d5f04d4804a2b4dc40263d0a90cd2c10 | https://github.com/AFASSoftware/maquette/blob/a65ae617d5f04d4804a2b4dc40263d0a90cd2c10/examples/todomvc/js/models/store.js#L84-L111 | |
18,269 | AFASSoftware/maquette | examples/todomvc/js/models/store.js | function (id, callback) {
var todos = data.todos;
for (var i = 0; i < todos.length; i++) {
if (todos[i].id == id) {
todos.splice(i, 1);
break;
}
}
flush();
callback.call(undefined, data.todos);
} | javascript | function (id, callback) {
var todos = data.todos;
for (var i = 0; i < todos.length; i++) {
if (todos[i].id == id) {
todos.splice(i, 1);
break;
}
}
flush();
callback.call(undefined, data.todos);
} | [
"function",
"(",
"id",
",",
"callback",
")",
"{",
"var",
"todos",
"=",
"data",
".",
"todos",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"todos",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"todos",
"[",
"i",
"]",
".",
"id... | Will remove an item from the Store based on its ID
@param {number} id The ID of the item you want to remove
@param {function} callback The callback to fire after saving | [
"Will",
"remove",
"an",
"item",
"from",
"the",
"Store",
"based",
"on",
"its",
"ID"
] | a65ae617d5f04d4804a2b4dc40263d0a90cd2c10 | https://github.com/AFASSoftware/maquette/blob/a65ae617d5f04d4804a2b4dc40263d0a90cd2c10/examples/todomvc/js/models/store.js#L119-L131 | |
18,270 | AFASSoftware/maquette | examples/tonic-example.js | render | function render() {
return h('div', [
h('input', {
type: 'text', placeholder: 'What is your name?',
value: yourName, oninput: handleNameInput
}),
h('p.output', ['Hello ' + (yourName || 'you') + '!'])
]);
} | javascript | function render() {
return h('div', [
h('input', {
type: 'text', placeholder: 'What is your name?',
value: yourName, oninput: handleNameInput
}),
h('p.output', ['Hello ' + (yourName || 'you') + '!'])
]);
} | [
"function",
"render",
"(",
")",
"{",
"return",
"h",
"(",
"'div'",
",",
"[",
"h",
"(",
"'input'",
",",
"{",
"type",
":",
"'text'",
",",
"placeholder",
":",
"'What is your name?'",
",",
"value",
":",
"yourName",
",",
"oninput",
":",
"handleNameInput",
"}",... | This function uses the 'hyperscript' notation to create the virtual DOM. | [
"This",
"function",
"uses",
"the",
"hyperscript",
"notation",
"to",
"create",
"the",
"virtual",
"DOM",
"."
] | a65ae617d5f04d4804a2b4dc40263d0a90cd2c10 | https://github.com/AFASSoftware/maquette/blob/a65ae617d5f04d4804a2b4dc40263d0a90cd2c10/examples/tonic-example.js#L13-L21 |
18,271 | AFASSoftware/maquette | examples/todomvc/js/models/model.js | function (title, callback) {
title = title || '';
callback = callback || function () { };
var newItem = {
title: title.trim(),
completed: false
};
storage.save(newItem, callback);
} | javascript | function (title, callback) {
title = title || '';
callback = callback || function () { };
var newItem = {
title: title.trim(),
completed: false
};
storage.save(newItem, callback);
} | [
"function",
"(",
"title",
",",
"callback",
")",
"{",
"title",
"=",
"title",
"||",
"''",
";",
"callback",
"=",
"callback",
"||",
"function",
"(",
")",
"{",
"}",
";",
"var",
"newItem",
"=",
"{",
"title",
":",
"title",
".",
"trim",
"(",
")",
",",
"c... | Creates a new todo model
@param {string} [title] The title of the task
@param {function} [callback] The callback to fire after the model is created | [
"Creates",
"a",
"new",
"todo",
"model"
] | a65ae617d5f04d4804a2b4dc40263d0a90cd2c10 | https://github.com/AFASSoftware/maquette/blob/a65ae617d5f04d4804a2b4dc40263d0a90cd2c10/examples/todomvc/js/models/model.js#L20-L30 | |
18,272 | AFASSoftware/maquette | examples/todomvc/js/models/model.js | function (query, callback) {
var queryType = typeof query;
callback = callback || function () { };
if (queryType === 'function') {
callback = query;
storage.findAll(callback);
} else if (queryType === 'string' || queryType === 'number') {
query = parseInt(q... | javascript | function (query, callback) {
var queryType = typeof query;
callback = callback || function () { };
if (queryType === 'function') {
callback = query;
storage.findAll(callback);
} else if (queryType === 'string' || queryType === 'number') {
query = parseInt(q... | [
"function",
"(",
"query",
",",
"callback",
")",
"{",
"var",
"queryType",
"=",
"typeof",
"query",
";",
"callback",
"=",
"callback",
"||",
"function",
"(",
")",
"{",
"}",
";",
"if",
"(",
"queryType",
"===",
"'function'",
")",
"{",
"callback",
"=",
"query... | Finds and returns a model in storage. If no query is given it'll simply
return everything. If you pass in a string or number it'll look that up as
the ID of the model to find. Lastly, you can pass it an object to match
against.
@param {string|number|object} [query] A query to match models against
@param {function} [ca... | [
"Finds",
"and",
"returns",
"a",
"model",
"in",
"storage",
".",
"If",
"no",
"query",
"is",
"given",
"it",
"ll",
"simply",
"return",
"everything",
".",
"If",
"you",
"pass",
"in",
"a",
"string",
"or",
"number",
"it",
"ll",
"look",
"that",
"up",
"as",
"t... | a65ae617d5f04d4804a2b4dc40263d0a90cd2c10 | https://github.com/AFASSoftware/maquette/blob/a65ae617d5f04d4804a2b4dc40263d0a90cd2c10/examples/todomvc/js/models/model.js#L47-L60 | |
18,273 | AFASSoftware/maquette | examples/todomvc/js/models/model.js | function (callback) {
var todos = {
active: 0,
completed: 0,
total: 0
};
storage.findAll(function (data) {
data.forEach(function (todo) {
if (todo.completed) {
todos.completed++;
} else {
todos.active++;... | javascript | function (callback) {
var todos = {
active: 0,
completed: 0,
total: 0
};
storage.findAll(function (data) {
data.forEach(function (todo) {
if (todo.completed) {
todos.completed++;
} else {
todos.active++;... | [
"function",
"(",
"callback",
")",
"{",
"var",
"todos",
"=",
"{",
"active",
":",
"0",
",",
"completed",
":",
"0",
",",
"total",
":",
"0",
"}",
";",
"storage",
".",
"findAll",
"(",
"function",
"(",
"data",
")",
"{",
"data",
".",
"forEach",
"(",
"fu... | Returns a count of all todos | [
"Returns",
"a",
"count",
"of",
"all",
"todos"
] | a65ae617d5f04d4804a2b4dc40263d0a90cd2c10 | https://github.com/AFASSoftware/maquette/blob/a65ae617d5f04d4804a2b4dc40263d0a90cd2c10/examples/todomvc/js/models/model.js#L96-L115 | |
18,274 | mapbox/stylelint-processor-arbitrary-tags | index.js | isFileProcessable | function isFileProcessable(filepath) {
if (options.fileFilterRegex.length === 0) {
return true;
}
return options.fileFilterRegex.some((regex) => filepath.match(regex) !== null);
} | javascript | function isFileProcessable(filepath) {
if (options.fileFilterRegex.length === 0) {
return true;
}
return options.fileFilterRegex.some((regex) => filepath.match(regex) !== null);
} | [
"function",
"isFileProcessable",
"(",
"filepath",
")",
"{",
"if",
"(",
"options",
".",
"fileFilterRegex",
".",
"length",
"===",
"0",
")",
"{",
"return",
"true",
";",
"}",
"return",
"options",
".",
"fileFilterRegex",
".",
"some",
"(",
"(",
"regex",
")",
"... | Checks whether the given file is allowed by the filter | [
"Checks",
"whether",
"the",
"given",
"file",
"is",
"allowed",
"by",
"the",
"filter"
] | f453dd4d43a656e6acca17a1bb997a5187942132 | https://github.com/mapbox/stylelint-processor-arbitrary-tags/blob/f453dd4d43a656e6acca17a1bb997a5187942132/index.js#L21-L27 |
18,275 | koajs/generic-session | src/session.js | session | async function session(ctx, next) {
ctx.sessionStore = store
if (ctx.session || ctx._session) {
return next()
}
const result = await getSession(ctx)
if (!result) {
return next()
}
addCommonAPI(ctx)
ctx._session = result.session
// more flexible
Object.definePropert... | javascript | async function session(ctx, next) {
ctx.sessionStore = store
if (ctx.session || ctx._session) {
return next()
}
const result = await getSession(ctx)
if (!result) {
return next()
}
addCommonAPI(ctx)
ctx._session = result.session
// more flexible
Object.definePropert... | [
"async",
"function",
"session",
"(",
"ctx",
",",
"next",
")",
"{",
"ctx",
".",
"sessionStore",
"=",
"store",
"if",
"(",
"ctx",
".",
"session",
"||",
"ctx",
".",
"_session",
")",
"{",
"return",
"next",
"(",
")",
"}",
"const",
"result",
"=",
"await",
... | common session middleware
each request will generate a new session
```
let session = this.session
``` | [
"common",
"session",
"middleware",
"each",
"request",
"will",
"generate",
"a",
"new",
"session"
] | 85a6ae64b6a3e7966fa6299536acfe54ad575c13 | https://github.com/koajs/generic-session/blob/85a6ae64b6a3e7966fa6299536acfe54ad575c13/src/session.js#L303-L360 |
18,276 | koajs/generic-session | src/session.js | deferSession | async function deferSession(ctx, next) {
ctx.sessionStore = store
// TODO:
// Accessing ctx.session when it's defined is causing problems
// because it has side effect. So, here we use a flag to determine
// that session property is already defined.
if (ctx.__isSessionDefined) {
return ne... | javascript | async function deferSession(ctx, next) {
ctx.sessionStore = store
// TODO:
// Accessing ctx.session when it's defined is causing problems
// because it has side effect. So, here we use a flag to determine
// that session property is already defined.
if (ctx.__isSessionDefined) {
return ne... | [
"async",
"function",
"deferSession",
"(",
"ctx",
",",
"next",
")",
"{",
"ctx",
".",
"sessionStore",
"=",
"store",
"// TODO:",
"// Accessing ctx.session when it's defined is causing problems",
"// because it has side effect. So, here we use a flag to determine",
"// that session pro... | defer session middleware
only generate and get session when request use session
```
let session = yield this.session
``` | [
"defer",
"session",
"middleware",
"only",
"generate",
"and",
"get",
"session",
"when",
"request",
"use",
"session"
] | 85a6ae64b6a3e7966fa6299536acfe54ad575c13 | https://github.com/koajs/generic-session/blob/85a6ae64b6a3e7966fa6299536acfe54ad575c13/src/session.js#L370-L448 |
18,277 | Reportr/dashboard | public/build/static/application.js | getScriptData | function getScriptData(evt) {
//Using currentTarget instead of target for Firefox 2.0's sake. Not
//all old browsers will be supported, but this one was easy enough
//to support and still makes sense.
var node = evt.currentTarget || evt.srcElement;
//Remove t... | javascript | function getScriptData(evt) {
//Using currentTarget instead of target for Firefox 2.0's sake. Not
//all old browsers will be supported, but this one was easy enough
//to support and still makes sense.
var node = evt.currentTarget || evt.srcElement;
//Remove t... | [
"function",
"getScriptData",
"(",
"evt",
")",
"{",
"//Using currentTarget instead of target for Firefox 2.0's sake. Not",
"//all old browsers will be supported, but this one was easy enough",
"//to support and still makes sense.",
"var",
"node",
"=",
"evt",
".",
"currentTarget",
"||",
... | Given an event from a script node, get the requirejs info from it,
and then removes the event listeners on the node.
@param {Event} evt
@returns {Object} | [
"Given",
"an",
"event",
"from",
"a",
"script",
"node",
"get",
"the",
"requirejs",
"info",
"from",
"it",
"and",
"then",
"removes",
"the",
"event",
"listeners",
"on",
"the",
"node",
"."
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L1195-L1209 |
18,278 | Reportr/dashboard | public/build/static/application.js | completed | function completed() {
document.removeEventListener( "DOMContentLoaded", completed, false );
window.removeEventListener( "load", completed, false );
jQuery.ready();
} | javascript | function completed() {
document.removeEventListener( "DOMContentLoaded", completed, false );
window.removeEventListener( "load", completed, false );
jQuery.ready();
} | [
"function",
"completed",
"(",
")",
"{",
"document",
".",
"removeEventListener",
"(",
"\"DOMContentLoaded\"",
",",
"completed",
",",
"false",
")",
";",
"window",
".",
"removeEventListener",
"(",
"\"load\"",
",",
"completed",
",",
"false",
")",
";",
"jQuery",
".... | The ready event handler and self cleanup method | [
"The",
"ready",
"event",
"handler",
"and",
"self",
"cleanup",
"method"
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L5426-L5430 |
18,279 | Reportr/dashboard | public/build/static/application.js | computePixelPositionAndBoxSizingReliable | function computePixelPositionAndBoxSizingReliable() {
// Support: Firefox, Android 2.3 (Prefixed box-sizing versions).
div.style.cssText = "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" +
"box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;" +
"position:absolute;to... | javascript | function computePixelPositionAndBoxSizingReliable() {
// Support: Firefox, Android 2.3 (Prefixed box-sizing versions).
div.style.cssText = "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" +
"box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;" +
"position:absolute;to... | [
"function",
"computePixelPositionAndBoxSizingReliable",
"(",
")",
"{",
"// Support: Firefox, Android 2.3 (Prefixed box-sizing versions).",
"div",
".",
"style",
".",
"cssText",
"=",
"\"-webkit-box-sizing:border-box;-moz-box-sizing:border-box;\"",
"+",
"\"box-sizing:border-box;padding:1px;... | Executing both pixelPosition & boxSizingReliable tests require only one layout so they're executed at the same time to save the second computation. | [
"Executing",
"both",
"pixelPosition",
"&",
"boxSizingReliable",
"tests",
"require",
"only",
"one",
"layout",
"so",
"they",
"re",
"executed",
"at",
"the",
"same",
"time",
"to",
"save",
"the",
"second",
"computation",
"."
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L7611-L7623 |
18,280 | Reportr/dashboard | public/build/static/application.js | compareAscending | function compareAscending(a, b) {
return baseCompareAscending(a.criteria, b.criteria) || a.index - b.index;
} | javascript | function compareAscending(a, b) {
return baseCompareAscending(a.criteria, b.criteria) || a.index - b.index;
} | [
"function",
"compareAscending",
"(",
"a",
",",
"b",
")",
"{",
"return",
"baseCompareAscending",
"(",
"a",
".",
"criteria",
",",
"b",
".",
"criteria",
")",
"||",
"a",
".",
"index",
"-",
"b",
".",
"index",
";",
"}"
] | Used by `sortBy` to compare transformed elements of a collection and stable
sort them in ascending order.
@private
@param {Object} a The object to compare to `b`.
@param {Object} b The object to compare to `a`.
@returns {number} Returns the sort order indicator for `a`. | [
"Used",
"by",
"sortBy",
"to",
"compare",
"transformed",
"elements",
"of",
"a",
"collection",
"and",
"stable",
"sort",
"them",
"in",
"ascending",
"order",
"."
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L13462-L13464 |
18,281 | Reportr/dashboard | public/build/static/application.js | compareMultipleAscending | function compareMultipleAscending(a, b) {
var ac = a.criteria,
bc = b.criteria,
index = -1,
length = ac.length;
while (++index < length) {
var result = baseCompareAscending(ac[index], bc[index]);
if (result) {
return result;
}
}
// Fixes an `Array#sort`... | javascript | function compareMultipleAscending(a, b) {
var ac = a.criteria,
bc = b.criteria,
index = -1,
length = ac.length;
while (++index < length) {
var result = baseCompareAscending(ac[index], bc[index]);
if (result) {
return result;
}
}
// Fixes an `Array#sort`... | [
"function",
"compareMultipleAscending",
"(",
"a",
",",
"b",
")",
"{",
"var",
"ac",
"=",
"a",
".",
"criteria",
",",
"bc",
"=",
"b",
".",
"criteria",
",",
"index",
"=",
"-",
"1",
",",
"length",
"=",
"ac",
".",
"length",
";",
"while",
"(",
"++",
"in... | Used by `sortBy` to compare multiple properties of each element in a
collection and stable sort them in ascending order.
@private
@param {Object} a The object to compare to `b`.
@param {Object} b The object to compare to `a`.
@returns {number} Returns the sort order indicator for `a`. | [
"Used",
"by",
"sortBy",
"to",
"compare",
"multiple",
"properties",
"of",
"each",
"element",
"in",
"a",
"collection",
"and",
"stable",
"sort",
"them",
"in",
"ascending",
"order",
"."
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L13475-L13494 |
18,282 | Reportr/dashboard | public/build/static/application.js | releaseArray | function releaseArray(array) {
array.length = 0;
if (arrayPool.length < MAX_POOL_SIZE) {
arrayPool.push(array);
}
} | javascript | function releaseArray(array) {
array.length = 0;
if (arrayPool.length < MAX_POOL_SIZE) {
arrayPool.push(array);
}
} | [
"function",
"releaseArray",
"(",
"array",
")",
"{",
"array",
".",
"length",
"=",
"0",
";",
"if",
"(",
"arrayPool",
".",
"length",
"<",
"MAX_POOL_SIZE",
")",
"{",
"arrayPool",
".",
"push",
"(",
"array",
")",
";",
"}",
"}"
] | Releases `array` back to the array pool.
@private
@param {Array} array The array to release. | [
"Releases",
"array",
"back",
"to",
"the",
"array",
"pool",
"."
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L13562-L13567 |
18,283 | Reportr/dashboard | public/build/static/application.js | releaseObject | function releaseObject(object) {
object.criteria = object.value = null;
if (objectPool.length < MAX_POOL_SIZE) {
objectPool.push(object);
}
} | javascript | function releaseObject(object) {
object.criteria = object.value = null;
if (objectPool.length < MAX_POOL_SIZE) {
objectPool.push(object);
}
} | [
"function",
"releaseObject",
"(",
"object",
")",
"{",
"object",
".",
"criteria",
"=",
"object",
".",
"value",
"=",
"null",
";",
"if",
"(",
"objectPool",
".",
"length",
"<",
"MAX_POOL_SIZE",
")",
"{",
"objectPool",
".",
"push",
"(",
"object",
")",
";",
... | Releases `object` back to the object pool.
@private
@param {Object} object The object to release. | [
"Releases",
"object",
"back",
"to",
"the",
"object",
"pool",
"."
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L13575-L13580 |
18,284 | Reportr/dashboard | public/build/static/application.js | shimTrimLeft | function shimTrimLeft(string, chars) {
string = string == null ? '' : String(string);
if (!string) {
return string;
}
if (chars == null) {
return string.slice(trimmedLeftIndex(string))
}
chars = String(chars);
return string.slice(charsLeftIndex(string, chars));
} | javascript | function shimTrimLeft(string, chars) {
string = string == null ? '' : String(string);
if (!string) {
return string;
}
if (chars == null) {
return string.slice(trimmedLeftIndex(string))
}
chars = String(chars);
return string.slice(charsLeftIndex(string, chars));
} | [
"function",
"shimTrimLeft",
"(",
"string",
",",
"chars",
")",
"{",
"string",
"=",
"string",
"==",
"null",
"?",
"''",
":",
"String",
"(",
"string",
")",
";",
"if",
"(",
"!",
"string",
")",
"{",
"return",
"string",
";",
"}",
"if",
"(",
"chars",
"==",... | A fallback implementation of `trimLeft` to remove leading whitespace or
specified characters from `string`.
@private
@param {string} string The string to trim.
@param {string} [chars=whitespace] The characters to trim.
@returns {string} Returns the trimmed string. | [
"A",
"fallback",
"implementation",
"of",
"trimLeft",
"to",
"remove",
"leading",
"whitespace",
"or",
"specified",
"characters",
"from",
"string",
"."
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L13612-L13622 |
18,285 | Reportr/dashboard | public/build/static/application.js | shimTrimRight | function shimTrimRight(string, chars) {
string = string == null ? '' : String(string);
if (!string) {
return string;
}
if (chars == null) {
return string.slice(0, trimmedRightIndex(string) + 1)
}
chars = String(chars);
return string.slice(0, charsRightIndex(string, chars) + 1);
... | javascript | function shimTrimRight(string, chars) {
string = string == null ? '' : String(string);
if (!string) {
return string;
}
if (chars == null) {
return string.slice(0, trimmedRightIndex(string) + 1)
}
chars = String(chars);
return string.slice(0, charsRightIndex(string, chars) + 1);
... | [
"function",
"shimTrimRight",
"(",
"string",
",",
"chars",
")",
"{",
"string",
"=",
"string",
"==",
"null",
"?",
"''",
":",
"String",
"(",
"string",
")",
";",
"if",
"(",
"!",
"string",
")",
"{",
"return",
"string",
";",
"}",
"if",
"(",
"chars",
"=="... | A fallback implementation of `trimRight` to remove trailing whitespace or
specified characters from `string`.
@private
@param {string} string The string to trim.
@param {string} [chars=whitespace] The characters to trim.
@returns {string} Returns the trimmed string. | [
"A",
"fallback",
"implementation",
"of",
"trimRight",
"to",
"remove",
"trailing",
"whitespace",
"or",
"specified",
"characters",
"from",
"string",
"."
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L13633-L13643 |
18,286 | Reportr/dashboard | public/build/static/application.js | trimmedLeftIndex | function trimmedLeftIndex(string) {
var index = -1,
length = string.length;
while (++index < length) {
var c = string.charCodeAt(index);
if (!((c <= 160 && (c >= 9 && c <= 13) || c == 32 || c == 160) || c == 5760 || c == 6158 ||
(c >= 8192 && (c <= 8202 || c == 8232 || c == 8233 |... | javascript | function trimmedLeftIndex(string) {
var index = -1,
length = string.length;
while (++index < length) {
var c = string.charCodeAt(index);
if (!((c <= 160 && (c >= 9 && c <= 13) || c == 32 || c == 160) || c == 5760 || c == 6158 ||
(c >= 8192 && (c <= 8202 || c == 8232 || c == 8233 |... | [
"function",
"trimmedLeftIndex",
"(",
"string",
")",
"{",
"var",
"index",
"=",
"-",
"1",
",",
"length",
"=",
"string",
".",
"length",
";",
"while",
"(",
"++",
"index",
"<",
"length",
")",
"{",
"var",
"c",
"=",
"string",
".",
"charCodeAt",
"(",
"index"... | Gets the index of the first non-whitespace character of `string`.
@private
@param {string} string The string to inspect.
@returns {number} Returns the index of the first non-whitespace character. | [
"Gets",
"the",
"index",
"of",
"the",
"first",
"non",
"-",
"whitespace",
"character",
"of",
"string",
"."
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L13652-L13664 |
18,287 | Reportr/dashboard | public/build/static/application.js | trimmedRightIndex | function trimmedRightIndex(string) {
var index = string.length;
while (index--) {
var c = string.charCodeAt(index);
if (!((c <= 160 && (c >= 9 && c <= 13) || c == 32 || c == 160) || c == 5760 || c == 6158 ||
(c >= 8192 && (c <= 8202 || c == 8232 || c == 8233 || c == 8239 || c == 8287 || c ... | javascript | function trimmedRightIndex(string) {
var index = string.length;
while (index--) {
var c = string.charCodeAt(index);
if (!((c <= 160 && (c >= 9 && c <= 13) || c == 32 || c == 160) || c == 5760 || c == 6158 ||
(c >= 8192 && (c <= 8202 || c == 8232 || c == 8233 || c == 8239 || c == 8287 || c ... | [
"function",
"trimmedRightIndex",
"(",
"string",
")",
"{",
"var",
"index",
"=",
"string",
".",
"length",
";",
"while",
"(",
"index",
"--",
")",
"{",
"var",
"c",
"=",
"string",
".",
"charCodeAt",
"(",
"index",
")",
";",
"if",
"(",
"!",
"(",
"(",
"c",... | Gets the index of the last non-whitespace character of `string`.
@private
@param {string} string The string to inspect.
@returns {number} Returns the index of the last non-whitespace character. | [
"Gets",
"the",
"index",
"of",
"the",
"last",
"non",
"-",
"whitespace",
"character",
"of",
"string",
"."
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L13673-L13683 |
18,288 | Reportr/dashboard | public/build/static/application.js | baseEach | function baseEach(collection, callback) {
var index = -1,
iterable = collection,
length = collection ? collection.length : 0;
if (typeof length == 'number') {
if (support.unindexedChars && isString(iterable)) {
iterable = iterable.split('');
}
while (++... | javascript | function baseEach(collection, callback) {
var index = -1,
iterable = collection,
length = collection ? collection.length : 0;
if (typeof length == 'number') {
if (support.unindexedChars && isString(iterable)) {
iterable = iterable.split('');
}
while (++... | [
"function",
"baseEach",
"(",
"collection",
",",
"callback",
")",
"{",
"var",
"index",
"=",
"-",
"1",
",",
"iterable",
"=",
"collection",
",",
"length",
"=",
"collection",
"?",
"collection",
".",
"length",
":",
"0",
";",
"if",
"(",
"typeof",
"length",
"... | The base implementation of `_.forEach` without support for callback
shorthands or `thisArg` binding.
@private
@param {Array|Object|string} collection The collection to iterate over.
@param {Function} callback The function called per iteration.
@returns {Array|Object|string} Returns `collection`. | [
"The",
"base",
"implementation",
"of",
"_",
".",
"forEach",
"without",
"support",
"for",
"callback",
"shorthands",
"or",
"thisArg",
"binding",
"."
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L14516-L14534 |
18,289 | Reportr/dashboard | public/build/static/application.js | baseEachRight | function baseEachRight(collection, callback) {
var iterable = collection,
length = collection ? collection.length : 0;
if (typeof length == 'number') {
if (support.unindexedChars && isString(iterable)) {
iterable = iterable.split('');
}
while (length--) {
... | javascript | function baseEachRight(collection, callback) {
var iterable = collection,
length = collection ? collection.length : 0;
if (typeof length == 'number') {
if (support.unindexedChars && isString(iterable)) {
iterable = iterable.split('');
}
while (length--) {
... | [
"function",
"baseEachRight",
"(",
"collection",
",",
"callback",
")",
"{",
"var",
"iterable",
"=",
"collection",
",",
"length",
"=",
"collection",
"?",
"collection",
".",
"length",
":",
"0",
";",
"if",
"(",
"typeof",
"length",
"==",
"'number'",
")",
"{",
... | The base implementation of `_.forEachRight` without support for callback
shorthands or `thisArg` binding.
@private
@param {Array|Object|string} collection The collection to iterate over.
@param {Function} callback The function called per iteration.
@returns {Array|Object|string} Returns `collection`. | [
"The",
"base",
"implementation",
"of",
"_",
".",
"forEachRight",
"without",
"support",
"for",
"callback",
"shorthands",
"or",
"thisArg",
"binding",
"."
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L14545-L14562 |
18,290 | Reportr/dashboard | public/build/static/application.js | baseForOwn | function baseForOwn(object, callback) {
var index = -1,
props = keys(object),
length = props.length;
while (++index < length) {
var key = props[index];
if (callback(object[key], key, object) === false) {
break;
}
}
return object;
} | javascript | function baseForOwn(object, callback) {
var index = -1,
props = keys(object),
length = props.length;
while (++index < length) {
var key = props[index];
if (callback(object[key], key, object) === false) {
break;
}
}
return object;
} | [
"function",
"baseForOwn",
"(",
"object",
",",
"callback",
")",
"{",
"var",
"index",
"=",
"-",
"1",
",",
"props",
"=",
"keys",
"(",
"object",
")",
",",
"length",
"=",
"props",
".",
"length",
";",
"while",
"(",
"++",
"index",
"<",
"length",
")",
"{",... | The base implementation of `_.forOwn` without support for callback
shorthands or `thisArg` binding.
@private
@param {Object} object The object to iterate over.
@param {Function} callback The function called per iteration.
@returns {Object} Returns `object`. | [
"The",
"base",
"implementation",
"of",
"_",
".",
"forOwn",
"without",
"support",
"for",
"callback",
"shorthands",
"or",
"thisArg",
"binding",
"."
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L14613-L14625 |
18,291 | Reportr/dashboard | public/build/static/application.js | baseForOwnRight | function baseForOwnRight(object, callback) {
var props = keys(object),
length = props.length;
while (length--) {
var key = props[length];
if (callback(object[key], key, object) === false) {
break;
}
}
return object;
} | javascript | function baseForOwnRight(object, callback) {
var props = keys(object),
length = props.length;
while (length--) {
var key = props[length];
if (callback(object[key], key, object) === false) {
break;
}
}
return object;
} | [
"function",
"baseForOwnRight",
"(",
"object",
",",
"callback",
")",
"{",
"var",
"props",
"=",
"keys",
"(",
"object",
")",
",",
"length",
"=",
"props",
".",
"length",
";",
"while",
"(",
"length",
"--",
")",
"{",
"var",
"key",
"=",
"props",
"[",
"lengt... | The base implementation of `_.forOwnRight` without support for callback
shorthands or `thisArg` binding.
@private
@param {Object} object The object to iterate over.
@param {Function} callback The function called per iteration.
@returns {Object} Returns `object`. | [
"The",
"base",
"implementation",
"of",
"_",
".",
"forOwnRight",
"without",
"support",
"for",
"callback",
"shorthands",
"or",
"thisArg",
"binding",
"."
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L14636-L14647 |
18,292 | Reportr/dashboard | public/build/static/application.js | baseMerge | function baseMerge(object, source, callback, stackA, stackB) {
(isArray(source) ? baseEach : baseForOwn)(source, function(source, key) {
var found,
isArr,
result = source,
value = object[key];
if (source && ((isArr = isArray(source)) || isPlainObject(source))) ... | javascript | function baseMerge(object, source, callback, stackA, stackB) {
(isArray(source) ? baseEach : baseForOwn)(source, function(source, key) {
var found,
isArr,
result = source,
value = object[key];
if (source && ((isArr = isArray(source)) || isPlainObject(source))) ... | [
"function",
"baseMerge",
"(",
"object",
",",
"source",
",",
"callback",
",",
"stackA",
",",
"stackB",
")",
"{",
"(",
"isArray",
"(",
"source",
")",
"?",
"baseEach",
":",
"baseForOwn",
")",
"(",
"source",
",",
"function",
"(",
"source",
",",
"key",
")",... | The base implementation of `_.merge` without argument juggling or support
for `thisArg` binding.
@private
@param {Object} object The destination object.
@param {Object} source The source object.
@param {Function} [callback] The function to customize merging properties.
@param {Array} [stackA=[]] Tracks traversed sourc... | [
"The",
"base",
"implementation",
"of",
"_",
".",
"merge",
"without",
"argument",
"juggling",
"or",
"support",
"for",
"thisArg",
"binding",
"."
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L14836-L14888 |
18,293 | Reportr/dashboard | public/build/static/application.js | createAggregator | function createAggregator(setter, retArray) {
return function(collection, callback, thisArg) {
var result = retArray ? [[], []] : {};
callback = lodash.createCallback(callback, thisArg, 3);
if (isArray(collection)) {
var index = -1,
length = collection.length;
... | javascript | function createAggregator(setter, retArray) {
return function(collection, callback, thisArg) {
var result = retArray ? [[], []] : {};
callback = lodash.createCallback(callback, thisArg, 3);
if (isArray(collection)) {
var index = -1,
length = collection.length;
... | [
"function",
"createAggregator",
"(",
"setter",
",",
"retArray",
")",
"{",
"return",
"function",
"(",
"collection",
",",
"callback",
",",
"thisArg",
")",
"{",
"var",
"result",
"=",
"retArray",
"?",
"[",
"[",
"]",
",",
"[",
"]",
"]",
":",
"{",
"}",
";"... | Creates a function that aggregates a collection, creating an object or
array composed from the results of running each element of the collection
through a callback. The given `setter` function sets the keys and values
of the composed object or array.
@private
@param {Function} setter The setter function.
@param {boole... | [
"Creates",
"a",
"function",
"that",
"aggregates",
"a",
"collection",
"creating",
"an",
"object",
"or",
"array",
"composed",
"from",
"the",
"results",
"of",
"running",
"each",
"element",
"of",
"the",
"collection",
"through",
"a",
"callback",
".",
"The",
"given"... | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L15020-L15040 |
18,294 | Reportr/dashboard | public/build/static/application.js | createIterator | function createIterator(options) {
options.shadowedProps = shadowedProps;
options.support = support;
// create the function factory
var factory = Function(
'errorClass, errorProto, hasOwnProperty, isArguments, isObject, objectProto, ' +
'nonEnumProps, stringClass, stringProt... | javascript | function createIterator(options) {
options.shadowedProps = shadowedProps;
options.support = support;
// create the function factory
var factory = Function(
'errorClass, errorProto, hasOwnProperty, isArguments, isObject, objectProto, ' +
'nonEnumProps, stringClass, stringProt... | [
"function",
"createIterator",
"(",
"options",
")",
"{",
"options",
".",
"shadowedProps",
"=",
"shadowedProps",
";",
"options",
".",
"support",
"=",
"support",
";",
"// create the function factory",
"var",
"factory",
"=",
"Function",
"(",
"'errorClass, errorProto, hasO... | Creates compiled iteration functions.
@private
@param {Object} [options] The compile options object.
@param {string} [options.args] A comma separated string of iteration function arguments.
@param {string} [options.init] The string representation of the initial `result` value.
@param {string} [options.loop] Code to ex... | [
"Creates",
"compiled",
"iteration",
"functions",
"."
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L15176-L15192 |
18,295 | Reportr/dashboard | public/build/static/application.js | getHolders | function getHolders(array) {
var index = -1,
length = array.length,
result = [];
while (++index < length) {
if (array[index] === lodash) {
result.push(index);
}
}
return result;
} | javascript | function getHolders(array) {
var index = -1,
length = array.length,
result = [];
while (++index < length) {
if (array[index] === lodash) {
result.push(index);
}
}
return result;
} | [
"function",
"getHolders",
"(",
"array",
")",
"{",
"var",
"index",
"=",
"-",
"1",
",",
"length",
"=",
"array",
".",
"length",
",",
"result",
"=",
"[",
"]",
";",
"while",
"(",
"++",
"index",
"<",
"length",
")",
"{",
"if",
"(",
"array",
"[",
"index"... | Finds the indexes of all placeholder elements in a given array.
@private
@param {Array} array The array to inspect.
@returns {Array} Returns a new array of placeholder indexes. | [
"Finds",
"the",
"indexes",
"of",
"all",
"placeholder",
"elements",
"in",
"a",
"given",
"array",
"."
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L15201-L15212 |
18,296 | Reportr/dashboard | public/build/static/application.js | sample | function sample(collection, n, guard) {
if (collection && typeof collection.length != 'number') {
collection = values(collection);
} else if (support.unindexedChars && isString(collection)) {
collection = collection.split('');
}
if (n == null || guard) {
return collection... | javascript | function sample(collection, n, guard) {
if (collection && typeof collection.length != 'number') {
collection = values(collection);
} else if (support.unindexedChars && isString(collection)) {
collection = collection.split('');
}
if (n == null || guard) {
return collection... | [
"function",
"sample",
"(",
"collection",
",",
"n",
",",
"guard",
")",
"{",
"if",
"(",
"collection",
"&&",
"typeof",
"collection",
".",
"length",
"!=",
"'number'",
")",
"{",
"collection",
"=",
"values",
"(",
"collection",
")",
";",
"}",
"else",
"if",
"(... | Retrieves a random element or `n` random elements from a collection.
@static
@memberOf _
@category Collections
@param {Array|Object|string} collection The collection to sample.
@param {number} [n] The number of elements to sample.
@param- {Object} [guard] Enables use as a callback for functions like `_.map`.
@returns ... | [
"Retrieves",
"a",
"random",
"element",
"or",
"n",
"random",
"elements",
"from",
"a",
"collection",
"."
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L17557-L17569 |
18,297 | Reportr/dashboard | public/build/static/application.js | partialRight | function partialRight(func) {
if (func) {
var arity = func[expando] ? func[expando][2] : func.length,
partialRightArgs = slice(arguments, 1);
arity -= partialRightArgs.length;
}
return createWrapper(func, PARTIAL_RIGHT_FLAG, arity, null, null, partialRightArgs);
} | javascript | function partialRight(func) {
if (func) {
var arity = func[expando] ? func[expando][2] : func.length,
partialRightArgs = slice(arguments, 1);
arity -= partialRightArgs.length;
}
return createWrapper(func, PARTIAL_RIGHT_FLAG, arity, null, null, partialRightArgs);
} | [
"function",
"partialRight",
"(",
"func",
")",
"{",
"if",
"(",
"func",
")",
"{",
"var",
"arity",
"=",
"func",
"[",
"expando",
"]",
"?",
"func",
"[",
"expando",
"]",
"[",
"2",
"]",
":",
"func",
".",
"length",
",",
"partialRightArgs",
"=",
"slice",
"(... | This method is like `_.partial` except that partially applied arguments
are appended to those provided to the new function.
Note: This method does not set the `length` property of partially applied
functions.
@static
@memberOf _
@category Functions
@param {Function} func The function to partially apply arguments to.
... | [
"This",
"method",
"is",
"like",
"_",
".",
"partial",
"except",
"that",
"partially",
"applied",
"arguments",
"are",
"appended",
"to",
"those",
"provided",
"to",
"the",
"new",
"function",
"."
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L18401-L18409 |
18,298 | Reportr/dashboard | public/build/static/application.js | functions | function functions(object) {
var result = [];
baseForIn(object, function(value, key) {
if (isFunction(value)) {
result.push(key);
}
});
return result.sort();
} | javascript | function functions(object) {
var result = [];
baseForIn(object, function(value, key) {
if (isFunction(value)) {
result.push(key);
}
});
return result.sort();
} | [
"function",
"functions",
"(",
"object",
")",
"{",
"var",
"result",
"=",
"[",
"]",
";",
"baseForIn",
"(",
"object",
",",
"function",
"(",
"value",
",",
"key",
")",
"{",
"if",
"(",
"isFunction",
"(",
"value",
")",
")",
"{",
"result",
".",
"push",
"("... | Creates a sorted array of property names of all enumerable properties,
own and inherited, of `object` that have function values.
@static
@memberOf _
@alias methods
@category Objects
@param {Object} object The object to inspect.
@returns {Array} Returns an array of property names that have function values.
@example
_.... | [
"Creates",
"a",
"sorted",
"array",
"of",
"property",
"names",
"of",
"all",
"enumerable",
"properties",
"own",
"and",
"inherited",
"of",
"object",
"that",
"have",
"function",
"values",
"."
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L19000-L19008 |
18,299 | Reportr/dashboard | public/build/static/application.js | matches | function matches(source) {
source || (source = {});
var props = keys(source),
key = props[0],
a = source[key];
// fast path the common case of providing an object with a single
// property containing a primitive value
if (props.length == 1 && a === a && !isObject(a)) ... | javascript | function matches(source) {
source || (source = {});
var props = keys(source),
key = props[0],
a = source[key];
// fast path the common case of providing an object with a single
// property containing a primitive value
if (props.length == 1 && a === a && !isObject(a)) ... | [
"function",
"matches",
"(",
"source",
")",
"{",
"source",
"||",
"(",
"source",
"=",
"{",
"}",
")",
";",
"var",
"props",
"=",
"keys",
"(",
"source",
")",
",",
"key",
"=",
"props",
"[",
"0",
"]",
",",
"a",
"=",
"source",
"[",
"key",
"]",
";",
"... | Creates a "_.where" style function, which performs a deep comparison
between a given object and the `source` object, returning `true` if the
given object has equivalent property values, else `false`.
@static
@memberOf _
@category Utilities
@param {Object} source The object of property values to match.
@returns {Functi... | [
"Creates",
"a",
"_",
".",
"where",
"style",
"function",
"which",
"performs",
"a",
"deep",
"comparison",
"between",
"a",
"given",
"object",
"and",
"the",
"source",
"object",
"returning",
"true",
"if",
"the",
"given",
"object",
"has",
"equivalent",
"property",
... | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L20306-L20337 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.