{"_id":"@aminzer/readline-dialogs","_rev":"1-7370058a36a8c92fefad52d008efbdf3","name":"@aminzer/readline-dialogs","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@aminzer/readline-dialogs","version":"1.0.0","description":"Dialog-like interactions with stdin/stdout or other readline interfaces","keywords":["dialogs","readline","stdin","stdout"],"repository":{"type":"git","url":"git+https://github.com/aminzer/readline-dialogs.git"},"license":"MIT","author":{"name":"aminzer"},"main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc --project tsconfig.build.json","build:watch":"npm run build -- --watch","husky:prepare":"husky install","lint":"eslint src/**/*.ts test/**/*.ts","lint:fix":"npm run lint -- --fix","prepare":"run-s husky:prepare build","test":"jest"},"devDependencies":{"@types/jest":"^27.5.2","@types/node":"^16.9.1","@typescript-eslint/eslint-plugin":"^4.31.1","@typescript-eslint/parser":"^4.31.1","eslint":"^7.32.0","eslint-config-airbnb-base":"^14.2.1","eslint-config-airbnb-typescript":"^14.0.0","eslint-plugin-import":"^2.24.2","eslint-plugin-jest":"^24.4.0","husky":"^7.0.2","jest":"^27.2.0","npm-run-all":"^4.1.5","ts-jest":"^27.0.5","typescript":"^4.4.3"},"engines":{"node":">=10.0.0"},"gitHead":"11cd7fb3f0f5cc6a5757ec214ffb4e58394f9669","bugs":{"url":"https://github.com/aminzer/readline-dialogs/issues"},"homepage":"https://github.com/aminzer/readline-dialogs#readme","_id":"@aminzer/readline-dialogs@1.0.0","_nodeVersion":"16.15.0","_npmVersion":"8.5.5","dist":{"integrity":"sha512-0YYOsr17LbV/mohCGKGF0sbORBRuU8CJDeU1eNrx83W9FfG2WSlU2SxO0aMg3WRiK+9rvqditlccKr9AJ5Ftkw==","shasum":"818108005f8b52df553ceaf0cd5a11b038cb9f8f","tarball":"https://registry.npmjs.org/@aminzer/readline-dialogs/-/readline-dialogs-1.0.0.tgz","fileCount":18,"unpackedSize":12837,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFrWlXJhQxaoDfNAJXZBXJGj5a43XdhHcrlVSUfjRHdtAiBL3DRd5OpxE7JsfeSmxefanA0kIWHzDEtT9eO4iPhqOA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjFu7MACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrlmA/9Hb2MZCRK1JpnvTyF7fkdloPJFjsCZk4Z0wscnYqU8AI9jTby\r\nYJHL/hNneESfvUdN63s2Q1qX0Gb8zH3zHAd2jVTZ2WyID8sW+M7XuHheoUS4\r\nZdE9PkHzKIq5ab9GgapSFxivzP4KKQOT4ZO6Homt3mUMIYbJ9RtLOvJyONz3\r\nuKnXZwvAQkAVZs50N6xXm49G1cVEQcdBYOslWH+vL03yPKbafRffSbWEwU0W\r\nnrBMQoeovZDxpFLW1d0xju51rk6PMWn/zvL4Zw+qtAU+TqWU+aIGUe4Od7ne\r\nVAXTXNcEsT98Y98xYbKUtYX5XEG0/i5qk4+YzLVNGXaEUZ5jGVwLDwEAQSIh\r\nZB4Kk16BDCZvoAX3elYQvneeSkw4rZylSMrpGi3ge1kC7fDKVTFZzbnf3Le0\r\nVPyZImT/PKsbE8asnIGD02ewKZ51I1PCgw3mcdr53CiPqOxYC7gaLQVq91KC\r\nhQpZsjqSAzVeH1Jj/ocOfE5USLLDWaVm9Rk4Z0JK9s2wLfgvWBXg2FZHwHkl\r\nyjyPv2sht4RVGo7KhSidFGHMSDgfYEfmkQpx7wDG+DbtGeNvNUr7DGPyWNTR\r\nKeTXbd71iaVNRVUWsY8kYLH9pOvjNINxkLvGtnVjq6eC64ffZDFXFpq43Vmk\r\nsFKCFCBwovVABhCQ7aggDqoM7kVlh04A4/E=\r\n=Izn3\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"aminzer","email":"minzer.alexey@gmail.com"},"directories":{},"maintainers":[{"name":"aminzer","email":"minzer.alexey@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/readline-dialogs_1.0.0_1662447307859_0.9882322736771838"},"_hasShrinkwrap":false},"1.0.2":{"name":"@aminzer/readline-dialogs","version":"1.0.2","description":"Dialog-like interactions with stdin/stdout or other readline interfaces","keywords":["dialogs","readline","stdin","stdout"],"repository":{"type":"git","url":"git+https://github.com/aminzer/readline-dialogs.git"},"license":"MIT","author":{"name":"aminzer"},"main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc --project tsconfig.build.json","build:watch":"npm run build -- --watch","husky:prepare":"husky install","lint":"eslint src/**/*.ts test/**/*.ts","lint:fix":"npm run lint -- --fix","prepare":"run-s husky:prepare build","test":"jest"},"devDependencies":{"@types/jest":"^27.5.2","@types/node":"^16.9.1","@typescript-eslint/eslint-plugin":"^4.31.1","@typescript-eslint/parser":"^4.31.1","eslint":"^7.32.0","eslint-config-airbnb-base":"^14.2.1","eslint-config-airbnb-typescript":"^14.0.0","eslint-plugin-import":"^2.24.2","eslint-plugin-jest":"^24.4.0","husky":"^7.0.2","jest":"^27.2.0","npm-run-all":"^4.1.5","ts-jest":"^27.0.5","typescript":"^4.4.3"},"engines":{"node":">=10.0.0"},"gitHead":"c25b6add0059f529d222e6a89115fea8e6f2ca4e","bugs":{"url":"https://github.com/aminzer/readline-dialogs/issues"},"homepage":"https://github.com/aminzer/readline-dialogs#readme","_id":"@aminzer/readline-dialogs@1.0.2","_nodeVersion":"16.15.0","_npmVersion":"8.5.5","dist":{"integrity":"sha512-IlIhdh47SlT9NmvFzt8kv2ixMJRNAY7aMoEmtJQJOZvVRFqyd9UtVFPWSWEGSjKJBSpW8roEaVP6M7xDfsMzdg==","shasum":"eed820f17246f67d850031c122f26dff26cc9b3f","tarball":"https://registry.npmjs.org/@aminzer/readline-dialogs/-/readline-dialogs-1.0.2.tgz","fileCount":18,"unpackedSize":13490,"signatures":[{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URE-----\r\n"},"_npmUser":{"name":"aminzer","email":"minzer.alexey@gmail.com"},"directories":{},"maintainers":[{"name":"aminzer","email":"minzer.alexey@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/readline-dialogs_1.0.2_1662499015771_0.8977643495820442"},"_hasShrinkwrap":false}},"time":{"created":"2022-09-06T06:55:07.776Z","1.0.0":"2022-09-06T06:55:08.013Z","modified":"2022-09-06T21:16:55.993Z","1.0.2":"2022-09-06T21:16:55.939Z"},"maintainers":[{"name":"aminzer","email":"minzer.alexey@gmail.com"}],"description":"Dialog-like interactions with stdin/stdout or other readline interfaces","homepage":"https://github.com/aminzer/readline-dialogs#readme","keywords":["dialogs","readline","stdin","stdout"],"repository":{"type":"git","url":"git+https://github.com/aminzer/readline-dialogs.git"},"author":{"name":"aminzer"},"bugs":{"url":"https://github.com/aminzer/readline-dialogs/issues"},"license":"MIT","readme":"### Overview\r\n\r\nDialog-like interactions with stdin/stdout or other [readline interfaces](https://nodejs.org/dist/latest/docs/api/readline.html#readline) for [NodeJS](https://nodejs.org).\r\n\r\n### Installation\r\n\r\n```\r\nnpm i @aminzer/readline-dialogs\r\n```\r\n\r\n### Usage example\r\n\r\n```javascript\r\nconst { prompt, confirm, alert } = require('@aminzer/readline-dialogs');\r\n\r\n(async () => {\r\n  const userName = await prompt('Enter your name:');\r\n\r\n  const isProcessingConfirmed = await confirm(`Do you want to process something, ${userName}?`);\r\n\r\n  if (!isProcessingConfirmed) {\r\n    return;\r\n  }\r\n\r\n  await alert('Press Enter to start processing');\r\n\r\n  console.log('...');\r\n  console.log('Processed');\r\n})();\r\n```\r\n\r\n![Usage example](https://github.com/aminzer/readline-dialogs/blob/media/usage-example.gif?raw=true)\r\n\r\n### API\r\n\r\n**prompt**\r\n\r\n##### Overview\r\n\r\n`prompt` is used to fetch user's answer from passed input stream (process.stdin by default).\r\n\r\n```javascript\r\nconst answer = await prompt('Enter your name:');\r\n// entering answer in process.stdin\r\nconsole.log(`Answer is: ${answer}`);\r\n```\r\n\r\n##### Parameters\r\n\r\n* `title` (`string`, required) - title of the prompt.\r\n* `opts` (`object`, optional) - additional options to pass:\r\n    * `possibleAnswers` (`string[]`, `undefined` by default) - answers that can be accepted. If user enters something not included into this arg - the prompt will be shown again.\r\n    * `input` (`Readable`, `process.stdin` by default) - input stream for [readline interface](https://nodejs.org/dist/latest/docs/api/readline.html#readline).\r\n    * `output` (`Writable`, `process.stdout` by default) - output stream for [readline interface](https://nodejs.org/dist/latest/docs/api/readline.html#readline).\r\n\r\n##### Return value\r\n\r\n`Promise` that becomes fulfilled with user's answer.\r\n\r\n**confirm**\r\n\r\n##### Overview\r\n\r\n`confirm` is used to check user's confirmation from passed input stream (process.stdin by default).\r\n\r\n```javascript\r\nconst answer = await confirm('Are you sure you want to continue:');\r\n// entering answer in process.stdin\r\nconsole.log(answer ? 'Processing...' : 'Terminating...');\r\n```\r\n\r\n##### Parameters\r\n\r\n* `title` (`string`, required) - title of the confirm.\r\n* `opts` (`object`, optional) - additional options to pass:\r\n    * `input` (`Readable`, `process.stdin` by default) - input stream for [readline interface](https://nodejs.org/dist/latest/docs/api/readline.html#readline).\r\n    * `output` (`Writable`, `process.stdout` by default) - output stream for [readline interface](https://nodejs.org/dist/latest/docs/api/readline.html#readline).\r\n\r\n##### Return value\r\n\r\n`Promise` that becomes fulfilled with boolean based on user's answer.\r\n\r\n**alert**\r\n\r\n##### Overview\r\n\r\n`alert` is used to wait for user's entering new-line symbol from passed input stream (process.stdin by default).\r\n\r\n```javascript\r\nawait alert('Press enter to continue:');\r\n// entering new-line symbol in process.stdin\r\n```\r\n\r\n##### Parameters\r\n\r\n* `title` (`string`, required) - title of the alert.\r\n* `opts` (`object`, optional) - additional options to pass:\r\n    * `input` (`Readable`, `process.stdin` by default) - input stream for [readline interface](https://nodejs.org/dist/latest/docs/api/readline.html#readline).\r\n    * `output` (`Writable`, `process.stdout` by default) - output stream for [readline interface](https://nodejs.org/dist/latest/docs/api/readline.html#readline).\r\n\r\n##### Return value\r\n\r\n`Promise` that becomes fulfilled after user enters new-line char.\r\n","readmeFilename":"README.md"}