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 Chalk(options) {
// We check for this.template here since calling `chalk.constructor()`
// by itself will have a `this` of a previously constructed chalk object
if (!this || !(this instanceof Chalk) || this.template) {
const chalk = {};
applyOptions(chalk, options);
c... | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | Chalk | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
get() {
const codes = ansiStyles$2[key];
return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key);
} | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | get | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
get() {
return build.call(this, this._styles || [], true, 'visible');
} | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | get | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
get() {
const level = this.level;
return function () {
const open = ansiStyles$2.color[levelMapping[level]][model].apply(null, arguments);
const codes = {
open,
close: ansiStyles$2.color.close,
closeRe: ansiStyles$2.color.closeRe
... | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | get | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
get() {
const level = this.level;
return function () {
const open = ansiStyles$2.bgColor[levelMapping[level]][model].apply(null, arguments);
const codes = {
open,
close: ansiStyles$2.bgColor.close,
closeRe: ansiStyles$2.bgColor.closeR... | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | get | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function build(_styles, _empty, key) {
const builder = function builder() {
return applyStyle.apply(builder, arguments);
};
builder._styles = _styles;
builder._empty = _empty;
const self = this;
Object.defineProperty(builder, 'level', {
enumerable: true,
get... | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | build | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
builder = function builder() {
return applyStyle.apply(builder, arguments);
} | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | builder | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
builder = function builder() {
return applyStyle.apply(builder, arguments);
} | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | builder | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
get() {
return self.level;
} | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | get | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
set(level) {
self.level = level;
} | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | set | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
get() {
return self.enabled;
} | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | get | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
set(enabled) {
self.enabled = enabled;
} | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | set | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function applyStyle() {
// Support varags, but simply cast to string in case there's only one arg
const args = arguments;
const argsLen = args.length;
let str = String(arguments[0]);
if (argsLen === 0) {
return '';
}
if (argsLen > 1) {
// Don't slice `argument... | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | applyStyle | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function chalkTag(chalk, strings) {
if (!Array.isArray(strings)) {
// If chalk() was called by itself or with a string,
// return the string itself as a string.
return [].slice.call(arguments, 1).join(' ');
}
const args = [].slice.call(arguments, 2);
const parts = [strin... | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | chalkTag | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
} | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | _interopRequireDefault | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function _getRequireWildcardCache() {
if (typeof WeakMap !== "function") return null;
var cache = new WeakMap();
_getRequireWildcardCache = function _getRequireWildcardCache() {
return cache;
};
return cache;
} | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | _getRequireWildcardCache | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function _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.ha... | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | _interopRequireWildcard | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function getDefs(chalk) {
return {
keyword: chalk.cyan,
capitalized: chalk.yellow,
jsx_tag: chalk.yellow,
punctuator: chalk.yellow,
number: chalk.magenta,
string: chalk.green,
regex: chalk.magenta,
comment: chalk.grey,
invalid: chalk.white.bg... | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | getDefs | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function getTokenType(match) {
const [offset, text] = match.slice(-2);
const token = (0, _jsTokens.matchToToken)(match);
if (token.type === "name") {
if (_esutils.default.keyword.isReservedWordES6(token.value)) {
return "keyword";
}
if (JSX_TAG.test(token.value) && ... | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | getTokenType | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function highlightTokens(defs, text) {
return text.replace(_jsTokens.default, function (...args) {
const type = getTokenType(args);
const colorize = defs[type];
if (colorize) {
return args[0].split(NEWLINE).map(str => colorize(str)).join("\n");
} else {
return ... | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | highlightTokens | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function shouldHighlight(options) {
return _chalk.default.supportsColor || options.forceColor;
} | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | shouldHighlight | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function getChalk(options) {
let chalk = _chalk.default;
if (options.forceColor) {
chalk = new _chalk.default.constructor({
enabled: true,
level: 1
});
}
return chalk;
} | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | getChalk | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function highlight(code, options = {}) {
if (shouldHighlight(options)) {
const chalk = getChalk(options);
const defs = getDefs(chalk);
return highlightTokens(defs, code);
} else {
return code;
}
} | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | highlight | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function _getRequireWildcardCache() {
if (typeof WeakMap !== "function") return null;
var cache = new WeakMap();
_getRequireWildcardCache = function _getRequireWildcardCache() {
return cache;
};
return cache;
} | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | _getRequireWildcardCache | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function _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.ha... | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | _interopRequireWildcard | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function getDefs(chalk) {
return {
gutter: chalk.grey,
marker: chalk.red.bold,
message: chalk.red.bold
};
} | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | getDefs | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function getMarkerLines(loc, source, opts) {
const startLoc = Object.assign({
column: 0,
line: -1
}, loc.start);
const endLoc = Object.assign({}, startLoc, {}, loc.end);
const {
linesAbove = 2,
linesBelow = 3
} = opts || {};
const startLine = startLoc.... | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | getMarkerLines | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function codeFrameColumns(rawLines, loc, opts = {}) {
const highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight.shouldHighlight)(opts);
const chalk = (0, _highlight.getChalk)(opts);
const defs = getDefs(chalk);
const maybeHighlight = (chalkFn, string) => {
return hig... | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | codeFrameColumns | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
maybeHighlight = (chalkFn, string) => {
return highlighted ? chalkFn(string) : string;
} | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | maybeHighlight | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
maybeHighlight = (chalkFn, string) => {
return highlighted ? chalkFn(string) : string;
} | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | maybeHighlight | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function _default(rawLines, lineNumber, colNumber, opts = {}) {
if (!deprecationWarningShown) {
deprecationWarningShown = true;
const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
if (process.emitWarning) {
proce... | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | _default | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function getParsers(options) {
const parsers = {};
for (const plugin of options.plugins) {
if (!plugin.parsers) {
continue;
}
for (const name of ownNames(plugin.parsers)) {
Object.defineProperty(parsers, name, ownDescriptor(plugin.parsers, name));
}
}
return pa... | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | getParsers | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function resolveParser(opts, parsers) {
parsers = parsers || getParsers(opts);
if (typeof opts.parser === "function") {
// Custom parser API always works with JavaScript.
return {
parse: opts.parser,
astFormat: "estree",
locStart: locStart$1,
locEnd: locEnd$1
}... | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | resolveParser | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function parse(text, opts) {
const parsers = getParsers(opts); // Create a new object {parserName: parseFn}. Uses defineProperty() to only call
// the parsers getters when actually calling the parser `parse` function.
const parsersForCustomParserApi = Object.keys(parsers).reduce((object, parserName) => Obj... | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | parse | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
get() {
return parsers[parserName].parse;
} | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | get | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function normalize$1(options, opts) {
opts = opts || {};
const rawOptions = Object.assign({}, options);
const supportOptions = getSupportInfo$1({
plugins: options.plugins,
showUnreleased: true,
showDeprecated: true
}).options;
const defaults = Object.assign(Object.assign({}, hidden... | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | normalize$1 | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function getPlugin(options) {
const {
astFormat
} = options;
if (!astFormat) {
throw new Error("getPlugin() requires astFormat to be set");
}
const printerPlugin = options.plugins.find(plugin => plugin.printers && plugin.printers[astFormat]);
if (!printerPlugin) {
throw new ... | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | getPlugin | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function getInterpreter(filepath) {
if (typeof filepath !== "string") {
return "";
}
let fd;
try {
fd = fs.openSync(filepath, "r");
} catch (err) {
// istanbul ignore next
return "";
}
try {
const liner = new readlines(fd);
const firstLine = liner.next(... | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | getInterpreter | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function inferParser(filepath, plugins) {
const filename = path.basename(filepath).toLowerCase();
const languages = getSupportInfo$1({
plugins
}).languages.filter(language => language.since !== null); // If the file has no extension, we can try to infer the language from the
// interpreter in the ... | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | inferParser | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function massageAST(ast, options, parent) {
if (Array.isArray(ast)) {
return ast.map(e => massageAST(e, options, parent)).filter(Boolean);
}
if (!ast || typeof ast !== "object") {
return ast;
}
const newObj = {};
for (const key of Object.keys(ast)) {
if (typeof ast[key] !== ... | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance | massageAST | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function align(n, contents) {
return {
type: "align",
contents,
n
};
} | @param {number} n
@param {Doc} contents
@returns Doc | align | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function group(contents, opts) {
opts = opts || {};
return {
type: "group",
id: opts.id,
contents,
break: !!opts.shouldBreak,
expandedStates: opts.expandedStates
};
} | @param {Doc} contents
@param {object} [opts] - TBD ???
@returns Doc | group | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function conditionalGroup(states, opts) {
return group(states[0], Object.assign(Object.assign({}, opts), {}, {
expandedStates: states
}));
} | @param {Doc[]} states
@param {object} [opts] - TBD ???
@returns Doc | conditionalGroup | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function ifBreak(breakContents, flatContents, opts) {
opts = opts || {};
return {
type: "if-break",
breakContents,
flatContents,
groupId: opts.groupId
};
} | @param {Doc} [breakContents]
@param {Doc} [flatContents]
@param {object} [opts] - TBD ???
@returns Doc | ifBreak | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function join(sep, arr) {
const res = [];
for (let i = 0; i < arr.length; i++) {
if (i !== 0) {
res.push(sep);
}
res.push(arr[i]);
}
return concat(res);
} | @param {Doc} sep
@param {Doc[]} arr
@returns Doc | join | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function addAlignmentToDoc(doc, size, tabWidth) {
let aligned = doc;
if (size > 0) {
// Use indent to add tabs for all the levels of tabs we need
for (let i = 0; i < Math.floor(size / tabWidth); ++i) {
aligned = indent(aligned);
} // Use align for all the spaces that are needed
... | @param {Doc} doc
@param {number} size
@param {number} tabWidth | addAlignmentToDoc | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
ansiRegex = ({
onlyFirst = false
} = {}) => {
const pattern = ['[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'].join('|');
return new RegExp(pattern, onlyFirst ? undefined : 'g');
} | @param {Doc} doc
@param {number} size
@param {number} tabWidth | ansiRegex | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
isFullwidthCodePoint = codePoint => {
if (Number.isNaN(codePoint)) {
return false;
} // Code points are derived from:
// http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt
if (codePoint >= 0x1100 && (codePoint <= 0x115F || // Hangul Jamo
codePoint === 0x2329 || // LEFT-POINTING ANGLE BRAC... | @param {Doc} doc
@param {number} size
@param {number} tabWidth | isFullwidthCodePoint | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
isFullwidthCodePoint = codePoint => {
if (Number.isNaN(codePoint)) {
return false;
} // Code points are derived from:
// http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt
if (codePoint >= 0x1100 && (codePoint <= 0x115F || // Hangul Jamo
codePoint === 0x2329 || // LEFT-POINTING ANGLE BRAC... | @param {Doc} doc
@param {number} size
@param {number} tabWidth | isFullwidthCodePoint | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
emojiRegex = function emojiRegex() {
// https://mths.be/emoji
return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|... | @param {Doc} doc
@param {number} size
@param {number} tabWidth | emojiRegex | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
stringWidth = string => {
string = string.replace(emojiRegex(), ' ');
if (typeof string !== 'string' || string.length === 0) {
return 0;
}
string = stripAnsi(string);
let width = 0;
for (let i = 0; i < string.length; i++) {
const code = string.codePointAt(i); // Ignore control ch... | @param {Doc} doc
@param {number} size
@param {number} tabWidth | stringWidth | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
stringWidth = string => {
string = string.replace(emojiRegex(), ' ');
if (typeof string !== 'string' || string.length === 0) {
return 0;
}
string = stripAnsi(string);
let width = 0;
for (let i = 0; i < string.length; i++) {
const code = string.codePointAt(i); // Ignore control ch... | @param {Doc} doc
@param {number} size
@param {number} tabWidth | stringWidth | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function getPenultimate(arr) {
if (arr.length > 1) {
return arr[arr.length - 2];
}
return null;
} | @param {Doc} doc
@param {number} size
@param {number} tabWidth | getPenultimate | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function skip(chars) {
return (text, index, opts) => {
const backwards = opts && opts.backwards; // Allow `skip` functions to be threaded together without having
// to check for failures (did someone say monads?).
if (index === false) {
return false;
}
const {
length
... | @param {string | RegExp} chars
@returns {(text: string, index: number | false, opts?: SkipOptions) => number | false} | skip | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function skipInlineComment(text, index) {
if (index === false) {
return false;
}
if (text.charAt(index) === "/" && text.charAt(index + 1) === "*") {
for (let i = index + 2; i < text.length; ++i) {
if (text.charAt(i) === "*" && text.charAt(i + 1) === "/") {
return i + 2;
... | @param {string} text
@param {number | false} index
@returns {number | false} | skipInlineComment | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function skipTrailingComment(text, index) {
if (index === false) {
return false;
}
if (text.charAt(index) === "/" && text.charAt(index + 1) === "/") {
return skipEverythingButNewLine(text, index);
}
return index;
} | @param {string} text
@param {number | false} index
@returns {number | false} | skipTrailingComment | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function skipNewline(text, index, opts) {
const backwards = opts && opts.backwards;
if (index === false) {
return false;
}
const atIndex = text.charAt(index);
if (backwards) {
if (text.charAt(index - 1) === "\r" && atIndex === "\n") {
return index - 2;
}
if (atInd... | @param {string} text
@param {number | false} index
@param {SkipOptions=} opts
@returns {number | false} | skipNewline | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function hasNewline(text, index, opts) {
opts = opts || {};
const idx = skipSpaces(text, opts.backwards ? index - 1 : index, opts);
const idx2 = skipNewline(text, idx, opts);
return idx !== idx2;
} | @param {string} text
@param {number} index
@param {SkipOptions=} opts
@returns {boolean} | hasNewline | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function hasNewlineInRange(text, start, end) {
for (let i = start; i < end; ++i) {
if (text.charAt(i) === "\n") {
return true;
}
}
return false;
} | @param {string} text
@param {number} start
@param {number} end
@returns {boolean} | hasNewlineInRange | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function isPreviousLineEmpty(text, node, locStart) {
/** @type {number | false} */
let idx = locStart(node) - 1;
idx = skipSpaces(text, idx, {
backwards: true
});
idx = skipNewline(text, idx, {
backwards: true
});
idx = skipSpaces(text, idx, {
backwards: true
});
co... | @template N
@param {string} text
@param {N} node
@param {(node: N) => number} locStart | isPreviousLineEmpty | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function isNextLineEmptyAfterIndex(text, index) {
/** @type {number | false} */
let oldIdx = null;
/** @type {number | false} */
let idx = index;
while (idx !== oldIdx) {
// We need to skip all the potential trailing inline comments
oldIdx = idx;
idx = skipToLineEnd(text, idx);
... | @param {string} text
@param {number} index
@returns {boolean} | isNextLineEmptyAfterIndex | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function isNextLineEmpty(text, node, locEnd) {
return isNextLineEmptyAfterIndex(text, locEnd(node));
} | @template N
@param {string} text
@param {N} node
@param {(node: N) => number} locEnd
@returns {boolean} | isNextLineEmpty | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, idx) {
/** @type {number | false} */
let oldIdx = null;
/** @type {number | false} */
let nextIdx = idx;
while (nextIdx !== oldIdx) {
oldIdx = nextIdx;
nextIdx = skipSpaces(text, nextIdx);
nextIdx = skipInlineCo... | @param {string} text
@param {number} idx
@returns {number | false} | getNextNonSpaceNonCommentCharacterIndexWithStartIndex | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function getNextNonSpaceNonCommentCharacterIndex(text, node, locEnd) {
return getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, locEnd(node));
} | @template N
@param {string} text
@param {N} node
@param {(node: N) => number} locEnd
@returns {number | false} | getNextNonSpaceNonCommentCharacterIndex | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function getNextNonSpaceNonCommentCharacter(text, node, locEnd) {
return text.charAt( // @ts-ignore => TBD: can return false, should we define a fallback?
getNextNonSpaceNonCommentCharacterIndex(text, node, locEnd));
} | @template N
@param {string} text
@param {N} node
@param {(node: N) => number} locEnd
@returns {string} | getNextNonSpaceNonCommentCharacter | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function hasSpaces(text, index, opts) {
opts = opts || {};
const idx = skipSpaces(text, opts.backwards ? index - 1 : index, opts);
return idx !== index;
} | @param {string} text
@param {number} index
@param {SkipOptions=} opts
@returns {boolean} | hasSpaces | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function setLocStart(node, index) {
if (node.range) {
node.range[0] = index;
} else {
node.start = index;
}
} | @param {{range?: [number, number], start?: number}} node
@param {number} index | setLocStart | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function setLocEnd(node, index) {
if (node.range) {
node.range[1] = index;
} else {
node.end = index;
}
} | @param {{range?: [number, number], end?: number}} node
@param {number} index | setLocEnd | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function getPrecedence(op) {
return PRECEDENCE[op];
} | @param {{range?: [number, number], end?: number}} node
@param {number} index | getPrecedence | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function shouldFlatten(parentOp, nodeOp) {
if (getPrecedence(nodeOp) !== getPrecedence(parentOp)) {
return false;
} // ** is right-associative
// x ** y ** z --> x ** (y ** z)
if (parentOp === "**") {
return false;
} // x == y == z --> (x == y) == z
if (equalityOperators[parentOp... | @param {{range?: [number, number], end?: number}} node
@param {number} index | shouldFlatten | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function isBitwiseOperator(operator) {
return !!bitshiftOperators[operator] || operator === "|" || operator === "^" || operator === "&";
} // Tests if an expression starts with `{`, or (if forbidFunctionClassAndDoExpr | @param {{range?: [number, number], end?: number}} node
@param {number} index | isBitwiseOperator | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function startsWithNoLookaheadToken(node, forbidFunctionClassAndDoExpr) {
node = getLeftMost(node);
switch (node.type) {
case "FunctionExpression":
case "ClassExpression":
case "DoExpression":
return forbidFunctionClassAndDoExpr;
case "ObjectExpression":
return true;
... | @param {{range?: [number, number], end?: number}} node
@param {number} index | startsWithNoLookaheadToken | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function getLeftMost(node) {
if (node.left) {
return getLeftMost(node.left);
}
return node;
} | @param {{range?: [number, number], end?: number}} node
@param {number} index | getLeftMost | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function getAlignmentSize(value, tabWidth, startIndex) {
startIndex = startIndex || 0;
let size = 0;
for (let i = startIndex; i < value.length; ++i) {
if (value[i] === "\t") {
// Tabs behave in a way that they are aligned to the nearest
// multiple of tabWidth:
// 0 -> 4, 1 ->... | @param {string} value
@param {number} tabWidth
@param {number=} startIndex
@returns {number} | getAlignmentSize | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function getIndentSize(value, tabWidth) {
const lastNewlineIndex = value.lastIndexOf("\n");
if (lastNewlineIndex === -1) {
return 0;
}
return getAlignmentSize( // All the leading whitespaces
value.slice(lastNewlineIndex + 1).match(/^[\t ]*/)[0], tabWidth);
} | @param {string} value
@param {number} tabWidth
@returns {number} | getIndentSize | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function getPreferredQuote(raw, preferredQuote) {
// `rawContent` is the string exactly like it appeared in the input source
// code, without its enclosing quotes.
const rawContent = raw.slice(1, -1);
/** @type {{ quote: '"', regex: RegExp }} */
const double = {
quote: '"',
regex: /"/g
... | @param {string} raw
@param {Quote} preferredQuote
@returns {Quote} | getPreferredQuote | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function makeString(rawContent, enclosingQuote, unescapeUnnecessaryEscapes) {
const otherQuote = enclosingQuote === '"' ? "'" : '"'; // Matches _any_ escape and unescaped quotes (both single and double).
const regex = /\\([\S\s])|(["'])/g; // Escape and unescape single and double quotes as needed to be able to... | @param {string} rawContent
@param {Quote} enclosingQuote
@param {boolean=} unescapeUnnecessaryEscapes
@returns {string} | makeString | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function printNumber(rawNumber) {
return rawNumber.toLowerCase() // Remove unnecessary plus and zeroes from scientific notation.
.replace(/^([+-]?[\d.]+e)(?:\+|(-))?0*(\d)/, "$1$2$3") // Remove unnecessary scientific notation (1e0).
.replace(/^([+-]?[\d.]+)e[+-]?0+$/, "$1") // Make sure numbers always start... | @param {string} rawContent
@param {Quote} enclosingQuote
@param {boolean=} unescapeUnnecessaryEscapes
@returns {string} | printNumber | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function getMaxContinuousCount(str, target) {
const results = str.match(new RegExp("(".concat(escapeStringRegexp$2(target), ")+"), "g"));
if (results === null) {
return 0;
}
return results.reduce((maxCount, result) => Math.max(maxCount, result.length / target.length), 0);
} | @param {string} str
@param {string} target
@returns {number} | getMaxContinuousCount | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function getMinNotPresentContinuousCount(str, target) {
const matches = str.match(new RegExp("(".concat(escapeStringRegexp$2(target), ")+"), "g"));
if (matches === null) {
return 0;
}
const countPresent = new Map();
let max = 0;
for (const match of matches) {
const count = match.l... | @param {string} str
@param {string} target
@returns {number} | getMinNotPresentContinuousCount | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
match(...predicates) {
let stackPointer = this.stack.length - 1;
let name = null;
let node = this.stack[stackPointer--];
for (const predicate of predicates) {
if (node === undefined) {
return false;
} // skip index/array
let number = null;
if (typeof... | @param {...(
| ((node: any, name: string | null, number: number | null) => boolean)
| undefined
)} predicates | match | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function printSubtree(path, print, options, printAstToDoc) {
if (options.printer.embed && options.embeddedLanguageFormatting === "auto") {
return options.printer.embed(path, print, (text, partialNextOptions) => textToDoc(text, partialNextOptions, options, printAstToDoc), options);
}
} | @param {...(
| ((node: any, name: string | null, number: number | null) => boolean)
| undefined
)} predicates | printSubtree | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function textToDoc(text, partialNextOptions, parentOptions, printAstToDoc) {
const nextOptions = normalize$2(Object.assign(Object.assign(Object.assign({}, parentOptions), partialNextOptions), {}, {
parentParser: parentOptions.parser,
embeddedInHtml: !!(parentOptions.embeddedInHtml || parentOptions.parse... | @param {...(
| ((node: any, name: string | null, number: number | null) => boolean)
| undefined
)} predicates | textToDoc | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function replaceQuotesInInlineComments(text) {
/** @typedef { 'initial' | 'single-quotes' | 'double-quotes' | 'url' | 'comment-block' | 'comment-inline' } State */
/** @type {State} */
let state = "initial";
/** @type {State} */
let stateToReturnFromQuotes = "initial";
let inlineCommentStartIn... | Workaround for a bug: quotes in inline comments corrupt loc data of subsequent nodes.
This function replaces the quotes with U+FFFE and U+FFFF. Later, when the comments are printed,
their content is extracted from the original text or restored by replacing the placeholder
characters back with quotes.
- https://github.c... | replaceQuotesInInlineComments | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function printStringLiteral(stringLiteral, options) {
const double = {
quote: '"',
regex: /"/g
};
const single = {
quote: "'",
regex: /'/g
};
const preferred = options.singleQuote ? single : double;
const alternate = preferred === single ? double : single;
let shouldU... | Prints a string literal with the correct surrounding quotes based on
`options.singleQuote` and the number of escaped quotes contained in
the string literal. This function is the glimmer equivalent of `printString`
in `common/util`, but has differences because of the way escaped characters
are treated in hbs string lite... | printStringLiteral | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function printSubExpressionPathAndParams(path, print) {
const p = printPath(path, print);
const params = printParams(path, print);
if (!params) {
return p;
}
return indent$4(concat$7([p, line$4, group$6(params)]));
} | Prints a string literal with the correct surrounding quotes based on
`options.singleQuote` and the number of escaped quotes contained in
the string literal. This function is the glimmer equivalent of `printString`
in `common/util`, but has differences because of the way escaped characters
are treated in hbs string lite... | printSubExpressionPathAndParams | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function printPathAndParams(path, print) {
const p = printPath(path, print);
const params = printParams(path, print);
if (!params) {
return p;
}
return indent$4(group$6(concat$7([p, line$4, params])));
} | Prints a string literal with the correct surrounding quotes based on
`options.singleQuote` and the number of escaped quotes contained in
the string literal. This function is the glimmer equivalent of `printString`
in `common/util`, but has differences because of the way escaped characters
are treated in hbs string lite... | printPathAndParams | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function printPath(path, print) {
return path.call(print, "path");
} | Prints a string literal with the correct surrounding quotes based on
`options.singleQuote` and the number of escaped quotes contained in
the string literal. This function is the glimmer equivalent of `printString`
in `common/util`, but has differences because of the way escaped characters
are treated in hbs string lite... | printPath | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function printParams(path, print) {
const node = path.getValue();
const parts = [];
if (node.params.length) {
const params = path.map(print, "params");
parts.push(...params);
}
if (node.hash && node.hash.pairs.length > 0) {
const hash = path.call(print, "hash");
parts.push(... | Prints a string literal with the correct surrounding quotes based on
`options.singleQuote` and the number of escaped quotes contained in
the string literal. This function is the glimmer equivalent of `printString`
in `common/util`, but has differences because of the way escaped characters
are treated in hbs string lite... | printParams | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function printBlockParams(node) {
if (!node || !node.blockParams.length) {
return "";
}
return concat$7([" as |", node.blockParams.join(" "), "|"]);
} | Prints a string literal with the correct surrounding quotes based on
`options.singleQuote` and the number of escaped quotes contained in
the string literal. This function is the glimmer equivalent of `printString`
in `common/util`, but has differences because of the way escaped characters
are treated in hbs string lite... | printBlockParams | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function locationToOffset(source, line, column) {
let seenLines = 0;
let seenChars = 0; // eslint-disable-next-line no-constant-condition
while (true) {
if (seenChars === source.length) {
return null;
}
let nextLine = source.indexOf("\n", seenChars);
if (nextLine === -1) {... | Prints a string literal with the correct surrounding quotes based on
`options.singleQuote` and the number of escaped quotes contained in
the string literal. This function is the glimmer equivalent of `printString`
in `common/util`, but has differences because of the way escaped characters
are treated in hbs string lite... | locationToOffset | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
clean$3 = function clean(ast, newNode) {
delete newNode.sourceSpan;
delete newNode.startSourceSpan;
delete newNode.endSourceSpan;
delete newNode.nameSpan;
delete newNode.valueSpan;
if (ast.type === "text" || ast.type === "comment") {
return null;
} // may be formatted by multiparser
... | Prints a string literal with the correct surrounding quotes based on
`options.singleQuote` and the number of escaped quotes contained in
the string literal. This function is the glimmer equivalent of `printString`
in `common/util`, but has differences because of the way escaped characters
are treated in hbs string lite... | clean$3 | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
getLeadingAndTrailingHtmlWhitespace = string => {
const [, leadingWhitespace, text, trailingWhitespace] = string.match(/^([\t\n\f\r ]*)([\S\s]*?)([\t\n\f\r ]*)$/);
return {
leadingWhitespace,
trailingWhitespace,
text
};
} | Prints a string literal with the correct surrounding quotes based on
`options.singleQuote` and the number of escaped quotes contained in
the string literal. This function is the glimmer equivalent of `printString`
in `common/util`, but has differences because of the way escaped characters
are treated in hbs string lite... | getLeadingAndTrailingHtmlWhitespace | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
getLeadingAndTrailingHtmlWhitespace = string => {
const [, leadingWhitespace, text, trailingWhitespace] = string.match(/^([\t\n\f\r ]*)([\S\s]*?)([\t\n\f\r ]*)$/);
return {
leadingWhitespace,
trailingWhitespace,
text
};
} | Prints a string literal with the correct surrounding quotes based on
`options.singleQuote` and the number of escaped quotes contained in
the string literal. This function is the glimmer equivalent of `printString`
in `common/util`, but has differences because of the way escaped characters
are treated in hbs string lite... | getLeadingAndTrailingHtmlWhitespace | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function arrayToMap(array) {
const map = Object.create(null);
for (const value of array) {
map[value] = true;
}
return map;
} | Prints a string literal with the correct surrounding quotes based on
`options.singleQuote` and the number of escaped quotes contained in
the string literal. This function is the glimmer equivalent of `printString`
in `common/util`, but has differences because of the way escaped characters
are treated in hbs string lite... | arrayToMap | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function mapObject(object, fn) {
const newObject = Object.create(null);
for (const key of Object.keys(object)) {
newObject[key] = fn(object[key], key);
}
return newObject;
} | Prints a string literal with the correct surrounding quotes based on
`options.singleQuote` and the number of escaped quotes contained in
the string literal. This function is the glimmer equivalent of `printString`
in `common/util`, but has differences because of the way escaped characters
are treated in hbs string lite... | mapObject | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function shouldPreserveContent(node, options) {
if (!node.endSourceSpan) {
return false;
}
if (node.type === "element" && node.fullName === "template" && node.attrMap.lang && node.attrMap.lang !== "html") {
return true;
} // unterminated node in ie conditional comment
// e.g. <!--[if lt... | Prints a string literal with the correct surrounding quotes based on
`options.singleQuote` and the number of escaped quotes contained in
the string literal. This function is the glimmer equivalent of `printString`
in `common/util`, but has differences because of the way escaped characters
are treated in hbs string lite... | shouldPreserveContent | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function hasPrettierIgnore$2(node) {
if (node.type === "attribute") {
return false;
}
if (!node.parent) {
return false;
}
if (typeof node.index !== "number" || node.index === 0) {
return false;
}
const prevNode = node.parent.children[node.index - 1];
return isPrettie... | Prints a string literal with the correct surrounding quotes based on
`options.singleQuote` and the number of escaped quotes contained in
the string literal. This function is the glimmer equivalent of `printString`
in `common/util`, but has differences because of the way escaped characters
are treated in hbs string lite... | hasPrettierIgnore$2 | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function isPrettierIgnore(node) {
return node.type === "comment" && node.value.trim() === "prettier-ignore";
} | Prints a string literal with the correct surrounding quotes based on
`options.singleQuote` and the number of escaped quotes contained in
the string literal. This function is the glimmer equivalent of `printString`
in `common/util`, but has differences because of the way escaped characters
are treated in hbs string lite... | isPrettierIgnore | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
function getPrettierIgnoreAttributeCommentData(value) {
const match = value.trim().match(/^prettier-ignore-attribute(?:\s+([^]+))?$/);
if (!match) {
return false;
}
if (!match[1]) {
return true;
}
return match[1].split(/\s+/);
} | Prints a string literal with the correct surrounding quotes based on
`options.singleQuote` and the number of escaped quotes contained in
the string literal. This function is the glimmer equivalent of `printString`
in `common/util`, but has differences because of the way escaped characters
are treated in hbs string lite... | getPrettierIgnoreAttributeCommentData | javascript | douyu/juno | assets/public/js/prettier/v2.0.5/standalone.js | https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/standalone.js | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.