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.
unreachable-branch-transform
Advanced tools
Removes unreachable code branches in if
statements, ternaries ?
, and logical operations ||
&&
, where the test is determinable (like comparing two constants). This is similar to what UglifyJS's "dead_code" compressor option does, but without the extra code transformations.
When combined with something like envify and browserify, you can perform conditional require
calls without including more code than you need.
npm install unreachable-branch-transform
// original
var transport = process.env.TARGET === 'client' ? require('ajax') : require('fs');
// after envify
var transport = 'server' === 'client' ? require('ajax') : require('fs');
// then after unreachable-branch-transform
var transport = require('fs');
// original
if (process.env.NODE_ENV === 'development') {
console.log('in dev mode');
} else {
console.log('in some other mode');
}
// after envify
if ('production' === 'development') {
console.log('in dev mode');
} else {
console.log('in some other mode');
}
// then after unreachable-branch-transform
{
console.log('in some other mode');
}
unreachable-branch-transform
can be used a browserify transform. Just include it like any other transform.unreachable-branch-transform
can also be used on raw code by calling the transform
function exposed by requiring the package.esmangle-evaluator
is from the esmangle project.
FAQs
Browserify transform to remove unreachable code
The npm package unreachable-branch-transform receives a total of 6,262 weekly downloads. As such, unreachable-branch-transform popularity was classified as popular.
We found that unreachable-branch-transform 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
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.