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.
lodash.omitby
Advanced tools
The lodash.omitby package is a utility function from the Lodash library that creates an object composed of the own and inherited enumerable string keyed properties of `object` that `predicate` doesn't return truthy for. Essentially, it allows you to omit properties from an object based on a condition.
Omit properties based on a condition
This feature allows you to omit properties from an object where the values meet a certain condition. In this example, all properties with numeric values are omitted.
const omitBy = require('lodash.omitby');
const object = { 'a': 1, 'b': '2', 'c': 3 };
const result = omitBy(object, value => typeof value === 'number');
console.log(result); // { 'b': '2' }
Omit properties with null or undefined values
This feature allows you to omit properties from an object where the values are null or undefined. In this example, properties 'b' and 'c' are omitted.
const omitBy = require('lodash.omitby');
const object = { 'a': 1, 'b': null, 'c': undefined, 'd': 'text' };
const result = omitBy(object, value => value == null);
console.log(result); // { 'a': 1, 'd': 'text' }
Ramda is a functional programming library for JavaScript. It provides a similar function called `R.omit` which can be used to omit properties from an object. However, Ramda's approach is more functional and may require a different mindset compared to Lodash.
Underscore is another utility library that provides a wide range of functions for manipulating objects and arrays. It has a function called `_.omit` which can be used to omit properties from an object based on keys. While similar, it does not provide the same predicate-based omission as lodash.omitby.
The lodash method _.omitBy
exported as a Node.js module.
Using npm:
$ {sudo -H} npm i -g npm
$ npm i --save lodash.omitby
In Node.js:
var omitBy = require('lodash.omitby');
See the documentation or package source for more details.
FAQs
The lodash method `_.omitBy` exported as a module.
The npm package lodash.omitby receives a total of 267,463 weekly downloads. As such, lodash.omitby popularity was classified as popular.
We found that lodash.omitby demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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.