aboutsummaryrefslogtreecommitdiff
path: root/src/modules/word
diff options
context:
space:
mode:
authorST-DDT <[email protected]>2023-04-28 15:17:34 +0200
committerGitHub <[email protected]>2023-04-28 13:17:34 +0000
commit971f36371bf924b334cb7766fd87afa7b484119a (patch)
tree1ad3b8ae43548e0a5ec2e6017e928ce39cfeda46 /src/modules/word
parent8395e6991cd00951d9e25ae489cb191c4c3957b6 (diff)
downloadfaker-971f36371bf924b334cb7766fd87afa7b484119a.tar.xz
faker-971f36371bf924b334cb7766fd87afa7b484119a.zip
fix(types): locale proxy (#2099)
Diffstat (limited to 'src/modules/word')
-rw-r--r--src/modules/word/filterWordListByLength.ts10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/modules/word/filterWordListByLength.ts b/src/modules/word/filterWordListByLength.ts
index 4651d497..e866bb9e 100644
--- a/src/modules/word/filterWordListByLength.ts
+++ b/src/modules/word/filterWordListByLength.ts
@@ -10,7 +10,7 @@ const STRATEGIES = {
throw new FakerError('No words found that match the given length.');
},
closest: (
- wordList: string[],
+ wordList: ReadonlyArray<string>,
length: { min: number; max: number }
): string[] => {
const wordsByLength = wordList.reduce((data, word) => {
@@ -30,15 +30,15 @@ const STRATEGIES = {
word.length === length.max + closestOffset
);
},
- shortest: (wordList: string[]): string[] => {
+ shortest: (wordList: ReadonlyArray<string>): string[] => {
const minLength = Math.min(...wordList.map((word) => word.length));
return wordList.filter((word) => word.length === minLength);
},
- longest: (wordList: string[]): string[] => {
+ longest: (wordList: ReadonlyArray<string>): string[] => {
const maxLength = Math.max(...wordList.map((word) => word.length));
return wordList.filter((word) => word.length === maxLength);
},
- 'any-length': (wordList: string[]): string[] => {
+ 'any-length': (wordList: ReadonlyArray<string>): string[] => {
return [...wordList];
},
} as const; /*
@@ -67,7 +67,7 @@ string, // Parameters<filterWordListByLength>[0]['strategy']
* - `any-length`: Returns a copy of the original word list.
*/
export function filterWordListByLength(options: {
- wordList: string[];
+ wordList: ReadonlyArray<string>;
length?: number | { min: number; max: number };
strategy?: 'fail' | 'closest' | 'shortest' | 'longest' | 'any-length';
}): string[] {