{"id":20806306,"url":"https://github.com/nodesource/function-scout","last_synced_at":"2025-05-11T17:31:43.431Z","repository":{"id":57242982,"uuid":"81586229","full_name":"nodesource/function-scout","owner":"nodesource","description":"Scouts all functions of a given object and provides data about their origin.","archived":true,"fork":false,"pushed_at":"2017-10-26T15:41:15.000Z","size":1187,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-28T15:15:39.636Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://github.com/thlorenz/function-scout","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/nodesource.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":"2017-02-10T16:54:15.000Z","updated_at":"2025-01-30T21:18:24.000Z","dependencies_parsed_at":"2022-09-15T01:33:53.817Z","dependency_job_id":null,"html_url":"https://github.com/nodesource/function-scout","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodesource%2Ffunction-scout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodesource%2Ffunction-scout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodesource%2Ffunction-scout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodesource%2Ffunction-scout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nodesource","download_url":"https://codeload.github.com/nodesource/function-scout/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253256463,"owners_count":21879269,"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-17T19:19:13.176Z","updated_at":"2025-05-11T17:31:43.191Z","avatar_url":"https://github.com/nodesource.png","language":"JavaScript","readme":"# function-scout [![build status](https://secure.travis-ci.org/nodesource/function-scout.png)](http://travis-ci.org/nodesource/function-scout)\n\nScouts all functions of a given object and provides data about their origin.\n\n```js\n    function inspect(obj, depth) {\n      console.error(require('util').inspect(obj, false, depth || 5, true))\n    }\n\n    const path = require('path')\n    const scout = require('function-scout')\n\n    const res = scout(path.basename, { mutate: true })\n    inspect(res)\n```\n\n```js\n{ scouted:\n  FunctionOrigin {\n    file: 'path.js',\n    line: 1354,\n    column: 29,\n    inferredName: '',\n    name: 'basename' },\n  functions:\n  [ { path: [],\n      key: undefined,\n      level: 0,\n      info:\n        FunctionOrigin {\n          file: 'path.js',\n          line: 1354,\n          column: 29,\n          inferredName: '',\n          name: 'basename' } } ] }\n```\n\nAlso see the full [`fs.createReadStream` example](examples/readStream.js)\n\n## Installation\n\n    npm install function-scout\n\n## [API](https://nodesource.github.io/function-scout)\n\n\u003c!-- Generated by documentation.js. Update this documentation by updating the source code. --\u003e\n\n### functionScout\n\nScouts all functions in the provided object by traversing it.\n\nIt returns an array of all functions found as `functions` and\nthe cloned object with all functions replaced with their information\nas `scouted`\n\nA `functions` value looks like this:\n\n     { path: [ '_events', 'end', '1' ],\n       key: '1',\n       level: 3,\n       info:\n       FunctionOrigin {\n         file: '/Volumes/d/dev/js/async-hooks/function-scout/examples/readStream.js',\n         line: 10,\n         column: 14,\n         inferredName: '',\n         name: 'onend' } }\n\nThe `level, path` and `key` provide information about where in the object each\nfunction was found.\n\nThe `scouted` functions look the same except they don't have any `level, path, key`\ninformation since they are still attached to the object.\nThe `scouted` object only is returned if `mutate=true` and has the resolved functions\nattached to the paths of the object at which they were originally found.\nBy default `mutate=false` and thus only `functions` are returned.\n\n**Parameters**\n\n-   `object` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** the object which functions to scout\n-   `$0` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** configure how functions are scouted\n    -   `$0.mutate` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** if `true` the `object` is cloned and then\n        the are functions replaced with the scouted versions on the returned\n        `scouted` object. (optional, default `false`)\n    -   `$0.referenceFunction` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** if `true` a reference to the function is\n        included with each of the function infos. Make sure to not hold on to it as it would\n        prevent the function and anything it closes over to be garbage collected (optional, default `false`)\n\nReturns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** with properties `scouted` (if `mutate=true`) and\n`functions` explained above\n\n## License\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodesource%2Ffunction-scout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnodesource%2Ffunction-scout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodesource%2Ffunction-scout/lists"}