1.11.1 • Published 5 years ago

enum-bug v1.11.1

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

Enum Bug

Enumerate properties that will not enumerate in older browsers (i.e. IE 8 and below).

license bundlephobia minzip npm dependents downloads Coverage Status Known Vulnerabilities

Installation

npm install enum-bug

Note: use add --save if you are using npm < 5.0.0

Usage

import enumBug from 'enum-bug';

const obj = {
  hello: 'not a bugged property',
  constructor: 'bugged property',
  hasOwnProperty: 'bugged property',
  isPrototypeOf: 'bugged property',
  propertyIsEnumerable: 'bugged property',
  toLocaleString: 'bugged property',
  toString: 'bugged property',
  valueOf: 'bugged property',
  goodbye: 'another normally enumerated property',
};

enumBug(obj, prop => {
  console.log(`${prop} is bugged.`);
});

By executing the code in an environment that contains an object enumeration bug (i.e. Internet Explorer 8 and below), the result will be

// console
 => constructor is bugged
 => hasOwnProperty is bugged
 => isPrototypeOf is bugged
 => propertyIsEnumerable is bugged
 => toLocaleString is bugged
 => toString is bugged
 => valueOf is bugged

Note

The bugged properties are:

  • constructor
  • hasOwnProperty
  • isPrototypeOf
  • propertyIsEnumerable
  • toLocaleString
  • toString
  • valueOf

This module will only enumerate over bugged properties in environments where they would not otherwise be enumerated over.

If the environment supports object property enumeration, no properties are enumerated.

1.11.1

5 years ago

1.11.0

5 years ago

1.10.0

5 years ago

1.0.9

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.4

5 years ago

1.0.1

5 years ago