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
ota-meshi/eslint-plugin-lodash-template
lib/rules/script-indent.js
processNonSpecifier
function processNonSpecifier() { const secondToken = sourceCode.getFirstToken(node, 1) if (isLeftBrace(secondToken)) { setOffsetToToken( [ secondToken, sourceCode.g...
javascript
function processNonSpecifier() { const secondToken = sourceCode.getFirstToken(node, 1) if (isLeftBrace(secondToken)) { setOffsetToToken( [ secondToken, sourceCode.g...
[ "function", "processNonSpecifier", "(", ")", "{", "const", "secondToken", "=", "sourceCode", ".", "getFirstToken", "(", "node", ",", "1", ")", "if", "(", "isLeftBrace", "(", "secondToken", ")", ")", "{", "setOffsetToToken", "(", "[", "secondToken", ",", "sou...
Process when the specifier does not exist @returns {void}
[ "Process", "when", "the", "specifier", "does", "not", "exist" ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/script-indent.js#L1144-L1164
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/script-indent.js
processImportDefaultSpecifier
function processImportDefaultSpecifier() { if ( secondSpecifier && secondSpecifier.type === "ImportNamespaceSpecifier" ) { // There is a pattern: // import Foo, * as foo from "foo"...
javascript
function processImportDefaultSpecifier() { if ( secondSpecifier && secondSpecifier.type === "ImportNamespaceSpecifier" ) { // There is a pattern: // import Foo, * as foo from "foo"...
[ "function", "processImportDefaultSpecifier", "(", ")", "{", "if", "(", "secondSpecifier", "&&", "secondSpecifier", ".", "type", "===", "\"ImportNamespaceSpecifier\"", ")", "{", "// There is a pattern:", "// import Foo, * as foo from \"foo\"", "tokens", ".", "push", "(",...
Process when the specifier is ImportDefaultSpecifier @returns {void}
[ "Process", "when", "the", "specifier", "is", "ImportDefaultSpecifier" ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/script-indent.js#L1170-L1225
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/script-indent.js
processImportNamespaceSpecifier
function processImportNamespaceSpecifier() { tokens.push( sourceCode.getFirstToken(firstSpecifier), // * sourceCode.getLastToken(node, hasSemi ? 2 : 1), // from sourceCode.getLastToken(node, hasSemi ? 1 : 0) // "foo" ...
javascript
function processImportNamespaceSpecifier() { tokens.push( sourceCode.getFirstToken(firstSpecifier), // * sourceCode.getLastToken(node, hasSemi ? 2 : 1), // from sourceCode.getLastToken(node, hasSemi ? 1 : 0) // "foo" ...
[ "function", "processImportNamespaceSpecifier", "(", ")", "{", "tokens", ".", "push", "(", "sourceCode", ".", "getFirstToken", "(", "firstSpecifier", ")", ",", "// *", "sourceCode", ".", "getLastToken", "(", "node", ",", "hasSemi", "?", "2", ":", "1", ")", ",...
Process when the specifier is ImportNamespaceSpecifier @returns {void}
[ "Process", "when", "the", "specifier", "is", "ImportNamespaceSpecifier" ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/script-indent.js#L1231-L1237
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/script-indent.js
processOtherSpecifier
function processOtherSpecifier() { const leftBrace = sourceCode.getFirstToken(node, 1) const rightBrace = sourceCode.getLastToken( node, hasSemi ? 3 : 2 ) setOffsetToToken(leftBrace, 0, import...
javascript
function processOtherSpecifier() { const leftBrace = sourceCode.getFirstToken(node, 1) const rightBrace = sourceCode.getLastToken( node, hasSemi ? 3 : 2 ) setOffsetToToken(leftBrace, 0, import...
[ "function", "processOtherSpecifier", "(", ")", "{", "const", "leftBrace", "=", "sourceCode", ".", "getFirstToken", "(", "node", ",", "1", ")", "const", "rightBrace", "=", "sourceCode", ".", "getLastToken", "(", "node", ",", "hasSemi", "?", "3", ":", "2", "...
Process when the specifier is other @returns {void}
[ "Process", "when", "the", "specifier", "is", "other" ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/script-indent.js#L1243-L1255
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/html-closing-bracket-spacing.js
getLastLocationInTag
function getLastLocationInTag(node) { const tagClose = node.tagClose const text = sourceCode.text.slice(node.range[0], tagClose.range[0]) const index = text.search(/\S\s*$/gu) + node.range[0] + 1 return { index, loc: sourceCode.getLocFromIn...
javascript
function getLastLocationInTag(node) { const tagClose = node.tagClose const text = sourceCode.text.slice(node.range[0], tagClose.range[0]) const index = text.search(/\S\s*$/gu) + node.range[0] + 1 return { index, loc: sourceCode.getLocFromIn...
[ "function", "getLastLocationInTag", "(", "node", ")", "{", "const", "tagClose", "=", "node", ".", "tagClose", "const", "text", "=", "sourceCode", ".", "text", ".", "slice", "(", "node", ".", "range", "[", "0", "]", ",", "tagClose", ".", "range", "[", "...
Get last location @param {ASTNode} node The node @returns {object} The last location
[ "Get", "last", "location" ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/html-closing-bracket-spacing.js#L73-L81
train
ota-meshi/eslint-plugin-lodash-template
lib/service/comment-directive.js
locationInRangeLoc
function locationInRangeLoc(loc, start, end) { if (loc.line < start.line || end.line < loc.line) { return false } if (loc.line === start.line) { if (start.column > loc.column) { return false } } if (loc.line === end.line) { if (loc.column >= end.column) { ...
javascript
function locationInRangeLoc(loc, start, end) { if (loc.line < start.line || end.line < loc.line) { return false } if (loc.line === start.line) { if (start.column > loc.column) { return false } } if (loc.line === end.line) { if (loc.column >= end.column) { ...
[ "function", "locationInRangeLoc", "(", "loc", ",", "start", ",", "end", ")", "{", "if", "(", "loc", ".", "line", "<", "start", ".", "line", "||", "end", ".", "line", "<", "loc", ".", "line", ")", "{", "return", "false", "}", "if", "(", "loc", "."...
Check whether the location is in range location. @param {object} loc The location. @param {object} start The start location. @param {object} end The end location. @returns {boolean} `true` if the location is in range location.
[ "Check", "whether", "the", "location", "is", "in", "range", "location", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/service/comment-directive.js#L178-L193
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/no-warning-html-comments.js
commentContainsWarningTerm
function commentContainsWarningTerm(comment) { const matches = [] warningRegExps.forEach((regex, index) => { if (regex.test(comment)) { matches.push(warningTerms[index]) } }) return matches }
javascript
function commentContainsWarningTerm(comment) { const matches = [] warningRegExps.forEach((regex, index) => { if (regex.test(comment)) { matches.push(warningTerms[index]) } }) return matches }
[ "function", "commentContainsWarningTerm", "(", "comment", ")", "{", "const", "matches", "=", "[", "]", "warningRegExps", ".", "forEach", "(", "(", "regex", ",", "index", ")", "=>", "{", "if", "(", "regex", ".", "test", "(", "comment", ")", ")", "{", "m...
Checks the specified comment for matches of the configured warning terms and returns the matches. @param {string} comment The comment which is checked. @returns {Array} All matched warning terms for this comment.
[ "Checks", "the", "specified", "comment", "for", "matches", "of", "the", "configured", "warning", "terms", "and", "returns", "the", "matches", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/no-warning-html-comments.js#L97-L107
train
ota-meshi/eslint-plugin-lodash-template
lib/processor/micro-template-processor.js
postprocessForDisableRules
function postprocessForDisableRules(messages, microTemplateService) { const option = microTemplateService.systemOption || {} const ignoreRules = DISABLED_RULES.concat(option.ignoreRules || []) const globals = GLOBALS.concat(option.globals || []) return messages.filter(message => { if (ignoreRul...
javascript
function postprocessForDisableRules(messages, microTemplateService) { const option = microTemplateService.systemOption || {} const ignoreRules = DISABLED_RULES.concat(option.ignoreRules || []) const globals = GLOBALS.concat(option.globals || []) return messages.filter(message => { if (ignoreRul...
[ "function", "postprocessForDisableRules", "(", "messages", ",", "microTemplateService", ")", "{", "const", "option", "=", "microTemplateService", ".", "systemOption", "||", "{", "}", "const", "ignoreRules", "=", "DISABLED_RULES", ".", "concat", "(", "option", ".", ...
postprocess for Filter disable rules messages. @param {Array} messages The base messages. @param {object} microTemplateService The MicroTemplateService. @returns {Array} messages The processed messages.
[ "postprocess", "for", "Filter", "disable", "rules", "messages", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/processor/micro-template-processor.js#L30-L75
train
ota-meshi/eslint-plugin-lodash-template
lib/service/MicroTemplateService.js
tryParseSelector
function tryParseSelector(rawSelector) { try { return esquery.parse(rawSelector.replace(/:exit$/u, "")) } catch (err) { if (typeof err.offset === "number") { throw new Error( `Syntax error in selector "${rawSelector}" at position ${ err.offset ...
javascript
function tryParseSelector(rawSelector) { try { return esquery.parse(rawSelector.replace(/:exit$/u, "")) } catch (err) { if (typeof err.offset === "number") { throw new Error( `Syntax error in selector "${rawSelector}" at position ${ err.offset ...
[ "function", "tryParseSelector", "(", "rawSelector", ")", "{", "try", "{", "return", "esquery", ".", "parse", "(", "rawSelector", ".", "replace", "(", "/", ":exit$", "/", "u", ",", "\"\"", ")", ")", "}", "catch", "(", "err", ")", "{", "if", "(", "type...
Parses a raw selector string, and throws a useful error if parsing fails. @param {string} rawSelector A raw AST selector @returns {Selector} An object (from esquery) describing the matching behavior of this selector @throws An error if the selector is invalid
[ "Parses", "a", "raw", "selector", "string", "and", "throws", "a", "useful", "error", "if", "parsing", "fails", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/service/MicroTemplateService.js#L16-L29
train
ota-meshi/eslint-plugin-lodash-template
lib/service/MicroTemplateService.js
parseSelector
function parseSelector(rawSelector) { const parsedSelector = tryParseSelector(rawSelector) return { rawSelector, isExit: rawSelector.endsWith(":exit"), parsedSelector, } }
javascript
function parseSelector(rawSelector) { const parsedSelector = tryParseSelector(rawSelector) return { rawSelector, isExit: rawSelector.endsWith(":exit"), parsedSelector, } }
[ "function", "parseSelector", "(", "rawSelector", ")", "{", "const", "parsedSelector", "=", "tryParseSelector", "(", "rawSelector", ")", "return", "{", "rawSelector", ",", "isExit", ":", "rawSelector", ".", "endsWith", "(", "\":exit\"", ")", ",", "parsedSelector", ...
Parses a raw selector string, and returns the parsed selector along with specificity and type information. @param {string} rawSelector A raw AST selector @returns {ASTSelector} A selector descriptor
[ "Parses", "a", "raw", "selector", "string", "and", "returns", "the", "parsed", "selector", "along", "with", "specificity", "and", "type", "information", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/service/MicroTemplateService.js#L36-L44
train
ota-meshi/eslint-plugin-lodash-template
lib/service/MicroTemplateService.js
traverse
function traverse(tokens, options) { const traverser = new Traverser() const nodes = Array.isArray(tokens) ? tokens : [tokens] for (const node of nodes) { traverser.traverse(node, options) if (traverser.isBroken()) { return } } }
javascript
function traverse(tokens, options) { const traverser = new Traverser() const nodes = Array.isArray(tokens) ? tokens : [tokens] for (const node of nodes) { traverser.traverse(node, options) if (traverser.isBroken()) { return } } }
[ "function", "traverse", "(", "tokens", ",", "options", ")", "{", "const", "traverser", "=", "new", "Traverser", "(", ")", "const", "nodes", "=", "Array", ".", "isArray", "(", "tokens", ")", "?", "tokens", ":", "[", "tokens", "]", "for", "(", "const", ...
Traverse the given tokens. @param {Token|Token[]} tokens tokens. @param {object} options The option object. @returns {void}
[ "Traverse", "the", "given", "tokens", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/service/MicroTemplateService.js#L133-L142
train
ota-meshi/eslint-plugin-lodash-template
lib/service/MicroTemplateService.js
traverseNodes
function traverseNodes(nodes, visitor) { const ne = new NodeEventGenerator(visitor) traverse(nodes, { enter(child) { ne.enterNode(child) }, leave(child) { ne.leaveNode(child) }, }) }
javascript
function traverseNodes(nodes, visitor) { const ne = new NodeEventGenerator(visitor) traverse(nodes, { enter(child) { ne.enterNode(child) }, leave(child) { ne.leaveNode(child) }, }) }
[ "function", "traverseNodes", "(", "nodes", ",", "visitor", ")", "{", "const", "ne", "=", "new", "NodeEventGenerator", "(", "visitor", ")", "traverse", "(", "nodes", ",", "{", "enter", "(", "child", ")", "{", "ne", ".", "enterNode", "(", "child", ")", "...
Traverse the given AST tree. @param {object} nodes Root node to traverse. @param {object} visitor Visitor. @returns {void}
[ "Traverse", "the", "given", "AST", "tree", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/service/MicroTemplateService.js#L150-L161
train
ota-meshi/eslint-plugin-lodash-template
lib/service/MicroTemplateService.js
findToken
function findToken(node, test) { let find = null traverse(node, { enter(child) { if (test(child)) { find = child this.break() } }, }) return find }
javascript
function findToken(node, test) { let find = null traverse(node, { enter(child) { if (test(child)) { find = child this.break() } }, }) return find }
[ "function", "findToken", "(", "node", ",", "test", ")", "{", "let", "find", "=", "null", "traverse", "(", "node", ",", "{", "enter", "(", "child", ")", "{", "if", "(", "test", "(", "child", ")", ")", "{", "find", "=", "child", "this", ".", "break...
Find for the token that hit on the given test. @param {object} node Root node to traverse. @param {function} test test. @returns {Token|null} The token that hit on the given test
[ "Find", "for", "the", "token", "that", "hit", "on", "the", "given", "test", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/service/MicroTemplateService.js#L169-L180
train
ota-meshi/eslint-plugin-lodash-template
lib/service/MicroTemplateService.js
inToken
function inToken(loc, token) { if (typeof loc === "number") { return token.range[0] <= loc && loc < token.range[1] } return locationInRangeLoc(loc, token.loc.start, token.loc.end) }
javascript
function inToken(loc, token) { if (typeof loc === "number") { return token.range[0] <= loc && loc < token.range[1] } return locationInRangeLoc(loc, token.loc.start, token.loc.end) }
[ "function", "inToken", "(", "loc", ",", "token", ")", "{", "if", "(", "typeof", "loc", "===", "\"number\"", ")", "{", "return", "token", ".", "range", "[", "0", "]", "<=", "loc", "&&", "loc", "<", "token", ".", "range", "[", "1", "]", "}", "retur...
Check whether the location is in token. @param {object|number} loc The location or index. @param {object} token The token. @returns {boolean} `true` if the location is in token.
[ "Check", "whether", "the", "location", "is", "in", "token", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/service/MicroTemplateService.js#L212-L217
train
ota-meshi/eslint-plugin-lodash-template
lib/service/MicroTemplateService.js
findExpressionStatement
function findExpressionStatement(start, end) { let target = sourceCode.getNodeByRangeIndex(start) while ( target && target.range[1] <= end && start <= target.range[0] ) { if ( target.type === "Express...
javascript
function findExpressionStatement(start, end) { let target = sourceCode.getNodeByRangeIndex(start) while ( target && target.range[1] <= end && start <= target.range[0] ) { if ( target.type === "Express...
[ "function", "findExpressionStatement", "(", "start", ",", "end", ")", "{", "let", "target", "=", "sourceCode", ".", "getNodeByRangeIndex", "(", "start", ")", "while", "(", "target", "&&", "target", ".", "range", "[", "1", "]", "<=", "end", "&&", "start", ...
Find the ExpressionStatement of range. @param {number} start - The start of range. @param {numnber} end - The end of range. @returns {ExpressionStatement} The expression statement.
[ "Find", "the", "ExpressionStatement", "of", "range", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/service/MicroTemplateService.js#L537-L554
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/html-indent.js
equalsLocation
function equalsLocation(a, b) { return a.range[0] === b.range[0] && a.range[1] === b.range[1] }
javascript
function equalsLocation(a, b) { return a.range[0] === b.range[0] && a.range[1] === b.range[1] }
[ "function", "equalsLocation", "(", "a", ",", "b", ")", "{", "return", "a", ".", "range", "[", "0", "]", "===", "b", ".", "range", "[", "0", "]", "&&", "a", ".", "range", "[", "1", "]", "===", "b", ".", "range", "[", "1", "]", "}" ]
Check whether the given tokens is a equals range. @param {Token} a The token @param {Token} b The token @returns {boolean} `true` if the given tokens is a equals range.
[ "Check", "whether", "the", "given", "tokens", "is", "a", "equals", "range", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/html-indent.js#L113-L115
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/html-indent.js
isLineStart
function isLineStart(loc) { const actualText = getActualLineIndentText(loc.line) return actualText.length === loc.column }
javascript
function isLineStart(loc) { const actualText = getActualLineIndentText(loc.line) return actualText.length === loc.column }
[ "function", "isLineStart", "(", "loc", ")", "{", "const", "actualText", "=", "getActualLineIndentText", "(", "loc", ".", "line", ")", "return", "actualText", ".", "length", "===", "loc", ".", "column", "}" ]
Check whether the given location is a line start location. @param {Location} loc The location to check. @returns {boolean} `true` if the location is a line start location.
[ "Check", "whether", "the", "given", "location", "is", "a", "line", "start", "location", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/html-indent.js#L197-L200
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/html-indent.js
setOffsetToLoc
function setOffsetToLoc(loc, offset, baseline) { if (baseline >= loc.line) { return } const actualText = getActualLineIndentText(loc.line) if (actualText.length !== loc.column) { return } offsets.set(loc.line, { ...
javascript
function setOffsetToLoc(loc, offset, baseline) { if (baseline >= loc.line) { return } const actualText = getActualLineIndentText(loc.line) if (actualText.length !== loc.column) { return } offsets.set(loc.line, { ...
[ "function", "setOffsetToLoc", "(", "loc", ",", "offset", ",", "baseline", ")", "{", "if", "(", "baseline", ">=", "loc", ".", "line", ")", "{", "return", "}", "const", "actualText", "=", "getActualLineIndentText", "(", "loc", ".", "line", ")", "if", "(", ...
Set offset to the given location. @param {Location} loc The start index to set. @param {number} offset The offset of the tokens. @param {number} baseline The line of the base offset. @returns {void}
[ "Set", "offset", "to", "the", "given", "location", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/html-indent.js#L209-L223
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/html-indent.js
setOffsetToIndex
function setOffsetToIndex(startIndex, offset, baseline) { const loc = sourceCode.getLocFromIndex(startIndex) setOffsetToLoc(loc, offset, baseline) }
javascript
function setOffsetToIndex(startIndex, offset, baseline) { const loc = sourceCode.getLocFromIndex(startIndex) setOffsetToLoc(loc, offset, baseline) }
[ "function", "setOffsetToIndex", "(", "startIndex", ",", "offset", ",", "baseline", ")", "{", "const", "loc", "=", "sourceCode", ".", "getLocFromIndex", "(", "startIndex", ")", "setOffsetToLoc", "(", "loc", ",", "offset", ",", "baseline", ")", "}" ]
Set offset to the given index. @param {number} startIndex The start index to set. @param {number} offset The offset of the tokens. @param {number} baseline The line of the base offset. @returns {void}
[ "Set", "offset", "to", "the", "given", "index", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/html-indent.js#L232-L235
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/html-indent.js
setOffsetToLine
function setOffsetToLine(line, offset, baseline) { if (baseline >= line) { return } const actualText = getActualLineIndentText(line) offsets.set(line, { actualText, baseline, offset, expected...
javascript
function setOffsetToLine(line, offset, baseline) { if (baseline >= line) { return } const actualText = getActualLineIndentText(line) offsets.set(line, { actualText, baseline, offset, expected...
[ "function", "setOffsetToLine", "(", "line", ",", "offset", ",", "baseline", ")", "{", "if", "(", "baseline", ">=", "line", ")", "{", "return", "}", "const", "actualText", "=", "getActualLineIndentText", "(", "line", ")", "offsets", ".", "set", "(", "line",...
Set offset to the given line. @param {number} line The line to set. @param {number} offset The offset of the tokens. @param {number} baseline The line of the base offset. @returns {void}
[ "Set", "offset", "to", "the", "given", "line", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/html-indent.js#L261-L273
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/html-indent.js
setOffsetRootToIndex
function setOffsetRootToIndex(startIndex) { const loc = sourceCode.getLocFromIndex(startIndex) if (!offsets.has(loc.line)) { setOffsetToLoc(loc, 0, -1) } }
javascript
function setOffsetRootToIndex(startIndex) { const loc = sourceCode.getLocFromIndex(startIndex) if (!offsets.has(loc.line)) { setOffsetToLoc(loc, 0, -1) } }
[ "function", "setOffsetRootToIndex", "(", "startIndex", ")", "{", "const", "loc", "=", "sourceCode", ".", "getLocFromIndex", "(", "startIndex", ")", "if", "(", "!", "offsets", ".", "has", "(", "loc", ".", "line", ")", ")", "{", "setOffsetToLoc", "(", "loc",...
Set root line offset to the given index. @param {number} startIndex The start index to set. @returns {void}
[ "Set", "root", "line", "offset", "to", "the", "given", "index", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/html-indent.js#L280-L286
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/html-indent.js
isDummyElement
function isDummyElement(node) { return ( !node.startTag && (node.name === "body" || node.name === "head" || node.name === "html") ) }
javascript
function isDummyElement(node) { return ( !node.startTag && (node.name === "body" || node.name === "head" || node.name === "html") ) }
[ "function", "isDummyElement", "(", "node", ")", "{", "return", "(", "!", "node", ".", "startTag", "&&", "(", "node", ".", "name", "===", "\"body\"", "||", "node", ".", "name", "===", "\"head\"", "||", "node", ".", "name", "===", "\"html\"", ")", ")", ...
Check whether the given token is a dummy element. @param {Token} node The token to check. @returns {boolean} `true` if the token is a dummy element.
[ "Check", "whether", "the", "given", "token", "is", "a", "dummy", "element", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/html-indent.js#L345-L352
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/html-indent.js
getStartToken
function getStartToken(elementNode) { if (!elementNode) { return null } if (elementNode.type !== "HTMLElement") { return null } if (isDummyElement(elementNode)) { return null ...
javascript
function getStartToken(elementNode) { if (!elementNode) { return null } if (elementNode.type !== "HTMLElement") { return null } if (isDummyElement(elementNode)) { return null ...
[ "function", "getStartToken", "(", "elementNode", ")", "{", "if", "(", "!", "elementNode", ")", "{", "return", "null", "}", "if", "(", "elementNode", ".", "type", "!==", "\"HTMLElement\"", ")", "{", "return", "null", "}", "if", "(", "isDummyElement", "(", ...
Get the start token of Element @param {Node} elementNode The element node @returns {Token} The start token
[ "Get", "the", "start", "token", "of", "Element" ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/html-indent.js#L359-L370
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/html-indent.js
findIndentationStartPunctuator
function findIndentationStartPunctuator(evaluate) { const searchIndex = evaluate.code.search(/(\S)\s*$/u) if (searchIndex < 0) { return null } const charIndex = evaluate.expressionStart.range[1] + searchIndex ...
javascript
function findIndentationStartPunctuator(evaluate) { const searchIndex = evaluate.code.search(/(\S)\s*$/u) if (searchIndex < 0) { return null } const charIndex = evaluate.expressionStart.range[1] + searchIndex ...
[ "function", "findIndentationStartPunctuator", "(", "evaluate", ")", "{", "const", "searchIndex", "=", "evaluate", ".", "code", ".", "search", "(", "/", "(\\S)\\s*$", "/", "u", ")", "if", "(", "searchIndex", "<", "0", ")", "{", "return", "null", "}", "const...
Find indentation-start punctuator token, within micro-template evaluate. @param {Node} evaluate The micro-template evaluate to set @returns {Token} The indentation-start punctuator token.
[ "Find", "indentation", "-", "start", "punctuator", "token", "within", "micro", "-", "template", "evaluate", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/html-indent.js#L553-L603
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/html-indent.js
findPairOpenPunctuator
function findPairOpenPunctuator(closeToken) { const closePunctuatorText = closeToken.value const isPairOpenPunctuator = closePunctuatorText === ")" ? isLeftParen : closePunctuatorText === "}" ? i...
javascript
function findPairOpenPunctuator(closeToken) { const closePunctuatorText = closeToken.value const isPairOpenPunctuator = closePunctuatorText === ")" ? isLeftParen : closePunctuatorText === "}" ? i...
[ "function", "findPairOpenPunctuator", "(", "closeToken", ")", "{", "const", "closePunctuatorText", "=", "closeToken", ".", "value", "const", "isPairOpenPunctuator", "=", "closePunctuatorText", "===", "\")\"", "?", "isLeftParen", ":", "closePunctuatorText", "===", "\"}\"...
Find pair open punctuator token. @param {Node} closeToken The close punctuator token @returns {Token} The indentation-start punctuator token.
[ "Find", "pair", "open", "punctuator", "token", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/html-indent.js#L610-L634
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/html-indent.js
findPairClosePunctuator
function findPairClosePunctuator(openToken) { const openPunctuatorText = openToken.value const isPairClosePunctuator = openPunctuatorText === "(" ? isRightParen : openPunctuatorText === "{" ? isR...
javascript
function findPairClosePunctuator(openToken) { const openPunctuatorText = openToken.value const isPairClosePunctuator = openPunctuatorText === "(" ? isRightParen : openPunctuatorText === "{" ? isR...
[ "function", "findPairClosePunctuator", "(", "openToken", ")", "{", "const", "openPunctuatorText", "=", "openToken", ".", "value", "const", "isPairClosePunctuator", "=", "openPunctuatorText", "===", "\"(\"", "?", "isRightParen", ":", "openPunctuatorText", "===", "\"{\"",...
Find pair close punctuator token. @param {Node} openToken The open punctuator token @returns {Token} The indentation-end punctuator token.
[ "Find", "pair", "close", "punctuator", "token", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/html-indent.js#L641-L665
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/html-indent.js
findSwitchCaseBodyInfoAtLineStart
function findSwitchCaseBodyInfoAtLineStart(line) { const index = sourceCode.getIndexFromLoc({ line, column: 0, }) let switchCaseNode = sourceCode.getNodeByRangeIndex(index) if ( ...
javascript
function findSwitchCaseBodyInfoAtLineStart(line) { const index = sourceCode.getIndexFromLoc({ line, column: 0, }) let switchCaseNode = sourceCode.getNodeByRangeIndex(index) if ( ...
[ "function", "findSwitchCaseBodyInfoAtLineStart", "(", "line", ")", "{", "const", "index", "=", "sourceCode", ".", "getIndexFromLoc", "(", "{", "line", ",", "column", ":", "0", ",", "}", ")", "let", "switchCaseNode", "=", "sourceCode", ".", "getNodeByRangeIndex",...
Find evaluate token of SwitchCase body from the given line. @param {number} line The line no to set. @returns {Token} The evaluate token of SwitchCase.
[ "Find", "evaluate", "token", "of", "SwitchCase", "body", "from", "the", "given", "line", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/html-indent.js#L705-L773
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/html-indent.js
inIgnore
function inIgnore(line) { const index = sourceCode.getIndexFromLoc({ line, column: 0, }) return ignoreRanges.find( range => range[0] <= index && index < range[1] ) }
javascript
function inIgnore(line) { const index = sourceCode.getIndexFromLoc({ line, column: 0, }) return ignoreRanges.find( range => range[0] <= index && index < range[1] ) }
[ "function", "inIgnore", "(", "line", ")", "{", "const", "index", "=", "sourceCode", ".", "getIndexFromLoc", "(", "{", "line", ",", "column", ":", "0", ",", "}", ")", "return", "ignoreRanges", ".", "find", "(", "range", "=>", "range", "[", "0", "]", "...
Check whether the line start is in ignore range. @param {number} line The line. @returns {boolean} `true` if the line start is in ignore range.
[ "Check", "whether", "the", "line", "start", "is", "in", "ignore", "range", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/html-indent.js#L895-L903
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/template-tag-spacing.js
equalLine
function equalLine(index1, index2) { return ( sourceCode.getLocFromIndex(index1).line === sourceCode.getLocFromIndex(index2).line ) }
javascript
function equalLine(index1, index2) { return ( sourceCode.getLocFromIndex(index1).line === sourceCode.getLocFromIndex(index2).line ) }
[ "function", "equalLine", "(", "index1", ",", "index2", ")", "{", "return", "(", "sourceCode", ".", "getLocFromIndex", "(", "index1", ")", ".", "line", "===", "sourceCode", ".", "getLocFromIndex", "(", "index2", ")", ".", "line", ")", "}" ]
Check whether the line numbers in the given indices are equal. @param {number} index1 The index @param {number} index2 The index @returns {boolean} `true` if the line numbers in the indices are equal.
[ "Check", "whether", "the", "line", "numbers", "in", "the", "given", "indices", "are", "equal", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/template-tag-spacing.js#L91-L96
train
ota-meshi/eslint-plugin-lodash-template
lib/parser/micro-template-eslint-parser.js
getDelimitersFinalMeans
function getDelimitersFinalMeans(text, innerCode) { const codeStart = text.indexOf(innerCode) const codeEnd = codeStart + innerCode.length return [text.slice(0, codeStart), text.slice(codeEnd)] }
javascript
function getDelimitersFinalMeans(text, innerCode) { const codeStart = text.indexOf(innerCode) const codeEnd = codeStart + innerCode.length return [text.slice(0, codeStart), text.slice(codeEnd)] }
[ "function", "getDelimitersFinalMeans", "(", "text", ",", "innerCode", ")", "{", "const", "codeStart", "=", "text", ".", "indexOf", "(", "innerCode", ")", "const", "codeEnd", "=", "codeStart", "+", "innerCode", ".", "length", "return", "[", "text", ".", "slic...
Get delimiters from the given text and inner text. @param {string} text The hit text. @param {string} innerCode The hit inner text. @returns {Array} The delimiters result.
[ "Get", "delimiters", "from", "the", "given", "text", "and", "inner", "text", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/parser/micro-template-eslint-parser.js#L21-L25
train
ota-meshi/eslint-plugin-lodash-template
lib/parser/micro-template-eslint-parser.js
settingToRegExpInfo
function settingToRegExpInfo(val, defaultDelimiters) { if (!val) { return { pattern: `${defaultDelimiters[0]}([\\s\\S]*?)${ defaultDelimiters[1] }`, getDelimiters: () => defaultDelimiters, } } if (Array.isArray(val)) { return { ...
javascript
function settingToRegExpInfo(val, defaultDelimiters) { if (!val) { return { pattern: `${defaultDelimiters[0]}([\\s\\S]*?)${ defaultDelimiters[1] }`, getDelimiters: () => defaultDelimiters, } } if (Array.isArray(val)) { return { ...
[ "function", "settingToRegExpInfo", "(", "val", ",", "defaultDelimiters", ")", "{", "if", "(", "!", "val", ")", "{", "return", "{", "pattern", ":", "`", "${", "defaultDelimiters", "[", "0", "]", "}", "\\\\", "\\\\", "${", "defaultDelimiters", "[", "1", "]...
Delimiters setting to RegExp source @param {*} val The delimiter settings. @param {Array} defaultDelimiters The default delimiters. @returns {string} The delimiters RegExp source.
[ "Delimiters", "setting", "to", "RegExp", "source" ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/parser/micro-template-eslint-parser.js#L43-L90
train
ota-meshi/eslint-plugin-lodash-template
lib/parser/micro-template-eslint-parser.js
parseTemplate
function parseTemplate(code, parserOptions) { const sourceCodeStore = new SourceCodeStore(code) // 文字位置をそのままにしてscriptとhtmlを分解 let script = "" let pre = 0 let template = "" const microTemplateTokens = [] // テンプレートTokens for (const token of genMicroTemplateTokens( code, parser...
javascript
function parseTemplate(code, parserOptions) { const sourceCodeStore = new SourceCodeStore(code) // 文字位置をそのままにしてscriptとhtmlを分解 let script = "" let pre = 0 let template = "" const microTemplateTokens = [] // テンプレートTokens for (const token of genMicroTemplateTokens( code, parser...
[ "function", "parseTemplate", "(", "code", ",", "parserOptions", ")", "{", "const", "sourceCodeStore", "=", "new", "SourceCodeStore", "(", "code", ")", "// 文字位置をそのままにしてscriptとhtmlを分解", "let", "script", "=", "\"\"", "let", "pre", "=", "0", "let", "template", "=", ...
Parse the given template. @param {string} code The template to parse. @param {object} parserOptions The parser options. @returns {object} The parsing result.
[ "Parse", "the", "given", "template", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/parser/micro-template-eslint-parser.js#L184-L242
train
ota-meshi/eslint-plugin-lodash-template
lib/parser/micro-template-eslint-parser.js
parseScript
function parseScript(code, parserOptions) { const parser = parserOptions.parser === "espree" || !parserOptions.parser ? require("espree") // eslint-disable-line @mysticatea/node/no-extraneous-require : require(parserOptions.parser) const scriptParserOptions = Object.assign({}, pa...
javascript
function parseScript(code, parserOptions) { const parser = parserOptions.parser === "espree" || !parserOptions.parser ? require("espree") // eslint-disable-line @mysticatea/node/no-extraneous-require : require(parserOptions.parser) const scriptParserOptions = Object.assign({}, pa...
[ "function", "parseScript", "(", "code", ",", "parserOptions", ")", "{", "const", "parser", "=", "parserOptions", ".", "parser", "===", "\"espree\"", "||", "!", "parserOptions", ".", "parser", "?", "require", "(", "\"espree\"", ")", "// eslint-disable-line @mystica...
Parse the given script source code. @param {string} code The script source code to parse. @param {object} parserOptions The parser options. @returns {object} The parsing result.
[ "Parse", "the", "given", "script", "source", "code", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/parser/micro-template-eslint-parser.js#L250-L267
train
ota-meshi/eslint-plugin-lodash-template
lib/parser/micro-template-eslint-parser.js
isHtmlFile
function isHtmlFile(code, options) { const filePath = typeof options.filePath === "string" ? options.filePath : "unknown.js" for (const ext of container.targetExtensions) { if (filePath.endsWith(ext)) { return true } } if (filePath.endsWith(".vue")) { return f...
javascript
function isHtmlFile(code, options) { const filePath = typeof options.filePath === "string" ? options.filePath : "unknown.js" for (const ext of container.targetExtensions) { if (filePath.endsWith(ext)) { return true } } if (filePath.endsWith(".vue")) { return f...
[ "function", "isHtmlFile", "(", "code", ",", "options", ")", "{", "const", "filePath", "=", "typeof", "options", ".", "filePath", "===", "\"string\"", "?", "options", ".", "filePath", ":", "\"unknown.js\"", "for", "(", "const", "ext", "of", "container", ".", ...
Check whether the code is a HTML. @param {string} code The source code to check. @param {object} options The parser options. @returns {boolean} `true` if the source code is a HTML.
[ "Check", "whether", "the", "code", "is", "a", "HTML", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/parser/micro-template-eslint-parser.js#L275-L287
train
ota-meshi/eslint-plugin-lodash-template
lib/parser/micro-template-eslint-parser.js
parseForESLint
function parseForESLint(code, options) { const opts = options || {} if (!isHtmlFile(code, opts)) { return parseScript(code, opts) } return parseTemplate(code, opts) }
javascript
function parseForESLint(code, options) { const opts = options || {} if (!isHtmlFile(code, opts)) { return parseScript(code, opts) } return parseTemplate(code, opts) }
[ "function", "parseForESLint", "(", "code", ",", "options", ")", "{", "const", "opts", "=", "options", "||", "{", "}", "if", "(", "!", "isHtmlFile", "(", "code", ",", "opts", ")", ")", "{", "return", "parseScript", "(", "code", ",", "opts", ")", "}", ...
Parse the given source code. @param {string} code The source code to parse. @param {object} options The parser options. @returns {object} The parsing result.
[ "Parse", "the", "given", "source", "code", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/parser/micro-template-eslint-parser.js#L295-L301
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/no-irregular-whitespace.js
getStartTagIgnoreTokens
function getStartTagIgnoreTokens(startTag) { if (!skipAttrValues) { return [] } const tokens = [] for (const attr of startTag.attributes) { tokens.push(attr.valueToken) } for (const attr of startTag.ignoredAttribute...
javascript
function getStartTagIgnoreTokens(startTag) { if (!skipAttrValues) { return [] } const tokens = [] for (const attr of startTag.attributes) { tokens.push(attr.valueToken) } for (const attr of startTag.ignoredAttribute...
[ "function", "getStartTagIgnoreTokens", "(", "startTag", ")", "{", "if", "(", "!", "skipAttrValues", ")", "{", "return", "[", "]", "}", "const", "tokens", "=", "[", "]", "for", "(", "const", "attr", "of", "startTag", ".", "attributes", ")", "{", "tokens",...
Get the start tag ignore tokens array @param {HTMLStartTag} startTag The start tag @returns {Array} Then tokens
[ "Get", "the", "start", "tag", "ignore", "tokens", "array" ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/no-irregular-whitespace.js#L93-L107
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/no-irregular-whitespace.js
checkForIrregularWhitespace
function checkForIrregularWhitespace(node, ignoreTokens) { const text = sourceCode.text.slice(node.range[0], node.range[1]) let match = undefined /** * Check whether the index is in ignore location. * @param {number} index The index. * @returns...
javascript
function checkForIrregularWhitespace(node, ignoreTokens) { const text = sourceCode.text.slice(node.range[0], node.range[1]) let match = undefined /** * Check whether the index is in ignore location. * @param {number} index The index. * @returns...
[ "function", "checkForIrregularWhitespace", "(", "node", ",", "ignoreTokens", ")", "{", "const", "text", "=", "sourceCode", ".", "text", ".", "slice", "(", "node", ".", "range", "[", "0", "]", ",", "node", ".", "range", "[", "1", "]", ")", "let", "match...
Checks the source for irregular whitespace @param {ASTNode} node The tag node @param {Token[]} ignoreTokens The ignore location tokens @returns {void}
[ "Checks", "the", "source", "for", "irregular", "whitespace" ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/no-irregular-whitespace.js#L133-L192
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/no-irregular-whitespace.js
isIgnoreLocation
function isIgnoreLocation(index) { return ( ignoreTokens.find( t => t.range[0] <= index && index < t.range[1] ) || templateTokens.find( t => t.range[0] <= index && index < t.range[1] ...
javascript
function isIgnoreLocation(index) { return ( ignoreTokens.find( t => t.range[0] <= index && index < t.range[1] ) || templateTokens.find( t => t.range[0] <= index && index < t.range[1] ...
[ "function", "isIgnoreLocation", "(", "index", ")", "{", "return", "(", "ignoreTokens", ".", "find", "(", "t", "=>", "t", ".", "range", "[", "0", "]", "<=", "index", "&&", "index", "<", "t", ".", "range", "[", "1", "]", ")", "||", "templateTokens", ...
Check whether the index is in ignore location. @param {number} index The index. @returns {boolean} `true` if the index is in ignore location.
[ "Check", "whether", "the", "index", "is", "in", "ignore", "location", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/no-irregular-whitespace.js#L142-L151
train
ota-meshi/eslint-plugin-lodash-template
lib/utils/rules.js
collectRules
function collectRules(category) { return rules.reduce((obj, rule) => { if (!category || rule.meta.docs.category === category) { obj[rule.meta.docs.ruleId] = "error" } return obj }, {}) }
javascript
function collectRules(category) { return rules.reduce((obj, rule) => { if (!category || rule.meta.docs.category === category) { obj[rule.meta.docs.ruleId] = "error" } return obj }, {}) }
[ "function", "collectRules", "(", "category", ")", "{", "return", "rules", ".", "reduce", "(", "(", "obj", ",", "rule", ")", "=>", "{", "if", "(", "!", "category", "||", "rule", ".", "meta", ".", "docs", ".", "category", "===", "category", ")", "{", ...
Collect the rules @param {string} category category @returns {Array} rules
[ "Collect", "the", "rules" ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/utils/rules.js#L143-L150
train
ota-meshi/eslint-plugin-lodash-template
lib/service/html-parser.js
buildChildTokens
function buildChildTokens(node, parentToken, html, sourceCodeStore, lastIndex) { return node.childNodes.map(child => { const token = parse5NodeToToken( child, parentToken, html, sourceCodeStore, lastIndex ) token.parent = parentToke...
javascript
function buildChildTokens(node, parentToken, html, sourceCodeStore, lastIndex) { return node.childNodes.map(child => { const token = parse5NodeToToken( child, parentToken, html, sourceCodeStore, lastIndex ) token.parent = parentToke...
[ "function", "buildChildTokens", "(", "node", ",", "parentToken", ",", "html", ",", "sourceCodeStore", ",", "lastIndex", ")", "{", "return", "node", ".", "childNodes", ".", "map", "(", "child", "=>", "{", "const", "token", "=", "parse5NodeToToken", "(", "chil...
Create child tokens from Node childNodes @param {object} node The node from parse5. @param {object} parentToken The parent token. @param {string} html The html source code to parse. @param {SourceCodeStore} sourceCodeStore The sourceCodeStore. @param {number} lastIndex The last index. @returns {Array} The child tokens.
[ "Create", "child", "tokens", "from", "Node", "childNodes" ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/service/html-parser.js#L33-L45
train
ota-meshi/eslint-plugin-lodash-template
lib/service/html-parser.js
defineRootTokenBuilder
function defineRootTokenBuilder(Type) { return (node, _parentToken, html, sourceCodeStore, lastIndex) => { const token = new Type(html, 0, lastIndex, sourceCodeStore) token.children = buildChildTokens( node, token, html, sourceCodeStore, la...
javascript
function defineRootTokenBuilder(Type) { return (node, _parentToken, html, sourceCodeStore, lastIndex) => { const token = new Type(html, 0, lastIndex, sourceCodeStore) token.children = buildChildTokens( node, token, html, sourceCodeStore, la...
[ "function", "defineRootTokenBuilder", "(", "Type", ")", "{", "return", "(", "node", ",", "_parentToken", ",", "html", ",", "sourceCodeStore", ",", "lastIndex", ")", "=>", "{", "const", "token", "=", "new", "Type", "(", "html", ",", "0", ",", "lastIndex", ...
Define root token builder @param {Class} Type The token type. @returns {function} The token builder.
[ "Define", "root", "token", "builder" ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/service/html-parser.js#L52-L64
train
ota-meshi/eslint-plugin-lodash-template
lib/service/html-parser.js
parse5NodeToToken
function parse5NodeToToken( node, parentToken, html, sourceCodeStore, lastIndex ) { const type = NODENAME_TO_TYPE_MAP[node.nodeName] ? NODENAME_TO_TYPE_MAP[node.nodeName] : "HTMLElement" return TOKEN_BUILDERS[type]( node, parentToken, html, so...
javascript
function parse5NodeToToken( node, parentToken, html, sourceCodeStore, lastIndex ) { const type = NODENAME_TO_TYPE_MAP[node.nodeName] ? NODENAME_TO_TYPE_MAP[node.nodeName] : "HTMLElement" return TOKEN_BUILDERS[type]( node, parentToken, html, so...
[ "function", "parse5NodeToToken", "(", "node", ",", "parentToken", ",", "html", ",", "sourceCodeStore", ",", "lastIndex", ")", "{", "const", "type", "=", "NODENAME_TO_TYPE_MAP", "[", "node", ".", "nodeName", "]", "?", "NODENAME_TO_TYPE_MAP", "[", "node", ".", "...
Node to ESLint token. @param {object} node The node from parse5. @param {object} parentToken The parent token. @param {string} html The html source code to parse. @param {SourceCodeStore} sourceCodeStore The sourceCodeStore. @param {number} lastIndex The last index. @returns {object} The ESLint token.
[ "Node", "to", "ESLint", "token", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/service/html-parser.js#L210-L228
train
ota-meshi/eslint-plugin-lodash-template
lib/service/html-parser.js
parseHtml
function parseHtml(html, sourceCodeStore) { const isFragment = !/^\s*<(!doctype|html|head|body|!--)/iu.test(html) const document = (isFragment ? parse5.parseFragment : parse5.parse)(html, { sourceCodeLocationInfo: true, }) return parse5NodeToToken(document, null, html, sourceCodeStore, html.len...
javascript
function parseHtml(html, sourceCodeStore) { const isFragment = !/^\s*<(!doctype|html|head|body|!--)/iu.test(html) const document = (isFragment ? parse5.parseFragment : parse5.parse)(html, { sourceCodeLocationInfo: true, }) return parse5NodeToToken(document, null, html, sourceCodeStore, html.len...
[ "function", "parseHtml", "(", "html", ",", "sourceCodeStore", ")", "{", "const", "isFragment", "=", "!", "/", "^\\s*<(!doctype|html|head|body|!--)", "/", "iu", ".", "test", "(", "html", ")", "const", "document", "=", "(", "isFragment", "?", "parse5", ".", "p...
Parse the given html. @param {string} html The html source code to parse. @param {SourceCodeStore} sourceCodeStore The sourceCodeStore. @returns {object} The parsing result.
[ "Parse", "the", "given", "html", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/service/html-parser.js#L236-L243
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/max-attributes-per-line.js
isSingleLine
function isSingleLine(node) { return node.loc.start.line === node.loc.end.line }
javascript
function isSingleLine(node) { return node.loc.start.line === node.loc.end.line }
[ "function", "isSingleLine", "(", "node", ")", "{", "return", "node", ".", "loc", ".", "start", ".", "line", "===", "node", ".", "loc", ".", "end", ".", "line", "}" ]
Check whether the node is declared in a single line or not. @param {ASTNode} node The startTag node @returns {boolean} `true` if the node is declared in a single line
[ "Check", "whether", "the", "node", "is", "declared", "in", "a", "single", "line", "or", "not", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/max-attributes-per-line.js#L47-L49
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/max-attributes-per-line.js
report
function report(attributes) { attributes.forEach((prop, i) => { context.report({ node: prop, loc: prop.loc, messageId: "missingNewLine", data: { name: prop.key, }, ...
javascript
function report(attributes) { attributes.forEach((prop, i) => { context.report({ node: prop, loc: prop.loc, messageId: "missingNewLine", data: { name: prop.key, }, ...
[ "function", "report", "(", "attributes", ")", "{", "attributes", ".", "forEach", "(", "(", "prop", ",", "i", ")", "=>", "{", "context", ".", "report", "(", "{", "node", ":", "prop", ",", "loc", ":", "prop", ".", "loc", ",", "messageId", ":", "\"mis...
Report warning the given attribute nodes. @param {Array} attributes The attribute nodes @returns {void}
[ "Report", "warning", "the", "given", "attribute", "nodes", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/max-attributes-per-line.js#L168-L183
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/max-attributes-per-line.js
groupAttrsByLine
function groupAttrsByLine(attributes) { const propsPerLine = [[attributes[0]]] attributes.reduce((previous, current) => { if (previous.loc.end.line === current.loc.start.line) { propsPerLine[propsPerLine.length - 1].push(current) } else { ...
javascript
function groupAttrsByLine(attributes) { const propsPerLine = [[attributes[0]]] attributes.reduce((previous, current) => { if (previous.loc.end.line === current.loc.start.line) { propsPerLine[propsPerLine.length - 1].push(current) } else { ...
[ "function", "groupAttrsByLine", "(", "attributes", ")", "{", "const", "propsPerLine", "=", "[", "[", "attributes", "[", "0", "]", "]", "]", "attributes", ".", "reduce", "(", "(", "previous", ",", "current", ")", "=>", "{", "if", "(", "previous", ".", "...
Grouping attribute lists line by line @param {Array} attributes The attribute nodes @returns {Array} The group attribute nodes
[ "Grouping", "attribute", "lists", "line", "by", "line" ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/max-attributes-per-line.js#L190-L203
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/html-content-newline.js
isMultiline
function isMultiline(node, contentFirstLoc, contentLastLoc) { if ( node.startTag.loc.start.line !== node.startTag.loc.end.line || node.endTag.loc.start.line !== node.endTag.loc.end.line ) { // multiline tag return true } if (contentFirstLoc.line < contentLastLoc.line) { ...
javascript
function isMultiline(node, contentFirstLoc, contentLastLoc) { if ( node.startTag.loc.start.line !== node.startTag.loc.end.line || node.endTag.loc.start.line !== node.endTag.loc.end.line ) { // multiline tag return true } if (contentFirstLoc.line < contentLastLoc.line) { ...
[ "function", "isMultiline", "(", "node", ",", "contentFirstLoc", ",", "contentLastLoc", ")", "{", "if", "(", "node", ".", "startTag", ".", "loc", ".", "start", ".", "line", "!==", "node", ".", "startTag", ".", "loc", ".", "end", ".", "line", "||", "node...
Check whether the given node is a multiline @param {ASTNode} node The element node. @param {object} contentFirstLoc The content first location. @param {object} contentLastLoc The content last location. @returns {boolean} `true` if the node is a multiline.
[ "Check", "whether", "the", "given", "node", "is", "a", "multiline" ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/html-content-newline.js#L10-L23
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/html-content-newline.js
isIgnore
function isIgnore(node) { let target = node while (target.type === "HTMLElement") { if (options.ignoreNames.indexOf(target.name) >= 0) { // ignore element name return true } target = target.parent ...
javascript
function isIgnore(node) { let target = node while (target.type === "HTMLElement") { if (options.ignoreNames.indexOf(target.name) >= 0) { // ignore element name return true } target = target.parent ...
[ "function", "isIgnore", "(", "node", ")", "{", "let", "target", "=", "node", "while", "(", "target", ".", "type", "===", "\"HTMLElement\"", ")", "{", "if", "(", "options", ".", "ignoreNames", ".", "indexOf", "(", "target", ".", "name", ")", ">=", "0", ...
Check whether the given node is in ignore. @param {ASTNode} node The element node. @returns {boolean} `true` if the given node is in ignore.
[ "Check", "whether", "the", "given", "node", "is", "in", "ignore", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/html-content-newline.js#L141-L151
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/html-content-newline.js
getContentLocatuons
function getContentLocatuons(node) { const contentStartIndex = node.startTag.range[1] const contentEndIndex = node.endTag.range[0] const contentText = sourceCode.text.slice( contentStartIndex, contentEndIndex ) const contentFirs...
javascript
function getContentLocatuons(node) { const contentStartIndex = node.startTag.range[1] const contentEndIndex = node.endTag.range[0] const contentText = sourceCode.text.slice( contentStartIndex, contentEndIndex ) const contentFirs...
[ "function", "getContentLocatuons", "(", "node", ")", "{", "const", "contentStartIndex", "=", "node", ".", "startTag", ".", "range", "[", "1", "]", "const", "contentEndIndex", "=", "node", ".", "endTag", ".", "range", "[", "0", "]", "const", "contentText", ...
Get the contents locations. @param {ASTNode} node The element node. @returns {object} The contents locations.
[ "Get", "the", "contents", "locations", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/html-content-newline.js#L158-L190
train
ota-meshi/eslint-plugin-lodash-template
lib/service/BranchedHTMLStore.js
traverseAst
function traverseAst(sourceCode, node, parent, visitor) { if (visitor[node.type]) { visitor[node.type](node, parent) } const keys = sourceCode.visitorKeys[node.type] for (const key of keys) { const child = node[key] if (Array.isArray(child)) { for (const c of child)...
javascript
function traverseAst(sourceCode, node, parent, visitor) { if (visitor[node.type]) { visitor[node.type](node, parent) } const keys = sourceCode.visitorKeys[node.type] for (const key of keys) { const child = node[key] if (Array.isArray(child)) { for (const c of child)...
[ "function", "traverseAst", "(", "sourceCode", ",", "node", ",", "parent", ",", "visitor", ")", "{", "if", "(", "visitor", "[", "node", ".", "type", "]", ")", "{", "visitor", "[", "node", ".", "type", "]", "(", "node", ",", "parent", ")", "}", "cons...
Traverse the given node. @param {SourceCode} sourceCode The source code. @param {object} node The node to traverse. @param {object} parent The parent node. @param {object} visitor Visitor. @returns {void}
[ "Traverse", "the", "given", "node", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/service/BranchedHTMLStore.js#L11-L30
train
ota-meshi/eslint-plugin-lodash-template
lib/service/BranchedHTMLStore.js
createBranchedHTML
function createBranchedHTML(service, branchStatements, targetNode) { let template = service.template const stripedRanges = [] /** * Strip template of range. * @param {number} start The start index of range. * @param {number} end The end index of range. * @returns {void} */ f...
javascript
function createBranchedHTML(service, branchStatements, targetNode) { let template = service.template const stripedRanges = [] /** * Strip template of range. * @param {number} start The start index of range. * @param {number} end The end index of range. * @returns {void} */ f...
[ "function", "createBranchedHTML", "(", "service", ",", "branchStatements", ",", "targetNode", ")", "{", "let", "template", "=", "service", ".", "template", "const", "stripedRanges", "=", "[", "]", "/**\n * Strip template of range.\n * @param {number} start The sta...
Get HTML with alternate statements striped. @param {MicroTemplateService} service The MicroTemplateService @param {Array} branchStatements The branch statements @param {ASTNode} targetNode The target node. @returns {BranchedHTML} Branch-processed HTML
[ "Get", "HTML", "with", "alternate", "statements", "striped", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/service/BranchedHTMLStore.js#L73-L133
train
ota-meshi/eslint-plugin-lodash-template
lib/service/BranchedHTMLStore.js
strip
function strip(start, end) { const before = template.slice(0, start) const target = template.slice(start, end) const after = template.slice(end) template = before + target.replace(/\S/gu, " ") + after stripedRanges.push([start, end]) }
javascript
function strip(start, end) { const before = template.slice(0, start) const target = template.slice(start, end) const after = template.slice(end) template = before + target.replace(/\S/gu, " ") + after stripedRanges.push([start, end]) }
[ "function", "strip", "(", "start", ",", "end", ")", "{", "const", "before", "=", "template", ".", "slice", "(", "0", ",", "start", ")", "const", "target", "=", "template", ".", "slice", "(", "start", ",", "end", ")", "const", "after", "=", "template"...
Strip template of range. @param {number} start The start index of range. @param {number} end The end index of range. @returns {void}
[ "Strip", "template", "of", "range", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/service/BranchedHTMLStore.js#L83-L89
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/no-template-tag-in-start-tag.js
getTemplateTags
function getTemplateTags(start, end) { const results = [] for (const token of microTemplateService.getMicroTemplateTokens()) { if (token.range[1] <= start) { continue } if (end <= token.range[0]) { break ...
javascript
function getTemplateTags(start, end) { const results = [] for (const token of microTemplateService.getMicroTemplateTokens()) { if (token.range[1] <= start) { continue } if (end <= token.range[0]) { break ...
[ "function", "getTemplateTags", "(", "start", ",", "end", ")", "{", "const", "results", "=", "[", "]", "for", "(", "const", "token", "of", "microTemplateService", ".", "getMicroTemplateTokens", "(", ")", ")", "{", "if", "(", "token", ".", "range", "[", "1...
Gets all interpolation tokens that are contained to the given range. @param {number} start - The start of range. @param {number} end - The end of range. @returns {Token[]} Array of objects representing tokens.
[ "Gets", "all", "interpolation", "tokens", "that", "are", "contained", "to", "the", "given", "range", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/no-template-tag-in-start-tag.js#L46-L58
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/no-template-tag-in-start-tag.js
validate
function validate(templateTags, attrs) { const valueTokens = attrs .map(attr => attr.valueToken) .filter(t => Boolean(t)) for (const templateTag of templateTags) { if ( valueTokens.some( valueToken => ...
javascript
function validate(templateTags, attrs) { const valueTokens = attrs .map(attr => attr.valueToken) .filter(t => Boolean(t)) for (const templateTag of templateTags) { if ( valueTokens.some( valueToken => ...
[ "function", "validate", "(", "templateTags", ",", "attrs", ")", "{", "const", "valueTokens", "=", "attrs", ".", "map", "(", "attr", "=>", "attr", ".", "valueToken", ")", ".", "filter", "(", "t", "=>", "Boolean", "(", "t", ")", ")", "for", "(", "const...
Validate template tags. @param {Array} templateTags The template tags. @param {Array} attrs The attibutes nodes. @returns {void}
[ "Validate", "template", "tags", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/no-template-tag-in-start-tag.js#L66-L93
train
swhite24/hover-api
index.js
createARecord
function createARecord (domain, subdomain, ip, cb) { var body = { name: subdomain, type: 'A', content: ip }; _hoverRequest('POST', '/domains/' + domain + '/dns', body, cb); }
javascript
function createARecord (domain, subdomain, ip, cb) { var body = { name: subdomain, type: 'A', content: ip }; _hoverRequest('POST', '/domains/' + domain + '/dns', body, cb); }
[ "function", "createARecord", "(", "domain", ",", "subdomain", ",", "ip", ",", "cb", ")", "{", "var", "body", "=", "{", "name", ":", "subdomain", ",", "type", ":", "'A'", ",", "content", ":", "ip", "}", ";", "_hoverRequest", "(", "'POST'", ",", "'/dom...
Create a new A record under the specified domain @param {String} domain Domain identifier @param {String} subdomain Subdomain of record @param {String} ip IP Address of record @param {Function} cb @api public
[ "Create", "a", "new", "A", "record", "under", "the", "specified", "domain" ]
0720a4b1566eb501dc64c5f8747fc19d1f5a9e31
https://github.com/swhite24/hover-api/blob/0720a4b1566eb501dc64c5f8747fc19d1f5a9e31/index.js#L80-L87
train
swhite24/hover-api
index.js
createMXRecord
function createMXRecord (domain, subdomain, priority, ip, cb) { var body = { name: subdomain, type: 'MX', content: [priority, ip].join(' ') }; _hoverRequest('POST', '/domains/' + domain + '/dns', body, cb); }
javascript
function createMXRecord (domain, subdomain, priority, ip, cb) { var body = { name: subdomain, type: 'MX', content: [priority, ip].join(' ') }; _hoverRequest('POST', '/domains/' + domain + '/dns', body, cb); }
[ "function", "createMXRecord", "(", "domain", ",", "subdomain", ",", "priority", ",", "ip", ",", "cb", ")", "{", "var", "body", "=", "{", "name", ":", "subdomain", ",", "type", ":", "'MX'", ",", "content", ":", "[", "priority", ",", "ip", "]", ".", ...
Create a new MX record under the specified domain @param {String} domain Domain identifier @param {String} subdomain Subdomain of record @param {String} priority Priority of record @param {String} ip IP Address of record @param {Function} cb @api public
[ "Create", "a", "new", "MX", "record", "under", "the", "specified", "domain" ]
0720a4b1566eb501dc64c5f8747fc19d1f5a9e31
https://github.com/swhite24/hover-api/blob/0720a4b1566eb501dc64c5f8747fc19d1f5a9e31/index.js#L99-L106
train
swhite24/hover-api
index.js
updateDomainDns
function updateDomainDns (dns, ip, cb) { var body = { content: ip }; _hoverRequest('PUT', '/dns/' + dns, body, cb); }
javascript
function updateDomainDns (dns, ip, cb) { var body = { content: ip }; _hoverRequest('PUT', '/dns/' + dns, body, cb); }
[ "function", "updateDomainDns", "(", "dns", ",", "ip", ",", "cb", ")", "{", "var", "body", "=", "{", "content", ":", "ip", "}", ";", "_hoverRequest", "(", "'PUT'", ",", "'/dns/'", "+", "dns", ",", "body", ",", "cb", ")", ";", "}" ]
Update an existing domain record @param {String} dns DNS identifier @param {String} ip New IP Address of record @param {Function} cb @api public
[ "Update", "an", "existing", "domain", "record" ]
0720a4b1566eb501dc64c5f8747fc19d1f5a9e31
https://github.com/swhite24/hover-api/blob/0720a4b1566eb501dc64c5f8747fc19d1f5a9e31/index.js#L116-L121
train
swhite24/hover-api
index.js
_hoverRequest
function _hoverRequest (method, path, body, cb) { // Check if previously logged in if (_loggedin) return _hoverApiRequest(method, path, body, cb); // Issue login request with provided username / password r({ uri: baseUrl + '/login', body: 'username=' + username +...
javascript
function _hoverRequest (method, path, body, cb) { // Check if previously logged in if (_loggedin) return _hoverApiRequest(method, path, body, cb); // Issue login request with provided username / password r({ uri: baseUrl + '/login', body: 'username=' + username +...
[ "function", "_hoverRequest", "(", "method", ",", "path", ",", "body", ",", "cb", ")", "{", "// Check if previously logged in", "if", "(", "_loggedin", ")", "return", "_hoverApiRequest", "(", "method", ",", "path", ",", "body", ",", "cb", ")", ";", "// Issue ...
Proxy request to hover API. Will issue login request if not previously generated. @param {String} method @param {String} path @param {Function} cb @api private
[ "Proxy", "request", "to", "hover", "API", ".", "Will", "issue", "login", "request", "if", "not", "previously", "generated", "." ]
0720a4b1566eb501dc64c5f8747fc19d1f5a9e31
https://github.com/swhite24/hover-api/blob/0720a4b1566eb501dc64c5f8747fc19d1f5a9e31/index.js#L143-L161
train
swhite24/hover-api
index.js
_hoverApiRequest
function _hoverApiRequest (method, path, body, cb) { // Check body provided if (typeof body === 'function') { cb = body; body = null; } // Default options var options = { method: method, uri: baseUrl + path }; // A...
javascript
function _hoverApiRequest (method, path, body, cb) { // Check body provided if (typeof body === 'function') { cb = body; body = null; } // Default options var options = { method: method, uri: baseUrl + path }; // A...
[ "function", "_hoverApiRequest", "(", "method", ",", "path", ",", "body", ",", "cb", ")", "{", "// Check body provided", "if", "(", "typeof", "body", "===", "'function'", ")", "{", "cb", "=", "body", ";", "body", "=", "null", ";", "}", "// Default options",...
Issue request to hover api. @param {String} method @param {String} path @param {Object} [body] @param {Function} cb @api private
[ "Issue", "request", "to", "hover", "api", "." ]
0720a4b1566eb501dc64c5f8747fc19d1f5a9e31
https://github.com/swhite24/hover-api/blob/0720a4b1566eb501dc64c5f8747fc19d1f5a9e31/index.js#L172-L196
train
swhite24/hover-api
index.js
_rCallback
function _rCallback (cb) { return function (err, res, data) { if (err) return cb(err); if (!res || res.statusCode > 400) return cb(data); cb(null, data); }; }
javascript
function _rCallback (cb) { return function (err, res, data) { if (err) return cb(err); if (!res || res.statusCode > 400) return cb(data); cb(null, data); }; }
[ "function", "_rCallback", "(", "cb", ")", "{", "return", "function", "(", "err", ",", "res", ",", "data", ")", "{", "if", "(", "err", ")", "return", "cb", "(", "err", ")", ";", "if", "(", "!", "res", "||", "res", ".", "statusCode", ">", "400", ...
Request callback abstraction to deliver http or connection error. @param {Function} cb @return {Function} @api private
[ "Request", "callback", "abstraction", "to", "deliver", "http", "or", "connection", "error", "." ]
0720a4b1566eb501dc64c5f8747fc19d1f5a9e31
https://github.com/swhite24/hover-api/blob/0720a4b1566eb501dc64c5f8747fc19d1f5a9e31/index.js#L205-L212
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/attribute-value-quote.js
calcValueInfo
function calcValueInfo(valueToken) { const text = valueToken.htmlValue const firstChar = text[0] const quote = firstChar === "'" || firstChar === '"' ? firstChar : undefined const content = quote ? text.slice(1, -1) : text return { quote, content, } }
javascript
function calcValueInfo(valueToken) { const text = valueToken.htmlValue const firstChar = text[0] const quote = firstChar === "'" || firstChar === '"' ? firstChar : undefined const content = quote ? text.slice(1, -1) : text return { quote, content, } }
[ "function", "calcValueInfo", "(", "valueToken", ")", "{", "const", "text", "=", "valueToken", ".", "htmlValue", "const", "firstChar", "=", "text", "[", "0", "]", "const", "quote", "=", "firstChar", "===", "\"'\"", "||", "firstChar", "===", "'\"'", "?", "fi...
get the value info. @param {Token} valueToken The value token. @returns {object} the value info.
[ "get", "the", "value", "info", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/attribute-value-quote.js#L8-L17
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/no-multi-spaces-in-script.js
formatReportedCommentValue
function formatReportedCommentValue(token) { const valueLines = token.value.split("\n") const value = valueLines[0] const formattedValue = `${value.slice(0, 12)}...` return valueLines.length === 1 && value.length <= 12 ? value : formattedV...
javascript
function formatReportedCommentValue(token) { const valueLines = token.value.split("\n") const value = valueLines[0] const formattedValue = `${value.slice(0, 12)}...` return valueLines.length === 1 && value.length <= 12 ? value : formattedV...
[ "function", "formatReportedCommentValue", "(", "token", ")", "{", "const", "valueLines", "=", "token", ".", "value", ".", "split", "(", "\"\\n\"", ")", "const", "value", "=", "valueLines", "[", "0", "]", "const", "formattedValue", "=", "`", "${", "value", ...
Formats value of given comment token for error message by truncating its length. @param {Token} token comment token @returns {string} formatted value @private
[ "Formats", "value", "of", "given", "comment", "token", "for", "error", "message", "by", "truncating", "its", "length", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/no-multi-spaces-in-script.js#L59-L67
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/no-multi-spaces-in-script.js
getTemplateTagByToken
function getTemplateTagByToken(token) { return microTemplateService .getMicroTemplateTokens() .find( t => t.expressionStart.range[1] <= token.range[0] && token.range[0] < t.expressionEnd.range[0] ...
javascript
function getTemplateTagByToken(token) { return microTemplateService .getMicroTemplateTokens() .find( t => t.expressionStart.range[1] <= token.range[0] && token.range[0] < t.expressionEnd.range[0] ...
[ "function", "getTemplateTagByToken", "(", "token", ")", "{", "return", "microTemplateService", ".", "getMicroTemplateTokens", "(", ")", ".", "find", "(", "t", "=>", "t", ".", "expressionStart", ".", "range", "[", "1", "]", "<=", "token", ".", "range", "[", ...
Get the template tag token containing a script. @param {Token} token The script token. @returns {Token} The token if found or null if not found.
[ "Get", "the", "template", "tag", "token", "containing", "a", "script", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/no-multi-spaces-in-script.js#L74-L82
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/no-multi-spaces-in-script.js
isIgnores
function isIgnores(leftToken, leftIndex, rightToken) { const tokensAndComments = sourceCode.tokensAndComments const leftTemplateTag = getTemplateTagByToken(leftToken) const rightTemplateTag = getTemplateTagByToken(rightToken) if (!leftTemplateTag || !rightTemplateTag) { ...
javascript
function isIgnores(leftToken, leftIndex, rightToken) { const tokensAndComments = sourceCode.tokensAndComments const leftTemplateTag = getTemplateTagByToken(leftToken) const rightTemplateTag = getTemplateTagByToken(rightToken) if (!leftTemplateTag || !rightTemplateTag) { ...
[ "function", "isIgnores", "(", "leftToken", ",", "leftIndex", ",", "rightToken", ")", "{", "const", "tokensAndComments", "=", "sourceCode", ".", "tokensAndComments", "const", "leftTemplateTag", "=", "getTemplateTagByToken", "(", "leftToken", ")", "const", "rightTemplat...
Checks if the given token is ignore or not. @param {Token} leftToken - The token to check. @param {number} leftIndex - The index of left token. @param {Token} rightToken - The token to check. @returns {boolean} `true` if the token is ignore.
[ "Checks", "if", "the", "given", "token", "is", "ignore", "or", "not", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/no-multi-spaces-in-script.js#L106-L148
train
ota-meshi/eslint-plugin-lodash-template
docs/.vuepress/components/state/serialize.js
getEnabledRules
function getEnabledRules(allRules) { return Object.keys(allRules).reduce((map, id) => { if (allRules[id] === "error") { map[id] = 2 } return map }, {}) }
javascript
function getEnabledRules(allRules) { return Object.keys(allRules).reduce((map, id) => { if (allRules[id] === "error") { map[id] = 2 } return map }, {}) }
[ "function", "getEnabledRules", "(", "allRules", ")", "{", "return", "Object", ".", "keys", "(", "allRules", ")", ".", "reduce", "(", "(", "map", ",", "id", ")", "=>", "{", "if", "(", "allRules", "[", "id", "]", "===", "\"error\"", ")", "{", "map", ...
Get only enabled rules to make the serialized data smaller. @param {object} allRules The rule settings. @returns {object} The rule settings for the enabled rules.
[ "Get", "only", "enabled", "rules", "to", "make", "the", "serialized", "data", "smaller", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/docs/.vuepress/components/state/serialize.js#L8-L15
train
ota-meshi/eslint-plugin-lodash-template
tools/lib/load-rules.js
readRules
function readRules() { const rulesRoot = path.resolve(__dirname, "../../lib/rules") const result = fs.readdirSync(rulesRoot) const rules = [] for (const name of result) { const ruleName = name.replace(/\.js$/u, "") const ruleId = `lodash-template/${ruleName}` const rule = requir...
javascript
function readRules() { const rulesRoot = path.resolve(__dirname, "../../lib/rules") const result = fs.readdirSync(rulesRoot) const rules = [] for (const name of result) { const ruleName = name.replace(/\.js$/u, "") const ruleId = `lodash-template/${ruleName}` const rule = requir...
[ "function", "readRules", "(", ")", "{", "const", "rulesRoot", "=", "path", ".", "resolve", "(", "__dirname", ",", "\"../../lib/rules\"", ")", "const", "result", "=", "fs", ".", "readdirSync", "(", "rulesRoot", ")", "const", "rules", "=", "[", "]", "for", ...
Get the all rules @returns {Array} The all rules
[ "Get", "the", "all", "rules" ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/tools/lib/load-rules.js#L10-L24
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/html-comment-content-newline.js
getCommentLocatuons
function getCommentLocatuons(node) { const contentStartIndex = node.commentOpen.range[1] const contentEndIndex = node.commentClose.range[0] const contentText = sourceCode.text.slice( contentStartIndex, contentEndIndex ) const co...
javascript
function getCommentLocatuons(node) { const contentStartIndex = node.commentOpen.range[1] const contentEndIndex = node.commentClose.range[0] const contentText = sourceCode.text.slice( contentStartIndex, contentEndIndex ) const co...
[ "function", "getCommentLocatuons", "(", "node", ")", "{", "const", "contentStartIndex", "=", "node", ".", "commentOpen", ".", "range", "[", "1", "]", "const", "contentEndIndex", "=", "node", ".", "commentClose", ".", "range", "[", "0", "]", "const", "content...
Get the comments locations. @param {ASTNode} node The HTML comment. @returns {object} The comments locations.
[ "Get", "the", "comments", "locations", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/html-comment-content-newline.js#L126-L158
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/no-multi-spaces-in-html-tag.js
startTagToTokens
function startTagToTokens(startTag) { const tokens = [startTag.tagOpen] for (const attr of startTag.attributes) { tokens.push(attr) } tokens.push(startTag.tagClose) return tokens .filter(t => Boolean(t)) .sort...
javascript
function startTagToTokens(startTag) { const tokens = [startTag.tagOpen] for (const attr of startTag.attributes) { tokens.push(attr) } tokens.push(startTag.tagClose) return tokens .filter(t => Boolean(t)) .sort...
[ "function", "startTagToTokens", "(", "startTag", ")", "{", "const", "tokens", "=", "[", "startTag", ".", "tagOpen", "]", "for", "(", "const", "attr", "of", "startTag", ".", "attributes", ")", "{", "tokens", ".", "push", "(", "attr", ")", "}", "tokens", ...
Convert start tag to Tokens array @param {HTMLStartTag} startTag The start tag @returns {Array} Then tokens
[ "Convert", "start", "tag", "to", "Tokens", "array" ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/no-multi-spaces-in-html-tag.js#L32-L44
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/no-multi-spaces-in-html-tag.js
endTagToTokens
function endTagToTokens(endTag) { const tokens = [endTag.tagOpen, endTag.tagClose] return tokens .filter(t => Boolean(t)) .sort((a, b) => a.range[0] - b.range[0]) }
javascript
function endTagToTokens(endTag) { const tokens = [endTag.tagOpen, endTag.tagClose] return tokens .filter(t => Boolean(t)) .sort((a, b) => a.range[0] - b.range[0]) }
[ "function", "endTagToTokens", "(", "endTag", ")", "{", "const", "tokens", "=", "[", "endTag", ".", "tagOpen", ",", "endTag", ".", "tagClose", "]", "return", "tokens", ".", "filter", "(", "t", "=>", "Boolean", "(", "t", ")", ")", ".", "sort", "(", "("...
Convert end tag to Tokens array @param {HTMLEndTag} endTag The end tag @returns {Array} Then tokens
[ "Convert", "end", "tag", "to", "Tokens", "array" ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/no-multi-spaces-in-html-tag.js#L51-L57
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/no-multi-spaces-in-html-tag.js
getIntersectionTemplateTags
function getIntersectionTemplateTags(start, end) { return microTemplateService .getMicroTemplateTokens() .filter( token => Math.max(start, token.range[0]) <= Math.min(end, token.range[1]) ) ...
javascript
function getIntersectionTemplateTags(start, end) { return microTemplateService .getMicroTemplateTokens() .filter( token => Math.max(start, token.range[0]) <= Math.min(end, token.range[1]) ) ...
[ "function", "getIntersectionTemplateTags", "(", "start", ",", "end", ")", "{", "return", "microTemplateService", ".", "getMicroTemplateTokens", "(", ")", ".", "filter", "(", "token", "=>", "Math", ".", "max", "(", "start", ",", "token", ".", "range", "[", "0...
Get the location intersection in template tags. @param {number} start The location start. @param {number} end The location end. @returns {Array} the location intersection in template tags.
[ "Get", "the", "location", "intersection", "in", "template", "tags", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/no-multi-spaces-in-html-tag.js#L75-L84
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/no-multi-spaces-in-html-tag.js
processTokens
function processTokens(tokens) { for (const tokenInfo of genTargetTokens(tokens)) { const prevToken = tokenInfo.prevToken const token = tokenInfo.token const start = prevToken.range[1] const end = token.range[0] const spaces = ...
javascript
function processTokens(tokens) { for (const tokenInfo of genTargetTokens(tokens)) { const prevToken = tokenInfo.prevToken const token = tokenInfo.token const start = prevToken.range[1] const end = token.range[0] const spaces = ...
[ "function", "processTokens", "(", "tokens", ")", "{", "for", "(", "const", "tokenInfo", "of", "genTargetTokens", "(", "tokens", ")", ")", "{", "const", "prevToken", "=", "tokenInfo", ".", "prevToken", "const", "token", "=", "tokenInfo", ".", "token", "const"...
Process tokens. @param {Array} tokens The tokens. @returns {void}
[ "Process", "tokens", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/no-multi-spaces-in-html-tag.js#L117-L144
train
ota-meshi/eslint-plugin-lodash-template
lib/rules/no-multi-spaces-in-html-tag.js
formatReportedHTMLToken
function formatReportedHTMLToken(token) { const valueLines = sourceCode.getText(token).split("\n") const value = valueLines[0] return value }
javascript
function formatReportedHTMLToken(token) { const valueLines = sourceCode.getText(token).split("\n") const value = valueLines[0] return value }
[ "function", "formatReportedHTMLToken", "(", "token", ")", "{", "const", "valueLines", "=", "sourceCode", ".", "getText", "(", "token", ")", ".", "split", "(", "\"\\n\"", ")", "const", "value", "=", "valueLines", "[", "0", "]", "return", "value", "}" ]
Formats value of given token for error message by first line. @param {Token} token The token @returns {string} formatted value @private
[ "Formats", "value", "of", "given", "token", "for", "error", "message", "by", "first", "line", "." ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/rules/no-multi-spaces-in-html-tag.js#L152-L156
train
ota-meshi/eslint-plugin-lodash-template
lib/service/SourceCodeStore.js
sortedLastIndexForNum
function sortedLastIndexForNum(array, value) { let low = 0 let high = array == null ? low : array.length while (low < high) { const mid = (low + high) >>> 1 const computed = array[mid] if (computed <= value) { low = mid + 1 } else { high = mid ...
javascript
function sortedLastIndexForNum(array, value) { let low = 0 let high = array == null ? low : array.length while (low < high) { const mid = (low + high) >>> 1 const computed = array[mid] if (computed <= value) { low = mid + 1 } else { high = mid ...
[ "function", "sortedLastIndexForNum", "(", "array", ",", "value", ")", "{", "let", "low", "=", "0", "let", "high", "=", "array", "==", "null", "?", "low", ":", "array", ".", "length", "while", "(", "low", "<", "high", ")", "{", "const", "mid", "=", ...
_.sortedLastIndex @param {Array} array The sorted array to inspect. @param {*} value The value to evaluate. @returns {number} Returns the index at which `value` should be inserted into `array`.
[ "_", ".", "sortedLastIndex" ]
9ff820d58da1eea47f12a87939e62a23cc07561d
https://github.com/ota-meshi/eslint-plugin-lodash-template/blob/9ff820d58da1eea47f12a87939e62a23cc07561d/lib/service/SourceCodeStore.js#L11-L25
train
anvaka/query-state
lib/windowHistory.js
init
function init() { var stateFromHash = getStateFromHash(); var stateChanged = false; if (typeof defaults === 'object' && defaults) { Object.keys(defaults).forEach(function(key) { if (key in stateFromHash) return; stateFromHash[key] = defaults[key] stateChanged = true; })...
javascript
function init() { var stateFromHash = getStateFromHash(); var stateChanged = false; if (typeof defaults === 'object' && defaults) { Object.keys(defaults).forEach(function(key) { if (key in stateFromHash) return; stateFromHash[key] = defaults[key] stateChanged = true; })...
[ "function", "init", "(", ")", "{", "var", "stateFromHash", "=", "getStateFromHash", "(", ")", ";", "var", "stateChanged", "=", "false", ";", "if", "(", "typeof", "defaults", "===", "'object'", "&&", "defaults", ")", "{", "Object", ".", "keys", "(", "defa...
Public API is over. You can ignore this part.
[ "Public", "API", "is", "over", ".", "You", "can", "ignore", "this", "part", "." ]
99b19b10f75dc3afae75b20f33960adc4f57b92b
https://github.com/anvaka/query-state/blob/99b19b10f75dc3afae75b20f33960adc4f57b92b/lib/windowHistory.js#L66-L80
train
anvaka/query-state
index.js
queryState
function queryState(defaults, options) { options = options || {}; var history = options.history || windowHistory(defaults, options); validateHistoryAPI(history); history.onChanged(updateQuery) var query = history.get() || Object.create(null); var api = { /** * Gets current state. * * ...
javascript
function queryState(defaults, options) { options = options || {}; var history = options.history || windowHistory(defaults, options); validateHistoryAPI(history); history.onChanged(updateQuery) var query = history.get() || Object.create(null); var api = { /** * Gets current state. * * ...
[ "function", "queryState", "(", "defaults", ",", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "var", "history", "=", "options", ".", "history", "||", "windowHistory", "(", "defaults", ",", "options", ")", ";", "validateHistoryAPI", "...
Creates new instance of the query state.
[ "Creates", "new", "instance", "of", "the", "query", "state", "." ]
99b19b10f75dc3afae75b20f33960adc4f57b92b
https://github.com/anvaka/query-state/blob/99b19b10f75dc3afae75b20f33960adc4f57b92b/index.js#L20-L150
train
anvaka/query-state
index.js
instance
function instance(defaults, options) { if (!singletonQS) { singletonQS = queryState(defaults, options); } else if (defaults) { singletonQS.setIfEmpty(defaults); } return singletonQS; }
javascript
function instance(defaults, options) { if (!singletonQS) { singletonQS = queryState(defaults, options); } else if (defaults) { singletonQS.setIfEmpty(defaults); } return singletonQS; }
[ "function", "instance", "(", "defaults", ",", "options", ")", "{", "if", "(", "!", "singletonQS", ")", "{", "singletonQS", "=", "queryState", "(", "defaults", ",", "options", ")", ";", "}", "else", "if", "(", "defaults", ")", "{", "singletonQS", ".", "...
Returns singleton instance of the query state. @param {Object} defaults - if present, then it is passed to the current instance of the query state. Defaults are applied only if they were not present before.
[ "Returns", "singleton", "instance", "of", "the", "query", "state", "." ]
99b19b10f75dc3afae75b20f33960adc4f57b92b
https://github.com/anvaka/query-state/blob/99b19b10f75dc3afae75b20f33960adc4f57b92b/index.js#L158-L166
train
nighca/universal-diff
dist/diff.js
function(seq1, seq2, stepMap){ // get contrast arrays (src & target) by analyze step by step var l1 = seq1.length, l2 = seq2.length, src = [], target = []; for(var i = l1,j = l2; i > 0 || j > 0;){ switch(stepMap[i][j]){ case STEP_NOCHANGE: src.unshift(seq1[i-1])...
javascript
function(seq1, seq2, stepMap){ // get contrast arrays (src & target) by analyze step by step var l1 = seq1.length, l2 = seq2.length, src = [], target = []; for(var i = l1,j = l2; i > 0 || j > 0;){ switch(stepMap[i][j]){ case STEP_NOCHANGE: src.unshift(seq1[i-1])...
[ "function", "(", "seq1", ",", "seq2", ",", "stepMap", ")", "{", "// get contrast arrays (src & target) by analyze step by step", "var", "l1", "=", "seq1", ".", "length", ",", "l2", "=", "seq2", ".", "length", ",", "src", "=", "[", "]", ",", "target", "=", ...
stepMap to contrast array
[ "stepMap", "to", "contrast", "array" ]
41ae67d209e0d238d1ceb07e6025d6d9e91f6ed7
https://github.com/nighca/universal-diff/blob/41ae67d209e0d238d1ceb07e6025d6d9e91f6ed7/dist/diff.js#L122-L166
train
nighca/universal-diff
dist/diff.js
function(seq1, seq2, eq){ // do compare var stepMap = coreCompare(seq1, seq2, eq); // transform stepMap var contrast = transformStepMap(seq1, seq2, stepMap), src = contrast.src, target = contrast.target; // convert contrast arrays to edit script var l = target.length, ...
javascript
function(seq1, seq2, eq){ // do compare var stepMap = coreCompare(seq1, seq2, eq); // transform stepMap var contrast = transformStepMap(seq1, seq2, stepMap), src = contrast.src, target = contrast.target; // convert contrast arrays to edit script var l = target.length, ...
[ "function", "(", "seq1", ",", "seq2", ",", "eq", ")", "{", "// do compare", "var", "stepMap", "=", "coreCompare", "(", "seq1", ",", "seq2", ",", "eq", ")", ";", "// transform stepMap", "var", "contrast", "=", "transformStepMap", "(", "seq1", ",", "seq2", ...
get edit script
[ "get", "edit", "script" ]
41ae67d209e0d238d1ceb07e6025d6d9e91f6ed7
https://github.com/nighca/universal-diff/blob/41ae67d209e0d238d1ceb07e6025d6d9e91f6ed7/dist/diff.js#L169-L206
train
anvaka/query-state
lib/query.js
decodeValue
function decodeValue(value) { value = decodeURIComponent(value); if (value === "") return value; if (!isNaN(value)) return parseFloat(value); if (isBolean(value)) return value === 'true'; if (isISODateString(value)) return new Date(value); return value; }
javascript
function decodeValue(value) { value = decodeURIComponent(value); if (value === "") return value; if (!isNaN(value)) return parseFloat(value); if (isBolean(value)) return value === 'true'; if (isISODateString(value)) return new Date(value); return value; }
[ "function", "decodeValue", "(", "value", ")", "{", "value", "=", "decodeURIComponent", "(", "value", ")", ";", "if", "(", "value", "===", "\"\"", ")", "return", "value", ";", "if", "(", "!", "isNaN", "(", "value", ")", ")", "return", "parseFloat", "(",...
This method returns typed value from string
[ "This", "method", "returns", "typed", "value", "from", "string" ]
99b19b10f75dc3afae75b20f33960adc4f57b92b
https://github.com/anvaka/query-state/blob/99b19b10f75dc3afae75b20f33960adc4f57b92b/lib/query.js#L76-L85
train
angular-ui/ui-tinymce
src/tinymce.js
function() { var UITinymceService = function() { var ID_ATTR = 'ui-tinymce'; // uniqueId keeps track of the latest assigned ID var uniqueId = 0; // getUniqueId returns a unique ID var getUniqueId = function() { uniqueId ++; return ID_ATTR + '-' + uniqueId; ...
javascript
function() { var UITinymceService = function() { var ID_ATTR = 'ui-tinymce'; // uniqueId keeps track of the latest assigned ID var uniqueId = 0; // getUniqueId returns a unique ID var getUniqueId = function() { uniqueId ++; return ID_ATTR + '-' + uniqueId; ...
[ "function", "(", ")", "{", "var", "UITinymceService", "=", "function", "(", ")", "{", "var", "ID_ATTR", "=", "'ui-tinymce'", ";", "// uniqueId keeps track of the latest assigned ID", "var", "uniqueId", "=", "0", ";", "// getUniqueId returns a unique ID", "var", "getUn...
A service is used to create unique ID's, this prevents duplicate ID's if there are multiple editors on screen.
[ "A", "service", "is", "used", "to", "create", "unique", "ID", "s", "this", "prevents", "duplicate", "ID", "s", "if", "there", "are", "multiple", "editors", "on", "screen", "." ]
30434e227768c47cdcf97b552cdbc4f12fad86da
https://github.com/angular-ui/ui-tinymce/blob/30434e227768c47cdcf97b552cdbc4f12fad86da/src/tinymce.js#L217-L234
train
aurelia/router
dist/es2015/aurelia-router.js
inspect
function inspect(val, router) { if (ignoreResult || shouldContinue(val, router)) { return iterate(); } return next.cancel(val); }
javascript
function inspect(val, router) { if (ignoreResult || shouldContinue(val, router)) { return iterate(); } return next.cancel(val); }
[ "function", "inspect", "(", "val", ",", "router", ")", "{", "if", "(", "ignoreResult", "||", "shouldContinue", "(", "val", ",", "router", ")", ")", "{", "return", "iterate", "(", ")", ";", "}", "return", "next", ".", "cancel", "(", "val", ")", ";", ...
query from top down
[ "query", "from", "top", "down" ]
893b768f01aea842ee57db4222e66aa572f24404
https://github.com/aurelia/router/blob/893b768f01aea842ee57db4222e66aa572f24404/dist/es2015/aurelia-router.js#L1614-L1619
train
aurelia/router
dist/amd/aurelia-router.js
function (navigationInstruction, callbackName, next, ignoreResult) { var plan = navigationInstruction.plan; var infos = findDeactivatable(plan, callbackName); var i = infos.length; // query from inside out function inspect(val) { if (ignoreResult || shouldContinue(val)) ...
javascript
function (navigationInstruction, callbackName, next, ignoreResult) { var plan = navigationInstruction.plan; var infos = findDeactivatable(plan, callbackName); var i = infos.length; // query from inside out function inspect(val) { if (ignoreResult || shouldContinue(val)) ...
[ "function", "(", "navigationInstruction", ",", "callbackName", ",", "next", ",", "ignoreResult", ")", "{", "var", "plan", "=", "navigationInstruction", ".", "plan", ";", "var", "infos", "=", "findDeactivatable", "(", "plan", ",", "callbackName", ")", ";", "var...
Recursively find list of deactivate-able view models and invoke the either 'canDeactivate' or 'deactivate' on each @internal exported for unit testing
[ "Recursively", "find", "list", "of", "deactivate", "-", "able", "view", "models", "and", "invoke", "the", "either", "canDeactivate", "or", "deactivate", "on", "each" ]
893b768f01aea842ee57db4222e66aa572f24404
https://github.com/aurelia/router/blob/893b768f01aea842ee57db4222e66aa572f24404/dist/amd/aurelia-router.js#L1609-L1634
train
aurelia/router
dist/amd/aurelia-router.js
function (plan, callbackName, list) { if (list === void 0) { list = []; } for (var viewPortName in plan) { var viewPortPlan = plan[viewPortName]; var prevComponent = viewPortPlan.prevComponent; if ((viewPortPlan.strategy === activationStrategy.invokeLifecycle || ...
javascript
function (plan, callbackName, list) { if (list === void 0) { list = []; } for (var viewPortName in plan) { var viewPortPlan = plan[viewPortName]; var prevComponent = viewPortPlan.prevComponent; if ((viewPortPlan.strategy === activationStrategy.invokeLifecycle || ...
[ "function", "(", "plan", ",", "callbackName", ",", "list", ")", "{", "if", "(", "list", "===", "void", "0", ")", "{", "list", "=", "[", "]", ";", "}", "for", "(", "var", "viewPortName", "in", "plan", ")", "{", "var", "viewPortPlan", "=", "plan", ...
Recursively find and returns a list of deactivate-able view models @internal exported for unit testing
[ "Recursively", "find", "and", "returns", "a", "list", "of", "deactivate", "-", "able", "view", "models" ]
893b768f01aea842ee57db4222e66aa572f24404
https://github.com/aurelia/router/blob/893b768f01aea842ee57db4222e66aa572f24404/dist/amd/aurelia-router.js#L1639-L1659
train
aurelia/router
dist/commonjs/aurelia-router.js
function (routeLoader, navigationInstruction, config) { var router = navigationInstruction.router; var lifecycleArgs = navigationInstruction.lifecycleArgs; return Promise.resolve() .then(function () { return routeLoader.loadRoute(router, config, navigationInstruction); }) .then( /*...
javascript
function (routeLoader, navigationInstruction, config) { var router = navigationInstruction.router; var lifecycleArgs = navigationInstruction.lifecycleArgs; return Promise.resolve() .then(function () { return routeLoader.loadRoute(router, config, navigationInstruction); }) .then( /*...
[ "function", "(", "routeLoader", ",", "navigationInstruction", ",", "config", ")", "{", "var", "router", "=", "navigationInstruction", ".", "router", ";", "var", "lifecycleArgs", "=", "navigationInstruction", ".", "lifecycleArgs", ";", "return", "Promise", ".", "re...
Load a routed-component based on navigation instruction and route config @internal exported for unit testing only
[ "Load", "a", "routed", "-", "component", "based", "on", "navigation", "instruction", "and", "route", "config" ]
893b768f01aea842ee57db4222e66aa572f24404
https://github.com/aurelia/router/blob/893b768f01aea842ee57db4222e66aa572f24404/dist/commonjs/aurelia-router.js#L1504-L1527
train
ionic-team/ionic-plugin-keyboard
src/blackberry10/index.js
function (success, fail, args, env) { var result = new PluginResult(args, env); result.ok(keyboard.getInstance().startService(), false); }
javascript
function (success, fail, args, env) { var result = new PluginResult(args, env); result.ok(keyboard.getInstance().startService(), false); }
[ "function", "(", "success", ",", "fail", ",", "args", ",", "env", ")", "{", "var", "result", "=", "new", "PluginResult", "(", "args", ",", "env", ")", ";", "result", ".", "ok", "(", "keyboard", ".", "getInstance", "(", ")", ".", "startService", "(", ...
These methods call into JNEXT.Keyboard which handles the communication through the JNEXT plugin to keyboard_js.cpp
[ "These", "methods", "call", "into", "JNEXT", ".", "Keyboard", "which", "handles", "the", "communication", "through", "the", "JNEXT", "plugin", "to", "keyboard_js", ".", "cpp" ]
93024cf825aade60859ee71af3ad46dda008e6bf
https://github.com/ionic-team/ionic-plugin-keyboard/blob/93024cf825aade60859ee71af3ad46dda008e6bf/src/blackberry10/index.js#L16-L20
train
fuzhenn/chinese_coordinate_conversion
chncrs.js
function (wgsLon, wgsLat) { if (this.outOfChina(wgsLat, wgsLon)) return [wgsLon, wgsLat]; var d = this.delta(wgsLat, wgsLon); return [wgsLon + d.lon, wgsLat + d.lat]; }
javascript
function (wgsLon, wgsLat) { if (this.outOfChina(wgsLat, wgsLon)) return [wgsLon, wgsLat]; var d = this.delta(wgsLat, wgsLon); return [wgsLon + d.lon, wgsLat + d.lat]; }
[ "function", "(", "wgsLon", ",", "wgsLat", ")", "{", "if", "(", "this", ".", "outOfChina", "(", "wgsLat", ",", "wgsLon", ")", ")", "return", "[", "wgsLon", ",", "wgsLat", "]", ";", "var", "d", "=", "this", ".", "delta", "(", "wgsLat", ",", "wgsLon",...
WGS-84 to GCJ-02
[ "WGS", "-", "84", "to", "GCJ", "-", "02" ]
448e4e4ad4b4a84422305d7263c74d44e72dbb6a
https://github.com/fuzhenn/chinese_coordinate_conversion/blob/448e4e4ad4b4a84422305d7263c74d44e72dbb6a/chncrs.js#L34-L40
train
fuzhenn/chinese_coordinate_conversion
chncrs.js
function (gcjLon, gcjLat) { if (this.outOfChina(gcjLat, gcjLon)) return [gcjLon, gcjLat]; var d = this.delta(gcjLat, gcjLon); return [gcjLon - d.lon, gcjLat - d.lat]; }
javascript
function (gcjLon, gcjLat) { if (this.outOfChina(gcjLat, gcjLon)) return [gcjLon, gcjLat]; var d = this.delta(gcjLat, gcjLon); return [gcjLon - d.lon, gcjLat - d.lat]; }
[ "function", "(", "gcjLon", ",", "gcjLat", ")", "{", "if", "(", "this", ".", "outOfChina", "(", "gcjLat", ",", "gcjLon", ")", ")", "return", "[", "gcjLon", ",", "gcjLat", "]", ";", "var", "d", "=", "this", ".", "delta", "(", "gcjLat", ",", "gcjLon",...
GCJ-02 to WGS-84
[ "GCJ", "-", "02", "to", "WGS", "-", "84" ]
448e4e4ad4b4a84422305d7263c74d44e72dbb6a
https://github.com/fuzhenn/chinese_coordinate_conversion/blob/448e4e4ad4b4a84422305d7263c74d44e72dbb6a/chncrs.js#L42-L48
train
fuzhenn/chinese_coordinate_conversion
chncrs.js
function (gcjLon, gcjLat) { var initDelta = 0.01; var threshold = 0.000000001; var dLat = initDelta, dLon = initDelta; var mLat = gcjLat - dLat, mLon = gcjLon - dLon; var pLat = gcjLat + dLat, pLon = gcjLon + dLon; var wgsLat, wgsLon, i = 0; while (1) { ...
javascript
function (gcjLon, gcjLat) { var initDelta = 0.01; var threshold = 0.000000001; var dLat = initDelta, dLon = initDelta; var mLat = gcjLat - dLat, mLon = gcjLon - dLon; var pLat = gcjLat + dLat, pLon = gcjLon + dLon; var wgsLat, wgsLon, i = 0; while (1) { ...
[ "function", "(", "gcjLon", ",", "gcjLat", ")", "{", "var", "initDelta", "=", "0.01", ";", "var", "threshold", "=", "0.000000001", ";", "var", "dLat", "=", "initDelta", ",", "dLon", "=", "initDelta", ";", "var", "mLat", "=", "gcjLat", "-", "dLat", ",", ...
GCJ-02 to WGS-84 exactly
[ "GCJ", "-", "02", "to", "WGS", "-", "84", "exactly" ]
448e4e4ad4b4a84422305d7263c74d44e72dbb6a
https://github.com/fuzhenn/chinese_coordinate_conversion/blob/448e4e4ad4b4a84422305d7263c74d44e72dbb6a/chncrs.js#L50-L72
train
fuzhenn/chinese_coordinate_conversion
chncrs.js
function (gcjLon, gcjLat) { var x = gcjLon, y = gcjLat; var z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * this.x_pi); var theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * this.x_pi); var bdLon = z * Math.cos(theta) + 0.0065; var bdLat = z * Math.sin(theta) + 0.006; ...
javascript
function (gcjLon, gcjLat) { var x = gcjLon, y = gcjLat; var z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * this.x_pi); var theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * this.x_pi); var bdLon = z * Math.cos(theta) + 0.0065; var bdLat = z * Math.sin(theta) + 0.006; ...
[ "function", "(", "gcjLon", ",", "gcjLat", ")", "{", "var", "x", "=", "gcjLon", ",", "y", "=", "gcjLat", ";", "var", "z", "=", "Math", ".", "sqrt", "(", "x", "*", "x", "+", "y", "*", "y", ")", "+", "0.00002", "*", "Math", ".", "sin", "(", "y...
GCJ-02 to BD-09
[ "GCJ", "-", "02", "to", "BD", "-", "09" ]
448e4e4ad4b4a84422305d7263c74d44e72dbb6a
https://github.com/fuzhenn/chinese_coordinate_conversion/blob/448e4e4ad4b4a84422305d7263c74d44e72dbb6a/chncrs.js#L74-L81
train
fuzhenn/chinese_coordinate_conversion
chncrs.js
function(source, fromCRS, toCRS) { if (!source) { return null; } if (!fromCRS || !toCRS) { throw new Error('must provide a valid fromCRS and toCRS.'); } if (this._isCoord(source)) { return this._transformCoordinate(source, fromCRS, toCRS); ...
javascript
function(source, fromCRS, toCRS) { if (!source) { return null; } if (!fromCRS || !toCRS) { throw new Error('must provide a valid fromCRS and toCRS.'); } if (this._isCoord(source)) { return this._transformCoordinate(source, fromCRS, toCRS); ...
[ "function", "(", "source", ",", "fromCRS", ",", "toCRS", ")", "{", "if", "(", "!", "source", ")", "{", "return", "null", ";", "}", "if", "(", "!", "fromCRS", "||", "!", "toCRS", ")", "{", "throw", "new", "Error", "(", "'must provide a valid fromCRS and...
transform geojson's coordinates @param {Object | Array} source a coordinate [x,y] or a geoJSON object to convert @param {String | CRS Object} fromCRS crs converted from @param {String | CRS Object} toCRS crs converted to @return {Object} result geoJSON object
[ "transform", "geojson", "s", "coordinates" ]
448e4e4ad4b4a84422305d7263c74d44e72dbb6a
https://github.com/fuzhenn/chinese_coordinate_conversion/blob/448e4e4ad4b4a84422305d7263c74d44e72dbb6a/chncrs.js#L139-L156
train
aurelia/validation
dist/amd/aurelia-validation.js
getTargetDOMElement
function getTargetDOMElement(binding, view) { var target = binding.target; // DOM element if (target instanceof Element) { return target; } // custom element or custom attribute // tslint:disable-next-line:prefer-const for (var i = 0, ii = view.controllers.len...
javascript
function getTargetDOMElement(binding, view) { var target = binding.target; // DOM element if (target instanceof Element) { return target; } // custom element or custom attribute // tslint:disable-next-line:prefer-const for (var i = 0, ii = view.controllers.len...
[ "function", "getTargetDOMElement", "(", "binding", ",", "view", ")", "{", "var", "target", "=", "binding", ".", "target", ";", "// DOM element\r", "if", "(", "target", "instanceof", "Element", ")", "{", "return", "target", ";", "}", "// custom element or custom ...
Gets the DOM element associated with the data-binding. Most of the time it's the binding.target but sometimes binding.target is an aurelia custom element, or custom attribute which is a javascript "class" instance, so we need to use the controller's container to retrieve the actual DOM element.
[ "Gets", "the", "DOM", "element", "associated", "with", "the", "data", "-", "binding", ".", "Most", "of", "the", "time", "it", "s", "the", "binding", ".", "target", "but", "sometimes", "binding", ".", "target", "is", "an", "aurelia", "custom", "element", ...
ecc1dc2f0b522d6e1ff7ff1c7ba2c0973afe3b2d
https://github.com/aurelia/validation/blob/ecc1dc2f0b522d6e1ff7ff1c7ba2c0973afe3b2d/dist/amd/aurelia-validation.js#L9-L28
train
aurelia/validation
dist/amd/aurelia-validation.js
getPropertyInfo
function getPropertyInfo(expression, source) { var originalExpression = expression; while (expression instanceof aureliaBinding.BindingBehavior || expression instanceof aureliaBinding.ValueConverter) { expression = expression.expression; } var object; var propertyName; ...
javascript
function getPropertyInfo(expression, source) { var originalExpression = expression; while (expression instanceof aureliaBinding.BindingBehavior || expression instanceof aureliaBinding.ValueConverter) { expression = expression.expression; } var object; var propertyName; ...
[ "function", "getPropertyInfo", "(", "expression", ",", "source", ")", "{", "var", "originalExpression", "=", "expression", ";", "while", "(", "expression", "instanceof", "aureliaBinding", ".", "BindingBehavior", "||", "expression", "instanceof", "aureliaBinding", ".",...
Retrieves the object and property name for the specified expression. @param expression The expression @param source The scope
[ "Retrieves", "the", "object", "and", "property", "name", "for", "the", "specified", "expression", "." ]
ecc1dc2f0b522d6e1ff7ff1c7ba2c0973afe3b2d
https://github.com/aurelia/validation/blob/ecc1dc2f0b522d6e1ff7ff1c7ba2c0973afe3b2d/dist/amd/aurelia-validation.js#L43-L69
train
aurelia/validation
dist/es2017/aurelia-validation.js
configure
function configure( // tslint:disable-next-line:ban-types frameworkConfig, callback) { // the fluent rule definition API needs the parser to translate messages // to interpolation expressions. const messageParser = frameworkConfig.container.get(ValidationMessageParser); const propertyParser = fram...
javascript
function configure( // tslint:disable-next-line:ban-types frameworkConfig, callback) { // the fluent rule definition API needs the parser to translate messages // to interpolation expressions. const messageParser = frameworkConfig.container.get(ValidationMessageParser); const propertyParser = fram...
[ "function", "configure", "(", "// tslint:disable-next-line:ban-types\r", "frameworkConfig", ",", "callback", ")", "{", "// the fluent rule definition API needs the parser to translate messages\r", "// to interpolation expressions.\r", "const", "messageParser", "=", "frameworkConfig", "...
Configures the plugin.
[ "Configures", "the", "plugin", "." ]
ecc1dc2f0b522d6e1ff7ff1c7ba2c0973afe3b2d
https://github.com/aurelia/validation/blob/ecc1dc2f0b522d6e1ff7ff1c7ba2c0973afe3b2d/dist/es2017/aurelia-validation.js#L1713-L1731
train
brandly/angular-youtube-embed
src/angular-youtube-embed.js
applyBroadcast
function applyBroadcast () { var args = Array.prototype.slice.call(arguments); scope.$apply(function () { scope.$emit.apply(scope, args); }); }
javascript
function applyBroadcast () { var args = Array.prototype.slice.call(arguments); scope.$apply(function () { scope.$emit.apply(scope, args); }); }
[ "function", "applyBroadcast", "(", ")", "{", "var", "args", "=", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "arguments", ")", ";", "scope", ".", "$apply", "(", "function", "(", ")", "{", "scope", ".", "$emit", ".", "apply", "(", "scop...
YT calls callbacks outside of digest cycle
[ "YT", "calls", "callbacks", "outside", "of", "digest", "cycle" ]
23ecdd8c94d2f676a6894e21d447ee1a616a9698
https://github.com/brandly/angular-youtube-embed/blob/23ecdd8c94d2f676a6894e21d447ee1a616a9698/src/angular-youtube-embed.js#L149-L154
train
jaredhanson/passport-http
lib/passport-http/strategies/digest.js
DigestStrategy
function DigestStrategy(options, secret, validate) { if (typeof options == 'function') { validate = secret; secret = options; options = {}; } if (!secret) throw new Error('HTTP Digest authentication strategy requires a secret function'); passport.Strategy.call(this); this.name = 'digest'; thi...
javascript
function DigestStrategy(options, secret, validate) { if (typeof options == 'function') { validate = secret; secret = options; options = {}; } if (!secret) throw new Error('HTTP Digest authentication strategy requires a secret function'); passport.Strategy.call(this); this.name = 'digest'; thi...
[ "function", "DigestStrategy", "(", "options", ",", "secret", ",", "validate", ")", "{", "if", "(", "typeof", "options", "==", "'function'", ")", "{", "validate", "=", "secret", ";", "secret", "=", "options", ";", "options", "=", "{", "}", ";", "}", "if...
`DigestStrategy` constructor. The HTTP Digest authentication strategy authenticates requests based on username and digest credentials contained in the `Authorization` header field. Applications must supply a `secret` callback, which is used to look up the user and corresponding password (aka shared secret) known to b...
[ "DigestStrategy", "constructor", "." ]
aa3f9554488b6830c64e6267558997a131dccd1f
https://github.com/jaredhanson/passport-http/blob/aa3f9554488b6830c64e6267558997a131dccd1f/lib/passport-http/strategies/digest.js#L62-L83
train
jaredhanson/passport-http
lib/passport-http/strategies/digest.js
parse
function parse(params) { var opts = {}; var tokens = params.split(/,(?=(?:[^"]|"[^"]*")*$)/); for (var i = 0, len = tokens.length; i < len; i++) { var param = /(\w+)=["]?([^"]+)["]?$/.exec(tokens[i]) if (param) { opts[param[1]] = param[2]; } } return opts; }
javascript
function parse(params) { var opts = {}; var tokens = params.split(/,(?=(?:[^"]|"[^"]*")*$)/); for (var i = 0, len = tokens.length; i < len; i++) { var param = /(\w+)=["]?([^"]+)["]?$/.exec(tokens[i]) if (param) { opts[param[1]] = param[2]; } } return opts; }
[ "function", "parse", "(", "params", ")", "{", "var", "opts", "=", "{", "}", ";", "var", "tokens", "=", "params", ".", "split", "(", "/", ",(?=(?:[^\"]|\"[^\"]*\")*$)", "/", ")", ";", "for", "(", "var", "i", "=", "0", ",", "len", "=", "tokens", ".",...
Parse authentication response. @api private
[ "Parse", "authentication", "response", "." ]
aa3f9554488b6830c64e6267558997a131dccd1f
https://github.com/jaredhanson/passport-http/blob/aa3f9554488b6830c64e6267558997a131dccd1f/lib/passport-http/strategies/digest.js#L234-L244
train
jaredhanson/passport-http
lib/passport-http/strategies/digest.js
nonce
function nonce(len) { var buf = [] , chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' , charlen = chars.length; for (var i = 0; i < len; ++i) { buf.push(chars[Math.random() * charlen | 0]); } return buf.join(''); }
javascript
function nonce(len) { var buf = [] , chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' , charlen = chars.length; for (var i = 0; i < len; ++i) { buf.push(chars[Math.random() * charlen | 0]); } return buf.join(''); }
[ "function", "nonce", "(", "len", ")", "{", "var", "buf", "=", "[", "]", ",", "chars", "=", "'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'", ",", "charlen", "=", "chars", ".", "length", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<"...
Return a unique nonce with the given `len`. utils.uid(10); // => "FDaS435D2z" CREDIT: Connect -- utils.uid https://github.com/senchalabs/connect/blob/1.7.1/lib/utils.js @param {Number} len @return {String} @api private
[ "Return", "a", "unique", "nonce", "with", "the", "given", "len", "." ]
aa3f9554488b6830c64e6267558997a131dccd1f
https://github.com/jaredhanson/passport-http/blob/aa3f9554488b6830c64e6267558997a131dccd1f/lib/passport-http/strategies/digest.js#L259-L269
train
jaredhanson/passport-http
lib/passport-http/strategies/basic.js
BasicStrategy
function BasicStrategy(options, verify) { if (typeof options == 'function') { verify = options; options = {}; } if (!verify) throw new Error('HTTP Basic authentication strategy requires a verify function'); passport.Strategy.call(this); this.name = 'basic'; this._verify = verify; this._realm = ...
javascript
function BasicStrategy(options, verify) { if (typeof options == 'function') { verify = options; options = {}; } if (!verify) throw new Error('HTTP Basic authentication strategy requires a verify function'); passport.Strategy.call(this); this.name = 'basic'; this._verify = verify; this._realm = ...
[ "function", "BasicStrategy", "(", "options", ",", "verify", ")", "{", "if", "(", "typeof", "options", "==", "'function'", ")", "{", "verify", "=", "options", ";", "options", "=", "{", "}", ";", "}", "if", "(", "!", "verify", ")", "throw", "new", "Err...
`BasicStrategy` constructor. The HTTP Basic authentication strategy authenticates requests based on userid and password credentials contained in the `Authorization` header field. Applications must supply a `verify` callback which accepts `userid` and `password` credentials, and then calls the `done` callback supplyin...
[ "BasicStrategy", "constructor", "." ]
aa3f9554488b6830c64e6267558997a131dccd1f
https://github.com/jaredhanson/passport-http/blob/aa3f9554488b6830c64e6267558997a131dccd1f/lib/passport-http/strategies/basic.js#L41-L53
train
thenikso/angular-inview
angular-inview.spec.js
scrollTo
function scrollTo(element, position, useTimeout) { if (!angular.isDefined(position)) { position = element; element = window; } if (!angular.isArray(position)) { position = [0, position]; } // Prepare promise resolution var deferred = $q.defer(), timeout; var scrollOnceHandler = function () { v...
javascript
function scrollTo(element, position, useTimeout) { if (!angular.isDefined(position)) { position = element; element = window; } if (!angular.isArray(position)) { position = [0, position]; } // Prepare promise resolution var deferred = $q.defer(), timeout; var scrollOnceHandler = function () { v...
[ "function", "scrollTo", "(", "element", ",", "position", ",", "useTimeout", ")", "{", "if", "(", "!", "angular", ".", "isDefined", "(", "position", ")", ")", "{", "position", "=", "element", ";", "element", "=", "window", ";", "}", "if", "(", "!", "a...
Scrolls the element to the given x, y position and waits a bit before resolving the returned promise.
[ "Scrolls", "the", "element", "to", "the", "given", "x", "y", "position", "and", "waits", "a", "bit", "before", "resolving", "the", "returned", "promise", "." ]
5cc859115f222510eac44b9ed5f5b86aa4843338
https://github.com/thenikso/angular-inview/blob/5cc859115f222510eac44b9ed5f5b86aa4843338/angular-inview.spec.js#L349-L398
train
thenikso/angular-inview
angular-inview.js
signalFromEvent
function signalFromEvent (target, event) { return new QuickSignal(function (subscriber) { var handler = function (e) { subscriber(e); }; var el = angular.element(target); event.split(' ').map(function (e) { el[0].addEventListener(e, handler, true); }); subscriber.$dispose = functio...
javascript
function signalFromEvent (target, event) { return new QuickSignal(function (subscriber) { var handler = function (e) { subscriber(e); }; var el = angular.element(target); event.split(' ').map(function (e) { el[0].addEventListener(e, handler, true); }); subscriber.$dispose = functio...
[ "function", "signalFromEvent", "(", "target", ",", "event", ")", "{", "return", "new", "QuickSignal", "(", "function", "(", "subscriber", ")", "{", "var", "handler", "=", "function", "(", "e", ")", "{", "subscriber", "(", "e", ")", ";", "}", ";", "var"...
Returns a signal from DOM events of a target.
[ "Returns", "a", "signal", "from", "DOM", "events", "of", "a", "target", "." ]
5cc859115f222510eac44b9ed5f5b86aa4843338
https://github.com/thenikso/angular-inview/blob/5cc859115f222510eac44b9ed5f5b86aa4843338/angular-inview.js#L357-L372
train