code
stringlengths
10
343k
docstring
stringlengths
36
21.9k
func_name
stringlengths
1
3.35k
language
stringclasses
1 value
repo
stringlengths
7
58
path
stringlengths
4
131
url
stringlengths
44
195
license
stringclasses
5 values
function listCacheGet(key) { var data = this.__data__, index = assocIndexOf(data, key); return index < 0 ? undefined : data[index][1]; }
Gets the list cache value for `key`. @private @name get @memberOf ListCache @param {string} key The key of the value to get. @returns {*} Returns the entry value.
listCacheGet ( key )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function listCacheHas(key) { return assocIndexOf(this.__data__, key) > -1; }
Checks if a list cache value for `key` exists. @private @name has @memberOf ListCache @param {string} key The key of the entry to check. @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
listCacheHas ( key )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function listCacheSet(key, value) { var data = this.__data__, index = assocIndexOf(data, key); if (index < 0) { ++this.size; data.push([key, value]); } else { data[index][1] = value; } return this; }
Sets the list cache `key` to `value`. @private @name set @memberOf ListCache @param {string} key The key of the value to set. @param {*} value The value to set. @returns {Object} Returns the list cache instance.
listCacheSet ( key , value )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function stackClear() { this.__data__ = new ListCache(); this.size = 0; }
Removes all key-value entries from the stack. @private @name clear @memberOf Stack
stackClear ( )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function stackDelete(key) { var data = this.__data__, result = data['delete'](key); this.size = data.size; return result; }
Removes `key` and its value from the stack. @private @name delete @memberOf Stack @param {string} key The key of the value to remove. @returns {boolean} Returns `true` if the entry was removed, else `false`.
stackDelete ( key )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function stackGet(key) { return this.__data__.get(key); }
Gets the stack value for `key`. @private @name get @memberOf Stack @param {string} key The key of the value to get. @returns {*} Returns the entry value.
stackGet ( key )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function stackHas(key) { return this.__data__.has(key); }
Checks if a stack value for `key` exists. @private @name has @memberOf Stack @param {string} key The key of the entry to check. @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
stackHas ( key )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function stackSet(key, value) { var data = this.__data__; if (data instanceof ListCache) { var pairs = data.__data__; if (!Map || pairs.length < LARGE_ARRAY_SIZE - 1) { pairs.push([key, value]); this.size = ++data.size; return this; } data = this.__data__ = new MapCache(pairs); } data.set(key, value); this.size = data.size; return this; }
Sets the stack `key` to `value`. @private @name set @memberOf Stack @param {string} key The key of the value to set. @param {*} value The value to set. @returns {Object} Returns the stack cache instance.
stackSet ( key , value )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function baseIsNative(value) { if (!isObject(value) || isMasked(value)) { return false; } var pattern = isFunction(value) ? reIsNative : reIsHostCtor; return pattern.test(toSource(value)); }
The base implementation of `_.isNative` without bad shim checks. @private @param {*} value The value to check. @returns {boolean} Returns `true` if `value` is a native function, else `false`.
baseIsNative ( value )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function isMasked(func) { return !!maskSrcKey && maskSrcKey in func; }
Checks if `func` has its source masked. @private @param {Function} func The function to check. @returns {boolean} Returns `true` if `func` is masked, else `false`.
isMasked ( func )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function getValue(object, key) { return object == null ? undefined : object[key]; }
Gets the value at `key` of `object`. @private @param {Object} [object] The object to query. @param {string} key The key of the property to get. @returns {*} Returns the property value.
getValue ( object , key )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function MapCache(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } // Add methods to `MapCache`.
Creates a map cache object to store key-value pairs. @private @constructor @param {Array} [entries] The key-value pairs to cache.
MapCache ( entries )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function Hash(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } // Add methods to `Hash`.
Creates a hash object. @private @constructor @param {Array} [entries] The key-value pairs to cache.
Hash ( entries )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function hashClear() { this.__data__ = nativeCreate ? nativeCreate(null) : {}; this.size = 0; }
Removes all key-value entries from the hash. @private @name clear @memberOf Hash
hashClear ( )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function hashDelete(key) { var result = this.has(key) && delete this.__data__[key]; this.size -= result ? 1 : 0; return result; }
Removes `key` and its value from the hash. @private @name delete @memberOf Hash @param {Object} hash The hash to modify. @param {string} key The key of the value to remove. @returns {boolean} Returns `true` if the entry was removed, else `false`.
hashDelete ( key )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function hashGet(key) { var data = this.__data__; if (nativeCreate) { var result = data[key]; return result === HASH_UNDEFINED ? undefined : result; } return hasOwnProperty.call(data, key) ? data[key] : undefined; }
Gets the hash value for `key`. @private @name get @memberOf Hash @param {string} key The key of the value to get. @returns {*} Returns the entry value.
hashGet ( key )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function hashHas(key) { var data = this.__data__; return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key); }
Checks if a hash value for `key` exists. @private @name has @memberOf Hash @param {string} key The key of the entry to check. @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
hashHas ( key )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function hashSet(key, value) { var data = this.__data__; this.size += this.has(key) ? 0 : 1; data[key] = nativeCreate && value === undefined ? HASH_UNDEFINED : value; return this; }
Sets the hash `key` to `value`. @private @name set @memberOf Hash @param {string} key The key of the value to set. @param {*} value The value to set. @returns {Object} Returns the hash instance.
hashSet ( key , value )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function mapCacheDelete(key) { var result = getMapData(this, key)['delete'](key); this.size -= result ? 1 : 0; return result; }
Removes `key` and its value from the map. @private @name delete @memberOf MapCache @param {string} key The key of the value to remove. @returns {boolean} Returns `true` if the entry was removed, else `false`.
mapCacheDelete ( key )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function isKeyable(value) { var type = typeof value; return type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean' ? value !== '__proto__' : value === null; }
Checks if `value` is suitable for use as unique object key. @private @param {*} value The value to check. @returns {boolean} Returns `true` if `value` is suitable, else `false`.
isKeyable ( value )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function mapCacheGet(key) { return getMapData(this, key).get(key); }
Gets the map value for `key`. @private @name get @memberOf MapCache @param {string} key The key of the value to get. @returns {*} Returns the entry value.
mapCacheGet ( key )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function mapCacheHas(key) { return getMapData(this, key).has(key); }
Checks if a map value for `key` exists. @private @name has @memberOf MapCache @param {string} key The key of the entry to check. @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
mapCacheHas ( key )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function mapCacheSet(key, value) { var data = getMapData(this, key), size = data.size; data.set(key, value); this.size += data.size == size ? 0 : 1; return this; }
Sets the map `key` to `value`. @private @name set @memberOf MapCache @param {string} key The key of the value to set. @param {*} value The value to set. @returns {Object} Returns the map cache instance.
mapCacheSet ( key , value )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function baseAssign(object, source) { return object && copyObject(source, keys(source), object); }
The base implementation of `_.assign` without support for multiple sources or `customizer` functions. @private @param {Object} object The destination object. @param {Object} source The source object. @returns {Object} Returns `object`.
baseAssign ( object , source )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function baseAssignIn(object, source) { return object && copyObject(source, keysIn(source), object); }
The base implementation of `_.assignIn` without support for multiple sources or `customizer` functions. @private @param {Object} object The destination object. @param {Object} source The source object. @returns {Object} Returns `object`.
baseAssignIn ( object , source )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function baseKeysIn(object) { if (!isObject(object)) { return nativeKeysIn(object); } var isProto = isPrototype(object), result = []; for (var key in object) { if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { result.push(key); } } return result; }
The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. @private @param {Object} object The object to query. @returns {Array} Returns the array of property names.
baseKeysIn ( object )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function nativeKeysIn(object) { var result = []; if (object != null) { for (var key in Object(object)) { result.push(key); } } return result; }
This function is like [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) except that it includes inherited enumerable properties. @private @param {Object} object The object to query. @returns {Array} Returns the array of property names.
nativeKeysIn ( object )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function cloneBuffer(buffer, isDeep) { if (isDeep) { return buffer.slice(); } var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); buffer.copy(result); return result; }
Creates a clone of `buffer`. @private @param {Buffer} buffer The buffer to clone. @param {boolean} [isDeep] Specify a deep clone. @returns {Buffer} Returns the cloned buffer.
cloneBuffer ( buffer , isDeep )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function copyArray(source, array) { var index = -1, length = source.length; array || (array = Array(length)); while (++index < length) { array[index] = source[index]; } return array; }
Copies the values of `source` to `array`. @private @param {Array} source The array to copy values from. @param {Array} [array=[]] The array to copy values to. @returns {Array} Returns `array`.
copyArray ( source , array )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function copySymbols(source, object) { return copyObject(source, getSymbols(source), object); }
Copies own symbols of `source` to `object`. @private @param {Object} source The object to copy symbols from. @param {Object} [object={}] The object to copy symbols to. @returns {Object} Returns `object`.
copySymbols ( source , object )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
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 ( array , predicate )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function copySymbolsIn(source, object) { return copyObject(source, getSymbolsIn(source), object); }
Copies own and inherited symbols of `source` to `object`. @private @param {Object} source The object to copy symbols from. @param {Object} [object={}] The object to copy symbols to. @returns {Object} Returns `object`.
copySymbolsIn ( source , object )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function getAllKeys(object) { return baseGetAllKeys(object, keys, 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 ( object )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function getAllKeysIn(object) { return baseGetAllKeys(object, keysIn, getSymbolsIn); }
Creates an array of own and inherited 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.
getAllKeysIn ( object )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function initCloneArray(array) { var length = array.length, result = new array.constructor(length); // Add properties assigned by `RegExp#exec`. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { result.index = array.index; result.input = array.input; } return result; }
Initializes an array clone. @private @param {Array} array The array to clone. @returns {Array} Returns the initialized clone.
initCloneArray ( array )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function initCloneByTag(object, tag, isDeep) { var Ctor = object.constructor; switch (tag) { case arrayBufferTag: return cloneArrayBuffer(object); case boolTag: case dateTag: return new Ctor(+object); case dataViewTag: return cloneDataView(object, isDeep); case float32Tag: case float64Tag: case int8Tag: case int16Tag: case int32Tag: case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: return cloneTypedArray(object, isDeep); case mapTag: return new Ctor(); case numberTag: case stringTag: return new Ctor(object); case regexpTag: return cloneRegExp(object); case setTag: return new Ctor(); case symbolTag: return cloneSymbol(object); } }
Initializes an object clone based on its `toStringTag`. **Note:** This function only supports cloning values with tags of `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`. @private @param {Object} object The object to clone. @param {string} tag The `toStringTag` of the object to clone. @param {boolean} [isDeep] Specify a deep clone. @returns {Object} Returns the initialized clone.
initCloneByTag ( object , tag , isDeep )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function cloneDataView(dataView, isDeep) { var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); }
Creates a clone of `dataView`. @private @param {Object} dataView The data view to clone. @param {boolean} [isDeep] Specify a deep clone. @returns {Object} Returns the cloned data view.
cloneDataView ( dataView , isDeep )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function cloneRegExp(regexp) { var result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); result.lastIndex = regexp.lastIndex; return result; }
Creates a clone of `regexp`. @private @param {Object} regexp The regexp to clone. @returns {Object} Returns the cloned regexp.
cloneRegExp ( regexp )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function cloneSymbol(symbol) { return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {}; }
Creates a clone of the `symbol` object. @private @param {Object} symbol The symbol object to clone. @returns {Object} Returns the cloned symbol object.
cloneSymbol ( symbol )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function cloneTypedArray(typedArray, isDeep) { var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); }
Creates a clone of `typedArray`. @private @param {Object} typedArray The typed array to clone. @param {boolean} [isDeep] Specify a deep clone. @returns {Object} Returns the cloned typed array.
cloneTypedArray ( typedArray , isDeep )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function initCloneObject(object) { return typeof object.constructor == 'function' && !isPrototype(object) ? baseCreate(getPrototype(object)) : {}; }
Initializes an object clone. @private @param {Object} object The object to clone. @returns {Object} Returns the initialized clone.
initCloneObject ( object )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function baseIsMap(value) { return isObjectLike(value) && getTag(value) == mapTag; }
The base implementation of `_.isMap` without Node.js optimizations. @private @param {*} value The value to check. @returns {boolean} Returns `true` if `value` is a map, else `false`.
baseIsMap ( value )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function baseIsSet(value) { return isObjectLike(value) && getTag(value) == setTag; }
The base implementation of `_.isSet` without Node.js optimizations. @private @param {*} value The value to check. @returns {boolean} Returns `true` if `value` is a set, else `false`.
baseIsSet ( value )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function isPlainObject(value) { if (!isObjectLike(value) || baseGetTag(value) != objectTag) { return false; } var proto = getPrototype(value); if (proto === null) { return true; } var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; return typeof Ctor == 'function' && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString; }
Checks if `value` is a plain object, that is, an object created by the `Object` constructor or one with a `[[Prototype]]` of `null`. @static @memberOf _ @since 0.8.0 @category Lang @param {*} value The value to check. @returns {boolean} Returns `true` if `value` is a plain object, else `false`. @example function Foo() { this.a = 1; } _.isPlainObject(new Foo); // => false _.isPlainObject([1, 2, 3]); // => false _.isPlainObject({ 'x': 0, 'y': 0 }); // => true _.isPlainObject(Object.create(null)); // => true
isPlainObject ( value )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function baseIsRegExp(value) { return isObjectLike(value) && baseGetTag(value) == regexpTag; }
The base implementation of `_.isRegExp` without Node.js optimizations. @private @param {*} value The value to check. @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
baseIsRegExp ( value )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function log(...args) { // This hackery is required for IE8/9, where // the `console.log` function doesn't have 'apply' return typeof console === 'object' && console.log && console.log(...args); }
Invokes `console.log()` when available. No-op when `console.log` is not a "function". @api public
log ( ... args )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function save(namespaces) { try { if (namespaces) { exports.storage.setItem('debug', namespaces); } else { exports.storage.removeItem('debug'); } } catch (error) {// Swallow // XXX (@Qix-) should we be logging these? } }
Save `namespaces`. @param {String} namespaces @api private
save ( namespaces )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function load() { let r; try { r = exports.storage.getItem('debug'); } catch (error) {// Swallow // XXX (@Qix-) should we be logging these? } // If debug isn't set in LS, and we're in Electron, try to load $DEBUG if (!r && typeof process !== 'undefined' && 'env' in process) { r = process.env.DEBUG; } return r; }
Load `namespaces`. @return {String} returns the previously persisted debug modes @api private
load ( )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function localstorage() { try { // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context // The Browser also has localStorage in the global context. return localStorage; } catch (error) {// Swallow // XXX (@Qix-) should we be logging these? } }
Localstorage attempts to return the localstorage. This is necessary because safari throws when a user disables cookies/localstorage and you attempt to access it. @return {LocalStorage} @api private
localstorage ( )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
formatters.j = function (v) { try { return JSON.stringify(v); } catch (error) { return '[UnexpectedJSONParseError]: ' + error.message; } };
Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
formatters.j ( v )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function formatArgs(args) { args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff); if (!this.useColors) { return; } const c = 'color: ' + this.color; args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other // arguments passed either before or after the %c, so we need to // figure out the correct index to insert the CSS into let index = 0; let lastC = 0; args[0].replace(/%[a-zA-Z%]/g, match => { if (match === '%%') { return; } index++; if (match === '%c') { // We only are interested in the *last* %c // (the user may have provided their own) lastC = index; } }); args.splice(lastC, 0, c); } /** * Invokes `console.log()` when available. * No-op when `console.log` is not a "function". * * @api public */ function log(...args) { // This hackery is required for IE8/9, where // the `console.log` function doesn't have 'apply' return typeof console === 'object' && console.log && console.log(...args); } /** * Save `namespaces`. * * @param {String} namespaces * @api private */ function save(namespaces) { try { if (namespaces) { exports.storage.setItem('debug', namespaces); } else { exports.storage.removeItem('debug'); } } catch (error) {// Swallow // XXX (@Qix-) should we be logging these? } } /** * Load `namespaces`. * * @return {String} returns the previously persisted debug modes * @api private */ function load() { let r; try { r = exports.storage.getItem('debug'); } catch (error) {// Swallow // XXX (@Qix-) should we be logging these? } // If debug isn't set in LS, and we're in Electron, try to load $DEBUG if (!r && typeof process !== 'undefined' && 'env' in process) { r = process.env.DEBUG; } return r; } /** * Localstorage attempts to return the localstorage. * * This is necessary because safari throws * when a user disables cookies/localstorage * and you attempt to access it. * * @return {LocalStorage} * @api private */ function localstorage() { try { // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context // The Browser also has localStorage in the global context. return localStorage; } catch (error) {// Swallow // XXX (@Qix-) should we be logging these? } } module.exports = __webpack_require__(255)(exports); const { formatters } = module.exports; /** * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. */ formatters.j = function (v) { try { return JSON.stringify(v); } catch (error) { return '[UnexpectedJSONParseError]: ' + error.message; } }; /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(8)))
Colorize log arguments if enabled. @api public
formatArgs ( args )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function selectColor(namespace) { let hash = 0; for (let i = 0; i < namespace.length; i++) { hash = (hash << 5) - hash + namespace.charCodeAt(i); hash |= 0; // Convert to 32bit integer } return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; }
Selects a color for a debug namespace @param {String} namespace The namespace string for the for the debug instance to be colored @return {Number|String} An ANSI color code for the given namespace @api private
selectColor ( namespace )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function createDebug(namespace) { let prevTime; function debug(...args) { // Disabled? if (!debug.enabled) { return; } const self = debug; // Set `diff` timestamp const curr = Number(new Date()); const ms = curr - (prevTime || curr); self.diff = ms; self.prev = prevTime; self.curr = curr; prevTime = curr; args[0] = createDebug.coerce(args[0]); if (typeof args[0] !== 'string') { // Anything else let's inspect with %O args.unshift('%O'); } // Apply any `formatters` transformations let index = 0; args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { // If we encounter an escaped % then don't increase the array index if (match === '%%') { return match; } index++; const formatter = createDebug.formatters[format]; if (typeof formatter === 'function') { const val = args[index]; match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format` args.splice(index, 1); index--; } return match; }); // Apply env-specific formatting (colors, etc.) createDebug.formatArgs.call(self, args); const logFn = self.log || createDebug.log; logFn.apply(self, args); } debug.namespace = namespace; debug.enabled = createDebug.enabled(namespace); debug.useColors = createDebug.useColors(); debug.color = selectColor(namespace); debug.destroy = destroy; debug.extend = extend; // Debug.formatArgs = formatArgs; // debug.rawLog = rawLog; // env-specific initialization logic for debug instances if (typeof createDebug.init === 'function') { createDebug.init(debug); } createDebug.instances.push(debug); return debug; }
Create a debugger with the given `namespace`. @param {String} namespace @return {Function} @api public
createDebug ( namespace )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
module.exports = function (val, options) { options = options || {}; var type = typeof val; if (type === 'string' && val.length > 0) { return parse(val); } else if (type === 'number' && isFinite(val)) { return options.long ? fmtLong(val) : fmtShort(val); } throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val)); };
Parse or format the given `val`. Options: - `long` verbose formatting [false] @param {String|Number} val @param {Object} [options] @throws {Error} throw an error if val is not a non-empty string or a number @return {String|Number} @api public
module.exports ( val , options )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function fmtShort(ms) { var msAbs = Math.abs(ms); if (msAbs >= d) { return Math.round(ms / d) + 'd'; } if (msAbs >= h) { return Math.round(ms / h) + 'h'; } if (msAbs >= m) { return Math.round(ms / m) + 'm'; } if (msAbs >= s) { return Math.round(ms / s) + 's'; } return ms + 'ms'; }
Short format for `ms`. @param {Number} ms @return {String} @api private
fmtShort ( ms )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function fmtLong(ms) { var msAbs = Math.abs(ms); if (msAbs >= d) { return plural(ms, msAbs, d, 'day'); } if (msAbs >= h) { return plural(ms, msAbs, h, 'hour'); } if (msAbs >= m) { return plural(ms, msAbs, m, 'minute'); } if (msAbs >= s) { return plural(ms, msAbs, s, 'second'); } return ms + ' ms'; }
Long format for `ms`. @param {Number} ms @return {String} @api private
fmtLong ( ms )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
exports.encode = function (number) { if (0 <= number && number < intToCharMap.length) { return intToCharMap[number]; } throw new TypeError("Must be between 0 and 63: " + number); };
Encode an integer in the range of 0 to 63 to a single base 64 digit.
exports.encode ( number )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
exports.decode = function (charCode) { var bigA = 65; // 'A' var bigZ = 90; // 'Z' var littleA = 97; // 'a' var littleZ = 122; // 'z' var zero = 48; // '0' var nine = 57; // '9' var plus = 43; // '+' var slash = 47; // '/' var littleOffset = 26; var numberOffset = 52; // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ if (bigA <= charCode && charCode <= bigZ) { return charCode - bigA; } // 26 - 51: abcdefghijklmnopqrstuvwxyz if (littleA <= charCode && charCode <= littleZ) { return charCode - littleA + littleOffset; } // 52 - 61: 0123456789 if (zero <= charCode && charCode <= nine) { return charCode - zero + numberOffset; } // 62: + if (charCode == plus) { return 62; } // 63: / if (charCode == slash) { return 63; } // Invalid base64 digit. return -1; };
Decode a single base 64 character code digit to an integer. Returns -1 on failure.
exports.decode ( charCode )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function generatedPositionAfter(mappingA, mappingB) { // Optimized for most common case var lineA = mappingA.generatedLine; var lineB = mappingB.generatedLine; var columnA = mappingA.generatedColumn; var columnB = mappingB.generatedColumn; return lineB > lineA || lineB == lineA && columnB >= columnA || util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0; }
Determine whether mappingB is after mappingA with respect to generated position.
generatedPositionAfter ( mappingA , mappingB )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
function MappingList() { this._array = []; this._sorted = true; // Serves as infimum this._last = { generatedLine: -1, generatedColumn: 0 }; }
A data structure to provide a sorted view of accumulated mappings in a performance conscious manner. It trades a neglibable overhead in general case for a large speedup in case of mappings being added in order.
MappingList ( )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
MappingList.prototype.unsortedForEach = function MappingList_forEach(aCallback, aThisArg) { this._array.forEach(aCallback, aThisArg); };
Iterate through internal items. This method takes the same arguments that `Array.prototype.forEach` takes. NOTE: The order of the mappings is NOT guaranteed.
MappingList_forEach ( aCallback , aThisArg )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
MappingList.prototype.add = function MappingList_add(aMapping) { if (generatedPositionAfter(this._last, aMapping)) { this._last = aMapping; this._array.push(aMapping); } else { this._sorted = false; this._array.push(aMapping); } };
Add the given source mapping. @param Object aMapping
MappingList_add ( aMapping )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
MappingList.prototype.toArray = function MappingList_toArray() { if (!this._sorted) { this._array.sort(util.compareByGeneratedPositionsInflated); this._sorted = true; } return this._array; };
Returns the flat, sorted array of mappings. The mappings are sorted by generated position. WARNING: This method returns internal data without copying, for performance. The return value must NOT be mutated, and should be treated as an immutable borrow. If you want to take ownership, you must make your own copy.
MappingList_toArray ( )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
SourceMapConsumer.prototype._parseMappings = function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { throw new Error("Subclasses must implement _parseMappings");
Parse the mappings in a string in to a data structure which we can easily query (the ordered arrays in the `this.__generatedMappings` and `this.__originalMappings` properties).
SourceMapConsumer_parseMappings ( aStr , aSourceRoot )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
BasicSourceMapConsumer.prototype.hasContentsOfAllSources = function BasicSourceMapConsumer_hasContentsOfAllSources() { if (!this.sourcesContent) { return false; } return this.sourcesContent.length >= this._sources.size() && !this.sourcesContent.some(function (sc) { return sc == null;
Return true if we have the source content for every source in the source map, false otherwise.
BasicSourceMapConsumer_hasContentsOfAllSources ( )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
SourceNode.prototype.add = function SourceNode_add(aChunk) { if (Array.isArray(aChunk)) {
Add a chunk of generated JS to this source node. @param aChunk A string snippet of generated JS code, another instance of SourceNode, or an array where each member is one of those things.
(anonymous) ( chunk )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
SourceNode.prototype.toString = function SourceNode_toString() { var str = "";
Return the string representation of this source node. Walks over the tree and concatenates all the various snippets together to one string.
(anonymous) ( chunk )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
class SourceMapMetadataConsumer_SourceMapMetadataConsumer { constructor(sourcemap) { this._sourceMap = sourcemap;
Consumes the `x_react_sources` or `x_facebook_sources` metadata field from a source map and exposes ways to query the React DevTools specific metadata included in those fields.
constructor ( sourcemap )
javascript
open-source-labs/Swell
ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js
MIT
submitMockRequest: async (event, postData) => { try { const result = await fetch('http://localhost:9990/mock/', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: postData, }); console.log('Result: ', result); } catch (err) { console.log('Error submitting endpoint: ', err); } },
Sends a POST request to the mock server to create new mock endpoints. @param {*} event - The Electron event object that triggered the submission of the mock request. @param {*} postData - the JSON stringified object from the renderer that contains a "method", "endpoint" and "response" keys that will be used to create the mock endpoint.
async
javascript
open-source-labs/Swell
main_process/main_mockController.js
https://github.com/open-source-labs/Swell/blob/master/main_process/main_mockController.js
MIT
const isButtonDisabled = async (page, path) => { const button = await page.locator(path); const isDisabled = await button.getAttribute('disabled'); return isDisabled !== null; };
This module contains helper functions that facilitates with filling in information, adding and sending requests in the UI for E2E testing.
isButtonDisabled
javascript
open-source-labs/Swell
test/subSuites/testHelper.js
https://github.com/open-source-labs/Swell/blob/master/test/subSuites/testHelper.js
MIT
describe('REST API Requests', () => { let state; beforeEach(() => { state = { history: [], newRequest: { newRequestHeaders: { headersArr: [], count: 0, }, newRequestBody: { bodyContent: '', bodyVariables: '', bodyType: 'raw', rawType: 'text/plain', JSONFormatted: true, bodyIsNew: false, }, newRequestStreams: { streamsArr: [], count: 0, streamContent: [], selectedPackage: null, selectedRequest: null, selectedService: null, selectedServiceObj: null, selectedStreamingType: null, initialQuery: null, queryArr: null, protoPath: '', services: null, protoContent: '', }, newRequestCookies: { cookiesArr: [], count: 0, }, newRequestSSE: { isSSE: false, }, newRequestWebRTC: { network: 'webrtc', webRTCEntryMode: 'Manual', webRTCDataChannel: 'Text', webRTCWebsocketServer: '', webRTCOffer: '', webRTCAnswer: '', webRTCpeerConnection: null, webRTCLocalStream: null, webRTCRemoteStream: null, webRTCMessages: [], }, }, graphPoints: {}, collections: [], newRequestFields: { protocol: '', method: 'GET', network: 'rest', url: 'http://', restUrl: 'http://', wsUrl: 'ws://', gqlUrl: 'https://', grpcUrl: '', webrtcUrl: '', graphQL: false, gRPC: false, tRPC: false, ws: false, openapi: false, webrtc: false, webhook: false, testContent: '', testResults: [], openapiReqObj: {}, }, newRequestOpenApi: { openApiMetadata: { info: {}, tags: [], serverUrls: [], }, openApiReqArray: [], }, reqRes: { reqResArray: [], currentResponse: {}, }, ui: { sidebarActiveTab: 'composer', workspaceActiveTab: 'workspace', responsePaneActiveTab: 'events', isDark: false, }, introspectionData: { schemaSDL: null, clientSchema: null, }, warningMessage: {}, mockServer: { isServerStarted: false, }, }; }); describe('public API', () => { xit('it should GET information from a public API', () => { // define request const request = { id: 'testID', // createdAt: 2020-11-04T19:33:55.829Z, protocol: 'http://', host: 'http://jsonplaceholder.typicode.com', path: '/posts', url: 'http://jsonplaceholder.typicode.com/posts', graphQL: false, gRPC: false, timeSent: null, timeReceived: null, connection: 'uninitialized', connectionType: null, checkSelected: false, protoPath: null, request: { method: 'GET', headers: [[Object]], cookies: [], body: '', bodyType: 'raw', bodyVariables: '', rawType: 'text/plain', isSSE: false, network: 'rest', restUrl: 'http://jsonplaceholder.typicode.com/posts', wsUrl: 'ws://', gqlUrl: 'https://', grpcUrl: '', }, response: { headers: null, events: null }, checked: false, minimized: false, tab: 'First Tab', }; state = ReqResCtrl.openReqRes(request); const response = state.reqResArray[0]; console.log(response); expect(response.status).toEqual(200); // expect(response.toEqual('hello')); }); it('should toggle select all', () => { expect(ReqResCtrl.toggleSelectAll()).not.toThrowError; }); }); });
@todo Integration tests with the actual API. The controller calls api.send and api.recieve without attachement to the API, the tests in this file don't perform anything. Additionally, add a testing file for graphQLController. This is currently untested and is a dependency for reqResController. @todo Refactor for new state structure with redux slices
(anonymous)
javascript
open-source-labs/Swell
test/__tests__/httpTest.js
https://github.com/open-source-labs/Swell/blob/master/test/__tests__/httpTest.js
MIT
it('should compose a new request store for a known protocol', () => { let expected = { ...initialState, newRequestBody: { ...initialState.newRequestBody, bodyType: 'TRPC', bodyVariables: '', }, }; let result = newRequestReducer( initialState, newRequestContentByProtocol('tRPC') ); expect(result).toEqual(expected); expected.newRequestBody.bodyType = 'GQL'; result = newRequestReducer( initialState, newRequestContentByProtocol('graphQL') ); expect(result).toEqual(expected); expected.newRequestBody.bodyType = 'GRPC'; result = newRequestReducer( initialState, newRequestContentByProtocol('grpc') ); expect(result).toEqual(expected); expected.newRequestBody.bodyType = 'none'; result = newRequestReducer( initialState, newRequestContentByProtocol('ws') ); expect(result).toEqual(expected); expected.newRequestBody.bodyType = 'none'; result = newRequestReducer( initialState, newRequestContentByProtocol('webhook') ); expect(result).toEqual(expected); });
@todo - Modularize the below test as it only has 1 Jest "it" statement. Also to note, in the newRequestSlice itself there are many other features still under WIP. Below test is currently written for the features that have some functionality.
(anonymous)
javascript
open-source-labs/Swell
test/__tests__/newRequestSliceTest.js
https://github.com/open-source-labs/Swell/blob/master/test/__tests__/newRequestSliceTest.js
MIT
function main() { const app = new Mali(PROTO_PATH, 'Greeter'); app.use({ sayHello, sayHelloNested, sayHellosSs, sayHelloCs, sayHelloBidi }); app.start(HOSTPORT); console.log(`Greeter service running @ ${HOSTPORT}`); }
Starts an RPC server that receives requests for the Greeter service at the sample server port
main ( )
javascript
open-source-labs/Swell
test/grpc_mockData/server.js
https://github.com/open-source-labs/Swell/blob/master/test/grpc_mockData/server.js
MIT
function getWidth() { if (window || document) { return ( (window || {}).innerWidth || document.documentElement.clientWidth || document.body.clientWidth ); } }
Copyright (c) 2018-present, Raphael Amorim. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree.
getWidth ( )
javascript
raphamorim/react-ape
packages/react-ape/modules/Dimensions/index.js
https://github.com/raphamorim/react-ape/blob/master/packages/react-ape/modules/Dimensions/index.js
MIT
export function unsafeCreateUniqueId(): string { return (Math.random() * 10e18 + Date.now()).toString(36); }
Returns a relatively "guaranteed" unique id. It's still not 100% guaranteed, that's why we added the "unsafe" prefix on this function.
unsafeCreateUniqueId ( )
javascript
raphamorim/react-ape
packages/react-ape/renderer/utils.js
https://github.com/raphamorim/react-ape/blob/master/packages/react-ape/renderer/utils.js
MIT
debug(msg) { const params = this.sqz.cli.params.get(); if (_.has(params.options, 'debug')) { this.console(`${this.logIdentifier} -> ${msg}`); } }
Display's a CLI debug message @param {string} msg - debug message @name this.sqz.cli.log.debug
debug ( msg )
javascript
SqueezerIO/squeezer
lib/common/cli/log/index.js
https://github.com/SqueezerIO/squeezer/blob/master/lib/common/cli/log/index.js
MIT
warn(msg) { this.console(`${this.logIdentifier} -> ${colors.red(msg)}`); }
Display's a CLI warning message @param {string} msg - warning message @name this.sqz.cli.log.warn
warn ( msg )
javascript
SqueezerIO/squeezer
lib/common/cli/log/index.js
https://github.com/SqueezerIO/squeezer/blob/master/lib/common/cli/log/index.js
MIT
info(msg) { this.console(`${this.logIdentifier} -> ${(msg)}`); }
Display's a CLI information message @param {string} msg - information message @name this.sqz.cli.log.info
info ( msg )
javascript
SqueezerIO/squeezer
lib/common/cli/log/index.js
https://github.com/SqueezerIO/squeezer/blob/master/lib/common/cli/log/index.js
MIT
error(msg) { this.console(this.sqz.cli.error.get(colors.yellow(msg))); process.exit(1); }
Display's a CLI error message ( and exists the CLI with terminal code 1 ) @param {string} msg - error message @name this.sqz.cli.log.error
error ( msg )
javascript
SqueezerIO/squeezer
lib/common/cli/log/index.js
https://github.com/SqueezerIO/squeezer/blob/master/lib/common/cli/log/index.js
MIT
console(msg) { console.log(msg); // eslint-disable-line no-console }
Use the same NodeJS console.log feature @param {string} msg - information message @name this.sqz.cli.log.console
console ( msg )
javascript
SqueezerIO/squeezer
lib/common/cli/log/index.js
https://github.com/SqueezerIO/squeezer/blob/master/lib/common/cli/log/index.js
MIT
constructor(sqz) { this.sqz = sqz; }
@param {Object} sqz - Squeezer CLI instance
constructor ( sqz )
javascript
SqueezerIO/squeezer
lib/common/cli/help/index.js
https://github.com/SqueezerIO/squeezer/blob/master/lib/common/cli/help/index.js
MIT
get(errorParam, noSqzError) { let error = errorParam; if (_.has(error, 'stack') && noSqzError) error = error.stack; const versionInfo = new Version(); let msg = colors.red.bold('\n\nSQUEEZER ERROR:'); if (noSqzError) { msg += `\n\n${error}\n\n`; } else { msg += `\n\n${error}\n\n`; } if (noSqzError) { msg += `${versionInfo.msg()}\n\n`; msg += `Please add ${colors.green('--debug')} to any command for more CLI details\n\n`; } msg += `### Docs: ${colors.cyan('docs.squeezer.io')}\n` + `### Bugs: ${colors.cyan('github.com/SqueezerIO/squeezer/issues')}`; if (noSqzError) { msg += "\n\n### If you feel that this error it's a bug please report it . Thank you !"; } msg += '\n'; return msg; }
Returns formatted error message @param {string} error - error message @param {boolean} noSqzError - true for system error @returns {String} @name this.sqz.error
get ( errorParam , noSqzError )
javascript
SqueezerIO/squeezer
lib/common/cli/error/index.js
https://github.com/SqueezerIO/squeezer/blob/master/lib/common/cli/error/index.js
MIT
start() { process.stdout.write('.'); this.loaderInterval = setInterval(() => { process.stdout.write('.'); }, 3000, true); }
Loader start @name this.sqz.cli.loader.start
start ( )
javascript
SqueezerIO/squeezer
lib/common/cli/loader/index.js
https://github.com/SqueezerIO/squeezer/blob/master/lib/common/cli/loader/index.js
MIT
stop() { // if (process.stdout.clearLine) { // process.stdout.clearLine(); // process.stdout.cursorTo(0); // } process.stdout.write('\n'); clearInterval(this.loaderInterval); }
Loader stop @name this.sqz.cli.loader.stop
stop ( )
javascript
SqueezerIO/squeezer
lib/common/cli/loader/index.js
https://github.com/SqueezerIO/squeezer/blob/master/lib/common/cli/loader/index.js
MIT
set(params) { this.params = params; }
Set CLI params object @name this.sqz.cli.params.set
set ( params )
javascript
SqueezerIO/squeezer
lib/common/cli/params/index.js
https://github.com/SqueezerIO/squeezer/blob/master/lib/common/cli/params/index.js
MIT
setOption(name, value) { if (!this.params.options[name]) { this.params.options[name] = value; } }
Set an option value @name this.sqz.cli.params.setOption
setOption ( name , value )
javascript
SqueezerIO/squeezer
lib/common/cli/params/index.js
https://github.com/SqueezerIO/squeezer/blob/master/lib/common/cli/params/index.js
MIT
get() { return this.params; }
Return CLI params @returns {Object} @name this.sqz.cli.params.get
get ( )
javascript
SqueezerIO/squeezer
lib/common/cli/params/index.js
https://github.com/SqueezerIO/squeezer/blob/master/lib/common/cli/params/index.js
MIT
set(setting, value) { const data = cfg.getAll(); if (!_.has(data, this.sqz.vars.project.name)) { cfg[this.sqz.vars.project.name] = {}; } cfg[this.sqz.vars.project.name][setting] = value; cfg.save(); }
Configure a setting @param {string} setting - setting name @param {string} setting - setting value @name this.sqz.config.set
set ( setting , value )
javascript
SqueezerIO/squeezer
lib/common/config/index.js
https://github.com/SqueezerIO/squeezer/blob/master/lib/common/config/index.js
MIT
get(setting) { return this.data[setting]; }
Retrieve a setting @param {string} setting - setting name @returns {Object} @name this.sqz.config.get
get ( setting )
javascript
SqueezerIO/squeezer
lib/common/config/index.js
https://github.com/SqueezerIO/squeezer/blob/master/lib/common/config/index.js
MIT
get() { return this.versionData; }
Returns framework version information @Return {Object} @name this.sqz.version.get
get ( )
javascript
SqueezerIO/squeezer
lib/common/version/index.js
https://github.com/SqueezerIO/squeezer/blob/master/lib/common/version/index.js
MIT
msg() { const msg = `* Squeezer CLI version: ${this.versionData.squeezerCliVersion}\n` + `* Node version: ${this.versionData.nodeVersion}\n` + `* OS platform: ${this.versionData.osPlatform}`; return msg; }
Returns framework markdown version information @Return {String} @name this.sqz.version.msg
msg ( )
javascript
SqueezerIO/squeezer
lib/common/version/index.js
https://github.com/SqueezerIO/squeezer/blob/master/lib/common/version/index.js
MIT
get() { return this.sqz.vars; }
Returns all available variables @Return {String} variables - all variables @name this.sqz.variables.get
get ( )
javascript
SqueezerIO/squeezer
lib/common/variables/index.js
https://github.com/SqueezerIO/squeezer/blob/master/lib/common/variables/index.js
MIT
getStage() { return this.sqz.vars.stage; }
Returns current selected stage @Return {String} stage - stage value @name this.sqz.variables.getStage
getStage ( )
javascript
SqueezerIO/squeezer
lib/common/variables/index.js
https://github.com/SqueezerIO/squeezer/blob/master/lib/common/variables/index.js
MIT
getRegion() { return this.sqz.vars.region; }
Returns current selected region @Return {String} region - region value @name this.sqz.variables.getRegion
getRegion ( )
javascript
SqueezerIO/squeezer
lib/common/variables/index.js
https://github.com/SqueezerIO/squeezer/blob/master/lib/common/variables/index.js
MIT
getProject() { return this.sqz.vars.project; }
Returns project config variables @Return {Object} project - project data @name this.sqz.variables.getProject
getProject ( )
javascript
SqueezerIO/squeezer
lib/common/variables/index.js
https://github.com/SqueezerIO/squeezer/blob/master/lib/common/variables/index.js
MIT
getHooks() { return this.sqz.vars.hooks; }
Returns project's hooks @Return {Object} hooks - hooks data @name this.sqz.variables.getHooks
getHooks ( )
javascript
SqueezerIO/squeezer
lib/common/variables/index.js
https://github.com/SqueezerIO/squeezer/blob/master/lib/common/variables/index.js
MIT
stage(stages) { const stage = this.sqz.vars.stage; if (!_.isEmpty(stages)) { if (!_.includes(stages, stage)) { return false; } } return true; }
Validate stages @param stages @returns {boolean}
stage ( stages )
javascript
SqueezerIO/squeezer
lib/common/validate/index.js
https://github.com/SqueezerIO/squeezer/blob/master/lib/common/validate/index.js
MIT
parse(file, input) { const vars = this.sqz.vars || {}; let data; let fileData; let inputData; let fileObj; const loadOptions = { schema: yamlinc.YAML_INCLUDE_SCHEMA }; try { fileData = fs.readFileSync(file, 'utf8'); fileObj = yaml.safeLoad(fileData, loadOptions); inputData = _.assign({ this : fileObj, vars : vars, env : process.env }, input); data = yaml.safeLoad(templateString(fileData, inputData), loadOptions); } catch (e) { this.sqz.cli.log.error(`FILENAME : "${file}"\n\n${e}`); } return data; }
Parse an YAML file @Return {Object} data - YAML data @name this.sqz.yaml.parse
parse ( file , input )
javascript
SqueezerIO/squeezer
lib/common/yaml/index.js
https://github.com/SqueezerIO/squeezer/blob/master/lib/common/yaml/index.js
MIT
run(lifecycle) { return new Promise((resolve) => { const hooks = this.sortHooks(lifecycle); this.sqz.cli.log.debug(`# Starting CLI lifecycle : [ ${hooks.join(colors.green(' , '))} ]`); Promise.each(hooks, (val) => { const hook = _.find(this.sqz.vars.hooks, { identifier : val }); this.sqz.cli.log.debug(`# Running lifecycle event "${val}"`); if (!hook) { this.sqz.cli.log.error(`No hook available for the lifecycle event ${colors.blue.bold(val)}`); } const Class = require(`${hook.path}`); const fn = new Class(this.sqz); if (typeof fn[hook.function] !== 'function') { this.sqz.cli.log.error( `No hook function ${colors.blue.bold(hook.function)} available on ${colors.blue.bold(hook.path)}` ); } const ret = fn[hook.function](); if (!ret || typeof ret.then !== 'function') { this.sqz.cli.log.warn(`Function ${colors.blue.bold(hook.function)} for hook ${colors.blue.bold(hook.identifier)} should be a Promise`); } return ret; }).then(() => { this.sqz.cli.log.debug('CLI lifecycle finished.'); resolve(); }); }); }
Run each event from the lifecycle @param {Array} lifecycle - lifecycle array
run ( lifecycle )
javascript
SqueezerIO/squeezer
lib/common/lifecycle/index.js
https://github.com/SqueezerIO/squeezer/blob/master/lib/common/lifecycle/index.js
MIT
zipDir(source, dest) { return new Promise((resolve, reject) => { const archive = archiver.create('zip', {}); const archiveName = path.basename(dest); const output = fs.createWriteStream(dest); archive.on('error', (err) => { reject(err); }); output.on('close', () => { this.sqz.cli.log.debug(`Archive "${archiveName}" successfully created`); resolve(); }); archive.pipe(output); archive.directory(source, './'); archive.finalize(); }); }
Zips a directory @param {string} source - source directory path "/tmp/my-files" @param {string} dest - destination path "/tmp/myfiles.zip" @name this.sqz.archive
zipDir ( source , dest )
javascript
SqueezerIO/squeezer
lib/common/archiver/index.js
https://github.com/SqueezerIO/squeezer/blob/master/lib/common/archiver/index.js
MIT