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 |
|---|---|---|---|---|---|---|---|
toString(ctx, onComment, onChompKeep) {
if (!ctx || !ctx.doc) return JSON.stringify(this);
const {
simpleKeys
} = ctx.doc.options;
let {
key,
value
} = this;
let keyComment = key instanceof _Node.default && key.comment;
if (simpleKeys) {
if (key... | 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
};
} | 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 _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 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 | _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 collectionFromPath(schema, path, value) {
let v = value;
for (let i = path.length - 1; i >= 0; --i) {
const k = path[i];
const o = Number.isInteger(k) && k >= 0 ? [] : {};
o[k] = v;
v = o;
}
return schema.createNode(v, false);
} // null, undefined, or an empty non-st... | 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 | collectionFromPath | 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(schema) {
super();
_defineProperty(this, "items", []);
this.schema = schema;
} | 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 |
addIn(path, value) {
if (isEmptyPath(path)) this.add(value);else {
const [key, ...rest] = path;
const node = this.get(key, true);
if (node instanceof Collection) node.addIn(rest, value);else if (node === undefined && this.schema) this.set(key, collectionFromPath(this.schema, rest, 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 | addIn | 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 |
deleteIn([key, ...rest]) {
if (rest.length === 0) return this.delete(key);
const node = this.get(key, true);
if (node instanceof Collection) return node.deleteIn(rest);else throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
} | 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 | deleteIn | 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 |
getIn([key, ...rest], keepScalar) {
const node = this.get(key, true);
if (rest.length === 0) return !keepScalar && node instanceof _Scalar.default ? node.value : node;else return node instanceof Collection ? node.getIn(rest, keepScalar) : undefined;
} | 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 | getIn | 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 |
hasAllNullValues() {
return this.items.every(node => {
if (!(node instanceof _Pair.default)) return false;
const n = node.value;
return n == null || n instanceof _Scalar.default && n.value == null && !n.commentBefore && !n.comment && !n.tag;
});
} | 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 | hasAllNullValues | 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 |
hasIn([key, ...rest]) {
if (rest.length === 0) return this.has(key);
const node = this.get(key, true);
return node instanceof Collection ? node.hasIn(rest) : false;
} | 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 | hasIn | 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 |
setIn([key, ...rest], value) {
if (rest.length === 0) {
this.set(key, value);
} else {
const node = this.get(key, true);
if (node instanceof Collection) node.setIn(rest, value);else if (node === undefined && this.schema) this.set(key, collectionFromPath(this.schema, rest, value));els... | 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 | setIn | 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() {
return null;
} | 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(ctx, {
blockItem,
flowChars,
isMap,
itemIndent
}, onComment, onChompKeep) {
const {
doc,
indent
} = ctx;
const inFlow = this.type && this.type.substr(0, 4) === 'FLOW' || ctx.inFlow;
if (inFlow) itemIndent += ' ';
const allNullValues = i... | 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
};
} | 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 _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 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 | _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 |
getAliasCount = (node, anchors) => {
if (node instanceof Alias) {
const anchor = anchors.find(a => a.node === node.source);
return anchor.count * anchor.aliasCount;
} else if (node instanceof _Collection.default) {
let count = 0;
for (const item of node.items) {
const c = getAli... | 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 | getAliasCount | 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 |
getAliasCount = (node, anchors) => {
if (node instanceof Alias) {
const anchor = anchors.find(a => a.node === node.source);
return anchor.count * anchor.aliasCount;
} else if (node instanceof _Collection.default) {
let count = 0;
for (const item of node.items) {
const c = getAli... | 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 | getAliasCount | 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 stringify({
range,
source
}, {
anchors,
doc,
implicitKey,
inStringifyKey
}) {
let anchor = Object.keys(anchors).find(a => anchors[a] === source);
if (!anchor && inStringifyKey) anchor = doc.anchors.getName(source) || doc.anchors.newName();
if (anchor)... | 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 | stringify | 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) {
super();
this.source = source;
this.type = constants.Type.ALIAS;
} | 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 |
set tag(t) {
throw new Error('Alias nodes cannot have tags');
} | 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 | 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 |
toJSON(arg, ctx) {
if (!ctx) return (0, _toJSON.default)(this.source, arg, ctx);
const {
anchors,
maxAliasCount
} = ctx;
const anchor = anchors.find(a => a.node === this.source);
/* istanbul ignore if */
if (!anchor || anchor.res === undefined) {
const msg = ... | 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(ctx) {
return Alias.stringify(this, 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 | 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
};
} | 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 findPair(items, key) {
const k = key instanceof _Scalar.default ? key.value : key;
for (const it of items) {
if (it instanceof _Pair.default) {
if (it.key === key || it.key === k) return it;
if (it.key && it.key.value === k) return it;
}
}
return undefined;
} | 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 | findPair | 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 |
add(pair, overwrite) {
if (!pair) pair = new _Pair.default(pair);else if (!(pair instanceof _Pair.default)) pair = new _Pair.default(pair.key || pair, pair.value);
const prev = findPair(this.items, pair.key);
const sortEntries = this.schema && this.schema.sortMapEntries;
if (prev) {
if ... | 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 | add | 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 |
delete(key) {
const it = findPair(this.items, key);
if (!it) return false;
const del = this.items.splice(this.items.indexOf(it), 1);
return del.length > 0;
} | 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 | delete | 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(key, keepScalar) {
const it = findPair(this.items, key);
const node = it && it.value;
return !keepScalar && node instanceof _Scalar.default ? node.value : node;
} | 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 | get | 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 |
has(key) {
return !!findPair(this.items, key);
} | 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 | has | 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(key, value) {
this.add(new _Pair.default(key, value), 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 | set | 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, Type) {
const map = Type ? new Type() : ctx && ctx.mapAsMap ? new Map() : {};
if (ctx && ctx.onCreate) ctx.onCreate(map);
for (const item of this.items) item.addToJSMap(ctx, map);
return map;
} | @param {*} arg ignored
@param {*} ctx Conversion context, originally set in Document#toJSON()
@param {Class} Type If set, forces the returned collection type
@returns {*} Instance of Type, Map, or Object | 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(ctx, onComment, onChompKeep) {
if (!ctx) return JSON.stringify(this);
for (const item of this.items) {
if (!(item instanceof _Pair.default)) throw new Error(`Map items must all be pairs; found ${JSON.stringify(item)} instead`);
}
return super.toString(ctx, {
blockItem:... | @param {*} arg ignored
@param {*} ctx Conversion context, originally set in Document#toJSON()
@param {Class} Type If set, forces the returned collection type
@returns {*} Instance of Type, Map, or Object | 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/seq' | @param {*} arg ignored
@param {*} ctx Conversion context, originally set in Document#toJSON()
@param {Class} Type If set, forces the returned collection type
@returns {*} Instance of Type, Map, or Object | _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 asItemIndex(key) {
let idx = key instanceof _Scalar.default ? key.value : key;
if (idx && typeof idx === 'string') idx = Number(idx);
return Number.isInteger(idx) && idx >= 0 ? idx : null;
} | @param {*} arg ignored
@param {*} ctx Conversion context, originally set in Document#toJSON()
@param {Class} Type If set, forces the returned collection type
@returns {*} Instance of Type, Map, or Object | asItemIndex | 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 |
delete(key) {
const idx = asItemIndex(key);
if (typeof idx !== 'number') return false;
const del = this.items.splice(idx, 1);
return del.length > 0;
} | @param {*} arg ignored
@param {*} ctx Conversion context, originally set in Document#toJSON()
@param {Class} Type If set, forces the returned collection type
@returns {*} Instance of Type, Map, or Object | delete | 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(key, keepScalar) {
const idx = asItemIndex(key);
if (typeof idx !== 'number') return undefined;
const it = this.items[idx];
return !keepScalar && it instanceof _Scalar.default ? it.value : it;
} | @param {*} arg ignored
@param {*} ctx Conversion context, originally set in Document#toJSON()
@param {Class} Type If set, forces the returned collection type
@returns {*} Instance of Type, Map, or Object | get | 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 |
has(key) {
const idx = asItemIndex(key);
return typeof idx === 'number' && idx < this.items.length;
} | @param {*} arg ignored
@param {*} ctx Conversion context, originally set in Document#toJSON()
@param {Class} Type If set, forces the returned collection type
@returns {*} Instance of Type, Map, or Object | has | 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(key, value) {
const idx = asItemIndex(key);
if (typeof idx !== 'number') throw new Error(`Expected a valid index, not ${key}.`);
this.items[idx] = value;
} | @param {*} arg ignored
@param {*} ctx Conversion context, originally set in Document#toJSON()
@param {Class} Type If set, forces the returned collection type
@returns {*} Instance of Type, Map, or Object | set | 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 seq = [];
if (ctx && ctx.onCreate) ctx.onCreate(seq);
let i = 0;
for (const item of this.items) seq.push((0, _toJSON.default)(item, String(i++), ctx));
return seq;
} | @param {*} arg ignored
@param {*} ctx Conversion context, originally set in Document#toJSON()
@param {Class} Type If set, forces the returned collection type
@returns {*} Instance of Type, Map, or Object | 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(ctx, onComment, onChompKeep) {
if (!ctx) return JSON.stringify(this);
return super.toString(ctx, {
blockItem: n => n.type === 'comment' ? n.str : `- ${n.str}`,
flowChars: {
start: '[',
end: ']'
},
isMap: false,
itemIndent: (ctx.indent || '... | @param {*} arg ignored
@param {*} ctx Conversion context, originally set in Document#toJSON()
@param {Class} Type If set, forces the returned collection type
@returns {*} Instance of Type, Map, or Object | 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 {*} arg ignored
@param {*} ctx Conversion context, originally set in Document#toJSON()
@param {Class} Type If set, forces the returned collection type
@returns {*} Instance of Type, Map, or Object | _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(pair) {
if (pair instanceof _Pair.default) {
let seq = pair.value;
if (!(seq instanceof _Seq.default)) {
seq = new _Seq.default();
seq.items.push(pair.value);
seq.range = pair.value.range;
}
super(pair.key, seq);
this.range = pair... | @param {*} arg ignored
@param {*} ctx Conversion context, originally set in Document#toJSON()
@param {Class} Type If set, forces the returned collection type
@returns {*} Instance of Type, Map, or Object | 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 |
addToJSMap(ctx, map) {
for (const {
source
} of this.value.items) {
if (!(source instanceof _Map$1.default)) throw new Error('Merge sources must be maps');
const srcMap = source.toJSON(null, ctx, Map);
for (const [key, value] of srcMap) {
if (map instanceof Map) {
... | @param {*} arg ignored
@param {*} ctx Conversion context, originally set in Document#toJSON()
@param {Class} Type If set, forces the returned collection type
@returns {*} Instance of Type, Map, or Object | 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 |
toString(ctx, onComment) {
const seq = this.value;
if (seq.items.length > 1) return super.toString(ctx, onComment);
this.value = seq.items[0];
const str = super.toString(ctx, onComment);
this.value = seq;
return str;
} | @param {*} arg ignored
@param {*} ctx Conversion context, originally set in Document#toJSON()
@param {Class} Type If set, forces the returned collection type
@returns {*} Instance of Type, Map, or Object | 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 {*} arg ignored
@param {*} ctx Conversion context, originally set in Document#toJSON()
@param {Class} Type If set, forces the returned collection type
@returns {*} Instance of Type, Map, or Object | _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;
} | @param {*} arg ignored
@param {*} ctx Conversion context, originally set in Document#toJSON()
@param {Class} Type If set, forces the returned collection type
@returns {*} Instance of Type, Map, or Object | _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 |
static validAnchorNode(node) {
return node instanceof _Scalar.default || node instanceof _Seq.default || node instanceof _Map$1.default;
} | @param {*} arg ignored
@param {*} ctx Conversion context, originally set in Document#toJSON()
@param {Class} Type If set, forces the returned collection type
@returns {*} Instance of Type, Map, or Object | validAnchorNode | 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(prefix) {
_defineProperty(this, "map", {});
this.prefix = prefix;
} | @param {*} arg ignored
@param {*} ctx Conversion context, originally set in Document#toJSON()
@param {Class} Type If set, forces the returned collection type
@returns {*} Instance of Type, Map, or Object | 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 |
createAlias(node, name) {
this.setAnchor(node, name);
return new _Alias.default(node);
} | @param {*} arg ignored
@param {*} ctx Conversion context, originally set in Document#toJSON()
@param {Class} Type If set, forces the returned collection type
@returns {*} Instance of Type, Map, or Object | createAlias | 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 |
createMergePair(...sources) {
const merge = new _Merge.default();
merge.value.items = sources.map(s => {
if (s instanceof _Alias.default) {
if (s.source instanceof _Map$1.default) return s;
} else if (s instanceof _Map$1.default) {
return this.createAlias(s);
}
... | @param {*} arg ignored
@param {*} ctx Conversion context, originally set in Document#toJSON()
@param {Class} Type If set, forces the returned collection type
@returns {*} Instance of Type, Map, or Object | createMergePair | 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 |
getName(node) {
const {
map
} = this;
return Object.keys(map).find(a => map[a] === node);
} | @param {*} arg ignored
@param {*} ctx Conversion context, originally set in Document#toJSON()
@param {Class} Type If set, forces the returned collection type
@returns {*} Instance of Type, Map, or Object | getName | 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 |
getNode(name) {
return this.map[name];
} | @param {*} arg ignored
@param {*} ctx Conversion context, originally set in Document#toJSON()
@param {Class} Type If set, forces the returned collection type
@returns {*} Instance of Type, Map, or Object | getNode | 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 |
newName(prefix) {
if (!prefix) prefix = this.prefix;
const names = Object.keys(this.map);
for (let i = 1; true; ++i) {
const name = `${prefix}${i}`;
if (!names.includes(name)) return name;
}
} | @param {*} arg ignored
@param {*} ctx Conversion context, originally set in Document#toJSON()
@param {Class} Type If set, forces the returned collection type
@returns {*} Instance of Type, Map, or Object | newName | 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 |
resolveNodes() {
const {
map,
_cstAliases
} = this;
Object.keys(map).forEach(a => {
map[a] = map[a].resolved;
});
_cstAliases.forEach(a => {
a.source = a.source.resolved;
});
delete this._cstAliases;
} | @param {*} arg ignored
@param {*} ctx Conversion context, originally set in Document#toJSON()
@param {Class} Type If set, forces the returned collection type
@returns {*} Instance of Type, Map, or Object | resolveNodes | 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 |
setAnchor(node, name) {
if (node != null && !Anchors.validAnchorNode(node)) {
throw new Error('Anchors may only be set for Scalar, Seq and Map nodes');
}
if (name && /[\x00-\x19\s,[\]{}]/.test(name)) {
throw new Error('Anchor names must not contain whitespace or control characters');
... | @param {*} arg ignored
@param {*} ctx Conversion context, originally set in Document#toJSON()
@param {Class} Type If set, forces the returned collection type
@returns {*} Instance of Type, Map, or Object | setAnchor | 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 {*} arg ignored
@param {*} ctx Conversion context, originally set in Document#toJSON()
@param {Class} Type If set, forces the returned collection type
@returns {*} Instance of Type, Map, or Object | _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 |
visit = (node, tags) => {
if (node && typeof node === 'object') {
const {
tag
} = node;
if (node instanceof _Collection.default) {
if (tag) tags[tag] = true;
node.items.forEach(n => visit(n, tags));
} else if (node instanceof _Pair.default) {
visit(node.key, ... | @param {*} arg ignored
@param {*} ctx Conversion context, originally set in Document#toJSON()
@param {Class} Type If set, forces the returned collection type
@returns {*} Instance of Type, Map, or Object | visit | 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 |
visit = (node, tags) => {
if (node && typeof node === 'object') {
const {
tag
} = node;
if (node instanceof _Collection.default) {
if (tag) tags[tag] = true;
node.items.forEach(n => visit(n, tags));
} else if (node instanceof _Pair.default) {
visit(node.key, ... | @param {*} arg ignored
@param {*} ctx Conversion context, originally set in Document#toJSON()
@param {Class} Type If set, forces the returned collection type
@returns {*} Instance of Type, Map, or Object | visit | 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 warn(warning, type) {
if (global && global._YAML_SILENCE_WARNINGS) return;
const {
emitWarning
} = global && global.process; // This will throw in Jest if `warning` is an Error instance due to
// https://github.com/facebook/jest/issues/2549
if (emitWarning) emitWarning(warning, type)... | @param {*} arg ignored
@param {*} ctx Conversion context, originally set in Document#toJSON()
@param {Class} Type If set, forces the returned collection type
@returns {*} Instance of Type, Map, or Object | warn | 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 warnFileDeprecation(filename) {
if (global && global._YAML_SILENCE_DEPRECATION_WARNINGS) return;
const path = filename.replace(/.*yaml[/\\]/i, '').replace(/\.js$/, '').replace(/\\/g, '/');
warn(`The endpoint 'yaml/${path}' will be removed in a future release.`, 'DeprecationWarning');
} | @param {*} arg ignored
@param {*} ctx Conversion context, originally set in Document#toJSON()
@param {Class} Type If set, forces the returned collection type
@returns {*} Instance of Type, Map, or Object | warnFileDeprecation | 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 warnOptionDeprecation(name, alternative) {
if (global && global._YAML_SILENCE_DEPRECATION_WARNINGS) return;
if (warned[name]) return;
warned[name] = true;
let msg = `The option '${name}' will be removed in a future release`;
msg += alternative ? `, use '${alternative}' instead.` : '.';
... | @param {*} arg ignored
@param {*} ctx Conversion context, originally set in Document#toJSON()
@param {Class} Type If set, forces the returned collection type
@returns {*} Instance of Type, Map, or Object | warnOptionDeprecation | 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 |
consumeMoreIndentedLines = (text, i) => {
let ch = text[i + 1];
while (ch === ' ' || ch === '\t') {
do {
ch = text[i += 1];
} while (ch && ch !== '\n');
ch = text[i + 1];
}
return i;
} | @param {*} arg ignored
@param {*} ctx Conversion context, originally set in Document#toJSON()
@param {Class} Type If set, forces the returned collection type
@returns {*} Instance of Type, Map, or Object | consumeMoreIndentedLines | 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 |
consumeMoreIndentedLines = (text, i) => {
let ch = text[i + 1];
while (ch === ' ' || ch === '\t') {
do {
ch = text[i += 1];
} while (ch && ch !== '\n');
ch = text[i + 1];
}
return i;
} | @param {*} arg ignored
@param {*} ctx Conversion context, originally set in Document#toJSON()
@param {Class} Type If set, forces the returned collection type
@returns {*} Instance of Type, Map, or Object | consumeMoreIndentedLines | 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 foldFlowLines(text, indent, mode, {
indentAtStart,
lineWidth = 80,
minContentWidth = 20,
onFold,
onOverflow
}) {
if (!lineWidth || lineWidth < 0) return text;
const endStep = Math.max(1 + minContentWidth, 1 + lineWidth - indent.length);
if (text.length <= endStep) return text;... | Tries to keep input at up to `lineWidth` characters, splitting only on spaces
not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
terminated with `\n` and started with `indent`.
@param {string} text
@param {string} indent
@param {string} [mode='flow'] `'block'` prevents more-indented lines
from... | foldFlowLines | 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 _getRequireWildcardCache() {
if (typeof WeakMap !== "function") return null;
var cache = new WeakMap();
_getRequireWildcardCache = function () {
return cache;
};
return cache;
} | Tries to keep input at up to `lineWidth` characters, splitting only on spaces
not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
terminated with `\n` and started with `indent`.
@param {string} text
@param {string} indent
@param {string} [mode='flow'] `'block'` prevents more-indented lines
from... | _getRequireWildcardCache | 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 _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache();
if (cache && cache.has(obj)) {
retu... | Tries to keep input at up to `lineWidth` characters, splitting only on spaces
not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
terminated with `\n` and started with `indent`.
@param {string} text
@param {string} indent
@param {string} [mode='flow'] `'block'` prevents more-indented lines
from... | _interopRequireWildcard | 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 |
getFoldOptions = ({
indentAtStart
}) => indentAtStart ? Object.assign({
indentAtStart
}, options.strOptions.fold) : options.strOptions.fold | Tries to keep input at up to `lineWidth` characters, splitting only on spaces
not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
terminated with `\n` and started with `indent`.
@param {string} text
@param {string} indent
@param {string} [mode='flow'] `'block'` prevents more-indented lines
from... | getFoldOptions | 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 |
getFoldOptions = ({
indentAtStart
}) => indentAtStart ? Object.assign({
indentAtStart
}, options.strOptions.fold) : options.strOptions.fold | Tries to keep input at up to `lineWidth` characters, splitting only on spaces
not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
terminated with `\n` and started with `indent`.
@param {string} text
@param {string} indent
@param {string} [mode='flow'] `'block'` prevents more-indented lines
from... | getFoldOptions | 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 stringifyNumber({
format,
minFractionDigits,
tag,
value
}) {
if (!isFinite(value)) return isNaN(value) ? '.nan' : value < 0 ? '-.inf' : '.inf';
let n = JSON.stringify(value);
if (!format && minFractionDigits && (!tag || tag === 'tag:yaml.org,2002:float') && /^\d/.test(n)) {
... | Tries to keep input at up to `lineWidth` characters, splitting only on spaces
not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
terminated with `\n` and started with `indent`.
@param {string} text
@param {string} indent
@param {string} [mode='flow'] `'block'` prevents more-indented lines
from... | stringifyNumber | 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 lineLengthOverLimit(str, limit) {
const strLen = str.length;
if (strLen <= limit) return false;
for (let i = 0, start = 0; i < strLen; ++i) {
if (str[i] === '\n') {
if (i - start > limit) return true;
start = i + 1;
if (strLen - start <= limit) return false;
}
... | Tries to keep input at up to `lineWidth` characters, splitting only on spaces
not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
terminated with `\n` and started with `indent`.
@param {string} text
@param {string} indent
@param {string} [mode='flow'] `'block'` prevents more-indented lines
from... | lineLengthOverLimit | 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 doubleQuotedString(value, ctx) {
const {
implicitKey,
indent
} = ctx;
const {
jsonEncoding,
minMultiLineLength
} = options.strOptions.doubleQuoted;
const json = JSON.stringify(value);
if (jsonEncoding) return json;
let str = '';
let start = 0;
for (l... | Tries to keep input at up to `lineWidth` characters, splitting only on spaces
not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
terminated with `\n` and started with `indent`.
@param {string} text
@param {string} indent
@param {string} [mode='flow'] `'block'` prevents more-indented lines
from... | doubleQuotedString | 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 singleQuotedString(value, ctx) {
const {
indent,
implicitKey
} = ctx;
if (implicitKey) {
if (/\n/.test(value)) return doubleQuotedString(value, ctx);
} else {
// single quoted string can't have leading or trailing whitespace around newline
if (/[ \t]\n|\n[ \t]/.te... | Tries to keep input at up to `lineWidth` characters, splitting only on spaces
not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
terminated with `\n` and started with `indent`.
@param {string} text
@param {string} indent
@param {string} [mode='flow'] `'block'` prevents more-indented lines
from... | singleQuotedString | 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 blockString({
comment,
type,
value
}, ctx, onComment, onChompKeep) {
// 1. Block can't end in whitespace unless the last line is non-empty.
// 2. Strings consisting of only whitespace are best rendered explicitly.
if (/\n[\t ]+$/.test(value) || /^\s*$/.test(value)) {
return doub... | Tries to keep input at up to `lineWidth` characters, splitting only on spaces
not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
terminated with `\n` and started with `indent`.
@param {string} text
@param {string} indent
@param {string} [mode='flow'] `'block'` prevents more-indented lines
from... | blockString | 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 plainString(item, ctx, onComment, onChompKeep) {
const {
comment,
type,
value
} = item;
const {
actualString,
implicitKey,
indent,
inFlow,
tags
} = ctx;
if (implicitKey && /[\n[\]{},]/.test(value) || inFlow && /[[\]{},]/.test(value)) {
... | Tries to keep input at up to `lineWidth` characters, splitting only on spaces
not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
terminated with `\n` and started with `indent`.
@param {string} text
@param {string} indent
@param {string} [mode='flow'] `'block'` prevents more-indented lines
from... | plainString | 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 stringifyString(item, ctx, onComment, onChompKeep) {
const {
defaultType
} = options.strOptions;
const {
implicitKey,
inFlow
} = ctx;
let {
type,
value
} = item;
if (typeof value !== 'string') {
value = String(value);
item = Object.assign({... | Tries to keep input at up to `lineWidth` characters, splitting only on spaces
not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
terminated with `\n` and started with `indent`.
@param {string} text
@param {string} indent
@param {string} [mode='flow'] `'block'` prevents more-indented lines
from... | stringifyString | 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 |
_stringify = _type => {
switch (_type) {
case constants.Type.BLOCK_FOLDED:
case constants.Type.BLOCK_LITERAL:
return blockString(item, ctx, onComment, onChompKeep);
case constants.Type.QUOTE_DOUBLE:
return doubleQuotedString(value, ctx);
case constants.Type.QU... | Tries to keep input at up to `lineWidth` characters, splitting only on spaces
not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
terminated with `\n` and started with `indent`.
@param {string} text
@param {string} indent
@param {string} [mode='flow'] `'block'` prevents more-indented lines
from... | _stringify | 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 |
_stringify = _type => {
switch (_type) {
case constants.Type.BLOCK_FOLDED:
case constants.Type.BLOCK_LITERAL:
return blockString(item, ctx, onComment, onChompKeep);
case constants.Type.QUOTE_DOUBLE:
return doubleQuotedString(value, ctx);
case constants.Type.QU... | Tries to keep input at up to `lineWidth` characters, splitting only on spaces
not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
terminated with `\n` and started with `indent`.
@param {string} text
@param {string} indent
@param {string} [mode='flow'] `'block'` prevents more-indented lines
from... | _stringify | 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 checkFlowCollectionEnd(errors$1, cst) {
let char, name;
switch (cst.type) {
case constants.Type.FLOW_MAP:
char = '}';
name = 'flow map';
break;
case constants.Type.FLOW_SEQ:
char = ']';
name = 'flow sequence';
break;
default:
... | Tries to keep input at up to `lineWidth` characters, splitting only on spaces
not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
terminated with `\n` and started with `indent`.
@param {string} text
@param {string} indent
@param {string} [mode='flow'] `'block'` prevents more-indented lines
from... | checkFlowCollectionEnd | 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 checkKeyLength(errors$1, node, itemIdx, key, keyStart) {
if (!key || typeof keyStart !== 'number') return;
const item = node.items[itemIdx];
let keyEnd = item && item.range && item.range.start;
if (!keyEnd) {
for (let i = itemIdx - 1; i >= 0; --i) {
const it = node.items[i];
... | Tries to keep input at up to `lineWidth` characters, splitting only on spaces
not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
terminated with `\n` and started with `indent`.
@param {string} text
@param {string} indent
@param {string} [mode='flow'] `'block'` prevents more-indented lines
from... | checkKeyLength | 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 resolveComments(collection, comments) {
for (const {
afterKey,
before,
comment
} of comments) {
let item = collection.items[before];
if (!item) {
if (comment !== undefined) {
if (collection.comment) collection.comment += '\n' + comment;else collection.co... | Tries to keep input at up to `lineWidth` characters, splitting only on spaces
not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
terminated with `\n` and started with `indent`.
@param {string} text
@param {string} indent
@param {string} [mode='flow'] `'block'` prevents more-indented lines
from... | resolveComments | 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 _getRequireWildcardCache() {
if (typeof WeakMap !== "function") return null;
var cache = new WeakMap();
_getRequireWildcardCache = function () {
return cache;
};
return cache;
} | Tries to keep input at up to `lineWidth` characters, splitting only on spaces
not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
terminated with `\n` and started with `indent`.
@param {string} text
@param {string} indent
@param {string} [mode='flow'] `'block'` prevents more-indented lines
from... | _getRequireWildcardCache | 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 _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache();
if (cache && cache.has(obj)) {
retu... | Tries to keep input at up to `lineWidth` characters, splitting only on spaces
not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
terminated with `\n` and started with `indent`.
@param {string} text
@param {string} indent
@param {string} [mode='flow'] `'block'` prevents more-indented lines
from... | _interopRequireWildcard | 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
};
} | Tries to keep input at up to `lineWidth` characters, splitting only on spaces
not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
terminated with `\n` and started with `indent`.
@param {string} text
@param {string} indent
@param {string} [mode='flow'] `'block'` prevents more-indented lines
from... | _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 parseMap(doc, cst) {
if (cst.type !== constants.Type.MAP && cst.type !== constants.Type.FLOW_MAP) {
const msg = `A ${cst.type} node cannot be resolved as a mapping`;
doc.errors.push(new errors.YAMLSyntaxError(cst, msg));
return null;
}
const {
comments,
items
} = ... | Tries to keep input at up to `lineWidth` characters, splitting only on spaces
not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
terminated with `\n` and started with `indent`.
@param {string} text
@param {string} indent
@param {string} [mode='flow'] `'block'` prevents more-indented lines
from... | parseMap | 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 |
valueHasPairComment = ({
context: {
lineStart,
node,
src
},
props
}) => {
if (props.length === 0) return false;
const {
start
} = props[0];
if (node && start > node.valueRange.start) return false;
if (src[start] !== constants.Char.COMMENT) return false;
for... | Tries to keep input at up to `lineWidth` characters, splitting only on spaces
not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
terminated with `\n` and started with `indent`.
@param {string} text
@param {string} indent
@param {string} [mode='flow'] `'block'` prevents more-indented lines
from... | valueHasPairComment | 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 |
valueHasPairComment = ({
context: {
lineStart,
node,
src
},
props
}) => {
if (props.length === 0) return false;
const {
start
} = props[0];
if (node && start > node.valueRange.start) return false;
if (src[start] !== constants.Char.COMMENT) return false;
for... | Tries to keep input at up to `lineWidth` characters, splitting only on spaces
not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
terminated with `\n` and started with `indent`.
@param {string} text
@param {string} indent
@param {string} [mode='flow'] `'block'` prevents more-indented lines
from... | valueHasPairComment | 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 resolvePairComment(item, pair) {
if (!valueHasPairComment(item)) return;
const comment = item.getPropValue(0, constants.Char.COMMENT, true);
let found = false;
const cb = pair.value.commentBefore;
if (cb && cb.startsWith(comment)) {
pair.value.commentBefore = cb.substr(comment.length... | Tries to keep input at up to `lineWidth` characters, splitting only on spaces
not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
terminated with `\n` and started with `indent`.
@param {string} text
@param {string} indent
@param {string} [mode='flow'] `'block'` prevents more-indented lines
from... | resolvePairComment | 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 resolveBlockMapItems(doc, cst) {
const comments = [];
const items = [];
let key = undefined;
let keyStart = null;
for (let i = 0; i < cst.items.length; ++i) {
const item = cst.items[i];
switch (item.type) {
case constants.Type.BLANK_LINE:
comments.push({
... | Tries to keep input at up to `lineWidth` characters, splitting only on spaces
not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
terminated with `\n` and started with `indent`.
@param {string} text
@param {string} indent
@param {string} [mode='flow'] `'block'` prevents more-indented lines
from... | resolveBlockMapItems | 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 resolveFlowMapItems(doc, cst) {
const comments = [];
const items = [];
let key = undefined;
let keyStart = null;
let explicitKey = false;
let next = '{';
for (let i = 0; i < cst.items.length; ++i) {
(0, parseUtils.checkKeyLength)(doc.errors, cst, i, key, keyStart);
cons... | Tries to keep input at up to `lineWidth` characters, splitting only on spaces
not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
terminated with `\n` and started with `indent`.
@param {string} text
@param {string} indent
@param {string} [mode='flow'] `'block'` prevents more-indented lines
from... | resolveFlowMapItems | 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
};
} | Tries to keep input at up to `lineWidth` characters, splitting only on spaces
not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
terminated with `\n` and started with `indent`.
@param {string} text
@param {string} indent
@param {string} [mode='flow'] `'block'` prevents more-indented lines
from... | _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 createMap(schema, obj, ctx) {
const map = new _Map$1.default(schema);
if (obj instanceof Map) {
for (const [key, value] of obj) map.items.push(schema.createPair(key, value, ctx));
} else if (obj && typeof obj === 'object') {
for (const key of Object.keys(obj)) map.items.push(schema.cre... | Tries to keep input at up to `lineWidth` characters, splitting only on spaces
not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
terminated with `\n` and started with `indent`.
@param {string} text
@param {string} indent
@param {string} [mode='flow'] `'block'` prevents more-indented lines
from... | createMap | 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
};
} | Tries to keep input at up to `lineWidth` characters, splitting only on spaces
not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
terminated with `\n` and started with `indent`.
@param {string} text
@param {string} indent
@param {string} [mode='flow'] `'block'` prevents more-indented lines
from... | _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 parseSeq(doc, cst) {
if (cst.type !== constants.Type.SEQ && cst.type !== constants.Type.FLOW_SEQ) {
const msg = `A ${cst.type} node cannot be resolved as a sequence`;
doc.errors.push(new errors.YAMLSyntaxError(cst, msg));
return null;
}
const {
comments,
items
} =... | Tries to keep input at up to `lineWidth` characters, splitting only on spaces
not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
terminated with `\n` and started with `indent`.
@param {string} text
@param {string} indent
@param {string} [mode='flow'] `'block'` prevents more-indented lines
from... | parseSeq | 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 resolveBlockSeqItems(doc, cst) {
const comments = [];
const items = [];
for (let i = 0; i < cst.items.length; ++i) {
const item = cst.items[i];
switch (item.type) {
case constants.Type.BLANK_LINE:
comments.push({
before: items.length
});
... | Tries to keep input at up to `lineWidth` characters, splitting only on spaces
not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
terminated with `\n` and started with `indent`.
@param {string} text
@param {string} indent
@param {string} [mode='flow'] `'block'` prevents more-indented lines
from... | resolveBlockSeqItems | 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 resolveFlowSeqItems(doc, cst) {
const comments = [];
const items = [];
let explicitKey = false;
let key = undefined;
let keyStart = null;
let next = '[';
for (let i = 0; i < cst.items.length; ++i) {
const item = cst.items[i];
if (typeof item.char === 'string') {
... | Tries to keep input at up to `lineWidth` characters, splitting only on spaces
not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
terminated with `\n` and started with `indent`.
@param {string} text
@param {string} indent
@param {string} [mode='flow'] `'block'` prevents more-indented lines
from... | resolveFlowSeqItems | 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
};
} | Tries to keep input at up to `lineWidth` characters, splitting only on spaces
not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
terminated with `\n` and started with `indent`.
@param {string} text
@param {string} indent
@param {string} [mode='flow'] `'block'` prevents more-indented lines
from... | _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 createSeq(schema, obj, ctx) {
const seq = new _Seq.default(schema);
if (obj && obj[Symbol.iterator]) {
for (const it of obj) {
const v = schema.createNode(it, ctx.wrapScalars, null, ctx);
seq.items.push(v);
}
}
return seq;
} | Tries to keep input at up to `lineWidth` characters, splitting only on spaces
not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
terminated with `\n` and started with `indent`.
@param {string} text
@param {string} indent
@param {string} [mode='flow'] `'block'` prevents more-indented lines
from... | createSeq | 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 |
resolveString = (doc, node) => {
// on error, will return { str: string, errors: Error[] }
const res = node.strValue;
if (!res) return '';
if (typeof res === 'string') return res;
res.errors.forEach(error => {
if (!error.source) error.source = node;
doc.errors.push(error);
});
re... | Tries to keep input at up to `lineWidth` characters, splitting only on spaces
not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
terminated with `\n` and started with `indent`.
@param {string} text
@param {string} indent
@param {string} [mode='flow'] `'block'` prevents more-indented lines
from... | resolveString | 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 |
resolveString = (doc, node) => {
// on error, will return { str: string, errors: Error[] }
const res = node.strValue;
if (!res) return '';
if (typeof res === 'string') return res;
res.errors.forEach(error => {
if (!error.source) error.source = node;
doc.errors.push(error);
});
re... | Tries to keep input at up to `lineWidth` characters, splitting only on spaces
not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
terminated with `\n` and started with `indent`.
@param {string} text
@param {string} indent
@param {string} [mode='flow'] `'block'` prevents more-indented lines
from... | resolveString | 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 |
stringify(item, ctx, onComment, onChompKeep) {
ctx = Object.assign({
actualString: true
}, ctx);
return (0, stringify.stringifyString)(item, ctx, onComment, onChompKeep);
} | Tries to keep input at up to `lineWidth` characters, splitting only on spaces
not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
terminated with `\n` and started with `indent`.
@param {string} text
@param {string} indent
@param {string} [mode='flow'] `'block'` prevents more-indented lines
from... | stringify | 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
};
} | Tries to keep input at up to `lineWidth` characters, splitting only on spaces
not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
terminated with `\n` and started with `indent`.
@param {string} text
@param {string} indent
@param {string} [mode='flow'] `'block'` prevents more-indented lines
from... | _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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.