{"id":26285839,"url":"https://github.com/alexandre-lelain/js-extra","last_synced_at":"2025-05-07T15:05:47.894Z","repository":{"id":38361872,"uuid":"194418282","full_name":"alexandre-lelain/js-extra","owner":"alexandre-lelain","description":"Does what native Javascript doesn't.","archived":false,"fork":false,"pushed_at":"2023-02-03T05:12:47.000Z","size":964,"stargazers_count":8,"open_issues_count":4,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-07T15:05:33.736Z","etag":null,"topics":["extra","functions","javascript","lodash"],"latest_commit_sha":null,"homepage":"https://js-extra.netlify.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alexandre-lelain.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-06-29T15:06:55.000Z","updated_at":"2023-12-05T06:28:29.000Z","dependencies_parsed_at":"2023-02-05T02:16:14.918Z","dependency_job_id":null,"html_url":"https://github.com/alexandre-lelain/js-extra","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexandre-lelain%2Fjs-extra","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexandre-lelain%2Fjs-extra/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexandre-lelain%2Fjs-extra/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexandre-lelain%2Fjs-extra/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexandre-lelain","download_url":"https://codeload.github.com/alexandre-lelain/js-extra/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252902614,"owners_count":21822261,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["extra","functions","javascript","lodash"],"created_at":"2025-03-14T19:50:10.631Z","updated_at":"2025-05-07T15:05:47.867Z","avatar_url":"https://github.com/alexandre-lelain.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://js-extra.netlify.app\" rel=\"noopener\" target=\"_blank\"\u003e\u003cimg width=\"150\" src=\"docs/img/js-extra.webp\" alt=\"Js-extra logo\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003c/p\u003e\n\n\u003ch1\u003ejs-extra\u003c/h1\u003e\n\n\u003cp\u003eDoes what native JavaScript doesn't.\u003c/p\u003e\n\n**[js-extra docs](https://js-extra.netlify.app/)**\n\n\u003cbr/\u003e\n\n[![npm version](https://img.shields.io/npm/v/js-extra.svg?style=flat)](https://www.npmjs.com/package/js-extra)\n[![ci status](https://travis-ci.org/alexandre-lelain/js-extra.svg?branch=master)](https://travis-ci.org/alexandre-lelain/js-extra)\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/alexandre-lelain/js-extra/blob/master/LICENSE)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/alexandre-lelain/js-extra/pulls)\n[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)\n[![build formats](https://img.shields.io/badge/module%20formats-cjs%2C%20esm-green.svg)](https://github.com/alexandre-lelain/js-extra)\n[![bundle size](https://badgen.net/bundlephobia/min/js-extra@latest)](https://bundlephobia.com/result?p=js-extra@latest)\n\n\u003cbr/\u003e\n\n\u003c/div\u003e\n\n## Menu\n\n- [Motivation](#motivation)\n- [How to use js-extra](#how-to-use-js-extra)\n- [API](#api)\n- [Contributing](#contributing)\n\n## Motivation\n\nFrom my humble point of view, **JavaScript** is lacking of some very useful small built-in functions some other languages, like Python, have.\n\nYes, [**reduce**](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux/Array/reduce) and [**map**](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux/Array/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.\n\nFor 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**:\n\n```js\narray.reduce((count, item) =\u003e item === itemToCount ? count + 1 : count, 0)\n```\n\nBut let's be honest. Don't you think this is so verbose code for a simple count() ?\nWhy is there not a built-in **count** function in JavaScript ?\n\nThis is exactly what **js-extra** is built for. Its aim is to provide explicit functions\nbuilt on top of the native JavaScript functions. Since [Lodash](https://lodash.com/)\nalready provides many extra functions, the lib will aim to complete it with very\nspecific functions.\n\nWith **js-extra** the above code becomes:\n\n```js\ncount(array, itemToCount)\n```\n\n## How to use js-extra\n\nYarn:\n```shell\n$ yarn add js-extra\n```\n\nNpm:\n```shell\n$ npm i js-extra\n```\n\nYou can import the functions this way:\n\nES6\n```js\nimport { count } from 'js-extra'\n```\n\nES5\n```js\nvar { count } = require('js-extra')\n```\n\nYou can find all the implemented \u0026 available functions of the lib [here](https://js-extra.netlify.com/#/api).\n\n**js-extra** is **tree-shakeable** and **side-effects free**!\n\n## API\n\nThe API is available here: [js-extra API](https://js-extra.netlify.com/#/api)\n\n## Contributing\n\nAny contribution would be more than welcome! You think you can optimize the\nalgorithms of existing functions ? Please, open a PR! :)\n\nYou would like to add a function that JavaScript doesn't have natively ? Please,\ngo ahead and open a PR! :)\n\nFound any bugs or you have some ideas ? Please, open an issue! :)\n\n**The following commands are executed with [yarn](https://yarnpkg.com/lang/en/), but you can of course use any package manager tool like npm or npx.**\n\nTo install dependencies:\n\n```shell\nyarn install\n```\n\nTo build the project:\n```shell\nyarn build\n```\n\nTo run the tests:\n```shell\nyarn test\n```\n\nBefore you commit:\n```shell\nyarn validate\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexandre-lelain%2Fjs-extra","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexandre-lelain%2Fjs-extra","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexandre-lelain%2Fjs-extra/lists"}