{"id":21662379,"url":"https://github.com/das-jishu/simplifying","last_synced_at":"2025-04-11T23:42:37.617Z","repository":{"id":39602444,"uuid":"281855977","full_name":"das-jishu/simplifying","owner":"das-jishu","description":"A lightweight library containing multiple utility functions to make your life easier when dealing with arrays and objects.","archived":false,"fork":false,"pushed_at":"2023-01-06T12:28:02.000Z","size":1086,"stargazers_count":5,"open_issues_count":6,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T19:39:18.702Z","etag":null,"topics":["array","arrayofobjects","javascript","npm","npm-package","object","simplifying","util","utilities"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/simplifying","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/das-jishu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-23T05:07:43.000Z","updated_at":"2022-09-26T00:08:45.000Z","dependencies_parsed_at":"2023-02-06T02:00:53.456Z","dependency_job_id":null,"html_url":"https://github.com/das-jishu/simplifying","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/das-jishu%2Fsimplifying","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/das-jishu%2Fsimplifying/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/das-jishu%2Fsimplifying/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/das-jishu%2Fsimplifying/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/das-jishu","download_url":"https://codeload.github.com/das-jishu/simplifying/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248497901,"owners_count":21113982,"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":["array","arrayofobjects","javascript","npm","npm-package","object","simplifying","util","utilities"],"created_at":"2024-11-25T10:15:58.471Z","updated_at":"2025-04-11T23:42:37.584Z","avatar_url":"https://github.com/das-jishu.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simplifying JS\r\n\r\n![Image of simplifying](https://github.com/das-jishu/simplifying/blob/master/images/simplifying.png?raw=true)\r\n \r\n [![Build Status](https://travis-ci.org/das-jishu/simplifying.svg?branch=master)](https://travis-ci.org/github/das-jishu/simplifying)\r\n [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT \"MIT License\")\r\n [![npm version](http://img.shields.io/npm/v/simplifying.svg?style=flat)](https://npmjs.org/package/simplifying \"View this project on npm\")\r\n [![npm](https://img.shields.io/npm/dt/simplifying)](https://npmjs.org/package/simplifying \"View project on npm\")\r\n ![GitHub repo size](https://img.shields.io/github/repo-size/das-jishu/simplifying)\r\n [![npm bundle size](https://img.shields.io/bundlephobia/min/simplifying)](https://npmjs.org/package/simplifying \"View project on npm\")\r\n [![Active](http://img.shields.io/badge/Status-Active-green.svg)](https://github.com/das-jishu/simplifying)\r\n [![GitHub tag](https://img.shields.io/github/tag/das-jishu/simplifying.svg)](https://GitHub.com/das-jishu/simplifying/tags/)\r\n [![Generic badge](https://img.shields.io/badge/lang-typescript-yellow.svg)](https://www.typescriptlang.org/)\r\n \r\nA lightweight library containing multiple utility functions to make your life easier when dealing with arrays and objects.\r\n\r\n### HOW TO USE\r\n\r\nOpen the terminal and navigate to the root directory of your project.\u003cbr/\u003e\r\nInstall Simplifying:\u003cbr/\u003e\r\n```\r\nnpm i simplifying\r\n```\r\nIf you do not have npm installed, you can download it [here](https://www.npmjs.com/get-npm).\u003cbr/\u003e\u003cbr/\u003e\r\n##### EXAMPLE CODE:\r\n\r\n```javascript\r\nconst array = require('simplifying');\r\nlet arr = [2, 3, 4, 3, 3, 2, 4];\r\nconsole.log(array.removeDuplicates(arr));\r\n\r\n//OUTPUT: [2, 3, 4]\r\n```\r\n\u003cbr /\u003e\r\n\r\n![Image of example code](https://github.com/das-jishu/simplifying/blob/master/images/example.PNG?raw=true)\r\n\r\n\u003cbr /\u003e\r\n\r\n### List of all methods on array: \u003cbr/\u003e\r\n\r\n\r\nMethod | Parameters | Use\r\n------------ | ------------- | --------------\r\nshuffle | array: Array | Shuffles array and returns it\r\nremoveDuplicates | array: Array | Removes all duplicate elements and returns a new array\r\npickRandom | array: Array,\u003cbr/\u003e n: Number,\u003cbr/\u003e unique?: Boolean | Returns an array of n random elements from array.\u003cbr/\u003eThe returned elements will be unique if true is passed in the third parameter\r\ncountItem | array: Array,\u003cbr/\u003e item: any | Returns the frequency of the passed item in the array\r\ncountAll | array: Array | Returns a map which holds the frequencies of all items in the array\r\nsearchItems | array: Array,\u003cbr /\u003e item: any | Returns all positions where the given item is found\r\nremoveItems | array: Array,\u003cbr /\u003e item: any | Deletes multiple occurances of the given item\r\ntoArray | x: (string, number) | Converts string or number to array of characters or digits\r\nmerge | array1: Array,\u003cbr /\u003e array2: Array, \u003cbr /\u003e type?: string | Merge two arrays.\u003cbr /\u003e\u003cbr /\u003etype == 'merge-all': Keep the duplicates\u003cbr/\u003etype == 'common': Returns common elements\u003cbr /\u003eno type: Merge and remove common\r\nclean | array: Array | Removes null, undefined, '', NaN\r\nflatten | array: Array | Flattens all nested arrays inside\r\nswapByPosition | array: Array,\u003cbr /\u003epos1: number,\u003cbr /\u003epos2: number | Swaps values in pos1 and pos2 in the array\r\nswapByValues | array: Array,\u003cbr /\u003e value1: any,\u003cbr /\u003e value2: any | Swaps value1 and value2 in the array\r\nperform | array: Array,\u003cbr /\u003e operation: string | Performs the said operation on the array.\u003cbr /\u003eAllowed Operations:\u003cbr /\u003esum, product, min, max, average\r\narrayToObject | array: Array | Converts an array to object\r\nslide | array: Array,\u003cbr /\u003e steps: number,\u003cbr /\u003e direction?: string | Shifts array by n steps in the given direction. The default direction is left\r\nrange | array: Array,\u003cbr /\u003e start: number,\u003cbr /\u003e end: number | Returns a subarray from start to end - 1\r\njump | array: Array,\u003cbr /\u003e steps: number | Returns a subarray jumping the steps mentioned\r\nisUnique | array: Array | Return true if all elements are unique in the array and false otherwise\r\n\r\n\u003cbr /\u003e\r\n\r\n### List of all methods on array of objects: \u003cbr /\u003e\r\n\r\nMethod | Parameters | Use\r\n------------ | ------------- | --------------\r\narrayOfObjectsToObject | array: Array,\u003cbr /\u003e keyField: string | Converts an array of objects to an object where key is keyField\r\nsortByKeyField | array: Array,\u003cbr /\u003e keyField: string,\u003cbr /\u003e order?: string | Sorts an array of objects based on keyField. Default sorting order is ascending. Pass 'desc' to order for reverse.\r\ngetFields | array: Array,\u003cbr /\u003e fields: Array | Returns an array of objects containing only the required fields\r\ngetOneField | array: Array,\u003cbr /\u003e field: string | Returns an array of all the values of the particular field\r\nsearchByKeyField | array: Array,\u003cbr /\u003e searchField: string,\u003cbr /\u003e searchValue: string,\u003cbr /\u003e reqFields?: Array | Searches the array for the given (key, value) pair and returns only the reqFields. If nothing is passed, the whole object is returned.\r\ndeleteByKeyField | array: Array,\u003cbr /\u003e field: string,\u003cbr /\u003e value: string | Deletes an item based on the (key, value) pair\r\ngetKeys | array: Array | Returns an array of all the keys inside the object. Assumes that all objects have the same keys\r\nfindObjects | array: Array,\u003cbr /\u003e func: Function | Executes the function on all objects and returns the satisfied objects\r\n\r\n\u003cbr /\u003e\r\n\r\n### LICENSE\r\n\r\n[MIT](https://opensource.org/licenses/MIT)\r\n\u003cbr /\u003e\r\n\r\n### Author\r\n\r\nSubham Das\r\n\r\n##### Open an issue if you feel the need for a change or want to report any bugs.\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdas-jishu%2Fsimplifying","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdas-jishu%2Fsimplifying","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdas-jishu%2Fsimplifying/lists"}