babel-plugin-assume-first-argument
v1.0.0
Published
Plugin simplifying arrow functions when working with the common case
Downloads
1
Readme
Assume First Argument
Babel plugin which reuses a uncommon unary operator for a more common purpose.
['foo', 'bar'].map(~length); // => ['foo', 'bar'].map(uid => uid.length);
[{ foo: 1 }, { foo: 2 }, { foo: 3 }].map(~foo % 2 === 0); // => ...map(uid => uid.foo % 2 === 0)
I initially wanted to use a better syntax, but realized that you can only write Babel plugins for Javascript syntax that they support. This may change in the future.