cpettitt / dig.js

Graph algorithms for JavaScript
MIT License
20 stars 4 forks source link

Provide fallback when Object.defineProperty is not available #8

Closed cpettitt closed 12 years ago

cpettitt commented 12 years ago

This was standardized in ECMAscript, fifth edition. In particular, it is not supported (for non-DOM objects) until IE 9.

defineProperty is definitely what we want when available. It can be used to set an immutable property (like _digId) on an object that does not show up as an enumerable field. When it is not available, the best we can do is provide a mutable, enumerable field. We could make the property immutable by using a function instead of a field to store _digId, but an inconsistent API is worse than the original problem.

cpettitt commented 12 years ago

Fixed in v0.0.2