UNPKG

550 BJavaScriptView Raw
1/**
2 * Checks if `value` is a host object in IE < 9.
3 *
4 * @private
5 * @param {*} value The value to check.
6 * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
7 */
8function isHostObject(value) {
9 // Many host objects are `Object` objects that can coerce to strings
10 // despite having improperly defined `toString` methods.
11 var result = false;
12 if (value != null && typeof value.toString != 'function') {
13 try {
14 result = !!(value + '');
15 } catch (e) {}
16 }
17 return result;
18}
19
20export default isHostObject;