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 extname(path) {
const filename = basename(path);
const dotIndex = filename.lastIndexOf(".");
if (dotIndex === -1) {
return "";
}
return filename.slice(dotIndex);
}
|
Checks if the hunk exactly fits on the provided location
|
extname
|
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 basename(path) {
return path.split(sep).pop();
}
|
Checks if the hunk exactly fits on the provided location
|
basename
|
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 isAbsolute() {
return true;
}
|
Checks if the hunk exactly fits on the provided location
|
isAbsolute
|
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 init() {
inited = true;
var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
for (var i = 0, len = code.length; i < len; ++i) {
lookup[i] = code[i];
revLookup[code.charCodeAt(i)] = i;
}
revLookup['-'.charCodeAt(0)] = 62;
revLookup['_'.charCodeAt(0)] = 63;
}
|
Checks if the hunk exactly fits on the provided location
|
init
|
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 toByteArray(b64) {
if (!inited) {
init();
}
var i, j, l, tmp, placeHolders, arr;
var len = b64.length;
if (len % 4 > 0) {
throw new Error('Invalid string. Length must be a multiple of 4');
} // the number of equal signs (place holders)
// if there are two placeholders, than the two characters before it
// represent one byte
// if there is only one, then the three characters before it represent 2 bytes
// this is just a cheap hack to not do indexOf twice
placeHolders = b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0; // base64 is 4/3 + up to two characters of the original data
arr = new Arr(len * 3 / 4 - placeHolders); // if there are placeholders, only get up to the last complete 4 chars
l = placeHolders > 0 ? len - 4 : len;
var L = 0;
for (i = 0, j = 0; i < l; i += 4, j += 3) {
tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)];
arr[L++] = tmp >> 16 & 0xFF;
arr[L++] = tmp >> 8 & 0xFF;
arr[L++] = tmp & 0xFF;
}
if (placeHolders === 2) {
tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4;
arr[L++] = tmp & 0xFF;
} else if (placeHolders === 1) {
tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2;
arr[L++] = tmp >> 8 & 0xFF;
arr[L++] = tmp & 0xFF;
}
return arr;
}
|
Checks if the hunk exactly fits on the provided location
|
toByteArray
|
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 tripletToBase64(num) {
return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F];
}
|
Checks if the hunk exactly fits on the provided location
|
tripletToBase64
|
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 encodeChunk(uint8, start, end) {
var tmp;
var output = [];
for (var i = start; i < end; i += 3) {
tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + uint8[i + 2];
output.push(tripletToBase64(tmp));
}
return output.join('');
}
|
Checks if the hunk exactly fits on the provided location
|
encodeChunk
|
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 fromByteArray(uint8) {
if (!inited) {
init();
}
var tmp;
var len = uint8.length;
var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes
var output = '';
var parts = [];
var maxChunkLength = 16383; // must be multiple of 3
// go through the array every three bytes, we'll deal with trailing stuff later
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength));
} // pad the end with zeros, but make sure to not forget the extra bytes
if (extraBytes === 1) {
tmp = uint8[len - 1];
output += lookup[tmp >> 2];
output += lookup[tmp << 4 & 0x3F];
output += '==';
} else if (extraBytes === 2) {
tmp = (uint8[len - 2] << 8) + uint8[len - 1];
output += lookup[tmp >> 10];
output += lookup[tmp >> 4 & 0x3F];
output += lookup[tmp << 2 & 0x3F];
output += '=';
}
parts.push(output);
return parts.join('');
}
|
Checks if the hunk exactly fits on the provided location
|
fromByteArray
|
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 read(buffer, offset, isLE, mLen, nBytes) {
var e, m;
var eLen = nBytes * 8 - mLen - 1;
var eMax = (1 << eLen) - 1;
var eBias = eMax >> 1;
var nBits = -7;
var i = isLE ? nBytes - 1 : 0;
var d = isLE ? -1 : 1;
var s = buffer[offset + i];
i += d;
e = s & (1 << -nBits) - 1;
s >>= -nBits;
nBits += eLen;
for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
m = e & (1 << -nBits) - 1;
e >>= -nBits;
nBits += mLen;
for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
if (e === 0) {
e = 1 - eBias;
} else if (e === eMax) {
return m ? NaN : (s ? -1 : 1) * Infinity;
} else {
m = m + Math.pow(2, mLen);
e = e - eBias;
}
return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
}
|
Checks if the hunk exactly fits on the provided location
|
read
|
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 write(buffer, value, offset, isLE, mLen, nBytes) {
var e, m, c;
var eLen = nBytes * 8 - mLen - 1;
var eMax = (1 << eLen) - 1;
var eBias = eMax >> 1;
var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
var i = isLE ? 0 : nBytes - 1;
var d = isLE ? 1 : -1;
var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
value = Math.abs(value);
if (isNaN(value) || value === Infinity) {
m = isNaN(value) ? 1 : 0;
e = eMax;
} else {
e = Math.floor(Math.log(value) / Math.LN2);
if (value * (c = Math.pow(2, -e)) < 1) {
e--;
c *= 2;
}
if (e + eBias >= 1) {
value += rt / c;
} else {
value += rt * Math.pow(2, 1 - eBias);
}
if (value * c >= 2) {
e++;
c /= 2;
}
if (e + eBias >= eMax) {
m = 0;
e = eMax;
} else if (e + eBias >= 1) {
m = (value * c - 1) * Math.pow(2, mLen);
e = e + eBias;
} else {
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
e = 0;
}
}
for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
e = e << mLen | m;
eLen += mLen;
for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
buffer[offset + i - d] |= s * 128;
}
|
Checks if the hunk exactly fits on the provided location
|
write
|
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 Buffer(arg, encodingOrOffset, length) {
if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
return new Buffer(arg, encodingOrOffset, length);
} // Common case.
if (typeof arg === 'number') {
if (typeof encodingOrOffset === 'string') {
throw new Error('If encoding is specified then the first argument must be a string');
}
return allocUnsafe(this, arg);
}
return from(this, arg, encodingOrOffset, length);
}
|
The Buffer constructor returns instances of `Uint8Array` that have their
prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
`Uint8Array`, so the returned instances will have all the node `Buffer` methods
and the `Uint8Array` methods. Square bracket notation works as expected -- it
returns a single octet.
The `Uint8Array` prototype remains unmodified.
|
Buffer
|
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 from(that, value, encodingOrOffset, length) {
if (typeof value === 'number') {
throw new TypeError('"value" argument must not be a number');
}
if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
return fromArrayBuffer(that, value, encodingOrOffset, length);
}
if (typeof value === 'string') {
return fromString(that, value, encodingOrOffset);
}
return fromObject(that, value);
}
|
The Buffer constructor returns instances of `Uint8Array` that have their
prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
`Uint8Array`, so the returned instances will have all the node `Buffer` methods
and the `Uint8Array` methods. Square bracket notation works as expected -- it
returns a single octet.
The `Uint8Array` prototype remains unmodified.
|
from
|
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 assertSize(size) {
if (typeof size !== 'number') {
throw new TypeError('"size" argument must be a number');
} else if (size < 0) {
throw new RangeError('"size" argument must not be negative');
}
}
|
Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
if value is a number.
Buffer.from(str[, encoding])
Buffer.from(array)
Buffer.from(buffer)
Buffer.from(arrayBuffer[, byteOffset[, length]])
|
assertSize
|
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 alloc(that, size, fill, encoding) {
assertSize(size);
if (size <= 0) {
return createBuffer(that, size);
}
if (fill !== undefined) {
// Only pay attention to encoding if it's a string. This
// prevents accidentally sending in a number that would
// be interpretted as a start offset.
return typeof encoding === 'string' ? createBuffer(that, size).fill(fill, encoding) : createBuffer(that, size).fill(fill);
}
return createBuffer(that, size);
}
|
Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
if value is a number.
Buffer.from(str[, encoding])
Buffer.from(array)
Buffer.from(buffer)
Buffer.from(arrayBuffer[, byteOffset[, length]])
|
alloc
|
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 allocUnsafe(that, size) {
assertSize(size);
that = createBuffer(that, size < 0 ? 0 : checked(size) | 0);
if (!Buffer.TYPED_ARRAY_SUPPORT) {
for (var i = 0; i < size; ++i) {
that[i] = 0;
}
}
return that;
}
|
Creates a new filled Buffer instance.
alloc(size[, fill[, encoding]])
|
allocUnsafe
|
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 fromString(that, string, encoding) {
if (typeof encoding !== 'string' || encoding === '') {
encoding = 'utf8';
}
if (!Buffer.isEncoding(encoding)) {
throw new TypeError('"encoding" must be a valid string encoding');
}
var length = byteLength(string, encoding) | 0;
that = createBuffer(that, length);
var actual = that.write(string, encoding);
if (actual !== length) {
// Writing a hex string, for example, that contains invalid characters will
// cause everything after the first invalid character to be ignored. (e.g.
// 'abxxcd' will be treated as 'ab')
that = that.slice(0, actual);
}
return that;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
fromString
|
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 fromArrayLike(that, array) {
var length = array.length < 0 ? 0 : checked(array.length) | 0;
that = createBuffer(that, length);
for (var i = 0; i < length; i += 1) {
that[i] = array[i] & 255;
}
return that;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
fromArrayLike
|
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 fromArrayBuffer(that, array, byteOffset, length) {
array.byteLength; // this throws if `array` is not a valid ArrayBuffer
if (byteOffset < 0 || array.byteLength < byteOffset) {
throw new RangeError('\'offset\' is out of bounds');
}
if (array.byteLength < byteOffset + (length || 0)) {
throw new RangeError('\'length\' is out of bounds');
}
if (byteOffset === undefined && length === undefined) {
array = new Uint8Array(array);
} else if (length === undefined) {
array = new Uint8Array(array, byteOffset);
} else {
array = new Uint8Array(array, byteOffset, length);
}
if (Buffer.TYPED_ARRAY_SUPPORT) {
// Return an augmented `Uint8Array` instance, for best performance
that = array;
that.__proto__ = Buffer.prototype;
} else {
// Fallback: Return an object instance of the Buffer class
that = fromArrayLike(that, array);
}
return that;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
fromArrayBuffer
|
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 fromObject(that, obj) {
if (internalIsBuffer(obj)) {
var len = checked(obj.length) | 0;
that = createBuffer(that, len);
if (that.length === 0) {
return that;
}
obj.copy(that, 0, 0, len);
return that;
}
if (obj) {
if (typeof ArrayBuffer !== 'undefined' && obj.buffer instanceof ArrayBuffer || 'length' in obj) {
if (typeof obj.length !== 'number' || isnan(obj.length)) {
return createBuffer(that, 0);
}
return fromArrayLike(that, obj);
}
if (obj.type === 'Buffer' && isArray(obj.data)) {
return fromArrayLike(that, obj.data);
}
}
throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.');
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
fromObject
|
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 checked(length) {
// Note: cannot use `length < kMaxLength()` here because that fails when
// length is NaN (which is otherwise coerced to zero.)
if (length >= kMaxLength()) {
throw new RangeError('Attempt to allocate Buffer larger than maximum ' + 'size: 0x' + kMaxLength().toString(16) + ' bytes');
}
return length | 0;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
checked
|
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 internalIsBuffer(b) {
return !!(b != null && b._isBuffer);
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
internalIsBuffer
|
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 byteLength(string, encoding) {
if (internalIsBuffer(string)) {
return string.length;
}
if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' && (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
return string.byteLength;
}
if (typeof string !== 'string') {
string = '' + string;
}
var len = string.length;
if (len === 0) return 0; // Use a for loop to avoid recursion
var loweredCase = false;
for (;;) {
switch (encoding) {
case 'ascii':
case 'latin1':
case 'binary':
return len;
case 'utf8':
case 'utf-8':
case undefined:
return utf8ToBytes(string).length;
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
return len * 2;
case 'hex':
return len >>> 1;
case 'base64':
return base64ToBytes(string).length;
default:
if (loweredCase) return utf8ToBytes(string).length; // assume utf8
encoding = ('' + encoding).toLowerCase();
loweredCase = true;
}
}
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
byteLength
|
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 slowToString(encoding, start, end) {
var loweredCase = false; // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
// property of a typed array.
// This behaves neither like String nor Uint8Array in that we set start/end
// to their upper/lower bounds if the value passed is out of range.
// undefined is handled specially as per ECMA-262 6th Edition,
// Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
if (start === undefined || start < 0) {
start = 0;
} // Return early if start > this.length. Done here to prevent potential uint32
// coercion fail below.
if (start > this.length) {
return '';
}
if (end === undefined || end > this.length) {
end = this.length;
}
if (end <= 0) {
return '';
} // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
end >>>= 0;
start >>>= 0;
if (end <= start) {
return '';
}
if (!encoding) encoding = 'utf8';
while (true) {
switch (encoding) {
case 'hex':
return hexSlice(this, start, end);
case 'utf8':
case 'utf-8':
return utf8Slice(this, start, end);
case 'ascii':
return asciiSlice(this, start, end);
case 'latin1':
case 'binary':
return latin1Slice(this, start, end);
case 'base64':
return base64Slice(this, start, end);
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
return utf16leSlice(this, start, end);
default:
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding);
encoding = (encoding + '').toLowerCase();
loweredCase = true;
}
}
} // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
slowToString
|
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 swap(b, n, m) {
var i = b[n];
b[n] = b[m];
b[m] = i;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
swap
|
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 bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
// Empty buffer means no match
if (buffer.length === 0) return -1; // Normalize byteOffset
if (typeof byteOffset === 'string') {
encoding = byteOffset;
byteOffset = 0;
} else if (byteOffset > 0x7fffffff) {
byteOffset = 0x7fffffff;
} else if (byteOffset < -0x80000000) {
byteOffset = -0x80000000;
}
byteOffset = +byteOffset; // Coerce to Number.
if (isNaN(byteOffset)) {
// byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
byteOffset = dir ? 0 : buffer.length - 1;
} // Normalize byteOffset: negative offsets start from the end of the buffer
if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
if (byteOffset >= buffer.length) {
if (dir) return -1;else byteOffset = buffer.length - 1;
} else if (byteOffset < 0) {
if (dir) byteOffset = 0;else return -1;
} // Normalize val
if (typeof val === 'string') {
val = Buffer.from(val, encoding);
} // Finally, search either indexOf (if dir is true) or lastIndexOf
if (internalIsBuffer(val)) {
// Special case: looking for empty string/buffer always fails
if (val.length === 0) {
return -1;
}
return arrayIndexOf(buffer, val, byteOffset, encoding, dir);
} else if (typeof val === 'number') {
val = val & 0xFF; // Search for a byte value [0-255]
if (Buffer.TYPED_ARRAY_SUPPORT && typeof Uint8Array.prototype.indexOf === 'function') {
if (dir) {
return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset);
} else {
return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset);
}
}
return arrayIndexOf(buffer, [val], byteOffset, encoding, dir);
}
throw new TypeError('val must be string, number or Buffer');
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
bidirectionalIndexOf
|
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 arrayIndexOf(arr, val, byteOffset, encoding, dir) {
var indexSize = 1;
var arrLength = arr.length;
var valLength = val.length;
if (encoding !== undefined) {
encoding = String(encoding).toLowerCase();
if (encoding === 'ucs2' || encoding === 'ucs-2' || encoding === 'utf16le' || encoding === 'utf-16le') {
if (arr.length < 2 || val.length < 2) {
return -1;
}
indexSize = 2;
arrLength /= 2;
valLength /= 2;
byteOffset /= 2;
}
}
function read(buf, i) {
if (indexSize === 1) {
return buf[i];
} else {
return buf.readUInt16BE(i * indexSize);
}
}
var i;
if (dir) {
var foundIndex = -1;
for (i = byteOffset; i < arrLength; i++) {
if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
if (foundIndex === -1) foundIndex = i;
if (i - foundIndex + 1 === valLength) return foundIndex * indexSize;
} else {
if (foundIndex !== -1) i -= i - foundIndex;
foundIndex = -1;
}
}
} else {
if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
for (i = byteOffset; i >= 0; i--) {
var found = true;
for (var j = 0; j < valLength; j++) {
if (read(arr, i + j) !== read(val, j)) {
found = false;
break;
}
}
if (found) return i;
}
}
return -1;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
arrayIndexOf
|
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 read(buf, i) {
if (indexSize === 1) {
return buf[i];
} else {
return buf.readUInt16BE(i * indexSize);
}
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
read
|
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 hexWrite(buf, string, offset, length) {
offset = Number(offset) || 0;
var remaining = buf.length - offset;
if (!length) {
length = remaining;
} else {
length = Number(length);
if (length > remaining) {
length = remaining;
}
} // must be an even number of digits
var strLen = string.length;
if (strLen % 2 !== 0) throw new TypeError('Invalid hex string');
if (length > strLen / 2) {
length = strLen / 2;
}
for (var i = 0; i < length; ++i) {
var parsed = parseInt(string.substr(i * 2, 2), 16);
if (isNaN(parsed)) return i;
buf[offset + i] = parsed;
}
return i;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
hexWrite
|
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 utf8Write(buf, string, offset, length) {
return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
utf8Write
|
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 asciiWrite(buf, string, offset, length) {
return blitBuffer(asciiToBytes(string), buf, offset, length);
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
asciiWrite
|
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 latin1Write(buf, string, offset, length) {
return asciiWrite(buf, string, offset, length);
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
latin1Write
|
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 base64Write(buf, string, offset, length) {
return blitBuffer(base64ToBytes(string), buf, offset, length);
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
base64Write
|
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 ucs2Write(buf, string, offset, length) {
return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
ucs2Write
|
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 base64Slice(buf, start, end) {
if (start === 0 && end === buf.length) {
return fromByteArray(buf);
} else {
return fromByteArray(buf.slice(start, end));
}
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
base64Slice
|
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 utf8Slice(buf, start, end) {
end = Math.min(buf.length, end);
var res = [];
var i = start;
while (i < end) {
var firstByte = buf[i];
var codePoint = null;
var bytesPerSequence = firstByte > 0xEF ? 4 : firstByte > 0xDF ? 3 : firstByte > 0xBF ? 2 : 1;
if (i + bytesPerSequence <= end) {
var secondByte, thirdByte, fourthByte, tempCodePoint;
switch (bytesPerSequence) {
case 1:
if (firstByte < 0x80) {
codePoint = firstByte;
}
break;
case 2:
secondByte = buf[i + 1];
if ((secondByte & 0xC0) === 0x80) {
tempCodePoint = (firstByte & 0x1F) << 0x6 | secondByte & 0x3F;
if (tempCodePoint > 0x7F) {
codePoint = tempCodePoint;
}
}
break;
case 3:
secondByte = buf[i + 1];
thirdByte = buf[i + 2];
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | thirdByte & 0x3F;
if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
codePoint = tempCodePoint;
}
}
break;
case 4:
secondByte = buf[i + 1];
thirdByte = buf[i + 2];
fourthByte = buf[i + 3];
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | fourthByte & 0x3F;
if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
codePoint = tempCodePoint;
}
}
}
}
if (codePoint === null) {
// we did not generate a valid codePoint so insert a
// replacement char (U+FFFD) and advance only 1 byte
codePoint = 0xFFFD;
bytesPerSequence = 1;
} else if (codePoint > 0xFFFF) {
// encode to utf16 (surrogate pair dance)
codePoint -= 0x10000;
res.push(codePoint >>> 10 & 0x3FF | 0xD800);
codePoint = 0xDC00 | codePoint & 0x3FF;
}
res.push(codePoint);
i += bytesPerSequence;
}
return decodeCodePointsArray(res);
} // Based on http://stackoverflow.com/a/22747272/680742, the browser with
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
utf8Slice
|
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 decodeCodePointsArray(codePoints) {
var len = codePoints.length;
if (len <= MAX_ARGUMENTS_LENGTH) {
return String.fromCharCode.apply(String, codePoints); // avoid extra slice()
} // Decode in chunks to avoid "call stack size exceeded".
var res = '';
var i = 0;
while (i < len) {
res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH));
}
return res;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
decodeCodePointsArray
|
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 asciiSlice(buf, start, end) {
var ret = '';
end = Math.min(buf.length, end);
for (var i = start; i < end; ++i) {
ret += String.fromCharCode(buf[i] & 0x7F);
}
return ret;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
asciiSlice
|
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 latin1Slice(buf, start, end) {
var ret = '';
end = Math.min(buf.length, end);
for (var i = start; i < end; ++i) {
ret += String.fromCharCode(buf[i]);
}
return ret;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
latin1Slice
|
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 hexSlice(buf, start, end) {
var len = buf.length;
if (!start || start < 0) start = 0;
if (!end || end < 0 || end > len) end = len;
var out = '';
for (var i = start; i < end; ++i) {
out += toHex(buf[i]);
}
return out;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
hexSlice
|
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 utf16leSlice(buf, start, end) {
var bytes = buf.slice(start, end);
var res = '';
for (var i = 0; i < bytes.length; i += 2) {
res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
}
return res;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
utf16leSlice
|
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 checkOffset(offset, ext, length) {
if (offset % 1 !== 0 || offset < 0) throw new RangeError('offset is not uint');
if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length');
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
checkOffset
|
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 checkInt(buf, value, offset, ext, max, min) {
if (!internalIsBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance');
if (value > max || value < min) throw new RangeError('"value" argument is out of bounds');
if (offset + ext > buf.length) throw new RangeError('Index out of range');
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
checkInt
|
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 objectWriteUInt16(buf, value, offset, littleEndian) {
if (value < 0) value = 0xffff + value + 1;
for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
buf[offset + i] = (value & 0xff << 8 * (littleEndian ? i : 1 - i)) >>> (littleEndian ? i : 1 - i) * 8;
}
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
objectWriteUInt16
|
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 objectWriteUInt32(buf, value, offset, littleEndian) {
if (value < 0) value = 0xffffffff + value + 1;
for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
buf[offset + i] = value >>> (littleEndian ? i : 3 - i) * 8 & 0xff;
}
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
objectWriteUInt32
|
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 checkIEEE754(buf, value, offset, ext, max, min) {
if (offset + ext > buf.length) throw new RangeError('Index out of range');
if (offset < 0) throw new RangeError('Index out of range');
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
checkIEEE754
|
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 writeFloat(buf, value, offset, littleEndian, noAssert) {
if (!noAssert) {
checkIEEE754(buf, value, offset, 4);
}
write(buf, value, offset, littleEndian, 23, 4);
return offset + 4;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
writeFloat
|
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 writeDouble(buf, value, offset, littleEndian, noAssert) {
if (!noAssert) {
checkIEEE754(buf, value, offset, 8);
}
write(buf, value, offset, littleEndian, 52, 8);
return offset + 8;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
writeDouble
|
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 base64clean(str) {
// Node strips out invalid characters like \n and \t from the string, base64-js does not
str = stringtrim(str).replace(INVALID_BASE64_RE, ''); // Node converts strings with length < 2 to ''
if (str.length < 2) return ''; // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
while (str.length % 4 !== 0) {
str = str + '=';
}
return str;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
base64clean
|
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 stringtrim(str) {
if (str.trim) return str.trim();
return str.replace(/^\s+|\s+$/g, '');
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
stringtrim
|
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 toHex(n) {
if (n < 16) return '0' + n.toString(16);
return n.toString(16);
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
toHex
|
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 utf8ToBytes(string, units) {
units = units || Infinity;
var codePoint;
var length = string.length;
var leadSurrogate = null;
var bytes = [];
for (var i = 0; i < length; ++i) {
codePoint = string.charCodeAt(i); // is surrogate component
if (codePoint > 0xD7FF && codePoint < 0xE000) {
// last char was a lead
if (!leadSurrogate) {
// no lead yet
if (codePoint > 0xDBFF) {
// unexpected trail
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
continue;
} else if (i + 1 === length) {
// unpaired lead
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
continue;
} // valid lead
leadSurrogate = codePoint;
continue;
} // 2 leads in a row
if (codePoint < 0xDC00) {
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
leadSurrogate = codePoint;
continue;
} // valid surrogate pair
codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000;
} else if (leadSurrogate) {
// valid bmp char, but last char was a lead
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
}
leadSurrogate = null; // encode utf8
if (codePoint < 0x80) {
if ((units -= 1) < 0) break;
bytes.push(codePoint);
} else if (codePoint < 0x800) {
if ((units -= 2) < 0) break;
bytes.push(codePoint >> 0x6 | 0xC0, codePoint & 0x3F | 0x80);
} else if (codePoint < 0x10000) {
if ((units -= 3) < 0) break;
bytes.push(codePoint >> 0xC | 0xE0, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80);
} else if (codePoint < 0x110000) {
if ((units -= 4) < 0) break;
bytes.push(codePoint >> 0x12 | 0xF0, codePoint >> 0xC & 0x3F | 0x80, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80);
} else {
throw new Error('Invalid code point');
}
}
return bytes;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
utf8ToBytes
|
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 asciiToBytes(str) {
var byteArray = [];
for (var i = 0; i < str.length; ++i) {
// Node's code seems to be doing this and not & 0x7F..
byteArray.push(str.charCodeAt(i) & 0xFF);
}
return byteArray;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
asciiToBytes
|
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 utf16leToBytes(str, units) {
var c, hi, lo;
var byteArray = [];
for (var i = 0; i < str.length; ++i) {
if ((units -= 2) < 0) break;
c = str.charCodeAt(i);
hi = c >> 8;
lo = c % 256;
byteArray.push(lo);
byteArray.push(hi);
}
return byteArray;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
utf16leToBytes
|
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 base64ToBytes(str) {
return toByteArray(base64clean(str));
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
base64ToBytes
|
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 blitBuffer(src, dst, offset, length) {
for (var i = 0; i < length; ++i) {
if (i + offset >= dst.length || i >= src.length) break;
dst[i + offset] = src[i];
}
return i;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
blitBuffer
|
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 isnan(val) {
return val !== val; // eslint-disable-line no-self-compare
} // the following is from is-buffer, also by Feross Aboukhadijeh and with same lisence
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
isnan
|
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 isBuffer(obj) {
return obj != null && (!!obj._isBuffer || isFastBuffer(obj) || isSlowBuffer(obj));
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
isBuffer
|
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 isFastBuffer(obj) {
return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj);
} // For Node v0.10 support. Remove this eventually.
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
isFastBuffer
|
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 isSlowBuffer(obj) {
return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isFastBuffer(obj.slice(0, 0));
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
isSlowBuffer
|
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 unwrapExports (x) {
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
unwrapExports
|
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 createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
createCommonjsModule
|
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 getCjsExportFromNamespace (n) {
return n && n['default'] || n;
}
|
Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
getCjsExportFromNamespace
|
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 fromPairs(pairs) {
var index = -1,
length = pairs == null ? 0 : pairs.length,
result = {};
while (++index < length) {
var pair = pairs[index];
result[pair[0]] = pair[1];
}
return result;
}
|
The inverse of `_.toPairs`; this method returns an object composed
from key-value `pairs`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} pairs The key-value pairs.
@returns {Object} Returns the new object.
@example
_.fromPairs([['a', 1], ['b', 2]]);
// => { 'a': 1, 'b': 2 }
|
fromPairs
|
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 _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
|
The inverse of `_.toPairs`; this method returns an object composed
from key-value `pairs`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} pairs The key-value pairs.
@returns {Object} Returns the new object.
@example
_.fromPairs([['a', 1], ['b', 2]]);
// => { 'a': 1, 'b': 2 }
|
_objectWithoutPropertiesLoose
|
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 _taggedTemplateLiteral(strings, raw) {
if (!raw) {
raw = strings.slice(0);
}
return Object.freeze(Object.defineProperties(strings, {
raw: {
value: Object.freeze(raw)
}
}));
}
|
The inverse of `_.toPairs`; this method returns an object composed
from key-value `pairs`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} pairs The key-value pairs.
@returns {Object} Returns the new object.
@example
_.fromPairs([['a', 1], ['b', 2]]);
// => { 'a': 1, 'b': 2 }
|
_taggedTemplateLiteral
|
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 defaultSetTimout() {
throw new Error('setTimeout has not been defined');
}
|
The inverse of `_.toPairs`; this method returns an object composed
from key-value `pairs`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} pairs The key-value pairs.
@returns {Object} Returns the new object.
@example
_.fromPairs([['a', 1], ['b', 2]]);
// => { 'a': 1, 'b': 2 }
|
defaultSetTimout
|
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 defaultClearTimeout() {
throw new Error('clearTimeout has not been defined');
}
|
The inverse of `_.toPairs`; this method returns an object composed
from key-value `pairs`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} pairs The key-value pairs.
@returns {Object} Returns the new object.
@example
_.fromPairs([['a', 1], ['b', 2]]);
// => { 'a': 1, 'b': 2 }
|
defaultClearTimeout
|
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 runTimeout(fun) {
if (cachedSetTimeout === setTimeout) {
//normal enviroments in sane situations
return setTimeout(fun, 0);
} // if setTimeout wasn't available but was latter defined
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
cachedSetTimeout = setTimeout;
return setTimeout(fun, 0);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedSetTimeout(fun, 0);
} catch (e) {
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedSetTimeout.call(null, fun, 0);
} catch (e) {
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
return cachedSetTimeout.call(this, fun, 0);
}
}
}
|
The inverse of `_.toPairs`; this method returns an object composed
from key-value `pairs`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} pairs The key-value pairs.
@returns {Object} Returns the new object.
@example
_.fromPairs([['a', 1], ['b', 2]]);
// => { 'a': 1, 'b': 2 }
|
runTimeout
|
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 runClearTimeout(marker) {
if (cachedClearTimeout === clearTimeout) {
//normal enviroments in sane situations
return clearTimeout(marker);
} // if clearTimeout wasn't available but was latter defined
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
cachedClearTimeout = clearTimeout;
return clearTimeout(marker);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedClearTimeout(marker);
} catch (e) {
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedClearTimeout.call(null, marker);
} catch (e) {
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
return cachedClearTimeout.call(this, marker);
}
}
}
|
The inverse of `_.toPairs`; this method returns an object composed
from key-value `pairs`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} pairs The key-value pairs.
@returns {Object} Returns the new object.
@example
_.fromPairs([['a', 1], ['b', 2]]);
// => { 'a': 1, 'b': 2 }
|
runClearTimeout
|
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 cleanUpNextTick() {
if (!draining || !currentQueue) {
return;
}
draining = false;
if (currentQueue.length) {
queue = currentQueue.concat(queue);
} else {
queueIndex = -1;
}
if (queue.length) {
drainQueue();
}
}
|
The inverse of `_.toPairs`; this method returns an object composed
from key-value `pairs`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} pairs The key-value pairs.
@returns {Object} Returns the new object.
@example
_.fromPairs([['a', 1], ['b', 2]]);
// => { 'a': 1, 'b': 2 }
|
cleanUpNextTick
|
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 drainQueue() {
if (draining) {
return;
}
var timeout = runTimeout(cleanUpNextTick);
draining = true;
var len = queue.length;
while (len) {
currentQueue = queue;
queue = [];
while (++queueIndex < len) {
if (currentQueue) {
currentQueue[queueIndex].run();
}
}
queueIndex = -1;
len = queue.length;
}
currentQueue = null;
draining = false;
runClearTimeout(timeout);
}
|
The inverse of `_.toPairs`; this method returns an object composed
from key-value `pairs`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} pairs The key-value pairs.
@returns {Object} Returns the new object.
@example
_.fromPairs([['a', 1], ['b', 2]]);
// => { 'a': 1, 'b': 2 }
|
drainQueue
|
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 nextTick(fun) {
var args = new Array(arguments.length - 1);
if (arguments.length > 1) {
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
}
queue.push(new Item(fun, args));
if (queue.length === 1 && !draining) {
runTimeout(drainQueue);
}
} // v8 likes predictible objects
|
The inverse of `_.toPairs`; this method returns an object composed
from key-value `pairs`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} pairs The key-value pairs.
@returns {Object} Returns the new object.
@example
_.fromPairs([['a', 1], ['b', 2]]);
// => { 'a': 1, 'b': 2 }
|
nextTick
|
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 Item(fun, array) {
this.fun = fun;
this.array = array;
}
|
The inverse of `_.toPairs`; this method returns an object composed
from key-value `pairs`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} pairs The key-value pairs.
@returns {Object} Returns the new object.
@example
_.fromPairs([['a', 1], ['b', 2]]);
// => { 'a': 1, 'b': 2 }
|
Item
|
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 binding(name) {
throw new Error('process.binding is not supported');
}
|
The inverse of `_.toPairs`; this method returns an object composed
from key-value `pairs`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} pairs The key-value pairs.
@returns {Object} Returns the new object.
@example
_.fromPairs([['a', 1], ['b', 2]]);
// => { 'a': 1, 'b': 2 }
|
binding
|
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 cwd() {
return '/';
}
|
The inverse of `_.toPairs`; this method returns an object composed
from key-value `pairs`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} pairs The key-value pairs.
@returns {Object} Returns the new object.
@example
_.fromPairs([['a', 1], ['b', 2]]);
// => { 'a': 1, 'b': 2 }
|
cwd
|
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 chdir(dir) {
throw new Error('process.chdir is not supported');
}
|
The inverse of `_.toPairs`; this method returns an object composed
from key-value `pairs`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} pairs The key-value pairs.
@returns {Object} Returns the new object.
@example
_.fromPairs([['a', 1], ['b', 2]]);
// => { 'a': 1, 'b': 2 }
|
chdir
|
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 umask() {
return 0;
} // from https://github.com/kumavis/browser-process-hrtime/blob/master/index.js
|
The inverse of `_.toPairs`; this method returns an object composed
from key-value `pairs`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} pairs The key-value pairs.
@returns {Object} Returns the new object.
@example
_.fromPairs([['a', 1], ['b', 2]]);
// => { 'a': 1, 'b': 2 }
|
umask
|
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 hrtime(previousTimestamp) {
var clocktime = performanceNow.call(performance) * 1e-3;
var seconds = Math.floor(clocktime);
var nanoseconds = Math.floor(clocktime % 1 * 1e9);
if (previousTimestamp) {
seconds = seconds - previousTimestamp[0];
nanoseconds = nanoseconds - previousTimestamp[1];
if (nanoseconds < 0) {
seconds--;
nanoseconds += 1e9;
}
}
return [seconds, nanoseconds];
}
|
The inverse of `_.toPairs`; this method returns an object composed
from key-value `pairs`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} pairs The key-value pairs.
@returns {Object} Returns the new object.
@example
_.fromPairs([['a', 1], ['b', 2]]);
// => { 'a': 1, 'b': 2 }
|
hrtime
|
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 uptime() {
var currentTime = new Date();
var dif = currentTime - startTime;
return dif / 1000;
}
|
The inverse of `_.toPairs`; this method returns an object composed
from key-value `pairs`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} pairs The key-value pairs.
@returns {Object} Returns the new object.
@example
_.fromPairs([['a', 1], ['b', 2]]);
// => { 'a': 1, 'b': 2 }
|
uptime
|
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
|
createToken = (name, value, isGlobal) => {
const index = R++;
debug_1(index, value);
t[name] = index;
src[index] = value;
re[index] = new RegExp(value, isGlobal ? 'g' : undefined);
}
|
The inverse of `_.toPairs`; this method returns an object composed
from key-value `pairs`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} pairs The key-value pairs.
@returns {Object} Returns the new object.
@example
_.fromPairs([['a', 1], ['b', 2]]);
// => { 'a': 1, 'b': 2 }
|
createToken
|
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
|
createToken = (name, value, isGlobal) => {
const index = R++;
debug_1(index, value);
t[name] = index;
src[index] = value;
re[index] = new RegExp(value, isGlobal ? 'g' : undefined);
}
|
The inverse of `_.toPairs`; this method returns an object composed
from key-value `pairs`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} pairs The key-value pairs.
@returns {Object} Returns the new object.
@example
_.fromPairs([['a', 1], ['b', 2]]);
// => { 'a': 1, 'b': 2 }
|
createToken
|
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
|
compareIdentifiers = (a, b) => {
const anum = numeric.test(a);
const bnum = numeric.test(b);
if (anum && bnum) {
a = +a;
b = +b;
}
return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
}
|
The inverse of `_.toPairs`; this method returns an object composed
from key-value `pairs`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} pairs The key-value pairs.
@returns {Object} Returns the new object.
@example
_.fromPairs([['a', 1], ['b', 2]]);
// => { 'a': 1, 'b': 2 }
|
compareIdentifiers
|
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
|
compareIdentifiers = (a, b) => {
const anum = numeric.test(a);
const bnum = numeric.test(b);
if (anum && bnum) {
a = +a;
b = +b;
}
return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
}
|
The inverse of `_.toPairs`; this method returns an object composed
from key-value `pairs`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} pairs The key-value pairs.
@returns {Object} Returns the new object.
@example
_.fromPairs([['a', 1], ['b', 2]]);
// => { 'a': 1, 'b': 2 }
|
compareIdentifiers
|
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(version, options) {
if (!options || typeof options !== 'object') {
options = {
loose: !!options,
includePrerelease: false
};
}
if (version instanceof SemVer) {
if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
return version;
} else {
version = version.version;
}
} else if (typeof version !== 'string') {
throw new TypeError("Invalid Version: ".concat(version));
}
if (version.length > MAX_LENGTH$1) {
throw new TypeError("version is longer than ".concat(MAX_LENGTH$1, " characters"));
}
debug_1('SemVer', version, options);
this.options = options;
this.loose = !!options.loose; // this isn't actually relevant for versions, but keep it so that we
// don't run into trouble passing this.options around.
this.includePrerelease = !!options.includePrerelease;
const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
if (!m) {
throw new TypeError("Invalid Version: ".concat(version));
}
this.raw = version; // these are actually numbers
this.major = +m[1];
this.minor = +m[2];
this.patch = +m[3];
if (this.major > MAX_SAFE_INTEGER$1 || this.major < 0) {
throw new TypeError('Invalid major version');
}
if (this.minor > MAX_SAFE_INTEGER$1 || this.minor < 0) {
throw new TypeError('Invalid minor version');
}
if (this.patch > MAX_SAFE_INTEGER$1 || this.patch < 0) {
throw new TypeError('Invalid patch version');
} // numberify any prerelease numeric ids
if (!m[4]) {
this.prerelease = [];
} else {
this.prerelease = m[4].split('.').map(id => {
if (/^[0-9]+$/.test(id)) {
const num = +id;
if (num >= 0 && num < MAX_SAFE_INTEGER$1) {
return num;
}
}
return id;
});
}
this.build = m[5] ? m[5].split('.') : [];
this.format();
}
|
The inverse of `_.toPairs`; this method returns an object composed
from key-value `pairs`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} pairs The key-value pairs.
@returns {Object} Returns the new object.
@example
_.fromPairs([['a', 1], ['b', 2]]);
// => { 'a': 1, 'b': 2 }
|
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
|
format() {
this.version = "".concat(this.major, ".").concat(this.minor, ".").concat(this.patch);
if (this.prerelease.length) {
this.version += "-".concat(this.prerelease.join('.'));
}
return this.version;
}
|
The inverse of `_.toPairs`; this method returns an object composed
from key-value `pairs`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} pairs The key-value pairs.
@returns {Object} Returns the new object.
@example
_.fromPairs([['a', 1], ['b', 2]]);
// => { 'a': 1, 'b': 2 }
|
format
|
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
|
toString() {
return this.version;
}
|
The inverse of `_.toPairs`; this method returns an object composed
from key-value `pairs`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} pairs The key-value pairs.
@returns {Object} Returns the new object.
@example
_.fromPairs([['a', 1], ['b', 2]]);
// => { 'a': 1, 'b': 2 }
|
toString
|
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
|
compare(other) {
debug_1('SemVer.compare', this.version, this.options, other);
if (!(other instanceof SemVer)) {
if (typeof other === 'string' && other === this.version) {
return 0;
}
other = new SemVer(other, this.options);
}
if (other.version === this.version) {
return 0;
}
return this.compareMain(other) || this.comparePre(other);
}
|
The inverse of `_.toPairs`; this method returns an object composed
from key-value `pairs`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} pairs The key-value pairs.
@returns {Object} Returns the new object.
@example
_.fromPairs([['a', 1], ['b', 2]]);
// => { 'a': 1, 'b': 2 }
|
compare
|
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
|
compareMain(other) {
if (!(other instanceof SemVer)) {
other = new SemVer(other, this.options);
}
return compareIdentifiers$1(this.major, other.major) || compareIdentifiers$1(this.minor, other.minor) || compareIdentifiers$1(this.patch, other.patch);
}
|
The inverse of `_.toPairs`; this method returns an object composed
from key-value `pairs`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} pairs The key-value pairs.
@returns {Object} Returns the new object.
@example
_.fromPairs([['a', 1], ['b', 2]]);
// => { 'a': 1, 'b': 2 }
|
compareMain
|
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
|
comparePre(other) {
if (!(other instanceof SemVer)) {
other = new SemVer(other, this.options);
} // NOT having a prerelease is > having one
if (this.prerelease.length && !other.prerelease.length) {
return -1;
} else if (!this.prerelease.length && other.prerelease.length) {
return 1;
} else if (!this.prerelease.length && !other.prerelease.length) {
return 0;
}
let i = 0;
do {
const a = this.prerelease[i];
const b = other.prerelease[i];
debug_1('prerelease compare', i, a, b);
if (a === undefined && b === undefined) {
return 0;
} else if (b === undefined) {
return 1;
} else if (a === undefined) {
return -1;
} else if (a === b) {
continue;
} else {
return compareIdentifiers$1(a, b);
}
} while (++i);
}
|
The inverse of `_.toPairs`; this method returns an object composed
from key-value `pairs`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} pairs The key-value pairs.
@returns {Object} Returns the new object.
@example
_.fromPairs([['a', 1], ['b', 2]]);
// => { 'a': 1, 'b': 2 }
|
comparePre
|
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
|
compareBuild(other) {
if (!(other instanceof SemVer)) {
other = new SemVer(other, this.options);
}
let i = 0;
do {
const a = this.build[i];
const b = other.build[i];
debug_1('prerelease compare', i, a, b);
if (a === undefined && b === undefined) {
return 0;
} else if (b === undefined) {
return 1;
} else if (a === undefined) {
return -1;
} else if (a === b) {
continue;
} else {
return compareIdentifiers$1(a, b);
}
} while (++i);
}
|
The inverse of `_.toPairs`; this method returns an object composed
from key-value `pairs`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} pairs The key-value pairs.
@returns {Object} Returns the new object.
@example
_.fromPairs([['a', 1], ['b', 2]]);
// => { 'a': 1, 'b': 2 }
|
compareBuild
|
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
|
inc(release, identifier) {
switch (release) {
case 'premajor':
this.prerelease.length = 0;
this.patch = 0;
this.minor = 0;
this.major++;
this.inc('pre', identifier);
break;
case 'preminor':
this.prerelease.length = 0;
this.patch = 0;
this.minor++;
this.inc('pre', identifier);
break;
case 'prepatch':
// If this is already a prerelease, it will bump to the next version
// drop any prereleases that might already exist, since they are not
// relevant at this point.
this.prerelease.length = 0;
this.inc('patch', identifier);
this.inc('pre', identifier);
break;
// If the input is a non-prerelease version, this acts the same as
// prepatch.
case 'prerelease':
if (this.prerelease.length === 0) {
this.inc('patch', identifier);
}
this.inc('pre', identifier);
break;
case 'major':
// If this is a pre-major version, bump up to the same major version.
// Otherwise increment major.
// 1.0.0-5 bumps to 1.0.0
// 1.1.0 bumps to 2.0.0
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
this.major++;
}
this.minor = 0;
this.patch = 0;
this.prerelease = [];
break;
case 'minor':
// If this is a pre-minor version, bump up to the same minor version.
// Otherwise increment minor.
// 1.2.0-5 bumps to 1.2.0
// 1.2.1 bumps to 1.3.0
if (this.patch !== 0 || this.prerelease.length === 0) {
this.minor++;
}
this.patch = 0;
this.prerelease = [];
break;
case 'patch':
// If this is not a pre-release version, it will increment the patch.
// If it is a pre-release it will bump up to the same patch version.
// 1.2.0-5 patches to 1.2.0
// 1.2.0 patches to 1.2.1
if (this.prerelease.length === 0) {
this.patch++;
}
this.prerelease = [];
break;
// This probably shouldn't be used publicly.
// 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
case 'pre':
if (this.prerelease.length === 0) {
this.prerelease = [0];
} else {
let i = this.prerelease.length;
while (--i >= 0) {
if (typeof this.prerelease[i] === 'number') {
this.prerelease[i]++;
i = -2;
}
}
if (i === -1) {
// didn't increment anything
this.prerelease.push(0);
}
}
if (identifier) {
// 1.2.0-beta.1 bumps to 1.2.0-beta.2,
// 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
if (this.prerelease[0] === identifier) {
if (isNaN(this.prerelease[1])) {
this.prerelease = [identifier, 0];
}
} else {
this.prerelease = [identifier, 0];
}
}
break;
default:
throw new Error("invalid increment argument: ".concat(release));
}
this.format();
this.raw = this.version;
return this;
}
|
The inverse of `_.toPairs`; this method returns an object composed
from key-value `pairs`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} pairs The key-value pairs.
@returns {Object} Returns the new object.
@example
_.fromPairs([['a', 1], ['b', 2]]);
// => { 'a': 1, 'b': 2 }
|
inc
|
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
|
arrayify = (object, keyName) => Object.entries(object).map(([key, value]) => Object.assign({
[keyName]: key
}, value))
|
The inverse of `_.toPairs`; this method returns an object composed
from key-value `pairs`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} pairs The key-value pairs.
@returns {Object} Returns the new object.
@example
_.fromPairs([['a', 1], ['b', 2]]);
// => { 'a': 1, 'b': 2 }
|
arrayify
|
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 dedent(strings) {
var raw = void 0;
if (typeof strings === "string") {
// dedent can be used as a plain function
raw = [strings];
} else {
raw = strings.raw;
} // first, perform interpolation
var result = "";
for (var i = 0; i < raw.length; i++) {
result += raw[i]. // join lines when there is a suppressed newline
replace(/\\\n[ \t]*/g, ""). // handle escaped backticks
replace(/\\`/g, "`");
if (i < (arguments.length <= 1 ? 0 : arguments.length - 1)) {
result += arguments.length <= i + 1 ? undefined : arguments[i + 1];
}
} // now strip indentation
var lines = result.split("\n");
var mindent = null;
lines.forEach(function (l) {
var m = l.match(/^(\s+)\S+/);
if (m) {
var indent = m[1].length;
if (!mindent) {
// this is the first indented line
mindent = indent;
} else {
mindent = Math.min(mindent, indent);
}
}
});
if (mindent !== null) {
result = lines.map(function (l) {
return l[0] === " " ? l.slice(mindent) : l;
}).join("\n");
} // dedent eats leading and trailing whitespace too
result = result.trim(); // handle escaped newlines at the end to ensure they don't get stripped too
return result.replace(/\\n/g, "\n");
}
|
The inverse of `_.toPairs`; this method returns an object composed
from key-value `pairs`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} pairs The key-value pairs.
@returns {Object} Returns the new object.
@example
_.fromPairs([['a', 1], ['b', 2]]);
// => { 'a': 1, 'b': 2 }
|
dedent
|
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 _templateObject6() {
const data = _taggedTemplateLiteral(["\n Require either '@prettier' or '@format' to be present in the file's first docblock comment\n in order for it to be formatted.\n "]);
_templateObject6 = function _templateObject6() {
return data;
};
return data;
}
|
The inverse of `_.toPairs`; this method returns an object composed
from key-value `pairs`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} pairs The key-value pairs.
@returns {Object} Returns the new object.
@example
_.fromPairs([['a', 1], ['b', 2]]);
// => { 'a': 1, 'b': 2 }
|
_templateObject6
|
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 _templateObject5() {
const data = _taggedTemplateLiteral(["\n Format code starting at a given character offset.\n The range will extend backwards to the start of the first line containing the selected statement.\n This option cannot be used with --cursor-offset.\n "]);
_templateObject5 = function _templateObject5() {
return data;
};
return data;
}
|
The inverse of `_.toPairs`; this method returns an object composed
from key-value `pairs`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} pairs The key-value pairs.
@returns {Object} Returns the new object.
@example
_.fromPairs([['a', 1], ['b', 2]]);
// => { 'a': 1, 'b': 2 }
|
_templateObject5
|
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 _templateObject4() {
const data = _taggedTemplateLiteral(["\n Format code ending at a given character offset (exclusive).\n The range will extend forwards to the end of the selected statement.\n This option cannot be used with --cursor-offset.\n "]);
_templateObject4 = function _templateObject4() {
return data;
};
return data;
}
|
The inverse of `_.toPairs`; this method returns an object composed
from key-value `pairs`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} pairs The key-value pairs.
@returns {Object} Returns the new object.
@example
_.fromPairs([['a', 1], ['b', 2]]);
// => { 'a': 1, 'b': 2 }
|
_templateObject4
|
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 _templateObject3() {
const data = _taggedTemplateLiteral(["\n Custom directory that contains prettier plugins in node_modules subdirectory.\n Overrides default behavior when plugins are searched relatively to the location of Prettier.\n Multiple values are accepted.\n "]);
_templateObject3 = function _templateObject3() {
return data;
};
return data;
}
|
The inverse of `_.toPairs`; this method returns an object composed
from key-value `pairs`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} pairs The key-value pairs.
@returns {Object} Returns the new object.
@example
_.fromPairs([['a', 1], ['b', 2]]);
// => { 'a': 1, 'b': 2 }
|
_templateObject3
|
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 _templateObject2() {
const data = _taggedTemplateLiteral(["\n Maintain existing\n (mixed values within one file are normalised by looking at what's used after the first line)\n "]);
_templateObject2 = function _templateObject2() {
return data;
};
return data;
}
|
The inverse of `_.toPairs`; this method returns an object composed
from key-value `pairs`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} pairs The key-value pairs.
@returns {Object} Returns the new object.
@example
_.fromPairs([['a', 1], ['b', 2]]);
// => { 'a': 1, 'b': 2 }
|
_templateObject2
|
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 _templateObject() {
const data = _taggedTemplateLiteral(["\n Print (to stderr) where a cursor at the given position would move to after formatting.\n This option cannot be used with --range-start and --range-end.\n "]);
_templateObject = function _templateObject() {
return data;
};
return data;
}
|
The inverse of `_.toPairs`; this method returns an object composed
from key-value `pairs`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} pairs The key-value pairs.
@returns {Object} Returns the new object.
@example
_.fromPairs([['a', 1], ['b', 2]]);
// => { 'a': 1, 'b': 2 }
|
_templateObject
|
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 getSupportInfo({
plugins = [],
showUnreleased = false,
showDeprecated = false,
showInternal = false
} = {}) {
// pre-release version is smaller than the normal version in semver,
// we need to treat it as the normal one so as to test new features.
const version = currentVersion.split("-", 1)[0];
const options = arrayify(Object.assign({}, ...plugins.map(({
options
}) => options), coreOptions$1), "name").filter(option => filterSince(option) && filterDeprecated(option)).sort((a, b) => a.name === b.name ? 0 : a.name < b.name ? -1 : 1).map(mapInternal).map(option => {
option = Object.assign({}, option);
if (Array.isArray(option.default)) {
option.default = option.default.length === 1 ? option.default[0].value : option.default.filter(filterSince).sort((info1, info2) => semver$1.compare(info2.since, info1.since))[0].value;
}
if (Array.isArray(option.choices)) {
option.choices = option.choices.filter(option => filterSince(option) && filterDeprecated(option));
}
const filteredPlugins = plugins.filter(plugin => plugin.defaultOptions && plugin.defaultOptions[option.name] !== undefined);
const pluginDefaults = filteredPlugins.reduce((reduced, plugin) => {
reduced[plugin.name] = plugin.defaultOptions[option.name];
return reduced;
}, {});
return Object.assign(Object.assign({}, option), {}, {
pluginDefaults
});
});
const languages = plugins.reduce((all, plugin) => all.concat(plugin.languages || []), []).filter(filterSince);
return {
languages,
options
};
function filterSince(object) {
return showUnreleased || !("since" in object) || object.since && semver$1.gte(version, object.since);
}
function filterDeprecated(object) {
return showDeprecated || !("deprecated" in object) || object.deprecated && semver$1.lt(version, object.deprecated);
}
function mapInternal(object) {
if (showInternal) {
return object;
}
const newObject = _objectWithoutPropertiesLoose(object, ["cliName", "cliCategory", "cliDescription"]);
return newObject;
}
}
|
Strings in `plugins` and `pluginSearchDirs` are handled by a wrapped version
of this function created by `withPlugins`. Don't pass them here directly.
@param {object} param0
@param {(string | object)[]=} param0.plugins Strings are resolved by `withPlugins`.
@param {string[]=} param0.pluginSearchDirs Added by `withPlugins`.
@param {boolean=} param0.showUnreleased
@param {boolean=} param0.showDeprecated
@param {boolean=} param0.showInternal
|
getSupportInfo
|
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.