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 createFind(eachFunc, fromRight) { return function(collection, predicate, thisArg) { predicate = baseCallback(predicate, thisArg, 3); if (isArray(collection)) { var index = baseFindIndex(collection, predicate, fromRight); return index > -1 ? collection[index] : undefined; } return ...
Creates a function that wraps `func` and invokes it with optional `this` binding of, partial application, and currying. @private @param {Function|string} func The function or method name to reference. @param {number} bitmask The bitmask of flags. See `createWrapper` for more details. @param {*} [thisArg] The `this` bi...
createFind
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function createForEach(arrayFunc, eachFunc) { return function(collection, iteratee, thisArg) { return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection)) ? arrayFunc(collection, iteratee) : eachFunc(collection, bindCallback(iteratee, thisArg, 3)); }; }
Creates a function that wraps `func` and invokes it with optional `this` binding of, partial application, and currying. @private @param {Function|string} func The function or method name to reference. @param {number} bitmask The bitmask of flags. See `createWrapper` for more details. @param {*} [thisArg] The `this` bi...
createForEach
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function createHybridWrapper(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { var isAry = bitmask & ARY_FLAG, isBind = bitmask & BIND_FLAG, isBindKey = bitmask & BIND_KEY_FLAG, isCurry = bitmask & CURRY_FLAG, isCurryBound = bitmask & CURRY_BOUND_FLA...
Creates a function that wraps `func` and invokes it with optional `this` binding of, partial application, and currying. @private @param {Function|string} func The function or method name to reference. @param {number} bitmask The bitmask of flags. See `createWrapper` for more details. @param {*} [thisArg] The `this` bi...
createHybridWrapper
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function wrapper() { // Avoid `arguments` object use disqualifying optimizations by // converting it to an array before providing it to other functions. var length = arguments.length, index = length, args = Array(length); while (index--) { args[index] = arguments[index]; } ...
Creates a function that wraps `func` and invokes it with optional `this` binding of, partial application, and currying. @private @param {Function|string} func The function or method name to reference. @param {number} bitmask The bitmask of flags. See `createWrapper` for more details. @param {*} [thisArg] The `this` bi...
wrapper
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function createPartialWrapper(func, bitmask, thisArg, partials) { var isBind = bitmask & BIND_FLAG, Ctor = createCtorWrapper(func); function wrapper() { // Avoid `arguments` object use disqualifying optimizations by // converting it to an array before providing it `func`. var argsIndex = -1, ...
Used to compose bitmasks for wrapper metadata.
createPartialWrapper
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function wrapper() { // Avoid `arguments` object use disqualifying optimizations by // converting it to an array before providing it `func`. var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array(leftLength + argsLength);...
Used as the `TypeError` message for "Functions" methods.
wrapper
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function equalArrays(array, other, equalFunc, customizer, isLoose, stackA, stackB) { var index = -1, arrLength = array.length, othLength = other.length; if (arrLength != othLength && !(isLoose && othLength > arrLength)) { return false; } // Ignore non-index properties. while (++index < arrLen...
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 {Function} equalFunc The function to determine equivalents of values. @param {Function} [customizer] The fun...
equalArrays
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function equalByTag(object, other, tag) { switch (tag) { case boolTag: case dateTag: // Coerce dates and booleans to numbers, dates to milliseconds and booleans // to `1` or `0` treating invalid dates coerced to `NaN` as not equal. return +object == +other; case errorTag: return o...
Gets the name of `func`. @private @param {Function} func The function to query. @returns {string} Returns the function name.
equalByTag
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function equalObjects(object, other, equalFunc, customizer, isLoose, stackA, stackB) { var objProps = keys(object), objLength = objProps.length, othProps = keys(other), othLength = othProps.length; if (objLength != othLength && !isLoose) { return false; } var index = objLength; while (i...
Gets the native function at `key` of `object`. @private @param {Object} object The object to query. @param {string} key The key of the method to get. @returns {*} Returns the function if it's native, else `undefined`.
equalObjects
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function getMatchData(object) { var result = pairs(object), length = result.length; while (length--) { result[length][2] = isStrictComparable(result[length][1]); } return result; }
Initializes an object clone based on its `toStringTag`. **Note:** This function only supports cloning values with tags of `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. @private @param {Object} object The object to clone. @param {string} tag The `toStringTag` of the object to clone. @param {boolean} [is...
getMatchData
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function getNative(object, key) { var value = object == null ? undefined : object[key]; return isNative(value) ? value : undefined; }
Initializes an object clone based on its `toStringTag`. **Note:** This function only supports cloning values with tags of `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. @private @param {Object} object The object to clone. @param {string} tag The `toStringTag` of the object to clone. @param {boolean} [is...
getNative
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function indexOfNaN(array, fromIndex, fromRight) { var length = array.length, index = fromIndex + (fromRight ? 0 : -1); while ((fromRight ? index-- : ++index < length)) { var other = array[index]; if (other !== other) { return index; } } return -1; }
Initializes an object clone based on its `toStringTag`. **Note:** This function only supports cloning values with tags of `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. @private @param {Object} object The object to clone. @param {string} tag The `toStringTag` of the object to clone. @param {boolean} [is...
indexOfNaN
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function initCloneArray(array) { var length = array.length, result = new array.constructor(length); // Add array properties assigned by `RegExp#exec`. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { result.index = array.index; result.input = array.input; } re...
Initializes an object clone based on its `toStringTag`. **Note:** This function only supports cloning values with tags of `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. @private @param {Object} object The object to clone. @param {string} tag The `toStringTag` of the object to clone. @param {boolean} [is...
initCloneArray
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function initCloneByTag(object, tag, isDeep) { var Ctor = object.constructor; switch (tag) { case arrayBufferTag: return bufferClone(object); case boolTag: case dateTag: return new Ctor(+object); case float32Tag: case float64Tag: case int8Tag: case int16Tag: case int32Tag: case...
Initializes an object clone based on its `toStringTag`. **Note:** This function only supports cloning values with tags of `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. @private @param {Object} object The object to clone. @param {string} tag The `toStringTag` of the object to clone. @param {boolean} [is...
initCloneByTag
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function initCloneObject(object) { var Ctor = object.constructor; if (!(typeof Ctor == 'function' && Ctor instanceof Ctor)) { Ctor = Object; } return new Ctor; }
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`.
initCloneObject
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function isArrayLike(value) { return value != null && isLength(getLength(value)); }
Checks if `func` has a lazy counterpart. @private @param {Function} func The function to check. @returns {boolean} Returns `true` if `func` has a lazy counterpart, else `false`.
isArrayLike
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function isIndex(value, length) { value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1; length = length == null ? MAX_SAFE_INTEGER : length; return value > -1 && value % 1 == 0 && value < length; }
Checks if `value` is object-like. @private @param {*} value The value to check. @returns {boolean} Returns `true` if `value` is object-like, else `false`.
isIndex
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function isIterateeCall(value, index, object) { if (!isObject(object)) { return false; } var type = typeof index; if (type == 'number' ? (isArrayLike(object) && isIndex(index, object.length)) : (type == 'string' && index in object)) { var other = object[index]; return value === value ? (...
Used as the internal argument placeholder.
isIterateeCall
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function isKey(value, object) { var type = typeof value; if ((type == 'string' && reIsPlainProp.test(value)) || type == 'number') { return true; } if (isArray(value)) { return false; } var result = !reIsDeepProp.test(value); return result || (object != null && value in toObject(object)); }
Merges the function metadata of `source` into `data`. Merging metadata reduces the number of wrappers required to invoke a function. This is possible because methods like `_.bind`, `_.curry`, and `_.partial` may be applied regardless of execution order. Methods like `_.ary` and `_.rearg` augment function arguments, ma...
isKey
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function isLaziable(func) { var funcName = getFuncName(func), other = lodash[funcName]; if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) { return false; } if (func === other) { return true; } var data = getData(other); return !!data && func === data[0]; }
Merges the function metadata of `source` into `data`. Merging metadata reduces the number of wrappers required to invoke a function. This is possible because methods like `_.bind`, `_.curry`, and `_.partial` may be applied regardless of execution order. Methods like `_.ary` and `_.rearg` augment function arguments, ma...
isLaziable
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function isLength(value) { return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; }
Merges the function metadata of `source` into `data`. Merging metadata reduces the number of wrappers required to invoke a function. This is possible because methods like `_.bind`, `_.curry`, and `_.partial` may be applied regardless of execution order. Methods like `_.ary` and `_.rearg` augment function arguments, ma...
isLength
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function mergeData(data, source) { var bitmask = data[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < ARY_FLAG; var isCombo = (srcBitmask == ARY_FLAG && bitmask == CURRY_FLAG) || (srcBitmask == ARY_FLAG && bitmask == REARG_FLAG && data[7].length <= s...
Used as the internal argument placeholder.
mergeData
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function reorder(array, indexes) { var arrLength = array.length, length = nativeMin(indexes.length, arrLength), oldArray = arrayCopy(array); while (length--) { var index = indexes[length]; array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined; } return array; }
Converts `value` to an object if it's not one. @private @param {*} value The value to process. @returns {Object} Returns the object.
reorder
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function replaceHolders(array, placeholder) { var index = -1, length = array.length, resIndex = -1, result = []; while (++index < length) { if (array[index] === placeholder) { array[index] = PLACEHOLDER; result[++resIndex] = index; } } return result; }
Converts `value` to property path array if it's not one. @private @param {*} value The value to process. @returns {Array} Returns the property path array.
replaceHolders
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function shimKeys(object) { var props = keysIn(object), propsLength = props.length, length = propsLength && object.length; var allowIndexes = !!length && isLength(length) && (isArray(object) || isArguments(object) || isString(object)); var index = -1, result = []; while (++index < props...
Creates a clone of `wrapper`. @private @param {Object} wrapper The wrapper to clone. @returns {Object} Returns the cloned wrapper.
shimKeys
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function wrapperClone(wrapper) { return wrapper instanceof LazyWrapper ? wrapper.clone() : new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__, arrayCopy(wrapper.__actions__)); }
Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) of values.
wrapperClone
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function isArguments(value) { return isObjectLike(value) && isArrayLike(value) && hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee'); }
Checks if `value` is classified as a `Function` object. @static @memberOf _ @category Lang @param {*} value The value to check. @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. @example _.isFunction(_); // => true _.isFunction(/abc/); // => false
isArguments
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function isEmpty(value) { if (value == null) { return true; } if (isArrayLike(value) && (isArray(value) || isString(value) || isArguments(value) || (isObjectLike(value) && isFunction(value.splice)))) { return !value.length; } return !keys(value).length; }
Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) @static @memberOf _ @category Lang @param {*} value The value to check. @returns {boolean} Returns `true` if `value` is an object, else `false`. @example _...
isEmpty
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator // in older versions of Chrome and Safari which return 'function' for regexes // and Safari 8 which returns 'object' for typed array constructors. return isObject(value) && objToString.call(value) == funcTag; }
Checks if `value` is a plain object, that is, an object created by the `Object` constructor or one with a `[[Prototype]]` of `null`. **Note:** This method assumes objects created by the `Object` constructor have no inherited enumerable properties. @static @memberOf _ @category Lang @param {*} value The value to check...
isFunction
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function isString(value) { return typeof value == 'string' || (isObjectLike(value) && objToString.call(value) == stringTag); }
Checks if `value` is `undefined`. @static @memberOf _ @category Lang @param {*} value The value to check. @returns {boolean} Returns `true` if `value` is `undefined`, else `false`. @example _.isUndefined(void 0); // => true _.isUndefined(null); // => false
isString
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function isTypedArray(value) { return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)]; }
Used to avoid iterating over non-enumerable properties in IE < 9.
isTypedArray
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function isUndefined(value) { return value === undefined; }
Used to avoid iterating over non-enumerable properties in IE < 9.
isUndefined
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function pairs(object) { object = toObject(object); var index = -1, props = keys(object), length = props.length, result = Array(length); while (++index < length) { var key = props[index]; result[index] = [key, object[key]]; } return result; }
Detect lack of support for accessing string characters by index. IE < 8 can't access characters by index. IE 8 can only access characters by index on string literals, not string objects. @memberOf _.support @type boolean
pairs
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function values(object) { return baseValues(object, keys(object)); }
A no-operation function that returns `undefined` regardless of the arguments it receives. @static @memberOf _ @category Utility @example var object = { 'user': 'fred' }; _.noop(object) === undefined; // => true
values
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function identity(value) { return value; }
Creates a function that returns the property value at `path` on a given object. @static @memberOf _ @category Utility @param {Array|string} path The path of the property to get. @returns {Function} Returns the new function. @example var objects = [ { 'a': { 'b': { 'c': 2 } } }, { 'a': { 'b': { 'c': 1 } } } ]; _....
identity
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function noop() { // No operation performed. }
Creates a function that returns the property value at `path` on a given object. @static @memberOf _ @category Utility @param {Array|string} path The path of the property to get. @returns {Function} Returns the new function. @example var objects = [ { 'a': { 'b': { 'c': 2 } } }, { 'a': { 'b': { 'c': 1 } } } ]; _....
noop
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function property(path) { return isKey(path) ? baseProperty(path) : basePropertyDeep(path); }
Creates a function that returns the property value at `path` on a given object. @static @memberOf _ @category Utility @param {Array|string} path The path of the property to get. @returns {Function} Returns the new function. @example var objects = [ { 'a': { 'b': { 'c': 2 } } }, { 'a': { 'b': { 'c': 1 } } } ]; _....
property
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function flush() { /* jshint loopfunc: true */ var task, domain; while (head.next) { head = head.next; task = head.task; head.task = void 0; domain = head.domain; if (domain) { head.domain = void 0; dom...
Creates a function that returns the property value at `path` on a given object. @static @memberOf _ @category Utility @param {Array|string} path The path of the property to get. @returns {Function} Returns the new function. @example var objects = [ { 'a': { 'b': { 'c': 2 } } }, { 'a': { 'b': { 'c': 1 } } } ]; _....
flush
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function runSingle(task, domain) { try { task(); } catch (e) { if (isNodeJS) { // In node, uncaught exceptions are considered fatal errors. // Re-throw them synchronously to interrupt flushing! // Ensure continuation if the uncaug...
Creates a function that returns the property value at `path` on a given object. @static @memberOf _ @category Utility @param {Array|string} path The path of the property to get. @returns {Function} Returns the new function. @example var objects = [ { 'a': { 'b': { 'c': 2 } } }, { 'a': { 'b': { 'c': 1 } } } ]; _....
runSingle
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
requestPortTick = function () { // Opera requires us to provide a message payload, regardless of // whether we use it. channel.port2.postMessage(0); }
Creates a function that returns the property value at `path` on a given object. @static @memberOf _ @category Utility @param {Array|string} path The path of the property to get. @returns {Function} Returns the new function. @example var objects = [ { 'a': { 'b': { 'c': 2 } } }, { 'a': { 'b': { 'c': 1 } } } ]; _....
requestPortTick
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function uncurryThis(f) { return function () { return call.apply(f, arguments); }; }
Creates a function that returns the property value at `path` on a given object. @static @memberOf _ @category Utility @param {Array|string} path The path of the property to get. @returns {Function} Returns the new function. @example var objects = [ { 'a': { 'b': { 'c': 2 } } }, { 'a': { 'b': { 'c': 1 } } } ]; _....
uncurryThis
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function isObject(value) { return value === Object(value); }
Constructs a promise for an immediate reference, passes promises through, or coerces promises from different systems. @param value immediate reference or promise
isObject
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function isStopIteration(exception) { return ( object_toString(exception) === "[object StopIteration]" || exception instanceof QReturnValue ); }
Constructs a promise for an immediate reference, passes promises through, or coerces promises from different systems. @param value immediate reference or promise
isStopIteration
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function makeStackTraceLong(error, promise) { // If possible, transform the error stack trace by removing Node and Q // cruft, then concatenating with the stack trace of `promise`. See #57. if (hasStacks && promise.stack && typeof error === "object" && error !== null && error...
Controls whether or not long stack traces will be on
makeStackTraceLong
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function filterStackString(stackString) { var lines = stackString.split("\n"); var desiredLines = []; for (var i = 0; i < lines.length; ++i) { var line = lines[i]; if (!isInternalFrame(line) && !isNodeFrame(line) && line) { desiredLines.push(line); } } return des...
Constructs a {promise, resolve, reject} object. `resolve` is a callback to invoke with a more resolved value for the promise. To fulfill the promise, invoke `resolve` with any value that is not a thenable. To reject the promise, invoke `resolve` with a rejected thenable, or invoke `reject` with the reason directly. To...
filterStackString
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function isNodeFrame(stackLine) { return stackLine.indexOf("(module.js:") !== -1 || stackLine.indexOf("(node.js:") !== -1; }
Constructs a {promise, resolve, reject} object. `resolve` is a callback to invoke with a more resolved value for the promise. To fulfill the promise, invoke `resolve` with any value that is not a thenable. To reject the promise, invoke `resolve` with a rejected thenable, or invoke `reject` with the reason directly. To...
isNodeFrame
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function getFileNameAndLineNumber(stackLine) { // Named functions: "at functionName (filename:lineNumber:columnNumber)" // In IE10 function name can have spaces ("Anonymous function") O_o var attempt1 = /at .+ \((.+):(\d+):(?:\d+)\)$/.exec(stackLine); if (attempt1) { return [attempt1[1], Number(...
Constructs a {promise, resolve, reject} object. `resolve` is a callback to invoke with a more resolved value for the promise. To fulfill the promise, invoke `resolve` with any value that is not a thenable. To reject the promise, invoke `resolve` with a rejected thenable, or invoke `reject` with the reason directly. To...
getFileNameAndLineNumber
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function isInternalFrame(stackLine) { var fileNameAndLineNumber = getFileNameAndLineNumber(stackLine); if (!fileNameAndLineNumber) { return false; } var fileName = fileNameAndLineNumber[0]; var lineNumber = fileNameAndLineNumber[1]; return fileName === qFileName && lineNumber ...
Constructs a {promise, resolve, reject} object. `resolve` is a callback to invoke with a more resolved value for the promise. To fulfill the promise, invoke `resolve` with any value that is not a thenable. To reject the promise, invoke `resolve` with a rejected thenable, or invoke `reject` with the reason directly. To...
isInternalFrame
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function captureLine() { if (!hasStacks) { return; } try { throw new Error(); } catch (e) { var lines = e.stack.split("\n"); var firstLine = lines[0].indexOf("@") > 0 ? lines[1] : lines[2]; var fileNameAndLineNumber = getFileNameAndLineNumber(firstLine); ...
Constructs a {promise, resolve, reject} object. `resolve` is a callback to invoke with a more resolved value for the promise. To fulfill the promise, invoke `resolve` with any value that is not a thenable. To reject the promise, invoke `resolve` with a rejected thenable, or invoke `reject` with the reason directly. To...
captureLine
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function deprecate(callback, name, alternative) { return function () { if (typeof console !== "undefined" && typeof console.warn === "function") { console.warn(name + " is deprecated, use " + alternative + " instead.", new Error("").stack); } ...
Constructs a {promise, resolve, reject} object. `resolve` is a callback to invoke with a more resolved value for the promise. To fulfill the promise, invoke `resolve` with any value that is not a thenable. To reject the promise, invoke `resolve` with a rejected thenable, or invoke `reject` with the reason directly. To...
deprecate
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function Q(value) { // If the object is already a Promise, return it directly. This enables // the resolve function to both be used to created references from objects, // but to tolerably coerce non-promises to promises. if (value instanceof Promise) { return value; } // assimilate the...
Constructs a {promise, resolve, reject} object. `resolve` is a callback to invoke with a more resolved value for the promise. To fulfill the promise, invoke `resolve` with any value that is not a thenable. To reject the promise, invoke `resolve` with a rejected thenable, or invoke `reject` with the reason directly. To...
Q
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function defer() { // if "messages" is an "Array", that indicates that the promise has not yet // been resolved. If it is "undefined", it has been resolved. Each // element of the messages array is itself an array of complete arguments to // forward to the resolved promise. We coerce the resolution v...
Creates a Node-style callback that will resolve or reject the deferred promise. @returns a nodeback
defer
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function become(newPromise) { resolvedPromise = newPromise; promise.source = newPromise; array_reduce(messages, function (undefined, message) { Q.nextTick(function () { newPromise.promiseDispatch.apply(newPromise, message); }); }, void 0); ...
Returns a promise for the first of an array of promises to become settled. @param answers {Array[Any*]} promises to race @returns {Any*} the first promise to be settled
become
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function promise(resolver) { if (typeof resolver !== "function") { throw new TypeError("resolver must be a function."); } var deferred = defer(); try { resolver(deferred.resolve, deferred.reject, deferred.notify); } catch (reason) { deferred.reject(reason); } return d...
Constructs a Promise with a promise descriptor object and optional fallback function. The descriptor contains methods like when(rejected), get(name), set(name, value), post(name, args), and delete(name), which all return either a value, a promise for a value, or a rejection. The fallback accepts the operation name, a...
promise
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function race(answerPs) { return promise(function (resolve, reject) { // Switch to this once we can assume at least ES5 // answerPs.forEach(function (answerP) { // Q(answerP).then(resolve, reject); // }); // Use this in the meantime for (var i = 0, len = answerPs....
Constructs a Promise with a promise descriptor object and optional fallback function. The descriptor contains methods like when(rejected), get(name), set(name, value), post(name, args), and delete(name), which all return either a value, a promise for a value, or a rejection. The fallback accepts the operation name, a...
race
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function Promise(descriptor, fallback, inspect) { if (fallback === void 0) { fallback = function (op) { return reject(new Error( "Promise does not support operation: " + op )); }; } if (inspect === void 0) { inspect = function () { ...
Works almost like "finally", but not called for rejections. Original resolution value is passed through callback unaffected. Callback may return a promise that will be awaited for. @param {Function} callback @returns {Q.Promise} @example doSomething() .then(...) .tap(console.log) .then(...);
Promise
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function _fulfilled(value) { try { return typeof fulfilled === "function" ? fulfilled(value) : value; } catch (exception) { return reject(exception); } }
@returns whether the given object is a promise. Otherwise it is a fulfilled value.
_fulfilled
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function _rejected(exception) { if (typeof rejected === "function") { makeStackTraceLong(exception, self); try { return rejected(exception); } catch (newException) { return reject(newException); } } return reject(exc...
@returns whether the given object is a promise. Otherwise it is a fulfilled value.
_rejected
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function _progressed(value) { return typeof progressed === "function" ? progressed(value) : value; }
@returns whether the given object is a pending promise, meaning not fulfilled or rejected.
_progressed
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function when(value, fulfilled, rejected, progressed) { return Q(value).then(fulfilled, rejected, progressed); }
@returns whether the given object is a rejected promise.
when
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function nearer(value) { if (isPromise(value)) { var inspected = value.inspect(); if (inspected.state === "fulfilled") { return inspected.value; } } return value; }
Constructs a rejected promise. @param reason value describing the failure
nearer
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function isPromise(object) { return object instanceof Promise; }
Constructs a rejected promise. @param reason value describing the failure
isPromise
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function isPromiseAlike(object) { return isObject(object) && typeof object.then === "function"; }
Constructs a rejected promise. @param reason value describing the failure
isPromiseAlike
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function isPending(object) { return isPromise(object) && object.inspect().state === "pending"; }
Constructs a fulfilled promise for an immediate reference. @param value immediate reference
isPending
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function isFulfilled(object) { return !isPromise(object) || object.inspect().state === "fulfilled"; }
Constructs a fulfilled promise for an immediate reference. @param value immediate reference
isFulfilled
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function isRejected(object) { return isPromise(object) && object.inspect().state === "rejected"; }
Constructs a fulfilled promise for an immediate reference. @param value immediate reference
isRejected
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function resetUnhandledRejections() { unhandledReasons.length = 0; unhandledRejections.length = 0; if (!trackUnhandledRejections) { trackUnhandledRejections = true; } }
Converts thenables to Q promises. @param promise thenable promise @returns a Q promise
resetUnhandledRejections
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function trackRejection(promise, reason) { if (!trackUnhandledRejections) { return; } if (typeof process === "object" && typeof process.emit === "function") { Q.nextTick.runAfter(function () { if (array_indexOf(unhandledRejections, promise) !== -1) { process.emit(...
Converts thenables to Q promises. @param promise thenable promise @returns a Q promise
trackRejection
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function untrackRejection(promise) { if (!trackUnhandledRejections) { return; } var at = array_indexOf(unhandledRejections, promise); if (at !== -1) { if (typeof process === "object" && typeof process.emit === "function") { Q.nextTick.runAfter(function () { v...
Spreads the values of a promised array of arguments into the fulfillment callback. @param fulfilled callback that receives variadic arguments from the promised array @param rejected callback that receives the exception if the promise is rejected. @returns a promise for the return value or thrown exception of either cal...
untrackRejection
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function reject(reason) { var rejection = Promise({ "when": function (rejected) { // note that the error has been handled if (rejected) { untrackRejection(this); } return rejected ? rejected(reason) : this; } }, function fallback() ...
Spreads the values of a promised array of arguments into the fulfillment callback. @param fulfilled callback that receives variadic arguments from the promised array @param rejected callback that receives the exception if the promise is rejected. @returns a promise for the return value or thrown exception of either cal...
reject
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function fulfill(value) { return Promise({ "when": function () { return value; }, "get": function (name) { return value[name]; }, "set": function (name, rhs) { value[name] = rhs; }, "delete": function (name) { de...
The async function is a decorator for generator functions, turning them into asynchronous generators. Although generators are only part of the newest ECMAScript 6 drafts, this code does not cause syntax errors in older engines. This code should continue to work and will in fact improve over time as the language impro...
fulfill
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function coerce(promise) { var deferred = defer(); Q.nextTick(function () { try { promise.then(deferred.resolve, deferred.reject, deferred.notify); } catch (exception) { deferred.reject(exception); } }); return deferred.promise; }
The async function is a decorator for generator functions, turning them into asynchronous generators. Although generators are only part of the newest ECMAScript 6 drafts, this code does not cause syntax errors in older engines. This code should continue to work and will in fact improve over time as the language impro...
coerce
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function master(object) { return Promise({ "isDef": function () {} }, function fallback(op, args) { return dispatch(object, op, args); }, function () { return Q(object).inspect(); }); }
The async function is a decorator for generator functions, turning them into asynchronous generators. Although generators are only part of the newest ECMAScript 6 drafts, this code does not cause syntax errors in older engines. This code should continue to work and will in fact improve over time as the language impro...
master
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function spread(value, fulfilled, rejected) { return Q(value).spread(fulfilled, rejected); }
The spawn function is a small wrapper around async that immediately calls the generator and also ends the promise chain, so that any unhandled errors are thrown instead of forwarded to the error handler. This is useful because it's extremely common to run generators at the top-level to work with libraries.
spread
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function async(makeGenerator) { return function () { // when verb is "send", arg is a value // when verb is "throw", arg is an exception function continuer(verb, arg) { var result; // Until V8 3.19 / Chromium 29 is released, SpiderMonkey is the only // en...
The promised function decorator ensures that any promise arguments are settled and passed as values (`this` is also settled and passed as a value). It will also ensure that the result of a function is always a promise. @example var add = Q.promised(function (a, b) { return a + b; }); add(Q(a), Q(B)); @param {fun...
async
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function continuer(verb, arg) { var result; // Until V8 3.19 / Chromium 29 is released, SpiderMonkey is the only // engine that has a deployed base of browsers that support generators. // However, SM's generators use the Python-inspired semantics of // outdat...
sends a message to a value in a future turn @param object* the recipient @param op the name of the message operation, e.g., "when", @param args further arguments to be forwarded to the operation @returns result {Promise} a promise for the result of the operation
continuer
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function _return(value) { throw new QReturnValue(value); }
Invokes a method in a future turn. @param object promise or immediate reference for target object @param name name of method to invoke @param ...args array of invocation arguments @return promise for the return value
_return
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function promised(callback) { return function () { return spread([this, all(arguments)], function (self, args) { return callback.apply(self, args); }); }; }
Applies the promised function in a future turn. @param object promise or immediate reference for target function @param args array of application arguments
promised
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function dispatch(object, op, args) { return Q(object).dispatch(op, args); }
Calls the promised function in a future turn. @param object promise or immediate reference for target function @param ...args array of application arguments
dispatch
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function all(promises) { return when(promises, function (promises) { var pendingCount = 0; var deferred = defer(); array_reduce(promises, function (undefined, promise, index) { var snapshot; if ( isPromise(promise) && (snapshot = promis...
Turns an array of promises into a promise for an array of their states (as returned by `inspect`) when they have all settled. @param {Array[Any*]} values an array (or promise for an array) of values (or promises for values) @returns {Array[State]} an array of states for the respective values.
all
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function any(promises) { if (promises.length === 0) { return Q.resolve(); } var deferred = Q.defer(); var pendingCount = 0; array_reduce(promises, function (prev, current, index) { var promise = promises[index]; pendingCount++; when(promise, onFulfilled, onRejected...
Attaches a listener that can respond to progress notifications from a promise's originating deferred. This listener receives the exact arguments passed to ``deferred.notify``. @param {Any*} promise for something @param {Function} callback to receive any progress notifications @returns the given promise, unchanged
any
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function onRejected() { pendingCount--; if (pendingCount === 0) { deferred.reject(new Error( "Can't get fulfillment value from any promise, all " + "promises were rejected." )); } }
Provides an opportunity to observe the settling of a promise, regardless of whether the promise is fulfilled or rejected. Forwards the resolution to the returned promise when the callback is done. The callback can return a promise to defer completion. @param {Any*} promise @param {Function} callback to observe the res...
onRejected
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function onProgress(progress) { deferred.notify({ index: index, value: progress }); }
Provides an opportunity to observe the settling of a promise, regardless of whether the promise is fulfilled or rejected. Forwards the resolution to the returned promise when the callback is done. The callback can return a promise to defer completion. @param {Any*} promise @param {Function} callback to observe the res...
onProgress
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function allResolved(promises) { return when(promises, function (promises) { promises = array_map(promises, Q); return when(all(array_map(promises, function (promise) { return when(promise, noop, noop); })), function () { return promises; }); }); }
Terminates a chain of promises, forcing rejections to be thrown as exceptions. @param {Any*} promise at the end of a chain of promises @returns nothing
allResolved
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function allSettled(promises) { return Q(promises).allSettled(); }
Terminates a chain of promises, forcing rejections to be thrown as exceptions. @param {Any*} promise at the end of a chain of promises @returns nothing
allSettled
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function regardless() { return promise.inspect(); }
Causes a promise to be rejected if it does not get fulfilled before some milliseconds time out. @param {Any*} promise @param {Number} milliseconds timeout @param {Any*} custom error message or Error object (optional) @returns a promise for the resolution of the given promise if it is fulfilled before the timeout, other...
regardless
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function progress(object, progressed) { return Q(object).then(void 0, void 0, progressed); }
Returns a promise for the given value (or promised value), some milliseconds after it resolved. Passes rejections immediately. @param {Any*} promise @param {Number} milliseconds @returns a promise for the resolution of the given promise after milliseconds time has elapsed since the resolution of the given promise. If t...
progress
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
onUnhandledError = function (error) { // forward to a future turn so that ``when`` // does not catch it and turn it into a rejection. Q.nextTick(function () { makeStackTraceLong(error, promise); if (Q.onerror) { Q.onerror(error); } else { ...
Wraps a NodeJS continuation passing function and returns an equivalent version that returns a promise. @example Q.nfbind(FS.readFile, __filename)("utf-8") .then(console.log) .done()
onUnhandledError
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function bound() { return callback.apply(thisp, arguments); }
If a function would like to support both Node continuation-passing-style and promise-returning-style, it can end its internal promise chain with `nodeify(nodeback)`, forwarding the optional nodeback argument. If the user elects to use a nodeback, the result will be sent there. If they do not pass a nodeback, they wil...
bound
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function nodeify(object, nodeback) { return Q(object).nodeify(nodeback); }
If a function would like to support both Node continuation-passing-style and promise-returning-style, it can end its internal promise chain with `nodeify(nodeback)`, forwarding the optional nodeback argument. If the user elects to use a nodeback, the result will be sent there. If they do not pass a nodeback, they wil...
nodeify
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function serialize(obj) { if (!isObject(obj)) return obj; var pairs = []; for (var key in obj) { pushEncodedKeyValuePair(pairs, key, obj[key]); } return pairs.join('&'); }
Return header field parameters. @param {String} str @return {Object} @api private
serialize
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function pushEncodedKeyValuePair(pairs, key, val) { if (val != null) { if (Array.isArray(val)) { val.forEach(function(v) { pushEncodedKeyValuePair(pairs, key, v); }); } else if (isObject(val)) { for(var subkey in val) { pushEncodedKeyValuePair(pairs, key + '[' + subkey + ']',...
Return header field parameters. @param {String} str @return {Object} @api private
pushEncodedKeyValuePair
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function parseString(str) { var obj = {}; var pairs = str.split('&'); var pair; var pos; for (var i = 0, len = pairs.length; i < len; ++i) { pair = pairs[i]; pos = pair.indexOf('='); if (pos == -1) { obj[decodeURIComponent(pair)] = ''; } else { obj[decodeURIComponent(pair.slice(0,...
Initialize a new `Response` with the given `xhr`. - set flags (.ok, .error, etc) - parse header Examples: Aliasing `superagent` as `request` is nice: request = superagent; We can use the promise-like API, or pass callbacks: request.get('/').end(function(res){}); request.get('/', function(res){}...
parseString
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function parseHeader(str) { var lines = str.split(/\r?\n/); var fields = {}; var index; var line; var field; var val; lines.pop(); // trailing CRLF for (var i = 0, len = lines.length; i < len; ++i) { line = lines[i]; index = line.indexOf(':'); field = line.slice(0, index).toLowerCase(); ...
Parse the given body `str`. Used for auto-parsing of bodies. Parsers are defined on the `superagent.parse` object. @param {String} str @return {Mixed} @api private
parseHeader
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function isJSON(mime) { return /[\/+]json\b/.test(mime); }
Parse the given body `str`. Used for auto-parsing of bodies. Parsers are defined on the `superagent.parse` object. @param {String} str @return {Mixed} @api private
isJSON
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function type(str){ return str.split(/ *; */).shift(); }
Set flags such as `.ok` based on `status`. For example a 2xx response will give you a `.ok` of __true__ whereas 5xx will be __false__ and `.error` will be __true__. The `.clientError` and `.serverError` are also available to be more specific, and `.statusType` is the class of error ranging from 1..5 sometimes useful f...
type
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function params(str){ return str.split(/ *; */).reduce(function(obj, str){ var parts = str.split(/ *= */), key = parts.shift(), val = parts.shift(); if (key && val) obj[key] = val; return obj; }, {}); }
Set flags such as `.ok` based on `status`. For example a 2xx response will give you a `.ok` of __true__ whereas 5xx will be __false__ and `.error` will be __true__. The `.clientError` and `.serverError` are also available to be more specific, and `.statusType` is the class of error ranging from 1..5 sometimes useful f...
params
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function Response(req, options) { options = options || {}; this.req = req; this.xhr = this.req.xhr; // responseText is accessible only if responseType is '' or 'text' and on older browsers this.text = ((this.req.method !='HEAD' && (this.xhr.responseType === '' || this.xhr.responseType === 'text')) || typeof t...
Initialize a new `Request` with the given `method` and `url`. @param {String} method @param {String} url @api public
Response
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
function Request(method, url) { var self = this; this._query = this._query || []; this.method = method; this.url = url; this.header = {}; // preserves header name case this._header = {}; // coerces header names to lowercase this.on('end', function(){ var err = null; var res = null; try { ...
Add query-string `val`. Examples: request.get('/shoes') .query('size=10') .query({ color: 'blue' }) @param {Object|String} val @return {Request} for chaining @api public
Request
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0
handleProgress = function(e){ if (e.total > 0) { e.percent = e.loaded / e.total * 100; } e.direction = 'download'; self.emit('progress', e); }
POST `url` with optional `data` and callback `fn(res)`. @param {String} url @param {Mixed} [data] @param {Function} [fn] @return {Request} @api public
handleProgress
javascript
edp963/wormhole
rider/swagger-ui/swagger-ui.js
https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js
Apache-2.0