Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
babel-plugin-transform-object-rest-spread
Advanced tools
The babel-plugin-transform-object-rest-spread package allows developers to use the object rest and spread properties syntax in their JavaScript code. This syntax is part of the ECMAScript 2018 (ES9) specification and enables more concise and readable code when copying properties from one object to another or collecting the remaining properties of an object after certain properties have been extracted.
Object Spread
Allows an object's own enumerable properties to be copied into a new object. This is useful for creating a new object with the same properties as an existing object or for combining multiple objects.
{...source}
Object Rest
Enables extracting properties from objects and binding the remaining properties to a new object. This is useful for object destructuring, where you want to separate certain properties from the rest.
{a, b, ...rest}
This is the official Babel plugin for transforming object rest and spread syntax. It is similar to babel-plugin-transform-object-rest-spread but is maintained as part of the Babel 7 release. It is the recommended package to use for Babel 7 users.
This preset includes various Babel plugins for JavaScript features that are in stage 3 of the TC39 process, including object rest and spread properties. It is broader in scope compared to babel-plugin-transform-object-rest-spread, which focuses only on object rest and spread properties.
Compile object rest and spread to ES5
// source
z = { x, ...y };
// compiled
_extends = Object.assign || function(target) { ... }
z = _extends({ x }, y);
$ npm install babel-plugin-transform-object-rest-spread
.babelrc
(Recommended).babelrc
{
"plugins": ["transform-object-rest-spread"]
}
This plugin will use babel's extends
helper, which will polyfill Object.assign
by default.
useBuiltIns
- Do not use Babel's helper's and just transform to use the built-in method (Disabled by default).{
"plugins": [
["transform-object-rest-spread", { "useBuiltIns": true }]
]
}
// source
z = { x, ...y };
// compiled
z = Object.assign({ x }, y);
$ babel --plugins transform-object-rest-spread script.js
require("babel-core").transform("code", {
plugins: ["transform-object-rest-spread"]
});
FAQs
Compile object rest and spread to ES5
The npm package babel-plugin-transform-object-rest-spread receives a total of 1,078,978 weekly downloads. As such, babel-plugin-transform-object-rest-spread popularity was classified as popular.
We found that babel-plugin-transform-object-rest-spread demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 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
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.