JAVASCRIPT   18

keys

Guest on 1st May 2022 04:35:41 PM

  1. import hasOwnProp from './has-own-prop';
  2.  
  3. var keys;
  4.  
  5. if (Object.keys) {
  6.     keys = Object.keys;
  7. } else {
  8.     keys = function (obj) {
  9.         var i,
  10.             res = [];
  11.         for (i in obj) {
  12.             if (hasOwnProp(obj, i)) {
  13.                 res.push(i);
  14.             }
  15.         }
  16.         return res;
  17.     };
  18. }
  19.  
  20. export { keys as default };

Raw Paste


Login or Register to edit or fork this paste. It's free.