Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Bring your JavaScript into the future.
$ yarn global add esnext
# or, with `npm`:
$ npm install -g esnext
After installing, run esnext -h
for comprehensive usage instructions.
Translate some regular functions to arrow functions:
list.map(function(item) { return item.name; });
// ↑ becomes ↓
list.map(item => item.name);
Convert var
declarations to let
or const
as appropriate:
var arr = [];
for (var i = 0; i < 5; i++) {
arr.push(i);
}
// ↑ becomes ↓
const arr = [];
for (let i = 0; i < 5; i++) {
arr.push(i);
}
Use shorthand syntax for various object constructs:
let person = {
first: first,
last: last,
fullName: function() {
return `${first} ${last}`;
}
};
// ↑ becomes ↓
let person = {
first,
last,
fullName() {
return `${first} ${last}`;
}
};
Convert string concatenation to string or template literals:
let name = 'Brian' + ' ' + 'Donovan';
let greeting = 'Hello, ' + name;
// ↑ becomes ↓
let name = 'Brian Donovan';
let greeting = `Hello, ${name}`;
Convert assignments and declarations to use object destructuring syntax:
let a = obj.a, b = obj.b;
a = obj2.a, b = obj2.b;
// ↑ becomes ↓
let { a, b } = obj;
({ a, b } = obj2);
Translate CommonJS modules into ES6 modules:
var readFile = require('fs').readFile;
const MagicString = require('magic-string');
let { ok, strictEqual: eq } = require('assert');
exports.doSomething = function() {
ok(1);
};
// ↑ becomes ↓
import { readFile } from 'fs';
import MagicString from 'magic-string';
import { ok, strictEqual as eq } from 'assert';
export function doSomething() {
ok(1);
}
{
'declarations.block-scope': {
/**
* Set this to `true` to only turn `var` into `let`, never `const`.
*/
disableConst: boolean
}
}
FAQs
Update your project to the latest ECMAScript syntax.
The npm package esnext receives a total of 8,915 weekly downloads. As such, esnext popularity was classified as popular.
We found that esnext 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.