Avoid engine slow path for primitives in _(…). [closes #123]

Former-commit-id: 32e33b0c0d192915e6d5a83001b85645829ca0ab
This commit is contained in:
John-David Dalton
2012-11-23 10:19:10 -06:00
parent 4a42c44101
commit 1672645e73
3 changed files with 45 additions and 45 deletions

View File

@@ -240,8 +240,8 @@
* @returns {Object} Returns a `lodash` instance.
*/
function lodash(value) {
// exit early if already wrapped
if (value && value.__wrapped__) {
// exit early if already wrapped, even if wrapped by a different `lodash` constructor
if (value && typeof value == 'object' && value.__wrapped__) {
return value;
}
// allow invoking `lodash` without the `new` operator