{"id":20204569,"url":"https://github.com/wilsonsilva/yn","last_synced_at":"2026-04-20T19:04:39.162Z","repository":{"id":56899134,"uuid":"225179621","full_name":"wilsonsilva/yn","owner":"wilsonsilva","description":"Parse yes/no like values","archived":false,"fork":false,"pushed_at":"2019-12-01T21:56:54.000Z","size":293,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-21T12:23:23.253Z","etag":null,"topics":["cli","command-line","npm","ruby","sindresorhus","yes-no"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/wilsonsilva.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-01T15:00:50.000Z","updated_at":"2023-02-16T21:53:56.000Z","dependencies_parsed_at":"2022-08-21T01:50:28.341Z","dependency_job_id":null,"html_url":"https://github.com/wilsonsilva/yn","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/wilsonsilva/yn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilsonsilva%2Fyn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilsonsilva%2Fyn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilsonsilva%2Fyn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilsonsilva%2Fyn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wilsonsilva","download_url":"https://codeload.github.com/wilsonsilva/yn/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilsonsilva%2Fyn/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32061255,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T11:35:06.609Z","status":"ssl_error","status_checked_at":"2026-04-20T11:34:48.899Z","response_time":94,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["cli","command-line","npm","ruby","sindresorhus","yes-no"],"created_at":"2024-11-14T05:13:56.399Z","updated_at":"2026-04-20T19:04:39.145Z","avatar_url":"https://github.com/wilsonsilva.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Yn\n\n[![Gem Version](https://badge.fury.io/rb/yn.svg)](https://badge.fury.io/rb/yn)\n[![Build Status](https://travis-ci.org/wilsonsilva/yn.svg?branch=master)](https://travis-ci.org/wilsonsilva/yn)\n[![Maintainability](https://api.codeclimate.com/v1/badges/96e1447d3ad45f1ca681/maintainability)](https://codeclimate.com/github/wilsonsilva/yn/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/96e1447d3ad45f1ca681/test_coverage)](https://codeclimate.com/github/wilsonsilva/yn/test_coverage)\n[![Security](https://hakiri.io/github/wilsonsilva/yn/master.svg)](https://hakiri.io/github/wilsonsilva/yn/master)\n[![Inline docs](http://inch-ci.org/github/wilsonsilva/yn.svg?branch=master)](http://inch-ci.org/github/wilsonsilva/yn)\n\n\n\u003e Parse yes/no like values\n\nUseful for validating answers of a CLI prompt.\n\n---\n\nThe following case-insensitive values are recognized:\n\n```ruby\n'y', 'yes', 'true', true, '1', 1, 'n', 'no', 'false', false, '0', 0, 'on', 'off'\n```\n\n*Enable lenient mode to gracefully handle typos.*\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'yn'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install yn\n\n## Usage\n\n```ruby\nrequire 'yn'\n\nYn.parse('y')\n# =\u003e true\n\nYn.parse('NO')\n# =\u003e false\n\nYn.parse(true)\n# =\u003e true\n\nYn.parse('abomasum')\n# =\u003e nil\n\nYn.parse('abomasum', default: false)\n# =\u003e false\n\nYn.parse('mo', lenient: true)\n# =\u003e false\n```\n\nUnrecognized values return `nil`.\n\n## API\n\n### Yn.parse(input, options?)\n\n#### input\n\nType: `unknown`\n\nValue that should be converted.\n\n#### options\n\nType: `hash`\n\n##### lenient\n\nType: `boolean`\\\nDefault: `false`\n\nUse a key distance-based score to leniently accept typos of `yes` and `no`.\n\n##### default\n\nType: `boolean`\\\nDefault: `nil`\n\nDefault value if no match was found.\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies, configure git hooks and create support files.\n\nYou can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nThe health and maintainability of the codebase is ensured through a set of\nRake tasks to test, lint and audit the gem for security vulnerabilities and documentation:\n\n```\nrake bundle:audit          # Checks for vulnerable versions of gems \nrake qa                    # Test, lint and perform security and documentation audits\nrake rubocop               # Lint the codebase with RuboCop\nrake rubocop:auto_correct  # Auto-correct RuboCop offenses\nrake spec                  # Run RSpec code examples\nrake verify_measurements   # Verify that yardstick coverage is at least 100%\nrake yard                  # Generate YARD Documentation\nrake yard:junk             # Check the junk in your YARD Documentation\nrake yardstick_measure     # Measure docs in lib/**/*.rb with yardstick\n```\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/wilsonsilva/yn.\nThis project is intended to be a safe, welcoming space for collaboration, and contributors are expected to\nadhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Credits\n\nThis is a port of [Sindre Sorhus](https://github.com/sindresorhus) JavaScript's [yn](https://github.com/sindresorhus/yn).\nI'm a big fan of his work!\n\n## Code of Conduct\n\nEveryone interacting in the Yn project’s codebases, issue trackers, chat rooms and mailing lists\nis expected to follow the [code of conduct](https://github.com/wilsonsilva/yn/blob/master/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilsonsilva%2Fyn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwilsonsilva%2Fyn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilsonsilva%2Fyn/lists"}