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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
43,300 | insin/redux-action-utils | lib/index.js | optionsActionCreator | function optionsActionCreator(type) {
var props = Array.isArray(arguments[1]) ? arguments[1] : slice.call(arguments, 1)
return function(options) {
var copyProps = props.length === 0 ? Object.keys(options) : props
return copyProps.reduce(function(action, prop) {
return (action[prop] = options[prop], ac... | javascript | function optionsActionCreator(type) {
var props = Array.isArray(arguments[1]) ? arguments[1] : slice.call(arguments, 1)
return function(options) {
var copyProps = props.length === 0 ? Object.keys(options) : props
return copyProps.reduce(function(action, prop) {
return (action[prop] = options[prop], ac... | [
"function",
"optionsActionCreator",
"(",
"type",
")",
"{",
"var",
"props",
"=",
"Array",
".",
"isArray",
"(",
"arguments",
"[",
"1",
"]",
")",
"?",
"arguments",
"[",
"1",
"]",
":",
"slice",
".",
"call",
"(",
"arguments",
",",
"1",
")",
"return",
"fun... | Creates an action creator for the given action type which also takes an
options object argument, which will either have all of its properties
or only specified properties added to the action object.
Property names can be specified as an Array of strings or as any number of
addiitonal String arguments. | [
"Creates",
"an",
"action",
"creator",
"for",
"the",
"given",
"action",
"type",
"which",
"also",
"takes",
"an",
"options",
"object",
"argument",
"which",
"will",
"either",
"have",
"all",
"of",
"its",
"properties",
"or",
"only",
"specified",
"properties",
"added... | 10a0464815751355fb9d43281cf5e41a9a65d1ae | https://github.com/insin/redux-action-utils/blob/10a0464815751355fb9d43281cf5e41a9a65d1ae/lib/index.js#L35-L43 |
43,301 | alexindigo/fbbot | incoming/type_cast.js | typeCast | function typeCast(payload, callback)
{
var type = find(types, function(t){ return (t in payload); });
if (type)
{
payload.type = normalize(type);
}
callback(null, payload);
} | javascript | function typeCast(payload, callback)
{
var type = find(types, function(t){ return (t in payload); });
if (type)
{
payload.type = normalize(type);
}
callback(null, payload);
} | [
"function",
"typeCast",
"(",
"payload",
",",
"callback",
")",
"{",
"var",
"type",
"=",
"find",
"(",
"types",
",",
"function",
"(",
"t",
")",
"{",
"return",
"(",
"t",
"in",
"payload",
")",
";",
"}",
")",
";",
"if",
"(",
"type",
")",
"{",
"payload"... | Casts message type based on the present fields from the list
@this Fbbot#
@param {object} payload - message object
@param {function} callback - invoked after type casting is done | [
"Casts",
"message",
"type",
"based",
"on",
"the",
"present",
"fields",
"from",
"the",
"list"
] | b78a0418ebdfd106723348d94b4378ac67f7d4bf | https://github.com/alexindigo/fbbot/blob/b78a0418ebdfd106723348d94b4378ac67f7d4bf/incoming/type_cast.js#L32-L42 |
43,302 | alexindigo/fbbot | outgoing/button_postback.js | buttonPostback | function buttonPostback(payload, callback)
{
if (typeof payload.payload != 'string')
{
payload.payload = JSON.stringify(payload.payload);
}
callback(null, payload);
} | javascript | function buttonPostback(payload, callback)
{
if (typeof payload.payload != 'string')
{
payload.payload = JSON.stringify(payload.payload);
}
callback(null, payload);
} | [
"function",
"buttonPostback",
"(",
"payload",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"payload",
".",
"payload",
"!=",
"'string'",
")",
"{",
"payload",
".",
"payload",
"=",
"JSON",
".",
"stringify",
"(",
"payload",
".",
"payload",
")",
";",
"}",
... | Stringifies provided button.postback payload
@this Fbbot#
@param {object} payload - button.postback object
@param {function} callback - invoked after stringification is done | [
"Stringifies",
"provided",
"button",
".",
"postback",
"payload"
] | b78a0418ebdfd106723348d94b4378ac67f7d4bf | https://github.com/alexindigo/fbbot/blob/b78a0418ebdfd106723348d94b4378ac67f7d4bf/outgoing/button_postback.js#L10-L18 |
43,303 | sean-perkins/ngx-select | examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js | function () {
return {
centered: this.centered,
speedFactor: this.speedFactor * (this._globalOptions.baseSpeedFactor || 1),
radius: this.radius,
color: this.color
};
} | javascript | function () {
return {
centered: this.centered,
speedFactor: this.speedFactor * (this._globalOptions.baseSpeedFactor || 1),
radius: this.radius,
color: this.color
};
} | [
"function",
"(",
")",
"{",
"return",
"{",
"centered",
":",
"this",
".",
"centered",
",",
"speedFactor",
":",
"this",
".",
"speedFactor",
"*",
"(",
"this",
".",
"_globalOptions",
".",
"baseSpeedFactor",
"||",
"1",
")",
",",
"radius",
":",
"this",
".",
"... | Ripple configuration from the directive's input values.
@return {?} | [
"Ripple",
"configuration",
"from",
"the",
"directive",
"s",
"input",
"values",
"."
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js#L7506-L7513 | |
43,304 | sean-perkins/ngx-select | examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js | isNativeFormElement | function isNativeFormElement(element) {
var /** @type {?} */ nodeName = element.nodeName.toLowerCase();
return nodeName === 'input' ||
nodeName === 'select' ||
nodeName === 'button' ||
nodeName === 'textarea';
} | javascript | function isNativeFormElement(element) {
var /** @type {?} */ nodeName = element.nodeName.toLowerCase();
return nodeName === 'input' ||
nodeName === 'select' ||
nodeName === 'button' ||
nodeName === 'textarea';
} | [
"function",
"isNativeFormElement",
"(",
"element",
")",
"{",
"var",
"/** @type {?} */",
"nodeName",
"=",
"element",
".",
"nodeName",
".",
"toLowerCase",
"(",
")",
";",
"return",
"nodeName",
"===",
"'input'",
"||",
"nodeName",
"===",
"'select'",
"||",
"nodeName",... | Gets whether an element's
@param {?} element
@return {?} | [
"Gets",
"whether",
"an",
"element",
"s"
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js#L10082-L10088 |
43,305 | sean-perkins/ngx-select | examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js | hasValidTabIndex | function hasValidTabIndex(element) {
if (!element.hasAttribute('tabindex') || element.tabIndex === undefined) {
return false;
}
var /** @type {?} */ tabIndex = element.getAttribute('tabindex');
// IE11 parses tabindex="" as the value "-32768"
if (tabIndex == '-32768') {
return false;... | javascript | function hasValidTabIndex(element) {
if (!element.hasAttribute('tabindex') || element.tabIndex === undefined) {
return false;
}
var /** @type {?} */ tabIndex = element.getAttribute('tabindex');
// IE11 parses tabindex="" as the value "-32768"
if (tabIndex == '-32768') {
return false;... | [
"function",
"hasValidTabIndex",
"(",
"element",
")",
"{",
"if",
"(",
"!",
"element",
".",
"hasAttribute",
"(",
"'tabindex'",
")",
"||",
"element",
".",
"tabIndex",
"===",
"undefined",
")",
"{",
"return",
"false",
";",
"}",
"var",
"/** @type {?} */",
"tabInde... | Gets whether an element has a valid tabindex.
@param {?} element
@return {?} | [
"Gets",
"whether",
"an",
"element",
"has",
"a",
"valid",
"tabindex",
"."
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js#L10126-L10136 |
43,306 | sean-perkins/ngx-select | examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js | getTabIndexValue | function getTabIndexValue(element) {
if (!hasValidTabIndex(element)) {
return null;
}
// See browser issue in Gecko https://bugzilla.mozilla.org/show_bug.cgi?id=1128054
var /** @type {?} */ tabIndex = parseInt(element.getAttribute('tabindex'), 10);
return isNaN(tabIndex) ? -1 : tabIndex;
} | javascript | function getTabIndexValue(element) {
if (!hasValidTabIndex(element)) {
return null;
}
// See browser issue in Gecko https://bugzilla.mozilla.org/show_bug.cgi?id=1128054
var /** @type {?} */ tabIndex = parseInt(element.getAttribute('tabindex'), 10);
return isNaN(tabIndex) ? -1 : tabIndex;
} | [
"function",
"getTabIndexValue",
"(",
"element",
")",
"{",
"if",
"(",
"!",
"hasValidTabIndex",
"(",
"element",
")",
")",
"{",
"return",
"null",
";",
"}",
"// See browser issue in Gecko https://bugzilla.mozilla.org/show_bug.cgi?id=1128054",
"var",
"/** @type {?} */",
"tabIn... | Returns the parsed tabindex from the element attributes instead of returning the
evaluated tabindex from the browsers defaults.
@param {?} element
@return {?} | [
"Returns",
"the",
"parsed",
"tabindex",
"from",
"the",
"element",
"attributes",
"instead",
"of",
"returning",
"the",
"evaluated",
"tabindex",
"from",
"the",
"browsers",
"defaults",
"."
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js#L10143-L10150 |
43,307 | sean-perkins/ngx-select | examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js | isPotentiallyTabbableIOS | function isPotentiallyTabbableIOS(element) {
var /** @type {?} */ nodeName = element.nodeName.toLowerCase();
var /** @type {?} */ inputType = nodeName === 'input' && ((element)).type;
return inputType === 'text'
|| inputType === 'password'
|| nodeName === 'select'
|| nodeName === 'te... | javascript | function isPotentiallyTabbableIOS(element) {
var /** @type {?} */ nodeName = element.nodeName.toLowerCase();
var /** @type {?} */ inputType = nodeName === 'input' && ((element)).type;
return inputType === 'text'
|| inputType === 'password'
|| nodeName === 'select'
|| nodeName === 'te... | [
"function",
"isPotentiallyTabbableIOS",
"(",
"element",
")",
"{",
"var",
"/** @type {?} */",
"nodeName",
"=",
"element",
".",
"nodeName",
".",
"toLowerCase",
"(",
")",
";",
"var",
"/** @type {?} */",
"inputType",
"=",
"nodeName",
"===",
"'input'",
"&&",
"(",
"("... | Checks whether the specified element is potentially tabbable on iOS
@param {?} element
@return {?} | [
"Checks",
"whether",
"the",
"specified",
"element",
"is",
"potentially",
"tabbable",
"on",
"iOS"
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js#L10156-L10163 |
43,308 | sean-perkins/ngx-select | examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js | applyCssTransform | function applyCssTransform(element, transformValue) {
// It's important to trim the result, because the browser will ignore the set operation
// if the string contains only whitespace.
var /** @type {?} */ value = transformValue.trim();
element.style.transform = value;
element.style.webkitTransform ... | javascript | function applyCssTransform(element, transformValue) {
// It's important to trim the result, because the browser will ignore the set operation
// if the string contains only whitespace.
var /** @type {?} */ value = transformValue.trim();
element.style.transform = value;
element.style.webkitTransform ... | [
"function",
"applyCssTransform",
"(",
"element",
",",
"transformValue",
")",
"{",
"// It's important to trim the result, because the browser will ignore the set operation",
"// if the string contains only whitespace.",
"var",
"/** @type {?} */",
"value",
"=",
"transformValue",
".",
"... | Applies a CSS transform to an element, including browser-prefixed properties.
@param {?} element
@param {?} transformValue
@return {?} | [
"Applies",
"a",
"CSS",
"transform",
"to",
"an",
"element",
"including",
"browser",
"-",
"prefixed",
"properties",
"."
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js#L11384-L11390 |
43,309 | sean-perkins/ngx-select | examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js | function () {
if (this._multiple) {
var /** @type {?} */ selectedOptions = this._selectionModel.selected.map(function (option) { return option.viewValue; });
if (this._isRtl()) {
selectedOptions.reverse();
}
// TODO(crisbeto... | javascript | function () {
if (this._multiple) {
var /** @type {?} */ selectedOptions = this._selectionModel.selected.map(function (option) { return option.viewValue; });
if (this._isRtl()) {
selectedOptions.reverse();
}
// TODO(crisbeto... | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"_multiple",
")",
"{",
"var",
"/** @type {?} */",
"selectedOptions",
"=",
"this",
".",
"_selectionModel",
".",
"selected",
".",
"map",
"(",
"function",
"(",
"option",
")",
"{",
"return",
"option",
".",
"... | The value displayed in the trigger.
@return {?} | [
"The",
"value",
"displayed",
"in",
"the",
"trigger",
"."
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js#L14285-L14295 | |
43,310 | sean-perkins/ngx-select | examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js | function () {
var /** @type {?} */ axis = this.vertical ? 'Y' : 'X';
// For a horizontal slider in RTL languages we push the ticks container off the left edge
// instead of the right edge to avoid causing a horizontal scrollbar to appear.
var /** @type {?} */ sign = !this... | javascript | function () {
var /** @type {?} */ axis = this.vertical ? 'Y' : 'X';
// For a horizontal slider in RTL languages we push the ticks container off the left edge
// instead of the right edge to avoid causing a horizontal scrollbar to appear.
var /** @type {?} */ sign = !this... | [
"function",
"(",
")",
"{",
"var",
"/** @type {?} */",
"axis",
"=",
"this",
".",
"vertical",
"?",
"'Y'",
":",
"'X'",
";",
"// For a horizontal slider in RTL languages we push the ticks container off the left edge",
"// instead of the right edge to avoid causing a horizontal scrollba... | CSS styles for the ticks container element.
@return {?} | [
"CSS",
"styles",
"for",
"the",
"ticks",
"container",
"element",
"."
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js#L15727-L15736 | |
43,311 | sean-perkins/ngx-select | examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js | function () {
var /** @type {?} */ tickSize = this._tickIntervalPercent * 100;
var /** @type {?} */ backgroundSize = this.vertical ? "2px " + tickSize + "%" : tickSize + "% 2px";
var /** @type {?} */ axis = this.vertical ? 'Y' : 'X';
// Depending on the direction we pushe... | javascript | function () {
var /** @type {?} */ tickSize = this._tickIntervalPercent * 100;
var /** @type {?} */ backgroundSize = this.vertical ? "2px " + tickSize + "%" : tickSize + "% 2px";
var /** @type {?} */ axis = this.vertical ? 'Y' : 'X';
// Depending on the direction we pushe... | [
"function",
"(",
")",
"{",
"var",
"/** @type {?} */",
"tickSize",
"=",
"this",
".",
"_tickIntervalPercent",
"*",
"100",
";",
"var",
"/** @type {?} */",
"backgroundSize",
"=",
"this",
".",
"vertical",
"?",
"\"2px \"",
"+",
"tickSize",
"+",
"\"%\"",
":",
"tickSi... | CSS styles for the ticks element.
@return {?} | [
"CSS",
"styles",
"for",
"the",
"ticks",
"element",
"."
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js#L15745-L15766 | |
43,312 | sean-perkins/ngx-select | examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js | polarToCartesian | function polarToCartesian(radius, pathRadius, angleInDegrees) {
var /** @type {?} */ angleInRadians = (angleInDegrees - 90) * DEGREE_IN_RADIANS;
return (radius + (pathRadius * Math.cos(angleInRadians))) +
',' + (radius + (pathRadius * Math.sin(angleInRadians)));
} | javascript | function polarToCartesian(radius, pathRadius, angleInDegrees) {
var /** @type {?} */ angleInRadians = (angleInDegrees - 90) * DEGREE_IN_RADIANS;
return (radius + (pathRadius * Math.cos(angleInRadians))) +
',' + (radius + (pathRadius * Math.sin(angleInRadians)));
} | [
"function",
"polarToCartesian",
"(",
"radius",
",",
"pathRadius",
",",
"angleInDegrees",
")",
"{",
"var",
"/** @type {?} */",
"angleInRadians",
"=",
"(",
"angleInDegrees",
"-",
"90",
")",
"*",
"DEGREE_IN_RADIANS",
";",
"return",
"(",
"radius",
"+",
"(",
"pathRad... | Converts Polar coordinates to Cartesian.
@param {?} radius
@param {?} pathRadius
@param {?} angleInDegrees
@return {?} | [
"Converts",
"Polar",
"coordinates",
"to",
"Cartesian",
"."
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js#L19950-L19954 |
43,313 | sean-perkins/ngx-select | examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js | materialEase | function materialEase(currentTime, startValue, changeInValue, duration) {
var /** @type {?} */ time = currentTime / duration;
var /** @type {?} */ timeCubed = Math.pow(time, 3);
var /** @type {?} */ timeQuad = Math.pow(time, 4);
var /** @type {?} */ timeQuint = Math.pow(time, 5);
return startValue +... | javascript | function materialEase(currentTime, startValue, changeInValue, duration) {
var /** @type {?} */ time = currentTime / duration;
var /** @type {?} */ timeCubed = Math.pow(time, 3);
var /** @type {?} */ timeQuad = Math.pow(time, 4);
var /** @type {?} */ timeQuint = Math.pow(time, 5);
return startValue +... | [
"function",
"materialEase",
"(",
"currentTime",
",",
"startValue",
",",
"changeInValue",
",",
"duration",
")",
"{",
"var",
"/** @type {?} */",
"time",
"=",
"currentTime",
"/",
"duration",
";",
"var",
"/** @type {?} */",
"timeCubed",
"=",
"Math",
".",
"pow",
"(",... | Easing function to match material design indeterminate animation.
@param {?} currentTime
@param {?} startValue
@param {?} changeInValue
@param {?} duration
@return {?} | [
"Easing",
"function",
"to",
"match",
"material",
"design",
"indeterminate",
"animation",
"."
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js#L19974-L19980 |
43,314 | sean-perkins/ngx-select | examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js | getSvgArc | function getSvgArc(currentValue, rotation) {
var /** @type {?} */ startPoint = rotation || 0;
var /** @type {?} */ radius = 50;
var /** @type {?} */ pathRadius = 40;
var /** @type {?} */ startAngle = startPoint * MAX_ANGLE;
var /** @type {?} */ endAngle = currentValue * MAX_ANGLE;
var /** @type ... | javascript | function getSvgArc(currentValue, rotation) {
var /** @type {?} */ startPoint = rotation || 0;
var /** @type {?} */ radius = 50;
var /** @type {?} */ pathRadius = 40;
var /** @type {?} */ startAngle = startPoint * MAX_ANGLE;
var /** @type {?} */ endAngle = currentValue * MAX_ANGLE;
var /** @type ... | [
"function",
"getSvgArc",
"(",
"currentValue",
",",
"rotation",
")",
"{",
"var",
"/** @type {?} */",
"startPoint",
"=",
"rotation",
"||",
"0",
";",
"var",
"/** @type {?} */",
"radius",
"=",
"50",
";",
"var",
"/** @type {?} */",
"pathRadius",
"=",
"40",
";",
"va... | Determines the path value to define the arc. Converting percentage values to to polar
coordinates on the circle, and then to cartesian coordinates in the viewport.
@param {?} currentValue The current percentage value of the progress circle, the percentage of the
circle to fill.
@param {?} rotation The starting point ... | [
"Determines",
"the",
"path",
"value",
"to",
"define",
"the",
"arc",
".",
"Converting",
"percentage",
"values",
"to",
"to",
"polar",
"coordinates",
"on",
"the",
"circle",
"and",
"then",
"to",
"cartesian",
"coordinates",
"in",
"the",
"viewport",
"."
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js#L19991-L20008 |
43,315 | sean-perkins/ngx-select | examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js | clamp$1 | function clamp$1(v, min, max) {
if (min === void 0) { min = 0; }
if (max === void 0) { max = 100; }
return Math.max(min, Math.min(max, v));
} | javascript | function clamp$1(v, min, max) {
if (min === void 0) { min = 0; }
if (max === void 0) { max = 100; }
return Math.max(min, Math.min(max, v));
} | [
"function",
"clamp$1",
"(",
"v",
",",
"min",
",",
"max",
")",
"{",
"if",
"(",
"min",
"===",
"void",
"0",
")",
"{",
"min",
"=",
"0",
";",
"}",
"if",
"(",
"max",
"===",
"void",
"0",
")",
"{",
"max",
"=",
"100",
";",
"}",
"return",
"Math",
"."... | Clamps a value to be between two numbers, by default 0 and 100.
@param {?} v
@param {?=} min
@param {?=} max
@return {?} | [
"Clamps",
"a",
"value",
"to",
"be",
"between",
"two",
"numbers",
"by",
"default",
"0",
"and",
"100",
"."
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js#L20144-L20148 |
43,316 | sean-perkins/ngx-select | examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js | function (origin) {
if (origin == null) {
return;
}
var /** @type {?} */ dir = this._getLayoutDirection();
if ((dir == 'ltr' && origin <= 0) || (dir == 'rtl' && origin > 0)) {
this._origin = 'left';
}
else {
... | javascript | function (origin) {
if (origin == null) {
return;
}
var /** @type {?} */ dir = this._getLayoutDirection();
if ((dir == 'ltr' && origin <= 0) || (dir == 'rtl' && origin > 0)) {
this._origin = 'left';
}
else {
... | [
"function",
"(",
"origin",
")",
"{",
"if",
"(",
"origin",
"==",
"null",
")",
"{",
"return",
";",
"}",
"var",
"/** @type {?} */",
"dir",
"=",
"this",
".",
"_getLayoutDirection",
"(",
")",
";",
"if",
"(",
"(",
"dir",
"==",
"'ltr'",
"&&",
"origin",
"<="... | The origin position from which this tab should appear when it is centered into view.
@param {?} origin
@return {?} | [
"The",
"origin",
"position",
"from",
"which",
"this",
"tab",
"should",
"appear",
"when",
"it",
"is",
"centered",
"into",
"view",
"."
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js#L22255-L22266 | |
43,317 | sean-perkins/ngx-select | examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js | function (value) {
if (!this._isValidIndex(value) || this._focusIndex == value) {
return;
}
this._focusIndex = value;
this.indexFocused.emit(value);
this._setTabFocus(value);
} | javascript | function (value) {
if (!this._isValidIndex(value) || this._focusIndex == value) {
return;
}
this._focusIndex = value;
this.indexFocused.emit(value);
this._setTabFocus(value);
} | [
"function",
"(",
"value",
")",
"{",
"if",
"(",
"!",
"this",
".",
"_isValidIndex",
"(",
"value",
")",
"||",
"this",
".",
"_focusIndex",
"==",
"value",
")",
"{",
"return",
";",
"}",
"this",
".",
"_focusIndex",
"=",
"value",
";",
"this",
".",
"indexFocu... | When the focus index is set, we must manually send focus to the correct label
@param {?} value
@return {?} | [
"When",
"the",
"focus",
"index",
"is",
"set",
"we",
"must",
"manually",
"send",
"focus",
"to",
"the",
"correct",
"label"
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js#L22538-L22545 | |
43,318 | sean-perkins/ngx-select | examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js | function (v) {
this._scrollDistance = Math.max(0, Math.min(this._getMaxScrollDistance(), v));
// Mark that the scroll distance has changed so that after the view is checked, the CSS
// transformation can move the header.
this._scrollDistanceChanged = true;
thi... | javascript | function (v) {
this._scrollDistance = Math.max(0, Math.min(this._getMaxScrollDistance(), v));
// Mark that the scroll distance has changed so that after the view is checked, the CSS
// transformation can move the header.
this._scrollDistanceChanged = true;
thi... | [
"function",
"(",
"v",
")",
"{",
"this",
".",
"_scrollDistance",
"=",
"Math",
".",
"max",
"(",
"0",
",",
"Math",
".",
"min",
"(",
"this",
".",
"_getMaxScrollDistance",
"(",
")",
",",
"v",
")",
")",
";",
"// Mark that the scroll distance has changed so that af... | Sets the distance in pixels that the tab header should be transformed in the X-axis.
@param {?} v
@return {?} | [
"Sets",
"the",
"distance",
"in",
"pixels",
"that",
"the",
"tab",
"header",
"should",
"be",
"transformed",
"in",
"the",
"X",
"-",
"axis",
"."
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js#L22646-L22652 | |
43,319 | sean-perkins/ngx-select | examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js | function (classes) {
this._classList = classes.split(' ').reduce(function (obj, className) {
obj[className] = true;
return obj;
}, {});
this.setPositionClasses(this.positionX, this.positionY);
} | javascript | function (classes) {
this._classList = classes.split(' ').reduce(function (obj, className) {
obj[className] = true;
return obj;
}, {});
this.setPositionClasses(this.positionX, this.positionY);
} | [
"function",
"(",
"classes",
")",
"{",
"this",
".",
"_classList",
"=",
"classes",
".",
"split",
"(",
"' '",
")",
".",
"reduce",
"(",
"function",
"(",
"obj",
",",
"className",
")",
"{",
"obj",
"[",
"className",
"]",
"=",
"true",
";",
"return",
"obj",
... | This method takes classes set on the host md-menu element and applies them on the
menu template that displays in the overlay container. Otherwise, it's difficult
to style the containing menu from outside the component.
@param {?} classes list of class names
@return {?} | [
"This",
"method",
"takes",
"classes",
"set",
"on",
"the",
"host",
"md",
"-",
"menu",
"element",
"and",
"applies",
"them",
"on",
"the",
"menu",
"template",
"that",
"displays",
"in",
"the",
"overlay",
"container",
".",
"Otherwise",
"it",
"s",
"difficult",
"t... | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js#L23796-L23802 | |
43,320 | sean-perkins/ngx-select | examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js | function () {
return __WEBPACK_IMPORTED_MODULE_4_rxjs_Observable__["Observable"].merge.apply(__WEBPACK_IMPORTED_MODULE_4_rxjs_Observable__["Observable"], this.autocomplete.options.map(function (option) { return option.onSelectionChange; }));
} | javascript | function () {
return __WEBPACK_IMPORTED_MODULE_4_rxjs_Observable__["Observable"].merge.apply(__WEBPACK_IMPORTED_MODULE_4_rxjs_Observable__["Observable"], this.autocomplete.options.map(function (option) { return option.onSelectionChange; }));
} | [
"function",
"(",
")",
"{",
"return",
"__WEBPACK_IMPORTED_MODULE_4_rxjs_Observable__",
"[",
"\"Observable\"",
"]",
".",
"merge",
".",
"apply",
"(",
"__WEBPACK_IMPORTED_MODULE_4_rxjs_Observable__",
"[",
"\"Observable\"",
"]",
",",
"this",
".",
"autocomplete",
".",
"option... | Stream of autocomplete option selections.
@return {?} | [
"Stream",
"of",
"autocomplete",
"option",
"selections",
"."
] | 27eb48f8e49cdaeb4e79937e58e7b16e43e7e390 | https://github.com/sean-perkins/ngx-select/blob/27eb48f8e49cdaeb4e79937e58e7b16e43e7e390/examples/webpack/dist/0.e100c23eefa4ef71b346.chunk.js#L25105-L25107 | |
43,321 | alexindigo/fbbot | lib/verify_endpoint.js | verifyEndpoint | function verifyEndpoint(request, respond)
{
var challenge;
if (typeof request.query == 'string')
{
request.query = qs.parse(request.query);
}
if (typeof request.query == 'object'
&& ((request.query['hub.verify_token'] === this.credentials.secret)
// for hapi@10 and restify/express with query... | javascript | function verifyEndpoint(request, respond)
{
var challenge;
if (typeof request.query == 'string')
{
request.query = qs.parse(request.query);
}
if (typeof request.query == 'object'
&& ((request.query['hub.verify_token'] === this.credentials.secret)
// for hapi@10 and restify/express with query... | [
"function",
"verifyEndpoint",
"(",
"request",
",",
"respond",
")",
"{",
"var",
"challenge",
";",
"if",
"(",
"typeof",
"request",
".",
"query",
"==",
"'string'",
")",
"{",
"request",
".",
"query",
"=",
"qs",
".",
"parse",
"(",
"request",
".",
"query",
"... | Verifies endpoint by replying with the provided challenge
@this Fbbot#
@param {EventEmitter} request - incoming http request object
@param {function} respond - http response function | [
"Verifies",
"endpoint",
"by",
"replying",
"with",
"the",
"provided",
"challenge"
] | b78a0418ebdfd106723348d94b4378ac67f7d4bf | https://github.com/alexindigo/fbbot/blob/b78a0418ebdfd106723348d94b4378ac67f7d4bf/lib/verify_endpoint.js#L12-L37 |
43,322 | yahoo/preceptor | lib/client.js | function (options, send) {
var clientPath = options.clientPath,
coverage = options.coverage,
parentId = options.parentId,
configuration = options.configuration,
globalConfig = options.globalConfig,
decorators = options.decorators,
decoratorPlugins = options.decoratorPlugins,
ClientClass,
clientInstan... | javascript | function (options, send) {
var clientPath = options.clientPath,
coverage = options.coverage,
parentId = options.parentId,
configuration = options.configuration,
globalConfig = options.globalConfig,
decorators = options.decorators,
decoratorPlugins = options.decoratorPlugins,
ClientClass,
clientInstan... | [
"function",
"(",
"options",
",",
"send",
")",
"{",
"var",
"clientPath",
"=",
"options",
".",
"clientPath",
",",
"coverage",
"=",
"options",
".",
"coverage",
",",
"parentId",
"=",
"options",
".",
"parentId",
",",
"configuration",
"=",
"options",
".",
"confi... | Runs the client
@class Client
@method run
@param {object} options
@param {function} send
@private | [
"Runs",
"the",
"client"
] | 061ffeca8751344b06e6768a281cc7a2679fd679 | https://github.com/yahoo/preceptor/blob/061ffeca8751344b06e6768a281cc7a2679fd679/lib/client.js#L18-L107 | |
43,323 | citizenmatt/gitbook-plugin-multipart | index.js | function(summary) {
// If the file contains an h2, we need to reformat it
if (summary.content.match(/^## /m)) {
var parts = summary.content.split(/(?=##)/);
for (var i = 0; i < parts.length; i++) {
// Remove any blank lines
... | javascript | function(summary) {
// If the file contains an h2, we need to reformat it
if (summary.content.match(/^## /m)) {
var parts = summary.content.split(/(?=##)/);
for (var i = 0; i < parts.length; i++) {
// Remove any blank lines
... | [
"function",
"(",
"summary",
")",
"{",
"// If the file contains an h2, we need to reformat it",
"if",
"(",
"summary",
".",
"content",
".",
"match",
"(",
"/",
"^## ",
"/",
"m",
")",
")",
"{",
"var",
"parts",
"=",
"summary",
".",
"content",
".",
"split",
"(",
... | Gets plain text content | [
"Gets",
"plain",
"text",
"content"
] | 6ba8f01d3e83915516d8614e119f0c34390aad96 | https://github.com/citizenmatt/gitbook-plugin-multipart/blob/6ba8f01d3e83915516d8614e119f0c34390aad96/index.js#L10-L32 | |
43,324 | citizenmatt/gitbook-plugin-multipart | index.js | function(page) {
var $ = cheerio.load(page.content);
// Replace top level li.chapter with li.part
$('ul.summary > li.chapter').each(function(i, elem) {
var li = $(elem);
// Replace the classes if the chapter is actually a part, and add a divider
... | javascript | function(page) {
var $ = cheerio.load(page.content);
// Replace top level li.chapter with li.part
$('ul.summary > li.chapter').each(function(i, elem) {
var li = $(elem);
// Replace the classes if the chapter is actually a part, and add a divider
... | [
"function",
"(",
"page",
")",
"{",
"var",
"$",
"=",
"cheerio",
".",
"load",
"(",
"page",
".",
"content",
")",
";",
"// Replace top level li.chapter with li.part",
"$",
"(",
"'ul.summary > li.chapter'",
")",
".",
"each",
"(",
"function",
"(",
"i",
",",
"elem"... | Requires an unhealthy knowledge of the generated template... | [
"Requires",
"an",
"unhealthy",
"knowledge",
"of",
"the",
"generated",
"template",
"..."
] | 6ba8f01d3e83915516d8614e119f0c34390aad96 | https://github.com/citizenmatt/gitbook-plugin-multipart/blob/6ba8f01d3e83915516d8614e119f0c34390aad96/index.js#L35-L80 | |
43,325 | alexindigo/fbbot | index.js | Fbbot | function Fbbot(options)
{
if (!(this instanceof Fbbot)) return new Fbbot(options);
/**
* Custom options per instance
* @type {object}
*/
this.options = merge(Fbbot.defaults, options || {});
/**
* Store credentials
* @type {object}
*/
this.credentials =
{
// keep simple naming for int... | javascript | function Fbbot(options)
{
if (!(this instanceof Fbbot)) return new Fbbot(options);
/**
* Custom options per instance
* @type {object}
*/
this.options = merge(Fbbot.defaults, options || {});
/**
* Store credentials
* @type {object}
*/
this.credentials =
{
// keep simple naming for int... | [
"function",
"Fbbot",
"(",
"options",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Fbbot",
")",
")",
"return",
"new",
"Fbbot",
"(",
"options",
")",
";",
"/**\n * Custom options per instance\n * @type {object}\n */",
"this",
".",
"options",
"=",
"me... | Fbbot instance constructor
@this Fbbot#
@param {object} options - list of customization parameters
@constructor | [
"Fbbot",
"instance",
"constructor"
] | b78a0418ebdfd106723348d94b4378ac67f7d4bf | https://github.com/alexindigo/fbbot/blob/b78a0418ebdfd106723348d94b4378ac67f7d4bf/index.js#L57-L136 |
43,326 | Gambiit/mcp3008.js | nodes/core/hardware/37-mcp3008.js | read | function read(mode,callback) {
if (spi === undefined) {return;};
var txBuf = new Buffer([1,mode,0]);
var rxBuf = new Buffer([0,0,0]);
spi.transfer(txBuf,rxBuf,function(dev,buffer) {
var value = ((buffer[1] & 3)<< 8) + buffer[2];
callback(value);
});
} | javascript | function read(mode,callback) {
if (spi === undefined) {return;};
var txBuf = new Buffer([1,mode,0]);
var rxBuf = new Buffer([0,0,0]);
spi.transfer(txBuf,rxBuf,function(dev,buffer) {
var value = ((buffer[1] & 3)<< 8) + buffer[2];
callback(value);
});
} | [
"function",
"read",
"(",
"mode",
",",
"callback",
")",
"{",
"if",
"(",
"spi",
"===",
"undefined",
")",
"{",
"return",
";",
"}",
";",
"var",
"txBuf",
"=",
"new",
"Buffer",
"(",
"[",
"1",
",",
"mode",
",",
"0",
"]",
")",
";",
"var",
"rxBuf",
"=",... | lit l'interface spi | [
"lit",
"l",
"interface",
"spi"
] | 0d3ea73bce000cb8bd1d10242e427e19ede5745d | https://github.com/Gambiit/mcp3008.js/blob/0d3ea73bce000cb8bd1d10242e427e19ede5745d/nodes/core/hardware/37-mcp3008.js#L31-L40 |
43,327 | ddliu/grunt-push-svn | tasks/push_svn.js | function(callback) {
grunt.log.writeln('Prepare tmp path...');
if (!grunt.file.isDir(tmpPath)) {
if (grunt.file.exists(tmpPath)) {
callback(new Error(util.format('"%s" is not a directory', tmpPath)));
}
else {
grunt.file.mkdir(tmpPath);
c... | javascript | function(callback) {
grunt.log.writeln('Prepare tmp path...');
if (!grunt.file.isDir(tmpPath)) {
if (grunt.file.exists(tmpPath)) {
callback(new Error(util.format('"%s" is not a directory', tmpPath)));
}
else {
grunt.file.mkdir(tmpPath);
c... | [
"function",
"(",
"callback",
")",
"{",
"grunt",
".",
"log",
".",
"writeln",
"(",
"'Prepare tmp path...'",
")",
";",
"if",
"(",
"!",
"grunt",
".",
"file",
".",
"isDir",
"(",
"tmpPath",
")",
")",
"{",
"if",
"(",
"grunt",
".",
"file",
".",
"exists",
"... | make sure tmpPath exists | [
"make",
"sure",
"tmpPath",
"exists"
] | 59dc07216fffaf05712d7a4936f2227435a1badf | https://github.com/ddliu/grunt-push-svn/blob/59dc07216fffaf05712d7a4936f2227435a1badf/tasks/push_svn.js#L101-L115 | |
43,328 | ddliu/grunt-push-svn | tasks/push_svn.js | function(callback) {
grunt.log.writeln('Push to tmp path...');
// remove
if (options.remove) {
grunt.file.recurse(tmpPath, function(abs, rootdir, subdir, filename) {
if (typeof subdir !== 'string') {
subdir = '';
}
var subPath = path.jo... | javascript | function(callback) {
grunt.log.writeln('Push to tmp path...');
// remove
if (options.remove) {
grunt.file.recurse(tmpPath, function(abs, rootdir, subdir, filename) {
if (typeof subdir !== 'string') {
subdir = '';
}
var subPath = path.jo... | [
"function",
"(",
"callback",
")",
"{",
"grunt",
".",
"log",
".",
"writeln",
"(",
"'Push to tmp path...'",
")",
";",
"// remove",
"if",
"(",
"options",
".",
"remove",
")",
"{",
"grunt",
".",
"file",
".",
"recurse",
"(",
"tmpPath",
",",
"function",
"(",
... | sync with tmp working directory | [
"sync",
"with",
"tmp",
"working",
"directory"
] | 59dc07216fffaf05712d7a4936f2227435a1badf | https://github.com/ddliu/grunt-push-svn/blob/59dc07216fffaf05712d7a4936f2227435a1badf/tasks/push_svn.js#L159-L231 | |
43,329 | alexindigo/fbbot | traverse/incoming.js | linkParent | function linkParent(original, branch, parentPayload, nextPayload)
{
// get proper name
var normalized = normalize(branch);
var result = original(branch, parentPayload, nextPayload);
// add normalized handle reference
// skip if it's empty string
if (normalized)
{
result.__proto__[normalized] = paren... | javascript | function linkParent(original, branch, parentPayload, nextPayload)
{
// get proper name
var normalized = normalize(branch);
var result = original(branch, parentPayload, nextPayload);
// add normalized handle reference
// skip if it's empty string
if (normalized)
{
result.__proto__[normalized] = paren... | [
"function",
"linkParent",
"(",
"original",
",",
"branch",
",",
"parentPayload",
",",
"nextPayload",
")",
"{",
"// get proper name",
"var",
"normalized",
"=",
"normalize",
"(",
"branch",
")",
";",
"var",
"result",
"=",
"original",
"(",
"branch",
",",
"parentPay... | Wraps original linkParent method
and adds normalized handle reference to the parent object
@param {function} original - original linkParent method
@param {string} branch - current branch of the payload
@param {object} parentPayload - parent payload object
@param {mixed} nextPayload - next step payload object
@... | [
"Wraps",
"original",
"linkParent",
"method",
"and",
"adds",
"normalized",
"handle",
"reference",
"to",
"the",
"parent",
"object"
] | b78a0418ebdfd106723348d94b4378ac67f7d4bf | https://github.com/alexindigo/fbbot/blob/b78a0418ebdfd106723348d94b4378ac67f7d4bf/traverse/incoming.js#L30-L51 |
43,330 | alexindigo/fbbot | traverse/incoming.js | middleware | function middleware(branch, payload, callback)
{
// get proper name
var normalized = normalize(branch);
this.logger.debug({message: 'Running middleware for incoming payload', branch: branch, normalized: normalized, payload: payload});
// add branch reference to the parent object
// run through all register... | javascript | function middleware(branch, payload, callback)
{
// get proper name
var normalized = normalize(branch);
this.logger.debug({message: 'Running middleware for incoming payload', branch: branch, normalized: normalized, payload: payload});
// add branch reference to the parent object
// run through all register... | [
"function",
"middleware",
"(",
"branch",
",",
"payload",
",",
"callback",
")",
"{",
"// get proper name",
"var",
"normalized",
"=",
"normalize",
"(",
"branch",
")",
";",
"this",
".",
"logger",
".",
"debug",
"(",
"{",
"message",
":",
"'Running middleware for in... | Traverse middleware for incoming flow
@this Fbbot#
@param {string} branch - branch name of the payload
@param {object} payload - initial payload object from facebook messenger
@param {function} callback - invoked upon error or when all entries were processed | [
"Traverse",
"middleware",
"for",
"incoming",
"flow"
] | b78a0418ebdfd106723348d94b4378ac67f7d4bf | https://github.com/alexindigo/fbbot/blob/b78a0418ebdfd106723348d94b4378ac67f7d4bf/traverse/incoming.js#L61-L86 |
43,331 | neoziro/smime | index.js | sign | function sign(options, cb) {
return new Promise(function (resolve, reject) {
options = options || {};
if (!options.content)
throw new Error('Invalid content.');
if (!options.key)
throw new Error('Invalid key.');
if (!options.cert)
throw new Error('Invalid certificate.');
var ... | javascript | function sign(options, cb) {
return new Promise(function (resolve, reject) {
options = options || {};
if (!options.content)
throw new Error('Invalid content.');
if (!options.key)
throw new Error('Invalid key.');
if (!options.cert)
throw new Error('Invalid certificate.');
var ... | [
"function",
"sign",
"(",
"options",
",",
"cb",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"if",
"(",
"!",
"options",
".",
"content",
")",
"throw",
... | Sign a file.
@param {object} options Options
@param {stream.Readable} options.content Content stream
@param {string} options.key Key path
@param {string} options.cert Cert path
@param {string} [options.password] Key password
@param {function} [cb] Optional callback
@returns {object} result Result
@returns {string} res... | [
"Sign",
"a",
"file",
"."
] | 9ada09c5a0a30ef3e8beac3db181f2cbb3602f2c | https://github.com/neoziro/smime/blob/9ada09c5a0a30ef3e8beac3db181f2cbb3602f2c/index.js#L22-L66 |
43,332 | alexindigo/fbbot | lib/attach.js | attach | function attach(filters, instance)
{
Object.keys(filters).forEach(function(step)
{
filters[step].forEach(function(filter)
{
instance.use(step, filter);
});
});
} | javascript | function attach(filters, instance)
{
Object.keys(filters).forEach(function(step)
{
filters[step].forEach(function(filter)
{
instance.use(step, filter);
});
});
} | [
"function",
"attach",
"(",
"filters",
",",
"instance",
")",
"{",
"Object",
".",
"keys",
"(",
"filters",
")",
".",
"forEach",
"(",
"function",
"(",
"step",
")",
"{",
"filters",
"[",
"step",
"]",
".",
"forEach",
"(",
"function",
"(",
"filter",
")",
"{"... | Attaches list of middleware filters to the provided instance
@param {object} filters - list of filters per step (event)
@param {function} instance - filter instance to attach to an event (step) | [
"Attaches",
"list",
"of",
"middleware",
"filters",
"to",
"the",
"provided",
"instance"
] | b78a0418ebdfd106723348d94b4378ac67f7d4bf | https://github.com/alexindigo/fbbot/blob/b78a0418ebdfd106723348d94b4378ac67f7d4bf/lib/attach.js#L9-L18 |
43,333 | doochik/react-native-vksdk | index.ios.js | function() {
return new Promise(function(resolve, reject) {
VkSdkLoginManager.authorize(function(error, result) {
if (error) {
reject(error);
} else {
resolve(result);
}
});
});
} | javascript | function() {
return new Promise(function(resolve, reject) {
VkSdkLoginManager.authorize(function(error, result) {
if (error) {
reject(error);
} else {
resolve(result);
}
});
});
} | [
"function",
"(",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"VkSdkLoginManager",
".",
"authorize",
"(",
"function",
"(",
"error",
",",
"result",
")",
"{",
"if",
"(",
"error",
")",
"{",
"reject",
"(",... | Starts authorization process to retrieve unlimited token.
If VKapp is available in system, it will opens and requests access from user.
Otherwise Mobile Safari will be opened for access request.
@returns {Promise} | [
"Starts",
"authorization",
"process",
"to",
"retrieve",
"unlimited",
"token",
".",
"If",
"VKapp",
"is",
"available",
"in",
"system",
"it",
"will",
"opens",
"and",
"requests",
"access",
"from",
"user",
".",
"Otherwise",
"Mobile",
"Safari",
"will",
"be",
"opened... | e06494b5a64121eea155414162b6416a0589b58c | https://github.com/doochik/react-native-vksdk/blob/e06494b5a64121eea155414162b6416a0589b58c/index.ios.js#L13-L23 | |
43,334 | alexindigo/fbbot | lib/pipeline.js | pipeline | function pipeline(list, payload, handler, callback)
{
var item;
if (!list.length)
{
callback(null, payload);
return;
}
list = list.concat();
item = list.shift();
// pipeline it
handler(item, payload, async(function(err, updatedPayload)
{
if (err)
{
callback(err, updatedPayload... | javascript | function pipeline(list, payload, handler, callback)
{
var item;
if (!list.length)
{
callback(null, payload);
return;
}
list = list.concat();
item = list.shift();
// pipeline it
handler(item, payload, async(function(err, updatedPayload)
{
if (err)
{
callback(err, updatedPayload... | [
"function",
"pipeline",
"(",
"list",
",",
"payload",
",",
"handler",
",",
"callback",
")",
"{",
"var",
"item",
";",
"if",
"(",
"!",
"list",
".",
"length",
")",
"{",
"callback",
"(",
"null",
",",
"payload",
")",
";",
"return",
";",
"}",
"list",
"=",... | Pipelines provided payload through the list of of item via handler
@param {array} list - items to iterate over
@param {object} payload - object to pass to pass iteratees
@param {function} handler - function to invoke for each item/payload iteration
@param {function} callback - invoked after all item were proce... | [
"Pipelines",
"provided",
"payload",
"through",
"the",
"list",
"of",
"of",
"item",
"via",
"handler"
] | b78a0418ebdfd106723348d94b4378ac67f7d4bf | https://github.com/alexindigo/fbbot/blob/b78a0418ebdfd106723348d94b4378ac67f7d4bf/lib/pipeline.js#L13-L38 |
43,335 | JamesMGreene/qunit-assert-compare | qunit-assert-compare.js | gte | function gte(num1, num2, message) {
var output,
input = {
operand1: num1,
operand2: num2,
expected: 1, // Untrue but... internal usage, so meh!
message: message
},
cleanedInput = _validateAndClean(input),
pushContext = _g... | javascript | function gte(num1, num2, message) {
var output,
input = {
operand1: num1,
operand2: num2,
expected: 1, // Untrue but... internal usage, so meh!
message: message
},
cleanedInput = _validateAndClean(input),
pushContext = _g... | [
"function",
"gte",
"(",
"num1",
",",
"num2",
",",
"message",
")",
"{",
"var",
"output",
",",
"input",
"=",
"{",
"operand1",
":",
"num1",
",",
"operand2",
":",
"num2",
",",
"expected",
":",
"1",
",",
"// Untrue but... internal usage, so meh!",
"message",
":... | Is `num1` greater than or equal to `num2`?
@example assert.gte(2, 2, "2 is greater than or equal to 2");
@example assert.gte(2, 1, "2 is greater than or equal to 1");
@param Number num1 The actual left operand
@param Number num2 The actual right operand
@param String message (optional) | [
"Is",
"num1",
"greater",
"than",
"or",
"equal",
"to",
"num2",
"?"
] | 512118ead5a40dd351c766e1b098ab9cf3de3cc4 | https://github.com/JamesMGreene/qunit-assert-compare/blob/512118ead5a40dd351c766e1b098ab9cf3de3cc4/qunit-assert-compare.js#L330-L348 |
43,336 | segmentio/localstorage-retry | lib/store.js | Store | function Store(name, id, keys, optionalEngine) {
this.id = id;
this.name = name;
this.keys = keys || {};
this.engine = optionalEngine || defaultEngine;
} | javascript | function Store(name, id, keys, optionalEngine) {
this.id = id;
this.name = name;
this.keys = keys || {};
this.engine = optionalEngine || defaultEngine;
} | [
"function",
"Store",
"(",
"name",
",",
"id",
",",
"keys",
",",
"optionalEngine",
")",
"{",
"this",
".",
"id",
"=",
"id",
";",
"this",
".",
"name",
"=",
"name",
";",
"this",
".",
"keys",
"=",
"keys",
"||",
"{",
"}",
";",
"this",
".",
"engine",
"... | Store Implementation with dedicated | [
"Store",
"Implementation",
"with",
"dedicated"
] | 0632fb943fc111b6dbf8f36bff5abc6568ffc65e | https://github.com/segmentio/localstorage-retry/blob/0632fb943fc111b6dbf8f36bff5abc6568ffc65e/lib/store.js#L13-L18 |
43,337 | koistya/gulp-render | index.js | renderToString | function renderToString(page) {
var layout = null, child = null, props = {};
while ((layout = page.type.layout || (page.defaultProps && page.defaultProps.layout))) {
child = React.createElement(page, props, child);
_.extend(props, page.defaultProps);
React.renderToString(React.createElement(page, props,... | javascript | function renderToString(page) {
var layout = null, child = null, props = {};
while ((layout = page.type.layout || (page.defaultProps && page.defaultProps.layout))) {
child = React.createElement(page, props, child);
_.extend(props, page.defaultProps);
React.renderToString(React.createElement(page, props,... | [
"function",
"renderToString",
"(",
"page",
")",
"{",
"var",
"layout",
"=",
"null",
",",
"child",
"=",
"null",
",",
"props",
"=",
"{",
"}",
";",
"while",
"(",
"(",
"layout",
"=",
"page",
".",
"type",
".",
"layout",
"||",
"(",
"page",
".",
"defaultPr... | Check if Page component has a layout property; and if yes, wrap the page
into the specified layout, then render to a string. | [
"Check",
"if",
"Page",
"component",
"has",
"a",
"layout",
"property",
";",
"and",
"if",
"yes",
"wrap",
"the",
"page",
"into",
"the",
"specified",
"layout",
"then",
"render",
"to",
"a",
"string",
"."
] | 97e69fd5c1c7c02017cb6597fe9c5dcc620ed92f | https://github.com/koistya/gulp-render/blob/97e69fd5c1c7c02017cb6597fe9c5dcc620ed92f/index.js#L38-L47 |
43,338 | mysidewalk/jsonapi-parse | dist/jsonapi.js | deserialize | function deserialize(json) {
var data, deserialized;
var includedMap = {};
each(json.included, function(value) {
var key = value.type + '-' + value.id;
includedMap[key] = value;
});
if (isArray(json.data)) {
data = map(
json.d... | javascript | function deserialize(json) {
var data, deserialized;
var includedMap = {};
each(json.included, function(value) {
var key = value.type + '-' + value.id;
includedMap[key] = value;
});
if (isArray(json.data)) {
data = map(
json.d... | [
"function",
"deserialize",
"(",
"json",
")",
"{",
"var",
"data",
",",
"deserialized",
";",
"var",
"includedMap",
"=",
"{",
"}",
";",
"each",
"(",
"json",
".",
"included",
",",
"function",
"(",
"value",
")",
"{",
"var",
"key",
"=",
"value",
".",
"type... | Deserialize the JSONAPI formatted object | [
"Deserialize",
"the",
"JSONAPI",
"formatted",
"object"
] | caf8437908586d649756e6e3e4ee444e78a66cf7 | https://github.com/mysidewalk/jsonapi-parse/blob/caf8437908586d649756e6e3e4ee444e78a66cf7/dist/jsonapi.js#L48-L89 |
43,339 | mysidewalk/jsonapi-parse | dist/jsonapi.js | populateRelatedFields | function populateRelatedFields(record, includedMap, parents) {
// IF: Object has relationships, update so this record is listed as a parent
if (record.relationships) {
parents = parents ? parents.concat([record]) : [record] ;
}
each(
record.relationships,
... | javascript | function populateRelatedFields(record, includedMap, parents) {
// IF: Object has relationships, update so this record is listed as a parent
if (record.relationships) {
parents = parents ? parents.concat([record]) : [record] ;
}
each(
record.relationships,
... | [
"function",
"populateRelatedFields",
"(",
"record",
",",
"includedMap",
",",
"parents",
")",
"{",
"// IF: Object has relationships, update so this record is listed as a parent",
"if",
"(",
"record",
".",
"relationships",
")",
"{",
"parents",
"=",
"parents",
"?",
"parents"... | Populate relations of the provided record from the included objects | [
"Populate",
"relations",
"of",
"the",
"provided",
"record",
"from",
"the",
"included",
"objects"
] | caf8437908586d649756e6e3e4ee444e78a66cf7 | https://github.com/mysidewalk/jsonapi-parse/blob/caf8437908586d649756e6e3e4ee444e78a66cf7/dist/jsonapi.js#L92-L133 |
43,340 | mysidewalk/jsonapi-parse | dist/jsonapi.js | getMatchingRecord | function getMatchingRecord(relationship, included, parents) {
var circular, match;
circular = findWhere(
parents,
{
id: relationship.id,
type: relationship.type
}
);
if (circular) {
return relationship;
... | javascript | function getMatchingRecord(relationship, included, parents) {
var circular, match;
circular = findWhere(
parents,
{
id: relationship.id,
type: relationship.type
}
);
if (circular) {
return relationship;
... | [
"function",
"getMatchingRecord",
"(",
"relationship",
",",
"included",
",",
"parents",
")",
"{",
"var",
"circular",
",",
"match",
";",
"circular",
"=",
"findWhere",
"(",
"parents",
",",
"{",
"id",
":",
"relationship",
".",
"id",
",",
"type",
":",
"relation... | Retrieves the record from the included objects that matches the provided relationship | [
"Retrieves",
"the",
"record",
"from",
"the",
"included",
"objects",
"that",
"matches",
"the",
"provided",
"relationship"
] | caf8437908586d649756e6e3e4ee444e78a66cf7 | https://github.com/mysidewalk/jsonapi-parse/blob/caf8437908586d649756e6e3e4ee444e78a66cf7/dist/jsonapi.js#L136-L168 |
43,341 | mysidewalk/jsonapi-parse | dist/jsonapi.js | flatten | function flatten(record, extraMeta) {
var meta = extend({}, record.meta, extraMeta)
return extend(
{},
{ links: record.links, meta: meta },
record.attributes,
{ id: record.id, type: record.type }
);
} | javascript | function flatten(record, extraMeta) {
var meta = extend({}, record.meta, extraMeta)
return extend(
{},
{ links: record.links, meta: meta },
record.attributes,
{ id: record.id, type: record.type }
);
} | [
"function",
"flatten",
"(",
"record",
",",
"extraMeta",
")",
"{",
"var",
"meta",
"=",
"extend",
"(",
"{",
"}",
",",
"record",
".",
"meta",
",",
"extraMeta",
")",
"return",
"extend",
"(",
"{",
"}",
",",
"{",
"links",
":",
"record",
".",
"links",
","... | Flatten the ID of an object with the rest of the attributes on a new object | [
"Flatten",
"the",
"ID",
"of",
"an",
"object",
"with",
"the",
"rest",
"of",
"the",
"attributes",
"on",
"a",
"new",
"object"
] | caf8437908586d649756e6e3e4ee444e78a66cf7 | https://github.com/mysidewalk/jsonapi-parse/blob/caf8437908586d649756e6e3e4ee444e78a66cf7/dist/jsonapi.js#L171-L179 |
43,342 | marijnh/getdocs | src/index.js | extend | function extend(from, to, path, overrideLoc) {
for (var prop in from) {
if (!(prop in to) || (prop == "loc" && overrideLoc)) {
to[prop] = from[prop]
} else if (prop == "properties" || prop == "staticProperties") {
extend(from[prop], to[prop], path.concat(prop))
} else {
var msg = "Confli... | javascript | function extend(from, to, path, overrideLoc) {
for (var prop in from) {
if (!(prop in to) || (prop == "loc" && overrideLoc)) {
to[prop] = from[prop]
} else if (prop == "properties" || prop == "staticProperties") {
extend(from[prop], to[prop], path.concat(prop))
} else {
var msg = "Confli... | [
"function",
"extend",
"(",
"from",
",",
"to",
",",
"path",
",",
"overrideLoc",
")",
"{",
"for",
"(",
"var",
"prop",
"in",
"from",
")",
"{",
"if",
"(",
"!",
"(",
"prop",
"in",
"to",
")",
"||",
"(",
"prop",
"==",
"\"loc\"",
"&&",
"overrideLoc",
")"... | Deriving context from ancestor nodes | [
"Deriving",
"context",
"from",
"ancestor",
"nodes"
] | 74181d582e041013cb742d057bf53801358b4d93 | https://github.com/marijnh/getdocs/blob/74181d582e041013cb742d057bf53801358b4d93/src/index.js#L283-L297 |
43,343 | lmangani/parsip | lib/Parser.js | getHeader | function getHeader(data, headerStart)
{
// 'start' position of the header.
let start = headerStart;
// 'end' position of the header.
let end = 0;
// 'partial end' position of the header.
let partialEnd = 0;
// End of message.
if (data.substring(start, start + 2).match(/(^\r\n)/))
{
return -2;
}... | javascript | function getHeader(data, headerStart)
{
// 'start' position of the header.
let start = headerStart;
// 'end' position of the header.
let end = 0;
// 'partial end' position of the header.
let partialEnd = 0;
// End of message.
if (data.substring(start, start + 2).match(/(^\r\n)/))
{
return -2;
}... | [
"function",
"getHeader",
"(",
"data",
",",
"headerStart",
")",
"{",
"// 'start' position of the header.",
"let",
"start",
"=",
"headerStart",
";",
"// 'end' position of the header.",
"let",
"end",
"=",
"0",
";",
"// 'partial end' position of the header.",
"let",
"partialE... | Extract and parse every header of a SIP message. | [
"Extract",
"and",
"parse",
"every",
"header",
"of",
"a",
"SIP",
"message",
"."
] | fa1fd873199e9933ed56124760c564c8e6c571d7 | https://github.com/lmangani/parsip/blob/fa1fd873199e9933ed56124760c564c8e6c571d7/lib/Parser.js#L103-L141 |
43,344 | adplabs/JQL | lib/JQL.js | find | function find(prefix, suffix)
{
if(valStack.length > 0)
{
var currentVal = valStack[valStack.length - 1];
if(prefix.length > 0)
{
// Manipulate prefix and suffix
var currentField = prefix.shift();
suffix.push(curren... | javascript | function find(prefix, suffix)
{
if(valStack.length > 0)
{
var currentVal = valStack[valStack.length - 1];
if(prefix.length > 0)
{
// Manipulate prefix and suffix
var currentField = prefix.shift();
suffix.push(curren... | [
"function",
"find",
"(",
"prefix",
",",
"suffix",
")",
"{",
"if",
"(",
"valStack",
".",
"length",
">",
"0",
")",
"{",
"var",
"currentVal",
"=",
"valStack",
"[",
"valStack",
".",
"length",
"-",
"1",
"]",
";",
"if",
"(",
"prefix",
".",
"length",
">",... | This is the foundation of all searching in JQL; it chooses specific search types based upon the current part of the JQL string
@private
@param {Array} prefix - Initial part of path
@param {Array} suffix - Final part of path | [
"This",
"is",
"the",
"foundation",
"of",
"all",
"searching",
"in",
"JQL",
";",
"it",
"chooses",
"specific",
"search",
"types",
"based",
"upon",
"the",
"current",
"part",
"of",
"the",
"JQL",
"string"
] | f4e63693c599dd9ad614327c8ca487b9ca576ffd | https://github.com/adplabs/JQL/blob/f4e63693c599dd9ad614327c8ca487b9ca576ffd/lib/JQL.js#L449-L520 |
43,345 | kengz/telegram-bot-bootstrap | API.js | function(token) {
this.token = token;
this.baseUrl = 'https://api.telegram.org/bot' + this.token;
// A sample Telegram bot JSON data, for req options
this.formData = {
chat_id: "87654321",
text: "Hello there"
};
// template options for req the Telegram Bot API
this.baseopti... | javascript | function(token) {
this.token = token;
this.baseUrl = 'https://api.telegram.org/bot' + this.token;
// A sample Telegram bot JSON data, for req options
this.formData = {
chat_id: "87654321",
text: "Hello there"
};
// template options for req the Telegram Bot API
this.baseopti... | [
"function",
"(",
"token",
")",
"{",
"this",
".",
"token",
"=",
"token",
";",
"this",
".",
"baseUrl",
"=",
"'https://api.telegram.org/bot'",
"+",
"this",
".",
"token",
";",
"// A sample Telegram bot JSON data, for req options",
"this",
".",
"formData",
"=",
"{",
... | The API object prototype
The API bot constructor.
@category Telegram API
@param {string} token Your Telegram bot token.
@returns {Bot} The bot able to call methods.
@example
var fs = require('fs');
var bot = require('telegram-bot-bootstrap');
var Alice = new bot(your_bot_token);
Alice.sendMessage(user_chat_id, 'He... | [
"The",
"API",
"object",
"prototype",
"The",
"API",
"bot",
"constructor",
"."
] | c99281393a1fa3d7c0f81df55634bb956072d20a | https://github.com/kengz/telegram-bot-bootstrap/blob/c99281393a1fa3d7c0f81df55634bb956072d20a/API.js#L39-L120 | |
43,346 | lmangani/parsip | lib/SIPMessage.js | function(name, value) {
var header = { raw: value };
name = Utils.headerize(name);
if(this.headers[name]) {
this.headers[name].push(header);
} else {
this.headers[name] = [header];
}
} | javascript | function(name, value) {
var header = { raw: value };
name = Utils.headerize(name);
if(this.headers[name]) {
this.headers[name].push(header);
} else {
this.headers[name] = [header];
}
} | [
"function",
"(",
"name",
",",
"value",
")",
"{",
"var",
"header",
"=",
"{",
"raw",
":",
"value",
"}",
";",
"name",
"=",
"Utils",
".",
"headerize",
"(",
"name",
")",
";",
"if",
"(",
"this",
".",
"headers",
"[",
"name",
"]",
")",
"{",
"this",
"."... | Insert a header of the given name and value into the last position of the
header array. | [
"Insert",
"a",
"header",
"of",
"the",
"given",
"name",
"and",
"value",
"into",
"the",
"last",
"position",
"of",
"the",
"header",
"array",
"."
] | fa1fd873199e9933ed56124760c564c8e6c571d7 | https://github.com/lmangani/parsip/blob/fa1fd873199e9933ed56124760c564c8e6c571d7/lib/SIPMessage.js#L311-L321 | |
43,347 | lmangani/parsip | lib/SIPMessage.js | function(name) {
var header = this.headers[Utils.headerize(name)];
if(header) {
if(header[0]) {
return header[0].raw;
}
} else {
return;
}
} | javascript | function(name) {
var header = this.headers[Utils.headerize(name)];
if(header) {
if(header[0]) {
return header[0].raw;
}
} else {
return;
}
} | [
"function",
"(",
"name",
")",
"{",
"var",
"header",
"=",
"this",
".",
"headers",
"[",
"Utils",
".",
"headerize",
"(",
"name",
")",
"]",
";",
"if",
"(",
"header",
")",
"{",
"if",
"(",
"header",
"[",
"0",
"]",
")",
"{",
"return",
"header",
"[",
"... | Get the value of the given header name at the given position. | [
"Get",
"the",
"value",
"of",
"the",
"given",
"header",
"name",
"at",
"the",
"given",
"position",
"."
] | fa1fd873199e9933ed56124760c564c8e6c571d7 | https://github.com/lmangani/parsip/blob/fa1fd873199e9933ed56124760c564c8e6c571d7/lib/SIPMessage.js#L326-L336 | |
43,348 | semibran/pack | lib/pack.js | whitespace | function whitespace(layout) {
var whitespace = layout.size[0] * layout.size[1]
for (var i = 0; i < layout.boxes.length; i++) {
var box = layout.boxes[i]
whitespace -= box.size[0] * box.size[1]
}
return whitespace
} | javascript | function whitespace(layout) {
var whitespace = layout.size[0] * layout.size[1]
for (var i = 0; i < layout.boxes.length; i++) {
var box = layout.boxes[i]
whitespace -= box.size[0] * box.size[1]
}
return whitespace
} | [
"function",
"whitespace",
"(",
"layout",
")",
"{",
"var",
"whitespace",
"=",
"layout",
".",
"size",
"[",
"0",
"]",
"*",
"layout",
".",
"size",
"[",
"1",
"]",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"layout",
".",
"boxes",
".",
"length",
... | determines the amount of whitespace area remaining in `layout` | [
"determines",
"the",
"amount",
"of",
"whitespace",
"area",
"remaining",
"in",
"layout"
] | 27103c7b53111ec96624d926b295b2976ea850af | https://github.com/semibran/pack/blob/27103c7b53111ec96624d926b295b2976ea850af/lib/pack.js#L65-L72 |
43,349 | semibran/pack | lib/pack.js | validate | function validate(boxes, box) {
var a = box
for (var i = 0; i < boxes.length; i++) {
var b = boxes[i]
if (intersects(a, b)) {
return false
}
}
return true
} | javascript | function validate(boxes, box) {
var a = box
for (var i = 0; i < boxes.length; i++) {
var b = boxes[i]
if (intersects(a, b)) {
return false
}
}
return true
} | [
"function",
"validate",
"(",
"boxes",
",",
"box",
")",
"{",
"var",
"a",
"=",
"box",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"boxes",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"b",
"=",
"boxes",
"[",
"i",
"]",
"if",
"(",
"inte... | determines if the region specified by `box` is clear of all other `boxes` | [
"determines",
"if",
"the",
"region",
"specified",
"by",
"box",
"is",
"clear",
"of",
"all",
"other",
"boxes"
] | 27103c7b53111ec96624d926b295b2976ea850af | https://github.com/semibran/pack/blob/27103c7b53111ec96624d926b295b2976ea850af/lib/pack.js#L93-L102 |
43,350 | semibran/pack | lib/pack.js | intersects | function intersects(a, b) {
return a.position[0] < b.position[0] + b.size[0] && a.position[0] + a.size[0] > b.position[0]
&& a.position[1] < b.position[1] + b.size[1] && a.position[1] + a.size[1] > b.position[1]
} | javascript | function intersects(a, b) {
return a.position[0] < b.position[0] + b.size[0] && a.position[0] + a.size[0] > b.position[0]
&& a.position[1] < b.position[1] + b.size[1] && a.position[1] + a.size[1] > b.position[1]
} | [
"function",
"intersects",
"(",
"a",
",",
"b",
")",
"{",
"return",
"a",
".",
"position",
"[",
"0",
"]",
"<",
"b",
".",
"position",
"[",
"0",
"]",
"+",
"b",
".",
"size",
"[",
"0",
"]",
"&&",
"a",
".",
"position",
"[",
"0",
"]",
"+",
"a",
".",... | determines if box `a` and box `b` intersect | [
"determines",
"if",
"box",
"a",
"and",
"box",
"b",
"intersect"
] | 27103c7b53111ec96624d926b295b2976ea850af | https://github.com/semibran/pack/blob/27103c7b53111ec96624d926b295b2976ea850af/lib/pack.js#L105-L108 |
43,351 | lxe/stream-replace | stream-replace.js | replaceStream | function replaceStream(needle, replacer) {
var ts = new Transform();
var chunks = [], len = 0, pos = 0;
ts._transform = function _transform(chunk, enc, cb) {
chunks.push(chunk);
len += chunk.length;
if (pos === 1) {
var data = Buffer.concat(chunks, len)
.toString()
.replace(ne... | javascript | function replaceStream(needle, replacer) {
var ts = new Transform();
var chunks = [], len = 0, pos = 0;
ts._transform = function _transform(chunk, enc, cb) {
chunks.push(chunk);
len += chunk.length;
if (pos === 1) {
var data = Buffer.concat(chunks, len)
.toString()
.replace(ne... | [
"function",
"replaceStream",
"(",
"needle",
",",
"replacer",
")",
"{",
"var",
"ts",
"=",
"new",
"Transform",
"(",
")",
";",
"var",
"chunks",
"=",
"[",
"]",
",",
"len",
"=",
"0",
",",
"pos",
"=",
"0",
";",
"ts",
".",
"_transform",
"=",
"function",
... | Returns a transform stream that replaces
'needle' with 'replacer' in the data piped into it.
All read data is converted ot utf-8 strings before
the replacement isperformed.
Honors needles appearing on chunk boundaries.
Abides by the same rules as String.replace();
@param {String|RegExp} needle needle
@param {... | [
"Returns",
"a",
"transform",
"stream",
"that",
"replaces",
"needle",
"with",
"replacer",
"in",
"the",
"data",
"piped",
"into",
"it",
"."
] | 043595c23b99a262fc07c744f975b0bd3d9689b0 | https://github.com/lxe/stream-replace/blob/043595c23b99a262fc07c744f975b0bd3d9689b0/stream-replace.js#L40-L76 |
43,352 | Mik13/nuki-bridge-api | lib/callback.js | Callback | function Callback (connection, callbackId, callbackUrl, nuki) {
EventEmitter.call(this);
this.connection = connection;
this.nuki = nuki;
this.callbackId = callbackId;
this.url = callbackUrl;
} | javascript | function Callback (connection, callbackId, callbackUrl, nuki) {
EventEmitter.call(this);
this.connection = connection;
this.nuki = nuki;
this.callbackId = callbackId;
this.url = callbackUrl;
} | [
"function",
"Callback",
"(",
"connection",
",",
"callbackId",
",",
"callbackUrl",
",",
"nuki",
")",
"{",
"EventEmitter",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"connection",
"=",
"connection",
";",
"this",
".",
"nuki",
"=",
"nuki",
";",
"this",... | The constructor for callbacks via bridge or nuki.
If called from nuki it will emit on it and check the battery level,
otherwise (called from bridge) it will only emit on itself (for every nuki connected to bridge).
@class Callback
@param {Bridge} connection the bridge
@param {Number} callbackId th... | [
"The",
"constructor",
"for",
"callbacks",
"via",
"bridge",
"or",
"nuki",
"."
] | 65e802f5eee2cf9e9c9d1b391b749f4a69648876 | https://github.com/Mik13/nuki-bridge-api/blob/65e802f5eee2cf9e9c9d1b391b749f4a69648876/lib/callback.js#L22-L29 |
43,353 | azusa0127/simple-semaphore | example.js | main | async function main () {
console.log(`\n\n[Single step producer]`);
const workers1 = [
new Producer(100),
new Producer(100),
new Producer(100),
new Producer(100),
new Producer(100),
new Consumer(200),
new Consumer(300),
];
await Promise.all(workers1.map(x => x.work()));
console.lo... | javascript | async function main () {
console.log(`\n\n[Single step producer]`);
const workers1 = [
new Producer(100),
new Producer(100),
new Producer(100),
new Producer(100),
new Producer(100),
new Consumer(200),
new Consumer(300),
];
await Promise.all(workers1.map(x => x.work()));
console.lo... | [
"async",
"function",
"main",
"(",
")",
"{",
"console",
".",
"log",
"(",
"`",
"\\n",
"\\n",
"`",
")",
";",
"const",
"workers1",
"=",
"[",
"new",
"Producer",
"(",
"100",
")",
",",
"new",
"Producer",
"(",
"100",
")",
",",
"new",
"Producer",
"(",
"10... | Async wrapped main function. | [
"Async",
"wrapped",
"main",
"function",
"."
] | db97a7bd4e7d1397143c614d70d02de65f8ff6fe | https://github.com/azusa0127/simple-semaphore/blob/db97a7bd4e7d1397143c614d70d02de65f8ff6fe/example.js#L68-L102 |
43,354 | Mik13/nuki-bridge-api | lib/bridge.js | Bridge | function Bridge (ip, port, token, options) {
if (!(this instanceof Bridge)) {
return new Bridge(ip, port, token);
}
this.ip = ip;
this.port = parseInt(port, 10);
this.token = token;
this.delayBetweenRequests = options && options.delayBetweenRequests || 250;
this.delayer = Promise.resolve();
if (!t... | javascript | function Bridge (ip, port, token, options) {
if (!(this instanceof Bridge)) {
return new Bridge(ip, port, token);
}
this.ip = ip;
this.port = parseInt(port, 10);
this.token = token;
this.delayBetweenRequests = options && options.delayBetweenRequests || 250;
this.delayer = Promise.resolve();
if (!t... | [
"function",
"Bridge",
"(",
"ip",
",",
"port",
",",
"token",
",",
"options",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Bridge",
")",
")",
"{",
"return",
"new",
"Bridge",
"(",
"ip",
",",
"port",
",",
"token",
")",
";",
"}",
"this",
".",... | The constructor for a connection to a bridge.
@class Bridge
@param {String} ip the ip of the bridge
@param {String} port the port of the bridge
@param {String} token the token of the bridge
@param {Object} [options] ... | [
"The",
"constructor",
"for",
"a",
"connection",
"to",
"a",
"bridge",
"."
] | 65e802f5eee2cf9e9c9d1b391b749f4a69648876 | https://github.com/Mik13/nuki-bridge-api/blob/65e802f5eee2cf9e9c9d1b391b749f4a69648876/lib/bridge.js#L18-L32 |
43,355 | slickplaid/node-slack-mailgun | lib/mailgun-verify.js | verifyMailgun | function verifyMailgun(apikey, token, timestamp, signature) {
var data = [timestamp, token].join('');
var hmac = crypto.createHmac('sha256', apikey).update(data);
var ourSig = hmac.digest('hex');
var output = {
apikey: apikey,
token: token,
timestamp: timestamp,
signature: signature,
genera... | javascript | function verifyMailgun(apikey, token, timestamp, signature) {
var data = [timestamp, token].join('');
var hmac = crypto.createHmac('sha256', apikey).update(data);
var ourSig = hmac.digest('hex');
var output = {
apikey: apikey,
token: token,
timestamp: timestamp,
signature: signature,
genera... | [
"function",
"verifyMailgun",
"(",
"apikey",
",",
"token",
",",
"timestamp",
",",
"signature",
")",
"{",
"var",
"data",
"=",
"[",
"timestamp",
",",
"token",
"]",
".",
"join",
"(",
"''",
")",
";",
"var",
"hmac",
"=",
"crypto",
".",
"createHmac",
"(",
"... | Verify mailgun HMAC authentication token | [
"Verify",
"mailgun",
"HMAC",
"authentication",
"token"
] | 54e523336a85e69766e4d6a2f6a308ebdd0869e9 | https://github.com/slickplaid/node-slack-mailgun/blob/54e523336a85e69766e4d6a2f6a308ebdd0869e9/lib/mailgun-verify.js#L27-L42 |
43,356 | brycebaril/timestreamdb | timestreamdb.js | TimestreamDB | function TimestreamDB(instance, options) {
if (!(this instanceof TimestreamDB))
return new TimestreamDB(instance, options)
var db = Version(instance, options)
db.ts = function (key, options) {
var opts = {reverse: true}
if (options.start) opts.minVersion = options.start
if (options.until) opts.... | javascript | function TimestreamDB(instance, options) {
if (!(this instanceof TimestreamDB))
return new TimestreamDB(instance, options)
var db = Version(instance, options)
db.ts = function (key, options) {
var opts = {reverse: true}
if (options.start) opts.minVersion = options.start
if (options.until) opts.... | [
"function",
"TimestreamDB",
"(",
"instance",
",",
"options",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"TimestreamDB",
")",
")",
"return",
"new",
"TimestreamDB",
"(",
"instance",
",",
"options",
")",
"var",
"db",
"=",
"Version",
"(",
"instance",... | Create a new TimestreamDB
@param {LevelUp} instance A LevelUp instance
@param {object} options Configuration options for level-version | [
"Create",
"a",
"new",
"TimestreamDB"
] | cebb50ea8d09f39c70937b0ba8e34020025e216e | https://github.com/brycebaril/timestreamdb/blob/cebb50ea8d09f39c70937b0ba8e34020025e216e/timestreamdb.js#L33-L49 |
43,357 | Erudika/para-client-js | lib/Constraint.js | Constraint | function Constraint(constraintName, constraintPayload) {
var name = constraintName;
var payload = constraintPayload;
/**
* The constraint name.
* @returns {String} a name
*/
this.getName = function () {
return name;
};
/**
* Sets the name of the constraint.
* @param {String} n name
*/
this.setNam... | javascript | function Constraint(constraintName, constraintPayload) {
var name = constraintName;
var payload = constraintPayload;
/**
* The constraint name.
* @returns {String} a name
*/
this.getName = function () {
return name;
};
/**
* Sets the name of the constraint.
* @param {String} n name
*/
this.setNam... | [
"function",
"Constraint",
"(",
"constraintName",
",",
"constraintPayload",
")",
"{",
"var",
"name",
"=",
"constraintName",
";",
"var",
"payload",
"=",
"constraintPayload",
";",
"/**\n\t * The constraint name.\n\t * @returns {String} a name\n\t */",
"this",
".",
"getName",
... | Represents a validation constraint.
@author Alex Bogdanovski [alex@erudika.com]
@param {String} constraintName name
@param {Object} constraintPayload payload
@returns {Constraint} | [
"Represents",
"a",
"validation",
"constraint",
"."
] | 6bcbe7b206ea2b50e65615048b06b43a1fad19f0 | https://github.com/Erudika/para-client-js/blob/6bcbe7b206ea2b50e65615048b06b43a1fad19f0/lib/Constraint.js#L29-L64 |
43,358 | jackzampolin/influx-express | index.js | function (options) {
if (options.username && options.password) {
return (options.protocol + "://" + options.username + ":" + options.password + "@" + options.host + ":" + options.port + "/" + options.database)
}
return (options.protocol + "://" + options.host + ":" + options.port + "/" + options.datab... | javascript | function (options) {
if (options.username && options.password) {
return (options.protocol + "://" + options.username + ":" + options.password + "@" + options.host + ":" + options.port + "/" + options.database)
}
return (options.protocol + "://" + options.host + ":" + options.port + "/" + options.datab... | [
"function",
"(",
"options",
")",
"{",
"if",
"(",
"options",
".",
"username",
"&&",
"options",
".",
"password",
")",
"{",
"return",
"(",
"options",
".",
"protocol",
"+",
"\"://\"",
"+",
"options",
".",
"username",
"+",
"\":\"",
"+",
"options",
".",
"pas... | This is a convinence function for creating the InfluxDB connection string | [
"This",
"is",
"a",
"convinence",
"function",
"for",
"creating",
"the",
"InfluxDB",
"connection",
"string"
] | 599ba9a2485fc6fd2f6bcd434f9d6818c094a497 | https://github.com/jackzampolin/influx-express/blob/599ba9a2485fc6fd2f6bcd434f9d6818c094a497/index.js#L20-L25 | |
43,359 | jackzampolin/influx-express | index.js | function () {
var len = this.points.length
// Check the length of the point buffer
if (len >= options.batchSize) {
// Write the points and log error if any
client.writePoints(this.points).catch(function (error) {
console.log(error.message)
})
// Reset point buff... | javascript | function () {
var len = this.points.length
// Check the length of the point buffer
if (len >= options.batchSize) {
// Write the points and log error if any
client.writePoints(this.points).catch(function (error) {
console.log(error.message)
})
// Reset point buff... | [
"function",
"(",
")",
"{",
"var",
"len",
"=",
"this",
".",
"points",
".",
"length",
"// Check the length of the point buffer",
"if",
"(",
"len",
">=",
"options",
".",
"batchSize",
")",
"{",
"// Write the points and log error if any",
"client",
".",
"writePoints",
... | When each point is added check the size of the batch and send if >= batchSize | [
"When",
"each",
"point",
"is",
"added",
"check",
"the",
"size",
"of",
"the",
"batch",
"and",
"send",
"if",
">",
"=",
"batchSize"
] | 599ba9a2485fc6fd2f6bcd434f9d6818c094a497 | https://github.com/jackzampolin/influx-express/blob/599ba9a2485fc6fd2f6bcd434f9d6818c094a497/index.js#L36-L49 | |
43,360 | jackzampolin/influx-express | index.js | makePoint | function makePoint() {
// Pull start time from req and log responseTime
var responseTime = Date.now() - req.start;
// Add the new point to the batch of points
batch.points.push({
measurement: "requests",
"tags": {
"path": req.path,
"host": req.hostname,... | javascript | function makePoint() {
// Pull start time from req and log responseTime
var responseTime = Date.now() - req.start;
// Add the new point to the batch of points
batch.points.push({
measurement: "requests",
"tags": {
"path": req.path,
"host": req.hostname,... | [
"function",
"makePoint",
"(",
")",
"{",
"// Pull start time from req and log responseTime",
"var",
"responseTime",
"=",
"Date",
".",
"now",
"(",
")",
"-",
"req",
".",
"start",
";",
"// Add the new point to the batch of points",
"batch",
".",
"points",
".",
"push",
"... | Make line protocol point and add to batcher | [
"Make",
"line",
"protocol",
"point",
"and",
"add",
"to",
"batcher"
] | 599ba9a2485fc6fd2f6bcd434f9d6818c094a497 | https://github.com/jackzampolin/influx-express/blob/599ba9a2485fc6fd2f6bcd434f9d6818c094a497/index.js#L60-L80 |
43,361 | WebReflection/wru | src/wru.DOM.functions.js | isGonnaBeLegen | function isGonnaBeLegen() {
current = shift.call(queue);
if (current) {
if (typeof current == "function") {
current = {name: current[NAME] || "anonymous", test: current};
}
(node = putItThereAndGimmeBack(
putItThereAndGimmeBack(wru.node... | javascript | function isGonnaBeLegen() {
current = shift.call(queue);
if (current) {
if (typeof current == "function") {
current = {name: current[NAME] || "anonymous", test: current};
}
(node = putItThereAndGimmeBack(
putItThereAndGimmeBack(wru.node... | [
"function",
"isGonnaBeLegen",
"(",
")",
"{",
"current",
"=",
"shift",
".",
"call",
"(",
"queue",
")",
";",
"if",
"(",
"current",
")",
"{",
"if",
"(",
"typeof",
"current",
"==",
"\"function\"",
")",
"{",
"current",
"=",
"{",
"name",
":",
"current",
"[... | DOM specific version | [
"DOM",
"specific",
"version"
] | 705b9629ce0eb1f86989f88fde4dc39796c1d545 | https://github.com/WebReflection/wru/blob/705b9629ce0eb1f86989f88fde4dc39796c1d545/src/wru.DOM.functions.js#L2-L28 |
43,362 | fgnass/tamper | index.js | patch | function patch(obj, properties) {
var old = {};
for (var name in properties) {
old[name] = obj[name];
obj[name] = properties[name];
}
return old;
} | javascript | function patch(obj, properties) {
var old = {};
for (var name in properties) {
old[name] = obj[name];
obj[name] = properties[name];
}
return old;
} | [
"function",
"patch",
"(",
"obj",
",",
"properties",
")",
"{",
"var",
"old",
"=",
"{",
"}",
";",
"for",
"(",
"var",
"name",
"in",
"properties",
")",
"{",
"old",
"[",
"name",
"]",
"=",
"obj",
"[",
"name",
"]",
";",
"obj",
"[",
"name",
"]",
"=",
... | Overwrites properties of the given object and returns the old values | [
"Overwrites",
"properties",
"of",
"the",
"given",
"object",
"and",
"returns",
"the",
"old",
"values"
] | ae46c87dee0510298571f0343bf647116f9868de | https://github.com/fgnass/tamper/blob/ae46c87dee0510298571f0343bf647116f9868de/index.js#L67-L74 |
43,363 | WebReflection/wru | src/wru.functions.js | giveItATry | function giveItATry(name) {
if (iHasIt(current, name)) {
try {
current[name](tmp);
} catch(doooodeThisIsBAD) {
push.call(fatal, EMPTY + doooodeThisIsBAD);
}
}
} | javascript | function giveItATry(name) {
if (iHasIt(current, name)) {
try {
current[name](tmp);
} catch(doooodeThisIsBAD) {
push.call(fatal, EMPTY + doooodeThisIsBAD);
}
}
} | [
"function",
"giveItATry",
"(",
"name",
")",
"{",
"if",
"(",
"iHasIt",
"(",
"current",
",",
"name",
")",
")",
"{",
"try",
"{",
"current",
"[",
"name",
"]",
"(",
"tmp",
")",
";",
"}",
"catch",
"(",
"doooodeThisIsBAD",
")",
"{",
"push",
".",
"call",
... | common functions for all versions | [
"common",
"functions",
"for",
"all",
"versions"
] | 705b9629ce0eb1f86989f88fde4dc39796c1d545 | https://github.com/WebReflection/wru/blob/705b9629ce0eb1f86989f88fde4dc39796c1d545/src/wru.functions.js#L2-L10 |
43,364 | WebReflection/wru | src/wru.console.functions.js | isGonnaBeLegen | function isGonnaBeLegen() {
current = shift.call(queue);
if (current) {
if (typeof current == "function") {
current = {name: current[NAME] || "anonymous", test: current};
}
log(OUTPUT_SEPARATOR);
log(
(iHasIt(current, NAME) ... | javascript | function isGonnaBeLegen() {
current = shift.call(queue);
if (current) {
if (typeof current == "function") {
current = {name: current[NAME] || "anonymous", test: current};
}
log(OUTPUT_SEPARATOR);
log(
(iHasIt(current, NAME) ... | [
"function",
"isGonnaBeLegen",
"(",
")",
"{",
"current",
"=",
"shift",
".",
"call",
"(",
"queue",
")",
";",
"if",
"(",
"current",
")",
"{",
"if",
"(",
"typeof",
"current",
"==",
"\"function\"",
")",
"{",
"current",
"=",
"{",
"name",
":",
"current",
"[... | console specific version | [
"console",
"specific",
"version"
] | 705b9629ce0eb1f86989f88fde4dc39796c1d545 | https://github.com/WebReflection/wru/blob/705b9629ce0eb1f86989f88fde4dc39796c1d545/src/wru.console.functions.js#L2-L26 |
43,365 | luxp/jqmath | src/jqmath.js | checkVertStretch | function checkVertStretch (up, dn, g, doP) /* non-MathML */ {
if (g.nodeName.toLowerCase() == 'mo' && g.childNodes.length == 1) {
var c = g.firstChild, s = c.data;
if (c.nodeType == 3 /* Text */ && (up > 0.9 || dn > 0.9)
&& (M.prefix_[s] < 25 || M.postfix_[s] < 25
|| '|\u2016\u221A' /* ‖ √... | javascript | function checkVertStretch (up, dn, g, doP) /* non-MathML */ {
if (g.nodeName.toLowerCase() == 'mo' && g.childNodes.length == 1) {
var c = g.firstChild, s = c.data;
if (c.nodeType == 3 /* Text */ && (up > 0.9 || dn > 0.9)
&& (M.prefix_[s] < 25 || M.postfix_[s] < 25
|| '|\u2016\u221A' /* ‖ √... | [
"function",
"checkVertStretch",
"(",
"up",
",",
"dn",
",",
"g",
",",
"doP",
")",
"/* non-MathML */",
"{",
"if",
"(",
"g",
".",
"nodeName",
".",
"toLowerCase",
"(",
")",
"==",
"'mo'",
"&&",
"g",
".",
"childNodes",
".",
"length",
"==",
"1",
")",
"{",
... | fmUp is mid-x to outer top, fmDn is mid-x to outer bottom, both approx. & in parent ems | [
"fmUp",
"is",
"mid",
"-",
"x",
"to",
"outer",
"top",
"fmDn",
"is",
"mid",
"-",
"x",
"to",
"outer",
"bottom",
"both",
"approx",
".",
"&",
"in",
"parent",
"ems"
] | 7a6051159c11e69e0f6ecba6e3f89801ef7e3984 | https://github.com/luxp/jqmath/blob/7a6051159c11e69e0f6ecba6e3f89801ef7e3984/src/jqmath.js#L258-L275 |
43,366 | luxp/jqmath | src/jqmath.js | parse_table_tokP | function parse_table_tokP (dtableQ) {
if (dtableQ === undefined) dtableQ = M.dtableQ;
var mtrs = [];
while (true) {
var mtrP_tokP = parse_mtr_tokP(mtrs.length == 0), mtrP = mtrP_tokP[0],
tokP = mtrP_tokP[1] || scanTokP();
if (mtrP) mtrs.push(mtrP);
if (!(tokP && tokP[1] == ';'))
return [n... | javascript | function parse_table_tokP (dtableQ) {
if (dtableQ === undefined) dtableQ = M.dtableQ;
var mtrs = [];
while (true) {
var mtrP_tokP = parse_mtr_tokP(mtrs.length == 0), mtrP = mtrP_tokP[0],
tokP = mtrP_tokP[1] || scanTokP();
if (mtrP) mtrs.push(mtrP);
if (!(tokP && tokP[1] == ';'))
return [n... | [
"function",
"parse_table_tokP",
"(",
"dtableQ",
")",
"{",
"if",
"(",
"dtableQ",
"===",
"undefined",
")",
"dtableQ",
"=",
"M",
".",
"dtableQ",
";",
"var",
"mtrs",
"=",
"[",
"]",
";",
"while",
"(",
"true",
")",
"{",
"var",
"mtrP_tokP",
"=",
"parse_mtr_to... | whether \table defaults to \dtable | [
"whether",
"\\",
"table",
"defaults",
"to",
"\\",
"dtable"
] | 7a6051159c11e69e0f6ecba6e3f89801ef7e3984 | https://github.com/luxp/jqmath/blob/7a6051159c11e69e0f6ecba6e3f89801ef7e3984/src/jqmath.js#L1101-L1113 |
43,367 | mhkeller/joiner | dist/joiner.node.js | listCacheSet$1 | function listCacheSet$1(key, value) {
var data = this.__data__,
index = assocIndexOf$4(data, key);
if (index < 0) {
++this.size;
data.push([key, value]);
} else {
data[index][1] = value;
}
return this;
} | javascript | function listCacheSet$1(key, value) {
var data = this.__data__,
index = assocIndexOf$4(data, key);
if (index < 0) {
++this.size;
data.push([key, value]);
} else {
data[index][1] = value;
}
return this;
} | [
"function",
"listCacheSet$1",
"(",
"key",
",",
"value",
")",
"{",
"var",
"data",
"=",
"this",
".",
"__data__",
",",
"index",
"=",
"assocIndexOf$4",
"(",
"data",
",",
"key",
")",
";",
"if",
"(",
"index",
"<",
"0",
")",
"{",
"++",
"this",
".",
"size"... | Sets the list cache `key` to `value`.
@private
@name set
@memberOf ListCache
@param {string} key The key of the value to set.
@param {*} value The value to set.
@returns {Object} Returns the list cache instance. | [
"Sets",
"the",
"list",
"cache",
"key",
"to",
"value",
"."
] | 97d3010f8b61e8899a4ca068cbf8d467de6dc4e6 | https://github.com/mhkeller/joiner/blob/97d3010f8b61e8899a4ca068cbf8d467de6dc4e6/dist/joiner.node.js#L162-L173 |
43,368 | mhkeller/joiner | dist/joiner.node.js | hashDelete$1 | function hashDelete$1(key) {
var result = this.has(key) && delete this.__data__[key];
this.size -= result ? 1 : 0;
return result;
} | javascript | function hashDelete$1(key) {
var result = this.has(key) && delete this.__data__[key];
this.size -= result ? 1 : 0;
return result;
} | [
"function",
"hashDelete$1",
"(",
"key",
")",
"{",
"var",
"result",
"=",
"this",
".",
"has",
"(",
"key",
")",
"&&",
"delete",
"this",
".",
"__data__",
"[",
"key",
"]",
";",
"this",
".",
"size",
"-=",
"result",
"?",
"1",
":",
"0",
";",
"return",
"r... | Removes `key` and its value from the hash.
@private
@name delete
@memberOf Hash
@param {Object} hash The hash to modify.
@param {string} key The key of the value to remove.
@returns {boolean} Returns `true` if the entry was removed, else `false`. | [
"Removes",
"key",
"and",
"its",
"value",
"from",
"the",
"hash",
"."
] | 97d3010f8b61e8899a4ca068cbf8d467de6dc4e6 | https://github.com/mhkeller/joiner/blob/97d3010f8b61e8899a4ca068cbf8d467de6dc4e6/dist/joiner.node.js#L647-L651 |
43,369 | mhkeller/joiner | dist/joiner.node.js | getMapData$1 | function getMapData$1(map, key) {
var data = map.__data__;
return isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map;
} | javascript | function getMapData$1(map, key) {
var data = map.__data__;
return isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map;
} | [
"function",
"getMapData$1",
"(",
"map",
",",
"key",
")",
"{",
"var",
"data",
"=",
"map",
".",
"__data__",
";",
"return",
"isKeyable",
"(",
"key",
")",
"?",
"data",
"[",
"typeof",
"key",
"==",
"'string'",
"?",
"'string'",
":",
"'hash'",
"]",
":",
"dat... | Gets the data for `map`.
@private
@param {Object} map The map to query.
@param {string} key The reference key.
@returns {*} Returns the map data. | [
"Gets",
"the",
"data",
"for",
"map",
"."
] | 97d3010f8b61e8899a4ca068cbf8d467de6dc4e6 | https://github.com/mhkeller/joiner/blob/97d3010f8b61e8899a4ca068cbf8d467de6dc4e6/dist/joiner.node.js#L813-L816 |
43,370 | mhkeller/joiner | dist/joiner.node.js | arrayEach$1 | function arrayEach$1(array, iteratee) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
if (iteratee(array[index], index, array) === false) {
break;
}
}
return array;
} | javascript | function arrayEach$1(array, iteratee) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
if (iteratee(array[index], index, array) === false) {
break;
}
}
return array;
} | [
"function",
"arrayEach$1",
"(",
"array",
",",
"iteratee",
")",
"{",
"var",
"index",
"=",
"-",
"1",
",",
"length",
"=",
"array",
"==",
"null",
"?",
"0",
":",
"array",
".",
"length",
";",
"while",
"(",
"++",
"index",
"<",
"length",
")",
"{",
"if",
... | A specialized version of `_.forEach` for arrays without support for
iteratee shorthands.
@private
@param {Array} [array] The array to iterate over.
@param {Function} iteratee The function invoked per iteration.
@returns {Array} Returns `array`. | [
"A",
"specialized",
"version",
"of",
"_",
".",
"forEach",
"for",
"arrays",
"without",
"support",
"for",
"iteratee",
"shorthands",
"."
] | 97d3010f8b61e8899a4ca068cbf8d467de6dc4e6 | https://github.com/mhkeller/joiner/blob/97d3010f8b61e8899a4ca068cbf8d467de6dc4e6/dist/joiner.node.js#L1001-L1011 |
43,371 | mhkeller/joiner | dist/joiner.node.js | copyArray$1 | function copyArray$1(source, array) {
var index = -1,
length = source.length;
array || (array = Array(length));
while (++index < length) {
array[index] = source[index];
}
return array;
} | javascript | function copyArray$1(source, array) {
var index = -1,
length = source.length;
array || (array = Array(length));
while (++index < length) {
array[index] = source[index];
}
return array;
} | [
"function",
"copyArray$1",
"(",
"source",
",",
"array",
")",
"{",
"var",
"index",
"=",
"-",
"1",
",",
"length",
"=",
"source",
".",
"length",
";",
"array",
"||",
"(",
"array",
"=",
"Array",
"(",
"length",
")",
")",
";",
"while",
"(",
"++",
"index",... | Copies the values of `source` to `array`.
@private
@param {Array} source The array to copy values from.
@param {Array} [array=[]] The array to copy values to.
@returns {Array} Returns `array`. | [
"Copies",
"the",
"values",
"of",
"source",
"to",
"array",
"."
] | 97d3010f8b61e8899a4ca068cbf8d467de6dc4e6 | https://github.com/mhkeller/joiner/blob/97d3010f8b61e8899a4ca068cbf8d467de6dc4e6/dist/joiner.node.js#L1851-L1860 |
43,372 | mhkeller/joiner | dist/joiner.node.js | arrayPush$1 | function arrayPush$1(array, values) {
var index = -1,
length = values.length,
offset = array.length;
while (++index < length) {
array[offset + index] = values[index];
}
return array;
} | javascript | function arrayPush$1(array, values) {
var index = -1,
length = values.length,
offset = array.length;
while (++index < length) {
array[offset + index] = values[index];
}
return array;
} | [
"function",
"arrayPush$1",
"(",
"array",
",",
"values",
")",
"{",
"var",
"index",
"=",
"-",
"1",
",",
"length",
"=",
"values",
".",
"length",
",",
"offset",
"=",
"array",
".",
"length",
";",
"while",
"(",
"++",
"index",
"<",
"length",
")",
"{",
"ar... | Appends the elements of `values` to `array`.
@private
@param {Array} array The array to modify.
@param {Array} values The values to append.
@returns {Array} Returns `array`. | [
"Appends",
"the",
"elements",
"of",
"values",
"to",
"array",
"."
] | 97d3010f8b61e8899a4ca068cbf8d467de6dc4e6 | https://github.com/mhkeller/joiner/blob/97d3010f8b61e8899a4ca068cbf8d467de6dc4e6/dist/joiner.node.js#L1970-L1979 |
43,373 | mhkeller/joiner | dist/joiner.node.js | setToArray$1 | function setToArray$1(set) {
var index = -1,
result = Array(set.size);
set.forEach(function (value) {
result[++index] = value;
});
return result;
} | javascript | function setToArray$1(set) {
var index = -1,
result = Array(set.size);
set.forEach(function (value) {
result[++index] = value;
});
return result;
} | [
"function",
"setToArray$1",
"(",
"set",
")",
"{",
"var",
"index",
"=",
"-",
"1",
",",
"result",
"=",
"Array",
"(",
"set",
".",
"size",
")",
";",
"set",
".",
"forEach",
"(",
"function",
"(",
"value",
")",
"{",
"result",
"[",
"++",
"index",
"]",
"=... | Converts `set` to an array of its values.
@private
@param {Object} set The set to convert.
@returns {Array} Returns the values. | [
"Converts",
"set",
"to",
"an",
"array",
"of",
"its",
"values",
"."
] | 97d3010f8b61e8899a4ca068cbf8d467de6dc4e6 | https://github.com/mhkeller/joiner/blob/97d3010f8b61e8899a4ca068cbf8d467de6dc4e6/dist/joiner.node.js#L2375-L2383 |
43,374 | mhkeller/joiner | dist/joiner.node.js | arrayMap$1 | function arrayMap$1(array, iteratee) {
var index = -1,
length = array == null ? 0 : array.length,
result = Array(length);
while (++index < length) {
result[index] = iteratee(array[index], index, array);
}
return result;
} | javascript | function arrayMap$1(array, iteratee) {
var index = -1,
length = array == null ? 0 : array.length,
result = Array(length);
while (++index < length) {
result[index] = iteratee(array[index], index, array);
}
return result;
} | [
"function",
"arrayMap$1",
"(",
"array",
",",
"iteratee",
")",
"{",
"var",
"index",
"=",
"-",
"1",
",",
"length",
"=",
"array",
"==",
"null",
"?",
"0",
":",
"array",
".",
"length",
",",
"result",
"=",
"Array",
"(",
"length",
")",
";",
"while",
"(",
... | A specialized version of `_.map` for arrays without support for iteratee
shorthands.
@private
@param {Array} [array] The array to iterate over.
@param {Function} iteratee The function invoked per iteration.
@returns {Array} Returns the new mapped array. | [
"A",
"specialized",
"version",
"of",
"_",
".",
"map",
"for",
"arrays",
"without",
"support",
"for",
"iteratee",
"shorthands",
"."
] | 97d3010f8b61e8899a4ca068cbf8d467de6dc4e6 | https://github.com/mhkeller/joiner/blob/97d3010f8b61e8899a4ca068cbf8d467de6dc4e6/dist/joiner.node.js#L2940-L2949 |
43,375 | mhkeller/joiner | dist/joiner.node.js | baseSet$1 | function baseSet$1(object, path, value, customizer) {
if (!isObject$6(object)) {
return object;
}
path = castPath$2(path, object);
var index = -1,
length = path.length,
lastIndex = length - 1,
nested = object;
while (nested != null && ++index < length) {
var key = toKey$2(path[inde... | javascript | function baseSet$1(object, path, value, customizer) {
if (!isObject$6(object)) {
return object;
}
path = castPath$2(path, object);
var index = -1,
length = path.length,
lastIndex = length - 1,
nested = object;
while (nested != null && ++index < length) {
var key = toKey$2(path[inde... | [
"function",
"baseSet$1",
"(",
"object",
",",
"path",
",",
"value",
",",
"customizer",
")",
"{",
"if",
"(",
"!",
"isObject$6",
"(",
"object",
")",
")",
"{",
"return",
"object",
";",
"}",
"path",
"=",
"castPath$2",
"(",
"path",
",",
"object",
")",
";",... | The base implementation of `_.set`.
@private
@param {Object} object The object to modify.
@param {Array|string} path The path of the property to set.
@param {*} value The value to set.
@param {Function} [customizer] The function to customize path creation.
@returns {Object} Returns `object`. | [
"The",
"base",
"implementation",
"of",
"_",
".",
"set",
"."
] | 97d3010f8b61e8899a4ca068cbf8d467de6dc4e6 | https://github.com/mhkeller/joiner/blob/97d3010f8b61e8899a4ca068cbf8d467de6dc4e6/dist/joiner.node.js#L3139-L3165 |
43,376 | mhkeller/joiner | dist/joiner.node.js | baseSlice$1 | function baseSlice$1(array, start, end) {
var index = -1,
length = array.length;
if (start < 0) {
start = -start > length ? 0 : length + start;
}
end = end > length ? length : end;
if (end < 0) {
end += length;
}
length = start > end ? 0 : end - start >>> 0;
start >>>= 0;
var result = ... | javascript | function baseSlice$1(array, start, end) {
var index = -1,
length = array.length;
if (start < 0) {
start = -start > length ? 0 : length + start;
}
end = end > length ? length : end;
if (end < 0) {
end += length;
}
length = start > end ? 0 : end - start >>> 0;
start >>>= 0;
var result = ... | [
"function",
"baseSlice$1",
"(",
"array",
",",
"start",
",",
"end",
")",
"{",
"var",
"index",
"=",
"-",
"1",
",",
"length",
"=",
"array",
".",
"length",
";",
"if",
"(",
"start",
"<",
"0",
")",
"{",
"start",
"=",
"-",
"start",
">",
"length",
"?",
... | The base implementation of `_.slice` without an iteratee call guard.
@private
@param {Array} array The array to slice.
@param {number} [start=0] The start position.
@param {number} [end=array.length] The end position.
@returns {Array} Returns the slice of `array`. | [
"The",
"base",
"implementation",
"of",
"_",
".",
"slice",
"without",
"an",
"iteratee",
"call",
"guard",
"."
] | 97d3010f8b61e8899a4ca068cbf8d467de6dc4e6 | https://github.com/mhkeller/joiner/blob/97d3010f8b61e8899a4ca068cbf8d467de6dc4e6/dist/joiner.node.js#L3235-L3254 |
43,377 | mhkeller/joiner | dist/joiner.node.js | baseUnset$1 | function baseUnset$1(object, path) {
path = castPath$3(path, object);
object = parent(object, path);
return object == null || delete object[toKey$3(last(path))];
} | javascript | function baseUnset$1(object, path) {
path = castPath$3(path, object);
object = parent(object, path);
return object == null || delete object[toKey$3(last(path))];
} | [
"function",
"baseUnset$1",
"(",
"object",
",",
"path",
")",
"{",
"path",
"=",
"castPath$3",
"(",
"path",
",",
"object",
")",
";",
"object",
"=",
"parent",
"(",
"object",
",",
"path",
")",
";",
"return",
"object",
"==",
"null",
"||",
"delete",
"object",... | The base implementation of `_.unset`.
@private
@param {Object} object The object to modify.
@param {Array|string} path The property path to unset.
@returns {boolean} Returns `true` if the property is deleted, else `false`. | [
"The",
"base",
"implementation",
"of",
"_",
".",
"unset",
"."
] | 97d3010f8b61e8899a4ca068cbf8d467de6dc4e6 | https://github.com/mhkeller/joiner/blob/97d3010f8b61e8899a4ca068cbf8d467de6dc4e6/dist/joiner.node.js#L3288-L3292 |
43,378 | mhkeller/joiner | dist/joiner.node.js | baseFindIndex$1 | function baseFindIndex$1(array, predicate, fromIndex, fromRight) {
var length = array.length,
index = fromIndex + (fromRight ? 1 : -1);
while (fromRight ? index-- : ++index < length) {
if (predicate(array[index], index, array)) {
return index;
}
}
return -1;
} | javascript | function baseFindIndex$1(array, predicate, fromIndex, fromRight) {
var length = array.length,
index = fromIndex + (fromRight ? 1 : -1);
while (fromRight ? index-- : ++index < length) {
if (predicate(array[index], index, array)) {
return index;
}
}
return -1;
} | [
"function",
"baseFindIndex$1",
"(",
"array",
",",
"predicate",
",",
"fromIndex",
",",
"fromRight",
")",
"{",
"var",
"length",
"=",
"array",
".",
"length",
",",
"index",
"=",
"fromIndex",
"+",
"(",
"fromRight",
"?",
"1",
":",
"-",
"1",
")",
";",
"while"... | The base implementation of `_.findIndex` and `_.findLastIndex` without
support for iteratee shorthands.
@private
@param {Array} array The array to inspect.
@param {Function} predicate The function invoked per iteration.
@param {number} fromIndex The index to search from.
@param {boolean} [fromRight] Specify iterating ... | [
"The",
"base",
"implementation",
"of",
"_",
".",
"findIndex",
"and",
"_",
".",
"findLastIndex",
"without",
"support",
"for",
"iteratee",
"shorthands",
"."
] | 97d3010f8b61e8899a4ca068cbf8d467de6dc4e6 | https://github.com/mhkeller/joiner/blob/97d3010f8b61e8899a4ca068cbf8d467de6dc4e6/dist/joiner.node.js#L3405-L3415 |
43,379 | mhkeller/joiner | dist/joiner.node.js | baseIndexOf$1 | function baseIndexOf$1(array, value, fromIndex) {
return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex);
} | javascript | function baseIndexOf$1(array, value, fromIndex) {
return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex);
} | [
"function",
"baseIndexOf$1",
"(",
"array",
",",
"value",
",",
"fromIndex",
")",
"{",
"return",
"value",
"===",
"value",
"?",
"strictIndexOf",
"(",
"array",
",",
"value",
",",
"fromIndex",
")",
":",
"baseFindIndex",
"(",
"array",
",",
"baseIsNaN",
",",
"fro... | The base implementation of `_.indexOf` without `fromIndex` bounds checks.
@private
@param {Array} array The array to inspect.
@param {*} value The value to search for.
@param {number} fromIndex The index to search from.
@returns {number} Returns the index of the matched value, else `-1`. | [
"The",
"base",
"implementation",
"of",
"_",
".",
"indexOf",
"without",
"fromIndex",
"bounds",
"checks",
"."
] | 97d3010f8b61e8899a4ca068cbf8d467de6dc4e6 | https://github.com/mhkeller/joiner/blob/97d3010f8b61e8899a4ca068cbf8d467de6dc4e6/dist/joiner.node.js#L3469-L3471 |
43,380 | mhkeller/joiner | dist/joiner.node.js | shortOut$1 | function shortOut$1(func) {
var count = 0,
lastCalled = 0;
return function () {
var stamp = nativeNow(),
remaining = HOT_SPAN - (stamp - lastCalled);
lastCalled = stamp;
if (remaining > 0) {
if (++count >= HOT_COUNT) {
return arguments[0];
}
} else {
count =... | javascript | function shortOut$1(func) {
var count = 0,
lastCalled = 0;
return function () {
var stamp = nativeNow(),
remaining = HOT_SPAN - (stamp - lastCalled);
lastCalled = stamp;
if (remaining > 0) {
if (++count >= HOT_COUNT) {
return arguments[0];
}
} else {
count =... | [
"function",
"shortOut$1",
"(",
"func",
")",
"{",
"var",
"count",
"=",
"0",
",",
"lastCalled",
"=",
"0",
";",
"return",
"function",
"(",
")",
"{",
"var",
"stamp",
"=",
"nativeNow",
"(",
")",
",",
"remaining",
"=",
"HOT_SPAN",
"-",
"(",
"stamp",
"-",
... | Creates a function that'll short out and invoke `identity` instead
of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
milliseconds.
@private
@param {Function} func The function to restrict.
@returns {Function} Returns the new shortable function. | [
"Creates",
"a",
"function",
"that",
"ll",
"short",
"out",
"and",
"invoke",
"identity",
"instead",
"of",
"func",
"when",
"it",
"s",
"called",
"HOT_COUNT",
"or",
"more",
"times",
"in",
"HOT_SPAN",
"milliseconds",
"."
] | 97d3010f8b61e8899a4ca068cbf8d467de6dc4e6 | https://github.com/mhkeller/joiner/blob/97d3010f8b61e8899a4ca068cbf8d467de6dc4e6/dist/joiner.node.js#L3747-L3765 |
43,381 | mhkeller/joiner | dist/joiner.node.js | baseDifference$1 | function baseDifference$1(array, values, iteratee, comparator) {
var index = -1,
includes = arrayIncludes$2,
isCommon = true,
length = array.length,
result = [],
valuesLength = values.length;
if (!length) {
return result;
}
if (iteratee) {
values = arrayMap$4(values, baseU... | javascript | function baseDifference$1(array, values, iteratee, comparator) {
var index = -1,
includes = arrayIncludes$2,
isCommon = true,
length = array.length,
result = [],
valuesLength = values.length;
if (!length) {
return result;
}
if (iteratee) {
values = arrayMap$4(values, baseU... | [
"function",
"baseDifference$1",
"(",
"array",
",",
"values",
",",
"iteratee",
",",
"comparator",
")",
"{",
"var",
"index",
"=",
"-",
"1",
",",
"includes",
"=",
"arrayIncludes$2",
",",
"isCommon",
"=",
"true",
",",
"length",
"=",
"array",
".",
"length",
"... | The base implementation of methods like `_.difference` without support
for excluding multiple arrays or iteratee shorthands.
@private
@param {Array} array The array to inspect.
@param {Array} values The values to exclude.
@param {Function} [iteratee] The iteratee invoked per element.
@param {Function} [comparator] The... | [
"The",
"base",
"implementation",
"of",
"methods",
"like",
"_",
".",
"difference",
"without",
"support",
"for",
"excluding",
"multiple",
"arrays",
"or",
"iteratee",
"shorthands",
"."
] | 97d3010f8b61e8899a4ca068cbf8d467de6dc4e6 | https://github.com/mhkeller/joiner/blob/97d3010f8b61e8899a4ca068cbf8d467de6dc4e6/dist/joiner.node.js#L3901-L3941 |
43,382 | mhkeller/joiner | dist/joiner.node.js | baseFlatten$1 | function baseFlatten$1(array, depth, predicate, isStrict, result) {
var index = -1,
length = array.length;
predicate || (predicate = isFlattenable);
result || (result = []);
while (++index < length) {
var value = array[index];
if (depth > 0 && predicate(value)) {
if (depth > 1) {
/... | javascript | function baseFlatten$1(array, depth, predicate, isStrict, result) {
var index = -1,
length = array.length;
predicate || (predicate = isFlattenable);
result || (result = []);
while (++index < length) {
var value = array[index];
if (depth > 0 && predicate(value)) {
if (depth > 1) {
/... | [
"function",
"baseFlatten$1",
"(",
"array",
",",
"depth",
",",
"predicate",
",",
"isStrict",
",",
"result",
")",
"{",
"var",
"index",
"=",
"-",
"1",
",",
"length",
"=",
"array",
".",
"length",
";",
"predicate",
"||",
"(",
"predicate",
"=",
"isFlattenable"... | The base implementation of `_.flatten` with support for restricting flattening.
@private
@param {Array} array The array to flatten.
@param {number} depth The maximum recursion depth.
@param {boolean} [predicate=isFlattenable] The function invoked per iteration.
@param {boolean} [isStrict] Restrict to values that pass ... | [
"The",
"base",
"implementation",
"of",
"_",
".",
"flatten",
"with",
"support",
"for",
"restricting",
"flattening",
"."
] | 97d3010f8b61e8899a4ca068cbf8d467de6dc4e6 | https://github.com/mhkeller/joiner/blob/97d3010f8b61e8899a4ca068cbf8d467de6dc4e6/dist/joiner.node.js#L3979-L4000 |
43,383 | krauskopf/node-red-contrib-avr-yamaha | avr-yamaha.js | function() {
if (node.debug) {
node.log('STARTING event listener');
}
var net = require('net');
var dgram = require('dgram');
node.inputSocket = dgram.createSocket({type:'udp4', reuseAddr: true});
node.inputSocket.on('notify', function (event) {
if (node.debug) {
... | javascript | function() {
if (node.debug) {
node.log('STARTING event listener');
}
var net = require('net');
var dgram = require('dgram');
node.inputSocket = dgram.createSocket({type:'udp4', reuseAddr: true});
node.inputSocket.on('notify', function (event) {
if (node.debug) {
... | [
"function",
"(",
")",
"{",
"if",
"(",
"node",
".",
"debug",
")",
"{",
"node",
".",
"log",
"(",
"'STARTING event listener'",
")",
";",
"}",
"var",
"net",
"=",
"require",
"(",
"'net'",
")",
";",
"var",
"dgram",
"=",
"require",
"(",
"'dgram'",
")",
";... | Internal sub routines | [
"Internal",
"sub",
"routines"
] | 88c66f4831c3b739c75173756bf62883cdf9391d | https://github.com/krauskopf/node-red-contrib-avr-yamaha/blob/88c66f4831c3b739c75173756bf62883cdf9391d/avr-yamaha.js#L318-L548 | |
43,384 | doowb/unlazy-loader | index.js | transform | function transform(str) {
str = str.split(/^lazy\(/gm).join('require(');
var lines = str.split(/\r\n|\n/);
var len = lines.length;
var re = regex();
var idx = 0;
var start = false;
var isExported = false;
var namespace;
var res = '';
while (idx < len) {
var line = lines[idx++];
res += '\n'... | javascript | function transform(str) {
str = str.split(/^lazy\(/gm).join('require(');
var lines = str.split(/\r\n|\n/);
var len = lines.length;
var re = regex();
var idx = 0;
var start = false;
var isExported = false;
var namespace;
var res = '';
while (idx < len) {
var line = lines[idx++];
res += '\n'... | [
"function",
"transform",
"(",
"str",
")",
"{",
"str",
"=",
"str",
".",
"split",
"(",
"/",
"^lazy\\(",
"/",
"gm",
")",
".",
"join",
"(",
"'require('",
")",
";",
"var",
"lines",
"=",
"str",
".",
"split",
"(",
"/",
"\\r\\n|\\n",
"/",
")",
";",
"var"... | Transform source code containing lazy-cache statements into a requirable file usable with webpack.
@param {String} `source` Source code.
@return {String} Transformed source code. | [
"Transform",
"source",
"code",
"containing",
"lazy",
"-",
"cache",
"statements",
"into",
"a",
"requirable",
"file",
"usable",
"with",
"webpack",
"."
] | 52bc36ef8ce08a72d2181f25b7370f5f5271ea47 | https://github.com/doowb/unlazy-loader/blob/52bc36ef8ce08a72d2181f25b7370f5f5271ea47/index.js#L48-L107 |
43,385 | doowb/unlazy-loader | index.js | camelcase | function camelcase(str) {
if (!/[\s\W]/.test(str)) return str;
if (str.length === 1) {
return str.toLowerCase();
}
str = str.replace(/^[\W_]+|[\W_]+$/g, '').toLowerCase();
return str.replace(/[\W_]+(\w|$)/g, function(_, ch) {
return ch.toUpperCase();
});
} | javascript | function camelcase(str) {
if (!/[\s\W]/.test(str)) return str;
if (str.length === 1) {
return str.toLowerCase();
}
str = str.replace(/^[\W_]+|[\W_]+$/g, '').toLowerCase();
return str.replace(/[\W_]+(\w|$)/g, function(_, ch) {
return ch.toUpperCase();
});
} | [
"function",
"camelcase",
"(",
"str",
")",
"{",
"if",
"(",
"!",
"/",
"[\\s\\W]",
"/",
".",
"test",
"(",
"str",
")",
")",
"return",
"str",
";",
"if",
"(",
"str",
".",
"length",
"===",
"1",
")",
"{",
"return",
"str",
".",
"toLowerCase",
"(",
")",
... | Used to camelcase the module if a variable is not defined.
@param {String} `str` String containing `_`, `.`, `-` or whitespace that will be camelcased.
@return {String} camelcased string. | [
"Used",
"to",
"camelcase",
"the",
"module",
"if",
"a",
"variable",
"is",
"not",
"defined",
"."
] | 52bc36ef8ce08a72d2181f25b7370f5f5271ea47 | https://github.com/doowb/unlazy-loader/blob/52bc36ef8ce08a72d2181f25b7370f5f5271ea47/index.js#L133-L142 |
43,386 | dongsik-yoo/assemblyscript-live-loader | lib/index.js | createWasmModule | function createWasmModule(source, wasm) {
var length = wasm.length;
var buffer = [];
for (var i = 0; i < length; i += 1) {
buffer.push(wasm[i]);
}
var module = "var buffer = new ArrayBuffer(" + wasm.length + ");\n var uint8 = new Uint8Array(buffer);\n uint8.set([" + buffer.join... | javascript | function createWasmModule(source, wasm) {
var length = wasm.length;
var buffer = [];
for (var i = 0; i < length; i += 1) {
buffer.push(wasm[i]);
}
var module = "var buffer = new ArrayBuffer(" + wasm.length + ");\n var uint8 = new Uint8Array(buffer);\n uint8.set([" + buffer.join... | [
"function",
"createWasmModule",
"(",
"source",
",",
"wasm",
")",
"{",
"var",
"length",
"=",
"wasm",
".",
"length",
";",
"var",
"buffer",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"+=",
"1",
")",
"{... | Create a module using WebAssembly.Module
@param {string} source assemblyscript source
@param {Buffer} wasm WebAssembly Buffer
@returns {string} module string | [
"Create",
"a",
"module",
"using",
"WebAssembly",
".",
"Module"
] | f1b5b4b28a66d2a8534224d0a962ff90bd3741a0 | https://github.com/dongsik-yoo/assemblyscript-live-loader/blob/f1b5b4b28a66d2a8534224d0a962ff90bd3741a0/lib/index.js#L37-L45 |
43,387 | dongsik-yoo/assemblyscript-live-loader | lib/index.js | createJsModule | function createJsModule(source) {
var compilerOptions = {
compilerOptions: {
target: ts.ScriptTarget.ES5,
module: ts.ModuleKind.CommonJS,
alwaysStrict: false
}
};
var transpiled = ts.transpileModule(source, compilerOptions);
return transpiled.outputTex... | javascript | function createJsModule(source) {
var compilerOptions = {
compilerOptions: {
target: ts.ScriptTarget.ES5,
module: ts.ModuleKind.CommonJS,
alwaysStrict: false
}
};
var transpiled = ts.transpileModule(source, compilerOptions);
return transpiled.outputTex... | [
"function",
"createJsModule",
"(",
"source",
")",
"{",
"var",
"compilerOptions",
"=",
"{",
"compilerOptions",
":",
"{",
"target",
":",
"ts",
".",
"ScriptTarget",
".",
"ES5",
",",
"module",
":",
"ts",
".",
"ModuleKind",
".",
"CommonJS",
",",
"alwaysStrict",
... | Creates commonjs module for javascript
@param {string} source assemblyscript source
@returns {string} module string | [
"Creates",
"commonjs",
"module",
"for",
"javascript"
] | f1b5b4b28a66d2a8534224d0a962ff90bd3741a0 | https://github.com/dongsik-yoo/assemblyscript-live-loader/blob/f1b5b4b28a66d2a8534224d0a962ff90bd3741a0/lib/index.js#L51-L61 |
43,388 | dongsik-yoo/assemblyscript-live-loader | lib/index.js | AssemblyScriptLiveLoader | function AssemblyScriptLiveLoader(source) {
var jsModule;
var wasmModule;
if (this.cacheable) {
this.cacheable();
}
this.addDependency(wasmFooterPath);
jsModule = createJsModule(source);
wasmModule = createWasmModule(source, compile(source));
return createCompatibleModule(jsModul... | javascript | function AssemblyScriptLiveLoader(source) {
var jsModule;
var wasmModule;
if (this.cacheable) {
this.cacheable();
}
this.addDependency(wasmFooterPath);
jsModule = createJsModule(source);
wasmModule = createWasmModule(source, compile(source));
return createCompatibleModule(jsModul... | [
"function",
"AssemblyScriptLiveLoader",
"(",
"source",
")",
"{",
"var",
"jsModule",
";",
"var",
"wasmModule",
";",
"if",
"(",
"this",
".",
"cacheable",
")",
"{",
"this",
".",
"cacheable",
"(",
")",
";",
"}",
"this",
".",
"addDependency",
"(",
"wasmFooterPa... | Webpack loader for assemblyscript to transform wasm and bundle it
@param {string} source - assemblyscript source file
@returns {string} module string | [
"Webpack",
"loader",
"for",
"assemblyscript",
"to",
"transform",
"wasm",
"and",
"bundle",
"it"
] | f1b5b4b28a66d2a8534224d0a962ff90bd3741a0 | https://github.com/dongsik-yoo/assemblyscript-live-loader/blob/f1b5b4b28a66d2a8534224d0a962ff90bd3741a0/lib/index.js#L89-L99 |
43,389 | otothea/node-twitchcmd | lib/helpers.js | createTimeout | function createTimeout(timer, i, callback) {
return setTimeout(function() {
callback(timer, i);
}, timer.seconds * 1000);
} | javascript | function createTimeout(timer, i, callback) {
return setTimeout(function() {
callback(timer, i);
}, timer.seconds * 1000);
} | [
"function",
"createTimeout",
"(",
"timer",
",",
"i",
",",
"callback",
")",
"{",
"return",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"callback",
"(",
"timer",
",",
"i",
")",
";",
"}",
",",
"timer",
".",
"seconds",
"*",
"1000",
")",
";",
"}"
] | Create a new timeout
@param timer {object} - timer to use for the timeout
@param i {number} - index of the timer object
@param callback {function} - function to call when the timeout triggers | [
"Create",
"a",
"new",
"timeout"
] | 8fd3e0ceda2e9ee179721bc53b9ce8f31ca6f638 | https://github.com/otothea/node-twitchcmd/blob/8fd3e0ceda2e9ee179721bc53b9ce8f31ca6f638/lib/helpers.js#L78-L82 |
43,390 | otothea/node-twitchcmd | index.js | init | function init(_config) {
if (initialized)
return;
// Validate the config
config = helpers.validateConfig(_config);
// Create a user for the bot
users[config.name] = helpers.createUser(true);
// Create a user for the channel owner
var name = config.channel.replace('#', '');
users[name] = helpers.c... | javascript | function init(_config) {
if (initialized)
return;
// Validate the config
config = helpers.validateConfig(_config);
// Create a user for the bot
users[config.name] = helpers.createUser(true);
// Create a user for the channel owner
var name = config.channel.replace('#', '');
users[name] = helpers.c... | [
"function",
"init",
"(",
"_config",
")",
"{",
"if",
"(",
"initialized",
")",
"return",
";",
"// Validate the config",
"config",
"=",
"helpers",
".",
"validateConfig",
"(",
"_config",
")",
";",
"// Create a user for the bot",
"users",
"[",
"config",
".",
"name",
... | Init the twitch bot
@param _config {object} - config to init the bot with | [
"Init",
"the",
"twitch",
"bot"
] | 8fd3e0ceda2e9ee179721bc53b9ce8f31ca6f638 | https://github.com/otothea/node-twitchcmd/blob/8fd3e0ceda2e9ee179721bc53b9ce8f31ca6f638/index.js#L43-L98 |
43,391 | otothea/node-twitchcmd | index.js | exit | function exit() {
if (!initialized || exited)
return;
log('Exiting...', true);
// Leave the twitch channel
if (ircClient)
ircClient.part(config.channel);
// Leave discord
if (discordClient)
discordClient.disconnect();
// Clear the stream check interval
if (streamInterval)
clearInterv... | javascript | function exit() {
if (!initialized || exited)
return;
log('Exiting...', true);
// Leave the twitch channel
if (ircClient)
ircClient.part(config.channel);
// Leave discord
if (discordClient)
discordClient.disconnect();
// Clear the stream check interval
if (streamInterval)
clearInterv... | [
"function",
"exit",
"(",
")",
"{",
"if",
"(",
"!",
"initialized",
"||",
"exited",
")",
"return",
";",
"log",
"(",
"'Exiting...'",
",",
"true",
")",
";",
"// Leave the twitch channel",
"if",
"(",
"ircClient",
")",
"ircClient",
".",
"part",
"(",
"config",
... | Exit the twitch bot | [
"Exit",
"the",
"twitch",
"bot"
] | 8fd3e0ceda2e9ee179721bc53b9ce8f31ca6f638 | https://github.com/otothea/node-twitchcmd/blob/8fd3e0ceda2e9ee179721bc53b9ce8f31ca6f638/index.js#L103-L127 |
43,392 | otothea/node-twitchcmd | index.js | isSpam | function isSpam(from, message) {
if (!config.filterSpam)
return false;
// Skip if this is a mod
if (users[from] && users[from].mod)
return false;
// Check for capital letter spam
var uppercaseCount = message.replace(/[^A-Z]/g, '').length;
if (uppercaseCount >= 10 && uppercaseCount >= message.lengt... | javascript | function isSpam(from, message) {
if (!config.filterSpam)
return false;
// Skip if this is a mod
if (users[from] && users[from].mod)
return false;
// Check for capital letter spam
var uppercaseCount = message.replace(/[^A-Z]/g, '').length;
if (uppercaseCount >= 10 && uppercaseCount >= message.lengt... | [
"function",
"isSpam",
"(",
"from",
",",
"message",
")",
"{",
"if",
"(",
"!",
"config",
".",
"filterSpam",
")",
"return",
"false",
";",
"// Skip if this is a mod",
"if",
"(",
"users",
"[",
"from",
"]",
"&&",
"users",
"[",
"from",
"]",
".",
"mod",
")",
... | Helper functions
Check if message is spam
@param from {string} - nickname of user who sent the message
@param message {string} - message being sent
@returns {boolean} - true if spam, false if not | [
"Helper",
"functions",
"Check",
"if",
"message",
"is",
"spam"
] | 8fd3e0ceda2e9ee179721bc53b9ce8f31ca6f638 | https://github.com/otothea/node-twitchcmd/blob/8fd3e0ceda2e9ee179721bc53b9ce8f31ca6f638/index.js#L367-L383 |
43,393 | otothea/node-twitchcmd | index.js | timeoutUser | function timeoutUser(name, seconds, reason) {
// Create a user if it doesn't exist
users[name] = users[name] || helpers.createUser();
users[name].offenses++;
var offenses = users[name].offenses;
if (offenses > config.maxOffenses)
banUser(name);
else {
seconds = seconds || (offenses === 1 ? 10 : 60... | javascript | function timeoutUser(name, seconds, reason) {
// Create a user if it doesn't exist
users[name] = users[name] || helpers.createUser();
users[name].offenses++;
var offenses = users[name].offenses;
if (offenses > config.maxOffenses)
banUser(name);
else {
seconds = seconds || (offenses === 1 ? 10 : 60... | [
"function",
"timeoutUser",
"(",
"name",
",",
"seconds",
",",
"reason",
")",
"{",
"// Create a user if it doesn't exist",
"users",
"[",
"name",
"]",
"=",
"users",
"[",
"name",
"]",
"||",
"helpers",
".",
"createUser",
"(",
")",
";",
"users",
"[",
"name",
"]"... | Timeout a user in chat
@param name {string} - nickname of the user to timeout
@param seconds {number|null} - number of seconds to timeout
@param reason {string} - the reason for the timeout | [
"Timeout",
"a",
"user",
"in",
"chat"
] | 8fd3e0ceda2e9ee179721bc53b9ce8f31ca6f638 | https://github.com/otothea/node-twitchcmd/blob/8fd3e0ceda2e9ee179721bc53b9ce8f31ca6f638/index.js#L406-L419 |
43,394 | otothea/node-twitchcmd | index.js | say | function say(message, channelId) {
channelId = channelId || false;
if (channelId) {
sendDiscordMessage(channelId, message);
return;
}
if (!ircClient || typeof message !== 'string')
return;
ircClient.say(config.channel, message);
} | javascript | function say(message, channelId) {
channelId = channelId || false;
if (channelId) {
sendDiscordMessage(channelId, message);
return;
}
if (!ircClient || typeof message !== 'string')
return;
ircClient.say(config.channel, message);
} | [
"function",
"say",
"(",
"message",
",",
"channelId",
")",
"{",
"channelId",
"=",
"channelId",
"||",
"false",
";",
"if",
"(",
"channelId",
")",
"{",
"sendDiscordMessage",
"(",
"channelId",
",",
"message",
")",
";",
"return",
";",
"}",
"if",
"(",
"!",
"i... | Say a message to chat
@param message {string} - send a message to chat
@param [channelId] {string} - id of discord channel | [
"Say",
"a",
"message",
"to",
"chat"
] | 8fd3e0ceda2e9ee179721bc53b9ce8f31ca6f638 | https://github.com/otothea/node-twitchcmd/blob/8fd3e0ceda2e9ee179721bc53b9ce8f31ca6f638/index.js#L436-L448 |
43,395 | otothea/node-twitchcmd | index.js | sendDiscordMessage | function sendDiscordMessage(id, message) {
if (!discordClient || typeof id !== 'string' || typeof message !== 'string')
return;
discordClient.sendMessage({
to: id,
message: message,
});
} | javascript | function sendDiscordMessage(id, message) {
if (!discordClient || typeof id !== 'string' || typeof message !== 'string')
return;
discordClient.sendMessage({
to: id,
message: message,
});
} | [
"function",
"sendDiscordMessage",
"(",
"id",
",",
"message",
")",
"{",
"if",
"(",
"!",
"discordClient",
"||",
"typeof",
"id",
"!==",
"'string'",
"||",
"typeof",
"message",
"!==",
"'string'",
")",
"return",
";",
"discordClient",
".",
"sendMessage",
"(",
"{",
... | Send a message to Discord channel
@param id {string} - id of the channel to send message
@param message {string} - message to send to channel | [
"Send",
"a",
"message",
"to",
"Discord",
"channel"
] | 8fd3e0ceda2e9ee179721bc53b9ce8f31ca6f638 | https://github.com/otothea/node-twitchcmd/blob/8fd3e0ceda2e9ee179721bc53b9ce8f31ca6f638/index.js#L456-L464 |
43,396 | otothea/node-twitchcmd | index.js | logChat | function logChat(from, message) {
if (typeof config.log !== 'string' || !from || typeof message !== 'string')
return;
// Get the current moment
var now = moment();
// Create the file name
var file = path.join(config.log, now.format('YYYY-MM-DD') + '-' + 'chat.log');
// Create the text to log based on... | javascript | function logChat(from, message) {
if (typeof config.log !== 'string' || !from || typeof message !== 'string')
return;
// Get the current moment
var now = moment();
// Create the file name
var file = path.join(config.log, now.format('YYYY-MM-DD') + '-' + 'chat.log');
// Create the text to log based on... | [
"function",
"logChat",
"(",
"from",
",",
"message",
")",
"{",
"if",
"(",
"typeof",
"config",
".",
"log",
"!==",
"'string'",
"||",
"!",
"from",
"||",
"typeof",
"message",
"!==",
"'string'",
")",
"return",
";",
"// Get the current moment",
"var",
"now",
"=",... | Log message to chat logs
@param from {string} - name of person sending the message
@param message {string} - the message sent | [
"Log",
"message",
"to",
"chat",
"logs"
] | 8fd3e0ceda2e9ee179721bc53b9ce8f31ca6f638 | https://github.com/otothea/node-twitchcmd/blob/8fd3e0ceda2e9ee179721bc53b9ce8f31ca6f638/index.js#L472-L490 |
43,397 | jfairbank/marionette.component | src/marionette.component.js | function(region) {
if (this._isShown) {
throw new Error('This component is already shown in a region.');
}
if (!region) {
throw new Error('Please supply a region to show inside.');
}
this.region = region;
this.triggerMethod('before:show');
this._showView();
this._isShown ... | javascript | function(region) {
if (this._isShown) {
throw new Error('This component is already shown in a region.');
}
if (!region) {
throw new Error('Please supply a region to show inside.');
}
this.region = region;
this.triggerMethod('before:show');
this._showView();
this._isShown ... | [
"function",
"(",
"region",
")",
"{",
"if",
"(",
"this",
".",
"_isShown",
")",
"{",
"throw",
"new",
"Error",
"(",
"'This component is already shown in a region.'",
")",
";",
"}",
"if",
"(",
"!",
"region",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Please sup... | Show this component inside a region | [
"Show",
"this",
"component",
"inside",
"a",
"region"
] | 590c12ea65add290b46f44cdf465b5f2cc9d1e2e | https://github.com/jfairbank/marionette.component/blob/590c12ea65add290b46f44cdf465b5f2cc9d1e2e/src/marionette.component.js#L18-L35 | |
43,398 | jfairbank/marionette.component | src/marionette.component.js | function() {
var view = this.view = this._getView();
this._initializeViewEvents();
// Trigger show:view after the view is shown in the region
this.listenTo(view, 'show', _.partial(this.triggerMethod, 'show:view'));
// Trigger before:show before the region shows the view
this.triggerMethod('be... | javascript | function() {
var view = this.view = this._getView();
this._initializeViewEvents();
// Trigger show:view after the view is shown in the region
this.listenTo(view, 'show', _.partial(this.triggerMethod, 'show:view'));
// Trigger before:show before the region shows the view
this.triggerMethod('be... | [
"function",
"(",
")",
"{",
"var",
"view",
"=",
"this",
".",
"view",
"=",
"this",
".",
"_getView",
"(",
")",
";",
"this",
".",
"_initializeViewEvents",
"(",
")",
";",
"// Trigger show:view after the view is shown in the region",
"this",
".",
"listenTo",
"(",
"v... | Show the view in the region | [
"Show",
"the",
"view",
"in",
"the",
"region"
] | 590c12ea65add290b46f44cdf465b5f2cc9d1e2e | https://github.com/jfairbank/marionette.component/blob/590c12ea65add290b46f44cdf465b5f2cc9d1e2e/src/marionette.component.js#L55-L72 | |
43,399 | yamadapc/mocha-spec-cov-alt | bin/index.js | any | function any(target, fn) {
var keys = Object.keys(target);
for(var i = 0, len = keys.length; i < len; i++) {
var key = keys[i];
var value = target[key];
if(fn(value, key)) return true;
}
return false;
} | javascript | function any(target, fn) {
var keys = Object.keys(target);
for(var i = 0, len = keys.length; i < len; i++) {
var key = keys[i];
var value = target[key];
if(fn(value, key)) return true;
}
return false;
} | [
"function",
"any",
"(",
"target",
",",
"fn",
")",
"{",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"target",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"keys",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
... | Applies a predicate to collection and returns true if any of the items match
it | [
"Applies",
"a",
"predicate",
"to",
"collection",
"and",
"returns",
"true",
"if",
"any",
"of",
"the",
"items",
"match",
"it"
] | 2f834c58e15bc186441cf21d0e2c586de13c6e9b | https://github.com/yamadapc/mocha-spec-cov-alt/blob/2f834c58e15bc186441cf21d0e2c586de13c6e9b/bin/index.js#L65-L73 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.