{"id":21294173,"url":"https://github.com/dwtechs/sparray.js","last_synced_at":"2026-03-09T15:31:21.375Z","repository":{"id":259299282,"uuid":"876015921","full_name":"DWTechs/Sparray.js","owner":"DWTechs","description":"Useful methods to work with arrays in Javascript","archived":false,"fork":false,"pushed_at":"2025-04-25T20:16:40.000Z","size":89,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-08T19:14:27.990Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/DWTechs.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-21T09:01:50.000Z","updated_at":"2025-04-25T20:16:19.000Z","dependencies_parsed_at":"2024-11-26T22:24:14.146Z","dependency_job_id":"b0768f4b-84ef-4998-b59c-293fff78c56b","html_url":"https://github.com/DWTechs/Sparray.js","commit_stats":null,"previous_names":["dwtechs/sparray.js"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/DWTechs/Sparray.js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DWTechs%2FSparray.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DWTechs%2FSparray.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DWTechs%2FSparray.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DWTechs%2FSparray.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DWTechs","download_url":"https://codeload.github.com/DWTechs/Sparray.js/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DWTechs%2FSparray.js/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30301109,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T14:33:48.460Z","status":"ssl_error","status_checked_at":"2026-03-09T14:33:48.027Z","response_time":61,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-11-21T13:58:03.800Z","updated_at":"2026-03-09T15:31:21.366Z","avatar_url":"https://github.com/DWTechs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n[![License: MIT](https://img.shields.io/npm/l/@dwtechs/sparray.svg?color=brightgreen)](https://opensource.org/licenses/MIT)\n[![npm version](https://badge.fury.io/js/%40dwtechs%2Fsparray.svg)](https://www.npmjs.com/package/@dwtechs/sparray)\n[![last version release date](https://img.shields.io/github/release-date/DWTechs/Sparray.js)](https://www.npmjs.com/package/@dwtechs/sparray)\n![Jest:coverage](https://img.shields.io/badge/Jest:coverage-100%25-brightgreen.svg)\n[![minified size](https://img.shields.io/bundlephobia/min/@dwtechs/sparray?color=brightgreen)](https://www.npmjs.com/package/@dwtechs/sparray)\n\n- [Synopsis](#synopsis)\n- [Support](#support)\n- [Installation](#installation)\n- [Usage](#usage)\n  - [ES6](#es6)\n  - [CommonJS](#commonjs)\n- [API Reference](#api-reference)\n- [Contributors](#contributors)\n- [Stack](#stack)\n\n\n## Synopsis\n\n**[Sparray.js](https://github.com/DWTechs/Sparray.js)** is an Open source arrays toolkit library for Javascript.\n\n- Only 1 small dependency to check inputs variables\n- Very lightweight\n- Thoroughly tested\n- Works in Javascript, Typescript and Node.js\n- Can be used as CommonJS or EcmaScrypt module\n- Written in Typescript\n\n\n## Support\n\n- node: 14\n\nThis is the oldest targeted versions. The library should work properly on older versions of Node.js but we do not support it officially.  \n\n\n## Installation\n\n```bash\n$ npm i @dwtechs/sparray\n```\n\n\n## Usage\n\n\n### ES6 / TypeScript\n\n```javascript\nimport { chunk } from \"@dwtechs/sparray\";\n\nfunction chunkArray(req, res, next) {\n  req.chunks = chunk(req.body.rows, null);\n  next();\n}\n\nexport {\n  chunkArray,\n};\n\n```\n\n\n### CommonJS\n\n```javascript\n\nconst sp = require(\"@dwtechs/sparray\");\n\nfunction chunk(req, res, next) {\n  req.chunks = sp.chunk(req.body.rows, null);\n  next();\n}\n\nmodule.exports = {\n  chunk,\n};\n\n```\n\n\n## API Reference\n\n\n```javascript\n\nlet chunkSize = 100 //Default value\n\n/**\n * Gets the chunk size for the `chunk` function.\n *\n * @return {number} The current chunk size.\n */\ngetChunkSize(): number {}\n\n/**\n * Sets the chunk size for the `chunk` function.\n *\n * @param {number} size - The number of elements to include in each chunk.\n * @return {number} The new chunk size.\n */\nsetChunkSize(size: number): number {}\n\n/**\n * Inserts an element into an array at a specified index.\n *\n * @param {unknown[]} a - The array to modify.\n * @param {unknown} prop - The element to insert into the array.\n * @param {number} start - The index at which to insert the element.\n * @returns {unknown[]} The modified array after the insertion.\n */\nadd(a: unknown[], prop: unknown, start: number): unknown[];\n\n/**\n * Creates chunks of data from a given array of rows.\n *\n * @param {Array} rows - The array to be chunked.\n * @param {number} count - The number of rows in the array.\n * @return {Array} An array of chunked arrays.\n */\nchunk(rows: any[], size?: number = chunkSize): any[] {}\n\n/**\n * Returns an array of elements that are common to both input arrays.\n *\n * @param {Array} a - The first array to compare.\n * @param {Array} b - The second array to compare.\n * @return {Array} An array of elements that exist in both input arrays.\n */\ngetCommonValues(a: any[], b: any[]): any[] {}\n\n/**\n * Checks if there are common values between two arrays.\n *\n * @param {Array} a - The first array to compare.\n * @param {Array} b - The second array to compare.\n * @return {boolean} True if there are common values, otherwise false.\n */\ncheckCommonValues(a: any[], b: any[]): boolean {}\n\n/**\n * Flatten chunks.\n *\n * @param {Array} chunks - The array of chunks to be flattened.\n * @return {Array} The flattened array.\n */\nflatten(chunks: any[]): any[] {}\n\n/**\n * Deletes specified properties from each object in an array.\n *\n * @param {Array} arr - The array of objects.\n * @param {Array} props - The properties to delete.\n * @return {Array} The modified array.\n */\ndeleteProps(arr: Record\u003cstring, any\u003e[], props: string[]): Record\u003cstring, any\u003e[] {}\n\n```\n\n## Contributors\n\nSparray.js is still in development and we would be glad to get all the help you can provide.\nTo contribute please read **[contributor.md](https://github.com/DWTechs/Sparray.js/blob/main/contributor.md)** for detailed installation guide.\n\n\n## Stack\n\n| Purpose         |                    Choice                    |                                                     Motivation |\n| :-------------- | :------------------------------------------: | -------------------------------------------------------------: |\n| repository      |        [Github](https://github.com/)         |     hosting for software development version control using Git |\n| package manager |     [npm](https://www.npmjs.com/get-npm)     |                                default node.js package manager |\n| language        | [TypeScript](https://www.typescriptlang.org) | static type checking along with the latest ECMAScript features |\n| module bundler  |      [Rollup](https://rollupjs.org)          |                        advanced module bundler for ES6 modules |\n| unit testing    |          [Jest](https://jestjs.io/)          |                  delightful testing with a focus on simplicity |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdwtechs%2Fsparray.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdwtechs%2Fsparray.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdwtechs%2Fsparray.js/lists"}