Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
@babel/plugin-proposal-function-sent
Advanced tools
Compile the function.sent meta property to valid ES2015 code
@babel/plugin-proposal-function-sent is a Babel plugin that allows you to use the `function.sent` meta-property within generator functions. This meta-property provides a way to access the value passed to the generator's `next` method, which can be useful for more advanced control flow within generator functions.
Accessing the value passed to the generator's next method
This feature allows you to access the value passed to the generator's `next` method using `function.sent`. In the example, the generator function logs the value received each time `next` is called.
function* generator() {
let value = function.sent;
while (true) {
value = yield value;
console.log('Received:', value);
}
}
const gen = generator();
console.log(gen.next('First').value); // Logs: 'First'
console.log(gen.next('Second').value); // Logs: 'Second'
The `co` package is a generator-based control flow library for Node.js and the browser, which allows you to write asynchronous code in a synchronous manner using generators. Unlike @babel/plugin-proposal-function-sent, which focuses on the `function.sent` meta-property, `co` is more about managing asynchronous operations with generators.
The `redux-saga` package is a library that aims to make application side effects (e.g., asynchronous actions like data fetching) easier to manage, more efficient to execute, and better at handling failures. It uses generator functions to handle side effects in a Redux application. While it doesn't provide the `function.sent` meta-property, it leverages generators for complex control flows.
Compile the function.sent meta property to valid ES2015 code
See our website @babel/plugin-proposal-function-sent for more information.
Using npm:
npm install --save-dev @babel/plugin-proposal-function-sent
or using yarn:
yarn add @babel/plugin-proposal-function-sent --dev
v7.24.7 (2024-06-05)
babel-node
babel-traverse
constantViolations
with destructuring (@liuxingbaoyu)babel-helper-transform-fixture-test-runner
, babel-plugin-proposal-explicit-resource-management
using
in switch
correctly (@liuxingbaoyu)babel-helpers
, babel-runtime-corejs2
, babel-runtime-corejs3
, babel-runtime
FAQs
Compile the function.sent meta property to valid ES2015 code
We found that @babel/plugin-proposal-function-sent demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers 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
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.