{"id":15693708,"url":"https://github.com/doowb/question-helper","last_synced_at":"2025-05-08T04:54:08.946Z","repository":{"id":23107397,"uuid":"26461699","full_name":"doowb/question-helper","owner":"doowb","description":"Ask questions when running templates for Templates, Handlebars, or Lodash.","archived":false,"fork":false,"pushed_at":"2015-10-16T03:04:29.000Z","size":144,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-08T04:54:02.238Z","etag":null,"topics":[],"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/doowb.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-11-10T23:57:47.000Z","updated_at":"2021-04-12T22:06:41.000Z","dependencies_parsed_at":"2022-08-21T19:10:19.620Z","dependency_job_id":null,"html_url":"https://github.com/doowb/question-helper","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fquestion-helper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fquestion-helper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fquestion-helper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fquestion-helper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/doowb","download_url":"https://codeload.github.com/doowb/question-helper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253002851,"owners_count":21838640,"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-10-03T18:47:43.662Z","updated_at":"2025-05-08T04:54:08.909Z","avatar_url":"https://github.com/doowb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# question-helper [![NPM version](https://badge.fury.io/js/question-helper.svg)](http://badge.fury.io/js/question-helper)  [![Build Status](https://travis-ci.org/doowb/question-helper.svg)](https://travis-ci.org/doowb/question-helper) \n\n\u003e Helper used to ask questions and output the answer. Useful with Template, Handlebars, and Loadash.\n\nInspired by conversations with [Jon Schlinkert](https://github.com/jonschlinkert)\n\n## Install with [npm](npmjs.org)\n\n```bash\nnpm i question-helper --save\n```\n\n## Usage\n\n```js\nvar question = require('question-helper');\nvar context = {questions: {name: \"What's your name?\"}};\n\n// Prompt a user for a question and get an answer back.\nquestion.call({ctx: context}, \"name\", function (err, answer) {\n  if (err) return console.log('error', err);\n  console.log('Answer', answer);\n});\n```\n\n**Params**\n\n* `key` **{String}**: Either a key on a `questions` object on the context or a question to ask.    \n* `options` **{String}**: Additional options to pass.    \n* `next` **{Function}**: Callback function that will be passed an error and/or the results of asking the question.    \n\n\n### Template \n\nTo use with [template]:\n\n```bash\nnpm i template --save\n```\n\nThen add to your project.\n\n```js\nvar template = require('template');\n```\n\n**handebars**\n\nRegister [handlebars as an engine][engine-handlebars]:\n\n```js\ntemplate.engine('hbs', require('engine-handlebars'));\n\nvar question = require('question-helper');\nvar context = {questions: {name: \"What's your name?\"}};\n\ntemplate.page('author.hbs', \"Author: {{question 'name'}}\");\ntemplate.render('author.hbs', context, function (err, content) {\n  if (err) return console.log('error', err);\n  console.log(content);\n});\n```\n\n**Lo-Dash**\n\nRegister [Lo-Dash as an engine][engine-lodash]:\n\n```js\ntemplate.engine('html', require('engine-lodash'));\n\nvar context = {questions: {name: \"What's your name?\"}};\ntemplate.page('author.html', \"Author: \u003c%= question('name') %\u003e\");\n\ntemplate.render('author.html', context, function (err, content) {\n  if (err) return console.log('error', err);\n  console.log(content);\n});\n```\n\n## Running tests\nInstall dev dependencies.\n\n```bash\nnpm i -d \u0026\u0026 npm test\n```\n\n\n## Contributing\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/doowb/question-helper/issues)\n\n\n## Related\n* [template-helpers](https://github.com/jonschlinkert/template-helpers): Generic JavaScript helpers that can be used with any template engine. Handlebars, Lo-Dash, Underscore, or any engine that supports helper functions.\n* [handlebars-helpers](https://github.com/assemble/handlebars-helpers): 120+ Handlebars helpers in ~20 categories, for Assemble, YUI, Ghost or any Handlebars project. Includes helpers like {{i18}}, {{markdown}}, {{relative}}, {{extend}}, {{moment}}, and so on.\n* [template](https://github.com/jonschlinkert/template): Render templates from any engine. Make custom template types, use layouts on pages, partials or any custom template type, custom delimiters, helpers, middleware, routes, loaders, and lots more. Powers Assemble v0.6.0, Verb v0.3.0 and your application.\n* [engine-handlebars](https://github.com/jonschlinkert/engine-handlebars): Handlebars engine, consolidate.js style but with enhancements. This works with Assemble, express.js, engine-cache or any application that follows consolidate.js conventions.\n* [engine-lodash](https://github.com/jonschlinkert/engine-lodash): Lo-Dash engine, consolidate.js style but with enhancements. Works with Assemble, express.js, engine-cache or any application that follows consolidate.js conventions.\n\n## Author\n\n**Brian Woodward**\n \n+ [github/doowb](https://github.com/doowb)\n+ [twitter/doowb](http://twitter.com/doowb) \n\n## License\nCopyright (c) 2015 Brian Woodward  \nReleased under the MIT license\n\n***\n\n_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on March 05, 2015._\n\n[engine-handlebars]: https://github.com/jonschlinkert/engine-handlebars\n[engine-lodash]: https://github.com/jonschlinkert/engine-lodash\n[template]: https://github.com/jonschlinkert/template\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoowb%2Fquestion-helper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoowb%2Fquestion-helper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoowb%2Fquestion-helper/lists"}