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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
jossmac/react-images | examples/dist/common.js | function (name, value) {
if (DOMProperty.isReservedProp(name)) {
return false;
}
if ((name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) {
return false;
}
if (value === null) {
return true;
}
switch (typeof value) {
case 'boolean':
re... | javascript | function (name, value) {
if (DOMProperty.isReservedProp(name)) {
return false;
}
if ((name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) {
return false;
}
if (value === null) {
return true;
}
switch (typeof value) {
case 'boolean':
re... | [
"function",
"(",
"name",
",",
"value",
")",
"{",
"if",
"(",
"DOMProperty",
".",
"isReservedProp",
"(",
"name",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"(",
"name",
"[",
"0",
"]",
"===",
"'o'",
"||",
"name",
"[",
"0",
"]",
"===",
... | Checks whether a property name is a writeable attribute.
@method | [
"Checks",
"whether",
"a",
"property",
"name",
"is",
"a",
"writeable",
"attribute",
"."
] | c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3 | https://github.com/jossmac/react-images/blob/c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3/examples/dist/common.js#L4383-L4405 | train | |
jossmac/react-images | examples/dist/common.js | getTopLevelCallbackBookKeeping | function getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst) {
if (callbackBookkeepingPool.length) {
var instance = callbackBookkeepingPool.pop();
instance.topLevelType = topLevelType;
instance.nativeEvent = nativeEvent;
instance.targetInst = targetInst;
return instance;
}
re... | javascript | function getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst) {
if (callbackBookkeepingPool.length) {
var instance = callbackBookkeepingPool.pop();
instance.topLevelType = topLevelType;
instance.nativeEvent = nativeEvent;
instance.targetInst = targetInst;
return instance;
}
re... | [
"function",
"getTopLevelCallbackBookKeeping",
"(",
"topLevelType",
",",
"nativeEvent",
",",
"targetInst",
")",
"{",
"if",
"(",
"callbackBookkeepingPool",
".",
"length",
")",
"{",
"var",
"instance",
"=",
"callbackBookkeepingPool",
".",
"pop",
"(",
")",
";",
"instan... | Used to store ancestor hierarchy in top level callback | [
"Used",
"to",
"store",
"ancestor",
"hierarchy",
"in",
"top",
"level",
"callback"
] | c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3 | https://github.com/jossmac/react-images/blob/c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3/examples/dist/common.js#L5691-L5705 | train |
jossmac/react-images | examples/dist/common.js | getVendorPrefixedEventName | function getVendorPrefixedEventName(eventName) {
if (prefixedEventNames[eventName]) {
return prefixedEventNames[eventName];
} else if (!vendorPrefixes[eventName]) {
return eventName;
}
var prefixMap = vendorPrefixes[eventName];
for (var styleProp in prefixMap) {
if (prefixMap.hasOwnProperty(styl... | javascript | function getVendorPrefixedEventName(eventName) {
if (prefixedEventNames[eventName]) {
return prefixedEventNames[eventName];
} else if (!vendorPrefixes[eventName]) {
return eventName;
}
var prefixMap = vendorPrefixes[eventName];
for (var styleProp in prefixMap) {
if (prefixMap.hasOwnProperty(styl... | [
"function",
"getVendorPrefixedEventName",
"(",
"eventName",
")",
"{",
"if",
"(",
"prefixedEventNames",
"[",
"eventName",
"]",
")",
"{",
"return",
"prefixedEventNames",
"[",
"eventName",
"]",
";",
"}",
"else",
"if",
"(",
"!",
"vendorPrefixes",
"[",
"eventName",
... | Attempts to determine the correct vendor prefixed event name.
@param {string} eventName
@returns {string} | [
"Attempts",
"to",
"determine",
"the",
"correct",
"vendor",
"prefixed",
"event",
"name",
"."
] | c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3 | https://github.com/jossmac/react-images/blob/c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3/examples/dist/common.js#L6220-L6236 | train |
jossmac/react-images | examples/dist/common.js | function (styles) {
{
var serialized = '';
var delimiter = '';
for (var styleName in styles) {
if (!styles.hasOwnProperty(styleName)) {
continue;
}
var styleValue = styles[styleName];
if (styleValue != null) {
var isCustomProperty = styleName.ind... | javascript | function (styles) {
{
var serialized = '';
var delimiter = '';
for (var styleName in styles) {
if (!styles.hasOwnProperty(styleName)) {
continue;
}
var styleValue = styles[styleName];
if (styleValue != null) {
var isCustomProperty = styleName.ind... | [
"function",
"(",
"styles",
")",
"{",
"{",
"var",
"serialized",
"=",
"''",
";",
"var",
"delimiter",
"=",
"''",
";",
"for",
"(",
"var",
"styleName",
"in",
"styles",
")",
"{",
"if",
"(",
"!",
"styles",
".",
"hasOwnProperty",
"(",
"styleName",
")",
")",
... | This creates a string that is expected to be equivalent to the style
attribute generated by server-side rendering. It by-passes warnings and
security checks so it's not safe to use this value for anything other than
comparison. It is only used in DEV for SSR validation. | [
"This",
"creates",
"a",
"string",
"that",
"is",
"expected",
"to",
"be",
"equivalent",
"to",
"the",
"style",
"attribute",
"generated",
"by",
"server",
"-",
"side",
"rendering",
".",
"It",
"by",
"-",
"passes",
"warnings",
"and",
"security",
"checks",
"so",
"... | c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3 | https://github.com/jossmac/react-images/blob/c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3/examples/dist/common.js#L6967-L6986 | train | |
jossmac/react-images | examples/dist/common.js | function (node, name, expected) {
{
var propertyInfo = DOMProperty_1.getPropertyInfo(name);
if (propertyInfo) {
var mutationMethod = propertyInfo.mutationMethod;
if (mutationMethod || propertyInfo.mustUseProperty) {
return node[propertyInfo.propertyName];
} else {
... | javascript | function (node, name, expected) {
{
var propertyInfo = DOMProperty_1.getPropertyInfo(name);
if (propertyInfo) {
var mutationMethod = propertyInfo.mutationMethod;
if (mutationMethod || propertyInfo.mustUseProperty) {
return node[propertyInfo.propertyName];
} else {
... | [
"function",
"(",
"node",
",",
"name",
",",
"expected",
")",
"{",
"{",
"var",
"propertyInfo",
"=",
"DOMProperty_1",
".",
"getPropertyInfo",
"(",
"name",
")",
";",
"if",
"(",
"propertyInfo",
")",
"{",
"var",
"mutationMethod",
"=",
"propertyInfo",
".",
"mutat... | Get the value for a property on a node. Only used in DEV for SSR validation.
The "expected" argument is used as a hint of what the expected value is.
Some properties have multiple equivalent values. | [
"Get",
"the",
"value",
"for",
"a",
"property",
"on",
"a",
"node",
".",
"Only",
"used",
"in",
"DEV",
"for",
"SSR",
"validation",
".",
"The",
"expected",
"argument",
"is",
"used",
"as",
"a",
"hint",
"of",
"what",
"the",
"expected",
"value",
"is",
".",
... | c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3 | https://github.com/jossmac/react-images/blob/c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3/examples/dist/common.js#L7505-L7559 | train | |
jossmac/react-images | examples/dist/common.js | function (node, name, expected) {
{
if (!isAttributeNameSafe(name)) {
return;
}
if (!node.hasAttribute(name)) {
return expected === undefined ? undefined : null;
}
var value = node.getAttribute(name);
if (value === '' + expected) {
return expected;
}... | javascript | function (node, name, expected) {
{
if (!isAttributeNameSafe(name)) {
return;
}
if (!node.hasAttribute(name)) {
return expected === undefined ? undefined : null;
}
var value = node.getAttribute(name);
if (value === '' + expected) {
return expected;
}... | [
"function",
"(",
"node",
",",
"name",
",",
"expected",
")",
"{",
"{",
"if",
"(",
"!",
"isAttributeNameSafe",
"(",
"name",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"node",
".",
"hasAttribute",
"(",
"name",
")",
")",
"{",
"return",
"expecte... | Get the value for a attribute on a node. Only used in DEV for SSR validation.
The third argument is used as a hint of what the expected value is. Some
attributes have multiple equivalent values. | [
"Get",
"the",
"value",
"for",
"a",
"attribute",
"on",
"a",
"node",
".",
"Only",
"used",
"in",
"DEV",
"for",
"SSR",
"validation",
".",
"The",
"third",
"argument",
"is",
"used",
"as",
"a",
"hint",
"of",
"what",
"the",
"expected",
"value",
"is",
".",
"S... | c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3 | https://github.com/jossmac/react-images/blob/c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3/examples/dist/common.js#L7566-L7580 | train | |
jossmac/react-images | examples/dist/common.js | function (parent, html) {
if (!testDocument) {
testDocument = document.implementation.createHTMLDocument();
}
var testElement = parent.namespaceURI === HTML_NAMESPACE$1 ? testDocument.createElement(parent.tagName) : testDocument.createElementNS(parent.namespaceURI, parent.tagName);
testElement.inn... | javascript | function (parent, html) {
if (!testDocument) {
testDocument = document.implementation.createHTMLDocument();
}
var testElement = parent.namespaceURI === HTML_NAMESPACE$1 ? testDocument.createElement(parent.tagName) : testDocument.createElementNS(parent.namespaceURI, parent.tagName);
testElement.inn... | [
"function",
"(",
"parent",
",",
"html",
")",
"{",
"if",
"(",
"!",
"testDocument",
")",
"{",
"testDocument",
"=",
"document",
".",
"implementation",
".",
"createHTMLDocument",
"(",
")",
";",
"}",
"var",
"testElement",
"=",
"parent",
".",
"namespaceURI",
"==... | Parse the HTML and read it back to normalize the HTML string so that it can be used for comparison. | [
"Parse",
"the",
"HTML",
"and",
"read",
"it",
"back",
"to",
"normalize",
"the",
"HTML",
"string",
"so",
"that",
"it",
"can",
"be",
"used",
"for",
"comparison",
"."
] | c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3 | https://github.com/jossmac/react-images/blob/c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3/examples/dist/common.js#L9822-L9829 | train | |
jossmac/react-images | examples/dist/common.js | findInsertionPosition | function findInsertionPosition(queue, update) {
var priorityLevel = update.priorityLevel;
var insertAfter = null;
var insertBefore = null;
if (queue.last !== null && comparePriority(queue.last.priorityLevel, priorityLevel) <= 0) {
// Fast path for the common case where the update should be inserted at
/... | javascript | function findInsertionPosition(queue, update) {
var priorityLevel = update.priorityLevel;
var insertAfter = null;
var insertBefore = null;
if (queue.last !== null && comparePriority(queue.last.priorityLevel, priorityLevel) <= 0) {
// Fast path for the common case where the update should be inserted at
/... | [
"function",
"findInsertionPosition",
"(",
"queue",
",",
"update",
")",
"{",
"var",
"priorityLevel",
"=",
"update",
".",
"priorityLevel",
";",
"var",
"insertAfter",
"=",
"null",
";",
"var",
"insertBefore",
"=",
"null",
";",
"if",
"(",
"queue",
".",
"last",
... | Returns the update after which the incoming update should be inserted into the queue, or null if it should be inserted at beginning. | [
"Returns",
"the",
"update",
"after",
"which",
"the",
"incoming",
"update",
"should",
"be",
"inserted",
"into",
"the",
"queue",
"or",
"null",
"if",
"it",
"should",
"be",
"inserted",
"at",
"beginning",
"."
] | c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3 | https://github.com/jossmac/react-images/blob/c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3/examples/dist/common.js#L10873-L10889 | train |
jossmac/react-images | examples/dist/common.js | function (fn) {
!(showDialog === defaultShowDialog) ? invariant(false, 'The custom dialog was already injected.') : void 0;
!(typeof fn === 'function') ? invariant(false, 'Injected showDialog() must be a function.') : void 0;
showDialog = fn;
} | javascript | function (fn) {
!(showDialog === defaultShowDialog) ? invariant(false, 'The custom dialog was already injected.') : void 0;
!(typeof fn === 'function') ? invariant(false, 'Injected showDialog() must be a function.') : void 0;
showDialog = fn;
} | [
"function",
"(",
"fn",
")",
"{",
"!",
"(",
"showDialog",
"===",
"defaultShowDialog",
")",
"?",
"invariant",
"(",
"false",
",",
"'The custom dialog was already injected.'",
")",
":",
"void",
"0",
";",
"!",
"(",
"typeof",
"fn",
"===",
"'function'",
")",
"?",
... | Display custom dialog for lifecycle errors.
Return false to prevent default behavior of logging to console.error. | [
"Display",
"custom",
"dialog",
"for",
"lifecycle",
"errors",
".",
"Return",
"false",
"to",
"prevent",
"default",
"behavior",
"of",
"logging",
"to",
"console",
".",
"error",
"."
] | c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3 | https://github.com/jossmac/react-images/blob/c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3/examples/dist/common.js#L12254-L12258 | train | |
jossmac/react-images | examples/dist/common.js | safelyCallComponentWillUnmount | function safelyCallComponentWillUnmount(current, instance) {
{
invokeGuardedCallback$2(null, callComponentWillUnmountWithTimerInDev, null, current, instance);
if (hasCaughtError$1()) {
var unmountError = clearCaughtError$1();
captureError(current, unmountError);
}
}
} | javascript | function safelyCallComponentWillUnmount(current, instance) {
{
invokeGuardedCallback$2(null, callComponentWillUnmountWithTimerInDev, null, current, instance);
if (hasCaughtError$1()) {
var unmountError = clearCaughtError$1();
captureError(current, unmountError);
}
}
} | [
"function",
"safelyCallComponentWillUnmount",
"(",
"current",
",",
"instance",
")",
"{",
"{",
"invokeGuardedCallback$2",
"(",
"null",
",",
"callComponentWillUnmountWithTimerInDev",
",",
"null",
",",
"current",
",",
"instance",
")",
";",
"if",
"(",
"hasCaughtError$1",
... | Capture errors so they don't interrupt unmounting. | [
"Capture",
"errors",
"so",
"they",
"don",
"t",
"interrupt",
"unmounting",
"."
] | c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3 | https://github.com/jossmac/react-images/blob/c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3/examples/dist/common.js#L15063-L15071 | train |
jossmac/react-images | examples/dist/common.js | resetNextUnitOfWork | function resetNextUnitOfWork() {
// Clear out roots with no more work on them, or if they have uncaught errors
while (nextScheduledRoot !== null && nextScheduledRoot.current.pendingWorkPriority === NoWork$2) {
// Unschedule this root.
nextScheduledRoot.isScheduled = false;
// Read the next poi... | javascript | function resetNextUnitOfWork() {
// Clear out roots with no more work on them, or if they have uncaught errors
while (nextScheduledRoot !== null && nextScheduledRoot.current.pendingWorkPriority === NoWork$2) {
// Unschedule this root.
nextScheduledRoot.isScheduled = false;
// Read the next poi... | [
"function",
"resetNextUnitOfWork",
"(",
")",
"{",
"// Clear out roots with no more work on them, or if they have uncaught errors",
"while",
"(",
"nextScheduledRoot",
"!==",
"null",
"&&",
"nextScheduledRoot",
".",
"current",
".",
"pendingWorkPriority",
"===",
"NoWork$2",
")",
... | resetNextUnitOfWork mutates the current priority context. It is reset after after the workLoop exits, so never call resetNextUnitOfWork from outside the work loop. | [
"resetNextUnitOfWork",
"mutates",
"the",
"current",
"priority",
"context",
".",
"It",
"is",
"reset",
"after",
"after",
"the",
"workLoop",
"exits",
"so",
"never",
"call",
"resetNextUnitOfWork",
"from",
"outside",
"the",
"work",
"loop",
"."
] | c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3 | https://github.com/jossmac/react-images/blob/c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3/examples/dist/common.js#L16097-L16151 | train |
jossmac/react-images | examples/dist/common.js | getSiblingNode | function getSiblingNode(node) {
while (node) {
if (node.nextSibling) {
return node.nextSibling;
}
node = node.parentNode;
}
} | javascript | function getSiblingNode(node) {
while (node) {
if (node.nextSibling) {
return node.nextSibling;
}
node = node.parentNode;
}
} | [
"function",
"getSiblingNode",
"(",
"node",
")",
"{",
"while",
"(",
"node",
")",
"{",
"if",
"(",
"node",
".",
"nextSibling",
")",
"{",
"return",
"node",
".",
"nextSibling",
";",
"}",
"node",
"=",
"node",
".",
"parentNode",
";",
"}",
"}"
] | Get the next sibling within a container. This will walk up the
DOM if a node's siblings have been exhausted.
@param {DOMElement|DOMTextNode} node
@return {?DOMElement|DOMTextNode} | [
"Get",
"the",
"next",
"sibling",
"within",
"a",
"container",
".",
"This",
"will",
"walk",
"up",
"the",
"DOM",
"if",
"a",
"node",
"s",
"siblings",
"have",
"been",
"exhausted",
"."
] | c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3 | https://github.com/jossmac/react-images/blob/c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3/examples/dist/common.js#L17430-L17437 | train |
jossmac/react-images | examples/dist/common.js | getNodeForCharacterOffset | function getNodeForCharacterOffset(root, offset) {
var node = getLeafNode(root);
var nodeStart = 0;
var nodeEnd = 0;
while (node) {
if (node.nodeType === TEXT_NODE$3) {
nodeEnd = nodeStart + node.textContent.length;
if (nodeStart <= offset && nodeEnd >= offset) {
return {
nod... | javascript | function getNodeForCharacterOffset(root, offset) {
var node = getLeafNode(root);
var nodeStart = 0;
var nodeEnd = 0;
while (node) {
if (node.nodeType === TEXT_NODE$3) {
nodeEnd = nodeStart + node.textContent.length;
if (nodeStart <= offset && nodeEnd >= offset) {
return {
nod... | [
"function",
"getNodeForCharacterOffset",
"(",
"root",
",",
"offset",
")",
"{",
"var",
"node",
"=",
"getLeafNode",
"(",
"root",
")",
";",
"var",
"nodeStart",
"=",
"0",
";",
"var",
"nodeEnd",
"=",
"0",
";",
"while",
"(",
"node",
")",
"{",
"if",
"(",
"n... | Get object describing the nodes which contain characters at offset.
@param {DOMElement|DOMTextNode} root
@param {number} offset
@return {?object} | [
"Get",
"object",
"describing",
"the",
"nodes",
"which",
"contain",
"characters",
"at",
"offset",
"."
] | c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3 | https://github.com/jossmac/react-images/blob/c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3/examples/dist/common.js#L17446-L17467 | train |
jossmac/react-images | examples/dist/common.js | traverseEnterLeave | function traverseEnterLeave(from, to, fn, argFrom, argTo) {
var common = from && to ? getLowestCommonAncestor(from, to) : null;
var pathFrom = [];
while (from && from !== common) {
pathFrom.push(from);
from = getParent(from);
}
var pathTo = [];
while (to && to !== common) {
pathTo.push(to);
... | javascript | function traverseEnterLeave(from, to, fn, argFrom, argTo) {
var common = from && to ? getLowestCommonAncestor(from, to) : null;
var pathFrom = [];
while (from && from !== common) {
pathFrom.push(from);
from = getParent(from);
}
var pathTo = [];
while (to && to !== common) {
pathTo.push(to);
... | [
"function",
"traverseEnterLeave",
"(",
"from",
",",
"to",
",",
"fn",
",",
"argFrom",
",",
"argTo",
")",
"{",
"var",
"common",
"=",
"from",
"&&",
"to",
"?",
"getLowestCommonAncestor",
"(",
"from",
",",
"to",
")",
":",
"null",
";",
"var",
"pathFrom",
"="... | Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
should would receive a `mouseEnter` or `mouseLeave` event.
Does not invoke the callback on the nearest common ancestor because nothing
"entered" or "left" that element. | [
"Traverses",
"the",
"ID",
"hierarchy",
"and",
"invokes",
"the",
"supplied",
"cb",
"on",
"any",
"IDs",
"that",
"should",
"would",
"receive",
"a",
"mouseEnter",
"or",
"mouseLeave",
"event",
"."
] | c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3 | https://github.com/jossmac/react-images/blob/c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3/examples/dist/common.js#L18365-L18384 | train |
jossmac/react-images | examples/dist/common.js | listenerAtPhase | function listenerAtPhase(inst, event, propagationPhase) {
var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase];
return getListener(inst, registrationName);
} | javascript | function listenerAtPhase(inst, event, propagationPhase) {
var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase];
return getListener(inst, registrationName);
} | [
"function",
"listenerAtPhase",
"(",
"inst",
",",
"event",
",",
"propagationPhase",
")",
"{",
"var",
"registrationName",
"=",
"event",
".",
"dispatchConfig",
".",
"phasedRegistrationNames",
"[",
"propagationPhase",
"]",
";",
"return",
"getListener",
"(",
"inst",
",... | Some event types have a notion of different registration names for different
"phases" of propagation. This finds listeners by a given phase. | [
"Some",
"event",
"types",
"have",
"a",
"notion",
"of",
"different",
"registration",
"names",
"for",
"different",
"phases",
"of",
"propagation",
".",
"This",
"finds",
"listeners",
"by",
"a",
"given",
"phase",
"."
] | c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3 | https://github.com/jossmac/react-images/blob/c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3/examples/dist/common.js#L18404-L18407 | train |
jossmac/react-images | examples/dist/common.js | accumulateDirectDispatchesSingle | function accumulateDirectDispatchesSingle(event) {
if (event && event.dispatchConfig.registrationName) {
accumulateDispatches(event._targetInst, null, event);
}
} | javascript | function accumulateDirectDispatchesSingle(event) {
if (event && event.dispatchConfig.registrationName) {
accumulateDispatches(event._targetInst, null, event);
}
} | [
"function",
"accumulateDirectDispatchesSingle",
"(",
"event",
")",
"{",
"if",
"(",
"event",
"&&",
"event",
".",
"dispatchConfig",
".",
"registrationName",
")",
"{",
"accumulateDispatches",
"(",
"event",
".",
"_targetInst",
",",
"null",
",",
"event",
")",
";",
... | Accumulates dispatches on an `SyntheticEvent`, but only for the
`dispatchMarker`.
@param {SyntheticEvent} event | [
"Accumulates",
"dispatches",
"on",
"an",
"SyntheticEvent",
"but",
"only",
"for",
"the",
"dispatchMarker",
"."
] | c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3 | https://github.com/jossmac/react-images/blob/c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3/examples/dist/common.js#L18471-L18475 | train |
jossmac/react-images | examples/dist/common.js | isPresto | function isPresto() {
var opera = window.opera;
return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12;
} | javascript | function isPresto() {
var opera = window.opera;
return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12;
} | [
"function",
"isPresto",
"(",
")",
"{",
"var",
"opera",
"=",
"window",
".",
"opera",
";",
"return",
"typeof",
"opera",
"===",
"'object'",
"&&",
"typeof",
"opera",
".",
"version",
"===",
"'function'",
"&&",
"parseInt",
"(",
"opera",
".",
"version",
"(",
")... | Opera <= 12 includes TextEvent in window, but does not fire
text input events. Rely on keypress instead. | [
"Opera",
"<",
"=",
"12",
"includes",
"TextEvent",
"in",
"window",
"but",
"does",
"not",
"fire",
"text",
"input",
"events",
".",
"Rely",
"on",
"keypress",
"instead",
"."
] | c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3 | https://github.com/jossmac/react-images/blob/c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3/examples/dist/common.js#L18926-L18929 | train |
jossmac/react-images | examples/dist/common.js | isFallbackCompositionEnd | function isFallbackCompositionEnd(topLevelType, nativeEvent) {
switch (topLevelType) {
case 'topKeyUp':
// Command keys insert or clear IME input.
return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
case 'topKeyDown':
// Expect IME keyCode on each keydown. If we get any other
// c... | javascript | function isFallbackCompositionEnd(topLevelType, nativeEvent) {
switch (topLevelType) {
case 'topKeyUp':
// Command keys insert or clear IME input.
return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
case 'topKeyDown':
// Expect IME keyCode on each keydown. If we get any other
// c... | [
"function",
"isFallbackCompositionEnd",
"(",
"topLevelType",
",",
"nativeEvent",
")",
"{",
"switch",
"(",
"topLevelType",
")",
"{",
"case",
"'topKeyUp'",
":",
"// Command keys insert or clear IME input.",
"return",
"END_KEYCODES",
".",
"indexOf",
"(",
"nativeEvent",
"."... | Does our fallback mode think that this event is the end of composition?
@param {string} topLevelType
@param {object} nativeEvent
@return {boolean} | [
"Does",
"our",
"fallback",
"mode",
"think",
"that",
"this",
"event",
"is",
"the",
"end",
"of",
"composition?"
] | c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3 | https://github.com/jossmac/react-images/blob/c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3/examples/dist/common.js#L19016-L19033 | train |
jossmac/react-images | examples/dist/common.js | extractBeforeInputEvent | function extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
var chars;
if (canUseTextInputEvent) {
chars = getNativeBeforeInputChars(topLevelType, nativeEvent);
} else {
chars = getFallbackBeforeInputChars(topLevelType, nativeEvent);
}
// If no characters are being i... | javascript | function extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
var chars;
if (canUseTextInputEvent) {
chars = getNativeBeforeInputChars(topLevelType, nativeEvent);
} else {
chars = getFallbackBeforeInputChars(topLevelType, nativeEvent);
}
// If no characters are being i... | [
"function",
"extractBeforeInputEvent",
"(",
"topLevelType",
",",
"targetInst",
",",
"nativeEvent",
",",
"nativeEventTarget",
")",
"{",
"var",
"chars",
";",
"if",
"(",
"canUseTextInputEvent",
")",
"{",
"chars",
"=",
"getNativeBeforeInputChars",
"(",
"topLevelType",
"... | Extract a SyntheticInputEvent for `beforeInput`, based on either native
`textInput` or fallback behavior.
@return {?object} A SyntheticInputEvent. | [
"Extract",
"a",
"SyntheticInputEvent",
"for",
"beforeInput",
"based",
"on",
"either",
"native",
"textInput",
"or",
"fallback",
"behavior",
"."
] | c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3 | https://github.com/jossmac/react-images/blob/c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3/examples/dist/common.js#L19228-L19248 | train |
jossmac/react-images | examples/dist/common.js | modifierStateGetter | function modifierStateGetter(keyArg) {
var syntheticEvent = this;
var nativeEvent = syntheticEvent.nativeEvent;
if (nativeEvent.getModifierState) {
return nativeEvent.getModifierState(keyArg);
}
var keyProp = modifierKeyToProp[keyArg];
return keyProp ? !!nativeEvent[keyProp] : false;
} | javascript | function modifierStateGetter(keyArg) {
var syntheticEvent = this;
var nativeEvent = syntheticEvent.nativeEvent;
if (nativeEvent.getModifierState) {
return nativeEvent.getModifierState(keyArg);
}
var keyProp = modifierKeyToProp[keyArg];
return keyProp ? !!nativeEvent[keyProp] : false;
} | [
"function",
"modifierStateGetter",
"(",
"keyArg",
")",
"{",
"var",
"syntheticEvent",
"=",
"this",
";",
"var",
"nativeEvent",
"=",
"syntheticEvent",
".",
"nativeEvent",
";",
"if",
"(",
"nativeEvent",
".",
"getModifierState",
")",
"{",
"return",
"nativeEvent",
"."... | IE8 does not implement getModifierState so we simply map it to the only modifier keys exposed by the event itself, does not support Lock-keys. Currently, all major browsers except Chrome seems to support Lock-keys. | [
"IE8",
"does",
"not",
"implement",
"getModifierState",
"so",
"we",
"simply",
"map",
"it",
"to",
"the",
"only",
"modifier",
"keys",
"exposed",
"by",
"the",
"event",
"itself",
"does",
"not",
"support",
"Lock",
"-",
"keys",
".",
"Currently",
"all",
"major",
"... | c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3 | https://github.com/jossmac/react-images/blob/c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3/examples/dist/common.js#L19662-L19670 | train |
jossmac/react-images | examples/dist/common.js | isValidContainer | function isValidContainer(node) {
return !!(node && (node.nodeType === ELEMENT_NODE || node.nodeType === DOCUMENT_NODE || node.nodeType === DOCUMENT_FRAGMENT_NODE || node.nodeType === COMMENT_NODE && node.nodeValue === ' react-mount-point-unstable '));
} | javascript | function isValidContainer(node) {
return !!(node && (node.nodeType === ELEMENT_NODE || node.nodeType === DOCUMENT_NODE || node.nodeType === DOCUMENT_FRAGMENT_NODE || node.nodeType === COMMENT_NODE && node.nodeValue === ' react-mount-point-unstable '));
} | [
"function",
"isValidContainer",
"(",
"node",
")",
"{",
"return",
"!",
"!",
"(",
"node",
"&&",
"(",
"node",
".",
"nodeType",
"===",
"ELEMENT_NODE",
"||",
"node",
".",
"nodeType",
"===",
"DOCUMENT_NODE",
"||",
"node",
".",
"nodeType",
"===",
"DOCUMENT_FRAGMENT... | True if the supplied DOM node is a valid node element.
@param {?DOMElement} node The candidate DOM node.
@return {boolean} True if the DOM is a valid DOM node.
@internal | [
"True",
"if",
"the",
"supplied",
"DOM",
"node",
"is",
"a",
"valid",
"node",
"element",
"."
] | c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3 | https://github.com/jossmac/react-images/blob/c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3/examples/dist/common.js#L20758-L20760 | train |
jossmac/react-images | examples/dist/common.js | finish | function finish(e) {
if (e && e.target !== node) {
return;
}
clearTimeout(timer);
if (removeListeners) removeListeners();
(0, _removeClass2.default)(node, className);
(0, _removeClass2.default)(node, activeClassName);
if (removeListeners) removeListeners();
//... | javascript | function finish(e) {
if (e && e.target !== node) {
return;
}
clearTimeout(timer);
if (removeListeners) removeListeners();
(0, _removeClass2.default)(node, className);
(0, _removeClass2.default)(node, activeClassName);
if (removeListeners) removeListeners();
//... | [
"function",
"finish",
"(",
"e",
")",
"{",
"if",
"(",
"e",
"&&",
"e",
".",
"target",
"!==",
"node",
")",
"{",
"return",
";",
"}",
"clearTimeout",
"(",
"timer",
")",
";",
"if",
"(",
"removeListeners",
")",
"removeListeners",
"(",
")",
";",
"(",
"0",
... | Clean-up the animation after the specified delay | [
"Clean",
"-",
"up",
"the",
"animation",
"after",
"the",
"specified",
"delay"
] | c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3 | https://github.com/jossmac/react-images/blob/c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3/examples/dist/common.js#L22303-L22321 | train |
jossmac/react-images | examples/dist/common.js | getChildMapping | function getChildMapping(children) {
if (!children) {
return children;
}
var result = {};
_react.Children.map(children, function (child) {
return child;
}).forEach(function (child) {
result[child.key] = child;
});
return result;
} | javascript | function getChildMapping(children) {
if (!children) {
return children;
}
var result = {};
_react.Children.map(children, function (child) {
return child;
}).forEach(function (child) {
result[child.key] = child;
});
return result;
} | [
"function",
"getChildMapping",
"(",
"children",
")",
"{",
"if",
"(",
"!",
"children",
")",
"{",
"return",
"children",
";",
"}",
"var",
"result",
"=",
"{",
"}",
";",
"_react",
".",
"Children",
".",
"map",
"(",
"children",
",",
"function",
"(",
"child",
... | Given `this.props.children`, return an object mapping key to child.
@param {*} children `this.props.children`
@return {object} Mapping of key to child | [
"Given",
"this",
".",
"props",
".",
"children",
"return",
"an",
"object",
"mapping",
"key",
"to",
"child",
"."
] | c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3 | https://github.com/jossmac/react-images/blob/c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3/examples/dist/common.js#L22672-L22683 | train |
jossmac/react-images | examples/dist/common.js | escape | function escape(key) {
var escapeRegex = /[=:]/g;
var escaperLookup = {
'=': '=0',
':': '=2'
};
var escapedString = ('' + key).replace(escapeRegex, function (match) {
return escaperLookup[match];
});
return '$' + escapedString;
} | javascript | function escape(key) {
var escapeRegex = /[=:]/g;
var escaperLookup = {
'=': '=0',
':': '=2'
};
var escapedString = ('' + key).replace(escapeRegex, function (match) {
return escaperLookup[match];
});
return '$' + escapedString;
} | [
"function",
"escape",
"(",
"key",
")",
"{",
"var",
"escapeRegex",
"=",
"/",
"[=:]",
"/",
"g",
";",
"var",
"escaperLookup",
"=",
"{",
"'='",
":",
"'=0'",
",",
"':'",
":",
"'=2'",
"}",
";",
"var",
"escapedString",
"=",
"(",
"''",
"+",
"key",
")",
"... | Escape and wrap key so it is safe to use as a reactid
@param {string} key to be escaped.
@return {string} the escaped key. | [
"Escape",
"and",
"wrap",
"key",
"so",
"it",
"is",
"safe",
"to",
"use",
"as",
"a",
"reactid"
] | c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3 | https://github.com/jossmac/react-images/blob/c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3/examples/dist/common.js#L23509-L23520 | train |
jossmac/react-images | examples/dist/common.js | getComponentKey | function getComponentKey(component, index) {
// Do some typechecking here since we call this blindly. We want to ensure
// that we don't block potential future ES APIs.
if (typeof component === 'object' && component !== null && component.key != null) {
// Explicit key
return escape(component.key);
}
/... | javascript | function getComponentKey(component, index) {
// Do some typechecking here since we call this blindly. We want to ensure
// that we don't block potential future ES APIs.
if (typeof component === 'object' && component !== null && component.key != null) {
// Explicit key
return escape(component.key);
}
/... | [
"function",
"getComponentKey",
"(",
"component",
",",
"index",
")",
"{",
"// Do some typechecking here since we call this blindly. We want to ensure",
"// that we don't block potential future ES APIs.",
"if",
"(",
"typeof",
"component",
"===",
"'object'",
"&&",
"component",
"!=="... | Generate a key string that identifies a component within a set.
@param {*} component A component that could contain a manual key.
@param {number} index Index that is used if a manual key is not provided.
@return {string} | [
"Generate",
"a",
"key",
"string",
"that",
"identifies",
"a",
"component",
"within",
"a",
"set",
"."
] | c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3 | https://github.com/jossmac/react-images/blob/c6d9c2b9b92cc02e8fb9bfd5c0550d53aa4a14e3/examples/dist/common.js#L23668-L23677 | train |
zhoushengmufc/iosselect | demo/ajax/zepto.js | triggerGlobal | function triggerGlobal(settings, context, eventName, data) {
if (settings.global)
return triggerAndReturn(context || document, eventName, data);
} | javascript | function triggerGlobal(settings, context, eventName, data) {
if (settings.global)
return triggerAndReturn(context || document, eventName, data);
} | [
"function",
"triggerGlobal",
"(",
"settings",
",",
"context",
",",
"eventName",
",",
"data",
")",
"{",
"if",
"(",
"settings",
".",
"global",
")",
"return",
"triggerAndReturn",
"(",
"context",
"||",
"document",
",",
"eventName",
",",
"data",
")",
";",
"}"
] | trigger an Ajax "global" event | [
"trigger",
"an",
"Ajax",
"global",
"event"
] | e32b1614e9c1c1417d16bfb5e47ba543d6d64f0f | https://github.com/zhoushengmufc/iosselect/blob/e32b1614e9c1c1417d16bfb5e47ba543d6d64f0f/demo/ajax/zepto.js#L1386-L1389 | train |
zhoushengmufc/iosselect | demo/ajax/zepto.js | ajaxBeforeSend | function ajaxBeforeSend(xhr, settings) {
var context = settings.context;
if (settings.beforeSend.call(context, xhr, settings) === false || triggerGlobal(settings, context, 'ajaxBeforeSend', [
xhr,
settings
]) === false)
return false;
trigg... | javascript | function ajaxBeforeSend(xhr, settings) {
var context = settings.context;
if (settings.beforeSend.call(context, xhr, settings) === false || triggerGlobal(settings, context, 'ajaxBeforeSend', [
xhr,
settings
]) === false)
return false;
trigg... | [
"function",
"ajaxBeforeSend",
"(",
"xhr",
",",
"settings",
")",
"{",
"var",
"context",
"=",
"settings",
".",
"context",
";",
"if",
"(",
"settings",
".",
"beforeSend",
".",
"call",
"(",
"context",
",",
"xhr",
",",
"settings",
")",
"===",
"false",
"||",
... | triggers an extra global event "ajaxBeforeSend" that's like "ajaxSend" but cancelable | [
"triggers",
"an",
"extra",
"global",
"event",
"ajaxBeforeSend",
"that",
"s",
"like",
"ajaxSend",
"but",
"cancelable"
] | e32b1614e9c1c1417d16bfb5e47ba543d6d64f0f | https://github.com/zhoushengmufc/iosselect/blob/e32b1614e9c1c1417d16bfb5e47ba543d6d64f0f/demo/ajax/zepto.js#L1404-L1416 | train |
minirefresh/minirefresh | examples/scroll-nested/libs/swipe/js/swiper.jquery.js | function (e) {
if (e.targetTouches.length < 2) return 1;
var x1 = e.targetTouches[0].pageX,
y1 = e.targetTouches[0].pageY,
x2 = e.targetTouches[1].pageX,
y2 = e.targetTouches[1].pageY;
var distance = Math.sqrt(Ma... | javascript | function (e) {
if (e.targetTouches.length < 2) return 1;
var x1 = e.targetTouches[0].pageX,
y1 = e.targetTouches[0].pageY,
x2 = e.targetTouches[1].pageX,
y2 = e.targetTouches[1].pageY;
var distance = Math.sqrt(Ma... | [
"function",
"(",
"e",
")",
"{",
"if",
"(",
"e",
".",
"targetTouches",
".",
"length",
"<",
"2",
")",
"return",
"1",
";",
"var",
"x1",
"=",
"e",
".",
"targetTouches",
"[",
"0",
"]",
".",
"pageX",
",",
"y1",
"=",
"e",
".",
"targetTouches",
"[",
"0... | Calc Scale From Multi-touches | [
"Calc",
"Scale",
"From",
"Multi",
"-",
"touches"
] | 8c74d46b4e7e7b22ae4807032887b9e5e3391d8a | https://github.com/minirefresh/minirefresh/blob/8c74d46b4e7e7b22ae4807032887b9e5e3391d8a/examples/scroll-nested/libs/swipe/js/swiper.jquery.js#L3834-L3842 | train | |
watson-developer-cloud/node-sdk | examples/assistant_tone_analyzer_integration/tone_detection.js | invokeToneAsync | function invokeToneAsync(assistantPayload, toneAnalyzer) {
return new Promise(function(resolve, reject) {
toneAnalyzer.tone({ text: assistantPayload.input.text }, function(error, data) {
if (error) {
reject(error);
} else {
resolve(data);
}
});
});
} | javascript | function invokeToneAsync(assistantPayload, toneAnalyzer) {
return new Promise(function(resolve, reject) {
toneAnalyzer.tone({ text: assistantPayload.input.text }, function(error, data) {
if (error) {
reject(error);
} else {
resolve(data);
}
});
});
} | [
"function",
"invokeToneAsync",
"(",
"assistantPayload",
",",
"toneAnalyzer",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"toneAnalyzer",
".",
"tone",
"(",
"{",
"text",
":",
"assistantPayload",
".",
"input",
... | invokeToneAsync is an asynchronous function that calls the Tone Analyzer service and returns a Promise
@param assistantPayload json object returned by the Watson Assistant Service
@param toneAnalyzer an instance of the Watson Tone Analyzer service
@return a Promise for the result of calling the toneAnalyzer with the as... | [
"invokeToneAsync",
"is",
"an",
"asynchronous",
"function",
"that",
"calls",
"the",
"Tone",
"Analyzer",
"service",
"and",
"returns",
"a",
"Promise"
] | f97aa72e3edec655a2d40fae64560d709a56e9c7 | https://github.com/watson-developer-cloud/node-sdk/blob/f97aa72e3edec655a2d40fae64560d709a56e9c7/examples/assistant_tone_analyzer_integration/tone_detection.js#L36-L46 | train |
watson-developer-cloud/node-sdk | examples/assistant_tone_analyzer_integration/tone_detection.js | updateTone | function updateTone(user, tones, maintainHistory) {
var maxScore = 0.0;
var primaryTone = null;
var primaryToneScore = null;
tones.forEach(function(tone) {
if (tone.score > maxScore) {
maxScore = tone.score;
primaryTone = tone.tone_name.toLowerCase();
primaryToneScore = tone.score;
}
... | javascript | function updateTone(user, tones, maintainHistory) {
var maxScore = 0.0;
var primaryTone = null;
var primaryToneScore = null;
tones.forEach(function(tone) {
if (tone.score > maxScore) {
maxScore = tone.score;
primaryTone = tone.tone_name.toLowerCase();
primaryToneScore = tone.score;
}
... | [
"function",
"updateTone",
"(",
"user",
",",
"tones",
",",
"maintainHistory",
")",
"{",
"var",
"maxScore",
"=",
"0.0",
";",
"var",
"primaryTone",
"=",
"null",
";",
"var",
"primaryToneScore",
"=",
"null",
";",
"tones",
".",
"forEach",
"(",
"function",
"(",
... | updateTone updates the user tone with the primary tone - the tone with the largest score
@param user a json object representing user information (tone) to be used in conversing with the assistant Service
@param tones an array containing the document-level tones in the payload returned by the Tone Analyzer | [
"updateTone",
"updates",
"the",
"user",
"tone",
"with",
"the",
"primary",
"tone",
"-",
"the",
"tone",
"with",
"the",
"largest",
"score"
] | f97aa72e3edec655a2d40fae64560d709a56e9c7 | https://github.com/watson-developer-cloud/node-sdk/blob/f97aa72e3edec655a2d40fae64560d709a56e9c7/examples/assistant_tone_analyzer_integration/tone_detection.js#L99-L124 | train |
watson-developer-cloud/node-sdk | examples/speech_to_text.v1.js | onEvent | function onEvent(name, event) {
console.log(name, JSON.stringify(event, null, 2));
} | javascript | function onEvent(name, event) {
console.log(name, JSON.stringify(event, null, 2));
} | [
"function",
"onEvent",
"(",
"name",
",",
"event",
")",
"{",
"console",
".",
"log",
"(",
"name",
",",
"JSON",
".",
"stringify",
"(",
"event",
",",
"null",
",",
"2",
")",
")",
";",
"}"
] | Displays events on the console. | [
"Displays",
"events",
"on",
"the",
"console",
"."
] | f97aa72e3edec655a2d40fae64560d709a56e9c7 | https://github.com/watson-developer-cloud/node-sdk/blob/f97aa72e3edec655a2d40fae64560d709a56e9c7/examples/speech_to_text.v1.js#L45-L47 | train |
nodegit/nodegit | examples/walk-history-for-file.js | compileHistory | function compileHistory(resultingArrayOfCommits) {
var lastSha;
if (historyCommits.length > 0) {
lastSha = historyCommits[historyCommits.length - 1].commit.sha();
if (
resultingArrayOfCommits.length == 1 &&
resultingArrayOfCommits[0].commit.sha() == lastSha
) {
return;
}
}
res... | javascript | function compileHistory(resultingArrayOfCommits) {
var lastSha;
if (historyCommits.length > 0) {
lastSha = historyCommits[historyCommits.length - 1].commit.sha();
if (
resultingArrayOfCommits.length == 1 &&
resultingArrayOfCommits[0].commit.sha() == lastSha
) {
return;
}
}
res... | [
"function",
"compileHistory",
"(",
"resultingArrayOfCommits",
")",
"{",
"var",
"lastSha",
";",
"if",
"(",
"historyCommits",
".",
"length",
">",
"0",
")",
"{",
"lastSha",
"=",
"historyCommits",
"[",
"historyCommits",
".",
"length",
"-",
"1",
"]",
".",
"commit... | This code walks the history of the master branch and prints results that look very similar to calling `git log` from the command line | [
"This",
"code",
"walks",
"the",
"history",
"of",
"the",
"master",
"branch",
"and",
"prints",
"results",
"that",
"look",
"very",
"similar",
"to",
"calling",
"git",
"log",
"from",
"the",
"command",
"line"
] | 764146ca8054cd2839685c423bc2e5ba727165e9 | https://github.com/nodegit/nodegit/blob/764146ca8054cd2839685c423bc2e5ba727165e9/examples/walk-history-for-file.js#L12-L36 | train |
nodegit/nodegit | examples/general.js | walk | function walk() {
return revWalk.next().then(function(oid) {
if (!oid) {
return;
}
return repo.getCommit(oid).then(function(commit) {
console.log("Commit:", commit.toString());
return walk();
});
});
} | javascript | function walk() {
return revWalk.next().then(function(oid) {
if (!oid) {
return;
}
return repo.getCommit(oid).then(function(commit) {
console.log("Commit:", commit.toString());
return walk();
});
});
} | [
"function",
"walk",
"(",
")",
"{",
"return",
"revWalk",
".",
"next",
"(",
")",
".",
"then",
"(",
"function",
"(",
"oid",
")",
"{",
"if",
"(",
"!",
"oid",
")",
"{",
"return",
";",
"}",
"return",
"repo",
".",
"getCommit",
"(",
"oid",
")",
".",
"t... | Now that we have the starting point pushed onto the walker, we start asking for ancestors. It will return them in the sorting order we asked for as commit oids. We can then lookup and parse the commited pointed at by the returned OID; note that this operation is specially fast since the raw contents of the commit objec... | [
"Now",
"that",
"we",
"have",
"the",
"starting",
"point",
"pushed",
"onto",
"the",
"walker",
"we",
"start",
"asking",
"for",
"ancestors",
".",
"It",
"will",
"return",
"them",
"in",
"the",
"sorting",
"order",
"we",
"asked",
"for",
"as",
"commit",
"oids",
"... | 764146ca8054cd2839685c423bc2e5ba727165e9 | https://github.com/nodegit/nodegit/blob/764146ca8054cd2839685c423bc2e5ba727165e9/examples/general.js#L301-L312 | train |
nodegit/nodegit | lib/repository.js | performRebase | function performRebase(
repository,
rebase,
signature,
beforeNextFn,
beforeFinishFn
) {
var beforeNextFnResult;
/* In the case of FF merges and a beforeFinishFn, this will fail
* when looking for 'rewritten' so we need to handle that case.
*/
function readRebaseMetadataFile(fileName, continueOnEr... | javascript | function performRebase(
repository,
rebase,
signature,
beforeNextFn,
beforeFinishFn
) {
var beforeNextFnResult;
/* In the case of FF merges and a beforeFinishFn, this will fail
* when looking for 'rewritten' so we need to handle that case.
*/
function readRebaseMetadataFile(fileName, continueOnEr... | [
"function",
"performRebase",
"(",
"repository",
",",
"rebase",
",",
"signature",
",",
"beforeNextFn",
",",
"beforeFinishFn",
")",
"{",
"var",
"beforeNextFnResult",
";",
"/* In the case of FF merges and a beforeFinishFn, this will fail\n * when looking for 'rewritten' so we need t... | Goes through a rebase's rebase operations and commits them if there are
no merge conflicts
@param {Repository} repository The repository that the rebase is being
performed in
@param {Rebase} rebase The current rebase being performed
@param {Signature} signature Identity of the one performing the ... | [
"Goes",
"through",
"a",
"rebase",
"s",
"rebase",
"operations",
"and",
"commits",
"them",
"if",
"there",
"are",
"no",
"merge",
"conflicts"
] | 764146ca8054cd2839685c423bc2e5ba727165e9 | https://github.com/nodegit/nodegit/blob/764146ca8054cd2839685c423bc2e5ba727165e9/lib/repository.js#L213-L319 | train |
nodegit/nodegit | lib/repository.js | lastHunkStagedPromise | function lastHunkStagedPromise(result) {
return NodeGit.Diff.indexToWorkdir(repo, index, {
flags:
NodeGit.Diff.OPTION.SHOW_UNTRACKED_CONTENT |
NodeGit.Diff.OPTION.RECURSE_UNTRACKED_DIRS |
(additionalDiffOptions || 0)
})
.then(function(diff) {
return diff.patches();
})... | javascript | function lastHunkStagedPromise(result) {
return NodeGit.Diff.indexToWorkdir(repo, index, {
flags:
NodeGit.Diff.OPTION.SHOW_UNTRACKED_CONTENT |
NodeGit.Diff.OPTION.RECURSE_UNTRACKED_DIRS |
(additionalDiffOptions || 0)
})
.then(function(diff) {
return diff.patches();
})... | [
"function",
"lastHunkStagedPromise",
"(",
"result",
")",
"{",
"return",
"NodeGit",
".",
"Diff",
".",
"indexToWorkdir",
"(",
"repo",
",",
"index",
",",
"{",
"flags",
":",
"NodeGit",
".",
"Diff",
".",
"OPTION",
".",
"SHOW_UNTRACKED_CONTENT",
"|",
"NodeGit",
".... | The following chain checks if there is a patch with no hunks left for the file, and no filemode changes were done on the file. It is then safe to stage the entire file so the file doesn't show as having unstaged changes in `git status`. Also, check if there are no type changes. | [
"The",
"following",
"chain",
"checks",
"if",
"there",
"is",
"a",
"patch",
"with",
"no",
"hunks",
"left",
"for",
"the",
"file",
"and",
"no",
"filemode",
"changes",
"were",
"done",
"on",
"the",
"file",
".",
"It",
"is",
"then",
"safe",
"to",
"stage",
"the... | 764146ca8054cd2839685c423bc2e5ba727165e9 | https://github.com/nodegit/nodegit/blob/764146ca8054cd2839685c423bc2e5ba727165e9/lib/repository.js#L1995-L2025 | train |
nodegit/nodegit | lib/utils/lookup_wrapper.js | lookupWrapper | function lookupWrapper(objectType, lookupFunction) {
lookupFunction = lookupFunction || objectType.lookup;
return function(repo, id, callback) {
if (id instanceof objectType) {
return Promise.resolve(id).then(function(obj) {
obj.repo = repo;
if (typeof callback === "function") {
... | javascript | function lookupWrapper(objectType, lookupFunction) {
lookupFunction = lookupFunction || objectType.lookup;
return function(repo, id, callback) {
if (id instanceof objectType) {
return Promise.resolve(id).then(function(obj) {
obj.repo = repo;
if (typeof callback === "function") {
... | [
"function",
"lookupWrapper",
"(",
"objectType",
",",
"lookupFunction",
")",
"{",
"lookupFunction",
"=",
"lookupFunction",
"||",
"objectType",
".",
"lookup",
";",
"return",
"function",
"(",
"repo",
",",
"id",
",",
"callback",
")",
"{",
"if",
"(",
"id",
"insta... | Wraps a method so that you can pass in either a string, OID or the object
itself and you will always get back a promise that resolves to the object.
@param {Object} objectType The object type that you're expecting to receive.
@param {Function} lookupFunction The function to do the lookup for the
object. Defaults to `o... | [
"Wraps",
"a",
"method",
"so",
"that",
"you",
"can",
"pass",
"in",
"either",
"a",
"string",
"OID",
"or",
"the",
"object",
"itself",
"and",
"you",
"will",
"always",
"get",
"back",
"a",
"promise",
"that",
"resolves",
"to",
"the",
"object",
"."
] | 764146ca8054cd2839685c423bc2e5ba727165e9 | https://github.com/nodegit/nodegit/blob/764146ca8054cd2839685c423bc2e5ba727165e9/lib/utils/lookup_wrapper.js#L11-L37 | train |
Leaflet/Leaflet.draw | docs/examples/libs/leaflet.snap.js | computeBuffer | function computeBuffer() {
this._buffer = map.layerPointToLatLng(new L.Point(0,0)).lat -
map.layerPointToLatLng(new L.Point(this.options.snapDistance, 0)).lat;
} | javascript | function computeBuffer() {
this._buffer = map.layerPointToLatLng(new L.Point(0,0)).lat -
map.layerPointToLatLng(new L.Point(this.options.snapDistance, 0)).lat;
} | [
"function",
"computeBuffer",
"(",
")",
"{",
"this",
".",
"_buffer",
"=",
"map",
".",
"layerPointToLatLng",
"(",
"new",
"L",
".",
"Point",
"(",
"0",
",",
"0",
")",
")",
".",
"lat",
"-",
"map",
".",
"layerPointToLatLng",
"(",
"new",
"L",
".",
"Point",
... | Convert snap distance in pixels into buffer in degres, for searching around mouse It changes at each zoom change. | [
"Convert",
"snap",
"distance",
"in",
"pixels",
"into",
"buffer",
"in",
"degres",
"for",
"searching",
"around",
"mouse",
"It",
"changes",
"at",
"each",
"zoom",
"change",
"."
] | d5dd11781c2e07f9e719308e504fe579000edf54 | https://github.com/Leaflet/Leaflet.draw/blob/d5dd11781c2e07f9e719308e504fe579000edf54/docs/examples/libs/leaflet.snap.js#L32-L35 | train |
Leaflet/Leaflet.draw | docs/examples/libs/Leaflet.draw.drag-src.js | function(matrix) {
var skew = this._skew;
if (!skew) {
skew = this._createElement('skew');
this._container.appendChild(skew);
skew.style.behavior = 'url(#default#VML)';
this._skew = skew;
}
// handle skew/translate separately, cause it's broken
var mt = ma... | javascript | function(matrix) {
var skew = this._skew;
if (!skew) {
skew = this._createElement('skew');
this._container.appendChild(skew);
skew.style.behavior = 'url(#default#VML)';
this._skew = skew;
}
// handle skew/translate separately, cause it's broken
var mt = ma... | [
"function",
"(",
"matrix",
")",
"{",
"var",
"skew",
"=",
"this",
".",
"_skew",
";",
"if",
"(",
"!",
"skew",
")",
"{",
"skew",
"=",
"this",
".",
"_createElement",
"(",
"'skew'",
")",
";",
"this",
".",
"_container",
".",
"appendChild",
"(",
"skew",
"... | Applies matrix transformation to VML
@param {Array.<Number>} matrix | [
"Applies",
"matrix",
"transformation",
"to",
"VML"
] | d5dd11781c2e07f9e719308e504fe579000edf54 | https://github.com/Leaflet/Leaflet.draw/blob/d5dd11781c2e07f9e719308e504fe579000edf54/docs/examples/libs/Leaflet.draw.drag-src.js#L51-L85 | train | |
Leaflet/Leaflet.draw | docs/examples/libs/Leaflet.draw.drag-src.js | function(e) {
if ((this.dragging && this.dragging.moved()) ||
(this._map.dragging && this._map.dragging.moved())) {
return;
}
this._fireMouseEvent(e);
} | javascript | function(e) {
if ((this.dragging && this.dragging.moved()) ||
(this._map.dragging && this._map.dragging.moved())) {
return;
}
this._fireMouseEvent(e);
} | [
"function",
"(",
"e",
")",
"{",
"if",
"(",
"(",
"this",
".",
"dragging",
"&&",
"this",
".",
"dragging",
".",
"moved",
"(",
")",
")",
"||",
"(",
"this",
".",
"_map",
".",
"dragging",
"&&",
"this",
".",
"_map",
".",
"dragging",
".",
"moved",
"(",
... | Check if the feature was dragged, that'll supress the click event
on mouseup. That fixes popups for example
@param {MouseEvent} e | [
"Check",
"if",
"the",
"feature",
"was",
"dragged",
"that",
"ll",
"supress",
"the",
"click",
"event",
"on",
"mouseup",
".",
"That",
"fixes",
"popups",
"for",
"example"
] | d5dd11781c2e07f9e719308e504fe579000edf54 | https://github.com/Leaflet/Leaflet.draw/blob/d5dd11781c2e07f9e719308e504fe579000edf54/docs/examples/libs/Leaflet.draw.drag-src.js#L99-L106 | train | |
Leaflet/Leaflet.draw | docs/examples/libs/Leaflet.draw.drag-src.js | function(matrix) {
var path = this._path;
var i, len, latlng;
var px = L.point(matrix[4], matrix[5]);
var crs = path._map.options.crs;
var transformation = crs.transformation;
var scale = crs.scale(path._map.getZoom());
var projection = crs.projection;
var diff = transformation.untran... | javascript | function(matrix) {
var path = this._path;
var i, len, latlng;
var px = L.point(matrix[4], matrix[5]);
var crs = path._map.options.crs;
var transformation = crs.transformation;
var scale = crs.scale(path._map.getZoom());
var projection = crs.projection;
var diff = transformation.untran... | [
"function",
"(",
"matrix",
")",
"{",
"var",
"path",
"=",
"this",
".",
"_path",
";",
"var",
"i",
",",
"len",
",",
"latlng",
";",
"var",
"px",
"=",
"L",
".",
"point",
"(",
"matrix",
"[",
"4",
"]",
",",
"matrix",
"[",
"5",
"]",
")",
";",
"var",
... | Applies transformation, does it in one sweep for performance,
so don't be surprised about the code repetition.
[ x ] [ a b tx ] [ x ] [ a * x + b * y + tx ]
[ y ] = [ c d ty ] [ y ] = [ c * x + d * y + ty ]
@param {Array.<Number>} matrix | [
"Applies",
"transformation",
"does",
"it",
"in",
"one",
"sweep",
"for",
"performance",
"so",
"don",
"t",
"be",
"surprised",
"about",
"the",
"code",
"repetition",
"."
] | d5dd11781c2e07f9e719308e504fe579000edf54 | https://github.com/Leaflet/Leaflet.draw/blob/d5dd11781c2e07f9e719308e504fe579000edf54/docs/examples/libs/Leaflet.draw.drag-src.js#L251-L296 | train | |
Leaflet/Leaflet.draw | docs/examples/libs/Leaflet.draw.drag-src.js | function(evt) {
var poly = this._shape || this._poly;
var marker = evt.target;
poly.fire('mousedown', L.Util.extend(evt, {
containerPoint: L.DomUtil.getPosition(marker._icon)
.add(poly._map._getMapPanePos())
}));
} | javascript | function(evt) {
var poly = this._shape || this._poly;
var marker = evt.target;
poly.fire('mousedown', L.Util.extend(evt, {
containerPoint: L.DomUtil.getPosition(marker._icon)
.add(poly._map._getMapPanePos())
}));
} | [
"function",
"(",
"evt",
")",
"{",
"var",
"poly",
"=",
"this",
".",
"_shape",
"||",
"this",
".",
"_poly",
";",
"var",
"marker",
"=",
"evt",
".",
"target",
";",
"poly",
".",
"fire",
"(",
"'mousedown'",
",",
"L",
".",
"Util",
".",
"extend",
"(",
"ev... | Start dragging through the marker
@param {L.MouseEvent} evt | [
"Start",
"dragging",
"through",
"the",
"marker"
] | d5dd11781c2e07f9e719308e504fe579000edf54 | https://github.com/Leaflet/Leaflet.draw/blob/d5dd11781c2e07f9e719308e504fe579000edf54/docs/examples/libs/Leaflet.draw.drag-src.js#L745-L752 | train | |
Leaflet/Leaflet.draw | docs/examples-0.7.x/libs/leaflet-src.js | function (obj) { // (LatLng) or (LatLngBounds)
if (!obj) { return this; }
var latLng = L.latLng(obj);
if (latLng !== null) {
obj = latLng;
} else {
obj = L.latLngBounds(obj);
}
if (obj instanceof L.LatLng) {
if (!this._southWest && !this._northEast) {
this._southWest = new L.LatLng(obj.lat, o... | javascript | function (obj) { // (LatLng) or (LatLngBounds)
if (!obj) { return this; }
var latLng = L.latLng(obj);
if (latLng !== null) {
obj = latLng;
} else {
obj = L.latLngBounds(obj);
}
if (obj instanceof L.LatLng) {
if (!this._southWest && !this._northEast) {
this._southWest = new L.LatLng(obj.lat, o... | [
"function",
"(",
"obj",
")",
"{",
"// (LatLng) or (LatLngBounds)",
"if",
"(",
"!",
"obj",
")",
"{",
"return",
"this",
";",
"}",
"var",
"latLng",
"=",
"L",
".",
"latLng",
"(",
"obj",
")",
";",
"if",
"(",
"latLng",
"!==",
"null",
")",
"{",
"obj",
"="... | extend the bounds to contain the given point or bounds | [
"extend",
"the",
"bounds",
"to",
"contain",
"the",
"given",
"point",
"or",
"bounds"
] | d5dd11781c2e07f9e719308e504fe579000edf54 | https://github.com/Leaflet/Leaflet.draw/blob/d5dd11781c2e07f9e719308e504fe579000edf54/docs/examples-0.7.x/libs/leaflet-src.js#L1261-L1287 | train | |
Leaflet/Leaflet.draw | docs/examples-0.7.x/libs/leaflet-src.js | function (center, zoom) {
zoom = zoom === undefined ? this.getZoom() : zoom;
this._resetView(L.latLng(center), this._limitZoom(zoom));
return this;
} | javascript | function (center, zoom) {
zoom = zoom === undefined ? this.getZoom() : zoom;
this._resetView(L.latLng(center), this._limitZoom(zoom));
return this;
} | [
"function",
"(",
"center",
",",
"zoom",
")",
"{",
"zoom",
"=",
"zoom",
"===",
"undefined",
"?",
"this",
".",
"getZoom",
"(",
")",
":",
"zoom",
";",
"this",
".",
"_resetView",
"(",
"L",
".",
"latLng",
"(",
"center",
")",
",",
"this",
".",
"_limitZoo... | public methods that modify map state replaced by animation-powered implementation in Map.PanAnimation.js | [
"public",
"methods",
"that",
"modify",
"map",
"state",
"replaced",
"by",
"animation",
"-",
"powered",
"implementation",
"in",
"Map",
".",
"PanAnimation",
".",
"js"
] | d5dd11781c2e07f9e719308e504fe579000edf54 | https://github.com/Leaflet/Leaflet.draw/blob/d5dd11781c2e07f9e719308e504fe579000edf54/docs/examples-0.7.x/libs/leaflet-src.js#L1594-L1598 | train | |
Leaflet/Leaflet.draw | docs/examples-0.7.x/libs/leaflet-src.js | function (offset, bounds) {
if (!bounds) { return offset; }
var viewBounds = this.getPixelBounds(),
newBounds = new L.Bounds(viewBounds.min.add(offset), viewBounds.max.add(offset));
return offset.add(this._getBoundsOffset(newBounds, bounds));
} | javascript | function (offset, bounds) {
if (!bounds) { return offset; }
var viewBounds = this.getPixelBounds(),
newBounds = new L.Bounds(viewBounds.min.add(offset), viewBounds.max.add(offset));
return offset.add(this._getBoundsOffset(newBounds, bounds));
} | [
"function",
"(",
"offset",
",",
"bounds",
")",
"{",
"if",
"(",
"!",
"bounds",
")",
"{",
"return",
"offset",
";",
"}",
"var",
"viewBounds",
"=",
"this",
".",
"getPixelBounds",
"(",
")",
",",
"newBounds",
"=",
"new",
"L",
".",
"Bounds",
"(",
"viewBound... | adjust offset for view to get inside bounds | [
"adjust",
"offset",
"for",
"view",
"to",
"get",
"inside",
"bounds"
] | d5dd11781c2e07f9e719308e504fe579000edf54 | https://github.com/Leaflet/Leaflet.draw/blob/d5dd11781c2e07f9e719308e504fe579000edf54/docs/examples-0.7.x/libs/leaflet-src.js#L2310-L2317 | train | |
Leaflet/Leaflet.draw | docs/examples-0.7.x/libs/leaflet-src.js | function (points, sqTolerance) {
var reducedPoints = [points[0]];
for (var i = 1, prev = 0, len = points.length; i < len; i++) {
if (this._sqDist(points[i], points[prev]) > sqTolerance) {
reducedPoints.push(points[i]);
prev = i;
}
}
if (prev < len - 1) {
reducedPoints.push(points[len - 1]);
... | javascript | function (points, sqTolerance) {
var reducedPoints = [points[0]];
for (var i = 1, prev = 0, len = points.length; i < len; i++) {
if (this._sqDist(points[i], points[prev]) > sqTolerance) {
reducedPoints.push(points[i]);
prev = i;
}
}
if (prev < len - 1) {
reducedPoints.push(points[len - 1]);
... | [
"function",
"(",
"points",
",",
"sqTolerance",
")",
"{",
"var",
"reducedPoints",
"=",
"[",
"points",
"[",
"0",
"]",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"1",
",",
"prev",
"=",
"0",
",",
"len",
"=",
"points",
".",
"length",
";",
"i",
"<",
"len... | reduce points that are too close to each other to a single point | [
"reduce",
"points",
"that",
"are",
"too",
"close",
"to",
"each",
"other",
"to",
"a",
"single",
"point"
] | d5dd11781c2e07f9e719308e504fe579000edf54 | https://github.com/Leaflet/Leaflet.draw/blob/d5dd11781c2e07f9e719308e504fe579000edf54/docs/examples-0.7.x/libs/leaflet-src.js#L5324-L5337 | train | |
Leaflet/Leaflet.draw | docs/examples-0.7.x/libs/leaflet-src.js | function (a, b, bounds, useLastCode) {
var codeA = useLastCode ? this._lastCode : this._getBitCode(a, bounds),
codeB = this._getBitCode(b, bounds),
codeOut, p, newCode;
// save 2nd code to avoid calculating it on the next segment
this._lastCode = codeB;
while (true) {
// if a,b is inside the c... | javascript | function (a, b, bounds, useLastCode) {
var codeA = useLastCode ? this._lastCode : this._getBitCode(a, bounds),
codeB = this._getBitCode(b, bounds),
codeOut, p, newCode;
// save 2nd code to avoid calculating it on the next segment
this._lastCode = codeB;
while (true) {
// if a,b is inside the c... | [
"function",
"(",
"a",
",",
"b",
",",
"bounds",
",",
"useLastCode",
")",
"{",
"var",
"codeA",
"=",
"useLastCode",
"?",
"this",
".",
"_lastCode",
":",
"this",
".",
"_getBitCode",
"(",
"a",
",",
"bounds",
")",
",",
"codeB",
"=",
"this",
".",
"_getBitCod... | Cohen-Sutherland line clipping algorithm. Used to avoid rendering parts of a polyline that are not currently visible. | [
"Cohen",
"-",
"Sutherland",
"line",
"clipping",
"algorithm",
".",
"Used",
"to",
"avoid",
"rendering",
"parts",
"of",
"a",
"polyline",
"that",
"are",
"not",
"currently",
"visible",
"."
] | d5dd11781c2e07f9e719308e504fe579000edf54 | https://github.com/Leaflet/Leaflet.draw/blob/d5dd11781c2e07f9e719308e504fe579000edf54/docs/examples-0.7.x/libs/leaflet-src.js#L5342-L5373 | train | |
Leaflet/Leaflet.draw | docs/examples-0.7.x/libs/leaflet-src.js | function (p, p1, p2, sqDist) {
var x = p1.x,
y = p1.y,
dx = p2.x - x,
dy = p2.y - y,
dot = dx * dx + dy * dy,
t;
if (dot > 0) {
t = ((p.x - x) * dx + (p.y - y) * dy) / dot;
if (t > 1) {
x = p2.x;
y = p2.y;
} else if (t > 0) {
x += dx * t;
y += dy * t;
}
... | javascript | function (p, p1, p2, sqDist) {
var x = p1.x,
y = p1.y,
dx = p2.x - x,
dy = p2.y - y,
dot = dx * dx + dy * dy,
t;
if (dot > 0) {
t = ((p.x - x) * dx + (p.y - y) * dy) / dot;
if (t > 1) {
x = p2.x;
y = p2.y;
} else if (t > 0) {
x += dx * t;
y += dy * t;
}
... | [
"function",
"(",
"p",
",",
"p1",
",",
"p2",
",",
"sqDist",
")",
"{",
"var",
"x",
"=",
"p1",
".",
"x",
",",
"y",
"=",
"p1",
".",
"y",
",",
"dx",
"=",
"p2",
".",
"x",
"-",
"x",
",",
"dy",
"=",
"p2",
".",
"y",
"-",
"y",
",",
"dot",
"=",
... | return closest point on segment or distance to that point | [
"return",
"closest",
"point",
"on",
"segment",
"or",
"distance",
"to",
"that",
"point"
] | d5dd11781c2e07f9e719308e504fe579000edf54 | https://github.com/Leaflet/Leaflet.draw/blob/d5dd11781c2e07f9e719308e504fe579000edf54/docs/examples-0.7.x/libs/leaflet-src.js#L5417-L5441 | train | |
Leaflet/Leaflet.draw | build/build.js | bundleFiles | function bundleFiles(files, copy, version) {
var node = new SourceNode(null, null, null, '');
node.add(new SourceNode(null, null, null, copy + '(function (window, document, undefined) {'));
for (var i = 0, len = files.length; i < len; i++) {
var contents = fs.readFileSync(files[i], 'utf8');
... | javascript | function bundleFiles(files, copy, version) {
var node = new SourceNode(null, null, null, '');
node.add(new SourceNode(null, null, null, copy + '(function (window, document, undefined) {'));
for (var i = 0, len = files.length; i < len; i++) {
var contents = fs.readFileSync(files[i], 'utf8');
... | [
"function",
"bundleFiles",
"(",
"files",
",",
"copy",
",",
"version",
")",
"{",
"var",
"node",
"=",
"new",
"SourceNode",
"(",
"null",
",",
"null",
",",
"null",
",",
"''",
")",
";",
"node",
".",
"add",
"(",
"new",
"SourceNode",
"(",
"null",
",",
"nu... | Concatenate the files while building up a sourcemap for the concatenation, and replace the line defining L.version with the string prepared in the jakefile | [
"Concatenate",
"the",
"files",
"while",
"building",
"up",
"a",
"sourcemap",
"for",
"the",
"concatenation",
"and",
"replace",
"the",
"line",
"defining",
"L",
".",
"version",
"with",
"the",
"string",
"prepared",
"in",
"the",
"jakefile"
] | d5dd11781c2e07f9e719308e504fe579000edf54 | https://github.com/Leaflet/Leaflet.draw/blob/d5dd11781c2e07f9e719308e504fe579000edf54/build/build.js#L76-L112 | train |
Leaflet/Leaflet.draw | Jakefile.js | calculateVersion | function calculateVersion(officialRelease, callback) {
var version = require('./package.json').version;
if (officialRelease) {
callback(version);
} else {
git.short(function (str) {
callback(version + '+' + str);
});
}
} | javascript | function calculateVersion(officialRelease, callback) {
var version = require('./package.json').version;
if (officialRelease) {
callback(version);
} else {
git.short(function (str) {
callback(version + '+' + str);
});
}
} | [
"function",
"calculateVersion",
"(",
"officialRelease",
",",
"callback",
")",
"{",
"var",
"version",
"=",
"require",
"(",
"'./package.json'",
")",
".",
"version",
";",
"if",
"(",
"officialRelease",
")",
"{",
"callback",
"(",
"version",
")",
";",
"}",
"else",... | Returns the version string in package.json, plus a semver build metadata if this is not an official release | [
"Returns",
"the",
"version",
"string",
"in",
"package",
".",
"json",
"plus",
"a",
"semver",
"build",
"metadata",
"if",
"this",
"is",
"not",
"an",
"official",
"release"
] | d5dd11781c2e07f9e719308e504fe579000edf54 | https://github.com/Leaflet/Leaflet.draw/blob/d5dd11781c2e07f9e719308e504fe579000edf54/Jakefile.js#L32-L42 | train |
Leaflet/Leaflet.draw | docs/examples/libs/spectrum.js | bind | function bind(func, obj) {
var slice = Array.prototype.slice;
var args = slice.call(arguments, 2);
return function () {
return func.apply(obj, args.concat(slice.call(arguments)));
};
} | javascript | function bind(func, obj) {
var slice = Array.prototype.slice;
var args = slice.call(arguments, 2);
return function () {
return func.apply(obj, args.concat(slice.call(arguments)));
};
} | [
"function",
"bind",
"(",
"func",
",",
"obj",
")",
"{",
"var",
"slice",
"=",
"Array",
".",
"prototype",
".",
"slice",
";",
"var",
"args",
"=",
"slice",
".",
"call",
"(",
"arguments",
",",
"2",
")",
";",
"return",
"function",
"(",
")",
"{",
"return",... | Create a function bound to a given object
Thanks to underscore.js | [
"Create",
"a",
"function",
"bound",
"to",
"a",
"given",
"object",
"Thanks",
"to",
"underscore",
".",
"js"
] | d5dd11781c2e07f9e719308e504fe579000edf54 | https://github.com/Leaflet/Leaflet.draw/blob/d5dd11781c2e07f9e719308e504fe579000edf54/docs/examples/libs/spectrum.js#L941-L947 | train |
hyperledger/fabric-sdk-node | fabric-ca-client/lib/helper.js | parseURL | function parseURL(url) {
const endpoint = {};
const purl = urlParser.parse(url, true);
if (purl.protocol && purl.protocol.startsWith('http')) {
endpoint.protocol = purl.protocol.slice(0, -1);
if (purl.hostname) {
endpoint.hostname = purl.hostname;
if (purl.port) {
endpoint.port = parseInt(purl.port... | javascript | function parseURL(url) {
const endpoint = {};
const purl = urlParser.parse(url, true);
if (purl.protocol && purl.protocol.startsWith('http')) {
endpoint.protocol = purl.protocol.slice(0, -1);
if (purl.hostname) {
endpoint.hostname = purl.hostname;
if (purl.port) {
endpoint.port = parseInt(purl.port... | [
"function",
"parseURL",
"(",
"url",
")",
"{",
"const",
"endpoint",
"=",
"{",
"}",
";",
"const",
"purl",
"=",
"urlParser",
".",
"parse",
"(",
"url",
",",
"true",
")",
";",
"if",
"(",
"purl",
".",
"protocol",
"&&",
"purl",
".",
"protocol",
".",
"star... | Utility function which parses an HTTP URL into its component parts
@param {string} url HTTP or HTTPS url including protocol, host and port
@returns {HTTPEndpoint}
@throws InvalidURL for malformed URLs
@ignore | [
"Utility",
"function",
"which",
"parses",
"an",
"HTTP",
"URL",
"into",
"its",
"component",
"parts"
] | 4f62e201624c1e9a14d548808d3524aa93573cd5 | https://github.com/hyperledger/fabric-sdk-node/blob/4f62e201624c1e9a14d548808d3524aa93573cd5/fabric-ca-client/lib/helper.js#L56-L80 | train |
hyperledger/fabric-sdk-node | fabric-client/lib/impl/CryptoSuite_ECDSA_AES.js | makeRealPem | function makeRealPem(pem) {
let result = null;
if (typeof pem === 'string') {
result = pem.replace(/-----BEGIN -----/, '-----BEGIN CERTIFICATE-----');
result = result.replace(/-----END -----/, '-----END CERTIFICATE-----');
result = result.replace(/-----([^-]+) ECDSA ([^-]+)-----([^-]*)-----([^-]+) ECDSA ([^-]+)... | javascript | function makeRealPem(pem) {
let result = null;
if (typeof pem === 'string') {
result = pem.replace(/-----BEGIN -----/, '-----BEGIN CERTIFICATE-----');
result = result.replace(/-----END -----/, '-----END CERTIFICATE-----');
result = result.replace(/-----([^-]+) ECDSA ([^-]+)-----([^-]*)-----([^-]+) ECDSA ([^-]+)... | [
"function",
"makeRealPem",
"(",
"pem",
")",
"{",
"let",
"result",
"=",
"null",
";",
"if",
"(",
"typeof",
"pem",
"===",
"'string'",
")",
"{",
"result",
"=",
"pem",
".",
"replace",
"(",
"/",
"-----BEGIN -----",
"/",
",",
"'-----BEGIN CERTIFICATE-----'",
")",... | Utilitly method to make sure the start and end markers are correct | [
"Utilitly",
"method",
"to",
"make",
"sure",
"the",
"start",
"and",
"end",
"markers",
"are",
"correct"
] | 4f62e201624c1e9a14d548808d3524aa93573cd5 | https://github.com/hyperledger/fabric-sdk-node/blob/4f62e201624c1e9a14d548808d3524aa93573cd5/fabric-client/lib/impl/CryptoSuite_ECDSA_AES.js#L343-L351 | train |
hyperledger/fabric-sdk-node | fabric-network/lib/contract.js | verifyTransactionName | function verifyTransactionName(name) {
if (typeof name !== 'string' || name.length === 0) {
const msg = util.format('Transaction name must be a non-empty string: %j', name);
logger.error('verifyTransactionName:', msg);
throw new Error(msg);
}
} | javascript | function verifyTransactionName(name) {
if (typeof name !== 'string' || name.length === 0) {
const msg = util.format('Transaction name must be a non-empty string: %j', name);
logger.error('verifyTransactionName:', msg);
throw new Error(msg);
}
} | [
"function",
"verifyTransactionName",
"(",
"name",
")",
"{",
"if",
"(",
"typeof",
"name",
"!==",
"'string'",
"||",
"name",
".",
"length",
"===",
"0",
")",
"{",
"const",
"msg",
"=",
"util",
".",
"format",
"(",
"'Transaction name must be a non-empty string: %j'",
... | Ensure transaction name is a non-empty string.
@private
@param {*} name Transaction name.
@throws {Error} if the name is invalid. | [
"Ensure",
"transaction",
"name",
"is",
"a",
"non",
"-",
"empty",
"string",
"."
] | 4f62e201624c1e9a14d548808d3524aa93573cd5 | https://github.com/hyperledger/fabric-sdk-node/blob/4f62e201624c1e9a14d548808d3524aa93573cd5/fabric-network/lib/contract.js#L21-L27 | train |
hyperledger/fabric-sdk-node | fabric-network/lib/contract.js | verifyNamespace | function verifyNamespace(namespace) {
if (namespace && typeof namespace !== 'string') {
const msg = util.format('Namespace must be a non-empty string: %j', namespace);
logger.error('verifyNamespace:', msg);
throw new Error(msg);
}
} | javascript | function verifyNamespace(namespace) {
if (namespace && typeof namespace !== 'string') {
const msg = util.format('Namespace must be a non-empty string: %j', namespace);
logger.error('verifyNamespace:', msg);
throw new Error(msg);
}
} | [
"function",
"verifyNamespace",
"(",
"namespace",
")",
"{",
"if",
"(",
"namespace",
"&&",
"typeof",
"namespace",
"!==",
"'string'",
")",
"{",
"const",
"msg",
"=",
"util",
".",
"format",
"(",
"'Namespace must be a non-empty string: %j'",
",",
"namespace",
")",
";"... | Ensure that, if a namespace is defined, it is a non-empty string
@private
@param {*} namespace Transaction namespace.
@throws {Error} if the namespace is invalid. | [
"Ensure",
"that",
"if",
"a",
"namespace",
"is",
"defined",
"it",
"is",
"a",
"non",
"-",
"empty",
"string"
] | 4f62e201624c1e9a14d548808d3524aa93573cd5 | https://github.com/hyperledger/fabric-sdk-node/blob/4f62e201624c1e9a14d548808d3524aa93573cd5/fabric-network/lib/contract.js#L35-L41 | train |
hyperledger/fabric-sdk-node | fabric-network/lib/transaction.js | verifyArguments | function verifyArguments(args) {
const isInvalid = args.some((arg) => typeof arg !== 'string');
if (isInvalid) {
const argsString = args.map((arg) => util.format('%j', arg)).join(', ');
const msg = util.format('Transaction arguments must be strings: %s', argsString);
logger.error('verifyArguments:', msg);
thr... | javascript | function verifyArguments(args) {
const isInvalid = args.some((arg) => typeof arg !== 'string');
if (isInvalid) {
const argsString = args.map((arg) => util.format('%j', arg)).join(', ');
const msg = util.format('Transaction arguments must be strings: %s', argsString);
logger.error('verifyArguments:', msg);
thr... | [
"function",
"verifyArguments",
"(",
"args",
")",
"{",
"const",
"isInvalid",
"=",
"args",
".",
"some",
"(",
"(",
"arg",
")",
"=>",
"typeof",
"arg",
"!==",
"'string'",
")",
";",
"if",
"(",
"isInvalid",
")",
"{",
"const",
"argsString",
"=",
"args",
".",
... | Ensure supplied transaction arguments are not strings.
@private
@static
@param {Array} args transaction arguments.
@throws {Error} if any arguments are invalid. | [
"Ensure",
"supplied",
"transaction",
"arguments",
"are",
"not",
"strings",
"."
] | 4f62e201624c1e9a14d548808d3524aa93573cd5 | https://github.com/hyperledger/fabric-sdk-node/blob/4f62e201624c1e9a14d548808d3524aa93573cd5/fabric-network/lib/transaction.js#L27-L35 | train |
hyperledger/fabric-sdk-node | fabric-client/lib/Client.js | _stringToSignature | function _stringToSignature(string_signatures) {
const signatures = [];
for (let signature of string_signatures) {
// check for properties rather than object type
if (signature && signature.signature_header && signature.signature) {
logger.debug('_stringToSignature - signature is protobuf');
} else {
logg... | javascript | function _stringToSignature(string_signatures) {
const signatures = [];
for (let signature of string_signatures) {
// check for properties rather than object type
if (signature && signature.signature_header && signature.signature) {
logger.debug('_stringToSignature - signature is protobuf');
} else {
logg... | [
"function",
"_stringToSignature",
"(",
"string_signatures",
")",
"{",
"const",
"signatures",
"=",
"[",
"]",
";",
"for",
"(",
"let",
"signature",
"of",
"string_signatures",
")",
"{",
"// check for properties rather than object type",
"if",
"(",
"signature",
"&&",
"si... | internal utility method to check and convert any strings to protobuf signatures | [
"internal",
"utility",
"method",
"to",
"check",
"and",
"convert",
"any",
"strings",
"to",
"protobuf",
"signatures"
] | 4f62e201624c1e9a14d548808d3524aa93573cd5 | https://github.com/hyperledger/fabric-sdk-node/blob/4f62e201624c1e9a14d548808d3524aa93573cd5/fabric-client/lib/Client.js#L1868-L1883 | train |
hyperledger/fabric-sdk-node | fabric-client/lib/Client.js | _getNetworkConfig | function _getNetworkConfig(loadConfig, client) {
let network_config = null;
let network_data = null;
let network_config_loc = null;
if (typeof loadConfig === 'string') {
network_config_loc = path.resolve(loadConfig);
logger.debug('%s - looking at absolute path of ==>%s<==', '_getNetworkConfig', network_config_l... | javascript | function _getNetworkConfig(loadConfig, client) {
let network_config = null;
let network_data = null;
let network_config_loc = null;
if (typeof loadConfig === 'string') {
network_config_loc = path.resolve(loadConfig);
logger.debug('%s - looking at absolute path of ==>%s<==', '_getNetworkConfig', network_config_l... | [
"function",
"_getNetworkConfig",
"(",
"loadConfig",
",",
"client",
")",
"{",
"let",
"network_config",
"=",
"null",
";",
"let",
"network_data",
"=",
"null",
";",
"let",
"network_config_loc",
"=",
"null",
";",
"if",
"(",
"typeof",
"loadConfig",
"===",
"'string'"... | internal utility method to get a NetworkConfig | [
"internal",
"utility",
"method",
"to",
"get",
"a",
"NetworkConfig"
] | 4f62e201624c1e9a14d548808d3524aa93573cd5 | https://github.com/hyperledger/fabric-sdk-node/blob/4f62e201624c1e9a14d548808d3524aa93573cd5/fabric-client/lib/Client.js#L1886-L1928 | train |
hyperledger/fabric-sdk-node | fabric-client/lib/Channel.js | _getProposalResponseResults | function _getProposalResponseResults(proposal_response) {
if (!proposal_response.payload) {
throw new Error('Parameter must be a ProposalResponse Object');
}
const payload = _responseProto.ProposalResponsePayload.decode(proposal_response.payload);
const extension = _proposalProto.ChaincodeAction.decode(payload.ex... | javascript | function _getProposalResponseResults(proposal_response) {
if (!proposal_response.payload) {
throw new Error('Parameter must be a ProposalResponse Object');
}
const payload = _responseProto.ProposalResponsePayload.decode(proposal_response.payload);
const extension = _proposalProto.ChaincodeAction.decode(payload.ex... | [
"function",
"_getProposalResponseResults",
"(",
"proposal_response",
")",
"{",
"if",
"(",
"!",
"proposal_response",
".",
"payload",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Parameter must be a ProposalResponse Object'",
")",
";",
"}",
"const",
"payload",
"=",
"_res... | internal utility method to decode and get the write set from a proposal response | [
"internal",
"utility",
"method",
"to",
"decode",
"and",
"get",
"the",
"write",
"set",
"from",
"a",
"proposal",
"response"
] | 4f62e201624c1e9a14d548808d3524aa93573cd5 | https://github.com/hyperledger/fabric-sdk-node/blob/4f62e201624c1e9a14d548808d3524aa93573cd5/fabric-client/lib/Channel.js#L3624-L3634 | train |
sidorares/node-mysql2 | lib/helpers.js | printDebugWithCode | function printDebugWithCode(msg, code) {
// eslint-disable-next-line no-console
console.log(`\n\n${msg}:\n`);
// eslint-disable-next-line no-console
console.log(`${highlightFn(code)}\n`);
} | javascript | function printDebugWithCode(msg, code) {
// eslint-disable-next-line no-console
console.log(`\n\n${msg}:\n`);
// eslint-disable-next-line no-console
console.log(`${highlightFn(code)}\n`);
} | [
"function",
"printDebugWithCode",
"(",
"msg",
",",
"code",
")",
"{",
"// eslint-disable-next-line no-console",
"console",
".",
"log",
"(",
"`",
"\\n",
"\\n",
"${",
"msg",
"}",
"\\n",
"`",
")",
";",
"// eslint-disable-next-line no-console",
"console",
".",
"log",
... | Prints debug message with code frame, will try to use `cardinal` if available. | [
"Prints",
"debug",
"message",
"with",
"code",
"frame",
"will",
"try",
"to",
"use",
"cardinal",
"if",
"available",
"."
] | 0b8ab90df2fdf7ade2961b588c7413428e9fd9f4 | https://github.com/sidorares/node-mysql2/blob/0b8ab90df2fdf7ade2961b588c7413428e9fd9f4/lib/helpers.js#L43-L48 | train |
521dimensions/amplitudejs | dist/visualizations/michaelbromley.js | Polygon | function Polygon( sides, x, y, tileSize, ctx, num, analyser, streamData, tiles, fgRotation ){
this.analyser = analyser;
this.sides = sides;
this.tileSize = tileSize;
this.ctx = ctx;
this.tiles = tiles;
this.fgRotation = fgRotation;
/*
The number of the tile, starting at 0
*/
this.num = num;
/*
The highes... | javascript | function Polygon( sides, x, y, tileSize, ctx, num, analyser, streamData, tiles, fgRotation ){
this.analyser = analyser;
this.sides = sides;
this.tileSize = tileSize;
this.ctx = ctx;
this.tiles = tiles;
this.fgRotation = fgRotation;
/*
The number of the tile, starting at 0
*/
this.num = num;
/*
The highes... | [
"function",
"Polygon",
"(",
"sides",
",",
"x",
",",
"y",
",",
"tileSize",
",",
"ctx",
",",
"num",
",",
"analyser",
",",
"streamData",
",",
"tiles",
",",
"fgRotation",
")",
"{",
"this",
".",
"analyser",
"=",
"analyser",
";",
"this",
".",
"sides",
"=",... | Defines the polygon object.
@param {number} sides
@param {number} x
@param {number} y
@param {number} tileSize
@param {context} ctx
@param {number} num
@param {Uint8Array} streamData
@param {array} tiles
@param {integer} fgRotation | [
"Defines",
"the",
"polygon",
"object",
"."
] | 86eea632f251ebaeb04b3c9ee9c84470d912f298 | https://github.com/521dimensions/amplitudejs/blob/86eea632f251ebaeb04b3c9ee9c84470d912f298/dist/visualizations/michaelbromley.js#L432-L475 | train |
521dimensions/amplitudejs | dist/visualizations/michaelbromley.js | Star | function Star( x, y, starSize, ctx, fgCanvas, analyser, streamData ){
this.x = x;
this.y = y;
this.angle = Math.atan( Math.abs(y) / Math.abs(x) );
this.starSize = starSize;
this.ctx = ctx;
this.high = 0;
this.fgCanvas = fgCanvas;
this.analyser = analyser;
this.streamData = streamData;
} | javascript | function Star( x, y, starSize, ctx, fgCanvas, analyser, streamData ){
this.x = x;
this.y = y;
this.angle = Math.atan( Math.abs(y) / Math.abs(x) );
this.starSize = starSize;
this.ctx = ctx;
this.high = 0;
this.fgCanvas = fgCanvas;
this.analyser = analyser;
this.streamData = streamData;
} | [
"function",
"Star",
"(",
"x",
",",
"y",
",",
"starSize",
",",
"ctx",
",",
"fgCanvas",
",",
"analyser",
",",
"streamData",
")",
"{",
"this",
".",
"x",
"=",
"x",
";",
"this",
".",
"y",
"=",
"y",
";",
"this",
".",
"angle",
"=",
"Math",
".",
"atan"... | Define the star object
@param {number} x
@param {number} y
@param {number} starSize
@param {context} ctx
@param {canvas} fgCanvas
@param {analyser} analyser
@param {Uint8Array} streamData | [
"Define",
"the",
"star",
"object"
] | 86eea632f251ebaeb04b3c9ee9c84470d912f298 | https://github.com/521dimensions/amplitudejs/blob/86eea632f251ebaeb04b3c9ee9c84470d912f298/dist/visualizations/michaelbromley.js#L661-L671 | train |
jsbin/jsbin | public/js/vendor/codemirror3/mode/smarty/smarty.js | function(stream, state) {
if (stream.match(settings.leftDelimiter, true)) {
if (stream.eat("*")) {
return helpers.chain(stream, state, parsers.inBlock("comment", "*" + settings.rightDelimiter));
} else {
// Smarty 3 allows { and } surrounded by whitespace to NOT slip into Smart... | javascript | function(stream, state) {
if (stream.match(settings.leftDelimiter, true)) {
if (stream.eat("*")) {
return helpers.chain(stream, state, parsers.inBlock("comment", "*" + settings.rightDelimiter));
} else {
// Smarty 3 allows { and } surrounded by whitespace to NOT slip into Smart... | [
"function",
"(",
"stream",
",",
"state",
")",
"{",
"if",
"(",
"stream",
".",
"match",
"(",
"settings",
".",
"leftDelimiter",
",",
"true",
")",
")",
"{",
"if",
"(",
"stream",
".",
"eat",
"(",
"\"*\"",
")",
")",
"{",
"return",
"helpers",
".",
"chain"... | the main tokenizer | [
"the",
"main",
"tokenizer"
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/vendor/codemirror3/mode/smarty/smarty.js#L47-L69 | train | |
jsbin/jsbin | public/js/render/edit.js | jsbinShowEdit | function jsbinShowEdit(options) {
'use strict';
if (window.location.hash === '#noedit') {return;}
var moveTimer, over,
doc = document,
aEL = 'addEventListener',
path = options.root + window.location.pathname,
style = doc.createElement('link'),
btn = doc.createElement('a');
// Add button:
btn.id = ... | javascript | function jsbinShowEdit(options) {
'use strict';
if (window.location.hash === '#noedit') {return;}
var moveTimer, over,
doc = document,
aEL = 'addEventListener',
path = options.root + window.location.pathname,
style = doc.createElement('link'),
btn = doc.createElement('a');
// Add button:
btn.id = ... | [
"function",
"jsbinShowEdit",
"(",
"options",
")",
"{",
"'use strict'",
";",
"if",
"(",
"window",
".",
"location",
".",
"hash",
"===",
"'#noedit'",
")",
"{",
"return",
";",
"}",
"var",
"moveTimer",
",",
"over",
",",
"doc",
"=",
"document",
",",
"aEL",
"... | "Edit in JS Bin" button setup | [
"Edit",
"in",
"JS",
"Bin",
"button",
"setup"
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/render/edit.js#L2-L44 | train |
jsbin/jsbin | public/js/vendor/codemirror3/mode/haskell/haskell.js | normal | function normal(source, setState) {
if (source.eatWhile(whiteCharRE)) {
return null;
}
var ch = source.next();
if (specialRE.test(ch)) {
if (ch == '{' && source.eat('-')) {
var t = "comment";
if (source.eat('#')) {
t = "meta";
}
return switchState(s... | javascript | function normal(source, setState) {
if (source.eatWhile(whiteCharRE)) {
return null;
}
var ch = source.next();
if (specialRE.test(ch)) {
if (ch == '{' && source.eat('-')) {
var t = "comment";
if (source.eat('#')) {
t = "meta";
}
return switchState(s... | [
"function",
"normal",
"(",
"source",
",",
"setState",
")",
"{",
"if",
"(",
"source",
".",
"eatWhile",
"(",
"whiteCharRE",
")",
")",
"{",
"return",
"null",
";",
"}",
"var",
"ch",
"=",
"source",
".",
"next",
"(",
")",
";",
"if",
"(",
"specialRE",
"."... | newlines are handled in tokenizer | [
"newlines",
"are",
"handled",
"in",
"tokenizer"
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/vendor/codemirror3/mode/haskell/haskell.js#L19-L110 | train |
jsbin/jsbin | lib/handlers/error.js | function (err, req, res, next) {
err = this.coerceError(err);
if (err instanceof errors.NotFound && req.accepts('html')) {
if (err instanceof errors.BinNotFound) {
if (req.editor) {
return (new BinHandler(this.sandbox)).notFound(req, res, next);
}
}
return this.rend... | javascript | function (err, req, res, next) {
err = this.coerceError(err);
if (err instanceof errors.NotFound && req.accepts('html')) {
if (err instanceof errors.BinNotFound) {
if (req.editor) {
return (new BinHandler(this.sandbox)).notFound(req, res, next);
}
}
return this.rend... | [
"function",
"(",
"err",
",",
"req",
",",
"res",
",",
"next",
")",
"{",
"err",
"=",
"this",
".",
"coerceError",
"(",
"err",
")",
";",
"if",
"(",
"err",
"instanceof",
"errors",
".",
"NotFound",
"&&",
"req",
".",
"accepts",
"(",
"'html'",
")",
")",
... | Handles all types of HTTPError and ensures that the correct type of response is returned depending on the type of content requested. So if you're expecting JSON you should get JSON. | [
"Handles",
"all",
"types",
"of",
"HTTPError",
"and",
"ensures",
"that",
"the",
"correct",
"type",
"of",
"response",
"is",
"returned",
"depending",
"on",
"the",
"type",
"of",
"content",
"requested",
".",
"So",
"if",
"you",
"re",
"expecting",
"JSON",
"you",
... | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/lib/handlers/error.js#L24-L45 | train | |
jsbin/jsbin | lib/handlers/error.js | function (req, res) {
var error = new errors.NotFound('Page Does Not Exist');
if (req.accepts('html') && (req.url.indexOf('/api/') !== 0)) {
this.renderErrorPage('404', error, req, res);
} else {
this.renderError(error, req, res);
}
} | javascript | function (req, res) {
var error = new errors.NotFound('Page Does Not Exist');
if (req.accepts('html') && (req.url.indexOf('/api/') !== 0)) {
this.renderErrorPage('404', error, req, res);
} else {
this.renderError(error, req, res);
}
} | [
"function",
"(",
"req",
",",
"res",
")",
"{",
"var",
"error",
"=",
"new",
"errors",
".",
"NotFound",
"(",
"'Page Does Not Exist'",
")",
";",
"if",
"(",
"req",
".",
"accepts",
"(",
"'html'",
")",
"&&",
"(",
"req",
".",
"url",
".",
"indexOf",
"(",
"'... | Fall through handler for when no routes match. | [
"Fall",
"through",
"handler",
"for",
"when",
"no",
"routes",
"match",
"."
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/lib/handlers/error.js#L48-L55 | train | |
jsbin/jsbin | lib/handlers/error.js | function (err, req, res) {
console.error('uncaughtError', req.method + ' ' + req.url);
this.sendErrorReport(err, req);
if (req.accepts('html')) {
this.renderErrorPage('error', err, req, res);
} else {
var error = new errors.HTTPError(500, 'Internal Server Error');
this.renderError(err... | javascript | function (err, req, res) {
console.error('uncaughtError', req.method + ' ' + req.url);
this.sendErrorReport(err, req);
if (req.accepts('html')) {
this.renderErrorPage('error', err, req, res);
} else {
var error = new errors.HTTPError(500, 'Internal Server Error');
this.renderError(err... | [
"function",
"(",
"err",
",",
"req",
",",
"res",
")",
"{",
"console",
".",
"error",
"(",
"'uncaughtError'",
",",
"req",
".",
"method",
"+",
"' '",
"+",
"req",
".",
"url",
")",
";",
"this",
".",
"sendErrorReport",
"(",
"err",
",",
"req",
")",
";",
... | Displays a friendly 500 page in production if requesting html otherwise returns an appropriate format. | [
"Displays",
"a",
"friendly",
"500",
"page",
"in",
"production",
"if",
"requesting",
"html",
"otherwise",
"returns",
"an",
"appropriate",
"format",
"."
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/lib/handlers/error.js#L59-L69 | train | |
jsbin/jsbin | lib/handlers/error.js | function (err) {
var status = typeof err === 'number' ? err : err.status;
if (!(err instanceof errors.HTTPError) && status) {
return errors.create(status, err.message);
}
return err;
} | javascript | function (err) {
var status = typeof err === 'number' ? err : err.status;
if (!(err instanceof errors.HTTPError) && status) {
return errors.create(status, err.message);
}
return err;
} | [
"function",
"(",
"err",
")",
"{",
"var",
"status",
"=",
"typeof",
"err",
"===",
"'number'",
"?",
"err",
":",
"err",
".",
"status",
";",
"if",
"(",
"!",
"(",
"err",
"instanceof",
"errors",
".",
"HTTPError",
")",
"&&",
"status",
")",
"{",
"return",
"... | Checks to see if the error has a status property and if so converts it into an instance of HTTPError. Just returns this original error if no status is found. | [
"Checks",
"to",
"see",
"if",
"the",
"error",
"has",
"a",
"status",
"property",
"and",
"if",
"so",
"converts",
"it",
"into",
"an",
"instance",
"of",
"HTTPError",
".",
"Just",
"returns",
"this",
"original",
"error",
"if",
"no",
"status",
"is",
"found",
"."... | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/lib/handlers/error.js#L157-L164 | train | |
jsbin/jsbin | public/js/chrome/share.js | formData | function formData(form) {
var length = form.length;
var data = {};
var value;
var el;
var type;
var name;
var append = function (data, name, value) {
if (data[name] === undefined) {
data[name] = value;
} else {
if (typeof data[name] === 'string') {
data... | javascript | function formData(form) {
var length = form.length;
var data = {};
var value;
var el;
var type;
var name;
var append = function (data, name, value) {
if (data[name] === undefined) {
data[name] = value;
} else {
if (typeof data[name] === 'string') {
data... | [
"function",
"formData",
"(",
"form",
")",
"{",
"var",
"length",
"=",
"form",
".",
"length",
";",
"var",
"data",
"=",
"{",
"}",
";",
"var",
"value",
";",
"var",
"el",
";",
"var",
"type",
";",
"var",
"name",
";",
"var",
"append",
"=",
"function",
"... | get an object representation of a form's state | [
"get",
"an",
"object",
"representation",
"of",
"a",
"form",
"s",
"state"
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/chrome/share.js#L79-L121 | train |
jsbin/jsbin | public/js/vendor/codemirror3/mode/haml/haml.js | function() {
var htmlState = htmlMode.startState();
var rubyState = rubyMode.startState();
return {
htmlState: htmlState,
rubyState: rubyState,
indented: 0,
previousToken: { style: null, indented: 0},
tokenize: html
};
} | javascript | function() {
var htmlState = htmlMode.startState();
var rubyState = rubyMode.startState();
return {
htmlState: htmlState,
rubyState: rubyState,
indented: 0,
previousToken: { style: null, indented: 0},
tokenize: html
};
} | [
"function",
"(",
")",
"{",
"var",
"htmlState",
"=",
"htmlMode",
".",
"startState",
"(",
")",
";",
"var",
"rubyState",
"=",
"rubyMode",
".",
"startState",
"(",
")",
";",
"return",
"{",
"htmlState",
":",
"htmlState",
",",
"rubyState",
":",
"rubyState",
","... | default to html mode | [
"default",
"to",
"html",
"mode"
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/vendor/codemirror3/mode/haml/haml.js#L88-L98 | train | |
jsbin/jsbin | public/js/vendor/codemirror3/mode/htmlembedded/htmlembedded.js | htmlDispatch | function htmlDispatch(stream, state) {
if (stream.match(scriptStartRegex, false)) {
state.token=scriptingDispatch;
return scriptingMode.token(stream, state.scriptState);
}
else
return htmlMixedMode.token(stream, state.htmlState);
} | javascript | function htmlDispatch(stream, state) {
if (stream.match(scriptStartRegex, false)) {
state.token=scriptingDispatch;
return scriptingMode.token(stream, state.scriptState);
}
else
return htmlMixedMode.token(stream, state.htmlState);
} | [
"function",
"htmlDispatch",
"(",
"stream",
",",
"state",
")",
"{",
"if",
"(",
"stream",
".",
"match",
"(",
"scriptStartRegex",
",",
"false",
")",
")",
"{",
"state",
".",
"token",
"=",
"scriptingDispatch",
";",
"return",
"scriptingMode",
".",
"token",
"(",
... | tokenizer when in html mode | [
"tokenizer",
"when",
"in",
"html",
"mode"
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/vendor/codemirror3/mode/htmlembedded/htmlembedded.js#L11-L18 | train |
jsbin/jsbin | public/js/vendor/codemirror3/keymap/vim.js | function(cm, key) {
var command;
var vim = maybeInitVimState(cm);
var macroModeState = vimGlobalState.macroModeState;
if (macroModeState.enteredMacroMode) {
if (key == 'q') {
actions.exitMacroRecordMode();
vim.inputState = new InputState();
r... | javascript | function(cm, key) {
var command;
var vim = maybeInitVimState(cm);
var macroModeState = vimGlobalState.macroModeState;
if (macroModeState.enteredMacroMode) {
if (key == 'q') {
actions.exitMacroRecordMode();
vim.inputState = new InputState();
r... | [
"function",
"(",
"cm",
",",
"key",
")",
"{",
"var",
"command",
";",
"var",
"vim",
"=",
"maybeInitVimState",
"(",
"cm",
")",
";",
"var",
"macroModeState",
"=",
"vimGlobalState",
".",
"macroModeState",
";",
"if",
"(",
"macroModeState",
".",
"enteredMacroMode",... | This is the outermost function called by CodeMirror, after keys have been mapped to their Vim equivalents. | [
"This",
"is",
"the",
"outermost",
"function",
"called",
"by",
"CodeMirror",
"after",
"keys",
"have",
"been",
"mapped",
"to",
"their",
"Vim",
"equivalents",
"."
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/vendor/codemirror3/keymap/vim.js#L588-L637 | train | |
jsbin/jsbin | public/js/vendor/codemirror3/keymap/vim.js | InputState | function InputState() {
this.prefixRepeat = [];
this.motionRepeat = [];
this.operator = null;
this.operatorArgs = null;
this.motion = null;
this.motionArgs = null;
this.keyBuffer = []; // For matching multi-key commands.
this.registerName = null; // Defaults to the uname... | javascript | function InputState() {
this.prefixRepeat = [];
this.motionRepeat = [];
this.operator = null;
this.operatorArgs = null;
this.motion = null;
this.motionArgs = null;
this.keyBuffer = []; // For matching multi-key commands.
this.registerName = null; // Defaults to the uname... | [
"function",
"InputState",
"(",
")",
"{",
"this",
".",
"prefixRepeat",
"=",
"[",
"]",
";",
"this",
".",
"motionRepeat",
"=",
"[",
"]",
";",
"this",
".",
"operator",
"=",
"null",
";",
"this",
".",
"operatorArgs",
"=",
"null",
";",
"this",
".",
"motion"... | Represents the current input state. | [
"Represents",
"the",
"current",
"input",
"state",
"."
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/vendor/codemirror3/keymap/vim.js#L644-L654 | train |
jsbin/jsbin | public/js/vendor/codemirror3/keymap/vim.js | function(name) {
if (!this.isValidRegister(name)) {
return this.unamedRegister;
}
name = name.toLowerCase();
if (!this.registers[name]) {
this.registers[name] = new Register();
}
return this.registers[name];
} | javascript | function(name) {
if (!this.isValidRegister(name)) {
return this.unamedRegister;
}
name = name.toLowerCase();
if (!this.registers[name]) {
this.registers[name] = new Register();
}
return this.registers[name];
} | [
"function",
"(",
"name",
")",
"{",
"if",
"(",
"!",
"this",
".",
"isValidRegister",
"(",
"name",
")",
")",
"{",
"return",
"this",
".",
"unamedRegister",
";",
"}",
"name",
"=",
"name",
".",
"toLowerCase",
"(",
")",
";",
"if",
"(",
"!",
"this",
".",
... | Gets the register named @name. If one of @name doesn't already exist, create it. If @name is invalid, return the unamedRegister. | [
"Gets",
"the",
"register",
"named"
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/vendor/codemirror3/keymap/vim.js#L776-L785 | train | |
jsbin/jsbin | public/js/vendor/codemirror3/keymap/vim.js | getFullyMatchedCommandOrNull | function getFullyMatchedCommandOrNull(command) {
if (keys.length < command.keys.length) {
// Matches part of a multi-key command. Buffer and wait for next
// stroke.
inputState.keyBuffer.push(key);
return null;
} else {
if (command.keys[key... | javascript | function getFullyMatchedCommandOrNull(command) {
if (keys.length < command.keys.length) {
// Matches part of a multi-key command. Buffer and wait for next
// stroke.
inputState.keyBuffer.push(key);
return null;
} else {
if (command.keys[key... | [
"function",
"getFullyMatchedCommandOrNull",
"(",
"command",
")",
"{",
"if",
"(",
"keys",
".",
"length",
"<",
"command",
".",
"keys",
".",
"length",
")",
"{",
"// Matches part of a multi-key command. Buffer and wait for next",
"// stroke.",
"inputState",
".",
"keyBuffer"... | Returns the command if it is a full match, or null if not. | [
"Returns",
"the",
"command",
"if",
"it",
"is",
"a",
"full",
"match",
"or",
"null",
"if",
"not",
"."
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/vendor/codemirror3/keymap/vim.js#L834-L848 | train |
jsbin/jsbin | public/js/vendor/codemirror3/keymap/vim.js | function(cm, operatorArgs, _vim, curStart, curEnd) {
// If the ending line is past the last line, inclusive, instead of
// including the trailing \n, include the \n before the starting line
if (operatorArgs.linewise &&
curEnd.line > cm.lastLine() && curStart.line > cm.firstLine()) {
... | javascript | function(cm, operatorArgs, _vim, curStart, curEnd) {
// If the ending line is past the last line, inclusive, instead of
// including the trailing \n, include the \n before the starting line
if (operatorArgs.linewise &&
curEnd.line > cm.lastLine() && curStart.line > cm.firstLine()) {
... | [
"function",
"(",
"cm",
",",
"operatorArgs",
",",
"_vim",
",",
"curStart",
",",
"curEnd",
")",
"{",
"// If the ending line is past the last line, inclusive, instead of",
"// including the trailing \\n, include the \\n before the starting line",
"if",
"(",
"operatorArgs",
".",
"l... | delete is a javascript keyword. | [
"delete",
"is",
"a",
"javascript",
"keyword",
"."
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/vendor/codemirror3/keymap/vim.js#L1595-L1612 | train | |
jsbin/jsbin | public/js/vendor/codemirror3/keymap/vim.js | isInRange | function isInRange(pos, start, end) {
if (typeof pos != 'number') {
// Assume it is a cursor position. Get the line number.
pos = pos.line;
}
if (start instanceof Array) {
return inArray(pos, start);
} else {
if (end) {
return (pos >= start && pos <= end... | javascript | function isInRange(pos, start, end) {
if (typeof pos != 'number') {
// Assume it is a cursor position. Get the line number.
pos = pos.line;
}
if (start instanceof Array) {
return inArray(pos, start);
} else {
if (end) {
return (pos >= start && pos <= end... | [
"function",
"isInRange",
"(",
"pos",
",",
"start",
",",
"end",
")",
"{",
"if",
"(",
"typeof",
"pos",
"!=",
"'number'",
")",
"{",
"// Assume it is a cursor position. Get the line number.",
"pos",
"=",
"pos",
".",
"line",
";",
"}",
"if",
"(",
"start",
"instanc... | Check if pos is in the specified range, INCLUSIVE.
Range can be specified with 1 or 2 arguments.
If the first range argument is an array, treat it as an array of line
numbers. Match pos against any of the lines.
If the first range argument is a number,
if there is only 1 range argument, check if pos has the same line
n... | [
"Check",
"if",
"pos",
"is",
"in",
"the",
"specified",
"range",
"INCLUSIVE",
".",
"Range",
"can",
"be",
"specified",
"with",
"1",
"or",
"2",
"arguments",
".",
"If",
"the",
"first",
"range",
"argument",
"is",
"an",
"array",
"treat",
"it",
"as",
"an",
"ar... | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/vendor/codemirror3/keymap/vim.js#L2936-L2950 | train |
jsbin/jsbin | public/js/vendor/codemirror3/keymap/vim.js | buildVimKeyMap | function buildVimKeyMap() {
/**
* Handle the raw key event from CodeMirror. Translate the
* Shift + key modifier to the resulting letter, while preserving other
* modifers.
*/
// TODO: Figure out a way to catch capslock.
function cmKeyToVimKey(key, modifier) {
var v... | javascript | function buildVimKeyMap() {
/**
* Handle the raw key event from CodeMirror. Translate the
* Shift + key modifier to the resulting letter, while preserving other
* modifers.
*/
// TODO: Figure out a way to catch capslock.
function cmKeyToVimKey(key, modifier) {
var v... | [
"function",
"buildVimKeyMap",
"(",
")",
"{",
"/**\n * Handle the raw key event from CodeMirror. Translate the\n * Shift + key modifier to the resulting letter, while preserving other\n * modifers.\n */",
"// TODO: Figure out a way to catch capslock.",
"function",
"cmKeyToVimK... | Register Vim with CodeMirror | [
"Register",
"Vim",
"with",
"CodeMirror"
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/vendor/codemirror3/keymap/vim.js#L3492-L3555 | train |
jsbin/jsbin | public/js/vendor/codemirror3/keymap/vim.js | onChange | function onChange(_cm, changeObj) {
var macroModeState = vimGlobalState.macroModeState;
var lastChange = macroModeState.lastInsertModeChanges;
while (changeObj) {
lastChange.expectCursorActivityForChange = true;
if (changeObj.origin == '+input' || changeObj.origin == 'paste'
... | javascript | function onChange(_cm, changeObj) {
var macroModeState = vimGlobalState.macroModeState;
var lastChange = macroModeState.lastInsertModeChanges;
while (changeObj) {
lastChange.expectCursorActivityForChange = true;
if (changeObj.origin == '+input' || changeObj.origin == 'paste'
... | [
"function",
"onChange",
"(",
"_cm",
",",
"changeObj",
")",
"{",
"var",
"macroModeState",
"=",
"vimGlobalState",
".",
"macroModeState",
";",
"var",
"lastChange",
"=",
"macroModeState",
".",
"lastInsertModeChanges",
";",
"while",
"(",
"changeObj",
")",
"{",
"lastC... | Listens for changes made in insert mode.
Should only be active in insert mode. | [
"Listens",
"for",
"changes",
"made",
"in",
"insert",
"mode",
".",
"Should",
"only",
"be",
"active",
"in",
"insert",
"mode",
"."
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/vendor/codemirror3/keymap/vim.js#L3647-L3660 | train |
jsbin/jsbin | public/js/vendor/codemirror3/keymap/vim.js | onCursorActivity | function onCursorActivity() {
var macroModeState = vimGlobalState.macroModeState;
var lastChange = macroModeState.lastInsertModeChanges;
if (lastChange.expectCursorActivityForChange) {
lastChange.expectCursorActivityForChange = false;
} else {
// Cursor moved outside the context ... | javascript | function onCursorActivity() {
var macroModeState = vimGlobalState.macroModeState;
var lastChange = macroModeState.lastInsertModeChanges;
if (lastChange.expectCursorActivityForChange) {
lastChange.expectCursorActivityForChange = false;
} else {
// Cursor moved outside the context ... | [
"function",
"onCursorActivity",
"(",
")",
"{",
"var",
"macroModeState",
"=",
"vimGlobalState",
".",
"macroModeState",
";",
"var",
"lastChange",
"=",
"macroModeState",
".",
"lastInsertModeChanges",
";",
"if",
"(",
"lastChange",
".",
"expectCursorActivityForChange",
")"... | Listens for any kind of cursor activity on CodeMirror.
- For tracking cursor activity in insert mode.
- Should only be active in insert mode. | [
"Listens",
"for",
"any",
"kind",
"of",
"cursor",
"activity",
"on",
"CodeMirror",
".",
"-",
"For",
"tracking",
"cursor",
"activity",
"in",
"insert",
"mode",
".",
"-",
"Should",
"only",
"be",
"active",
"in",
"insert",
"mode",
"."
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/vendor/codemirror3/keymap/vim.js#L3667-L3676 | train |
jsbin/jsbin | public/js/vendor/codemirror3/keymap/vim.js | onKeyEventTargetKeyDown | function onKeyEventTargetKeyDown(e) {
var macroModeState = vimGlobalState.macroModeState;
var lastChange = macroModeState.lastInsertModeChanges;
var keyName = CodeMirror.keyName(e);
function onKeyFound() {
lastChange.changes.push(new InsertModeKey(keyName));
return true;
}
... | javascript | function onKeyEventTargetKeyDown(e) {
var macroModeState = vimGlobalState.macroModeState;
var lastChange = macroModeState.lastInsertModeChanges;
var keyName = CodeMirror.keyName(e);
function onKeyFound() {
lastChange.changes.push(new InsertModeKey(keyName));
return true;
}
... | [
"function",
"onKeyEventTargetKeyDown",
"(",
"e",
")",
"{",
"var",
"macroModeState",
"=",
"vimGlobalState",
".",
"macroModeState",
";",
"var",
"lastChange",
"=",
"macroModeState",
".",
"lastInsertModeChanges",
";",
"var",
"keyName",
"=",
"CodeMirror",
".",
"keyName",... | Handles raw key down events from the text area.
- Should only be active in insert mode.
- For recording deletes in insert mode. | [
"Handles",
"raw",
"key",
"down",
"events",
"from",
"the",
"text",
"area",
".",
"-",
"Should",
"only",
"be",
"active",
"in",
"insert",
"mode",
".",
"-",
"For",
"recording",
"deletes",
"in",
"insert",
"mode",
"."
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/vendor/codemirror3/keymap/vim.js#L3688-L3699 | train |
jsbin/jsbin | public/js/vendor/codemirror3/keymap/vim.js | repeatLastEdit | function repeatLastEdit(cm, vim, repeat, repeatForInsert) {
var macroModeState = vimGlobalState.macroModeState;
macroModeState.inReplay = true;
var isAction = !!vim.lastEditActionCommand;
var cachedInputState = vim.inputState;
function repeatCommand() {
if (isAction) {
co... | javascript | function repeatLastEdit(cm, vim, repeat, repeatForInsert) {
var macroModeState = vimGlobalState.macroModeState;
macroModeState.inReplay = true;
var isAction = !!vim.lastEditActionCommand;
var cachedInputState = vim.inputState;
function repeatCommand() {
if (isAction) {
co... | [
"function",
"repeatLastEdit",
"(",
"cm",
",",
"vim",
",",
"repeat",
",",
"repeatForInsert",
")",
"{",
"var",
"macroModeState",
"=",
"vimGlobalState",
".",
"macroModeState",
";",
"macroModeState",
".",
"inReplay",
"=",
"true",
";",
"var",
"isAction",
"=",
"!",
... | Repeats the last edit, which includes exactly 1 command and at most 1
insert. Operator and motion commands are read from lastEditInputState,
while action commands are read from lastEditActionCommand.
If repeatForInsert is true, then the function was called by
exitInsertMode to repeat the insert mode changes the user j... | [
"Repeats",
"the",
"last",
"edit",
"which",
"includes",
"exactly",
"1",
"command",
"and",
"at",
"most",
"1",
"insert",
".",
"Operator",
"and",
"motion",
"commands",
"are",
"read",
"from",
"lastEditInputState",
"while",
"action",
"commands",
"are",
"read",
"from... | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/vendor/codemirror3/keymap/vim.js#L3710-L3754 | train |
jsbin/jsbin | public/js/vendor/pretty-date.js | prettyDate | function prettyDate(time){
'use strict';
// Remy Sharp edit: July 13, 2014 specific to JS Bin
// Need to replace Z in ISO8601 timestamp with +0000 so prettyDate() doesn't
// completely remove it (and parse the date using the local timezone).
var date = new Date((time || '').replace('Z', '+0000').replace(/-/... | javascript | function prettyDate(time){
'use strict';
// Remy Sharp edit: July 13, 2014 specific to JS Bin
// Need to replace Z in ISO8601 timestamp with +0000 so prettyDate() doesn't
// completely remove it (and parse the date using the local timezone).
var date = new Date((time || '').replace('Z', '+0000').replace(/-/... | [
"function",
"prettyDate",
"(",
"time",
")",
"{",
"'use strict'",
";",
"// Remy Sharp edit: July 13, 2014 specific to JS Bin",
"// Need to replace Z in ISO8601 timestamp with +0000 so prettyDate() doesn't",
"// completely remove it (and parse the date using the local timezone).",
"var",
"date... | Takes an ISO time and returns a string representing how long ago the date represents. | [
"Takes",
"an",
"ISO",
"time",
"and",
"returns",
"a",
"string",
"representing",
"how",
"long",
"ago",
"the",
"date",
"represents",
"."
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/vendor/pretty-date.js#L9-L31 | train |
jsbin/jsbin | public/js/editors/tern.js | function(name, file) {
if (!ternLoaded[name]) {
$.ajax({
url: file,
dataType: 'json',
success: function(data) {
addTernDefinition(data);
ternLoaded[name] = true;
}
});
}
} | javascript | function(name, file) {
if (!ternLoaded[name]) {
$.ajax({
url: file,
dataType: 'json',
success: function(data) {
addTernDefinition(data);
ternLoaded[name] = true;
}
});
}
} | [
"function",
"(",
"name",
",",
"file",
")",
"{",
"if",
"(",
"!",
"ternLoaded",
"[",
"name",
"]",
")",
"{",
"$",
".",
"ajax",
"(",
"{",
"url",
":",
"file",
",",
"dataType",
":",
"'json'",
",",
"success",
":",
"function",
"(",
"data",
")",
"{",
"a... | Load the json defition of the library | [
"Load",
"the",
"json",
"defition",
"of",
"the",
"library"
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/editors/tern.js#L43-L54 | train | |
jsbin/jsbin | public/js/editors/tern.js | function(name, file) {
if (!ternLoaded[name]) {
$.ajax({
url: file,
dataType: 'script',
success: function(data) {
ternServer.server.addFile(name, data);
ternLoaded[name] = true;
}
});
}
} | javascript | function(name, file) {
if (!ternLoaded[name]) {
$.ajax({
url: file,
dataType: 'script',
success: function(data) {
ternServer.server.addFile(name, data);
ternLoaded[name] = true;
}
});
}
} | [
"function",
"(",
"name",
",",
"file",
")",
"{",
"if",
"(",
"!",
"ternLoaded",
"[",
"name",
"]",
")",
"{",
"$",
".",
"ajax",
"(",
"{",
"url",
":",
"file",
",",
"dataType",
":",
"'script'",
",",
"success",
":",
"function",
"(",
"data",
")",
"{",
... | Load the actual js library | [
"Load",
"the",
"actual",
"js",
"library"
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/editors/tern.js#L57-L68 | train | |
jsbin/jsbin | lib/models/bin.js | function (data, fn) {
this.store.generateBinId(data.length, 0, function generateBinId(err, id) {
if (err) {
return fn(err);
}
data.url = id;
data.revision = 1;
data.latest = true;
data.streamingKey = this.createStreamingKey(id, data.revision);
this.store.setBin(dat... | javascript | function (data, fn) {
this.store.generateBinId(data.length, 0, function generateBinId(err, id) {
if (err) {
return fn(err);
}
data.url = id;
data.revision = 1;
data.latest = true;
data.streamingKey = this.createStreamingKey(id, data.revision);
this.store.setBin(dat... | [
"function",
"(",
"data",
",",
"fn",
")",
"{",
"this",
".",
"store",
".",
"generateBinId",
"(",
"data",
".",
"length",
",",
"0",
",",
"function",
"generateBinId",
"(",
"err",
",",
"id",
")",
"{",
"if",
"(",
"err",
")",
"{",
"return",
"fn",
"(",
"e... | Create a new bin. | [
"Create",
"a",
"new",
"bin",
"."
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/lib/models/bin.js#L103-L118 | train | |
jsbin/jsbin | lib/models/bin.js | function (data, fn) {
data.streamingKey = this.createStreamingKey(data.url, data.revision);
this.store.setBin(data, function (err, id) {
data.id = id;
fn(err || null, err ? undefined : data);
});
} | javascript | function (data, fn) {
data.streamingKey = this.createStreamingKey(data.url, data.revision);
this.store.setBin(data, function (err, id) {
data.id = id;
fn(err || null, err ? undefined : data);
});
} | [
"function",
"(",
"data",
",",
"fn",
")",
"{",
"data",
".",
"streamingKey",
"=",
"this",
".",
"createStreamingKey",
"(",
"data",
".",
"url",
",",
"data",
".",
"revision",
")",
";",
"this",
".",
"store",
".",
"setBin",
"(",
"data",
",",
"function",
"("... | Create a new revision. | [
"Create",
"a",
"new",
"revision",
"."
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/lib/models/bin.js#L120-L126 | train | |
jsbin/jsbin | lib/spike/index.js | function (req, res, next) {
// Check request's accepts header for event-stream. Move on if it doesn't
// support it.
if (!req.headers.accept || req.headers.accept.indexOf('text/event-stream') === -1) {
return next();
}
// Restore or create a session for the bin
var session = utils.sessio... | javascript | function (req, res, next) {
// Check request's accepts header for event-stream. Move on if it doesn't
// support it.
if (!req.headers.accept || req.headers.accept.indexOf('text/event-stream') === -1) {
return next();
}
// Restore or create a session for the bin
var session = utils.sessio... | [
"function",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"// Check request's accepts header for event-stream. Move on if it doesn't",
"// support it.",
"if",
"(",
"!",
"req",
".",
"headers",
".",
"accept",
"||",
"req",
".",
"headers",
".",
"accept",
".",
"indexO... | Setup an event stream for the client. This is hit on all bin endpoints. | [
"Setup",
"an",
"event",
"stream",
"for",
"the",
"client",
".",
"This",
"is",
"hit",
"on",
"all",
"bin",
"endpoints",
"."
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/lib/spike/index.js#L174-L267 | train | |
jsbin/jsbin | lib/spike/index.js | function (bin) {
var session = utils.sessionForBin(bin);
if (session) {
session.res.forEach(function (res) {
res.write('event: reload\ndata: 0\n\n');
if (res.ajax) {
res.end(); // lets older browsers finish their xhr request
res.req.emit('close');
}
});
... | javascript | function (bin) {
var session = utils.sessionForBin(bin);
if (session) {
session.res.forEach(function (res) {
res.write('event: reload\ndata: 0\n\n');
if (res.ajax) {
res.end(); // lets older browsers finish their xhr request
res.req.emit('close');
}
});
... | [
"function",
"(",
"bin",
")",
"{",
"var",
"session",
"=",
"utils",
".",
"sessionForBin",
"(",
"bin",
")",
";",
"if",
"(",
"session",
")",
"{",
"session",
".",
"res",
".",
"forEach",
"(",
"function",
"(",
"res",
")",
"{",
"res",
".",
"write",
"(",
... | Reload all connected clients | [
"Reload",
"all",
"connected",
"clients"
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/lib/spike/index.js#L272-L285 | train | |
jsbin/jsbin | lib/spike/index.js | function (oldBin, newBin) {
if (!newBin || !newBin.url) {
// FIXME this is just patching a problem, the source of which I'm not sure
console.error('spike/index.js#bump-revision - missing newBin', newBin);
return;
}
var oldSession = utils.sessionForBin(oldBin),
oldKey = utils.keyF... | javascript | function (oldBin, newBin) {
if (!newBin || !newBin.url) {
// FIXME this is just patching a problem, the source of which I'm not sure
console.error('spike/index.js#bump-revision - missing newBin', newBin);
return;
}
var oldSession = utils.sessionForBin(oldBin),
oldKey = utils.keyF... | [
"function",
"(",
"oldBin",
",",
"newBin",
")",
"{",
"if",
"(",
"!",
"newBin",
"||",
"!",
"newBin",
".",
"url",
")",
"{",
"// FIXME this is just patching a problem, the source of which I'm not sure",
"console",
".",
"error",
"(",
"'spike/index.js#bump-revision - missing ... | Update spikes when a new revision is created. | [
"Update",
"spikes",
"when",
"a",
"new",
"revision",
"is",
"created",
"."
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/lib/spike/index.js#L318-L353 | train | |
jsbin/jsbin | lib/spike/index.js | function (bin, data, statsRequest) {
var id = bin.id,
delayTrigger = 500;
if (!pending[id]) {
pending[id] = {};
}
pending[id].bin = bin;
pending[id][data.panelId] = utils.process(data, bin.settings);
// Clear the previous ping
clearTimeout(pending[id].timer);
// NOTE: t... | javascript | function (bin, data, statsRequest) {
var id = bin.id,
delayTrigger = 500;
if (!pending[id]) {
pending[id] = {};
}
pending[id].bin = bin;
pending[id][data.panelId] = utils.process(data, bin.settings);
// Clear the previous ping
clearTimeout(pending[id].timer);
// NOTE: t... | [
"function",
"(",
"bin",
",",
"data",
",",
"statsRequest",
")",
"{",
"var",
"id",
"=",
"bin",
".",
"id",
",",
"delayTrigger",
"=",
"500",
";",
"if",
"(",
"!",
"pending",
"[",
"id",
"]",
")",
"{",
"pending",
"[",
"id",
"]",
"=",
"{",
"}",
";",
... | Notify connected clients of an update to a bin | [
"Notify",
"connected",
"clients",
"of",
"an",
"update",
"to",
"a",
"bin"
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/lib/spike/index.js#L358-L408 | train | |
jsbin/jsbin | lib/middleware.js | function () {
return function (req, res, next) {
var headers = req.header('Access-Control-Request-Headers');
var origin = req.header('Origin');
// TODO should this check if the request is via the API?
if (req.method === 'OPTIONS' || (req.method === 'GET' && req.headers.origin)) {
re... | javascript | function () {
return function (req, res, next) {
var headers = req.header('Access-Control-Request-Headers');
var origin = req.header('Origin');
// TODO should this check if the request is via the API?
if (req.method === 'OPTIONS' || (req.method === 'GET' && req.headers.origin)) {
re... | [
"function",
"(",
")",
"{",
"return",
"function",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"headers",
"=",
"req",
".",
"header",
"(",
"'Access-Control-Request-Headers'",
")",
";",
"var",
"origin",
"=",
"req",
".",
"header",
"(",
"'Origin'",
... | Add relevant CORS headers for the application. | [
"Add",
"relevant",
"CORS",
"headers",
"for",
"the",
"application",
"."
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/lib/middleware.js#L40-L61 | train | |
jsbin/jsbin | lib/middleware.js | function (options) {
var ignore = options.ignore || [],
csrf = csurf(options),
always = {OPTIONS: 1, GET: 1, HEAD: 1};
return function (req, res, next) {
if (always[req.method]) {
return csrf(req, res, next);
} else {
var url = parse(req.url);
var skipCSRF = ... | javascript | function (options) {
var ignore = options.ignore || [],
csrf = csurf(options),
always = {OPTIONS: 1, GET: 1, HEAD: 1};
return function (req, res, next) {
if (always[req.method]) {
return csrf(req, res, next);
} else {
var url = parse(req.url);
var skipCSRF = ... | [
"function",
"(",
"options",
")",
"{",
"var",
"ignore",
"=",
"options",
".",
"ignore",
"||",
"[",
"]",
",",
"csrf",
"=",
"csurf",
"(",
"options",
")",
",",
"always",
"=",
"{",
"OPTIONS",
":",
"1",
",",
"GET",
":",
"1",
",",
"HEAD",
":",
"1",
"}"... | monkey patch for express' own csrf method, so we can ignore specific url patterns | [
"monkey",
"patch",
"for",
"express",
"own",
"csrf",
"method",
"so",
"we",
"can",
"ignore",
"specific",
"url",
"patterns"
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/lib/middleware.js#L118-L149 | train | |
jsbin/jsbin | lib/middleware.js | function () {
return function (req, res, next) {
var apphost = config.url.host,
outputHost = undefsafe(config, 'security.preview'),
host = req.header('Host', ''),
offset = host.indexOf(apphost);
if (host === outputHost) {
offset = host.indexOf(outputHost);
}
... | javascript | function () {
return function (req, res, next) {
var apphost = config.url.host,
outputHost = undefsafe(config, 'security.preview'),
host = req.header('Host', ''),
offset = host.indexOf(apphost);
if (host === outputHost) {
offset = host.indexOf(outputHost);
}
... | [
"function",
"(",
")",
"{",
"return",
"function",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"apphost",
"=",
"config",
".",
"url",
".",
"host",
",",
"outputHost",
"=",
"undefsafe",
"(",
"config",
",",
"'security.preview'",
")",
",",
"host",
... | Checks for a subdomain in the current url, if found it sets the req.subdomain property. This supports existing behaviour that allows subdomains to load custom config files. | [
"Checks",
"for",
"a",
"subdomain",
"in",
"the",
"current",
"url",
"if",
"found",
"it",
"sets",
"the",
"req",
".",
"subdomain",
"property",
".",
"This",
"supports",
"existing",
"behaviour",
"that",
"allows",
"subdomains",
"to",
"load",
"custom",
"config",
"fi... | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/lib/middleware.js#L153-L171 | train | |
jsbin/jsbin | lib/middleware.js | function (options) {
// Parse a string representing a file size and convert it into bytes.
// A number on it's own will be assumed to be bytes. A multiple such as
// "k" or "m" can be appended to the string to handle larger numbers. This
// is case insensitive and uses powers of 1024 rather than (1000).... | javascript | function (options) {
// Parse a string representing a file size and convert it into bytes.
// A number on it's own will be assumed to be bytes. A multiple such as
// "k" or "m" can be appended to the string to handle larger numbers. This
// is case insensitive and uses powers of 1024 rather than (1000).... | [
"function",
"(",
"options",
")",
"{",
"// Parse a string representing a file size and convert it into bytes.",
"// A number on it's own will be assumed to be bytes. A multiple such as",
"// \"k\" or \"m\" can be appended to the string to handle larger numbers. This",
"// is case insensitive and uses... | Limit the file size that can be uploaded. | [
"Limit",
"the",
"file",
"size",
"that",
"can",
"be",
"uploaded",
"."
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/lib/middleware.js#L174-L211 | train | |
jsbin/jsbin | lib/middleware.js | function () {
return function (req, res, next) {
var userModel = models.user;
if (req.url.indexOf('/api') === 0) {
req.isApi = true;
// Make the API requests stateless by removin the cookie set by middleware cookieSession
onHeaders(res, () => res.removeHeader('Set-Cookie'));
... | javascript | function () {
return function (req, res, next) {
var userModel = models.user;
if (req.url.indexOf('/api') === 0) {
req.isApi = true;
// Make the API requests stateless by removin the cookie set by middleware cookieSession
onHeaders(res, () => res.removeHeader('Set-Cookie'));
... | [
"function",
"(",
")",
"{",
"return",
"function",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"userModel",
"=",
"models",
".",
"user",
";",
"if",
"(",
"req",
".",
"url",
".",
"indexOf",
"(",
"'/api'",
")",
"===",
"0",
")",
"{",
"req",
... | detect if this is an API request and add flag isApi to the request object | [
"detect",
"if",
"this",
"is",
"an",
"API",
"request",
"and",
"add",
"flag",
"isApi",
"to",
"the",
"request",
"object"
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/lib/middleware.js#L214-L278 | train | |
jsbin/jsbin | public/js/render/console.js | function (cmd, cb) {
var internalCmd = internalCommand(cmd);
if (internalCmd) {
return cb(['info', internalCmd]);
}
$document.trigger('console:run', cmd);
} | javascript | function (cmd, cb) {
var internalCmd = internalCommand(cmd);
if (internalCmd) {
return cb(['info', internalCmd]);
}
$document.trigger('console:run', cmd);
} | [
"function",
"(",
"cmd",
",",
"cb",
")",
"{",
"var",
"internalCmd",
"=",
"internalCommand",
"(",
"cmd",
")",
";",
"if",
"(",
"internalCmd",
")",
"{",
"return",
"cb",
"(",
"[",
"'info'",
",",
"internalCmd",
"]",
")",
";",
"}",
"$document",
".",
"trigge... | Run a console command. | [
"Run",
"a",
"console",
"command",
"."
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/render/console.js#L22-L28 | train | |
jsbin/jsbin | public/js/render/console.js | function (cmd, blind, response) {
var toecho = '';
if (typeof cmd !== 'string') {
toecho = cmd.echo;
blind = cmd.blind;
response = cmd.response;
cmd = cmd.cmd;
} else {
toecho = cmd;
}
cmd = trim(cmd);
// Add the command to the user's history – unless this was blind
if (!blind) {
... | javascript | function (cmd, blind, response) {
var toecho = '';
if (typeof cmd !== 'string') {
toecho = cmd.echo;
blind = cmd.blind;
response = cmd.response;
cmd = cmd.cmd;
} else {
toecho = cmd;
}
cmd = trim(cmd);
// Add the command to the user's history – unless this was blind
if (!blind) {
... | [
"function",
"(",
"cmd",
",",
"blind",
",",
"response",
")",
"{",
"var",
"toecho",
"=",
"''",
";",
"if",
"(",
"typeof",
"cmd",
"!==",
"'string'",
")",
"{",
"toecho",
"=",
"cmd",
".",
"echo",
";",
"blind",
"=",
"cmd",
".",
"blind",
";",
"response",
... | Run and show response to a command fired from the console | [
"Run",
"and",
"show",
"response",
"to",
"a",
"command",
"fired",
"from",
"the",
"console"
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/render/console.js#L33-L62 | train | |
jsbin/jsbin | public/js/render/console.js | function (response) {
// order so it appears at the top
var el = document.createElement('div'),
li = document.createElement('li'),
span = document.createElement('span'),
parent = output.parentNode;
historyPosition = history.length;
if (typeof response === 'undefined') return;
el.classNam... | javascript | function (response) {
// order so it appears at the top
var el = document.createElement('div'),
li = document.createElement('li'),
span = document.createElement('span'),
parent = output.parentNode;
historyPosition = history.length;
if (typeof response === 'undefined') return;
el.classNam... | [
"function",
"(",
"response",
")",
"{",
"// order so it appears at the top",
"var",
"el",
"=",
"document",
".",
"createElement",
"(",
"'div'",
")",
",",
"li",
"=",
"document",
".",
"createElement",
"(",
"'li'",
")",
",",
"span",
"=",
"document",
".",
"createE... | Display the result of a command to the user | [
"Display",
"the",
"result",
"of",
"a",
"command",
"to",
"the",
"user"
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/render/console.js#L67-L104 | train | |
jsbin/jsbin | public/js/vendor/codemirror3/mode/stex/stex.js | getMostPowerful | function getMostPowerful(state) {
var context = state.cmdState;
for (var i = context.length - 1; i >= 0; i--) {
var plug = context[i];
if (plug.name == "DEFAULT") {
continue;
}
return plug;
}
return { styleIdentifier: functi... | javascript | function getMostPowerful(state) {
var context = state.cmdState;
for (var i = context.length - 1; i >= 0; i--) {
var plug = context[i];
if (plug.name == "DEFAULT") {
continue;
}
return plug;
}
return { styleIdentifier: functi... | [
"function",
"getMostPowerful",
"(",
"state",
")",
"{",
"var",
"context",
"=",
"state",
".",
"cmdState",
";",
"for",
"(",
"var",
"i",
"=",
"context",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"var",
"plug",
"=",
"cont... | returns the non-default plugin closest to the end of the list | [
"returns",
"the",
"non",
"-",
"default",
"plugin",
"closest",
"to",
"the",
"end",
"of",
"the",
"list"
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/vendor/codemirror3/mode/stex/stex.js#L29-L39 | train |
Subsets and Splits
SQL Console for semeru/code-text-javascript
Retrieves 20,000 non-null code samples labeled as JavaScript, providing a basic overview of the dataset.