
Research
2025 Report: Destructive Malware in Open Source Packages
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.
Keep or remove certain keys from an object.
npm install trim-keys
trim-keys has been tested in Node, IE9+, Chrome, Firefox, and Opera.
// CommonJS
var trim = require('trim-keys');
// AMD
require(['trim-keys'], function(trim) { ... });
// Script Tag
var trim = window.trim;
trim(obj, keyMap)
type: Object
The object to trim. This object will be modified, so if you want to retain your original object, you'll need to pass in a copy of that object.
type: Object
This object defines what properties to keep, or what properties to remove. It takes the following form:
{ field1: <boolean>, field2: <boolean> ... }
The <boolean> value can be any of the following:
1 or true to include the field.0 or false to exclude the field.A keyMap cannot contain both include and exclude specifications. An error will be thrown if all of the keys are not the same value.
var trim = require('trim-keys');
var person = { name: 'John Doe', age: 40, height: { ft: 5, in: 10 } };
trim(person, { name: 1 })
// person === { name: 'John Doe' }
var trim = require('trim-keys');
var person = { name: 'John Doe', age: 40, height: { ft: 5, in: 10 } };
trim(person, { age: 0, height: { in: 0 } });
// person === { name: 'John Doe', height: { ft: 5 } }
FAQs
Keep or remove certain keys from an object.
We found that trim-keys 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.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.

Research
/Security News
A five-month operation turned 27 npm packages into durable hosting for browser-run lures that mimic document-sharing portals and Microsoft sign-in, targeting 25 organizations across manufacturing, industrial automation, plastics, and healthcare for credential theft.