From fa0086404d5b9e89c0ce99a3714e1cce4dbe5733 Mon Sep 17 00:00:00 2001 From: jdalton Date: Sun, 15 Feb 2015 21:54:12 -0800 Subject: [PATCH] Add `baseLodash`. --- lodash.src.js | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/lodash.src.js b/lodash.src.js index 344399941..f0375c456 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -943,6 +943,16 @@ return new LodashWrapper(value); } + /** + * A no-operation function used to setup inheritance for `lodash`, + * `LodashWrapper`, and `LazyWrapper` . + * + * @private + */ + function baseLodash() { + // No operation performed. + } + /** * The base constructor for creating `lodash` wrapper objects. * @@ -5689,7 +5699,7 @@ var result, parent = this; - while (parent instanceof LodashWrapper) { + while (parent instanceof baseLodash) { var clone = wrapperClone(parent); if (result) { previous.__wrapped__ = clone; @@ -11012,11 +11022,13 @@ /*------------------------------------------------------------------------*/ - // Ensure `new LodashWrapper` is an instance of `lodash`. - LodashWrapper.prototype = baseCreate(lodash.prototype); + // Ensure wrappers are instances of `baseLodash`. + lodash.prototype = baseLodash.prototype; - // Ensure `new LazyWraper` is an instance of `LodashWrapper` - LazyWrapper.prototype = baseCreate(LodashWrapper.prototype); + LodashWrapper.prototype = baseCreate(baseLodash.prototype); + LodashWrapper.prototype.constructor = LodashWrapper; + + LazyWrapper.prototype = baseCreate(baseLodash.prototype); LazyWrapper.prototype.constructor = LazyWrapper; // Add functions to the `Map` cache.