null-class
v0.1.1
Published
A `Null` class to simplify `Object.create(null)` and `class extends null {}` patterns.
Downloads
17
Maintainers
Readme
null class
A Null
class to simplify Object.create(null)
and class extends null {}
patterns.
This module exports nothing else than:
function Null(){}
Before being exported though, such Null
"class" is modified as such:
Object.setPrototypeOf(Null, null);
Null.prototype = Object.create(null);
The Null
class can be used to extend, as in class extends Null {}
, or to create, faster than Object.create(null)
, dictionaries of any kind, via new Null
.
Compatibility
Every engine capable of Object.create(null)
. If the engine doesn't know Object.setPrototypeOf
, the Null
class will simply still be an instance of Function
, but it can still be extended, or used to create null
dictionaries via new Null
.