{"name":"libnpmfund","version":"4.0.2","keywords":["npm","npmcli","libnpm","cli","git","fund","gitfund"],"author":{"name":"GitHub Inc."},"license":"ISC","_id":"libnpmfund@4.0.2","contributors":[{"url":"https://ruyadorno.com","name":"Ruy Adorno"}],"homepage":"https://github.com/npm/cli#readme","bugs":{"url":"https://github.com/npm/cli/issues"},"tap":{"nyc-arg":["--exclude","tap-snapshots/**"]},"dist":{"shasum":"a3900a4245fdb637813a5e523d49488b396efeb6","tarball":"http://registry-npm.ywwl.com/libnpmfund/download/libnpmfund-4.0.2.tgz","fileCount":4,"integrity":"sha512-uCYWErkrVV9F/slsIn+gbYou3jFptO9LByOVAgt6bPHvHslWMFwRHlSxyHQCI46yV1HhiuFvQiQR8gJE9K6ZXQ==","signatures":[{"sig":"MEYCIQDi4dKHDU7ENaQ9MBUCA2gtVnvjwIUxvqJXQFr7PXvhYgIhANfiiThYmuUtrKzDHRd4beW+vgAXef9H73pBteLmv8vw","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11031,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjYrWuACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqNoA//QK6GseXa8+Y1Qv3x8c5MIKlNSbUcC0nde6J+5jUOpuJ5JWIx\r\n9WQOW6TB1w2AgiAcrVjmBDrtv809RSDqkLXXANiFsgWi9C6oWgSZcddZss7X\r\n8BSMik0fBV6WnxLzwtEEOuoh4LSa+rcu2pcpaxPT4MT1Yii3cTtiTLAiqRMd\r\nxgkwKkTdd5jv/SlmFddHRBaXvzO8a2/PEGaLDAhgREaWUSY7C+HGYY+GOnkx\r\nJov2T/2iH5hiKiJyKOIlzwKZVGDtZLZWz5md56uSa6IUwVjc8Hi8qBEWciRv\r\nY5JxA5Y7LnmhPWo4orYyB7JnQvZnKAThsmdsDxvyOe9UGlYRNlGrg7cC9Pbp\r\nKTzgpJywLFc+q4o5wGEdkKhcdLEd9pjfI2+tPve1GgZlhaDR1zNriUnZ4GS4\r\nR5MIi08EbAxcwWTqJc/yKJSVh0EM0O19qXwTAo0e9A0x4uYmKNJZyaEJF2b/\r\nUq6hkJBKUx7vN4sfXEoO83sTWI1by6h1xV+9hntWo2N15Bb2N7e0RPIHv11O\r\ntg2EwqhatzKiipR1QPVUSPRODHbsVPrXrWCFyPld9gVrb08l7MW/UWmqyRQS\r\nHkrqvgnXDd1a+EPIOLWy4uLke4MJFGRf0pLJc7EuIJskrGNY+/Pyv4Cy2riV\r\n1y/5g4J5NJGXE8Pg03zJl6SpI5PrH9wDUb4=\r\n=uTE5\r\n-----END PGP SIGNATURE-----\r\n","size":4172,"noattachment":false,"key":"/libnpmfund/-/libnpmfund-4.0.2.tgz"},"main":"lib/index.js","engines":{"node":"^14.17.0 || ^16.13.0 || >=18.0.0"},"scripts":{"lint":"eslint \"**/*.js\"","snap":"tap","test":"tap","eslint":"eslint","lintfix":"node ../.. run lint -- --fix","postlint":"template-oss-check","posttest":"node ../.. run lint","template-oss-apply":"template-oss-apply --force"},"_npmUser":{"name":"gar","email":"gar+npm@danger.computer"},"repository":{"url":"git+https://github.com/npm/cli.git","type":"git","directory":"workspaces/libnpmfund"},"_npmVersion":"9.1.0","description":"Programmatic API for npm fund","directories":{},"templateOSS":{"content":"../../scripts/template-oss/index.js","version":"4.8.0","//@npmcli/template-oss":"This file is partially managed by @npmcli/template-oss. Edits may be overwritten."},"_nodeVersion":"18.12.0","dependencies":{"@npmcli/arborist":"^6.1.1"},"_hasShrinkwrap":false,"devDependencies":{"tap":"^16.0.1","@npmcli/template-oss":"4.8.0","@npmcli/eslint-config":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/libnpmfund_4.0.2_1667413422047_0.7969934923266075","host":"s3://npm-registry-packages"},"readme":"# libnpmfund\n\n[![npm version](https://img.shields.io/npm/v/libnpmfund.svg)](https://npm.im/libnpmfund)\n[![license](https://img.shields.io/npm/l/libnpmfund.svg)](https://npm.im/libnpmfund)\n[![CI - libnpmfund](https://github.com/npm/cli/actions/workflows/ci-libnpmfund.yml/badge.svg)](https://github.com/npm/cli/actions/workflows/ci-libnpmfund.yml)\n\n[`libnpmfund`](https://github.com/npm/libnpmfund) is a Node.js library for\nretrieving **funding** information for packages installed using\n[`arborist`](https://github.com/npm/arborist).\n\n## Table of Contents\n\n* [Example](#example)\n* [Install](#install)\n* [Contributing](#contributing)\n* [API](#api)\n* [LICENSE](#license)\n\n## Example\n\n```js\nconst { read } = require('libnpmfund')\n\nconst fundingInfo = await read()\nconsole.log(\n  JSON.stringify(fundingInfo, null, 2)\n)\n// => {\n  length: 2,\n  name: 'foo',\n  version: '1.0.0',\n  funding: { url: 'https://example.com' },\n  dependencies: {\n    bar: {\n      version: '1.0.0',\n      funding: { url: 'http://collective.example.com' }\n    }\n  }\n}\n```\n\n## Install\n\n`$ npm install libnpmfund`\n\n### Contributing\n\nThe npm team enthusiastically welcomes contributions and project participation!\nThere's a bunch of things you can do if you want to contribute! The\n[Contributor Guide](https://github.com/npm/cli/blob/latest/CONTRIBUTING.md)\noutlines the process for community interaction and contribution. Please don't\nhesitate to jump in if you'd like to, or even ask us questions if something\nisn't clear.\n\nAll participants and maintainers in this project are expected to follow the\n[npm Code of Conduct](https://www.npmjs.com/policies/conduct), and just\ngenerally be excellent to each other.\n\nPlease refer to the [Changelog](CHANGELOG.md) for project history details, too.\n\nHappy hacking!\n\n### API\n\n##### <a name=\"fund.read\"></a> `> fund.read([opts]) -> Promise<Object>`\n\nReads **funding** info from a npm install and returns a promise for a\ntree object that only contains packages in which funding info is defined.\n\nOptions:\n\n- `countOnly`: Uses the tree-traversal logic from **npm fund** but skips over\nany obj definition and just returns an obj containing `{ length }` - useful for\nthings such as printing a `6 packages are looking for funding` msg.\n- `workspaces`: `Array<String>` List of workspaces names to filter for,\nthe result will only include a subset of the resulting tree that includes\nonly the nodes that are children of the listed workspaces names.\n- `path`, `registry` and more [Arborist](https://github.com/npm/arborist/) options.\n\n##### <a name=\"fund.readTree\"></a> `> fund.readTree(tree, [opts]) -> Promise<Object>`\n\nReads **funding** info from a given install tree and returns a tree object\nthat only contains packages in which funding info is defined.\n\n- `tree`: An [`arborist`](https://github.com/npm/arborist) tree to be used, e.g:\n\n```js\nconst Arborist = require('@npmcli/arborist')\nconst { readTree } = require('libnpmfund')\n\nconst arb = new Arborist({ path: process.cwd() })\nconst tree = await arb.loadActual()\n\nreturn readTree(tree, { countOnly: false })\n```\n\nOptions:\n\n- `countOnly`: Uses the tree-traversal logic from **npm fund** but skips over\nany obj definition and just returns an obj containing `{ length }` - useful for\nthings such as printing a `6 packages are looking for funding` msg.\n\n##### <a name=\"fund.normalizeFunding\"></a> `> fund.normalizeFunding(funding) -> Object`\n\nFrom a `funding` `<object|string|array>`, retrieves normalized funding objects\ncontaining a `url` property.\n\ne.g:\n\n```js\nnormalizeFunding('http://example.com')\n// => {\n  url: 'http://example.com'\n}\n```\n\n##### <a name=\"fund.isValidFunding\"></a> `> fund.isValidFunding(funding) -> Boolean`\n\nReturns `<true>` if `funding` is a valid funding object, e.g:\n\n```js\nisValidFunding({ foo: 'not a valid funding obj' })\n// => false\n\nisValidFunding('http://example.com')\n// => true\n```\n\n## LICENSE\n\n[ISC](./LICENSE)\n","publish_time":1667413422174,"maintainers":[{"name":"reggi","email":"reggi@github.com"},{"name":"npm-cli-ops","email":"npm-cli+bot@github.com"},{"name":"saquibkhan","email":"saquibkhan@github.com"},{"name":"fritzy","email":"fritzy@github.com"},{"name":"gar","email":"gar+npm@danger.computer"}],"_cnpm_publish_time":1667413422174,"dist-tags":{"backport":"7.0.28","latest":"8.0.4","prerelease":"8.0.0-pre.1"}}