code
stringlengths 24
2.07M
| docstring
stringlengths 25
85.3k
| func_name
stringlengths 1
92
| language
stringclasses 1
value | repo
stringlengths 5
64
| path
stringlengths 4
172
| url
stringlengths 44
218
| license
stringclasses 7
values |
---|---|---|---|---|---|---|---|
function _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 being folded; `'quoted'` allows for `\` escapes, including escaped
newlines
@param {Object} options
@param {number} [options.indentAtStart] Accounts for leading contents on
the first line, defaulting to `indent.length`
@param {number} [options.lineWidth=80]
@param {number} [options.minContentWidth=20] Allow highly indented lines to
stretch the line width
@param {function} options.onFold Called once if the text is folded
@param {function} options.onFold Called once if any line of text exceeds
lineWidth characters
|
_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
|
resolve(str, frac) {
const node = new _Scalar.default(parseFloat(str));
if (frac && frac[frac.length - 1] === '0') node.minFractionDigits = frac.length;
return node;
}
|
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 being folded; `'quoted'` allows for `\` escapes, including escaped
newlines
@param {Object} options
@param {number} [options.indentAtStart] Accounts for leading contents on
the first line, defaulting to `indent.length`
@param {number} [options.lineWidth=80]
@param {number} [options.minContentWidth=20] Allow highly indented lines to
stretch the line width
@param {function} options.onFold Called once if the text is folded
@param {function} options.onFold Called once if any line of text exceeds
lineWidth characters
|
resolve
|
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 being folded; `'quoted'` allows for `\` escapes, including escaped
newlines
@param {Object} options
@param {number} [options.indentAtStart] Accounts for leading contents on
the first line, defaulting to `indent.length`
@param {number} [options.lineWidth=80]
@param {number} [options.minContentWidth=20] Allow highly indented lines to
stretch the line width
@param {function} options.onFold Called once if the text is folded
@param {function} options.onFold Called once if any line of text exceeds
lineWidth characters
|
_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 _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
_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 parsePairs(doc, cst) {
const seq = (0, _parseSeq.default)(doc, cst);
for (let i = 0; i < seq.items.length; ++i) {
let item = seq.items[i];
if (item instanceof _Pair.default) continue;else if (item instanceof _Map$1.default) {
if (item.items.length > 1) {
const msg = 'Each pair must have its own sequence indicator';
throw new errors.YAMLSemanticError(cst, msg);
}
const pair = item.items[0] || new _Pair.default();
if (item.commentBefore) pair.commentBefore = pair.commentBefore ? `${item.commentBefore}\n${pair.commentBefore}` : item.commentBefore;
if (item.comment) pair.comment = pair.comment ? `${item.comment}\n${pair.comment}` : item.comment;
item = pair;
}
seq.items[i] = item instanceof _Pair.default ? item : new _Pair.default(item);
}
return seq;
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
parsePairs
|
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 createPairs(schema, iterable, ctx) {
const pairs = new _Seq.default(schema);
pairs.tag = 'tag:yaml.org,2002:pairs';
for (const it of iterable) {
let key, value;
if (Array.isArray(it)) {
if (it.length === 2) {
key = it[0];
value = it[1];
} else throw new TypeError(`Expected [key, value] tuple: ${it}`);
} else if (it && it instanceof Object) {
const keys = Object.keys(it);
if (keys.length === 1) {
key = keys[0];
value = it[key];
} else throw new TypeError(`Expected { key: value } tuple: ${it}`);
} else {
key = it;
}
const pair = schema.createPair(key, value, ctx);
pairs.items.push(pair);
}
return pairs;
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
createPairs
|
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
};
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
_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;
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
_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
|
constructor() {
super();
_defineProperty(this, "add", _Map$1.default.prototype.add.bind(this));
_defineProperty(this, "delete", _Map$1.default.prototype.delete.bind(this));
_defineProperty(this, "get", _Map$1.default.prototype.get.bind(this));
_defineProperty(this, "has", _Map$1.default.prototype.has.bind(this));
_defineProperty(this, "set", _Map$1.default.prototype.set.bind(this));
this.tag = YAMLOMap.tag;
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
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(_, ctx) {
const map = new Map();
if (ctx && ctx.onCreate) ctx.onCreate(map);
for (const pair of this.items) {
let key, value;
if (pair instanceof _Pair.default) {
key = (0, _toJSON.default)(pair.key, '', ctx);
value = (0, _toJSON.default)(pair.value, key, ctx);
} else {
key = (0, _toJSON.default)(pair, '', ctx);
}
if (map.has(key)) throw new Error('Ordered maps must not include duplicate keys');
map.set(key, value);
}
return map;
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
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 parseOMap(doc, cst) {
const pairs$1 = (0, pairs.parsePairs)(doc, cst);
const seenKeys = [];
for (const {
key
} of pairs$1.items) {
if (key instanceof _Scalar.default) {
if (seenKeys.includes(key.value)) {
const msg = 'Ordered maps must not include duplicate keys';
throw new errors.YAMLSemanticError(cst, msg);
} else {
seenKeys.push(key.value);
}
}
}
return Object.assign(new YAMLOMap(), pairs$1);
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
parseOMap
|
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 createOMap(schema, iterable, ctx) {
const pairs$1 = (0, pairs.createPairs)(schema, iterable, ctx);
const omap = new YAMLOMap();
omap.items = pairs$1.items;
return omap;
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
createOMap
|
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
};
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
_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 _getRequireWildcardCache() {
if (typeof WeakMap !== "function") return null;
var cache = new WeakMap();
_getRequireWildcardCache = function () {
return cache;
};
return cache;
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
_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)) {
return cache.get(obj);
}
var newObj = {};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
_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 _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;
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
_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
|
constructor() {
super();
this.tag = YAMLSet.tag;
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
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
|
add(key) {
const pair = key instanceof _Pair.default ? key : new _Pair.default(key);
const prev = (0, _Map$1.findPair)(this.items, pair.key);
if (!prev) this.items.push(pair);
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
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
|
get(key, keepPair) {
const pair = (0, _Map$1.findPair)(this.items, key);
return !keepPair && pair instanceof _Pair.default ? pair.key instanceof _Scalar.default ? pair.key.value : pair.key : pair;
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
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
|
set(key, value) {
if (typeof value !== 'boolean') throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof value}`);
const prev = (0, _Map$1.findPair)(this.items, key);
if (prev && !value) {
this.items.splice(this.items.indexOf(prev), 1);
} else if (!prev && value) {
this.items.push(new _Pair.default(key));
}
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
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) {
return super.toJSON(_, ctx, Set);
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
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);
if (this.hasAllNullValues()) return super.toString(ctx, onComment, onChompKeep);else throw new Error('Set items must all have null values');
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
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 parseSet(doc, cst) {
const map = (0, _parseMap.default)(doc, cst);
if (!map.hasAllNullValues()) throw new errors.YAMLSemanticError(cst, 'Set items must all have null values');
return Object.assign(new YAMLSet(), map);
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
parseSet
|
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 createSet(schema, iterable, ctx) {
const set = new YAMLSet();
for (const value of iterable) set.items.push(schema.createPair(value, null, ctx));
return set;
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
createSet
|
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
|
parseSexagesimal = (sign, parts) => {
const n = parts.split(':').reduce((n, p) => n * 60 + Number(p), 0);
return sign === '-' ? -n : n;
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
parseSexagesimal
|
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
|
parseSexagesimal = (sign, parts) => {
const n = parts.split(':').reduce((n, p) => n * 60 + Number(p), 0);
return sign === '-' ? -n : n;
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
parseSexagesimal
|
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
|
stringifySexagesimal = ({
value
}) => {
if (isNaN(value) || !isFinite(value)) return (0, stringify.stringifyNumber)(value);
let sign = '';
if (value < 0) {
sign = '-';
value = Math.abs(value);
}
const parts = [value % 60]; // seconds, including ms
if (value < 60) {
parts.unshift(0); // at least one : is required
} else {
value = Math.round((value - parts[0]) / 60);
parts.unshift(value % 60); // minutes
if (value >= 60) {
value = Math.round((value - parts[0]) / 60);
parts.unshift(value); // hours
}
}
return sign + parts.map(n => n < 10 ? '0' + String(n) : String(n)).join(':').replace(/000000\d*$/, '') // % 60 may introduce error
;
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
stringifySexagesimal
|
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
|
stringifySexagesimal = ({
value
}) => {
if (isNaN(value) || !isFinite(value)) return (0, stringify.stringifyNumber)(value);
let sign = '';
if (value < 0) {
sign = '-';
value = Math.abs(value);
}
const parts = [value % 60]; // seconds, including ms
if (value < 60) {
parts.unshift(0); // at least one : is required
} else {
value = Math.round((value - parts[0]) / 60);
parts.unshift(value % 60); // minutes
if (value >= 60) {
value = Math.round((value - parts[0]) / 60);
parts.unshift(value); // hours
}
}
return sign + parts.map(n => n < 10 ? '0' + String(n) : String(n)).join(':').replace(/000000\d*$/, '') // % 60 may introduce error
;
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
stringifySexagesimal
|
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
};
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
_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
|
boolStringify = ({
value
}) => value ? options.boolOptions.trueStr : options.boolOptions.falseStr
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
boolStringify
|
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
|
boolStringify = ({
value
}) => value ? options.boolOptions.trueStr : options.boolOptions.falseStr
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
boolStringify
|
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
|
resolve(str, frac) {
const node = new _Scalar.default(parseFloat(str.replace(/_/g, '')));
if (frac) {
const f = frac.replace(/_/g, '');
if (f[f.length - 1] === '0') node.minFractionDigits = f.length;
}
return node;
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
resolve
|
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
};
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
_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 _getRequireWildcardCache() {
if (typeof WeakMap !== "function") return null;
var cache = new WeakMap();
_getRequireWildcardCache = function () {
return cache;
};
return cache;
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
_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)) {
return cache.get(obj);
}
var newObj = {};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
_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
};
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
_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;
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
_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
|
isMap = ({
type
}) => type === constants.Type.FLOW_MAP || type === constants.Type.MAP
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
isMap
|
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
|
isMap = ({
type
}) => type === constants.Type.FLOW_MAP || type === constants.Type.MAP
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
isMap
|
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
|
isSeq = ({
type
}) => type === constants.Type.FLOW_SEQ || type === constants.Type.SEQ
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
isSeq
|
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
|
isSeq = ({
type
}) => type === constants.Type.FLOW_SEQ || type === constants.Type.SEQ
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
isSeq
|
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({
customTags,
merge,
schema,
sortMapEntries,
tags: deprecatedCustomTags
}) {
this.merge = !!merge;
this.name = schema;
this.sortMapEntries = sortMapEntries === true ? (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0 : sortMapEntries || null;
this.tags = tags_1.schemas[schema.replace(/\W/g, '')]; // 'yaml-1.1' -> 'yaml11'
if (!this.tags) {
const keys = Object.keys(tags_1.schemas).map(key => JSON.stringify(key)).join(', ');
throw new Error(`Unknown schema "${schema}"; use one of ${keys}`);
}
if (!customTags && deprecatedCustomTags) {
customTags = deprecatedCustomTags;
(0, warnings.warnOptionDeprecation)('tags', 'customTags');
}
if (Array.isArray(customTags)) {
for (const tag of customTags) this.tags = this.tags.concat(tag);
} else if (typeof customTags === 'function') {
this.tags = customTags(this.tags.slice());
}
for (let i = 0; i < this.tags.length; ++i) {
const tag = this.tags[i];
if (typeof tag === 'string') {
const tagObj = tags_1.tags[tag];
if (!tagObj) {
const keys = Object.keys(tags_1.tags).map(key => JSON.stringify(key)).join(', ');
throw new Error(`Unknown custom tag "${tag}"; use one of ${keys}`);
}
this.tags[i] = tagObj;
}
}
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
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
|
createNode(value, wrapScalars, tag, ctx) {
if (value instanceof _Node.default) return value;
let tagObj;
if (tag) {
if (tag.startsWith('!!')) tag = Schema.defaultPrefix + tag.slice(2);
const match = this.tags.filter(t => t.tag === tag);
tagObj = match.find(t => !t.format) || match[0];
if (!tagObj) throw new Error(`Tag ${tag} not found`);
} else {
// TODO: deprecate/remove class check
tagObj = this.tags.find(t => (t.identify && t.identify(value) || t.class && value instanceof t.class) && !t.format);
if (!tagObj) {
if (typeof value.toJSON === 'function') value = value.toJSON();
if (typeof value !== 'object') return wrapScalars ? new _Scalar.default(value) : value;
tagObj = value instanceof Map ? tags_1.tags.map : value[Symbol.iterator] ? tags_1.tags.seq : tags_1.tags.map;
}
}
if (!ctx) ctx = {
wrapScalars
};else ctx.wrapScalars = wrapScalars;
if (ctx.onTagObj) {
ctx.onTagObj(tagObj);
delete ctx.onTagObj;
}
const obj = {};
if (value && typeof value === 'object' && ctx.prevObjects) {
const prev = ctx.prevObjects.get(value);
if (prev) {
const alias = new _Alias.default(prev); // leaves source dirty; must be cleaned by caller
ctx.aliasNodes.push(alias);
return alias;
}
obj.value = value;
ctx.prevObjects.set(value, obj);
}
obj.node = tagObj.createNode ? tagObj.createNode(this, value, ctx) : wrapScalars ? new _Scalar.default(value) : value;
if (tag && obj.node instanceof _Node.default) obj.node.tag = tag;
return obj.node;
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
createNode
|
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
|
createPair(key, value, ctx) {
const k = this.createNode(key, ctx.wrapScalars, null, ctx);
const v = this.createNode(value, ctx.wrapScalars, null, ctx);
return new _Pair.default(k, v);
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
createPair
|
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
|
resolveScalar(str, tags) {
if (!tags) tags = this.tags;
for (let i = 0; i < tags.length; ++i) {
const {
format,
test,
resolve
} = tags[i];
if (test) {
const match = str.match(test);
if (match) {
let res = resolve.apply(null, match);
if (!(res instanceof _Scalar.default)) res = new _Scalar.default(res);
if (format) res.format = format;
return res;
}
}
}
if (this.tags.scalarFallback) str = this.tags.scalarFallback(str);
return new _Scalar.default(str);
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
resolveScalar
|
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
|
resolveNode(doc, node, tagName) {
const tags = this.tags.filter(({
tag
}) => tag === tagName);
const generic = tags.find(({
test
}) => !test);
if (node.error) doc.errors.push(node.error);
try {
if (generic) {
let res = generic.resolve(doc, node);
if (!(res instanceof _Collection.default)) res = new _Scalar.default(res);
node.resolved = res;
} else {
const str = (0, string.resolveString)(doc, node);
if (typeof str === 'string' && tags.length > 0) {
node.resolved = this.resolveScalar(str, tags);
}
}
} catch (error) {
/* istanbul ignore if */
if (!error.source) error.source = node;
doc.errors.push(error);
node.resolved = null;
}
if (!node.resolved) return null;
if (tagName && node.tag) node.resolved.tag = tagName;
return node.resolved;
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
resolveNode
|
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
|
resolveNodeWithFallback(doc, node, tagName) {
const res = this.resolveNode(doc, node, tagName);
if (Object.prototype.hasOwnProperty.call(node, 'resolved')) return res;
const fallback = isMap(node) ? Schema.defaultTags.MAP : isSeq(node) ? Schema.defaultTags.SEQ : Schema.defaultTags.STR;
/* istanbul ignore else */
if (fallback) {
doc.warnings.push(new errors.YAMLWarning(node, `The tag ${tagName} is unavailable, falling back to ${fallback}`));
const res = this.resolveNode(doc, node, fallback);
res.tag = tagName;
return res;
} else {
doc.errors.push(new errors.YAMLReferenceError(node, `The tag ${tagName} is unavailable`));
return null;
}
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
resolveNodeWithFallback
|
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
|
getTagObject(item) {
if (item instanceof _Alias.default) return _Alias.default;
if (item.tag) {
const match = this.tags.filter(t => t.tag === item.tag);
if (match.length > 0) return match.find(t => t.format === item.format) || match[0];
}
let tagObj, obj;
if (item instanceof _Scalar.default) {
obj = item.value; // TODO: deprecate/remove class check
const match = this.tags.filter(t => t.identify && t.identify(obj) || t.class && obj instanceof t.class);
tagObj = match.find(t => t.format === item.format) || match.find(t => !t.format);
} else {
obj = item;
tagObj = this.tags.find(t => t.nodeClass && obj instanceof t.nodeClass);
}
if (!tagObj) {
const name = obj && obj.constructor ? obj.constructor.name : typeof obj;
throw new Error(`Tag not resolved for ${name} value`);
}
return tagObj;
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
getTagObject
|
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
|
stringifyProps(node, tagObj, {
anchors,
doc
}) {
const props = [];
const anchor = doc.anchors.getName(node);
if (anchor) {
anchors[anchor] = node;
props.push(`&${anchor}`);
}
if (node.tag) {
props.push(doc.stringifyTag(node.tag));
} else if (!tagObj.default) {
props.push(doc.stringifyTag(tagObj.tag));
}
return props.join(' ');
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
stringifyProps
|
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) {
let tagObj;
if (!(item instanceof _Node.default)) {
const createCtx = {
aliasNodes: [],
onTagObj: o => tagObj = o,
prevObjects: new Map()
};
item = this.createNode(item, true, null, createCtx);
const {
anchors
} = ctx.doc;
for (const alias of createCtx.aliasNodes) {
alias.source = alias.source.node;
let name = anchors.getName(alias.source);
if (!name) {
name = anchors.newName();
anchors.map[name] = alias.source;
}
}
}
ctx.tags = this;
if (item instanceof _Pair.default) return item.toString(ctx, onComment, onChompKeep);
if (!tagObj) tagObj = this.getTagObject(item);
const props = this.stringifyProps(item, tagObj, ctx);
if (props.length > 0) ctx.indentAtStart = (ctx.indentAtStart || 0) + props.length + 1;
const str = typeof tagObj.stringify === 'function' ? tagObj.stringify(item, ctx, onComment, onChompKeep) : item instanceof _Collection.default ? item.toString(ctx, onComment, onChompKeep) : (0, stringify.stringifyString)(item, ctx, onComment, onChompKeep);
return props ? item instanceof _Collection.default && str[0] !== '{' && str[0] !== '[' ? `${props}\n${ctx.indent}${str}` : `${props} ${str}` : str;
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
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 _getRequireWildcardCache() {
if (typeof WeakMap !== "function") return null;
var cache = new WeakMap();
_getRequireWildcardCache = function () {
return cache;
};
return cache;
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
_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)) {
return cache.get(obj);
}
var newObj = {};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
_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
};
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
_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;
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
_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
|
constructor(options) {
this.anchors = new _Anchors.default(options.anchorPrefix);
this.commentBefore = null;
this.comment = null;
this.contents = null;
this.directivesEndMarker = null;
this.errors = [];
this.options = options;
this.schema = null;
this.tagPrefixes = [];
this.version = null;
this.warnings = [];
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
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
|
assertCollectionContents() {
if (this.contents instanceof _Collection.default) return true;
throw new Error('Expected a YAML collection as document contents');
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
assertCollectionContents
|
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(value) {
this.assertCollectionContents();
return this.contents.add(value);
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
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
|
addIn(path, value) {
this.assertCollectionContents();
this.contents.addIn(path, value);
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
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
|
delete(key) {
this.assertCollectionContents();
return this.contents.delete(key);
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
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
|
deleteIn(path) {
if ((0, _Collection.isEmptyPath)(path)) {
if (this.contents == null) return false;
this.contents = null;
return true;
}
this.assertCollectionContents();
return this.contents.deleteIn(path);
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
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
|
getDefaults() {
return Document.defaults[this.version] || Document.defaults[this.options.version] || {};
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
getDefaults
|
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) {
return this.contents instanceof _Collection.default ? this.contents.get(key, keepScalar) : undefined;
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
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
|
getIn(path, keepScalar) {
if ((0, _Collection.isEmptyPath)(path)) return !keepScalar && this.contents instanceof _Scalar.default ? this.contents.value : this.contents;
return this.contents instanceof _Collection.default ? this.contents.getIn(path, keepScalar) : undefined;
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
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
|
has(key) {
return this.contents instanceof _Collection.default ? this.contents.has(key) : false;
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
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
|
hasIn(path) {
if ((0, _Collection.isEmptyPath)(path)) return this.contents !== undefined;
return this.contents instanceof _Collection.default ? this.contents.hasIn(path) : false;
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
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
|
set(key, value) {
this.assertCollectionContents();
this.contents.set(key, value);
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
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
|
setIn(path, value) {
if ((0, _Collection.isEmptyPath)(path)) this.contents = value;else {
this.assertCollectionContents();
this.contents.setIn(path, value);
}
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
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
|
setSchema(id, customTags) {
if (!id && !customTags && this.schema) return;
if (typeof id === 'number') id = id.toFixed(1);
if (id === '1.0' || id === '1.1' || id === '1.2') {
if (this.version) this.version = id;else this.options.version = id;
delete this.options.schema;
} else if (id && typeof id === 'string') {
this.options.schema = id;
}
if (Array.isArray(customTags)) this.options.customTags = customTags;
const opt = Object.assign({}, this.getDefaults(), this.options);
this.schema = new _schema.default(opt);
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
setSchema
|
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(node, prevDoc) {
if (this.options.keepCstNodes) this.cstNode = node;
if (this.options.keepNodeTypes) this.type = 'DOCUMENT';
const {
directives = [],
contents = [],
directivesEndMarker,
error,
valueRange
} = node;
if (error) {
if (!error.source) error.source = this;
this.errors.push(error);
}
this.parseDirectives(directives, prevDoc);
if (directivesEndMarker) this.directivesEndMarker = true;
this.range = valueRange ? [valueRange.start, valueRange.end] : null;
this.setSchema();
this.anchors._cstAliases = [];
this.parseContents(contents);
this.anchors.resolveNodes();
if (this.options.prettyErrors) {
for (const error of this.errors) if (error instanceof errors.YAMLError) error.makePretty();
for (const warn of this.warnings) if (warn instanceof errors.YAMLError) warn.makePretty();
}
return this;
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
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
|
parseDirectives(directives, prevDoc) {
const directiveComments = [];
let hasDirectives = false;
directives.forEach(directive => {
const {
comment,
name
} = directive;
switch (name) {
case 'TAG':
this.resolveTagDirective(directive);
hasDirectives = true;
break;
case 'YAML':
case 'YAML:1.0':
this.resolveYamlDirective(directive);
hasDirectives = true;
break;
default:
if (name) {
const msg = `YAML only supports %TAG and %YAML directives, and not %${name}`;
this.warnings.push(new errors.YAMLWarning(directive, msg));
}
}
if (comment) directiveComments.push(comment);
});
if (prevDoc && !hasDirectives && '1.1' === (this.version || prevDoc.version || this.options.version)) {
const copyTagPrefix = ({
handle,
prefix
}) => ({
handle,
prefix
});
this.tagPrefixes = prevDoc.tagPrefixes.map(copyTagPrefix);
this.version = prevDoc.version;
}
this.commentBefore = directiveComments.join('\n') || null;
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
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
|
copyTagPrefix = ({
handle,
prefix
}) => ({
handle,
prefix
})
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
copyTagPrefix
|
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
|
copyTagPrefix = ({
handle,
prefix
}) => ({
handle,
prefix
})
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
copyTagPrefix
|
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(contents) {
const comments = {
before: [],
after: []
};
const contentNodes = [];
let spaceBefore = false;
contents.forEach(node => {
if (node.valueRange) {
if (contentNodes.length === 1) {
const msg = 'Document is not valid YAML (bad indentation?)';
this.errors.push(new errors.YAMLSyntaxError(node, msg));
}
const res = this.resolveNode(node);
if (spaceBefore) {
res.spaceBefore = true;
spaceBefore = false;
}
contentNodes.push(res);
} else if (node.comment !== null) {
const cc = contentNodes.length === 0 ? comments.before : comments.after;
cc.push(node.comment);
} else if (node.type === constants.Type.BLANK_LINE) {
spaceBefore = true;
if (contentNodes.length === 0 && comments.before.length > 0 && !this.commentBefore) {
// space-separated comments at start are parsed as document comments
this.commentBefore = comments.before.join('\n');
comments.before = [];
}
}
});
switch (contentNodes.length) {
case 0:
this.contents = null;
comments.after = comments.before;
break;
case 1:
this.contents = contentNodes[0];
if (this.contents) {
const cb = comments.before.join('\n') || null;
if (cb) {
const cbNode = this.contents instanceof _Collection.default && this.contents.items[0] ? this.contents.items[0] : this.contents;
cbNode.commentBefore = cbNode.commentBefore ? `${cb}\n${cbNode.commentBefore}` : cb;
}
} else {
comments.after = comments.before.concat(comments.after);
}
break;
default:
this.contents = contentNodes;
if (this.contents[0]) {
this.contents[0].commentBefore = comments.before.join('\n') || null;
} else {
comments.after = comments.before.concat(comments.after);
}
}
this.comment = comments.after.join('\n') || null;
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
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
|
resolveTagDirective(directive) {
const [handle, prefix] = directive.parameters;
if (handle && prefix) {
if (this.tagPrefixes.every(p => p.handle !== handle)) {
this.tagPrefixes.push({
handle,
prefix
});
} else {
const msg = 'The %TAG directive must only be given at most once per handle in the same document.';
this.errors.push(new errors.YAMLSemanticError(directive, msg));
}
} else {
const msg = 'Insufficient parameters given for %TAG directive';
this.errors.push(new errors.YAMLSemanticError(directive, msg));
}
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
resolveTagDirective
|
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
|
resolveYamlDirective(directive) {
let [version] = directive.parameters;
if (directive.name === 'YAML:1.0') version = '1.0';
if (this.version) {
const msg = 'The %YAML directive must only be given at most once per document.';
this.errors.push(new errors.YAMLSemanticError(directive, msg));
}
if (!version) {
const msg = 'Insufficient parameters given for %YAML directive';
this.errors.push(new errors.YAMLSemanticError(directive, msg));
} else {
if (!Document.defaults[version]) {
const v0 = this.version || this.options.version;
const msg = `Document will be parsed as YAML ${v0} rather than YAML ${version}`;
this.warnings.push(new errors.YAMLWarning(directive, msg));
}
this.version = version;
}
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
resolveYamlDirective
|
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
|
resolveTagName(node) {
const {
tag,
type
} = node;
let nonSpecific = false;
if (tag) {
const {
handle,
suffix,
verbatim
} = tag;
if (verbatim) {
if (verbatim !== '!' && verbatim !== '!!') return verbatim;
const msg = `Verbatim tags aren't resolved, so ${verbatim} is invalid.`;
this.errors.push(new errors.YAMLSemanticError(node, msg));
} else if (handle === '!' && !suffix) {
nonSpecific = true;
} else {
let prefix = this.tagPrefixes.find(p => p.handle === handle);
if (!prefix) {
const dtp = this.getDefaults().tagPrefixes;
if (dtp) prefix = dtp.find(p => p.handle === handle);
}
if (prefix) {
if (suffix) {
if (handle === '!' && (this.version || this.options.version) === '1.0') {
if (suffix[0] === '^') return suffix;
if (/[:/]/.test(suffix)) {
// word/foo -> tag:word.yaml.org,2002:foo
const vocab = suffix.match(/^([a-z0-9-]+)\/(.*)/i);
return vocab ? `tag:${vocab[1]}.yaml.org,2002:${vocab[2]}` : `tag:${suffix}`;
}
}
return prefix.prefix + decodeURIComponent(suffix);
}
this.errors.push(new errors.YAMLSemanticError(node, `The ${handle} tag has no suffix.`));
} else {
const msg = `The ${handle} tag handle is non-default and was not declared.`;
this.errors.push(new errors.YAMLSemanticError(node, msg));
}
}
}
switch (type) {
case constants.Type.BLOCK_FOLDED:
case constants.Type.BLOCK_LITERAL:
case constants.Type.QUOTE_DOUBLE:
case constants.Type.QUOTE_SINGLE:
return _schema.default.defaultTags.STR;
case constants.Type.FLOW_MAP:
case constants.Type.MAP:
return _schema.default.defaultTags.MAP;
case constants.Type.FLOW_SEQ:
case constants.Type.SEQ:
return _schema.default.defaultTags.SEQ;
case constants.Type.PLAIN:
return nonSpecific ? _schema.default.defaultTags.STR : null;
default:
return null;
}
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
resolveTagName
|
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
|
resolveNode(node) {
if (!node) return null;
const {
anchors,
errors: errors$1,
schema
} = this;
let hasAnchor = false;
let hasTag = false;
const comments = {
before: [],
after: []
};
const props = isCollectionItem(node.context.parent) ? node.context.parent.props.concat(node.props) : node.props;
for (const {
start,
end
} of props) {
switch (node.context.src[start]) {
case constants.Char.COMMENT:
{
if (!node.commentHasRequiredWhitespace(start)) {
const msg = 'Comments must be separated from other tokens by white space characters';
errors$1.push(new errors.YAMLSemanticError(node, msg));
}
const c = node.context.src.slice(start + 1, end);
const {
header,
valueRange
} = node;
if (valueRange && (start > valueRange.start || header && start > header.start)) {
comments.after.push(c);
} else {
comments.before.push(c);
}
}
break;
case constants.Char.ANCHOR:
if (hasAnchor) {
const msg = 'A node can have at most one anchor';
errors$1.push(new errors.YAMLSemanticError(node, msg));
}
hasAnchor = true;
break;
case constants.Char.TAG:
if (hasTag) {
const msg = 'A node can have at most one tag';
errors$1.push(new errors.YAMLSemanticError(node, msg));
}
hasTag = true;
break;
}
}
if (hasAnchor) {
const name = node.anchor;
const prev = anchors.getNode(name); // At this point, aliases for any preceding node with the same anchor
// name have already been resolved, so it may safely be renamed.
if (prev) anchors.map[anchors.newName(name)] = prev; // During parsing, we need to store the CST node in anchors.map as
// anchors need to be available during resolution to allow for
// circular references.
anchors.map[name] = node;
}
let res;
if (node.type === constants.Type.ALIAS) {
if (hasAnchor || hasTag) {
const msg = 'An alias node must not specify any properties';
errors$1.push(new errors.YAMLSemanticError(node, msg));
}
const name = node.rawValue;
const src = anchors.getNode(name);
if (!src) {
const msg = `Aliased anchor not found: ${name}`;
errors$1.push(new errors.YAMLReferenceError(node, msg));
return null;
} // Lazy resolution for circular references
res = new _Alias.default(src);
anchors._cstAliases.push(res);
} else {
const tagName = this.resolveTagName(node);
if (tagName) {
res = schema.resolveNodeWithFallback(this, node, tagName);
} else {
if (node.type !== constants.Type.PLAIN) {
const msg = `Failed to resolve ${node.type} node here`;
errors$1.push(new errors.YAMLSyntaxError(node, msg));
return null;
}
try {
res = schema.resolveScalar(node.strValue || '');
} catch (error) {
if (!error.source) error.source = node;
errors$1.push(error);
return null;
}
}
}
if (res) {
res.range = [node.range.start, node.range.end];
if (this.options.keepCstNodes) res.cstNode = node;
if (this.options.keepNodeTypes) res.type = node.type;
const cb = comments.before.join('\n');
if (cb) {
res.commentBefore = res.commentBefore ? `${res.commentBefore}\n${cb}` : cb;
}
const ca = comments.after.join('\n');
if (ca) res.comment = res.comment ? `${res.comment}\n${ca}` : ca;
}
return node.resolved = res;
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
resolveNode
|
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
|
listNonDefaultTags() {
return (0, _listTagNames.default)(this.contents).filter(t => t.indexOf(_schema.default.defaultPrefix) !== 0);
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
listNonDefaultTags
|
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
|
setTagPrefix(handle, prefix) {
if (handle[0] !== '!' || handle[handle.length - 1] !== '!') throw new Error('Handle must start and end with !');
if (prefix) {
const prev = this.tagPrefixes.find(p => p.handle === handle);
if (prev) prev.prefix = prefix;else this.tagPrefixes.push({
handle,
prefix
});
} else {
this.tagPrefixes = this.tagPrefixes.filter(p => p.handle !== handle);
}
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
setTagPrefix
|
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
|
stringifyTag(tag) {
if ((this.version || this.options.version) === '1.0') {
const priv = tag.match(/^tag:private\.yaml\.org,2002:([^:/]+)$/);
if (priv) return '!' + priv[1];
const vocab = tag.match(/^tag:([a-zA-Z0-9-]+)\.yaml\.org,2002:(.*)/);
return vocab ? `!${vocab[1]}/${vocab[2]}` : `!${tag.replace(/^tag:/, '')}`;
} else {
let p = this.tagPrefixes.find(p => tag.indexOf(p.prefix) === 0);
if (!p) {
const dtp = this.getDefaults().tagPrefixes;
p = dtp && dtp.find(p => tag.indexOf(p.prefix) === 0);
}
if (!p) return tag[0] === '!' ? tag : `!<${tag}>`;
const suffix = tag.substr(p.prefix.length).replace(/[!,[\]{}]/g, ch => ({
'!': '%21',
',': '%2C',
'[': '%5B',
']': '%5D',
'{': '%7B',
'}': '%7D'
})[ch]);
return p.handle + suffix;
}
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
stringifyTag
|
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) {
const {
keepBlobsInJSON,
mapAsMap,
maxAliasCount
} = this.options;
const keep = keepBlobsInJSON && (typeof arg !== 'string' || !(this.contents instanceof _Scalar.default));
const ctx = {
doc: this,
keep,
mapAsMap: keep && !!mapAsMap,
maxAliasCount
};
const anchorNames = Object.keys(this.anchors.map);
if (anchorNames.length > 0) ctx.anchors = anchorNames.map(name => ({
alias: [],
aliasCount: 0,
count: 1,
node: this.anchors.map[name]
}));
return (0, _toJSON.default)(this.contents, arg, ctx);
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
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() {
if (this.errors.length > 0) throw new Error('Document with errors cannot be stringified');
this.setSchema();
const lines = [];
let hasDirectives = false;
if (this.version) {
let vd = '%YAML 1.2';
if (this.schema.name === 'yaml-1.1') {
if (this.version === '1.0') vd = '%YAML:1.0';else if (this.version === '1.1') vd = '%YAML 1.1';
}
lines.push(vd);
hasDirectives = true;
}
const tagNames = this.listNonDefaultTags();
this.tagPrefixes.forEach(({
handle,
prefix
}) => {
if (tagNames.some(t => t.indexOf(prefix) === 0)) {
lines.push(`%TAG ${handle} ${prefix}`);
hasDirectives = true;
}
});
if (hasDirectives || this.directivesEndMarker) lines.push('---');
if (this.commentBefore) {
if (hasDirectives || !this.directivesEndMarker) lines.unshift('');
lines.unshift(this.commentBefore.replace(/^/gm, '#'));
}
const ctx = {
anchors: {},
doc: this,
indent: ''
};
let chompKeep = false;
let contentComment = null;
if (this.contents) {
if (this.contents instanceof _Node.default) {
if (this.contents.spaceBefore && (hasDirectives || this.directivesEndMarker)) lines.push('');
if (this.contents.commentBefore) lines.push(this.contents.commentBefore.replace(/^/gm, '#')); // top-level block scalars need to be indented if followed by a comment
ctx.forceBlockIndent = !!this.comment;
contentComment = this.contents.comment;
}
const onChompKeep = contentComment ? null : () => chompKeep = true;
const body = this.schema.stringify(this.contents, ctx, () => contentComment = null, onChompKeep);
lines.push((0, _addComment.default)(body, '', contentComment));
} else if (this.contents !== undefined) {
lines.push(this.schema.stringify(this.contents, ctx));
}
if (this.comment) {
if ((!chompKeep || contentComment) && lines[lines.length - 1] !== '') lines.push('');
lines.push(this.comment.replace(/^/gm, '#'));
}
return lines.join('\n') + '\n';
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
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
};
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
_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 createNode(value, wrapScalars = true, tag) {
if (tag === undefined && typeof wrapScalars === 'string') {
tag = wrapScalars;
wrapScalars = true;
}
const options = Object.assign({}, _Document.default.defaults[defaultOptions.version], defaultOptions);
const schema = new _schema.default(options);
return schema.createNode(value, wrapScalars, tag);
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
createNode
|
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(options) {
super(Object.assign({}, defaultOptions, options));
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
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 parseAllDocuments(src, options) {
const stream = [];
let prev;
for (const cstDoc of (0, _parse.default)(src)) {
const doc = new Document(options);
doc.parse(cstDoc, prev);
stream.push(doc);
prev = doc;
}
return stream;
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
parseAllDocuments
|
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 parseDocument(src, options) {
const cst = (0, _parse.default)(src);
const doc = new Document(options).parse(cst[0]);
if (cst.length > 1) {
const errMsg = 'Source contains multiple documents; please use YAML.parseAllDocuments()';
doc.errors.unshift(new errors.YAMLSemanticError(cst[1], errMsg));
}
return doc;
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
parseDocument
|
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, options) {
const doc = parseDocument(src, options);
doc.warnings.forEach(warning => (0, warnings.warn)(warning));
if (doc.errors.length > 0) throw doc.errors[0];
return doc.toJSON();
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
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 stringify(value, options) {
const doc = new Document(options);
doc.contents = value;
return String(doc);
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
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
|
loadJs = function loadJs(filepath) {
if (importFresh$1 === undefined) {
importFresh$1 = importFresh;
}
const result = importFresh$1(filepath);
return result;
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
loadJs
|
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
|
loadJs = function loadJs(filepath) {
if (importFresh$1 === undefined) {
importFresh$1 = importFresh;
}
const result = importFresh$1(filepath);
return result;
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
loadJs
|
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
|
loadJson = function loadJson(filepath, content) {
if (parseJson === undefined) {
parseJson = parseJson$1;
}
try {
const result = parseJson(content);
return result;
} catch (error) {
error.message = `JSON Error in ${filepath}:\n${error.message}`;
throw error;
}
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
loadJson
|
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
|
loadJson = function loadJson(filepath, content) {
if (parseJson === undefined) {
parseJson = parseJson$1;
}
try {
const result = parseJson(content);
return result;
} catch (error) {
error.message = `JSON Error in ${filepath}:\n${error.message}`;
throw error;
}
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
loadJson
|
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
|
loadYaml = function loadYaml(filepath, content) {
if (yaml$1 === undefined) {
yaml$1 = yaml;
}
try {
const result = yaml$1.parse(content, {
prettyErrors: true
});
return result;
} catch (error) {
error.message = `YAML Error in ${filepath}:\n${error.message}`;
throw error;
}
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
loadYaml
|
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
|
loadYaml = function loadYaml(filepath, content) {
if (yaml$1 === undefined) {
yaml$1 = yaml;
}
try {
const result = yaml$1.parse(content, {
prettyErrors: true
});
return result;
} catch (error) {
error.message = `YAML Error in ${filepath}:\n${error.message}`;
throw error;
}
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
loadYaml
|
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 getPropertyByPath(source, path) {
if (typeof path === 'string' && Object.prototype.hasOwnProperty.call(source, path)) {
return source[path];
}
const parsedPath = typeof path === 'string' ? path.split('.') : path; // eslint-disable-next-line @typescript-eslint/no-explicit-any
return parsedPath.reduce((previous, key) => {
if (previous === undefined) {
return previous;
}
return previous[key];
}, source);
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
getPropertyByPath
|
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
};
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
_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(options) {
if (options.cache === true) {
this.loadCache = new Map();
this.searchCache = new Map();
}
this.config = options;
this.validateConfig();
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
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
|
clearLoadCache() {
if (this.loadCache) {
this.loadCache.clear();
}
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
clearLoadCache
|
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
|
clearSearchCache() {
if (this.searchCache) {
this.searchCache.clear();
}
}
|
Returns a Buffer in node and an Uint8Array in browsers
To use the resulting buffer as an image, you'll want to do something like:
const blob = new Blob([buffer], { type: 'image/jpeg' })
document.querySelector('#photo').src = URL.createObjectURL(blob)
|
clearSearchCache
|
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.