resourceloader: Optimise several map-like objects with Object.create(null)
authorTimo Tijhof <krinklemail@gmail.com>
Fri, 24 Aug 2018 01:58:56 +0000 (02:58 +0100)
committerTimo Tijhof <krinklemail@gmail.com>
Fri, 24 Aug 2018 01:58:56 +0000 (02:58 +0100)
commit11e81ef63b26955aeb6dbb1d6ef01bb0c0aa7e85
treefd57d5149013a7e8023cb128ccfbe70a73b940c7
parent4b4afe7cbe83d770c0f5c06406d2110a2d7f56f6
resourceloader: Optimise several map-like objects with Object.create(null)

Object.create(null) is specifically for the use case of being
able to store any key/value without worrying about inherited
built-in methods.

As such, using Object.create(null) in these cases has two benefits:

* Removes the need for a hasOwn() call.
  One can instead use the 'in' operator, or look for undefined,
  without there being gotchas due to inherited methods.

* When the known values are always truthy (e.g. when only storing
  value that are also objects or arrays), there is no need for
  any explicit comparison (plain boolean evaluation).

Change-Id: I24f86f9938e4f5ccca81d15aa14a48ac3ddee341
resources/src/startup/mediawiki.js