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 setCacheHas(value) {
return this.__data__.has(value);
}
|
Checks if `value` is in the array cache.
@private
@name has
@memberOf SetCache
@param {*} value The value to search for.
@returns {number} Returns `true` if `value` is found, else `false`.
|
setCacheHas
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function SetCache(values) {
var index = -1,
length = values == null ? 0 : values.length;
this.__data__ = new _MapCache();
while (++index < length) {
this.add(values[index]);
}
} // Add methods to `SetCache`.
|
Creates an array cache object to store unique values.
@private
@constructor
@param {Array} [values] The values to cache.
|
SetCache
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function arraySome(array, predicate) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
if (predicate(array[index], index, array)) {
return true;
}
}
return false;
}
|
A specialized version of `_.some` for arrays without support for iteratee
shorthands.
@private
@param {Array} [array] The array to iterate over.
@param {Function} predicate The function invoked per iteration.
@returns {boolean} Returns `true` if any element passes the predicate check,
else `false`.
|
arraySome
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function cacheHas(cache, key) {
return cache.has(key);
}
|
Checks if a `cache` value for `key` exists.
@private
@param {Object} cache The cache to query.
@param {string} key The key of the entry to check.
@returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
cacheHas
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
arrLength = array.length,
othLength = other.length;
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
return false;
} // Assume cyclic values are equal.
var stacked = stack.get(array);
if (stacked && stack.get(other)) {
return stacked == other;
}
var index = -1,
result = true,
seen = bitmask & COMPARE_UNORDERED_FLAG ? new _SetCache() : undefined;
stack.set(array, other);
stack.set(other, array); // Ignore non-index properties.
while (++index < arrLength) {
var arrValue = array[index],
othValue = other[index];
if (customizer) {
var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
}
if (compared !== undefined) {
if (compared) {
continue;
}
result = false;
break;
} // Recursively compare arrays (susceptible to call stack limits).
if (seen) {
if (!_arraySome(other, function (othValue, othIndex) {
if (!_cacheHas(seen, othIndex) && (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
return seen.push(othIndex);
}
})) {
result = false;
break;
}
} else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
result = false;
break;
}
}
stack['delete'](array);
stack['delete'](other);
return result;
}
|
A specialized version of `baseIsEqualDeep` for arrays with support for
partial deep comparisons.
@private
@param {Array} array The array to compare.
@param {Array} other The other array to compare.
@param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
@param {Function} customizer The function to customize comparisons.
@param {Function} equalFunc The function to determine equivalents of values.
@param {Object} stack Tracks traversed `array` and `other` objects.
@returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
|
equalArrays
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function mapToArray(map) {
var index = -1,
result = Array(map.size);
map.forEach(function (value, key) {
result[++index] = [key, value];
});
return result;
}
|
Converts `map` to its key-value pairs.
@private
@param {Object} map The map to convert.
@returns {Array} Returns the key-value pairs.
|
mapToArray
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function setToArray(set) {
var index = -1,
result = Array(set.size);
set.forEach(function (value) {
result[++index] = value;
});
return result;
}
|
Converts `set` to an array of its values.
@private
@param {Object} set The set to convert.
@returns {Array} Returns the values.
|
setToArray
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
switch (tag) {
case dataViewTag:
if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
return false;
}
object = object.buffer;
other = other.buffer;
case arrayBufferTag:
if (object.byteLength != other.byteLength || !equalFunc(new _Uint8Array(object), new _Uint8Array(other))) {
return false;
}
return true;
case boolTag:
case dateTag:
case numberTag:
// Coerce booleans to `1` or `0` and dates to milliseconds.
// Invalid dates are coerced to `NaN`.
return eq_1(+object, +other);
case errorTag:
return object.name == other.name && object.message == other.message;
case regexpTag:
case stringTag:
// Coerce regexes to strings and treat strings, primitives and objects,
// as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
// for more details.
return object == other + '';
case mapTag:
var convert = _mapToArray;
case setTag:
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1;
convert || (convert = _setToArray);
if (object.size != other.size && !isPartial) {
return false;
} // Assume cyclic values are equal.
var stacked = stack.get(object);
if (stacked) {
return stacked == other;
}
bitmask |= COMPARE_UNORDERED_FLAG$1; // Recursively compare objects (susceptible to call stack limits).
stack.set(object, other);
var result = _equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
stack['delete'](object);
return result;
case symbolTag:
if (symbolValueOf) {
return symbolValueOf.call(object) == symbolValueOf.call(other);
}
}
return false;
}
|
A specialized version of `baseIsEqualDeep` for comparing objects of
the same `toStringTag`.
**Note:** This function only supports comparing values with tags of
`Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
@private
@param {Object} object The object to compare.
@param {Object} other The other object to compare.
@param {string} tag The `toStringTag` of the objects to compare.
@param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
@param {Function} customizer The function to customize comparisons.
@param {Function} equalFunc The function to determine equivalents of values.
@param {Object} stack Tracks traversed `object` and `other` objects.
@returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
equalByTag
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function arrayPush(array, values) {
var index = -1,
length = values.length,
offset = array.length;
while (++index < length) {
array[offset + index] = values[index];
}
return array;
}
|
Appends the elements of `values` to `array`.
@private
@param {Array} array The array to modify.
@param {Array} values The values to append.
@returns {Array} Returns `array`.
|
arrayPush
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
var result = keysFunc(object);
return isArray_1(object) ? result : _arrayPush(result, symbolsFunc(object));
}
|
The base implementation of `getAllKeys` and `getAllKeysIn` which uses
`keysFunc` and `symbolsFunc` to get the enumerable property names and
symbols of `object`.
@private
@param {Object} object The object to query.
@param {Function} keysFunc The function to get the keys of `object`.
@param {Function} symbolsFunc The function to get the symbols of `object`.
@returns {Array} Returns the array of property names and symbols.
|
baseGetAllKeys
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function arrayFilter(array, predicate) {
var index = -1,
length = array == null ? 0 : array.length,
resIndex = 0,
result = [];
while (++index < length) {
var value = array[index];
if (predicate(value, index, array)) {
result[resIndex++] = value;
}
}
return result;
}
|
A specialized version of `_.filter` for arrays without support for
iteratee shorthands.
@private
@param {Array} [array] The array to iterate over.
@param {Function} predicate The function invoked per iteration.
@returns {Array} Returns the new filtered array.
|
arrayFilter
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function stubArray() {
return [];
}
|
This method returns a new empty array.
@static
@memberOf _
@since 4.13.0
@category Util
@returns {Array} Returns the new empty array.
@example
var arrays = _.times(2, _.stubArray);
console.log(arrays);
// => [[], []]
console.log(arrays[0] === arrays[1]);
// => false
|
stubArray
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function baseTimes(n, iteratee) {
var index = -1,
result = Array(n);
while (++index < n) {
result[index] = iteratee(index);
}
return result;
}
|
The base implementation of `_.times` without support for iteratee shorthands
or max array length checks.
@private
@param {number} n The number of times to invoke `iteratee`.
@param {Function} iteratee The function invoked per iteration.
@returns {Array} Returns the array of results.
|
baseTimes
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function isObjectLike(value) {
return value != null && typeof value == 'object';
}
|
Checks if `value` is object-like. A value is object-like if it's not `null`
and has a `typeof` result of "object".
@static
@memberOf _
@since 4.0.0
@category Lang
@param {*} value The value to check.
@returns {boolean} Returns `true` if `value` is object-like, else `false`.
@example
_.isObjectLike({});
// => true
_.isObjectLike([1, 2, 3]);
// => true
_.isObjectLike(_.noop);
// => false
_.isObjectLike(null);
// => false
|
isObjectLike
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function baseIsArguments(value) {
return isObjectLike_1(value) && _baseGetTag(value) == argsTag;
}
|
The base implementation of `_.isArguments`.
@private
@param {*} value The value to check.
@returns {boolean} Returns `true` if `value` is an `arguments` object,
|
baseIsArguments
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function stubFalse() {
return false;
}
|
This method returns `false`.
@static
@memberOf _
@since 4.13.0
@category Util
@returns {boolean} Returns `false`.
@example
_.times(2, _.stubFalse);
// => [false, false]
|
stubFalse
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function isIndex(value, length) {
var type = typeof value;
length = length == null ? MAX_SAFE_INTEGER$2 : length;
return !!length && (type == 'number' || type != 'symbol' && reIsUint.test(value)) && value > -1 && value % 1 == 0 && value < length;
}
|
Checks if `value` is a valid array-like index.
@private
@param {*} value The value to check.
@param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
@returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
isIndex
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function isLength(value) {
return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$3;
}
|
Checks if `value` is a valid array-like length.
**Note:** This method is loosely based on
[`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
@static
@memberOf _
@since 4.0.0
@category Lang
@param {*} value The value to check.
@returns {boolean} Returns `true` if `value` is a valid length, else `false`.
@example
_.isLength(3);
// => true
_.isLength(Number.MIN_VALUE);
// => false
_.isLength(Infinity);
// => false
_.isLength('3');
// => false
|
isLength
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function baseIsTypedArray(value) {
return isObjectLike_1(value) && isLength_1(value.length) && !!typedArrayTags[_baseGetTag(value)];
}
|
The base implementation of `_.isTypedArray` without Node.js optimizations.
@private
@param {*} value The value to check.
@returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
baseIsTypedArray
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function baseUnary(func) {
return function (value) {
return func(value);
};
}
|
The base implementation of `_.unary` without support for storing metadata.
@private
@param {Function} func The function to cap arguments for.
@returns {Function} Returns the new capped function.
|
baseUnary
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function arrayLikeKeys(value, inherited) {
var isArr = isArray_1(value),
isArg = !isArr && isArguments_1(value),
isBuff = !isArr && !isArg && isBuffer_1(value),
isType = !isArr && !isArg && !isBuff && isTypedArray_1(value),
skipIndexes = isArr || isArg || isBuff || isType,
result = skipIndexes ? _baseTimes(value.length, String) : [],
length = result.length;
for (var key in value) {
if ((inherited || hasOwnProperty$7.call(value, key)) && !(skipIndexes && ( // Safari 9 has enumerable `arguments.length` in strict mode.
key == 'length' || // Node.js 0.10 has enumerable non-index properties on buffers.
isBuff && (key == 'offset' || key == 'parent') || // PhantomJS 2 has enumerable non-index properties on typed arrays.
isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset') || // Skip index properties.
_isIndex(key, length)))) {
result.push(key);
}
}
return result;
}
|
Creates an array of the enumerable property names of the array-like `value`.
@private
@param {*} value The value to query.
@param {boolean} inherited Specify returning inherited property names.
@returns {Array} Returns the array of property names.
|
arrayLikeKeys
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function isPrototype(value) {
var Ctor = value && value.constructor,
proto = typeof Ctor == 'function' && Ctor.prototype || objectProto$8;
return value === proto;
}
|
Checks if `value` is likely a prototype object.
@private
@param {*} value The value to check.
@returns {boolean} Returns `true` if `value` is a prototype, else `false`.
|
isPrototype
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function overArg(func, transform) {
return function (arg) {
return func(transform(arg));
};
}
|
Creates a unary function that invokes `func` with its argument transformed.
@private
@param {Function} func The function to wrap.
@param {Function} transform The argument transform.
@returns {Function} Returns the new function.
|
overArg
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function baseKeys(object) {
if (!_isPrototype(object)) {
return _nativeKeys(object);
}
var result = [];
for (var key in Object(object)) {
if (hasOwnProperty$8.call(object, key) && key != 'constructor') {
result.push(key);
}
}
return result;
}
|
The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
@private
@param {Object} object The object to query.
@returns {Array} Returns the array of property names.
|
baseKeys
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function isArrayLike(value) {
return value != null && isLength_1(value.length) && !isFunction_1(value);
}
|
Checks if `value` is array-like. A value is considered array-like if it's
not a function and has a `value.length` that's an integer greater than or
equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
@static
@memberOf _
@since 4.0.0
@category Lang
@param {*} value The value to check.
@returns {boolean} Returns `true` if `value` is array-like, else `false`.
@example
_.isArrayLike([1, 2, 3]);
// => true
_.isArrayLike(document.body.children);
// => true
_.isArrayLike('abc');
// => true
_.isArrayLike(_.noop);
// => false
|
isArrayLike
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function keys(object) {
return isArrayLike_1(object) ? _arrayLikeKeys(object) : _baseKeys(object);
}
|
Creates an array of the own enumerable property names of `object`.
**Note:** Non-object values are coerced to objects. See the
[ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
for more details.
@static
@since 0.1.0
@memberOf _
@category Object
@param {Object} object The object to query.
@returns {Array} Returns the array of property names.
@example
function Foo() {
this.a = 1;
this.b = 2;
}
Foo.prototype.c = 3;
_.keys(new Foo);
// => ['a', 'b'] (iteration order is not guaranteed)
_.keys('hi');
// => ['0', '1']
|
keys
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function getAllKeys(object) {
return _baseGetAllKeys(object, keys_1, _getSymbols);
}
|
Creates an array of own enumerable property names and symbols of `object`.
@private
@param {Object} object The object to query.
@returns {Array} Returns the array of property names and symbols.
|
getAllKeys
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2,
objProps = _getAllKeys(object),
objLength = objProps.length,
othProps = _getAllKeys(other),
othLength = othProps.length;
if (objLength != othLength && !isPartial) {
return false;
}
var index = objLength;
while (index--) {
var key = objProps[index];
if (!(isPartial ? key in other : hasOwnProperty$9.call(other, key))) {
return false;
}
} // Assume cyclic values are equal.
var stacked = stack.get(object);
if (stacked && stack.get(other)) {
return stacked == other;
}
var result = true;
stack.set(object, other);
stack.set(other, object);
var skipCtor = isPartial;
while (++index < objLength) {
key = objProps[index];
var objValue = object[key],
othValue = other[key];
if (customizer) {
var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
} // Recursively compare objects (susceptible to call stack limits).
if (!(compared === undefined ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
result = false;
break;
}
skipCtor || (skipCtor = key == 'constructor');
}
if (result && !skipCtor) {
var objCtor = object.constructor,
othCtor = other.constructor; // Non `Object` object instances with different constructors are not equal.
if (objCtor != othCtor && 'constructor' in object && 'constructor' in other && !(typeof objCtor == 'function' && objCtor instanceof objCtor && typeof othCtor == 'function' && othCtor instanceof othCtor)) {
result = false;
}
}
stack['delete'](object);
stack['delete'](other);
return result;
}
|
A specialized version of `baseIsEqualDeep` for objects with support for
partial deep comparisons.
@private
@param {Object} object The object to compare.
@param {Object} other The other object to compare.
@param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
@param {Function} customizer The function to customize comparisons.
@param {Function} equalFunc The function to determine equivalents of values.
@param {Object} stack Tracks traversed `object` and `other` objects.
@returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
equalObjects
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
var objIsArr = isArray_1(object),
othIsArr = isArray_1(other),
objTag = objIsArr ? arrayTag$1 : _getTag(object),
othTag = othIsArr ? arrayTag$1 : _getTag(other);
objTag = objTag == argsTag$2 ? objectTag$2 : objTag;
othTag = othTag == argsTag$2 ? objectTag$2 : othTag;
var objIsObj = objTag == objectTag$2,
othIsObj = othTag == objectTag$2,
isSameTag = objTag == othTag;
if (isSameTag && isBuffer_1(object)) {
if (!isBuffer_1(other)) {
return false;
}
objIsArr = true;
objIsObj = false;
}
if (isSameTag && !objIsObj) {
stack || (stack = new _Stack());
return objIsArr || isTypedArray_1(object) ? _equalArrays(object, other, bitmask, customizer, equalFunc, stack) : _equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
}
if (!(bitmask & COMPARE_PARTIAL_FLAG$3)) {
var objIsWrapped = objIsObj && hasOwnProperty$a.call(object, '__wrapped__'),
othIsWrapped = othIsObj && hasOwnProperty$a.call(other, '__wrapped__');
if (objIsWrapped || othIsWrapped) {
var objUnwrapped = objIsWrapped ? object.value() : object,
othUnwrapped = othIsWrapped ? other.value() : other;
stack || (stack = new _Stack());
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
}
}
if (!isSameTag) {
return false;
}
stack || (stack = new _Stack());
return _equalObjects(object, other, bitmask, customizer, equalFunc, stack);
}
|
A specialized version of `baseIsEqual` for arrays and objects which performs
deep comparisons and tracks traversed objects enabling objects with circular
references to be compared.
@private
@param {Object} object The object to compare.
@param {Object} other The other object to compare.
@param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
@param {Function} customizer The function to customize comparisons.
@param {Function} equalFunc The function to determine equivalents of values.
@param {Object} [stack] Tracks traversed `object` and `other` objects.
@returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
baseIsEqualDeep
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function baseIsEqual(value, other, bitmask, customizer, stack) {
if (value === other) {
return true;
}
if (value == null || other == null || !isObjectLike_1(value) && !isObjectLike_1(other)) {
return value !== value && other !== other;
}
return _baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
}
|
The base implementation of `_.isEqual` which supports partial comparisons
and tracks traversed objects.
@private
@param {*} value The value to compare.
@param {*} other The other value to compare.
@param {boolean} bitmask The bitmask flags.
1 - Unordered comparison
2 - Partial comparison
@param {Function} [customizer] The function to customize comparisons.
@param {Object} [stack] Tracks traversed `value` and `other` objects.
@returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
baseIsEqual
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function baseIsMatch(object, source, matchData, customizer) {
var index = matchData.length,
length = index,
noCustomizer = !customizer;
if (object == null) {
return !length;
}
object = Object(object);
while (index--) {
var data = matchData[index];
if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
return false;
}
}
while (++index < length) {
data = matchData[index];
var key = data[0],
objValue = object[key],
srcValue = data[1];
if (noCustomizer && data[2]) {
if (objValue === undefined && !(key in object)) {
return false;
}
} else {
var stack = new _Stack();
if (customizer) {
var result = customizer(objValue, srcValue, key, object, source, stack);
}
if (!(result === undefined ? _baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$4 | COMPARE_UNORDERED_FLAG$2, customizer, stack) : result)) {
return false;
}
}
}
return true;
}
|
The base implementation of `_.isMatch` without support for iteratee shorthands.
@private
@param {Object} object The object to inspect.
@param {Object} source The object of property values to match.
@param {Array} matchData The property names, values, and compare flags to match.
@param {Function} [customizer] The function to customize comparisons.
@returns {boolean} Returns `true` if `object` is a match, else `false`.
|
baseIsMatch
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function isStrictComparable(value) {
return value === value && !isObject_1(value);
}
|
Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
@private
@param {*} value The value to check.
@returns {boolean} Returns `true` if `value` if suitable for strict
equality comparisons, else `false`.
|
isStrictComparable
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function getMatchData(object) {
var result = keys_1(object),
length = result.length;
while (length--) {
var key = result[length],
value = object[key];
result[length] = [key, value, _isStrictComparable(value)];
}
return result;
}
|
Gets the property names, values, and compare flags of `object`.
@private
@param {Object} object The object to query.
@returns {Array} Returns the match data of `object`.
|
getMatchData
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function matchesStrictComparable(key, srcValue) {
return function (object) {
if (object == null) {
return false;
}
return object[key] === srcValue && (srcValue !== undefined || key in Object(object));
};
}
|
A specialized version of `matchesProperty` for source values suitable
for strict equality comparisons, i.e. `===`.
@private
@param {string} key The key of the property to get.
@param {*} srcValue The value to match.
@returns {Function} Returns the new spec function.
|
matchesStrictComparable
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function baseMatches(source) {
var matchData = _getMatchData(source);
if (matchData.length == 1 && matchData[0][2]) {
return _matchesStrictComparable(matchData[0][0], matchData[0][1]);
}
return function (object) {
return object === source || _baseIsMatch(object, source, matchData);
};
}
|
The base implementation of `_.matches` which doesn't clone `source`.
@private
@param {Object} source The object of property values to match.
@returns {Function} Returns the new spec function.
|
baseMatches
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function isKey(value, object) {
if (isArray_1(value)) {
return false;
}
var type = typeof value;
if (type == 'number' || type == 'symbol' || type == 'boolean' || value == null || isSymbol_1(value)) {
return true;
}
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
}
|
Checks if `value` is a property name and not a property path.
@private
@param {*} value The value to check.
@param {Object} [object] The object to query keys on.
@returns {boolean} Returns `true` if `value` is a property name, else `false`.
|
isKey
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function memoize(func, resolver) {
if (typeof func != 'function' || resolver != null && typeof resolver != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
var memoized = function () {
var args = arguments,
key = resolver ? resolver.apply(this, args) : args[0],
cache = memoized.cache;
if (cache.has(key)) {
return cache.get(key);
}
var result = func.apply(this, args);
memoized.cache = cache.set(key, result) || cache;
return result;
};
memoized.cache = new (memoize.Cache || _MapCache)();
return memoized;
} // Expose `MapCache`.
|
Creates a function that memoizes the result of `func`. If `resolver` is
provided, it determines the cache key for storing the result based on the
arguments provided to the memoized function. By default, the first argument
provided to the memoized function is used as the map cache key. The `func`
is invoked with the `this` binding of the memoized function.
**Note:** The cache is exposed as the `cache` property on the memoized
function. Its creation may be customized by replacing the `_.memoize.Cache`
constructor with one whose instances implement the
[`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
method interface of `clear`, `delete`, `get`, `has`, and `set`.
@static
@memberOf _
@since 0.1.0
@category Function
@param {Function} func The function to have its output memoized.
@param {Function} [resolver] The function to resolve the cache key.
@returns {Function} Returns the new memoized function.
@example
var object = { 'a': 1, 'b': 2 };
var other = { 'c': 3, 'd': 4 };
var values = _.memoize(_.values);
values(object);
// => [1, 2]
values(other);
// => [3, 4]
object.a = 2;
values(object);
// => [1, 2]
// Modify the result cache.
values.cache.set(object, ['a', 'b']);
values(object);
// => ['a', 'b']
// Replace `_.memoize.Cache`.
_.memoize.Cache = WeakMap;
|
memoize
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
memoized = function () {
var args = arguments,
key = resolver ? resolver.apply(this, args) : args[0],
cache = memoized.cache;
if (cache.has(key)) {
return cache.get(key);
}
var result = func.apply(this, args);
memoized.cache = cache.set(key, result) || cache;
return result;
}
|
Creates a function that memoizes the result of `func`. If `resolver` is
provided, it determines the cache key for storing the result based on the
arguments provided to the memoized function. By default, the first argument
provided to the memoized function is used as the map cache key. The `func`
is invoked with the `this` binding of the memoized function.
**Note:** The cache is exposed as the `cache` property on the memoized
function. Its creation may be customized by replacing the `_.memoize.Cache`
constructor with one whose instances implement the
[`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
method interface of `clear`, `delete`, `get`, `has`, and `set`.
@static
@memberOf _
@since 0.1.0
@category Function
@param {Function} func The function to have its output memoized.
@param {Function} [resolver] The function to resolve the cache key.
@returns {Function} Returns the new memoized function.
@example
var object = { 'a': 1, 'b': 2 };
var other = { 'c': 3, 'd': 4 };
var values = _.memoize(_.values);
values(object);
// => [1, 2]
values(other);
// => [3, 4]
object.a = 2;
values(object);
// => [1, 2]
// Modify the result cache.
values.cache.set(object, ['a', 'b']);
values(object);
// => ['a', 'b']
// Replace `_.memoize.Cache`.
_.memoize.Cache = WeakMap;
|
memoized
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function memoizeCapped(func) {
var result = memoize_1(func, function (key) {
if (cache.size === MAX_MEMOIZE_SIZE) {
cache.clear();
}
return key;
});
var cache = result.cache;
return result;
}
|
A specialized version of `_.memoize` which clears the memoized function's
cache when it exceeds `MAX_MEMOIZE_SIZE`.
@private
@param {Function} func The function to have its output memoized.
@returns {Function} Returns the new memoized function.
|
memoizeCapped
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function arrayMap(array, iteratee) {
var index = -1,
length = array == null ? 0 : array.length,
result = Array(length);
while (++index < length) {
result[index] = iteratee(array[index], index, array);
}
return result;
}
|
A specialized version of `_.map` for arrays without support for iteratee
shorthands.
@private
@param {Array} [array] The array to iterate over.
@param {Function} iteratee The function invoked per iteration.
@returns {Array} Returns the new mapped array.
|
arrayMap
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function baseToString(value) {
// Exit early for strings to avoid a performance hit in some environments.
if (typeof value == 'string') {
return value;
}
if (isArray_1(value)) {
// Recursively convert values (susceptible to call stack limits).
return _arrayMap(value, baseToString) + '';
}
if (isSymbol_1(value)) {
return symbolToString ? symbolToString.call(value) : '';
}
var result = value + '';
return result == '0' && 1 / value == -INFINITY ? '-0' : result;
}
|
The base implementation of `_.toString` which doesn't convert nullish
values to empty strings.
@private
@param {*} value The value to process.
@returns {string} Returns the string.
|
baseToString
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function toString(value) {
return value == null ? '' : _baseToString(value);
}
|
Converts `value` to a string. An empty string is returned for `null`
and `undefined` values. The sign of `-0` is preserved.
@static
@memberOf _
@since 4.0.0
@category Lang
@param {*} value The value to convert.
@returns {string} Returns the converted string.
@example
_.toString(null);
// => ''
_.toString(-0);
// => '-0'
_.toString([1, 2, 3]);
// => '1,2,3'
|
toString
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function castPath(value, object) {
if (isArray_1(value)) {
return value;
}
return _isKey(value, object) ? [value] : _stringToPath(toString_1(value));
}
|
Casts `value` to a path array if it's not one.
@private
@param {*} value The value to inspect.
@param {Object} [object] The object to query keys on.
@returns {Array} Returns the cast property path array.
|
castPath
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function toKey(value) {
if (typeof value == 'string' || isSymbol_1(value)) {
return value;
}
var result = value + '';
return result == '0' && 1 / value == -INFINITY$1 ? '-0' : result;
}
|
Converts `value` to a string key if it's not a string or symbol.
@private
@param {*} value The value to inspect.
@returns {string|symbol} Returns the key.
|
toKey
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function baseGet(object, path) {
path = _castPath(path, object);
var index = 0,
length = path.length;
while (object != null && index < length) {
object = object[_toKey(path[index++])];
}
return index && index == length ? object : undefined;
}
|
The base implementation of `_.get` without support for default values.
@private
@param {Object} object The object to query.
@param {Array|string} path The path of the property to get.
@returns {*} Returns the resolved value.
|
baseGet
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function get$1(object, path, defaultValue) {
var result = object == null ? undefined : _baseGet(object, path);
return result === undefined ? defaultValue : result;
}
|
Gets the value at `path` of `object`. If the resolved value is
`undefined`, the `defaultValue` is returned in its place.
@static
@memberOf _
@since 3.7.0
@category Object
@param {Object} object The object to query.
@param {Array|string} path The path of the property to get.
@param {*} [defaultValue] The value returned for `undefined` resolved values.
@returns {*} Returns the resolved value.
@example
var object = { 'a': [{ 'b': { 'c': 3 } }] };
_.get(object, 'a[0].b.c');
// => 3
_.get(object, ['a', '0', 'b', 'c']);
// => 3
_.get(object, 'a.b.c', 'default');
// => 'default'
|
get$1
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function baseHasIn(object, key) {
return object != null && key in Object(object);
}
|
The base implementation of `_.hasIn` without support for deep paths.
@private
@param {Object} [object] The object to query.
@param {Array|string} key The key to check.
@returns {boolean} Returns `true` if `key` exists, else `false`.
|
baseHasIn
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function hasPath(object, path, hasFunc) {
path = _castPath(path, object);
var index = -1,
length = path.length,
result = false;
while (++index < length) {
var key = _toKey(path[index]);
if (!(result = object != null && hasFunc(object, key))) {
break;
}
object = object[key];
}
if (result || ++index != length) {
return result;
}
length = object == null ? 0 : object.length;
return !!length && isLength_1(length) && _isIndex(key, length) && (isArray_1(object) || isArguments_1(object));
}
|
Checks if `path` exists on `object`.
@private
@param {Object} object The object to query.
@param {Array|string} path The path to check.
@param {Function} hasFunc The function to check properties.
@returns {boolean} Returns `true` if `path` exists, else `false`.
|
hasPath
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function hasIn(object, path) {
return object != null && _hasPath(object, path, _baseHasIn);
}
|
Checks if `path` is a direct or inherited property of `object`.
@static
@memberOf _
@since 4.0.0
@category Object
@param {Object} object The object to query.
@param {Array|string} path The path to check.
@returns {boolean} Returns `true` if `path` exists, else `false`.
@example
var object = _.create({ 'a': _.create({ 'b': 2 }) });
_.hasIn(object, 'a');
// => true
_.hasIn(object, 'a.b');
// => true
_.hasIn(object, ['a', 'b']);
// => true
_.hasIn(object, 'b');
// => false
|
hasIn
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function baseMatchesProperty(path, srcValue) {
if (_isKey(path) && _isStrictComparable(srcValue)) {
return _matchesStrictComparable(_toKey(path), srcValue);
}
return function (object) {
var objValue = get_1(object, path);
return objValue === undefined && objValue === srcValue ? hasIn_1(object, path) : _baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$5 | COMPARE_UNORDERED_FLAG$3);
};
}
|
The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
@private
@param {string} path The path of the property to get.
@param {*} srcValue The value to match.
@returns {Function} Returns the new spec function.
|
baseMatchesProperty
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function identity(value) {
return value;
}
|
This method returns the first argument it receives.
@static
@since 0.1.0
@memberOf _
@category Util
@param {*} value Any value.
@returns {*} Returns `value`.
@example
var object = { 'a': 1 };
console.log(_.identity(object) === object);
// => true
|
identity
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function baseProperty(key) {
return function (object) {
return object == null ? undefined : object[key];
};
}
|
The base implementation of `_.property` without support for deep paths.
@private
@param {string} key The key of the property to get.
@returns {Function} Returns the new accessor function.
|
baseProperty
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function basePropertyDeep(path) {
return function (object) {
return _baseGet(object, path);
};
}
|
A specialized version of `baseProperty` which supports deep paths.
@private
@param {Array|string} path The path of the property to get.
@returns {Function} Returns the new accessor function.
|
basePropertyDeep
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function property(path) {
return _isKey(path) ? _baseProperty(_toKey(path)) : _basePropertyDeep(path);
}
|
Creates a function that returns the value at `path` of a given object.
@static
@memberOf _
@since 2.4.0
@category Util
@param {Array|string} path The path of the property to get.
@returns {Function} Returns the new accessor function.
@example
var objects = [
{ 'a': { 'b': 2 } },
{ 'a': { 'b': 1 } }
];
_.map(objects, _.property('a.b'));
// => [2, 1]
_.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
// => [1, 2]
|
property
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function baseIteratee(value) {
// Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
// See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
if (typeof value == 'function') {
return value;
}
if (value == null) {
return identity_1;
}
if (typeof value == 'object') {
return isArray_1(value) ? _baseMatchesProperty(value[0], value[1]) : _baseMatches(value);
}
return property_1(value);
}
|
The base implementation of `_.iteratee`.
@private
@param {*} [value=_.identity] The value to convert to an iteratee.
@returns {Function} Returns the iteratee.
|
baseIteratee
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function baseFindIndex(array, predicate, fromIndex, fromRight) {
var length = array.length,
index = fromIndex + (fromRight ? 1 : -1);
while (fromRight ? index-- : ++index < length) {
if (predicate(array[index], index, array)) {
return index;
}
}
return -1;
}
|
The base implementation of `_.findIndex` and `_.findLastIndex` without
support for iteratee shorthands.
@private
@param {Array} array The array to inspect.
@param {Function} predicate The function invoked per iteration.
@param {number} fromIndex The index to search from.
@param {boolean} [fromRight] Specify iterating from right to left.
@returns {number} Returns the index of the matched value, else `-1`.
|
baseFindIndex
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function baseIsNaN(value) {
return value !== value;
}
|
The base implementation of `_.isNaN` without support for number objects.
@private
@param {*} value The value to check.
@returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
|
baseIsNaN
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function strictIndexOf(array, value, fromIndex) {
var index = fromIndex - 1,
length = array.length;
while (++index < length) {
if (array[index] === value) {
return index;
}
}
return -1;
}
|
A specialized version of `_.indexOf` which performs strict equality
comparisons of values, i.e. `===`.
@private
@param {Array} array The array to inspect.
@param {*} value The value to search for.
@param {number} fromIndex The index to search from.
@returns {number} Returns the index of the matched value, else `-1`.
|
strictIndexOf
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function baseIndexOf(array, value, fromIndex) {
return value === value ? _strictIndexOf(array, value, fromIndex) : _baseFindIndex(array, _baseIsNaN, fromIndex);
}
|
The base implementation of `_.indexOf` without `fromIndex` bounds checks.
@private
@param {Array} array The array to inspect.
@param {*} value The value to search for.
@param {number} fromIndex The index to search from.
@returns {number} Returns the index of the matched value, else `-1`.
|
baseIndexOf
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function arrayIncludes(array, value) {
var length = array == null ? 0 : array.length;
return !!length && _baseIndexOf(array, value, 0) > -1;
}
|
A specialized version of `_.includes` for arrays without support for
specifying an index to search from.
@private
@param {Array} [array] The array to inspect.
@param {*} target The value to search for.
@returns {boolean} Returns `true` if `target` is found, else `false`.
|
arrayIncludes
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function arrayIncludesWith(array, value, comparator) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
if (comparator(value, array[index])) {
return true;
}
}
return false;
}
|
This function is like `arrayIncludes` except that it accepts a comparator.
@private
@param {Array} [array] The array to inspect.
@param {*} target The value to search for.
@param {Function} comparator The comparator invoked per element.
@returns {boolean} Returns `true` if `target` is found, else `false`.
|
arrayIncludesWith
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function baseUniq(array, iteratee, comparator) {
var index = -1,
includes = _arrayIncludes,
length = array.length,
isCommon = true,
result = [],
seen = result;
if (comparator) {
isCommon = false;
includes = _arrayIncludesWith;
} else if (length >= LARGE_ARRAY_SIZE$1) {
var set = iteratee ? null : _createSet(array);
if (set) {
return _setToArray(set);
}
isCommon = false;
includes = _cacheHas;
seen = new _SetCache();
} else {
seen = iteratee ? [] : result;
}
outer: while (++index < length) {
var value = array[index],
computed = iteratee ? iteratee(value) : value;
value = comparator || value !== 0 ? value : 0;
if (isCommon && computed === computed) {
var seenIndex = seen.length;
while (seenIndex--) {
if (seen[seenIndex] === computed) {
continue outer;
}
}
if (iteratee) {
seen.push(computed);
}
result.push(value);
} else if (!includes(seen, computed, comparator)) {
if (seen !== result) {
seen.push(computed);
}
result.push(value);
}
}
return result;
}
|
The base implementation of `_.uniqBy` without support for iteratee shorthands.
@private
@param {Array} array The array to inspect.
@param {Function} [iteratee] The iteratee invoked per element.
@param {Function} [comparator] The comparator invoked per element.
@returns {Array} Returns the new duplicate free array.
|
baseUniq
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function uniqBy(array, iteratee) {
return array && array.length ? _baseUniq(array, _baseIteratee(iteratee)) : [];
}
|
This method is like `_.uniq` except that it accepts `iteratee` which is
invoked for each element in `array` to generate the criterion by which
uniqueness is computed. The order of result values is determined by the
order they occur in the array. The iteratee is invoked with one argument:
(value).
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} array The array to inspect.
@param {Function} [iteratee=_.identity] The iteratee invoked per element.
@returns {Array} Returns the new duplicate free array.
@example
_.uniqBy([2.1, 1.2, 2.3], Math.floor);
// => [2.1, 1.2]
// The `_.property` iteratee shorthand.
_.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
// => [{ 'x': 1 }, { 'x': 2 }]
|
uniqBy
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function arrayAggregator(array, setter, iteratee, accumulator) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
var value = array[index];
setter(accumulator, value, iteratee(value), array);
}
return accumulator;
}
|
A specialized version of `baseAggregator` for arrays.
@private
@param {Array} [array] The array to iterate over.
@param {Function} setter The function to set `accumulator` values.
@param {Function} iteratee The iteratee to transform keys.
@param {Object} accumulator The initial aggregated object.
@returns {Function} Returns `accumulator`.
|
arrayAggregator
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function createBaseFor(fromRight) {
return function (object, iteratee, keysFunc) {
var index = -1,
iterable = Object(object),
props = keysFunc(object),
length = props.length;
while (length--) {
var key = props[fromRight ? length : ++index];
if (iteratee(iterable[key], key, iterable) === false) {
break;
}
}
return object;
};
}
|
Creates a base function for methods like `_.forIn` and `_.forOwn`.
@private
@param {boolean} [fromRight] Specify iterating from right to left.
@returns {Function} Returns the new base function.
|
createBaseFor
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function baseForOwn(object, iteratee) {
return object && _baseFor(object, iteratee, keys_1);
}
|
The base implementation of `_.forOwn` without support for iteratee shorthands.
@private
@param {Object} object The object to iterate over.
@param {Function} iteratee The function invoked per iteration.
@returns {Object} Returns `object`.
|
baseForOwn
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function createBaseEach(eachFunc, fromRight) {
return function (collection, iteratee) {
if (collection == null) {
return collection;
}
if (!isArrayLike_1(collection)) {
return eachFunc(collection, iteratee);
}
var length = collection.length,
index = fromRight ? length : -1,
iterable = Object(collection);
while (fromRight ? index-- : ++index < length) {
if (iteratee(iterable[index], index, iterable) === false) {
break;
}
}
return collection;
};
}
|
Creates a `baseEach` or `baseEachRight` function.
@private
@param {Function} eachFunc The function to iterate over a collection.
@param {boolean} [fromRight] Specify iterating from right to left.
@returns {Function} Returns the new base function.
|
createBaseEach
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function baseAggregator(collection, setter, iteratee, accumulator) {
_baseEach(collection, function (value, key, collection) {
setter(accumulator, value, iteratee(value), collection);
});
return accumulator;
}
|
Aggregates elements of `collection` on `accumulator` with keys transformed
by `iteratee` and values set by `setter`.
@private
@param {Array|Object} collection The collection to iterate over.
@param {Function} setter The function to set `accumulator` values.
@param {Function} iteratee The iteratee to transform keys.
@param {Object} accumulator The initial aggregated object.
@returns {Function} Returns `accumulator`.
|
baseAggregator
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function createAggregator(setter, initializer) {
return function (collection, iteratee) {
var func = isArray_1(collection) ? _arrayAggregator : _baseAggregator,
accumulator = initializer ? initializer() : {};
return func(collection, setter, _baseIteratee(iteratee), accumulator);
};
}
|
Creates a function like `_.groupBy`.
@private
@param {Function} setter The function to set accumulator values.
@param {Function} [initializer] The accumulator object initializer.
@returns {Function} Returns the new aggregator function.
|
createAggregator
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
arrayUnion = (...arguments_) => {
return [...new Set([].concat(...arguments_))];
}
|
Creates an array of elements split into two groups, the first of which
contains elements `predicate` returns truthy for, the second of which
contains elements `predicate` returns falsey for. The predicate is
invoked with one argument: (value).
@static
@memberOf _
@since 3.0.0
@category Collection
@param {Array|Object} collection The collection to iterate over.
@param {Function} [predicate=_.identity] The function invoked per iteration.
@returns {Array} Returns the array of grouped elements.
@example
var users = [
{ 'user': 'barney', 'age': 36, 'active': false },
{ 'user': 'fred', 'age': 40, 'active': true },
{ 'user': 'pebbles', 'age': 1, 'active': false }
];
_.partition(users, function(o) { return o.active; });
// => objects for [['fred'], ['barney', 'pebbles']]
// The `_.matches` iteratee shorthand.
_.partition(users, { 'age': 1, 'active': false });
// => objects for [['pebbles'], ['barney', 'fred']]
// The `_.matchesProperty` iteratee shorthand.
_.partition(users, ['active', false]);
// => objects for [['barney', 'pebbles'], ['fred']]
// The `_.property` iteratee shorthand.
_.partition(users, 'active');
// => objects for [['fred'], ['barney', 'pebbles']]
|
arrayUnion
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function merge2() {
const streamsQueue = [];
let merging = false;
const args = slice.call(arguments);
let options = args[args.length - 1];
if (options && !Array.isArray(options) && options.pipe == null) args.pop();else options = {};
const doEnd = options.end !== false;
if (options.objectMode == null) options.objectMode = true;
if (options.highWaterMark == null) options.highWaterMark = 64 * 1024;
const mergedStream = PassThrough(options);
function addStream() {
for (let i = 0, len = arguments.length; i < len; i++) {
streamsQueue.push(pauseStreams(arguments[i], options));
}
mergeStream();
return this;
}
function mergeStream() {
if (merging) return;
merging = true;
let streams = streamsQueue.shift();
if (!streams) {
process.nextTick(endStream);
return;
}
if (!Array.isArray(streams)) streams = [streams];
let pipesCount = streams.length + 1;
function next() {
if (--pipesCount > 0) return;
merging = false;
mergeStream();
}
function pipe(stream) {
function onend() {
stream.removeListener('merge2UnpipeEnd', onend);
stream.removeListener('end', onend);
next();
} // skip ended stream
if (stream._readableState.endEmitted) return next();
stream.on('merge2UnpipeEnd', onend);
stream.on('end', onend);
stream.pipe(mergedStream, {
end: false
}); // compatible for old stream
stream.resume();
}
for (let i = 0; i < streams.length; i++) pipe(streams[i]);
next();
}
function endStream() {
merging = false; // emit 'queueDrain' when all streams merged.
mergedStream.emit('queueDrain');
return doEnd && mergedStream.end();
}
mergedStream.setMaxListeners(0);
mergedStream.add = addStream;
mergedStream.on('unpipe', function (stream) {
stream.emit('merge2UnpipeEnd');
});
if (args.length) addStream.apply(null, args);
return mergedStream;
} // check and pause streams for pipe.
|
Creates an array of elements split into two groups, the first of which
contains elements `predicate` returns truthy for, the second of which
contains elements `predicate` returns falsey for. The predicate is
invoked with one argument: (value).
@static
@memberOf _
@since 3.0.0
@category Collection
@param {Array|Object} collection The collection to iterate over.
@param {Function} [predicate=_.identity] The function invoked per iteration.
@returns {Array} Returns the array of grouped elements.
@example
var users = [
{ 'user': 'barney', 'age': 36, 'active': false },
{ 'user': 'fred', 'age': 40, 'active': true },
{ 'user': 'pebbles', 'age': 1, 'active': false }
];
_.partition(users, function(o) { return o.active; });
// => objects for [['fred'], ['barney', 'pebbles']]
// The `_.matches` iteratee shorthand.
_.partition(users, { 'age': 1, 'active': false });
// => objects for [['pebbles'], ['barney', 'fred']]
// The `_.matchesProperty` iteratee shorthand.
_.partition(users, ['active', false]);
// => objects for [['barney', 'pebbles'], ['fred']]
// The `_.property` iteratee shorthand.
_.partition(users, 'active');
// => objects for [['fred'], ['barney', 'pebbles']]
|
merge2
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function addStream() {
for (let i = 0, len = arguments.length; i < len; i++) {
streamsQueue.push(pauseStreams(arguments[i], options));
}
mergeStream();
return this;
}
|
Creates an array of elements split into two groups, the first of which
contains elements `predicate` returns truthy for, the second of which
contains elements `predicate` returns falsey for. The predicate is
invoked with one argument: (value).
@static
@memberOf _
@since 3.0.0
@category Collection
@param {Array|Object} collection The collection to iterate over.
@param {Function} [predicate=_.identity] The function invoked per iteration.
@returns {Array} Returns the array of grouped elements.
@example
var users = [
{ 'user': 'barney', 'age': 36, 'active': false },
{ 'user': 'fred', 'age': 40, 'active': true },
{ 'user': 'pebbles', 'age': 1, 'active': false }
];
_.partition(users, function(o) { return o.active; });
// => objects for [['fred'], ['barney', 'pebbles']]
// The `_.matches` iteratee shorthand.
_.partition(users, { 'age': 1, 'active': false });
// => objects for [['pebbles'], ['barney', 'fred']]
// The `_.matchesProperty` iteratee shorthand.
_.partition(users, ['active', false]);
// => objects for [['barney', 'pebbles'], ['fred']]
// The `_.property` iteratee shorthand.
_.partition(users, 'active');
// => objects for [['fred'], ['barney', 'pebbles']]
|
addStream
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function mergeStream() {
if (merging) return;
merging = true;
let streams = streamsQueue.shift();
if (!streams) {
process.nextTick(endStream);
return;
}
if (!Array.isArray(streams)) streams = [streams];
let pipesCount = streams.length + 1;
function next() {
if (--pipesCount > 0) return;
merging = false;
mergeStream();
}
function pipe(stream) {
function onend() {
stream.removeListener('merge2UnpipeEnd', onend);
stream.removeListener('end', onend);
next();
} // skip ended stream
if (stream._readableState.endEmitted) return next();
stream.on('merge2UnpipeEnd', onend);
stream.on('end', onend);
stream.pipe(mergedStream, {
end: false
}); // compatible for old stream
stream.resume();
}
for (let i = 0; i < streams.length; i++) pipe(streams[i]);
next();
}
|
Creates an array of elements split into two groups, the first of which
contains elements `predicate` returns truthy for, the second of which
contains elements `predicate` returns falsey for. The predicate is
invoked with one argument: (value).
@static
@memberOf _
@since 3.0.0
@category Collection
@param {Array|Object} collection The collection to iterate over.
@param {Function} [predicate=_.identity] The function invoked per iteration.
@returns {Array} Returns the array of grouped elements.
@example
var users = [
{ 'user': 'barney', 'age': 36, 'active': false },
{ 'user': 'fred', 'age': 40, 'active': true },
{ 'user': 'pebbles', 'age': 1, 'active': false }
];
_.partition(users, function(o) { return o.active; });
// => objects for [['fred'], ['barney', 'pebbles']]
// The `_.matches` iteratee shorthand.
_.partition(users, { 'age': 1, 'active': false });
// => objects for [['pebbles'], ['barney', 'fred']]
// The `_.matchesProperty` iteratee shorthand.
_.partition(users, ['active', false]);
// => objects for [['barney', 'pebbles'], ['fred']]
// The `_.property` iteratee shorthand.
_.partition(users, 'active');
// => objects for [['fred'], ['barney', 'pebbles']]
|
mergeStream
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function next() {
if (--pipesCount > 0) return;
merging = false;
mergeStream();
}
|
Creates an array of elements split into two groups, the first of which
contains elements `predicate` returns truthy for, the second of which
contains elements `predicate` returns falsey for. The predicate is
invoked with one argument: (value).
@static
@memberOf _
@since 3.0.0
@category Collection
@param {Array|Object} collection The collection to iterate over.
@param {Function} [predicate=_.identity] The function invoked per iteration.
@returns {Array} Returns the array of grouped elements.
@example
var users = [
{ 'user': 'barney', 'age': 36, 'active': false },
{ 'user': 'fred', 'age': 40, 'active': true },
{ 'user': 'pebbles', 'age': 1, 'active': false }
];
_.partition(users, function(o) { return o.active; });
// => objects for [['fred'], ['barney', 'pebbles']]
// The `_.matches` iteratee shorthand.
_.partition(users, { 'age': 1, 'active': false });
// => objects for [['pebbles'], ['barney', 'fred']]
// The `_.matchesProperty` iteratee shorthand.
_.partition(users, ['active', false]);
// => objects for [['barney', 'pebbles'], ['fred']]
// The `_.property` iteratee shorthand.
_.partition(users, 'active');
// => objects for [['fred'], ['barney', 'pebbles']]
|
next
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function pipe(stream) {
function onend() {
stream.removeListener('merge2UnpipeEnd', onend);
stream.removeListener('end', onend);
next();
} // skip ended stream
if (stream._readableState.endEmitted) return next();
stream.on('merge2UnpipeEnd', onend);
stream.on('end', onend);
stream.pipe(mergedStream, {
end: false
}); // compatible for old stream
stream.resume();
}
|
Creates an array of elements split into two groups, the first of which
contains elements `predicate` returns truthy for, the second of which
contains elements `predicate` returns falsey for. The predicate is
invoked with one argument: (value).
@static
@memberOf _
@since 3.0.0
@category Collection
@param {Array|Object} collection The collection to iterate over.
@param {Function} [predicate=_.identity] The function invoked per iteration.
@returns {Array} Returns the array of grouped elements.
@example
var users = [
{ 'user': 'barney', 'age': 36, 'active': false },
{ 'user': 'fred', 'age': 40, 'active': true },
{ 'user': 'pebbles', 'age': 1, 'active': false }
];
_.partition(users, function(o) { return o.active; });
// => objects for [['fred'], ['barney', 'pebbles']]
// The `_.matches` iteratee shorthand.
_.partition(users, { 'age': 1, 'active': false });
// => objects for [['pebbles'], ['barney', 'fred']]
// The `_.matchesProperty` iteratee shorthand.
_.partition(users, ['active', false]);
// => objects for [['barney', 'pebbles'], ['fred']]
// The `_.property` iteratee shorthand.
_.partition(users, 'active');
// => objects for [['fred'], ['barney', 'pebbles']]
|
pipe
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function onend() {
stream.removeListener('merge2UnpipeEnd', onend);
stream.removeListener('end', onend);
next();
} // skip ended stream
|
Creates an array of elements split into two groups, the first of which
contains elements `predicate` returns truthy for, the second of which
contains elements `predicate` returns falsey for. The predicate is
invoked with one argument: (value).
@static
@memberOf _
@since 3.0.0
@category Collection
@param {Array|Object} collection The collection to iterate over.
@param {Function} [predicate=_.identity] The function invoked per iteration.
@returns {Array} Returns the array of grouped elements.
@example
var users = [
{ 'user': 'barney', 'age': 36, 'active': false },
{ 'user': 'fred', 'age': 40, 'active': true },
{ 'user': 'pebbles', 'age': 1, 'active': false }
];
_.partition(users, function(o) { return o.active; });
// => objects for [['fred'], ['barney', 'pebbles']]
// The `_.matches` iteratee shorthand.
_.partition(users, { 'age': 1, 'active': false });
// => objects for [['pebbles'], ['barney', 'fred']]
// The `_.matchesProperty` iteratee shorthand.
_.partition(users, ['active', false]);
// => objects for [['barney', 'pebbles'], ['fred']]
// The `_.property` iteratee shorthand.
_.partition(users, 'active');
// => objects for [['fred'], ['barney', 'pebbles']]
|
onend
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function endStream() {
merging = false; // emit 'queueDrain' when all streams merged.
mergedStream.emit('queueDrain');
return doEnd && mergedStream.end();
}
|
Creates an array of elements split into two groups, the first of which
contains elements `predicate` returns truthy for, the second of which
contains elements `predicate` returns falsey for. The predicate is
invoked with one argument: (value).
@static
@memberOf _
@since 3.0.0
@category Collection
@param {Array|Object} collection The collection to iterate over.
@param {Function} [predicate=_.identity] The function invoked per iteration.
@returns {Array} Returns the array of grouped elements.
@example
var users = [
{ 'user': 'barney', 'age': 36, 'active': false },
{ 'user': 'fred', 'age': 40, 'active': true },
{ 'user': 'pebbles', 'age': 1, 'active': false }
];
_.partition(users, function(o) { return o.active; });
// => objects for [['fred'], ['barney', 'pebbles']]
// The `_.matches` iteratee shorthand.
_.partition(users, { 'age': 1, 'active': false });
// => objects for [['pebbles'], ['barney', 'fred']]
// The `_.matchesProperty` iteratee shorthand.
_.partition(users, ['active', false]);
// => objects for [['barney', 'pebbles'], ['fred']]
// The `_.property` iteratee shorthand.
_.partition(users, 'active');
// => objects for [['fred'], ['barney', 'pebbles']]
|
endStream
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function pauseStreams(streams, options) {
if (!Array.isArray(streams)) {
// Backwards-compat with old-style streams
if (!streams._readableState && streams.pipe) streams = streams.pipe(PassThrough(options));
if (!streams._readableState || !streams.pause || !streams.pipe) {
throw new Error('Only readable stream can be merged.');
}
streams.pause();
} else {
for (let i = 0, len = streams.length; i < len; i++) streams[i] = pauseStreams(streams[i], options);
}
return streams;
}
|
Creates an array of elements split into two groups, the first of which
contains elements `predicate` returns truthy for, the second of which
contains elements `predicate` returns falsey for. The predicate is
invoked with one argument: (value).
@static
@memberOf _
@since 3.0.0
@category Collection
@param {Array|Object} collection The collection to iterate over.
@param {Function} [predicate=_.identity] The function invoked per iteration.
@returns {Array} Returns the array of grouped elements.
@example
var users = [
{ 'user': 'barney', 'age': 36, 'active': false },
{ 'user': 'fred', 'age': 40, 'active': true },
{ 'user': 'pebbles', 'age': 1, 'active': false }
];
_.partition(users, function(o) { return o.active; });
// => objects for [['fred'], ['barney', 'pebbles']]
// The `_.matches` iteratee shorthand.
_.partition(users, { 'age': 1, 'active': false });
// => objects for [['pebbles'], ['barney', 'fred']]
// The `_.matchesProperty` iteratee shorthand.
_.partition(users, ['active', false]);
// => objects for [['barney', 'pebbles'], ['fred']]
// The `_.property` iteratee shorthand.
_.partition(users, 'active');
// => objects for [['fred'], ['barney', 'pebbles']]
|
pauseStreams
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function flatten(items) {
return items.reduce((collection, item) => [].concat(collection, item), []);
}
|
Creates an array of elements split into two groups, the first of which
contains elements `predicate` returns truthy for, the second of which
contains elements `predicate` returns falsey for. The predicate is
invoked with one argument: (value).
@static
@memberOf _
@since 3.0.0
@category Collection
@param {Array|Object} collection The collection to iterate over.
@param {Function} [predicate=_.identity] The function invoked per iteration.
@returns {Array} Returns the array of grouped elements.
@example
var users = [
{ 'user': 'barney', 'age': 36, 'active': false },
{ 'user': 'fred', 'age': 40, 'active': true },
{ 'user': 'pebbles', 'age': 1, 'active': false }
];
_.partition(users, function(o) { return o.active; });
// => objects for [['fred'], ['barney', 'pebbles']]
// The `_.matches` iteratee shorthand.
_.partition(users, { 'age': 1, 'active': false });
// => objects for [['pebbles'], ['barney', 'fred']]
// The `_.matchesProperty` iteratee shorthand.
_.partition(users, ['active', false]);
// => objects for [['barney', 'pebbles'], ['fred']]
// The `_.property` iteratee shorthand.
_.partition(users, 'active');
// => objects for [['fred'], ['barney', 'pebbles']]
|
flatten
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function splitWhen(items, predicate) {
const result = [[]];
let groupIndex = 0;
for (const item of items) {
if (predicate(item)) {
groupIndex++;
result[groupIndex] = [];
} else {
result[groupIndex].push(item);
}
}
return result;
}
|
Creates an array of elements split into two groups, the first of which
contains elements `predicate` returns truthy for, the second of which
contains elements `predicate` returns falsey for. The predicate is
invoked with one argument: (value).
@static
@memberOf _
@since 3.0.0
@category Collection
@param {Array|Object} collection The collection to iterate over.
@param {Function} [predicate=_.identity] The function invoked per iteration.
@returns {Array} Returns the array of grouped elements.
@example
var users = [
{ 'user': 'barney', 'age': 36, 'active': false },
{ 'user': 'fred', 'age': 40, 'active': true },
{ 'user': 'pebbles', 'age': 1, 'active': false }
];
_.partition(users, function(o) { return o.active; });
// => objects for [['fred'], ['barney', 'pebbles']]
// The `_.matches` iteratee shorthand.
_.partition(users, { 'age': 1, 'active': false });
// => objects for [['pebbles'], ['barney', 'fred']]
// The `_.matchesProperty` iteratee shorthand.
_.partition(users, ['active', false]);
// => objects for [['barney', 'pebbles'], ['fred']]
// The `_.property` iteratee shorthand.
_.partition(users, 'active');
// => objects for [['fred'], ['barney', 'pebbles']]
|
splitWhen
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function isEnoentCodeError(error) {
return error.code === 'ENOENT';
}
|
Creates an array of elements split into two groups, the first of which
contains elements `predicate` returns truthy for, the second of which
contains elements `predicate` returns falsey for. The predicate is
invoked with one argument: (value).
@static
@memberOf _
@since 3.0.0
@category Collection
@param {Array|Object} collection The collection to iterate over.
@param {Function} [predicate=_.identity] The function invoked per iteration.
@returns {Array} Returns the array of grouped elements.
@example
var users = [
{ 'user': 'barney', 'age': 36, 'active': false },
{ 'user': 'fred', 'age': 40, 'active': true },
{ 'user': 'pebbles', 'age': 1, 'active': false }
];
_.partition(users, function(o) { return o.active; });
// => objects for [['fred'], ['barney', 'pebbles']]
// The `_.matches` iteratee shorthand.
_.partition(users, { 'age': 1, 'active': false });
// => objects for [['pebbles'], ['barney', 'fred']]
// The `_.matchesProperty` iteratee shorthand.
_.partition(users, ['active', false]);
// => objects for [['barney', 'pebbles'], ['fred']]
// The `_.property` iteratee shorthand.
_.partition(users, 'active');
// => objects for [['fred'], ['barney', 'pebbles']]
|
isEnoentCodeError
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
constructor(name, stats) {
this.name = name;
this.isBlockDevice = stats.isBlockDevice.bind(stats);
this.isCharacterDevice = stats.isCharacterDevice.bind(stats);
this.isDirectory = stats.isDirectory.bind(stats);
this.isFIFO = stats.isFIFO.bind(stats);
this.isFile = stats.isFile.bind(stats);
this.isSocket = stats.isSocket.bind(stats);
this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
}
|
Creates an array of elements split into two groups, the first of which
contains elements `predicate` returns truthy for, the second of which
contains elements `predicate` returns falsey for. The predicate is
invoked with one argument: (value).
@static
@memberOf _
@since 3.0.0
@category Collection
@param {Array|Object} collection The collection to iterate over.
@param {Function} [predicate=_.identity] The function invoked per iteration.
@returns {Array} Returns the array of grouped elements.
@example
var users = [
{ 'user': 'barney', 'age': 36, 'active': false },
{ 'user': 'fred', 'age': 40, 'active': true },
{ 'user': 'pebbles', 'age': 1, 'active': false }
];
_.partition(users, function(o) { return o.active; });
// => objects for [['fred'], ['barney', 'pebbles']]
// The `_.matches` iteratee shorthand.
_.partition(users, { 'age': 1, 'active': false });
// => objects for [['pebbles'], ['barney', 'fred']]
// The `_.matchesProperty` iteratee shorthand.
_.partition(users, ['active', false]);
// => objects for [['barney', 'pebbles'], ['fred']]
// The `_.property` iteratee shorthand.
_.partition(users, 'active');
// => objects for [['fred'], ['barney', 'pebbles']]
|
constructor
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function createDirentFromStats(name, stats) {
return new DirentFromStats(name, stats);
}
|
Creates an array of elements split into two groups, the first of which
contains elements `predicate` returns truthy for, the second of which
contains elements `predicate` returns falsey for. The predicate is
invoked with one argument: (value).
@static
@memberOf _
@since 3.0.0
@category Collection
@param {Array|Object} collection The collection to iterate over.
@param {Function} [predicate=_.identity] The function invoked per iteration.
@returns {Array} Returns the array of grouped elements.
@example
var users = [
{ 'user': 'barney', 'age': 36, 'active': false },
{ 'user': 'fred', 'age': 40, 'active': true },
{ 'user': 'pebbles', 'age': 1, 'active': false }
];
_.partition(users, function(o) { return o.active; });
// => objects for [['fred'], ['barney', 'pebbles']]
// The `_.matches` iteratee shorthand.
_.partition(users, { 'age': 1, 'active': false });
// => objects for [['pebbles'], ['barney', 'fred']]
// The `_.matchesProperty` iteratee shorthand.
_.partition(users, ['active', false]);
// => objects for [['barney', 'pebbles'], ['fred']]
// The `_.property` iteratee shorthand.
_.partition(users, 'active');
// => objects for [['fred'], ['barney', 'pebbles']]
|
createDirentFromStats
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function unixify(filepath) {
return filepath.replace(/\\/g, '/');
}
|
Designed to work only with simple paths: `dir\\file`.
|
unixify
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function makeAbsolute(cwd, filepath) {
return path$2.resolve(cwd, filepath);
}
|
Designed to work only with simple paths: `dir\\file`.
|
makeAbsolute
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function escape(pattern) {
return pattern.replace(UNESCAPED_GLOB_SYMBOLS_RE, '\\$2');
}
|
Designed to work only with simple paths: `dir\\file`.
|
escape
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function removeLeadingDotSegment(entry) {
// We do not use `startsWith` because this is 10x slower than current implementation for some cases.
// eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with
if (entry.charAt(0) === '.') {
const secondCharactery = entry.charAt(1);
if (secondCharactery === '/' || secondCharactery === '\\') {
return entry.slice(LEADING_DOT_SEGMENT_CHARACTERS_COUNT);
}
}
return entry;
}
|
Designed to work only with simple paths: `dir\\file`.
|
removeLeadingDotSegment
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
isExtglob = function isExtglob(str) {
if (typeof str !== 'string' || str === '') {
return false;
}
var match;
while (match = /(\\).|([@?!+*]\(.*\))/g.exec(str)) {
if (match[2]) return true;
str = str.slice(match.index + match[0].length);
}
return false;
}
|
Designed to work only with simple paths: `dir\\file`.
|
isExtglob
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
isGlob = function isGlob(str, options) {
if (typeof str !== 'string' || str === '') {
return false;
}
if (isExtglob(str)) {
return true;
}
var regex = strictRegex;
var match; // optionally relax regex
if (options && options.strict === false) {
regex = relaxedRegex;
}
while (match = regex.exec(str)) {
if (match[2]) return true;
var idx = match.index + match[0].length; // if an open bracket/brace/paren is escaped,
// set the index to the next closing character
var open = match[1];
var close = open ? chars[open] : null;
if (open && close) {
var n = str.indexOf(close, idx);
if (n !== -1) {
idx = n + 1;
}
}
str = str.slice(idx);
}
return false;
}
|
Designed to work only with simple paths: `dir\\file`.
|
isGlob
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
globParent = function globParent(str, opts) {
var options = Object.assign({
flipBackslashes: true
}, opts); // flip windows path separators
if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) {
str = str.replace(backslash, slash);
} // special case for strings ending in enclosure containing path separator
if (enclosure.test(str)) {
str += slash;
} // preserves full path in case of trailing path separator
str += 'a'; // remove path parts that are globby
do {
str = pathPosixDirname(str);
} while (isGlob(str) || globby.test(str)); // remove escape chars and return result
return str.replace(escaped, '$1');
}
|
@param {string} str
@param {Object} opts
@param {boolean} [opts.flipBackslashes=true]
|
globParent
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function rangeToPattern(start, stop, options) {
if (start === stop) {
return {
pattern: start,
count: [],
digits: 0
};
}
let zipped = zip(start, stop);
let digits = zipped.length;
let pattern = '';
let count = 0;
for (let i = 0; i < digits; i++) {
let [startDigit, stopDigit] = zipped[i];
if (startDigit === stopDigit) {
pattern += startDigit;
} else if (startDigit !== '0' || stopDigit !== '9') {
pattern += toCharacterClass(startDigit, stopDigit);
} else {
count++;
}
}
if (count) {
pattern += options.shorthand === true ? '\\d' : '[0-9]';
}
return {
pattern,
count: [count],
digits
};
}
|
Convert a range to a regex pattern
@param {Number} `start`
@param {Number} `stop`
@return {String}
|
rangeToPattern
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function splitToPatterns(min, max, tok, options) {
let ranges = splitToRanges(min, max);
let tokens = [];
let start = min;
let prev;
for (let i = 0; i < ranges.length; i++) {
let max = ranges[i];
let obj = rangeToPattern(String(start), String(max), options);
let zeros = '';
if (!tok.isPadded && prev && prev.pattern === obj.pattern) {
if (prev.count.length > 1) {
prev.count.pop();
}
prev.count.push(obj.count[0]);
prev.string = prev.pattern + toQuantifier(prev.count);
start = max + 1;
continue;
}
if (tok.isPadded) {
zeros = padZeros(max, tok, options);
}
obj.string = zeros + obj.pattern + toQuantifier(obj.count);
tokens.push(obj);
start = max + 1;
prev = obj;
}
return tokens;
}
|
Convert a range to a regex pattern
@param {Number} `start`
@param {Number} `stop`
@return {String}
|
splitToPatterns
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
function filterPatterns(arr, comparison, prefix, intersection, options) {
let result = [];
for (let ele of arr) {
let {
string
} = ele; // only push if _both_ are negative...
if (!intersection && !contains(comparison, 'string', string)) {
result.push(prefix + string);
} // or _both_ are positive
if (intersection && contains(comparison, 'string', string)) {
result.push(prefix + string);
}
}
return result;
}
|
Convert a range to a regex pattern
@param {Number} `start`
@param {Number} `stop`
@return {String}
|
filterPatterns
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
braces = (input, options = {}) => {
let output = [];
if (Array.isArray(input)) {
for (let pattern of input) {
let result = braces.create(pattern, options);
if (Array.isArray(result)) {
output.push(...result);
} else {
output.push(result);
}
}
} else {
output = [].concat(braces.create(input, options));
}
if (options && options.expand === true && options.nodupes === true) {
output = [...new Set(output)];
}
return output;
}
|
Expand the given pattern or create a regex-compatible string.
```js
const braces = require('braces');
console.log(braces('{a,b,c}', { compile: true })); //=> ['(a|b|c)']
console.log(braces('{a,b,c}')); //=> ['a', 'b', 'c']
```
@param {String} `str`
@param {Object} `options`
@return {String}
@api public
|
braces
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
braces = (input, options = {}) => {
let output = [];
if (Array.isArray(input)) {
for (let pattern of input) {
let result = braces.create(pattern, options);
if (Array.isArray(result)) {
output.push(...result);
} else {
output.push(result);
}
}
} else {
output = [].concat(braces.create(input, options));
}
if (options && options.expand === true && options.nodupes === true) {
output = [...new Set(output)];
}
return output;
}
|
Expand the given pattern or create a regex-compatible string.
```js
const braces = require('braces');
console.log(braces('{a,b,c}', { compile: true })); //=> ['(a|b|c)']
console.log(braces('{a,b,c}')); //=> ['a', 'b', 'c']
```
@param {String} `str`
@param {Object} `options`
@return {String}
@api public
|
braces
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
scan = (input, options) => {
const opts = options || {};
const length = input.length - 1;
const scanToEnd = opts.parts === true || opts.scanToEnd === true;
const slashes = [];
const tokens = [];
const parts = [];
let str = input;
let index = -1;
let start = 0;
let lastIndex = 0;
let isBrace = false;
let isBracket = false;
let isGlob = false;
let isExtglob = false;
let isGlobstar = false;
let braceEscaped = false;
let backslashes = false;
let negated = false;
let finished = false;
let braces = 0;
let prev;
let code;
let token = {
value: '',
depth: 0,
isGlob: false
};
const eos = () => index >= length;
const peek = () => str.charCodeAt(index + 1);
const advance = () => {
prev = code;
return str.charCodeAt(++index);
};
while (index < length) {
code = advance();
let next;
if (code === CHAR_BACKWARD_SLASH) {
backslashes = token.backslashes = true;
code = advance();
if (code === CHAR_LEFT_CURLY_BRACE$1) {
braceEscaped = true;
}
continue;
}
if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE$1) {
braces++;
while (eos() !== true && (code = advance())) {
if (code === CHAR_BACKWARD_SLASH) {
backslashes = token.backslashes = true;
advance();
continue;
}
if (code === CHAR_LEFT_CURLY_BRACE$1) {
braces++;
continue;
}
if (braceEscaped !== true && code === CHAR_DOT$1 && (code = advance()) === CHAR_DOT$1) {
isBrace = token.isBrace = true;
isGlob = token.isGlob = true;
finished = true;
if (scanToEnd === true) {
continue;
}
break;
}
if (braceEscaped !== true && code === CHAR_COMMA$2) {
isBrace = token.isBrace = true;
isGlob = token.isGlob = true;
finished = true;
if (scanToEnd === true) {
continue;
}
break;
}
if (code === CHAR_RIGHT_CURLY_BRACE$1) {
braces--;
if (braces === 0) {
braceEscaped = false;
isBrace = token.isBrace = true;
finished = true;
break;
}
}
}
if (scanToEnd === true) {
continue;
}
break;
}
if (code === CHAR_FORWARD_SLASH) {
slashes.push(index);
tokens.push(token);
token = {
value: '',
depth: 0,
isGlob: false
};
if (finished === true) continue;
if (prev === CHAR_DOT$1 && index === start + 1) {
start += 2;
continue;
}
lastIndex = index + 1;
continue;
}
if (opts.noext !== true) {
const isExtglobChar = code === CHAR_PLUS$1 || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES$1) {
isGlob = token.isGlob = true;
isExtglob = token.isExtglob = true;
finished = true;
if (scanToEnd === true) {
while (eos() !== true && (code = advance())) {
if (code === CHAR_BACKWARD_SLASH) {
backslashes = token.backslashes = true;
code = advance();
continue;
}
if (code === CHAR_RIGHT_PARENTHESES$1) {
isGlob = token.isGlob = true;
finished = true;
break;
}
}
continue;
}
break;
}
}
if (code === CHAR_ASTERISK) {
if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
isGlob = token.isGlob = true;
finished = true;
if (scanToEnd === true) {
continue;
}
break;
}
if (code === CHAR_QUESTION_MARK) {
isGlob = token.isGlob = true;
finished = true;
if (scanToEnd === true) {
continue;
}
break;
}
if (code === CHAR_LEFT_SQUARE_BRACKET$1) {
while (eos() !== true && (next = advance())) {
if (next === CHAR_BACKWARD_SLASH) {
backslashes = token.backslashes = true;
advance();
continue;
}
if (next === CHAR_RIGHT_SQUARE_BRACKET$1) {
isBracket = token.isBracket = true;
isGlob = token.isGlob = true;
finished = true;
if (scanToEnd === true) {
continue;
}
break;
}
}
}
if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
negated = token.negated = true;
start++;
continue;
}
if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES$1) {
while (eos() !== true && (code = advance())) {
if (code === CHAR_BACKWARD_SLASH) {
backslashes = token.backslashes = true;
code = advance();
continue;
}
if (code === CHAR_RIGHT_PARENTHESES$1) {
isGlob = token.isGlob = true;
finished = true;
if (scanToEnd === true) {
continue;
}
break;
}
}
}
if (isGlob === true) {
finished = true;
if (scanToEnd === true) {
continue;
}
break;
}
}
if (opts.noext === true) {
isExtglob = false;
isGlob = false;
}
let base = str;
let prefix = '';
let glob = '';
if (start > 0) {
prefix = str.slice(0, start);
str = str.slice(start);
lastIndex -= start;
}
if (base && isGlob === true && lastIndex > 0) {
base = str.slice(0, lastIndex);
glob = str.slice(lastIndex);
} else if (isGlob === true) {
base = '';
glob = str;
} else {
base = str;
}
if (base && base !== '' && base !== '/' && base !== str) {
if (isPathSeparator(base.charCodeAt(base.length - 1))) {
base = base.slice(0, -1);
}
}
if (opts.unescape === true) {
if (glob) glob = utils$3.removeBackslashes(glob);
if (base && backslashes === true) {
base = utils$3.removeBackslashes(base);
}
}
const state = {
prefix,
input,
start,
base,
glob,
isBrace,
isBracket,
isGlob,
isExtglob,
isGlobstar,
negated
};
if (opts.tokens === true) {
state.maxDepth = 0;
if (!isPathSeparator(code)) {
tokens.push(token);
}
state.tokens = tokens;
}
if (opts.parts === true || opts.tokens === true) {
let prevIndex;
for (let idx = 0; idx < slashes.length; idx++) {
const n = prevIndex ? prevIndex + 1 : start;
const i = slashes[idx];
const value = input.slice(n, i);
if (opts.tokens) {
if (idx === 0 && start !== 0) {
tokens[idx].isPrefix = true;
tokens[idx].value = prefix;
} else {
tokens[idx].value = value;
}
depth(tokens[idx]);
state.maxDepth += tokens[idx].depth;
}
if (idx !== 0 || value !== '') {
parts.push(value);
}
prevIndex = i;
}
if (prevIndex && prevIndex + 1 < input.length) {
const value = input.slice(prevIndex + 1);
parts.push(value);
if (opts.tokens) {
tokens[tokens.length - 1].value = value;
depth(tokens[tokens.length - 1]);
state.maxDepth += tokens[tokens.length - 1].depth;
}
}
state.slashes = slashes;
state.parts = parts;
}
return state;
}
|
Quickly scans a glob pattern and returns an object with a handful of
useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
`glob` (the actual pattern), and `negated` (true if the path starts with `!`).
```js
const pm = require('picomatch');
console.log(pm.scan('foo/bar/*.js'));
{ isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
```
@param {String} `str`
@param {Object} `options`
@return {Object} Returns an object with tokens and regex source string.
@api public
|
scan
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
scan = (input, options) => {
const opts = options || {};
const length = input.length - 1;
const scanToEnd = opts.parts === true || opts.scanToEnd === true;
const slashes = [];
const tokens = [];
const parts = [];
let str = input;
let index = -1;
let start = 0;
let lastIndex = 0;
let isBrace = false;
let isBracket = false;
let isGlob = false;
let isExtglob = false;
let isGlobstar = false;
let braceEscaped = false;
let backslashes = false;
let negated = false;
let finished = false;
let braces = 0;
let prev;
let code;
let token = {
value: '',
depth: 0,
isGlob: false
};
const eos = () => index >= length;
const peek = () => str.charCodeAt(index + 1);
const advance = () => {
prev = code;
return str.charCodeAt(++index);
};
while (index < length) {
code = advance();
let next;
if (code === CHAR_BACKWARD_SLASH) {
backslashes = token.backslashes = true;
code = advance();
if (code === CHAR_LEFT_CURLY_BRACE$1) {
braceEscaped = true;
}
continue;
}
if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE$1) {
braces++;
while (eos() !== true && (code = advance())) {
if (code === CHAR_BACKWARD_SLASH) {
backslashes = token.backslashes = true;
advance();
continue;
}
if (code === CHAR_LEFT_CURLY_BRACE$1) {
braces++;
continue;
}
if (braceEscaped !== true && code === CHAR_DOT$1 && (code = advance()) === CHAR_DOT$1) {
isBrace = token.isBrace = true;
isGlob = token.isGlob = true;
finished = true;
if (scanToEnd === true) {
continue;
}
break;
}
if (braceEscaped !== true && code === CHAR_COMMA$2) {
isBrace = token.isBrace = true;
isGlob = token.isGlob = true;
finished = true;
if (scanToEnd === true) {
continue;
}
break;
}
if (code === CHAR_RIGHT_CURLY_BRACE$1) {
braces--;
if (braces === 0) {
braceEscaped = false;
isBrace = token.isBrace = true;
finished = true;
break;
}
}
}
if (scanToEnd === true) {
continue;
}
break;
}
if (code === CHAR_FORWARD_SLASH) {
slashes.push(index);
tokens.push(token);
token = {
value: '',
depth: 0,
isGlob: false
};
if (finished === true) continue;
if (prev === CHAR_DOT$1 && index === start + 1) {
start += 2;
continue;
}
lastIndex = index + 1;
continue;
}
if (opts.noext !== true) {
const isExtglobChar = code === CHAR_PLUS$1 || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES$1) {
isGlob = token.isGlob = true;
isExtglob = token.isExtglob = true;
finished = true;
if (scanToEnd === true) {
while (eos() !== true && (code = advance())) {
if (code === CHAR_BACKWARD_SLASH) {
backslashes = token.backslashes = true;
code = advance();
continue;
}
if (code === CHAR_RIGHT_PARENTHESES$1) {
isGlob = token.isGlob = true;
finished = true;
break;
}
}
continue;
}
break;
}
}
if (code === CHAR_ASTERISK) {
if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
isGlob = token.isGlob = true;
finished = true;
if (scanToEnd === true) {
continue;
}
break;
}
if (code === CHAR_QUESTION_MARK) {
isGlob = token.isGlob = true;
finished = true;
if (scanToEnd === true) {
continue;
}
break;
}
if (code === CHAR_LEFT_SQUARE_BRACKET$1) {
while (eos() !== true && (next = advance())) {
if (next === CHAR_BACKWARD_SLASH) {
backslashes = token.backslashes = true;
advance();
continue;
}
if (next === CHAR_RIGHT_SQUARE_BRACKET$1) {
isBracket = token.isBracket = true;
isGlob = token.isGlob = true;
finished = true;
if (scanToEnd === true) {
continue;
}
break;
}
}
}
if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
negated = token.negated = true;
start++;
continue;
}
if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES$1) {
while (eos() !== true && (code = advance())) {
if (code === CHAR_BACKWARD_SLASH) {
backslashes = token.backslashes = true;
code = advance();
continue;
}
if (code === CHAR_RIGHT_PARENTHESES$1) {
isGlob = token.isGlob = true;
finished = true;
if (scanToEnd === true) {
continue;
}
break;
}
}
}
if (isGlob === true) {
finished = true;
if (scanToEnd === true) {
continue;
}
break;
}
}
if (opts.noext === true) {
isExtglob = false;
isGlob = false;
}
let base = str;
let prefix = '';
let glob = '';
if (start > 0) {
prefix = str.slice(0, start);
str = str.slice(start);
lastIndex -= start;
}
if (base && isGlob === true && lastIndex > 0) {
base = str.slice(0, lastIndex);
glob = str.slice(lastIndex);
} else if (isGlob === true) {
base = '';
glob = str;
} else {
base = str;
}
if (base && base !== '' && base !== '/' && base !== str) {
if (isPathSeparator(base.charCodeAt(base.length - 1))) {
base = base.slice(0, -1);
}
}
if (opts.unescape === true) {
if (glob) glob = utils$3.removeBackslashes(glob);
if (base && backslashes === true) {
base = utils$3.removeBackslashes(base);
}
}
const state = {
prefix,
input,
start,
base,
glob,
isBrace,
isBracket,
isGlob,
isExtglob,
isGlobstar,
negated
};
if (opts.tokens === true) {
state.maxDepth = 0;
if (!isPathSeparator(code)) {
tokens.push(token);
}
state.tokens = tokens;
}
if (opts.parts === true || opts.tokens === true) {
let prevIndex;
for (let idx = 0; idx < slashes.length; idx++) {
const n = prevIndex ? prevIndex + 1 : start;
const i = slashes[idx];
const value = input.slice(n, i);
if (opts.tokens) {
if (idx === 0 && start !== 0) {
tokens[idx].isPrefix = true;
tokens[idx].value = prefix;
} else {
tokens[idx].value = value;
}
depth(tokens[idx]);
state.maxDepth += tokens[idx].depth;
}
if (idx !== 0 || value !== '') {
parts.push(value);
}
prevIndex = i;
}
if (prevIndex && prevIndex + 1 < input.length) {
const value = input.slice(prevIndex + 1);
parts.push(value);
if (opts.tokens) {
tokens[tokens.length - 1].value = value;
depth(tokens[tokens.length - 1]);
state.maxDepth += tokens[tokens.length - 1].depth;
}
}
state.slashes = slashes;
state.parts = parts;
}
return state;
}
|
Quickly scans a glob pattern and returns an object with a handful of
useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
`glob` (the actual pattern), and `negated` (true if the path starts with `!`).
```js
const pm = require('picomatch');
console.log(pm.scan('foo/bar/*.js'));
{ isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
```
@param {String} `str`
@param {Object} `options`
@return {Object} Returns an object with tokens and regex source string.
@api public
|
scan
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
advance = () => {
prev = code;
return str.charCodeAt(++index);
}
|
Quickly scans a glob pattern and returns an object with a handful of
useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
`glob` (the actual pattern), and `negated` (true if the path starts with `!`).
```js
const pm = require('picomatch');
console.log(pm.scan('foo/bar/*.js'));
{ isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
```
@param {String} `str`
@param {Object} `options`
@return {Object} Returns an object with tokens and regex source string.
@api public
|
advance
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
advance = () => {
prev = code;
return str.charCodeAt(++index);
}
|
Quickly scans a glob pattern and returns an object with a handful of
useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
`glob` (the actual pattern), and `negated` (true if the path starts with `!`).
```js
const pm = require('picomatch');
console.log(pm.scan('foo/bar/*.js'));
{ isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
```
@param {String} `str`
@param {Object} `options`
@return {Object} Returns an object with tokens and regex source string.
@api public
|
advance
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
syntaxError = (type, char) => {
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
}
|
Create the message for a syntax error
|
syntaxError
|
javascript
|
douyu/juno
|
assets/public/js/prettier/v2.0.5/index.js
|
https://github.com/douyu/juno/blob/master/assets/public/js/prettier/v2.0.5/index.js
|
Apache-2.0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.