mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 06:37:23 +01:00
fix exports
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
import values from 'lodash/values';
|
||||
import keys from 'lodash/keys';
|
||||
|
||||
function trueRandom () {
|
||||
export function trueRandom () {
|
||||
return Math.random();
|
||||
}
|
||||
|
||||
// Get a random property from an object
|
||||
// returns random property (the value)
|
||||
module.exports = function randomVal (obj, options = {}) {
|
||||
export default function randomVal (obj, options = {}) {
|
||||
let array = options.key ? keys(obj) : values(obj);
|
||||
let random = options.predictableRandom || trueRandom();
|
||||
|
||||
@@ -16,6 +16,4 @@ module.exports = function randomVal (obj, options = {}) {
|
||||
let randomIndex = Math.floor(random * array.length);
|
||||
|
||||
return array[randomIndex];
|
||||
};
|
||||
|
||||
module.exports.trueRandom = trueRandom;
|
||||
}
|
||||
Reference in New Issue
Block a user