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 |
---|---|---|---|---|---|---|---|
constructor(parameters) {
super(parameters);
this._sourceName = parameters.sourceName;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
constructor
|
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
|
expected(utils) {
return utils.schemas[this._sourceName].expected(utils);
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
expected
|
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
|
validate(value, utils) {
return utils.schemas[this._sourceName].validate(value, utils);
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
validate
|
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
|
redirect(_value, _utils) {
return this._sourceName;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
redirect
|
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
|
expected() {
return 'anything';
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
expected
|
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
|
validate() {
return true;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
validate
|
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
|
constructor(_a) {
var {
valueSchema,
name = valueSchema.name
} = _a,
handlers = tslib_1.__rest(_a, ["valueSchema", "name"]);
super(Object.assign({}, handlers, {
name
}));
this._valueSchema = valueSchema;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
constructor
|
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
|
expected(utils) {
return "an array of ".concat(this._valueSchema.expected(utils));
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
expected
|
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
|
validate(value, utils) {
if (!Array.isArray(value)) {
return false;
}
const invalidValues = [];
for (const subValue of value) {
const subValidateResult = utils.normalizeValidateResult(this._valueSchema.validate(subValue, utils), subValue);
if (subValidateResult !== true) {
invalidValues.push(subValidateResult.value);
}
}
return invalidValues.length === 0 ? true : {
value: invalidValues
};
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
validate
|
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
|
deprecated(value, utils) {
const deprecatedResult = [];
for (const subValue of value) {
const subDeprecatedResult = utils.normalizeDeprecatedResult(this._valueSchema.deprecated(subValue, utils), subValue);
if (subDeprecatedResult !== false) {
deprecatedResult.push(...subDeprecatedResult.map(({
value: deprecatedValue
}) => ({
value: [deprecatedValue]
})));
}
}
return deprecatedResult;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
deprecated
|
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
|
forward(value, utils) {
const forwardResult = [];
for (const subValue of value) {
const subForwardResult = utils.normalizeForwardResult(this._valueSchema.forward(subValue, utils), subValue);
forwardResult.push(...subForwardResult.map(wrapTransferResult));
}
return forwardResult;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
forward
|
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
|
redirect(value, utils) {
const remain = [];
const redirect = [];
for (const subValue of value) {
const subRedirectResult = utils.normalizeRedirectResult(this._valueSchema.redirect(subValue, utils), subValue);
if ('remain' in subRedirectResult) {
remain.push(subRedirectResult.remain);
}
redirect.push(...subRedirectResult.redirect.map(wrapTransferResult));
}
return remain.length === 0 ? {
redirect
} : {
redirect,
remain
};
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
redirect
|
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
|
overlap(currentValue, newValue) {
return currentValue.concat(newValue);
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
overlap
|
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 wrapTransferResult({
from,
to
}) {
return {
from: [from],
to
};
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
wrapTransferResult
|
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
|
expected() {
return 'true or false';
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
expected
|
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
|
validate(value) {
return typeof value === 'boolean';
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
validate
|
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 recordFromArray(array, mainKey) {
const record = Object.create(null);
for (const value of array) {
const key = value[mainKey]; // istanbul ignore next
if (record[key]) {
throw new Error("Duplicate ".concat(mainKey, " ").concat(JSON.stringify(key)));
} // @ts-ignore
record[key] = value;
}
return record;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
recordFromArray
|
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 mapFromArray(array, mainKey) {
const map = new Map();
for (const value of array) {
const key = value[mainKey]; // istanbul ignore next
if (map.has(key)) {
throw new Error("Duplicate ".concat(mainKey, " ").concat(JSON.stringify(key)));
}
map.set(key, value);
}
return map;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
mapFromArray
|
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 createAutoChecklist() {
const map = Object.create(null);
return id => {
const idString = JSON.stringify(id);
if (map[idString]) {
return true;
}
map[idString] = true;
return false;
};
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
createAutoChecklist
|
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 partition(array, predicate) {
const trueArray = [];
const falseArray = [];
for (const value of array) {
if (predicate(value)) {
trueArray.push(value);
} else {
falseArray.push(value);
}
}
return [trueArray, falseArray];
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
partition
|
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 isInt(value) {
return value === Math.floor(value);
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
isInt
|
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 comparePrimitive(a, b) {
if (a === b) {
return 0;
}
const typeofA = typeof a;
const typeofB = typeof b;
const orders = ['undefined', 'object', 'boolean', 'number', 'string'];
if (typeofA !== typeofB) {
return orders.indexOf(typeofA) - orders.indexOf(typeofB);
}
if (typeofA !== 'string') {
return Number(a) - Number(b);
}
return a.localeCompare(b);
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
comparePrimitive
|
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 normalizeDefaultResult(result) {
return result === undefined ? {} : result;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
normalizeDefaultResult
|
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 normalizeValidateResult(result, value) {
return result === true ? true : result === false ? {
value
} : result;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
normalizeValidateResult
|
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 normalizeDeprecatedResult(result, value, doNotNormalizeTrue = false) {
return result === false ? false : result === true ? doNotNormalizeTrue ? true : [{
value
}] : 'value' in result ? [result] : result.length === 0 ? false : result;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
normalizeDeprecatedResult
|
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 normalizeTransferResult(result, value) {
return typeof result === 'string' || 'key' in result ? {
from: value,
to: result
} : 'from' in result ? {
from: result.from,
to: result.to
} : {
from: value,
to: result.to
};
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
normalizeTransferResult
|
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 normalizeForwardResult(result, value) {
return result === undefined ? [] : Array.isArray(result) ? result.map(transferResult => normalizeTransferResult(transferResult, value)) : [normalizeTransferResult(result, value)];
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
normalizeForwardResult
|
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 normalizeRedirectResult(result, value) {
const redirect = normalizeForwardResult(typeof result === 'object' && 'redirect' in result ? result.redirect : result, value);
return redirect.length === 0 ? {
remain: value,
redirect
} : typeof result === 'object' && 'remain' in result ? {
remain: result.remain,
redirect
} : {
redirect
};
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
normalizeRedirectResult
|
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
|
constructor(parameters) {
super(parameters);
this._choices = utils.mapFromArray(parameters.choices.map(choice => choice && typeof choice === 'object' ? choice : {
value: choice
}), 'value');
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
constructor
|
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
|
expected({
descriptor
}) {
const choiceValues = Array.from(this._choices.keys()).map(value => this._choices.get(value)).filter(choiceInfo => !choiceInfo.deprecated).map(choiceInfo => choiceInfo.value).sort(utils.comparePrimitive).map(descriptor.value);
const head = choiceValues.slice(0, -2);
const tail = choiceValues.slice(-2);
return head.concat(tail.join(' or ')).join(', ');
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
expected
|
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
|
validate(value) {
return this._choices.has(value);
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
validate
|
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
|
deprecated(value) {
const choiceInfo = this._choices.get(value);
return choiceInfo && choiceInfo.deprecated ? {
value
} : false;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
deprecated
|
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
|
forward(value) {
const choiceInfo = this._choices.get(value);
return choiceInfo ? choiceInfo.forward : undefined;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
forward
|
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
|
redirect(value) {
const choiceInfo = this._choices.get(value);
return choiceInfo ? choiceInfo.redirect : undefined;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
redirect
|
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
|
expected() {
return 'a number';
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
expected
|
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
|
validate(value, _utils) {
return typeof value === 'number';
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
validate
|
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
|
expected() {
return 'an integer';
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
expected
|
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
|
validate(value, utils$1) {
return utils$1.normalizeValidateResult(super.validate(value, utils$1), value) === true && utils.isInt(value);
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
validate
|
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
|
expected() {
return 'a string';
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
expected
|
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
|
validate(value) {
return typeof value === 'string';
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
validate
|
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
|
constructor(schemas, opts) {
// istanbul ignore next
const {
logger = console,
descriptor = defaults.defaultDescriptor,
unknown = defaults.defaultUnknownHandler,
invalid = defaults.defaultInvalidHandler,
deprecated = defaults.defaultDeprecatedHandler
} = opts || {};
this._utils = {
descriptor,
logger:
/* istanbul ignore next */
logger || {
warn: () => {}
},
schemas: utils.recordFromArray(schemas, 'name'),
normalizeDefaultResult: utils.normalizeDefaultResult,
normalizeDeprecatedResult: utils.normalizeDeprecatedResult,
normalizeForwardResult: utils.normalizeForwardResult,
normalizeRedirectResult: utils.normalizeRedirectResult,
normalizeValidateResult: utils.normalizeValidateResult
};
this._unknownHandler = unknown;
this._invalidHandler = invalid;
this._deprecatedHandler = deprecated;
this.cleanHistory();
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
constructor
|
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
|
cleanHistory() {
this._hasDeprecationWarned = utils.createAutoChecklist();
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
cleanHistory
|
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
|
normalize(options) {
const normalized = {};
const restOptionsArray = [options];
const applyNormalization = () => {
while (restOptionsArray.length !== 0) {
const currentOptions = restOptionsArray.shift();
const transferredOptionsArray = this._applyNormalization(currentOptions, normalized);
restOptionsArray.push(...transferredOptionsArray);
}
};
applyNormalization();
for (const key of Object.keys(this._utils.schemas)) {
const schema = this._utils.schemas[key];
if (!(key in normalized)) {
const defaultResult = utils.normalizeDefaultResult(schema.default(this._utils));
if ('value' in defaultResult) {
restOptionsArray.push({
[key]: defaultResult.value
});
}
}
}
applyNormalization();
for (const key of Object.keys(this._utils.schemas)) {
const schema = this._utils.schemas[key];
if (key in normalized) {
normalized[key] = schema.postprocess(normalized[key], this._utils);
}
}
return normalized;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
normalize
|
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
|
applyNormalization = () => {
while (restOptionsArray.length !== 0) {
const currentOptions = restOptionsArray.shift();
const transferredOptionsArray = this._applyNormalization(currentOptions, normalized);
restOptionsArray.push(...transferredOptionsArray);
}
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
applyNormalization
|
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
|
applyNormalization = () => {
while (restOptionsArray.length !== 0) {
const currentOptions = restOptionsArray.shift();
const transferredOptionsArray = this._applyNormalization(currentOptions, normalized);
restOptionsArray.push(...transferredOptionsArray);
}
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
applyNormalization
|
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
|
_applyNormalization(options, normalized) {
const transferredOptionsArray = [];
const [knownOptionNames, unknownOptionNames] = utils.partition(Object.keys(options), key => key in this._utils.schemas);
for (const key of knownOptionNames) {
const schema = this._utils.schemas[key];
const value = schema.preprocess(options[key], this._utils);
const validateResult = utils.normalizeValidateResult(schema.validate(value, this._utils), value);
if (validateResult !== true) {
const {
value: invalidValue
} = validateResult;
const errorMessageOrError = this._invalidHandler(key, invalidValue, this._utils);
throw typeof errorMessageOrError === 'string' ? new Error(errorMessageOrError) :
/* istanbul ignore next*/
errorMessageOrError;
}
const appendTransferredOptions = ({
from,
to
}) => {
transferredOptionsArray.push(typeof to === 'string' ? {
[to]: from
} : {
[to.key]: to.value
});
};
const warnDeprecated = ({
value: currentValue,
redirectTo
}) => {
const deprecatedResult = utils.normalizeDeprecatedResult(schema.deprecated(currentValue, this._utils), value,
/* doNotNormalizeTrue */
true);
if (deprecatedResult === false) {
return;
}
if (deprecatedResult === true) {
if (!this._hasDeprecationWarned(key)) {
this._utils.logger.warn(this._deprecatedHandler(key, redirectTo, this._utils));
}
} else {
for (const {
value: deprecatedValue
} of deprecatedResult) {
const pair = {
key,
value: deprecatedValue
};
if (!this._hasDeprecationWarned(pair)) {
const redirectToPair = typeof redirectTo === 'string' ? {
key: redirectTo,
value: deprecatedValue
} : redirectTo;
this._utils.logger.warn(this._deprecatedHandler(pair, redirectToPair, this._utils));
}
}
}
};
const forwardResult = utils.normalizeForwardResult(schema.forward(value, this._utils), value);
forwardResult.forEach(appendTransferredOptions);
const redirectResult = utils.normalizeRedirectResult(schema.redirect(value, this._utils), value);
redirectResult.redirect.forEach(appendTransferredOptions);
if ('remain' in redirectResult) {
const remainingValue = redirectResult.remain;
normalized[key] = key in normalized ? schema.overlap(normalized[key], remainingValue, this._utils) : remainingValue;
warnDeprecated({
value: remainingValue
});
}
for (const {
from,
to
} of redirectResult.redirect) {
warnDeprecated({
value: from,
redirectTo: to
});
}
}
for (const key of unknownOptionNames) {
const value = options[key];
const unknownResult = this._unknownHandler(key, value, this._utils);
if (unknownResult) {
for (const unknownKey of Object.keys(unknownResult)) {
const unknownOption = {
[unknownKey]: unknownResult[unknownKey]
};
if (unknownKey in this._utils.schemas) {
transferredOptionsArray.push(unknownOption);
} else {
Object.assign(normalized, unknownOption);
}
}
}
}
return transferredOptionsArray;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
_applyNormalization
|
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
|
appendTransferredOptions = ({
from,
to
}) => {
transferredOptionsArray.push(typeof to === 'string' ? {
[to]: from
} : {
[to.key]: to.value
});
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
appendTransferredOptions
|
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
|
appendTransferredOptions = ({
from,
to
}) => {
transferredOptionsArray.push(typeof to === 'string' ? {
[to]: from
} : {
[to.key]: to.value
});
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
appendTransferredOptions
|
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
|
warnDeprecated = ({
value: currentValue,
redirectTo
}) => {
const deprecatedResult = utils.normalizeDeprecatedResult(schema.deprecated(currentValue, this._utils), value,
/* doNotNormalizeTrue */
true);
if (deprecatedResult === false) {
return;
}
if (deprecatedResult === true) {
if (!this._hasDeprecationWarned(key)) {
this._utils.logger.warn(this._deprecatedHandler(key, redirectTo, this._utils));
}
} else {
for (const {
value: deprecatedValue
} of deprecatedResult) {
const pair = {
key,
value: deprecatedValue
};
if (!this._hasDeprecationWarned(pair)) {
const redirectToPair = typeof redirectTo === 'string' ? {
key: redirectTo,
value: deprecatedValue
} : redirectTo;
this._utils.logger.warn(this._deprecatedHandler(pair, redirectToPair, this._utils));
}
}
}
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
warnDeprecated
|
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
|
warnDeprecated = ({
value: currentValue,
redirectTo
}) => {
const deprecatedResult = utils.normalizeDeprecatedResult(schema.deprecated(currentValue, this._utils), value,
/* doNotNormalizeTrue */
true);
if (deprecatedResult === false) {
return;
}
if (deprecatedResult === true) {
if (!this._hasDeprecationWarned(key)) {
this._utils.logger.warn(this._deprecatedHandler(key, redirectTo, this._utils));
}
} else {
for (const {
value: deprecatedValue
} of deprecatedResult) {
const pair = {
key,
value: deprecatedValue
};
if (!this._hasDeprecationWarned(pair)) {
const redirectToPair = typeof redirectTo === 'string' ? {
key: redirectTo,
value: deprecatedValue
} : redirectTo;
this._utils.logger.warn(this._deprecatedHandler(pair, redirectToPair, this._utils));
}
}
}
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
warnDeprecated
|
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
|
leven$1 = (left, right) => {
if (left === right) {
return 0;
}
const swap = left; // Swapping the strings if `a` is longer than `b` so we know which one is the
// shortest & which one is the longest
if (left.length > right.length) {
left = right;
right = swap;
}
let leftLength = left.length;
let rightLength = right.length; // Performing suffix trimming:
// We can linearly drop suffix common to both strings since they
// don't increase distance at all
// Note: `~-` is the bitwise way to perform a `- 1` operation
while (leftLength > 0 && left.charCodeAt(~-leftLength) === right.charCodeAt(~-rightLength)) {
leftLength--;
rightLength--;
} // Performing prefix trimming
// We can linearly drop prefix common to both strings since they
// don't increase distance at all
let start = 0;
while (start < leftLength && left.charCodeAt(start) === right.charCodeAt(start)) {
start++;
}
leftLength -= start;
rightLength -= start;
if (leftLength === 0) {
return rightLength;
}
let bCharCode;
let result;
let temp;
let temp2;
let i = 0;
let j = 0;
while (i < leftLength) {
charCodeCache$1[i] = left.charCodeAt(start + i);
array$1[i] = ++i;
}
while (j < rightLength) {
bCharCode = right.charCodeAt(start + j);
temp = j++;
result = j;
for (i = 0; i < leftLength; i++) {
temp2 = bCharCode === charCodeCache$1[i] ? temp : temp + 1;
temp = array$1[i]; // eslint-disable-next-line no-multi-assign
result = array$1[i] = temp > result ? temp2 > result ? result + 1 : temp2 : temp2 > temp ? temp + 1 : temp2;
}
}
return result;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
leven$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
|
leven$1 = (left, right) => {
if (left === right) {
return 0;
}
const swap = left; // Swapping the strings if `a` is longer than `b` so we know which one is the
// shortest & which one is the longest
if (left.length > right.length) {
left = right;
right = swap;
}
let leftLength = left.length;
let rightLength = right.length; // Performing suffix trimming:
// We can linearly drop suffix common to both strings since they
// don't increase distance at all
// Note: `~-` is the bitwise way to perform a `- 1` operation
while (leftLength > 0 && left.charCodeAt(~-leftLength) === right.charCodeAt(~-rightLength)) {
leftLength--;
rightLength--;
} // Performing prefix trimming
// We can linearly drop prefix common to both strings since they
// don't increase distance at all
let start = 0;
while (start < leftLength && left.charCodeAt(start) === right.charCodeAt(start)) {
start++;
}
leftLength -= start;
rightLength -= start;
if (leftLength === 0) {
return rightLength;
}
let bCharCode;
let result;
let temp;
let temp2;
let i = 0;
let j = 0;
while (i < leftLength) {
charCodeCache$1[i] = left.charCodeAt(start + i);
array$1[i] = ++i;
}
while (j < rightLength) {
bCharCode = right.charCodeAt(start + j);
temp = j++;
result = j;
for (i = 0; i < leftLength; i++) {
temp2 = bCharCode === charCodeCache$1[i] ? temp : temp + 1;
temp = array$1[i]; // eslint-disable-next-line no-multi-assign
result = array$1[i] = temp > result ? temp2 > result ? result + 1 : temp2 : temp2 > temp ? temp + 1 : temp2;
}
}
return result;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
leven$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
|
diffc = function diffc(c) {
return (v - c) / 6 / diff + 1 / 2;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
diffc
|
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
|
diffc = function diffc(c) {
return (v - c) / 6 / diff + 1 / 2;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
diffc
|
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 comparativeDistance(x, y) {
/*
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
*/
return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
comparativeDistance
|
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 buildGraph$1() {
const graph = {}; // https://jsperf.com/object-keys-vs-for-in-with-closure/3
const models = Object.keys(conversions$1);
for (let len = models.length, i = 0; i < len; i++) {
graph[models[i]] = {
// http://jsperf.com/1-vs-infinity
// micro-opt, but this is simple.
distance: -1,
parent: null
};
}
return graph;
} // https://en.wikipedia.org/wiki/Breadth-first_search
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
buildGraph$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 deriveBFS$1(fromModel) {
const graph = buildGraph$1();
const queue = [fromModel]; // Unshift -> queue -> pop
graph[fromModel].distance = 0;
while (queue.length) {
const current = queue.pop();
const adjacents = Object.keys(conversions$1[current]);
for (let len = adjacents.length, i = 0; i < len; i++) {
const adjacent = adjacents[i];
const node = graph[adjacent];
if (node.distance === -1) {
node.distance = graph[current].distance + 1;
node.parent = current;
queue.unshift(adjacent);
}
}
}
return graph;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
deriveBFS$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 link$1(from, to) {
return function (args) {
return to(from(args));
};
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
link$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 wrapConversion$1(toModel, graph) {
const path = [graph[toModel].parent, toModel];
let fn = conversions$1[graph[toModel].parent][toModel];
let cur = graph[toModel].parent;
while (graph[cur].parent) {
path.unshift(graph[cur].parent);
fn = link$1(conversions$1[graph[cur].parent][cur], fn);
cur = graph[cur].parent;
}
fn.conversion = path;
return fn;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
wrapConversion$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
|
route$1 = function route(fromModel) {
const graph = deriveBFS$1(fromModel);
const conversion = {};
const models = Object.keys(graph);
for (let len = models.length, i = 0; i < len; i++) {
const toModel = models[i];
const node = graph[toModel];
if (node.parent === null) {
// No possible conversion, or this node is the source model.
continue;
}
conversion[toModel] = wrapConversion$1(toModel, graph);
}
return conversion;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
route$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 wrapRaw$1(fn) {
const wrappedFn = function wrappedFn(...args) {
const arg0 = args[0];
if (arg0 === undefined || arg0 === null) {
return arg0;
}
if (arg0.length > 1) {
args = arg0;
}
return fn(args);
}; // Preserve .conversion property if there is one
if ('conversion' in fn) {
wrappedFn.conversion = fn.conversion;
}
return wrappedFn;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
wrapRaw$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
|
wrappedFn = function wrappedFn(...args) {
const arg0 = args[0];
if (arg0 === undefined || arg0 === null) {
return arg0;
}
if (arg0.length > 1) {
args = arg0;
}
return fn(args);
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
wrappedFn
|
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
|
wrappedFn = function wrappedFn(...args) {
const arg0 = args[0];
if (arg0 === undefined || arg0 === null) {
return arg0;
}
if (arg0.length > 1) {
args = arg0;
}
return fn(args);
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
wrappedFn
|
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 wrapRounded$1(fn) {
const wrappedFn = function wrappedFn(...args) {
const arg0 = args[0];
if (arg0 === undefined || arg0 === null) {
return arg0;
}
if (arg0.length > 1) {
args = arg0;
}
const result = fn(args); // We're assuming the result is an array here.
// see notice in conversions.js; don't use box types
// in conversion functions.
if (typeof result === 'object') {
for (let len = result.length, i = 0; i < len; i++) {
result[i] = Math.round(result[i]);
}
}
return result;
}; // Preserve .conversion property if there is one
if ('conversion' in fn) {
wrappedFn.conversion = fn.conversion;
}
return wrappedFn;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
wrapRounded$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
|
wrappedFn = function wrappedFn(...args) {
const arg0 = args[0];
if (arg0 === undefined || arg0 === null) {
return arg0;
}
if (arg0.length > 1) {
args = arg0;
}
const result = fn(args); // We're assuming the result is an array here.
// see notice in conversions.js; don't use box types
// in conversion functions.
if (typeof result === 'object') {
for (let len = result.length, i = 0; i < len; i++) {
result[i] = Math.round(result[i]);
}
}
return result;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
wrappedFn
|
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
|
wrappedFn = function wrappedFn(...args) {
const arg0 = args[0];
if (arg0 === undefined || arg0 === null) {
return arg0;
}
if (arg0.length > 1) {
args = arg0;
}
const result = fn(args); // We're assuming the result is an array here.
// see notice in conversions.js; don't use box types
// in conversion functions.
if (typeof result === 'object') {
for (let len = result.length, i = 0; i < len; i++) {
result[i] = Math.round(result[i]);
}
}
return result;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
wrappedFn
|
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
|
wrapAnsi16 = (fn, offset) => (...args) => {
const code = fn(...args);
return "\x1B[".concat(code + offset, "m");
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
wrapAnsi16
|
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
|
wrapAnsi16 = (fn, offset) => (...args) => {
const code = fn(...args);
return "\x1B[".concat(code + offset, "m");
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
wrapAnsi16
|
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
|
wrapAnsi256 = (fn, offset) => (...args) => {
const code = fn(...args);
return "\x1B[".concat(38 + offset, ";5;").concat(code, "m");
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
wrapAnsi256
|
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
|
wrapAnsi256 = (fn, offset) => (...args) => {
const code = fn(...args);
return "\x1B[".concat(38 + offset, ";5;").concat(code, "m");
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
wrapAnsi256
|
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
|
wrapAnsi16m = (fn, offset) => (...args) => {
const rgb = fn(...args);
return "\x1B[".concat(38 + offset, ";2;").concat(rgb[0], ";").concat(rgb[1], ";").concat(rgb[2], "m");
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
wrapAnsi16m
|
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
|
wrapAnsi16m = (fn, offset) => (...args) => {
const rgb = fn(...args);
return "\x1B[".concat(38 + offset, ";2;").concat(rgb[0], ";").concat(rgb[1], ";").concat(rgb[2], "m");
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
wrapAnsi16m
|
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
|
setLazyProperty = (object, property, _get) => {
Object.defineProperty(object, property, {
get: () => {
const value = _get();
Object.defineProperty(object, property, {
value,
enumerable: true,
configurable: true
});
return value;
},
enumerable: true,
configurable: true
});
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
setLazyProperty
|
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
|
setLazyProperty = (object, property, _get) => {
Object.defineProperty(object, property, {
get: () => {
const value = _get();
Object.defineProperty(object, property, {
value,
enumerable: true,
configurable: true
});
return value;
},
enumerable: true,
configurable: true
});
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
setLazyProperty
|
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 comparativeDistance(x, y) {
return Math.pow(x[0] - y[0], 2) + Math.pow(x[1] - y[1], 2) + Math.pow(x[2] - y[2], 2);
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
comparativeDistance
|
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 buildGraph$2() {
var graph = {}; // https://jsperf.com/object-keys-vs-for-in-with-closure/3
var models = Object.keys(conversions$2);
for (var len = models.length, i = 0; i < len; i++) {
graph[models[i]] = {
// http://jsperf.com/1-vs-infinity
// micro-opt, but this is simple.
distance: -1,
parent: null
};
}
return graph;
} // https://en.wikipedia.org/wiki/Breadth-first_search
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
buildGraph$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 deriveBFS$2(fromModel) {
var graph = buildGraph$2();
var queue = [fromModel]; // unshift -> queue -> pop
graph[fromModel].distance = 0;
while (queue.length) {
var current = queue.pop();
var adjacents = Object.keys(conversions$2[current]);
for (var len = adjacents.length, i = 0; i < len; i++) {
var adjacent = adjacents[i];
var node = graph[adjacent];
if (node.distance === -1) {
node.distance = graph[current].distance + 1;
node.parent = current;
queue.unshift(adjacent);
}
}
}
return graph;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
deriveBFS$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 link$2(from, to) {
return function (args) {
return to(from(args));
};
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
link$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 wrapConversion$2(toModel, graph) {
var path = [graph[toModel].parent, toModel];
var fn = conversions$2[graph[toModel].parent][toModel];
var cur = graph[toModel].parent;
while (graph[cur].parent) {
path.unshift(graph[cur].parent);
fn = link$2(conversions$2[graph[cur].parent][cur], fn);
cur = graph[cur].parent;
}
fn.conversion = path;
return fn;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
wrapConversion$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
|
route$2 = function route(fromModel) {
var graph = deriveBFS$2(fromModel);
var conversion = {};
var models = Object.keys(graph);
for (var len = models.length, i = 0; i < len; i++) {
var toModel = models[i];
var node = graph[toModel];
if (node.parent === null) {
// no possible conversion, or this node is the source model.
continue;
}
conversion[toModel] = wrapConversion$2(toModel, graph);
}
return conversion;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
route$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 wrapRaw$2(fn) {
var wrappedFn = function wrappedFn(args) {
if (args === undefined || args === null) {
return args;
}
if (arguments.length > 1) {
args = Array.prototype.slice.call(arguments);
}
return fn(args);
}; // preserve .conversion property if there is one
if ('conversion' in fn) {
wrappedFn.conversion = fn.conversion;
}
return wrappedFn;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
wrapRaw$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
|
wrappedFn = function wrappedFn(args) {
if (args === undefined || args === null) {
return args;
}
if (arguments.length > 1) {
args = Array.prototype.slice.call(arguments);
}
return fn(args);
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
wrappedFn
|
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 wrapRounded$2(fn) {
var wrappedFn = function wrappedFn(args) {
if (args === undefined || args === null) {
return args;
}
if (arguments.length > 1) {
args = Array.prototype.slice.call(arguments);
}
var result = fn(args); // we're assuming the result is an array here.
// see notice in conversions.js; don't use box types
// in conversion functions.
if (typeof result === 'object') {
for (var len = result.length, i = 0; i < len; i++) {
result[i] = Math.round(result[i]);
}
}
return result;
}; // preserve .conversion property if there is one
if ('conversion' in fn) {
wrappedFn.conversion = fn.conversion;
}
return wrappedFn;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
wrapRounded$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
|
wrappedFn = function wrappedFn(args) {
if (args === undefined || args === null) {
return args;
}
if (arguments.length > 1) {
args = Array.prototype.slice.call(arguments);
}
var result = fn(args); // we're assuming the result is an array here.
// see notice in conversions.js; don't use box types
// in conversion functions.
if (typeof result === 'object') {
for (var len = result.length, i = 0; i < len; i++) {
result[i] = Math.round(result[i]);
}
}
return result;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
wrappedFn
|
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
|
wrapAnsi16 = (fn, offset) => function () {
const code = fn.apply(colorConvert$2, arguments);
return "\x1B[".concat(code + offset, "m");
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
wrapAnsi16
|
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
|
wrapAnsi16 = (fn, offset) => function () {
const code = fn.apply(colorConvert$2, arguments);
return "\x1B[".concat(code + offset, "m");
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
wrapAnsi16
|
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
|
wrapAnsi256 = (fn, offset) => function () {
const code = fn.apply(colorConvert$2, arguments);
return "\x1B[".concat(38 + offset, ";5;").concat(code, "m");
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
wrapAnsi256
|
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
|
wrapAnsi256 = (fn, offset) => function () {
const code = fn.apply(colorConvert$2, arguments);
return "\x1B[".concat(38 + offset, ";5;").concat(code, "m");
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
wrapAnsi256
|
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
|
wrapAnsi16m = (fn, offset) => function () {
const rgb = fn.apply(colorConvert$2, arguments);
return "\x1B[".concat(38 + offset, ";2;").concat(rgb[0], ";").concat(rgb[1], ";").concat(rgb[2], "m");
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
wrapAnsi16m
|
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
|
wrapAnsi16m = (fn, offset) => function () {
const rgb = fn.apply(colorConvert$2, arguments);
return "\x1B[".concat(38 + offset, ";2;").concat(rgb[0], ";").concat(rgb[1], ";").concat(rgb[2], "m");
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
wrapAnsi16m
|
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 assembleStyles() {
const codes = new Map();
const styles = {
modifier: {
reset: [0, 0],
// 21 isn't widely supported and 22 does the same thing
bold: [1, 22],
dim: [2, 22],
italic: [3, 23],
underline: [4, 24],
inverse: [7, 27],
hidden: [8, 28],
strikethrough: [9, 29]
},
color: {
black: [30, 39],
red: [31, 39],
green: [32, 39],
yellow: [33, 39],
blue: [34, 39],
magenta: [35, 39],
cyan: [36, 39],
white: [37, 39],
gray: [90, 39],
// Bright color
redBright: [91, 39],
greenBright: [92, 39],
yellowBright: [93, 39],
blueBright: [94, 39],
magentaBright: [95, 39],
cyanBright: [96, 39],
whiteBright: [97, 39]
},
bgColor: {
bgBlack: [40, 49],
bgRed: [41, 49],
bgGreen: [42, 49],
bgYellow: [43, 49],
bgBlue: [44, 49],
bgMagenta: [45, 49],
bgCyan: [46, 49],
bgWhite: [47, 49],
// Bright color
bgBlackBright: [100, 49],
bgRedBright: [101, 49],
bgGreenBright: [102, 49],
bgYellowBright: [103, 49],
bgBlueBright: [104, 49],
bgMagentaBright: [105, 49],
bgCyanBright: [106, 49],
bgWhiteBright: [107, 49]
}
}; // Fix humans
styles.color.grey = styles.color.gray;
for (const groupName of Object.keys(styles)) {
const group = styles[groupName];
for (const styleName of Object.keys(group)) {
const style = group[styleName];
styles[styleName] = {
open: "\x1B[".concat(style[0], "m"),
close: "\x1B[".concat(style[1], "m")
};
group[styleName] = styles[styleName];
codes.set(style[0], style[1]);
}
Object.defineProperty(styles, groupName, {
value: group,
enumerable: false
});
Object.defineProperty(styles, 'codes', {
value: codes,
enumerable: false
});
}
const ansi2ansi = n => n;
const rgb2rgb = (r, g, b) => [r, g, b];
styles.color.close = '\u001B[39m';
styles.bgColor.close = '\u001B[49m';
styles.color.ansi = {
ansi: wrapAnsi16(ansi2ansi, 0)
};
styles.color.ansi256 = {
ansi256: wrapAnsi256(ansi2ansi, 0)
};
styles.color.ansi16m = {
rgb: wrapAnsi16m(rgb2rgb, 0)
};
styles.bgColor.ansi = {
ansi: wrapAnsi16(ansi2ansi, 10)
};
styles.bgColor.ansi256 = {
ansi256: wrapAnsi256(ansi2ansi, 10)
};
styles.bgColor.ansi16m = {
rgb: wrapAnsi16m(rgb2rgb, 10)
};
for (let key of Object.keys(colorConvert$2)) {
if (typeof colorConvert$2[key] !== 'object') {
continue;
}
const suite = colorConvert$2[key];
if (key === 'ansi16') {
key = 'ansi';
}
if ('ansi16' in suite) {
styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);
styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);
}
if ('ansi256' in suite) {
styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0);
styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10);
}
if ('rgb' in suite) {
styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0);
styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10);
}
}
return styles;
} // Make the export immutable
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
assembleStyles
|
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 translateLevel$2(level) {
if (level === 0) {
return false;
}
return {
level,
hasBasic: true,
has256: level >= 2,
has16m: level >= 3
};
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
translateLevel$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 supportsColor$2(stream) {
if (forceColor$2 === false) {
return 0;
}
if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) {
return 3;
}
if (hasFlag('color=256')) {
return 2;
}
if (stream && !stream.isTTY && forceColor$2 !== true) {
return 0;
}
const min = forceColor$2 ? 1 : 0;
if (process.platform === 'win32') {
// Node.js 7.5.0 is the first version of Node.js to include a patch to
// libuv that enables 256 color output on Windows. Anything earlier and it
// won't work. However, here we target Node.js 8 at minimum as it is an LTS
// release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows
// release that supports 256 colors. Windows 10 build 14931 is the first release
// that supports 16m/TrueColor.
const osRelease = require$$0$1.release().split('.');
if (Number(process.versions.node.split('.')[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
return Number(osRelease[2]) >= 14931 ? 3 : 2;
}
return 1;
}
if ('CI' in env$3) {
if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env$3) || env$3.CI_NAME === 'codeship') {
return 1;
}
return min;
}
if ('TEAMCITY_VERSION' in env$3) {
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env$3.TEAMCITY_VERSION) ? 1 : 0;
}
if (env$3.COLORTERM === 'truecolor') {
return 3;
}
if ('TERM_PROGRAM' in env$3) {
const version = parseInt((env$3.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
switch (env$3.TERM_PROGRAM) {
case 'iTerm.app':
return version >= 3 ? 3 : 2;
case 'Apple_Terminal':
return 2;
// No default
}
}
if (/-256(color)?$/i.test(env$3.TERM)) {
return 2;
}
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env$3.TERM)) {
return 1;
}
if ('COLORTERM' in env$3) {
return 1;
}
if (env$3.TERM === 'dumb') {
return min;
}
return min;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
supportsColor$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 getSupportLevel$2(stream) {
const level = supportsColor$2(stream);
return translateLevel$2(level);
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
getSupportLevel$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 unescape$2(c) {
if (c[0] === 'u' && c.length === 5 || c[0] === 'x' && c.length === 3) {
return String.fromCharCode(parseInt(c.slice(1), 16));
}
return ESCAPES$2.get(c) || c;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
unescape$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 parseArguments$2(name, args) {
const results = [];
const chunks = args.trim().split(/\s*,\s*/g);
let matches;
for (const chunk of chunks) {
if (!isNaN(chunk)) {
results.push(Number(chunk));
} else if (matches = chunk.match(STRING_REGEX$2)) {
results.push(matches[2].replace(ESCAPE_REGEX$2, (m, escape, chr) => escape ? unescape$2(escape) : chr));
} else {
throw new Error("Invalid Chalk template style argument: ".concat(chunk, " (in style '").concat(name, "')"));
}
}
return results;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
parseArguments$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 parseStyle$2(style) {
STYLE_REGEX$2.lastIndex = 0;
const results = [];
let matches;
while ((matches = STYLE_REGEX$2.exec(style)) !== null) {
const name = matches[1];
if (matches[2]) {
const args = parseArguments$2(name, matches[2]);
results.push([name].concat(args));
} else {
results.push([name]);
}
}
return results;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
parseStyle$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 buildStyle$2(chalk, styles) {
const enabled = {};
for (const layer of styles) {
for (const style of layer.styles) {
enabled[style[0]] = layer.inverse ? null : style.slice(1);
}
}
let current = chalk;
for (const styleName of Object.keys(enabled)) {
if (Array.isArray(enabled[styleName])) {
if (!(styleName in current)) {
throw new Error("Unknown Chalk style: ".concat(styleName));
}
if (enabled[styleName].length > 0) {
current = current[styleName].apply(current, enabled[styleName]);
} else {
current = current[styleName];
}
}
}
return current;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
buildStyle$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
|
templates$2 = (chalk, tmp) => {
const styles = [];
const chunks = [];
let chunk = []; // eslint-disable-next-line max-params
tmp.replace(TEMPLATE_REGEX$2, (m, escapeChar, inverse, style, close, chr) => {
if (escapeChar) {
chunk.push(unescape$2(escapeChar));
} else if (style) {
const str = chunk.join('');
chunk = [];
chunks.push(styles.length === 0 ? str : buildStyle$2(chalk, styles)(str));
styles.push({
inverse,
styles: parseStyle$2(style)
});
} else if (close) {
if (styles.length === 0) {
throw new Error('Found extraneous } in Chalk template literal');
}
chunks.push(buildStyle$2(chalk, styles)(chunk.join('')));
chunk = [];
styles.pop();
} else {
chunk.push(chr);
}
});
chunks.push(chunk.join(''));
if (styles.length > 0) {
const errMsg = "Chalk template literal is missing ".concat(styles.length, " closing bracket").concat(styles.length === 1 ? '' : 's', " (`}`)");
throw new Error(errMsg);
}
return chunks.join('');
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
templates$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 applyOptions(obj, options) {
options = options || {}; // Detect level if not set manually
const scLevel = stdoutColor ? stdoutColor.level : 0;
obj.level = options.level === undefined ? scLevel : options.level;
obj.enabled = 'enabled' in options ? options.enabled : obj.level > 0;
}
|
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
applyOptions
|
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.