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 |
|---|---|---|---|---|---|---|---|
get rawValue() {
if (!this.valueRange || !this.context) return null;
const {
start,
end
} = this.valueRange;
return this.context.src.slice(start, end);
} | End of indentation, or null if the line's indent level is not more
than `indent`
@param {string} src
@param {number} indent
@param {number} lineStart
@returns {?number} | rawValue | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
get tag() {
for (let i = 0; i < this.props.length; ++i) {
const tag = this.getPropValue(i, constants.Char.TAG, false);
if (tag != null) {
if (tag[1] === '<') {
return {
verbatim: tag.slice(2, -1)
};
} else {
// eslint-disable-n... | End of indentation, or null if the line's indent level is not more
than `indent`
@param {string} src
@param {number} indent
@param {number} lineStart
@returns {?number} | tag | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
get valueRangeContainsNewline() {
if (!this.valueRange || !this.context) return false;
const {
start,
end
} = this.valueRange;
const {
src
} = this.context;
for (let i = start; i < end; ++i) {
if (src[i] === '\n') return true;
}
return fa... | End of indentation, or null if the line's indent level is not more
than `indent`
@param {string} src
@param {number} indent
@param {number} lineStart
@returns {?number} | valueRangeContainsNewline | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
parseComment(start) {
const {
src
} = this.context;
if (src[start] === constants.Char.COMMENT) {
const end = Node.endOfLine(src, start + 1);
const commentRange = new _Range.default(start, end);
this.props.push(commentRange);
return end;
}
return st... | End of indentation, or null if the line's indent level is not more
than `indent`
@param {string} src
@param {number} indent
@param {number} lineStart
@returns {?number} | parseComment | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
setOrigRanges(cr, offset) {
if (this.range) offset = this.range.setOrigRange(cr, offset);
if (this.valueRange) this.valueRange.setOrigRange(cr, offset);
this.props.forEach(prop => prop.setOrigRange(cr, offset));
return offset;
} | Populates the `origStart` and `origEnd` values of all ranges for this
node. Extended by child classes to handle descendant nodes.
@param {number[]} cr - Positions of dropped CR characters
@param {number} offset - Starting index of `cr` from the last call
@returns {number} - The next offset, matching the one found for ... | setOrigRanges | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
toString() {
const {
context: {
src
},
range,
value
} = this;
if (value != null) return value;
const str = src.slice(range.start, range.end);
return Node.addStringTerminator(src, range.end, str);
} | Populates the `origStart` and `origEnd` values of all ranges for this
node. Extended by child classes to handle descendant nodes.
@param {number[]} cr - Positions of dropped CR characters
@param {number} offset - Starting index of `cr` from the last call
@returns {number} - The next offset, matching the one found for ... | toString | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
} | Populates the `origStart` and `origEnd` values of all ranges for this
node. Extended by child classes to handle descendant nodes.
@param {number[]} cr - Positions of dropped CR characters
@param {number} offset - Starting index of `cr` from the last call
@returns {number} - The next offset, matching the one found for ... | _interopRequireDefault | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
constructor(name, source, message) {
if (!message || !(source instanceof _Node.default)) throw new Error(`Invalid arguments for new ${name}`);
super();
this.name = name;
this.message = message;
this.source = source;
} | Populates the `origStart` and `origEnd` values of all ranges for this
node. Extended by child classes to handle descendant nodes.
@param {number[]} cr - Positions of dropped CR characters
@param {number} offset - Starting index of `cr` from the last call
@returns {number} - The next offset, matching the one found for ... | constructor | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
makePretty() {
if (!this.source) return;
this.nodeType = this.source.type;
const cst = this.source.context && this.source.context.root;
if (typeof this.offset === 'number') {
this.range = new _Range.default(this.offset, this.offset + 1);
const start = cst && (0, sourceUtils.getL... | Populates the `origStart` and `origEnd` values of all ranges for this
node. Extended by child classes to handle descendant nodes.
@param {number[]} cr - Positions of dropped CR characters
@param {number} offset - Starting index of `cr` from the last call
@returns {number} - The next offset, matching the one found for ... | makePretty | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
constructor(source, message) {
super('YAMLReferenceError', source, message);
} | Populates the `origStart` and `origEnd` values of all ranges for this
node. Extended by child classes to handle descendant nodes.
@param {number[]} cr - Positions of dropped CR characters
@param {number} offset - Starting index of `cr` from the last call
@returns {number} - The next offset, matching the one found for ... | constructor | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
constructor(source, message) {
super('YAMLSemanticError', source, message);
} | Populates the `origStart` and `origEnd` values of all ranges for this
node. Extended by child classes to handle descendant nodes.
@param {number[]} cr - Positions of dropped CR characters
@param {number} offset - Starting index of `cr` from the last call
@returns {number} - The next offset, matching the one found for ... | constructor | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
constructor(source, message) {
super('YAMLSyntaxError', source, message);
} | Populates the `origStart` and `origEnd` values of all ranges for this
node. Extended by child classes to handle descendant nodes.
@param {number[]} cr - Positions of dropped CR characters
@param {number} offset - Starting index of `cr` from the last call
@returns {number} - The next offset, matching the one found for ... | constructor | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
constructor(source, message) {
super('YAMLWarning', source, message);
} | Populates the `origStart` and `origEnd` values of all ranges for this
node. Extended by child classes to handle descendant nodes.
@param {number[]} cr - Positions of dropped CR characters
@param {number} offset - Starting index of `cr` from the last call
@returns {number} - The next offset, matching the one found for ... | constructor | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
} | Populates the `origStart` and `origEnd` values of all ranges for this
node. Extended by child classes to handle descendant nodes.
@param {number[]} cr - Positions of dropped CR characters
@param {number} offset - Starting index of `cr` from the last call
@returns {number} - The next offset, matching the one found for ... | _interopRequireDefault | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
get includesTrailingLines() {
// This is never called from anywhere, but if it were,
// this is the value it should return.
return true;
} | Populates the `origStart` and `origEnd` values of all ranges for this
node. Extended by child classes to handle descendant nodes.
@param {number[]} cr - Positions of dropped CR characters
@param {number} offset - Starting index of `cr` from the last call
@returns {number} - The next offset, matching the one found for ... | includesTrailingLines | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
parse(context, start) {
this.context = context;
const {
src
} = context;
let offset = start + 1;
while (_Node.default.atBlank(src, offset)) {
const lineEnd = _Node.default.endOfWhiteSpace(src, offset);
if (lineEnd === '\n') offset = lineEnd + 1;else break;
}... | Parses blank lines from the source
@param {ParseContext} context
@param {number} start - Index of first \n character
@returns {number} - Index of the character after this | parse | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
} | Parses blank lines from the source
@param {ParseContext} context
@param {number} start - Index of first \n character
@returns {number} - Index of the character after this | _interopRequireDefault | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
constructor(type, props) {
super(type, props);
this.node = null;
} | Parses blank lines from the source
@param {ParseContext} context
@param {number} start - Index of first \n character
@returns {number} - Index of the character after this | constructor | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
get includesTrailingLines() {
return !!this.node && this.node.includesTrailingLines;
} | Parses blank lines from the source
@param {ParseContext} context
@param {number} start - Index of first \n character
@returns {number} - Index of the character after this | includesTrailingLines | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
parse(context, start) {
this.context = context;
const {
parseNode,
src
} = context;
let {
atLineStart,
lineStart
} = context;
if (!atLineStart && this.type === constants.Type.SEQ_ITEM) this.error = new errors.YAMLSemanticError(this, 'Sequence items mus... | @param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this | parse | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
setOrigRanges(cr, offset) {
offset = super.setOrigRanges(cr, offset);
return this.node ? this.node.setOrigRanges(cr, offset) : offset;
} | @param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this | setOrigRanges | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
toString() {
const {
context: {
src
},
node,
range,
value
} = this;
if (value != null) return value;
const str = node ? src.slice(range.start, node.range.start) + String(node) : src.slice(range.start, range.end);
return _Node.default.addStr... | @param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this | toString | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
} | @param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this | _interopRequireDefault | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
parse(context, start) {
this.context = context;
const offset = this.parseComment(start);
this.range = new _Range.default(start, offset);
return offset;
} | Parses a comment line from the source
@param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this scalar | parse | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
} | Parses a comment line from the source
@param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this scalar | _interopRequireDefault | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function grabCollectionEndComments(node) {
let cnode = node;
while (cnode instanceof _CollectionItem.default) cnode = cnode.node;
if (!(cnode instanceof Collection)) return null;
const len = cnode.items.length;
let ci = -1;
for (let i = len - 1; i >= 0; --i) {
const n = cnode.items[i];
... | Parses a comment line from the source
@param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this scalar | grabCollectionEndComments | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
static nextContentHasIndent(src, offset, indent) {
const lineStart = _Node.default.endOfLine(src, offset) + 1;
offset = _Node.default.endOfWhiteSpace(src, lineStart);
const ch = src[offset];
if (!ch) return false;
if (offset >= lineStart + indent) return true;
if (ch !== '#' && ch !=... | Parses a comment line from the source
@param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this scalar | nextContentHasIndent | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
constructor(firstItem) {
super(firstItem.type === constants.Type.SEQ_ITEM ? constants.Type.SEQ : constants.Type.MAP);
for (let i = firstItem.props.length - 1; i >= 0; --i) {
if (firstItem.props[i].start < firstItem.context.lineStart) {
// props on previous line are assumed by the collecti... | Parses a comment line from the source
@param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this scalar | constructor | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
get includesTrailingLines() {
return this.items.length > 0;
} | Parses a comment line from the source
@param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this scalar | includesTrailingLines | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
parse(context, start) {
this.context = context;
const {
parseNode,
src
} = context; // It's easier to recalculate lineStart here rather than tracking down the
// last context from which to read it -- eemeli/yaml#2
let lineStart = _Node.default.startOfLine(src, start);
... | @param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this | parse | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
setOrigRanges(cr, offset) {
offset = super.setOrigRanges(cr, offset);
this.items.forEach(node => {
offset = node.setOrigRanges(cr, offset);
});
return offset;
} | @param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this | setOrigRanges | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
toString() {
const {
context: {
src
},
items,
range,
value
} = this;
if (value != null) return value;
let str = src.slice(range.start, items[0].range.start) + String(items[0]);
for (let i = 1; i < items.length; ++i) {
const item = ... | @param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this | toString | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
} | @param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this | _interopRequireDefault | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
constructor() {
super(constants.Type.DIRECTIVE);
this.name = null;
} | @param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this | constructor | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
get parameters() {
const raw = this.rawValue;
return raw ? raw.trim().split(/[ \t]+/) : [];
} | @param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this | parameters | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
parseName(start) {
const {
src
} = this.context;
let offset = start;
let ch = src[offset];
while (ch && ch !== '\n' && ch !== '\t' && ch !== ' ') ch = src[offset += 1];
this.name = src.slice(start, offset);
return offset;
} | @param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this | parseName | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
parseParameters(start) {
const {
src
} = this.context;
let offset = start;
let ch = src[offset];
while (ch && ch !== '\n' && ch !== '#') ch = src[offset += 1];
this.valueRange = new _Range.default(start, offset);
return offset;
} | @param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this | parseParameters | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
parse(context, start) {
this.context = context;
let offset = this.parseName(start + 1);
offset = this.parseParameters(offset);
offset = this.parseComment(offset);
this.range = new _Range.default(start, offset);
return offset;
} | @param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this | parse | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
} | @param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this | _interopRequireDefault | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
static startCommentOrEndBlankLine(src, start) {
const offset = _Node.default.endOfWhiteSpace(src, start);
const ch = src[offset];
return ch === '#' || ch === '\n' ? offset : start;
} | @param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this | startCommentOrEndBlankLine | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
constructor() {
super(constants.Type.DOCUMENT);
this.directives = null;
this.contents = null;
this.directivesEndMarker = null;
this.documentEndMarker = null;
} | @param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this | constructor | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
parseDirectives(start) {
const {
src
} = this.context;
this.directives = [];
let atLineStart = true;
let hasDirectives = false;
let offset = start;
while (!_Node.default.atDocumentBoundary(src, offset, constants.Char.DIRECTIVES_END)) {
offset = Document.startCo... | @param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this | parseDirectives | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
parseContents(start) {
const {
parseNode,
src
} = this.context;
if (!this.contents) this.contents = [];
let lineStart = start;
while (src[lineStart - 1] === '-') lineStart -= 1;
let offset = _Node.default.endOfWhiteSpace(src, start);
let atLineStart = lineSta... | @param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this | parseContents | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
parse(context, start) {
context.root = this;
this.context = context;
const {
src
} = context;
let offset = src.charCodeAt(start) === 0xfeff ? start + 1 : start; // skip BOM
offset = this.parseDirectives(offset);
offset = this.parseContents(offset);
return offset;... | @param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this | parse | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
setOrigRanges(cr, offset) {
offset = super.setOrigRanges(cr, offset);
this.directives.forEach(node => {
offset = node.setOrigRanges(cr, offset);
});
if (this.directivesEndMarker) offset = this.directivesEndMarker.setOrigRange(cr, offset);
this.contents.forEach(node => {
off... | @param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this | setOrigRanges | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
toString() {
const {
contents,
directives,
value
} = this;
if (value != null) return value;
let str = directives.join('');
if (contents.length > 0) {
if (directives.length > 0 || contents[0].type === constants.Type.COMMENT) str += '---\n';
str += co... | @param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this | toString | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
} | @param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this | _interopRequireDefault | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
parse(context, start) {
this.context = context;
const {
src
} = context;
let offset = _Node.default.endOfIdentifier(src, start + 1);
this.valueRange = new _Range.default(start + 1, offset);
offset = _Node.default.endOfWhiteSpace(src, offset);
offset = this.parseCommen... | Parses an *alias from the source
@param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this scalar | parse | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
} | Parses an *alias from the source
@param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this scalar | _interopRequireDefault | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
constructor(type, props) {
super(type, props);
this.blockIndent = null;
this.chomping = Chomp.CLIP;
this.header = null;
} | Parses an *alias from the source
@param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this scalar | constructor | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
get includesTrailingLines() {
return this.chomping === Chomp.KEEP;
} | Parses an *alias from the source
@param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this scalar | includesTrailingLines | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
get strValue() {
if (!this.valueRange || !this.context) return null;
let {
start,
end
} = this.valueRange;
const {
indent,
src
} = this.context;
if (this.valueRange.isEmpty()) return '';
let lastNewLine = null;
let ch = src[end - 1];
... | Parses an *alias from the source
@param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this scalar | strValue | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
parseBlockHeader(start) {
const {
src
} = this.context;
let offset = start + 1;
let bi = '';
while (true) {
const ch = src[offset];
switch (ch) {
case '-':
this.chomping = Chomp.STRIP;
break;
case '+':
this.... | Parses an *alias from the source
@param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this scalar | parseBlockHeader | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
parseBlockValue(start) {
const {
indent,
src
} = this.context;
let offset = start;
let valueEnd = start;
let bi = this.blockIndent ? indent + this.blockIndent - 1 : indent;
let minBlockIndent = 1;
for (let ch = src[offset]; ch === '\n'; ch = src[offset]) {
... | Parses an *alias from the source
@param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this scalar | parseBlockValue | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
parse(context, start) {
this.context = context;
const {
src
} = context;
let offset = this.parseBlockHeader(start);
offset = _Node.default.endOfWhiteSpace(src, offset);
offset = this.parseComment(offset);
offset = this.parseBlockValue(offset);
return offset;
} | Parses a block value from the source
Accepted forms are:
```
BS
block
lines
BS #comment
block
lines
```
where the block style BS matches the regexp `[|>][-+1-9]*` and block lines
are empty or have an indent level greater than `indent`.
@param {ParseContext} context
@param {number} start - Index of first character
@r... | parse | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
setOrigRanges(cr, offset) {
offset = super.setOrigRanges(cr, offset);
return this.header ? this.header.setOrigRange(cr, offset) : offset;
} | Parses a block value from the source
Accepted forms are:
```
BS
block
lines
BS #comment
block
lines
```
where the block style BS matches the regexp `[|>][-+1-9]*` and block lines
are empty or have an indent level greater than `indent`.
@param {ParseContext} context
@param {number} start - Index of first character
@r... | setOrigRanges | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
} | Parses a block value from the source
Accepted forms are:
```
BS
block
lines
BS #comment
block
lines
```
where the block style BS matches the regexp `[|>][-+1-9]*` and block lines
are empty or have an indent level greater than `indent`.
@param {ParseContext} context
@param {number} start - Index of first character
@r... | _interopRequireDefault | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
constructor(type, props) {
super(type, props);
this.items = null;
} | Parses a block value from the source
Accepted forms are:
```
BS
block
lines
BS #comment
block
lines
```
where the block style BS matches the regexp `[|>][-+1-9]*` and block lines
are empty or have an indent level greater than `indent`.
@param {ParseContext} context
@param {number} start - Index of first character
@r... | constructor | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
prevNodeIsJsonLike(idx = this.items.length) {
const node = this.items[idx - 1];
return !!node && (node.jsonLike || node.type === constants.Type.COMMENT && this.nodeIsJsonLike(idx - 1));
} | Parses a block value from the source
Accepted forms are:
```
BS
block
lines
BS #comment
block
lines
```
where the block style BS matches the regexp `[|>][-+1-9]*` and block lines
are empty or have an indent level greater than `indent`.
@param {ParseContext} context
@param {number} start - Index of first character
@r... | prevNodeIsJsonLike | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
parse(context, start) {
this.context = context;
const {
parseNode,
src
} = context;
let {
indent,
lineStart
} = context;
let char = src[start]; // { or [
this.items = [{
char,
offset: start
}];
let offset = _Node.def... | @param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this | parse | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
setOrigRanges(cr, offset) {
offset = super.setOrigRanges(cr, offset);
this.items.forEach(node => {
if (node instanceof _Node.default) {
offset = node.setOrigRanges(cr, offset);
} else if (cr.length === 0) {
node.origOffset = node.offset;
} else {
let i =... | @param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this | setOrigRanges | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
toString() {
const {
context: {
src
},
items,
range,
value
} = this;
if (value != null) return value;
const nodes = items.filter(item => item instanceof _Node.default);
let str = '';
let prevEnd = range.start;
nodes.forEach(node... | @param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this | toString | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
} | @param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this | _interopRequireDefault | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
static endOfLine(src, start, inFlow) {
let ch = src[start];
let offset = start;
while (ch && ch !== '\n') {
if (inFlow && (ch === '[' || ch === ']' || ch === '{' || ch === '}' || ch === ',')) break;
const next = src[offset + 1];
if (ch === ':' && (!next || next === '\n' || nex... | @param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this | endOfLine | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
get strValue() {
if (!this.valueRange || !this.context) return null;
let {
start,
end
} = this.valueRange;
const {
src
} = this.context;
let ch = src[end - 1];
while (start < end && (ch === '\n' || ch === '\t' || ch === ' ')) ch = src[--end - 1];
... | @param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this | strValue | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
parseBlockValue(start) {
const {
indent,
inFlow,
src
} = this.context;
let offset = start;
let valueEnd = start;
for (let ch = src[offset]; ch === '\n'; ch = src[offset]) {
if (_Node.default.atDocumentBoundary(src, offset + 1)) break;
const end = _... | @param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this | parseBlockValue | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
parse(context, start) {
this.context = context;
const {
inFlow,
src
} = context;
let offset = start;
const ch = src[offset];
if (ch && ch !== '#' && ch !== '\n') {
offset = PlainValue.endOfLine(src, start, inFlow);
}
this.valueRange = new _Range.... | Parses a plain value from the source
Accepted forms are:
```
#comment
first line
first line #comment
first line
block
lines
#comment
block
lines
```
where block lines are empty or have an indent level greater than `indent`.
@param {ParseContext} context
@param {number} start - Index of first character
@returns {n... | parse | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
} | Parses a plain value from the source
Accepted forms are:
```
#comment
first line
first line #comment
first line
block
lines
#comment
block
lines
```
where block lines are empty or have an indent level greater than `indent`.
@param {ParseContext} context
@param {number} start - Index of first character
@returns {n... | _interopRequireDefault | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
static endOfQuote(src, offset) {
let ch = src[offset];
while (ch && ch !== '"') {
offset += ch === '\\' ? 2 : 1;
ch = src[offset];
}
return offset + 1;
} | Parses a plain value from the source
Accepted forms are:
```
#comment
first line
first line #comment
first line
block
lines
#comment
block
lines
```
where block lines are empty or have an indent level greater than `indent`.
@param {ParseContext} context
@param {number} start - Index of first character
@returns {n... | endOfQuote | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
get strValue() {
if (!this.valueRange || !this.context) return null;
const errors$1 = [];
const {
start,
end
} = this.valueRange;
const {
indent,
src
} = this.context;
if (src[end - 1] !== '"') errors$1.push(new errors.YAMLSyntaxError(this, 'Miss... | @returns {string | { str: string, errors: YAMLSyntaxError[] }} | strValue | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
parseCharCode(offset, length, errors$1) {
const {
src
} = this.context;
const cc = src.substr(offset, length);
const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);
const code = ok ? parseInt(cc, 16) : NaN;
if (isNaN(code)) {
errors$1.push(new errors.YAMLSynt... | @returns {string | { str: string, errors: YAMLSyntaxError[] }} | parseCharCode | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
parse(context, start) {
this.context = context;
const {
src
} = context;
let offset = QuoteDouble.endOfQuote(src, start + 1);
this.valueRange = new _Range.default(start, offset);
offset = _Node.default.endOfWhiteSpace(src, offset);
offset = this.parseComment(offset);
... | Parses a "double quoted" value from the source
@param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this scalar | parse | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
} | Parses a "double quoted" value from the source
@param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this scalar | _interopRequireDefault | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
static endOfQuote(src, offset) {
let ch = src[offset];
while (ch) {
if (ch === "'") {
if (src[offset + 1] !== "'") break;
ch = src[offset += 2];
} else {
ch = src[offset += 1];
}
}
return offset + 1;
} | Parses a "double quoted" value from the source
@param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this scalar | endOfQuote | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
get strValue() {
if (!this.valueRange || !this.context) return null;
const errors$1 = [];
const {
start,
end
} = this.valueRange;
const {
indent,
src
} = this.context;
if (src[end - 1] !== "'") errors$1.push(new errors.YAMLSyntaxError(this, "Miss... | @returns {string | { str: string, errors: YAMLSyntaxError[] }} | strValue | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
parse(context, start) {
this.context = context;
const {
src
} = context;
let offset = QuoteSingle.endOfQuote(src, start + 1);
this.valueRange = new _Range.default(start, offset);
offset = _Node.default.endOfWhiteSpace(src, offset);
offset = this.parseComment(offset);
... | Parses a 'single quoted' value from the source
@param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this scalar | parse | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
} | Parses a 'single quoted' value from the source
@param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this scalar | _interopRequireDefault | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
} | Parses a 'single quoted' value from the source
@param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this scalar | _defineProperty | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function createNewNode(type, props) {
switch (type) {
case constants.Type.ALIAS:
return new _Alias.default(type, props);
case constants.Type.BLOCK_FOLDED:
case constants.Type.BLOCK_LITERAL:
return new _BlockValue.default(type, props);
case constants.Type.FLOW_MAP:
cas... | Parses a 'single quoted' value from the source
@param {ParseContext} context
@param {number} start - Index of first character
@returns {number} - Index of the character after this scalar | createNewNode | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
static parseType(src, offset, inFlow) {
switch (src[offset]) {
case '*':
return constants.Type.ALIAS;
case '>':
return constants.Type.BLOCK_FOLDED;
case '|':
return constants.Type.BLOCK_LITERAL;
case '{':
return constants.Type.FLOW_MAP;
... | @param {boolean} atLineStart - Node starts at beginning of line
@param {boolean} inFlow - true if currently in a flow context
@param {boolean} inCollection - true if currently in a collection context
@param {number} indent - Current level of indentation
@param {number} lineStart - Start of the current line
@param {Node... | parseType | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
constructor(orig = {}, {
atLineStart,
inCollection,
inFlow,
indent,
lineStart,
parent
} = {}) {
_defineProperty(this, "parseNode", (overlay, start) => {
if (_Node.default.atDocumentBoundary(this.src, start)) return null;
const context = new ParseContext(this... | @param {boolean} atLineStart - Node starts at beginning of line
@param {boolean} inFlow - true if currently in a flow context
@param {boolean} inCollection - true if currently in a collection context
@param {number} indent - Current level of indentation
@param {number} lineStart - Start of the current line
@param {Node... | constructor | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
nodeStartsCollection(node) {
const {
inCollection,
inFlow,
src
} = this;
if (inCollection || inFlow) return false;
if (node instanceof _CollectionItem.default) return true; // check for implicit key
let offset = node.range.end;
if (src[offset] === '\n' || src... | @param {boolean} atLineStart - Node starts at beginning of line
@param {boolean} inFlow - true if currently in a flow context
@param {boolean} inCollection - true if currently in a collection context
@param {number} indent - Current level of indentation
@param {number} lineStart - Start of the current line
@param {Node... | nodeStartsCollection | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
parseProps(offset) {
const {
inFlow,
parent,
src
} = this;
const props = [];
let lineHasProps = false;
offset = _Node.default.endOfWhiteSpace(src, offset);
let ch = src[offset];
while (ch === constants.Char.ANCHOR || ch === constants.Char.COMMENT || ch ... | @param {boolean} atLineStart - Node starts at beginning of line
@param {boolean} inFlow - true if currently in a flow context
@param {boolean} inCollection - true if currently in a collection context
@param {number} indent - Current level of indentation
@param {number} lineStart - Start of the current line
@param {Node... | parseProps | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
} // Published as 'yaml/parse-cst' | Parses a node from the source
@param {ParseContext} overlay
@param {number} start - Index of first non-whitespace character for the node
@returns {?Node} - null if at a document boundary | _interopRequireDefault | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function parse(src) {
const cr = [];
if (src.indexOf('\r') !== -1) {
src = src.replace(/\r\n?/g, (match, offset) => {
if (match.length > 1) cr.push(offset);
return '\n';
});
}
const documents = [];
let offset = 0;
do {
const doc = new _Document.default();
... | Parses a node from the source
@param {ParseContext} overlay
@param {number} start - Index of first non-whitespace character for the node
@returns {?Node} - null if at a document boundary | parse | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function addCommentBefore(str, indent, comment) {
if (!comment) return str;
const cc = comment.replace(/[\s\S]^/gm, `$&${indent}#`);
return `#${cc}\n${indent}${str}`;
} | Parses a node from the source
@param {ParseContext} overlay
@param {number} start - Index of first non-whitespace character for the node
@returns {?Node} - null if at a document boundary | addCommentBefore | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function addComment(str, indent, comment) {
return !comment ? str : comment.indexOf('\n') === -1 ? `${str} #${comment}` : `${str}\n` + comment.replace(/^/gm, `${indent || ''}#`);
} | Parses a node from the source
@param {ParseContext} overlay
@param {number} start - Index of first non-whitespace character for the node
@returns {?Node} - null if at a document boundary | addComment | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function toJSON(value, arg, ctx) {
if (Array.isArray(value)) return value.map((v, i) => toJSON(v, String(i), ctx));
if (value && typeof value.toJSON === 'function') {
const anchor = ctx && ctx.anchors && ctx.anchors.find(a => a.node === value);
if (anchor) ctx.onCreate = res => {
anchor.res... | Parses a node from the source
@param {ParseContext} overlay
@param {number} start - Index of first non-whitespace character for the node
@returns {?Node} - null if at a document boundary | toJSON | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
} // Published as 'yaml/scalar' | Parses a node from the source
@param {ParseContext} overlay
@param {number} start - Index of first non-whitespace character for the node
@returns {?Node} - null if at a document boundary | _interopRequireDefault | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
constructor(value) {
super();
this.value = value;
} | Parses a node from the source
@param {ParseContext} overlay
@param {number} start - Index of first non-whitespace character for the node
@returns {?Node} - null if at a document boundary | constructor | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
toJSON(arg, ctx) {
return ctx && ctx.keep ? this.value : (0, _toJSON.default)(this.value, arg, ctx);
} | Parses a node from the source
@param {ParseContext} overlay
@param {number} start - Index of first non-whitespace character for the node
@returns {?Node} - null if at a document boundary | toJSON | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
toString() {
return String(this.value);
} | Parses a node from the source
@param {ParseContext} overlay
@param {number} start - Index of first non-whitespace character for the node
@returns {?Node} - null if at a document boundary | toString | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
} // Published as 'yaml/pair' | Parses a node from the source
@param {ParseContext} overlay
@param {number} start - Index of first non-whitespace character for the node
@returns {?Node} - null if at a document boundary | _interopRequireDefault | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
stringifyKey = (key, jsKey, ctx) => {
if (jsKey === null) return '';
if (typeof jsKey !== 'object') return String(jsKey);
if (key instanceof _Node.default && ctx && ctx.doc) return key.toString({
anchors: {},
doc: ctx.doc,
indent: '',
inFlow: true,
inStringifyKey: true
});
... | Parses a node from the source
@param {ParseContext} overlay
@param {number} start - Index of first non-whitespace character for the node
@returns {?Node} - null if at a document boundary | stringifyKey | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
stringifyKey = (key, jsKey, ctx) => {
if (jsKey === null) return '';
if (typeof jsKey !== 'object') return String(jsKey);
if (key instanceof _Node.default && ctx && ctx.doc) return key.toString({
anchors: {},
doc: ctx.doc,
indent: '',
inFlow: true,
inStringifyKey: true
});
... | Parses a node from the source
@param {ParseContext} overlay
@param {number} start - Index of first non-whitespace character for the node
@returns {?Node} - null if at a document boundary | stringifyKey | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
constructor(key, value = null) {
super();
this.key = key;
this.value = value;
this.type = 'PAIR';
} | Parses a node from the source
@param {ParseContext} overlay
@param {number} start - Index of first non-whitespace character for the node
@returns {?Node} - null if at a document boundary | constructor | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
get commentBefore() {
return this.key && this.key.commentBefore;
} | Parses a node from the source
@param {ParseContext} overlay
@param {number} start - Index of first non-whitespace character for the node
@returns {?Node} - null if at a document boundary | commentBefore | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
set commentBefore(cb) {
if (this.key == null) this.key = new _Scalar.default(null);
this.key.commentBefore = cb;
} | Parses a node from the source
@param {ParseContext} overlay
@param {number} start - Index of first non-whitespace character for the node
@returns {?Node} - null if at a document boundary | commentBefore | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
addToJSMap(ctx, map) {
const key = (0, _toJSON.default)(this.key, '', ctx);
if (map instanceof Map) {
const value = (0, _toJSON.default)(this.value, key, ctx);
map.set(key, value);
} else if (map instanceof Set) {
map.add(key);
} else {
const stringKey = stringif... | Parses a node from the source
@param {ParseContext} overlay
@param {number} start - Index of first non-whitespace character for the node
@returns {?Node} - null if at a document boundary | addToJSMap | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
toJSON(_, ctx) {
const pair = ctx && ctx.mapAsMap ? new Map() : {};
return this.addToJSMap(ctx, pair);
} | Parses a node from the source
@param {ParseContext} overlay
@param {number} start - Index of first non-whitespace character for the node
@returns {?Node} - null if at a document boundary | toJSON | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/third-party.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/third-party.js | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.