
Security News
Potemkin Understanding in LLMs: New Study Reveals Flaws in AI Benchmarks
New research reveals that LLMs often fake understanding, passing benchmarks but failing to apply concepts or stay internally consistent.
babel-plugin-transform-js-macros
Advanced tools
A handful of useful macros as babel-plugin.
npm install --save-dev babel-plugin-transform-js-macros
.babelrc
<- { "plugins": ["babel-plugin-transform-js-macros"] }
Detect free variables in an expression and return a lambda that takes those as arguments.
symbolic, x + y;
gives
({ x, y }) => x + y;
Mimics haskell do-notation. Takes an additional function to flatten the structure.
join, (x = 1), (y = 2), 3;
gives
_joiner => _joiner(1, x => _joiner(2, y => 3));
examples:
// Promise chain
const then = (promise, callback) => Promise.resolve(promise).then(callback);
const six = (join,
(x = Promise.resolve(4)), // binding a Promise
(y = x * 2), // Promise.resolve will take care non-promise values
Promise.resolve(y - 2))(then);
six.then(console.log); // 6
// Maybe
class Nothing {
mbind(f) {
return new Nothing();
}
}
class Just {
constructor(x) {
this.x = x;
}
mbind(f) {
return f(this.x);
}
}
const bind = (monad, binder) => monad.mbind(binder);
// here the magic
const plus3 = n =>
(join,
(a = n), // n must be a monad
(b = new Just(3)),
new Just(a + b))(bind);
expect(plus3(new Nothing())).toEqual(new Nothing());
expect(plus3(new Just(5))).toEqual(new Just(8));
const toArray = (item, next) => [item].concat(next(item));
expect((join, (a = 1), (b = 2), a + b)(toArray)).toEqual([1, 2, 3]);
const assign = (item, next) => next(item);
expect((join, (a = 1), (b = 2), { a, b })(assign)).toEqual({ a: 1, b: 2 });
FAQs
A handful of useful macros as babel-plugin.
The npm package babel-plugin-transform-js-macros receives a total of 9 weekly downloads. As such, babel-plugin-transform-js-macros popularity was classified as not popular.
We found that babel-plugin-transform-js-macros demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
New research reveals that LLMs often fake understanding, passing benchmarks but failing to apply concepts or stay internally consistent.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.