
Research
Supply Chain Attack on Axios Pulls Malicious Dependency from npm
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.
object-has-value
Advanced tools
This function takes two arguments - an object and a search term (String) - and returns true/false based on whether the object has a value matching the term.
In many applications, I find myself needing an efficient function to test whether an object contains a search term. Many implementations I've seen do something simple like converting the object to a string and testing for a match on the string, but then you tend to get some false positives for things like object properties, when in reality you likely only want to test whether the object has a value matching your term. So I built this with optimal filtering performance in mind.
It will return true if an object:
{ type: 'cat' } and search term 'cat'){ name: 'Fluffy' } and search term 'fluffy'){ type: 'cat' } and search term 'ca')If a value is an object, it will recursively test that object's values.
If a value is an array, it will check each item in the array. If it encounters an object, it will again recursively test that object's values.
As soon as it encounters a match, it stops checking and returns true, for optimal performance.
Can be used as a standalone function or as a function inside Array.filter.
import { objectHasValue } from 'object-has-value'
const someObject = {
...
}
const hasValue = objectHasValue(someObject, 'your search term') // true/false
Array.filterimport { objectHasValue } from 'object-has-value'
const someArray = [...]
const filteredArray = someArray.filter(item => objectHasValue(item, 'your search term')) // array of objects matching search term
Find a bug? A missed use case? Performance enhancement? PRs welcome!
MIT
FAQs
Efficiently test whether an object contains the specified value
We found that object-has-value demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 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.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.