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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
12,800 | elix/elix | tasks/buildWeekData.js | formatWeekDataAsModule | function formatWeekDataAsModule(weekData) {
const date = new Date();
const { firstDay, weekendEnd, weekendStart } = weekData;
const transformed = {
firstDay: transformWeekDays(firstDay),
weekendEnd: transformWeekDays(weekendEnd),
weekendStart: transformWeekDays(weekendStart)
};
const formatted = J... | javascript | function formatWeekDataAsModule(weekData) {
const date = new Date();
const { firstDay, weekendEnd, weekendStart } = weekData;
const transformed = {
firstDay: transformWeekDays(firstDay),
weekendEnd: transformWeekDays(weekendEnd),
weekendStart: transformWeekDays(weekendStart)
};
const formatted = J... | [
"function",
"formatWeekDataAsModule",
"(",
"weekData",
")",
"{",
"const",
"date",
"=",
"new",
"Date",
"(",
")",
";",
"const",
"{",
"firstDay",
",",
"weekendEnd",
",",
"weekendStart",
"}",
"=",
"weekData",
";",
"const",
"transformed",
"=",
"{",
"firstDay",
... | Extract the week data we care about and format it as an ES6 module. | [
"Extract",
"the",
"week",
"data",
"we",
"care",
"about",
"and",
"format",
"it",
"as",
"an",
"ES6",
"module",
"."
] | 2e5fde9777b2e6e4b9453c32d7b7007948d5892d | https://github.com/elix/elix/blob/2e5fde9777b2e6e4b9453c32d7b7007948d5892d/tasks/buildWeekData.js#L33-L49 |
12,801 | elix/elix | src/AutoSizeTextarea.js | getTextFromContent | function getTextFromContent(contentNodes) {
if (contentNodes === null) {
return '';
}
const texts = [...contentNodes].map(node => node.textContent);
const text = texts.join('').trim();
return unescapeHtml(text);
} | javascript | function getTextFromContent(contentNodes) {
if (contentNodes === null) {
return '';
}
const texts = [...contentNodes].map(node => node.textContent);
const text = texts.join('').trim();
return unescapeHtml(text);
} | [
"function",
"getTextFromContent",
"(",
"contentNodes",
")",
"{",
"if",
"(",
"contentNodes",
"===",
"null",
")",
"{",
"return",
"''",
";",
"}",
"const",
"texts",
"=",
"[",
"...",
"contentNodes",
"]",
".",
"map",
"(",
"node",
"=>",
"node",
".",
"textConten... | Return the text represented by the given content nodes. | [
"Return",
"the",
"text",
"represented",
"by",
"the",
"given",
"content",
"nodes",
"."
] | 2e5fde9777b2e6e4b9453c32d7b7007948d5892d | https://github.com/elix/elix/blob/2e5fde9777b2e6e4b9453c32d7b7007948d5892d/src/AutoSizeTextarea.js#L255-L262 |
12,802 | elix/elix | src/State.js | isEmpty | function isEmpty(o) {
for (var key in o) {
if (o.hasOwnProperty(key)) {
return false;
}
}
return Object.getOwnPropertySymbols(o).length === 0;
} | javascript | function isEmpty(o) {
for (var key in o) {
if (o.hasOwnProperty(key)) {
return false;
}
}
return Object.getOwnPropertySymbols(o).length === 0;
} | [
"function",
"isEmpty",
"(",
"o",
")",
"{",
"for",
"(",
"var",
"key",
"in",
"o",
")",
"{",
"if",
"(",
"o",
".",
"hasOwnProperty",
"(",
"key",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"Object",
".",
"getOwnPropertySymbols",
"(",
"o"... | Return true if o is an empty object. | [
"Return",
"true",
"if",
"o",
"is",
"an",
"empty",
"object",
"."
] | 2e5fde9777b2e6e4b9453c32d7b7007948d5892d | https://github.com/elix/elix/blob/2e5fde9777b2e6e4b9453c32d7b7007948d5892d/src/State.js#L93-L100 |
12,803 | elix/elix | src/PageNumbersMixin.js | PageNumbersMixin | function PageNumbersMixin(Base) {
class PageNumbers extends Base {
/**
* Destructively wrap a node with elements to show page numbers.
*
* @param {Node} original - the element that should be wrapped by page numbers
*/
[wrap](original) {
const pageNumbersTemplate = template.html`
... | javascript | function PageNumbersMixin(Base) {
class PageNumbers extends Base {
/**
* Destructively wrap a node with elements to show page numbers.
*
* @param {Node} original - the element that should be wrapped by page numbers
*/
[wrap](original) {
const pageNumbersTemplate = template.html`
... | [
"function",
"PageNumbersMixin",
"(",
"Base",
")",
"{",
"class",
"PageNumbers",
"extends",
"Base",
"{",
"/**\n * Destructively wrap a node with elements to show page numbers.\n * \n * @param {Node} original - the element that should be wrapped by page numbers\n */",
"[",
"wr... | Adds a page number and total page count to a carousel-like element.
This can be applied to components like [Carousel](Carousel) that renders
their content as pages.
@module PageNumbersMixin | [
"Adds",
"a",
"page",
"number",
"and",
"total",
"page",
"count",
"to",
"a",
"carousel",
"-",
"like",
"element",
"."
] | 2e5fde9777b2e6e4b9453c32d7b7007948d5892d | https://github.com/elix/elix/blob/2e5fde9777b2e6e4b9453c32d7b7007948d5892d/src/PageNumbersMixin.js#L16-L61 |
12,804 | elix/elix | src/AttributeMarshallingMixin.js | attributeToPropertyName | function attributeToPropertyName(attributeName) {
let propertyName = attributeToPropertyNames[attributeName];
if (!propertyName) {
// Convert and memoize.
const hyphenRegEx = /-([a-z])/g;
propertyName = attributeName.replace(hyphenRegEx,
match => match[1].toUpperCase());
attributeToPropertyN... | javascript | function attributeToPropertyName(attributeName) {
let propertyName = attributeToPropertyNames[attributeName];
if (!propertyName) {
// Convert and memoize.
const hyphenRegEx = /-([a-z])/g;
propertyName = attributeName.replace(hyphenRegEx,
match => match[1].toUpperCase());
attributeToPropertyN... | [
"function",
"attributeToPropertyName",
"(",
"attributeName",
")",
"{",
"let",
"propertyName",
"=",
"attributeToPropertyNames",
"[",
"attributeName",
"]",
";",
"if",
"(",
"!",
"propertyName",
")",
"{",
"// Convert and memoize.",
"const",
"hyphenRegEx",
"=",
"/",
"-([... | Convert hyphenated foo-bar attribute name to camel case fooBar property name. | [
"Convert",
"hyphenated",
"foo",
"-",
"bar",
"attribute",
"name",
"to",
"camel",
"case",
"fooBar",
"property",
"name",
"."
] | 2e5fde9777b2e6e4b9453c32d7b7007948d5892d | https://github.com/elix/elix/blob/2e5fde9777b2e6e4b9453c32d7b7007948d5892d/src/AttributeMarshallingMixin.js#L126-L136 |
12,805 | elix/elix | src/AttributeMarshallingMixin.js | propertyNameToAttribute | function propertyNameToAttribute(propertyName) {
let attribute = propertyNamesToAttributes[propertyName];
if (!attribute) {
// Convert and memoize.
const uppercaseRegEx = /([A-Z])/g;
attribute = propertyName.replace(uppercaseRegEx, '-$1').toLowerCase();
}
return attribute;
} | javascript | function propertyNameToAttribute(propertyName) {
let attribute = propertyNamesToAttributes[propertyName];
if (!attribute) {
// Convert and memoize.
const uppercaseRegEx = /([A-Z])/g;
attribute = propertyName.replace(uppercaseRegEx, '-$1').toLowerCase();
}
return attribute;
} | [
"function",
"propertyNameToAttribute",
"(",
"propertyName",
")",
"{",
"let",
"attribute",
"=",
"propertyNamesToAttributes",
"[",
"propertyName",
"]",
";",
"if",
"(",
"!",
"attribute",
")",
"{",
"// Convert and memoize.",
"const",
"uppercaseRegEx",
"=",
"/",
"([A-Z])... | Convert a camel case fooBar property name to a hyphenated foo-bar attribute. | [
"Convert",
"a",
"camel",
"case",
"fooBar",
"property",
"name",
"to",
"a",
"hyphenated",
"foo",
"-",
"bar",
"attribute",
"."
] | 2e5fde9777b2e6e4b9453c32d7b7007948d5892d | https://github.com/elix/elix/blob/2e5fde9777b2e6e4b9453c32d7b7007948d5892d/src/AttributeMarshallingMixin.js#L154-L162 |
12,806 | elix/elix | src/SlotContentMixin.js | assignedNodesChanged | function assignedNodesChanged(component) {
const slot = component[symbols.contentSlot];
const content = slot ?
slot.assignedNodes({ flatten: true }) :
null;
// Make immutable.
Object.freeze(content);
component.setState({ content });
} | javascript | function assignedNodesChanged(component) {
const slot = component[symbols.contentSlot];
const content = slot ?
slot.assignedNodes({ flatten: true }) :
null;
// Make immutable.
Object.freeze(content);
component.setState({ content });
} | [
"function",
"assignedNodesChanged",
"(",
"component",
")",
"{",
"const",
"slot",
"=",
"component",
"[",
"symbols",
".",
"contentSlot",
"]",
";",
"const",
"content",
"=",
"slot",
"?",
"slot",
".",
"assignedNodes",
"(",
"{",
"flatten",
":",
"true",
"}",
")",... | The nodes assigned to the given component have changed. Update the component's state to reflect the new content. | [
"The",
"nodes",
"assigned",
"to",
"the",
"given",
"component",
"have",
"changed",
".",
"Update",
"the",
"component",
"s",
"state",
"to",
"reflect",
"the",
"new",
"content",
"."
] | 2e5fde9777b2e6e4b9453c32d7b7007948d5892d | https://github.com/elix/elix/blob/2e5fde9777b2e6e4b9453c32d7b7007948d5892d/src/SlotContentMixin.js#L147-L158 |
12,807 | elix/elix | src/FocusCaptureMixin.js | FocusCaptureMixin | function FocusCaptureMixin(base) {
class FocusCapture extends base {
componentDidMount() {
if (super.componentDidMount) { super.componentDidMount(); }
this.$.focusCatcher.addEventListener('focus', () => {
if (!this[wrappingFocusKey]) {
// Wrap focus back to the first focusable elem... | javascript | function FocusCaptureMixin(base) {
class FocusCapture extends base {
componentDidMount() {
if (super.componentDidMount) { super.componentDidMount(); }
this.$.focusCatcher.addEventListener('focus', () => {
if (!this[wrappingFocusKey]) {
// Wrap focus back to the first focusable elem... | [
"function",
"FocusCaptureMixin",
"(",
"base",
")",
"{",
"class",
"FocusCapture",
"extends",
"base",
"{",
"componentDidMount",
"(",
")",
"{",
"if",
"(",
"super",
".",
"componentDidMount",
")",
"{",
"super",
".",
"componentDidMount",
"(",
")",
";",
"}",
"this"... | Allows Tab and Shift+Tab operations to cycle the focus within the component.
This mixin expects the component to provide:
* A template-stamping mechanism compatible with `ShadowTemplateMixin`.
The mixin provides these features to the component:
* Template elements and event handlers that will cause the keyboard foc... | [
"Allows",
"Tab",
"and",
"Shift",
"+",
"Tab",
"operations",
"to",
"cycle",
"the",
"focus",
"within",
"the",
"component",
"."
] | 2e5fde9777b2e6e4b9453c32d7b7007948d5892d | https://github.com/elix/elix/blob/2e5fde9777b2e6e4b9453c32d7b7007948d5892d/src/FocusCaptureMixin.js#L28-L84 |
12,808 | elix/elix | src/PullToRefresh.js | handleScrollPull | async function handleScrollPull(element, scrollTarget) {
const scrollTop = scrollTarget === window ?
document.body.scrollTop :
scrollTarget.scrollTop;
if (scrollTop < 0) {
// Negative scroll top means we're probably in WebKit.
// Start a scroll pull operation.
let scrollPullDistance = -scrollTop... | javascript | async function handleScrollPull(element, scrollTarget) {
const scrollTop = scrollTarget === window ?
document.body.scrollTop :
scrollTarget.scrollTop;
if (scrollTop < 0) {
// Negative scroll top means we're probably in WebKit.
// Start a scroll pull operation.
let scrollPullDistance = -scrollTop... | [
"async",
"function",
"handleScrollPull",
"(",
"element",
",",
"scrollTarget",
")",
"{",
"const",
"scrollTop",
"=",
"scrollTarget",
"===",
"window",
"?",
"document",
".",
"body",
".",
"scrollTop",
":",
"scrollTarget",
".",
"scrollTop",
";",
"if",
"(",
"scrollTo... | If a user flicks down to quickly scroll up, and scrolls past the top of the page, the area above the page may be shown briefly. We use that opportunity to show the user the refresh header so they'll realize they can pull to refresh. We call this operation a "scroll pull". It works a little like a real touch drag, but c... | [
"If",
"a",
"user",
"flicks",
"down",
"to",
"quickly",
"scroll",
"up",
"and",
"scrolls",
"past",
"the",
"top",
"of",
"the",
"page",
"the",
"area",
"above",
"the",
"page",
"may",
"be",
"shown",
"briefly",
".",
"We",
"use",
"that",
"opportunity",
"to",
"s... | 2e5fde9777b2e6e4b9453c32d7b7007948d5892d | https://github.com/elix/elix/blob/2e5fde9777b2e6e4b9453c32d7b7007948d5892d/src/PullToRefresh.js#L303-L331 |
12,809 | elix/elix | src/TimerSelectionMixin.js | updateTimer | function updateTimer(element) {
// If the element is playing and we haven't started a timer yet, do so now.
// Also, if the element's selectedIndex changed for any reason, restart the
// timer. This ensures that the timer restarts no matter why the selection
// changes: it could have been us moving to the next ... | javascript | function updateTimer(element) {
// If the element is playing and we haven't started a timer yet, do so now.
// Also, if the element's selectedIndex changed for any reason, restart the
// timer. This ensures that the timer restarts no matter why the selection
// changes: it could have been us moving to the next ... | [
"function",
"updateTimer",
"(",
"element",
")",
"{",
"// If the element is playing and we haven't started a timer yet, do so now.",
"// Also, if the element's selectedIndex changed for any reason, restart the",
"// timer. This ensures that the timer restarts no matter why the selection",
"// chang... | Update the timer to match the element's `playing` state. | [
"Update",
"the",
"timer",
"to",
"match",
"the",
"element",
"s",
"playing",
"state",
"."
] | 2e5fde9777b2e6e4b9453c32d7b7007948d5892d | https://github.com/elix/elix/blob/2e5fde9777b2e6e4b9453c32d7b7007948d5892d/src/TimerSelectionMixin.js#L134-L146 |
12,810 | elix/elix | src/TrackpadSwipeMixin.js | resetWheelTracking | function resetWheelTracking(element) {
element[wheelDistanceSymbol] = 0;
element[lastDeltaXSymbol] = 0;
element[absorbDecelerationSymbol] = false;
element[postNavigateDelayCompleteSymbol] = false;
if (element[lastWheelTimeoutSymbol]) {
clearTimeout(element[lastWheelTimeoutSymbol]);
element[lastWheelTi... | javascript | function resetWheelTracking(element) {
element[wheelDistanceSymbol] = 0;
element[lastDeltaXSymbol] = 0;
element[absorbDecelerationSymbol] = false;
element[postNavigateDelayCompleteSymbol] = false;
if (element[lastWheelTimeoutSymbol]) {
clearTimeout(element[lastWheelTimeoutSymbol]);
element[lastWheelTi... | [
"function",
"resetWheelTracking",
"(",
"element",
")",
"{",
"element",
"[",
"wheelDistanceSymbol",
"]",
"=",
"0",
";",
"element",
"[",
"lastDeltaXSymbol",
"]",
"=",
"0",
";",
"element",
"[",
"absorbDecelerationSymbol",
"]",
"=",
"false",
";",
"element",
"[",
... | Reset all state related to the tracking of the wheel. | [
"Reset",
"all",
"state",
"related",
"to",
"the",
"tracking",
"of",
"the",
"wheel",
"."
] | 2e5fde9777b2e6e4b9453c32d7b7007948d5892d | https://github.com/elix/elix/blob/2e5fde9777b2e6e4b9453c32d7b7007948d5892d/src/TrackpadSwipeMixin.js#L171-L180 |
12,811 | elix/elix | src/KeyboardPrefixSelectionMixin.js | handlePlainCharacter | function handlePlainCharacter(element, char) {
const prefix = element[typedPrefixKey] || '';
element[typedPrefixKey] = prefix + char;
element.selectItemWithTextPrefix(element[typedPrefixKey]);
setPrefixTimeout(element);
} | javascript | function handlePlainCharacter(element, char) {
const prefix = element[typedPrefixKey] || '';
element[typedPrefixKey] = prefix + char;
element.selectItemWithTextPrefix(element[typedPrefixKey]);
setPrefixTimeout(element);
} | [
"function",
"handlePlainCharacter",
"(",
"element",
",",
"char",
")",
"{",
"const",
"prefix",
"=",
"element",
"[",
"typedPrefixKey",
"]",
"||",
"''",
";",
"element",
"[",
"typedPrefixKey",
"]",
"=",
"prefix",
"+",
"char",
";",
"element",
".",
"selectItemWith... | Add a plain character to the prefix. | [
"Add",
"a",
"plain",
"character",
"to",
"the",
"prefix",
"."
] | 2e5fde9777b2e6e4b9453c32d7b7007948d5892d | https://github.com/elix/elix/blob/2e5fde9777b2e6e4b9453c32d7b7007948d5892d/src/KeyboardPrefixSelectionMixin.js#L122-L127 |
12,812 | elix/elix | src/KeyboardPrefixSelectionMixin.js | resetPrefixTimeout | function resetPrefixTimeout(element) {
if (element[prefixTimeoutKey]) {
clearTimeout(element[prefixTimeoutKey]);
element[prefixTimeoutKey] = false;
}
} | javascript | function resetPrefixTimeout(element) {
if (element[prefixTimeoutKey]) {
clearTimeout(element[prefixTimeoutKey]);
element[prefixTimeoutKey] = false;
}
} | [
"function",
"resetPrefixTimeout",
"(",
"element",
")",
"{",
"if",
"(",
"element",
"[",
"prefixTimeoutKey",
"]",
")",
"{",
"clearTimeout",
"(",
"element",
"[",
"prefixTimeoutKey",
"]",
")",
";",
"element",
"[",
"prefixTimeoutKey",
"]",
"=",
"false",
";",
"}",... | Stop listening for typing. | [
"Stop",
"listening",
"for",
"typing",
"."
] | 2e5fde9777b2e6e4b9453c32d7b7007948d5892d | https://github.com/elix/elix/blob/2e5fde9777b2e6e4b9453c32d7b7007948d5892d/src/KeyboardPrefixSelectionMixin.js#L130-L135 |
12,813 | elix/elix | src/KeyboardPrefixSelectionMixin.js | setPrefixTimeout | function setPrefixTimeout(element) {
resetPrefixTimeout(element);
element[prefixTimeoutKey] = setTimeout(() => {
resetTypedPrefix(element);
}, TYPING_TIMEOUT_DURATION);
} | javascript | function setPrefixTimeout(element) {
resetPrefixTimeout(element);
element[prefixTimeoutKey] = setTimeout(() => {
resetTypedPrefix(element);
}, TYPING_TIMEOUT_DURATION);
} | [
"function",
"setPrefixTimeout",
"(",
"element",
")",
"{",
"resetPrefixTimeout",
"(",
"element",
")",
";",
"element",
"[",
"prefixTimeoutKey",
"]",
"=",
"setTimeout",
"(",
"(",
")",
"=>",
"{",
"resetTypedPrefix",
"(",
"element",
")",
";",
"}",
",",
"TYPING_TI... | Wait for the user to stop typing. | [
"Wait",
"for",
"the",
"user",
"to",
"stop",
"typing",
"."
] | 2e5fde9777b2e6e4b9453c32d7b7007948d5892d | https://github.com/elix/elix/blob/2e5fde9777b2e6e4b9453c32d7b7007948d5892d/src/KeyboardPrefixSelectionMixin.js#L144-L149 |
12,814 | elix/elix | demos/src/CalendarDayMoonPhase.js | jd0 | function jd0(year, month, day) {
let y = year;
let m = month;
if (m < 3) {
m += 12;
y -= 1
};
const a = Math.floor(y/100);
const b = 2-a+Math.floor(a/4);
const j = Math.floor(365.25*(y+4716))+Math.floor(30.6001*(m+1))+day+b-1524.5;
return j;
} | javascript | function jd0(year, month, day) {
let y = year;
let m = month;
if (m < 3) {
m += 12;
y -= 1
};
const a = Math.floor(y/100);
const b = 2-a+Math.floor(a/4);
const j = Math.floor(365.25*(y+4716))+Math.floor(30.6001*(m+1))+day+b-1524.5;
return j;
} | [
"function",
"jd0",
"(",
"year",
",",
"month",
",",
"day",
")",
"{",
"let",
"y",
"=",
"year",
";",
"let",
"m",
"=",
"month",
";",
"if",
"(",
"m",
"<",
"3",
")",
"{",
"m",
"+=",
"12",
";",
"y",
"-=",
"1",
"}",
";",
"const",
"a",
"=",
"Math"... | The Julian date at 0 hours UT at Greenwich | [
"The",
"Julian",
"date",
"at",
"0",
"hours",
"UT",
"at",
"Greenwich"
] | 2e5fde9777b2e6e4b9453c32d7b7007948d5892d | https://github.com/elix/elix/blob/2e5fde9777b2e6e4b9453c32d7b7007948d5892d/demos/src/CalendarDayMoonPhase.js#L102-L113 |
12,815 | elix/elix | src/Explorer.js | createDefaultProxies | function createDefaultProxies(items, proxyRole) {
const proxies = items ?
items.map(() => template.createElement(proxyRole)) :
[];
// Make the array immutable to help update performance.
Object.freeze(proxies);
return proxies;
} | javascript | function createDefaultProxies(items, proxyRole) {
const proxies = items ?
items.map(() => template.createElement(proxyRole)) :
[];
// Make the array immutable to help update performance.
Object.freeze(proxies);
return proxies;
} | [
"function",
"createDefaultProxies",
"(",
"items",
",",
"proxyRole",
")",
"{",
"const",
"proxies",
"=",
"items",
"?",
"items",
".",
"map",
"(",
"(",
")",
"=>",
"template",
".",
"createElement",
"(",
"proxyRole",
")",
")",
":",
"[",
"]",
";",
"// Make the ... | Return the default list generated for the given items. | [
"Return",
"the",
"default",
"list",
"generated",
"for",
"the",
"given",
"items",
"."
] | 2e5fde9777b2e6e4b9453c32d7b7007948d5892d | https://github.com/elix/elix/blob/2e5fde9777b2e6e4b9453c32d7b7007948d5892d/src/Explorer.js#L393-L400 |
12,816 | elix/elix | src/Explorer.js | findChildContainingNode | function findChildContainingNode(root, node) {
const parentNode = node.parentNode;
return parentNode === root ?
node :
findChildContainingNode(root, parentNode);
} | javascript | function findChildContainingNode(root, node) {
const parentNode = node.parentNode;
return parentNode === root ?
node :
findChildContainingNode(root, parentNode);
} | [
"function",
"findChildContainingNode",
"(",
"root",
",",
"node",
")",
"{",
"const",
"parentNode",
"=",
"node",
".",
"parentNode",
";",
"return",
"parentNode",
"===",
"root",
"?",
"node",
":",
"findChildContainingNode",
"(",
"root",
",",
"parentNode",
")",
";",... | Find the child of root that is or contains the given node. | [
"Find",
"the",
"child",
"of",
"root",
"that",
"is",
"or",
"contains",
"the",
"given",
"node",
"."
] | 2e5fde9777b2e6e4b9453c32d7b7007948d5892d | https://github.com/elix/elix/blob/2e5fde9777b2e6e4b9453c32d7b7007948d5892d/src/Explorer.js#L404-L409 |
12,817 | elix/elix | src/Explorer.js | setListAndStageOrder | function setListAndStageOrder(element) {
const proxyListPosition = element.state.proxyListPosition;
const rightToLeft = element[symbols.rightToLeft];
const listInInitialPosition =
proxyListPosition === 'top' ||
proxyListPosition === 'start' ||
proxyListPosition === 'left' && !rightToLeft ||
... | javascript | function setListAndStageOrder(element) {
const proxyListPosition = element.state.proxyListPosition;
const rightToLeft = element[symbols.rightToLeft];
const listInInitialPosition =
proxyListPosition === 'top' ||
proxyListPosition === 'start' ||
proxyListPosition === 'left' && !rightToLeft ||
... | [
"function",
"setListAndStageOrder",
"(",
"element",
")",
"{",
"const",
"proxyListPosition",
"=",
"element",
".",
"state",
".",
"proxyListPosition",
";",
"const",
"rightToLeft",
"=",
"element",
"[",
"symbols",
".",
"rightToLeft",
"]",
";",
"const",
"listInInitialPo... | Physically reorder the list and stage to reflect the desired arrangement. We could change the visual appearance by reversing the order of the flex box, but then the visual order wouldn't reflect the document order, which determines focus order. That would surprise a user trying to tab through the controls. | [
"Physically",
"reorder",
"the",
"list",
"and",
"stage",
"to",
"reflect",
"the",
"desired",
"arrangement",
".",
"We",
"could",
"change",
"the",
"visual",
"appearance",
"by",
"reversing",
"the",
"order",
"of",
"the",
"flex",
"box",
"but",
"then",
"the",
"visua... | 2e5fde9777b2e6e4b9453c32d7b7007948d5892d | https://github.com/elix/elix/blob/2e5fde9777b2e6e4b9453c32d7b7007948d5892d/src/Explorer.js#L417-L433 |
12,818 | adonisjs/adonis-lucid | src/Database/MonkeyPatch.js | generateAggregate | function generateAggregate (aggregateOp, defaultColumnName = undefined) {
let funcName = `get${_.upperFirst(aggregateOp)}`
/**
* Do not re-add the method if exists
*/
if (KnexQueryBuilder.prototype[funcName]) {
return
}
KnexQueryBuilder.prototype[funcName] = async function (columnName = defaultCol... | javascript | function generateAggregate (aggregateOp, defaultColumnName = undefined) {
let funcName = `get${_.upperFirst(aggregateOp)}`
/**
* Do not re-add the method if exists
*/
if (KnexQueryBuilder.prototype[funcName]) {
return
}
KnexQueryBuilder.prototype[funcName] = async function (columnName = defaultCol... | [
"function",
"generateAggregate",
"(",
"aggregateOp",
",",
"defaultColumnName",
"=",
"undefined",
")",
"{",
"let",
"funcName",
"=",
"`",
"${",
"_",
".",
"upperFirst",
"(",
"aggregateOp",
")",
"}",
"`",
"/**\n * Do not re-add the method if exists\n */",
"if",
"(",... | Generates an aggregate function, that returns the aggregated result
as a number.
@method generateAggregate
@param {String} aggregateOp
@param {String} defaultColumnName
@return {Number}
@example
```js
generateAggregate('count')
``` | [
"Generates",
"an",
"aggregate",
"function",
"that",
"returns",
"the",
"aggregated",
"result",
"as",
"a",
"number",
"."
] | 6cd666df9534a981f4bd99ac0812a44d1685728a | https://github.com/adonisjs/adonis-lucid/blob/6cd666df9534a981f4bd99ac0812a44d1685728a/src/Database/MonkeyPatch.js#L182-L212 |
12,819 | tscanlin/tocbot | src/js/parse-content.js | getHeadingObject | function getHeadingObject (heading) {
var obj = {
id: heading.id,
children: [],
nodeName: heading.nodeName,
headingLevel: getHeadingLevel(heading),
textContent: heading.textContent.trim()
}
if (options.includeHtml) {
obj.childNodes = heading.childNodes
}
return ... | javascript | function getHeadingObject (heading) {
var obj = {
id: heading.id,
children: [],
nodeName: heading.nodeName,
headingLevel: getHeadingLevel(heading),
textContent: heading.textContent.trim()
}
if (options.includeHtml) {
obj.childNodes = heading.childNodes
}
return ... | [
"function",
"getHeadingObject",
"(",
"heading",
")",
"{",
"var",
"obj",
"=",
"{",
"id",
":",
"heading",
".",
"id",
",",
"children",
":",
"[",
"]",
",",
"nodeName",
":",
"heading",
".",
"nodeName",
",",
"headingLevel",
":",
"getHeadingLevel",
"(",
"headin... | Get important properties from a heading element and store in a plain object.
@param {HTMLElement} heading
@return {Object} | [
"Get",
"important",
"properties",
"from",
"a",
"heading",
"element",
"and",
"store",
"in",
"a",
"plain",
"object",
"."
] | b1437aea1efbb2cccc82180be7465ed2d54508be | https://github.com/tscanlin/tocbot/blob/b1437aea1efbb2cccc82180be7465ed2d54508be/src/js/parse-content.js#L34-L48 |
12,820 | tscanlin/tocbot | src/js/parse-content.js | addNode | function addNode (node, nest) {
var obj = getHeadingObject(node)
var level = getHeadingLevel(node)
var array = nest
var lastItem = getLastItem(array)
var lastItemLevel = lastItem
? lastItem.headingLevel
: 0
var counter = level - lastItemLevel
while (counter > 0) {
lastItem... | javascript | function addNode (node, nest) {
var obj = getHeadingObject(node)
var level = getHeadingLevel(node)
var array = nest
var lastItem = getLastItem(array)
var lastItemLevel = lastItem
? lastItem.headingLevel
: 0
var counter = level - lastItemLevel
while (counter > 0) {
lastItem... | [
"function",
"addNode",
"(",
"node",
",",
"nest",
")",
"{",
"var",
"obj",
"=",
"getHeadingObject",
"(",
"node",
")",
"var",
"level",
"=",
"getHeadingLevel",
"(",
"node",
")",
"var",
"array",
"=",
"nest",
"var",
"lastItem",
"=",
"getLastItem",
"(",
"array"... | Add a node to the nested array.
@param {Object} node
@param {Array} nest
@return {Array} | [
"Add",
"a",
"node",
"to",
"the",
"nested",
"array",
"."
] | b1437aea1efbb2cccc82180be7465ed2d54508be | https://github.com/tscanlin/tocbot/blob/b1437aea1efbb2cccc82180be7465ed2d54508be/src/js/parse-content.js#L56-L80 |
12,821 | tscanlin/tocbot | src/js/parse-content.js | selectHeadings | function selectHeadings (contentSelector, headingSelector) {
var selectors = headingSelector
if (options.ignoreSelector) {
selectors = headingSelector.split(',')
.map(function mapSelectors (selector) {
return selector.trim() + ':not(' + options.ignoreSelector + ')'
})
}
t... | javascript | function selectHeadings (contentSelector, headingSelector) {
var selectors = headingSelector
if (options.ignoreSelector) {
selectors = headingSelector.split(',')
.map(function mapSelectors (selector) {
return selector.trim() + ':not(' + options.ignoreSelector + ')'
})
}
t... | [
"function",
"selectHeadings",
"(",
"contentSelector",
",",
"headingSelector",
")",
"{",
"var",
"selectors",
"=",
"headingSelector",
"if",
"(",
"options",
".",
"ignoreSelector",
")",
"{",
"selectors",
"=",
"headingSelector",
".",
"split",
"(",
"','",
")",
".",
... | Select headings in content area, exclude any selector in options.ignoreSelector
@param {String} contentSelector
@param {Array} headingSelector
@return {Array} | [
"Select",
"headings",
"in",
"content",
"area",
"exclude",
"any",
"selector",
"in",
"options",
".",
"ignoreSelector"
] | b1437aea1efbb2cccc82180be7465ed2d54508be | https://github.com/tscanlin/tocbot/blob/b1437aea1efbb2cccc82180be7465ed2d54508be/src/js/parse-content.js#L88-L103 |
12,822 | tscanlin/tocbot | src/js/parse-content.js | nestHeadingsArray | function nestHeadingsArray (headingsArray) {
return reduce.call(headingsArray, function reducer (prev, curr) {
var currentHeading = getHeadingObject(curr)
addNode(currentHeading, prev.nest)
return prev
}, {
nest: []
})
} | javascript | function nestHeadingsArray (headingsArray) {
return reduce.call(headingsArray, function reducer (prev, curr) {
var currentHeading = getHeadingObject(curr)
addNode(currentHeading, prev.nest)
return prev
}, {
nest: []
})
} | [
"function",
"nestHeadingsArray",
"(",
"headingsArray",
")",
"{",
"return",
"reduce",
".",
"call",
"(",
"headingsArray",
",",
"function",
"reducer",
"(",
"prev",
",",
"curr",
")",
"{",
"var",
"currentHeading",
"=",
"getHeadingObject",
"(",
"curr",
")",
"addNode... | Nest headings array into nested arrays with 'children' property.
@param {Array} headingsArray
@return {Object} | [
"Nest",
"headings",
"array",
"into",
"nested",
"arrays",
"with",
"children",
"property",
"."
] | b1437aea1efbb2cccc82180be7465ed2d54508be | https://github.com/tscanlin/tocbot/blob/b1437aea1efbb2cccc82180be7465ed2d54508be/src/js/parse-content.js#L110-L119 |
12,823 | tscanlin/tocbot | src/js/build-html.js | createEl | function createEl (d, container) {
var link = container.appendChild(createLink(d))
if (d.children.length) {
var list = createList(d.isCollapsed)
d.children.forEach(function (child) {
createEl(child, list)
})
link.appendChild(list)
}
} | javascript | function createEl (d, container) {
var link = container.appendChild(createLink(d))
if (d.children.length) {
var list = createList(d.isCollapsed)
d.children.forEach(function (child) {
createEl(child, list)
})
link.appendChild(list)
}
} | [
"function",
"createEl",
"(",
"d",
",",
"container",
")",
"{",
"var",
"link",
"=",
"container",
".",
"appendChild",
"(",
"createLink",
"(",
"d",
")",
")",
"if",
"(",
"d",
".",
"children",
".",
"length",
")",
"{",
"var",
"list",
"=",
"createList",
"(",... | Create link and list elements.
@param {Object} d
@param {HTMLElement} container
@return {HTMLElement} | [
"Create",
"link",
"and",
"list",
"elements",
"."
] | b1437aea1efbb2cccc82180be7465ed2d54508be | https://github.com/tscanlin/tocbot/blob/b1437aea1efbb2cccc82180be7465ed2d54508be/src/js/build-html.js#L20-L29 |
12,824 | tscanlin/tocbot | src/js/build-html.js | render | function render (selector, data) {
var collapsed = false
var container = createList(collapsed)
data.forEach(function (d) {
createEl(d, container)
})
var parent = document.querySelector(selector)
// Return if no parent is found.
if (parent === null) {
return
}
// Remov... | javascript | function render (selector, data) {
var collapsed = false
var container = createList(collapsed)
data.forEach(function (d) {
createEl(d, container)
})
var parent = document.querySelector(selector)
// Return if no parent is found.
if (parent === null) {
return
}
// Remov... | [
"function",
"render",
"(",
"selector",
",",
"data",
")",
"{",
"var",
"collapsed",
"=",
"false",
"var",
"container",
"=",
"createList",
"(",
"collapsed",
")",
"data",
".",
"forEach",
"(",
"function",
"(",
"d",
")",
"{",
"createEl",
"(",
"d",
",",
"conta... | Render nested heading array data into a given selector.
@param {String} selector
@param {Array} data
@return {HTMLElement} | [
"Render",
"nested",
"heading",
"array",
"data",
"into",
"a",
"given",
"selector",
"."
] | b1437aea1efbb2cccc82180be7465ed2d54508be | https://github.com/tscanlin/tocbot/blob/b1437aea1efbb2cccc82180be7465ed2d54508be/src/js/build-html.js#L37-L64 |
12,825 | tscanlin/tocbot | src/js/build-html.js | createLink | function createLink (data) {
var item = document.createElement('li')
var a = document.createElement('a')
if (options.listItemClass) {
item.setAttribute('class', options.listItemClass)
}
if (options.onClick) {
a.onclick = options.onClick
}
if (options.includeHtml && data.childNo... | javascript | function createLink (data) {
var item = document.createElement('li')
var a = document.createElement('a')
if (options.listItemClass) {
item.setAttribute('class', options.listItemClass)
}
if (options.onClick) {
a.onclick = options.onClick
}
if (options.includeHtml && data.childNo... | [
"function",
"createLink",
"(",
"data",
")",
"{",
"var",
"item",
"=",
"document",
".",
"createElement",
"(",
"'li'",
")",
"var",
"a",
"=",
"document",
".",
"createElement",
"(",
"'a'",
")",
"if",
"(",
"options",
".",
"listItemClass",
")",
"{",
"item",
"... | Create link element.
@param {Object} data
@return {HTMLElement} | [
"Create",
"link",
"element",
"."
] | b1437aea1efbb2cccc82180be7465ed2d54508be | https://github.com/tscanlin/tocbot/blob/b1437aea1efbb2cccc82180be7465ed2d54508be/src/js/build-html.js#L71-L96 |
12,826 | tscanlin/tocbot | src/js/build-html.js | createList | function createList (isCollapsed) {
var listElement = (options.orderedList) ? 'ol' : 'ul'
var list = document.createElement(listElement)
var classes = options.listClass +
SPACE_CHAR + options.extraListClasses
if (isCollapsed) {
classes += SPACE_CHAR + options.collapsibleClass
classes +... | javascript | function createList (isCollapsed) {
var listElement = (options.orderedList) ? 'ol' : 'ul'
var list = document.createElement(listElement)
var classes = options.listClass +
SPACE_CHAR + options.extraListClasses
if (isCollapsed) {
classes += SPACE_CHAR + options.collapsibleClass
classes +... | [
"function",
"createList",
"(",
"isCollapsed",
")",
"{",
"var",
"listElement",
"=",
"(",
"options",
".",
"orderedList",
")",
"?",
"'ol'",
":",
"'ul'",
"var",
"list",
"=",
"document",
".",
"createElement",
"(",
"listElement",
")",
"var",
"classes",
"=",
"opt... | Create list element.
@param {Boolean} isCollapsed
@return {HTMLElement} | [
"Create",
"list",
"element",
"."
] | b1437aea1efbb2cccc82180be7465ed2d54508be | https://github.com/tscanlin/tocbot/blob/b1437aea1efbb2cccc82180be7465ed2d54508be/src/js/build-html.js#L103-L114 |
12,827 | tscanlin/tocbot | src/js/build-html.js | updateFixedSidebarClass | function updateFixedSidebarClass () {
if (options.scrollContainer && document.querySelector(options.scrollContainer)) {
var top = document.querySelector(options.scrollContainer).scrollTop
} else {
var top = document.documentElement.scrollTop || body.scrollTop
}
var posFixedEl = document.quer... | javascript | function updateFixedSidebarClass () {
if (options.scrollContainer && document.querySelector(options.scrollContainer)) {
var top = document.querySelector(options.scrollContainer).scrollTop
} else {
var top = document.documentElement.scrollTop || body.scrollTop
}
var posFixedEl = document.quer... | [
"function",
"updateFixedSidebarClass",
"(",
")",
"{",
"if",
"(",
"options",
".",
"scrollContainer",
"&&",
"document",
".",
"querySelector",
"(",
"options",
".",
"scrollContainer",
")",
")",
"{",
"var",
"top",
"=",
"document",
".",
"querySelector",
"(",
"option... | Update fixed sidebar class.
@return {HTMLElement} | [
"Update",
"fixed",
"sidebar",
"class",
"."
] | b1437aea1efbb2cccc82180be7465ed2d54508be | https://github.com/tscanlin/tocbot/blob/b1437aea1efbb2cccc82180be7465ed2d54508be/src/js/build-html.js#L120-L139 |
12,828 | tscanlin/tocbot | src/js/build-html.js | getHeadingTopPos | function getHeadingTopPos (obj) {
var position = 0
if (obj != document.querySelector(options.contentSelector && obj != null)) {
position = obj.offsetTop
if (options.hasInnerContainers)
position += getHeadingTopPos(obj.offsetParent)
}
return position
} | javascript | function getHeadingTopPos (obj) {
var position = 0
if (obj != document.querySelector(options.contentSelector && obj != null)) {
position = obj.offsetTop
if (options.hasInnerContainers)
position += getHeadingTopPos(obj.offsetParent)
}
return position
} | [
"function",
"getHeadingTopPos",
"(",
"obj",
")",
"{",
"var",
"position",
"=",
"0",
"if",
"(",
"obj",
"!=",
"document",
".",
"querySelector",
"(",
"options",
".",
"contentSelector",
"&&",
"obj",
"!=",
"null",
")",
")",
"{",
"position",
"=",
"obj",
".",
... | Get top position of heading
@param {HTMLElement}
@return {integer} position | [
"Get",
"top",
"position",
"of",
"heading"
] | b1437aea1efbb2cccc82180be7465ed2d54508be | https://github.com/tscanlin/tocbot/blob/b1437aea1efbb2cccc82180be7465ed2d54508be/src/js/build-html.js#L146-L154 |
12,829 | tscanlin/tocbot | src/js/build-html.js | updateToc | function updateToc (headingsArray) {
// If a fixed content container was set
if (options.scrollContainer && document.querySelector(options.scrollContainer)) {
var top = document.querySelector(options.scrollContainer).scrollTop
} else {
var top = document.documentElement.scrollTop || body.scrollT... | javascript | function updateToc (headingsArray) {
// If a fixed content container was set
if (options.scrollContainer && document.querySelector(options.scrollContainer)) {
var top = document.querySelector(options.scrollContainer).scrollTop
} else {
var top = document.documentElement.scrollTop || body.scrollT... | [
"function",
"updateToc",
"(",
"headingsArray",
")",
"{",
"// If a fixed content container was set",
"if",
"(",
"options",
".",
"scrollContainer",
"&&",
"document",
".",
"querySelector",
"(",
"options",
".",
"scrollContainer",
")",
")",
"{",
"var",
"top",
"=",
"doc... | Update TOC highlighting and collpased groupings. | [
"Update",
"TOC",
"highlighting",
"and",
"collpased",
"groupings",
"."
] | b1437aea1efbb2cccc82180be7465ed2d54508be | https://github.com/tscanlin/tocbot/blob/b1437aea1efbb2cccc82180be7465ed2d54508be/src/js/build-html.js#L159-L233 |
12,830 | tscanlin/tocbot | src/js/build-html.js | removeCollapsedFromParents | function removeCollapsedFromParents (element) {
if (element.className.indexOf(options.collapsibleClass) !== -1 && element.className.indexOf(options.isCollapsedClass) !== -1) {
element.className = element.className.split(SPACE_CHAR + options.isCollapsedClass).join('')
return removeCollapsedFromParents(el... | javascript | function removeCollapsedFromParents (element) {
if (element.className.indexOf(options.collapsibleClass) !== -1 && element.className.indexOf(options.isCollapsedClass) !== -1) {
element.className = element.className.split(SPACE_CHAR + options.isCollapsedClass).join('')
return removeCollapsedFromParents(el... | [
"function",
"removeCollapsedFromParents",
"(",
"element",
")",
"{",
"if",
"(",
"element",
".",
"className",
".",
"indexOf",
"(",
"options",
".",
"collapsibleClass",
")",
"!==",
"-",
"1",
"&&",
"element",
".",
"className",
".",
"indexOf",
"(",
"options",
".",... | Remove collpased class from parent elements.
@param {HTMLElement} element
@return {HTMLElement} | [
"Remove",
"collpased",
"class",
"from",
"parent",
"elements",
"."
] | b1437aea1efbb2cccc82180be7465ed2d54508be | https://github.com/tscanlin/tocbot/blob/b1437aea1efbb2cccc82180be7465ed2d54508be/src/js/build-html.js#L240-L246 |
12,831 | tscanlin/tocbot | src/js/build-html.js | disableTocAnimation | function disableTocAnimation (event) {
var target = event.target || event.srcElement
if (typeof target.className !== 'string' || target.className.indexOf(options.linkClass) === -1) {
return
}
// Bind to tocLink clicks to temporarily disable highlighting
// while smoothScroll is animating.
... | javascript | function disableTocAnimation (event) {
var target = event.target || event.srcElement
if (typeof target.className !== 'string' || target.className.indexOf(options.linkClass) === -1) {
return
}
// Bind to tocLink clicks to temporarily disable highlighting
// while smoothScroll is animating.
... | [
"function",
"disableTocAnimation",
"(",
"event",
")",
"{",
"var",
"target",
"=",
"event",
".",
"target",
"||",
"event",
".",
"srcElement",
"if",
"(",
"typeof",
"target",
".",
"className",
"!==",
"'string'",
"||",
"target",
".",
"className",
".",
"indexOf",
... | Disable TOC Animation when a link is clicked.
@param {Event} event | [
"Disable",
"TOC",
"Animation",
"when",
"a",
"link",
"is",
"clicked",
"."
] | b1437aea1efbb2cccc82180be7465ed2d54508be | https://github.com/tscanlin/tocbot/blob/b1437aea1efbb2cccc82180be7465ed2d54508be/src/js/build-html.js#L252-L260 |
12,832 | paulkr/overhang.js | lib/overhang.js | raise | function raise (runCallback, identifier) {
$overlay.fadeOut(100);
$overhang.slideUp(attributes.speed, function () {
if (runCallback) {
attributes.callback(identifier !== null ? $element.data(identifier) : "");
}
});
} | javascript | function raise (runCallback, identifier) {
$overlay.fadeOut(100);
$overhang.slideUp(attributes.speed, function () {
if (runCallback) {
attributes.callback(identifier !== null ? $element.data(identifier) : "");
}
});
} | [
"function",
"raise",
"(",
"runCallback",
",",
"identifier",
")",
"{",
"$overlay",
".",
"fadeOut",
"(",
"100",
")",
";",
"$overhang",
".",
"slideUp",
"(",
"attributes",
".",
"speed",
",",
"function",
"(",
")",
"{",
"if",
"(",
"runCallback",
")",
"{",
"a... | Raise the overhang alert | [
"Raise",
"the",
"overhang",
"alert"
] | 97ad104aca7ce24b5de3239df0c00cd946ffe06e | https://github.com/paulkr/overhang.js/blob/97ad104aca7ce24b5de3239df0c00cd946ffe06e/lib/overhang.js#L53-L60 |
12,833 | gregjacobs/Autolinker.js | gulpfile.js | buildSrcCheckMinifiedSizeTask | async function buildSrcCheckMinifiedSizeTask() {
const stats = await fs.stat( './dist/Autolinker.min.js' );
const sizeInKb = stats.size / 1000;
const maxExpectedSizeInKb = 46;
if( sizeInKb > maxExpectedSizeInKb ) {
throw new Error( `
Minified file size of ${sizeInKb.toFixed( 2 )}kb is greater than max
ex... | javascript | async function buildSrcCheckMinifiedSizeTask() {
const stats = await fs.stat( './dist/Autolinker.min.js' );
const sizeInKb = stats.size / 1000;
const maxExpectedSizeInKb = 46;
if( sizeInKb > maxExpectedSizeInKb ) {
throw new Error( `
Minified file size of ${sizeInKb.toFixed( 2 )}kb is greater than max
ex... | [
"async",
"function",
"buildSrcCheckMinifiedSizeTask",
"(",
")",
"{",
"const",
"stats",
"=",
"await",
"fs",
".",
"stat",
"(",
"'./dist/Autolinker.min.js'",
")",
";",
"const",
"sizeInKb",
"=",
"stats",
".",
"size",
"/",
"1000",
";",
"const",
"maxExpectedSizeInKb",... | Checks that we don't accidentally add an extra dependency that bloats the
minified size of Autolinker | [
"Checks",
"that",
"we",
"don",
"t",
"accidentally",
"add",
"an",
"extra",
"dependency",
"that",
"bloats",
"the",
"minified",
"size",
"of",
"Autolinker"
] | acdf9a5dd9208f27c144efaa068ae4b5d924b38c | https://github.com/gregjacobs/Autolinker.js/blob/acdf9a5dd9208f27c144efaa068ae4b5d924b38c/gulpfile.js#L295-L311 |
12,834 | chariotsolutions/phonegap-nfc | www/phonegap-nfc-blackberry.js | function(ndefMessageAsString) {
"use strict";
var ndefMessage = JSON.parse(ndefMessageAsString);
cordova.fireDocumentEvent("ndef", {
type: "ndef",
tag: {
ndefMessage: ndefMessage
}
});
} | javascript | function(ndefMessageAsString) {
"use strict";
var ndefMessage = JSON.parse(ndefMessageAsString);
cordova.fireDocumentEvent("ndef", {
type: "ndef",
tag: {
ndefMessage: ndefMessage
}
});
} | [
"function",
"(",
"ndefMessageAsString",
")",
"{",
"\"use strict\"",
";",
"var",
"ndefMessage",
"=",
"JSON",
".",
"parse",
"(",
"ndefMessageAsString",
")",
";",
"cordova",
".",
"fireDocumentEvent",
"(",
"\"ndef\"",
",",
"{",
"type",
":",
"\"ndef\"",
",",
"tag",... | takes an ndefMessage from the success callback and fires a javascript event | [
"takes",
"an",
"ndefMessage",
"from",
"the",
"success",
"callback",
"and",
"fires",
"a",
"javascript",
"event"
] | aa92afca3686dff038d71d2ecb270c62e07c4bcb | https://github.com/chariotsolutions/phonegap-nfc/blob/aa92afca3686dff038d71d2ecb270c62e07c4bcb/www/phonegap-nfc-blackberry.js#L59-L68 | |
12,835 | chariotsolutions/phonegap-nfc | src/blackberry10/index.js | function(pluginResult, payloadString) {
var payload = JSON.parse(payloadString),
ndefObjectAsString = JSON.stringify(decode(b64toArray(payload.data)));
pluginResult.callbackOk(ndefObjectAsString, true);
} | javascript | function(pluginResult, payloadString) {
var payload = JSON.parse(payloadString),
ndefObjectAsString = JSON.stringify(decode(b64toArray(payload.data)));
pluginResult.callbackOk(ndefObjectAsString, true);
} | [
"function",
"(",
"pluginResult",
",",
"payloadString",
")",
"{",
"var",
"payload",
"=",
"JSON",
".",
"parse",
"(",
"payloadString",
")",
",",
"ndefObjectAsString",
"=",
"JSON",
".",
"stringify",
"(",
"decode",
"(",
"b64toArray",
"(",
"payload",
".",
"data",
... | called by invoke, when NFC tag is scanned | [
"called",
"by",
"invoke",
"when",
"NFC",
"tag",
"is",
"scanned"
] | aa92afca3686dff038d71d2ecb270c62e07c4bcb | https://github.com/chariotsolutions/phonegap-nfc/blob/aa92afca3686dff038d71d2ecb270c62e07c4bcb/src/blackberry10/index.js#L127-L131 | |
12,836 | FaridSafi/react-native-gifted-form | GiftedFormManager.js | formatValues | function formatValues(values) {
var formatted = {};
for (var key in values) {
if (values.hasOwnProperty(key)) {
if (typeof values[key] === 'boolean') {
var position = key.indexOf('{');
if (position !== -1) {
if (values[key] === true) {
// Each options of SelectWidget ... | javascript | function formatValues(values) {
var formatted = {};
for (var key in values) {
if (values.hasOwnProperty(key)) {
if (typeof values[key] === 'boolean') {
var position = key.indexOf('{');
if (position !== -1) {
if (values[key] === true) {
// Each options of SelectWidget ... | [
"function",
"formatValues",
"(",
"values",
")",
"{",
"var",
"formatted",
"=",
"{",
"}",
";",
"for",
"(",
"var",
"key",
"in",
"values",
")",
"{",
"if",
"(",
"values",
".",
"hasOwnProperty",
"(",
"key",
")",
")",
"{",
"if",
"(",
"typeof",
"values",
"... | the select widgets values need to be formated because even when the values are 'False' they are stored formatValues return only selected values of select widgets | [
"the",
"select",
"widgets",
"values",
"need",
"to",
"be",
"formated",
"because",
"even",
"when",
"the",
"values",
"are",
"False",
"they",
"are",
"stored",
"formatValues",
"return",
"only",
"selected",
"values",
"of",
"select",
"widgets"
] | 7910cb47157b35841f93d72febb39317dc0002c0 | https://github.com/FaridSafi/react-native-gifted-form/blob/7910cb47157b35841f93d72febb39317dc0002c0/GiftedFormManager.js#L94-L128 |
12,837 | mhart/aws4 | aws4.js | encodeRfc3986 | function encodeRfc3986(urlEncodedString) {
return urlEncodedString.replace(/[!'()*]/g, function(c) {
return '%' + c.charCodeAt(0).toString(16).toUpperCase()
})
} | javascript | function encodeRfc3986(urlEncodedString) {
return urlEncodedString.replace(/[!'()*]/g, function(c) {
return '%' + c.charCodeAt(0).toString(16).toUpperCase()
})
} | [
"function",
"encodeRfc3986",
"(",
"urlEncodedString",
")",
"{",
"return",
"urlEncodedString",
".",
"replace",
"(",
"/",
"[!'()*]",
"/",
"g",
",",
"function",
"(",
"c",
")",
"{",
"return",
"'%'",
"+",
"c",
".",
"charCodeAt",
"(",
"0",
")",
".",
"toString"... | This function assumes the string has already been percent encoded | [
"This",
"function",
"assumes",
"the",
"string",
"has",
"already",
"been",
"percent",
"encoded"
] | e2052432f836af766b33ce5782a3bfa21f40db99 | https://github.com/mhart/aws4/blob/e2052432f836af766b33ce5782a3bfa21f40db99/aws4.js#L19-L23 |
12,838 | alexeyten/qr-image | lib/qr-base.js | getTemplate | function getTemplate(message, ec_level) {
var i = 1;
var len;
if (message.data1) {
len = Math.ceil(message.data1.length / 8);
} else {
i = 10;
}
for (/* i */; i < 10; i++) {
var version = versions[i][ec_level];
if (version.data_len >= len) {
return _d... | javascript | function getTemplate(message, ec_level) {
var i = 1;
var len;
if (message.data1) {
len = Math.ceil(message.data1.length / 8);
} else {
i = 10;
}
for (/* i */; i < 10; i++) {
var version = versions[i][ec_level];
if (version.data_len >= len) {
return _d... | [
"function",
"getTemplate",
"(",
"message",
",",
"ec_level",
")",
"{",
"var",
"i",
"=",
"1",
";",
"var",
"len",
";",
"if",
"(",
"message",
".",
"data1",
")",
"{",
"len",
"=",
"Math",
".",
"ceil",
"(",
"message",
".",
"data1",
".",
"length",
"/",
"... | {{{1 Get version template | [
"{{{",
"1",
"Get",
"version",
"template"
] | 9b5ee0e8f38152f29cfd59eedaf037fafb47e740 | https://github.com/alexeyten/qr-image/blob/9b5ee0e8f38152f29cfd59eedaf037fafb47e740/lib/qr-base.js#L89-L125 |
12,839 | alexeyten/qr-image | lib/qr-base.js | fillTemplate | function fillTemplate(message, template) {
var blocks = new Buffer(template.data_len);
blocks.fill(0);
if (template.version < 10) {
message = message.data1;
} else if (template.version < 27) {
message = message.data10;
} else {
message = message.data27;
}
var len = ... | javascript | function fillTemplate(message, template) {
var blocks = new Buffer(template.data_len);
blocks.fill(0);
if (template.version < 10) {
message = message.data1;
} else if (template.version < 27) {
message = message.data10;
} else {
message = message.data27;
}
var len = ... | [
"function",
"fillTemplate",
"(",
"message",
",",
"template",
")",
"{",
"var",
"blocks",
"=",
"new",
"Buffer",
"(",
"template",
".",
"data_len",
")",
";",
"blocks",
".",
"fill",
"(",
"0",
")",
";",
"if",
"(",
"template",
".",
"version",
"<",
"10",
")"... | {{{1 Fill template | [
"{{{",
"1",
"Fill",
"template"
] | 9b5ee0e8f38152f29cfd59eedaf037fafb47e740 | https://github.com/alexeyten/qr-image/blob/9b5ee0e8f38152f29cfd59eedaf037fafb47e740/lib/qr-base.js#L128-L165 |
12,840 | alexeyten/qr-image | lib/qr-base.js | QR | function QR(text, ec_level, parse_url) {
ec_level = EC_LEVELS.indexOf(ec_level) > -1 ? ec_level : 'M';
var message = encode(text, parse_url);
var data = fillTemplate(message, getTemplate(message, ec_level));
return matrix.getMatrix(data);
} | javascript | function QR(text, ec_level, parse_url) {
ec_level = EC_LEVELS.indexOf(ec_level) > -1 ? ec_level : 'M';
var message = encode(text, parse_url);
var data = fillTemplate(message, getTemplate(message, ec_level));
return matrix.getMatrix(data);
} | [
"function",
"QR",
"(",
"text",
",",
"ec_level",
",",
"parse_url",
")",
"{",
"ec_level",
"=",
"EC_LEVELS",
".",
"indexOf",
"(",
"ec_level",
")",
">",
"-",
"1",
"?",
"ec_level",
":",
"'M'",
";",
"var",
"message",
"=",
"encode",
"(",
"text",
",",
"parse... | {{{1 All-in-one | [
"{{{",
"1",
"All",
"-",
"in",
"-",
"one"
] | 9b5ee0e8f38152f29cfd59eedaf037fafb47e740 | https://github.com/alexeyten/qr-image/blob/9b5ee0e8f38152f29cfd59eedaf037fafb47e740/lib/qr-base.js#L168-L173 |
12,841 | alexeyten/qr-image | lib/encode.js | encode_8bit | function encode_8bit(data) {
var len = data.length;
var bits = [];
for (var i = 0; i < len; i++) {
pushBits(bits, 8, data[i]);
}
var res = {};
var d = [0, 1, 0, 0];
pushBits(d, 16, len);
res.data10 = res.data27 = d.concat(bits);
if (len < 256) {
var d = [0, 1, 0, ... | javascript | function encode_8bit(data) {
var len = data.length;
var bits = [];
for (var i = 0; i < len; i++) {
pushBits(bits, 8, data[i]);
}
var res = {};
var d = [0, 1, 0, 0];
pushBits(d, 16, len);
res.data10 = res.data27 = d.concat(bits);
if (len < 256) {
var d = [0, 1, 0, ... | [
"function",
"encode_8bit",
"(",
"data",
")",
"{",
"var",
"len",
"=",
"data",
".",
"length",
";",
"var",
"bits",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"pushBits",
"(",
"bits",
","... | {{{1 8bit encode | [
"{{{",
"1",
"8bit",
"encode"
] | 9b5ee0e8f38152f29cfd59eedaf037fafb47e740 | https://github.com/alexeyten/qr-image/blob/9b5ee0e8f38152f29cfd59eedaf037fafb47e740/lib/encode.js#L10-L31 |
12,842 | alexeyten/qr-image | lib/encode.js | encode_numeric | function encode_numeric(str) {
var len = str.length;
var bits = [];
for (var i = 0; i < len; i += 3) {
var s = str.substr(i, 3);
var b = Math.ceil(s.length * 10 / 3);
pushBits(bits, b, parseInt(s, 10));
}
var res = {};
var d = [0, 0, 0, 1];
pushBits(d, 14, len);
... | javascript | function encode_numeric(str) {
var len = str.length;
var bits = [];
for (var i = 0; i < len; i += 3) {
var s = str.substr(i, 3);
var b = Math.ceil(s.length * 10 / 3);
pushBits(bits, b, parseInt(s, 10));
}
var res = {};
var d = [0, 0, 0, 1];
pushBits(d, 14, len);
... | [
"function",
"encode_numeric",
"(",
"str",
")",
"{",
"var",
"len",
"=",
"str",
".",
"length",
";",
"var",
"bits",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"i",
"+=",
"3",
")",
"{",
"var",
"s",
"=",
"st... | {{{1 numeric encode | [
"{{{",
"1",
"numeric",
"encode"
] | 9b5ee0e8f38152f29cfd59eedaf037fafb47e740 | https://github.com/alexeyten/qr-image/blob/9b5ee0e8f38152f29cfd59eedaf037fafb47e740/lib/encode.js#L78-L107 |
12,843 | alexeyten/qr-image | lib/encode.js | encode_url | function encode_url(str) {
var slash = str.indexOf('/', 8) + 1 || str.length;
var res = encode(str.slice(0, slash).toUpperCase(), false);
if (slash >= str.length) {
return res;
}
var path_res = encode(str.slice(slash), false);
res.data27 = res.data27.concat(path_res.data27);
if (... | javascript | function encode_url(str) {
var slash = str.indexOf('/', 8) + 1 || str.length;
var res = encode(str.slice(0, slash).toUpperCase(), false);
if (slash >= str.length) {
return res;
}
var path_res = encode(str.slice(slash), false);
res.data27 = res.data27.concat(path_res.data27);
if (... | [
"function",
"encode_url",
"(",
"str",
")",
"{",
"var",
"slash",
"=",
"str",
".",
"indexOf",
"(",
"'/'",
",",
"8",
")",
"+",
"1",
"||",
"str",
".",
"length",
";",
"var",
"res",
"=",
"encode",
"(",
"str",
".",
"slice",
"(",
"0",
",",
"slash",
")"... | {{{1 url encode | [
"{{{",
"1",
"url",
"encode"
] | 9b5ee0e8f38152f29cfd59eedaf037fafb47e740 | https://github.com/alexeyten/qr-image/blob/9b5ee0e8f38152f29cfd59eedaf037fafb47e740/lib/encode.js#L110-L131 |
12,844 | alexeyten/qr-image | lib/encode.js | encode | function encode(data, parse_url) {
var str;
var t = typeof data;
if (t == 'string' || t == 'number') {
str = '' + data;
data = new Buffer(str);
} else if (Buffer.isBuffer(data)) {
str = data.toString();
} else if (Array.isArray(data)) {
data = new Buffer(data);
... | javascript | function encode(data, parse_url) {
var str;
var t = typeof data;
if (t == 'string' || t == 'number') {
str = '' + data;
data = new Buffer(str);
} else if (Buffer.isBuffer(data)) {
str = data.toString();
} else if (Array.isArray(data)) {
data = new Buffer(data);
... | [
"function",
"encode",
"(",
"data",
",",
"parse_url",
")",
"{",
"var",
"str",
";",
"var",
"t",
"=",
"typeof",
"data",
";",
"if",
"(",
"t",
"==",
"'string'",
"||",
"t",
"==",
"'number'",
")",
"{",
"str",
"=",
"''",
"+",
"data",
";",
"data",
"=",
... | {{{1 Choose encode mode and generates struct with data for different version | [
"{{{",
"1",
"Choose",
"encode",
"mode",
"and",
"generates",
"struct",
"with",
"data",
"for",
"different",
"version"
] | 9b5ee0e8f38152f29cfd59eedaf037fafb47e740 | https://github.com/alexeyten/qr-image/blob/9b5ee0e8f38152f29cfd59eedaf037fafb47e740/lib/encode.js#L134-L172 |
12,845 | alexeyten/qr-image | lib/matrix.js | init | function init(version) {
var N = version * 4 + 17;
var matrix = [];
var zeros = new Buffer(N);
zeros.fill(0);
zeros = [].slice.call(zeros);
for (var i = 0; i < N; i++) {
matrix[i] = zeros.slice();
}
return matrix;
} | javascript | function init(version) {
var N = version * 4 + 17;
var matrix = [];
var zeros = new Buffer(N);
zeros.fill(0);
zeros = [].slice.call(zeros);
for (var i = 0; i < N; i++) {
matrix[i] = zeros.slice();
}
return matrix;
} | [
"function",
"init",
"(",
"version",
")",
"{",
"var",
"N",
"=",
"version",
"*",
"4",
"+",
"17",
";",
"var",
"matrix",
"=",
"[",
"]",
";",
"var",
"zeros",
"=",
"new",
"Buffer",
"(",
"N",
")",
";",
"zeros",
".",
"fill",
"(",
"0",
")",
";",
"zero... | {{{1 Initialize matrix with zeros | [
"{{{",
"1",
"Initialize",
"matrix",
"with",
"zeros"
] | 9b5ee0e8f38152f29cfd59eedaf037fafb47e740 | https://github.com/alexeyten/qr-image/blob/9b5ee0e8f38152f29cfd59eedaf037fafb47e740/lib/matrix.js#L4-L14 |
12,846 | alexeyten/qr-image | lib/matrix.js | fillFinders | function fillFinders(matrix) {
var N = matrix.length;
for (var i = -3; i <= 3; i++) {
for (var j = -3; j <= 3; j++) {
var max = Math.max(i, j);
var min = Math.min(i, j);
var pixel = (max == 2 && min >= -2) || (min == -2 && max <= 2) ? 0x80 : 0x81;
matrix[3... | javascript | function fillFinders(matrix) {
var N = matrix.length;
for (var i = -3; i <= 3; i++) {
for (var j = -3; j <= 3; j++) {
var max = Math.max(i, j);
var min = Math.min(i, j);
var pixel = (max == 2 && min >= -2) || (min == -2 && max <= 2) ? 0x80 : 0x81;
matrix[3... | [
"function",
"fillFinders",
"(",
"matrix",
")",
"{",
"var",
"N",
"=",
"matrix",
".",
"length",
";",
"for",
"(",
"var",
"i",
"=",
"-",
"3",
";",
"i",
"<=",
"3",
";",
"i",
"++",
")",
"{",
"for",
"(",
"var",
"j",
"=",
"-",
"3",
";",
"j",
"<=",
... | {{{1 Put finders into matrix | [
"{{{",
"1",
"Put",
"finders",
"into",
"matrix"
] | 9b5ee0e8f38152f29cfd59eedaf037fafb47e740 | https://github.com/alexeyten/qr-image/blob/9b5ee0e8f38152f29cfd59eedaf037fafb47e740/lib/matrix.js#L17-L34 |
12,847 | alexeyten/qr-image | lib/matrix.js | fillAlignAndTiming | function fillAlignAndTiming(matrix) {
var N = matrix.length;
if (N > 21) {
var len = N - 13;
var delta = Math.round(len / Math.ceil(len / 28));
if (delta % 2) delta++;
var res = [];
for (var p = len + 6; p > 10; p -= delta) {
res.unshift(p);
}
... | javascript | function fillAlignAndTiming(matrix) {
var N = matrix.length;
if (N > 21) {
var len = N - 13;
var delta = Math.round(len / Math.ceil(len / 28));
if (delta % 2) delta++;
var res = [];
for (var p = len + 6; p > 10; p -= delta) {
res.unshift(p);
}
... | [
"function",
"fillAlignAndTiming",
"(",
"matrix",
")",
"{",
"var",
"N",
"=",
"matrix",
".",
"length",
";",
"if",
"(",
"N",
">",
"21",
")",
"{",
"var",
"len",
"=",
"N",
"-",
"13",
";",
"var",
"delta",
"=",
"Math",
".",
"round",
"(",
"len",
"/",
"... | {{{1 Put align and timinig | [
"{{{",
"1",
"Put",
"align",
"and",
"timinig"
] | 9b5ee0e8f38152f29cfd59eedaf037fafb47e740 | https://github.com/alexeyten/qr-image/blob/9b5ee0e8f38152f29cfd59eedaf037fafb47e740/lib/matrix.js#L37-L66 |
12,848 | alexeyten/qr-image | lib/matrix.js | fillStub | function fillStub(matrix) {
var N = matrix.length;
for (var i = 0; i < 8; i++) {
if (i != 6) {
matrix[8][i] = matrix[i][8] = 0x80;
}
matrix[8][N - 1 - i] = 0x80;
matrix[N - 1 - i][8] = 0x80;
}
matrix[8][8] = 0x80;
matrix[N - 8][8] = 0x81;
if (N < 45) ... | javascript | function fillStub(matrix) {
var N = matrix.length;
for (var i = 0; i < 8; i++) {
if (i != 6) {
matrix[8][i] = matrix[i][8] = 0x80;
}
matrix[8][N - 1 - i] = 0x80;
matrix[N - 1 - i][8] = 0x80;
}
matrix[8][8] = 0x80;
matrix[N - 8][8] = 0x81;
if (N < 45) ... | [
"function",
"fillStub",
"(",
"matrix",
")",
"{",
"var",
"N",
"=",
"matrix",
".",
"length",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"8",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
"!=",
"6",
")",
"{",
"matrix",
"[",
"8",
"]",
... | {{{1 Fill reserved areas with zeroes | [
"{{{",
"1",
"Fill",
"reserved",
"areas",
"with",
"zeroes"
] | 9b5ee0e8f38152f29cfd59eedaf037fafb47e740 | https://github.com/alexeyten/qr-image/blob/9b5ee0e8f38152f29cfd59eedaf037fafb47e740/lib/matrix.js#L69-L88 |
12,849 | alexeyten/qr-image | lib/matrix.js | getMatrix | function getMatrix(data) {
var matrix = init(data.version);
fillFinders(matrix);
fillAlignAndTiming(matrix);
fillStub(matrix);
var penalty = Infinity;
var bestMask = 0;
for (var mask = 0; mask < 8; mask++) {
fillData(matrix, data, mask);
fillReserved(matrix, data.ec_level, m... | javascript | function getMatrix(data) {
var matrix = init(data.version);
fillFinders(matrix);
fillAlignAndTiming(matrix);
fillStub(matrix);
var penalty = Infinity;
var bestMask = 0;
for (var mask = 0; mask < 8; mask++) {
fillData(matrix, data, mask);
fillReserved(matrix, data.ec_level, m... | [
"function",
"getMatrix",
"(",
"data",
")",
"{",
"var",
"matrix",
"=",
"init",
"(",
"data",
".",
"version",
")",
";",
"fillFinders",
"(",
"matrix",
")",
";",
"fillAlignAndTiming",
"(",
"matrix",
")",
";",
"fillStub",
"(",
"matrix",
")",
";",
"var",
"pen... | {{{1 All-in-one function | [
"{{{",
"1",
"All",
"-",
"in",
"-",
"one",
"function"
] | 9b5ee0e8f38152f29cfd59eedaf037fafb47e740 | https://github.com/alexeyten/qr-image/blob/9b5ee0e8f38152f29cfd59eedaf037fafb47e740/lib/matrix.js#L314-L340 |
12,850 | Autodesk/hig | packages/components/scripts/build.js | getPackageExportNames | function getPackageExportNames(packagePath) {
const packageMeta = getPackageMeta(packagePath);
const packageModulePath = path.join(packagePath, packageMeta.module);
const moduleFileSource = fs.readFileSync(packageModulePath, "utf8");
const { body } = esprima.parseModule(moduleFileSource);
return body.reduce(... | javascript | function getPackageExportNames(packagePath) {
const packageMeta = getPackageMeta(packagePath);
const packageModulePath = path.join(packagePath, packageMeta.module);
const moduleFileSource = fs.readFileSync(packageModulePath, "utf8");
const { body } = esprima.parseModule(moduleFileSource);
return body.reduce(... | [
"function",
"getPackageExportNames",
"(",
"packagePath",
")",
"{",
"const",
"packageMeta",
"=",
"getPackageMeta",
"(",
"packagePath",
")",
";",
"const",
"packageModulePath",
"=",
"path",
".",
"join",
"(",
"packagePath",
",",
"packageMeta",
".",
"module",
")",
";... | Parsed the package's main module and returns all of the export names
@param {string} packageName
@returns {string[]} | [
"Parsed",
"the",
"package",
"s",
"main",
"module",
"and",
"returns",
"all",
"of",
"the",
"export",
"names"
] | b51406a358ec536d70dc404199c62dafe7e4f75e | https://github.com/Autodesk/hig/blob/b51406a358ec536d70dc404199c62dafe7e4f75e/packages/components/scripts/build.js#L60-L77 |
12,851 | Autodesk/hig | packages/flyout/src/coordinateHelpers.js | offsetContainerProperty | function offsetContainerProperty(offsetProperty, coordinates, diff) {
return {
...coordinates,
containerPosition: {
...coordinates.containerPosition,
[offsetProperty]: coordinates.containerPosition[offsetProperty] + diff
}
};
} | javascript | function offsetContainerProperty(offsetProperty, coordinates, diff) {
return {
...coordinates,
containerPosition: {
...coordinates.containerPosition,
[offsetProperty]: coordinates.containerPosition[offsetProperty] + diff
}
};
} | [
"function",
"offsetContainerProperty",
"(",
"offsetProperty",
",",
"coordinates",
",",
"diff",
")",
"{",
"return",
"{",
"...",
"coordinates",
",",
"containerPosition",
":",
"{",
"...",
"coordinates",
".",
"containerPosition",
",",
"[",
"offsetProperty",
"]",
":",
... | Offsets the container
@param {string} offsetProperty
@param {Coordinates} coordinates
@param {number} diff
@returns {Coordinates} | [
"Offsets",
"the",
"container"
] | b51406a358ec536d70dc404199c62dafe7e4f75e | https://github.com/Autodesk/hig/blob/b51406a358ec536d70dc404199c62dafe7e4f75e/packages/flyout/src/coordinateHelpers.js#L17-L25 |
12,852 | Autodesk/hig | packages/flyout/src/getCoordinates.js | createViewportDeterminer | function createViewportDeterminer(props) {
const { viewportRect, panelRect, actionRect } = props;
return function isInViewport({ containerPosition }) {
const containerTop = actionRect.top + containerPosition.top;
const containerLeft = actionRect.left + containerPosition.left;
const containerRight = con... | javascript | function createViewportDeterminer(props) {
const { viewportRect, panelRect, actionRect } = props;
return function isInViewport({ containerPosition }) {
const containerTop = actionRect.top + containerPosition.top;
const containerLeft = actionRect.left + containerPosition.left;
const containerRight = con... | [
"function",
"createViewportDeterminer",
"(",
"props",
")",
"{",
"const",
"{",
"viewportRect",
",",
"panelRect",
",",
"actionRect",
"}",
"=",
"props",
";",
"return",
"function",
"isInViewport",
"(",
"{",
"containerPosition",
"}",
")",
"{",
"const",
"containerTop"... | Determines whether the given position is entirely within the viewport
@param {Payload} payload
@returns {function(Coordinates): boolean} | [
"Determines",
"whether",
"the",
"given",
"position",
"is",
"entirely",
"within",
"the",
"viewport"
] | b51406a358ec536d70dc404199c62dafe7e4f75e | https://github.com/Autodesk/hig/blob/b51406a358ec536d70dc404199c62dafe7e4f75e/packages/flyout/src/getCoordinates.js#L234-L250 |
12,853 | canonical-web-and-design/vanilla-framework | gulp/styles.js | throwSassError | function throwSassError(sassError) {
throw new gutil.PluginError({
plugin: 'sass',
message: util.format("Sass error: '%s' on line %s of %s", sassError.message, sassError.line, sassError.file)
});
} | javascript | function throwSassError(sassError) {
throw new gutil.PluginError({
plugin: 'sass',
message: util.format("Sass error: '%s' on line %s of %s", sassError.message, sassError.line, sassError.file)
});
} | [
"function",
"throwSassError",
"(",
"sassError",
")",
"{",
"throw",
"new",
"gutil",
".",
"PluginError",
"(",
"{",
"plugin",
":",
"'sass'",
",",
"message",
":",
"util",
".",
"format",
"(",
"\"Sass error: '%s' on line %s of %s\"",
",",
"sassError",
".",
"message",
... | Provide details of Sass errors | [
"Provide",
"details",
"of",
"Sass",
"errors"
] | 720e10be29350c847e64b928ebf604f5cf64adcd | https://github.com/canonical-web-and-design/vanilla-framework/blob/720e10be29350c847e64b928ebf604f5cf64adcd/gulp/styles.js#L10-L15 |
12,854 | Operational-Transformation/ot.js | lib/simple-text-operation.js | Insert | function Insert (str, position) {
if (!this || this.constructor !== SimpleTextOperation) {
// => function was called without 'new'
return new Insert(str, position);
}
this.str = str;
this.position = position;
} | javascript | function Insert (str, position) {
if (!this || this.constructor !== SimpleTextOperation) {
// => function was called without 'new'
return new Insert(str, position);
}
this.str = str;
this.position = position;
} | [
"function",
"Insert",
"(",
"str",
",",
"position",
")",
"{",
"if",
"(",
"!",
"this",
"||",
"this",
".",
"constructor",
"!==",
"SimpleTextOperation",
")",
"{",
"// => function was called without 'new'",
"return",
"new",
"Insert",
"(",
"str",
",",
"position",
")... | Insert the string `str` at the zero-based `position` in the document. | [
"Insert",
"the",
"string",
"str",
"at",
"the",
"zero",
"-",
"based",
"position",
"in",
"the",
"document",
"."
] | 8873b7e28e83f9adbf6c3a28ec639c9151a838ae | https://github.com/Operational-Transformation/ot.js/blob/8873b7e28e83f9adbf6c3a28ec639c9151a838ae/lib/simple-text-operation.js#L14-L21 |
12,855 | Operational-Transformation/ot.js | lib/simple-text-operation.js | Delete | function Delete (count, position) {
if (!this || this.constructor !== SimpleTextOperation) {
return new Delete(count, position);
}
this.count = count;
this.position = position;
} | javascript | function Delete (count, position) {
if (!this || this.constructor !== SimpleTextOperation) {
return new Delete(count, position);
}
this.count = count;
this.position = position;
} | [
"function",
"Delete",
"(",
"count",
",",
"position",
")",
"{",
"if",
"(",
"!",
"this",
"||",
"this",
".",
"constructor",
"!==",
"SimpleTextOperation",
")",
"{",
"return",
"new",
"Delete",
"(",
"count",
",",
"position",
")",
";",
"}",
"this",
".",
"coun... | Delete `count` many characters at the zero-based `position` in the document. | [
"Delete",
"count",
"many",
"characters",
"at",
"the",
"zero",
"-",
"based",
"position",
"in",
"the",
"document",
"."
] | 8873b7e28e83f9adbf6c3a28ec639c9151a838ae | https://github.com/Operational-Transformation/ot.js/blob/8873b7e28e83f9adbf6c3a28ec639c9151a838ae/lib/simple-text-operation.js#L42-L48 |
12,856 | Operational-Transformation/ot.js | lib/undo-manager.js | UndoManager | function UndoManager (maxItems) {
this.maxItems = maxItems || 50;
this.state = NORMAL_STATE;
this.dontCompose = false;
this.undoStack = [];
this.redoStack = [];
} | javascript | function UndoManager (maxItems) {
this.maxItems = maxItems || 50;
this.state = NORMAL_STATE;
this.dontCompose = false;
this.undoStack = [];
this.redoStack = [];
} | [
"function",
"UndoManager",
"(",
"maxItems",
")",
"{",
"this",
".",
"maxItems",
"=",
"maxItems",
"||",
"50",
";",
"this",
".",
"state",
"=",
"NORMAL_STATE",
";",
"this",
".",
"dontCompose",
"=",
"false",
";",
"this",
".",
"undoStack",
"=",
"[",
"]",
";"... | Create a new UndoManager with an optional maximum history size. | [
"Create",
"a",
"new",
"UndoManager",
"with",
"an",
"optional",
"maximum",
"history",
"size",
"."
] | 8873b7e28e83f9adbf6c3a28ec639c9151a838ae | https://github.com/Operational-Transformation/ot.js/blob/8873b7e28e83f9adbf6c3a28ec639c9151a838ae/lib/undo-manager.js#L14-L20 |
12,857 | notwaldorf/emoji-translate | emoji-translate.js | getEmojiForWord | function getEmojiForWord(word) {
let translations = getAllEmojiForWord(word);
return translations[Math.floor(Math.random() * translations.length)];
} | javascript | function getEmojiForWord(word) {
let translations = getAllEmojiForWord(word);
return translations[Math.floor(Math.random() * translations.length)];
} | [
"function",
"getEmojiForWord",
"(",
"word",
")",
"{",
"let",
"translations",
"=",
"getAllEmojiForWord",
"(",
"word",
")",
";",
"return",
"translations",
"[",
"Math",
".",
"floor",
"(",
"Math",
".",
"random",
"(",
")",
"*",
"translations",
".",
"length",
")... | Returns a random emoji translation of an english word.
@param {String} word The word to be translated.
@returns {String} A random emoji translation or '' if none exists. | [
"Returns",
"a",
"random",
"emoji",
"translation",
"of",
"an",
"english",
"word",
"."
] | ed74d89410dc4aa3c67e19c5a9171b7267aba362 | https://github.com/notwaldorf/emoji-translate/blob/ed74d89410dc4aa3c67e19c5a9171b7267aba362/emoji-translate.js#L108-L111 |
12,858 | notwaldorf/emoji-translate | emoji-translate.js | translate | function translate(sentence, onlyEmoji) {
let translation = '';
let words = sentence.split(' ');
for (let i = 0; i < words.length; i++ ) {
// Punctuation blows. Get all the punctuation at the start and end of the word.
// TODO: stop copy pasting this.
let firstSymbol = '';
let lastSymbol = '';
... | javascript | function translate(sentence, onlyEmoji) {
let translation = '';
let words = sentence.split(' ');
for (let i = 0; i < words.length; i++ ) {
// Punctuation blows. Get all the punctuation at the start and end of the word.
// TODO: stop copy pasting this.
let firstSymbol = '';
let lastSymbol = '';
... | [
"function",
"translate",
"(",
"sentence",
",",
"onlyEmoji",
")",
"{",
"let",
"translation",
"=",
"''",
";",
"let",
"words",
"=",
"sentence",
".",
"split",
"(",
"' '",
")",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"words",
".",
"length"... | Translates an entire sentence to emoji. If multiple translations exist
for a particular word, a random emoji is picked.
@param {String} sentence The sentence to be translated
@param {Bool} onlyEmoji True if the translation should omit all untranslatable words
@returns {String} An emoji translation! | [
"Translates",
"an",
"entire",
"sentence",
"to",
"emoji",
".",
"If",
"multiple",
"translations",
"exist",
"for",
"a",
"particular",
"word",
"a",
"random",
"emoji",
"is",
"picked",
"."
] | ed74d89410dc4aa3c67e19c5a9171b7267aba362 | https://github.com/notwaldorf/emoji-translate/blob/ed74d89410dc4aa3c67e19c5a9171b7267aba362/emoji-translate.js#L165-L196 |
12,859 | fzaninotto/uptime | lib/pollers/udp/udpPoller.js | function() {
var udpServer = dgram.createSocket('udp4');
// binding required for getting responses
udpServer.bind();
udpServer.on('error', function () {});
getUdpServer = function() {
return udpServer;
};
return getUdpServer();
} | javascript | function() {
var udpServer = dgram.createSocket('udp4');
// binding required for getting responses
udpServer.bind();
udpServer.on('error', function () {});
getUdpServer = function() {
return udpServer;
};
return getUdpServer();
} | [
"function",
"(",
")",
"{",
"var",
"udpServer",
"=",
"dgram",
".",
"createSocket",
"(",
"'udp4'",
")",
";",
"// binding required for getting responses",
"udpServer",
".",
"bind",
"(",
")",
";",
"udpServer",
".",
"on",
"(",
"'error'",
",",
"function",
"(",
")"... | UdpServer Singleton, using self-redefining function | [
"UdpServer",
"Singleton",
"using",
"self",
"-",
"redefining",
"function"
] | e2f6bfe42da7b9e8e1416cf9e0668fd9fb5e4294 | https://github.com/fzaninotto/uptime/blob/e2f6bfe42da7b9e8e1416cf9e0668fd9fb5e4294/lib/pollers/udp/udpPoller.js#L12-L21 | |
12,860 | fzaninotto/uptime | lib/pollers/udp/udpPoller.js | UdpPoller | function UdpPoller(target, timeout, callback) {
UdpPoller.super_.call(this, target, timeout, callback);
} | javascript | function UdpPoller(target, timeout, callback) {
UdpPoller.super_.call(this, target, timeout, callback);
} | [
"function",
"UdpPoller",
"(",
"target",
",",
"timeout",
",",
"callback",
")",
"{",
"UdpPoller",
".",
"super_",
".",
"call",
"(",
"this",
",",
"target",
",",
"timeout",
",",
"callback",
")",
";",
"}"
] | UDP Poller, to check UDP services
@param {Mixed} Poller Target (e.g. URL)
@param {Number} Poller timeout in milliseconds. Without response before this duration, the poller stops and executes the error callback.
@param {Function} Error/success callback
@api public | [
"UDP",
"Poller",
"to",
"check",
"UDP",
"services"
] | e2f6bfe42da7b9e8e1416cf9e0668fd9fb5e4294 | https://github.com/fzaninotto/uptime/blob/e2f6bfe42da7b9e8e1416cf9e0668fd9fb5e4294/lib/pollers/udp/udpPoller.js#L31-L33 |
12,861 | fzaninotto/uptime | fixtures/populate.js | function(callback) {
console.log('Removing Checks');
async.series([
function(cb) { CheckEvent.collection.remove(cb); },
function(cb) { Check.collection.remove(cb); }
], callback);
} | javascript | function(callback) {
console.log('Removing Checks');
async.series([
function(cb) { CheckEvent.collection.remove(cb); },
function(cb) { Check.collection.remove(cb); }
], callback);
} | [
"function",
"(",
"callback",
")",
"{",
"console",
".",
"log",
"(",
"'Removing Checks'",
")",
";",
"async",
".",
"series",
"(",
"[",
"function",
"(",
"cb",
")",
"{",
"CheckEvent",
".",
"collection",
".",
"remove",
"(",
"cb",
")",
";",
"}",
",",
"funct... | defaults to 3 months ago | [
"defaults",
"to",
"3",
"months",
"ago"
] | e2f6bfe42da7b9e8e1416cf9e0668fd9fb5e4294 | https://github.com/fzaninotto/uptime/blob/e2f6bfe42da7b9e8e1416cf9e0668fd9fb5e4294/fixtures/populate.js#L9-L15 | |
12,862 | fzaninotto/uptime | lib/pollers/https/httpsPoller.js | HttpsPoller | function HttpsPoller(target, timeout, callback) {
HttpsPoller.super_.call(this, target, timeout, callback);
} | javascript | function HttpsPoller(target, timeout, callback) {
HttpsPoller.super_.call(this, target, timeout, callback);
} | [
"function",
"HttpsPoller",
"(",
"target",
",",
"timeout",
",",
"callback",
")",
"{",
"HttpsPoller",
".",
"super_",
".",
"call",
"(",
"this",
",",
"target",
",",
"timeout",
",",
"callback",
")",
";",
"}"
] | HTTPS Poller, to check web pages served via SSL
@param {Mixed} Poller Target (e.g. URL)
@param {Number} Poller timeout in milliseconds. Without response before this duration, the poller stops and executes the error callback.
@param {Function} Error/success callback
@api public | [
"HTTPS",
"Poller",
"to",
"check",
"web",
"pages",
"served",
"via",
"SSL"
] | e2f6bfe42da7b9e8e1416cf9e0668fd9fb5e4294 | https://github.com/fzaninotto/uptime/blob/e2f6bfe42da7b9e8e1416cf9e0668fd9fb5e4294/lib/pollers/https/httpsPoller.js#L24-L26 |
12,863 | fzaninotto/uptime | lib/pollers/http/httpPoller.js | HttpPoller | function HttpPoller(target, timeout, callback) {
HttpPoller.super_.call(this, target, timeout, callback);
} | javascript | function HttpPoller(target, timeout, callback) {
HttpPoller.super_.call(this, target, timeout, callback);
} | [
"function",
"HttpPoller",
"(",
"target",
",",
"timeout",
",",
"callback",
")",
"{",
"HttpPoller",
".",
"super_",
".",
"call",
"(",
"this",
",",
"target",
",",
"timeout",
",",
"callback",
")",
";",
"}"
] | HTTP Poller, to check web pages
@param {Mixed} Poller Target (e.g. URL)
@param {Number} Poller timeout in milliseconds. Without response before this duration, the poller stops and executes the error callback.
@param {Function} Error/success callback
@api public | [
"HTTP",
"Poller",
"to",
"check",
"web",
"pages"
] | e2f6bfe42da7b9e8e1416cf9e0668fd9fb5e4294 | https://github.com/fzaninotto/uptime/blob/e2f6bfe42da7b9e8e1416cf9e0668fd9fb5e4294/lib/pollers/http/httpPoller.js#L24-L26 |
12,864 | fzaninotto/uptime | lib/pollers/basePoller.js | BasePoller | function BasePoller(target, timeout, callback) {
this.target = target;
this.timeout = timeout || 5000;
this.callback = callback;
this.isDebugEnabled = false;
this.initialize();
} | javascript | function BasePoller(target, timeout, callback) {
this.target = target;
this.timeout = timeout || 5000;
this.callback = callback;
this.isDebugEnabled = false;
this.initialize();
} | [
"function",
"BasePoller",
"(",
"target",
",",
"timeout",
",",
"callback",
")",
"{",
"this",
".",
"target",
"=",
"target",
";",
"this",
".",
"timeout",
"=",
"timeout",
"||",
"5000",
";",
"this",
".",
"callback",
"=",
"callback",
";",
"this",
".",
"isDeb... | Base Poller constructor
@param {Mixed} Poller Target (e.g. URL)
@param {Number} Poller timeout in milliseconds. Without response before this duration, the poller stops and executes the error callback.
@param {Function} Error/success callback
@api public | [
"Base",
"Poller",
"constructor"
] | e2f6bfe42da7b9e8e1416cf9e0668fd9fb5e4294 | https://github.com/fzaninotto/uptime/blob/e2f6bfe42da7b9e8e1416cf9e0668fd9fb5e4294/lib/pollers/basePoller.js#L14-L20 |
12,865 | fzaninotto/uptime | app/api/routes/check.js | function(req, res, next) {
Check
.find({ _id: req.params.id })
.select({qos: 0})
.findOne(function(err, check) {
if (err) return next(err);
if (!check) return res.json(404, { error: 'failed to load check ' + req.params.id });
req.check = check;
next();
});
} | javascript | function(req, res, next) {
Check
.find({ _id: req.params.id })
.select({qos: 0})
.findOne(function(err, check) {
if (err) return next(err);
if (!check) return res.json(404, { error: 'failed to load check ' + req.params.id });
req.check = check;
next();
});
} | [
"function",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"Check",
".",
"find",
"(",
"{",
"_id",
":",
"req",
".",
"params",
".",
"id",
"}",
")",
".",
"select",
"(",
"{",
"qos",
":",
"0",
"}",
")",
".",
"findOne",
"(",
"function",
"(",
"err",... | check route middleware | [
"check",
"route",
"middleware"
] | e2f6bfe42da7b9e8e1416cf9e0668fd9fb5e4294 | https://github.com/fzaninotto/uptime/blob/e2f6bfe42da7b9e8e1416cf9e0668fd9fb5e4294/app/api/routes/check.js#L41-L51 | |
12,866 | fzaninotto/uptime | app/api/routes/tag.js | function(req, res, next) {
Tag.findOne({ name: req.params.name }, function(err, tag) {
if (err) return next(err);
if (!tag) return res.json(404, { error: 'failed to load tag ' + req.params.name });
req.tag = tag;
next();
});
} | javascript | function(req, res, next) {
Tag.findOne({ name: req.params.name }, function(err, tag) {
if (err) return next(err);
if (!tag) return res.json(404, { error: 'failed to load tag ' + req.params.name });
req.tag = tag;
next();
});
} | [
"function",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"Tag",
".",
"findOne",
"(",
"{",
"name",
":",
"req",
".",
"params",
".",
"name",
"}",
",",
"function",
"(",
"err",
",",
"tag",
")",
"{",
"if",
"(",
"err",
")",
"return",
"next",
"(",
... | tag route middleware | [
"tag",
"route",
"middleware"
] | e2f6bfe42da7b9e8e1416cf9e0668fd9fb5e4294 | https://github.com/fzaninotto/uptime/blob/e2f6bfe42da7b9e8e1416cf9e0668fd9fb5e4294/app/api/routes/tag.js#L26-L33 | |
12,867 | fzaninotto/uptime | lib/pollers/http/baseHttpPoller.js | BaseHttpPoller | function BaseHttpPoller(target, timeout, callback) {
BaseHttpPoller.super_.call(this, target, timeout, callback);
} | javascript | function BaseHttpPoller(target, timeout, callback) {
BaseHttpPoller.super_.call(this, target, timeout, callback);
} | [
"function",
"BaseHttpPoller",
"(",
"target",
",",
"timeout",
",",
"callback",
")",
"{",
"BaseHttpPoller",
".",
"super_",
".",
"call",
"(",
"this",
",",
"target",
",",
"timeout",
",",
"callback",
")",
";",
"}"
] | Abstract class for HTTP and HTTPS Pollers, to check web pages
@param {Mixed} Poller Target (e.g. URL)
@param {Number} Poller timeout in milliseconds. Without response before this duration, the poller stops and executes the error callback.
@param {Function} Error/success callback
@api public | [
"Abstract",
"class",
"for",
"HTTP",
"and",
"HTTPS",
"Pollers",
"to",
"check",
"web",
"pages"
] | e2f6bfe42da7b9e8e1416cf9e0668fd9fb5e4294 | https://github.com/fzaninotto/uptime/blob/e2f6bfe42da7b9e8e1416cf9e0668fd9fb5e4294/lib/pollers/http/baseHttpPoller.js#L20-L22 |
12,868 | Lucifier129/react-lite | addons/shallowCompare.js | shallowCompare | function shallowCompare(instance, nextProps, nextState) {
return (
!shallowEqual(instance.props, nextProps) ||
!shallowEqual(instance.state, nextState)
);
} | javascript | function shallowCompare(instance, nextProps, nextState) {
return (
!shallowEqual(instance.props, nextProps) ||
!shallowEqual(instance.state, nextState)
);
} | [
"function",
"shallowCompare",
"(",
"instance",
",",
"nextProps",
",",
"nextState",
")",
"{",
"return",
"(",
"!",
"shallowEqual",
"(",
"instance",
".",
"props",
",",
"nextProps",
")",
"||",
"!",
"shallowEqual",
"(",
"instance",
".",
"state",
",",
"nextState",... | Does a shallow comparison for props and state.
See ReactComponentWithPureRenderMixin | [
"Does",
"a",
"shallow",
"comparison",
"for",
"props",
"and",
"state",
".",
"See",
"ReactComponentWithPureRenderMixin"
] | b7586ae247615f2d4c4373f206e6c284d7931f81 | https://github.com/Lucifier129/react-lite/blob/b7586ae247615f2d4c4373f206e6c284d7931f81/addons/shallowCompare.js#L17-L22 |
12,869 | Lucifier129/react-lite | addons/utils/getIteratorFn.js | getIteratorFn | function getIteratorFn(maybeIterable) {
var iteratorFn = maybeIterable && (
(ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL]) ||
maybeIterable[FAUX_ITERATOR_SYMBOL]
);
if (typeof iteratorFn === 'function') {
return iteratorFn;
}
} | javascript | function getIteratorFn(maybeIterable) {
var iteratorFn = maybeIterable && (
(ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL]) ||
maybeIterable[FAUX_ITERATOR_SYMBOL]
);
if (typeof iteratorFn === 'function') {
return iteratorFn;
}
} | [
"function",
"getIteratorFn",
"(",
"maybeIterable",
")",
"{",
"var",
"iteratorFn",
"=",
"maybeIterable",
"&&",
"(",
"(",
"ITERATOR_SYMBOL",
"&&",
"maybeIterable",
"[",
"ITERATOR_SYMBOL",
"]",
")",
"||",
"maybeIterable",
"[",
"FAUX_ITERATOR_SYMBOL",
"]",
")",
";",
... | Before Symbol spec.
Returns the iterator method function contained on the iterable object.
Be sure to invoke the function with the iterable as context:
var iteratorFn = getIteratorFn(myIterable);
if (iteratorFn) {
var iterator = iteratorFn.call(myIterable);
...
}
@param {?object} maybeIterable
@return {?function} | [
"Before",
"Symbol",
"spec",
".",
"Returns",
"the",
"iterator",
"method",
"function",
"contained",
"on",
"the",
"iterable",
"object",
"."
] | b7586ae247615f2d4c4373f206e6c284d7931f81 | https://github.com/Lucifier129/react-lite/blob/b7586ae247615f2d4c4373f206e6c284d7931f81/addons/utils/getIteratorFn.js#L33-L41 |
12,870 | Lucifier129/react-lite | addons/ReactStateSetters.js | function(component, funcReturningState) {
return function(a, b, c, d, e, f) {
var partialState = funcReturningState.call(component, a, b, c, d, e, f);
if (partialState) {
component.setState(partialState);
}
};
} | javascript | function(component, funcReturningState) {
return function(a, b, c, d, e, f) {
var partialState = funcReturningState.call(component, a, b, c, d, e, f);
if (partialState) {
component.setState(partialState);
}
};
} | [
"function",
"(",
"component",
",",
"funcReturningState",
")",
"{",
"return",
"function",
"(",
"a",
",",
"b",
",",
"c",
",",
"d",
",",
"e",
",",
"f",
")",
"{",
"var",
"partialState",
"=",
"funcReturningState",
".",
"call",
"(",
"component",
",",
"a",
... | Returns a function that calls the provided function, and uses the result
of that to set the component's state.
@param {ReactCompositeComponent} component
@param {function} funcReturningState Returned callback uses this to
determine how to update state.
@return {function} callback that when invoked uses funcReturningSt... | [
"Returns",
"a",
"function",
"that",
"calls",
"the",
"provided",
"function",
"and",
"uses",
"the",
"result",
"of",
"that",
"to",
"set",
"the",
"component",
"s",
"state",
"."
] | b7586ae247615f2d4c4373f206e6c284d7931f81 | https://github.com/Lucifier129/react-lite/blob/b7586ae247615f2d4c4373f206e6c284d7931f81/addons/ReactStateSetters.js#L25-L32 | |
12,871 | Lucifier129/react-lite | addons/ReactStateSetters.js | function(component, key) {
// Memoize the setters.
var cache = component.__keySetters || (component.__keySetters = {});
return cache[key] || (cache[key] = createStateKeySetter(component, key));
} | javascript | function(component, key) {
// Memoize the setters.
var cache = component.__keySetters || (component.__keySetters = {});
return cache[key] || (cache[key] = createStateKeySetter(component, key));
} | [
"function",
"(",
"component",
",",
"key",
")",
"{",
"// Memoize the setters.",
"var",
"cache",
"=",
"component",
".",
"__keySetters",
"||",
"(",
"component",
".",
"__keySetters",
"=",
"{",
"}",
")",
";",
"return",
"cache",
"[",
"key",
"]",
"||",
"(",
"ca... | Returns a single-argument callback that can be used to update a single
key in the component's state.
Note: this is memoized function, which makes it inexpensive to call.
@param {ReactCompositeComponent} component
@param {string} key The key in the state that you should update.
@return {function} callback of 1 argumen... | [
"Returns",
"a",
"single",
"-",
"argument",
"callback",
"that",
"can",
"be",
"used",
"to",
"update",
"a",
"single",
"key",
"in",
"the",
"component",
"s",
"state",
"."
] | b7586ae247615f2d4c4373f206e6c284d7931f81 | https://github.com/Lucifier129/react-lite/blob/b7586ae247615f2d4c4373f206e6c284d7931f81/addons/ReactStateSetters.js#L45-L49 | |
12,872 | xmppjs/xmpp.js | server/index.js | kill | async function kill(pid) {
try {
process.kill(pid, 'SIGTERM')
} catch (err) {
if (err.code !== 'ESRCH') throw err
}
} | javascript | async function kill(pid) {
try {
process.kill(pid, 'SIGTERM')
} catch (err) {
if (err.code !== 'ESRCH') throw err
}
} | [
"async",
"function",
"kill",
"(",
"pid",
")",
"{",
"try",
"{",
"process",
".",
"kill",
"(",
"pid",
",",
"'SIGTERM'",
")",
"}",
"catch",
"(",
"err",
")",
"{",
"if",
"(",
"err",
".",
"code",
"!==",
"'ESRCH'",
")",
"throw",
"err",
"}",
"}"
] | eslint-disable-next-line require-await | [
"eslint",
"-",
"disable",
"-",
"next",
"-",
"line",
"require",
"-",
"await"
] | 78f7a8fc220ce3dd013c60afacbf011400d23317 | https://github.com/xmppjs/xmpp.js/blob/78f7a8fc220ce3dd013c60afacbf011400d23317/server/index.js#L54-L60 |
12,873 | PatrickJS/angular-websocket | src/angular-websocket.js | cancelableify | function cancelableify(promise) {
promise.cancel = cancel;
var then = promise.then;
promise.then = function() {
var newPromise = then.apply(this, arguments);
return cancelableify(newPromise);
};
return promise;
} | javascript | function cancelableify(promise) {
promise.cancel = cancel;
var then = promise.then;
promise.then = function() {
var newPromise = then.apply(this, arguments);
return cancelableify(newPromise);
};
return promise;
} | [
"function",
"cancelableify",
"(",
"promise",
")",
"{",
"promise",
".",
"cancel",
"=",
"cancel",
";",
"var",
"then",
"=",
"promise",
".",
"then",
";",
"promise",
".",
"then",
"=",
"function",
"(",
")",
"{",
"var",
"newPromise",
"=",
"then",
".",
"apply"... | Credit goes to @btford | [
"Credit",
"goes",
"to"
] | 1d3101e00cf396e1de436a26c6834f9b48529804 | https://github.com/PatrickJS/angular-websocket/blob/1d3101e00cf396e1de436a26c6834f9b48529804/src/angular-websocket.js#L286-L294 |
12,874 | QuantumMechanics/NEM-sdk | src/crypto/cryptoHelpers.js | function(common, walletAccount, algo) {
// Errors
if(!common || !walletAccount || !algo) throw new Error('Missing argument !');
let r = undefined;
if (algo === "trezor") { // HW wallet
r = { 'priv': '' };
common.isHW = true;
} else if (!common.password) {
throw new Error('M... | javascript | function(common, walletAccount, algo) {
// Errors
if(!common || !walletAccount || !algo) throw new Error('Missing argument !');
let r = undefined;
if (algo === "trezor") { // HW wallet
r = { 'priv': '' };
common.isHW = true;
} else if (!common.password) {
throw new Error('M... | [
"function",
"(",
"common",
",",
"walletAccount",
",",
"algo",
")",
"{",
"// Errors",
"if",
"(",
"!",
"common",
"||",
"!",
"walletAccount",
"||",
"!",
"algo",
")",
"throw",
"new",
"Error",
"(",
"'Missing argument !'",
")",
";",
"let",
"r",
"=",
"undefined... | Reveal the private key of an account or derive it from the wallet password
@param {object} common- An object containing password and privateKey field
@param {object} walletAccount - A wallet account object
@param {string} algo - A wallet algorithm
@return {object|boolean} - The account private key in and object or fa... | [
"Reveal",
"the",
"private",
"key",
"of",
"an",
"account",
"or",
"derive",
"it",
"from",
"the",
"wallet",
"password"
] | 4b0b60007c52ff4a89deeef84f9ca95b61c92fca | https://github.com/QuantumMechanics/NEM-sdk/blob/4b0b60007c52ff4a89deeef84f9ca95b61c92fca/src/crypto/cryptoHelpers.js#L75-L133 | |
12,875 | QuantumMechanics/NEM-sdk | src/crypto/cryptoHelpers.js | function(priv, network, _expectedAddress) {
// Errors
if (!priv || !network || !_expectedAddress) throw new Error('Missing argument !');
if (!Helpers.isPrivateKeyValid(priv)) throw new Error('Private key is not valid !');
//Processing
let expectedAddress = _expectedAddress.toUpperCase().replace(/-/g... | javascript | function(priv, network, _expectedAddress) {
// Errors
if (!priv || !network || !_expectedAddress) throw new Error('Missing argument !');
if (!Helpers.isPrivateKeyValid(priv)) throw new Error('Private key is not valid !');
//Processing
let expectedAddress = _expectedAddress.toUpperCase().replace(/-/g... | [
"function",
"(",
"priv",
",",
"network",
",",
"_expectedAddress",
")",
"{",
"// Errors",
"if",
"(",
"!",
"priv",
"||",
"!",
"network",
"||",
"!",
"_expectedAddress",
")",
"throw",
"new",
"Error",
"(",
"'Missing argument !'",
")",
";",
"if",
"(",
"!",
"He... | Check if a private key correspond to an account address
@param {string} priv - An account private key
@param {number} network - A network id
@param {string} _expectedAddress - The expected NEM address
@return {boolean} - True if valid, false otherwise | [
"Check",
"if",
"a",
"private",
"key",
"correspond",
"to",
"an",
"account",
"address"
] | 4b0b60007c52ff4a89deeef84f9ca95b61c92fca | https://github.com/QuantumMechanics/NEM-sdk/blob/4b0b60007c52ff4a89deeef84f9ca95b61c92fca/src/crypto/cryptoHelpers.js#L144-L154 | |
12,876 | QuantumMechanics/NEM-sdk | src/crypto/cryptoHelpers.js | function(data, key) {
// Errors
if (!data || !key) throw new Error('Missing argument !');
// Processing
let iv = nacl.randomBytes(16)
let encKey = convert.ua2words(key, 32);
let encIv = {
iv: convert.ua2words(iv, 16)
};
let encrypted = CryptoJS.AES.encrypt(CryptoJS.enc.Hex.parse(... | javascript | function(data, key) {
// Errors
if (!data || !key) throw new Error('Missing argument !');
// Processing
let iv = nacl.randomBytes(16)
let encKey = convert.ua2words(key, 32);
let encIv = {
iv: convert.ua2words(iv, 16)
};
let encrypted = CryptoJS.AES.encrypt(CryptoJS.enc.Hex.parse(... | [
"function",
"(",
"data",
",",
"key",
")",
"{",
"// Errors",
"if",
"(",
"!",
"data",
"||",
"!",
"key",
")",
"throw",
"new",
"Error",
"(",
"'Missing argument !'",
")",
";",
"// Processing",
"let",
"iv",
"=",
"nacl",
".",
"randomBytes",
"(",
"16",
")",
... | Encrypt hex data using a key
@param {string} data - An hex string
@param {Uint8Array} key - An Uint8Array key
@return {object} - The encrypted data | [
"Encrypt",
"hex",
"data",
"using",
"a",
"key"
] | 4b0b60007c52ff4a89deeef84f9ca95b61c92fca | https://github.com/QuantumMechanics/NEM-sdk/blob/4b0b60007c52ff4a89deeef84f9ca95b61c92fca/src/crypto/cryptoHelpers.js#L193-L209 | |
12,877 | QuantumMechanics/NEM-sdk | src/crypto/cryptoHelpers.js | function(privateKey, password) {
// Errors
if (!privateKey || !password) throw new Error('Missing argument !');
if (!Helpers.isPrivateKeyValid(privateKey)) throw new Error('Private key is not valid !');
// Processing
let pass = derivePassSha(password, 20);
let r = encrypt(privateKey, convert.hex... | javascript | function(privateKey, password) {
// Errors
if (!privateKey || !password) throw new Error('Missing argument !');
if (!Helpers.isPrivateKeyValid(privateKey)) throw new Error('Private key is not valid !');
// Processing
let pass = derivePassSha(password, 20);
let r = encrypt(privateKey, convert.hex... | [
"function",
"(",
"privateKey",
",",
"password",
")",
"{",
"// Errors",
"if",
"(",
"!",
"privateKey",
"||",
"!",
"password",
")",
"throw",
"new",
"Error",
"(",
"'Missing argument !'",
")",
";",
"if",
"(",
"!",
"Helpers",
".",
"isPrivateKeyValid",
"(",
"priv... | Encode a private key using a password
@param {string} privateKey - An hex private key
@param {string} password - A password
@return {object} - The encoded data | [
"Encode",
"a",
"private",
"key",
"using",
"a",
"password"
] | 4b0b60007c52ff4a89deeef84f9ca95b61c92fca | https://github.com/QuantumMechanics/NEM-sdk/blob/4b0b60007c52ff4a89deeef84f9ca95b61c92fca/src/crypto/cryptoHelpers.js#L238-L250 | |
12,878 | QuantumMechanics/NEM-sdk | src/crypto/cryptoHelpers.js | function(senderPriv, recipientPub, msg) {
// Errors
if (!senderPriv || !recipientPub || !msg) throw new Error('Missing argument !');
if (!Helpers.isPrivateKeyValid(senderPriv)) throw new Error('Private key is not valid !');
if (!Helpers.isPublicKeyValid(recipientPub)) throw new Error('Public key is not ... | javascript | function(senderPriv, recipientPub, msg) {
// Errors
if (!senderPriv || !recipientPub || !msg) throw new Error('Missing argument !');
if (!Helpers.isPrivateKeyValid(senderPriv)) throw new Error('Private key is not valid !');
if (!Helpers.isPublicKeyValid(recipientPub)) throw new Error('Public key is not ... | [
"function",
"(",
"senderPriv",
",",
"recipientPub",
",",
"msg",
")",
"{",
"// Errors",
"if",
"(",
"!",
"senderPriv",
"||",
"!",
"recipientPub",
"||",
"!",
"msg",
")",
"throw",
"new",
"Error",
"(",
"'Missing argument !'",
")",
";",
"if",
"(",
"!",
"Helper... | Encode a message
@param {string} senderPriv - A sender private key
@param {string} recipientPub - A recipient public key
@param {string} msg - A text message
@return {string} - The encoded message | [
"Encode",
"a",
"message"
] | 4b0b60007c52ff4a89deeef84f9ca95b61c92fca | https://github.com/QuantumMechanics/NEM-sdk/blob/4b0b60007c52ff4a89deeef84f9ca95b61c92fca/src/crypto/cryptoHelpers.js#L292-L304 | |
12,879 | QuantumMechanics/NEM-sdk | src/crypto/cryptoHelpers.js | function(recipientPrivate, senderPublic, _payload) {
// Errors
if(!recipientPrivate || !senderPublic || !_payload) throw new Error('Missing argument !');
if (!Helpers.isPrivateKeyValid(recipientPrivate)) throw new Error('Private key is not valid !');
if (!Helpers.isPublicKeyValid(senderPublic)) throw ne... | javascript | function(recipientPrivate, senderPublic, _payload) {
// Errors
if(!recipientPrivate || !senderPublic || !_payload) throw new Error('Missing argument !');
if (!Helpers.isPrivateKeyValid(recipientPrivate)) throw new Error('Private key is not valid !');
if (!Helpers.isPublicKeyValid(senderPublic)) throw ne... | [
"function",
"(",
"recipientPrivate",
",",
"senderPublic",
",",
"_payload",
")",
"{",
"// Errors",
"if",
"(",
"!",
"recipientPrivate",
"||",
"!",
"senderPublic",
"||",
"!",
"_payload",
")",
"throw",
"new",
"Error",
"(",
"'Missing argument !'",
")",
";",
"if",
... | Decode an encrypted message payload
@param {string} recipientPrivate - A recipient private key
@param {string} senderPublic - A sender public key
@param {string} _payload - An encrypted message payload
@return {string} - The decoded payload as hex | [
"Decode",
"an",
"encrypted",
"message",
"payload"
] | 4b0b60007c52ff4a89deeef84f9ca95b61c92fca | https://github.com/QuantumMechanics/NEM-sdk/blob/4b0b60007c52ff4a89deeef84f9ca95b61c92fca/src/crypto/cryptoHelpers.js#L315-L340 | |
12,880 | QuantumMechanics/NEM-sdk | examples/browser/transfer/script.js | updateFee | function updateFee() {
// Check for amount errors
if(undefined === $("#amount").val() || !nem.utils.helpers.isTextAmountValid($("#amount").val())) return alert('Invalid amount !');
// Set the cleaned amount into transfer transaction object
transferTransaction.amount = nem.utils.helpers.cleanTextAmount($("#amou... | javascript | function updateFee() {
// Check for amount errors
if(undefined === $("#amount").val() || !nem.utils.helpers.isTextAmountValid($("#amount").val())) return alert('Invalid amount !');
// Set the cleaned amount into transfer transaction object
transferTransaction.amount = nem.utils.helpers.cleanTextAmount($("#amou... | [
"function",
"updateFee",
"(",
")",
"{",
"// Check for amount errors",
"if",
"(",
"undefined",
"===",
"$",
"(",
"\"#amount\"",
")",
".",
"val",
"(",
")",
"||",
"!",
"nem",
".",
"utils",
".",
"helpers",
".",
"isTextAmountValid",
"(",
"$",
"(",
"\"#amount\"",... | Function to update our fee in the view | [
"Function",
"to",
"update",
"our",
"fee",
"in",
"the",
"view"
] | 4b0b60007c52ff4a89deeef84f9ca95b61c92fca | https://github.com/QuantumMechanics/NEM-sdk/blob/4b0b60007c52ff4a89deeef84f9ca95b61c92fca/examples/browser/transfer/script.js#L21-L39 |
12,881 | QuantumMechanics/NEM-sdk | examples/browser/transfer/script.js | send | function send() {
// Check form for errors
if(!$("#privateKey").val() || !$("#recipient").val()) return alert('Missing parameter !');
if(undefined === $("#amount").val() || !nem.utils.helpers.isTextAmountValid($("#amount").val())) return alert('Invalid amount !');
if (!nem.model.address.isValid(nem.model.addres... | javascript | function send() {
// Check form for errors
if(!$("#privateKey").val() || !$("#recipient").val()) return alert('Missing parameter !');
if(undefined === $("#amount").val() || !nem.utils.helpers.isTextAmountValid($("#amount").val())) return alert('Invalid amount !');
if (!nem.model.address.isValid(nem.model.addres... | [
"function",
"send",
"(",
")",
"{",
"// Check form for errors",
"if",
"(",
"!",
"$",
"(",
"\"#privateKey\"",
")",
".",
"val",
"(",
")",
"||",
"!",
"$",
"(",
"\"#recipient\"",
")",
".",
"val",
"(",
")",
")",
"return",
"alert",
"(",
"'Missing parameter !'",... | Build transaction from form data and send | [
"Build",
"transaction",
"from",
"form",
"data",
"and",
"send"
] | 4b0b60007c52ff4a89deeef84f9ca95b61c92fca | https://github.com/QuantumMechanics/NEM-sdk/blob/4b0b60007c52ff4a89deeef84f9ca95b61c92fca/examples/browser/transfer/script.js#L44-L80 |
12,882 | QuantumMechanics/NEM-sdk | examples/browser/offlineTransaction/create/script.js | create | function create() {
// Check form for errors
if(!$("#privateKey").val() || !$("#recipient").val()) return alert('Missing parameter !');
if(undefined === $("#amount").val() || !nem.utils.helpers.isTextAmountValid($("#amount").val())) return alert('Invalid amount !');
if (!nem.model.address.isValid(nem.model.addr... | javascript | function create() {
// Check form for errors
if(!$("#privateKey").val() || !$("#recipient").val()) return alert('Missing parameter !');
if(undefined === $("#amount").val() || !nem.utils.helpers.isTextAmountValid($("#amount").val())) return alert('Invalid amount !');
if (!nem.model.address.isValid(nem.model.addr... | [
"function",
"create",
"(",
")",
"{",
"// Check form for errors",
"if",
"(",
"!",
"$",
"(",
"\"#privateKey\"",
")",
".",
"val",
"(",
")",
"||",
"!",
"$",
"(",
"\"#recipient\"",
")",
".",
"val",
"(",
")",
")",
"return",
"alert",
"(",
"'Missing parameter !'... | Build transaction from form data | [
"Build",
"transaction",
"from",
"form",
"data"
] | 4b0b60007c52ff4a89deeef84f9ca95b61c92fca | https://github.com/QuantumMechanics/NEM-sdk/blob/4b0b60007c52ff4a89deeef84f9ca95b61c92fca/examples/browser/offlineTransaction/create/script.js#L41-L83 |
12,883 | QuantumMechanics/NEM-sdk | examples/browser/monitor/script.js | showTransactions | function showTransactions(height) {
// Set the block height in modal title
$('#txsHeight').html(height);
// Get the transactions for that block
var txs = transactions[height];
// Reset the modal body
$('#txs').html('');
// Loop transactions
for(var i = 0; i < txs.length; i++) {
// Add stringified transaction ... | javascript | function showTransactions(height) {
// Set the block height in modal title
$('#txsHeight').html(height);
// Get the transactions for that block
var txs = transactions[height];
// Reset the modal body
$('#txs').html('');
// Loop transactions
for(var i = 0; i < txs.length; i++) {
// Add stringified transaction ... | [
"function",
"showTransactions",
"(",
"height",
")",
"{",
"// Set the block height in modal title",
"$",
"(",
"'#txsHeight'",
")",
".",
"html",
"(",
"height",
")",
";",
"// Get the transactions for that block",
"var",
"txs",
"=",
"transactions",
"[",
"height",
"]",
"... | Function to open modal and set transaction data into it | [
"Function",
"to",
"open",
"modal",
"and",
"set",
"transaction",
"data",
"into",
"it"
] | 4b0b60007c52ff4a89deeef84f9ca95b61c92fca | https://github.com/QuantumMechanics/NEM-sdk/blob/4b0b60007c52ff4a89deeef84f9ca95b61c92fca/examples/browser/monitor/script.js#L59-L73 |
12,884 | angular-ui/ui-sortable | src/sortable.js | isFloating | function isFloating(item) {
return (
/left|right/.test(item.css('float')) ||
/inline|table-cell/.test(item.css('display'))
);
} | javascript | function isFloating(item) {
return (
/left|right/.test(item.css('float')) ||
/inline|table-cell/.test(item.css('display'))
);
} | [
"function",
"isFloating",
"(",
"item",
")",
"{",
"return",
"(",
"/",
"left|right",
"/",
".",
"test",
"(",
"item",
".",
"css",
"(",
"'float'",
")",
")",
"||",
"/",
"inline|table-cell",
"/",
".",
"test",
"(",
"item",
".",
"css",
"(",
"'display'",
")",
... | thanks jquery-ui | [
"thanks",
"jquery",
"-",
"ui"
] | e763b5765eea87743c8463ddf045a53015193c20 | https://github.com/angular-ui/ui-sortable/blob/e763b5765eea87743c8463ddf045a53015193c20/src/sortable.js#L268-L273 |
12,885 | angular-ui/ui-sortable | demo/demo.js | function(e, ui) {
var logEntry = {
ID: $scope.sortingLog.length + 1,
Text: 'Moved element: ' + ui.item.scope().item.text
};
$scope.sortingLog.push(logEntry);
} | javascript | function(e, ui) {
var logEntry = {
ID: $scope.sortingLog.length + 1,
Text: 'Moved element: ' + ui.item.scope().item.text
};
$scope.sortingLog.push(logEntry);
} | [
"function",
"(",
"e",
",",
"ui",
")",
"{",
"var",
"logEntry",
"=",
"{",
"ID",
":",
"$scope",
".",
"sortingLog",
".",
"length",
"+",
"1",
",",
"Text",
":",
"'Moved element: '",
"+",
"ui",
".",
"item",
".",
"scope",
"(",
")",
".",
"item",
".",
"tex... | called after a node is dropped | [
"called",
"after",
"a",
"node",
"is",
"dropped"
] | e763b5765eea87743c8463ddf045a53015193c20 | https://github.com/angular-ui/ui-sortable/blob/e763b5765eea87743c8463ddf045a53015193c20/demo/demo.js#L25-L31 | |
12,886 | angular-ui/ui-sortable | gruntFile.js | fakeTargetTask | function fakeTargetTask(prefix){
return function(){
if (this.args.length !== 1) {
return grunt.log.fail('Just give the name of the ' + prefix + ' you want like :\ngrunt ' + prefix + ':bower');
}
var done = this.async();
var spawn = require('child_process').spawn;
spawn('./nod... | javascript | function fakeTargetTask(prefix){
return function(){
if (this.args.length !== 1) {
return grunt.log.fail('Just give the name of the ' + prefix + ' you want like :\ngrunt ' + prefix + ':bower');
}
var done = this.async();
var spawn = require('child_process').spawn;
spawn('./nod... | [
"function",
"fakeTargetTask",
"(",
"prefix",
")",
"{",
"return",
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"args",
".",
"length",
"!==",
"1",
")",
"{",
"return",
"grunt",
".",
"log",
".",
"fail",
"(",
"'Just give the name of the '",
"+",
"prefix... | HACK TO ACCESS TO THE COMPONENT PUBLISHER | [
"HACK",
"TO",
"ACCESS",
"TO",
"THE",
"COMPONENT",
"PUBLISHER"
] | e763b5765eea87743c8463ddf045a53015193c20 | https://github.com/angular-ui/ui-sortable/blob/e763b5765eea87743c8463ddf045a53015193c20/gruntFile.js#L19-L33 |
12,887 | angular-ui/ui-sortable | gruntFile.js | function(configFile, customOptions) {
var options = { configFile: configFile, singleRun: true };
var travisOptions = process.env.TRAVIS && {
browsers: ['Chrome', 'Firefox'],
reporters: ['dots', 'coverage', 'coveralls'],
preprocessors: { 'src/*.js': ['coverage'] },
coverageReporter: {
... | javascript | function(configFile, customOptions) {
var options = { configFile: configFile, singleRun: true };
var travisOptions = process.env.TRAVIS && {
browsers: ['Chrome', 'Firefox'],
reporters: ['dots', 'coverage', 'coveralls'],
preprocessors: { 'src/*.js': ['coverage'] },
coverageReporter: {
... | [
"function",
"(",
"configFile",
",",
"customOptions",
")",
"{",
"var",
"options",
"=",
"{",
"configFile",
":",
"configFile",
",",
"singleRun",
":",
"true",
"}",
";",
"var",
"travisOptions",
"=",
"process",
".",
"env",
".",
"TRAVIS",
"&&",
"{",
"browsers",
... | HACK TO MAKE TRAVIS WORK | [
"HACK",
"TO",
"MAKE",
"TRAVIS",
"WORK"
] | e763b5765eea87743c8463ddf045a53015193c20 | https://github.com/angular-ui/ui-sortable/blob/e763b5765eea87743c8463ddf045a53015193c20/gruntFile.js#L41-L57 | |
12,888 | jeremyfa/yaml.js | dist/yaml.legacy.js | function(message, parsedLine, snippet, parsedFile){
this.rawMessage = message;
this.parsedLine = (parsedLine !== undefined) ? parsedLine : -1;
this.snippet = (snippet !== undefined) ? snippet : null;
this.parsedFile = (parsedFile !== undefined) ? parsedFile : null;
this.updateRepr();
this.message = mes... | javascript | function(message, parsedLine, snippet, parsedFile){
this.rawMessage = message;
this.parsedLine = (parsedLine !== undefined) ? parsedLine : -1;
this.snippet = (snippet !== undefined) ? snippet : null;
this.parsedFile = (parsedFile !== undefined) ? parsedFile : null;
this.updateRepr();
this.message = mes... | [
"function",
"(",
"message",
",",
"parsedLine",
",",
"snippet",
",",
"parsedFile",
")",
"{",
"this",
".",
"rawMessage",
"=",
"message",
";",
"this",
".",
"parsedLine",
"=",
"(",
"parsedLine",
"!==",
"undefined",
")",
"?",
"parsedLine",
":",
"-",
"1",
";",... | Exception class thrown when an error occurs during parsing.
@author Fabien Potencier <[email protected]>
@api
Constructor.
@param string message The error message
@param integer parsedLine The line where the error occurred
@param integer snippet The snippet of code near the problem
@param string parsedFile Th... | [
"Exception",
"class",
"thrown",
"when",
"an",
"error",
"occurs",
"during",
"parsing",
"."
] | 0b53177b26dfe0c2081465e3a496c9b4cb5b1c63 | https://github.com/jeremyfa/yaml.js/blob/0b53177b26dfe0c2081465e3a496c9b4cb5b1c63/dist/yaml.legacy.js#L40-L51 | |
12,889 | jeremyfa/yaml.js | dist/yaml.legacy.js | function(file /* String */, callback /* Function */)
{
if ( callback == null )
{
var input = this.getFileContents(file);
var ret = null;
try
{
ret = this.parse(input);
}
catch ( e )
{
if ( e instanceof YamlParseException ) {
e.setParsedFile(file);
}
throw e;
}
return... | javascript | function(file /* String */, callback /* Function */)
{
if ( callback == null )
{
var input = this.getFileContents(file);
var ret = null;
try
{
ret = this.parse(input);
}
catch ( e )
{
if ( e instanceof YamlParseException ) {
e.setParsedFile(file);
}
throw e;
}
return... | [
"function",
"(",
"file",
"/* String */",
",",
"callback",
"/* Function */",
")",
"{",
"if",
"(",
"callback",
"==",
"null",
")",
"{",
"var",
"input",
"=",
"this",
".",
"getFileContents",
"(",
"file",
")",
";",
"var",
"ret",
"=",
"null",
";",
"try",
"{",... | Parses YAML into a JS representation.
The parse method, when supplied with a YAML stream (file),
will do its best to convert YAML in a file into a JS representation.
Usage:
<code>
obj = yaml.parseFile('config.yml');
</code>
@param string input Path of YAML file
@return array The YAML converted to a JS representatio... | [
"Parses",
"YAML",
"into",
"a",
"JS",
"representation",
"."
] | 0b53177b26dfe0c2081465e3a496c9b4cb5b1c63 | https://github.com/jeremyfa/yaml.js/blob/0b53177b26dfe0c2081465e3a496c9b4cb5b1c63/dist/yaml.legacy.js#L193-L217 | |
12,890 | jeremyfa/yaml.js | dist/yaml.legacy.js | function(array, inline, spaces)
{
if ( inline == null ) inline = 2;
var yaml = new YamlDumper();
if (spaces) {
yaml.numSpacesForIndentation = spaces;
}
return yaml.dump(array, inline);
} | javascript | function(array, inline, spaces)
{
if ( inline == null ) inline = 2;
var yaml = new YamlDumper();
if (spaces) {
yaml.numSpacesForIndentation = spaces;
}
return yaml.dump(array, inline);
} | [
"function",
"(",
"array",
",",
"inline",
",",
"spaces",
")",
"{",
"if",
"(",
"inline",
"==",
"null",
")",
"inline",
"=",
"2",
";",
"var",
"yaml",
"=",
"new",
"YamlDumper",
"(",
")",
";",
"if",
"(",
"spaces",
")",
"{",
"yaml",
".",
"numSpacesForInde... | Dumps a JS representation to a YAML string.
The dump method, when supplied with an array, will do its best
to convert the array into friendly YAML.
@param array array JS representation
@param integer inline The level where you switch to inline YAML
@return string A YAML string representing the original JS represent... | [
"Dumps",
"a",
"JS",
"representation",
"to",
"a",
"YAML",
"string",
"."
] | 0b53177b26dfe0c2081465e3a496c9b4cb5b1c63 | https://github.com/jeremyfa/yaml.js/blob/0b53177b26dfe0c2081465e3a496c9b4cb5b1c63/dist/yaml.legacy.js#L256-L266 | |
12,891 | jeremyfa/yaml.js | dist/yaml.legacy.js | function(value)
{
var result = null;
value = this.trim(value);
if ( 0 == value.length )
{
return '';
}
switch ( value.charAt(0) )
{
case '[':
result = this.parseSequence(value);
break;
case '{':
result = this.parseMapping(value);
break;
default:
result = this.parseScalar... | javascript | function(value)
{
var result = null;
value = this.trim(value);
if ( 0 == value.length )
{
return '';
}
switch ( value.charAt(0) )
{
case '[':
result = this.parseSequence(value);
break;
case '{':
result = this.parseMapping(value);
break;
default:
result = this.parseScalar... | [
"function",
"(",
"value",
")",
"{",
"var",
"result",
"=",
"null",
";",
"value",
"=",
"this",
".",
"trim",
"(",
"value",
")",
";",
"if",
"(",
"0",
"==",
"value",
".",
"length",
")",
"{",
"return",
"''",
";",
"}",
"switch",
"(",
"value",
".",
"ch... | Convert a YAML string to a JS object.
@param string value A YAML string
@return object A JS object representing the YAML string | [
"Convert",
"a",
"YAML",
"string",
"to",
"a",
"JS",
"object",
"."
] | 0b53177b26dfe0c2081465e3a496c9b4cb5b1c63 | https://github.com/jeremyfa/yaml.js/blob/0b53177b26dfe0c2081465e3a496c9b4cb5b1c63/dist/yaml.legacy.js#L410-L439 | |
12,892 | jeremyfa/yaml.js | dist/yaml.legacy.js | function(value)
{
if ( undefined == value || null == value )
return 'null';
if ( value instanceof Date)
return value.toISOString();
if ( typeof(value) == 'object')
return this.dumpObject(value);
if ( typeof(value) == 'boolean' )
return value ? 'true' : 'false';
if ( /^\d+$/.test(value) )
retu... | javascript | function(value)
{
if ( undefined == value || null == value )
return 'null';
if ( value instanceof Date)
return value.toISOString();
if ( typeof(value) == 'object')
return this.dumpObject(value);
if ( typeof(value) == 'boolean' )
return value ? 'true' : 'false';
if ( /^\d+$/.test(value) )
retu... | [
"function",
"(",
"value",
")",
"{",
"if",
"(",
"undefined",
"==",
"value",
"||",
"null",
"==",
"value",
")",
"return",
"'null'",
";",
"if",
"(",
"value",
"instanceof",
"Date",
")",
"return",
"value",
".",
"toISOString",
"(",
")",
";",
"if",
"(",
"typ... | Dumps a given JS variable to a YAML string.
@param mixed value The JS variable to convert
@return string The YAML string representing the JS object | [
"Dumps",
"a",
"given",
"JS",
"variable",
"to",
"a",
"YAML",
"string",
"."
] | 0b53177b26dfe0c2081465e3a496c9b4cb5b1c63 | https://github.com/jeremyfa/yaml.js/blob/0b53177b26dfe0c2081465e3a496c9b4cb5b1c63/dist/yaml.legacy.js#L448-L477 | |
12,893 | jeremyfa/yaml.js | dist/yaml.legacy.js | function(value)
{
var keys = this.getKeys(value);
var output = null;
var i;
var len = keys.length;
// array
if ( value instanceof Array )
/*( 1 == len && '0' == keys[0] )
||
( len > 1 && this.reduceArray(keys, function(v,w){return Math.floor(v+w);}, 0) == len * (len - 1) / 2) )*/
{
output = ... | javascript | function(value)
{
var keys = this.getKeys(value);
var output = null;
var i;
var len = keys.length;
// array
if ( value instanceof Array )
/*( 1 == len && '0' == keys[0] )
||
( len > 1 && this.reduceArray(keys, function(v,w){return Math.floor(v+w);}, 0) == len * (len - 1) / 2) )*/
{
output = ... | [
"function",
"(",
"value",
")",
"{",
"var",
"keys",
"=",
"this",
".",
"getKeys",
"(",
"value",
")",
";",
"var",
"output",
"=",
"null",
";",
"var",
"i",
";",
"var",
"len",
"=",
"keys",
".",
"length",
";",
"// array",
"if",
"(",
"value",
"instanceof",... | Dumps a JS object to a YAML string.
@param object value The JS array to dump
@return string The YAML string representing the JS object | [
"Dumps",
"a",
"JS",
"object",
"to",
"a",
"YAML",
"string",
"."
] | 0b53177b26dfe0c2081465e3a496c9b4cb5b1c63 | https://github.com/jeremyfa/yaml.js/blob/0b53177b26dfe0c2081465e3a496c9b4cb5b1c63/dist/yaml.legacy.js#L486-L516 | |
12,894 | jeremyfa/yaml.js | dist/yaml.legacy.js | function(scalar, delimiters, stringDelimiters, i, evaluate)
{
if ( delimiters == undefined ) delimiters = null;
if ( stringDelimiters == undefined ) stringDelimiters = ['"', "'"];
if ( i == undefined ) i = 0;
if ( evaluate == undefined ) evaluate = true;
var output = null;
var pos = null;
var matches ... | javascript | function(scalar, delimiters, stringDelimiters, i, evaluate)
{
if ( delimiters == undefined ) delimiters = null;
if ( stringDelimiters == undefined ) stringDelimiters = ['"', "'"];
if ( i == undefined ) i = 0;
if ( evaluate == undefined ) evaluate = true;
var output = null;
var pos = null;
var matches ... | [
"function",
"(",
"scalar",
",",
"delimiters",
",",
"stringDelimiters",
",",
"i",
",",
"evaluate",
")",
"{",
"if",
"(",
"delimiters",
"==",
"undefined",
")",
"delimiters",
"=",
"null",
";",
"if",
"(",
"stringDelimiters",
"==",
"undefined",
")",
"stringDelimit... | Parses a scalar to a YAML string.
@param scalar scalar
@param string delimiters
@param object stringDelimiters
@param integer i
@param boolean evaluate
@return string A YAML string
@throws YamlParseException When malformed inline YAML string is parsed | [
"Parses",
"a",
"scalar",
"to",
"a",
"YAML",
"string",
"."
] | 0b53177b26dfe0c2081465e3a496c9b4cb5b1c63 | https://github.com/jeremyfa/yaml.js/blob/0b53177b26dfe0c2081465e3a496c9b4cb5b1c63/dist/yaml.legacy.js#L531-L585 | |
12,895 | jeremyfa/yaml.js | dist/yaml.legacy.js | function(scalar, i)
{
var matches = null;
//var item = /^(.*?)['"]\s*(?:[,:]|[}\]]\s*,)/.exec((scalar+'').substring(i))[1];
if ( !(matches = new RegExp('^'+YamlInline.REGEX_QUOTED_STRING).exec((scalar+'').substring(i))) )
{
throw new YamlParseException('Malformed inline YAML string ('+(scalar+'').substri... | javascript | function(scalar, i)
{
var matches = null;
//var item = /^(.*?)['"]\s*(?:[,:]|[}\]]\s*,)/.exec((scalar+'').substring(i))[1];
if ( !(matches = new RegExp('^'+YamlInline.REGEX_QUOTED_STRING).exec((scalar+'').substring(i))) )
{
throw new YamlParseException('Malformed inline YAML string ('+(scalar+'').substri... | [
"function",
"(",
"scalar",
",",
"i",
")",
"{",
"var",
"matches",
"=",
"null",
";",
"//var item = /^(.*?)['\"]\\s*(?:[,:]|[}\\]]\\s*,)/.exec((scalar+'').substring(i))[1];",
"if",
"(",
"!",
"(",
"matches",
"=",
"new",
"RegExp",
"(",
"'^'",
"+",
"YamlInline",
".",
"R... | Parses a quoted scalar to YAML.
@param string scalar
@param integer i
@return string A YAML string
@throws YamlParseException When malformed inline YAML string is parsed | [
"Parses",
"a",
"quoted",
"scalar",
"to",
"YAML",
"."
] | 0b53177b26dfe0c2081465e3a496c9b4cb5b1c63 | https://github.com/jeremyfa/yaml.js/blob/0b53177b26dfe0c2081465e3a496c9b4cb5b1c63/dist/yaml.legacy.js#L597-L624 | |
12,896 | jeremyfa/yaml.js | dist/yaml.legacy.js | function(sequence, i)
{
if ( i == undefined ) i = 0;
var output = [];
var len = sequence.length;
i += 1;
// [foo, bar, ...]
while ( i < len )
{
switch ( sequence.charAt(i) )
{
case '[':
// nested sequence
output.push(this.parseSequence(sequence, i));
i = this.i;
break;
... | javascript | function(sequence, i)
{
if ( i == undefined ) i = 0;
var output = [];
var len = sequence.length;
i += 1;
// [foo, bar, ...]
while ( i < len )
{
switch ( sequence.charAt(i) )
{
case '[':
// nested sequence
output.push(this.parseSequence(sequence, i));
i = this.i;
break;
... | [
"function",
"(",
"sequence",
",",
"i",
")",
"{",
"if",
"(",
"i",
"==",
"undefined",
")",
"i",
"=",
"0",
";",
"var",
"output",
"=",
"[",
"]",
";",
"var",
"len",
"=",
"sequence",
".",
"length",
";",
"i",
"+=",
"1",
";",
"// [foo, bar, ...]",
"while... | Parses a sequence to a YAML string.
@param string sequence
@param integer i
@return string A YAML string
@throws YamlParseException When malformed inline YAML string is parsed | [
"Parses",
"a",
"sequence",
"to",
"a",
"YAML",
"string",
"."
] | 0b53177b26dfe0c2081465e3a496c9b4cb5b1c63 | https://github.com/jeremyfa/yaml.js/blob/0b53177b26dfe0c2081465e3a496c9b4cb5b1c63/dist/yaml.legacy.js#L636-L693 | |
12,897 | jeremyfa/yaml.js | dist/yaml.legacy.js | function(mapping, i)
{
if ( i == undefined ) i = 0;
var output = {};
var len = mapping.length;
i += 1;
var done = false;
var doContinue = false;
// {foo: bar, bar:foo, ...}
while ( i < len )
{
doContinue = false;
switch ( mapping.charAt(i) )
{
case ' ':
case ',':
i++;
... | javascript | function(mapping, i)
{
if ( i == undefined ) i = 0;
var output = {};
var len = mapping.length;
i += 1;
var done = false;
var doContinue = false;
// {foo: bar, bar:foo, ...}
while ( i < len )
{
doContinue = false;
switch ( mapping.charAt(i) )
{
case ' ':
case ',':
i++;
... | [
"function",
"(",
"mapping",
",",
"i",
")",
"{",
"if",
"(",
"i",
"==",
"undefined",
")",
"i",
"=",
"0",
";",
"var",
"output",
"=",
"{",
"}",
";",
"var",
"len",
"=",
"mapping",
".",
"length",
";",
"i",
"+=",
"1",
";",
"var",
"done",
"=",
"false... | Parses a mapping to a YAML string.
@param string mapping
@param integer i
@return string A YAML string
@throws YamlParseException When malformed inline YAML string is parsed | [
"Parses",
"a",
"mapping",
"to",
"a",
"YAML",
"string",
"."
] | 0b53177b26dfe0c2081465e3a496c9b4cb5b1c63 | https://github.com/jeremyfa/yaml.js/blob/0b53177b26dfe0c2081465e3a496c9b4cb5b1c63/dist/yaml.legacy.js#L705-L778 | |
12,898 | jeremyfa/yaml.js | dist/yaml.legacy.js | function(scalar)
{
scalar = this.trim(scalar);
var raw = null;
var cast = null;
if ( ( 'null' == scalar.toLowerCase() ) ||
( '' == scalar ) ||
( '~' == scalar ) )
return null;
if ( (scalar+'').indexOf('!str ') == 0 )
return (''+scalar).substring(5);
if ( (scalar+'').indexOf('! ') == 0 )
... | javascript | function(scalar)
{
scalar = this.trim(scalar);
var raw = null;
var cast = null;
if ( ( 'null' == scalar.toLowerCase() ) ||
( '' == scalar ) ||
( '~' == scalar ) )
return null;
if ( (scalar+'').indexOf('!str ') == 0 )
return (''+scalar).substring(5);
if ( (scalar+'').indexOf('! ') == 0 )
... | [
"function",
"(",
"scalar",
")",
"{",
"scalar",
"=",
"this",
".",
"trim",
"(",
"scalar",
")",
";",
"var",
"raw",
"=",
"null",
";",
"var",
"cast",
"=",
"null",
";",
"if",
"(",
"(",
"'null'",
"==",
"scalar",
".",
"toLowerCase",
"(",
")",
")",
"||",
... | Evaluates scalars and replaces magic values.
@param string scalar
@return string A YAML string | [
"Evaluates",
"scalars",
"and",
"replaces",
"magic",
"values",
"."
] | 0b53177b26dfe0c2081465e3a496c9b4cb5b1c63 | https://github.com/jeremyfa/yaml.js/blob/0b53177b26dfe0c2081465e3a496c9b4cb5b1c63/dist/yaml.legacy.js#L787-L826 | |
12,899 | jeremyfa/yaml.js | dist/yaml.legacy.js | function(value /* String */)
{
this.currentLineNb = -1;
this.currentLine = '';
this.lines = this.cleanup(value).split("\n");
var data = null;
var context = null;
while ( this.moveToNextLine() )
{
if ( this.isCurrentLineEmpty() )
{
continue;
}
// tab?
if ( this.curre... | javascript | function(value /* String */)
{
this.currentLineNb = -1;
this.currentLine = '';
this.lines = this.cleanup(value).split("\n");
var data = null;
var context = null;
while ( this.moveToNextLine() )
{
if ( this.isCurrentLineEmpty() )
{
continue;
}
// tab?
if ( this.curre... | [
"function",
"(",
"value",
"/* String */",
")",
"{",
"this",
".",
"currentLineNb",
"=",
"-",
"1",
";",
"this",
".",
"currentLine",
"=",
"''",
";",
"this",
".",
"lines",
"=",
"this",
".",
"cleanup",
"(",
"value",
")",
".",
"split",
"(",
"\"\\n\"",
")",... | Parses a YAML string to a JS value.
@param String value A YAML string
@return mixed A JS value | [
"Parses",
"a",
"YAML",
"string",
"to",
"a",
"JS",
"value",
"."
] | 0b53177b26dfe0c2081465e3a496c9b4cb5b1c63 | https://github.com/jeremyfa/yaml.js/blob/0b53177b26dfe0c2081465e3a496c9b4cb5b1c63/dist/yaml.legacy.js#L976-L1239 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.