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.
acorn-has-side-effect
Advanced tools
A simple module to check whether an expression has any side effects
A simple module to check whether an expression has any side effects. This is aimed at being useful for writing optimising JavaScript compilers.
npm install acorn-has-side-effect
'use strict';
var assert = require('assert');
var hasSideEffect = require('./');
assert(hasSideEffect('x = 10') === true);
assert(hasSideEffect('x++') === true);
assert(hasSideEffect('x') === false);
assert(hasSideEffect('x', {strict: true}) === true);
assert(hasSideEffect('x.foo') === false);
assert(hasSideEffect('x.foo', {strict: true}) === true);
assert(hasSideEffect('this') === false);
assert(hasSideEffect('this', {strict: true}) === false);
assert(hasSideEffect('this.foo') === false);
assert(hasSideEffect('this.foo', {strict: true}) === true);
console.log('tests passed');
It assumes that property-access and variable-access should not count as a side effect, even though they technically could be because of property accessors and reference errors etc. For most purposes this should be fine, but it could go wrong in some rare circumstances. You can force it to treat even these nodes as having side effects by passing {strict: true}
for the options.
If you already have an AST, you can pass an acorn AST instead of a string for the source code.
MIT
FAQs
A simple module to check whether an expression has any side effects
The npm package acorn-has-side-effect receives a total of 1 weekly downloads. As such, acorn-has-side-effect popularity was classified as not popular.
We found that acorn-has-side-effect 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.