{"id":15679790,"url":"https://github.com/jonschlinkert/lookup-deps","last_synced_at":"2025-05-07T10:42:34.833Z","repository":{"id":21709717,"uuid":"25031207","full_name":"jonschlinkert/lookup-deps","owner":"jonschlinkert","description":"Simple API for getting metadata from locally installed npm packages (in `node_modules`).","archived":false,"fork":false,"pushed_at":"2015-02-03T06:27:03.000Z","size":280,"stargazers_count":11,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-01T19:41:33.704Z","etag":null,"topics":["cache","dependencies","deps","package","package-json","tree"],"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/jonschlinkert.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2014-10-10T10:35:40.000Z","updated_at":"2021-04-12T22:44:39.000Z","dependencies_parsed_at":"2022-08-17T18:40:50.955Z","dependency_job_id":null,"html_url":"https://github.com/jonschlinkert/lookup-deps","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Flookup-deps","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Flookup-deps/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Flookup-deps/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Flookup-deps/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonschlinkert","download_url":"https://codeload.github.com/jonschlinkert/lookup-deps/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252862149,"owners_count":21815805,"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":["cache","dependencies","deps","package","package-json","tree"],"created_at":"2024-10-03T16:36:26.520Z","updated_at":"2025-05-07T10:42:34.814Z","avatar_url":"https://github.com/jonschlinkert.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lookup-deps [![NPM version](https://badge.fury.io/js/lookup-deps.svg)](http://badge.fury.io/js/lookup-deps)\n\n\u003e Simple API for getting metadata from locally installed npm packages (in `node_modules`).\n\n## What does it do!?\n\nBuilds a recursive tree of all `dependencies` currently installed in node_modules. Allows you to easily get information from the package.json of any locally installed module.\n\n**Examples:**\n\nGet the version of the specified dependency:\n\n```js\ndeps.get('markdown-utils', 'version');\n//=\u003e '0.1.0'\n```\n\nUse glob patterns to get the specified property from every dependency:\n\n```js\ndeps.get('*', 'homepage')\n\n// returns an object like this:\n{ globby: 'https://github.com/sindresorhus/globby',\n 'is-relative': 'https://github.com/jonschlinkert/is-relative',\n 'is-absolute': 'https://github.com/jonschlinkert/is-absolute', ...}\n```\n\nIf an object is returned with `null` values, this means that the package wasn't found at the given path. e.g. it was symlinked by npm.\n\nTo get around this, you can pass `{findup: true}` to the constructor and [findup-sync] will be used to find the nearest match. This is\ndisabled by default since this is an exception to the rule and it considerably slows down searches.\n\n## Install\n### Install with [npm](npmjs.org):\n\n```bash\nnpm i lookup-deps --save-dev\n```\n\n## Run tests\n\n```bash\nnpm test\n```\n\n## Usage\n\n```js\nvar Deps = require('lookup-deps');\nvar deps = new Deps();\n```\n\n## API\n### [Lookup](index.js#L46)\n\nCreate a new instance of `Lookup`.\n\n* `config` **{Object}**: Optionally pass a default config object instead of `package.json` For now there is no reason to do this.    \n* `options` **{Object}**    \n\n```js\nvar Lookup = require('lookup-deps');\nvar deps = new Lookup();\n```\n\n### [.get](index.js#L120)\n\nGet a value from the cache.\n\n* `name` **{Object}**: The module to get.    \n* `props` **{String}**: Property paths.    \n* `returns`: {Object}  \n\n```js\n// get an entire package.json\ndeps.get('markdown-utils');\n//=\u003e { pkg: { name: 'markdown-utils', version: '0.3.0', ... }\n\n// or, get a specific value\ndeps.get('markdown-utils', 'version');\n//=\u003e '0.3.0'\n```\n\n### [.exists](index.js#L144)\n\nCheck to see if a module exists (or at least is on the cache).\n\n* `name` **{String}**: The name to check.    \n* `returns`: {String}  \n\n```js\ndeps.exists('markdown-utils');\n//=\u003e true\n```\n\n### [.depsKeys](index.js#L215)\n\nGet the keys for `dependencies` for the specified package.\n\n* `config` **{Object|String}**: The name of the module, or package.json config object.    \n* `returns`: {Object}  \n\n```js\ndeps.depsKeys('markdown-utils');\n//=\u003e [ 'is-absolute', 'kind-of', 'relative', ... ]\n```\n\n### [.findPkg](index.js#L284)\n\n* `filepath` **{String}**    \n* `returns`: {String}  \n\nFind a package.json for the given module by `name`, starting\nthe search at the given `cwd`.\n\n### [.tree](index.js#L350)\n\nBuild a dependency tree by recursively reading in package.json files for projects in node_modules.\n\n* `cwd` **{String}**: The root directory to search from.    \n* `returns`: {Object}  \n\n```js\ndeps.tree('./');\n```\n\n### [.filter](index.js#L407)\n\nFilter the entire `cache` object to have only packages with names that match the given glob patterns.\n\n* `patterns` **{String|Array}**: Glob patterns to use for filtering modules.    \n* `keyPatterns` **{String|Array}**: Glob patterns to use for filtering the keys on each object.    \n* `returns` **{Object}**: Filtered object.  \n\nYou may also filter the keys on each object by passing\nadditional glob patterns as a second argument.\n\n```js\ndeps.filter('markdown-*');\n//=\u003e {'markdown-utils': {...}}\n\n// exclude the `readme` key from package.json objects\ndeps.filter('markdown-*', ['*', '!readme']);\n//=\u003e {'markdown-utils': {...}}\n```\n\n### [.getParents](index.js#L436)\n\nReturns an object of all modules that have the given module as a dependency. Glob patterns may be used for filtering.\n\n* `patterns` **{String|Array}**: Glob patterns to use for filtering.    \n* `returns` **{Object}**: Object of parent modules.  \n\n```js\ndeps.getParents('*');\n```\n\n### [.names](index.js#L455)\n\nReturn a list of names of all resolved packages from node_modules that match the given glob patterns. If no pattern is provided the entire list is returned.\n\n* `patterns` **{String|Array}**: Glob patterns to use for filtering.    \n* `returns` **{Array}**: Array of keys.  \n\n```js\ndeps.names('markdown-*');\n//=\u003e ['markdown-utils']\n```\n\n### [.find](index.js#L481)\n\nFind a module or modules using glob patterns, and return an object filtered to have only the specified `props`. Note that `package.json` objects are stored on the `pkg` property for each module.\n\n* `patterns` **{String}**    \n* `props` **{String}**    \n* `returns`: {Object}  \n\nProperties are specified using object paths:\n\n```js\ndeps.find('for-*', 'pkg.repository.url');\n\n// results in:\n// { 'for-own': 'git://github.com/jonschlinkert/for-own.git',\n//   'for-in': 'git://github.com/jonschlinkert/for-in.git' }\n```\n\n### [.lookup](index.js#L506)\n\nA convenience proxy for the `.find()` method to specifically search the `pkg` object of each module on the cache.\n\n* `patterns` **{String}**    \n* `props` **{String}**    \n* `returns`: {Object}  \n\n```js\ndeps.lookup('for-*', 'repository.url');\n\n// results in:\n// { 'for-own': 'git://github.com/jonschlinkert/for-own.git',\n//   'for-in': 'git://github.com/jonschlinkert/for-in.git' }\n```\n\n### [.paths](index.js#L524)\n\nGet the path to a module or modules, relative to the current working directory. Glob patterns may be used.\n\n* `patterns` **{String}**    \n* `returns`: {String}  \n\n```js\ndeps.paths('*');\n```\n\n### [.pkg](index.js#L541)\n\nGet the package.json objects for the given module or modules. Glob patterns may be used.\n\n* `patterns` **{String}**    \n* `returns`: {String}  \n\n```js\ndeps.pkg('markdown-utils');\n```\n\n### [.dependencies](index.js#L559)\n\nGet the `dependencies` for the given modules. Glob patterns may be used.\n\n* `patterns` **{String}**    \n* `returns`: {Object}  \n\n```js\ndeps.dependencies('multi*');\n//=\u003e { multimatch: { 'array-differ': '^1.0.0', ... } }\n```\n\n### [.devDependencies](index.js#L577)\n\nGet the `devDependencies` for the given modules. Glob patterns may be used.\n\n* `patterns` **{String}**    \n* `returns`: {Object}  \n\n```js\ndeps.devDependencies('multi*');\n//=\u003e { multimatch: { 'array-differ': '^1.0.0', ... } }\n```\n\n### [.keywords](index.js#L594)\n\nGet the `keywords` for the given modules.\n\n* `patterns` **{String}**    \n* `returns`: {String}  \n\n```js\ndeps.keywords('multi*');\n//=\u003e { multimatch: [ 'minimatch', 'match', ... ] }\n```\n\n### [.homepage](index.js#L611)\n\nGet the `homepage` for the specified modules.\n\n* `patterns` **{String}**    \n* `returns`: {String}  \n\n```js\ndeps.homepage('markdown-*');\n//=\u003e { 'markdown-utils': 'https://github.com/jonschlinkert/markdown-utils' }\n```\n\n### [.links](index.js#L629)\n\nGet a list of markdown-formatted links, from the `homepage` properties of the specified modules.\n\n* `patterns` **{String}**    \n* `returns`: {String}  \n\n```js\ndeps.links('markdown-*');\n//=\u003e [markdown-utils](https://github.com/jonschlinkert/markdown-utils)\n```\n\n### [.reflinks](index.js#L655)\n\nGet a list of markdown-formatted links, from the `homepage` properties of the specified modules.\n\n* `patterns` **{String}**    \n* `returns`: {String}  \n\n```js\ndeps.reflinks('markdown-*');\n//=\u003e [markdown-utils]: https://github.com/jonschlinkert/markdown-utils\n```\n\n\n## Author\n\n**Jon Schlinkert**\n \n+ [github/jonschlinkert](https://github.com/jonschlinkert)\n+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) \n\n## License\nCopyright (c) 2014-2015 Jon Schlinkert  \nReleased under the MIT license\n\n***\n\n_This file was generated by [verb](https://github.com/assemble/verb) on February 03, 2015._\n\n[arr-flatten]: https://github.com/jonschlinkert/arr-flatten\n[filter-object]: https://github.com/jonschlinkert/filter-object\n[isobject]: https://github.com/jonschlinkert/isobject\n[deep-filter-object]: https://github.com/jonschlinkert/deep-filter-object\n[arr-map]: https://github.com/jonschlinkert/arr-map\n[array-slice]: https://github.com/jonschlinkert/array-slice\n[extend-shallow]: https://github.com/jonschlinkert/extend-shallow\n[kind-of]: https://github.com/jonschlinkert/kind-of\n[arr-diff]: https://github.com/jonschlinkert/arr-diff\n[for-own]: https://github.com/jonschlinkert/for-own\n[make-iterator]: https://github.com/jonschlinkert/make-iterator\n[arr-filter]: https://github.com/jonschlinkert/arr-filter\n[is-number]: https://github.com/jonschlinkert/is-number\n[randomatic]: https://github.com/jonschlinkert/randomatic\n[repeat-element]: https://github.com/jonschlinkert/repeat-element\n[repeat-string]: https://github.com/jonschlinkert/repeat-string\n[fill-range]: https://github.com/jonschlinkert/fill-range\n[expand-range]: https://github.com/jonschlinkert/expand-range\n[preserve]: https://github.com/jonschlinkert/preserve\n[braces]: https://github.com/jonschlinkert/braces\n[filename-regex]: https://github.com/regexps/filename-regex\n[glob-path-regex]: https://github.com/regexps/glob-path-regex\n[is-glob]: https://github.com/jonschlinkert/is-glob\n[micromatch]: https://github.com/jonschlinkert/micromatch\n[export-files]: https://github.com/jonschlinkert/export-files\n[filter-keys]: https://github.com/jonschlinkert/filter-keys\n[filter-values]: https://github.com/jonschlinkert/filter-values\n[sort-asc]: https://github.com/jonschlinkert/sort-asc\n[sort-desc]: https://github.com/jonschlinkert/sort-desc\n[sort-object]: https://github.com/doowb/sort-object\n[for-in]: https://github.com/jonschlinkert/for-in\n[get-value]: https://github.com/jonschlinkert/get-value\n[look-up]: https://github.com/jonschlinkert/look-up\n[markdown-utils]: https://github.com/jonschlinkert/markdown-utils\n\n\n\u003c!-- deps: helper-reflinks --\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonschlinkert%2Flookup-deps","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonschlinkert%2Flookup-deps","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonschlinkert%2Flookup-deps/lists"}