-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3fc08a3
commit dd579c6
Showing
5 changed files
with
69 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './notes'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const DEFAULT_NUMBER_OF_NOTE = 7; | ||
export const NOTES_LIST_MAX = 7; | ||
export const NOTES_LIST_MIN = 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
import { Note, notes } from "../config"; | ||
import { NOTES_LIST_MAX, NOTES_LIST_MIN } from "../config/constants"; | ||
import { shuffle } from "../utils/shuffle"; | ||
|
||
export const getListOfRandomNotes = (): Note[] => { | ||
export const getListOfRandomNotes = (count: number): Note[] => { | ||
const randomNotes = shuffle(notes); | ||
|
||
return randomNotes.slice(undefined, 7); | ||
return randomNotes.slice(undefined, count); | ||
}; | ||
|
||
export const isValidCountList = (count: number): boolean => { | ||
return count >= NOTES_LIST_MIN && count <= NOTES_LIST_MAX | ||
} |