
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
From my humble point of view, JavaScript is lacking of some very useful small built-in functions some other languages, like Python, have.
Yes, reduce and map can do quite a lot of things, in quite a lot of situations. They can also often save us in the most desparate situations. But because they are very generic tools, they do not provide a clear straight-forward understanding of what they are used/implemented for.
For example, let's say you want to count the occurences of a number in an array of numbers. For sure, you can do it with a reduce:
array.reduce((count, item) => item === itemToCount ? count + 1 : count, 0)
But let's be honest. Don't you think this is so verbose code for a simple count() ? Why is there not a built-in count function in JavaScript ?
This is exactly what js-extra is built for. Its aim is to provide explicit functions built on top of the native JavaScript functions. Since Lodash already provides many extra functions, the lib will aim to complete it with very specific functions.
With js-extra the above code becomes:
count(array, itemToCount)
Yarn:
$ yarn add js-extra
Npm:
$ npm i js-extra
You can import the functions this way:
ES6
import { count } from 'js-extra'
ES5
var { count } = require('js-extra')
You can find all the implemented & available functions of the lib here.
js-extra is tree-shakeable and side-effects free!
The API is available here: js-extra API
Any contribution would be more than welcome! You think you can optimize the algorithms of existing functions ? Please, open a PR! :)
You would like to add a function that JavaScript doesn't have natively ? Please, go ahead and open a PR! :)
Found any bugs or you have some ideas ? Please, open an issue! :)
The following commands are executed with yarn, but you can of course use any package manager tool like npm or npx.
To install dependencies:
yarn install
To build the project:
yarn build
To run the tests:
yarn test
Before you commit:
yarn validate
FAQs
Does what native Javascript doesn't.
The npm package js-extra receives a total of 39 weekly downloads. As such, js-extra popularity was classified as not popular.
We found that js-extra 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.