obsolete

obsolete properties throw exceptions

Usage no npm install needed!

<script type="module">
  import obsolete from 'https://cdn.skypack.dev/obsolete';
</script>

README

obsolete

Mark removed properties as obsolete so they throw an exception when used

Build Status

Usage:

var obsolete = require('obsolete');

var foo = {};
obsolete(foo, 'bar');

// throws exceptions 'obsolete property "bar" removed'
foo.bar;
foo.bar = 1;
foo.bar();

Uses Object.defineProperty() with a custom getter and setter to throw Error exceptions on usage.

Useful to cause old dependant code that needs to be updated to fail fast and fail early as possible, instead of returning and propagating invalid data (undefined) leading to hard-to-track-down errors further down the line.

License

MIT