Skip to content

WIP: support object rest properties

// given
let { a, b, ...rest } = obj;
// it should output
let a = obj.a;
let b = obj.b;
let rest = _objectWithoutProperties(obj, ['a', 'b']);
// where _objectWithoutProperties is a helper like babel's:
// function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj,  i)) continue; target[i] = obj[i]; } return target; }

I've added support for object rest properties in acorn-object-spread (PR pending results here).

This branch is the first stab at it and doesn't really work. Hopefully this will open the door for others to take it and continue work on it, I'd absolutely love to see this land in buble as it's this feature and async/await what prevents me from using it in other projects but I don't have time now to keep at it.

Thanks for your help :) Darío

Merge request reports