Version 1
[yaffs-website] / node_modules / core-js / library / modules / _object-gopn-ext.js
1 // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
2 var toIObject = require('./_to-iobject')
3   , gOPN      = require('./_object-gopn').f
4   , toString  = {}.toString;
5
6 var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
7   ? Object.getOwnPropertyNames(window) : [];
8
9 var getWindowNames = function(it){
10   try {
11     return gOPN(it);
12   } catch(e){
13     return windowNames.slice();
14   }
15 };
16
17 module.exports.f = function getOwnPropertyNames(it){
18   return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it));
19 };