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 property(key) {
return function(object) {
return object[key];
};
} | Creates a "_.pluck" style function, which returns the `key` value of a
given object.
@static
@memberOf _
@category Utilities
@param {string} key The name of the property to retrieve.
@returns {Function} Returns the new function.
@example
var characters = [
{ 'name': 'fred', 'age': 40 },
{ 'name': 'barney', 'age... | property | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.js | MIT |
function random(min, max, floating) {
var noMin = min == null,
noMax = max == null;
if (floating == null) {
if (typeof min == 'boolean' && noMax) {
floating = min;
min = 1;
}
else if (!noMax && typeof max == 'boolean') {
floating = max;
... | Produces a random number between `min` and `max` (inclusive). If only one
argument is provided a number between `0` and the given number will be
returned. If `floating` is truey or either `min` or `max` are floats a
floating-point number will be returned instead of an integer.
@static
@memberOf _
@category Utilities
@... | random | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.js | MIT |
function result(object, key) {
if (object) {
var value = object[key];
return isFunction(value) ? object[key]() : value;
}
} | Resolves the value of property `key` on `object`. If `key` is a function
it will be invoked with the `this` binding of `object` and its result returned,
else the property value is returned. If `object` is falsey then `undefined`
is returned.
@static
@memberOf _
@category Utilities
@param {Object} object The object to ... | result | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.js | MIT |
function times(n, callback, thisArg) {
n = (n = +n) > -1 ? n : 0;
var index = -1,
result = Array(n);
callback = baseCreateCallback(callback, thisArg, 1);
while (++index < n) {
result[index] = callback(index);
}
return result;
} | Executes the callback `n` times, returning an array of the results
of each callback execution. The callback is bound to `thisArg` and invoked
with one argument; (index).
@static
@memberOf _
@category Utilities
@param {number} n The number of times to execute the callback.
@param {Function} callback The function called... | times | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.js | MIT |
function unescape(string) {
return string == null ? '' : String(string).replace(reEscapedHtml, unescapeHtmlChar);
} | The inverse of `_.escape` this method converts the HTML entities
`&`, `<`, `>`, `"`, and `'` in `string` to their
corresponding characters.
@static
@memberOf _
@category Utilities
@param {string} string The string to unescape.
@returns {string} Returns the unescaped string.
@example
_.unescape('Fre... | unescape | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.js | MIT |
function uniqueId(prefix) {
var id = ++idCounter;
return String(prefix == null ? '' : prefix) + id;
} | Generates a unique ID. If `prefix` is provided the ID will be appended to it.
@static
@memberOf _
@category Utilities
@param {string} [prefix] The value to prefix the ID with.
@returns {string} Returns the unique ID.
@example
_.uniqueId('contact_');
// => 'contact_104'
_.uniqueId();
// => '105' | uniqueId | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.js | MIT |
function chain(value) {
value = new lodashWrapper(value);
value.__chain__ = true;
return value;
} | Creates a `lodash` object that wraps the given value with explicit
method chaining enabled.
@static
@memberOf _
@category Chaining
@param {*} value The value to wrap.
@returns {Object} Returns the wrapper object.
@example
var characters = [
{ 'name': 'barney', 'age': 36 },
{ 'name': 'fred', 'age': 40 },
{ '... | chain | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.js | MIT |
function tap(value, interceptor) {
interceptor(value);
return value;
} | Invokes `interceptor` with the `value` as the first argument and then
returns `value`. The purpose of this method is to "tap into" a method
chain in order to perform operations on intermediate results within
the chain.
@static
@memberOf _
@category Chaining
@param {*} value The value to provide to `interceptor`.
@para... | tap | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.js | MIT |
function wrapperChain() {
this.__chain__ = true;
return this;
} | Enables explicit method chaining on the wrapper object.
@name chain
@memberOf _
@category Chaining
@returns {*} Returns the wrapper object.
@example
var characters = [
{ 'name': 'barney', 'age': 36 },
{ 'name': 'fred', 'age': 40 }
];
// without explicit chaining
_(characters).first();
// => { 'name': 'barney',... | wrapperChain | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.js | MIT |
function wrapperToString() {
return String(this.__wrapped__);
} | Produces the `toString` result of the wrapped value.
@name toString
@memberOf _
@category Chaining
@returns {string} Returns the string result.
@example
_([1, 2, 3]).toString();
// => '1,2,3' | wrapperToString | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.js | MIT |
function wrapperValueOf() {
return this.__wrapped__;
} | Extracts the wrapped value.
@name valueOf
@memberOf _
@alias value
@category Chaining
@returns {*} Returns the wrapped value.
@example
_([1, 2, 3]).valueOf();
// => [1, 2, 3] | wrapperValueOf | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.js | MIT |
function baseIndexOf(array, value, fromIndex) {
var index = (fromIndex || 0) - 1,
length = array ? array.length : 0;
while (++index < length) {
if (array[index] === value) {
return index;
}
}
return -1;
} | The base implementation of `_.indexOf` without support for binary searches
or `fromIndex` constraints.
@private
@param {Array} array The array to search.
@param {*} value The value to search for.
@param {number} [fromIndex=0] The index to search from.
@returns {number} Returns the index of the matched value or `-1`. | baseIndexOf | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function compareAscending(a, b) {
var ac = a.criteria,
bc = b.criteria,
index = -1,
length = ac.length;
while (++index < length) {
var value = ac[index],
other = bc[index];
if (value !== other) {
if (value > other || typeof value == 'undefined') {
... | Used by `sortBy` to compare transformed `collection` elements, stable sorting
them in ascending order.
@private
@param {Object} a The object to compare to `b`.
@param {Object} b The object to compare to `a`.
@returns {number} Returns the sort order indicator of `1` or `-1`. | compareAscending | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function escapeStringChar(match) {
return '\\' + stringEscapes[match];
} | Used by `template` to escape characters for inclusion in compiled
string literals.
@private
@param {string} match The matched character to escape.
@returns {string} Returns the escaped character. | escapeStringChar | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function slice(array, start, end) {
start || (start = 0);
if (typeof end == 'undefined') {
end = array ? array.length : 0;
}
var index = -1,
length = end - start || 0,
result = Array(length < 0 ? 0 : length);
while (++index < length) {
result[index] = array[start + index... | Slices the `collection` from the `start` index up to, but not including,
the `end` index.
Note: This function is used instead of `Array#slice` to support node lists
in IE < 9 and to ensure dense arrays are returned.
@private
@param {Array|Object|string} collection The collection to slice.
@param {number} start The st... | slice | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function lodashWrapper(value, chainAll) {
this.__chain__ = !!chainAll;
this.__wrapped__ = value;
} | A fast path for creating `lodash` wrapper objects.
@private
@param {*} value The value to wrap in a `lodash` instance.
@param {boolean} chainAll A flag to enable chaining for all methods
@returns {Object} Returns a `lodash` instance. | lodashWrapper | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function baseBind(bindData) {
var func = bindData[0],
partialArgs = bindData[2],
thisArg = bindData[4];
function bound() {
// `Function#bind` spec
// http://es5.github.io/#x15.3.4.5
if (partialArgs) {
// avoid `arguments` object deoptimizations by using `slice` instead... | The base implementation of `_.bind` that creates the bound function and
sets its meta data.
@private
@param {Array} bindData The bind data array.
@returns {Function} Returns the new bound function. | baseBind | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function bound() {
// `Function#bind` spec
// http://es5.github.io/#x15.3.4.5
if (partialArgs) {
// avoid `arguments` object deoptimizations by using `slice` instead
// of `Array.prototype.slice.call` and not assigning `arguments` to a
// variable as a ternary expression
... | The base implementation of `_.bind` that creates the bound function and
sets its meta data.
@private
@param {Array} bindData The bind data array.
@returns {Function} Returns the new bound function. | bound | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function baseCreate(prototype, properties) {
return isObject(prototype) ? nativeCreate(prototype) : {};
} | The base implementation of `_.create` without support for assigning
properties to the created object.
@private
@param {Object} prototype The object to inherit from.
@returns {Object} Returns the new object. | baseCreate | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function baseCreateCallback(func, thisArg, argCount) {
if (typeof func != 'function') {
return identity;
}
// exit early for no `thisArg` or already bound by `Function#bind`
if (typeof thisArg == 'undefined' || !('prototype' in func)) {
return func;
}
switch (argCount) {
case 1... | The base implementation of `_.createCallback` without support for creating
"_.pluck" or "_.where" style callbacks.
@private
@param {*} [func=identity] The value to convert to a callback.
@param {*} [thisArg] The `this` binding of the created callback.
@param {number} [argCount] The number of arguments the callback acc... | baseCreateCallback | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function baseCreateWrapper(bindData) {
var func = bindData[0],
bitmask = bindData[1],
partialArgs = bindData[2],
partialRightArgs = bindData[3],
thisArg = bindData[4],
arity = bindData[5];
var isBind = bitmask & 1,
isBindKey = bitmask & 2,
isCurry = bitma... | The base implementation of `createWrapper` that creates the wrapper and
sets its meta data.
@private
@param {Array} bindData The bind data array.
@returns {Function} Returns the new function. | baseCreateWrapper | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function bound() {
var thisBinding = isBind ? thisArg : this;
if (partialArgs) {
var args = slice(partialArgs);
push.apply(args, arguments);
}
if (partialRightArgs || isCurry) {
args || (args = slice(arguments));
if (partialRightArgs) {
push.apply(args, ... | The base implementation of `createWrapper` that creates the wrapper and
sets its meta data.
@private
@param {Array} bindData The bind data array.
@returns {Function} Returns the new function. | bound | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function baseDifference(array, values) {
var index = -1,
indexOf = getIndexOf(),
length = array ? array.length : 0,
result = [];
while (++index < length) {
var value = array[index];
if (indexOf(values, value) < 0) {
result.push(value);
}
}
return result... | The base implementation of `_.difference` that accepts a single array
of values to exclude.
@private
@param {Array} array The array to process.
@param {Array} [values] The array of values to exclude.
@returns {Array} Returns a new array of filtered values. | baseDifference | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function baseFlatten(array, isShallow, isStrict, fromIndex) {
var index = (fromIndex || 0) - 1,
length = array ? array.length : 0,
result = [];
while (++index < length) {
var value = array[index];
if (value && typeof value == 'object' && typeof value.length == 'number'
&&... | The base implementation of `_.flatten` without support for callback
shorthands or `thisArg` binding.
@private
@param {Array} array The array to flatten.
@param {boolean} [isShallow=false] A flag to restrict flattening to a single level.
@param {boolean} [isStrict=false] A flag to restrict flattening to arrays and `arg... | baseFlatten | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function baseIsEqual(a, b, stackA, stackB) {
if (a === b) {
return a !== 0 || (1 / a == 1 / b);
}
var type = typeof a,
otherType = typeof b;
if (a === a &&
!(a && objectTypes[type]) &&
!(b && objectTypes[otherType])) {
return false;
}
if (a == null || b == nu... | The base implementation of `_.isEqual`, without support for `thisArg` binding,
that allows partial "_.where" style comparisons.
@private
@param {*} a The value to compare.
@param {*} b The other value to compare.
@param {Function} [callback] The function to customize comparing values.
@param {Function} [isWhere=false]... | baseIsEqual | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function baseRandom(min, max) {
return min + floor(nativeRandom() * (max - min + 1));
} | The base implementation of `_.random` without argument juggling or support
for returning floating-point numbers.
@private
@param {number} min The minimum possible value.
@param {number} max The maximum possible value.
@returns {number} Returns a random number. | baseRandom | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function baseUniq(array, isSorted, callback) {
var index = -1,
indexOf = getIndexOf(),
length = array ? array.length : 0,
result = [],
seen = callback ? [] : result;
while (++index < length) {
var value = array[index],
computed = callback ? callback(value, index,... | The base implementation of `_.uniq` without support for callback shorthands
or `thisArg` binding.
@private
@param {Array} array The array to process.
@param {boolean} [isSorted=false] A flag to indicate that `array` is sorted.
@param {Function} [callback] The function called per iteration.
@returns {Array} Returns a d... | baseUniq | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function createAggregator(setter) {
return function(collection, callback, thisArg) {
var result = {};
callback = createCallback(callback, thisArg, 3);
var index = -1,
length = collection ? collection.length : 0;
if (typeof length == 'number') {
while (++index < length) {
... | Creates a function that aggregates a collection, creating an object composed
of keys generated from the results of running each element of the collection
through a callback. The given `setter` function sets the keys and values
of the composed object.
@private
@param {Function} setter The setter function.
@returns {Fun... | createAggregator | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function createWrapper(func, bitmask, partialArgs, partialRightArgs, thisArg, arity) {
var isBind = bitmask & 1,
isBindKey = bitmask & 2,
isCurry = bitmask & 4,
isCurryBound = bitmask & 8,
isPartial = bitmask & 16,
isPartialRight = bitmask & 32;
if (!isBindKey && !isFunc... | Creates a function that, when called, either curries or invokes `func`
with an optional `this` binding and partially applied arguments.
@private
@param {Function|string} func The function or method name to reference.
@param {number} bitmask The bitmask of method flags to compose.
The bitmask may be composed of the fo... | createWrapper | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function escapeHtmlChar(match) {
return htmlEscapes[match];
} | Used by `escape` to convert characters to HTML entities.
@private
@param {string} match The matched character to escape.
@returns {string} Returns the escaped character. | escapeHtmlChar | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function getIndexOf() {
var result = (result = lodash.indexOf) === indexOf ? baseIndexOf : result;
return result;
} | Gets the appropriate "indexOf" function. If the `_.indexOf` method is
customized, this method returns the custom method, otherwise it returns
the `baseIndexOf` function.
@private
@returns {Function} Returns the "indexOf" function. | getIndexOf | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function isNative(value) {
return typeof value == 'function' && reNative.test(value);
} | Checks if `value` is a native function.
@private
@param {*} value The value to check.
@returns {boolean} Returns `true` if the `value` is a native function, else `false`. | isNative | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function unescapeHtmlChar(match) {
return htmlUnescapes[match];
} | Used by `unescape` to convert HTML entities to characters.
@private
@param {string} match The matched character to unescape.
@returns {string} Returns the unescaped character. | unescapeHtmlChar | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function isArguments(value) {
return value && typeof value == 'object' && typeof value.length == 'number' &&
toString.call(value) == argsClass || false;
} | Checks if `value` is an `arguments` object.
@static
@memberOf _
@category Objects
@param {*} value The value to check.
@returns {boolean} Returns `true` if the `value` is an `arguments` object, else `false`.
@example
(function() { return _.isArguments(arguments); })(1, 2, 3);
// => true
_.isArguments([1, 2, 3]);
// ... | isArguments | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
shimKeys = function(object) {
var index, iterable = object, result = [];
if (!iterable) return result;
if (!(objectTypes[typeof object])) return result;
for (index in iterable) {
if (hasOwnProperty.call(iterable, index)) {
result.push(index);
}
}
return result
} | A fallback implementation of `Object.keys` which produces an array of the
given object's own enumerable property names.
@private
@type Function
@param {Object} object The object to inspect.
@returns {Array} Returns an array of property names. | shimKeys | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function assign(object) {
if (!object) {
return object;
}
for (var argsIndex = 1, argsLength = arguments.length; argsIndex < argsLength; argsIndex++) {
var iterable = arguments[argsIndex];
if (iterable) {
for (var key in iterable) {
object[key] = iterable[key];
}
... | Assigns own enumerable properties of source object(s) to the destination
object. Subsequent sources will overwrite property assignments of previous
sources. If a callback is provided it will be executed to produce the
assigned values. The callback is bound to `thisArg` and invoked with two
arguments; (objectValue, sour... | assign | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function clone(value) {
return isObject(value)
? (isArray(value) ? slice(value) : assign({}, value))
: value;
} | Creates a clone of `value`. If `isDeep` is `true` nested objects will also
be cloned, otherwise they will be assigned by reference. If a callback
is provided it will be executed to produce the cloned values. If the
callback returns `undefined` cloning will be handled by the method instead.
The callback is bound to `thi... | clone | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function defaults(object) {
if (!object) {
return object;
}
for (var argsIndex = 1, argsLength = arguments.length; argsIndex < argsLength; argsIndex++) {
var iterable = arguments[argsIndex];
if (iterable) {
for (var key in iterable) {
if (typeof object[key] == 'undefined'... | Assigns own enumerable properties of source object(s) to the destination
object for all destination properties that resolve to `undefined`. Once a
property is set, additional defaults of the same property will be ignored.
@static
@memberOf _
@type Function
@category Objects
@param {Object} object The destination objec... | defaults | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
forIn = function(collection, callback) {
var index, iterable = collection, result = iterable;
if (!iterable) return result;
if (!objectTypes[typeof iterable]) return result;
for (index in iterable) {
if (callback(iterable[index], index, collection) === indicatorObject) return result;
}
... | Iterates over own and inherited enumerable properties of an object,
executing the callback for each property. The callback is bound to `thisArg`
and invoked with three arguments; (value, key, object). Callbacks may exit
iteration early by explicitly returning `false`.
@static
@memberOf _
@type Function
@category Objec... | forIn | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
forOwn = function(collection, callback) {
var index, iterable = collection, result = iterable;
if (!iterable) return result;
if (!objectTypes[typeof iterable]) return result;
for (index in iterable) {
if (hasOwnProperty.call(iterable, index)) {
if (callback(iterable[index], index, co... | Iterates over own enumerable properties of an object, executing the callback
for each property. The callback is bound to `thisArg` and invoked with three
arguments; (value, key, object). Callbacks may exit iteration early by
explicitly returning `false`.
@static
@memberOf _
@type Function
@category Objects
@param {Obj... | forOwn | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function functions(object) {
var result = [];
forIn(object, function(value, key) {
if (isFunction(value)) {
result.push(key);
}
});
return result.sort();
} | Creates a sorted array of property names of all enumerable properties,
own and inherited, of `object` that have function values.
@static
@memberOf _
@alias methods
@category Objects
@param {Object} object The object to inspect.
@returns {Array} Returns an array of property names that have function values.
@example
_.... | functions | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function has(object, key) {
return object ? hasOwnProperty.call(object, key) : false;
} | Checks if the specified property name exists as a direct property of `object`,
instead of an inherited property.
@static
@memberOf _
@category Objects
@param {Object} object The object to inspect.
@param {string} key The name of the property to check.
@returns {boolean} Returns `true` if key is a direct property, else... | has | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function invert(object) {
var index = -1,
props = keys(object),
length = props.length,
result = {};
while (++index < length) {
var key = props[index];
result[object[key]] = key;
}
return result;
} | Creates an object composed of the inverted keys and values of the given object.
@static
@memberOf _
@category Objects
@param {Object} object The object to invert.
@returns {Object} Returns the created inverted object.
@example
_.invert({ 'first': 'fred', 'second': 'barney' });
// => { 'fred': 'first', 'barney': 'seco... | invert | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function isBoolean(value) {
return value === true || value === false ||
value && typeof value == 'object' && toString.call(value) == boolClass || false;
} | Checks if `value` is a boolean value.
@static
@memberOf _
@category Objects
@param {*} value The value to check.
@returns {boolean} Returns `true` if the `value` is a boolean value, else `false`.
@example
_.isBoolean(null);
// => false | isBoolean | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function isDate(value) {
return value && typeof value == 'object' && toString.call(value) == dateClass || false;
} | Checks if `value` is a date.
@static
@memberOf _
@category Objects
@param {*} value The value to check.
@returns {boolean} Returns `true` if the `value` is a date, else `false`.
@example
_.isDate(new Date);
// => true | isDate | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function isElement(value) {
return value && value.nodeType === 1 || false;
} | Checks if `value` is a DOM element.
@static
@memberOf _
@category Objects
@param {*} value The value to check.
@returns {boolean} Returns `true` if the `value` is a DOM element, else `false`.
@example
_.isElement(document.body);
// => true | isElement | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function isEmpty(value) {
if (!value) {
return true;
}
if (isArray(value) || isString(value)) {
return !value.length;
}
for (var key in value) {
if (hasOwnProperty.call(value, key)) {
return false;
}
}
return true;
} | Checks if `value` is empty. Arrays, strings, or `arguments` objects with a
length of `0` and objects with no own enumerable properties are considered
"empty".
@static
@memberOf _
@category Objects
@param {Array|Object|string} value The value to inspect.
@returns {boolean} Returns `true` if the `value` is empty, else `... | isEmpty | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function isEqual(a, b) {
return baseIsEqual(a, b);
} | Performs a deep comparison between two values to determine if they are
equivalent to each other. If a callback is provided it will be executed
to compare values. If the callback returns `undefined` comparisons will
be handled by the method instead. The callback is bound to `thisArg` and
invoked with two arguments; (a, ... | isEqual | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function isFinite(value) {
return nativeIsFinite(value) && !nativeIsNaN(parseFloat(value));
} | Checks if `value` is, or can be coerced to, a finite number.
Note: This is not the same as native `isFinite` which will return true for
booleans and empty strings. See http://es5.github.io/#x15.1.2.5.
@static
@memberOf _
@category Objects
@param {*} value The value to check.
@returns {boolean} Returns `true` if the `... | isFinite | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function isFunction(value) {
return typeof value == 'function';
} | Checks if `value` is a function.
@static
@memberOf _
@category Objects
@param {*} value The value to check.
@returns {boolean} Returns `true` if the `value` is a function, else `false`.
@example
_.isFunction(_);
// => true | isFunction | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function isObject(value) {
// check if the value is the ECMAScript language type of Object
// http://es5.github.io/#x8
// and avoid a V8 bug
// http://code.google.com/p/v8/issues/detail?id=2291
return !!(value && objectTypes[typeof value]);
} | Checks if `value` is the language type of Object.
(e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
@static
@memberOf _
@category Objects
@param {*} value The value to check.
@returns {boolean} Returns `true` if the `value` is an object, else `false`.
@example
_.isObject({});
// => tru... | isObject | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function isNaN(value) {
// `NaN` as a primitive is the only value that is not equal to itself
// (perform the [[Class]] check first to avoid errors with some host objects in IE)
return isNumber(value) && value != +value;
} | Checks if `value` is `NaN`.
Note: This is not the same as native `isNaN` which will return `true` for
`undefined` and other non-numeric values. See http://es5.github.io/#x15.1.2.4.
@static
@memberOf _
@category Objects
@param {*} value The value to check.
@returns {boolean} Returns `true` if the `value` is `NaN`, els... | isNaN | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function isNull(value) {
return value === null;
} | Checks if `value` is `null`.
@static
@memberOf _
@category Objects
@param {*} value The value to check.
@returns {boolean} Returns `true` if the `value` is `null`, else `false`.
@example
_.isNull(null);
// => true
_.isNull(undefined);
// => false | isNull | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function isNumber(value) {
return typeof value == 'number' ||
value && typeof value == 'object' && toString.call(value) == numberClass || false;
} | Checks if `value` is a number.
Note: `NaN` is considered a number. See http://es5.github.io/#x8.5.
@static
@memberOf _
@category Objects
@param {*} value The value to check.
@returns {boolean} Returns `true` if the `value` is a number, else `false`.
@example
_.isNumber(8.4 * 5);
// => true | isNumber | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function isRegExp(value) {
return value && objectTypes[typeof value] && toString.call(value) == regexpClass || false;
} | Checks if `value` is a regular expression.
@static
@memberOf _
@category Objects
@param {*} value The value to check.
@returns {boolean} Returns `true` if the `value` is a regular expression, else `false`.
@example
_.isRegExp(/fred/);
// => true | isRegExp | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function isString(value) {
return typeof value == 'string' ||
value && typeof value == 'object' && toString.call(value) == stringClass || false;
} | Checks if `value` is a string.
@static
@memberOf _
@category Objects
@param {*} value The value to check.
@returns {boolean} Returns `true` if the `value` is a string, else `false`.
@example
_.isString('fred');
// => true | isString | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function isUndefined(value) {
return typeof value == 'undefined';
} | Checks if `value` is `undefined`.
@static
@memberOf _
@category Objects
@param {*} value The value to check.
@returns {boolean} Returns `true` if the `value` is `undefined`, else `false`.
@example
_.isUndefined(void 0);
// => true | isUndefined | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function pairs(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;
} | Creates a two dimensional array of an object's key-value pairs,
i.e. `[[key1, value1], [key2, value2]]`.
@static
@memberOf _
@category Objects
@param {Object} object The object to inspect.
@returns {Array} Returns new array of key-value pairs.
@example
_.pairs({ 'barney': 36, 'fred': 40 });
// => [['barney', 36], ['f... | pairs | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function pick(object) {
var index = -1,
props = baseFlatten(arguments, true, false, 1),
length = props.length,
result = {};
while (++index < length) {
var key = props[index];
if (key in object) {
result[key] = object[key];
}
}
return result;
} | Creates a shallow clone of `object` composed of the specified properties.
Property names may be specified as individual arguments or as arrays of
property names. If a callback is provided it will be executed for each
property of `object` picking the properties the callback returns truey
for. The callback is bound to `t... | pick | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function values(object) {
var index = -1,
props = keys(object),
length = props.length,
result = Array(length);
while (++index < length) {
result[index] = object[props[index]];
}
return result;
} | Creates an array composed of the own enumerable property values of `object`.
@static
@memberOf _
@category Objects
@param {Object} object The object to inspect.
@returns {Array} Returns an array of property values.
@example
_.values({ 'one': 1, 'two': 2, 'three': 3 });
// => [1, 2, 3] (property order is not guarantee... | values | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function contains(collection, target) {
var indexOf = getIndexOf(),
length = collection ? collection.length : 0,
result = false;
if (length && typeof length == 'number') {
result = indexOf(collection, target) > -1;
} else {
forOwn(collection, function(value) {
return (res... | Checks if a given value is present in a collection using strict equality
for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the
offset from the end of the collection.
@static
@memberOf _
@alias include
@category Collections
@param {Array|Object|string} collection The collection to iterate over.
@pa... | contains | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function every(collection, callback, thisArg) {
var result = true;
callback = createCallback(callback, thisArg, 3);
var index = -1,
length = collection ? collection.length : 0;
if (typeof length == 'number') {
while (++index < length) {
if (!(result = !!callback(collection[index]... | Checks if the given callback returns truey value for **all** elements of
a collection. The callback is bound to `thisArg` and invoked with three
arguments; (value, index|key, collection).
If a property name is provided for `callback` the created "_.pluck" style
callback will return the property value of the given elem... | every | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function filter(collection, callback, thisArg) {
var result = [];
callback = createCallback(callback, thisArg, 3);
var index = -1,
length = collection ? collection.length : 0;
if (typeof length == 'number') {
while (++index < length) {
var value = collection[index];
if (c... | Iterates over elements of a collection, returning an array of all elements
the callback returns truey for. The callback is bound to `thisArg` and
invoked with three arguments; (value, index|key, collection).
If a property name is provided for `callback` the created "_.pluck" style
callback will return the property val... | filter | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function find(collection, callback, thisArg) {
callback = createCallback(callback, thisArg, 3);
var index = -1,
length = collection ? collection.length : 0;
if (typeof length == 'number') {
while (++index < length) {
var value = collection[index];
if (callback(value, index, c... | Iterates over elements of a collection, returning the first element that
the callback returns truey for. The callback is bound to `thisArg` and
invoked with three arguments; (value, index|key, collection).
If a property name is provided for `callback` the created "_.pluck" style
callback will return the property value... | find | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function findWhere(object, properties) {
return where(object, properties, true);
} | Examines each element in a `collection`, returning the first that
has the given properties. When checking `properties`, this method
performs a deep comparison between values to determine if they are
equivalent to each other.
@static
@memberOf _
@category Collections
@param {Array|Object|string} collection The collecti... | findWhere | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function forEach(collection, callback, thisArg) {
var index = -1,
length = collection ? collection.length : 0;
callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3);
if (typeof length == 'number') {
while (++index < length) {
if (ca... | Iterates over elements of a collection, executing the callback for each
element. The callback is bound to `thisArg` and invoked with three arguments;
(value, index|key, collection). Callbacks may exit iteration early by
explicitly returning `false`.
Note: As with other "Collections" methods, objects with a `length` pr... | forEach | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function forEachRight(collection, callback) {
var length = collection ? collection.length : 0;
if (typeof length == 'number') {
while (length--) {
if (callback(collection[length], length, collection) === false) {
break;
}
}
} else {
var props = keys(collection);
... | This method is like `_.forEach` except that it iterates over elements
of a `collection` from right to left.
@static
@memberOf _
@alias eachRight
@category Collections
@param {Array|Object|string} collection The collection to iterate over.
@param {Function} [callback=identity] The function called per iteration.
@param ... | forEachRight | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function invoke(collection, methodName) {
var args = slice(arguments, 2),
index = -1,
isFunc = typeof methodName == 'function',
length = collection ? collection.length : 0,
result = Array(typeof length == 'number' ? length : 0);
forEach(collection, function(value) {
result... | Invokes the method named by `methodName` on each element in the `collection`
returning an array of the results of each invoked method. Additional arguments
will be provided to each invoked method. If `methodName` is a function it
will be invoked for, and `this` bound to, each element in the `collection`.
@static
@memb... | invoke | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function map(collection, callback, thisArg) {
var index = -1,
length = collection ? collection.length : 0;
callback = createCallback(callback, thisArg, 3);
if (typeof length == 'number') {
var result = Array(length);
while (++index < length) {
result[index] = callback(collection... | Creates an array of values by running each element in the collection
through the callback. The callback is bound to `thisArg` and invoked with
three arguments; (value, index|key, collection).
If a property name is provided for `callback` the created "_.pluck" style
callback will return the property value of the given ... | map | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function max(collection, callback, thisArg) {
var computed = -Infinity,
result = computed;
// allows working with functions like `_.map` without using
// their `index` argument as a callback
if (typeof callback != 'function' && thisArg && thisArg[callback] === collection) {
callback = nul... | Retrieves the maximum value of a collection. If the collection is empty or
falsey `-Infinity` is returned. If a callback is provided it will be executed
for each value in the collection to generate the criterion by which the value
is ranked. The callback is bound to `thisArg` and invoked with three
arguments; (value, i... | max | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function min(collection, callback, thisArg) {
var computed = Infinity,
result = computed;
// allows working with functions like `_.map` without using
// their `index` argument as a callback
if (typeof callback != 'function' && thisArg && thisArg[callback] === collection) {
callback = null... | Retrieves the minimum value of a collection. If the collection is empty or
falsey `Infinity` is returned. If a callback is provided it will be executed
for each value in the collection to generate the criterion by which the value
is ranked. The callback is bound to `thisArg` and invoked with three
arguments; (value, in... | min | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function reduce(collection, callback, accumulator, thisArg) {
if (!collection) return accumulator;
var noaccum = arguments.length < 3;
callback = createCallback(callback, thisArg, 4);
var index = -1,
length = collection.length;
if (typeof length == 'number') {
if (noaccum) {
... | Reduces a collection to a value which is the accumulated result of running
each element in the collection through the callback, where each successive
callback execution consumes the return value of the previous execution. If
`accumulator` is not provided the first element of the collection will be
used as the initial `... | reduce | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function reduceRight(collection, callback, accumulator, thisArg) {
var noaccum = arguments.length < 3;
callback = createCallback(callback, thisArg, 4);
forEachRight(collection, function(value, index, collection) {
accumulator = noaccum
? (noaccum = false, value)
: callback(accumulator,... | This method is like `_.reduce` except that it iterates over elements
of a `collection` from right to left.
@static
@memberOf _
@alias foldr
@category Collections
@param {Array|Object|string} collection The collection to iterate over.
@param {Function} [callback=identity] The function called per iteration.
@param {*} [... | reduceRight | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function reject(collection, callback, thisArg) {
callback = createCallback(callback, thisArg, 3);
return filter(collection, function(value, index, collection) {
return !callback(value, index, collection);
});
} | The opposite of `_.filter` this method returns the elements of a
collection that the callback does **not** return truey for.
If a property name is provided for `callback` the created "_.pluck" style
callback will return the property value of the given element.
If an object is provided for `callback` the created "_.wh... | reject | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function sample(collection, n, guard) {
if (collection && typeof collection.length != 'number') {
collection = values(collection);
}
if (n == null || guard) {
return collection ? collection[baseRandom(0, collection.length - 1)] : undefined;
}
var result = shuffle(collection);
result.... | Retrieves a random element or `n` random elements from a collection.
@static
@memberOf _
@category Collections
@param {Array|Object|string} collection The collection to sample.
@param {number} [n] The number of elements to sample.
@param- {Object} [guard] Allows working with functions like `_.map`
without using their... | sample | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function shuffle(collection) {
var index = -1,
length = collection ? collection.length : 0,
result = Array(typeof length == 'number' ? length : 0);
forEach(collection, function(value) {
var rand = baseRandom(0, ++index);
result[index] = result[rand];
result[rand] = value;
... | Creates an array of shuffled values, using a version of the Fisher-Yates
shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle.
@static
@memberOf _
@category Collections
@param {Array|Object|string} collection The collection to shuffle.
@returns {Array} Returns a new shuffled collection.
@example
_.shuffle([... | shuffle | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function size(collection) {
var length = collection ? collection.length : 0;
return typeof length == 'number' ? length : keys(collection).length;
} | Gets the size of the `collection` by returning `collection.length` for arrays
and array-like objects or the number of own enumerable properties for objects.
@static
@memberOf _
@category Collections
@param {Array|Object|string} collection The collection to inspect.
@returns {number} Returns `collection.length` or numb... | size | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function some(collection, callback, thisArg) {
var result;
callback = createCallback(callback, thisArg, 3);
var index = -1,
length = collection ? collection.length : 0;
if (typeof length == 'number') {
while (++index < length) {
if ((result = callback(collection[index], index, co... | Checks if the callback returns a truey value for **any** element of a
collection. The function returns as soon as it finds a passing value and
does not iterate over the entire collection. The callback is bound to
`thisArg` and invoked with three arguments; (value, index|key, collection).
If a property name is provided... | some | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function sortBy(collection, callback, thisArg) {
var index = -1,
length = collection ? collection.length : 0,
result = Array(typeof length == 'number' ? length : 0);
callback = createCallback(callback, thisArg, 3);
forEach(collection, function(value, key, collection) {
result[++index]... | Creates an array of elements, sorted in ascending order by the results of
running each element in a collection through the callback. This method
performs a stable sort, that is, it will preserve the original sort order
of equal elements. The callback is bound to `thisArg` and invoked with
three arguments; (value, index... | sortBy | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function toArray(collection) {
if (isArray(collection)) {
return slice(collection);
}
if (collection && typeof collection.length == 'number') {
return map(collection);
}
return values(collection);
} | Converts the `collection` to an array.
@static
@memberOf _
@category Collections
@param {Array|Object|string} collection The collection to convert.
@returns {Array} Returns the new converted array.
@example
(function() { return _.toArray(arguments).slice(1); })(1, 2, 3, 4);
// => [2, 3, 4] | toArray | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function where(collection, properties, first) {
return (first && isEmpty(properties))
? undefined
: (first ? find : filter)(collection, properties);
} | Performs a deep comparison of each element in a `collection` to the given
`properties` object, returning an array of all elements that have equivalent
property values.
@static
@memberOf _
@type Function
@category Collections
@param {Array|Object|string} collection The collection to iterate over.
@param {Object} props ... | where | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function compact(array) {
var index = -1,
length = array ? array.length : 0,
result = [];
while (++index < length) {
var value = array[index];
if (value) {
result.push(value);
}
}
return result;
} | Creates an array with all falsey values removed. The values `false`, `null`,
`0`, `""`, `undefined`, and `NaN` are all falsey.
@static
@memberOf _
@category Arrays
@param {Array} array The array to compact.
@returns {Array} Returns a new array of filtered values.
@example
_.compact([0, 1, false, 2, '', 3]);
// => [1,... | compact | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function difference(array) {
return baseDifference(array, baseFlatten(arguments, true, true, 1));
} | Creates an array excluding all values of the provided arrays using strict
equality for comparisons, i.e. `===`.
@static
@memberOf _
@category Arrays
@param {Array} array The array to process.
@param {...Array} [values] The arrays of values to exclude.
@returns {Array} Returns a new array of filtered values.
@example
... | difference | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function first(array, callback, thisArg) {
var n = 0,
length = array ? array.length : 0;
if (typeof callback != 'number' && callback != null) {
var index = -1;
callback = createCallback(callback, thisArg, 3);
while (++index < length && callback(array[index], index, array)) {
n... | Gets the first element or first `n` elements of an array. If a callback
is provided elements at the beginning of the array are returned as long
as the callback returns truey. The callback is bound to `thisArg` and
invoked with three arguments; (value, index, array).
If a property name is provided for `callback` the cr... | first | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function flatten(array, isShallow) {
return baseFlatten(array, isShallow);
} | Flattens a nested array (the nesting can be to any depth). If `isShallow`
is truey, the array will only be flattened a single level. If a callback
is provided each element of the array is passed through the callback before
flattening. The callback is bound to `thisArg` and invoked with three
arguments; (value, index, a... | flatten | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function indexOf(array, value, fromIndex) {
if (typeof fromIndex == 'number') {
var length = array ? array.length : 0;
fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex || 0);
} else if (fromIndex) {
var index = sortedIndex(array, value);
return array[index] === v... | Gets the index at which the first occurrence of `value` is found using
strict equality for comparisons, i.e. `===`. If the array is already sorted
providing `true` for `fromIndex` will run a faster binary search.
@static
@memberOf _
@category Arrays
@param {Array} array The array to search.
@param {*} value The value ... | indexOf | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function initial(array, callback, thisArg) {
var n = 0,
length = array ? array.length : 0;
if (typeof callback != 'number' && callback != null) {
var index = length;
callback = createCallback(callback, thisArg, 3);
while (index-- && callback(array[index], index, array)) {
n++;... | Gets all but the last element or last `n` elements of an array. If a
callback is provided elements at the end of the array are excluded from
the result as long as the callback returns truey. The callback is bound
to `thisArg` and invoked with three arguments; (value, index, array).
If a property name is provided for `... | initial | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function intersection() {
var args = [],
argsIndex = -1,
argsLength = arguments.length;
while (++argsIndex < argsLength) {
var value = arguments[argsIndex];
if (isArray(value) || isArguments(value)) {
args.push(value);
}
}
var array = args[0],
index ... | Creates an array of unique values present in all provided arrays using
strict equality for comparisons, i.e. `===`.
@static
@memberOf _
@category Arrays
@param {...Array} [array] The arrays to inspect.
@returns {Array} Returns an array of shared values.
@example
_.intersection([1, 2, 3], [5, 2, 1, 4], [2, 1]);
// => ... | intersection | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function last(array, callback, thisArg) {
var n = 0,
length = array ? array.length : 0;
if (typeof callback != 'number' && callback != null) {
var index = length;
callback = createCallback(callback, thisArg, 3);
while (index-- && callback(array[index], index, array)) {
n++;
... | Gets the last element or last `n` elements of an array. If a callback is
provided elements at the end of the array are returned as long as the
callback returns truey. The callback is bound to `thisArg` and invoked
with three arguments; (value, index, array).
If a property name is provided for `callback` the created "_... | last | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function lastIndexOf(array, value, fromIndex) {
var index = array ? array.length : 0;
if (typeof fromIndex == 'number') {
index = (fromIndex < 0 ? nativeMax(0, index + fromIndex) : nativeMin(fromIndex, index - 1)) + 1;
}
while (index--) {
if (array[index] === value) {
return index;
... | Gets the index at which the last occurrence of `value` is found using strict
equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used
as the offset from the end of the collection.
If a property name is provided for `callback` the created "_.pluck" style
callback will return the property value of th... | lastIndexOf | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function range(start, end, step) {
start = +start || 0;
step = (+step || 1);
if (end == null) {
end = start;
start = 0;
}
// use `Array(length)` so engines like Chakra and V8 avoid slower modes
// http://youtu.be/XAqIpGU8ZZk#t=17m25s
var index = -1,
length = nativeMax(0... | Creates an array of numbers (positive and/or negative) progressing from
`start` up to but not including `end`. If `start` is less than `stop` a
zero-length range is created unless a negative `step` is specified.
@static
@memberOf _
@category Arrays
@param {number} [start=0] The start of the range.
@param {number} end ... | range | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function rest(array, callback, thisArg) {
if (typeof callback != 'number' && callback != null) {
var n = 0,
index = -1,
length = array ? array.length : 0;
callback = createCallback(callback, thisArg, 3);
while (++index < length && callback(array[index], index, array)) {
... | The opposite of `_.initial` this method gets all but the first element or
first `n` elements of an array. If a callback function is provided elements
at the beginning of the array are excluded from the result as long as the
callback returns truey. The callback is bound to `thisArg` and invoked
with three arguments; (va... | rest | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function sortedIndex(array, value, callback, thisArg) {
var low = 0,
high = array ? array.length : low;
// explicitly reference `identity` for better inlining in Firefox
callback = callback ? createCallback(callback, thisArg, 1) : identity;
value = callback(value);
while (low < high) {
... | Uses a binary search to determine the smallest index at which a value
should be inserted into a given sorted array in order to maintain the sort
order of the array. If a callback is provided it will be executed for
`value` and each element of `array` to compute their sort ranking. The
callback is bound to `thisArg` and... | sortedIndex | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function union() {
return baseUniq(baseFlatten(arguments, true, true));
} | Creates an array of unique values, in order, of the provided arrays using
strict equality for comparisons, i.e. `===`.
@static
@memberOf _
@category Arrays
@param {...Array} [array] The arrays to inspect.
@returns {Array} Returns an array of combined values.
@example
_.union([1, 2, 3], [5, 2, 1, 4], [2, 1]);
// => [1... | union | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function uniq(array, isSorted, callback, thisArg) {
// juggle arguments
if (typeof isSorted != 'boolean' && isSorted != null) {
thisArg = callback;
callback = (typeof isSorted != 'function' && thisArg && thisArg[isSorted] === array) ? null : isSorted;
isSorted = false;
}
if (callback !... | Creates a duplicate-value-free version of an array using strict equality
for comparisons, i.e. `===`. If the array is sorted, providing
`true` for `isSorted` will use a faster algorithm. If a callback is provided
each element of `array` is passed through the callback before uniqueness
is computed. The callback is bound... | uniq | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function without(array) {
return baseDifference(array, slice(arguments, 1));
} | Creates an array excluding all provided values using strict equality for
comparisons, i.e. `===`.
@static
@memberOf _
@category Arrays
@param {Array} array The array to filter.
@param {...*} [value] The values to exclude.
@returns {Array} Returns a new array of filtered values.
@example
_.without([1, 2, 1, 0, 3, 1, 4... | without | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function zip() {
var index = -1,
length = max(pluck(arguments, 'length')),
result = Array(length < 0 ? 0 : length);
while (++index < length) {
result[index] = pluck(arguments, index);
}
return result;
} | Creates an array of grouped elements, the first of which contains the first
elements of the given arrays, the second of which contains the second
elements of the given arrays, and so on.
@static
@memberOf _
@alias unzip
@category Arrays
@param {...Array} [array] Arrays to process.
@returns {Array} Returns a new array ... | zip | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function zipObject(keys, values) {
var index = -1,
length = keys ? keys.length : 0,
result = {};
if (!values && length && !isArray(keys[0])) {
values = [];
}
while (++index < length) {
var key = keys[index];
if (values) {
result[key] = values[index];
} el... | Creates an object composed from arrays of `keys` and `values`. Provide
either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]`
or two arrays, one of `keys` and one of corresponding `values`.
@static
@memberOf _
@alias object
@category Arrays
@param {Array} keys The array of keys.
@param {Array} ... | zipObject | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function after(n, func) {
if (!isFunction(func)) {
throw new TypeError;
}
return function() {
if (--n < 1) {
return func.apply(this, arguments);
}
};
} | Creates a function that executes `func`, with the `this` binding and
arguments of the created function, only after being called `n` times.
@static
@memberOf _
@category Functions
@param {number} n The number of times the function must be called before
`func` is executed.
@param {Function} func The function to restri... | after | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
function bind(func, thisArg) {
return arguments.length > 2
? createWrapper(func, 17, slice(arguments, 2), null, thisArg)
: createWrapper(func, 1, null, null, thisArg);
} | Creates a function that, when called, invokes `func` with the `this`
binding of `thisArg` and prepends any additional `bind` arguments to those
provided to the bound function.
@static
@memberOf _
@category Functions
@param {Function} func The function to bind.
@param {*} [thisArg] The `this` binding of `func`.
@param ... | bind | javascript | sdelements/lets-chat | media/js/vendor/lodash/lodash.underscore.js | https://github.com/sdelements/lets-chat/blob/master/media/js/vendor/lodash/lodash.underscore.js | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.