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.
selection-update
Advanced tools
Computing selection updates on external INPUT value changes, browser style
Computing input selection updates on external file changes, as if we used browser managed undo and redo.
/**
* Calculate the selection update for the given
* current and new input values.
*
* @param {Object} currentSelection as {start, end}
* @param {String} currentValue
* @param {String} newValue
*
* @return {Object} newSelection as {start, end}
*/
calculateUpdate(currentSelection, currentValue, newValue);
var selectionUpdate = require('selection-update');
/**
* Update input with new value.
* @param {Node} $input
* @param {String} newValue
*/
function updateInput($input, newValue) {
var newSelection;
// only retrieve and restore input, if the element
// is currently active
if (document.activeElement === $input) {
// get the current selection and pass it in as {start, end}
newSelection = selectionUpdate(getSelection($input), $input.value, newValue);
}
// apply new value, will naturally send selection to input end
$input.value = value;
if (newSelection) {
// set new {start, end} selection on input
setSelection($input, selection);
}
}
MIT
FAQs
Computing selection updates on external INPUT value changes, browser style
We found that selection-update 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.