{"id":21831425,"url":"https://github.com/nodef/extra-sorted-array","last_synced_at":"2026-02-17T17:32:29.715Z","repository":{"id":40715341,"uuid":"273426239","full_name":"nodef/extra-sorted-array","owner":"nodef","description":"A sorted array is a collection of values, arranged in an order.","archived":false,"fork":false,"pushed_at":"2025-04-08T17:17:43.000Z","size":283,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-27T13:34:55.580Z","etag":null,"topics":["array","chunk","clear","compare","count","count-each","cut","cut-at","cut-at-right","cut-right","deep-clone","difference","drop","drop-right","drop-while","drop-while-right","entries","every","extra","sorted"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/extra-sorted-array","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/nodef.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-06-19T06:57:44.000Z","updated_at":"2025-04-08T17:17:43.000Z","dependencies_parsed_at":"2023-02-09T19:16:08.031Z","dependency_job_id":"78be9683-e0bf-4d51-a7de-c9bed1027834","html_url":"https://github.com/nodef/extra-sorted-array","commit_stats":{"total_commits":20,"total_committers":1,"mean_commits":20.0,"dds":0.0,"last_synced_commit":"7d2b0b2e862163102bc7b66faa6e86aa1f11530a"},"previous_names":["nodef/extra-sortedarray"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/nodef/extra-sorted-array","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodef%2Fextra-sorted-array","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodef%2Fextra-sorted-array/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodef%2Fextra-sorted-array/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodef%2Fextra-sorted-array/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nodef","download_url":"https://codeload.github.com/nodef/extra-sorted-array/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodef%2Fextra-sorted-array/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29551257,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-17T14:33:00.708Z","status":"ssl_error","status_checked_at":"2026-02-17T14:32:58.657Z","response_time":100,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["array","chunk","clear","compare","count","count-each","cut","cut-at","cut-at-right","cut-right","deep-clone","difference","drop","drop-right","drop-while","drop-while-right","entries","every","extra","sorted"],"created_at":"2024-11-27T19:10:23.447Z","updated_at":"2026-02-17T17:32:29.694Z","avatar_url":"https://github.com/nodef.png","language":"TypeScript","readme":"A [sorted array] is a collection of values, arranged in an order.\u003cbr\u003e\n📦 [Node.js](https://www.npmjs.com/package/extra-sorted-array),\n🌐 [Web](https://www.npmjs.com/package/extra-sorted-array.web),\n📜 [Files](https://unpkg.com/extra-sorted-array/),\n📰 [Docs](https://nodef.github.io/extra-sorted-array/),\n📘 [Wiki](https://github.com/nodef/extra-sorted-array/wiki/).\n\n\u003cbr\u003e\n\n\nThis package includes comprehensive set of functions that operate on a sorted\narray with which you can **search a value** using binary search, **merge**\nmultiple sorted arrays, or perform **set operations** upon it.\n\nWe use a consistent naming scheme that helps you quickly identify the functions\nyou need. All functions except `from*()` take array as 1st parameter. Some\nfunctions operate on a specified range in the array and are called `ranged*()`,\nsuch as `rangedMerge()`. Functions like `slice()` are pure and do not modify the\narray itself, while functions like `slice$()` *do modify (update)* the array\nitself. Some functions accept a map function in addition to a compare function.\nFurther, functions which return an iterable instead of an array are prefixed\nwith `i`, such as `isubsequences()`. We borrow some names from other programming\nlanguages such as *Haskell*, *Python*, *Java*, and *Processing*.\n\nWith this package, you can simplify the implementation of complex algorithms,\nand be able to achieve your goals faster, regardless of your level of expertise.\nTry it out today and discover how it can transform your development experience!\nThis package is available in *Node.js* and *Web* formats. To use it on the web,\nsimply use the `extra_sorted_array` global variable after loading with a\n`\u003cscript\u003e` tag from the [jsDelivr CDN].\n\n\u003e Stability: [Experimental](https://www.youtube.com/watch?v=L1j93RnIxEo).\n\n[sorted array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort\n[jsDelivr CDN]: https://cdn.jsdelivr.net/npm/extra-sorted-array.web/index.js\n\n\u003cbr\u003e\n\n```javascript\nconst xsortedArray = require('extra-sorted-array');\n// import * as xsortedArray from \"extra-sorted-array\";\n// import * as xsortedArray from \"https://unpkg.com/extra-sorted-array/index.mjs\"; (deno)\n\nvar x = [10, 20, 20, 40, 40, 80];\nxsortedArray.searchValue(x, 40);\n// → 3\n\nvar x = [10, 20, 20, 40, 40, 80];\nvar y = [20, 50, 70];\nxsortedArray.merge(x, y);\n// → [ 10, 20, 20, 20, 40, 40, 50, 70, 80 ]\n\nvar x = [10, 20, 20, 40, 40, 80];\nvar y = [20, 50, 70];\nvar z = [30, 60, 90];\nxsortedArray.mergeAll([x, y, z]);\n// → [ 10, 20, 20, 20, 30, 40, 40, 50, 60, 70, 80, 90 ]\n\nvar x = [10, 20, 20, 40, 40, 80];\nvar y = [20, 50, 70];\nxsortedArray.isDisjoint(x, y);\n// → false\n\nvar x = [10, 20, 20, 40, 40, 80];\nvar y = [20, 50, 80];\nxsortedArray.intersection(x, y);\n// → [ 20, 80 ]\n```\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n\n## Index\n\n| Property | Description |\n|  ----  |  ----  |\n| [includes] | Check if sorted array has a value using binary search. |\n| [hasValue] | Check if sorted array has a value using binary search. |\n| [indexOf] | Find first index of value using binary search. |\n| [lastIndexOf] | Find last index of value using binary search. |\n| [searchValue] | Find first index of value using binary search. |\n| [searchValueRight] | Find last index of a value using binary search. |\n| [searchValueAny] | Find any index of a value using binary search. |\n| [searchClosestValue] | Find index of closest value using binary search. |\n|  |  |\n| [merge] | Merge values from two sorted arrays. |\n| [mergeAll] | Merge values from sorted arrays. |\n|  |  |\n| [isUnique] | Examine if there are no duplicate values. |\n| [isDisjoint] | Examine if arrays have no value in common. |\n| [unique] | Remove duplicate values. |\n| [union] | Obtain values present in any sorted array. |\n| [intersection] | Obtain values present in both sorted arrays. |\n| [difference] | Obtain values not present in another sorted array. |\n| [symmetricDifference] | Obtain values present in either sorted array but not both. |\n\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n\n## References\n\n- [binarysearch - npm : Ryan Day](https://www.npmjs.com/package/binarysearch)\n- [binary-sorted-array - npm : Michal Iwanow](https://www.npmjs.com/package/binary-sorted-array)\n- [How to add region in java script file, visual studio](https://stackoverflow.com/a/51550649/1413259)\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n[![](https://img.youtube.com/vi/VnFLMIEZNG8/maxresdefault.jpg)](https://www.youtube.com/watch?v=VnFLMIEZNG8)\u003cbr\u003e\n[![ORG](https://img.shields.io/badge/org-nodef-green?logo=Org)](https://nodef.github.io)\n[![Coverage Status](https://coveralls.io/repos/github/nodef/extra-sorted-array/badge.svg?branch=master)](https://coveralls.io/github/nodef/extra-sorted-array?branch=master)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/31b3e3f490532d3bd3d3/test_coverage)](https://codeclimate.com/github/nodef/extra-sorted-array/test_coverage)\n\u003c!-- [![DOI](https://zenodo.org/badge/133759104.svg)](https://zenodo.org/badge/latestdoi/133759104) --\u003e\n\n![](https://ga-beacon.deno.dev/G-RC63DPBH3P:SH3Eq-NoQ9mwgYeHWxu7cw/github.com/nodef/extra-sorted-array)\n\n[includes]: https://github.com/nodef/extra-sorted-array/wiki/includes\n[hasValue]: https://github.com/nodef/extra-sorted-array/wiki/hasValue\n[indexOf]: https://github.com/nodef/extra-sorted-array/wiki/indexOf\n[lastIndexOf]: https://github.com/nodef/extra-sorted-array/wiki/lastIndexOf\n[searchValue]: https://github.com/nodef/extra-sorted-array/wiki/searchValue\n[searchValueRight]: https://github.com/nodef/extra-sorted-array/wiki/searchValueRight\n[searchValueAny]: https://github.com/nodef/extra-sorted-array/wiki/searchValueAny\n[searchClosestValue]: https://github.com/nodef/extra-sorted-array/wiki/searchClosestValue\n[merge]: https://github.com/nodef/extra-sorted-array/wiki/merge\n[rangedMerge]: https://github.com/nodef/extra-sorted-array/wiki/rangedMerge\n[mergeAll]: https://github.com/nodef/extra-sorted-array/wiki/mergeAll\n[isUnique]: https://github.com/nodef/extra-sorted-array/wiki/isUnique\n[isDisjoint]: https://github.com/nodef/extra-sorted-array/wiki/isDisjoint\n[unique]: https://github.com/nodef/extra-sorted-array/wiki/unique\n[union]: https://github.com/nodef/extra-sorted-array/wiki/union\n[intersection]: https://github.com/nodef/extra-sorted-array/wiki/intersection\n[difference]: https://github.com/nodef/extra-sorted-array/wiki/difference\n[symmetricDifference]: https://github.com/nodef/extra-sorted-array/wiki/symmetricDifference\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodef%2Fextra-sorted-array","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnodef%2Fextra-sorted-array","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodef%2Fextra-sorted-array/lists"}