Skip to content

Commit

Permalink
Add comments to pick field
Browse files Browse the repository at this point in the history
  • Loading branch information
Chacaponquin committed Apr 24, 2024
1 parent 697a37f commit 2c808ef
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: 🖥️ Workflow Dev
on:
push:
branches: [chaca-dev]
pull_request:
branches: [chaca-dev]
jobs:
release:
name: 🖥️ Dev
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "chaca",
"version": "1.9.0",
"version": "1.9.1",
"description": "Create and export mock data with your rules",
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.mjs",
Expand Down
13 changes: 13 additions & 0 deletions src/Chaca.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,19 @@ export class Chaca {
return new ProbabilityField(options);
}

/**
* Select a number of elements in an array so that all selected values are not repeated
*
* @param props.values array of values
* @param props.count number of items to select
*
* @example
* chaca.pick({
* values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
* count: 3
* })
* // [2, 6, 10] or [4, 5, 1] or [1, 9, 8] or ...
*/
pick<V = any>(props: PickFieldProps<V>) {
return new PickField(props);
}
Expand Down

0 comments on commit 2c808ef

Please sign in to comment.