{"_id":"extract-path","_rev":"3-0f9790ce1b0ce4efd4c0843367153b94","name":"extract-path","dist-tags":{"latest":"2.0.0"},"versions":{"1.0.0":{"name":"extract-path","version":"1.0.0","description":"Extract a valid fs path from a string","main":"index.js","files":["index.js"],"scripts":{"pretest":"eslint index.js","test":"jest --coverage && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"},"repository":{"type":"git","url":"git+https://github.com/ruyadorno/extract-path.git"},"keywords":["path","parse","string","pick","PathPicker","extract","retrieve","filename","file","fs"],"author":{"name":"Ruy Adorno","url":"ruyadorno.com"},"license":"MIT","bugs":{"url":"https://github.com/ruyadorno/extract-path/issues"},"homepage":"https://github.com/ruyadorno/extract-path#readme","dependencies":{"untildify":"^3.0.2"},"devDependencies":{"coveralls":"^3.0.0","eslint":"^4.18.2","eslint-config-prettier":"^2.9.0","jest":"^22.4.2","prettier":"^1.11.1"},"gitHead":"f8b0000aa8902b6d405ecddefa9b12132dfa0ded","_id":"extract-path@1.0.0","_npmVersion":"5.7.1","_nodeVersion":"9.6.1","_npmUser":{"name":"ruyadorno","email":"ruyadorno@hotmail.com"},"dist":{"integrity":"sha512-FN9kpD3x8idqE8ILIJ/HvYR/jKlULE84ozBQQ4LH17l/kdpFH8Roko5Yx9uMT/94YTtAQ++1CtlZSL4a/XE1LA==","shasum":"093df22f62af331576efbe7a7604ef975e6c5c62","tarball":"https://registry.npmjs.org/extract-path/-/extract-path-1.0.0.tgz","fileCount":4,"unpackedSize":9953,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGj2DLJlr/WSgXOCwSddiydmPVjHiLDDaS9ZUSnBH0zEAiBIXueTj01wePr7ATXcDKAZH/eJih+q8/iu70cliROjtQ=="}]},"maintainers":[{"name":"ruyadorno","email":"ruyadorno@hotmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/extract-path_1.0.0_1521602398456_0.00003171983496197406"},"_hasShrinkwrap":false},"2.0.0":{"name":"extract-path","version":"2.0.0","description":"Extract a valid fs path from a string","main":"index.js","engines":{"node":">=10"},"scripts":{"pretest":"eslint index.js","test":"jest --coverage"},"repository":{"type":"git","url":"git+https://github.com/ruyadorno/extract-path.git"},"keywords":["path","parse","string","pick","PathPicker","extract","retrieve","filename","file","fs"],"author":{"name":"Ruy Adorno","url":"ruyadorno.com"},"license":"MIT","bugs":{"url":"https://github.com/ruyadorno/extract-path/issues"},"homepage":"https://github.com/ruyadorno/extract-path#readme","dependencies":{"untildify":"^4.0.0"},"devDependencies":{"coveralls":"^3.0.7","eslint":"^6.5.1","eslint-config-prettier":"^6.4.0","jest":"^24.9.0","prettier":"^1.18.2"},"gitHead":"36fc0680e76af368df718e08d992c91b4bc9d37f","_id":"extract-path@2.0.0","_nodeVersion":"13.0.0","_npmVersion":"6.12.0","_npmUser":{"name":"ruyadorno","email":"ruyadorno@hotmail.com"},"dist":{"integrity":"sha512-EQrwJL8rfZti2iCL7NvXrK3AN6jh7SjgCfDfQyCeuL6nEzsbDEVfxMQzhZeTPjStLcoWzLbyddulJ01YaZjk4g==","shasum":"17b344d81d85d30a3e6c4c89ef4da9db883cf65f","tarball":"https://registry.npmjs.org/extract-path/-/extract-path-2.0.0.tgz","fileCount":4,"unpackedSize":9919,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdr9MFCRA9TVsSAnZWagAAPgMP/A1och/Xw5xARm7EfXB8\nzfNmUEPOe6mBnKV7XVtpQMia30PQGirJfUz2ZpUbDHTYX2MqUS17pv74Qc/4\ninxIH0xfC3BnenodkauralhoRi/OPcT5SXrXDZuhmOwaHGqbZZhOK3iTsHLF\nfq56z45tYcYp9Vw42ymFz3E1WtwCFOqOEKSd7IL/jFgyyyxVCyaQTsSMtqsa\ndVrn3mZijJvkon3VkconV+pDaIQHDNOir/Zyl/Jtolpo4b8q7zqQeNZjJZk8\nEtp/mdtuSXmiPpwT8nYnIdBfengJacSAVLy5cav0lf83bAaYDnQ3izjbnDx4\niXWwrVdx56Aesw0Z3+rSl3i8MED2UkdP7qq5bb+N6radhUohdtdVc/2ItisD\nowK40ucchcXkFMDbMwKCAzaFoCAwlLBr+2MRWnNO+3ZdbDNFutLwJOAYOGhV\nXSGAxKPkRGGsBfjLCeUBI8JXN7IUFCn9wZjIsjcfIF9QHGUpERRhDPwCtwFf\nGoaFuzxRO7W0G5FwXfrjhszqL7aXPsr9AL6f3hs1uRJPRnn2TPjrHBmBKRg+\nLnZUbSizdOnk823JcABE3l2CorK7+0BN8Ve/USxQiMGAq4mBoMuOAZ2bIl9Z\nWngXYvGCaUX+Wg3bDPiUmmm4o7xoZGYz4Mxj9gVkDu5mTRJdpOOZxp9CXItn\nGDi0\r\n=jlsh\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB7+sHCgz68cFZWSH01W+XZaFqmnBlCaK2QcQUMVFgH2AiBjLykpEPDTseX9ZkoDtp2DFpE2XdxfHaSYQP+aXX5CZQ=="}]},"maintainers":[{"name":"ruyadorno","email":"ruyadorno@hotmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/extract-path_2.0.0_1571803908814_0.07131374872323315"},"_hasShrinkwrap":false}},"time":{"created":"2018-03-21T03:19:58.455Z","1.0.0":"2018-03-21T03:19:58.509Z","modified":"2022-05-02T01:15:07.820Z","2.0.0":"2019-10-23T04:11:48.958Z"},"maintainers":[{"name":"ruyadorno","email":"ruyadorno@hotmail.com"}],"description":"Extract a valid fs path from a string","homepage":"https://github.com/ruyadorno/extract-path#readme","keywords":["path","parse","string","pick","PathPicker","extract","retrieve","filename","file","fs"],"repository":{"type":"git","url":"git+https://github.com/ruyadorno/extract-path.git"},"author":{"name":"Ruy Adorno","url":"ruyadorno.com"},"bugs":{"url":"https://github.com/ruyadorno/extract-path/issues"},"license":"MIT","readme":"# extract-path\n\n[![NPM version](https://badge.fury.io/js/extract-path.svg)](https://npmjs.org/package/extract-path)\n[![Build Status](https://travis-ci.org/ruyadorno/extract-path.svg?branch=master)](https://travis-ci.org/ruyadorno/extract-path)\n[![coveralls-image](https://img.shields.io/coveralls/ruyadorno/extract-path/master.svg)](https://coveralls.io/r/ruyadorno/extract-path)\n[![MIT license](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://raw.githubusercontent.com/ruyadorno/extract-path/master/LICENSE)\n\n> Extract a valid fs path from a string.\n\n**extract-path** is a node library that will attempt to find a possible valid file system path for a given input, validate its existance within the file system and return the matching value upon confirmation.\n\n## Table of Contents\n\n- [About](#about)\n- [Install](#install)\n- [Usage](#usage)\n- [API](#api)\n- [Credit](#credit)\n- [Contribute](#contribute)\n- [License](#license)\n\n## About\n\nThe main use case for the lib is to be able to take valid path values out of verbose outputs such as those generated by a `git status` command:\n\n- `    modified:   src/Router.js` resolves to `src/Router.js`\n- `?? src/utils/__tests__/file.test.js` resolves to `src/utils/__tests__/file.test.js`\n\nThis library was primarily put together for usage in [iPipeTo](https://github.com/ruyadorno/ipt) which allows for its users to easily extract a path out of a random input value. Some extra effort was made to ensure **extract-path** works well as a separated lib in the hope that it can be useful for different use cases out there. Feel free to refer to [iPipeTo source code](https://github.com/ruyadorno/ipt/blob/master/src/index.js) as a implementation example if ever needed.\n\n## Install\n\n```sh\nnpm install extract-path\n```\n\n## Usage\n\n```js\n// example.js\nconst extractPath = require('extract-path');\n\nextractPath('Selected file: ~/Documents/foo.js ...')\n\t.then(path => {\n\t\tconsole.log(path);\n\t\t// ~/Documents/foo.js\n\t});\n```\n\n## API\n\nThe API only exposes a single function, that receives a `string` and returns a `Promise` which resolves with a single, valid `string` value or `undefined` if there was no possible match.\n\n### extractPath(str, opts)\n\n- **str** `string` value to be parsed in order to extract a valid fs path\n- **opts** \\[optional\\] `object` containing the following:\n  - **validateFileExists** `boolean` wether the module should validate the file exists, defaults to `true`\n  - **resolveWithFallback** `boolean` uses a fallback system that matches the entire input if a path couldn't be infered from the input, defaults to `true`\n\n## Credit\n\n**extract-path** is heavily inspired by the work done in [PathPicker](https://github.com/facebook/PathPicker) parsing algorithm and regular expressions.\n\n## Related\n\n[iPipeTo](https://github.com/ruyadorno/ipt) - Interactive Pipe To: The missing cli interactive workflow\n\n## Contribute\n\nPlease do! This is an open source project. If you have a bug or want to discuss something, [open an issue](https://github.com/ruyadorno/extract-path/issues/new).\n\n## License\n\n[MIT](LICENSE) © 2018 [Ruy Adorno](http://ruyadorno.com)\n\n","readmeFilename":"README.md"}