This repository has been archived by the owner on Oct 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added a unique identifier to the quote within the timestamp met…
…adata … (#281) * Added a unique identifier to the quote within the timestamp metadata field * Added unit test for affiliate data generation, other nits * prettier 🤦
- Loading branch information
1 parent
56f7a90
commit d992563
Showing
5 changed files
with
61 additions
and
3 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,19 @@ | ||
export const numberUtils = { | ||
// from MDN https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random | ||
randomNumberInclusive: (minimumSpecified: number, maximumSpecified: number): number => { | ||
const min = Math.ceil(minimumSpecified); | ||
const max = Math.floor(maximumSpecified); | ||
return Math.floor(Math.random() * (max - min + 1)) + min; // The maximum is inclusive and the minimum is inclusive | ||
}, | ||
// creates a random hex number of desired length by stringing together | ||
// random integers from 1-15, guaranteeing the | ||
// result is a hex number of the given length | ||
randomHexNumberOfLength: (numberLength: number): string => { | ||
let res = ''; | ||
for (let i = 0; i < numberLength; i++) { | ||
// tslint:disable-next-line:custom-no-magic-numbers | ||
res = `${res}${numberUtils.randomNumberInclusive(1, 15).toString(16)}`; | ||
} | ||
return res; | ||
}, | ||
}; |
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
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