![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Returns a copy of a Map object containing only those entries which pass a test function.
Returns a copy of a Map or Object containing only those entries which pass a test function.
Supports a numeric limit on the number of entries in the resulting Map or Object.
npm install filter-map --save
const filterMap = require('filter-map')
const map = new Map([['a', 1], ['b', 2], ['c', 3]])
const filteredMap = filterMap(map, (key, value) => value > 1)
filteredMap.size // 2
// Works on objects too
const obj = {a: 1, b: 2, c: 3}
filterMap(obj, (key, value) => value > 1) // {b: 2, c: 3}
If no test function is provided, values are filtered by truthiness:
const filterMap = require('filter-map')
const map = new Map([[1, true], [2, false], [3, true]])
filterMap(map).size // 2
filterMap({1: true, 2: false, 3: true}) // {1: true, 3: true}
If you only want a certain number of entries in the filtered Map or Object, you can specify a numeric limit parameter:
const obj = {a: 0, b: 1, c: 2, d: 3}
filterMap(obj, (k, v) => v > 1, {limit: 1}) // {c: 2}
filterMap(obj, {limit: 1}) // {b: 1}
FAQs
Returns a copy of a Map object containing only those entries which pass a test function.
We found that filter-map 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.