babel-plugin-assume-first-argument

1.0.0 • Public • Published

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.

Readme

Keywords

none

Package Sidebar

Install

npm i babel-plugin-assume-first-argument

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

2.98 kB

Total Files

4

Last publish

Collaborators

  • dijs