mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 08:57:49 +00:00
pulling Evgeniy Dolzhenko's patch to add _.tap, with tests
This commit is contained in:
@@ -495,6 +495,13 @@
|
||||
return typeof obj == 'undefined';
|
||||
};
|
||||
|
||||
// Invokes interceptor with the obj, and then returns obj.
|
||||
// The primary purpose of this method is to "tap into" a method chain, in order to perform operations on intermediate results within the chain.
|
||||
_.tap = function(obj, interceptor) {
|
||||
interceptor(obj);
|
||||
return obj;
|
||||
}
|
||||
|
||||
// Define the isArray, isDate, isFunction, isNumber, isRegExp, and isString
|
||||
// functions based on their toString identifiers.
|
||||
var types = ['Array', 'Date', 'Function', 'Number', 'RegExp', 'String'];
|
||||
|
||||
Reference in New Issue
Block a user