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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
13,100 | benfred/venn.js | venn.js | distanceFromIntersectArea | function distanceFromIntersectArea(r1, r2, overlap) {
// handle complete overlapped circles
if (Math.min(r1, r2) * Math.min(r1,r2) * Math.PI <= overlap + SMALL$1) {
return Math.abs(r1 - r2);
}
return bisect(function(distance$$1) {
return circleOverlap(r1, r2, dis... | javascript | function distanceFromIntersectArea(r1, r2, overlap) {
// handle complete overlapped circles
if (Math.min(r1, r2) * Math.min(r1,r2) * Math.PI <= overlap + SMALL$1) {
return Math.abs(r1 - r2);
}
return bisect(function(distance$$1) {
return circleOverlap(r1, r2, dis... | [
"function",
"distanceFromIntersectArea",
"(",
"r1",
",",
"r2",
",",
"overlap",
")",
"{",
"// handle complete overlapped circles",
"if",
"(",
"Math",
".",
"min",
"(",
"r1",
",",
"r2",
")",
"*",
"Math",
".",
"min",
"(",
"r1",
",",
"r2",
")",
"*",
"Math",
... | Returns the distance necessary for two circles of radius r1 + r2 to
have the overlap area 'overlap' | [
"Returns",
"the",
"distance",
"necessary",
"for",
"two",
"circles",
"of",
"radius",
"r1",
"+",
"r2",
"to",
"have",
"the",
"overlap",
"area",
"overlap"
] | 5ff0ef3ff450803a50c69493cd2bb6ce8b04f9fb | https://github.com/benfred/venn.js/blob/5ff0ef3ff450803a50c69493cd2bb6ce8b04f9fb/venn.js#L623-L632 |
13,101 | highsource/jsonix | scripts/src/main/javascript/org/hisrc/jsonix/Jsonix/Model/ClassInfo.js | function(value, context, scope) {
return this.isInstance(value, context, scope) || (Jsonix.Util.Type.isObject(value) && !Jsonix.Util.Type.isArray(value));
} | javascript | function(value, context, scope) {
return this.isInstance(value, context, scope) || (Jsonix.Util.Type.isObject(value) && !Jsonix.Util.Type.isArray(value));
} | [
"function",
"(",
"value",
",",
"context",
",",
"scope",
")",
"{",
"return",
"this",
".",
"isInstance",
"(",
"value",
",",
"context",
",",
"scope",
")",
"||",
"(",
"Jsonix",
".",
"Util",
".",
"Type",
".",
"isObject",
"(",
"value",
")",
"&&",
"!",
"J... | Checks if the value is marshallable | [
"Checks",
"if",
"the",
"value",
"is",
"marshallable"
] | cb622447c59435558dd3142f3c460fbb6a274a3a | https://github.com/highsource/jsonix/blob/cb622447c59435558dd3142f3c460fbb6a274a3a/scripts/src/main/javascript/org/hisrc/jsonix/Jsonix/Model/ClassInfo.js#L252-L254 | |
13,102 | ded/script.js | vendor/mootools.js | function(value){
value = Function.from(value)();
value = (typeof value == 'string') ? value.split(' ') : Array.from(value);
return value.map(function(val){
val = String(val);
var found = false;
Object.each(Fx.CSS.Parsers, function(parser, key){
if (found) return;
var parsed = parser.parse(val);
... | javascript | function(value){
value = Function.from(value)();
value = (typeof value == 'string') ? value.split(' ') : Array.from(value);
return value.map(function(val){
val = String(val);
var found = false;
Object.each(Fx.CSS.Parsers, function(parser, key){
if (found) return;
var parsed = parser.parse(val);
... | [
"function",
"(",
"value",
")",
"{",
"value",
"=",
"Function",
".",
"from",
"(",
"value",
")",
"(",
")",
";",
"value",
"=",
"(",
"typeof",
"value",
"==",
"'string'",
")",
"?",
"value",
".",
"split",
"(",
"' '",
")",
":",
"Array",
".",
"from",
"(",... | parses a value into an array | [
"parses",
"a",
"value",
"into",
"an",
"array"
] | 95ca7a60c75e266a492262e29dacb3ec2ea15a95 | https://github.com/ded/script.js/blob/95ca7a60c75e266a492262e29dacb3ec2ea15a95/vendor/mootools.js#L4616-L4630 | |
13,103 | ded/script.js | vendor/mootools.js | function(from, to, delta){
var computed = [];
(Math.min(from.length, to.length)).times(function(i){
computed.push({value: from[i].parser.compute(from[i].value, to[i].value, delta), parser: from[i].parser});
});
computed.$family = Function.from('fx:css:value');
return computed;
} | javascript | function(from, to, delta){
var computed = [];
(Math.min(from.length, to.length)).times(function(i){
computed.push({value: from[i].parser.compute(from[i].value, to[i].value, delta), parser: from[i].parser});
});
computed.$family = Function.from('fx:css:value');
return computed;
} | [
"function",
"(",
"from",
",",
"to",
",",
"delta",
")",
"{",
"var",
"computed",
"=",
"[",
"]",
";",
"(",
"Math",
".",
"min",
"(",
"from",
".",
"length",
",",
"to",
".",
"length",
")",
")",
".",
"times",
"(",
"function",
"(",
"i",
")",
"{",
"co... | computes by a from and to prepared objects, using their parsers. | [
"computes",
"by",
"a",
"from",
"and",
"to",
"prepared",
"objects",
"using",
"their",
"parsers",
"."
] | 95ca7a60c75e266a492262e29dacb3ec2ea15a95 | https://github.com/ded/script.js/blob/95ca7a60c75e266a492262e29dacb3ec2ea15a95/vendor/mootools.js#L4634-L4641 | |
13,104 | ded/script.js | vendor/mootools.js | function(value, unit){
if (typeOf(value) != 'fx:css:value') value = this.parse(value);
var returned = [];
value.each(function(bit){
returned = returned.concat(bit.parser.serve(bit.value, unit));
});
return returned;
} | javascript | function(value, unit){
if (typeOf(value) != 'fx:css:value') value = this.parse(value);
var returned = [];
value.each(function(bit){
returned = returned.concat(bit.parser.serve(bit.value, unit));
});
return returned;
} | [
"function",
"(",
"value",
",",
"unit",
")",
"{",
"if",
"(",
"typeOf",
"(",
"value",
")",
"!=",
"'fx:css:value'",
")",
"value",
"=",
"this",
".",
"parse",
"(",
"value",
")",
";",
"var",
"returned",
"=",
"[",
"]",
";",
"value",
".",
"each",
"(",
"f... | serves the value as settable | [
"serves",
"the",
"value",
"as",
"settable"
] | 95ca7a60c75e266a492262e29dacb3ec2ea15a95 | https://github.com/ded/script.js/blob/95ca7a60c75e266a492262e29dacb3ec2ea15a95/vendor/mootools.js#L4645-L4652 | |
13,105 | ded/script.js | vendor/mootools.js | function(element, property, value, unit){
element.setStyle(property, this.serve(value, unit));
} | javascript | function(element, property, value, unit){
element.setStyle(property, this.serve(value, unit));
} | [
"function",
"(",
"element",
",",
"property",
",",
"value",
",",
"unit",
")",
"{",
"element",
".",
"setStyle",
"(",
"property",
",",
"this",
".",
"serve",
"(",
"value",
",",
"unit",
")",
")",
";",
"}"
] | renders the change to an element | [
"renders",
"the",
"change",
"to",
"an",
"element"
] | 95ca7a60c75e266a492262e29dacb3ec2ea15a95 | https://github.com/ded/script.js/blob/95ca7a60c75e266a492262e29dacb3ec2ea15a95/vendor/mootools.js#L4656-L4658 | |
13,106 | ded/script.js | vendor/lab2.js | isScriptLoaded | function isScriptLoaded(elem,scriptentry) {
if ((elem[sREADYSTATE] && elem[sREADYSTATE]!==sCOMPLETE && elem[sREADYSTATE]!=="loaded") || scriptentry[sDONE]) { return bFALSE; }
elem[sONLOAD] = elem[sONREADYSTATECHANGE] = nNULL; // prevent memory leak
return bTRUE;
} | javascript | function isScriptLoaded(elem,scriptentry) {
if ((elem[sREADYSTATE] && elem[sREADYSTATE]!==sCOMPLETE && elem[sREADYSTATE]!=="loaded") || scriptentry[sDONE]) { return bFALSE; }
elem[sONLOAD] = elem[sONREADYSTATECHANGE] = nNULL; // prevent memory leak
return bTRUE;
} | [
"function",
"isScriptLoaded",
"(",
"elem",
",",
"scriptentry",
")",
"{",
"if",
"(",
"(",
"elem",
"[",
"sREADYSTATE",
"]",
"&&",
"elem",
"[",
"sREADYSTATE",
"]",
"!==",
"sCOMPLETE",
"&&",
"elem",
"[",
"sREADYSTATE",
"]",
"!==",
"\"loaded\"",
")",
"||",
"s... | if all flags are turned off, preload is moot so disable it | [
"if",
"all",
"flags",
"are",
"turned",
"off",
"preload",
"is",
"moot",
"so",
"disable",
"it"
] | 95ca7a60c75e266a492262e29dacb3ec2ea15a95 | https://github.com/ded/script.js/blob/95ca7a60c75e266a492262e29dacb3ec2ea15a95/vendor/lab2.js#L113-L117 |
13,107 | bigspotteddog/ScrollToFixed | jquery-scrolltofixed.js | resetScroll | function resetScroll() {
// Set the element to it original positioning.
target.trigger('preUnfixed.ScrollToFixed');
setUnfixed();
target.trigger('unfixed.ScrollToFixed');
// Reset the last offset used to determine if the page has moved
// horizont... | javascript | function resetScroll() {
// Set the element to it original positioning.
target.trigger('preUnfixed.ScrollToFixed');
setUnfixed();
target.trigger('unfixed.ScrollToFixed');
// Reset the last offset used to determine if the page has moved
// horizont... | [
"function",
"resetScroll",
"(",
")",
"{",
"// Set the element to it original positioning.",
"target",
".",
"trigger",
"(",
"'preUnfixed.ScrollToFixed'",
")",
";",
"setUnfixed",
"(",
")",
";",
"target",
".",
"trigger",
"(",
"'unfixed.ScrollToFixed'",
")",
";",
"// Rese... | Capture the original offsets for the target element. This needs to be called whenever the page size changes or when the page is first scrolled. For some reason, calling this before the page is first scrolled causes the element to become fixed too late. | [
"Capture",
"the",
"original",
"offsets",
"for",
"the",
"target",
"element",
".",
"This",
"needs",
"to",
"be",
"called",
"whenever",
"the",
"page",
"size",
"changes",
"or",
"when",
"the",
"page",
"is",
"first",
"scrolled",
".",
"For",
"some",
"reason",
"cal... | a2f9dc0d20cfc8fc2468f5b2937fbc11937e2a98 | https://github.com/bigspotteddog/ScrollToFixed/blob/a2f9dc0d20cfc8fc2468f5b2937fbc11937e2a98/jquery-scrolltofixed.js#L65-L100 |
13,108 | bigspotteddog/ScrollToFixed | jquery-scrolltofixed.js | setFixed | function setFixed() {
// Only fix the target element and the spacer if we need to.
if (!isFixed()) {
//get REAL dimensions (decimal fix)
//Ref. http://stackoverflow.com/questions/3603065/how-to-make-jquery-to-not-round-value-returned-by-width
var d... | javascript | function setFixed() {
// Only fix the target element and the spacer if we need to.
if (!isFixed()) {
//get REAL dimensions (decimal fix)
//Ref. http://stackoverflow.com/questions/3603065/how-to-make-jquery-to-not-round-value-returned-by-width
var d... | [
"function",
"setFixed",
"(",
")",
"{",
"// Only fix the target element and the spacer if we need to.",
"if",
"(",
"!",
"isFixed",
"(",
")",
")",
"{",
"//get REAL dimensions (decimal fix)",
"//Ref. http://stackoverflow.com/questions/3603065/how-to-make-jquery-to-not-round-value-returned... | Sets the target element to fixed. Also, sets the spacer to fill the void left by the target element. | [
"Sets",
"the",
"target",
"element",
"to",
"fixed",
".",
"Also",
"sets",
"the",
"spacer",
"to",
"fill",
"the",
"void",
"left",
"by",
"the",
"target",
"element",
"."
] | a2f9dc0d20cfc8fc2468f5b2937fbc11937e2a98 | https://github.com/bigspotteddog/ScrollToFixed/blob/a2f9dc0d20cfc8fc2468f5b2937fbc11937e2a98/jquery-scrolltofixed.js#L128-L167 |
13,109 | bigspotteddog/ScrollToFixed | jquery-scrolltofixed.js | setUnfixed | function setUnfixed() {
// Only unfix the target element and the spacer if we need to.
if (!isUnfixed()) {
lastOffsetLeft = -1;
// Hide the spacer now that the target element will fill the
// space.
spacer.css('display', 'none');
... | javascript | function setUnfixed() {
// Only unfix the target element and the spacer if we need to.
if (!isUnfixed()) {
lastOffsetLeft = -1;
// Hide the spacer now that the target element will fill the
// space.
spacer.css('display', 'none');
... | [
"function",
"setUnfixed",
"(",
")",
"{",
"// Only unfix the target element and the spacer if we need to.",
"if",
"(",
"!",
"isUnfixed",
"(",
")",
")",
"{",
"lastOffsetLeft",
"=",
"-",
"1",
";",
"// Hide the spacer now that the target element will fill the",
"// space.",
"sp... | Sets the target element back to unfixed. Also, hides the spacer. | [
"Sets",
"the",
"target",
"element",
"back",
"to",
"unfixed",
".",
"Also",
"hides",
"the",
"spacer",
"."
] | a2f9dc0d20cfc8fc2468f5b2937fbc11937e2a98 | https://github.com/bigspotteddog/ScrollToFixed/blob/a2f9dc0d20cfc8fc2468f5b2937fbc11937e2a98/jquery-scrolltofixed.js#L194-L222 |
13,110 | bigspotteddog/ScrollToFixed | jquery-scrolltofixed.js | setLeft | function setLeft(x) {
// Only if the scroll is not what it was last time we did this.
if (x != lastOffsetLeft) {
// Move the target element horizontally relative to its original
// horizontal position.
target.css('left', offsetLeft - x);
... | javascript | function setLeft(x) {
// Only if the scroll is not what it was last time we did this.
if (x != lastOffsetLeft) {
// Move the target element horizontally relative to its original
// horizontal position.
target.css('left', offsetLeft - x);
... | [
"function",
"setLeft",
"(",
"x",
")",
"{",
"// Only if the scroll is not what it was last time we did this.",
"if",
"(",
"x",
"!=",
"lastOffsetLeft",
")",
"{",
"// Move the target element horizontally relative to its original",
"// horizontal position.",
"target",
".",
"css",
"... | Moves the target element left or right relative to the horizontal scroll position. | [
"Moves",
"the",
"target",
"element",
"left",
"or",
"right",
"relative",
"to",
"the",
"horizontal",
"scroll",
"position",
"."
] | a2f9dc0d20cfc8fc2468f5b2937fbc11937e2a98 | https://github.com/bigspotteddog/ScrollToFixed/blob/a2f9dc0d20cfc8fc2468f5b2937fbc11937e2a98/jquery-scrolltofixed.js#L226-L236 |
13,111 | h2non/jshashes | hashes.js | rstr2binb | function rstr2binb(input) {
var i, l = input.length * 8,
output = Array(input.length >> 2),
lo = output.length;
for (i = 0; i < lo; i += 1) {
output[i] = 0;
}
for (i = 0; i < l; i += 8) {
output[i >> 5] |= (input.charCodeAt(i / 8) & 0xFF) << (24 - i % 32);
}
return output... | javascript | function rstr2binb(input) {
var i, l = input.length * 8,
output = Array(input.length >> 2),
lo = output.length;
for (i = 0; i < lo; i += 1) {
output[i] = 0;
}
for (i = 0; i < l; i += 8) {
output[i >> 5] |= (input.charCodeAt(i / 8) & 0xFF) << (24 - i % 32);
}
return output... | [
"function",
"rstr2binb",
"(",
"input",
")",
"{",
"var",
"i",
",",
"l",
"=",
"input",
".",
"length",
"*",
"8",
",",
"output",
"=",
"Array",
"(",
"input",
".",
"length",
">>",
"2",
")",
",",
"lo",
"=",
"output",
".",
"length",
";",
"for",
"(",
"i... | Convert a raw string to an array of big-endian words
Characters >255 have their high-byte silently ignored. | [
"Convert",
"a",
"raw",
"string",
"to",
"an",
"array",
"of",
"big",
"-",
"endian",
"words",
"Characters",
">",
"255",
"have",
"their",
"high",
"-",
"byte",
"silently",
"ignored",
"."
] | 88625b6c841ca3c90f8b9fefb0fedb78992017ad | https://github.com/h2non/jshashes/blob/88625b6c841ca3c90f8b9fefb0fedb78992017ad/hashes.js#L189-L200 |
13,112 | h2non/jshashes | hashes.js | function(str) {
var crc = 0,
x = 0,
y = 0,
table, i, iTop;
str = utf8Encode(str);
table = [
'00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 ',
'79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3... | javascript | function(str) {
var crc = 0,
x = 0,
y = 0,
table, i, iTop;
str = utf8Encode(str);
table = [
'00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 ',
'79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3... | [
"function",
"(",
"str",
")",
"{",
"var",
"crc",
"=",
"0",
",",
"x",
"=",
"0",
",",
"y",
"=",
"0",
",",
"table",
",",
"i",
",",
"iTop",
";",
"str",
"=",
"utf8Encode",
"(",
"str",
")",
";",
"table",
"=",
"[",
"'00000000 77073096 EE0E612C 990951BA 076... | CRC-32 calculation
@member Hashes
@method CRC32
@static
@param {String} str Input String
@return {String} | [
"CRC",
"-",
"32",
"calculation"
] | 88625b6c841ca3c90f8b9fefb0fedb78992017ad | https://github.com/h2non/jshashes/blob/88625b6c841ca3c90f8b9fefb0fedb78992017ad/hashes.js#L384-L428 | |
13,113 | h2non/jshashes | hashes.js | rstr | function rstr(s) {
s = (utf8) ? utf8Encode(s) : s;
return binl2rstr(binl(rstr2binl(s), s.length * 8));
} | javascript | function rstr(s) {
s = (utf8) ? utf8Encode(s) : s;
return binl2rstr(binl(rstr2binl(s), s.length * 8));
} | [
"function",
"rstr",
"(",
"s",
")",
"{",
"s",
"=",
"(",
"utf8",
")",
"?",
"utf8Encode",
"(",
"s",
")",
":",
"s",
";",
"return",
"binl2rstr",
"(",
"binl",
"(",
"rstr2binl",
"(",
"s",
")",
",",
"s",
".",
"length",
"*",
"8",
")",
")",
";",
"}"
] | private methods
Calculate the MD5 of a raw string | [
"private",
"methods",
"Calculate",
"the",
"MD5",
"of",
"a",
"raw",
"string"
] | 88625b6c841ca3c90f8b9fefb0fedb78992017ad | https://github.com/h2non/jshashes/blob/88625b6c841ca3c90f8b9fefb0fedb78992017ad/hashes.js#L518-L521 |
13,114 | h2non/jshashes | hashes.js | rstr | function rstr(s, utf8) {
s = (utf8) ? utf8Encode(s) : s;
return binb2rstr(binb(rstr2binb(s), s.length * 8));
} | javascript | function rstr(s, utf8) {
s = (utf8) ? utf8Encode(s) : s;
return binb2rstr(binb(rstr2binb(s), s.length * 8));
} | [
"function",
"rstr",
"(",
"s",
",",
"utf8",
")",
"{",
"s",
"=",
"(",
"utf8",
")",
"?",
"utf8Encode",
"(",
"s",
")",
":",
"s",
";",
"return",
"binb2rstr",
"(",
"binb",
"(",
"rstr2binb",
"(",
"s",
")",
",",
"s",
".",
"length",
"*",
"8",
")",
")"... | private methods
Calculate the SHA-512 of a raw string | [
"private",
"methods",
"Calculate",
"the",
"SHA",
"-",
"512",
"of",
"a",
"raw",
"string"
] | 88625b6c841ca3c90f8b9fefb0fedb78992017ad | https://github.com/h2non/jshashes/blob/88625b6c841ca3c90f8b9fefb0fedb78992017ad/hashes.js#L956-L959 |
13,115 | h2non/jshashes | hashes.js | int64copy | function int64copy(dst, src) {
dst.h = src.h;
dst.l = src.l;
} | javascript | function int64copy(dst, src) {
dst.h = src.h;
dst.l = src.l;
} | [
"function",
"int64copy",
"(",
"dst",
",",
"src",
")",
"{",
"dst",
".",
"h",
"=",
"src",
".",
"h",
";",
"dst",
".",
"l",
"=",
"src",
".",
"l",
";",
"}"
] | Copies src into dst, assuming both are 64-bit numbers | [
"Copies",
"src",
"into",
"dst",
"assuming",
"both",
"are",
"64",
"-",
"bit",
"numbers"
] | 88625b6c841ca3c90f8b9fefb0fedb78992017ad | https://github.com/h2non/jshashes/blob/88625b6c841ca3c90f8b9fefb0fedb78992017ad/hashes.js#L1417-L1420 |
13,116 | h2non/jshashes | hashes.js | int64revrrot | function int64revrrot(dst, x, shift) {
dst.l = (x.h >>> shift) | (x.l << (32 - shift));
dst.h = (x.l >>> shift) | (x.h << (32 - shift));
} | javascript | function int64revrrot(dst, x, shift) {
dst.l = (x.h >>> shift) | (x.l << (32 - shift));
dst.h = (x.l >>> shift) | (x.h << (32 - shift));
} | [
"function",
"int64revrrot",
"(",
"dst",
",",
"x",
",",
"shift",
")",
"{",
"dst",
".",
"l",
"=",
"(",
"x",
".",
"h",
">>>",
"shift",
")",
"|",
"(",
"x",
".",
"l",
"<<",
"(",
"32",
"-",
"shift",
")",
")",
";",
"dst",
".",
"h",
"=",
"(",
"x"... | Reverses the dwords of the source and then rotates right by shift. This is equivalent to rotation by 32+shift | [
"Reverses",
"the",
"dwords",
"of",
"the",
"source",
"and",
"then",
"rotates",
"right",
"by",
"shift",
".",
"This",
"is",
"equivalent",
"to",
"rotation",
"by",
"32",
"+",
"shift"
] | 88625b6c841ca3c90f8b9fefb0fedb78992017ad | https://github.com/h2non/jshashes/blob/88625b6c841ca3c90f8b9fefb0fedb78992017ad/hashes.js#L1434-L1437 |
13,117 | h2non/jshashes | hashes.js | int64shr | function int64shr(dst, x, shift) {
dst.l = (x.l >>> shift) | (x.h << (32 - shift));
dst.h = (x.h >>> shift);
} | javascript | function int64shr(dst, x, shift) {
dst.l = (x.l >>> shift) | (x.h << (32 - shift));
dst.h = (x.h >>> shift);
} | [
"function",
"int64shr",
"(",
"dst",
",",
"x",
",",
"shift",
")",
"{",
"dst",
".",
"l",
"=",
"(",
"x",
".",
"l",
">>>",
"shift",
")",
"|",
"(",
"x",
".",
"h",
"<<",
"(",
"32",
"-",
"shift",
")",
")",
";",
"dst",
".",
"h",
"=",
"(",
"x",
... | Bitwise-shifts right a 64-bit number by shift Won't handle shift>=32, but it's never needed in SHA512 | [
"Bitwise",
"-",
"shifts",
"right",
"a",
"64",
"-",
"bit",
"number",
"by",
"shift",
"Won",
"t",
"handle",
"shift",
">",
"=",
"32",
"but",
"it",
"s",
"never",
"needed",
"in",
"SHA512"
] | 88625b6c841ca3c90f8b9fefb0fedb78992017ad | https://github.com/h2non/jshashes/blob/88625b6c841ca3c90f8b9fefb0fedb78992017ad/hashes.js#L1442-L1445 |
13,118 | h2non/jshashes | hashes.js | int64add | function int64add(dst, x, y) {
var w0 = (x.l & 0xffff) + (y.l & 0xffff);
var w1 = (x.l >>> 16) + (y.l >>> 16) + (w0 >>> 16);
var w2 = (x.h & 0xffff) + (y.h & 0xffff) + (w1 >>> 16);
var w3 = (x.h >>> 16) + (y.h >>> 16) + (w2 >>> 16);
dst.l = (w0 & 0xffff) | (w1 << 16);
dst... | javascript | function int64add(dst, x, y) {
var w0 = (x.l & 0xffff) + (y.l & 0xffff);
var w1 = (x.l >>> 16) + (y.l >>> 16) + (w0 >>> 16);
var w2 = (x.h & 0xffff) + (y.h & 0xffff) + (w1 >>> 16);
var w3 = (x.h >>> 16) + (y.h >>> 16) + (w2 >>> 16);
dst.l = (w0 & 0xffff) | (w1 << 16);
dst... | [
"function",
"int64add",
"(",
"dst",
",",
"x",
",",
"y",
")",
"{",
"var",
"w0",
"=",
"(",
"x",
".",
"l",
"&",
"0xffff",
")",
"+",
"(",
"y",
".",
"l",
"&",
"0xffff",
")",
";",
"var",
"w1",
"=",
"(",
"x",
".",
"l",
">>>",
"16",
")",
"+",
"... | Adds two 64-bit numbers Like the original implementation, does not rely on 32-bit operations | [
"Adds",
"two",
"64",
"-",
"bit",
"numbers",
"Like",
"the",
"original",
"implementation",
"does",
"not",
"rely",
"on",
"32",
"-",
"bit",
"operations"
] | 88625b6c841ca3c90f8b9fefb0fedb78992017ad | https://github.com/h2non/jshashes/blob/88625b6c841ca3c90f8b9fefb0fedb78992017ad/hashes.js#L1450-L1457 |
13,119 | h2non/jshashes | hashes.js | binl2rstr | function binl2rstr(input) {
var i, output = '',
l = input.length * 32;
for (i = 0; i < l; i += 8) {
output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xFF);
}
return output;
} | javascript | function binl2rstr(input) {
var i, output = '',
l = input.length * 32;
for (i = 0; i < l; i += 8) {
output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xFF);
}
return output;
} | [
"function",
"binl2rstr",
"(",
"input",
")",
"{",
"var",
"i",
",",
"output",
"=",
"''",
",",
"l",
"=",
"input",
".",
"length",
"*",
"32",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"l",
";",
"i",
"+=",
"8",
")",
"{",
"output",
"+=",
"Str... | Convert an array of little-endian words to a string | [
"Convert",
"an",
"array",
"of",
"little",
"-",
"endian",
"words",
"to",
"a",
"string"
] | 88625b6c841ca3c90f8b9fefb0fedb78992017ad | https://github.com/h2non/jshashes/blob/88625b6c841ca3c90f8b9fefb0fedb78992017ad/hashes.js#L1640-L1647 |
13,120 | h2non/jshashes | hashes.js | binl | function binl(x, len) {
var T, j, i, l,
h0 = 0x67452301,
h1 = 0xefcdab89,
h2 = 0x98badcfe,
h3 = 0x10325476,
h4 = 0xc3d2e1f0,
A1, B1, C1, D1, E1,
A2, B2, C2, D2, E2;
/* append padding */
x[len >> 5] |= 0x80 << (len % 32);
... | javascript | function binl(x, len) {
var T, j, i, l,
h0 = 0x67452301,
h1 = 0xefcdab89,
h2 = 0x98badcfe,
h3 = 0x10325476,
h4 = 0xc3d2e1f0,
A1, B1, C1, D1, E1,
A2, B2, C2, D2, E2;
/* append padding */
x[len >> 5] |= 0x80 << (len % 32);
... | [
"function",
"binl",
"(",
"x",
",",
"len",
")",
"{",
"var",
"T",
",",
"j",
",",
"i",
",",
"l",
",",
"h0",
"=",
"0x67452301",
",",
"h1",
"=",
"0xefcdab89",
",",
"h2",
"=",
"0x98badcfe",
",",
"h3",
"=",
"0x10325476",
",",
"h4",
"=",
"0xc3d2e1f0",
... | Calculate the RIPE-MD160 of an array of little-endian words, and a bit length. | [
"Calculate",
"the",
"RIPE",
"-",
"MD160",
"of",
"an",
"array",
"of",
"little",
"-",
"endian",
"words",
"and",
"a",
"bit",
"length",
"."
] | 88625b6c841ca3c90f8b9fefb0fedb78992017ad | https://github.com/h2non/jshashes/blob/88625b6c841ca3c90f8b9fefb0fedb78992017ad/hashes.js#L1653-L1703 |
13,121 | h2non/jshashes | hashes.js | rmd160_f | function rmd160_f(j, x, y, z) {
return (0 <= j && j <= 15) ? (x ^ y ^ z) :
(16 <= j && j <= 31) ? (x & y) | (~x & z) :
(32 <= j && j <= 47) ? (x | ~y) ^ z :
(48 <= j && j <= 63) ? (x & z) | (y & ~z) :
(64 <= j && j <= 79) ? x ^ (y | ~z) :
'rmd160_f: j out of ran... | javascript | function rmd160_f(j, x, y, z) {
return (0 <= j && j <= 15) ? (x ^ y ^ z) :
(16 <= j && j <= 31) ? (x & y) | (~x & z) :
(32 <= j && j <= 47) ? (x | ~y) ^ z :
(48 <= j && j <= 63) ? (x & z) | (y & ~z) :
(64 <= j && j <= 79) ? x ^ (y | ~z) :
'rmd160_f: j out of ran... | [
"function",
"rmd160_f",
"(",
"j",
",",
"x",
",",
"y",
",",
"z",
")",
"{",
"return",
"(",
"0",
"<=",
"j",
"&&",
"j",
"<=",
"15",
")",
"?",
"(",
"x",
"^",
"y",
"^",
"z",
")",
":",
"(",
"16",
"<=",
"j",
"&&",
"j",
"<=",
"31",
")",
"?",
"... | specific algorithm methods | [
"specific",
"algorithm",
"methods"
] | 88625b6c841ca3c90f8b9fefb0fedb78992017ad | https://github.com/h2non/jshashes/blob/88625b6c841ca3c90f8b9fefb0fedb78992017ad/hashes.js#L1707-L1714 |
13,122 | arobson/rabbot | src/amqp/queue.js | purgeADQueue | function purgeADQueue (channel, connectionName, options, messages) {
const name = options.uniqueName || options.name;
return new Promise(function (resolve, reject) {
const messageCount = messages.messages.length;
if (messageCount > 0) {
log.info(`Purge operation for queue '${options.name}' on '${conne... | javascript | function purgeADQueue (channel, connectionName, options, messages) {
const name = options.uniqueName || options.name;
return new Promise(function (resolve, reject) {
const messageCount = messages.messages.length;
if (messageCount > 0) {
log.info(`Purge operation for queue '${options.name}' on '${conne... | [
"function",
"purgeADQueue",
"(",
"channel",
",",
"connectionName",
",",
"options",
",",
"messages",
")",
"{",
"const",
"name",
"=",
"options",
".",
"uniqueName",
"||",
"options",
".",
"name",
";",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
... | purging an auto-delete queue means unsubscribing is not an option as it will cause the queue, binding and possibly upstream auto-delete exchanges to be deleted as well | [
"purging",
"an",
"auto",
"-",
"delete",
"queue",
"means",
"unsubscribing",
"is",
"not",
"an",
"option",
"as",
"it",
"will",
"cause",
"the",
"queue",
"binding",
"and",
"possibly",
"upstream",
"auto",
"-",
"delete",
"exchanges",
"to",
"be",
"deleted",
"as",
... | 80b63c08bdb32d04fd36502f24180e0c8e8f69ee | https://github.com/arobson/rabbot/blob/80b63c08bdb32d04fd36502f24180e0c8e8f69ee/src/amqp/queue.js#L205-L226 |
13,123 | filamentgroup/criticalCSS | critical.js | replaceDecls | function replaceDecls(originalRules, criticalRule){
// find all the rules in the original CSS that have the same selectors and
// then create an array of all the associated declarations. Note that this
// works with mutiple duplicate selectors on the original CSS
var originalDecls = _.flatten(
originalRules
... | javascript | function replaceDecls(originalRules, criticalRule){
// find all the rules in the original CSS that have the same selectors and
// then create an array of all the associated declarations. Note that this
// works with mutiple duplicate selectors on the original CSS
var originalDecls = _.flatten(
originalRules
... | [
"function",
"replaceDecls",
"(",
"originalRules",
",",
"criticalRule",
")",
"{",
"// find all the rules in the original CSS that have the same selectors and",
"// then create an array of all the associated declarations. Note that this",
"// works with mutiple duplicate selectors on the original ... | create a function that can be passed to `map` for a collection of critical css rules. The function will match original rules against the selector of the critical css declarations, concatenate them together, and then keep only the unique ones | [
"create",
"a",
"function",
"that",
"can",
"be",
"passed",
"to",
"map",
"for",
"a",
"collection",
"of",
"critical",
"css",
"rules",
".",
"The",
"function",
"will",
"match",
"original",
"rules",
"against",
"the",
"selector",
"of",
"the",
"critical",
"css",
"... | 42e299907a0bd3a8113f83aef4b2fd69ca5d21e3 | https://github.com/filamentgroup/criticalCSS/blob/42e299907a0bd3a8113f83aef4b2fd69ca5d21e3/critical.js#L127-L149 |
13,124 | d3/d3-dsv | src/dsv.js | inferColumns | function inferColumns(rows) {
var columnSet = Object.create(null),
columns = [];
rows.forEach(function(row) {
for (var column in row) {
if (!(column in columnSet)) {
columns.push(columnSet[column] = column);
}
}
});
return columns;
} | javascript | function inferColumns(rows) {
var columnSet = Object.create(null),
columns = [];
rows.forEach(function(row) {
for (var column in row) {
if (!(column in columnSet)) {
columns.push(columnSet[column] = column);
}
}
});
return columns;
} | [
"function",
"inferColumns",
"(",
"rows",
")",
"{",
"var",
"columnSet",
"=",
"Object",
".",
"create",
"(",
"null",
")",
",",
"columns",
"=",
"[",
"]",
";",
"rows",
".",
"forEach",
"(",
"function",
"(",
"row",
")",
"{",
"for",
"(",
"var",
"column",
"... | Compute unique columns in order of discovery. | [
"Compute",
"unique",
"columns",
"in",
"order",
"of",
"discovery",
"."
] | ff2d09f943c2d19d0f0fa96f9b6a39c7431ca7e8 | https://github.com/d3/d3-dsv/blob/ff2d09f943c2d19d0f0fa96f9b6a39c7431ca7e8/src/dsv.js#L21-L34 |
13,125 | Surnet/swagger-jsdoc | lib/helpers/filterJsDocComments.js | filterJsDocComments | function filterJsDocComments(jsDocComments) {
const swaggerJsDocComments = [];
for (let i = 0; i < jsDocComments.length; i += 1) {
const jsDocComment = jsDocComments[i];
for (let j = 0; j < jsDocComment.tags.length; j += 1) {
const tag = jsDocComment.tags[j];
if (tag.title === 'swagger') {
... | javascript | function filterJsDocComments(jsDocComments) {
const swaggerJsDocComments = [];
for (let i = 0; i < jsDocComments.length; i += 1) {
const jsDocComment = jsDocComments[i];
for (let j = 0; j < jsDocComment.tags.length; j += 1) {
const tag = jsDocComment.tags[j];
if (tag.title === 'swagger') {
... | [
"function",
"filterJsDocComments",
"(",
"jsDocComments",
")",
"{",
"const",
"swaggerJsDocComments",
"=",
"[",
"]",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"jsDocComments",
".",
"length",
";",
"i",
"+=",
"1",
")",
"{",
"const",
"jsDocComment... | Filters JSDoc comments for those tagged with '@swagger'
@function
@param {array} jsDocComments - JSDoc comments
@returns {array} JSDoc comments tagged with '@swagger'
@requires js-yaml | [
"Filters",
"JSDoc",
"comments",
"for",
"those",
"tagged",
"with"
] | ece24be07458d9a4ff1b8a1020a4581624bb0f7c | https://github.com/Surnet/swagger-jsdoc/blob/ece24be07458d9a4ff1b8a1020a4581624bb0f7c/lib/helpers/filterJsDocComments.js#L10-L24 |
13,126 | Surnet/swagger-jsdoc | lib/helpers/convertGlobPaths.js | convertGlobPaths | function convertGlobPaths(globs) {
return globs
.map(globString => glob.sync(globString))
.reduce((previous, current) => previous.concat(current), []);
} | javascript | function convertGlobPaths(globs) {
return globs
.map(globString => glob.sync(globString))
.reduce((previous, current) => previous.concat(current), []);
} | [
"function",
"convertGlobPaths",
"(",
"globs",
")",
"{",
"return",
"globs",
".",
"map",
"(",
"globString",
"=>",
"glob",
".",
"sync",
"(",
"globString",
")",
")",
".",
"reduce",
"(",
"(",
"previous",
",",
"current",
")",
"=>",
"previous",
".",
"concat",
... | Converts an array of globs to full paths
@function
@param {array} globs - Array of globs and/or normal paths
@return {array} Array of fully-qualified paths
@requires glob | [
"Converts",
"an",
"array",
"of",
"globs",
"to",
"full",
"paths"
] | ece24be07458d9a4ff1b8a1020a4581624bb0f7c | https://github.com/Surnet/swagger-jsdoc/blob/ece24be07458d9a4ff1b8a1020a4581624bb0f7c/lib/helpers/convertGlobPaths.js#L10-L14 |
13,127 | Surnet/swagger-jsdoc | bin/swagger-jsdoc.js | createSpecification | function createSpecification(swaggerDefinition, apis, fileName) {
// Options for the swagger docs
const options = {
// Import swaggerDefinitions
swaggerDefinition,
// Path to the API docs
apis,
};
// Initialize swagger-jsdoc -> returns validated JSON or YAML swagger spec
let swaggerSpec;
co... | javascript | function createSpecification(swaggerDefinition, apis, fileName) {
// Options for the swagger docs
const options = {
// Import swaggerDefinitions
swaggerDefinition,
// Path to the API docs
apis,
};
// Initialize swagger-jsdoc -> returns validated JSON or YAML swagger spec
let swaggerSpec;
co... | [
"function",
"createSpecification",
"(",
"swaggerDefinition",
",",
"apis",
",",
"fileName",
")",
"{",
"// Options for the swagger docs",
"const",
"options",
"=",
"{",
"// Import swaggerDefinitions",
"swaggerDefinition",
",",
"// Path to the API docs",
"apis",
",",
"}",
";"... | Creates a swagger specification from a definition and a set of files.
@function
@param {object} swaggerDefinition - The swagger definition object.
@param {array} apis - List of files to extract documentation from.
@param {string} fileName - Name the output file. | [
"Creates",
"a",
"swagger",
"specification",
"from",
"a",
"definition",
"and",
"a",
"set",
"of",
"files",
"."
] | ece24be07458d9a4ff1b8a1020a4581624bb0f7c | https://github.com/Surnet/swagger-jsdoc/blob/ece24be07458d9a4ff1b8a1020a4581624bb0f7c/bin/swagger-jsdoc.js#L25-L53 |
13,128 | Surnet/swagger-jsdoc | bin/swagger-jsdoc.js | loadSpecification | function loadSpecification(defPath, data) {
const resolvedPath = path.resolve(defPath);
const extName = path.extname(resolvedPath);
const loader = LOADERS[extName];
// Check whether the definition file is actually a usable file
if (loader === undefined) {
throw new Error('Definition file should be .js, ... | javascript | function loadSpecification(defPath, data) {
const resolvedPath = path.resolve(defPath);
const extName = path.extname(resolvedPath);
const loader = LOADERS[extName];
// Check whether the definition file is actually a usable file
if (loader === undefined) {
throw new Error('Definition file should be .js, ... | [
"function",
"loadSpecification",
"(",
"defPath",
",",
"data",
")",
"{",
"const",
"resolvedPath",
"=",
"path",
".",
"resolve",
"(",
"defPath",
")",
";",
"const",
"extName",
"=",
"path",
".",
"extname",
"(",
"resolvedPath",
")",
";",
"const",
"loader",
"=",
... | Get an object of the definition file configuration. | [
"Get",
"an",
"object",
"of",
"the",
"definition",
"file",
"configuration",
"."
] | ece24be07458d9a4ff1b8a1020a4581624bb0f7c | https://github.com/Surnet/swagger-jsdoc/blob/ece24be07458d9a4ff1b8a1020a4581624bb0f7c/bin/swagger-jsdoc.js#L77-L90 |
13,129 | Surnet/swagger-jsdoc | lib/helpers/hasEmptyProperty.js | hasEmptyProperty | function hasEmptyProperty(obj) {
return Object.keys(obj)
.map(key => obj[key])
.every(
keyObject =>
typeof keyObject === 'object' &&
Object.keys(keyObject).every(key => !(key in keyObject))
);
} | javascript | function hasEmptyProperty(obj) {
return Object.keys(obj)
.map(key => obj[key])
.every(
keyObject =>
typeof keyObject === 'object' &&
Object.keys(keyObject).every(key => !(key in keyObject))
);
} | [
"function",
"hasEmptyProperty",
"(",
"obj",
")",
"{",
"return",
"Object",
".",
"keys",
"(",
"obj",
")",
".",
"map",
"(",
"key",
"=>",
"obj",
"[",
"key",
"]",
")",
".",
"every",
"(",
"keyObject",
"=>",
"typeof",
"keyObject",
"===",
"'object'",
"&&",
"... | Checks if there is any properties of @obj that is a empty object
@function
@param {object} obj - the object to check | [
"Checks",
"if",
"there",
"is",
"any",
"properties",
"of"
] | ece24be07458d9a4ff1b8a1020a4581624bb0f7c | https://github.com/Surnet/swagger-jsdoc/blob/ece24be07458d9a4ff1b8a1020a4581624bb0f7c/lib/helpers/hasEmptyProperty.js#L6-L14 |
13,130 | Surnet/swagger-jsdoc | lib/helpers/parseApiFile.js | parseApiFile | function parseApiFile(file) {
const jsDocRegex = /\/\*\*([\s\S]*?)\*\//gm;
const fileContent = fs.readFileSync(file, { encoding: 'utf8' });
const ext = path.extname(file);
const yaml = [];
const jsDocComments = [];
if (ext === '.yaml' || ext === '.yml') {
yaml.push(jsYaml.safeLoad(fileContent));
} el... | javascript | function parseApiFile(file) {
const jsDocRegex = /\/\*\*([\s\S]*?)\*\//gm;
const fileContent = fs.readFileSync(file, { encoding: 'utf8' });
const ext = path.extname(file);
const yaml = [];
const jsDocComments = [];
if (ext === '.yaml' || ext === '.yml') {
yaml.push(jsYaml.safeLoad(fileContent));
} el... | [
"function",
"parseApiFile",
"(",
"file",
")",
"{",
"const",
"jsDocRegex",
"=",
"/",
"\\/\\*\\*([\\s\\S]*?)\\*\\/",
"/",
"gm",
";",
"const",
"fileContent",
"=",
"fs",
".",
"readFileSync",
"(",
"file",
",",
"{",
"encoding",
":",
"'utf8'",
"}",
")",
";",
"con... | Parses the provided API file for JSDoc comments.
@function
@param {string} file - File to be parsed
@returns {{jsdoc: array, yaml: array}} JSDoc comments and Yaml files
@requires doctrine | [
"Parses",
"the",
"provided",
"API",
"file",
"for",
"JSDoc",
"comments",
"."
] | ece24be07458d9a4ff1b8a1020a4581624bb0f7c | https://github.com/Surnet/swagger-jsdoc/blob/ece24be07458d9a4ff1b8a1020a4581624bb0f7c/lib/helpers/parseApiFile.js#L13-L36 |
13,131 | anmonteiro/lumo | vendor/nexe/monkeypatch.js | _monkeypatch | function _monkeypatch(filePath, monkeyPatched, processor, complete) {
async.waterfall(
[
function read(next) {
fs.readFile(filePath, 'utf8', next);
},
// TODO - need to parse gyp file - this is a bit hacker
function monkeypatch(content, next) {
if (monkeyPatched(content)) ... | javascript | function _monkeypatch(filePath, monkeyPatched, processor, complete) {
async.waterfall(
[
function read(next) {
fs.readFile(filePath, 'utf8', next);
},
// TODO - need to parse gyp file - this is a bit hacker
function monkeypatch(content, next) {
if (monkeyPatched(content)) ... | [
"function",
"_monkeypatch",
"(",
"filePath",
",",
"monkeyPatched",
",",
"processor",
",",
"complete",
")",
"{",
"async",
".",
"waterfall",
"(",
"[",
"function",
"read",
"(",
"next",
")",
"{",
"fs",
".",
"readFile",
"(",
"filePath",
",",
"'utf8'",
",",
"n... | Monkey patch a file.
@param {string} filePath - path to file.
@param {function} monkeyPatched - function to process contents
@param {function} processor - TODO: detail what this is
@param {function} complete - callback
@return undefined | [
"Monkey",
"patch",
"a",
"file",
"."
] | 345bacd2c36f9648b416f74d2e41cdf55c2cc1f9 | https://github.com/anmonteiro/lumo/blob/345bacd2c36f9648b416f74d2e41cdf55c2cc1f9/vendor/nexe/monkeypatch.js#L39-L62 |
13,132 | anmonteiro/lumo | vendor/nexe/log.js | _log | function _log() {
var args = Array.prototype.slice.call(arguments, 0),
level = args.shift();
if (!~['log', 'error', 'warn'].indexOf(level)) {
args.unshift(level);
level = 'log';
}
if (level == 'log') {
args[0] = '----> ' + args[0];
} else if (level == 'error') {
args[0] = '....> ' + colo... | javascript | function _log() {
var args = Array.prototype.slice.call(arguments, 0),
level = args.shift();
if (!~['log', 'error', 'warn'].indexOf(level)) {
args.unshift(level);
level = 'log';
}
if (level == 'log') {
args[0] = '----> ' + args[0];
} else if (level == 'error') {
args[0] = '....> ' + colo... | [
"function",
"_log",
"(",
")",
"{",
"var",
"args",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
",",
"0",
")",
",",
"level",
"=",
"args",
".",
"shift",
"(",
")",
";",
"if",
"(",
"!",
"~",
"[",
"'log'",
",",
"'erro... | standard output, takes 3 different types.
log, error, and warn
@param {any} arguments - Text to output.
@return undefined | [
"standard",
"output",
"takes",
"3",
"different",
"types",
".",
"log",
"error",
"and",
"warn"
] | 345bacd2c36f9648b416f74d2e41cdf55c2cc1f9 | https://github.com/anmonteiro/lumo/blob/345bacd2c36f9648b416f74d2e41cdf55c2cc1f9/vendor/nexe/log.js#L35-L53 |
13,133 | anmonteiro/lumo | vendor/nexe/embed.js | embed | function embed(resourceFiles, resourceRoot) {
if (resourceFiles.length > 0) {
let buffer = 'var embeddedFiles = {\n';
for (let i = 0; i < resourceFiles.length; ++i) {
buffer +=
JSON.stringify(path.relative(resourceRoot, resourceFiles[i])) + ': "';
buffer += encode(resourceFiles[i]) + '",\n... | javascript | function embed(resourceFiles, resourceRoot) {
if (resourceFiles.length > 0) {
let buffer = 'var embeddedFiles = {\n';
for (let i = 0; i < resourceFiles.length; ++i) {
buffer +=
JSON.stringify(path.relative(resourceRoot, resourceFiles[i])) + ': "';
buffer += encode(resourceFiles[i]) + '",\n... | [
"function",
"embed",
"(",
"resourceFiles",
",",
"resourceRoot",
")",
"{",
"if",
"(",
"resourceFiles",
".",
"length",
">",
"0",
")",
"{",
"let",
"buffer",
"=",
"'var embeddedFiles = {\\n'",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"resourceFi... | Embed files.
@param {array} resourceFiles - array of files to embed.
@param {string} resourceRoot - root of resources.
@param {function} compelte - callback | [
"Embed",
"files",
"."
] | 345bacd2c36f9648b416f74d2e41cdf55c2cc1f9 | https://github.com/anmonteiro/lumo/blob/345bacd2c36f9648b416f74d2e41cdf55c2cc1f9/vendor/nexe/embed.js#L54-L69 |
13,134 | anmonteiro/lumo | vendor/nexe/exe.js | checkOpts | function checkOpts(next) {
/* failsafe */
if (options === undefined) {
_log('error', 'no options given to .compile()');
process.exit();
}
/**
* Have we been given a custom flag for python executable?
**/
if (
options.python !== 'py... | javascript | function checkOpts(next) {
/* failsafe */
if (options === undefined) {
_log('error', 'no options given to .compile()');
process.exit();
}
/**
* Have we been given a custom flag for python executable?
**/
if (
options.python !== 'py... | [
"function",
"checkOpts",
"(",
"next",
")",
"{",
"/* failsafe */",
"if",
"(",
"options",
"===",
"undefined",
")",
"{",
"_log",
"(",
"'error'",
",",
"'no options given to .compile()'",
")",
";",
"process",
".",
"exit",
"(",
")",
";",
"}",
"/**\n * Have w... | check relevant options | [
"check",
"relevant",
"options"
] | 345bacd2c36f9648b416f74d2e41cdf55c2cc1f9 | https://github.com/anmonteiro/lumo/blob/345bacd2c36f9648b416f74d2e41cdf55c2cc1f9/vendor/nexe/exe.js#L63-L126 |
13,135 | anmonteiro/lumo | vendor/nexe/exe.js | downloadNode | function downloadNode(next) {
_downloadNode(
version,
options.nodeTempDir,
options.nodeConfigureArgs,
options.nodeMakeArgs,
options.nodeVCBuildArgs,
next,
);
} | javascript | function downloadNode(next) {
_downloadNode(
version,
options.nodeTempDir,
options.nodeConfigureArgs,
options.nodeMakeArgs,
options.nodeVCBuildArgs,
next,
);
} | [
"function",
"downloadNode",
"(",
"next",
")",
"{",
"_downloadNode",
"(",
"version",
",",
"options",
".",
"nodeTempDir",
",",
"options",
".",
"nodeConfigureArgs",
",",
"options",
".",
"nodeMakeArgs",
",",
"options",
".",
"nodeVCBuildArgs",
",",
"next",
",",
")"... | first download node | [
"first",
"download",
"node"
] | 345bacd2c36f9648b416f74d2e41cdf55c2cc1f9 | https://github.com/anmonteiro/lumo/blob/345bacd2c36f9648b416f74d2e41cdf55c2cc1f9/vendor/nexe/exe.js#L131-L140 |
13,136 | anmonteiro/lumo | vendor/nexe/exe.js | embedResources | function embedResources(nc, next) {
nodeCompiler = nc;
options.resourceFiles = options.resourceFiles || [];
options.resourceRoot = options.resourceRoot || '';
if (!Array.isArray(options.resourceFiles)) {
throw new Error('Bad Argument: resourceFiles is not an array');
... | javascript | function embedResources(nc, next) {
nodeCompiler = nc;
options.resourceFiles = options.resourceFiles || [];
options.resourceRoot = options.resourceRoot || '';
if (!Array.isArray(options.resourceFiles)) {
throw new Error('Bad Argument: resourceFiles is not an array');
... | [
"function",
"embedResources",
"(",
"nc",
",",
"next",
")",
"{",
"nodeCompiler",
"=",
"nc",
";",
"options",
".",
"resourceFiles",
"=",
"options",
".",
"resourceFiles",
"||",
"[",
"]",
";",
"options",
".",
"resourceRoot",
"=",
"options",
".",
"resourceRoot",
... | Embed Resources into a base64 encoded array. | [
"Embed",
"Resources",
"into",
"a",
"base64",
"encoded",
"array",
"."
] | 345bacd2c36f9648b416f74d2e41cdf55c2cc1f9 | https://github.com/anmonteiro/lumo/blob/345bacd2c36f9648b416f74d2e41cdf55c2cc1f9/vendor/nexe/exe.js#L145-L170 |
13,137 | anmonteiro/lumo | vendor/nexe/exe.js | combineProject | function combineProject(next) {
if (options.noBundle) {
_log(
'using provided bundle %s since noBundle is true',
options.input,
);
const source = fs.readFileSync(options.input, 'utf8');
const thirdPartyMain = `
if (!process.send) {
console.log('t... | javascript | function combineProject(next) {
if (options.noBundle) {
_log(
'using provided bundle %s since noBundle is true',
options.input,
);
const source = fs.readFileSync(options.input, 'utf8');
const thirdPartyMain = `
if (!process.send) {
console.log('t... | [
"function",
"combineProject",
"(",
"next",
")",
"{",
"if",
"(",
"options",
".",
"noBundle",
")",
"{",
"_log",
"(",
"'using provided bundle %s since noBundle is true'",
",",
"options",
".",
"input",
",",
")",
";",
"const",
"source",
"=",
"fs",
".",
"readFileSyn... | Bundle the application into one script | [
"Bundle",
"the",
"application",
"into",
"one",
"script"
] | 345bacd2c36f9648b416f74d2e41cdf55c2cc1f9 | https://github.com/anmonteiro/lumo/blob/345bacd2c36f9648b416f74d2e41cdf55c2cc1f9/vendor/nexe/exe.js#L175-L202 |
13,138 | anmonteiro/lumo | vendor/nexe/exe.js | cleanUpOldExecutable | function cleanUpOldExecutable(next) {
fs.unlink(nodeCompiler.releasePath, function(err) {
if (err) {
if (err.code === 'ENOENT') {
next();
} else {
throw err;
}
} else {
next();
}
});
} | javascript | function cleanUpOldExecutable(next) {
fs.unlink(nodeCompiler.releasePath, function(err) {
if (err) {
if (err.code === 'ENOENT') {
next();
} else {
throw err;
}
} else {
next();
}
});
} | [
"function",
"cleanUpOldExecutable",
"(",
"next",
")",
"{",
"fs",
".",
"unlink",
"(",
"nodeCompiler",
".",
"releasePath",
",",
"function",
"(",
"err",
")",
"{",
"if",
"(",
"err",
")",
"{",
"if",
"(",
"err",
".",
"code",
"===",
"'ENOENT'",
")",
"{",
"n... | If an old compiled executable exists in the Release directory, delete it.
This lets us see if the build failed by checking the existence of this file later. | [
"If",
"an",
"old",
"compiled",
"executable",
"exists",
"in",
"the",
"Release",
"directory",
"delete",
"it",
".",
"This",
"lets",
"us",
"see",
"if",
"the",
"build",
"failed",
"by",
"checking",
"the",
"existence",
"of",
"this",
"file",
"later",
"."
] | 345bacd2c36f9648b416f74d2e41cdf55c2cc1f9 | https://github.com/anmonteiro/lumo/blob/345bacd2c36f9648b416f74d2e41cdf55c2cc1f9/vendor/nexe/exe.js#L245-L257 |
13,139 | anmonteiro/lumo | vendor/nexe/exe.js | checkThatExecutableExists | function checkThatExecutableExists(next) {
fs.exists(nodeCompiler.releasePath, function(exists) {
if (!exists) {
_log(
'error',
'The release executable has not been generated. ' +
'This indicates a failure in the build process. ' +
... | javascript | function checkThatExecutableExists(next) {
fs.exists(nodeCompiler.releasePath, function(exists) {
if (!exists) {
_log(
'error',
'The release executable has not been generated. ' +
'This indicates a failure in the build process. ' +
... | [
"function",
"checkThatExecutableExists",
"(",
"next",
")",
"{",
"fs",
".",
"exists",
"(",
"nodeCompiler",
".",
"releasePath",
",",
"function",
"(",
"exists",
")",
"{",
"if",
"(",
"!",
"exists",
")",
"{",
"_log",
"(",
"'error'",
",",
"'The release executable ... | Verify that the executable was compiled successfully | [
"Verify",
"that",
"the",
"executable",
"was",
"compiled",
"successfully"
] | 345bacd2c36f9648b416f74d2e41cdf55c2cc1f9 | https://github.com/anmonteiro/lumo/blob/345bacd2c36f9648b416f74d2e41cdf55c2cc1f9/vendor/nexe/exe.js#L286-L300 |
13,140 | anmonteiro/lumo | vendor/nexe/exe.js | copyBinaryToOutput | function copyBinaryToOutput(next) {
_log('cp %s %s', nodeCompiler.releasePath, options.output);
ncp(nodeCompiler.releasePath, options.output, function(err) {
if (err) {
_log('error', "Couldn't copy binary.");
throw err; // dump raw error object
}
_lo... | javascript | function copyBinaryToOutput(next) {
_log('cp %s %s', nodeCompiler.releasePath, options.output);
ncp(nodeCompiler.releasePath, options.output, function(err) {
if (err) {
_log('error', "Couldn't copy binary.");
throw err; // dump raw error object
}
_lo... | [
"function",
"copyBinaryToOutput",
"(",
"next",
")",
"{",
"_log",
"(",
"'cp %s %s'",
",",
"nodeCompiler",
".",
"releasePath",
",",
"options",
".",
"output",
")",
";",
"ncp",
"(",
"nodeCompiler",
".",
"releasePath",
",",
"options",
".",
"output",
",",
"functio... | Copy the compilied binary to the output specified. | [
"Copy",
"the",
"compilied",
"binary",
"to",
"the",
"output",
"specified",
"."
] | 345bacd2c36f9648b416f74d2e41cdf55c2cc1f9 | https://github.com/anmonteiro/lumo/blob/345bacd2c36f9648b416f74d2e41cdf55c2cc1f9/vendor/nexe/exe.js#L306-L317 |
13,141 | anmonteiro/lumo | vendor/nexe/exe.js | downloadNode | function downloadNode(next) {
if (fs.existsSync(nodeFilePath)) return next();
var uri = framework;
if (framework === 'node') {
uri = 'nodejs'; // if node, use nodejs uri
} else if (framework === 'nodejs') {
framework = 'node'; // support nodejs, and node, as framewo... | javascript | function downloadNode(next) {
if (fs.existsSync(nodeFilePath)) return next();
var uri = framework;
if (framework === 'node') {
uri = 'nodejs'; // if node, use nodejs uri
} else if (framework === 'nodejs') {
framework = 'node'; // support nodejs, and node, as framewo... | [
"function",
"downloadNode",
"(",
"next",
")",
"{",
"if",
"(",
"fs",
".",
"existsSync",
"(",
"nodeFilePath",
")",
")",
"return",
"next",
"(",
")",
";",
"var",
"uri",
"=",
"framework",
";",
"if",
"(",
"framework",
"===",
"'node'",
")",
"{",
"uri",
"=",... | download node into the target directory | [
"download",
"node",
"into",
"the",
"target",
"directory"
] | 345bacd2c36f9648b416f74d2e41cdf55c2cc1f9 | https://github.com/anmonteiro/lumo/blob/345bacd2c36f9648b416f74d2e41cdf55c2cc1f9/vendor/nexe/exe.js#L372-L420 |
13,142 | anmonteiro/lumo | vendor/nexe/exe.js | unzipNodeTarball | function unzipNodeTarball(next) {
var onError = function(err) {
console.log(err.stack);
_log('error', 'failed to extract the node source');
process.exit(1);
};
if (isWin) {
_log('extracting the node source [node-tar.gz]');
// tar-stream method ... | javascript | function unzipNodeTarball(next) {
var onError = function(err) {
console.log(err.stack);
_log('error', 'failed to extract the node source');
process.exit(1);
};
if (isWin) {
_log('extracting the node source [node-tar.gz]');
// tar-stream method ... | [
"function",
"unzipNodeTarball",
"(",
"next",
")",
"{",
"var",
"onError",
"=",
"function",
"(",
"err",
")",
"{",
"console",
".",
"log",
"(",
"err",
".",
"stack",
")",
";",
"_log",
"(",
"'error'",
",",
"'failed to extract the node source'",
")",
";",
"proces... | unzip in the same directory | [
"unzip",
"in",
"the",
"same",
"directory"
] | 345bacd2c36f9648b416f74d2e41cdf55c2cc1f9 | https://github.com/anmonteiro/lumo/blob/345bacd2c36f9648b416f74d2e41cdf55c2cc1f9/vendor/nexe/exe.js#L426-L505 |
13,143 | anmonteiro/lumo | vendor/nexe/exe.js | _loop | function _loop(dir) {
/* eventually try every python file */
var pdir = fs.readdirSync(dir);
pdir.forEach(function(v, i) {
var stat = fs.statSync(dir + '/' + v);
if (stat.isFile()) {
// only process Makefiles and .mk targets.
... | javascript | function _loop(dir) {
/* eventually try every python file */
var pdir = fs.readdirSync(dir);
pdir.forEach(function(v, i) {
var stat = fs.statSync(dir + '/' + v);
if (stat.isFile()) {
// only process Makefiles and .mk targets.
... | [
"function",
"_loop",
"(",
"dir",
")",
"{",
"/* eventually try every python file */",
"var",
"pdir",
"=",
"fs",
".",
"readdirSync",
"(",
"dir",
")",
";",
"pdir",
".",
"forEach",
"(",
"function",
"(",
"v",
",",
"i",
")",
"{",
"var",
"stat",
"=",
"fs",
".... | local function, move to top eventually | [
"local",
"function",
"move",
"to",
"top",
"eventually"
] | 345bacd2c36f9648b416f74d2e41cdf55c2cc1f9 | https://github.com/anmonteiro/lumo/blob/345bacd2c36f9648b416f74d2e41cdf55c2cc1f9/vendor/nexe/exe.js#L602-L632 |
13,144 | anmonteiro/lumo | vendor/nexe/exe.js | _monkeyPatchGyp | function _monkeyPatchGyp(compiler, options, complete) {
const hasNexeres = options.resourceFiles.length > 0;
const gypPath = path.join(compiler.dir, 'node.gyp');
let replacementString = "'lib/fs.js', 'lib/_third_party_main.js', ";
if (hasNexeres) {
replacementString += "'lib/nexeres.js', ";
}
_monkeyp... | javascript | function _monkeyPatchGyp(compiler, options, complete) {
const hasNexeres = options.resourceFiles.length > 0;
const gypPath = path.join(compiler.dir, 'node.gyp');
let replacementString = "'lib/fs.js', 'lib/_third_party_main.js', ";
if (hasNexeres) {
replacementString += "'lib/nexeres.js', ";
}
_monkeyp... | [
"function",
"_monkeyPatchGyp",
"(",
"compiler",
",",
"options",
",",
"complete",
")",
"{",
"const",
"hasNexeres",
"=",
"options",
".",
"resourceFiles",
".",
"length",
">",
"0",
";",
"const",
"gypPath",
"=",
"path",
".",
"join",
"(",
"compiler",
".",
"dir",... | patch the gyp file to allow our custom includes | [
"patch",
"the",
"gyp",
"file",
"to",
"allow",
"our",
"custom",
"includes"
] | 345bacd2c36f9648b416f74d2e41cdf55c2cc1f9 | https://github.com/anmonteiro/lumo/blob/345bacd2c36f9648b416f74d2e41cdf55c2cc1f9/vendor/nexe/exe.js#L758-L784 |
13,145 | anmonteiro/lumo | vendor/nexe/exe.js | _monkeyPatchConfigure | function _monkeyPatchConfigure(compiler, complete, options) {
var configurePath = path.join(compiler.dir, 'configure.py');
var snapshotPath = options.startupSnapshot;
if (snapshotPath != null) {
_log('monkey patching configure file');
snapshotPath = path.join(process.cwd(), snapshotPath);
return _mon... | javascript | function _monkeyPatchConfigure(compiler, complete, options) {
var configurePath = path.join(compiler.dir, 'configure.py');
var snapshotPath = options.startupSnapshot;
if (snapshotPath != null) {
_log('monkey patching configure file');
snapshotPath = path.join(process.cwd(), snapshotPath);
return _mon... | [
"function",
"_monkeyPatchConfigure",
"(",
"compiler",
",",
"complete",
",",
"options",
")",
"{",
"var",
"configurePath",
"=",
"path",
".",
"join",
"(",
"compiler",
".",
"dir",
",",
"'configure.py'",
")",
";",
"var",
"snapshotPath",
"=",
"options",
".",
"star... | patch the configure file to allow for custom startup snapshots | [
"patch",
"the",
"configure",
"file",
"to",
"allow",
"for",
"custom",
"startup",
"snapshots"
] | 345bacd2c36f9648b416f74d2e41cdf55c2cc1f9 | https://github.com/anmonteiro/lumo/blob/345bacd2c36f9648b416f74d2e41cdf55c2cc1f9/vendor/nexe/exe.js#L810-L840 |
13,146 | anmonteiro/lumo | vendor/nexe/exe.js | _monkeyPatchMainCc | function _monkeyPatchMainCc(compiler, complete) {
let finalContents;
let mainPath = path.join(compiler.dir, 'src', 'node.cc');
let mainC = fs.readFileSync(mainPath, {
encoding: 'utf8',
});
// content split, and original start/end
let constant_loc = 1;
let lines = mainC.split('\n');
let startLine =... | javascript | function _monkeyPatchMainCc(compiler, complete) {
let finalContents;
let mainPath = path.join(compiler.dir, 'src', 'node.cc');
let mainC = fs.readFileSync(mainPath, {
encoding: 'utf8',
});
// content split, and original start/end
let constant_loc = 1;
let lines = mainC.split('\n');
let startLine =... | [
"function",
"_monkeyPatchMainCc",
"(",
"compiler",
",",
"complete",
")",
"{",
"let",
"finalContents",
";",
"let",
"mainPath",
"=",
"path",
".",
"join",
"(",
"compiler",
".",
"dir",
",",
"'src'",
",",
"'node.cc'",
")",
";",
"let",
"mainC",
"=",
"fs",
".",... | Patch node.cc to not check the internal arguments. | [
"Patch",
"node",
".",
"cc",
"to",
"not",
"check",
"the",
"internal",
"arguments",
"."
] | 345bacd2c36f9648b416f74d2e41cdf55c2cc1f9 | https://github.com/anmonteiro/lumo/blob/345bacd2c36f9648b416f74d2e41cdf55c2cc1f9/vendor/nexe/exe.js#L846-L938 |
13,147 | anmonteiro/lumo | vendor/nexe/exe.js | _getFirstDirectory | function _getFirstDirectory(dir) {
var files = glob.sync(dir + '/*');
for (var i = files.length; i--; ) {
var file = files[i];
if (fs.statSync(file).isDirectory()) return file;
}
return false;
} | javascript | function _getFirstDirectory(dir) {
var files = glob.sync(dir + '/*');
for (var i = files.length; i--; ) {
var file = files[i];
if (fs.statSync(file).isDirectory()) return file;
}
return false;
} | [
"function",
"_getFirstDirectory",
"(",
"dir",
")",
"{",
"var",
"files",
"=",
"glob",
".",
"sync",
"(",
"dir",
"+",
"'/*'",
")",
";",
"for",
"(",
"var",
"i",
"=",
"files",
".",
"length",
";",
"i",
"--",
";",
")",
"{",
"var",
"file",
"=",
"files",
... | Get the first directory of a string. | [
"Get",
"the",
"first",
"directory",
"of",
"a",
"string",
"."
] | 345bacd2c36f9648b416f74d2e41cdf55c2cc1f9 | https://github.com/anmonteiro/lumo/blob/345bacd2c36f9648b416f74d2e41cdf55c2cc1f9/vendor/nexe/exe.js#L1078-L1087 |
13,148 | anmonteiro/lumo | vendor/nexe/exe.js | _logProgress | function _logProgress(req) {
req.on('response', function(resp) {
var len = parseInt(resp.headers['content-length'], 10),
bar = new ProgressBar('[:bar]', {
complete: '=',
incomplete: ' ',
total: len,
width: 100, // just use 100
});
req.on('data', function(chunk) {
... | javascript | function _logProgress(req) {
req.on('response', function(resp) {
var len = parseInt(resp.headers['content-length'], 10),
bar = new ProgressBar('[:bar]', {
complete: '=',
incomplete: ' ',
total: len,
width: 100, // just use 100
});
req.on('data', function(chunk) {
... | [
"function",
"_logProgress",
"(",
"req",
")",
"{",
"req",
".",
"on",
"(",
"'response'",
",",
"function",
"(",
"resp",
")",
"{",
"var",
"len",
"=",
"parseInt",
"(",
"resp",
".",
"headers",
"[",
"'content-length'",
"]",
",",
"10",
")",
",",
"bar",
"=",
... | Log the progress of a request object. | [
"Log",
"the",
"progress",
"of",
"a",
"request",
"object",
"."
] | 345bacd2c36f9648b416f74d2e41cdf55c2cc1f9 | https://github.com/anmonteiro/lumo/blob/345bacd2c36f9648b416f74d2e41cdf55c2cc1f9/vendor/nexe/exe.js#L1093-L1115 |
13,149 | sequelize/umzug | src/helper.js | function (packageName) {
let result;
try {
result = require.resolve(packageName, { basedir: process.cwd() });
result = require(result);
} catch (e) {
try {
result = require(packageName);
} catch (e) {
result = undefined;
}
}
return result;
} | javascript | function (packageName) {
let result;
try {
result = require.resolve(packageName, { basedir: process.cwd() });
result = require(result);
} catch (e) {
try {
result = require(packageName);
} catch (e) {
result = undefined;
}
}
return result;
} | [
"function",
"(",
"packageName",
")",
"{",
"let",
"result",
";",
"try",
"{",
"result",
"=",
"require",
".",
"resolve",
"(",
"packageName",
",",
"{",
"basedir",
":",
"process",
".",
"cwd",
"(",
")",
"}",
")",
";",
"result",
"=",
"require",
"(",
"result... | Try to require module from file relative to process cwd or regular require.
@param {string} packageName - Filename relative to process' cwd or package
name to be required.
@returns {*|undefined} Required module | [
"Try",
"to",
"require",
"module",
"from",
"file",
"relative",
"to",
"process",
"cwd",
"or",
"regular",
"require",
"."
] | ebb08d65d5365a77d54b68eb87e2cc1249cb727a | https://github.com/sequelize/umzug/blob/ebb08d65d5365a77d54b68eb87e2cc1249cb727a/src/helper.js#L9-L24 | |
13,150 | openlayers/ol-mapbox-style | webpack.config.js | getExamples | function getExamples(dirName, callback) {
const example_files = fs.readdirSync(dirName);
const entries = {};
// iterate through the list of files in the directory.
for (const filename of example_files) {
// ooo, javascript file!
if (filename.endsWith('.js')) {
// trim the entry name down to the f... | javascript | function getExamples(dirName, callback) {
const example_files = fs.readdirSync(dirName);
const entries = {};
// iterate through the list of files in the directory.
for (const filename of example_files) {
// ooo, javascript file!
if (filename.endsWith('.js')) {
// trim the entry name down to the f... | [
"function",
"getExamples",
"(",
"dirName",
",",
"callback",
")",
"{",
"const",
"example_files",
"=",
"fs",
".",
"readdirSync",
"(",
"dirName",
")",
";",
"const",
"entries",
"=",
"{",
"}",
";",
"// iterate through the list of files in the directory.",
"for",
"(",
... | Get the list of examples from the example directory.
@param {String} dirName - Name of the directory to read.
@param {Function} callback - Function to execute for each example.
@returns {undefined} Nothing. | [
"Get",
"the",
"list",
"of",
"examples",
"from",
"the",
"example",
"directory",
"."
] | 69f9032f98e7b11f17f581d6d4a6fdfcb4bea2db | https://github.com/openlayers/ol-mapbox-style/blob/69f9032f98e7b11f17f581d6d4a6fdfcb4bea2db/webpack.config.js#L14-L29 |
13,151 | openlayers/ol-mapbox-style | webpack.config.js | getEntries | function getEntries(dirName) {
const entries = {};
getExamples(dirName, (entryName, filename) => {
entries[entryName] = filename;
});
return entries;
} | javascript | function getEntries(dirName) {
const entries = {};
getExamples(dirName, (entryName, filename) => {
entries[entryName] = filename;
});
return entries;
} | [
"function",
"getEntries",
"(",
"dirName",
")",
"{",
"const",
"entries",
"=",
"{",
"}",
";",
"getExamples",
"(",
"dirName",
",",
"(",
"entryName",
",",
"filename",
")",
"=>",
"{",
"entries",
"[",
"entryName",
"]",
"=",
"filename",
";",
"}",
")",
";",
... | Creates an object with the entry names and file names
to be transformed.
@param {String} dirName - Name of the directory to read.
@returns {Object} with webpack entry points. | [
"Creates",
"an",
"object",
"with",
"the",
"entry",
"names",
"and",
"file",
"names",
"to",
"be",
"transformed",
"."
] | 69f9032f98e7b11f17f581d6d4a6fdfcb4bea2db | https://github.com/openlayers/ol-mapbox-style/blob/69f9032f98e7b11f17f581d6d4a6fdfcb4bea2db/webpack.config.js#L38-L44 |
13,152 | openlayers/ol-mapbox-style | webpack.config.js | getHtmlTemplates | function getHtmlTemplates(dirName) {
const html_conf = [];
// create the array of HTML plugins.
const template = path.join(dirName, '_template.html');
getExamples(dirName, (entryName, filename) => {
html_conf.push(
new HtmlWebpackPlugin({
title: entryName,
// ensure each output has a u... | javascript | function getHtmlTemplates(dirName) {
const html_conf = [];
// create the array of HTML plugins.
const template = path.join(dirName, '_template.html');
getExamples(dirName, (entryName, filename) => {
html_conf.push(
new HtmlWebpackPlugin({
title: entryName,
// ensure each output has a u... | [
"function",
"getHtmlTemplates",
"(",
"dirName",
")",
"{",
"const",
"html_conf",
"=",
"[",
"]",
";",
"// create the array of HTML plugins.",
"const",
"template",
"=",
"path",
".",
"join",
"(",
"dirName",
",",
"'_template.html'",
")",
";",
"getExamples",
"(",
"dir... | Each example needs a dedicated HTML file.
This will create a "plugin" that outputs HTML from a template.
@param {String} dirName - Name of the directory to read.
@returns {Array} specifying webpack plugins. | [
"Each",
"example",
"needs",
"a",
"dedicated",
"HTML",
"file",
".",
"This",
"will",
"create",
"a",
"plugin",
"that",
"outputs",
"HTML",
"from",
"a",
"template",
"."
] | 69f9032f98e7b11f17f581d6d4a6fdfcb4bea2db | https://github.com/openlayers/ol-mapbox-style/blob/69f9032f98e7b11f17f581d6d4a6fdfcb4bea2db/webpack.config.js#L53-L71 |
13,153 | leonidas/transparency | examples/todomvc/architecture-examples/backbone/js/views/app.js | function() {
return {
title: this.input.val().trim(),
order: window.app.Todos.nextOrder(),
completed: false
};
} | javascript | function() {
return {
title: this.input.val().trim(),
order: window.app.Todos.nextOrder(),
completed: false
};
} | [
"function",
"(",
")",
"{",
"return",
"{",
"title",
":",
"this",
".",
"input",
".",
"val",
"(",
")",
".",
"trim",
"(",
")",
",",
"order",
":",
"window",
".",
"app",
".",
"Todos",
".",
"nextOrder",
"(",
")",
",",
"completed",
":",
"false",
"}",
"... | Generate the attributes for a new Todo item. | [
"Generate",
"the",
"attributes",
"for",
"a",
"new",
"Todo",
"item",
"."
] | 92149b83e7202423a764e1cc2ec5d78e43f77ce2 | https://github.com/leonidas/transparency/blob/92149b83e7202423a764e1cc2ec5d78e43f77ce2/examples/todomvc/architecture-examples/backbone/js/views/app.js#L99-L105 | |
13,154 | leonidas/transparency | examples/todomvc/architecture-examples/backbone/js/views/app.js | function() {
_.each(window.app.Todos.completed(), function(todo){ todo.destroy(); });
return false;
} | javascript | function() {
_.each(window.app.Todos.completed(), function(todo){ todo.destroy(); });
return false;
} | [
"function",
"(",
")",
"{",
"_",
".",
"each",
"(",
"window",
".",
"app",
".",
"Todos",
".",
"completed",
"(",
")",
",",
"function",
"(",
"todo",
")",
"{",
"todo",
".",
"destroy",
"(",
")",
";",
"}",
")",
";",
"return",
"false",
";",
"}"
] | Clear all completed todo items, destroying their models. | [
"Clear",
"all",
"completed",
"todo",
"items",
"destroying",
"their",
"models",
"."
] | 92149b83e7202423a764e1cc2ec5d78e43f77ce2 | https://github.com/leonidas/transparency/blob/92149b83e7202423a764e1cc2ec5d78e43f77ce2/examples/todomvc/architecture-examples/backbone/js/views/app.js#L124-L127 | |
13,155 | socib/Leaflet.TimeDimension | examples/js/example15.js | function(feature, minTime, maxTime) {
var featureStringTimes = this._getFeatureTimes(feature);
if (featureStringTimes.length == 0) {
return feature;
}
var featureTimes = [];
for (var i = 0, l = featureStringTimes.length; i < l; i++) {
var time = featureStr... | javascript | function(feature, minTime, maxTime) {
var featureStringTimes = this._getFeatureTimes(feature);
if (featureStringTimes.length == 0) {
return feature;
}
var featureTimes = [];
for (var i = 0, l = featureStringTimes.length; i < l; i++) {
var time = featureStr... | [
"function",
"(",
"feature",
",",
"minTime",
",",
"maxTime",
")",
"{",
"var",
"featureStringTimes",
"=",
"this",
".",
"_getFeatureTimes",
"(",
"feature",
")",
";",
"if",
"(",
"featureStringTimes",
".",
"length",
"==",
"0",
")",
"{",
"return",
"feature",
";"... | Do not modify features. Just return the feature if it intersects the time interval | [
"Do",
"not",
"modify",
"features",
".",
"Just",
"return",
"the",
"feature",
"if",
"it",
"intersects",
"the",
"time",
"interval"
] | 8045c2e8a62520fe647e41ab5801fe6bc7b021af | https://github.com/socib/Leaflet.TimeDimension/blob/8045c2e8a62520fe647e41ab5801fe6bc7b021af/examples/js/example15.js#L25-L43 | |
13,156 | pillarjs/router | index.js | generateOptionsResponder | function generateOptionsResponder(res, methods) {
return function onDone(fn, err) {
if (err || methods.length === 0) {
return fn(err)
}
trySendOptionsResponse(res, methods, fn)
}
} | javascript | function generateOptionsResponder(res, methods) {
return function onDone(fn, err) {
if (err || methods.length === 0) {
return fn(err)
}
trySendOptionsResponse(res, methods, fn)
}
} | [
"function",
"generateOptionsResponder",
"(",
"res",
",",
"methods",
")",
"{",
"return",
"function",
"onDone",
"(",
"fn",
",",
"err",
")",
"{",
"if",
"(",
"err",
"||",
"methods",
".",
"length",
"===",
"0",
")",
"{",
"return",
"fn",
"(",
"err",
")",
"}... | Generate a callback that will make an OPTIONS response.
@param {OutgoingMessage} res
@param {array} methods
@private | [
"Generate",
"a",
"callback",
"that",
"will",
"make",
"an",
"OPTIONS",
"response",
"."
] | 51c56e61b40ab486a936df7d6b09db006a3e9159 | https://github.com/pillarjs/router/blob/51c56e61b40ab486a936df7d6b09db006a3e9159/index.js#L546-L554 |
13,157 | pillarjs/router | index.js | mergeParams | function mergeParams(params, parent) {
if (typeof parent !== 'object' || !parent) {
return params
}
// make copy of parent for base
var obj = mixin({}, parent)
// simple non-numeric merging
if (!(0 in params) || !(0 in parent)) {
return mixin(obj, params)
}
var i = 0
var o = 0
// determi... | javascript | function mergeParams(params, parent) {
if (typeof parent !== 'object' || !parent) {
return params
}
// make copy of parent for base
var obj = mixin({}, parent)
// simple non-numeric merging
if (!(0 in params) || !(0 in parent)) {
return mixin(obj, params)
}
var i = 0
var o = 0
// determi... | [
"function",
"mergeParams",
"(",
"params",
",",
"parent",
")",
"{",
"if",
"(",
"typeof",
"parent",
"!==",
"'object'",
"||",
"!",
"parent",
")",
"{",
"return",
"params",
"}",
"// make copy of parent for base",
"var",
"obj",
"=",
"mixin",
"(",
"{",
"}",
",",
... | Merge params with parent params
@private | [
"Merge",
"params",
"with",
"parent",
"params"
] | 51c56e61b40ab486a936df7d6b09db006a3e9159 | https://github.com/pillarjs/router/blob/51c56e61b40ab486a936df7d6b09db006a3e9159/index.js#L616-L653 |
13,158 | pillarjs/router | index.js | restore | function restore(fn, obj) {
var props = new Array(arguments.length - 2)
var vals = new Array(arguments.length - 2)
for (var i = 0; i < props.length; i++) {
props[i] = arguments[i + 2]
vals[i] = obj[props[i]]
}
return function(){
// restore vals
for (var i = 0; i < props.length; i++) {
... | javascript | function restore(fn, obj) {
var props = new Array(arguments.length - 2)
var vals = new Array(arguments.length - 2)
for (var i = 0; i < props.length; i++) {
props[i] = arguments[i + 2]
vals[i] = obj[props[i]]
}
return function(){
// restore vals
for (var i = 0; i < props.length; i++) {
... | [
"function",
"restore",
"(",
"fn",
",",
"obj",
")",
"{",
"var",
"props",
"=",
"new",
"Array",
"(",
"arguments",
".",
"length",
"-",
"2",
")",
"var",
"vals",
"=",
"new",
"Array",
"(",
"arguments",
".",
"length",
"-",
"2",
")",
"for",
"(",
"var",
"i... | Restore obj props after function
@private | [
"Restore",
"obj",
"props",
"after",
"function"
] | 51c56e61b40ab486a936df7d6b09db006a3e9159 | https://github.com/pillarjs/router/blob/51c56e61b40ab486a936df7d6b09db006a3e9159/index.js#L661-L678 |
13,159 | pillarjs/router | index.js | sendOptionsResponse | function sendOptionsResponse(res, methods) {
var options = Object.create(null)
// build unique method map
for (var i = 0; i < methods.length; i++) {
options[methods[i]] = true
}
// construct the allow list
var allow = Object.keys(options).sort().join(', ')
// send response
res.setHeader('Allow', ... | javascript | function sendOptionsResponse(res, methods) {
var options = Object.create(null)
// build unique method map
for (var i = 0; i < methods.length; i++) {
options[methods[i]] = true
}
// construct the allow list
var allow = Object.keys(options).sort().join(', ')
// send response
res.setHeader('Allow', ... | [
"function",
"sendOptionsResponse",
"(",
"res",
",",
"methods",
")",
"{",
"var",
"options",
"=",
"Object",
".",
"create",
"(",
"null",
")",
"// build unique method map",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"methods",
".",
"length",
";",
"i",
... | Send an OPTIONS response.
@private | [
"Send",
"an",
"OPTIONS",
"response",
"."
] | 51c56e61b40ab486a936df7d6b09db006a3e9159 | https://github.com/pillarjs/router/blob/51c56e61b40ab486a936df7d6b09db006a3e9159/index.js#L686-L703 |
13,160 | pillarjs/router | index.js | trySendOptionsResponse | function trySendOptionsResponse(res, methods, next) {
try {
sendOptionsResponse(res, methods)
} catch (err) {
next(err)
}
} | javascript | function trySendOptionsResponse(res, methods, next) {
try {
sendOptionsResponse(res, methods)
} catch (err) {
next(err)
}
} | [
"function",
"trySendOptionsResponse",
"(",
"res",
",",
"methods",
",",
"next",
")",
"{",
"try",
"{",
"sendOptionsResponse",
"(",
"res",
",",
"methods",
")",
"}",
"catch",
"(",
"err",
")",
"{",
"next",
"(",
"err",
")",
"}",
"}"
] | Try to send an OPTIONS response.
@private | [
"Try",
"to",
"send",
"an",
"OPTIONS",
"response",
"."
] | 51c56e61b40ab486a936df7d6b09db006a3e9159 | https://github.com/pillarjs/router/blob/51c56e61b40ab486a936df7d6b09db006a3e9159/index.js#L711-L717 |
13,161 | SC5/sc5-styleguide | lib/modules/section-references.js | reduceModifiers | function reduceModifiers (previousValue, currentValue) {
return previousValue + currentValue[property].replace(modifierPlaceholder, currentValue.className);
} | javascript | function reduceModifiers (previousValue, currentValue) {
return previousValue + currentValue[property].replace(modifierPlaceholder, currentValue.className);
} | [
"function",
"reduceModifiers",
"(",
"previousValue",
",",
"currentValue",
")",
"{",
"return",
"previousValue",
"+",
"currentValue",
"[",
"property",
"]",
".",
"replace",
"(",
"modifierPlaceholder",
",",
"currentValue",
".",
"className",
")",
";",
"}"
] | Concat all modifiers | [
"Concat",
"all",
"modifiers"
] | f573faba05643166f5c01c5faab3a4011c4173b7 | https://github.com/SC5/sc5-styleguide/blob/f573faba05643166f5c01c5faab3a4011c4173b7/lib/modules/section-references.js#L13-L15 |
13,162 | SC5/sc5-styleguide | lib/modules/kss-parser.js | jsonSections | function jsonSections(sections, block) {
return sections.map(function(section) {
// Temporary inserting of partial
var partial = section;
if (partial.markup() && partial.markup().toString().match(/^[^\n]+\.(html|hbs|pug)$/)) {
partial.file = partial.markup().toString();
partial.name = path.ba... | javascript | function jsonSections(sections, block) {
return sections.map(function(section) {
// Temporary inserting of partial
var partial = section;
if (partial.markup() && partial.markup().toString().match(/^[^\n]+\.(html|hbs|pug)$/)) {
partial.file = partial.markup().toString();
partial.name = path.ba... | [
"function",
"jsonSections",
"(",
"sections",
",",
"block",
")",
"{",
"return",
"sections",
".",
"map",
"(",
"function",
"(",
"section",
")",
"{",
"// Temporary inserting of partial",
"var",
"partial",
"=",
"section",
";",
"if",
"(",
"partial",
".",
"markup",
... | Parses kss.KssSection to JSON | [
"Parses",
"kss",
".",
"KssSection",
"to",
"JSON"
] | f573faba05643166f5c01c5faab3a4011c4173b7 | https://github.com/SC5/sc5-styleguide/blob/f573faba05643166f5c01c5faab3a4011c4173b7/lib/modules/kss-parser.js#L14-L39 |
13,163 | SC5/sc5-styleguide | lib/modules/kss-parser.js | jsonModifiers | function jsonModifiers(modifiers) {
return modifiers.map(function(modifier, id) {
return {
id: id + 1,
name: modifier.name(),
description: modifier.description(),
className: modifier.className(),
markup: modifier.markup() ? modifier.markup().toString() : null
};
});
} | javascript | function jsonModifiers(modifiers) {
return modifiers.map(function(modifier, id) {
return {
id: id + 1,
name: modifier.name(),
description: modifier.description(),
className: modifier.className(),
markup: modifier.markup() ? modifier.markup().toString() : null
};
});
} | [
"function",
"jsonModifiers",
"(",
"modifiers",
")",
"{",
"return",
"modifiers",
".",
"map",
"(",
"function",
"(",
"modifier",
",",
"id",
")",
"{",
"return",
"{",
"id",
":",
"id",
"+",
"1",
",",
"name",
":",
"modifier",
".",
"name",
"(",
")",
",",
"... | Parses kss.KssModifier to JSON | [
"Parses",
"kss",
".",
"KssModifier",
"to",
"JSON"
] | f573faba05643166f5c01c5faab3a4011c4173b7 | https://github.com/SC5/sc5-styleguide/blob/f573faba05643166f5c01c5faab3a4011c4173b7/lib/modules/kss-parser.js#L42-L52 |
13,164 | dhotson/springy | springyui.js | intersect_line_line | function intersect_line_line(p1, p2, p3, p4) {
var denom = ((p4.y - p3.y)*(p2.x - p1.x) - (p4.x - p3.x)*(p2.y - p1.y));
// lines are parallel
if (denom === 0) {
return false;
}
var ua = ((p4.x - p3.x)*(p1.y - p3.y) - (p4.y - p3.y)*(p1.x - p3.x)) / denom;
var ub = ((p2.x - p1.x)*(p1.y - p3.y) - (p2.y - ... | javascript | function intersect_line_line(p1, p2, p3, p4) {
var denom = ((p4.y - p3.y)*(p2.x - p1.x) - (p4.x - p3.x)*(p2.y - p1.y));
// lines are parallel
if (denom === 0) {
return false;
}
var ua = ((p4.x - p3.x)*(p1.y - p3.y) - (p4.y - p3.y)*(p1.x - p3.x)) / denom;
var ub = ((p2.x - p1.x)*(p1.y - p3.y) - (p2.y - ... | [
"function",
"intersect_line_line",
"(",
"p1",
",",
"p2",
",",
"p3",
",",
"p4",
")",
"{",
"var",
"denom",
"=",
"(",
"(",
"p4",
".",
"y",
"-",
"p3",
".",
"y",
")",
"*",
"(",
"p2",
".",
"x",
"-",
"p1",
".",
"x",
")",
"-",
"(",
"p4",
".",
"x"... | helpers for figuring out where to draw arrows | [
"helpers",
"for",
"figuring",
"out",
"where",
"to",
"draw",
"arrows"
] | 9654b64f85f7f35220eaafee80894d33a00ef5ac | https://github.com/dhotson/springy/blob/9654b64f85f7f35220eaafee80894d33a00ef5ac/springyui.js#L358-L374 |
13,165 | fernando-mc/serverless-finch | lib/bucketUtils.js | emptyBucket | function emptyBucket(aws, bucketName, keyPrefix) {
return listObjectsInBucket(aws, bucketName).then(resp => {
const contents = resp.Contents;
let testPrefix = false,
prefixRegexp;
if (!contents[0]) {
return Promise.resolve();
} else {
if (keyPrefix) {
testPrefix = true;
... | javascript | function emptyBucket(aws, bucketName, keyPrefix) {
return listObjectsInBucket(aws, bucketName).then(resp => {
const contents = resp.Contents;
let testPrefix = false,
prefixRegexp;
if (!contents[0]) {
return Promise.resolve();
} else {
if (keyPrefix) {
testPrefix = true;
... | [
"function",
"emptyBucket",
"(",
"aws",
",",
"bucketName",
",",
"keyPrefix",
")",
"{",
"return",
"listObjectsInBucket",
"(",
"aws",
",",
"bucketName",
")",
".",
"then",
"(",
"resp",
"=>",
"{",
"const",
"contents",
"=",
"resp",
".",
"Contents",
";",
"let",
... | Deletes all objects in an S3 bucket
@param {Object} aws - AWS class
@param {string} bucketName - Name of bucket to be deleted | [
"Deletes",
"all",
"objects",
"in",
"an",
"S3",
"bucket"
] | ccdc24b958385f65472fad19896b14279171de09 | https://github.com/fernando-mc/serverless-finch/blob/ccdc24b958385f65472fad19896b14279171de09/lib/bucketUtils.js#L51-L76 |
13,166 | fernando-mc/serverless-finch | lib/configure.js | configureBucket | function configureBucket(
aws,
bucketName,
indexDocument,
errorDocument,
redirectAllRequestsTo,
routingRules
) {
const params = {
Bucket: bucketName,
WebsiteConfiguration: {}
};
if (redirectAllRequestsTo) {
params.WebsiteConfiguration.RedirectAllRequestsTo = {};
params.WebsiteConfigur... | javascript | function configureBucket(
aws,
bucketName,
indexDocument,
errorDocument,
redirectAllRequestsTo,
routingRules
) {
const params = {
Bucket: bucketName,
WebsiteConfiguration: {}
};
if (redirectAllRequestsTo) {
params.WebsiteConfiguration.RedirectAllRequestsTo = {};
params.WebsiteConfigur... | [
"function",
"configureBucket",
"(",
"aws",
",",
"bucketName",
",",
"indexDocument",
",",
"errorDocument",
",",
"redirectAllRequestsTo",
",",
"routingRules",
")",
"{",
"const",
"params",
"=",
"{",
"Bucket",
":",
"bucketName",
",",
"WebsiteConfiguration",
":",
"{",
... | Sets website configuration parameters for given bucket
@param {Object} aws - AWS class
@param {string} bucketName - Name of bucket to be configured
@param {string} indexDocument - Path to index document
@param {string} errorDocument - Path to error document
@param {Object} redirectAllRequestsTo - Configuration informat... | [
"Sets",
"website",
"configuration",
"parameters",
"for",
"given",
"bucket"
] | ccdc24b958385f65472fad19896b14279171de09 | https://github.com/fernando-mc/serverless-finch/blob/ccdc24b958385f65472fad19896b14279171de09/lib/configure.js#L12-L86 |
13,167 | fernando-mc/serverless-finch | lib/configure.js | configurePolicyForBucket | function configurePolicyForBucket(aws, bucketName, customPolicy) {
const policy = customPolicy || {
Version: '2012-10-17',
Statement: [
{
Effect: 'Allow',
Principal: {
AWS: '*'
},
Action: 's3:GetObject',
Resource: `arn:aws:s3:::${bucketName}/*`
}
... | javascript | function configurePolicyForBucket(aws, bucketName, customPolicy) {
const policy = customPolicy || {
Version: '2012-10-17',
Statement: [
{
Effect: 'Allow',
Principal: {
AWS: '*'
},
Action: 's3:GetObject',
Resource: `arn:aws:s3:::${bucketName}/*`
}
... | [
"function",
"configurePolicyForBucket",
"(",
"aws",
",",
"bucketName",
",",
"customPolicy",
")",
"{",
"const",
"policy",
"=",
"customPolicy",
"||",
"{",
"Version",
":",
"'2012-10-17'",
",",
"Statement",
":",
"[",
"{",
"Effect",
":",
"'Allow'",
",",
"Principal"... | Configures policy for given bucket
@param {Object} aws - AWS class
@param {string} bucketName - Name of bucket to be configured | [
"Configures",
"policy",
"for",
"given",
"bucket"
] | ccdc24b958385f65472fad19896b14279171de09 | https://github.com/fernando-mc/serverless-finch/blob/ccdc24b958385f65472fad19896b14279171de09/lib/configure.js#L93-L114 |
13,168 | fernando-mc/serverless-finch | lib/configure.js | configureCorsForBucket | function configureCorsForBucket(aws, bucketName) {
const params = {
Bucket: bucketName,
CORSConfiguration: require('./resources/CORSPolicy')
};
return aws.request('S3', 'putBucketCors', params);
} | javascript | function configureCorsForBucket(aws, bucketName) {
const params = {
Bucket: bucketName,
CORSConfiguration: require('./resources/CORSPolicy')
};
return aws.request('S3', 'putBucketCors', params);
} | [
"function",
"configureCorsForBucket",
"(",
"aws",
",",
"bucketName",
")",
"{",
"const",
"params",
"=",
"{",
"Bucket",
":",
"bucketName",
",",
"CORSConfiguration",
":",
"require",
"(",
"'./resources/CORSPolicy'",
")",
"}",
";",
"return",
"aws",
".",
"request",
... | Configures CORS policy for given bucket
@param {Object} aws - AWS class
@param {string} bucketName - Name of bucket to be configured | [
"Configures",
"CORS",
"policy",
"for",
"given",
"bucket"
] | ccdc24b958385f65472fad19896b14279171de09 | https://github.com/fernando-mc/serverless-finch/blob/ccdc24b958385f65472fad19896b14279171de09/lib/configure.js#L121-L128 |
13,169 | fernando-mc/serverless-finch | lib/upload.js | uploadDirectory | function uploadDirectory(aws, bucketName, clientRoot, headerSpec, orderSpec, keyPrefix) {
const allFiles = getFileList(clientRoot);
const filesGroupedByOrder = groupFilesByOrder(allFiles, orderSpec);
return filesGroupedByOrder.reduce((existingUploads, files) => {
return existingUploads.then(existingResults ... | javascript | function uploadDirectory(aws, bucketName, clientRoot, headerSpec, orderSpec, keyPrefix) {
const allFiles = getFileList(clientRoot);
const filesGroupedByOrder = groupFilesByOrder(allFiles, orderSpec);
return filesGroupedByOrder.reduce((existingUploads, files) => {
return existingUploads.then(existingResults ... | [
"function",
"uploadDirectory",
"(",
"aws",
",",
"bucketName",
",",
"clientRoot",
",",
"headerSpec",
",",
"orderSpec",
",",
"keyPrefix",
")",
"{",
"const",
"allFiles",
"=",
"getFileList",
"(",
"clientRoot",
")",
";",
"const",
"filesGroupedByOrder",
"=",
"groupFil... | Uploads client files to an S3 bucket
@param {Object} aws - AWS class
@param {string} bucketName - Name of bucket to be configured
@param {string} clientRoot - Full path to the root directory of client files
@param {Object[]} headerSpec - Array of header values to add to files
@param {string[]} orderSpec - Array of rege... | [
"Uploads",
"client",
"files",
"to",
"an",
"S3",
"bucket"
] | ccdc24b958385f65472fad19896b14279171de09 | https://github.com/fernando-mc/serverless-finch/blob/ccdc24b958385f65472fad19896b14279171de09/lib/upload.js#L22-L36 |
13,170 | fernando-mc/serverless-finch | lib/upload.js | uploadFile | function uploadFile(aws, bucketName, filePath, fileKey, headers) {
const baseHeaderKeys = [
'Cache-Control',
'Content-Disposition',
'Content-Encoding',
'Content-Language',
'Content-Type',
'Expires',
'Website-Redirect-Location'
];
const fileBuffer = fs.readFileSync(filePath);
const ... | javascript | function uploadFile(aws, bucketName, filePath, fileKey, headers) {
const baseHeaderKeys = [
'Cache-Control',
'Content-Disposition',
'Content-Encoding',
'Content-Language',
'Content-Type',
'Expires',
'Website-Redirect-Location'
];
const fileBuffer = fs.readFileSync(filePath);
const ... | [
"function",
"uploadFile",
"(",
"aws",
",",
"bucketName",
",",
"filePath",
",",
"fileKey",
",",
"headers",
")",
"{",
"const",
"baseHeaderKeys",
"=",
"[",
"'Cache-Control'",
",",
"'Content-Disposition'",
",",
"'Content-Encoding'",
",",
"'Content-Language'",
",",
"'C... | Uploads a file to an S3 bucket
@param {Object} aws - AWS class
@param {string} bucketName - Name of bucket to be configured
@param {string} filePath - Full path to file to be uploaded
@param {string} clientRoot - Full path to the root directory of client files | [
"Uploads",
"a",
"file",
"to",
"an",
"S3",
"bucket"
] | ccdc24b958385f65472fad19896b14279171de09 | https://github.com/fernando-mc/serverless-finch/blob/ccdc24b958385f65472fad19896b14279171de09/lib/upload.js#L45-L77 |
13,171 | livoras/list-diff | lib/diff.js | makeKeyIndexAndFree | function makeKeyIndexAndFree (list, key) {
var keyIndex = {}
var free = []
for (var i = 0, len = list.length; i < len; i++) {
var item = list[i]
var itemKey = getItemKey(item, key)
if (itemKey) {
keyIndex[itemKey] = i
} else {
free.push(item)
}
}
return {
keyIn... | javascript | function makeKeyIndexAndFree (list, key) {
var keyIndex = {}
var free = []
for (var i = 0, len = list.length; i < len; i++) {
var item = list[i]
var itemKey = getItemKey(item, key)
if (itemKey) {
keyIndex[itemKey] = i
} else {
free.push(item)
}
}
return {
keyIn... | [
"function",
"makeKeyIndexAndFree",
"(",
"list",
",",
"key",
")",
"{",
"var",
"keyIndex",
"=",
"{",
"}",
"var",
"free",
"=",
"[",
"]",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"list",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++"... | Convert list to key-item keyIndex object.
@param {Array} list
@param {String|Function} key | [
"Convert",
"list",
"to",
"key",
"-",
"item",
"keyIndex",
"object",
"."
] | 7a35a1607e9f7baf3ab8c43bb68d424c6c0a7ca8 | https://github.com/livoras/list-diff/blob/7a35a1607e9f7baf3ab8c43bb68d424c6c0a7ca8/lib/diff.js#L128-L144 |
13,172 | Travelport-Ukraine/uapi-json | src/Services/Air/AirFormat.js | setIndexesForSegments | function setIndexesForSegments(
segmentsObject = null,
serviceSegmentsObject = null
) {
const segments = segmentsObject
? Object.keys(segmentsObject).map(k => segmentsObject[k])
: null;
const serviceSegments = serviceSegmentsObject
? Object.keys(serviceSegmentsObject).map(k => serviceSegmentsObject... | javascript | function setIndexesForSegments(
segmentsObject = null,
serviceSegmentsObject = null
) {
const segments = segmentsObject
? Object.keys(segmentsObject).map(k => segmentsObject[k])
: null;
const serviceSegments = serviceSegmentsObject
? Object.keys(serviceSegmentsObject).map(k => serviceSegmentsObject... | [
"function",
"setIndexesForSegments",
"(",
"segmentsObject",
"=",
"null",
",",
"serviceSegmentsObject",
"=",
"null",
")",
"{",
"const",
"segments",
"=",
"segmentsObject",
"?",
"Object",
".",
"keys",
"(",
"segmentsObject",
")",
".",
"map",
"(",
"k",
"=>",
"segme... | This function used to transform segments and service segments objects
to arrays. After that this function try to set indexes with same as in
terminal response order. So it needs to check `TravelOrder` field for that.
@param segmentsObject
@param serviceSegmentsObject
@return {*} | [
"This",
"function",
"used",
"to",
"transform",
"segments",
"and",
"service",
"segments",
"objects",
"to",
"arrays",
".",
"After",
"that",
"this",
"function",
"try",
"to",
"set",
"indexes",
"with",
"same",
"as",
"in",
"terminal",
"response",
"order",
".",
"So... | de43c1add967e7af629fe155505197dc55d637d4 | https://github.com/Travelport-Ukraine/uapi-json/blob/de43c1add967e7af629fe155505197dc55d637d4/src/Services/Air/AirFormat.js#L244-L299 |
13,173 | expressjs/cookie-parser | index.js | cookieParser | function cookieParser (secret, options) {
var secrets = !secret || Array.isArray(secret)
? (secret || [])
: [secret]
return function cookieParser (req, res, next) {
if (req.cookies) {
return next()
}
var cookies = req.headers.cookie
req.secret = secrets[0]
req.cookies = Object.c... | javascript | function cookieParser (secret, options) {
var secrets = !secret || Array.isArray(secret)
? (secret || [])
: [secret]
return function cookieParser (req, res, next) {
if (req.cookies) {
return next()
}
var cookies = req.headers.cookie
req.secret = secrets[0]
req.cookies = Object.c... | [
"function",
"cookieParser",
"(",
"secret",
",",
"options",
")",
"{",
"var",
"secrets",
"=",
"!",
"secret",
"||",
"Array",
".",
"isArray",
"(",
"secret",
")",
"?",
"(",
"secret",
"||",
"[",
"]",
")",
":",
"[",
"secret",
"]",
"return",
"function",
"coo... | Parse Cookie header and populate `req.cookies`
with an object keyed by the cookie names.
@param {string|array} [secret] A string (or array of strings) representing cookie signing secret(s).
@param {Object} [options]
@return {Function}
@public | [
"Parse",
"Cookie",
"header",
"and",
"populate",
"req",
".",
"cookies",
"with",
"an",
"object",
"keyed",
"by",
"the",
"cookie",
"names",
"."
] | 26fd91a024c58bf2dbe0a05c6b8831b180c12d11 | https://github.com/expressjs/cookie-parser/blob/26fd91a024c58bf2dbe0a05c6b8831b180c12d11/index.js#L39-L73 |
13,174 | expressjs/cookie-parser | index.js | JSONCookie | function JSONCookie (str) {
if (typeof str !== 'string' || str.substr(0, 2) !== 'j:') {
return undefined
}
try {
return JSON.parse(str.slice(2))
} catch (err) {
return undefined
}
} | javascript | function JSONCookie (str) {
if (typeof str !== 'string' || str.substr(0, 2) !== 'j:') {
return undefined
}
try {
return JSON.parse(str.slice(2))
} catch (err) {
return undefined
}
} | [
"function",
"JSONCookie",
"(",
"str",
")",
"{",
"if",
"(",
"typeof",
"str",
"!==",
"'string'",
"||",
"str",
".",
"substr",
"(",
"0",
",",
"2",
")",
"!==",
"'j:'",
")",
"{",
"return",
"undefined",
"}",
"try",
"{",
"return",
"JSON",
".",
"parse",
"("... | Parse JSON cookie string.
@param {String} str
@return {Object} Parsed object or undefined if not json cookie
@public | [
"Parse",
"JSON",
"cookie",
"string",
"."
] | 26fd91a024c58bf2dbe0a05c6b8831b180c12d11 | https://github.com/expressjs/cookie-parser/blob/26fd91a024c58bf2dbe0a05c6b8831b180c12d11/index.js#L83-L93 |
13,175 | expressjs/cookie-parser | index.js | JSONCookies | function JSONCookies (obj) {
var cookies = Object.keys(obj)
var key
var val
for (var i = 0; i < cookies.length; i++) {
key = cookies[i]
val = JSONCookie(obj[key])
if (val) {
obj[key] = val
}
}
return obj
} | javascript | function JSONCookies (obj) {
var cookies = Object.keys(obj)
var key
var val
for (var i = 0; i < cookies.length; i++) {
key = cookies[i]
val = JSONCookie(obj[key])
if (val) {
obj[key] = val
}
}
return obj
} | [
"function",
"JSONCookies",
"(",
"obj",
")",
"{",
"var",
"cookies",
"=",
"Object",
".",
"keys",
"(",
"obj",
")",
"var",
"key",
"var",
"val",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"cookies",
".",
"length",
";",
"i",
"++",
")",
"{",
"ke... | Parse JSON cookies.
@param {Object} obj
@return {Object}
@public | [
"Parse",
"JSON",
"cookies",
"."
] | 26fd91a024c58bf2dbe0a05c6b8831b180c12d11 | https://github.com/expressjs/cookie-parser/blob/26fd91a024c58bf2dbe0a05c6b8831b180c12d11/index.js#L103-L118 |
13,176 | Yaffle/EventSource | src/eventsource.js | function () {
try {
return new TextDecoder().decode(new TextEncoder().encode("test"), {stream: true}) === "test";
} catch (error) {
console.log(error);
}
return false;
} | javascript | function () {
try {
return new TextDecoder().decode(new TextEncoder().encode("test"), {stream: true}) === "test";
} catch (error) {
console.log(error);
}
return false;
} | [
"function",
"(",
")",
"{",
"try",
"{",
"return",
"new",
"TextDecoder",
"(",
")",
".",
"decode",
"(",
"new",
"TextEncoder",
"(",
")",
".",
"encode",
"(",
"\"test\"",
")",
",",
"{",
"stream",
":",
"true",
"}",
")",
"===",
"\"test\"",
";",
"}",
"catch... | Firefox < 38 throws an error with stream option | [
"Firefox",
"<",
"38",
"throws",
"an",
"error",
"with",
"stream",
"option"
] | c68b58eb7c35591af763fd704699ac8c9816defe | https://github.com/Yaffle/EventSource/blob/c68b58eb7c35591af763fd704699ac8c9816defe/src/eventsource.js#L148-L155 | |
13,177 | john-doherty/selenium-cucumber-js | page-objects/google-search.js | function (searchQuery) {
var selector = page.googleSearch.elements.searchInput;
// return a promise so the calling function knows the task has completed
return driver.findElement(selector).sendKeys(searchQuery, selenium.Key.ENTER);
} | javascript | function (searchQuery) {
var selector = page.googleSearch.elements.searchInput;
// return a promise so the calling function knows the task has completed
return driver.findElement(selector).sendKeys(searchQuery, selenium.Key.ENTER);
} | [
"function",
"(",
"searchQuery",
")",
"{",
"var",
"selector",
"=",
"page",
".",
"googleSearch",
".",
"elements",
".",
"searchInput",
";",
"// return a promise so the calling function knows the task has completed",
"return",
"driver",
".",
"findElement",
"(",
"selector",
... | enters a search term into Google's search box and presses enter
@param {string} searchQuery
@returns {Promise} a promise to enter the search values | [
"enters",
"a",
"search",
"term",
"into",
"Google",
"s",
"search",
"box",
"and",
"presses",
"enter"
] | d29cd32ffafdc405fa5279fc9b50361d75c91e3c | https://github.com/john-doherty/selenium-cucumber-js/blob/d29cd32ffafdc405fa5279fc9b50361d75c91e3c/page-objects/google-search.js#L15-L21 | |
13,178 | john-doherty/selenium-cucumber-js | runtime/world.js | getDriverInstance | function getDriverInstance() {
var driver;
switch (browserName || '') {
case 'firefox': {
driver = new FireFoxDriver();
}
break;
case 'phantomjs': {
driver = new PhantomJSDriver();
}
break;
case 'electron': {
... | javascript | function getDriverInstance() {
var driver;
switch (browserName || '') {
case 'firefox': {
driver = new FireFoxDriver();
}
break;
case 'phantomjs': {
driver = new PhantomJSDriver();
}
break;
case 'electron': {
... | [
"function",
"getDriverInstance",
"(",
")",
"{",
"var",
"driver",
";",
"switch",
"(",
"browserName",
"||",
"''",
")",
"{",
"case",
"'firefox'",
":",
"{",
"driver",
"=",
"new",
"FireFoxDriver",
"(",
")",
";",
"}",
"break",
";",
"case",
"'phantomjs'",
":",
... | create the selenium browser based on global var set in index.js
@returns {ThenableWebDriver} selenium web driver | [
"create",
"the",
"selenium",
"browser",
"based",
"on",
"global",
"var",
"set",
"in",
"index",
".",
"js"
] | d29cd32ffafdc405fa5279fc9b50361d75c91e3c | https://github.com/john-doherty/selenium-cucumber-js/blob/d29cd32ffafdc405fa5279fc9b50361d75c91e3c/runtime/world.js#L32-L71 |
13,179 | john-doherty/selenium-cucumber-js | runtime/world.js | getEyesInstance | function getEyesInstance() {
if (global.eyesKey) {
var eyes = new Eyes();
// retrieve eyes api key from config file in the project root as defined by the user
eyes.setApiKey(global.eyesKey);
return eyes;
}
return null;
} | javascript | function getEyesInstance() {
if (global.eyesKey) {
var eyes = new Eyes();
// retrieve eyes api key from config file in the project root as defined by the user
eyes.setApiKey(global.eyesKey);
return eyes;
}
return null;
} | [
"function",
"getEyesInstance",
"(",
")",
"{",
"if",
"(",
"global",
".",
"eyesKey",
")",
"{",
"var",
"eyes",
"=",
"new",
"Eyes",
"(",
")",
";",
"// retrieve eyes api key from config file in the project root as defined by the user",
"eyes",
".",
"setApiKey",
"(",
"glo... | Initialize the eyes SDK and set your private API key via the config file. | [
"Initialize",
"the",
"eyes",
"SDK",
"and",
"set",
"your",
"private",
"API",
"key",
"via",
"the",
"config",
"file",
"."
] | d29cd32ffafdc405fa5279fc9b50361d75c91e3c | https://github.com/john-doherty/selenium-cucumber-js/blob/d29cd32ffafdc405fa5279fc9b50361d75c91e3c/runtime/world.js#L77-L90 |
13,180 | john-doherty/selenium-cucumber-js | runtime/world.js | createWorld | function createWorld() {
var runtime = {
driver: null, // the browser object
eyes: null,
selenium: selenium, // the raw nodejs selenium driver
By: selenium.By, // in keeping with Java expose selenium By
by: selenium.By, // provide ... | javascript | function createWorld() {
var runtime = {
driver: null, // the browser object
eyes: null,
selenium: selenium, // the raw nodejs selenium driver
By: selenium.By, // in keeping with Java expose selenium By
by: selenium.By, // provide ... | [
"function",
"createWorld",
"(",
")",
"{",
"var",
"runtime",
"=",
"{",
"driver",
":",
"null",
",",
"// the browser object",
"eyes",
":",
"null",
",",
"selenium",
":",
"selenium",
",",
"// the raw nodejs selenium driver",
"By",
":",
"selenium",
".",
"By",
",",
... | Creates a list of variables to expose globally and therefore accessible within each step definition
@returns {void} | [
"Creates",
"a",
"list",
"of",
"variables",
"to",
"expose",
"globally",
"and",
"therefore",
"accessible",
"within",
"each",
"step",
"definition"
] | d29cd32ffafdc405fa5279fc9b50361d75c91e3c | https://github.com/john-doherty/selenium-cucumber-js/blob/d29cd32ffafdc405fa5279fc9b50361d75c91e3c/runtime/world.js#L103-L128 |
13,181 | john-doherty/selenium-cucumber-js | runtime/world.js | importSupportObjects | function importSupportObjects() {
// import shared objects from multiple paths (after global vars have been created)
if (global.sharedObjectPaths && Array.isArray(global.sharedObjectPaths) && global.sharedObjectPaths.length > 0) {
var allDirs = {};
// first require directories into objects by... | javascript | function importSupportObjects() {
// import shared objects from multiple paths (after global vars have been created)
if (global.sharedObjectPaths && Array.isArray(global.sharedObjectPaths) && global.sharedObjectPaths.length > 0) {
var allDirs = {};
// first require directories into objects by... | [
"function",
"importSupportObjects",
"(",
")",
"{",
"// import shared objects from multiple paths (after global vars have been created)",
"if",
"(",
"global",
".",
"sharedObjectPaths",
"&&",
"Array",
".",
"isArray",
"(",
"global",
".",
"sharedObjectPaths",
")",
"&&",
"global... | Import shared objects, pages object and helpers into global scope
@returns {void} | [
"Import",
"shared",
"objects",
"pages",
"object",
"and",
"helpers",
"into",
"global",
"scope"
] | d29cd32ffafdc405fa5279fc9b50361d75c91e3c | https://github.com/john-doherty/selenium-cucumber-js/blob/d29cd32ffafdc405fa5279fc9b50361d75c91e3c/runtime/world.js#L134-L169 |
13,182 | john-doherty/selenium-cucumber-js | runtime/helpers.js | function(url, waitInSeconds) {
// use either passed in timeout or global default
var timeout = (waitInSeconds) ? (waitInSeconds * 1000) : DEFAULT_TIMEOUT;
// load the url and wait for it to complete
return driver.get(url).then(function() {
// now wait for the body element ... | javascript | function(url, waitInSeconds) {
// use either passed in timeout or global default
var timeout = (waitInSeconds) ? (waitInSeconds * 1000) : DEFAULT_TIMEOUT;
// load the url and wait for it to complete
return driver.get(url).then(function() {
// now wait for the body element ... | [
"function",
"(",
"url",
",",
"waitInSeconds",
")",
"{",
"// use either passed in timeout or global default",
"var",
"timeout",
"=",
"(",
"waitInSeconds",
")",
"?",
"(",
"waitInSeconds",
"*",
"1000",
")",
":",
"DEFAULT_TIMEOUT",
";",
"// load the url and wait for it to c... | returns a promise that is called when the url has loaded and the body element is present
@param {string} url - url to load
@param {integer} waitInSeconds - number of seconds to wait for page to load
@returns {Promise} resolved when url has loaded otherwise rejects
@example
helpers.loadPage('http://www.google.com'); | [
"returns",
"a",
"promise",
"that",
"is",
"called",
"when",
"the",
"url",
"has",
"loaded",
"and",
"the",
"body",
"element",
"is",
"present"
] | d29cd32ffafdc405fa5279fc9b50361d75c91e3c | https://github.com/john-doherty/selenium-cucumber-js/blob/d29cd32ffafdc405fa5279fc9b50361d75c91e3c/runtime/helpers.js#L11-L22 | |
13,183 | john-doherty/selenium-cucumber-js | runtime/helpers.js | function (htmlCssSelector, attributeName) {
// get the element from the page
return driver.findElement(by.css(htmlCssSelector)).then(function(el) {
return el.getAttribute(attributeName);
});
} | javascript | function (htmlCssSelector, attributeName) {
// get the element from the page
return driver.findElement(by.css(htmlCssSelector)).then(function(el) {
return el.getAttribute(attributeName);
});
} | [
"function",
"(",
"htmlCssSelector",
",",
"attributeName",
")",
"{",
"// get the element from the page",
"return",
"driver",
".",
"findElement",
"(",
"by",
".",
"css",
"(",
"htmlCssSelector",
")",
")",
".",
"then",
"(",
"function",
"(",
"el",
")",
"{",
"return"... | returns the value of an attribute on an element
@param {string} htmlCssSelector - HTML css selector used to find the element
@param {string} attributeName - attribute name to retrieve
@returns {string} the value of the attribute or empty string if not found
@example
helpers.getAttributeValue('body', 'class'); | [
"returns",
"the",
"value",
"of",
"an",
"attribute",
"on",
"an",
"element"
] | d29cd32ffafdc405fa5279fc9b50361d75c91e3c | https://github.com/john-doherty/selenium-cucumber-js/blob/d29cd32ffafdc405fa5279fc9b50361d75c91e3c/runtime/helpers.js#L32-L38 | |
13,184 | john-doherty/selenium-cucumber-js | runtime/helpers.js | function(elementSelector, attributeName, waitInMilliseconds) {
// use either passed in timeout or global default
var timeout = waitInMilliseconds || DEFAULT_TIMEOUT;
// readable error message
var timeoutMessage = attributeName + ' does not exists after ' + waitInMilliseconds + ' millis... | javascript | function(elementSelector, attributeName, waitInMilliseconds) {
// use either passed in timeout or global default
var timeout = waitInMilliseconds || DEFAULT_TIMEOUT;
// readable error message
var timeoutMessage = attributeName + ' does not exists after ' + waitInMilliseconds + ' millis... | [
"function",
"(",
"elementSelector",
",",
"attributeName",
",",
"waitInMilliseconds",
")",
"{",
"// use either passed in timeout or global default",
"var",
"timeout",
"=",
"waitInMilliseconds",
"||",
"DEFAULT_TIMEOUT",
";",
"// readable error message",
"var",
"timeoutMessage",
... | Waits until a HTML attribute exists
@param {string} elementSelector - HTML element CSS selector
@param {string} attributeName - name of the attribute to inspect
@param {integer} waitInMilliseconds - number of milliseconds to wait for page to load
@returns {Promise} resolves if attribute exists within timeout, otherwise... | [
"Waits",
"until",
"a",
"HTML",
"attribute",
"exists"
] | d29cd32ffafdc405fa5279fc9b50361d75c91e3c | https://github.com/john-doherty/selenium-cucumber-js/blob/d29cd32ffafdc405fa5279fc9b50361d75c91e3c/runtime/helpers.js#L169-L188 | |
13,185 | ktquez/vue-head | vue-head.js | function () {
if (!els.length) return
els.map(function (el) {
el.parentElement.removeChild(el)
})
els = []
} | javascript | function () {
if (!els.length) return
els.map(function (el) {
el.parentElement.removeChild(el)
})
els = []
} | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"els",
".",
"length",
")",
"return",
"els",
".",
"map",
"(",
"function",
"(",
"el",
")",
"{",
"el",
".",
"parentElement",
".",
"removeChild",
"(",
"el",
")",
"}",
")",
"els",
"=",
"[",
"]",
"}"
] | Undo elements to its previous state
@type {Function} | [
"Undo",
"elements",
"to",
"its",
"previous",
"state"
] | 0ff9d248cea22191539606e3009ab7591f6c2f11 | https://github.com/ktquez/vue-head/blob/0ff9d248cea22191539606e3009ab7591f6c2f11/vue-head.js#L63-L69 | |
13,186 | ktquez/vue-head | vue-head.js | function (obj, el) {
var self = this
Object.keys(obj).map(function (prop) {
var sh = self.shorthand[prop] || prop
if (sh.match(/(body|undo|replace)/g)) return
if (sh === 'inner') {
el.textContent = obj[prop]
return
}
el.setAttribute(sh, obj[prop])
... | javascript | function (obj, el) {
var self = this
Object.keys(obj).map(function (prop) {
var sh = self.shorthand[prop] || prop
if (sh.match(/(body|undo|replace)/g)) return
if (sh === 'inner') {
el.textContent = obj[prop]
return
}
el.setAttribute(sh, obj[prop])
... | [
"function",
"(",
"obj",
",",
"el",
")",
"{",
"var",
"self",
"=",
"this",
"Object",
".",
"keys",
"(",
"obj",
")",
".",
"map",
"(",
"function",
"(",
"prop",
")",
"{",
"var",
"sh",
"=",
"self",
".",
"shorthand",
"[",
"prop",
"]",
"||",
"prop",
"if... | Set attributes in element
@type {Function}
@param {Object} obj
@param {HTMLElement} el
@return {HTMLElement} with defined attributes | [
"Set",
"attributes",
"in",
"element"
] | 0ff9d248cea22191539606e3009ab7591f6c2f11 | https://github.com/ktquez/vue-head/blob/0ff9d248cea22191539606e3009ab7591f6c2f11/vue-head.js#L78-L90 | |
13,187 | ktquez/vue-head | vue-head.js | function (obj) {
if (!obj) return
diffTitle.before = opt.complement
var title = obj.inner + ' ' + (obj.separator || opt.separator) +
' ' + (obj.complement || opt.complement)
window.document.title = title.trim()
} | javascript | function (obj) {
if (!obj) return
diffTitle.before = opt.complement
var title = obj.inner + ' ' + (obj.separator || opt.separator) +
' ' + (obj.complement || opt.complement)
window.document.title = title.trim()
} | [
"function",
"(",
"obj",
")",
"{",
"if",
"(",
"!",
"obj",
")",
"return",
"diffTitle",
".",
"before",
"=",
"opt",
".",
"complement",
"var",
"title",
"=",
"obj",
".",
"inner",
"+",
"' '",
"+",
"(",
"obj",
".",
"separator",
"||",
"opt",
".",
"separator... | Change window.document title
@type {Function}
@param {Object} obj | [
"Change",
"window",
".",
"document",
"title"
] | 0ff9d248cea22191539606e3009ab7591f6c2f11 | https://github.com/ktquez/vue-head/blob/0ff9d248cea22191539606e3009ab7591f6c2f11/vue-head.js#L97-L103 | |
13,188 | ktquez/vue-head | vue-head.js | function (arr, tag, place, update) {
var self = this
if (!arr) return
arr.map(function (obj) {
var parent = (obj.body) ? self.getPlace('body') : self.getPlace(place)
var el = window.document.getElementById(obj.id) || window.document.createElement(tag)
// Elements that will subs... | javascript | function (arr, tag, place, update) {
var self = this
if (!arr) return
arr.map(function (obj) {
var parent = (obj.body) ? self.getPlace('body') : self.getPlace(place)
var el = window.document.getElementById(obj.id) || window.document.createElement(tag)
// Elements that will subs... | [
"function",
"(",
"arr",
",",
"tag",
",",
"place",
",",
"update",
")",
"{",
"var",
"self",
"=",
"this",
"if",
"(",
"!",
"arr",
")",
"return",
"arr",
".",
"map",
"(",
"function",
"(",
"obj",
")",
"{",
"var",
"parent",
"=",
"(",
"obj",
".",
"body"... | Handle of create elements
@type {Function}
@param {Array} arr
@param {String} tag - style, link, meta, script, base
@param {String} place - Default 'head'
@param {Boolean} update | [
"Handle",
"of",
"create",
"elements"
] | 0ff9d248cea22191539606e3009ab7591f6c2f11 | https://github.com/ktquez/vue-head/blob/0ff9d248cea22191539606e3009ab7591f6c2f11/vue-head.js#L142-L163 | |
13,189 | ktquez/vue-head | vue-head.js | VueHead | function VueHead (Vue, options) {
if (installed) return
installed = true
if (options) {
Vue.util.extend(opt, options)
}
/**
* Initializes and updates the elements in the head
* @param {Boolean} update
*/
function init (update) {
var self = this
var head = (ty... | javascript | function VueHead (Vue, options) {
if (installed) return
installed = true
if (options) {
Vue.util.extend(opt, options)
}
/**
* Initializes and updates the elements in the head
* @param {Boolean} update
*/
function init (update) {
var self = this
var head = (ty... | [
"function",
"VueHead",
"(",
"Vue",
",",
"options",
")",
"{",
"if",
"(",
"installed",
")",
"return",
"installed",
"=",
"true",
"if",
"(",
"options",
")",
"{",
"Vue",
".",
"util",
".",
"extend",
"(",
"opt",
",",
"options",
")",
"}",
"/**\n * Initiali... | Plugin | vue-head
@param {Function} Vue
@param {Object} options | [
"Plugin",
"|",
"vue",
"-",
"head"
] | 0ff9d248cea22191539606e3009ab7591f6c2f11 | https://github.com/ktquez/vue-head/blob/0ff9d248cea22191539606e3009ab7591f6c2f11/vue-head.js#L171-L245 |
13,190 | ktquez/vue-head | vue-head.js | init | function init (update) {
var self = this
var head = (typeof self.$options.head === 'function') ? self.$options.head.bind(self)() : self.$options.head
if (!head) return
Object.keys(head).map(function (key) {
var prop = head[key]
if (!prop) return
var obj = (typeof prop ===... | javascript | function init (update) {
var self = this
var head = (typeof self.$options.head === 'function') ? self.$options.head.bind(self)() : self.$options.head
if (!head) return
Object.keys(head).map(function (key) {
var prop = head[key]
if (!prop) return
var obj = (typeof prop ===... | [
"function",
"init",
"(",
"update",
")",
"{",
"var",
"self",
"=",
"this",
"var",
"head",
"=",
"(",
"typeof",
"self",
".",
"$options",
".",
"head",
"===",
"'function'",
")",
"?",
"self",
".",
"$options",
".",
"head",
".",
"bind",
"(",
"self",
")",
"(... | Initializes and updates the elements in the head
@param {Boolean} update | [
"Initializes",
"and",
"updates",
"the",
"elements",
"in",
"the",
"head"
] | 0ff9d248cea22191539606e3009ab7591f6c2f11 | https://github.com/ktquez/vue-head/blob/0ff9d248cea22191539606e3009ab7591f6c2f11/vue-head.js#L184-L199 |
13,191 | C2FO/fast-csv | lib/formatter/formatter.js | gatherHeaders | function gatherHeaders(item) {
var ret, i, l;
if (isHashArray(item)) {
//lets assume a multidimesional array with item 0 bing the title
i = -1;
l = item.length;
ret = [];
while (++i < l) {
ret[i] = item[i][0];
}
} else if (isArray(item)) {
... | javascript | function gatherHeaders(item) {
var ret, i, l;
if (isHashArray(item)) {
//lets assume a multidimesional array with item 0 bing the title
i = -1;
l = item.length;
ret = [];
while (++i < l) {
ret[i] = item[i][0];
}
} else if (isArray(item)) {
... | [
"function",
"gatherHeaders",
"(",
"item",
")",
"{",
"var",
"ret",
",",
"i",
",",
"l",
";",
"if",
"(",
"isHashArray",
"(",
"item",
")",
")",
"{",
"//lets assume a multidimesional array with item 0 bing the title",
"i",
"=",
"-",
"1",
";",
"l",
"=",
"item",
... | get headers from a row item | [
"get",
"headers",
"from",
"a",
"row",
"item"
] | d4e33a2b5397afe188a08df01a1a3562efe8e3a1 | https://github.com/C2FO/fast-csv/blob/d4e33a2b5397afe188a08df01a1a3562efe8e3a1/lib/formatter/formatter.js#L104-L120 |
13,192 | C2FO/fast-csv | lib/formatter/formatter.js | transformHashData | function transformHashData(stream, item) {
var vals = [], row = [], headers = stream.headers, i = -1, headersLength = stream.headersLength;
if (stream.totalCount++) {
row.push(stream.rowDelimiter);
}
while (++i < headersLength) {
vals[i] = item[headers[i]];
}
row.push(stream.form... | javascript | function transformHashData(stream, item) {
var vals = [], row = [], headers = stream.headers, i = -1, headersLength = stream.headersLength;
if (stream.totalCount++) {
row.push(stream.rowDelimiter);
}
while (++i < headersLength) {
vals[i] = item[headers[i]];
}
row.push(stream.form... | [
"function",
"transformHashData",
"(",
"stream",
",",
"item",
")",
"{",
"var",
"vals",
"=",
"[",
"]",
",",
"row",
"=",
"[",
"]",
",",
"headers",
"=",
"stream",
".",
"headers",
",",
"i",
"=",
"-",
"1",
",",
"headersLength",
"=",
"stream",
".",
"heade... | transform an object into a CSV row | [
"transform",
"an",
"object",
"into",
"a",
"CSV",
"row"
] | d4e33a2b5397afe188a08df01a1a3562efe8e3a1 | https://github.com/C2FO/fast-csv/blob/d4e33a2b5397afe188a08df01a1a3562efe8e3a1/lib/formatter/formatter.js#L141-L151 |
13,193 | C2FO/fast-csv | lib/formatter/formatter.js | transformArrayData | function transformArrayData(stream, item, cb) {
var row = [];
if (stream.totalCount++) {
row.push(stream.rowDelimiter);
}
row.push(stream.formatter(item));
return row.join("");
} | javascript | function transformArrayData(stream, item, cb) {
var row = [];
if (stream.totalCount++) {
row.push(stream.rowDelimiter);
}
row.push(stream.formatter(item));
return row.join("");
} | [
"function",
"transformArrayData",
"(",
"stream",
",",
"item",
",",
"cb",
")",
"{",
"var",
"row",
"=",
"[",
"]",
";",
"if",
"(",
"stream",
".",
"totalCount",
"++",
")",
"{",
"row",
".",
"push",
"(",
"stream",
".",
"rowDelimiter",
")",
";",
"}",
"row... | transform an array into a CSV row | [
"transform",
"an",
"array",
"into",
"a",
"CSV",
"row"
] | d4e33a2b5397afe188a08df01a1a3562efe8e3a1 | https://github.com/C2FO/fast-csv/blob/d4e33a2b5397afe188a08df01a1a3562efe8e3a1/lib/formatter/formatter.js#L154-L161 |
13,194 | C2FO/fast-csv | lib/formatter/formatter.js | transformHashArrayData | function transformHashArrayData(stream, item) {
var vals = [], row = [], i = -1, headersLength = stream.headersLength;
if (stream.totalCount++) {
row.push(stream.rowDelimiter);
}
while (++i < headersLength) {
vals[i] = item[i][1];
}
row.push(stream.formatter(vals));
return ro... | javascript | function transformHashArrayData(stream, item) {
var vals = [], row = [], i = -1, headersLength = stream.headersLength;
if (stream.totalCount++) {
row.push(stream.rowDelimiter);
}
while (++i < headersLength) {
vals[i] = item[i][1];
}
row.push(stream.formatter(vals));
return ro... | [
"function",
"transformHashArrayData",
"(",
"stream",
",",
"item",
")",
"{",
"var",
"vals",
"=",
"[",
"]",
",",
"row",
"=",
"[",
"]",
",",
"i",
"=",
"-",
"1",
",",
"headersLength",
"=",
"stream",
".",
"headersLength",
";",
"if",
"(",
"stream",
".",
... | transform an array of two item arrays into a CSV row | [
"transform",
"an",
"array",
"of",
"two",
"item",
"arrays",
"into",
"a",
"CSV",
"row"
] | d4e33a2b5397afe188a08df01a1a3562efe8e3a1 | https://github.com/C2FO/fast-csv/blob/d4e33a2b5397afe188a08df01a1a3562efe8e3a1/lib/formatter/formatter.js#L164-L174 |
13,195 | C2FO/fast-csv | lib/formatter/formatter.js | transformItem | function transformItem(stream, item) {
var ret;
if (isArray(item)) {
if (isHashArray(item)) {
ret = transformHashArrayData(stream, item);
} else {
ret = transformArrayData(stream, item);
}
} else {
ret = transformHashData(stream, item);
}
retur... | javascript | function transformItem(stream, item) {
var ret;
if (isArray(item)) {
if (isHashArray(item)) {
ret = transformHashArrayData(stream, item);
} else {
ret = transformArrayData(stream, item);
}
} else {
ret = transformHashData(stream, item);
}
retur... | [
"function",
"transformItem",
"(",
"stream",
",",
"item",
")",
"{",
"var",
"ret",
";",
"if",
"(",
"isArray",
"(",
"item",
")",
")",
"{",
"if",
"(",
"isHashArray",
"(",
"item",
")",
")",
"{",
"ret",
"=",
"transformHashArrayData",
"(",
"stream",
",",
"i... | wrapper to determin what transform to run | [
"wrapper",
"to",
"determin",
"what",
"transform",
"to",
"run"
] | d4e33a2b5397afe188a08df01a1a3562efe8e3a1 | https://github.com/C2FO/fast-csv/blob/d4e33a2b5397afe188a08df01a1a3562efe8e3a1/lib/formatter/formatter.js#L177-L189 |
13,196 | andybelldesign/beedle | bundler.js | bundleJavaScript | async function bundleJavaScript() {
const bundle = await rollup.rollup({
input: `${__dirname}/src/beedle.js`,
plugins: [
uglify()
]
});
await bundle.write({
format: 'umd',
name: 'beedle',
file: 'beedle.js',
dir: `${__dirname}/dist/`,
}... | javascript | async function bundleJavaScript() {
const bundle = await rollup.rollup({
input: `${__dirname}/src/beedle.js`,
plugins: [
uglify()
]
});
await bundle.write({
format: 'umd',
name: 'beedle',
file: 'beedle.js',
dir: `${__dirname}/dist/`,
}... | [
"async",
"function",
"bundleJavaScript",
"(",
")",
"{",
"const",
"bundle",
"=",
"await",
"rollup",
".",
"rollup",
"(",
"{",
"input",
":",
"`",
"${",
"__dirname",
"}",
"`",
",",
"plugins",
":",
"[",
"uglify",
"(",
")",
"]",
"}",
")",
";",
"await",
"... | Bundle the JavaScript components together and smoosh them with uglify | [
"Bundle",
"the",
"JavaScript",
"components",
"together",
"and",
"smoosh",
"them",
"with",
"uglify"
] | 84f02075a8c144bfdbb877d7b615487807c742cb | https://github.com/andybelldesign/beedle/blob/84f02075a8c144bfdbb877d7b615487807c742cb/bundler.js#L7-L21 |
13,197 | posthtml/posthtml | lib/index.js | _next | function _next (res) {
if (res && !options.skipParse) {
res = [].concat(res)
}
return next(res || result, cb)
} | javascript | function _next (res) {
if (res && !options.skipParse) {
res = [].concat(res)
}
return next(res || result, cb)
} | [
"function",
"_next",
"(",
"res",
")",
"{",
"if",
"(",
"res",
"&&",
"!",
"options",
".",
"skipParse",
")",
"{",
"res",
"=",
"[",
"]",
".",
"concat",
"(",
"res",
")",
"}",
"return",
"next",
"(",
"res",
"||",
"result",
",",
"cb",
")",
"}"
] | little helper to go to the next iteration | [
"little",
"helper",
"to",
"go",
"to",
"the",
"next",
"iteration"
] | 881d4a5b170109789a5245a379229afb4793e21a | https://github.com/posthtml/posthtml/blob/881d4a5b170109789a5245a379229afb4793e21a/lib/index.js#L165-L171 |
13,198 | posthtml/posthtml | lib/index.js | lazyResult | function lazyResult (render, tree) {
return {
get html () {
return render(tree, tree.options)
},
tree: tree,
messages: tree.messages
}
} | javascript | function lazyResult (render, tree) {
return {
get html () {
return render(tree, tree.options)
},
tree: tree,
messages: tree.messages
}
} | [
"function",
"lazyResult",
"(",
"render",
",",
"tree",
")",
"{",
"return",
"{",
"get",
"html",
"(",
")",
"{",
"return",
"render",
"(",
"tree",
",",
"tree",
".",
"options",
")",
"}",
",",
"tree",
":",
"tree",
",",
"messages",
":",
"tree",
".",
"messa... | Wraps the PostHTMLTree within an object using a getter to render HTML on demand.
@private
@param {Function} render
@param {Array} tree
@returns {Object<{html: String, tree: Array}>} | [
"Wraps",
"the",
"PostHTMLTree",
"within",
"an",
"object",
"using",
"a",
"getter",
"to",
"render",
"HTML",
"on",
"demand",
"."
] | 881d4a5b170109789a5245a379229afb4793e21a | https://github.com/posthtml/posthtml/blob/881d4a5b170109789a5245a379229afb4793e21a/lib/index.js#L286-L294 |
13,199 | posthtml/posthtml | lib/api.js | match | function match (expression, cb) {
return Array.isArray(expression)
? traverse(this, function (node) {
for (var i = 0; i < expression.length; i++) {
if (compare(expression[i], node)) return cb(node)
}
return node
})
: traverse(this, function (node) {
if (compare(expression,... | javascript | function match (expression, cb) {
return Array.isArray(expression)
? traverse(this, function (node) {
for (var i = 0; i < expression.length; i++) {
if (compare(expression[i], node)) return cb(node)
}
return node
})
: traverse(this, function (node) {
if (compare(expression,... | [
"function",
"match",
"(",
"expression",
",",
"cb",
")",
"{",
"return",
"Array",
".",
"isArray",
"(",
"expression",
")",
"?",
"traverse",
"(",
"this",
",",
"function",
"(",
"node",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"expressi... | Matches an expression to search for nodes in the tree
@memberof tree
@param {String|RegExp|Object|Array} expression - Matcher(s) to search
@param {Function} cb Callback
@return {Function} Callback(node)
@example
```js
export const match = (tree) => {
// Single matcher
tree.match({ tag: 'custom-tag' }, (node) => {... | [
"Matches",
"an",
"expression",
"to",
"search",
"for",
"nodes",
"in",
"the",
"tree"
] | 881d4a5b170109789a5245a379229afb4793e21a | https://github.com/posthtml/posthtml/blob/881d4a5b170109789a5245a379229afb4793e21a/lib/api.js#L81-L95 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.