mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 00:27:50 +00:00
Ensure isType methods return false for subclassed values.
Former-commit-id: e300d12eb506c6ae4949bd37cf8eb33c3a4be2e1
This commit is contained in:
@@ -1611,6 +1611,15 @@
|
||||
equal(typeof func({ 'a': 1 }), expected);
|
||||
equal(typeof func('a'), expected);
|
||||
});
|
||||
|
||||
test('should return `false` for subclassed values', function() {
|
||||
_.each(['isArray', 'isBoolean', 'isDate', 'isFunction', 'isNumber', 'isRegExp', 'isString'], function(methodName) {
|
||||
function Foo() {}
|
||||
Foo.prototype = window[methodName.slice(2)].prototype;
|
||||
|
||||
strictEqual(_[methodName](new Foo), false, '_.' + methodName + ' returns `false`');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
Reference in New Issue
Block a user