{"id":19545789,"url":"https://github.com/alex-ray/qna","last_synced_at":"2025-10-08T07:59:17.930Z","repository":{"id":33650731,"uuid":"37303182","full_name":"Alex-ray/qna","owner":"Alex-ray","description":"A simple library for interactive questions and answers.","archived":false,"fork":false,"pushed_at":"2017-01-04T13:00:51.000Z","size":2190,"stargazers_count":13,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-09T13:49:40.900Z","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/Alex-ray.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-12T05:09:19.000Z","updated_at":"2024-10-15T02:26:50.000Z","dependencies_parsed_at":"2022-08-17T19:05:45.512Z","dependency_job_id":null,"html_url":"https://github.com/Alex-ray/qna","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/Alex-ray/qna","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alex-ray%2Fqna","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alex-ray%2Fqna/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alex-ray%2Fqna/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alex-ray%2Fqna/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Alex-ray","download_url":"https://codeload.github.com/Alex-ray/qna/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alex-ray%2Fqna/sbom","scorecard":{"id":10778,"data":{"date":"2025-08-11","repo":{"name":"github.com/Alex-ray/qna","commit":"a18a774f35c5baf86b68fca37d3858754009950e"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: MIT License: LICENSE.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-14T14:29:36.240Z","repository_id":33650731,"created_at":"2025-08-14T14:29:36.240Z","updated_at":"2025-08-14T14:29:36.240Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278909714,"owners_count":26066887,"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","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-11T03:41:12.414Z","updated_at":"2025-10-08T07:59:17.889Z","avatar_url":"https://github.com/Alex-ray.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# qna.js [![Build Status](https://img.shields.io/travis/Alex-ray/qna.svg?branch=master\u0026style=flat)](https://travis-ci.org/Alex-ray/qna) [![Coverage Status](https://img.shields.io/coveralls/Alex-ray/qna.svg?style=flat)](https://coveralls.io/r/Alex-ray/qna)\n\n\u003e Chat like questions and answers\n\n## Usage\n\n#### [Editable Example](http://jsfiddle.net/57xon9ov/14/)\n```html\n\u003cbody\u003e\n  \u003cp class=\"question\"\u003e\n      \u003cspan class=\"snippet\"\u003e\u003c/span\u003e\n      \u003cspan class=\"snippet\"\u003e\u003c/span\u003e\n  \u003c/p\u003e\n\n\t\u003cform id=\"question-form\" name=\"question\"\u003e\n\t\t\t\u003cinput name=\"name\" type=\"text\" placeholder=\"Your Name\"\u003e\n\t\u003c/form\u003e\n\n  \u003cp class=\"answer\"\u003e\n      \u003cspan class=\"answer-snippet\"\u003e\u003c/span\u003e\n      \u003cspan class=\"answer-snippet\"\u003e\u003c/span\u003e\n  \u003c/p\u003e\n\n\t\u003cscript src=\"dist/qna.min.js\"\u003e\u003c/script\u003e\n\t\u003cscript\u003e\n\n\tdocument.addEventListener('DOMContentLoaded', function() {\n\n\t\tvar questionText = [\n\t    {str: 'Hello, '},\n      {str: 'What\\'s your name?', pauseDelay: 50}\n    ];\n\n    var defaultAnswerText = [\n    \t{str: 'It\\'s, great to meet you'}\n    ];\n\n\t  var answerOpts   = { responder: answerResponder };\n\t  var questionOpts = { form: '#question-form' };\n\n\t  var answer   = new qna('.answer .snippet', defaultAnswerText, answerOpts);\n\t\tvar question = new qna('.question .snippet', questionText, questionOpts);\n\n\t\tquestion.bindAnswer(answer) ;\n\t\tquestion.respond( );\n\n\t\tfunction answerResponder ( event, form ) {\n\t\t\tevent.preventDefault();\n\n\t\t\tvar input = form.querySelector('input');\n\t\t\tvar name = input.value.trim();\n\n\t\t\tinput.blur();\n\n\t\t\treturn [\n\t\t\t\t{str: 'Hello, '+name},\n\t\t\t\t{str: 'It\\'s, great to meet you'}\n\t\t\t];\n\t\t}\n\t});\n\n\t\u003c/script\u003e\n\u003c/body\u003e\n```\n\n\n## Api\n\nIn the browser, `qna` is a global variable. In Node, do:\n\n```js\nvar qna = require('qna');\n```\n\n#### var q = new qna(nodeSelection, snippets [, opts]);\n\nThis will initialize a qna instance on the documents `nodeSelection` and corresponding `snippets` with the given options.\n\n- `nodeSelection`    \u0026mdash; A DOM Node List or a query selector string (passed into `document.querySelectorAll()`).\n- `snippets`         \u0026mdash; An ordered Array of `snippetObjects`.\n\t- `snippetObject`   \u0026mdash; An Object literal with the following properties\n\t\t- `str`          \u0026mdash; A String (required)\n\t\t- `pauseDelay`   \u0026mdash; A Number representing the delay before typing in milliseconds (optional, default 750)\n\t\t- `typeSpeed`    \u0026mdash; A Number representing the typing speed in milliseconds (optional, default 50)\n- `opts`             \u0026mdash;\n\nKey | Description | Value\n:--|:--|:--\n`responder` | A function for generating responses to form submissions | A function that returns a `snippetObject` Array\n`form` | The form element to listen for a submit event. | A DOM Element or a selector String\n`answer` | The answer to the question | An instance on qna\n\n#### q.respond([callback, args])\n\nType the `snippets` to the corresponding `nodeSelection` list defined at initialization with an optional callback that will be called after all the snippets have been typed to the screen.\n\nIf a responder was specified at initialization the additional arguments will be passed through to the responder function. If the responder returns a `snippetObject` it will use those `snippetObjects` to type to the corresponding `nodeSelection`\n\n#### q.bindAnswer(a, [callback])\n\n`a` is a instance of qna.\n\n`callback` is a function that will be called after the questions form has been submitted.\n\nAssign an answer and optional callback to a question.\n\nThe answers `a.respond` method will be triggered when the questions form is submitted with that events parameters (formEvent, formEl).\n\n## Installation\n\nInstall via [npm](https://npmjs.com):\n\n```\n$ npm i --save qna\n```\n\nInstall via [bower](http://bower.io):\n\n```\n$ bower i --save alex-ray/qna\n```\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falex-ray%2Fqna","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falex-ray%2Fqna","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falex-ray%2Fqna/lists"}