{"id":18576089,"url":"https://github.com/thiagodp/one-wise","last_synced_at":"2025-06-15T19:36:04.286Z","repository":{"id":57314585,"uuid":"126918139","full_name":"thiagodp/one-wise","owner":"thiagodp","description":"One-wise combinatorial testing generator for JavaScript","archived":false,"fork":false,"pushed_at":"2020-07-05T00:55:51.000Z","size":191,"stargazers_count":4,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T10:51:57.281Z","etag":null,"topics":["combinatorial-testing","javascript","n-way","n-wise","one-wise","pair-wise","pairwise","seedrandom","shuffle","testing"],"latest_commit_sha":null,"homepage":"","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/thiagodp.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":"2018-03-27T02:38:47.000Z","updated_at":"2022-10-17T17:19:20.000Z","dependencies_parsed_at":"2022-09-20T23:20:57.974Z","dependency_job_id":null,"html_url":"https://github.com/thiagodp/one-wise","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thiagodp%2Fone-wise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thiagodp%2Fone-wise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thiagodp%2Fone-wise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thiagodp%2Fone-wise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thiagodp","download_url":"https://codeload.github.com/thiagodp/one-wise/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248185318,"owners_count":21061494,"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":["combinatorial-testing","javascript","n-way","n-wise","one-wise","pair-wise","pairwise","seedrandom","shuffle","testing"],"created_at":"2024-11-06T23:23:33.324Z","updated_at":"2025-04-10T08:31:02.073Z","avatar_url":"https://github.com/thiagodp.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# one-wise\n\n\u003e One-wise combinatorial testing generator\n\n[![npm version](https://badge.fury.io/js/one-wise.svg)](https://badge.fury.io/js/one-wise)\n[![Build Status](https://travis-ci.org/thiagodp/one-wise.svg?branch=master)](https://travis-ci.org/thiagodp/one-wise)\n[![Coverage Status](https://coveralls.io/repos/github/thiagodp/one-wise/badge.svg)](https://coveralls.io/github/thiagodp/one-wise)\n\nA **1-wise** (*a.k.a.* **1-way**) testing generator guarantees that at least one value of each group appears in the generated tests. The produced array has exactly the length of the largest input array.\n\n## About\n\nThis is a fast and simple implementation of a [1-wise testing](https://en.wikipedia.org/wiki/All-pairs_testing) generator. No external dependencies. Uses [semantic versioning](https://semver.org/).\n\n## Install\n\n```bash\nnpm install one-wise\n```\n\n## Example\n\n```javascript\noneWise( {\n    \"foo\": [ \"x\", \"y\" ],\n    \"bar\": [ \"a\", \"b\", \"c\", \"d\" ],\n    \"baz\": [ \"f\", \"g\" ]\n} )\n```\nwill return\n```json\n[\n   { \"foo\": \"x\", \"bar\": \"a\", \"baz\": \"f\" },\n   { \"foo\": \"y\", \"bar\": \"b\", \"baz\": \"g\" },\n   { \"foo\": \"x\", \"bar\": \"c\", \"baz\": \"f\" },\n   { \"foo\": \"y\", \"bar\": \"d\", \"baz\": \"g\" }\n]\n```\n**Note**: the values of `foo` and `bar` in the last two lines are picked *randomly*.\n\nIt uses JavaScript's `Math.random()`, but a *predictive* pseudo-random generator function (*e.g.,* [seedrandom](https://github.com/davidbau/seedrandom)) can be passed as a second argument. Such function must work like `Math.random()` and return a number \u003e= 0 and \u003c 1.\n```javascript\noneWise( /* your object */, myPseudoRandomNumberGenerator );\n```\n\n## Declaration\n\n### Browser\n\n```html\n\u003cscript crossorigin src=\"https://unpkg.com/one-wise\" \u003e\u003c/script\u003e\n\u003cscript\u003e\nconsole.log(\n\toneWise( {\n\t\t\"foo\": [ \"x\", \"y\" ],\n\t\t\"bar\": [ 1, 2, 3 ]\n\t} )\n);\n\u003c/script\u003e\n```\n\n**Option 2**: Using unpkg and ESM:\n```html\n\u003cscript crossorigin src=\"https://unpkg.com/one-wise/index.esm.js\" \u003e\u003c/script\u003e\n\u003cscript\u003e\nimport oneWise from 'one-wise';\n\u003c/script\u003e\n```\n\n### CommonJS (NodeJS)\n\n```javascript\nconst oneWise = require('one-wise');\n```\n\n### ESM/TypeScript\n\n```javascript\nimport oneWise from 'one-wise';\n```\n\n## API\n\n### oneWise( obj [, prngFunc ] )\n\n- `obj` {object} - The given object.\n- `prngFunc` {function} - Pseudo-random number generator function used to pick array elements to repeat. Defaults to `Math.random`.\n\n## See also\n\n- [shuffle-obj-arrays](https://github.com/thiagodp/shuffle-obj-arrays) - Shuffles the arrays of the given object. A custom PRNG can be used.\n- [seedrandom](https://github.com/davidbau/seedrandom) - Predictive PRNG\n\n## License\n\n[MIT](LICENSE) © [Thiago Delgado Pinto](https://github.com/thiagodp)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthiagodp%2Fone-wise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthiagodp%2Fone-wise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthiagodp%2Fone-wise/lists"}