code
stringlengths
24
2.07M
docstring
stringlengths
25
85.3k
func_name
stringlengths
1
92
language
stringclasses
1 value
repo
stringlengths
5
64
path
stringlengths
4
172
url
stringlengths
44
218
license
stringclasses
7 values
function splitText(text, options) { const KIND_NON_CJK = "non-cjk"; const KIND_CJ_LETTER = "cj-letter"; const KIND_K_LETTER = "k-letter"; const KIND_CJK_PUNCTUATION = "cjk-punctuation"; const nodes = []; (options.proseWrap === "preserve" ? text : text.replace(new RegExp(`(${cjkPattern})\n(${cjkPattern})`, "...
split text into whitespaces and words @param {string} text @return {Array<{ type: "whitespace", value: " " | "\n" | "" } | { type: "word", value: string }>}
splitText
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function appendNode(node) { const lastNode = getLast$6(nodes); if (lastNode && lastNode.type === "word") { if (lastNode.kind === KIND_NON_CJK && node.kind === KIND_CJ_LETTER && !lastNode.hasTrailingPunctuation || lastNode.kind === KIND_CJ_LETTER && node.kind === KIND_NON_CJK && !node.hasLeadingPunctuatio...
split text into whitespaces and words @param {string} text @return {Array<{ type: "whitespace", value: " " | "\n" | "" } | { type: "word", value: string }>}
appendNode
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function isBetween(kind1, kind2) { return lastNode.kind === kind1 && node.kind === kind2 || lastNode.kind === kind2 && node.kind === kind1; }
split text into whitespaces and words @param {string} text @return {Array<{ type: "whitespace", value: " " | "\n" | "" } | { type: "word", value: string }>}
isBetween
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function getOrderedListItemInfo(orderListItem, originalText) { const [, numberText, marker, leadingSpaces] = originalText.slice(orderListItem.position.start.offset, orderListItem.position.end.offset).match(/^\s*(\d+)(\.|\))(\s*)/); return { numberText, marker, leadingSpaces }; }
split text into whitespaces and words @param {string} text @return {Array<{ type: "whitespace", value: " " | "\n" | "" } | { type: "word", value: string }>}
getOrderedListItemInfo
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function hasGitDiffFriendlyOrderedList(node, options) { if (!node.ordered) { return false; } if (node.children.length < 2) { return false; } const firstNumber = Number(getOrderedListItemInfo(node.children[0], options.originalText).numberText); const secondNumber = Number(getOrderedListItemInfo(nod...
split text into whitespaces and words @param {string} text @return {Array<{ type: "whitespace", value: " " | "\n" | "" } | { type: "word", value: string }>}
hasGitDiffFriendlyOrderedList
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function getFencedCodeBlockValue(node, originalText) { const text = originalText.slice(node.position.start.offset, node.position.end.offset); const leadingSpaceCount = text.match(/^\s*/)[0].length; const replaceRegex = new RegExp(`^\\s{0,${leadingSpaceCount}}`); const lineContents = text.split("\n"); const ma...
split text into whitespaces and words @param {string} text @return {Array<{ type: "whitespace", value: " " | "\n" | "" } | { type: "word", value: string }>}
getFencedCodeBlockValue
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function getIndent(lineIndex) { return node.position.indent[lineIndex - 1] - 1; }
split text into whitespaces and words @param {string} text @return {Array<{ type: "whitespace", value: " " | "\n" | "" } | { type: "word", value: string }>}
getIndent
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function mapAst(ast, handler) { return function preorder(node, index, parentStack) { parentStack = parentStack || []; const newNode = Object.assign({}, handler(node, index, parentStack)); if (newNode.children) { newNode.children = newNode.children.map((child, index) => { return preorder(chi...
split text into whitespaces and words @param {string} text @return {Array<{ type: "whitespace", value: " " | "\n" | "" } | { type: "word", value: string }>}
mapAst
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function embed$2(path, print, textToDoc, options) { const node = path.getValue(); if (node.type === "code" && node.lang !== null) { // only look for the first string so as to support [markdown-preview-enhanced](https://shd101wyy.github.io/markdown-preview-enhanced/#/code-chunk) const langMatch = node.lang....
split text into whitespaces and words @param {string} text @return {Array<{ type: "whitespace", value: " " | "\n" | "" } | { type: "word", value: string }>}
embed$2
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function replaceNewlinesWithLiterallines(doc) { return mapDoc$3(doc, currentDoc => typeof currentDoc === "string" && currentDoc.includes("\n") ? concat$f(currentDoc.split(/(\n)/g).map((v, i) => i % 2 === 0 ? v : literalline$4)) : currentDoc); }
split text into whitespaces and words @param {string} text @return {Array<{ type: "whitespace", value: " " | "\n" | "" } | { type: "word", value: string }>}
replaceNewlinesWithLiterallines
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function startWithPragma(text) { const pragma = `@(${pragmas.join("|")})`; const regex = new RegExp([`<!--\\s*${pragma}\\s*-->`, `<!--.*\r?\n[\\s\\S]*(^|\n)[^\\S\n]*${pragma}[^\\S\n]*($|\n)[\\s\\S]*\n.*-->`].join("|"), "m"); const matched = text.match(regex); return matched && matched.index === 0; }
split text into whitespaces and words @param {string} text @return {Array<{ type: "whitespace", value: " " | "\n" | "" } | { type: "word", value: string }>}
startWithPragma
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function preprocess$1(ast, options) { ast = restoreUnescapedCharacter(ast, options); ast = mergeContinuousTexts(ast); ast = transformInlineCode(ast); ast = transformIndentedCodeblockAndMarkItsParentList(ast, options); ast = markAlignedList(ast, options); ast = splitTextIntoSentences(ast, options); ast = t...
split text into whitespaces and words @param {string} text @return {Array<{ type: "whitespace", value: " " | "\n" | "" } | { type: "word", value: string }>}
preprocess$1
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function transformImportExport(ast) { return mapAst$1(ast, node => { if (node.type !== "import" && node.type !== "export") { return node; } return Object.assign(Object.assign({}, node), {}, { type: "importExport" }); }); }
split text into whitespaces and words @param {string} text @return {Array<{ type: "whitespace", value: " " | "\n" | "" } | { type: "word", value: string }>}
transformImportExport
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function transformInlineCode(ast) { return mapAst$1(ast, node => { if (node.type !== "inlineCode") { return node; } return Object.assign(Object.assign({}, node), {}, { value: node.value.replace(/\s+/g, " ") }); }); }
split text into whitespaces and words @param {string} text @return {Array<{ type: "whitespace", value: " " | "\n" | "" } | { type: "word", value: string }>}
transformInlineCode
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function restoreUnescapedCharacter(ast, options) { return mapAst$1(ast, node => { return node.type !== "text" ? node : Object.assign(Object.assign({}, node), {}, { value: node.value !== "*" && node.value !== "_" && node.value !== "$" && // handle these cases in printer isSingleCharRegex.test(node.valu...
split text into whitespaces and words @param {string} text @return {Array<{ type: "whitespace", value: " " | "\n" | "" } | { type: "word", value: string }>}
restoreUnescapedCharacter
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function mergeContinuousImportExport(ast) { return mergeChildren(ast, (prevNode, node) => prevNode.type === "importExport" && node.type === "importExport", (prevNode, node) => ({ type: "importExport", value: prevNode.value + "\n\n" + node.value, position: { start: prevNode.position.start, end:...
split text into whitespaces and words @param {string} text @return {Array<{ type: "whitespace", value: " " | "\n" | "" } | { type: "word", value: string }>}
mergeContinuousImportExport
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function mergeChildren(ast, shouldMerge, mergeNode) { return mapAst$1(ast, node => { if (!node.children) { return node; } const children = node.children.reduce((current, child) => { const lastChild = current[current.length - 1]; if (lastChild && shouldMerge(lastChild, child)) { ...
split text into whitespaces and words @param {string} text @return {Array<{ type: "whitespace", value: " " | "\n" | "" } | { type: "word", value: string }>}
mergeChildren
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function mergeContinuousTexts(ast) { return mergeChildren(ast, (prevNode, node) => prevNode.type === "text" && node.type === "text", (prevNode, node) => ({ type: "text", value: prevNode.value + node.value, position: { start: prevNode.position.start, end: node.position.end } })); }
split text into whitespaces and words @param {string} text @return {Array<{ type: "whitespace", value: " " | "\n" | "" } | { type: "word", value: string }>}
mergeContinuousTexts
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function splitTextIntoSentences(ast, options) { return mapAst$1(ast, (node, index, [parentNode]) => { if (node.type !== "text") { return node; } let { value } = node; if (parentNode.type === "paragraph") { if (index === 0) { value = value.trimStart(); } if ...
split text into whitespaces and words @param {string} text @return {Array<{ type: "whitespace", value: " " | "\n" | "" } | { type: "word", value: string }>}
splitTextIntoSentences
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function transformIndentedCodeblockAndMarkItsParentList(ast, options) { return mapAst$1(ast, (node, index, parentStack) => { if (node.type === "code") { // the first char may point to `\n`, e.g. `\n\t\tbar`, just ignore it const isIndented = /^\n?( {4,}|\t)/.test(options.originalText.slice(node.positi...
split text into whitespaces and words @param {string} text @return {Array<{ type: "whitespace", value: " " | "\n" | "" } | { type: "word", value: string }>}
transformIndentedCodeblockAndMarkItsParentList
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function markAlignedList(ast, options) { return mapAst$1(ast, (node, index, parentStack) => { if (node.type === "list" && node.children.length !== 0) { // if one of its parents is not aligned, it's not possible to be aligned in sub-lists for (let i = 0; i < parentStack.length; i++) { const par...
split text into whitespaces and words @param {string} text @return {Array<{ type: "whitespace", value: " " | "\n" | "" } | { type: "word", value: string }>}
markAlignedList
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function getListItemStart(listItem) { return listItem.children.length === 0 ? -1 : listItem.children[0].position.start.column - 1; }
split text into whitespaces and words @param {string} text @return {Array<{ type: "whitespace", value: " " | "\n" | "" } | { type: "word", value: string }>}
getListItemStart
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function isAligned(list) { if (!list.ordered) { /** * - 123 * - 123 */ return true; } const [firstItem, secondItem] = list.children; const firstInfo = getOrderedListItemInfo$1(firstItem, options.originalText); if (firstInfo.leadingSpaces.length > 1) { /** ...
split text into whitespaces and words @param {string} text @return {Array<{ type: "whitespace", value: " " | "\n" | "" } | { type: "word", value: string }>}
isAligned
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function isTextLikeNode(node) { return node.type === "text" || node.type === "comment"; }
there's no opening/closing tag or it's considered not breakable
isTextLikeNode
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function isScriptLikeTag(node) { return node.type === "element" && (node.fullName === "script" || node.fullName === "style" || node.fullName === "svg:style" || isUnknownNamespace(node) && (node.name === "script" || node.name === "style")); }
there's no opening/closing tag or it's considered not breakable
isScriptLikeTag
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function isFrontMatterNode(node) { return node.type === "yaml" || node.type === "toml"; }
there's no opening/closing tag or it's considered not breakable
isFrontMatterNode
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function canHaveInterpolation(node) { return node.children && !isScriptLikeTag(node); }
there's no opening/closing tag or it's considered not breakable
canHaveInterpolation
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function isWhitespaceSensitiveNode(node) { return isScriptLikeTag(node) || node.type === "interpolation" || isIndentationSensitiveNode(node); }
there's no opening/closing tag or it's considered not breakable
isWhitespaceSensitiveNode
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function isIndentationSensitiveNode(node) { return getNodeCssStyleWhiteSpace(node).startsWith("pre"); }
there's no opening/closing tag or it's considered not breakable
isIndentationSensitiveNode
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function isLeadingSpaceSensitiveNode(node, options) { const isLeadingSpaceSensitive = _isLeadingSpaceSensitiveNode(); if (isLeadingSpaceSensitive && !node.prev && node.parent && node.parent.tagDefinition && node.parent.tagDefinition.ignoreFirstLf) { return node.type === "interpolation"; } return isLeading...
there's no opening/closing tag or it's considered not breakable
isLeadingSpaceSensitiveNode
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function _isLeadingSpaceSensitiveNode() { if (isFrontMatterNode(node)) { return false; } if ((node.type === "text" || node.type === "interpolation") && node.prev && (node.prev.type === "text" || node.prev.type === "interpolation")) { return true; } if (!node.parent || node.parent.cssDi...
there's no opening/closing tag or it's considered not breakable
_isLeadingSpaceSensitiveNode
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function isTrailingSpaceSensitiveNode(node, options) { if (isFrontMatterNode(node)) { return false; } if ((node.type === "text" || node.type === "interpolation") && node.next && (node.next.type === "text" || node.next.type === "interpolation")) { return true; } if (!node.parent || node.parent.cssDis...
there's no opening/closing tag or it's considered not breakable
isTrailingSpaceSensitiveNode
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function isDanglingSpaceSensitiveNode(node) { return isDanglingSpaceSensitiveCssDisplay(node.cssDisplay) && !isScriptLikeTag(node); }
there's no opening/closing tag or it's considered not breakable
isDanglingSpaceSensitiveNode
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function forceNextEmptyLine(node) { return isFrontMatterNode(node) || node.next && node.sourceSpan.end.line + 1 < node.next.sourceSpan.start.line; }
there's no opening/closing tag or it's considered not breakable
forceNextEmptyLine
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function extractWhitespaces(ast /*, options*/ ) { const TYPE_WHITESPACE = "whitespace"; return ast.map(node => { if (!node.children) { return node; } if (node.children.length === 0 || node.children.length === 1 && node.children[0].type === "text" && htmlTrim$1(node.children[0].value).length === 0...
- add `hasLeadingSpaces` field - add `hasTrailingSpaces` field - add `hasDanglingSpaces` field for parent nodes - add `isWhitespaceSensitive`, `isIndentationSensitive` field for text nodes - remove insensitive whitespaces
extractWhitespaces
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function addIsSelfClosing(ast /*, options */ ) { return ast.map(node => Object.assign(node, { isSelfClosing: !node.children || node.type === "element" && (node.tagDefinition.isVoid || // self-closing node.startSourceSpan === node.endSourceSpan) })); }
- add `hasLeadingSpaces` field - add `hasTrailingSpaces` field - add `hasDanglingSpaces` field for parent nodes - add `isWhitespaceSensitive`, `isIndentationSensitive` field for text nodes - remove insensitive whitespaces
addIsSelfClosing
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function addHasHtmComponentClosingTag(ast, options) { return ast.map(node => node.type !== "element" ? node : Object.assign(node, { hasHtmComponentClosingTag: node.endSourceSpan && /^<\s*\/\s*\/\s*>$/.test(options.originalText.slice(node.endSourceSpan.start.offset, node.endSourceSpan.end.offset)) })); }
- add `hasLeadingSpaces` field - add `hasTrailingSpaces` field - add `hasDanglingSpaces` field for parent nodes - add `isWhitespaceSensitive`, `isIndentationSensitive` field for text nodes - remove insensitive whitespaces
addHasHtmComponentClosingTag
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function addCssDisplay(ast, options) { return ast.map(node => Object.assign(node, { cssDisplay: getNodeCssStyleDisplay$1(node, options) })); }
- add `hasLeadingSpaces` field - add `hasTrailingSpaces` field - add `hasDanglingSpaces` field for parent nodes - add `isWhitespaceSensitive`, `isIndentationSensitive` field for text nodes - remove insensitive whitespaces
addCssDisplay
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function addIsSpaceSensitive(ast, options) { return ast.map(node => { if (!node.children) { return node; } if (node.children.length === 0) { return node.clone({ isDanglingSpaceSensitive: isDanglingSpaceSensitiveNode$1(node) }); } return node.clone({ children: node...
- add `isLeadingSpaceSensitive` field - add `isTrailingSpaceSensitive` field - add `isDanglingSpaceSensitive` field for parent nodes
addIsSpaceSensitive
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function hasPragma$3(text) { return /^\s*<!--\s*@(format|prettier)\s*-->/.test(text); }
- add `isLeadingSpaceSensitive` field - add `isTrailingSpaceSensitive` field - add `isDanglingSpaceSensitive` field for parent nodes
hasPragma$3
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function insertPragma$6(text) { return "<!-- @format -->\n\n" + text.replace(/^\s*\n/, ""); }
- add `isLeadingSpaceSensitive` field - add `isTrailingSpaceSensitive` field - add `isDanglingSpaceSensitive` field for parent nodes
insertPragma$6
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function printVueFor(value, textToDoc) { const { left, operator, right } = parseVueFor(value); return concat$h([group$h(textToDoc(`function _(${left}) {}`, { parser: "babel", __isVueForBindingLeft: true })), " ", operator, " ", textToDoc(right, { parser: "__js_expression" })]); } // mo...
v-for="... in ..." v-for="... of ..." v-for="(..., ...) in ..." v-for="(..., ...) of ..."
printVueFor
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function parseVueFor(value) { const forAliasRE = /([^]*?)\s+(in|of)\s+([^]*)/; const forIteratorRE = /,([^,\]}]*)(?:,([^,\]}]*))?$/; const stripParensRE = /^\(|\)$/g; const inMatch = value.match(forAliasRE); if (!inMatch) { return; } const res = {}; res.for = inMatch[3].trim(); const alias = inM...
v-for="... in ..." v-for="... of ..." v-for="(..., ...) in ..." v-for="(..., ...) of ..."
parseVueFor
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function printVueSlotScope(value, textToDoc) { return textToDoc(`function _(${value}) {}`, { parser: "babel", __isVueSlotScope: true }); }
v-for="... in ..." v-for="... of ..." v-for="(..., ...) in ..." v-for="(..., ...) of ..."
printVueSlotScope
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function isVueEventBindingExpression$2(eventBindingValue) { // https://github.com/vuejs/vue/blob/v2.5.17/src/compiler/codegen/events.js#L3-L4 // arrow function or anonymous function const fnExpRE = /^([\w$]+|\([^)]*?\))\s*=>|^function\s*\(/; // simple member expression chain (a, a.b, a['b'], a["b"], a[0], a[b]) ...
v-for="... in ..." v-for="... of ..." v-for="(..., ...) in ..." v-for="(..., ...) of ..."
isVueEventBindingExpression$2
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function deepUnique(array) { return array.sort().filter((element, index) => { return JSON.stringify(element) !== JSON.stringify(array[index - 1]); }); }
v-for="... in ..." v-for="... of ..." v-for="(..., ...) in ..." v-for="(..., ...) of ..."
deepUnique
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
parse$6 = string => { return deepUnique(string.split(',').map(part => { const result = {}; part.trim().split(/\s+/).forEach((element, index) => { if (index === 0) { result.url = element; return; } const value = element.slice(0, element.length - 1); const postfix = elem...
v-for="... in ..." v-for="... of ..." v-for="(..., ...) in ..." v-for="(..., ...) of ..."
parse$6
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
stringify$2 = array => { return [...new Set(array.map(element => { if (!element.url) { throw new Error('URL is required'); } const result = [element.url]; if (element.width) { result.push(`${element.width}w`); } if (element.height) { result.push(`${element.height}h`); ...
v-for="... in ..." v-for="... of ..." v-for="(..., ...) in ..." v-for="(..., ...) of ..."
stringify$2
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function printImgSrcset(value) { const srcset = parseSrcset(value); const hasW = srcset.some(src => src.width); const hasH = srcset.some(src => src.height); const hasX = srcset.some(src => src.density); if (hasW + hasH + hasX > 1) { throw new Error("Mixed descriptor in srcset is not supported"); } c...
v-for="... in ..." v-for="... of ..." v-for="(..., ...) in ..." v-for="(..., ...) of ..."
printImgSrcset
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function printClassNames(value) { return value.trim().split(/\s+/).join(" "); }
v-for="... in ..." v-for="... of ..." v-for="(..., ...) in ..." v-for="(..., ...) of ..."
printClassNames
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function concat$j(parts) { const newParts = normalizeParts$2(parts); return newParts.length === 0 ? "" : newParts.length === 1 ? newParts[0] : builders.concat(newParts); }
v-for="... in ..." v-for="... of ..." v-for="(..., ...) in ..." v-for="(..., ...) of ..."
concat$j
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function embed$4(path, print, textToDoc, options) { const node = path.getValue(); switch (node.type) { case "text": { if (isScriptLikeTag$1(node.parent)) { const parser = inferScriptParser$1(node.parent); if (parser) { const value = parser === "markdown" ? dedentS...
v-for="... in ..." v-for="... of ..." v-for="(..., ...) in ..." v-for="(..., ...) of ..."
embed$4
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function genericPrint$5(path, options, print) { const node = path.getValue(); switch (node.type) { case "root": if (options.__onHtmlRoot) { options.__onHtmlRoot(node); } // use original concat to not break stripTrailingHardline return builders.concat([group$i(printChildren$2(path, o...
v-for="... in ..." v-for="... of ..." v-for="(..., ...) in ..." v-for="(..., ...) of ..."
genericPrint$5
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function printOpeningTag(path, options, print) { const node = path.getValue(); const forceNotToBreakAttrContent = node.type === "element" && node.fullName === "script" && node.attrs.length === 1 && node.attrs[0].fullName === "src" && node.children.length === 0; return concat$j([printOpeningTagStart(node, options)...
Want to write us a letter? Use our<a ><b><a>mailing address</a></b></a ~ >.
printOpeningTag
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function isNode(value, types) { return value && typeof value.type === "string" && (!types || types.includes(value.type)); }
@param {any} value @param {string[]=} types
isNode
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function mapNode(node, callback, parent) { return callback("children" in node ? Object.assign(Object.assign({}, node), {}, { children: node.children.map(childNode => mapNode(childNode, callback, node)) }) : node, parent); }
@param {any} value @param {string[]=} types
mapNode
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function defineShortcut(x, key, getter) { Object.defineProperty(x, key, { get: getter, enumerable: false }); }
@param {any} value @param {string[]=} types
defineShortcut
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function isNextLineEmpty$7(node, text) { let newlineCount = 0; const textLength = text.length; for (let i = node.position.end.offset - 1; i < textLength; i++) { const char = text[i]; if (char === "\n") { newlineCount++; } if (newlineCount === 1 && /\S/.test(char)) { return false; ...
@param {any} value @param {string[]=} types
isNextLineEmpty$7
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function isLastDescendantNode(path) { const node = path.getValue(); switch (node.type) { case "tag": case "anchor": case "comment": return false; } const pathStackLength = path.stack.length; for (let i = 1; i < pathStackLength; i++) { const item = path.stack[i]; const parentItem =...
@param {any} value @param {string[]=} types
isLastDescendantNode
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function getLastDescendantNode$1(node) { return "children" in node && node.children.length !== 0 ? getLastDescendantNode$1(getLast$7(node.children)) : node; }
@param {any} value @param {string[]=} types
getLastDescendantNode$1
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function isPrettierIgnore$2(comment) { return comment.value.trim() === "prettier-ignore"; }
@param {any} value @param {string[]=} types
isPrettierIgnore$2
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function hasPrettierIgnore$7(path) { const node = path.getValue(); if (node.type === "documentBody") { const document = path.getParentNode(); return hasEndComments(document.head) && isPrettierIgnore$2(getLast$7(document.head.endComments)); } return hasLeadingComments(node) && isPrettierIgnore$2(getLas...
@param {any} value @param {string[]=} types
hasPrettierIgnore$7
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function isEmptyNode(node) { return (!node.children || node.children.length === 0) && !hasComments(node); }
@param {any} value @param {string[]=} types
isEmptyNode
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function hasComments(node) { return hasLeadingComments(node) || hasMiddleComments(node) || hasIndicatorComment(node) || hasTrailingComment$4(node) || hasEndComments(node); }
@param {any} value @param {string[]=} types
hasComments
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function hasLeadingComments(node) { return node && node.leadingComments && node.leadingComments.length !== 0; }
@param {any} value @param {string[]=} types
hasLeadingComments
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function hasMiddleComments(node) { return node && node.middleComments && node.middleComments.length !== 0; }
@param {any} value @param {string[]=} types
hasMiddleComments
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function hasIndicatorComment(node) { return node && node.indicatorComment; }
@param {any} value @param {string[]=} types
hasIndicatorComment
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function hasTrailingComment$4(node) { return node && node.trailingComment; }
@param {any} value @param {string[]=} types
hasTrailingComment$4
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function hasEndComments(node) { return node && node.endComments && node.endComments.length !== 0; }
@param {any} value @param {string[]=} types
hasEndComments
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/index.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
Apache-2.0
function hunkFits(hunk, toPos) { for (var j = 0; j < hunk.lines.length; j++) { var line = hunk.lines[j], operation = line.length > 0 ? line[0] : ' ', content = line.length > 0 ? line.substr(1) : line; if (operation === ' ' || operation === '-') { // Context sanit...
Checks if the hunk exactly fits on the provided location
hunkFits
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/standalone.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js
Apache-2.0
function applyPatches(uniDiff, options) { if (typeof uniDiff === 'string') { uniDiff = parsePatch(uniDiff); } var currentIndex = 0; function processIndex() { var index = uniDiff[currentIndex++]; if (!index) { return options.complete(); } options.loadFile(index, ...
Checks if the hunk exactly fits on the provided location
applyPatches
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/standalone.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js
Apache-2.0
function processIndex() { var index = uniDiff[currentIndex++]; if (!index) { return options.complete(); } options.loadFile(index, function (err, data) { if (err) { return options.complete(err); } var updatedContent = applyPatch(data, index, options); ...
Checks if the hunk exactly fits on the provided location
processIndex
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/standalone.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js
Apache-2.0
function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { if (!options) { options = {}; } if (typeof options.context === 'undefined') { options.context = 4; } var diff = diffLines(oldStr, newStr, options); diff.push({ value: '', ...
Checks if the hunk exactly fits on the provided location
structuredPatch
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/standalone.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js
Apache-2.0
function contextLines(lines) { return lines.map(function (entry) { return ' ' + entry; }); }
Checks if the hunk exactly fits on the provided location
contextLines
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/standalone.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js
Apache-2.0
_loop = function _loop(i) { var current = diff[i], lines = current.lines || current.value.replace(/\n$/, '').split('\n'); current.lines = lines; if (current.added || current.removed) { var _curRange; // If we have previous context, start with that if (!oldRangeStart) { ...
Checks if the hunk exactly fits on the provided location
_loop
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/standalone.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js
Apache-2.0
function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { var diff = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options); var ret = []; if (oldFileName == newFileName) { ret.push('Index: ' + oldFileName); } re...
Checks if the hunk exactly fits on the provided location
createTwoFilesPatch
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/standalone.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js
Apache-2.0
function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) { return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options); }
Checks if the hunk exactly fits on the provided location
createPatch
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/standalone.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js
Apache-2.0
function arrayEqual(a, b) { if (a.length !== b.length) { return false; } return arrayStartsWith(a, b); }
Checks if the hunk exactly fits on the provided location
arrayEqual
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/standalone.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js
Apache-2.0
function arrayStartsWith(array, start) { if (start.length > array.length) { return false; } for (var i = 0; i < start.length; i++) { if (start[i] !== array[i]) { return false; } } return true; }
Checks if the hunk exactly fits on the provided location
arrayStartsWith
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/standalone.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js
Apache-2.0
function calcLineCount(hunk) { var _calcOldNewLineCount = calcOldNewLineCount(hunk.lines), oldLines = _calcOldNewLineCount.oldLines, newLines = _calcOldNewLineCount.newLines; if (oldLines !== undefined) { hunk.oldLines = oldLines; } else { delete hunk.oldLines; } if (ne...
Checks if the hunk exactly fits on the provided location
calcLineCount
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/standalone.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js
Apache-2.0
function merge(mine, theirs, base) { mine = loadPatch(mine, base); theirs = loadPatch(theirs, base); var ret = {}; // For index we just let it pass through as it doesn't have any necessary meaning. // Leaving sanity checks on this to the API consumer that may know more about the // meaning in their ...
Checks if the hunk exactly fits on the provided location
merge
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/standalone.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js
Apache-2.0
function loadPatch(param, base) { if (typeof param === 'string') { if (/^@@/m.test(param) || /^Index:/m.test(param)) { return parsePatch(param)[0]; } if (!base) { throw new Error('Must provide a base reference or pass in a patch'); } return structuredPatch(undefined, ...
Checks if the hunk exactly fits on the provided location
loadPatch
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/standalone.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js
Apache-2.0
function fileNameChanged(patch) { return patch.newFileName && patch.newFileName !== patch.oldFileName; }
Checks if the hunk exactly fits on the provided location
fileNameChanged
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/standalone.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js
Apache-2.0
function selectField(index, mine, theirs) { if (mine === theirs) { return mine; } else { index.conflict = true; return { mine: mine, theirs: theirs }; } }
Checks if the hunk exactly fits on the provided location
selectField
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/standalone.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js
Apache-2.0
function hunkBefore(test, check) { return test.oldStart < check.oldStart && test.oldStart + test.oldLines < check.oldStart; }
Checks if the hunk exactly fits on the provided location
hunkBefore
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/standalone.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js
Apache-2.0
function cloneHunk(hunk, offset) { return { oldStart: hunk.oldStart, oldLines: hunk.oldLines, newStart: hunk.newStart + offset, newLines: hunk.newLines, lines: hunk.lines }; }
Checks if the hunk exactly fits on the provided location
cloneHunk
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/standalone.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js
Apache-2.0
function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) { // This will generally result in a conflicted hunk, but there are cases where the context // is the only overlap where we can successfully merge the content here. var mine = { offset: mineOffset, lines: mineLines, ...
Checks if the hunk exactly fits on the provided location
mergeLines
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/standalone.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js
Apache-2.0
function mutualChange(hunk, mine, their) { var myChanges = collectChange(mine), theirChanges = collectChange(their); if (allRemoves(myChanges) && allRemoves(theirChanges)) { // Special case for remove changes that are supersets of one another if (arrayStartsWith(myChanges, theirChanges) && ...
Checks if the hunk exactly fits on the provided location
mutualChange
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/standalone.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js
Apache-2.0
function removal(hunk, mine, their, swap) { var myChanges = collectChange(mine), theirChanges = collectContext(their, myChanges); if (theirChanges.merged) { var _hunk$lines6; (_hunk$lines6 = hunk.lines).push.apply(_hunk$lines6, _toConsumableArray(theirChanges.merged)); } else { c...
Checks if the hunk exactly fits on the provided location
removal
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/standalone.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js
Apache-2.0
function conflict(hunk, mine, their) { hunk.conflict = true; hunk.lines.push({ conflict: true, mine: mine, theirs: their }); }
Checks if the hunk exactly fits on the provided location
conflict
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/standalone.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js
Apache-2.0
function insertLeading(hunk, insert, their) { while (insert.offset < their.offset && insert.index < insert.lines.length) { var line = insert.lines[insert.index++]; hunk.lines.push(line); insert.offset++; } }
Checks if the hunk exactly fits on the provided location
insertLeading
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/standalone.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js
Apache-2.0
function insertTrailing(hunk, insert) { while (insert.index < insert.lines.length) { var line = insert.lines[insert.index++]; hunk.lines.push(line); } }
Checks if the hunk exactly fits on the provided location
insertTrailing
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/standalone.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js
Apache-2.0
function collectChange(state) { var ret = [], operation = state.lines[state.index][0]; while (state.index < state.lines.length) { var line = state.lines[state.index]; // Group additions that are immediately after subtractions and treat them as one "atomic" modify change. if (operation === ...
Checks if the hunk exactly fits on the provided location
collectChange
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/standalone.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js
Apache-2.0
function collectContext(state, matchChanges) { var changes = [], merged = [], matchIndex = 0, contextChanges = false, conflicted = false; while (matchIndex < matchChanges.length && state.index < state.lines.length) { var change = state.lines[state.index], match =...
Checks if the hunk exactly fits on the provided location
collectContext
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/standalone.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js
Apache-2.0
function allRemoves(changes) { return changes.reduce(function (prev, change) { return prev && change[0] === '-'; }, true); }
Checks if the hunk exactly fits on the provided location
allRemoves
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/standalone.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js
Apache-2.0
function skipRemoveSuperset(state, removeChanges, delta) { for (var i = 0; i < delta; i++) { var changeContent = removeChanges[removeChanges.length - delta + i].substr(1); if (state.lines[state.index + i] !== ' ' + changeContent) { return false; } } state.index += delta; retu...
Checks if the hunk exactly fits on the provided location
skipRemoveSuperset
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/standalone.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js
Apache-2.0
function calcOldNewLineCount(lines) { var oldLines = 0; var newLines = 0; lines.forEach(function (line) { if (typeof line !== 'string') { var myCount = calcOldNewLineCount(line.mine); var theirCount = calcOldNewLineCount(line.theirs); if (oldLines !== undefined) { if...
Checks if the hunk exactly fits on the provided location
calcOldNewLineCount
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/standalone.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js
Apache-2.0
function convertChangesToDMP(changes) { var ret = [], change, operation; for (var i = 0; i < changes.length; i++) { change = changes[i]; if (change.added) { operation = 1; } else if (change.removed) { operation = -1; } else { operation = 0; ...
Checks if the hunk exactly fits on the provided location
convertChangesToDMP
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/standalone.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js
Apache-2.0
function convertChangesToXML(changes) { var ret = []; for (var i = 0; i < changes.length; i++) { var change = changes[i]; if (change.added) { ret.push('<ins>'); } else if (change.removed) { ret.push('<del>'); } ret.push(escapeHTML(change.value)); if (chang...
Checks if the hunk exactly fits on the provided location
convertChangesToXML
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/standalone.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js
Apache-2.0
function escapeHTML(s) { var n = s; n = n.replace(/&/g, '&amp;'); n = n.replace(/</g, '&lt;'); n = n.replace(/>/g, '&gt;'); n = n.replace(/"/g, '&quot;'); return n; }
Checks if the hunk exactly fits on the provided location
escapeHTML
javascript
douyu/juno
assets/public/js/prettier/v2.0.5/standalone.js
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js
Apache-2.0