Page MenuHomePhabricator

OOjs: Split core utilities up into object-specific singletons
Closed, DeclinedPublic

Description

So instead of:

oo.extendObject
oo.isPlainObject
oo.cloneObject
oo.getObjectKeys
oo.getObjectValues
oo.simpleArrayUnion
We'd have:

oo.Object.extend
oo.Object.isPlain
oo.Object.clone
oo.Object.keys (obsolete, ES5 has Object.keys)
oo.Object.values
oo.Array.quickUnion (or something like that)
More like YUI for example, as well as like methods in javascript itself.


Migrated from https://github.com/trevorparscal/oojs/issues/23


Version: unspecified
Severity: enhancement

Details

Reference
bz56977

Event Timeline

bzimport raised the priority of this task from to Lowest.Nov 22 2014, 2:34 AM
bzimport added a project: OOjs core.
bzimport set Reference to bz56977.

Not actually sure we want to do this. It's an interesting idea, but not worth breaking the API for, and considering the minimal size of the library, keeping this back-compat would be a fair amount of code.

Hopefully, the OOjs API will become smaller as time goes on when we start adopting more ES5 feature, and use global es5 shims for older browsers instead of aliases in other host objects (like jQuery.trim, jQuery.proxy, ve.indexOf and OO.getObjectkeys; instead of String#trim, Function#bind, Array#indexOf and Object.keys)

This is nice for a framework design, but for OOjs. We use native methods instead, more with es5-shim. We don't need many utility methods or an extendable base like that.