{"id":22021454,"url":"https://github.com/lamansky/vget","last_synced_at":"2026-04-08T18:04:07.180Z","repository":{"id":57391994,"uuid":"134572350","full_name":"lamansky/vget","owner":"lamansky","description":"[Node.js] Gets a value from a collection that strictly or loosely equals another value.","archived":false,"fork":false,"pushed_at":"2018-05-23T13:20:10.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T15:50:23.960Z","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/lamansky.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-23T13:17:43.000Z","updated_at":"2018-05-23T13:20:12.000Z","dependencies_parsed_at":"2022-09-19T05:23:04.039Z","dependency_job_id":null,"html_url":"https://github.com/lamansky/vget","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamansky%2Fvget","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamansky%2Fvget/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamansky%2Fvget/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamansky%2Fvget/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lamansky","download_url":"https://codeload.github.com/lamansky/vget/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245084920,"owners_count":20558304,"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":[],"created_at":"2024-11-30T06:12:07.727Z","updated_at":"2025-12-30T22:07:13.536Z","avatar_url":"https://github.com/lamansky.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vget\n\nGets a value from a collection that strictly or loosely equals another value.\n\n## Installation\n\nRequires [Node.js](https://nodejs.org/) 8.3.0 or above.\n\n```bash\nnpm i vget\n```\n\n## API\n\nThe module exports a `get()` function that has one other function attached to it as a method: `get.any()`.\n\n### `get()`\n\n#### Parameters\n\n1. Bindable: `collection` (Array, Iterator, Map, Object, Set, string, Typed Array, or WeakSet): The collection from which to retrieve a value.\n2. `valueToMatch` (any): The value to retrieve from the collection.\n3. Optional: Object argument:\n    * `arrays` / `maps` / `sets` / `weakSets` (arrays of classes/strings): Arrays of classes and/or string names of classes that should be treated as equivalent to `Array`/`Map`/`Set`/`WeakSet` (respectively).\n    * `elseReturn` (any): A value to return if `valueToMatch` is not found. Defaults to `undefined`.\n    * `inObj` (boolean): Whether or not to search inherited properties if `collection` is an Object (i.e. not another recognized type). Defaults to `false`.\n    * `loose` (boolean): Whether or not to compare values loosely (as defined by `looselyEquals`). Defaults to `false`.\n    * `looselyEquals` (function): A callback that accepts two values and returns `true` if they are to be considered equivalent or `false` otherwise. This argument is only used if `loose` is `true`. If omitted, the default behavior will, among other things, consider arrays/objects to be equal if they have the same entries.\n    * `preferStrict` (boolean): Only applies if `loose` is `true`. If `true`, then strictly-identical values will be preferred over loosely-equivalent values. Otherwise, the first loosely-equivalent key found will be used, even if a strictly-identical one comes later. Defaults to `false`.\n    * `reflectObj` (boolean): Whether or not to use reflection to include non-enumerable Object property values. Only takes effect if `collection` is an Object (i.e. not another recognized type). Defaults to `false`.\n\n#### Return Values\n\n* Returns a value from the collection that matches the search value either strictly or loosely (depending on the configured options).\n* If no such value exists, returns `elseReturn` if provided; otherwise `undefined`.\n\n#### Example\n\n```javascript\nconst get = require('vget')\n\nconst emptyObj = {}\nconst collection = [emptyObj]\n\nget(collection, {}, {loose: true}) === emptyObj // true\n```\n\n### `get.any()`\n\nUse this function if you want to get the first value that matches any one of a set of values. The signature is the same as that of the main function except that the second parameter is called `valuesToMatch` and takes an iterable (such as an array or string).\n\n## Related\n\nThe “k” family of modules works on keyed/indexed collections.\n\n* [khas](https://github.com/lamansky/khas)\n* [kget](https://github.com/lamansky/kget)\n* [kedit](https://github.com/lamansky/kedit)\n* [kset](https://github.com/lamansky/kset)\n* [kinc](https://github.com/lamansky/kinc)\n* [kdel](https://github.com/lamansky/kdel)\n\nThe “v” family of modules works on any collection of values.\n\n* [vhas](https://github.com/lamansky/vhas)\n* [vsize](https://github.com/lamansky/vsize)\n* [vadd](https://github.com/lamansky/vadd)\n* [vdel](https://github.com/lamansky/vdel)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flamansky%2Fvget","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flamansky%2Fvget","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flamansky%2Fvget/lists"}